ar71xx: setup platform data for ath9k on the TL-WR741ND, Bullet M and on the WNDR3700 boards

SVN-Revision: 18437
This commit is contained in:
Gabor Juhos 2009-11-16 17:31:32 +00:00
parent 3018b457f9
commit b7692e73c6
3 changed files with 96 additions and 5 deletions

View file

@ -8,12 +8,14 @@
* by the Free Software Foundation. * by the Free Software Foundation.
*/ */
#include <linux/pci.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/spi/flash.h> #include <linux/spi/flash.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/ath9k_platform.h>
#include <asm/mips_machine.h> #include <asm/mips_machine.h>
@ -105,6 +107,7 @@ static struct gpio_button tl_wr741nd_gpio_buttons[] __initdata = {
} }
}; };
#ifdef CONFIG_PCI
static struct ar71xx_pci_irq tl_wr741nd_pci_irqs[] __initdata = { static struct ar71xx_pci_irq tl_wr741nd_pci_irqs[] __initdata = {
{ {
.slot = 0, .slot = 0,
@ -113,6 +116,29 @@ static struct ar71xx_pci_irq tl_wr741nd_pci_irqs[] __initdata = {
} }
}; };
static struct ath9k_platform_data tl_wr741nd_wmac_data;
static int tl_wr741nd_pci_plat_dev_init(struct pci_dev *dev)
{
dev->dev.platform_data = &tl_wr741nd_wmac_data;
return 0;
}
static void tl_wr741nd_pci_init(void)
{
u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
memcpy(tl_wr741nd_wmac_data.eeprom_data, ee,
sizeof(tl_wr741nd_wmac_data.eeprom_data));
ar71xx_pci_plat_dev_init = tl_wr741nd_pci_plat_dev_init;
ar71xx_pci_init(ARRAY_SIZE(tl_wr741nd_pci_irqs), tl_wr741nd_pci_irqs);
}
#else
static inline void tl_wr741nd_pci_init(void) { };
#endif /* CONFIG_PCI */
static void __init tl_wr741nd_setup(void) static void __init tl_wr741nd_setup(void)
{ {
u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
@ -145,6 +171,6 @@ static void __init tl_wr741nd_setup(void)
ARRAY_SIZE(tl_wr741nd_gpio_buttons), ARRAY_SIZE(tl_wr741nd_gpio_buttons),
tl_wr741nd_gpio_buttons); tl_wr741nd_gpio_buttons);
ar71xx_pci_init(ARRAY_SIZE(tl_wr741nd_pci_irqs), tl_wr741nd_pci_irqs); tl_wr741nd_pci_init();
} }
MIPS_MACHINE(AR71XX_MACH_TL_WR741ND, "TP-LINK TL-WR741ND", tl_wr741nd_setup); MIPS_MACHINE(AR71XX_MACH_TL_WR741ND, "TP-LINK TL-WR741ND", tl_wr741nd_setup);

View file

@ -10,10 +10,12 @@
* by the Free Software Foundation. * by the Free Software Foundation.
*/ */
#include <linux/pci.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/spi/flash.h> #include <linux/spi/flash.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/ath9k_platform.h>
#include <asm/mips_machine.h> #include <asm/mips_machine.h>
#include <asm/mach-ar71xx/ar71xx.h> #include <asm/mach-ar71xx/ar71xx.h>
@ -244,6 +246,7 @@ static void __init ubnt_lssr71_setup(void)
MIPS_MACHINE(AR71XX_MACH_UBNT_LSSR71, "Ubiquiti LS-SR71", ubnt_lssr71_setup); MIPS_MACHINE(AR71XX_MACH_UBNT_LSSR71, "Ubiquiti LS-SR71", ubnt_lssr71_setup);
#ifdef CONFIG_PCI
static struct ar71xx_pci_irq ubnt_bullet_m_pci_irqs[] __initdata = { static struct ar71xx_pci_irq ubnt_bullet_m_pci_irqs[] __initdata = {
{ {
.slot = 0, .slot = 0,
@ -252,6 +255,30 @@ static struct ar71xx_pci_irq ubnt_bullet_m_pci_irqs[] __initdata = {
} }
}; };
static struct ath9k_platform_data ubnt_bullet_m_wmac_data;
static int ubmnt_bullet_m_pci_plat_dev_init(struct pci_dev *dev)
{
dev->dev.platform_data = &ubnt_bullet_m_wmac_data;
return 0;
}
static void __init ubnt_bullet_m_pci_init(void)
{
u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
memcpy(ubnt_bullet_m_wmac_data.eeprom_data, ee,
sizeof(ubnt_bullet_m_wmac_data.eeprom_data));
ar71xx_pci_plat_dev_init = ubmnt_bullet_m_pci_plat_dev_init;
ar71xx_pci_init(ARRAY_SIZE(ubnt_bullet_m_pci_irqs),
ubnt_bullet_m_pci_irqs);
}
#else
static inline void ubnt_bullet_m_pci_init(void) { };
#endif /* CONFIG_PCI */
static void __init ubnt_bullet_m_setup(void) static void __init ubnt_bullet_m_setup(void)
{ {
u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000); u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000);
@ -277,8 +304,7 @@ static void __init ubnt_bullet_m_setup(void)
ARRAY_SIZE(ubnt_bullet_m_gpio_buttons), ARRAY_SIZE(ubnt_bullet_m_gpio_buttons),
ubnt_bullet_m_gpio_buttons); ubnt_bullet_m_gpio_buttons);
ar71xx_pci_init(ARRAY_SIZE(ubnt_bullet_m_pci_irqs), ubnt_bullet_m_pci_init();
ubnt_bullet_m_pci_irqs);
} }
MIPS_MACHINE(AR71XX_MACH_UBNT_BULLET_M, "Ubiquiti Bullet M", ubnt_bullet_m_setup); MIPS_MACHINE(AR71XX_MACH_UBNT_BULLET_M, "Ubiquiti Bullet M", ubnt_bullet_m_setup);

