aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/coldfire/patches/049-Update-FEC-driver-for-MCF5445x-and-MCF54418.patch
blob: 3a25350c09c22d22dd6f9db916e287aecd24ae2d (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
From bb6fd2eef9359aff90f78b8791967a37e3284784 Mon Sep 17 00:00:00 2001
From: Jason Jin <jason.jin@freescale.com>
Date: Thu, 4 Aug 2011 09:59:55 +0800
Subject: [PATCH 49/52] Update FEC driver for MCF5445x and MCF54418

This patch fixed the bug that FEC could not support 10Mbps
for MCF5445x.
This patch also improved FEC performance.

Signed-off-by: Alison Wang <b18965@freescale.com>
Signed-off-by: Jason Jin <jason.jin@freescale.com>
---
 arch/m68k/coldfire/m5441x/fec.c |    4 ++--
 arch/m68k/coldfire/m5445x/fec.c |   17 +++++++++++++++--
 drivers/net/fec.c               |    9 +++++----
 3 files changed, 22 insertions(+), 8 deletions(-)

--- a/arch/m68k/coldfire/m5441x/fec.c
+++ b/arch/m68k/coldfire/m5441x/fec.c
@@ -98,7 +98,7 @@ static struct fec_platform_data m54418_f
 };
 
 static struct platform_device fec0_coldfire_device = {
-	.name = "m54418-fec",
+	.name = "coldfire-fec",
 	.id = 0,
 	.resource = fec0_resources,
 	.num_resources = ARRAY_SIZE(fec0_resources),
@@ -109,7 +109,7 @@ static struct platform_device fec0_coldf
 
 #if defined(CONFIG_FEC2)
 static struct platform_device fec1_coldfire_device = {
-	.name = "m54418-fec",
+	.name = "coldfire-fec",
 	.id = 1,
 	.resource = fec1_resources,
 	.num_resources = ARRAY_SIZE(fec1_resources),
--- a/arch/m68k/coldfire/m5445x/fec.c
+++ b/arch/m68k/coldfire/m5445x/fec.c
@@ -34,6 +34,10 @@
 #include <linux/skbuff.h>
 #include <linux/spinlock.h>
 #include <linux/workqueue.h>
+#include <linux/platform_device.h>
+#include <linux/fec.h>
+#include <linux/io.h>
+
 #include <asm/pgtable.h>
 
 #include <asm/traps.h>
@@ -89,19 +93,28 @@ static struct resource fec1_resources[]
 };
 #endif
 
+static struct fec_platform_data m5445x_fec_pdata = {
+	.phy = PHY_INTERFACE_MODE_RMII,
+};
 static struct platform_device fec0_coldfire_device = {
-	.name = "fec",
+	.name = "coldfire-fec",
 	.id = 0,
 	.resource = fec0_resources,
 	.num_resources = ARRAY_SIZE(fec0_resources),
+	.dev = {
+		.platform_data = &m5445x_fec_pdata,
+	}
 };
 
 #if defined(CONFIG_FEC2)
 static struct platform_device fec1_coldfire_device = {
-	.name = "fec",
+	.name = "coldfire-fec",
 	.id = 1,
 	.resource = fec1_resources,
 	.num_resources = ARRAY_SIZE(fec1_resources),
+	.dev = {
+		.platform_data = &m5445x_fec_pdata,
+	}
 };
 #endif
 
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -76,7 +76,7 @@ static struct platform_device_id fec_dev
 		.name = "imx28-fec",
 		.driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME,
 	}, {
-		.name = "m54418-fec",
+		.name = "coldfire-fec",
 		.driver_data = FEC_QUIRK_ENET_MAC,
 	},
 	{ }
@@ -341,8 +341,9 @@ fec_enet_start_xmit(struct sk_buff *skb,
 	/* Push the data cache so the CPM does not get stale memory
 	 * data.
 	 */
-	bdp->cbd_bufaddr = dma_map_single(&dev->dev, bufaddr,
-			FEC_ENET_TX_FRSIZE, DMA_TO_DEVICE);
+	bdp->cbd_bufaddr = __pa(bufaddr);
+	flush_dcache_range((unsigned long)skb->data,
+			(unsigned long)skb->data + skb->len);
 
 	/* Send it on its way.  Tell FEC it's ready, interrupt when done,
 	 * it's the last BD of the frame, and to put the CRC on the end.
@@ -1074,7 +1075,7 @@ static int fec_enet_alloc_buffers(struct
 
 	bdp = fep->tx_bd_base;
 	for (i = 0; i < TX_RING_SIZE; i++) {
-		fep->tx_bounce[i] = kmalloc(FEC_ENET_TX_FRSIZE, GFP_KERNEL);
+		fep->tx_bounce[i] = kmalloc(FEC_ENET_TX_FRSIZE, GFP_DMA);
 
 		bdp->cbd_sc = 0;
 		bdp->cbd_bufaddr = 0;