sparc32,leon: added LEON-common low-level PCI routines
Subsystems (2)
PATCH 1/2 sparc32,leon: added LEON-common low-level PCI routines
The LEON architecture does not have a BIOS or bootloader that initializes PCI for us, instead Linux generic PCI layer is used to set up resources and IRQ.
Signed-off-by Daniel Hellstrom <[email protected]>
--- arch/sparc/include/asm/pci_32.h | 5 + arch/sparc/include/asm/pci_leon.h | 36 ++++++ arch/sparc/include/asm/pcic.h | 2 +- arch/sparc/kernel/Makefile | 4 + arch/sparc/kernel/entry.S | 2 +- arch/sparc/kernel/leon_pci.c | 237 +++++++++++++++++++++++++++++++++++++ drivers/pci/Makefile | 1 + 7 files changed, 285 insertions(+), 2 deletions(-) create mode 100644 arch/sparc/include/asm/pci_leon.h create mode 100644 arch/sparc/kernel/leon_pci.c
arch/sparc/include/asm/pci_32.h +5 -0
@@ -47,7 +47,12 @@ extern struct device_node *pci_device_to_OF_node(struct pci_dev *pdev);#endif /* __KERNEL__ */ +#ifndef CONFIG_SPARC_LEON /* generic pci stuff */ #include <asm-generic/pci.h> +#else +/* LEON PCI cores need its own definitions */ +#include <asm/pci_leon.h> +#endif #endif /* __SPARC_PCI_H */
arch/sparc/include/asm/pci_leon.h new file +36 -0
@@ -0,0 +1,36 @@ +/* +* asm/pci_leon.h +* +* Copyright (C) 2011 Aeroflex Gaisler AB, Daniel Hellstrom +*/ + +#ifndef _ASM_PCI_LEON_H_ +#define _ASM_PCI_LEON_H_ + +/* On LEON PCI Memory space is mapped 1:1 with physical address space */ + +extern void +pcibios_resource_to_bus (struct pci_dev *dev,struct pci_bus_region *region, +struct resource *res); + +extern void +pcibios_bus_to_resource (struct pci_dev *dev,struct resource *res, +struct pci_bus_region *region); + +static inline int pci_get_legacy_ide_irq (struct pci_dev *dev,int channel) +{ +return PCI_IRQ_NONE ; +} + +/* PCI related definitions */ +struct leon_pci_info { +struct pci_ops *ops; +struct resource io_space; +struct resource mem_space; +int (*map_irq)(struct pci_dev *dev,u8 slot,u8 pin); +}; + +extern void leon_pci_init (struct platform_device *ofdev, +struct leon_pci_info *info); + +#endif /* _ASM_PCI_LEON_H_ */
arch/sparc/include/asm/pcic.h +1 -1
@@ -29,7 +29,7 @@ struct linux_pcic {int pcic_imdim; }; -#ifdef CONFIG_PCI +#if defined(CONFIG_PCI ) && !defined(CONFIG_SPARC_LEON )extern int pcic_present (void );extern int pcic_probe (void );extern void pci_time_init (void );
arch/sparc/kernel/Makefile +4 -0
@@ -73,7 +73,11 @@ obj-$(CONFIG_SPARC64_SMP) += cpumap.o obj-y += dma.o +ifndef CONFIG_SPARC_LEON obj-$(CONFIG_SPARC32_PCI) += pcic.o +else +obj-$(CONFIG_SPARC32_PCI) += leon_pci.o +endif obj-$(CONFIG_SMP) += trampoline_$(BITS).o smp_$(BITS).o obj-$(CONFIG_SPARC32_SMP) += sun4m_smp.o sun4d_smp.o leon_smp.o
arch/sparc/kernel/entry.S +1 -1
@@ -1567,7 +1567,7 @@ restore_current: retl nop -#ifdef CONFIG_PCI +#if defined(CONFIG_PCI) && !defined(CONFIG_SPARC_LEON) #include <asm/pcic.h> .align 4
arch/sparc/kernel/leon_pci.c new file +236 -0
236 lines not on this page · raw message
drivers/pci/Makefile +1 -0
@@ -51,6 +51,7 @@ obj-$(CONFIG_X86_VISWS) += setup-irq.o obj-$(CONFIG_MN10300) += setup-bus.o obj-$(CONFIG_MICROBLAZE) += setup-bus.o obj-$(CONFIG_TILE) += setup-bus.o setup-irq.o +obj-$(CONFIG_SPARC_LEON) += setup-bus.o setup-irq.o # # ACPI Related PCI FW Functions
Signature · 1 line
1.5.4