brcm47xx: add support for ipv6 in default network config
[openwrt/svn-archive/archive.git] / target / linux / kirkwood / patches-3.10 / 0022-net-mv643xx_eth-proper-initialization-for-Kirkwood-S.patch
1 From 3b0f26629fef1b55a71031b4ef4db27d0a66a0be Mon Sep 17 00:00:00 2001
2 From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
3 Date: Wed, 29 May 2013 21:32:47 +0200
4 Subject: [PATCH 22/29] net: mv643xx_eth: proper initialization for Kirkwood
5 SoCs
6
7 Ethernet controllers found on Kirkwood SoCs not only suffer from loosing
8 MAC address register contents on clock gating but also some important
9 registers are reset to values that would break ethernet. This patch
10 clears the CLK125_BYPASS_EN bit for DT enabled Kirkwood only by using
11 of_device_is_compatible() instead of #ifdefs. Non-DT Kirkwood is not
12 affected as it installs a clock gating workaround because of the MAC
13 address issue above. Other Orion SoCs do not suffer from register reset,
14 do not have the bit in question, or do not have the register at all.
15 Moreover, system controllers on PPC using this driver should also be
16 protected from clearing that bit.
17
18 Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
19 ---
20 drivers/net/ethernet/marvell/mv643xx_eth.c | 11 +++++++++++
21 1 file changed, 11 insertions(+)
22
23 diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
24 index 946033b..af6bdcc 100644
25 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c
26 +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
27 @@ -116,6 +116,8 @@ static char mv643xx_eth_driver_version[] = "1.4";
28 #define LINK_UP 0x00000002
29 #define TXQ_COMMAND 0x0048
30 #define TXQ_FIX_PRIO_CONF 0x004c
31 +#define PORT_SERIAL_CONTROL1 0x004c
32 +#define CLK125_BYPASS_EN 0x00000010
33 #define TX_BW_RATE 0x0050
34 #define TX_BW_MTU 0x0058
35 #define TX_BW_BURST 0x005c
36 @@ -2701,6 +2703,15 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
37
38 mp->dev = dev;
39
40 + /* Kirkwood resets some registers on gated clocks. Especially
41 + * CLK125_BYPASS_EN must be cleared but is not available on
42 + * all other SoCs/System Controllers using this driver.
43 + */
44 + if (of_device_is_compatible(pdev->dev.of_node,
45 + "marvell,kirkwood-eth-port"))
46 + wrlp(mp, PORT_SERIAL_CONTROL1,
47 + rdlp(mp, PORT_SERIAL_CONTROL1) & ~CLK125_BYPASS_EN);
48 +
49 /*
50 * Start with a default rate, and if there is a clock, allow
51 * it to override the default.
52 --
53 1.8.4.rc1
54