ar71xx: move PB42 specific PCI init code into a separate file
authorGabor Juhos <juhosg@openwrt.org>
Fri, 25 Dec 2009 13:09:04 +0000 (13:09 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Fri, 25 Dec 2009 13:09:04 +0000 (13:09 +0000)
SVN-Revision: 18932

13 files changed:
target/linux/ar71xx/config-2.6.30
target/linux/ar71xx/config-2.6.31
target/linux/ar71xx/config-2.6.32
target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig
target/linux/ar71xx/files/arch/mips/ar71xx/Makefile
target/linux/ar71xx/files/arch/mips/ar71xx/dev-pb42-pci.c [new file with mode: 0644]
target/linux/ar71xx/files/arch/mips/ar71xx/dev-pb42-pci.h [new file with mode: 0644]
target/linux/ar71xx/files/arch/mips/ar71xx/mach-aw-nr580.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb42.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb44.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr841n.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-wp543.c

index e1190a861c30c4669ea393f2d76765bc8e854aeb..84aa232f70008ec5c320769d4124a70dce90e1bc 100644 (file)
@@ -7,6 +7,7 @@ CONFIG_AR71XX_DEV_AP91_PCI=y
 CONFIG_AR71XX_DEV_AP94_PCI=y
 CONFIG_AR71XX_DEV_AR913X_WMAC=y
 CONFIG_AR71XX_DEV_M25P80=y
+CONFIG_AR71XX_DEV_PB42_PCI=y
 CONFIG_AR71XX_MACH_AP81=y
 CONFIG_AR71XX_MACH_AP83=y
 CONFIG_AR71XX_MACH_AW_NR580=y
index 540b37ccc3a2ae41a8912184729964e03279f4bc..3b2af9ce382cd2ae4fc7781e210297986e26ce52 100644 (file)
@@ -9,6 +9,7 @@ CONFIG_AR71XX_DEV_AP91_PCI=y
 CONFIG_AR71XX_DEV_AP94_PCI=y
 CONFIG_AR71XX_DEV_AR913X_WMAC=y
 CONFIG_AR71XX_DEV_M25P80=y
+CONFIG_AR71XX_DEV_PB42_PCI=y
 CONFIG_AR71XX_MACH_AP81=y
 CONFIG_AR71XX_MACH_AP83=y
 CONFIG_AR71XX_MACH_AW_NR580=y
index ed3bb6201c9878aef1034252ea90766c5a783081..566495fdb70f4c8d823fdd4481bbf1ea9703fe17 100644 (file)
@@ -9,6 +9,7 @@ CONFIG_AR71XX_DEV_AP91_PCI=y
 CONFIG_AR71XX_DEV_AP94_PCI=y
 CONFIG_AR71XX_DEV_AR913X_WMAC=y
 CONFIG_AR71XX_DEV_M25P80=y
+CONFIG_AR71XX_DEV_PB42_PCI=y
 CONFIG_AR71XX_MACH_AP81=y
 CONFIG_AR71XX_MACH_AP83=y
 CONFIG_AR71XX_MACH_AW_NR580=y
index 39a175732aef74bb4f7de7bf320f406c04ff0836..d1ff1bed01c6251c6d5b9a0dd9507b116748ed9b 100644 (file)
@@ -28,15 +28,18 @@ config AR71XX_MACH_DIR_825_B1
 config AR71XX_MACH_PB42
        bool "Atheros PB42 board support"
        select AR71XX_DEV_M25P80
+       select AR71XX_DEV_PB42_PCI if PCI
        default y
 
 config AR71XX_MACH_PB44
        bool "Atheros PB44 board support"
+       select AR71XX_DEV_PB42_PCI if PCI
        default y
 
 config AR71XX_MACH_AW_NR580
        bool "AzureWave AW-NR580 board support"
        select AR71XX_DEV_M25P80
+       select AR71XX_DEV_PB42_PCI if PCI
        default y
 
 config AR71XX_MACH_GENERIC
@@ -47,6 +50,7 @@ config AR71XX_MACH_WP543
        bool "Compex WP543/WPJ543 board support"
        select MYLOADER
        select AR71XX_DEV_M25P80
+       select AR71XX_DEV_PB42_PCI if PCI
        default y
 
 config AR71XX_MACH_WRT160NL
@@ -97,6 +101,7 @@ config AR71XX_MACH_TL_WR741ND
 config AR71XX_MACH_TL_WR841N_V1
        bool "TP-LINK TL-WR841N v1 support"
        select AR71XX_DEV_M25P80
+       select AR71XX_DEV_PB42_PCI if PCI
        default y
 
 config AR71XX_MACH_TL_WR941ND
@@ -121,6 +126,7 @@ config AR71XX_MACH_UBNT
        bool "Ubiquiti AR71xx based boards support"
        select AR71XX_DEV_M25P80
        select AR71XX_DEV_AP91_PCI if PCI
+       select AR71XX_DEV_PB42_PCI if PCI
        default y
 
 endmenu
@@ -137,4 +143,7 @@ config AR71XX_DEV_AP94_PCI
 config AR71XX_DEV_AR913X_WMAC
        def_bool n
 
+config AR71XX_DEV_PB42_PCI
+       def_bool n
+
 endif
index 34a89e22ee9097d1ceb4289f4376fc211b8898de..fed466d58538fe52736c862174140d3f202d64f3 100644 (file)
@@ -17,6 +17,7 @@ obj-$(CONFIG_AR71XX_DEV_AP91_PCI)     += dev-ap91-pci.o
 obj-$(CONFIG_AR71XX_DEV_AP94_PCI)      += dev-ap94-pci.o
 obj-$(CONFIG_AR71XX_DEV_AR913X_WMAC)   += dev-ar913x-wmac.o
 obj-$(CONFIG_AR71XX_DEV_M25P80)                += dev-m25p80.o
+obj-$(CONFIG_AR71XX_DEV_PB42_PCI)      += dev-pb42-pci.o
 
 obj-$(CONFIG_AR71XX_MACH_AP81)         += mach-ap81.o
 obj-$(CONFIG_AR71XX_MACH_AP83)         += mach-ap83.o
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/dev-pb42-pci.c b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-pb42-pci.c
new file mode 100644 (file)
index 0000000..0678567
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ *  Atheros PB42 reference board PCI initialization
+ *
+ *  Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
+ *  Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
+ *
+ *  Parts of this file are based on Atheros' 2.6.15 BSP
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published
+ *  by the Free Software Foundation.
+ */
+
+#include <linux/pci.h>
+
+#include <asm/mach-ar71xx/ar71xx.h>
+#include <asm/mach-ar71xx/pci.h>
+
+#include "dev-pb42-pci.h"
+
+static struct ar71xx_pci_irq pb42_pci_irqs[] __initdata = {
+       {
+               .slot   = 0,
+               .pin    = 1,
+               .irq    = AR71XX_PCI_IRQ_DEV0,
+       }, {
+               .slot   = 1,
+               .pin    = 1,
+               .irq    = AR71XX_PCI_IRQ_DEV1,
+       }, {
+               .slot   = 2,
+               .pin    = 1,
+               .irq    = AR71XX_PCI_IRQ_DEV2,
+       }
+};
+
+void __init pb42_pci_init(void)
+{
+       ar71xx_pci_init(ARRAY_SIZE(pb42_pci_irqs), pb42_pci_irqs);
+}
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/dev-pb42-pci.h b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-pb42-pci.h
new file mode 100644 (file)
index 0000000..f9ef951
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ *  Atheros PB42 reference board PCI initialization
+ *
+ *  Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
+ *  Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published
+ *  by the Free Software Foundation.
+ */
+
+#ifndef _AR71XX_DEV_PB42_PCI_H
+#define _AR71XX_DEV_PB42_PCI_H
+
+#if defined(CONFIG_AR71XX_DEV_PB42_PCI)
+void pb42_pci_init(void) __init;
+#else
+static inline void pb42_pci_init(void) { }
+#endif
+
+#endif /* _AR71XX_DEV_PB42_PCI_H */
index d8bed69340f07505947d2bd8b779cc5ef9e38c98..859bcae5d6fdf5ed11cfe523c4a7006f4d6d9d31 100644 (file)
 
 #include <asm/mips_machine.h>
 #include <asm/mach-ar71xx/ar71xx.h>
-#include <asm/mach-ar71xx/pci.h>
 
 #include "devices.h"
 #include "dev-m25p80.h"
+#include "dev-pb42-pci.h"
 
 #define AW_NR580_GPIO_LED_READY_RED    0
 #define AW_NR580_GPIO_LED_WLAN         1
@@ -74,14 +74,6 @@ static struct gpio_button aw_nr580_gpio_buttons[] __initdata = {
        }
 };
 
