Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc: Move mpc83xx_add_bridge to fsl_pci.c

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>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>

authored by

John Rigby and committed by
Kumar Gala
76fe1ffc b500563b

+73 -94
+1 -1
arch/powerpc/platforms/83xx/Kconfig
··· 3 3 depends on 6xx && PPC_MULTIPLATFORM 4 4 select PPC_UDBG_16550 5 5 select PPC_PCI_CHOICE 6 - select PPC_INDIRECT_PCI 6 + select FSL_PCI if PCI 7 7 select FSL_SOC 8 8 select IPIC 9 9
-1
arch/powerpc/platforms/83xx/Makefile
··· 2 2 # Makefile for the PowerPC 83xx linux kernel. 3 3 # 4 4 obj-y := misc.o usb.o 5 - obj-$(CONFIG_PCI) += pci.o 6 5 obj-$(CONFIG_SUSPEND) += suspend.o suspend-asm.o 7 6 obj-$(CONFIG_MPC831x_RDB) += mpc831x_rdb.o 8 7 obj-$(CONFIG_MPC832x_RDB) += mpc832x_rdb.o
+1
arch/powerpc/platforms/83xx/mpc831x_rdb.c
··· 19 19 #include <asm/time.h> 20 20 #include <asm/ipic.h> 21 21 #include <asm/udbg.h> 22 + #include <sysdev/fsl_pci.h> 22 23 23 24 #include "mpc83xx.h" 24 25
+1
arch/powerpc/platforms/83xx/mpc832x_mds.c
··· 36 36 #include <asm/prom.h> 37 37 #include <asm/udbg.h> 38 38 #include <sysdev/fsl_soc.h> 39 + #include <sysdev/fsl_pci.h> 39 40 #include <asm/qe.h> 40 41 #include <asm/qe_ic.h> 41 42
+1
arch/powerpc/platforms/83xx/mpc832x_rdb.c
··· 27 27 #include <asm/qe.h> 28 28 #include <asm/qe_ic.h> 29 29 #include <sysdev/fsl_soc.h> 30 + #include <sysdev/fsl_pci.h> 30 31 31 32 #include "mpc83xx.h" 32 33
+1
arch/powerpc/platforms/83xx/mpc834x_itx.c
··· 35 35 #include <asm/prom.h> 36 36 #include <asm/udbg.h> 37 37 #include <sysdev/fsl_soc.h> 38 + #include <sysdev/fsl_pci.h> 38 39 39 40 #include "mpc83xx.h" 40 41
+1
arch/powerpc/platforms/83xx/mpc834x_mds.c
··· 35 35 #include <asm/prom.h> 36 36 #include <asm/udbg.h> 37 37 #include <sysdev/fsl_soc.h> 38 + #include <sysdev/fsl_pci.h> 38 39 39 40 #include "mpc83xx.h" 40 41
+1
arch/powerpc/platforms/83xx/mpc836x_mds.c
··· 42 42 #include <asm/prom.h> 43 43 #include <asm/udbg.h> 44 44 #include <sysdev/fsl_soc.h> 45 + #include <sysdev/fsl_pci.h> 45 46 #include <asm/qe.h> 46 47 #include <asm/qe_ic.h> 47 48
+1
arch/powerpc/platforms/83xx/mpc836x_rdk.c
··· 23 23 #include <asm/qe.h> 24 24 #include <asm/qe_ic.h> 25 25 #include <sysdev/fsl_soc.h> 26 + #include <sysdev/fsl_pci.h> 26 27 27 28 #include "mpc83xx.h" 28 29
+1
arch/powerpc/platforms/83xx/mpc837x_mds.c
··· 19 19 #include <asm/ipic.h> 20 20 #include <asm/udbg.h> 21 21 #include <asm/prom.h> 22 + #include <sysdev/fsl_pci.h> 22 23 23 24 #include "mpc83xx.h" 24 25
+1
arch/powerpc/platforms/83xx/mpc837x_rdb.c
··· 17 17 #include <asm/time.h> 18 18 #include <asm/ipic.h> 19 19 #include <asm/udbg.h> 20 + #include <sysdev/fsl_pci.h> 20 21 21 22 #include "mpc83xx.h" 22 23
-1
arch/powerpc/platforms/83xx/mpc83xx.h
··· 55 55 * mpc83xx_* files. Mostly for use by mpc83xx_setup 56 56 */ 57 57 58 - extern int mpc83xx_add_bridge(struct device_node *dev); 59 58 extern void mpc83xx_restart(char *cmd); 60 59 extern long mpc83xx_time_init(void); 61 60 extern int mpc834x_usb_cfg(void);
-91
arch/powerpc/platforms/83xx/pci.c
··· 1 - /* 2 - * FSL SoC setup code 3 - * 4 - * Maintained by Kumar Gala (see MAINTAINERS for contact information) 5 - * 6 - * This program is free software; you can redistribute it and/or modify it 7 - * under the terms of the GNU General Public License as published by the 8 - * Free Software Foundation; either version 2 of the License, or (at your 9 - * option) any later version. 10 - */ 11 - 12 - #include <linux/stddef.h> 13 - #include <linux/kernel.h> 14 - #include <linux/init.h> 15 - #include <linux/errno.h> 16 - #include <linux/pci.h> 17 - #include <linux/delay.h> 18 - #include <linux/irq.h> 19 - #include <linux/module.h> 20 - 21 - #include <asm/system.h> 22 - #include <asm/atomic.h> 23 - #include <asm/io.h> 24 - #include <asm/pci-bridge.h> 25 - #include <asm/prom.h> 26 - #include <sysdev/fsl_soc.h> 27 - 28 - #undef DEBUG 29 - 30 - #ifdef DEBUG 31 - #define DBG(x...) printk(x) 32 - #else 33 - #define DBG(x...) 34 - #endif 35 - 36 - int __init mpc83xx_add_bridge(struct device_node *dev) 37 - { 38 - int len; 39 - struct pci_controller *hose; 40 - struct resource rsrc; 41 - const int *bus_range; 42 - int primary = 1, has_address = 0; 43 - phys_addr_t immr = get_immrbase(); 44 - 45 - DBG("Adding PCI host bridge %s\n", dev->full_name); 46 - 47 - /* Fetch host bridge registers address */ 48 - has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); 49 - 50 - /* Get bus range if any */ 51 - bus_range = of_get_property(dev, "bus-range", &len); 52 - if (bus_range == NULL || len < 2 * sizeof(int)) { 53 - printk(KERN_WARNING "Can't get bus-range for %s, assume" 54 - " bus 0\n", dev->full_name); 55 - } 56 - 57 - ppc_pci_flags |= PPC_PCI_REASSIGN_ALL_BUS; 58 - hose = pcibios_alloc_controller(dev); 59 - if (!hose) 60 - return -ENOMEM; 61 - 62 - hose->first_busno = bus_range ? bus_range[0] : 0; 63 - hose->last_busno = bus_range ? bus_range[1] : 0xff; 64 - 65 - /* MPC83xx supports up to two host controllers one at 0x8500 from immrbar 66 - * the other at 0x8600, we consider the 0x8500 the primary controller 67 - */ 68 - /* PCI 1 */ 69 - if ((rsrc.start & 0xfffff) == 0x8500) { 70 - setup_indirect_pci(hose, immr + 0x8300, immr + 0x8304, 0); 71 - } 72 - /* PCI 2 */ 73 - if ((rsrc.start & 0xfffff) == 0x8600) { 74 - setup_indirect_pci(hose, immr + 0x8380, immr + 0x8384, 0); 75 - primary = 0; 76 - } 77 - 78 - printk(KERN_INFO "Found MPC83xx PCI host bridge at 0x%016llx. " 79 - "Firmware bus number: %d->%d\n", 80 - (unsigned long long)rsrc.start, hose->first_busno, 81 - hose->last_busno); 82 - 83 - DBG(" ->Hose at 0x%p, cfg_addr=0x%p,cfg_data=0x%p\n", 84 - hose, hose->cfg_addr, hose->cfg_data); 85 - 86 - /* Interpret the "ranges" property */ 87 - /* This also maps the I/O region and sets isa_io/mem_base */ 88 - pci_process_bridge_OF_ranges(hose, dev, primary); 89 - 90 - return 0; 91 - }
+1
arch/powerpc/platforms/83xx/sbc834x.c
··· 37 37 #include <asm/prom.h> 38 38 #include <asm/udbg.h> 39 39 #include <sysdev/fsl_soc.h> 40 + #include <sysdev/fsl_pci.h> 40 41 41 42 #include "mpc83xx.h" 42 43
+61
arch/powerpc/sysdev/fsl_pci.c
··· 27 27 #include <sysdev/fsl_soc.h> 28 28 #include <sysdev/fsl_pci.h> 29 29 30 + #if defined(CONFIG_PPC_85xx) || defined(CONFIG_PPC_86xx) 30 31 /* atmu setup for fsl pci/pcie controller */ 31 32 void __init setup_pci_atmu(struct pci_controller *hose, struct resource *rsrc) 32 33 { ··· 249 248 DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8641, quirk_fsl_pcie_header); 250 249 DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8641D, quirk_fsl_pcie_header); 251 250 DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8610, quirk_fsl_pcie_header); 251 + #endif /* CONFIG_PPC_85xx || CONFIG_PPC_86xx */ 252 + 253 + #if defined(CONFIG_PPC_83xx) 254 + int __init mpc83xx_add_bridge(struct device_node *dev) 255 + { 256 + int len; 257 + struct pci_controller *hose; 258 + struct resource rsrc; 259 + const int *bus_range; 260 + int primary = 1, has_address = 0; 261 + phys_addr_t immr = get_immrbase(); 262 + 263 + pr_debug("Adding PCI host bridge %s\n", dev->full_name); 264 + 265 + /* Fetch host bridge registers address */ 266 + has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); 267 + 268 + /* Get bus range if any */ 269 + bus_range = of_get_property(dev, "bus-range", &len); 270 + if (bus_range == NULL || len < 2 * sizeof(int)) { 271 + printk(KERN_WARNING "Can't get bus-range for %s, assume" 272 + " bus 0\n", dev->full_name); 273 + } 274 + 275 + ppc_pci_flags |= PPC_PCI_REASSIGN_ALL_BUS; 276 + hose = pcibios_alloc_controller(dev); 277 + if (!hose) 278 + return -ENOMEM; 279 + 280 + hose->first_busno = bus_range ? bus_range[0] : 0; 281 + hose->last_busno = bus_range ? bus_range[1] : 0xff; 282 + 283 + /* MPC83xx supports up to two host controllers one at 0x8500 from immrbar 284 + * the other at 0x8600, we consider the 0x8500 the primary controller 285 + */ 286 + /* PCI 1 */ 287 + if ((rsrc.start & 0xfffff) == 0x8500) { 288 + setup_indirect_pci(hose, immr + 0x8300, immr + 0x8304, 0); 289 + } 290 + /* PCI 2 */ 291 + if ((rsrc.start & 0xfffff) == 0x8600) { 292 + setup_indirect_pci(hose, immr + 0x8380, immr + 0x8384, 0); 293 + primary = 0; 294 + } 295 + 296 + printk(KERN_INFO "Found MPC83xx PCI host bridge at 0x%016llx. " 297 + "Firmware bus number: %d->%d\n", 298 + (unsigned long long)rsrc.start, hose->first_busno, 299 + hose->last_busno); 300 + 301 + pr_debug(" ->Hose at 0x%p, cfg_addr=0x%p,cfg_data=0x%p\n", 302 + hose, hose->cfg_addr, hose->cfg_data); 303 + 304 + /* Interpret the "ranges" property */ 305 + /* This also maps the I/O region and sets isa_io/mem_base */ 306 + pci_process_bridge_OF_ranges(hose, dev, primary); 307 + 308 + return 0; 309 + } 310 + #endif /* CONFIG_PPC_83xx */
+1
arch/powerpc/sysdev/fsl_pci.h
··· 83 83 84 84 extern int fsl_add_bridge(struct device_node *dev, int is_primary); 85 85 extern void fsl_pcibios_fixup_bus(struct pci_bus *bus); 86 + extern int mpc83xx_add_bridge(struct device_node *dev); 86 87 87 88 #endif /* __POWERPC_FSL_PCI_H */ 88 89 #endif /* __KERNEL__ */