bcm63xx: add 3.9 support
[openwrt/svn-archive/archive.git] / target / linux / brcm63xx / patches-3.9 / 413-BCM63XX-allow-providing-fixup-data-in-board-data.patch
1 From 8879e209111192c5e9752d7bd203cf7582693328 Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jonas.gorski@gmail.com>
3 Date: Thu, 3 May 2012 14:40:03 +0200
4 Subject: [PATCH 58/72] BCM63XX: allow providing fixup data in board data
5
6 ---
7 arch/mips/bcm63xx/boards/board_bcm963xx.c | 9 ++++++++-
8 arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h | 10 ++++++++++
9 2 files changed, 18 insertions(+), 1 deletion(-)
10
11 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
12 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
13 @@ -33,6 +33,7 @@
14 #include <bcm63xx_dev_usb_ohci.h>
15 #include <bcm63xx_dev_usb_usbd.h>
16 #include <board_bcm963xx.h>
17 +#include <pci_ath9k_fixup.h>
18
19 #include <uapi/linux/bcm963xx_tag.h>
20
21 @@ -907,6 +908,7 @@ int __init board_register_devices(void)
22 {
23 int button_count = 0;
24 int led_count = 0;
25 + int i;
26
27 if (board.has_uart0)
28 bcm63xx_uart_register(0);
29 @@ -945,7 +947,8 @@ int __init board_register_devices(void)
30 * do this after registering enet devices
31 */
32 #ifdef CONFIG_SSB_PCIHOST
33 - if (!bcm63xx_nvram_get_mac_address(bcm63xx_sprom.il0mac)) {
34 + if (!board.has_caldata &&
35 + !bcm63xx_nvram_get_mac_address(bcm63xx_sprom.il0mac)) {
36 memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN);
37 memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN);
38 if (ssb_arch_register_fallback_sprom(
39 @@ -987,5 +990,9 @@ int __init board_register_devices(void)
40 platform_device_register(&bcm63xx_gpio_keys_device);
41 }
42
43 + /* register any fixups */
44 + for (i = 0; i < board.has_caldata; i++)
45 + pci_enable_ath9k_fixup(board.caldata[i].slot, board.caldata[i].caldata_offset);
46 +
47 return 0;
48 }
49 --- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
50 +++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
51 @@ -8,6 +8,7 @@
52 #include <bcm63xx_dev_enet.h>
53 #include <bcm63xx_dev_usb_usbd.h>
54 #include <bcm63xx_dev_dsp.h>
55 +#include <pci_ath9k_fixup.h>
56
57 /*
58 * flash mapping
59 @@ -15,6 +16,11 @@
60 #define BCM963XX_CFE_VERSION_OFFSET 0x570
61 #define BCM963XX_NVRAM_OFFSET 0x580
62
63 +struct ath9k_caldata {
64 + unsigned int slot;
65 + u32 caldata_offset;
66 +};
67 +
68 /*
69 * board definition
70 */
71 @@ -34,6 +40,10 @@ struct board_info {
72 unsigned int has_dsp:1;
73 unsigned int has_uart0:1;
74 unsigned int has_uart1:1;
75 + unsigned int has_caldata:2;
76 +
77 + /* wifi calibration data config */
78 + struct ath9k_caldata caldata[2];
79
80 /* ethernet config */
81 struct bcm63xx_enet_platform_data enet0;