OpenWrt – Diff between revs 2 and 3
?pathlinks?
Rev 2 | Rev 3 | |||
---|---|---|---|---|
1 | From cc025e749a1fece61a6cc0d64bbe7b12472259cc Mon Sep 17 00:00:00 2001 |
1 | From cc025e749a1fece61a6cc0d64bbe7b12472259cc Mon Sep 17 00:00:00 2001 |
|
2 | From: Jonas Gorski <jogo@openwrt.org> |
2 | From: Jonas Gorski <jogo@openwrt.org> |
|
3 | Date: Tue, 29 Jul 2014 21:31:12 +0200 |
3 | Date: Tue, 29 Jul 2014 21:31:12 +0200 |
|
4 | Subject: [PATCH 01/10] MIPS: BCM63XX: move fallback sprom support into its own |
4 | Subject: [PATCH 01/10] MIPS: BCM63XX: move fallback sprom support into its own |
|
5 | unit |
5 | unit |
|
6 | |
6 | |
|
7 | In preparation for enhancing it, move it into its own file. Require a |
7 | In preparation for enhancing it, move it into its own file. Require a |
|
8 | mac address to be passed as the argument to always "reserve" the mac |
8 | mac address to be passed as the argument to always "reserve" the mac |
|
9 | regardless of the inclusion state of SSB. |
9 | regardless of the inclusion state of SSB. |
|
10 | |
10 | |
|
11 | Signed-off-by: Jonas Gorski <jogo@openwrt.org> |
11 | Signed-off-by: Jonas Gorski <jogo@openwrt.org> |
|
12 | --- |
12 | --- |
|
13 | arch/mips/bcm63xx/Makefile | 2 +- |
13 | arch/mips/bcm63xx/Makefile | 2 +- |
|
14 | arch/mips/bcm63xx/boards/board_common.c | 53 ++-------------- |
14 | arch/mips/bcm63xx/boards/board_common.c | 53 ++-------------- |
|
15 | arch/mips/bcm63xx/sprom.c | 70 ++++++++++++++++++++++ |
15 | arch/mips/bcm63xx/sprom.c | 70 ++++++++++++++++++++++ |
|
16 | .../asm/mach-bcm63xx/bcm63xx_fallback_sprom.h | 6 ++ |
16 | .../asm/mach-bcm63xx/bcm63xx_fallback_sprom.h | 6 ++ |
|
17 | 4 files changed, 83 insertions(+), 48 deletions(-) |
17 | 4 files changed, 83 insertions(+), 48 deletions(-) |
|
18 | create mode 100644 arch/mips/bcm63xx/sprom.c |
18 | create mode 100644 arch/mips/bcm63xx/sprom.c |
|
19 | create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h |
19 | create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h |
|
20 | |
20 | |
|
21 | --- a/arch/mips/bcm63xx/Makefile |
21 | --- a/arch/mips/bcm63xx/Makefile |
|
22 | +++ b/arch/mips/bcm63xx/Makefile |
22 | +++ b/arch/mips/bcm63xx/Makefile |
|
23 | @@ -1,7 +1,8 @@ |
- | ||
24 | obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \ |
23 | @@ -2,7 +2,7 @@ obj-y += clk.o cpu.o cs.o gpio.o irq.o |
|
25 | setup.o timer.o dev-enet.o dev-flash.o dev-pcmcia.o \ |
24 | setup.o timer.o dev-dsp.o dev-enet.o dev-flash.o \ |
|
26 | dev-rng.o dev-spi.o dev-hsspi.o dev-uart.o dev-wdt.o \ |
25 | dev-pcmcia.o dev-rng.o dev-spi.o dev-hsspi.o dev-uart.o \ |
|
27 | - dev-usb-ehci.o dev-usb-ohci.o dev-usb-usbd.o usb-common.o |
26 | dev-wdt.o dev-usb-ehci.o dev-usb-ohci.o dev-usb-usbd.o \ |
|
28 | + dev-usb-ehci.o dev-usb-ohci.o dev-usb-usbd.o usb-common.o \ |
27 | - usb-common.o |
|
29 | + sprom.o |
28 | + usb-common.o sprom.o |
|
30 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o |
29 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o |
|
31 | |
30 | |
|
32 | obj-y += boards/ |
31 | obj-y += boards/ |
|
33 | --- a/arch/mips/bcm63xx/boards/board_common.c |
32 | --- a/arch/mips/bcm63xx/boards/board_common.c |
|
34 | +++ b/arch/mips/bcm63xx/boards/board_common.c |
33 | +++ b/arch/mips/bcm63xx/boards/board_common.c |
|
35 | @@ -39,44 +39,6 @@ |
34 | @@ -40,44 +40,6 @@ |
|
36 | static struct board_info board; |
35 | static struct board_info board; |
|
37 | |
36 | |
|
38 | /* |
37 | /* |
|
39 | - * Register a sane SPROMv2 to make the on-board |
38 | - * Register a sane SPROMv2 to make the on-board |
|
40 | - * bcm4318 WLAN work |
39 | - * bcm4318 WLAN work |
|
41 | - */ |
40 | - */ |
|
42 | -#ifdef CONFIG_SSB_PCIHOST |
41 | -#ifdef CONFIG_SSB_PCIHOST |
|
43 | -static struct ssb_sprom bcm63xx_sprom = { |
42 | -static struct ssb_sprom bcm63xx_sprom = { |
|
44 | - .revision = 0x02, |
43 | - .revision = 0x02, |
|
45 | - .board_rev = 0x17, |
44 | - .board_rev = 0x17, |
|
46 | - .country_code = 0x0, |
45 | - .country_code = 0x0, |
|
47 | - .ant_available_bg = 0x3, |
46 | - .ant_available_bg = 0x3, |
|
48 | - .pa0b0 = 0x15ae, |
47 | - .pa0b0 = 0x15ae, |
|
49 | - .pa0b1 = 0xfa85, |
48 | - .pa0b1 = 0xfa85, |
|
50 | - .pa0b2 = 0xfe8d, |
49 | - .pa0b2 = 0xfe8d, |
|
51 | - .pa1b0 = 0xffff, |
50 | - .pa1b0 = 0xffff, |
|
52 | - .pa1b1 = 0xffff, |
51 | - .pa1b1 = 0xffff, |
|
53 | - .pa1b2 = 0xffff, |
52 | - .pa1b2 = 0xffff, |
|
54 | - .gpio0 = 0xff, |
53 | - .gpio0 = 0xff, |
|
55 | - .gpio1 = 0xff, |
54 | - .gpio1 = 0xff, |
|
56 | - .gpio2 = 0xff, |
55 | - .gpio2 = 0xff, |
|
57 | - .gpio3 = 0xff, |
56 | - .gpio3 = 0xff, |
|
58 | - .maxpwr_bg = 0x004c, |
57 | - .maxpwr_bg = 0x004c, |
|
59 | - .itssi_bg = 0x00, |
58 | - .itssi_bg = 0x00, |
|
60 | - .boardflags_lo = 0x2848, |
59 | - .boardflags_lo = 0x2848, |
|
61 | - .boardflags_hi = 0x0000, |
60 | - .boardflags_hi = 0x0000, |
|
62 | -}; |
61 | -}; |
|
63 | - |
62 | - |
|
64 | -int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out) |
63 | -int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out) |
|
65 | -{ |
64 | -{ |
|
66 | - if (bus->bustype == SSB_BUSTYPE_PCI) { |
65 | - if (bus->bustype == SSB_BUSTYPE_PCI) { |
|
67 | - memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom)); |
66 | - memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom)); |
|
68 | - return 0; |
67 | - return 0; |
|
69 | - } else { |
68 | - } else { |
|
70 | - printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n"); |
69 | - printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n"); |
|
71 | - return -EINVAL; |
70 | - return -EINVAL; |
|
72 | - } |
71 | - } |
|
73 | -} |
72 | -} |
|
74 | -#endif |
73 | -#endif |
|
75 | - |
74 | - |
|
76 | -/* |
75 | -/* |
|
77 | * return board name for /proc/cpuinfo |
76 | * return board name for /proc/cpuinfo |
|
78 | */ |
77 | */ |
|
79 | const char *board_get_name(void) |
78 | const char *board_get_name(void) |
|
80 | @@ -179,6 +141,7 @@ static struct platform_device bcm63xx_gp |
79 | @@ -180,6 +142,7 @@ static struct platform_device bcm63xx_gp |
|
81 | int __init board_register_devices(void) |
80 | int __init board_register_devices(void) |
|
82 | { |
81 | { |
|
83 | int usbh_ports = 0; |
82 | int usbh_ports = 0; |
|
84 | + u8 mac[ETH_ALEN]; |
83 | + u8 mac[ETH_ALEN]; |
|
85 | |
84 | |
|
86 | if (board.has_uart0) |
85 | if (board.has_uart0) |
|
87 | bcm63xx_uart_register(0); |
86 | bcm63xx_uart_register(0); |
|
88 | @@ -220,15 +183,10 @@ int __init board_register_devices(void) |
87 | @@ -224,15 +187,10 @@ int __init board_register_devices(void) |
|
89 | /* Generate MAC address for WLAN and register our SPROM, |
88 | /* Generate MAC address for WLAN and register our SPROM, |
|
90 | * do this after registering enet devices |
89 | * do this after registering enet devices |
|
91 | */ |
90 | */ |
|
92 | -#ifdef CONFIG_SSB_PCIHOST |
91 | -#ifdef CONFIG_SSB_PCIHOST |
|
93 | - if (!board_get_mac_address(bcm63xx_sprom.il0mac)) { |
92 | - if (!board_get_mac_address(bcm63xx_sprom.il0mac)) { |
|
94 | - memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN); |
93 | - memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN); |
|
95 | - memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN); |
94 | - memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN); |
|
96 | - if (ssb_arch_register_fallback_sprom( |
95 | - if (ssb_arch_register_fallback_sprom( |
|
97 | - &bcm63xx_get_fallback_sprom) < 0) |
96 | - &bcm63xx_get_fallback_sprom) < 0) |
|
98 | - pr_err(PFX "failed to register fallback SPROM\n"); |
97 | - pr_err(PFX "failed to register fallback SPROM\n"); |
|
99 | - } |
98 | - } |
|
100 | -#endif |
99 | -#endif |
|
101 | + |
100 | + |
|
102 | + if (board_get_mac_address(mac) || |
101 | + if (board_get_mac_address(mac) || |
|
103 | + bcm63xx_register_fallback_sprom(mac)) |
102 | + bcm63xx_register_fallback_sprom(mac)) |
|
104 | + pr_err(PFX "failed to register fallback SPROM\n"); |
103 | + pr_err(PFX "failed to register fallback SPROM\n"); |
|
105 | |
104 | |
|
106 | bcm63xx_spi_register(); |
105 | bcm63xx_spi_register(); |
|
107 | |
106 | |
|
108 | --- /dev/null |
107 | --- /dev/null |
|
109 | +++ b/arch/mips/bcm63xx/sprom.c |
108 | +++ b/arch/mips/bcm63xx/sprom.c |
|
110 | @@ -0,0 +1,70 @@ |
109 | @@ -0,0 +1,70 @@ |
|
111 | +/* |
110 | +/* |
|
112 | + * This file is subject to the terms and conditions of the GNU General Public |
111 | + * This file is subject to the terms and conditions of the GNU General Public |
|
113 | + * License. See the file "COPYING" in the main directory of this archive |
112 | + * License. See the file "COPYING" in the main directory of this archive |
|
114 | + * for more details. |
113 | + * for more details. |
|
115 | + * |
114 | + * |
|
116 | + * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr> |
115 | + * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr> |
|
117 | + * Copyright (C) 2008 Florian Fainelli <florian@openwrt.org> |
116 | + * Copyright (C) 2008 Florian Fainelli <florian@openwrt.org> |
|
118 | + */ |
117 | + */ |
|
119 | + |
118 | + |
|
120 | +#include <linux/init.h> |
119 | +#include <linux/init.h> |
|
121 | +#include <linux/kernel.h> |
120 | +#include <linux/kernel.h> |
|
122 | +#include <linux/string.h> |
121 | +#include <linux/string.h> |
|
123 | +#include <linux/platform_device.h> |
122 | +#include <linux/platform_device.h> |
|
124 | +#include <linux/ssb/ssb.h> |
123 | +#include <linux/ssb/ssb.h> |
|
125 | +#include <bcm63xx_fallback_sprom.h> |
124 | +#include <bcm63xx_fallback_sprom.h> |
|
126 | +#include <board_bcm963xx.h> |
125 | +#include <board_bcm963xx.h> |
|
127 | + |
126 | + |
|
128 | +#define PFX "sprom: " |
127 | +#define PFX "sprom: " |
|
129 | + |
128 | + |
|
130 | +/* |
129 | +/* |
|
131 | + * Register a sane SPROMv2 to make the on-board |
130 | + * Register a sane SPROMv2 to make the on-board |
|
132 | + * bcm4318 WLAN work |
131 | + * bcm4318 WLAN work |
|
133 | + */ |
132 | + */ |
|
134 | +#ifdef CONFIG_SSB_PCIHOST |
133 | +#ifdef CONFIG_SSB_PCIHOST |
|
135 | +static struct ssb_sprom bcm63xx_sprom = { |
134 | +static struct ssb_sprom bcm63xx_sprom = { |
|
136 | + .revision = 0x02, |
135 | + .revision = 0x02, |
|
137 | + .board_rev = 0x17, |
136 | + .board_rev = 0x17, |
|
138 | + .country_code = 0x0, |
137 | + .country_code = 0x0, |
|
139 | + .ant_available_bg = 0x3, |
138 | + .ant_available_bg = 0x3, |
|
140 | + .pa0b0 = 0x15ae, |
139 | + .pa0b0 = 0x15ae, |
|
141 | + .pa0b1 = 0xfa85, |
140 | + .pa0b1 = 0xfa85, |
|
142 | + .pa0b2 = 0xfe8d, |
141 | + .pa0b2 = 0xfe8d, |
|
143 | + .pa1b0 = 0xffff, |
142 | + .pa1b0 = 0xffff, |
|
144 | + .pa1b1 = 0xffff, |
143 | + .pa1b1 = 0xffff, |
|
145 | + .pa1b2 = 0xffff, |
144 | + .pa1b2 = 0xffff, |
|
146 | + .gpio0 = 0xff, |
145 | + .gpio0 = 0xff, |
|
147 | + .gpio1 = 0xff, |
146 | + .gpio1 = 0xff, |
|
148 | + .gpio2 = 0xff, |
147 | + .gpio2 = 0xff, |
|
149 | + .gpio3 = 0xff, |
148 | + .gpio3 = 0xff, |
|
150 | + .maxpwr_bg = 0x004c, |
149 | + .maxpwr_bg = 0x004c, |
|
151 | + .itssi_bg = 0x00, |
150 | + .itssi_bg = 0x00, |
|
152 | + .boardflags_lo = 0x2848, |
151 | + .boardflags_lo = 0x2848, |
|
153 | + .boardflags_hi = 0x0000, |
152 | + .boardflags_hi = 0x0000, |
|
154 | +}; |
153 | +}; |
|
155 | + |
154 | + |
|
156 | +int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out) |
155 | +int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out) |
|
157 | +{ |
156 | +{ |
|
158 | + if (bus->bustype == SSB_BUSTYPE_PCI) { |
157 | + if (bus->bustype == SSB_BUSTYPE_PCI) { |
|
159 | + memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom)); |
158 | + memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom)); |
|
160 | + return 0; |
159 | + return 0; |
|
161 | + } else { |
160 | + } else { |
|
162 | + printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n"); |
161 | + printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n"); |
|
163 | + return -EINVAL; |
162 | + return -EINVAL; |
|
164 | + } |
163 | + } |
|
165 | +} |
164 | +} |
|
166 | +#endif |
165 | +#endif |
|
167 | + |
166 | + |
|
168 | +int __init bcm63xx_register_fallback_sprom(u8 *mac) |
167 | +int __init bcm63xx_register_fallback_sprom(u8 *mac) |
|
169 | +{ |
168 | +{ |
|
170 | + int ret = 0; |
169 | + int ret = 0; |
|
171 | + |
170 | + |
|
172 | +#ifdef CONFIG_SSB_PCIHOST |
171 | +#ifdef CONFIG_SSB_PCIHOST |
|
173 | + memcpy(bcm63xx_sprom.il0mac, mac, ETH_ALEN); |
172 | + memcpy(bcm63xx_sprom.il0mac, mac, ETH_ALEN); |
|
174 | + memcpy(bcm63xx_sprom.et0mac, mac, ETH_ALEN); |
173 | + memcpy(bcm63xx_sprom.et0mac, mac, ETH_ALEN); |
|
175 | + memcpy(bcm63xx_sprom.et1mac, mac, ETH_ALEN); |
174 | + memcpy(bcm63xx_sprom.et1mac, mac, ETH_ALEN); |
|
176 | + |
175 | + |
|
177 | + ret = ssb_arch_register_fallback_sprom(&bcm63xx_get_fallback_sprom); |
176 | + ret = ssb_arch_register_fallback_sprom(&bcm63xx_get_fallback_sprom); |
|
178 | +#endif |
177 | +#endif |
|
179 | + return ret; |
178 | + return ret; |
|
180 | +} |
179 | +} |
|
181 | --- /dev/null |
180 | --- /dev/null |
|
182 | +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h |
181 | +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h |
|
183 | @@ -0,0 +1,6 @@ |
182 | @@ -0,0 +1,6 @@ |
|
184 | +#ifndef __BCM63XX_FALLBACK_SPROM |
183 | +#ifndef __BCM63XX_FALLBACK_SPROM |
|
185 | +#define __BCM63XX_FALLBACK_SPROM |
184 | +#define __BCM63XX_FALLBACK_SPROM |
|
186 | + |
185 | + |
|
187 | +int bcm63xx_register_fallback_sprom(u8 *mac); |
186 | +int bcm63xx_register_fallback_sprom(u8 *mac); |
|
188 | + |
187 | + |
|
189 | +#endif |
188 | +#endif |
|
190 | |
189 | |
|
191 | |
190 | |
|
192 |
|
191 |
|
|
193 | |
192 | |
|
194 | |
193 | |
|
195 | |
194 | |