| 1 | From b8420b9150fa03fcdfacd32e8c5ad286e208d5e9 Mon Sep 17 00:00:00 2001 |
| 2 | From: Jonas Gorski <jonas.gorski@gmail.com> |
| 3 | Date: Wed, 13 Jun 2012 16:48:02 +0100 |
| 4 | Subject: [PATCH 5/8] MIPS: BCM63XX: Move the PCI initialization into its own function |
| 5 | |
| 6 | Also make the cpu check a bit more explicit. |
| 7 | |
| 8 | Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> |
| 9 | Cc: linux-mips@linux-mips.org |
| 10 | Cc: Maxime Bizon <mbizon@freebox.fr> |
| 11 | Cc: Florian Fainelli <florian@openwrt.org> |
| 12 | Cc: Kevin Cernekee <cernekee@gmail.com> |
| 13 | Patchwork: https://patchwork.linux-mips.org/patch/3953/ |
| 14 | Reviewed-by: Florian Fainelli <florian@openwrt.org> |
| 15 | Signed-off-by: Ralf Baechle <ralf@linux-mips.org> |
| 16 | --- |
| 17 | arch/mips/pci/pci-bcm63xx.c | 25 +++++++++++++++++-------- |
| 18 | 1 files changed, 17 insertions(+), 8 deletions(-) |
| 19 | |
| 20 | --- a/arch/mips/pci/pci-bcm63xx.c |
| 21 | +++ b/arch/mips/pci/pci-bcm63xx.c |
| 22 | @@ -94,17 +94,10 @@ static void bcm63xx_int_cfg_writel(u32 v |
| 23 | |
| 24 | void __iomem *pci_iospace_start; |
| 25 | |
| 26 | -static int __init bcm63xx_pci_init(void) |
| 27 | +static int __init bcm63xx_register_pci(void) |
| 28 | { |
| 29 | unsigned int mem_size; |
| 30 | u32 val; |
| 31 | - |
| 32 | - if (!BCMCPU_IS_6348() && !BCMCPU_IS_6358() && !BCMCPU_IS_6368()) |
| 33 | - return -ENODEV; |
| 34 | - |
| 35 | - if (!bcm63xx_pci_enabled) |
| 36 | - return -ENODEV; |
| 37 | - |
| 38 | /* |
| 39 | * configuration access are done through IO space, remap 4 |
| 40 | * first bytes to access it from CPU. |
| 41 | @@ -221,4 +214,20 @@ static int __init bcm63xx_pci_init(void) |
| 42 | return 0; |
| 43 | } |
| 44 | |
| 45 | + |
| 46 | +static int __init bcm63xx_pci_init(void) |
| 47 | +{ |
| 48 | + if (!bcm63xx_pci_enabled) |
| 49 | + return -ENODEV; |
| 50 | + |
| 51 | + switch (bcm63xx_get_cpu_id()) { |
| 52 | + case BCM6348_CPU_ID: |
| 53 | + case BCM6358_CPU_ID: |
| 54 | + case BCM6368_CPU_ID: |
| 55 | + return bcm63xx_register_pci(); |
| 56 | + default: |
| 57 | + return -ENODEV; |
| 58 | + } |
| 59 | +} |
| 60 | + |
| 61 | arch_initcall(bcm63xx_pci_init); |
| 62 | |