* [PATCH 0/2] powerpc: pci cleanup [rev2] @ 2008-06-26 17:07 John Rigby 2008-06-26 17:07 ` [PATCH 1/2] powerpc: pci config " John Rigby 0 siblings, 1 reply; 7+ messages in thread From: John Rigby @ 2008-06-26 17:07 UTC (permalink / raw) To: Kumar Gala; +Cc: linuxppc-dev, John Rigby patch 1/2 cleans up powerpc pci config Thanks to Michael Ellerman for his comments. This new version calls the new config var PPC_PCI_CHOICE instead of PPC_HAS_PCI patch 2/2 moves mpc83xx_add_bridge to fsl_pci.c This is unchanged. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] powerpc: pci config cleanup [rev2] 2008-06-26 17:07 [PATCH 0/2] powerpc: pci cleanup [rev2] John Rigby @ 2008-06-26 17:07 ` John Rigby 2008-06-26 17:07 ` [PATCH 2/2] powerpc: Move mpc83xx_add_bridge to fsl_pci.c [rev2] John Rigby ` (2 more replies) 0 siblings, 3 replies; 7+ messages in thread From: John Rigby @ 2008-06-26 17:07 UTC (permalink / raw) To: Kumar Gala; +Cc: linuxppc-dev, John Rigby Choosing PCI or not at config time is allowed on some platforms via an if expression in arch/powerpc/Kconfig. To add a new platform with PCI support selectable at config time, you must change the if expression. This patch makes this easier by changing: bool "PCI support" if <long expression> to bool "PCI support" if PPC_PCI_CHOICE and adding select PPC_PCI_CHOICE to all the config nodes that were previously in the PCI if expression. Platforms with unconditional PCI support continue to just select PCI in their config nodes. Signed-off-by: John Rigby <jrigby@freescale.com> --- arch/powerpc/Kconfig | 12 ++++++++---- arch/powerpc/platforms/52xx/Kconfig | 1 + arch/powerpc/platforms/83xx/Kconfig | 1 + arch/powerpc/platforms/85xx/Kconfig | 2 +- arch/powerpc/platforms/86xx/Kconfig | 2 ++ arch/powerpc/platforms/Kconfig | 1 + arch/powerpc/platforms/Kconfig.cputype | 2 ++ arch/powerpc/platforms/iseries/Kconfig | 1 + arch/powerpc/platforms/ps3/Kconfig | 1 + arch/powerpc/platforms/pseries/Kconfig | 1 + 10 files changed, 19 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 3934e26..36c8d1c 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -542,11 +542,15 @@ config FSL_LBC config MCA bool +# Platforms that what PCI turned unconditionally just do select PCI +# in their config node. Platforms that want to choose at config +# time should select PPC_PCI_CHOICE +config PPC_PCI_CHOICE + bool + config PCI - bool "PCI support" if 40x || CPM2 || PPC_83xx || PPC_85xx || PPC_86xx \ - || PPC_MPC52xx || (EMBEDDED && (PPC_PSERIES || PPC_ISERIES)) \ - || PPC_PS3 || 44x - default y if !40x && !CPM2 && !8xx && !PPC_MPC512x && !PPC_83xx \ + bool "PCI support" if PPC_PCI_CHOICE + default y if !40x && !CPM2 && !8xx && !PPC_83xx \ && !PPC_85xx && !PPC_86xx default PCI_PERMEDIA if !4xx && !CPM2 && !8xx default PCI_QSPAN if !4xx && !CPM2 && 8xx diff --git a/arch/powerpc/platforms/52xx/Kconfig b/arch/powerpc/platforms/52xx/Kconfig index acd2fc8..d664b1b 100644 --- a/arch/powerpc/platforms/52xx/Kconfig +++ b/arch/powerpc/platforms/52xx/Kconfig @@ -3,6 +3,7 @@ config PPC_MPC52xx depends on PPC_MULTIPLATFORM && PPC32 select FSL_SOC select PPC_CLOCK + select PPC_PCI_CHOICE config PPC_MPC5200_SIMPLE bool "Generic support for simple MPC5200 based boards" diff --git a/arch/powerpc/platforms/83xx/Kconfig b/arch/powerpc/platforms/83xx/Kconfig index 583b0c7..0a306eb 100644 --- a/arch/powerpc/platforms/83xx/Kconfig +++ b/arch/powerpc/platforms/83xx/Kconfig @@ -2,6 +2,7 @@ menuconfig MPC83xx bool "83xx Board Type" depends on PPC_83xx select PPC_UDBG_16550 + select PPC_PCI_CHOICE select PPC_INDIRECT_PCI if MPC83xx diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig index 7ff29d5..82a3023 100644 --- a/arch/powerpc/platforms/85xx/Kconfig +++ b/arch/powerpc/platforms/85xx/Kconfig @@ -2,8 +2,8 @@ menuconfig MPC85xx bool "Machine Type" depends on PPC_85xx select PPC_UDBG_16550 - select PPC_INDIRECT_PCI if PCI select MPIC + select PPC_PCI_CHOICE select FSL_PCI if PCI select SERIAL_8250_SHARE_IRQ if SERIAL_8250 default y diff --git a/arch/powerpc/platforms/86xx/Kconfig b/arch/powerpc/platforms/86xx/Kconfig index 053f49a..3500e67 100644 --- a/arch/powerpc/platforms/86xx/Kconfig +++ b/arch/powerpc/platforms/86xx/Kconfig @@ -28,6 +28,7 @@ endchoice config MPC8641 bool + select PPC_PCI_CHOICE select FSL_PCI if PCI select PPC_UDBG_16550 select MPIC @@ -35,6 +36,7 @@ config MPC8641 config MPC8610 bool + select PPC_PCI_CHOICE select FSL_PCI if PCI select PPC_UDBG_16550 select MPIC diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig index 87454c5..aead68a 100644 --- a/arch/powerpc/platforms/Kconfig +++ b/arch/powerpc/platforms/Kconfig @@ -280,6 +280,7 @@ config CPM2 depends on MPC85xx || 8260 select CPM select PPC_LIB_RHEAP + select PPC_PCI_CHOICE help The CPM2 (Communications Processor Module) is a coprocessor on embedded CPUs made by Freescale. Selecting this option means that diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype index f7efaa9..01e7561 100644 --- a/arch/powerpc/platforms/Kconfig.cputype +++ b/arch/powerpc/platforms/Kconfig.cputype @@ -42,12 +42,14 @@ config 40x select PPC_DCR_NATIVE select PPC_UDBG_16550 select 4xx_SOC + select PPC_PCI_CHOICE config 44x bool "AMCC 44x" select PPC_DCR_NATIVE select PPC_UDBG_16550 select 4xx_SOC + select PPC_PCI_CHOICE config E200 bool "Freescale e200" diff --git a/arch/powerpc/platforms/iseries/Kconfig b/arch/powerpc/platforms/iseries/Kconfig index 761d9e9..ea3e541 100644 --- a/arch/powerpc/platforms/iseries/Kconfig +++ b/arch/powerpc/platforms/iseries/Kconfig @@ -2,6 +2,7 @@ config PPC_ISERIES bool "IBM Legacy iSeries" depends on PPC_MULTIPLATFORM && PPC64 select PPC_INDIRECT_IO + select PPC_PCI_CHOICE if EMBEDDED menu "iSeries device drivers" depends on PPC_ISERIES diff --git a/arch/powerpc/platforms/ps3/Kconfig b/arch/powerpc/platforms/ps3/Kconfig index a5f4e95..920cf7a 100644 --- a/arch/powerpc/platforms/ps3/Kconfig +++ b/arch/powerpc/platforms/ps3/Kconfig @@ -8,6 +8,7 @@ config PPC_PS3 select USB_ARCH_HAS_EHCI select USB_EHCI_BIG_ENDIAN_MMIO select MEMORY_HOTPLUG + select PPC_PCI_CHOICE help This option enables support for the Sony PS3 game console and other platforms using the PS3 hypervisor. Enabling this diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig index 07fe5b6..757c029 100644 --- a/arch/powerpc/platforms/pseries/Kconfig +++ b/arch/powerpc/platforms/pseries/Kconfig @@ -7,6 +7,7 @@ config PPC_PSERIES select RTAS_ERROR_LOGGING select PPC_UDBG_16550 select PPC_NATIVE + select PPC_PCI_CHOICE if EMBEDDED default y config PPC_SPLPAR -- 1.5.6.rc0.46.gd2b3 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] powerpc: Move mpc83xx_add_bridge to fsl_pci.c [rev2] 2008-06-26 17:07 ` [PATCH 1/2] powerpc: pci config " John Rigby @ 2008-06-26 17:07 ` John Rigby 2008-06-29 6:01 ` Grant Likely 2008-07-15 13:22 ` Kumar Gala 2008-06-29 5:58 ` [PATCH 1/2] powerpc: pci config cleanup [rev2] Grant Likely 2008-07-15 13:22 ` Kumar Gala 2 siblings, 2 replies; 7+ messages in thread From: John Rigby @ 2008-06-26 17:07 UTC (permalink / raw) To: Kumar Gala; +Cc: linuxppc-dev, John Rigby This allows other platforms with the same pci block like MPC5121 to use it. Signed-off-by: John Rigby <jrigby@freescale.com> --- arch/powerpc/platforms/83xx/Kconfig | 2 +- arch/powerpc/platforms/83xx/Makefile | 1 - arch/powerpc/platforms/83xx/mpc831x_rdb.c | 1 + arch/powerpc/platforms/83xx/mpc832x_mds.c | 1 + arch/powerpc/platforms/83xx/mpc832x_rdb.c | 1 + arch/powerpc/platforms/83xx/mpc834x_itx.c | 1 + arch/powerpc/platforms/83xx/mpc834x_mds.c | 1 + arch/powerpc/platforms/83xx/mpc836x_mds.c | 1 + arch/powerpc/platforms/83xx/mpc837x_mds.c | 1 + arch/powerpc/platforms/83xx/mpc837x_rdb.c | 1 + arch/powerpc/platforms/83xx/mpc83xx.h | 1 - arch/powerpc/platforms/83xx/pci.c | 91 ----------------------------- arch/powerpc/platforms/83xx/sbc834x.c | 1 + arch/powerpc/sysdev/fsl_pci.c | 61 +++++++++++++++++++ arch/powerpc/sysdev/fsl_pci.h | 1 + 15 files changed, 72 insertions(+), 94 deletions(-) delete mode 100644 arch/powerpc/platforms/83xx/pci.c diff --git a/arch/powerpc/platforms/83xx/Kconfig b/arch/powerpc/platforms/83xx/Kconfig index 0a306eb..ca2c149 100644 --- a/arch/powerpc/platforms/83xx/Kconfig +++ b/arch/powerpc/platforms/83xx/Kconfig @@ -3,7 +3,7 @@ menuconfig MPC83xx depends on PPC_83xx select PPC_UDBG_16550 select PPC_PCI_CHOICE - select PPC_INDIRECT_PCI + select FSL_PCI if PCI if MPC83xx diff --git a/arch/powerpc/platforms/83xx/Makefile b/arch/powerpc/platforms/83xx/Makefile index 76494be..59c413c 100644 --- a/arch/powerpc/platforms/83xx/Makefile +++ b/arch/powerpc/platforms/83xx/Makefile @@ -2,7 +2,6 @@ # Makefile for the PowerPC 83xx linux kernel. # obj-y := misc.o usb.o -obj-$(CONFIG_PCI) += pci.o obj-$(CONFIG_MPC831x_RDB) += mpc831x_rdb.o obj-$(CONFIG_MPC832x_RDB) += mpc832x_rdb.o obj-$(CONFIG_MPC834x_MDS) += mpc834x_mds.o diff --git a/arch/powerpc/platforms/83xx/mpc831x_rdb.c b/arch/powerpc/platforms/83xx/mpc831x_rdb.c index c4db517..a428f8d 100644 --- a/arch/powerpc/platforms/83xx/mpc831x_rdb.c +++ b/arch/powerpc/platforms/83xx/mpc831x_rdb.c @@ -19,6 +19,7 @@ #include <asm/time.h> #include <asm/ipic.h> #include <asm/udbg.h> +#include <sysdev/fsl_pci.h> #include "mpc83xx.h" diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c index 6dbc6ea..dd4be4a 100644 --- a/arch/powerpc/platforms/83xx/mpc832x_mds.c +++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c @@ -36,6 +36,7 @@ #include <asm/prom.h> #include <asm/udbg.h> #include <sysdev/fsl_soc.h> +#include <sysdev/fsl_pci.h> #include <asm/qe.h> #include <asm/qe_ic.h> diff --git a/arch/powerpc/platforms/83xx/mpc832x_rdb.c b/arch/powerpc/platforms/83xx/mpc832x_rdb.c index e7f706b..f049d69 100644 --- a/arch/powerpc/platforms/83xx/mpc832x_rdb.c +++ b/arch/powerpc/platforms/83xx/mpc832x_rdb.c @@ -27,6 +27,7 @@ #include <asm/qe.h> #include <asm/qe_ic.h> #include <sysdev/fsl_soc.h> +#include <sysdev/fsl_pci.h> #include "mpc83xx.h" diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.c b/arch/powerpc/platforms/83xx/mpc834x_itx.c index 50e8f63..7301d77 100644 --- a/arch/powerpc/platforms/83xx/mpc834x_itx.c +++ b/arch/powerpc/platforms/83xx/mpc834x_itx.c @@ -35,6 +35,7 @@ #include <asm/prom.h> #include <asm/udbg.h> #include <sysdev/fsl_soc.h> +#include <sysdev/fsl_pci.h> #include "mpc83xx.h" diff --git a/arch/powerpc/platforms/83xx/mpc834x_mds.c b/arch/powerpc/platforms/83xx/mpc834x_mds.c index 2b8a0a3..30d509a 100644 --- a/arch/powerpc/platforms/83xx/mpc834x_mds.c +++ b/arch/powerpc/platforms/83xx/mpc834x_mds.c @@ -35,6 +35,7 @@ #include <asm/prom.h> #include <asm/udbg.h> #include <sysdev/fsl_soc.h> +#include <sysdev/fsl_pci.h> #include "mpc83xx.h" diff --git a/arch/powerpc/platforms/83xx/mpc836x_mds.c b/arch/powerpc/platforms/83xx/mpc836x_mds.c index c2e5de6..75b80e8 100644 --- a/arch/powerpc/platforms/83xx/mpc836x_mds.c +++ b/arch/powerpc/platforms/83xx/mpc836x_mds.c @@ -42,6 +42,7 @@ #include <asm/prom.h> #include <asm/udbg.h> #include <sysdev/fsl_soc.h> +#include <sysdev/fsl_pci.h> #include <asm/qe.h> #include <asm/qe_ic.h> diff --git a/arch/powerpc/platforms/83xx/mpc837x_mds.c b/arch/powerpc/platforms/83xx/mpc837x_mds.c index 64d17b0..be62de2 100644 --- a/arch/powerpc/platforms/83xx/mpc837x_mds.c +++ b/arch/powerpc/platforms/83xx/mpc837x_mds.c @@ -19,6 +19,7 @@ #include <asm/ipic.h> #include <asm/udbg.h> #include <asm/prom.h> +#include <sysdev/fsl_pci.h> #include "mpc83xx.h" diff --git a/arch/powerpc/platforms/83xx/mpc837x_rdb.c b/arch/powerpc/platforms/83xx/mpc837x_rdb.c index c00356b..da030af 100644 --- a/arch/powerpc/platforms/83xx/mpc837x_rdb.c +++ b/arch/powerpc/platforms/83xx/mpc837x_rdb.c @@ -17,6 +17,7 @@ #include <asm/time.h> #include <asm/ipic.h> #include <asm/udbg.h> +#include <sysdev/fsl_pci.h> #include "mpc83xx.h" diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h b/arch/powerpc/platforms/83xx/mpc83xx.h index 88a3b5c..393dfec 100644 --- a/arch/powerpc/platforms/83xx/mpc83xx.h +++ b/arch/powerpc/platforms/83xx/mpc83xx.h @@ -55,7 +55,6 @@ * mpc83xx_* files. Mostly for use by mpc83xx_setup */ -extern int mpc83xx_add_bridge(struct device_node *dev); extern void mpc83xx_restart(char *cmd); extern long mpc83xx_time_init(void); extern int mpc834x_usb_cfg(void); diff --git a/arch/powerpc/platforms/83xx/pci.c b/arch/powerpc/platforms/83xx/pci.c deleted file mode 100644 index 14f1080..0000000 --- a/arch/powerpc/platforms/83xx/pci.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * FSL SoC setup code - * - * Maintained by Kumar Gala (see MAINTAINERS for contact information) - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - */ - -#include <linux/stddef.h> -#include <linux/kernel.h> -#include <linux/init.h> -#include <linux/errno.h> -#include <linux/pci.h> -#include <linux/delay.h> -#include <linux/irq.h> -#include <linux/module.h> - -#include <asm/system.h> -#include <asm/atomic.h> -#include <asm/io.h> -#include <asm/pci-bridge.h> -#include <asm/prom.h> -#include <sysdev/fsl_soc.h> - -#undef DEBUG - -#ifdef DEBUG -#define DBG(x...) printk(x) -#else -#define DBG(x...) -#endif - -int __init mpc83xx_add_bridge(struct device_node *dev) -{ - int len; - struct pci_controller *hose; - struct resource rsrc; - const int *bus_range; - int primary = 1, has_address = 0; - phys_addr_t immr = get_immrbase(); - - DBG("Adding PCI host bridge %s\n", dev->full_name); - - /* Fetch host bridge registers address */ - has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); - - /* Get bus range if any */ - bus_range = of_get_property(dev, "bus-range", &len); - if (bus_range == NULL || len < 2 * sizeof(int)) { - printk(KERN_WARNING "Can't get bus-range for %s, assume" - " bus 0\n", dev->full_name); - } - - ppc_pci_flags |= PPC_PCI_REASSIGN_ALL_BUS; - hose = pcibios_alloc_controller(dev); - if (!hose) - return -ENOMEM; - - hose->first_busno = bus_range ? bus_range[0] : 0; - hose->last_busno = bus_range ? bus_range[1] : 0xff; - - /* MPC83xx supports up to two host controllers one at 0x8500 from immrbar - * the other at 0x8600, we consider the 0x8500 the primary controller - */ - /* PCI 1 */ - if ((rsrc.start & 0xfffff) == 0x8500) { - setup_indirect_pci(hose, immr + 0x8300, immr + 0x8304, 0); - } - /* PCI 2 */ - if ((rsrc.start & 0xfffff) == 0x8600) { - setup_indirect_pci(hose, immr + 0x8380, immr + 0x8384, 0); - primary = 0; - } - - printk(KERN_INFO "Found MPC83xx PCI host bridge at 0x%016llx. " - "Firmware bus number: %d->%d\n", - (unsigned long long)rsrc.start, hose->first_busno, - hose->last_busno); - - DBG(" ->Hose at 0x%p, cfg_addr=0x%p,cfg_data=0x%p\n", - hose, hose->cfg_addr, hose->cfg_data); - - /* Interpret the "ranges" property */ - /* This also maps the I/O region and sets isa_io/mem_base */ - pci_process_bridge_OF_ranges(hose, dev, primary); - - return 0; -} diff --git a/arch/powerpc/platforms/83xx/sbc834x.c b/arch/powerpc/platforms/83xx/sbc834x.c index cf38247..fc21f5c 100644 --- a/arch/powerpc/platforms/83xx/sbc834x.c +++ b/arch/powerpc/platforms/83xx/sbc834x.c @@ -37,6 +37,7 @@ #include <asm/prom.h> #include <asm/udbg.h> #include <sysdev/fsl_soc.h> +#include <sysdev/fsl_pci.h> #include "mpc83xx.h" diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c index 489ca5a..68583f6 100644 --- a/arch/powerpc/sysdev/fsl_pci.c +++ b/arch/powerpc/sysdev/fsl_pci.c @@ -27,6 +27,7 @@ #include <sysdev/fsl_soc.h> #include <sysdev/fsl_pci.h> +#if defined(CONFIG_PPC_85xx) || defined(CONFIG_PPC_86xx) /* atmu setup for fsl pci/pcie controller */ void __init setup_pci_atmu(struct pci_controller *hose, struct resource *rsrc) { @@ -246,3 +247,63 @@ DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8572, quirk_fsl_pcie_header); DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8641, quirk_fsl_pcie_header); DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8641D, quirk_fsl_pcie_header); DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8610, quirk_fsl_pcie_header); +#endif /* CONFIG_PPC_85xx || CONFIG_PPC_86xx */ + +#if defined(CONFIG_PPC_83xx) +int __init mpc83xx_add_bridge(struct device_node *dev) +{ + int len; + struct pci_controller *hose; + struct resource rsrc; + const int *bus_range; + int primary = 1, has_address = 0; + phys_addr_t immr = get_immrbase(); + + pr_debug("Adding PCI host bridge %s\n", dev->full_name); + + /* Fetch host bridge registers address */ + has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); + + /* Get bus range if any */ + bus_range = of_get_property(dev, "bus-range", &len); + if (bus_range == NULL || len < 2 * sizeof(int)) { + printk(KERN_WARNING "Can't get bus-range for %s, assume" + " bus 0\n", dev->full_name); + } + + ppc_pci_flags |= PPC_PCI_REASSIGN_ALL_BUS; + hose = pcibios_alloc_controller(dev); + if (!hose) + return -ENOMEM; + + hose->first_busno = bus_range ? bus_range[0] : 0; + hose->last_busno = bus_range ? bus_range[1] : 0xff; + + /* MPC83xx supports up to two host controllers one at 0x8500 from immrbar + * the other at 0x8600, we consider the 0x8500 the primary controller + */ + /* PCI 1 */ + if ((rsrc.start & 0xfffff) == 0x8500) { + setup_indirect_pci(hose, immr + 0x8300, immr + 0x8304, 0); + } + /* PCI 2 */ + if ((rsrc.start & 0xfffff) == 0x8600) { + setup_indirect_pci(hose, immr + 0x8380, immr + 0x8384, 0); + primary = 0; + } + + printk(KERN_INFO "Found MPC83xx PCI host bridge at 0x%016llx. " + "Firmware bus number: %d->%d\n", + (unsigned long long)rsrc.start, hose->first_busno, + hose->last_busno); + + pr_debug(" ->Hose at 0x%p, cfg_addr=0x%p,cfg_data=0x%p\n", + hose, hose->cfg_addr, hose->cfg_data); + + /* Interpret the "ranges" property */ + /* This also maps the I/O region and sets isa_io/mem_base */ + pci_process_bridge_OF_ranges(hose, dev, primary); + + return 0; +} +#endif /* CONFIG_PPC_83xx */ diff --git a/arch/powerpc/sysdev/fsl_pci.h b/arch/powerpc/sysdev/fsl_pci.h index 37b04ad..13f30c2 100644 --- a/arch/powerpc/sysdev/fsl_pci.h +++ b/arch/powerpc/sysdev/fsl_pci.h @@ -83,6 +83,7 @@ struct ccsr_pci { extern int fsl_add_bridge(struct device_node *dev, int is_primary); extern void fsl_pcibios_fixup_bus(struct pci_bus *bus); +extern int mpc83xx_add_bridge(struct device_node *dev); #endif /* __POWERPC_FSL_PCI_H */ #endif /* __KERNEL__ */ -- 1.5.6.rc0.46.gd2b3 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] powerpc: Move mpc83xx_add_bridge to fsl_pci.c [rev2] 2008-06-26 17:07 ` [PATCH 2/2] powerpc: Move mpc83xx_add_bridge to fsl_pci.c [rev2] John Rigby @ 2008-06-29 6:01 ` Grant Likely 2008-07-15 13:22 ` Kumar Gala 1 sibling, 0 replies; 7+ messages in thread From: Grant Likely @ 2008-06-29 6:01 UTC (permalink / raw) To: John Rigby; +Cc: linuxppc-dev On Thu, Jun 26, 2008 at 11:07:57AM -0600, John Rigby wrote: > This allows other platforms with the same pci > block like MPC5121 to use it. > > Signed-off-by: John Rigby <jrigby@freescale.com> Acked-by: Grant Likely <grant.likely@secretlab.ca> > --- > arch/powerpc/platforms/83xx/Kconfig | 2 +- > arch/powerpc/platforms/83xx/Makefile | 1 - > arch/powerpc/platforms/83xx/mpc831x_rdb.c | 1 + > arch/powerpc/platforms/83xx/mpc832x_mds.c | 1 + > arch/powerpc/platforms/83xx/mpc832x_rdb.c | 1 + > arch/powerpc/platforms/83xx/mpc834x_itx.c | 1 + > arch/powerpc/platforms/83xx/mpc834x_mds.c | 1 + > arch/powerpc/platforms/83xx/mpc836x_mds.c | 1 + > arch/powerpc/platforms/83xx/mpc837x_mds.c | 1 + > arch/powerpc/platforms/83xx/mpc837x_rdb.c | 1 + > arch/powerpc/platforms/83xx/mpc83xx.h | 1 - > arch/powerpc/platforms/83xx/pci.c | 91 ----------------------------- > arch/powerpc/platforms/83xx/sbc834x.c | 1 + > arch/powerpc/sysdev/fsl_pci.c | 61 +++++++++++++++++++ > arch/powerpc/sysdev/fsl_pci.h | 1 + > 15 files changed, 72 insertions(+), 94 deletions(-) > delete mode 100644 arch/powerpc/platforms/83xx/pci.c > > diff --git a/arch/powerpc/platforms/83xx/Kconfig b/arch/powerpc/platforms/83xx/Kconfig > index 0a306eb..ca2c149 100644 > --- a/arch/powerpc/platforms/83xx/Kconfig > +++ b/arch/powerpc/platforms/83xx/Kconfig > @@ -3,7 +3,7 @@ menuconfig MPC83xx > depends on PPC_83xx > select PPC_UDBG_16550 > select PPC_PCI_CHOICE > - select PPC_INDIRECT_PCI > + select FSL_PCI if PCI > > if MPC83xx > > diff --git a/arch/powerpc/platforms/83xx/Makefile b/arch/powerpc/platforms/83xx/Makefile > index 76494be..59c413c 100644 > --- a/arch/powerpc/platforms/83xx/Makefile > +++ b/arch/powerpc/platforms/83xx/Makefile > @@ -2,7 +2,6 @@ > # Makefile for the PowerPC 83xx linux kernel. > # > obj-y := misc.o usb.o > -obj-$(CONFIG_PCI) += pci.o > obj-$(CONFIG_MPC831x_RDB) += mpc831x_rdb.o > obj-$(CONFIG_MPC832x_RDB) += mpc832x_rdb.o > obj-$(CONFIG_MPC834x_MDS) += mpc834x_mds.o > diff --git a/arch/powerpc/platforms/83xx/mpc831x_rdb.c b/arch/powerpc/platforms/83xx/mpc831x_rdb.c > index c4db517..a428f8d 100644 > --- a/arch/powerpc/platforms/83xx/mpc831x_rdb.c > +++ b/arch/powerpc/platforms/83xx/mpc831x_rdb.c > @@ -19,6 +19,7 @@ > #include <asm/time.h> > #include <asm/ipic.h> > #include <asm/udbg.h> > +#include <sysdev/fsl_pci.h> > > #include "mpc83xx.h" > > diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c > index 6dbc6ea..dd4be4a 100644 > --- a/arch/powerpc/platforms/83xx/mpc832x_mds.c > +++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c > @@ -36,6 +36,7 @@ > #include <asm/prom.h> > #include <asm/udbg.h> > #include <sysdev/fsl_soc.h> > +#include <sysdev/fsl_pci.h> > #include <asm/qe.h> > #include <asm/qe_ic.h> > > diff --git a/arch/powerpc/platforms/83xx/mpc832x_rdb.c b/arch/powerpc/platforms/83xx/mpc832x_rdb.c > index e7f706b..f049d69 100644 > --- a/arch/powerpc/platforms/83xx/mpc832x_rdb.c > +++ b/arch/powerpc/platforms/83xx/mpc832x_rdb.c > @@ -27,6 +27,7 @@ > #include <asm/qe.h> > #include <asm/qe_ic.h> > #include <sysdev/fsl_soc.h> > +#include <sysdev/fsl_pci.h> > > #include "mpc83xx.h" > > diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.c b/arch/powerpc/platforms/83xx/mpc834x_itx.c > index 50e8f63..7301d77 100644 > --- a/arch/powerpc/platforms/83xx/mpc834x_itx.c > +++ b/arch/powerpc/platforms/83xx/mpc834x_itx.c > @@ -35,6 +35,7 @@ > #include <asm/prom.h> > #include <asm/udbg.h> > #include <sysdev/fsl_soc.h> > +#include <sysdev/fsl_pci.h> > > #include "mpc83xx.h" > > diff --git a/arch/powerpc/platforms/83xx/mpc834x_mds.c b/arch/powerpc/platforms/83xx/mpc834x_mds.c > index 2b8a0a3..30d509a 100644 > --- a/arch/powerpc/platforms/83xx/mpc834x_mds.c > +++ b/arch/powerpc/platforms/83xx/mpc834x_mds.c > @@ -35,6 +35,7 @@ > #include <asm/prom.h> > #include <asm/udbg.h> > #include <sysdev/fsl_soc.h> > +#include <sysdev/fsl_pci.h> > > #include "mpc83xx.h" > > diff --git a/arch/powerpc/platforms/83xx/mpc836x_mds.c b/arch/powerpc/platforms/83xx/mpc836x_mds.c > index c2e5de6..75b80e8 100644 > --- a/arch/powerpc/platforms/83xx/mpc836x_mds.c > +++ b/arch/powerpc/platforms/83xx/mpc836x_mds.c > @@ -42,6 +42,7 @@ > #include <asm/prom.h> > #include <asm/udbg.h> > #include <sysdev/fsl_soc.h> > +#include <sysdev/fsl_pci.h> > #include <asm/qe.h> > #include <asm/qe_ic.h> > > diff --git a/arch/powerpc/platforms/83xx/mpc837x_mds.c b/arch/powerpc/platforms/83xx/mpc837x_mds.c > index 64d17b0..be62de2 100644 > --- a/arch/powerpc/platforms/83xx/mpc837x_mds.c > +++ b/arch/powerpc/platforms/83xx/mpc837x_mds.c > @@ -19,6 +19,7 @@ > #include <asm/ipic.h> > #include <asm/udbg.h> > #include <asm/prom.h> > +#include <sysdev/fsl_pci.h> > > #include "mpc83xx.h" > > diff --git a/arch/powerpc/platforms/83xx/mpc837x_rdb.c b/arch/powerpc/platforms/83xx/mpc837x_rdb.c > index c00356b..da030af 100644 > --- a/arch/powerpc/platforms/83xx/mpc837x_rdb.c > +++ b/arch/powerpc/platforms/83xx/mpc837x_rdb.c > @@ -17,6 +17,7 @@ > #include <asm/time.h> > #include <asm/ipic.h> > #include <asm/udbg.h> > +#include <sysdev/fsl_pci.h> > > #include "mpc83xx.h" > > diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h b/arch/powerpc/platforms/83xx/mpc83xx.h > index 88a3b5c..393dfec 100644 > --- a/arch/powerpc/platforms/83xx/mpc83xx.h > +++ b/arch/powerpc/platforms/83xx/mpc83xx.h > @@ -55,7 +55,6 @@ > * mpc83xx_* files. Mostly for use by mpc83xx_setup > */ > > -extern int mpc83xx_add_bridge(struct device_node *dev); > extern void mpc83xx_restart(char *cmd); > extern long mpc83xx_time_init(void); > extern int mpc834x_usb_cfg(void); > diff --git a/arch/powerpc/platforms/83xx/pci.c b/arch/powerpc/platforms/83xx/pci.c > deleted file mode 100644 > index 14f1080..0000000 > --- a/arch/powerpc/platforms/83xx/pci.c > +++ /dev/null > @@ -1,91 +0,0 @@ > -/* > - * FSL SoC setup code > - * > - * Maintained by Kumar Gala (see MAINTAINERS for contact information) > - * > - * This program is free software; you can redistribute it and/or modify it > - * under the terms of the GNU General Public License as published by the > - * Free Software Foundation; either version 2 of the License, or (at your > - * option) any later version. > - */ > - > -#include <linux/stddef.h> > -#include <linux/kernel.h> > -#include <linux/init.h> > -#include <linux/errno.h> > -#include <linux/pci.h> > -#include <linux/delay.h> > -#include <linux/irq.h> > -#include <linux/module.h> > - > -#include <asm/system.h> > -#include <asm/atomic.h> > -#include <asm/io.h> > -#include <asm/pci-bridge.h> > -#include <asm/prom.h> > -#include <sysdev/fsl_soc.h> > - > -#undef DEBUG > - > -#ifdef DEBUG > -#define DBG(x...) printk(x) > -#else > -#define DBG(x...) > -#endif > - > -int __init mpc83xx_add_bridge(struct device_node *dev) > -{ > - int len; > - struct pci_controller *hose; > - struct resource rsrc; > - const int *bus_range; > - int primary = 1, has_address = 0; > - phys_addr_t immr = get_immrbase(); > - > - DBG("Adding PCI host bridge %s\n", dev->full_name); > - > - /* Fetch host bridge registers address */ > - has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); > - > - /* Get bus range if any */ > - bus_range = of_get_property(dev, "bus-range", &len); > - if (bus_range == NULL || len < 2 * sizeof(int)) { > - printk(KERN_WARNING "Can't get bus-range for %s, assume" > - " bus 0\n", dev->full_name); > - } > - > - ppc_pci_flags |= PPC_PCI_REASSIGN_ALL_BUS; > - hose = pcibios_alloc_controller(dev); > - if (!hose) > - return -ENOMEM; > - > - hose->first_busno = bus_range ? bus_range[0] : 0; > - hose->last_busno = bus_range ? bus_range[1] : 0xff; > - > - /* MPC83xx supports up to two host controllers one at 0x8500 from immrbar > - * the other at 0x8600, we consider the 0x8500 the primary controller > - */ > - /* PCI 1 */ > - if ((rsrc.start & 0xfffff) == 0x8500) { > - setup_indirect_pci(hose, immr + 0x8300, immr + 0x8304, 0); > - } > - /* PCI 2 */ > - if ((rsrc.start & 0xfffff) == 0x8600) { > - setup_indirect_pci(hose, immr + 0x8380, immr + 0x8384, 0); > - primary = 0; > - } > - > - printk(KERN_INFO "Found MPC83xx PCI host bridge at 0x%016llx. " > - "Firmware bus number: %d->%d\n", > - (unsigned long long)rsrc.start, hose->first_busno, > - hose->last_busno); > - > - DBG(" ->Hose at 0x%p, cfg_addr=0x%p,cfg_data=0x%p\n", > - hose, hose->cfg_addr, hose->cfg_data); > - > - /* Interpret the "ranges" property */ > - /* This also maps the I/O region and sets isa_io/mem_base */ > - pci_process_bridge_OF_ranges(hose, dev, primary); > - > - return 0; > -} > diff --git a/arch/powerpc/platforms/83xx/sbc834x.c b/arch/powerpc/platforms/83xx/sbc834x.c > index cf38247..fc21f5c 100644 > --- a/arch/powerpc/platforms/83xx/sbc834x.c > +++ b/arch/powerpc/platforms/83xx/sbc834x.c > @@ -37,6 +37,7 @@ > #include <asm/prom.h> > #include <asm/udbg.h> > #include <sysdev/fsl_soc.h> > +#include <sysdev/fsl_pci.h> > > #include "mpc83xx.h" > > diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c > index 489ca5a..68583f6 100644 > --- a/arch/powerpc/sysdev/fsl_pci.c > +++ b/arch/powerpc/sysdev/fsl_pci.c > @@ -27,6 +27,7 @@ > #include <sysdev/fsl_soc.h> > #include <sysdev/fsl_pci.h> > > +#if defined(CONFIG_PPC_85xx) || defined(CONFIG_PPC_86xx) > /* atmu setup for fsl pci/pcie controller */ > void __init setup_pci_atmu(struct pci_controller *hose, struct resource *rsrc) > { > @@ -246,3 +247,63 @@ DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8572, quirk_fsl_pcie_header); > DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8641, quirk_fsl_pcie_header); > DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8641D, quirk_fsl_pcie_header); > DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8610, quirk_fsl_pcie_header); > +#endif /* CONFIG_PPC_85xx || CONFIG_PPC_86xx */ > + > +#if defined(CONFIG_PPC_83xx) > +int __init mpc83xx_add_bridge(struct device_node *dev) > +{ > + int len; > + struct pci_controller *hose; > + struct resource rsrc; > + const int *bus_range; > + int primary = 1, has_address = 0; > + phys_addr_t immr = get_immrbase(); > + > + pr_debug("Adding PCI host bridge %s\n", dev->full_name); > + > + /* Fetch host bridge registers address */ > + has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); > + > + /* Get bus range if any */ > + bus_range = of_get_property(dev, "bus-range", &len); > + if (bus_range == NULL || len < 2 * sizeof(int)) { > + printk(KERN_WARNING "Can't get bus-range for %s, assume" > + " bus 0\n", dev->full_name); > + } > + > + ppc_pci_flags |= PPC_PCI_REASSIGN_ALL_BUS; > + hose = pcibios_alloc_controller(dev); > + if (!hose) > + return -ENOMEM; > + > + hose->first_busno = bus_range ? bus_range[0] : 0; > + hose->last_busno = bus_range ? bus_range[1] : 0xff; > + > + /* MPC83xx supports up to two host controllers one at 0x8500 from immrbar > + * the other at 0x8600, we consider the 0x8500 the primary controller > + */ > + /* PCI 1 */ > + if ((rsrc.start & 0xfffff) == 0x8500) { > + setup_indirect_pci(hose, immr + 0x8300, immr + 0x8304, 0); > + } > + /* PCI 2 */ > + if ((rsrc.start & 0xfffff) == 0x8600) { > + setup_indirect_pci(hose, immr + 0x8380, immr + 0x8384, 0); > + primary = 0; > + } > + > + printk(KERN_INFO "Found MPC83xx PCI host bridge at 0x%016llx. " > + "Firmware bus number: %d->%d\n", > + (unsigned long long)rsrc.start, hose->first_busno, > + hose->last_busno); > + > + pr_debug(" ->Hose at 0x%p, cfg_addr=0x%p,cfg_data=0x%p\n", > + hose, hose->cfg_addr, hose->cfg_data); > + > + /* Interpret the "ranges" property */ > + /* This also maps the I/O region and sets isa_io/mem_base */ > + pci_process_bridge_OF_ranges(hose, dev, primary); > + > + return 0; > +} > +#endif /* CONFIG_PPC_83xx */ > diff --git a/arch/powerpc/sysdev/fsl_pci.h b/arch/powerpc/sysdev/fsl_pci.h > index 37b04ad..13f30c2 100644 > --- a/arch/powerpc/sysdev/fsl_pci.h > +++ b/arch/powerpc/sysdev/fsl_pci.h > @@ -83,6 +83,7 @@ struct ccsr_pci { > > extern int fsl_add_bridge(struct device_node *dev, int is_primary); > extern void fsl_pcibios_fixup_bus(struct pci_bus *bus); > +extern int mpc83xx_add_bridge(struct device_node *dev); > > #endif /* __POWERPC_FSL_PCI_H */ > #endif /* __KERNEL__ */ > -- > 1.5.6.rc0.46.gd2b3 > > _______________________________________________ > Linuxppc-dev mailing list > Linuxppc-dev@ozlabs.org > https://ozlabs.org/mailman/listinfo/linuxppc-dev ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] powerpc: Move mpc83xx_add_bridge to fsl_pci.c [rev2] 2008-06-26 17:07 ` [PATCH 2/2] powerpc: Move mpc83xx_add_bridge to fsl_pci.c [rev2] John Rigby 2008-06-29 6:01 ` Grant Likely @ 2008-07-15 13:22 ` Kumar Gala 1 sibling, 0 replies; 7+ messages in thread From: Kumar Gala @ 2008-07-15 13:22 UTC (permalink / raw) To: John Rigby; +Cc: linuxppc-dev On Jun 26, 2008, at 12:07 PM, John Rigby wrote: > This allows other platforms with the same pci > block like MPC5121 to use it. > > Signed-off-by: John Rigby <jrigby@freescale.com> > --- > arch/powerpc/platforms/83xx/Kconfig | 2 +- > arch/powerpc/platforms/83xx/Makefile | 1 - > arch/powerpc/platforms/83xx/mpc831x_rdb.c | 1 + > arch/powerpc/platforms/83xx/mpc832x_mds.c | 1 + > arch/powerpc/platforms/83xx/mpc832x_rdb.c | 1 + > arch/powerpc/platforms/83xx/mpc834x_itx.c | 1 + > arch/powerpc/platforms/83xx/mpc834x_mds.c | 1 + > arch/powerpc/platforms/83xx/mpc836x_mds.c | 1 + > arch/powerpc/platforms/83xx/mpc837x_mds.c | 1 + > arch/powerpc/platforms/83xx/mpc837x_rdb.c | 1 + > arch/powerpc/platforms/83xx/mpc83xx.h | 1 - > arch/powerpc/platforms/83xx/pci.c | 91 > ----------------------------- > arch/powerpc/platforms/83xx/sbc834x.c | 1 + > arch/powerpc/sysdev/fsl_pci.c | 61 +++++++++++++++++++ > arch/powerpc/sysdev/fsl_pci.h | 1 + > 15 files changed, 72 insertions(+), 94 deletions(-) > delete mode 100644 arch/powerpc/platforms/83xx/pci.c applied. - k ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] powerpc: pci config cleanup [rev2] 2008-06-26 17:07 ` [PATCH 1/2] powerpc: pci config " John Rigby 2008-06-26 17:07 ` [PATCH 2/2] powerpc: Move mpc83xx_add_bridge to fsl_pci.c [rev2] John Rigby @ 2008-06-29 5:58 ` Grant Likely 2008-07-15 13:22 ` Kumar Gala 2 siblings, 0 replies; 7+ messages in thread From: Grant Likely @ 2008-06-29 5:58 UTC (permalink / raw) To: John Rigby; +Cc: linuxppc-dev On Thu, Jun 26, 2008 at 11:07:56AM -0600, John Rigby wrote: > Choosing PCI or not at config time is allowed on some > platforms via an if expression in arch/powerpc/Kconfig. > To add a new platform with PCI support selectable at > config time, you must change the if expression. This > patch makes this easier by changing: > bool "PCI support" if <long expression> > to > bool "PCI support" if PPC_PCI_CHOICE > and adding select PPC_PCI_CHOICE to all the config nodes that > were previously in the PCI if expression. > > Platforms with unconditional PCI support continue to > just select PCI in their config nodes. > > Signed-off-by: John Rigby <jrigby@freescale.com> Acked-by: Grant Likely <grant.likely@secretlab.ca> ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] powerpc: pci config cleanup [rev2] 2008-06-26 17:07 ` [PATCH 1/2] powerpc: pci config " John Rigby 2008-06-26 17:07 ` [PATCH 2/2] powerpc: Move mpc83xx_add_bridge to fsl_pci.c [rev2] John Rigby 2008-06-29 5:58 ` [PATCH 1/2] powerpc: pci config cleanup [rev2] Grant Likely @ 2008-07-15 13:22 ` Kumar Gala 2 siblings, 0 replies; 7+ messages in thread From: Kumar Gala @ 2008-07-15 13:22 UTC (permalink / raw) To: John Rigby; +Cc: linuxppc-dev On Jun 26, 2008, at 12:07 PM, John Rigby wrote: > Choosing PCI or not at config time is allowed on some > platforms via an if expression in arch/powerpc/Kconfig. > To add a new platform with PCI support selectable at > config time, you must change the if expression. This > patch makes this easier by changing: > bool "PCI support" if <long expression> > to > bool "PCI support" if PPC_PCI_CHOICE > and adding select PPC_PCI_CHOICE to all the config nodes that > were previously in the PCI if expression. > > Platforms with unconditional PCI support continue to > just select PCI in their config nodes. > > Signed-off-by: John Rigby <jrigby@freescale.com> > --- > arch/powerpc/Kconfig | 12 ++++++++---- > arch/powerpc/platforms/52xx/Kconfig | 1 + > arch/powerpc/platforms/83xx/Kconfig | 1 + > arch/powerpc/platforms/85xx/Kconfig | 2 +- > arch/powerpc/platforms/86xx/Kconfig | 2 ++ > arch/powerpc/platforms/Kconfig | 1 + > arch/powerpc/platforms/Kconfig.cputype | 2 ++ > arch/powerpc/platforms/iseries/Kconfig | 1 + > arch/powerpc/platforms/ps3/Kconfig | 1 + > arch/powerpc/platforms/pseries/Kconfig | 1 + > 10 files changed, 19 insertions(+), 5 deletion applied. - k ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-07-15 13:22 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-06-26 17:07 [PATCH 0/2] powerpc: pci cleanup [rev2] John Rigby 2008-06-26 17:07 ` [PATCH 1/2] powerpc: pci config " John Rigby 2008-06-26 17:07 ` [PATCH 2/2] powerpc: Move mpc83xx_add_bridge to fsl_pci.c [rev2] John Rigby 2008-06-29 6:01 ` Grant Likely 2008-07-15 13:22 ` Kumar Gala 2008-06-29 5:58 ` [PATCH 1/2] powerpc: pci config cleanup [rev2] Grant Likely 2008-07-15 13:22 ` Kumar Gala
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).