national.c (c39f2d9db0fd81ea20bb5cce9b3f082ca63753e2) national.c (e47488b2df7f9cb405789c7f5d4c27909fc597ae)
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * drivers/net/phy/national.c
4 *
5 * Driver for National Semiconductor PHYs
6 *
7 * Author: Stuart Menefy <stuart.menefy@st.com>
8 * Maintainer: Giuseppe Cavallaro <peppe.cavallaro@st.com>

--- 91 unchanged lines hidden (view full) ---

100 phy_write(phydev, NS_EXP_MEM_ADD, 0x1C0);
101 phy_write(phydev, NS_EXP_MEM_DATA, 0x0008);
102 phy_write(phydev, MII_BMCR, (bmcr & ~BMCR_PDOWN));
103 phy_write(phydev, LED_CTRL_REG, mode);
104}
105
106static void ns_10_base_t_hdx_loopack(struct phy_device *phydev, int disable)
107{
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * drivers/net/phy/national.c
4 *
5 * Driver for National Semiconductor PHYs
6 *
7 * Author: Stuart Menefy <stuart.menefy@st.com>
8 * Maintainer: Giuseppe Cavallaro <peppe.cavallaro@st.com>

--- 91 unchanged lines hidden (view full) ---

100 phy_write(phydev, NS_EXP_MEM_ADD, 0x1C0);
101 phy_write(phydev, NS_EXP_MEM_DATA, 0x0008);
102 phy_write(phydev, MII_BMCR, (bmcr & ~BMCR_PDOWN));
103 phy_write(phydev, LED_CTRL_REG, mode);
104}
105
106static void ns_10_base_t_hdx_loopack(struct phy_device *phydev, int disable)
107{
108 u16 lb_dis = BIT(1);
109
108 if (disable)
110 if (disable)
109 ns_exp_write(phydev, 0x1c0, ns_exp_read(phydev, 0x1c0) | 1);
111 ns_exp_write(phydev, 0x1c0,
112 ns_exp_read(phydev, 0x1c0) | lb_dis);
110 else
111 ns_exp_write(phydev, 0x1c0,
113 else
114 ns_exp_write(phydev, 0x1c0,
112 ns_exp_read(phydev, 0x1c0) & 0xfffe);
115 ns_exp_read(phydev, 0x1c0) & ~lb_dis);
113
114 pr_debug("10BASE-T HDX loopback %s\n",
116
117 pr_debug("10BASE-T HDX loopback %s\n",
115 (ns_exp_read(phydev, 0x1c0) & 0x0001) ? "off" : "on");
118 (ns_exp_read(phydev, 0x1c0) & lb_dis) ? "off" : "on");
116}
117
118static int ns_config_init(struct phy_device *phydev)
119{
120 ns_giga_speed_fallback(phydev, ALL_FALLBACK_ON);
121 /* In the latest MAC or switches design, the 10 Mbps loopback
122 is desired to be turned off. */
123 ns_10_base_t_hdx_loopack(phydev, hdx_loopback_off);

--- 25 unchanged lines hidden ---
119}
120
121static int ns_config_init(struct phy_device *phydev)
122{
123 ns_giga_speed_fallback(phydev, ALL_FALLBACK_ON);
124 /* In the latest MAC or switches design, the 10 Mbps loopback
125 is desired to be turned off. */
126 ns_10_base_t_hdx_loopack(phydev, hdx_loopback_off);

--- 25 unchanged lines hidden ---