OpenWrt – Diff between revs 2 and 3
?pathlinks?
Rev 2 | Rev 3 | |||
---|---|---|---|---|
1 | From 4e9c34a37bd3442b286ba55441bfe22c1ac5b65f Mon Sep 17 00:00:00 2001 |
1 | From 4e9c34a37bd3442b286ba55441bfe22c1ac5b65f Mon Sep 17 00:00:00 2001 |
|
2 | From: Jonas Gorski <jogo@openwrt.org> |
2 | From: Jonas Gorski <jogo@openwrt.org> |
|
3 | Date: Sun, 9 Mar 2014 04:08:06 +0100 |
3 | Date: Sun, 9 Mar 2014 04:08:06 +0100 |
|
4 | Subject: [PATCH 41/44] MIPS: BCM63XX: pass a mac addresss allocator to board |
4 | Subject: [PATCH 41/44] MIPS: BCM63XX: pass a mac addresss allocator to board |
|
5 | setup |
5 | setup |
|
6 | |
6 | |
|
7 | Pass a mac address allocator to board setup code to allow board |
7 | Pass a mac address allocator to board setup code to allow board |
|
8 | implementations to work with third party bootloaders not using nvram |
8 | implementations to work with third party bootloaders not using nvram |
|
9 | for configuration storage. |
9 | for configuration storage. |
|
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/boards/board_bcm963xx.c | 3 ++- |
13 | arch/mips/bcm63xx/boards/board_bcm963xx.c | 3 ++- |
|
14 | arch/mips/bcm63xx/boards/board_common.c | 16 ++++++++++------ |
14 | arch/mips/bcm63xx/boards/board_common.c | 16 ++++++++++------ |
|
15 | arch/mips/bcm63xx/boards/board_common.h | 3 ++- |
15 | arch/mips/bcm63xx/boards/board_common.h | 3 ++- |
|
16 | 3 files changed, 14 insertions(+), 8 deletions(-) |
16 | 3 files changed, 14 insertions(+), 8 deletions(-) |
|
17 | |
17 | |
|
18 | --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c |
18 | --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c |
|
19 | +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c |
19 | +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c |
|
20 | @@ -727,7 +727,8 @@ void __init board_prom_init(void) |
20 | @@ -743,7 +743,8 @@ void __init board_prom_init(void) |
|
21 | if (strncmp(board_name, bcm963xx_boards[i]->name, 16)) |
21 | if (strncmp(board_name, bcm963xx_boards[i]->name, 16)) |
|
22 | continue; |
22 | continue; |
|
23 | /* copy, board desc array is marked initdata */ |
23 | /* copy, board desc array is marked initdata */ |
|
24 | - board_early_setup(bcm963xx_boards[i]); |
24 | - board_early_setup(bcm963xx_boards[i]); |
|
25 | + board_early_setup(bcm963xx_boards[i], |
25 | + board_early_setup(bcm963xx_boards[i], |
|
26 | + bcm63xx_nvram_get_mac_address); |
26 | + bcm63xx_nvram_get_mac_address); |
|
27 | break; |
27 | break; |
|
28 | } |
28 | } |
|
29 | |
29 | |
|
30 | --- a/arch/mips/bcm63xx/boards/board_common.c |
30 | --- a/arch/mips/bcm63xx/boards/board_common.c |
|
31 | +++ b/arch/mips/bcm63xx/boards/board_common.c |
31 | +++ b/arch/mips/bcm63xx/boards/board_common.c |
|
32 | @@ -18,7 +18,6 @@ |
32 | @@ -18,7 +18,6 @@ |
|
33 | #include <bcm63xx_dev_uart.h> |
33 | #include <bcm63xx_dev_uart.h> |
|
34 | #include <bcm63xx_regs.h> |
34 | #include <bcm63xx_regs.h> |
|
35 | #include <bcm63xx_io.h> |
35 | #include <bcm63xx_io.h> |
|
36 | -#include <bcm63xx_nvram.h> |
36 | -#include <bcm63xx_nvram.h> |
|
37 | #include <bcm63xx_gpio.h> |
37 | #include <bcm63xx_gpio.h> |
|
38 | #include <bcm63xx_dev_pci.h> |
38 | #include <bcm63xx_dev_pci.h> |
|
39 | #include <bcm63xx_dev_enet.h> |
39 | #include <bcm63xx_dev_enet.h> |
|
40 | @@ -81,15 +80,20 @@ const char *board_get_name(void) |
40 | @@ -82,15 +81,20 @@ const char *board_get_name(void) |
|
41 | return board.name; |
41 | return board.name; |
|
42 | } |
42 | } |
|
43 | |
43 | |
|
44 | +static int (*board_get_mac_address)(u8 mac[ETH_ALEN]); |
44 | +static int (*board_get_mac_address)(u8 mac[ETH_ALEN]); |
|
45 | + |
45 | + |
|
46 | /* |
46 | /* |
|
47 | * setup board for device registration |
47 | * setup board for device registration |
|
48 | */ |
48 | */ |
|
49 | -void __init board_early_setup(const struct board_info *target) |
49 | -void __init board_early_setup(const struct board_info *target) |
|
50 | +void __init board_early_setup(const struct board_info *target, |
50 | +void __init board_early_setup(const struct board_info *target, |
|
51 | + int (*get_mac_address)(u8 mac[ETH_ALEN])) |
51 | + int (*get_mac_address)(u8 mac[ETH_ALEN])) |
|
52 | { |
52 | { |
|
53 | u32 val; |
53 | u32 val; |
|
54 | |
54 | |
|
55 | memcpy(&board, target, sizeof(board)); |
55 | memcpy(&board, target, sizeof(board)); |
|
56 | |
56 | |
|
57 | + board_get_mac_address = get_mac_address; |
57 | + board_get_mac_address = get_mac_address; |
|
58 | + |
58 | + |
|
59 | /* setup pin multiplexing depending on board enabled device, |
59 | /* setup pin multiplexing depending on board enabled device, |
|
60 | * this has to be done this early since PCI init is done |
60 | * this has to be done this early since PCI init is done |
|
61 | * inside arch_initcall */ |
61 | * inside arch_initcall */ |
|
62 | @@ -162,15 +166,15 @@ int __init board_register_devices(void) |
62 | @@ -163,15 +167,15 @@ int __init board_register_devices(void) |
|
63 | bcm63xx_pcmcia_register(); |
63 | bcm63xx_pcmcia_register(); |
|
64 | |
64 | |
|
65 | if (board.has_enet0 && |
65 | if (board.has_enet0 && |
|
66 | - !bcm63xx_nvram_get_mac_address(board.enet0.mac_addr)) |
66 | - !bcm63xx_nvram_get_mac_address(board.enet0.mac_addr)) |
|
67 | + !board_get_mac_address(board.enet0.mac_addr)) |
67 | + !board_get_mac_address(board.enet0.mac_addr)) |
|
68 | bcm63xx_enet_register(0, &board.enet0); |
68 | bcm63xx_enet_register(0, &board.enet0); |
|
69 | |
69 | |
|
70 | if (board.has_enet1 && |
70 | if (board.has_enet1 && |
|
71 | - !bcm63xx_nvram_get_mac_address(board.enet1.mac_addr)) |
71 | - !bcm63xx_nvram_get_mac_address(board.enet1.mac_addr)) |
|
72 | + !board_get_mac_address(board.enet1.mac_addr)) |
72 | + !board_get_mac_address(board.enet1.mac_addr)) |
|
73 | bcm63xx_enet_register(1, &board.enet1); |
73 | bcm63xx_enet_register(1, &board.enet1); |
|
74 | |
74 | |
|
75 | if (board.has_enetsw && |
75 | if (board.has_enetsw && |
|
76 | - !bcm63xx_nvram_get_mac_address(board.enetsw.mac_addr)) |
76 | - !bcm63xx_nvram_get_mac_address(board.enetsw.mac_addr)) |
|
77 | + !board_get_mac_address(board.enetsw.mac_addr)) |
77 | + !board_get_mac_address(board.enetsw.mac_addr)) |
|
78 | bcm63xx_enetsw_register(&board.enetsw); |
78 | bcm63xx_enetsw_register(&board.enetsw); |
|
79 | |
79 | |
|
80 | if (board.has_usbd) |
80 | if (board.has_usbd) |
|
81 | @@ -186,7 +190,7 @@ int __init board_register_devices(void) |
81 | @@ -190,7 +194,7 @@ int __init board_register_devices(void) |
|
82 | * do this after registering enet devices |
82 | * do this after registering enet devices |
|
83 | */ |
83 | */ |
|
84 | #ifdef CONFIG_SSB_PCIHOST |
84 | #ifdef CONFIG_SSB_PCIHOST |
|
85 | - if (!bcm63xx_nvram_get_mac_address(bcm63xx_sprom.il0mac)) { |
85 | - if (!bcm63xx_nvram_get_mac_address(bcm63xx_sprom.il0mac)) { |
|
86 | + if (!board_get_mac_address(bcm63xx_sprom.il0mac)) { |
86 | + if (!board_get_mac_address(bcm63xx_sprom.il0mac)) { |
|
87 | memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN); |
87 | memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN); |
|
88 | memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN); |
88 | memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN); |
|
89 | if (ssb_arch_register_fallback_sprom( |
89 | if (ssb_arch_register_fallback_sprom( |
|
90 | --- a/arch/mips/bcm63xx/boards/board_common.h |
90 | --- a/arch/mips/bcm63xx/boards/board_common.h |
|
91 | +++ b/arch/mips/bcm63xx/boards/board_common.h |
91 | +++ b/arch/mips/bcm63xx/boards/board_common.h |
|
92 | @@ -3,6 +3,7 @@ |
92 | @@ -3,6 +3,7 @@ |
|
93 | |
93 | |
|
94 | #include <board_bcm963xx.h> |
94 | #include <board_bcm963xx.h> |
|
95 | |
95 | |
|
96 | -void board_early_setup(const struct board_info *board); |
96 | -void board_early_setup(const struct board_info *board); |
|
97 | +void board_early_setup(const struct board_info *board, |
97 | +void board_early_setup(const struct board_info *board, |
|
98 | + int (*get_mac_address)(u8 mac[ETH_ALEN])); |
98 | + int (*get_mac_address)(u8 mac[ETH_ALEN])); |
|
99 | |
99 | |
|
100 | #endif /* __BOARD_COMMON_H */ |
100 | #endif /* __BOARD_COMMON_H */ |
|
101 | |
101 | |