OpenWrt – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | From 8575548b08e33c9ff4fd540abec09dd177e33682 Mon Sep 17 00:00:00 2001 |
2 | From: Jonas Gorski <jogo@openwrt.org> |
||
3 | Date: Thu, 31 Jul 2014 19:12:33 +0200 |
||
4 | Subject: [PATCH 09/10] MIPS: BCM63XX: allow board files to provide sprom |
||
5 | fixups |
||
6 | |||
7 | Allow board_info files to supply fixups for the base sproms to adapt |
||
8 | them to the actual used sprom contents in case they do not use the |
||
9 | default ones. |
||
10 | |||
11 | Signed-off-by: Jonas Gorski <jogo@openwrt.org> |
||
12 | --- |
||
13 | arch/mips/bcm63xx/sprom.c | 14 +++++++++++++- |
||
14 | .../mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h | 8 ++++++++ |
||
15 | 2 files changed, 21 insertions(+), 1 deletion(-) |
||
16 | |||
17 | --- a/arch/mips/bcm63xx/sprom.c |
||
18 | +++ b/arch/mips/bcm63xx/sprom.c |
||
19 | @@ -883,6 +883,14 @@ static int sprom_extract(struct ssb_spro |
||
20 | return 0; |
||
21 | } |
||
22 | |||
23 | +void sprom_apply_fixups(u16 *sprom, struct sprom_fixup *fixups, int n) |
||
24 | +{ |
||
25 | + unsigned int i; |
||
26 | + |
||
27 | + for (i = 0; i < n; i++) |
||
28 | + sprom[fixups[i].offset] = fixups[i].value; |
||
29 | +} |
||
30 | + |
||
31 | static __initdata u16 template_sprom[220]; |
||
32 | #endif |
||
33 | |||
34 | @@ -961,8 +969,12 @@ int __init bcm63xx_register_fallback_spr |
||
35 | return -EINVAL; |
||
36 | } |
||
37 | |||
38 | - if (size > 0) |
||
39 | + if (size > 0) { |
||
40 | + sprom_apply_fixups(template_sprom, data->board_fixups, |
||
41 | + data->num_board_fixups); |
||
42 | + |
||
43 | sprom_extract(&bcm63xx_sprom, template_sprom, size); |
||
44 | + } |
||
45 | |||
46 | memcpy(bcm63xx_sprom.il0mac, data->mac_addr, ETH_ALEN); |
||
47 | memcpy(bcm63xx_sprom.et0mac, data->mac_addr, ETH_ALEN); |
||
48 | --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h |
||
49 | +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h |
||
50 | @@ -21,9 +21,17 @@ enum sprom_type { |
||
51 | SPROM_BCM4331, |
||
52 | }; |
||
53 | |||
54 | +struct sprom_fixup { |
||
55 | + u16 offset; |
||
56 | + u16 value; |
||
57 | +}; |
||
58 | + |
||
59 | struct fallback_sprom_data { |
||
60 | u8 mac_addr[ETH_ALEN]; |
||
61 | enum sprom_type type; |
||
62 | + |
||
63 | + struct sprom_fixup *board_fixups; |
||
64 | + unsigned int num_board_fixups; |
||
65 | }; |
||
66 | |||
67 | int bcm63xx_register_fallback_sprom(struct fallback_sprom_data *data); |