mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-30 22:49:43 +02:00
0b36fa881c
This patch adds support for defining rt2x00 eeprom data. This eeprom data can be extracted from flash or loaded directly from a firmware file. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34322 3c298f89-4303-0410-b956-a3cf2f4a3e73
189 lines
5.0 KiB
Diff
189 lines
5.0 KiB
Diff
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
|
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
|
@@ -34,6 +34,7 @@
|
|
#include <board_bcm963xx.h>
|
|
#include <linux/bcm963xx_tag.h>
|
|
#include <pci_ath9k_fixup.h>
|
|
+#include <pci_rt2x00_fixup.h>
|
|
|
|
#define PFX "board_bcm963xx: "
|
|
|
|
@@ -982,9 +983,19 @@ int __init board_register_devices(void)
|
|
}
|
|
|
|
/* register any fixups */
|
|
- for (i = 0; i < board.has_caldata; i++)
|
|
- pci_enable_ath9k_fixup(board.caldata[i].slot, board.caldata[i].caldata_offset,
|
|
- board.caldata[i].endian_check, board.caldata[i].led_pin);
|
|
+ for (i = 0; i < board.has_caldata; i++) {
|
|
+ switch (board.caldata[i].vendor) {
|
|
+ case PCI_VENDOR_ID_ATHEROS:
|
|
+ pci_enable_ath9k_fixup(board.caldata[i].slot,
|
|
+ board.caldata[i].caldata_offset, board.caldata[i].endian_check,
|
|
+ board.caldata[i].led_pin);
|
|
+ break;
|
|
+ case PCI_VENDOR_ID_RALINK:
|
|
+ pci_enable_rt2x00_fixup(board.caldata[i].slot,
|
|
+ board.caldata[i].eeprom);
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
|
|
return 0;
|
|
}
|
|
--- a/arch/mips/bcm63xx/dev-flash.c
|
|
+++ b/arch/mips/bcm63xx/dev-flash.c
|
|
@@ -146,7 +146,7 @@ static int __init bcm63xx_detect_flash_t
|
|
return 0;
|
|
}
|
|
|
|
-int __init bcm63xx_flash_register(int num_caldata, struct ath9k_caldata *caldata)
|
|
+int __init bcm63xx_flash_register(int num_caldata, struct bcm63xx_caldata *caldata)
|
|
{
|
|
u32 val;
|
|
unsigned int i;
|
|
--- a/arch/mips/bcm63xx/Makefile
|
|
+++ b/arch/mips/bcm63xx/Makefile
|
|
@@ -1,7 +1,8 @@
|
|
obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o setup.o \
|
|
timer.o dev-dsp.o dev-enet.o dev-flash.o dev-hsspi.o \
|
|
dev-pcmcia.o dev-rng.o dev-spi.o dev-uart.o dev-usb-ehci.o \
|
|
- dev-usb-ohci.o dev-wdt.o pci-ath9k-fixup.o
|
|
+ dev-usb-ohci.o dev-wdt.o pci-ath9k-fixup.o \
|
|
+ pci-rt2x00-fixup.o
|
|
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
|
|
|
|
obj-y += boards/
|
|
--- /dev/null
|
|
+++ b/arch/mips/bcm63xx/pci-rt2x00-fixup.c
|
|
@@ -0,0 +1,71 @@
|
|
+/*
|
|
+ * Broadcom BCM63XX RT2x00 EEPROM fixup helper.
|
|
+ *
|
|
+ * Copyright (C) 2012 Álvaro Fernández Rojas <noltari@gmail.com>
|
|
+ *
|
|
+ * Based on
|
|
+ *
|
|
+ * Broadcom BCM63XX Ath9k EEPROM fixup helper.
|
|
+ *
|
|
+ * Copyright (C) 2012 Jonas Gorski <jonas.gorski@gmail.com>
|
|
+ *
|
|
+ * 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 <linux/platform_device.h>
|
|
+#include <linux/rt2x00_platform.h>
|
|
+
|
|
+#include <bcm63xx_nvram.h>
|
|
+#include <pci_rt2x00_fixup.h>
|
|
+
|
|
+struct rt2x00_fixup {
|
|
+ unsigned slot;
|
|
+ u8 mac[ETH_ALEN];
|
|
+ struct rt2x00_platform_data pdata;
|
|
+};
|
|
+
|
|
+static int rt2x00_num_fixups;
|
|
+static struct rt2x00_fixup rt2x00_fixups[2] = {
|
|
+ {
|
|
+ .slot = 255,
|
|
+ },
|
|
+ {
|
|
+ .slot = 255,
|
|
+ },
|
|
+};
|
|
+
|
|
+static void rt2x00_pci_fixup(struct pci_dev *dev)
|
|
+{
|
|
+ unsigned i;
|
|
+ struct rt2x00_platform_data *pdata = NULL;
|
|
+
|
|
+ for (i = 0; i < rt2x00_num_fixups; i++) {
|
|
+ if (rt2x00_fixups[i].slot != PCI_SLOT(dev->devfn))
|
|
+ continue;
|
|
+
|
|
+ pdata = &rt2x00_fixups[i].pdata;
|
|
+ break;
|
|
+ }
|
|
+
|
|
+ dev->dev.platform_data = pdata;
|
|
+}
|
|
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_RALINK, PCI_ANY_ID, rt2x00_pci_fixup);
|
|
+
|
|
+void __init pci_enable_rt2x00_fixup(unsigned slot, char* eeprom)
|
|
+{
|
|
+ if (rt2x00_num_fixups >= ARRAY_SIZE(rt2x00_fixups))
|
|
+ return;
|
|
+
|
|
+ rt2x00_fixups[rt2x00_num_fixups].slot = slot;
|
|
+ rt2x00_fixups[rt2x00_num_fixups].pdata.eeprom_file_name = kstrdup(eeprom, GFP_KERNEL);
|
|
+
|
|
+ if (bcm63xx_nvram_get_mac_address(rt2x00_fixups[rt2x00_num_fixups].mac))
|
|
+ return;
|
|
+
|
|
+ rt2x00_fixups[rt2x00_num_fixups].pdata.mac_address = rt2x00_fixups[rt2x00_num_fixups].mac;
|
|
+ rt2x00_num_fixups++;
|
|
+}
|
|
+
|
|
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h
|
|
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h
|
|
@@ -11,6 +11,6 @@ enum {
|
|
|
|
extern int bcm63xx_attached_flash;
|
|
|
|
-int __init bcm63xx_flash_register(int num_caldata, struct ath9k_caldata *caldata);
|
|
+int __init bcm63xx_flash_register(int num_caldata, struct bcm63xx_caldata *caldata);
|
|
|
|
#endif /* __BCM63XX_FLASH_H */
|
|
--- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
|
|
+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
|
|
@@ -8,6 +8,7 @@
|
|
#include <bcm63xx_dev_enet.h>
|
|
#include <bcm63xx_dev_dsp.h>
|
|
#include <pci_ath9k_fixup.h>
|
|
+#include <pci_rt2x00_fixup.h>
|
|
|
|
/*
|
|
* flash mapping
|
|
@@ -15,11 +16,15 @@
|
|
#define BCM963XX_CFE_VERSION_OFFSET 0x570
|
|
#define BCM963XX_NVRAM_OFFSET 0x580
|
|
|
|
-struct ath9k_caldata {
|
|
+struct bcm63xx_caldata {
|
|
+ unsigned int vendor;
|
|
unsigned int slot;
|
|
u32 caldata_offset;
|
|
+ /* Atheros */
|
|
unsigned int endian_check:1;
|
|
int led_pin;
|
|
+ /* Ralink */
|
|
+ char* eeprom;
|
|
};
|
|
|
|
/*
|
|
@@ -43,7 +48,7 @@ struct board_info {
|
|
unsigned int has_caldata:2;
|
|
|
|
/* wifi calibration data config */
|
|
- struct ath9k_caldata caldata[2];
|
|
+ struct bcm63xx_caldata caldata[2];
|
|
|
|
/* ethernet config */
|
|
struct bcm63xx_enet_platform_data enet0;
|
|
--- /dev/null
|
|
+++ b/arch/mips/include/asm/mach-bcm63xx/pci_rt2x00_fixup.h
|
|
@@ -0,0 +1,9 @@
|
|
+#ifndef _PCI_RT2X00_FIXUP
|
|
+#define _PCI_RT2X00_FIXUP
|
|
+
|
|
+#define PCI_VENDOR_ID_RALINK 0x1814
|
|
+
|
|
+void pci_enable_rt2x00_fixup(unsigned slot, char* eeprom) __init;
|
|
+
|
|
+#endif /* _PCI_RT2X00_FIXUP */
|
|
+
|