summaryrefslogtreecommitdiffstats
path: root/arch/avr32/boards
diff options
context:
space:
mode:
authorHaavard Skinnemoen <hskinnemoen@atmel.com>2006-12-04 13:58:27 +0100
committerHaavard Skinnemoen <hskinnemoen@atmel.com>2006-12-08 13:06:19 +0100
commita6f92f3dc8e53185bae50d44b5042b9cddf7f475 (patch)
tree8fb91d7fc304e24393eb52d74b17f840dfdedb5d /arch/avr32/boards
parentcfcb3a89d04144c064023bdc7d8dc600a88cc5c4 (diff)
downloadop-kernel-dev-a6f92f3dc8e53185bae50d44b5042b9cddf7f475.zip
op-kernel-dev-a6f92f3dc8e53185bae50d44b5042b9cddf7f475.tar.gz
[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')
-rw-r--r--arch/avr32/boards/atstk1000/atstk1002.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c
index cced73c..f65865c 100644
--- a/arch/avr32/boards/atstk1000/atstk1002.c
+++ b/arch/avr32/boards/atstk1000/atstk1002.c
@@ -8,19 +8,32 @@
* published by the Free Software Foundation.
*/
#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/types.h>
+#include <asm/setup.h>
#include <asm/arch/board.h>
#include <asm/arch/init.h>
-struct eth_platform_data __initdata eth0_data = {
- .valid = 1,
- .mii_phy_addr = 0x10,
- .is_rmii = 0,
- .hw_addr = { 0x6a, 0x87, 0x71, 0x14, 0xcd, 0xcb },
-};
-
+static struct eth_platform_data __initdata eth_data[2];
extern struct lcdc_platform_data atstk1000_fb0_data;
+static int __init parse_tag_ethernet(struct tag *tag)
+{
+ int i;
+
+ i = tag->u.ethernet.mac_index;
+ if (i < ARRAY_SIZE(eth_data)) {
+ eth_data[i].mii_phy_addr = tag->u.ethernet.mii_phy_addr;
+ memcpy(&eth_data[i].hw_addr, tag->u.ethernet.hw_address,
+ sizeof(eth_data[i].hw_addr));
+ eth_data[i].valid = 1;
+ }
+ return 0;
+}
+__tagtable(ATAG_ETHERNET, parse_tag_ethernet);
+
void __init setup_board(void)
{
at32_map_usart(1, 0); /* /dev/ttyS0 */
@@ -38,7 +51,9 @@ static int __init atstk1002_init(void)
at32_add_device_usart(1);
at32_add_device_usart(2);
- at32_add_device_eth(0, &eth0_data);
+ if (eth_data[0].valid)
+ at32_add_device_eth(0, &eth_data[0]);
+
at32_add_device_spi(0);
at32_add_device_lcdc(0, &atstk1000_fb0_data);
OpenPOWER on IntegriCloud