From e190743d25dc5714dce9f65378263a3e56cd4204 Mon Sep 17 00:00:00 2001 From: Gabor Juhos Date: Fri, 18 Dec 2009 12:56:55 +0000 Subject: [PATCH] ar71xx: add common m25p80 device SVN-Revision: 18817 --- target/linux/ar71xx/config-2.6.30 | 1 + target/linux/ar71xx/config-2.6.31 | 1 + target/linux/ar71xx/config-2.6.32 | 1 + .../ar71xx/files/arch/mips/ar71xx/Kconfig | 19 ++++++++++++ .../ar71xx/files/arch/mips/ar71xx/Makefile | 2 ++ .../files/arch/mips/ar71xx/dev-m25p80.c | 30 +++++++++++++++++++ .../files/arch/mips/ar71xx/dev-m25p80.h | 16 ++++++++++ .../ar71xx/files/arch/mips/ar71xx/mach-ap81.c | 16 ++-------- .../files/arch/mips/ar71xx/mach-aw-nr580.c | 15 ++-------- .../files/arch/mips/ar71xx/mach-dir-825-b1.c | 16 ++-------- .../files/arch/mips/ar71xx/mach-mzk-w300nh.c | 16 ++-------- .../ar71xx/files/arch/mips/ar71xx/mach-pb42.c | 15 ++-------- .../files/arch/mips/ar71xx/mach-tew-632brp.c | 17 ++--------- .../files/arch/mips/ar71xx/mach-tl-wr1043nd.c | 16 ++-------- .../files/arch/mips/ar71xx/mach-tl-wr741nd.c | 16 ++-------- .../files/arch/mips/ar71xx/mach-tl-wr941nd.c | 16 ++-------- .../ar71xx/files/arch/mips/ar71xx/mach-ubnt.c | 18 ++--------- .../files/arch/mips/ar71xx/mach-wndr3700.c | 16 ++-------- .../files/arch/mips/ar71xx/mach-wnr2000.c | 16 ++-------- .../files/arch/mips/ar71xx/mach-wp543.c | 14 ++------- .../files/arch/mips/ar71xx/mach-wrt160nl.c | 16 ++-------- .../files/arch/mips/ar71xx/mach-wrt400n.c | 16 ++-------- 22 files changed, 101 insertions(+), 208 deletions(-) create mode 100644 target/linux/ar71xx/files/arch/mips/ar71xx/dev-m25p80.c create mode 100644 target/linux/ar71xx/files/arch/mips/ar71xx/dev-m25p80.h diff --git a/target/linux/ar71xx/config-2.6.30 b/target/linux/ar71xx/config-2.6.30 index 66b1b8fb34..842424de60 100644 --- a/target/linux/ar71xx/config-2.6.30 +++ b/target/linux/ar71xx/config-2.6.30 @@ -3,6 +3,7 @@ CONFIG_32BIT=y CONFIG_AG71XX=y CONFIG_AG71XX_AR8216_SUPPORT=y # CONFIG_AG71XX_DEBUG is not set +CONFIG_AR71XX_DEV_M25P80=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 b699e4b81a..b506467e50 100644 --- a/target/linux/ar71xx/config-2.6.31 +++ b/target/linux/ar71xx/config-2.6.31 @@ -5,6 +5,7 @@ CONFIG_AG71XX_AR8216_SUPPORT=y # CONFIG_AG71XX_DEBUG is not set # CONFIG_ALCHEMY_GPIO_INDIRECT is not set # CONFIG_AR7 is not set +CONFIG_AR71XX_DEV_M25P80=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 cedfa8e72f..70cd31f482 100644 --- a/target/linux/ar71xx/config-2.6.32 +++ b/target/linux/ar71xx/config-2.6.32 @@ -5,6 +5,7 @@ CONFIG_AG71XX_AR8216_SUPPORT=y # CONFIG_AG71XX_DEBUG is not set # CONFIG_ALCHEMY_GPIO_INDIRECT is not set # CONFIG_AR7 is not set +CONFIG_AR71XX_DEV_M25P80=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 c06038cada..6ab6eefa9c 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig @@ -4,6 +4,7 @@ menu "Atheros AR71xx machine selection" config AR71XX_MACH_AP81 bool "Atheros AP81 board support" + select AR71XX_DEV_M25P80 default y config AR71XX_MACH_AP83 @@ -12,10 +13,12 @@ config AR71XX_MACH_AP83 config AR71XX_MACH_DIR_825_B1 bool "D-Link DIR-825 rev. B1 board support" + select AR71XX_DEV_M25P80 default y config AR71XX_MACH_PB42 bool "Atheros PB42 board support" + select AR71XX_DEV_M25P80 default y config AR71XX_MACH_PB44 @@ -24,6 +27,7 @@ config AR71XX_MACH_PB44 config AR71XX_MACH_AW_NR580 bool "AzureWave AW-NR580 board support" + select AR71XX_DEV_M25P80 default y config AR71XX_MACH_GENERIC @@ -33,14 +37,17 @@ config AR71XX_MACH_GENERIC config AR71XX_MACH_WP543 bool "Compex WP543/WPJ543 board support" select MYLOADER + select AR71XX_DEV_M25P80 default y config AR71XX_MACH_WRT160NL bool "Linksys WRT160NL board support" + select AR71XX_DEV_M25P80 default y config AR71XX_MACH_WRT400N bool "Linksys WRT400N board support" + select AR71XX_DEV_M25P80 default y config AR71XX_MACH_RB_4XX @@ -49,40 +56,52 @@ config AR71XX_MACH_RB_4XX config AR71XX_MACH_WNDR3700 bool "NETGEAR WNDR3700 board support" + select AR71XX_DEV_M25P80 default y config AR71XX_MACH_WNR2000 bool "NETGEAR WNR2000 board support" + select AR71XX_DEV_M25P80 default y config AR71XX_MACH_MZK_W04NU bool "Planex MZK-W04NU board support" + select AR71XX_DEV_M25P80 default y config AR71XX_MACH_MZK_W300NH bool "Planex MZK-W300NH board support" + select AR71XX_DEV_M25P80 default y config AR71XX_MACH_TL_WR741ND bool "TP-LINK TL-WR741ND support" + select AR71XX_DEV_M25P80 default y config AR71XX_MACH_TL_WR941ND bool "TP-LINK TL-WR941ND support" + select AR71XX_DEV_M25P80 default y config AR71XX_MACH_TL_WR1043ND bool "TP-LINK TL-WR1043ND support" + select AR71XX_DEV_M25P80 default y config AR71XX_MACH_TEW_632BRP bool "TRENDnet TEW-632BRP support" + select AR71XX_DEV_M25P80 default y config AR71XX_MACH_UBNT bool "Ubiquiti AR71xx based boards support" + select AR71XX_DEV_M25P80 default y endmenu +config AR71XX_DEV_M25P80 + 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 a7871a22a1..1b9bdafd82 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile @@ -13,6 +13,8 @@ obj-y := prom.o irq.o setup.o devices.o gpio.o ar71xx.o obj-$(CONFIG_EARLY_PRINTK) += early_printk.o obj-$(CONFIG_PCI) += pci.o +obj-$(CONFIG_AR71XX_DEV_M25P80) += dev-m25p80.o + obj-$(CONFIG_AR71XX_MACH_AP81) += mach-ap81.o obj-$(CONFIG_AR71XX_MACH_AP83) += mach-ap83.o obj-$(CONFIG_AR71XX_MACH_AW_NR580) += mach-aw-nr580.o diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/dev-m25p80.c b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-m25p80.c new file mode 100644 index 0000000000..666b508fc4 --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-m25p80.c @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2009 Gabor Juhos + * + * 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 "devices.h" +#include "dev-m25p80.h" + +static struct spi_board_info ar71xx_spi_info[] = { + { + .bus_num = 0, + .chip_select = 0, + .max_speed_hz = 25000000, + .modalias = "m25p80", + } +}; + +void __init ar71xx_add_device_m25p80(struct flash_platform_data *pdata) +{ + ar71xx_spi_info[0].platform_data = pdata; + ar71xx_add_device_spi(NULL, ar71xx_spi_info, + ARRAY_SIZE(ar71xx_spi_info)); +} diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/dev-m25p80.h b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-m25p80.h new file mode 100644 index 0000000000..0b8e56d03f --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-m25p80.h @@ -0,0 +1,16 @@ +/* + * Copyright (C) 2009 Gabor Juhos + * + * 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_M25P80_H +#define _AR71XX_DEV_M25P80_H + +#include + +void ar71xx_add_device_m25p80(struct flash_platform_data *pdata) __init; + +#endif /* _AR71XX_DEV_M25P80_H */ diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap81.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap81.c index 418631a3ba..c510f85487 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap81.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap81.c @@ -12,14 +12,13 @@ #include #include #include -#include -#include #include #include #include #include "devices.h" +#include "dev-m25p80.h" #define AP81_GPIO_LED_STATUS 1 #define AP81_GPIO_LED_AOSS 3 @@ -66,16 +65,6 @@ static struct flash_platform_data ap81_flash_data = { #endif }; -static struct spi_board_info ap81_spi_info[] = { - { - .bus_num = 0, - .chip_select = 0, - .max_speed_hz = 25000000, - .modalias = "m25p80", - .platform_data = &ap81_flash_data, - } -}; - static struct gpio_led ap81_leds_gpio[] __initdata = { { .name = "ap81:green:status", @@ -135,8 +124,7 @@ static void __init ap81_setup(void) ar71xx_add_device_usb(); - ar71xx_add_device_spi(NULL, ap81_spi_info, - ARRAY_SIZE(ap81_spi_info)); + ar71xx_add_device_m25p80(&ap81_flash_data); ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(ap81_leds_gpio), ap81_leds_gpio); 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 1e8c2baec9..d8bed69340 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 @@ -12,8 +12,6 @@ #include #include #include -#include -#include #include #include @@ -21,6 +19,7 @@ #include #include "devices.h" +#include "dev-m25p80.h" #define AW_NR580_GPIO_LED_READY_RED 0 #define AW_NR580_GPIO_LED_WLAN 1 @@ -33,15 +32,6 @@ #define AW_NR580_BUTTONS_POLL_INTERVAL 20 -static struct spi_board_info aw_nr580_spi_info[] = { - { - .bus_num = 0, - .chip_select = 0, - .max_speed_hz = 25000000, - .modalias = "m25p80", - } -}; - static struct gpio_led aw_nr580_leds_gpio[] __initdata = { { .name = "aw-nr580:red:ready", @@ -105,8 +95,7 @@ static void __init aw_nr580_setup(void) ar71xx_pci_init(ARRAY_SIZE(aw_nr580_pci_irqs), aw_nr580_pci_irqs); - ar71xx_add_device_spi(NULL, aw_nr580_spi_info, - ARRAY_SIZE(aw_nr580_spi_info)); + ar71xx_add_device_m25p80(NULL); ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(aw_nr580_leds_gpio), aw_nr580_leds_gpio); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-825-b1.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-825-b1.c index 4fdb9fb5b4..620ccd1d71 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-825-b1.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-825-b1.c @@ -13,8 +13,6 @@ #include #include #include -#include -#include #include #include #include @@ -26,6 +24,7 @@ #include #include "devices.h" +#include "dev-m25p80.h" #define DIR825B1_GPIO_LED_BLUE_USB 0 #define DIR825B1_GPIO_LED_ORANGE_POWER 1 @@ -85,16 +84,6 @@ static struct flash_platform_data dir825b1_flash_data = { #endif }; -static struct spi_board_info dir825b1_spi_info[] = { - { - .bus_num = 0, - .chip_select = 0, - .max_speed_hz = 25000000, - .modalias = "m25p80", - .platform_data = &dir825b1_flash_data, - } -}; - static struct gpio_led dir825b1_leds_gpio[] __initdata = { { .name = "dir825b1:blue:usb", @@ -298,8 +287,7 @@ static void __init dir825b1_setup(void) ar71xx_add_device_eth(0); ar71xx_add_device_eth(1); - ar71xx_add_device_spi(NULL, dir825b1_spi_info, - ARRAY_SIZE(dir825b1_spi_info)); + ar71xx_add_device_m25p80(&dir825b1_flash_data); ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(dir825b1_leds_gpio), dir825b1_leds_gpio); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w300nh.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w300nh.c index 49cc2ac3f7..7dea748e05 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w300nh.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w300nh.c @@ -12,8 +12,6 @@ #include #include #include -#include -#include #include #include @@ -21,6 +19,7 @@ #include #include "devices.h" +#include "dev-m25p80.h" #define MZK_W300NH_GPIO_LED_STATUS 1 #define MZK_W300NH_GPIO_LED_WPS 3 @@ -77,16 +76,6 @@ static struct flash_platform_data mzk_w300nh_flash_data = { #endif }; -static struct spi_board_info mzk_w300nh_spi_info[] = { - { - .bus_num = 0, - .chip_select = 0, - .max_speed_hz = 25000000, - .modalias = "m25p80", - .platform_data = &mzk_w300nh_flash_data, - } -}; - static struct gpio_led mzk_w300nh_leds_gpio[] __initdata = { { .name = "mzk-w300nh:green:status", @@ -156,8 +145,7 @@ static void __init mzk_w300nh_setup(void) ar71xx_add_device_eth(0); ar71xx_add_device_eth(1); - ar71xx_add_device_spi(NULL, mzk_w300nh_spi_info, - ARRAY_SIZE(mzk_w300nh_spi_info)); + ar71xx_add_device_m25p80(&mzk_w300nh_flash_data); ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(mzk_w300nh_leds_gpio), mzk_w300nh_leds_gpio); 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 154a1e43dc..9a4b7a1c30 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb42.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb42.c @@ -13,29 +13,19 @@ #include #include #include -#include -#include #include #include #include #include "devices.h" +#include "dev-m25p80.h" #define PB42_BUTTONS_POLL_INTERVAL 20 #define PB42_GPIO_BTN_SW4 8 #define PB42_GPIO_BTN_SW5 3 -static struct spi_board_info pb42_spi_info[] = { - { - .bus_num = 0, - .chip_select = 0, - .max_speed_hz = 25000000, - .modalias = "m25p80", - } -}; - static struct ar71xx_pci_irq pb42_pci_irqs[] __initdata = { { .slot = 0, @@ -76,8 +66,7 @@ static struct gpio_button pb42_gpio_buttons[] __initdata = { static void __init pb42_init(void) { - ar71xx_add_device_spi(NULL, pb42_spi_info, - ARRAY_SIZE(pb42_spi_info)); + ar71xx_add_device_m25p80(NULL); ar71xx_add_device_mdio(~PB42_MDIO_PHYMASK); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tew-632brp.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tew-632brp.c index afb8ceebd5..0c81ec190c 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tew-632brp.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tew-632brp.c @@ -12,15 +12,13 @@ #include #include #include -#include -#include #include #include - #include #include "devices.h" +#include "dev-m25p80.h" #define TEW_632BRP_GPIO_LED_STATUS 1 #define TEW_632BRP_GPIO_LED_WPS 3 @@ -69,16 +67,6 @@ static struct flash_platform_data tew_632brp_flash_data = { #endif }; -static struct spi_board_info tew_632brp_spi_info[] = { - { - .bus_num = 0, - .chip_select = 0, - .max_speed_hz = 25000000, - .modalias = "m25p80", - .platform_data = &tew_632brp_flash_data, - } -}; - static struct gpio_led tew_632brp_leds_gpio[] __initdata = { { .name = "tew-632brp:green:status", @@ -126,8 +114,7 @@ static void __init tew_632brp_setup(void) ar71xx_add_device_eth(0); ar71xx_add_device_eth(1); - ar71xx_add_device_spi(NULL, tew_632brp_spi_info, - ARRAY_SIZE(tew_632brp_spi_info)); + ar71xx_add_device_m25p80(&tew_632brp_flash_data); ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(tew_632brp_leds_gpio), tew_632brp_leds_gpio); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr1043nd.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr1043nd.c index d4dcd5a333..d612335f9a 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr1043nd.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr1043nd.c @@ -11,8 +11,6 @@ #include #include #include -#include -#include #include #include @@ -20,6 +18,7 @@ #include #include "devices.h" +#include "dev-m25p80.h" #define TL_WR1043ND_GPIO_LED_SYSTEM 2 #define TL_WR1043ND_GPIO_LED_QSS 5 @@ -64,16 +63,6 @@ static struct flash_platform_data tl_wr1043nd_flash_data = { #endif }; -static struct spi_board_info tl_wr1043nd_spi_info[] = { - { - .bus_num = 0, - .chip_select = 0, - .max_speed_hz = 25000000, - .modalias = "m25p80", - .platform_data = &tl_wr1043nd_flash_data, - } -}; - static struct gpio_led tl_wr1043nd_leds_gpio[] __initdata = { { .name = "tl-wr1043nd:green:system", @@ -121,8 +110,7 @@ static void __init tl_wr1043nd_setup(void) ar71xx_add_device_usb(); - ar71xx_add_device_spi(NULL, tl_wr1043nd_spi_info, - ARRAY_SIZE(tl_wr1043nd_spi_info)); + ar71xx_add_device_m25p80(&tl_wr1043nd_flash_data); ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(tl_wr1043nd_leds_gpio), tl_wr1043nd_leds_gpio); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr741nd.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr741nd.c index 1d13ce94dc..859ef6afdb 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr741nd.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr741nd.c @@ -12,8 +12,6 @@ #include #include #include -#include -#include #include #include @@ -23,6 +21,7 @@ #include #include "devices.h" +#include "dev-m25p80.h" #define TL_WR741ND_GPIO_LED_QSS 0 #define TL_WR741ND_GPIO_LED_SYSTEM 1 @@ -67,16 +66,6 @@ static struct flash_platform_data tl_wr741nd_flash_data = { #endif }; -static struct spi_board_info tl_wr741nd_spi_info[] = { - { - .bus_num = 0, - .chip_select = 0, - .max_speed_hz = 25000000, - .modalias = "m25p80", - .platform_data = &tl_wr741nd_flash_data, - } -}; - static struct gpio_led tl_wr741nd_leds_gpio[] __initdata = { { .name = "tl-wr741nd:green:system", @@ -167,8 +156,7 @@ static void __init tl_wr741nd_setup(void) ar71xx_add_device_eth(1); ar71xx_add_device_eth(0); - ar71xx_add_device_spi(NULL, tl_wr741nd_spi_info, - ARRAY_SIZE(tl_wr741nd_spi_info)); + ar71xx_add_device_m25p80(&tl_wr741nd_flash_data); ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(tl_wr741nd_leds_gpio), tl_wr741nd_leds_gpio); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr941nd.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr941nd.c index 580ae19d92..fb42cb006a 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr941nd.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr941nd.c @@ -11,8 +11,6 @@ #include #include #include -#include -#include #include #include @@ -20,6 +18,7 @@ #include #include "devices.h" +#include "dev-m25p80.h" #define TL_WR941ND_GPIO_LED_SYSTEM 2 #define TL_WR941ND_GPIO_LED_QSS 5 @@ -64,16 +63,6 @@ static struct flash_platform_data tl_wr941nd_flash_data = { #endif }; -static struct spi_board_info tl_wr941nd_spi_info[] = { - { - .bus_num = 0, - .chip_select = 0, - .max_speed_hz = 25000000, - .modalias = "m25p80", - .platform_data = &tl_wr941nd_flash_data, - } -}; - static struct gpio_led tl_wr941nd_leds_gpio[] __initdata = { { .name = "tl-wr941nd:green:system", @@ -134,8 +123,7 @@ static void __init tl_wr941nd_setup(void) ar71xx_add_device_eth(0); ar71xx_add_device_dsa(0, &tl_wr941nd_dsa_data); - ar71xx_add_device_spi(NULL, tl_wr941nd_spi_info, - ARRAY_SIZE(tl_wr941nd_spi_info)); + ar71xx_add_device_m25p80(&tl_wr941nd_flash_data); ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(tl_wr941nd_leds_gpio), tl_wr941nd_leds_gpio); 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 371ac0fc31..5182cbfc45 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c @@ -12,8 +12,6 @@ #include #include -#include -#include #include #include @@ -22,6 +20,7 @@ #include #include "devices.h" +#include "dev-m25p80.h" #define UBNT_RS_GPIO_LED_RF 2 #define UBNT_RS_GPIO_SW4 8 @@ -42,15 +41,6 @@ #define UBNT_BUTTONS_POLL_INTERVAL 20 -static struct spi_board_info ubnt_spi_info[] = { - { - .bus_num = 0, - .chip_select = 0, - .max_speed_hz = 25000000, - .modalias = "m25p80", - } -}; - static struct ar71xx_pci_irq ubnt_pci_irqs[] __initdata = { { .slot = 0, @@ -151,8 +141,7 @@ static struct gpio_button ubnt_m_gpio_buttons[] __initdata = { static void __init ubnt_generic_setup(void) { - ar71xx_add_device_spi(NULL, ubnt_spi_info, - ARRAY_SIZE(ubnt_spi_info)); + ar71xx_add_device_m25p80(NULL); ar71xx_add_device_gpio_buttons(-1, UBNT_BUTTONS_POLL_INTERVAL, ARRAY_SIZE(ubnt_gpio_buttons), @@ -285,8 +274,7 @@ static void __init ubnt_m_setup(void) ar71xx_set_mac_base(mac); - ar71xx_add_device_spi(NULL, ubnt_spi_info, - ARRAY_SIZE(ubnt_spi_info)); + ar71xx_add_device_m25p80(NULL); ar71xx_add_device_mdio(~0); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c index 729267ac46..e408ef6eb0 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c @@ -12,8 +12,6 @@ #include #include #include -#include -#include #include #include #include @@ -25,6 +23,7 @@ #include #include "devices.h" +#include "dev-m25p80.h" #define WNDR3700_GPIO_LED_WPS_ORANGE 0 #define WNDR3700_GPIO_LED_POWER_ORANGE 1 @@ -226,16 +225,6 @@ static void __init wndr3700_pci_init(void) static inline void wndr3700_pci_init(void) { }; #endif /* CONFIG_PCI */ -static struct spi_board_info wndr3700_spi_info[] = { - { - .bus_num = 0, - .chip_select = 0, - .max_speed_hz = 25000000, - .modalias = "m25p80", - .platform_data = &wndr3700_flash_data, - } -}; - static struct gpio_led wndr3700_leds_gpio[] __initdata = { { .name = "wndr3700:green:power", @@ -314,8 +303,7 @@ static void __init wndr3700_setup(void) ar71xx_add_device_usb(); - ar71xx_add_device_spi(NULL, wndr3700_spi_info, - ARRAY_SIZE(wndr3700_spi_info)); + ar71xx_add_device_m25p80(&wndr3700_flash_data); ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wndr3700_leds_gpio), wndr3700_leds_gpio); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wnr2000.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wnr2000.c index d766fef711..c1674e4690 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wnr2000.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wnr2000.c @@ -13,8 +13,6 @@ #include #include #include -#include -#include #include #include @@ -22,6 +20,7 @@ #include #include "devices.h" +#include "dev-m25p80.h" #define WNR2000_GPIO_LED_PWR_GREEN 14 #define WNR2000_GPIO_LED_PWR_AMBER 7 @@ -79,16 +78,6 @@ static struct flash_platform_data wnr2000_flash_data = { #endif }; -static struct spi_board_info wnr2000_spi_info[] = { - { - .bus_num = 0, - .chip_select = 0, - .max_speed_hz = 25000000, - .modalias = "m25p80", - .platform_data = &wnr2000_flash_data, - } -}; - static struct gpio_led wnr2000_leds_gpio[] __initdata = { { .name = "wnr2000:green:power", @@ -144,8 +133,7 @@ static void __init wnr2000_setup(void) ar71xx_add_device_eth(0); ar71xx_add_device_eth(1); - ar71xx_add_device_spi(NULL, wnr2000_spi_info, - ARRAY_SIZE(wnr2000_spi_info)); + ar71xx_add_device_m25p80(&wnr2000_flash_data); ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wnr2000_leds_gpio), wnr2000_leds_gpio); 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 9f1111dae1..04d3446502 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wp543.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wp543.c @@ -12,8 +12,6 @@ #include #include #include -#include -#include #include #include @@ -21,6 +19,7 @@ #include #include "devices.h" +#include "dev-m25p80.h" #define WP543_GPIO_SW6 2 #define WP543_GPIO_LED_1 3 @@ -32,15 +31,6 @@ #define WP543_BUTTONS_POLL_INTERVAL 20 -static struct spi_board_info wp543_spi_info[] = { - { - .bus_num = 0, - .chip_select = 0, - .max_speed_hz = 25000000, - .modalias = "m25p80", - } -}; - static struct ar71xx_pci_irq wp543_pci_irqs[] __initdata = { { .slot = 0, @@ -99,7 +89,7 @@ static struct gpio_button wp543_gpio_buttons[] __initdata = { static void __init wp543_setup(void) { - ar71xx_add_device_spi(NULL, wp543_spi_info, ARRAY_SIZE(wp543_spi_info)); + ar71xx_add_device_m25p80(NULL); ar71xx_add_device_mdio(0xfffffff7); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c index ca811d3566..da8bd9bbe2 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c @@ -11,14 +11,13 @@ #include #include #include -#include -#include #include #include #include #include "devices.h" +#include "dev-m25p80.h" #define WRT160NL_GPIO_LED_POWER 14 #define WRT160NL_GPIO_LED_WPS_AMBER 9 @@ -70,16 +69,6 @@ static struct flash_platform_data wrt160nl_flash_data = { #endif }; -static struct spi_board_info wrt160nl_spi_info[] = { - { - .bus_num = 0, - .chip_select = 0, - .max_speed_hz = 25000000, - .modalias = "m25p80", - .platform_data = &wrt160nl_flash_data, - } -}; - static struct gpio_led wrt160nl_leds_gpio[] __initdata = { { .name = "wrt160nl:blue:power", @@ -132,8 +121,7 @@ static void __init wrt160nl_setup(void) ar71xx_add_device_eth(0); ar71xx_add_device_eth(1); - ar71xx_add_device_spi(NULL, wrt160nl_spi_info, - ARRAY_SIZE(wrt160nl_spi_info)); + ar71xx_add_device_m25p80(&wrt160nl_flash_data); ar71xx_add_device_usb(); ar91xx_add_device_wmac(); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt400n.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt400n.c index 0298b1a6bf..91de9adbc6 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt400n.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt400n.c @@ -12,14 +12,13 @@ #include #include #include -#include -#include #include #include #include #include "devices.h" +#include "dev-m25p80.h" #define WRT400N_GPIO_LED_ORANGE 5 #define WRT400N_GPIO_LED_GREEN 4 @@ -86,16 +85,6 @@ static struct flash_platform_data wrt400n_flash_data = { #endif }; -static struct spi_board_info wrt400n_spi_info[] = { - { - .bus_num = 0, - .chip_select = 0, - .max_speed_hz = 25000000, - .modalias = "m25p80", - .platform_data = &wrt400n_flash_data, - } -}; - static struct gpio_led wrt400n_leds_gpio[] __initdata = { { .name = "wrt400n:green:status", @@ -150,8 +139,7 @@ static void __init wrt400n_setup(void) ar71xx_add_device_eth(0); ar71xx_add_device_eth(1); - ar71xx_add_device_spi(NULL, wrt400n_spi_info, - ARRAY_SIZE(wrt400n_spi_info)); + ar71xx_add_device_m25p80(&wrt400n_flash_data); ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wrt400n_leds_gpio), wrt400n_leds_gpio); -- 2.25.1