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