[AVR32] Move ethernet tag parsing to board-specific code
[safe/jmp/linux-2.6] / arch / avr32 / boards / atstk1000 / atstk1002.c
1 /*
2  * ATSTK1002 daughterboard-specific init code
3  *
4  * Copyright (C) 2005-2006 Atmel Corporation
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  */
10 #include <linux/init.h>
11 #include <linux/kernel.h>
12 #include <linux/string.h>
13 #include <linux/types.h>
14
15 #include <asm/setup.h>
16 #include <asm/arch/board.h>
17 #include <asm/arch/init.h>
18
19 static struct eth_platform_data __initdata eth_data[2];
20 extern struct lcdc_platform_data atstk1000_fb0_data;
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(&eth_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
37 void __init setup_board(void)
38 {
39         at32_map_usart(1, 0);   /* /dev/ttyS0 */
40         at32_map_usart(2, 1);   /* /dev/ttyS1 */
41         at32_map_usart(3, 2);   /* /dev/ttyS2 */
42
43         at32_setup_serial_console(0);
44 }
45
46 static int __init atstk1002_init(void)
47 {
48         at32_add_system_devices();
49
50         at32_add_device_usart(0);
51         at32_add_device_usart(1);
52         at32_add_device_usart(2);
53
54         if (eth_data[0].valid)
55                 at32_add_device_eth(0, &eth_data[0]);
56
57         at32_add_device_spi(0);
58         at32_add_device_lcdc(0, &atstk1000_fb0_data);
59
60         return 0;
61 }
62 postcore_initcall(atstk1002_init);