aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/stmmac/dwmac1000_core.c
diff options
context:
space:
mode:
authorGiuseppe CAVALLARO <peppe.cavallaro@st.com>2010-09-16 23:23:40 -0400
committerDavid S. Miller <davem@davemloft.net>2010-09-17 19:12:57 -0400
commitebbb293f8b3021ae2009fcb7cb3b8a52fb5fd06a (patch)
tree9ee381c887f2bc585c103a34b349d85fd95a2567 /drivers/net/stmmac/dwmac1000_core.c
parentdfb8fb96ae2b5126cd0c08c0ccd7c42e1f46568a (diff)
stmmac: consolidate and tidy-up the COE support
The first version of the driver had hard-coded the logic for handling the checksum offloading. This was designed according to the chips included in the STM platforms where: o MAC10/100 supports no COE at all. o GMAC fully supports RX/TX COE. This is not good for other chip configurations where, for example, the mac10/100 supports the tx csum in HW or when the GMAC has no IPC. Thanks to Johannes Stezenbach; he provided me a first draft of this patch that only reviewed the IPC for the GMAC devices. This patch also helps on SPEAr platforms where the MAC10/100 can perform the TX csum in HW. Thanks to Deepak SIKRI for his support on this. In the end, GMAC devices for STM platforms have a bugged Jumbo frame support that needs to have the Tx COE disabled for oversized frames (due to limited buffer sizes). This information is also passed through the driver's platform structure. Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Signed-off-by: Johannes Stezenbach <js@sig21.net> Signed-off-by: Deepak SIKRI <deepak.sikri@st.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/stmmac/dwmac1000_core.c')
-rw-r--r--drivers/net/stmmac/dwmac1000_core.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/net/stmmac/dwmac1000_core.c b/drivers/net/stmmac/dwmac1000_core.c
index f1f426146f40..c18c85993179 100644
--- a/drivers/net/stmmac/dwmac1000_core.c
+++ b/drivers/net/stmmac/dwmac1000_core.c
@@ -50,6 +50,18 @@ static void dwmac1000_core_init(void __iomem *ioaddr)
50#endif 50#endif
51} 51}
52 52
53static int dwmac1000_rx_coe_supported(void __iomem *ioaddr)
54{
55 u32 value = readl(ioaddr + GMAC_CONTROL);
56
57 value |= GMAC_CONTROL_IPC;
58 writel(value, ioaddr + GMAC_CONTROL);
59
60 value = readl(ioaddr + GMAC_CONTROL);
61
62 return !!(value & GMAC_CONTROL_IPC);
63}
64
53static void dwmac1000_dump_regs(void __iomem *ioaddr) 65static void dwmac1000_dump_regs(void __iomem *ioaddr)
54{ 66{
55 int i; 67 int i;
@@ -202,6 +214,7 @@ static void dwmac1000_irq_status(void __iomem *ioaddr)
202 214
203struct stmmac_ops dwmac1000_ops = { 215struct stmmac_ops dwmac1000_ops = {
204 .core_init = dwmac1000_core_init, 216 .core_init = dwmac1000_core_init,
217 .rx_coe = dwmac1000_rx_coe_supported,
205 .dump_regs = dwmac1000_dump_regs, 218 .dump_regs = dwmac1000_dump_regs,
206 .host_irq_status = dwmac1000_irq_status, 219 .host_irq_status = dwmac1000_irq_status,
207 .set_filter = dwmac1000_set_filter, 220 .set_filter = dwmac1000_set_filter,