Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: mv643xx_eth: proper initialization for Kirkwood SoCs

Ethernet controllers found on Kirkwood SoCs not only suffer from loosing
MAC address register contents on clock gating but also some important
registers are reset to values that would break ethernet. This patch
clears the CLK125_BYPASS_EN bit for DT enabled Kirkwood only by using
of_device_is_compatible() instead of #ifdefs. Non-DT Kirkwood is not
affected as it installs a clock gating workaround because of the MAC
address issue above. Other Orion SoCs do not suffer from register reset,
do not have the bit in question, or do not have the register at all.
Moreover, system controllers on PPC using this driver should also be
protected from clearing that bit.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Sebastian Hesselbarth and committed by
David S. Miller
cb85215f cc9d4598

+11
+11
drivers/net/ethernet/marvell/mv643xx_eth.c
··· 116 116 #define LINK_UP 0x00000002 117 117 #define TXQ_COMMAND 0x0048 118 118 #define TXQ_FIX_PRIO_CONF 0x004c 119 + #define PORT_SERIAL_CONTROL1 0x004c 120 + #define CLK125_BYPASS_EN 0x00000010 119 121 #define TX_BW_RATE 0x0050 120 122 #define TX_BW_MTU 0x0058 121 123 #define TX_BW_BURST 0x005c ··· 2702 2700 mp->port_num = pd->port_number; 2703 2701 2704 2702 mp->dev = dev; 2703 + 2704 + /* Kirkwood resets some registers on gated clocks. Especially 2705 + * CLK125_BYPASS_EN must be cleared but is not available on 2706 + * all other SoCs/System Controllers using this driver. 2707 + */ 2708 + if (of_device_is_compatible(pdev->dev.of_node, 2709 + "marvell,kirkwood-eth-port")) 2710 + wrlp(mp, PORT_SERIAL_CONTROL1, 2711 + rdlp(mp, PORT_SERIAL_CONTROL1) & ~CLK125_BYPASS_EN); 2705 2712 2706 2713 /* 2707 2714 * Start with a default rate, and if there is a clock, allow