mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-16 12:14:06 +00:00
Microblaze patches for 6.2-rc1
- Cleanup PCI support -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQQbPNTMvXmYlBPRwx7KSWXLKUoMIQUCY5G1nQAKCRDKSWXLKUoM IXs0AKCZevEWzLeT08mYlAAcwecYNFVxvgCeOqBIkvqhwqX892DoSf4/TrzJxQU= =77qE -----END PGP SIGNATURE----- Merge tag 'microblaze-v6.2' of git://git.monstr.eu/linux-2.6-microblaze Pull microblaze updates from Michal Simek: "Clean up PCI support which was pretty much copied and pasted from PowerPC long time ago for one custom platform which is not available for years. Also, the Xilinx/AMD PCIe team tested Microblaze with IP cores also used on ARM SOCs and clean up Microblaze code" * tag 'microblaze-v6.2' of git://git.monstr.eu/linux-2.6-microblaze: microblaze/PCI: Moving PCI iounmap and dependent code microblaze/PCI: Remove support for Xilinx PCI host bridge microblaze/PCI: Remove unused pci_iobar_pfn() and et al declarations microblaze/PCI: Remove unused sys_pciconfig_iobase() and et al declaration microblaze/PCI: Remove unused pci_address_to_pio() conversion of CPU address to I/O port microblaze/PCI: Remove unused PCI Indirect ops microblaze/PCI: Remove unused PCI BIOS resource allocation microblaze/PCI: Remove unused allocation & free of PCI host bridge structure microblaze/PCI: Remove unused device tree parsing for a host bridge resources microblaze/PCI: Remove unused PCI legacy IO's access on a bus microblaze/PCI: Remove unused PCI bus scan if configured as a host microblaze/PCI: Remove Null PCI config access unused functions microblaze/PCI: Remove unused early_read_config_byte() et al declarations
This commit is contained in:
commit
164f59000c
9 changed files with 37 additions and 1527 deletions
|
@ -215,11 +215,3 @@ config MB_MANAGER
|
|||
Say N here unless you know what you are doing.
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Bus Options"
|
||||
|
||||
config PCI_XILINX
|
||||
bool "Xilinx PCI host bridge support"
|
||||
depends on PCI
|
||||
|
||||
endmenu
|
||||
|
|
|
@ -19,7 +19,6 @@ CONFIG_HZ_100=y
|
|||
CONFIG_CMDLINE_BOOL=y
|
||||
CONFIG_CMDLINE_FORCE=y
|
||||
CONFIG_HIGHMEM=y
|
||||
CONFIG_PCI_XILINX=y
|
||||
CONFIG_MODULES=y
|
||||
CONFIG_MODULE_UNLOAD=y
|
||||
# CONFIG_BLK_DEV_BSG is not set
|
||||
|
|
|
@ -25,75 +25,17 @@ static inline int pcibios_vaddr_is_ioport(void __iomem *address)
|
|||
*/
|
||||
struct pci_controller {
|
||||
struct pci_bus *bus;
|
||||
char is_dynamic;
|
||||
struct device_node *dn;
|
||||
struct list_head list_node;
|
||||
struct device *parent;
|
||||
|
||||
int first_busno;
|
||||
int last_busno;
|
||||
|
||||
int self_busno;
|
||||
|
||||
void __iomem *io_base_virt;
|
||||
resource_size_t io_base_phys;
|
||||
|
||||
resource_size_t pci_io_size;
|
||||
|
||||
/* Some machines (PReP) have a non 1:1 mapping of
|
||||
* the PCI memory space in the CPU bus space
|
||||
*/
|
||||
resource_size_t pci_mem_offset;
|
||||
|
||||
/* Some machines have a special region to forward the ISA
|
||||
* "memory" cycles such as VGA memory regions. Left to 0
|
||||
* if unsupported
|
||||
*/
|
||||
resource_size_t isa_mem_phys;
|
||||
resource_size_t isa_mem_size;
|
||||
|
||||
struct pci_ops *ops;
|
||||
unsigned int __iomem *cfg_addr;
|
||||
void __iomem *cfg_data;
|
||||
|
||||
/*
|
||||
* Used for variants of PCI indirect handling and possible quirks:
|
||||
* SET_CFG_TYPE - used on 4xx or any PHB that does explicit type0/1
|
||||
* EXT_REG - provides access to PCI-e extended registers
|
||||
* SURPRESS_PRIMARY_BUS - we suppress the setting of PCI_PRIMARY_BUS
|
||||
* on Freescale PCI-e controllers since they used the PCI_PRIMARY_BUS
|
||||
* to determine which bus number to match on when generating type0
|
||||
* config cycles
|
||||
* NO_PCIE_LINK - the Freescale PCI-e controllers have issues with
|
||||
* hanging if we don't have link and try to do config cycles to
|
||||
* anything but the PHB. Only allow talking to the PHB if this is
|
||||
* set.
|
||||
* BIG_ENDIAN - cfg_addr is a big endian register
|
||||
* BROKEN_MRM - the 440EPx/GRx chips have an errata that causes hangs
|
||||
* on the PLB4. Effectively disable MRM commands by setting this.
|
||||
*/
|
||||
#define INDIRECT_TYPE_SET_CFG_TYPE 0x00000001
|
||||
#define INDIRECT_TYPE_EXT_REG 0x00000002
|
||||
#define INDIRECT_TYPE_SURPRESS_PRIMARY_BUS 0x00000004
|
||||
#define INDIRECT_TYPE_NO_PCIE_LINK 0x00000008
|
||||
#define INDIRECT_TYPE_BIG_ENDIAN 0x00000010
|
||||
#define INDIRECT_TYPE_BROKEN_MRM 0x00000020
|
||||
u32 indirect_type;
|
||||
|
||||
/* Currently, we limit ourselves to 1 IO range and 3 mem
|
||||
* ranges since the common pci_bus structure can't handle more
|
||||
*/
|
||||
struct resource io_resource;
|
||||
struct resource mem_resources[3];
|
||||
int global_number; /* PCI domain number */
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus)
|
||||
{
|
||||
return bus->sysdata;
|
||||
}
|
||||
|
||||
static inline int isa_vaddr_is_ioport(void __iomem *address)
|
||||
{
|
||||
/* No specific ISA handling on ppc32 at this stage, it
|
||||
|
@ -103,39 +45,5 @@ static inline int isa_vaddr_is_ioport(void __iomem *address)
|
|||
}
|
||||
#endif /* CONFIG_PCI */
|
||||
|
||||
/* These are used for config access before all the PCI probing
|
||||
has been done. */
|
||||
extern int early_read_config_byte(struct pci_controller *hose, int bus,
|
||||
int dev_fn, int where, u8 *val);
|
||||
extern int early_read_config_word(struct pci_controller *hose, int bus,
|
||||
int dev_fn, int where, u16 *val);
|
||||
extern int early_read_config_dword(struct pci_controller *hose, int bus,
|
||||
int dev_fn, int where, u32 *val);
|
||||
extern int early_write_config_byte(struct pci_controller *hose, int bus,
|
||||
int dev_fn, int where, u8 val);
|
||||
extern int early_write_config_word(struct pci_controller *hose, int bus,
|
||||
int dev_fn, int where, u16 val);
|
||||
extern int early_write_config_dword(struct pci_controller *hose, int bus,
|
||||
int dev_fn, int where, u32 val);
|
||||
|
||||
extern int early_find_capability(struct pci_controller *hose, int bus,
|
||||
int dev_fn, int cap);
|
||||
|
||||
extern void setup_indirect_pci(struct pci_controller *hose,
|
||||
resource_size_t cfg_addr,
|
||||
resource_size_t cfg_data, u32 flags);
|
||||
|
||||
/* Get the PCI host controller for an OF device */
|
||||
extern struct pci_controller *pci_find_hose_for_OF_device(
|
||||
struct device_node *node);
|
||||
|
||||
/* Fill up host controller resources from the OF node */
|
||||
extern void pci_process_bridge_OF_ranges(struct pci_controller *hose,
|
||||
struct device_node *dev, int primary);
|
||||
|
||||
/* Allocate & free a PCI host bridge structure */
|
||||
extern struct pci_controller *pcibios_alloc_controller(struct device_node *dev);
|
||||
extern void pcibios_free_controller(struct pci_controller *phb);
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* _ASM_MICROBLAZE_PCI_BRIDGE_H */
|
||||
|
|
|
@ -21,15 +21,6 @@
|
|||
#define PCIBIOS_MIN_IO 0x1000
|
||||
#define PCIBIOS_MIN_MEM 0x10000000
|
||||
|
||||
/* Values for the `which' argument to sys_pciconfig_iobase syscall. */
|
||||
#define IOBASE_BRIDGE_NUMBER 0
|
||||
#define IOBASE_MEMORY 1
|
||||
#define IOBASE_IO 2
|
||||
#define IOBASE_ISA_IO 3
|
||||
#define IOBASE_ISA_MEM 4
|
||||
|
||||
#define pcibios_scan_all_fns(a, b) 0
|
||||
|
||||
/*
|
||||
* Set this to 1 if you want the kernel to re-assign all PCI
|
||||
* bus numbers (don't do that on ppc64 yet !)
|
||||
|
@ -41,33 +32,13 @@ extern int pci_domain_nr(struct pci_bus *bus);
|
|||
/* Decide whether to display the domain number in /proc */
|
||||
extern int pci_proc_domain(struct pci_bus *bus);
|
||||
|
||||
struct vm_area_struct;
|
||||
|
||||
/* Tell PCI code what kind of PCI resource mappings we support */
|
||||
#define HAVE_PCI_MMAP 1
|
||||
#define ARCH_GENERIC_PCI_MMAP_RESOURCE 1
|
||||
#define arch_can_pci_mmap_io() 1
|
||||
|
||||
extern int pci_legacy_read(struct pci_bus *bus, loff_t port, u32 *val,
|
||||
size_t count);
|
||||
extern int pci_legacy_write(struct pci_bus *bus, loff_t port, u32 val,
|
||||
size_t count);
|
||||
extern int pci_mmap_legacy_page_range(struct pci_bus *bus,
|
||||
struct vm_area_struct *vma,
|
||||
enum pci_mmap_state mmap_state);
|
||||
|
||||
#define HAVE_PCI_LEGACY 1
|
||||
|
||||
extern void pcibios_resource_survey(void);
|
||||
|
||||
struct file;
|
||||
|
||||
/* This part of code was originally in xilinx-pci.h */
|
||||
#ifdef CONFIG_PCI_XILINX
|
||||
extern void __init xilinx_pci_init(void);
|
||||
#else
|
||||
static inline void __init xilinx_pci_init(void) { return; }
|
||||
#endif
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* __ASM_MICROBLAZE_PCI_H */
|
||||
|
|
|
@ -3,5 +3,4 @@
|
|||
# Makefile
|
||||
#
|
||||
|
||||
obj-$(CONFIG_PCI) += pci-common.o indirect_pci.o iomap.o
|
||||
obj-$(CONFIG_PCI_XILINX) += xilinx_pci.o
|
||||
obj-$(CONFIG_PCI) += iomap.o
|
||||
|
|
|
@ -1,158 +0,0 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Support for indirect PCI bridges.
|
||||
*
|
||||
* Copyright (C) 1998 Gabriel Paubert.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
#include <linux/io.h>
|
||||
#include <asm/pci-bridge.h>
|
||||
|
||||
static int
|
||||
indirect_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
|
||||
int len, u32 *val)
|
||||
{
|
||||
struct pci_controller *hose = pci_bus_to_host(bus);
|
||||
volatile void __iomem *cfg_data;
|
||||
u8 cfg_type = 0;
|
||||
u32 bus_no, reg;
|
||||
|
||||
if (hose->indirect_type & INDIRECT_TYPE_NO_PCIE_LINK) {
|
||||
if (bus->number != hose->first_busno)
|
||||
return PCIBIOS_DEVICE_NOT_FOUND;
|
||||
if (devfn != 0)
|
||||
return PCIBIOS_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (hose->indirect_type & INDIRECT_TYPE_SET_CFG_TYPE)
|
||||
if (bus->number != hose->first_busno)
|
||||
cfg_type = 1;
|
||||
|
||||
bus_no = (bus->number == hose->first_busno) ?
|
||||
hose->self_busno : bus->number;
|
||||
|
||||
if (hose->indirect_type & INDIRECT_TYPE_EXT_REG)
|
||||
reg = ((offset & 0xf00) << 16) | (offset & 0xfc);
|
||||
else
|
||||
reg = offset & 0xfc; /* Only 3 bits for function */
|
||||
|
||||
if (hose->indirect_type & INDIRECT_TYPE_BIG_ENDIAN)
|
||||
out_be32(hose->cfg_addr, (0x80000000 | (bus_no << 16) |
|
||||
(devfn << 8) | reg | cfg_type));
|
||||
else
|
||||
out_le32(hose->cfg_addr, (0x80000000 | (bus_no << 16) |
|
||||
(devfn << 8) | reg | cfg_type));
|
||||
|
||||
/*
|
||||
* Note: the caller has already checked that offset is
|
||||
* suitably aligned and that len is 1, 2 or 4.
|
||||
*/
|
||||
cfg_data = hose->cfg_data + (offset & 3); /* Only 3 bits for function */
|
||||
switch (len) {
|
||||
case 1:
|
||||
*val = in_8(cfg_data);
|
||||
break;
|
||||
case 2:
|
||||
*val = in_le16(cfg_data);
|
||||
break;
|
||||
default:
|
||||
*val = in_le32(cfg_data);
|
||||
break;
|
||||
}
|
||||
return PCIBIOS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
static int
|
||||
indirect_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
|
||||
int len, u32 val)
|
||||
{
|
||||
struct pci_controller *hose = pci_bus_to_host(bus);
|
||||
volatile void __iomem *cfg_data;
|
||||
u8 cfg_type = 0;
|
||||
u32 bus_no, reg;
|
||||
|
||||
if (hose->indirect_type & INDIRECT_TYPE_NO_PCIE_LINK) {
|
||||
if (bus->number != hose->first_busno)
|
||||
return PCIBIOS_DEVICE_NOT_FOUND;
|
||||
if (devfn != 0)
|
||||
return PCIBIOS_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (hose->indirect_type & INDIRECT_TYPE_SET_CFG_TYPE)
|
||||
if (bus->number != hose->first_busno)
|
||||
cfg_type = 1;
|
||||
|
||||
bus_no = (bus->number == hose->first_busno) ?
|
||||
hose->self_busno : bus->number;
|
||||
|
||||
if (hose->indirect_type & INDIRECT_TYPE_EXT_REG)
|
||||
reg = ((offset & 0xf00) << 16) | (offset & 0xfc);
|
||||
else
|
||||
reg = offset & 0xfc;
|
||||
|
||||
if (hose->indirect_type & INDIRECT_TYPE_BIG_ENDIAN)
|
||||
out_be32(hose->cfg_addr, (0x80000000 | (bus_no << 16) |
|
||||
(devfn << 8) | reg | cfg_type));
|
||||
else
|
||||
out_le32(hose->cfg_addr, (0x80000000 | (bus_no << 16) |
|
||||
(devfn << 8) | reg | cfg_type));
|
||||
|
||||
/* suppress setting of PCI_PRIMARY_BUS */
|
||||
if (hose->indirect_type & INDIRECT_TYPE_SURPRESS_PRIMARY_BUS)
|
||||
if ((offset == PCI_PRIMARY_BUS) &&
|
||||
(bus->number == hose->first_busno))
|
||||
val &= 0xffffff00;
|
||||
|
||||
/* Workaround for PCI_28 Errata in 440EPx/GRx */
|
||||
if ((hose->indirect_type & INDIRECT_TYPE_BROKEN_MRM) &&
|
||||
offset == PCI_CACHE_LINE_SIZE) {
|
||||
val = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Note: the caller has already checked that offset is
|
||||
* suitably aligned and that len is 1, 2 or 4.
|
||||
*/
|
||||
cfg_data = hose->cfg_data + (offset & 3);
|
||||
switch (len) {
|
||||
case 1:
|
||||
out_8(cfg_data, val);
|
||||
break;
|
||||
case 2:
|
||||
out_le16(cfg_data, val);
|
||||
break;
|
||||
default:
|
||||
out_le32(cfg_data, val);
|
||||
break;
|
||||
}
|
||||
|
||||
return PCIBIOS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
static struct pci_ops indirect_pci_ops = {
|
||||
.read = indirect_read_config,
|
||||
.write = indirect_write_config,
|
||||
};
|
||||
|
||||
void __init
|
||||
setup_indirect_pci(struct pci_controller *hose,
|
||||
resource_size_t cfg_addr,
|
||||
resource_size_t cfg_data, u32 flags)
|
||||
{
|
||||
resource_size_t base = cfg_addr & PAGE_MASK;
|
||||
void __iomem *mbase;
|
||||
|
||||
mbase = ioremap(base, PAGE_SIZE);
|
||||
hose->cfg_addr = mbase + (cfg_addr & ~PAGE_MASK);
|
||||
if ((cfg_data & PAGE_MASK) != base)
|
||||
mbase = ioremap(cfg_data & PAGE_MASK, PAGE_SIZE);
|
||||
hose->cfg_data = mbase + (cfg_data & ~PAGE_MASK);
|
||||
hose->ops = &indirect_pci_ops;
|
||||
hose->indirect_type = flags;
|
||||
}
|
|
@ -11,6 +11,42 @@
|
|||
#include <linux/io.h>
|
||||
#include <asm/pci-bridge.h>
|
||||
|
||||
static DEFINE_SPINLOCK(hose_spinlock);
|
||||
LIST_HEAD(hose_list);
|
||||
|
||||
unsigned long isa_io_base;
|
||||
EXPORT_SYMBOL(isa_io_base);
|
||||
|
||||
static resource_size_t pcibios_io_size(const struct pci_controller *hose)
|
||||
{
|
||||
return resource_size(&hose->io_resource);
|
||||
}
|
||||
|
||||
int pcibios_vaddr_is_ioport(void __iomem *address)
|
||||
{
|
||||
int ret = 0;
|
||||
struct pci_controller *hose;
|
||||
resource_size_t size;
|
||||
|
||||
spin_lock(&hose_spinlock);
|
||||
list_for_each_entry(hose, &hose_list, list_node) {
|
||||
size = pcibios_io_size(hose);
|
||||
if (address >= hose->io_base_virt &&
|
||||
address < (hose->io_base_virt + size)) {
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
spin_unlock(&hose_spinlock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Display the domain number in /proc */
|
||||
int pci_proc_domain(struct pci_bus *bus)
|
||||
{
|
||||
return pci_domain_nr(bus);
|
||||
}
|
||||
|
||||
void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
|
||||
{
|
||||
if (isa_vaddr_is_ioport(addr))
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,170 +0,0 @@
|
|||
/*
|
||||
* PCI support for Xilinx plbv46_pci soft-core which can be used on
|
||||
* Xilinx Virtex ML410 / ML510 boards.
|
||||
*
|
||||
* Copyright 2009 Roderick Colenbrander
|
||||
* Copyright 2009 Secret Lab Technologies Ltd.
|
||||
*
|
||||
* The pci bridge fixup code was copied from ppc4xx_pci.c and was written
|
||||
* by Benjamin Herrenschmidt.
|
||||
* Copyright 2007 Ben. Herrenschmidt <benh@kernel.crashing.org>, IBM Corp.
|
||||
*
|
||||
* This file is licensed under the terms of the GNU General Public License
|
||||
* version 2. This program is licensed "as is" without any warranty of any
|
||||
* kind, whether express or implied.
|
||||
*/
|
||||
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#define XPLB_PCI_ADDR 0x10c
|
||||
#define XPLB_PCI_DATA 0x110
|
||||
#define XPLB_PCI_BUS 0x114
|
||||
|
||||
#define PCI_HOST_ENABLE_CMD (PCI_COMMAND_SERR | PCI_COMMAND_PARITY | \
|
||||
PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY)
|
||||
|
||||
static const struct of_device_id xilinx_pci_match[] = {
|
||||
{ .compatible = "xlnx,plbv46-pci-1.03.a", },
|
||||
{}
|
||||
};
|
||||
|
||||
/**
|
||||
* xilinx_pci_fixup_bridge - Block Xilinx PHB configuration.
|
||||
*/
|
||||
static void xilinx_pci_fixup_bridge(struct pci_dev *dev)
|
||||
{
|
||||
struct pci_controller *hose;
|
||||
int i;
|
||||
|
||||
if (dev->devfn || dev->bus->self)
|
||||
return;
|
||||
|
||||
hose = pci_bus_to_host(dev->bus);
|
||||
if (!hose)
|
||||
return;
|
||||
|
||||
if (!of_match_node(xilinx_pci_match, hose->dn))
|
||||
return;
|
||||
|
||||
/* Hide the PCI host BARs from the kernel as their content doesn't
|
||||
* fit well in the resource management
|
||||
*/
|
||||
for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
|
||||
dev->resource[i].start = 0;
|
||||
dev->resource[i].end = 0;
|
||||
dev->resource[i].flags = 0;
|
||||
}
|
||||
|
||||
dev_info(&dev->dev, "Hiding Xilinx plb-pci host bridge resources %s\n",
|
||||
pci_name(dev));
|
||||
}
|
||||
DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, xilinx_pci_fixup_bridge);
|
||||
|
||||
#ifdef DEBUG
|
||||
/**
|
||||
* xilinx_pci_exclude_device - Don't do config access for non-root bus
|
||||
*
|
||||
* This is a hack. Config access to any bus other than bus 0 does not
|
||||
* currently work on the ML510 so we prevent it here.
|
||||
*/
|
||||
static int
|
||||
xilinx_pci_exclude_device(struct pci_controller *hose, u_char bus, u8 devfn)
|
||||
{
|
||||
return (bus != 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* xilinx_early_pci_scan - List pci config space for available devices
|
||||
*
|
||||
* List pci devices in very early phase.
|
||||
*/
|
||||
static void __init xilinx_early_pci_scan(struct pci_controller *hose)
|
||||
{
|
||||
u32 bus = 0;
|
||||
u32 val, dev, func, offset;
|
||||
|
||||
/* Currently we have only 2 device connected - up-to 32 devices */
|
||||
for (dev = 0; dev < 2; dev++) {
|
||||
/* List only first function number - up-to 8 functions */
|
||||
for (func = 0; func < 1; func++) {
|
||||
pr_info("%02x:%02x:%02x", bus, dev, func);
|
||||
/* read the first 64 standardized bytes */
|
||||
/* Up-to 192 bytes can be list of capabilities */
|
||||
for (offset = 0; offset < 64; offset += 4) {
|
||||
early_read_config_dword(hose, bus,
|
||||
PCI_DEVFN(dev, func), offset, &val);
|
||||
if (offset == 0 && val == 0xFFFFFFFF) {
|
||||
pr_cont("\nABSENT");
|
||||
break;
|
||||
}
|
||||
if (!(offset % 0x10))
|
||||
pr_cont("\n%04x: ", offset);
|
||||
|
||||
pr_cont("%08x ", val);
|
||||
}
|
||||
pr_info("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
static void __init xilinx_early_pci_scan(struct pci_controller *hose)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* xilinx_pci_init - Find and register a Xilinx PCI host bridge
|
||||
*/
|
||||
void __init xilinx_pci_init(void)
|
||||
{
|
||||
struct pci_controller *hose;
|
||||
struct resource r;
|
||||
void __iomem *pci_reg;
|
||||
struct device_node *pci_node;
|
||||
|
||||
pci_node = of_find_matching_node(NULL, xilinx_pci_match);
|
||||
if (!pci_node)
|
||||
return;
|
||||
|
||||
if (of_address_to_resource(pci_node, 0, &r)) {
|
||||
pr_err("xilinx-pci: cannot resolve base address\n");
|
||||
return;
|
||||
}
|
||||
|
||||
hose = pcibios_alloc_controller(pci_node);
|
||||
if (!hose) {
|
||||
pr_err("xilinx-pci: pcibios_alloc_controller() failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Setup config space */
|
||||
setup_indirect_pci(hose, r.start + XPLB_PCI_ADDR,
|
||||
r.start + XPLB_PCI_DATA,
|
||||
INDIRECT_TYPE_SET_CFG_TYPE);
|
||||
|
||||
/* According to the xilinx plbv46_pci documentation the soft-core starts
|
||||
* a self-init when the bus master enable bit is set. Without this bit
|
||||
* set the pci bus can't be scanned.
|
||||
*/
|
||||
early_write_config_word(hose, 0, 0, PCI_COMMAND, PCI_HOST_ENABLE_CMD);
|
||||
|
||||
/* Set the max latency timer to 255 */
|
||||
early_write_config_byte(hose, 0, 0, PCI_LATENCY_TIMER, 0xff);
|
||||
|
||||
/* Set the max bus number to 255, and bus/subbus no's to 0 */
|
||||
pci_reg = of_iomap(pci_node, 0);
|
||||
WARN_ON(!pci_reg);
|
||||
out_be32(pci_reg + XPLB_PCI_BUS, 0x000000ff);
|
||||
iounmap(pci_reg);
|
||||
|
||||
/* Register the host bridge with the linux kernel! */
|
||||
pci_process_bridge_OF_ranges(hose, pci_node,
|
||||
INDIRECT_TYPE_SET_CFG_TYPE);
|
||||
|
||||
pr_info("xilinx-pci: Registered PCI host bridge\n");
|
||||
xilinx_early_pci_scan(hose);
|
||||
}
|
Loading…
Add table
Reference in a new issue