From 795fed69101b45a28498a7b37f6f0747ffd986ed Mon Sep 17 00:00:00 2001 From: juhosg Date: Fri, 25 Dec 2009 13:09:04 +0000 Subject: ar71xx: move PB42 specific PCI init code into a separate file git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18932 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/config-2.6.30 | 1 + target/linux/ar71xx/config-2.6.31 | 1 + target/linux/ar71xx/config-2.6.32 | 1 + target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig | 9 +++++ .../linux/ar71xx/files/arch/mips/ar71xx/Makefile | 1 + .../ar71xx/files/arch/mips/ar71xx/dev-pb42-pci.c | 40 ++++++++++++++++++++++ .../ar71xx/files/arch/mips/ar71xx/dev-pb42-pci.h | 21 ++++++++++++ .../ar71xx/files/arch/mips/ar71xx/mach-aw-nr580.c | 12 ++----- .../ar71xx/files/arch/mips/ar71xx/mach-pb42.c | 20 ++--------- .../ar71xx/files/arch/mips/ar71xx/mach-pb44.c | 20 ++--------- .../ar71xx/files/arch/mips/ar71xx/mach-tl-wr841n.c | 22 ++---------- .../ar71xx/files/arch/mips/ar71xx/mach-ubnt.c | 20 ++--------- .../ar71xx/files/arch/mips/ar71xx/mach-wp543.c | 19 ++-------- 13 files changed, 86 insertions(+), 101 deletions(-) create mode 100644 target/linux/ar71xx/files/arch/mips/ar71xx/dev-pb42-pci.c create mode 100644 target/linux/ar71xx/files/arch/mips/ar71xx/dev-pb42-pci.h (limited to 'target') diff --git a/target/linux/ar71xx/config-2.6.30 b/target/linux/ar71xx/config-2.6.30 index e1190a861c..84aa232f70 100644 --- a/target/linux/ar71xx/config-2.6.30 +++ b/target/linux/ar71xx/config-2.6.30 @@ -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 diff --git a/target/linux/ar71xx/config-2.6.31 b/target/linux/ar71xx/config-2.6.31 index 540b37ccc3..3b2af9ce38 100644 --- a/target/linux/ar71xx/config-2.6.31 +++ b/target/linux/ar71xx/config-2.6.31 @@ -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 diff --git a/target/linux/ar71xx/config-2.6.32 b/target/linux/ar71xx/config-2.6.32 index ed3bb6201c..566495fdb7 100644 --- a/target/linux/ar71xx/config-2.6.32 +++ b/target/linux/ar71xx/config-2.6.32 @@ -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 diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig b/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig index 39a175732a..d1ff1bed01 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig @@ -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 diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile b/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile index 34a89e22ee..fed466d585 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile @@ -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 index 0000000000..0678567a2f --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-pb42-pci.c @@ -0,0 +1,40 @@ +/* + * Atheros PB42 reference board PCI initialization + * + * Copyright (C) 2008-2009 Gabor Juhos + * Copyright (C) 2008 Imre Kaloz + * + * 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 + +#include +#include + +#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 index 0000000000..f9ef951233 --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-pb42-pci.h @@ -0,0 +1,21 @@ +/* + * Atheros PB42 reference board PCI initialization + * + * Copyright (C) 2008-2009 Gabor Juhos + * Copyright (C) 2008 Imre Kaloz + * + * 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 */ diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-aw-nr580.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-aw-nr580.c index d8bed69340..859bcae5d6 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-aw-nr580.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-aw-nr580.c @@ -16,10 +16,10 @@ #include #include -#include #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); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb42.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb42.c index 9a4b7a1c30..6e85155ccd 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb42.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb42.c @@ -16,32 +16,16 @@ #include #include -#include #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); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb44.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb44.c index 04f995c09a..008babc5cc 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb44.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb44.c @@ -22,9 +22,9 @@ #include #include -#include #include "devices.h" +#include "dev-pb42-pci.h" #define PB44_PCF8757_VSC7395_CS 0 #define PB44_PCF8757_STEREO_CS 1 @@ -52,22 +52,6 @@ #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)); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr841n.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr841n.c index d798070fde..9baedaa88a 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr841n.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr841n.c @@ -15,11 +15,10 @@ #include #include -#include #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", diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c index fb9f8c5ff4..e3285cf94c 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c @@ -16,11 +16,11 @@ #include #include -#include #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 @@ -41,22 +41,6 @@ #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) diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wp543.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wp543.c index 04d3446502..2830dcd2f2 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wp543.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wp543.c @@ -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 @@ -31,22 +32,6 @@ #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); -- cgit v1.2.3