OpenWrt – Blame information for rev 3
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | From 5ed5b5e9614fa5b02da699ab565af76c7e63d64d Mon Sep 17 00:00:00 2001 |
2 | From: Jonas Gorski <jogo@openwrt.org> |
||
3 | Date: Mon, 7 Jan 2013 17:45:39 +0100 |
||
4 | Subject: [PATCH 72/72] 446-BCM63XX-add-a-fixup-for-rt2x00-devices |
||
5 | |||
6 | --- |
||
7 | arch/mips/bcm63xx/Makefile | 2 +- |
||
8 | arch/mips/bcm63xx/boards/board_bcm963xx.c | 17 ++++- |
||
9 | arch/mips/bcm63xx/dev-flash.c | 2 +- |
||
10 | arch/mips/bcm63xx/pci-rt2x00-fixup.c | 71 ++++++++++++++++++++ |
||
11 | .../include/asm/mach-bcm63xx/bcm63xx_dev_flash.h | 2 +- |
||
12 | .../mips/include/asm/mach-bcm63xx/board_bcm963xx.h | 9 ++- |
||
13 | .../include/asm/mach-bcm63xx/pci_rt2x00_fixup.h | 9 +++ |
||
14 | 7 files changed, 104 insertions(+), 8 deletions(-) |
||
15 | create mode 100644 arch/mips/bcm63xx/pci-rt2x00-fixup.c |
||
16 | create mode 100644 arch/mips/include/asm/mach-bcm63xx/pci_rt2x00_fixup.h |
||
17 | |||
18 | --- a/arch/mips/bcm63xx/Makefile |
||
19 | +++ b/arch/mips/bcm63xx/Makefile |
||
20 | @@ -3,7 +3,7 @@ obj-y += clk.o cpu.o cs.o gpio.o irq.o |
||
3 | office | 21 | setup.o timer.o dev-dsp.o dev-enet.o dev-flash.o \ |
22 | dev-pcmcia.o dev-rng.o \ |
||
23 | dev-wdt.o dev-usb-ehci.o dev-usb-ohci.o dev-usb-usbd.o \ |
||
24 | - pci-ath9k-fixup.o usb-common.o sprom.o |
||
25 | + pci-ath9k-fixup.o pci-rt2x00-fixup.o usb-common.o sprom.o |
||
1 | office | 26 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o |
27 | |||
28 | obj-y += boards/ |
||
29 | --- a/arch/mips/bcm63xx/boards/board_common.c |
||
30 | +++ b/arch/mips/bcm63xx/boards/board_common.c |
||
3 | office | 31 | @@ -33,6 +33,7 @@ |
1 | office | 32 | #include <bcm63xx_dev_usb_usbd.h> |
33 | #include <board_bcm963xx.h> |
||
34 | #include <pci_ath9k_fixup.h> |
||
35 | +#include <pci_rt2x00_fixup.h> |
||
36 | |||
37 | #include "board_common.h" |
||
38 | |||
3 | office | 39 | @@ -248,9 +249,19 @@ int __init board_register_devices(void) |
1 | office | 40 | } |
41 | |||
42 | /* register any fixups */ |
||
43 | - for (i = 0; i < board.has_caldata; i++) |
||
44 | - pci_enable_ath9k_fixup(board.caldata[i].slot, board.caldata[i].caldata_offset, |
||
45 | - board.caldata[i].endian_check, board.caldata[i].led_pin, board.caldata[i].led_active_high); |
||
46 | + for (i = 0; i < board.has_caldata; i++) { |
||
47 | + switch (board.caldata[i].vendor) { |
||
48 | + case PCI_VENDOR_ID_ATHEROS: |
||
49 | + pci_enable_ath9k_fixup(board.caldata[i].slot, |
||
50 | + board.caldata[i].caldata_offset, board.caldata[i].endian_check, |
||
51 | + board.caldata[i].led_pin, board.caldata[i].led_active_high); |
||
52 | + break; |
||
53 | + case PCI_VENDOR_ID_RALINK: |
||
54 | + pci_enable_rt2x00_fixup(board.caldata[i].slot, |
||
55 | + board.caldata[i].eeprom); |
||
56 | + break; |
||
57 | + } |
||
58 | + } |
||
59 | |||
60 | return 0; |
||
61 | } |
||
62 | --- /dev/null |
||
63 | +++ b/arch/mips/bcm63xx/pci-rt2x00-fixup.c |
||
64 | @@ -0,0 +1,72 @@ |
||
65 | +/* |
||
66 | + * Broadcom BCM63XX RT2x00 EEPROM fixup helper. |
||
67 | + * |
||
68 | + * Copyright (C) 2012 Álvaro Fernández Rojas <noltari@gmail.com> |
||
69 | + * |
||
70 | + * Based on |
||
71 | + * |
||
72 | + * Broadcom BCM63XX Ath9k EEPROM fixup helper. |
||
73 | + * |
||
74 | + * Copyright (C) 2012 Jonas Gorski <jonas.gorski@gmail.com> |
||
75 | + * |
||
76 | + * This program is free software; you can redistribute it and/or modify it |
||
77 | + * under the terms of the GNU General Public License version 2 as published |
||
78 | + * by the Free Software Foundation. |
||
79 | + */ |
||
80 | + |
||
81 | +#include <linux/if_ether.h> |
||
82 | +#include <linux/pci.h> |
||
83 | +#include <linux/platform_device.h> |
||
84 | +#include <linux/rt2x00_platform.h> |
||
85 | + |
||
86 | +#include <bcm63xx_nvram.h> |
||
87 | +#include <pci_rt2x00_fixup.h> |
||
88 | + |
||
89 | +struct rt2x00_fixup { |
||
90 | + unsigned slot; |
||
91 | + u8 mac[ETH_ALEN]; |
||
92 | + struct rt2x00_platform_data pdata; |
||
93 | +}; |
||
94 | + |
||
95 | +static int rt2x00_num_fixups; |
||
96 | +static struct rt2x00_fixup rt2x00_fixups[2] = { |
||
97 | + { |
||
98 | + .slot = 255, |
||
99 | + }, |
||
100 | + { |
||
101 | + .slot = 255, |
||
102 | + }, |
||
103 | +}; |
||
104 | + |
||
105 | +static void rt2x00_pci_fixup(struct pci_dev *dev) |
||
106 | +{ |
||
107 | + unsigned i; |
||
108 | + struct rt2x00_platform_data *pdata = NULL; |
||
109 | + |
||
110 | + for (i = 0; i < rt2x00_num_fixups; i++) { |
||
111 | + if (rt2x00_fixups[i].slot != PCI_SLOT(dev->devfn)) |
||
112 | + continue; |
||
113 | + |
||
114 | + pdata = &rt2x00_fixups[i].pdata; |
||
115 | + break; |
||
116 | + } |
||
117 | + |
||
118 | + dev->dev.platform_data = pdata; |
||
119 | +} |
||
120 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_RALINK, PCI_ANY_ID, rt2x00_pci_fixup); |
||
121 | + |
||
122 | +void __init pci_enable_rt2x00_fixup(unsigned slot, char* eeprom) |
||
123 | +{ |
||
124 | + if (rt2x00_num_fixups >= ARRAY_SIZE(rt2x00_fixups)) |
||
125 | + return; |
||
126 | + |
||
127 | + rt2x00_fixups[rt2x00_num_fixups].slot = slot; |
||
128 | + rt2x00_fixups[rt2x00_num_fixups].pdata.eeprom_file_name = kstrdup(eeprom, GFP_KERNEL); |
||
129 | + |
||
130 | + if (bcm63xx_nvram_get_mac_address(rt2x00_fixups[rt2x00_num_fixups].mac)) |
||
131 | + return; |
||
132 | + |
||
133 | + rt2x00_fixups[rt2x00_num_fixups].pdata.mac_address = rt2x00_fixups[rt2x00_num_fixups].mac; |
||
134 | + rt2x00_num_fixups++; |
||
135 | +} |
||
136 | + |
||
137 | --- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h |
||
138 | +++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h |
||
3 | office | 139 | @@ -11,6 +11,7 @@ |
140 | #include <bcm63xx_dev_dsp.h> |
||
1 | office | 141 | #include <bcm63xx_fallback_sprom.h> |
142 | #include <pci_ath9k_fixup.h> |
||
143 | +#include <pci_rt2x00_fixup.h> |
||
144 | |||
145 | /* |
||
146 | * flash mapping |
||
3 | office | 147 | @@ -18,12 +19,16 @@ |
1 | office | 148 | #define BCM963XX_CFE_VERSION_OFFSET 0x570 |
149 | #define BCM963XX_NVRAM_OFFSET 0x580 |
||
150 | |||
151 | -struct ath9k_caldata { |
||
152 | +struct bcm63xx_caldata { |
||
153 | + unsigned int vendor; |
||
154 | unsigned int slot; |
||
155 | u32 caldata_offset; |
||
156 | + /* Atheros */ |
||
157 | unsigned int endian_check:1; |
||
158 | int led_pin; |
||
159 | bool led_active_high; |
||
160 | + /* Ralink */ |
||
161 | + char* eeprom; |
||
162 | }; |
||
163 | |||
164 | /* |
||
3 | office | 165 | @@ -47,7 +52,7 @@ struct board_info { |
1 | office | 166 | unsigned int has_caldata:2; |
167 | |||
168 | /* wifi calibration data config */ |
||
169 | - struct ath9k_caldata caldata[2]; |
||
170 | + struct bcm63xx_caldata caldata[2]; |
||
171 | |||
172 | /* ethernet config */ |
||
173 | struct bcm63xx_enet_platform_data enet0; |
||
174 | --- /dev/null |
||
175 | +++ b/arch/mips/include/asm/mach-bcm63xx/pci_rt2x00_fixup.h |
||
176 | @@ -0,0 +1,9 @@ |
||
177 | +#ifndef _PCI_RT2X00_FIXUP |
||
178 | +#define _PCI_RT2X00_FIXUP |
||
179 | + |
||
180 | +#define PCI_VENDOR_ID_RALINK 0x1814 |
||
181 | + |
||
182 | +void pci_enable_rt2x00_fixup(unsigned slot, char* eeprom) __init; |
||
183 | + |
||
184 | +#endif /* _PCI_RT2X00_FIXUP */ |
||
185 | + |