-static struct ar71xx_pci_irq aw_nr580_pci_irqs[] __initdata = {
-       {
-               .slot   = 1,
-               .pin    = 1,
-               .irq    = AR71XX_PCI_IRQ_DEV1,
-       }
-};
-
 static void __init aw_nr580_setup(void)
 {
        ar71xx_add_device_mdio(0x0);
@@ -93,7 +85,7 @@ static void __init aw_nr580_setup(void)
 
        ar71xx_add_device_eth(0);
 
-       ar71xx_pci_init(ARRAY_SIZE(aw_nr580_pci_irqs), aw_nr580_pci_irqs);
+       pb42_pci_init();
 
        ar71xx_add_device_m25p80(NULL);
 
index 9a4b7a1c306abf8c2728c8c381ee26155498be41..6e85155ccdaad2c7f2ffe4e8ac46ad48658bab30 100644 (file)
 
 #include <asm/mips_machine.h>
 #include <asm/mach-ar71xx/ar71xx.h>
-#include <asm/mach-ar71xx/pci.h>
 
 #include "devices.h"
 #include "dev-m25p80.h"
+#include "dev-pb42-pci.h"
 
 #define PB42_BUTTONS_POLL_INTERVAL     20
 
 #define PB42_GPIO_BTN_SW4      8
 #define PB42_GPIO_BTN_SW5      3
 
-static struct ar71xx_pci_irq pb42_pci_irqs[] __initdata = {
-       {
-               .slot   = 0,
-               .pin    = 1,
-               .irq    = AR71XX_PCI_IRQ_DEV0,
-       }, {
-               .slot   = 1,
-               .pin    = 1,
-               .irq    = AR71XX_PCI_IRQ_DEV1,
-       }, {
-               .slot   = 2,
-               .pin    = 1,
-               .irq    = AR71XX_PCI_IRQ_DEV2,
-       }
-};
-
 static struct gpio_button pb42_gpio_buttons[] __initdata = {
        {
                .desc           = "sw4",
@@ -85,7 +69,7 @@ static void __init pb42_init(void)
                                       ARRAY_SIZE(pb42_gpio_buttons),
                                       pb42_gpio_buttons);
 
-       ar71xx_pci_init(ARRAY_SIZE(pb42_pci_irqs), pb42_pci_irqs);
+       pb42_pci_init();
 }
 
 MIPS_MACHINE(AR71XX_MACH_PB42, "Atheros PB42", pb42_init);
index 04f995c09a75f76e61b62c0f8822c4d0ab484eee..008babc5cc0541894412ce55c1e59bda27d7ef90 100644 (file)
@@ -22,9 +22,9 @@
 
 #include <asm/mips_machine.h>
 #include <asm/mach-ar71xx/ar71xx.h>
-#include <asm/mach-ar71xx/pci.h>
 
 #include "devices.h"
+#include "dev-pb42-pci.h"
 
 #define PB44_PCF8757_VSC7395_CS        0
 #define PB44_PCF8757_STEREO_CS 1
 #define PB44_GPIO_LED_JUMP1    (PB44_GPIO_EXP_BASE + PB44_PCF8757_LED_JUMP1)
 #define PB44_GPIO_LED_JUMP2    (PB44_GPIO_EXP_BASE + PB44_PCF8757_LED_JUMP2)
 
-static struct ar71xx_pci_irq pb44_pci_irqs[] __initdata = {
-       {
-               .slot   = 0,
-               .pin    = 1,
-               .irq    = AR71XX_PCI_IRQ_DEV0,
-       }, {
-               .slot   = 1,
-               .pin    = 1,
-               .irq    = AR71XX_PCI_IRQ_DEV1,
-       }, {
-               .slot   = 2,
-               .pin    = 1,
-               .irq    = AR71XX_PCI_IRQ_DEV2,
-       }
-};
-
 static struct i2c_gpio_platform_data pb44_i2c_gpio_data = {
        .sda_pin        = PB44_GPIO_I2C_SDA,
        .scl_pin        = PB44_GPIO_I2C_SCL,
@@ -202,7 +186,7 @@ static void __init pb44_init(void)
 
        ar71xx_add_device_usb();
 
-       ar71xx_pci_init(ARRAY_SIZE(pb44_pci_irqs), pb44_pci_irqs);
+       pb42_pci_init();
 
        i2c_register_board_info(0, pb44_i2c_board_info,
                                ARRAY_SIZE(pb44_i2c_board_info));
index d798070fde4e473259445aab0737cf149a4d1bd0..9baedaa88a62befa880991c35cb5f6f568ba3f9a 100644 (file)
 
 #include <asm/mips_machine.h>
 #include <asm/mach-ar71xx/ar71xx.h>
-#include <asm/mach-ar71xx/pci.h>
 
 #include "devices.h"
 #include "dev-m25p80.h"
-#include "dev-ar913x-wmac.h"
+#include "dev-pb42-pci.h"
 
 #define TL_WR841ND_V1_GPIO_LED_SYSTEM          2
 #define TL_WR841ND_V1_GPIO_LED_QSS_GREEN       4
@@ -65,22 +64,6 @@ static struct flash_platform_data tl_wr841n_v1_flash_data = {
 #endif
 };
 
-static struct ar71xx_pci_irq tl_wr841n_v1_pci_irqs[] __initdata = {
-       {
-               .slot   = 0,
-               .pin    = 1,
-               .irq    = AR71XX_PCI_IRQ_DEV0,
-       }, {
-               .slot   = 1,
-               .pin    = 1,
-               .irq    = AR71XX_PCI_IRQ_DEV1,
-       }, {
-               .slot   = 2,
-               .pin    = 1,
-               .irq    = AR71XX_PCI_IRQ_DEV2,
-       }
-};
-
 static struct gpio_led tl_wr841n_v1_leds_gpio[] __initdata = {
        {
                .name           = "tl-wr841n:green:system",
@@ -153,8 +136,7 @@ static void __init tl_wr841n_v1_setup(void)
                                        ARRAY_SIZE(tl_wr841n_v1_gpio_buttons),
                                        tl_wr841n_v1_gpio_buttons);
 
-       ar71xx_pci_init(ARRAY_SIZE(tl_wr841n_v1_pci_irqs),
-                       tl_wr841n_v1_pci_irqs);
+       pb42_pci_init();
 }
 
 MIPS_MACHINE(AR71XX_MACH_TL_WR841N_V1, "TP-LINK TL-WR841N v1",
index fb9f8c5ff4a69685e83d3edd62b988cfbebd43ce..e3285cf94c6cde9c5ae583f650454299fe6d913b 100644 (file)
 
 #include <asm/mips_machine.h>
 #include <asm/mach-ar71xx/ar71xx.h>
-#include <asm/mach-ar71xx/pci.h>
 
 #include "devices.h"
 #include "dev-m25p80.h"
 #include "dev-ap91-pci.h"
+#include "dev-pb42-pci.h"
 
 #define UBNT_RS_GPIO_LED_RF    2
 #define UBNT_RS_GPIO_SW4       8
 
 #define UBNT_BUTTONS_POLL_INTERVAL     20
 
-static struct ar71xx_pci_irq ubnt_pci_irqs[] __initdata = {
-       {
-               .slot   = 0,
-               .pin    = 1,
-               .irq    = AR71XX_PCI_IRQ_DEV0,
-       }, {
-               .slot   = 1,
-               .pin    = 1,
-               .irq    = AR71XX_PCI_IRQ_DEV1,
-       }, {
-               .slot   = 2,
-               .pin    = 1,
-               .irq    = AR71XX_PCI_IRQ_DEV2,
-       }
-};
-
 static struct gpio_led ubnt_rs_leds_gpio[] __initdata = {
        {
                .name           = "ubnt:green:rf",
@@ -147,7 +131,7 @@ static void __init ubnt_generic_setup(void)
                                        ARRAY_SIZE(ubnt_gpio_buttons),
                                        ubnt_gpio_buttons);
 
-       ar71xx_pci_init(ARRAY_SIZE(ubnt_pci_irqs), ubnt_pci_irqs);
+       pb42_pci_init();
 }
 
 #define UBNT_RS_WAN_PHYMASK    (1 << 20)
index 04d344650209b0a17bb9a20198a44ab4c011866e..2830dcd2f26099de8d7e656081afd8b65104d145 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "devices.h"
 #include "dev-m25p80.h"
+#include "dev-pb42-pci.h"
 
 #define WP543_GPIO_SW6         2
 #define WP543_GPIO_LED_1       3
 
 #define WP543_BUTTONS_POLL_INTERVAL    20
 
-static struct ar71xx_pci_irq wp543_pci_irqs[] __initdata = {
-       {
-               .slot   = 0,
-               .pin    = 1,
-               .irq    = AR71XX_PCI_IRQ_DEV0,
-       }, {
-               .slot   = 1,
-               .pin    = 1,
-               .irq    = AR71XX_PCI_IRQ_DEV1,
-       }, {
-               .slot   = 2,
-               .pin    = 1,
-               .irq    = AR71XX_PCI_IRQ_DEV2,
-       }
-};
-
 static struct gpio_led wp543_leds_gpio[] __initdata = {
        {
                .name           = "wp543:green:led1",
@@ -101,7 +86,7 @@ static void __init wp543_setup(void)
 
        ar71xx_add_device_usb();
 
-       ar71xx_pci_init(ARRAY_SIZE(wp543_pci_irqs), wp543_pci_irqs);
+       pb42_pci_init();
 
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wp543_leds_gpio),
                                        wp543_leds_gpio);