diff options
author | Haavard Skinnemoen <hskinnemoen@atmel.com> | 2006-12-04 07:58:27 -0500 |
---|---|---|
committer | Haavard Skinnemoen <hskinnemoen@atmel.com> | 2006-12-08 07:06:19 -0500 |
commit | a6f92f3dc8e53185bae50d44b5042b9cddf7f475 (patch) | |
tree | 8fb91d7fc304e24393eb52d74b17f840dfdedb5d /arch/avr32/boards/atstk1000/atstk1002.c | |
parent | cfcb3a89d04144c064023bdc7d8dc600a88cc5c4 (diff) |
[AVR32] Move ethernet tag parsing to board-specific code
By moving the ethernet tag parsing to the board-specific code we avoid
the issue of figuring out which device we're supposed to attach the
information to. The board specific code knows this because it's
where the actual devices are instantiated.
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Diffstat (limited to 'arch/avr32/boards/atstk1000/atstk1002.c')
-rw-r--r-- | arch/avr32/boards/atstk1000/atstk1002.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c index cced73c58115..f65865cd9c3b 100644 --- a/arch/avr32/boards/atstk1000/atstk1002.c +++ b/arch/avr32/boards/atstk1000/atstk1002.c | |||
@@ -8,19 +8,32 @@ | |||
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
9 | */ | 9 | */ |
10 | #include <linux/init.h> | 10 | #include <linux/init.h> |
11 | #include <linux/kernel.h> | ||
12 | #include <linux/string.h> | ||
13 | #include <linux/types.h> | ||
11 | 14 | ||
15 | #include <asm/setup.h> | ||
12 | #include <asm/arch/board.h> | 16 | #include <asm/arch/board.h> |
13 | #include <asm/arch/init.h> | 17 | #include <asm/arch/init.h> |
14 | 18 | ||
15 | struct eth_platform_data __initdata eth0_data = { | 19 | static struct eth_platform_data __initdata eth_data[2]; |
16 | .valid = 1, | ||
17 | .mii_phy_addr = 0x10, | ||
18 | .is_rmii = 0, | ||
19 | .hw_addr = { 0x6a, 0x87, 0x71, 0x14, 0xcd, 0xcb }, | ||
20 | }; | ||
21 | |||
22 | extern struct lcdc_platform_data atstk1000_fb0_data; | 20 | extern struct lcdc_platform_data atstk1000_fb0_data; |
23 | 21 | ||
22 | static int __init parse_tag_ethernet(struct tag *tag) | ||
23 | { | ||
24 | int i; | ||
25 | |||
26 | i = tag->u.ethernet.mac_index; | ||
27 | if (i < ARRAY_SIZE(eth_data)) { | ||
28 | eth_data[i].mii_phy_addr = tag->u.ethernet.mii_phy_addr; | ||
29 | memcpy(ð_data[i].hw_addr, tag->u.ethernet.hw_address, | ||
30 | sizeof(eth_data[i].hw_addr)); | ||
31 | eth_data[i].valid = 1; | ||
32 | } | ||
33 | return 0; | ||
34 | } | ||
35 | __tagtable(ATAG_ETHERNET, parse_tag_ethernet); | ||
36 | |||
24 | void __init setup_board(void) | 37 | void __init setup_board(void) |
25 | { | 38 | { |
26 | at32_map_usart(1, 0); /* /dev/ttyS0 */ | 39 | at32_map_usart(1, 0); /* /dev/ttyS0 */ |
@@ -38,7 +51,9 @@ static int __init atstk1002_init(void) | |||
38 | at32_add_device_usart(1); | 51 | at32_add_device_usart(1); |
39 | at32_add_device_usart(2); | 52 | at32_add_device_usart(2); |
40 | 53 | ||
41 | at32_add_device_eth(0, ð0_data); | 54 | if (eth_data[0].valid) |
55 | at32_add_device_eth(0, ð_data[0]); | ||
56 | |||
42 | at32_add_device_spi(0); | 57 | at32_add_device_spi(0); |
43 | at32_add_device_lcdc(0, &atstk1000_fb0_data); | 58 | at32_add_device_lcdc(0, &atstk1000_fb0_data); |
44 | 59 | ||