Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Edgar E. Iglesias | 8d3ce68 | 2015-09-25 23:46:08 -0700 | [diff] [blame] | 2 | /* |
| 3 | * TI PHY drivers |
| 4 | * |
Edgar E. Iglesias | 8d3ce68 | 2015-09-25 23:46:08 -0700 | [diff] [blame] | 5 | */ |
| 6 | #include <common.h> |
| 7 | #include <phy.h> |
Dan Murphy | 83fbd0a | 2016-05-02 15:45:59 -0500 | [diff] [blame] | 8 | #include <linux/compat.h> |
| 9 | #include <malloc.h> |
| 10 | |
Dan Murphy | 83fbd0a | 2016-05-02 15:45:59 -0500 | [diff] [blame] | 11 | #include <dm.h> |
| 12 | #include <dt-bindings/net/ti-dp83867.h> |
| 13 | |
Edgar E. Iglesias | 8d3ce68 | 2015-09-25 23:46:08 -0700 | [diff] [blame] | 14 | |
| 15 | /* TI DP83867 */ |
| 16 | #define DP83867_DEVADDR 0x1f |
| 17 | |
| 18 | #define MII_DP83867_PHYCTRL 0x10 |
| 19 | #define MII_DP83867_MICR 0x12 |
Siva Durga Prasad Paladugu | 02c7be6 | 2016-03-25 12:53:43 +0530 | [diff] [blame] | 20 | #define MII_DP83867_CFG2 0x14 |
| 21 | #define MII_DP83867_BISCR 0x16 |
Edgar E. Iglesias | 8d3ce68 | 2015-09-25 23:46:08 -0700 | [diff] [blame] | 22 | #define DP83867_CTRL 0x1f |
| 23 | |
| 24 | /* Extended Registers */ |
Murali Karicheri | 9b05076 | 2018-06-28 14:26:34 -0500 | [diff] [blame] | 25 | #define DP83867_CFG4 0x0031 |
Edgar E. Iglesias | 8d3ce68 | 2015-09-25 23:46:08 -0700 | [diff] [blame] | 26 | #define DP83867_RGMIICTL 0x0032 |
| 27 | #define DP83867_RGMIIDCTL 0x0086 |
Mugunthan V N | 5b6b18e | 2017-01-24 11:15:40 -0600 | [diff] [blame] | 28 | #define DP83867_IO_MUX_CFG 0x0170 |
Edgar E. Iglesias | 8d3ce68 | 2015-09-25 23:46:08 -0700 | [diff] [blame] | 29 | |
| 30 | #define DP83867_SW_RESET BIT(15) |
| 31 | #define DP83867_SW_RESTART BIT(14) |
| 32 | |
| 33 | /* MICR Interrupt bits */ |
| 34 | #define MII_DP83867_MICR_AN_ERR_INT_EN BIT(15) |
| 35 | #define MII_DP83867_MICR_SPEED_CHNG_INT_EN BIT(14) |
| 36 | #define MII_DP83867_MICR_DUP_MODE_CHNG_INT_EN BIT(13) |
| 37 | #define MII_DP83867_MICR_PAGE_RXD_INT_EN BIT(12) |
| 38 | #define MII_DP83867_MICR_AUTONEG_COMP_INT_EN BIT(11) |
| 39 | #define MII_DP83867_MICR_LINK_STS_CHNG_INT_EN BIT(10) |
| 40 | #define MII_DP83867_MICR_FALSE_CARRIER_INT_EN BIT(8) |
| 41 | #define MII_DP83867_MICR_SLEEP_MODE_CHNG_INT_EN BIT(4) |
| 42 | #define MII_DP83867_MICR_WOL_INT_EN BIT(3) |
| 43 | #define MII_DP83867_MICR_XGMII_ERR_INT_EN BIT(2) |
| 44 | #define MII_DP83867_MICR_POL_CHNG_INT_EN BIT(1) |
| 45 | #define MII_DP83867_MICR_JABBER_INT_EN BIT(0) |
| 46 | |
| 47 | /* RGMIICTL bits */ |
| 48 | #define DP83867_RGMII_TX_CLK_DELAY_EN BIT(1) |
| 49 | #define DP83867_RGMII_RX_CLK_DELAY_EN BIT(0) |
| 50 | |
| 51 | /* PHY CTRL bits */ |
| 52 | #define DP83867_PHYCR_FIFO_DEPTH_SHIFT 14 |
Michal Simek | f645915 | 2015-10-19 10:43:30 +0200 | [diff] [blame] | 53 | #define DP83867_MDI_CROSSOVER 5 |
| 54 | #define DP83867_MDI_CROSSOVER_AUTO 2 |
Siva Durga Prasad Paladugu | 02c7be6 | 2016-03-25 12:53:43 +0530 | [diff] [blame] | 55 | #define DP83867_MDI_CROSSOVER_MDIX 2 |
| 56 | #define DP83867_PHYCTRL_SGMIIEN 0x0800 |
| 57 | #define DP83867_PHYCTRL_RXFIFO_SHIFT 12 |
| 58 | #define DP83867_PHYCTRL_TXFIFO_SHIFT 14 |
Edgar E. Iglesias | 8d3ce68 | 2015-09-25 23:46:08 -0700 | [diff] [blame] | 59 | |
| 60 | /* RGMIIDCTL bits */ |
| 61 | #define DP83867_RGMII_TX_CLK_DELAY_SHIFT 4 |
| 62 | |
Siva Durga Prasad Paladugu | 02c7be6 | 2016-03-25 12:53:43 +0530 | [diff] [blame] | 63 | /* CFG2 bits */ |
| 64 | #define MII_DP83867_CFG2_SPEEDOPT_10EN 0x0040 |
| 65 | #define MII_DP83867_CFG2_SGMII_AUTONEGEN 0x0080 |
| 66 | #define MII_DP83867_CFG2_SPEEDOPT_ENH 0x0100 |
| 67 | #define MII_DP83867_CFG2_SPEEDOPT_CNT 0x0800 |
| 68 | #define MII_DP83867_CFG2_SPEEDOPT_INTLOW 0x2000 |
| 69 | #define MII_DP83867_CFG2_MASK 0x003F |
| 70 | |
Edgar E. Iglesias | 8d3ce68 | 2015-09-25 23:46:08 -0700 | [diff] [blame] | 71 | #define MII_MMD_CTRL 0x0d /* MMD Access Control Register */ |
| 72 | #define MII_MMD_DATA 0x0e /* MMD Access Data Register */ |
| 73 | |
| 74 | /* MMD Access Control register fields */ |
| 75 | #define MII_MMD_CTRL_DEVAD_MASK 0x1f /* Mask MMD DEVAD*/ |
| 76 | #define MII_MMD_CTRL_ADDR 0x0000 /* Address */ |
| 77 | #define MII_MMD_CTRL_NOINCR 0x4000 /* no post increment */ |
| 78 | #define MII_MMD_CTRL_INCR_RDWT 0x8000 /* post increment on reads & writes */ |
| 79 | #define MII_MMD_CTRL_INCR_ON_WT 0xC000 /* post increment on writes only */ |
| 80 | |
Dan Murphy | 83fbd0a | 2016-05-02 15:45:59 -0500 | [diff] [blame] | 81 | /* User setting - can be taken from DTS */ |
| 82 | #define DEFAULT_RX_ID_DELAY DP83867_RGMIIDCTL_2_25_NS |
| 83 | #define DEFAULT_TX_ID_DELAY DP83867_RGMIIDCTL_2_75_NS |
| 84 | #define DEFAULT_FIFO_DEPTH DP83867_PHYCR_FIFO_DEPTH_4_B_NIB |
| 85 | |
Mugunthan V N | 5b6b18e | 2017-01-24 11:15:40 -0600 | [diff] [blame] | 86 | /* IO_MUX_CFG bits */ |
| 87 | #define DP83867_IO_MUX_CFG_IO_IMPEDANCE_CTRL 0x1f |
| 88 | |
| 89 | #define DP83867_IO_MUX_CFG_IO_IMPEDANCE_MAX 0x0 |
| 90 | #define DP83867_IO_MUX_CFG_IO_IMPEDANCE_MIN 0x1f |
| 91 | |
Dan Murphy | 83fbd0a | 2016-05-02 15:45:59 -0500 | [diff] [blame] | 92 | struct dp83867_private { |
| 93 | int rx_id_delay; |
| 94 | int tx_id_delay; |
| 95 | int fifo_depth; |
Mugunthan V N | 5b6b18e | 2017-01-24 11:15:40 -0600 | [diff] [blame] | 96 | int io_impedance; |
Murali Karicheri | 9b05076 | 2018-06-28 14:26:34 -0500 | [diff] [blame] | 97 | bool rxctrl_strap_quirk; |
Dan Murphy | 83fbd0a | 2016-05-02 15:45:59 -0500 | [diff] [blame] | 98 | }; |
| 99 | |
Edgar E. Iglesias | 8d3ce68 | 2015-09-25 23:46:08 -0700 | [diff] [blame] | 100 | /** |
| 101 | * phy_read_mmd_indirect - reads data from the MMD registers |
| 102 | * @phydev: The PHY device bus |
| 103 | * @prtad: MMD Address |
| 104 | * @devad: MMD DEVAD |
| 105 | * @addr: PHY address on the MII bus |
| 106 | * |
| 107 | * Description: it reads data from the MMD registers (clause 22 to access to |
| 108 | * clause 45) of the specified phy address. |
| 109 | * To read these registers we have: |
| 110 | * 1) Write reg 13 // DEVAD |
| 111 | * 2) Write reg 14 // MMD Address |
| 112 | * 3) Write reg 13 // MMD Data Command for MMD DEVAD |
| 113 | * 3) Read reg 14 // Read MMD data |
| 114 | */ |
| 115 | int phy_read_mmd_indirect(struct phy_device *phydev, int prtad, |
| 116 | int devad, int addr) |
| 117 | { |
| 118 | int value = -1; |
| 119 | |
| 120 | /* Write the desired MMD Devad */ |
| 121 | phy_write(phydev, addr, MII_MMD_CTRL, devad); |
| 122 | |
| 123 | /* Write the desired MMD register address */ |
| 124 | phy_write(phydev, addr, MII_MMD_DATA, prtad); |
| 125 | |
| 126 | /* Select the Function : DATA with no post increment */ |
| 127 | phy_write(phydev, addr, MII_MMD_CTRL, (devad | MII_MMD_CTRL_NOINCR)); |
| 128 | |
| 129 | /* Read the content of the MMD's selected register */ |
| 130 | value = phy_read(phydev, addr, MII_MMD_DATA); |
| 131 | return value; |
| 132 | } |
| 133 | |
| 134 | /** |
| 135 | * phy_write_mmd_indirect - writes data to the MMD registers |
| 136 | * @phydev: The PHY device |
| 137 | * @prtad: MMD Address |
| 138 | * @devad: MMD DEVAD |
| 139 | * @addr: PHY address on the MII bus |
| 140 | * @data: data to write in the MMD register |
| 141 | * |
| 142 | * Description: Write data from the MMD registers of the specified |
| 143 | * phy address. |
| 144 | * To write these registers we have: |
| 145 | * 1) Write reg 13 // DEVAD |
| 146 | * 2) Write reg 14 // MMD Address |
| 147 | * 3) Write reg 13 // MMD Data Command for MMD DEVAD |
| 148 | * 3) Write reg 14 // Write MMD data |
| 149 | */ |
| 150 | void phy_write_mmd_indirect(struct phy_device *phydev, int prtad, |
| 151 | int devad, int addr, u32 data) |
| 152 | { |
| 153 | /* Write the desired MMD Devad */ |
| 154 | phy_write(phydev, addr, MII_MMD_CTRL, devad); |
| 155 | |
| 156 | /* Write the desired MMD register address */ |
| 157 | phy_write(phydev, addr, MII_MMD_DATA, prtad); |
| 158 | |
| 159 | /* Select the Function : DATA with no post increment */ |
| 160 | phy_write(phydev, addr, MII_MMD_CTRL, (devad | MII_MMD_CTRL_NOINCR)); |
| 161 | |
| 162 | /* Write the data into MMD's selected register */ |
| 163 | phy_write(phydev, addr, MII_MMD_DATA, data); |
| 164 | } |
| 165 | |
Dan Murphy | 83fbd0a | 2016-05-02 15:45:59 -0500 | [diff] [blame] | 166 | #if defined(CONFIG_DM_ETH) |
| 167 | /** |
| 168 | * dp83867_data_init - Convenience function for setting PHY specific data |
| 169 | * |
| 170 | * @phydev: the phy_device struct |
| 171 | */ |
| 172 | static int dp83867_of_init(struct phy_device *phydev) |
| 173 | { |
| 174 | struct dp83867_private *dp83867 = phydev->priv; |
Grygorii Strashko | 00e2c24 | 2018-07-05 12:02:49 -0500 | [diff] [blame] | 175 | ofnode node; |
| 176 | |
| 177 | node = phy_get_ofnode(phydev); |
| 178 | if (!ofnode_valid(node)) |
| 179 | return -EINVAL; |
Mugunthan V N | 5b6b18e | 2017-01-24 11:15:40 -0600 | [diff] [blame] | 180 | |
Grygorii Strashko | 9df3505 | 2018-06-28 14:26:35 -0500 | [diff] [blame] | 181 | if (ofnode_read_bool(node, "ti,max-output-impedance")) |
Mugunthan V N | 5b6b18e | 2017-01-24 11:15:40 -0600 | [diff] [blame] | 182 | dp83867->io_impedance = DP83867_IO_MUX_CFG_IO_IMPEDANCE_MAX; |
Grygorii Strashko | 9df3505 | 2018-06-28 14:26:35 -0500 | [diff] [blame] | 183 | else if (ofnode_read_bool(node, "ti,min-output-impedance")) |
Mugunthan V N | 5b6b18e | 2017-01-24 11:15:40 -0600 | [diff] [blame] | 184 | dp83867->io_impedance = DP83867_IO_MUX_CFG_IO_IMPEDANCE_MIN; |
| 185 | else |
| 186 | dp83867->io_impedance = -EINVAL; |
Dan Murphy | 83fbd0a | 2016-05-02 15:45:59 -0500 | [diff] [blame] | 187 | |
Grygorii Strashko | 9df3505 | 2018-06-28 14:26:35 -0500 | [diff] [blame] | 188 | if (ofnode_read_bool(node, "ti,dp83867-rxctrl-strap-quirk")) |
Murali Karicheri | 9b05076 | 2018-06-28 14:26:34 -0500 | [diff] [blame] | 189 | dp83867->rxctrl_strap_quirk = true; |
Grygorii Strashko | 9df3505 | 2018-06-28 14:26:35 -0500 | [diff] [blame] | 190 | dp83867->rx_id_delay = ofnode_read_u32_default(node, |
| 191 | "ti,rx-internal-delay", |
| 192 | -1); |
Dan Murphy | 83fbd0a | 2016-05-02 15:45:59 -0500 | [diff] [blame] | 193 | |
Grygorii Strashko | 9df3505 | 2018-06-28 14:26:35 -0500 | [diff] [blame] | 194 | dp83867->tx_id_delay = ofnode_read_u32_default(node, |
| 195 | "ti,tx-internal-delay", |
| 196 | -1); |
Dan Murphy | 83fbd0a | 2016-05-02 15:45:59 -0500 | [diff] [blame] | 197 | |
Grygorii Strashko | 9df3505 | 2018-06-28 14:26:35 -0500 | [diff] [blame] | 198 | dp83867->fifo_depth = ofnode_read_u32_default(node, "ti,fifo-depth", |
| 199 | -1); |
Dan Murphy | 83fbd0a | 2016-05-02 15:45:59 -0500 | [diff] [blame] | 200 | |
| 201 | return 0; |
| 202 | } |
| 203 | #else |
| 204 | static int dp83867_of_init(struct phy_device *phydev) |
| 205 | { |
| 206 | struct dp83867_private *dp83867 = phydev->priv; |
| 207 | |
| 208 | dp83867->rx_id_delay = DEFAULT_RX_ID_DELAY; |
| 209 | dp83867->tx_id_delay = DEFAULT_TX_ID_DELAY; |
| 210 | dp83867->fifo_depth = DEFAULT_FIFO_DEPTH; |
Mugunthan V N | 5b6b18e | 2017-01-24 11:15:40 -0600 | [diff] [blame] | 211 | dp83867->io_impedance = -EINVAL; |
Dan Murphy | 83fbd0a | 2016-05-02 15:45:59 -0500 | [diff] [blame] | 212 | |
| 213 | return 0; |
| 214 | } |
| 215 | #endif |
Edgar E. Iglesias | 8d3ce68 | 2015-09-25 23:46:08 -0700 | [diff] [blame] | 216 | |
| 217 | static int dp83867_config(struct phy_device *phydev) |
| 218 | { |
Dan Murphy | 83fbd0a | 2016-05-02 15:45:59 -0500 | [diff] [blame] | 219 | struct dp83867_private *dp83867; |
Siva Durga Prasad Paladugu | 02c7be6 | 2016-03-25 12:53:43 +0530 | [diff] [blame] | 220 | unsigned int val, delay, cfg2; |
Edgar E. Iglesias | 8d3ce68 | 2015-09-25 23:46:08 -0700 | [diff] [blame] | 221 | int ret; |
| 222 | |
Dan Murphy | 83fbd0a | 2016-05-02 15:45:59 -0500 | [diff] [blame] | 223 | if (!phydev->priv) { |
| 224 | dp83867 = kzalloc(sizeof(*dp83867), GFP_KERNEL); |
| 225 | if (!dp83867) |
| 226 | return -ENOMEM; |
| 227 | |
| 228 | phydev->priv = dp83867; |
| 229 | ret = dp83867_of_init(phydev); |
| 230 | if (ret) |
| 231 | goto err_out; |
| 232 | } else { |
| 233 | dp83867 = (struct dp83867_private *)phydev->priv; |
| 234 | } |
| 235 | |
Edgar E. Iglesias | 8d3ce68 | 2015-09-25 23:46:08 -0700 | [diff] [blame] | 236 | /* Restart the PHY. */ |
| 237 | val = phy_read(phydev, MDIO_DEVAD_NONE, DP83867_CTRL); |
| 238 | phy_write(phydev, MDIO_DEVAD_NONE, DP83867_CTRL, |
| 239 | val | DP83867_SW_RESTART); |
| 240 | |
Murali Karicheri | 9b05076 | 2018-06-28 14:26:34 -0500 | [diff] [blame] | 241 | /* Mode 1 or 2 workaround */ |
| 242 | if (dp83867->rxctrl_strap_quirk) { |
| 243 | val = phy_read_mmd_indirect(phydev, DP83867_CFG4, |
| 244 | DP83867_DEVADDR, phydev->addr); |
| 245 | val &= ~BIT(7); |
| 246 | phy_write_mmd_indirect(phydev, DP83867_CFG4, |
| 247 | DP83867_DEVADDR, phydev->addr, val); |
| 248 | } |
| 249 | |
Edgar E. Iglesias | 8d3ce68 | 2015-09-25 23:46:08 -0700 | [diff] [blame] | 250 | if (phy_interface_is_rgmii(phydev)) { |
| 251 | ret = phy_write(phydev, MDIO_DEVAD_NONE, MII_DP83867_PHYCTRL, |
Michal Simek | f645915 | 2015-10-19 10:43:30 +0200 | [diff] [blame] | 252 | (DP83867_MDI_CROSSOVER_AUTO << DP83867_MDI_CROSSOVER) | |
Dan Murphy | 83fbd0a | 2016-05-02 15:45:59 -0500 | [diff] [blame] | 253 | (dp83867->fifo_depth << DP83867_PHYCR_FIFO_DEPTH_SHIFT)); |
Edgar E. Iglesias | 8d3ce68 | 2015-09-25 23:46:08 -0700 | [diff] [blame] | 254 | if (ret) |
Dan Murphy | 83fbd0a | 2016-05-02 15:45:59 -0500 | [diff] [blame] | 255 | goto err_out; |
Dan Murphy | 4f4e962 | 2016-05-02 15:46:02 -0500 | [diff] [blame] | 256 | } else if (phy_interface_is_sgmii(phydev)) { |
Siva Durga Prasad Paladugu | 02c7be6 | 2016-03-25 12:53:43 +0530 | [diff] [blame] | 257 | phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, |
| 258 | (BMCR_ANENABLE | BMCR_FULLDPLX | BMCR_SPEED1000)); |
| 259 | |
| 260 | cfg2 = phy_read(phydev, phydev->addr, MII_DP83867_CFG2); |
| 261 | cfg2 &= MII_DP83867_CFG2_MASK; |
| 262 | cfg2 |= (MII_DP83867_CFG2_SPEEDOPT_10EN | |
| 263 | MII_DP83867_CFG2_SGMII_AUTONEGEN | |
| 264 | MII_DP83867_CFG2_SPEEDOPT_ENH | |
| 265 | MII_DP83867_CFG2_SPEEDOPT_CNT | |
| 266 | MII_DP83867_CFG2_SPEEDOPT_INTLOW); |
| 267 | phy_write(phydev, MDIO_DEVAD_NONE, MII_DP83867_CFG2, cfg2); |
| 268 | |
| 269 | phy_write_mmd_indirect(phydev, DP83867_RGMIICTL, |
| 270 | DP83867_DEVADDR, phydev->addr, 0x0); |
| 271 | |
| 272 | phy_write(phydev, MDIO_DEVAD_NONE, MII_DP83867_PHYCTRL, |
| 273 | DP83867_PHYCTRL_SGMIIEN | |
| 274 | (DP83867_MDI_CROSSOVER_MDIX << |
| 275 | DP83867_MDI_CROSSOVER) | |
Dan Murphy | 83fbd0a | 2016-05-02 15:45:59 -0500 | [diff] [blame] | 276 | (dp83867->fifo_depth << DP83867_PHYCTRL_RXFIFO_SHIFT) | |
| 277 | (dp83867->fifo_depth << DP83867_PHYCTRL_TXFIFO_SHIFT)); |
Siva Durga Prasad Paladugu | 02c7be6 | 2016-03-25 12:53:43 +0530 | [diff] [blame] | 278 | phy_write(phydev, MDIO_DEVAD_NONE, MII_DP83867_BISCR, 0x0); |
Edgar E. Iglesias | 8d3ce68 | 2015-09-25 23:46:08 -0700 | [diff] [blame] | 279 | } |
| 280 | |
Phil Edworthy | c611980 | 2016-12-09 10:46:02 +0000 | [diff] [blame] | 281 | if (phy_interface_is_rgmii(phydev)) { |
Edgar E. Iglesias | 8d3ce68 | 2015-09-25 23:46:08 -0700 | [diff] [blame] | 282 | val = phy_read_mmd_indirect(phydev, DP83867_RGMIICTL, |
| 283 | DP83867_DEVADDR, phydev->addr); |
| 284 | |
| 285 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) |
| 286 | val |= (DP83867_RGMII_TX_CLK_DELAY_EN | |
| 287 | DP83867_RGMII_RX_CLK_DELAY_EN); |
| 288 | |
| 289 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) |
| 290 | val |= DP83867_RGMII_TX_CLK_DELAY_EN; |
| 291 | |
| 292 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) |
| 293 | val |= DP83867_RGMII_RX_CLK_DELAY_EN; |
| 294 | |
| 295 | phy_write_mmd_indirect(phydev, DP83867_RGMIICTL, |
| 296 | DP83867_DEVADDR, phydev->addr, val); |
| 297 | |
Dan Murphy | 83fbd0a | 2016-05-02 15:45:59 -0500 | [diff] [blame] | 298 | delay = (dp83867->rx_id_delay | |
| 299 | (dp83867->tx_id_delay << DP83867_RGMII_TX_CLK_DELAY_SHIFT)); |
Edgar E. Iglesias | 8d3ce68 | 2015-09-25 23:46:08 -0700 | [diff] [blame] | 300 | |
| 301 | phy_write_mmd_indirect(phydev, DP83867_RGMIIDCTL, |
| 302 | DP83867_DEVADDR, phydev->addr, delay); |
Mugunthan V N | 5b6b18e | 2017-01-24 11:15:40 -0600 | [diff] [blame] | 303 | |
| 304 | if (dp83867->io_impedance >= 0) { |
| 305 | val = phy_read_mmd_indirect(phydev, |
| 306 | DP83867_IO_MUX_CFG, |
| 307 | DP83867_DEVADDR, |
| 308 | phydev->addr); |
| 309 | val &= ~DP83867_IO_MUX_CFG_IO_IMPEDANCE_CTRL; |
| 310 | val |= dp83867->io_impedance & |
| 311 | DP83867_IO_MUX_CFG_IO_IMPEDANCE_CTRL; |
| 312 | phy_write_mmd_indirect(phydev, DP83867_IO_MUX_CFG, |
| 313 | DP83867_DEVADDR, phydev->addr, |
| 314 | val); |
| 315 | } |
Edgar E. Iglesias | 8d3ce68 | 2015-09-25 23:46:08 -0700 | [diff] [blame] | 316 | } |
| 317 | |
| 318 | genphy_config_aneg(phydev); |
| 319 | return 0; |
Dan Murphy | 83fbd0a | 2016-05-02 15:45:59 -0500 | [diff] [blame] | 320 | |
| 321 | err_out: |
| 322 | kfree(dp83867); |
| 323 | return ret; |
Edgar E. Iglesias | 8d3ce68 | 2015-09-25 23:46:08 -0700 | [diff] [blame] | 324 | } |
| 325 | |
| 326 | static struct phy_driver DP83867_driver = { |
| 327 | .name = "TI DP83867", |
| 328 | .uid = 0x2000a231, |
| 329 | .mask = 0xfffffff0, |
| 330 | .features = PHY_GBIT_FEATURES, |
| 331 | .config = &dp83867_config, |
| 332 | .startup = &genphy_startup, |
| 333 | .shutdown = &genphy_shutdown, |
| 334 | }; |
| 335 | |
| 336 | int phy_ti_init(void) |
| 337 | { |
| 338 | phy_register(&DP83867_driver); |
| 339 | return 0; |
| 340 | } |