aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/linux/linux-2.6.18/avr32-move-ethernet-tag-parsing-to-board-specific-code.patch
blob: 03e08785f0b0133ec6ab91195e426a98ebc86f36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
From 736c9c38e8a681d0ecfc4dafe15fcb955fe66a29 Mon Sep 17 00:00:00 2001
From: Haavard Skinnemoen <hskinnemoen@atmel.com>
Date: Tue, 24 Oct 2006 09:34:48 +0200
Subject: [PATCH] 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>
---
 arch/avr32/boards/atstk1000/atstk1002.c |   26 ++++++++++++++++++++------
 arch/avr32/kernel/setup.c               |   24 ------------------------
 2 files changed, 20 insertions(+), 30 deletions(-)

Index: linux-2.6.18-avr32/arch/avr32/boards/atstk1000/atstk1002.c
===================================================================
--- linux-2.6.18-avr32.orig/arch/avr32/boards/atstk1000/atstk1002.c	2006-11-01 13:26:19.000000000 +0100
+++ linux-2.6.18-avr32/arch/avr32/boards/atstk1000/atstk1002.c	2006-11-01 13:33:38.000000000 +0100
@@ -8,18 +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>
 
-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);
+
 static int __init atstk1002_init(void)
 {
 	at32_add_system_devices();
Index: linux-2.6.18-avr32/arch/avr32/kernel/setup.c
===================================================================
--- linux-2.6.18-avr32.orig/arch/avr32/kernel/setup.c	2006-11-01 13:26:19.000000000 +0100
+++ linux-2.6.18-avr32/arch/avr32/kernel/setup.c	2006-11-01 13:31:32.000000000 +0100
@@ -229,30 +229,6 @@ static int __init parse_tag_rsvd_mem(str
 }
 __tagtable(ATAG_RSVD_MEM, parse_tag_rsvd_mem);
 
-static int __init parse_tag_ethernet(struct tag *tag)
-{
-#if 0
-	const struct platform_device *pdev;
-
-	/*
-	 * We really need a bus type that supports "classes"...this
-	 * will do for now (until we must handle other kinds of
-	 * ethernet controllers)
-	 */
-	pdev = platform_get_device("macb", tag->u.ethernet.mac_index);
-	if (pdev && pdev->dev.platform_data) {
-		struct eth_platform_data *data = pdev->dev.platform_data;
-
-		data->valid = 1;
-		data->mii_phy_addr = tag->u.ethernet.mii_phy_addr;
-		memcpy(data->hw_addr, tag->u.ethernet.hw_address,
-		       sizeof(data->hw_addr));
-	}
-#endif
-	return 0;
-}
-__tagtable(ATAG_ETHERNET, parse_tag_ethernet);
-
 /*
  * Scan the tag table for this tag, and call its parse function. The
  * tag table is built by the linker from all the __tagtable