1 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
2 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
4 #include <board_bcm963xx.h>
5 #include <linux/bcm963xx_tag.h>
6 #include <pci_ath9k_fixup.h>
7 +#include <pci_rt2x00_fixup.h>
9 #define PFX "board_bcm963xx: "
11 @@ -982,9 +983,19 @@ int __init board_register_devices(void)
14 /* register any fixups */
15 - for (i = 0; i < board.has_caldata; i++)
16 - pci_enable_ath9k_fixup(board.caldata[i].slot, board.caldata[i].caldata_offset,
17 - board.caldata[i].endian_check, board.caldata[i].led_pin);
18 + for (i = 0; i < board.has_caldata; i++) {
19 + switch (board.caldata[i].vendor) {
20 + case PCI_VENDOR_ID_ATHEROS:
21 + pci_enable_ath9k_fixup(board.caldata[i].slot,
22 + board.caldata[i].caldata_offset, board.caldata[i].endian_check,
23 + board.caldata[i].led_pin);
25 + case PCI_VENDOR_ID_RALINK:
26 + pci_enable_rt2x00_fixup(board.caldata[i].slot,
27 + board.caldata[i].eeprom);
34 --- a/arch/mips/bcm63xx/dev-flash.c
35 +++ b/arch/mips/bcm63xx/dev-flash.c
36 @@ -146,7 +146,7 @@ static int __init bcm63xx_detect_flash_t
40 -int __init bcm63xx_flash_register(int num_caldata, struct ath9k_caldata *caldata)
41 +int __init bcm63xx_flash_register(int num_caldata, struct bcm63xx_caldata *caldata)
45 --- a/arch/mips/bcm63xx/Makefile
46 +++ b/arch/mips/bcm63xx/Makefile
48 obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o setup.o \
49 timer.o dev-dsp.o dev-enet.o dev-flash.o dev-hsspi.o \
50 dev-pcmcia.o dev-rng.o dev-spi.o dev-uart.o dev-usb-ehci.o \
51 - dev-usb-ohci.o dev-wdt.o pci-ath9k-fixup.o
52 + dev-usb-ohci.o dev-wdt.o pci-ath9k-fixup.o \
54 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
58 +++ b/arch/mips/bcm63xx/pci-rt2x00-fixup.c
61 + * Broadcom BCM63XX RT2x00 EEPROM fixup helper.
63 + * Copyright (C) 2012 Álvaro Fernández Rojas <noltari@gmail.com>
67 + * Broadcom BCM63XX Ath9k EEPROM fixup helper.
69 + * Copyright (C) 2012 Jonas Gorski <jonas.gorski@gmail.com>
71 + * This program is free software; you can redistribute it and/or modify it
72 + * under the terms of the GNU General Public License version 2 as published
73 + * by the Free Software Foundation.
76 +#include <linux/pci.h>
77 +#include <linux/platform_device.h>
78 +#include <linux/rt2x00_platform.h>
80 +#include <bcm63xx_nvram.h>
81 +#include <pci_rt2x00_fixup.h>
83 +struct rt2x00_fixup {
86 + struct rt2x00_platform_data pdata;
89 +static int rt2x00_num_fixups;
90 +static struct rt2x00_fixup rt2x00_fixups[2] = {
99 +static void rt2x00_pci_fixup(struct pci_dev *dev)
102 + struct rt2x00_platform_data *pdata = NULL;
104 + for (i = 0; i < rt2x00_num_fixups; i++) {
105 + if (rt2x00_fixups[i].slot != PCI_SLOT(dev->devfn))
108 + pdata = &rt2x00_fixups[i].pdata;
112 + dev->dev.platform_data = pdata;
114 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_RALINK, PCI_ANY_ID, rt2x00_pci_fixup);
116 +void __init pci_enable_rt2x00_fixup(unsigned slot, char* eeprom)
118 + if (rt2x00_num_fixups >= ARRAY_SIZE(rt2x00_fixups))
121 + rt2x00_fixups[rt2x00_num_fixups].slot = slot;
122 + rt2x00_fixups[rt2x00_num_fixups].pdata.eeprom_file_name = kstrdup(eeprom, GFP_KERNEL);
124 + if (bcm63xx_nvram_get_mac_address(rt2x00_fixups[rt2x00_num_fixups].mac))
127 + rt2x00_fixups[rt2x00_num_fixups].pdata.mac_address = rt2x00_fixups[rt2x00_num_fixups].mac;
128 + rt2x00_num_fixups++;
131 --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h
132 +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h
133 @@ -11,6 +11,6 @@ enum {
135 extern int bcm63xx_attached_flash;
137 -int __init bcm63xx_flash_register(int num_caldata, struct ath9k_caldata *caldata);
138 +int __init bcm63xx_flash_register(int num_caldata, struct bcm63xx_caldata *caldata);
140 #endif /* __BCM63XX_FLASH_H */
141 --- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
142 +++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
144 #include <bcm63xx_dev_enet.h>
145 #include <bcm63xx_dev_dsp.h>
146 #include <pci_ath9k_fixup.h>
147 +#include <pci_rt2x00_fixup.h>
152 #define BCM963XX_CFE_VERSION_OFFSET 0x570
153 #define BCM963XX_NVRAM_OFFSET 0x580
155 -struct ath9k_caldata {
156 +struct bcm63xx_caldata {
157 + unsigned int vendor;
161 unsigned int endian_check:1;
168 @@ -43,7 +48,7 @@ struct board_info {
169 unsigned int has_caldata:2;
171 /* wifi calibration data config */
172 - struct ath9k_caldata caldata[2];
173 + struct bcm63xx_caldata caldata[2];
175 /* ethernet config */
176 struct bcm63xx_enet_platform_data enet0;
178 +++ b/arch/mips/include/asm/mach-bcm63xx/pci_rt2x00_fixup.h
180 +#ifndef _PCI_RT2X00_FIXUP
181 +#define _PCI_RT2X00_FIXUP
183 +#define PCI_VENDOR_ID_RALINK 0x1814
185 +void pci_enable_rt2x00_fixup(unsigned slot, char* eeprom) __init;
187 +#endif /* _PCI_RT2X00_FIXUP */