sparc32,leon: added LEON-common low-level PCI routines
Subsystems (2)
PATCH v2 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.
--- 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 | 252 +++++++++++++++++++++++++++++++++++++ drivers/pci/Makefile | 1 + 7 files changed, 300 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
@@ -1604,7 +1604,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 +251 -0
251 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
Re: [PATCH 1/2 v2] sparc32,leon: added LEON-common low-level PCI
Quoted 5 lines · Daniel Hellstrom
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]>
Quoted 11 lines
--- 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 | 252 +++++++++++++++++++++++++++++++++++++ drivers/pci/Makefile | 1 + 7 files changed, 300 insertions(+), 2 deletions(-) create mode 100644 arch/sparc/include/asm/pci_leon.h create mode 100644 arch/sparc/kernel/leon_pci.c
Hi Daniel.
Reading through this patch it looks like LEOON pci support is bolted on top of what we have rather than trying to integrate it a bit more.
I would like to see something like:
* include/asm/pcic.h intregated in pci_32.h
* leon specifics added to pci_32.h - with minimal ifdefs
Dunno abot the rest...
If i find time I will try to come up with a proposal later tonight.
Sam
Quoted 14 lines · Sam Ravnborg
Quoted 5 lines · Daniel Hellstrom
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]>Hi Daniel.
Reading through this patch it looks like LEOON pci support is bolted on top of what we have rather than trying to integrate it a bit more.
I would like to see something like:
Quoted 8 lines
*
include/asm/pcic.hintregated inpci_32.h
* leon specifics added topci_32.h- with minimal ifdefsDunno abot the rest...
If i find time I will try to come up with a proposal later tonight.
Sam
When I looked at this earlier, I was thinking that we might want to introduce a new KConfig variable, maybe CONFIG_LEON_PCI, to hide all this stuff behind so we don't have to do any complicated ifdefery or change any existing ifdefs.
Thanks,
Signature · 5 lines
Julian Calaby Email: [email protected] Profile: http://www.google.com/profiles/julian.calaby/ .Plan: http://sites.google.com/site/juliancalaby/
Re: [PATCH 1/2 v2] sparc32,leon: added LEON-common low-level PCI
In reply to Daniel HellstromQuoted 15 lines · Julian Calaby
Quoted 12 lines · Sam Ravnborg
Quoted 7 lines · Daniel Hellstrom
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]>Hi Daniel.
Quoted 8 lines
Quoted 8 lines
Reading through this patch it looks like LEOON pci support is bolted on top of what we have rather than trying to integrate it a bit more.
I would like to see something like:
*
include/asm/pcic.hintregated inpci_32.h
Do we really want that? I mean drivers that include pci.h does not need to know about pcic.h internals. I think is is quite clear the way it is, pcic.h is one PCI Host controller implementation, the host implementation shouldn't go to the header right? This is similar to LEON_PCI, is a common file for LEON PCI host controllers on the LEON platform. PCIC is common to machines which have PCI on the SUN platform.
Quoted 3 lines
Quoted 3 lines
* leon specifics added to
pci_32.h- with minimal ifdefs
Ok, could do that. Then I propose that I remove pci_leon.h, add some of that stuff into pci_32.h (will still be as many ifdefs as before) and I will create a leon_pci.h similar to pcic.h or add LEON-PCI specific stuff that nowone really wants to know about (leon_pci_info,leon_pci_init), or I add it to leon.h instead.
Quoted 4 lines
Quoted 4 lines
Dunno abot the rest...
If i find time I will try to come up with a proposal later tonight.
Quoted 10 lines
Quoted 3 lines
Sam
When I looked at this earlier, I was thinking that we might want to introduce a new KConfig variable, maybe
CONFIG_LEON_PCI, to hide all this stuff behind so we don't have to do any complicated ifdefery or change any existing ifdefs.
Ok, I will try to add a PCIC and a LEON_PCI config option. Then most ifdefs still will be there but only dependent on one thing: PCIC, LEON_PCI or PCI.
Does all this sound reasonable?
Daniel