View file

@ -15,6 +15,8 @@
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/spi/flash.h> #include <linux/spi/flash.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/pci.h>
#include <linux/ath9k_platform.h>
#include <asm/mips_machine.h> #include <asm/mips_machine.h>
#include <asm/mach-ar71xx/ar71xx.h> #include <asm/mach-ar71xx/ar71xx.h>
@ -90,6 +92,7 @@ static struct flash_platform_data wndr3700_flash_data = {
#endif #endif
}; };
#ifdef CONFIG_PCI
static struct ar71xx_pci_irq wndr3700_pci_irqs[] __initdata = { static struct ar71xx_pci_irq wndr3700_pci_irqs[] __initdata = {
{ {
.slot = 0, .slot = 0,
@ -102,6 +105,42 @@ static struct ar71xx_pci_irq wndr3700_pci_irqs[] __initdata = {
} }
}; };
static struct ath9k_platform_data wndr3700_wmac0_data;
static struct ath9k_platform_data wndr3700_wmac1_data;
static int wndr3700_pci_plat_dev_init(struct pci_dev *dev)
{
switch (PCI_SLOT(dev->devfn)) {
case 17:
dev->dev.platform_data = &wndr3700_wmac0_data;
break;
case 18:
dev->dev.platform_data = &wndr3700_wmac1_data;
break;
}
return 0;
}
static void __init wndr3700_pci_init(void)
{
u8 *ee;
ee = (u8 *) KSEG1ADDR(0x1fff1000);
memcpy(wndr3700_wmac0_data.eeprom_data, ee,
sizeof(wndr3700_wmac0_data.eeprom_data));
ee = (u8 *) KSEG1ADDR(0x1fff5000);
memcpy(wndr3700_wmac1_data.eeprom_data, ee,
sizeof(wndr3700_wmac1_data.eeprom_data));
ar71xx_pci_plat_dev_init = wndr3700_pci_plat_dev_init;
ar71xx_pci_init(ARRAY_SIZE(wndr3700_pci_irqs), wndr3700_pci_irqs);
}
#else
static inline void wndr3700_pci_init(void) { };
#endif /* CONFIG_PCI */
static struct spi_board_info wndr3700_spi_info[] = { static struct spi_board_info wndr3700_spi_info[] = {
{ {
.bus_num = 0, .bus_num = 0,
@ -174,8 +213,6 @@ static void __init wndr3700_setup(void)
ar71xx_add_device_usb(); ar71xx_add_device_usb();
ar71xx_pci_init(ARRAY_SIZE(wndr3700_pci_irqs), wndr3700_pci_irqs);
ar71xx_add_device_spi(NULL, wndr3700_spi_info, ar71xx_add_device_spi(NULL, wndr3700_spi_info,
ARRAY_SIZE(wndr3700_spi_info)); ARRAY_SIZE(wndr3700_spi_info));
@ -185,6 +222,8 @@ static void __init wndr3700_setup(void)
ar71xx_add_device_gpio_buttons(-1, WNDR3700_BUTTONS_POLL_INTERVAL, ar71xx_add_device_gpio_buttons(-1, WNDR3700_BUTTONS_POLL_INTERVAL,
ARRAY_SIZE(wndr3700_gpio_buttons), ARRAY_SIZE(wndr3700_gpio_buttons),
wndr3700_gpio_buttons); wndr3700_gpio_buttons);
wndr3700_pci_init();
} }
MIPS_MACHINE(AR71XX_MACH_WNDR3700, "NETGEAR WNDR3700", wndr3700_setup); MIPS_MACHINE(AR71XX_MACH_WNDR3700, "NETGEAR WNDR3700", wndr3700_setup);