David J. Choi | d050700 | 2010-04-29 06:12:41 +0000 | [diff] [blame] | 1 | /* |
| 2 | * drivers/net/phy/micrel.c |
| 3 | * |
| 4 | * Driver for Micrel PHYs |
| 5 | * |
| 6 | * Author: David J. Choi |
| 7 | * |
David J. Choi | 7ab59dc | 2013-01-23 14:05:15 +0000 | [diff] [blame] | 8 | * Copyright (c) 2010-2013 Micrel, Inc. |
David J. Choi | d050700 | 2010-04-29 06:12:41 +0000 | [diff] [blame] | 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify it |
| 11 | * under the terms of the GNU General Public License as published by the |
| 12 | * Free Software Foundation; either version 2 of the License, or (at your |
| 13 | * option) any later version. |
| 14 | * |
David J. Choi | 7ab59dc | 2013-01-23 14:05:15 +0000 | [diff] [blame] | 15 | * Support : Micrel Phys: |
| 16 | * Giga phys: ksz9021, ksz9031 |
| 17 | * 100/10 Phys : ksz8001, ksz8721, ksz8737, ksz8041 |
| 18 | * ksz8021, ksz8031, ksz8051, |
| 19 | * ksz8081, ksz8091, |
| 20 | * ksz8061, |
| 21 | * Switch : ksz8873, ksz886x |
David J. Choi | d050700 | 2010-04-29 06:12:41 +0000 | [diff] [blame] | 22 | */ |
| 23 | |
| 24 | #include <linux/kernel.h> |
| 25 | #include <linux/module.h> |
| 26 | #include <linux/phy.h> |
Baruch Siach | d606ef3 | 2011-02-14 02:05:33 +0000 | [diff] [blame] | 27 | #include <linux/micrel_phy.h> |
Sean Cross | 954c396 | 2013-08-21 01:46:12 +0000 | [diff] [blame] | 28 | #include <linux/of.h> |
Sascha Hauer | 1fadee0 | 2014-10-10 09:48:05 +0200 | [diff] [blame] | 29 | #include <linux/clk.h> |
David J. Choi | d050700 | 2010-04-29 06:12:41 +0000 | [diff] [blame] | 30 | |
Marek Vasut | 212ea99 | 2012-09-23 16:58:49 +0000 | [diff] [blame] | 31 | /* Operation Mode Strap Override */ |
| 32 | #define MII_KSZPHY_OMSO 0x16 |
| 33 | #define KSZPHY_OMSO_B_CAST_OFF (1 << 9) |
| 34 | #define KSZPHY_OMSO_RMII_OVERRIDE (1 << 1) |
| 35 | #define KSZPHY_OMSO_MII_OVERRIDE (1 << 0) |
| 36 | |
Choi, David | 51f932c | 2010-06-28 15:23:41 +0000 | [diff] [blame] | 37 | /* general Interrupt control/status reg in vendor specific block. */ |
| 38 | #define MII_KSZPHY_INTCS 0x1B |
| 39 | #define KSZPHY_INTCS_JABBER (1 << 15) |
| 40 | #define KSZPHY_INTCS_RECEIVE_ERR (1 << 14) |
| 41 | #define KSZPHY_INTCS_PAGE_RECEIVE (1 << 13) |
| 42 | #define KSZPHY_INTCS_PARELLEL (1 << 12) |
| 43 | #define KSZPHY_INTCS_LINK_PARTNER_ACK (1 << 11) |
| 44 | #define KSZPHY_INTCS_LINK_DOWN (1 << 10) |
| 45 | #define KSZPHY_INTCS_REMOTE_FAULT (1 << 9) |
| 46 | #define KSZPHY_INTCS_LINK_UP (1 << 8) |
| 47 | #define KSZPHY_INTCS_ALL (KSZPHY_INTCS_LINK_UP |\ |
| 48 | KSZPHY_INTCS_LINK_DOWN) |
| 49 | |
| 50 | /* general PHY control reg in vendor specific block. */ |
| 51 | #define MII_KSZPHY_CTRL 0x1F |
| 52 | /* bitmap of PHY register to set interrupt mode */ |
| 53 | #define KSZPHY_CTRL_INT_ACTIVE_HIGH (1 << 9) |
| 54 | #define KSZ9021_CTRL_INT_ACTIVE_HIGH (1 << 14) |
| 55 | #define KS8737_CTRL_INT_ACTIVE_HIGH (1 << 14) |
Baruch Siach | d606ef3 | 2011-02-14 02:05:33 +0000 | [diff] [blame] | 56 | #define KSZ8051_RMII_50MHZ_CLK (1 << 7) |
Choi, David | 51f932c | 2010-06-28 15:23:41 +0000 | [diff] [blame] | 57 | |
Sean Cross | 954c396 | 2013-08-21 01:46:12 +0000 | [diff] [blame] | 58 | /* Write/read to/from extended registers */ |
| 59 | #define MII_KSZPHY_EXTREG 0x0b |
| 60 | #define KSZPHY_EXTREG_WRITE 0x8000 |
| 61 | |
| 62 | #define MII_KSZPHY_EXTREG_WRITE 0x0c |
| 63 | #define MII_KSZPHY_EXTREG_READ 0x0d |
| 64 | |
| 65 | /* Extended registers */ |
| 66 | #define MII_KSZPHY_CLK_CONTROL_PAD_SKEW 0x104 |
| 67 | #define MII_KSZPHY_RX_DATA_PAD_SKEW 0x105 |
| 68 | #define MII_KSZPHY_TX_DATA_PAD_SKEW 0x106 |
| 69 | |
| 70 | #define PS_TO_REG 200 |
| 71 | |
Hector Palacios | b6bb4dfc | 2013-03-10 22:50:03 +0000 | [diff] [blame] | 72 | static int ksz_config_flags(struct phy_device *phydev) |
| 73 | { |
| 74 | int regval; |
| 75 | |
Sascha Hauer | 1fadee0 | 2014-10-10 09:48:05 +0200 | [diff] [blame] | 76 | if (phydev->dev_flags & (MICREL_PHY_50MHZ_CLK | MICREL_PHY_25MHZ_CLK)) { |
Hector Palacios | b6bb4dfc | 2013-03-10 22:50:03 +0000 | [diff] [blame] | 77 | regval = phy_read(phydev, MII_KSZPHY_CTRL); |
Sascha Hauer | 1fadee0 | 2014-10-10 09:48:05 +0200 | [diff] [blame] | 78 | if (phydev->dev_flags & MICREL_PHY_50MHZ_CLK) |
| 79 | regval |= KSZ8051_RMII_50MHZ_CLK; |
| 80 | else |
| 81 | regval &= ~KSZ8051_RMII_50MHZ_CLK; |
Hector Palacios | b6bb4dfc | 2013-03-10 22:50:03 +0000 | [diff] [blame] | 82 | return phy_write(phydev, MII_KSZPHY_CTRL, regval); |
| 83 | } |
| 84 | return 0; |
| 85 | } |
| 86 | |
Sean Cross | 954c396 | 2013-08-21 01:46:12 +0000 | [diff] [blame] | 87 | static int kszphy_extended_write(struct phy_device *phydev, |
Florian Fainelli | 756b508 | 2013-12-17 21:38:11 -0800 | [diff] [blame] | 88 | u32 regnum, u16 val) |
Sean Cross | 954c396 | 2013-08-21 01:46:12 +0000 | [diff] [blame] | 89 | { |
| 90 | phy_write(phydev, MII_KSZPHY_EXTREG, KSZPHY_EXTREG_WRITE | regnum); |
| 91 | return phy_write(phydev, MII_KSZPHY_EXTREG_WRITE, val); |
| 92 | } |
| 93 | |
| 94 | static int kszphy_extended_read(struct phy_device *phydev, |
Florian Fainelli | 756b508 | 2013-12-17 21:38:11 -0800 | [diff] [blame] | 95 | u32 regnum) |
Sean Cross | 954c396 | 2013-08-21 01:46:12 +0000 | [diff] [blame] | 96 | { |
| 97 | phy_write(phydev, MII_KSZPHY_EXTREG, regnum); |
| 98 | return phy_read(phydev, MII_KSZPHY_EXTREG_READ); |
| 99 | } |
| 100 | |
Choi, David | 51f932c | 2010-06-28 15:23:41 +0000 | [diff] [blame] | 101 | static int kszphy_ack_interrupt(struct phy_device *phydev) |
| 102 | { |
| 103 | /* bit[7..0] int status, which is a read and clear register. */ |
| 104 | int rc; |
| 105 | |
| 106 | rc = phy_read(phydev, MII_KSZPHY_INTCS); |
| 107 | |
| 108 | return (rc < 0) ? rc : 0; |
| 109 | } |
| 110 | |
| 111 | static int kszphy_set_interrupt(struct phy_device *phydev) |
| 112 | { |
| 113 | int temp; |
| 114 | temp = (PHY_INTERRUPT_ENABLED == phydev->interrupts) ? |
| 115 | KSZPHY_INTCS_ALL : 0; |
| 116 | return phy_write(phydev, MII_KSZPHY_INTCS, temp); |
| 117 | } |
| 118 | |
| 119 | static int kszphy_config_intr(struct phy_device *phydev) |
| 120 | { |
| 121 | int temp, rc; |
| 122 | |
| 123 | /* set the interrupt pin active low */ |
| 124 | temp = phy_read(phydev, MII_KSZPHY_CTRL); |
Johan Hovold | 5bb8fc0 | 2014-11-11 20:00:08 +0100 | [diff] [blame^] | 125 | if (temp < 0) |
| 126 | return temp; |
Choi, David | 51f932c | 2010-06-28 15:23:41 +0000 | [diff] [blame] | 127 | temp &= ~KSZPHY_CTRL_INT_ACTIVE_HIGH; |
| 128 | phy_write(phydev, MII_KSZPHY_CTRL, temp); |
| 129 | rc = kszphy_set_interrupt(phydev); |
| 130 | return rc < 0 ? rc : 0; |
| 131 | } |
| 132 | |
| 133 | static int ksz9021_config_intr(struct phy_device *phydev) |
| 134 | { |
| 135 | int temp, rc; |
| 136 | |
| 137 | /* set the interrupt pin active low */ |
| 138 | temp = phy_read(phydev, MII_KSZPHY_CTRL); |
Johan Hovold | 5bb8fc0 | 2014-11-11 20:00:08 +0100 | [diff] [blame^] | 139 | if (temp < 0) |
| 140 | return temp; |
Choi, David | 51f932c | 2010-06-28 15:23:41 +0000 | [diff] [blame] | 141 | temp &= ~KSZ9021_CTRL_INT_ACTIVE_HIGH; |
| 142 | phy_write(phydev, MII_KSZPHY_CTRL, temp); |
| 143 | rc = kszphy_set_interrupt(phydev); |
| 144 | return rc < 0 ? rc : 0; |
| 145 | } |
| 146 | |
| 147 | static int ks8737_config_intr(struct phy_device *phydev) |
| 148 | { |
| 149 | int temp, rc; |
| 150 | |
| 151 | /* set the interrupt pin active low */ |
| 152 | temp = phy_read(phydev, MII_KSZPHY_CTRL); |
Johan Hovold | 5bb8fc0 | 2014-11-11 20:00:08 +0100 | [diff] [blame^] | 153 | if (temp < 0) |
| 154 | return temp; |
Choi, David | 51f932c | 2010-06-28 15:23:41 +0000 | [diff] [blame] | 155 | temp &= ~KS8737_CTRL_INT_ACTIVE_HIGH; |
| 156 | phy_write(phydev, MII_KSZPHY_CTRL, temp); |
| 157 | rc = kszphy_set_interrupt(phydev); |
| 158 | return rc < 0 ? rc : 0; |
| 159 | } |
David J. Choi | d050700 | 2010-04-29 06:12:41 +0000 | [diff] [blame] | 160 | |
Ben Dooks | 20d8435 | 2014-02-26 11:48:00 +0000 | [diff] [blame] | 161 | static int kszphy_setup_led(struct phy_device *phydev, |
| 162 | unsigned int reg, unsigned int shift) |
| 163 | { |
| 164 | |
| 165 | struct device *dev = &phydev->dev; |
| 166 | struct device_node *of_node = dev->of_node; |
| 167 | int rc, temp; |
| 168 | u32 val; |
| 169 | |
| 170 | if (!of_node && dev->parent->of_node) |
| 171 | of_node = dev->parent->of_node; |
| 172 | |
| 173 | if (of_property_read_u32(of_node, "micrel,led-mode", &val)) |
| 174 | return 0; |
| 175 | |
| 176 | temp = phy_read(phydev, reg); |
| 177 | if (temp < 0) |
| 178 | return temp; |
| 179 | |
Sergei Shtylyov | 28bdc49 | 2014-03-19 02:58:16 +0300 | [diff] [blame] | 180 | temp &= ~(3 << shift); |
Ben Dooks | 20d8435 | 2014-02-26 11:48:00 +0000 | [diff] [blame] | 181 | temp |= val << shift; |
| 182 | rc = phy_write(phydev, reg, temp); |
| 183 | |
| 184 | return rc < 0 ? rc : 0; |
| 185 | } |
| 186 | |
David J. Choi | d050700 | 2010-04-29 06:12:41 +0000 | [diff] [blame] | 187 | static int kszphy_config_init(struct phy_device *phydev) |
| 188 | { |
| 189 | return 0; |
| 190 | } |
| 191 | |
Ben Dooks | 20d8435 | 2014-02-26 11:48:00 +0000 | [diff] [blame] | 192 | static int kszphy_config_init_led8041(struct phy_device *phydev) |
| 193 | { |
| 194 | /* single led control, register 0x1e bits 15..14 */ |
| 195 | return kszphy_setup_led(phydev, 0x1e, 14); |
| 196 | } |
| 197 | |
Marek Vasut | 212ea99 | 2012-09-23 16:58:49 +0000 | [diff] [blame] | 198 | static int ksz8021_config_init(struct phy_device *phydev) |
| 199 | { |
| 200 | const u16 val = KSZPHY_OMSO_B_CAST_OFF | KSZPHY_OMSO_RMII_OVERRIDE; |
Ben Dooks | 20d8435 | 2014-02-26 11:48:00 +0000 | [diff] [blame] | 201 | int rc; |
| 202 | |
| 203 | rc = kszphy_setup_led(phydev, 0x1f, 4); |
| 204 | if (rc) |
| 205 | dev_err(&phydev->dev, "failed to set led mode\n"); |
| 206 | |
Hector Palacios | b6bb4dfc | 2013-03-10 22:50:03 +0000 | [diff] [blame] | 207 | rc = ksz_config_flags(phydev); |
Bruno Thomsen | b838b4a | 2014-10-09 16:48:14 +0200 | [diff] [blame] | 208 | if (rc < 0) |
| 209 | return rc; |
| 210 | rc = phy_write(phydev, MII_KSZPHY_OMSO, val); |
Hector Palacios | b6bb4dfc | 2013-03-10 22:50:03 +0000 | [diff] [blame] | 211 | return rc < 0 ? rc : 0; |
Marek Vasut | 212ea99 | 2012-09-23 16:58:49 +0000 | [diff] [blame] | 212 | } |
| 213 | |
Baruch Siach | d606ef3 | 2011-02-14 02:05:33 +0000 | [diff] [blame] | 214 | static int ks8051_config_init(struct phy_device *phydev) |
| 215 | { |
Hector Palacios | b6bb4dfc | 2013-03-10 22:50:03 +0000 | [diff] [blame] | 216 | int rc; |
Baruch Siach | d606ef3 | 2011-02-14 02:05:33 +0000 | [diff] [blame] | 217 | |
Ben Dooks | 20d8435 | 2014-02-26 11:48:00 +0000 | [diff] [blame] | 218 | rc = kszphy_setup_led(phydev, 0x1f, 4); |
| 219 | if (rc) |
| 220 | dev_err(&phydev->dev, "failed to set led mode\n"); |
| 221 | |
Hector Palacios | b6bb4dfc | 2013-03-10 22:50:03 +0000 | [diff] [blame] | 222 | rc = ksz_config_flags(phydev); |
| 223 | return rc < 0 ? rc : 0; |
Baruch Siach | d606ef3 | 2011-02-14 02:05:33 +0000 | [diff] [blame] | 224 | } |
| 225 | |
Sean Cross | 954c396 | 2013-08-21 01:46:12 +0000 | [diff] [blame] | 226 | static int ksz9021_load_values_from_of(struct phy_device *phydev, |
| 227 | struct device_node *of_node, u16 reg, |
| 228 | char *field1, char *field2, |
| 229 | char *field3, char *field4) |
| 230 | { |
| 231 | int val1 = -1; |
| 232 | int val2 = -2; |
| 233 | int val3 = -3; |
| 234 | int val4 = -4; |
| 235 | int newval; |
| 236 | int matches = 0; |
| 237 | |
| 238 | if (!of_property_read_u32(of_node, field1, &val1)) |
| 239 | matches++; |
| 240 | |
| 241 | if (!of_property_read_u32(of_node, field2, &val2)) |
| 242 | matches++; |
| 243 | |
| 244 | if (!of_property_read_u32(of_node, field3, &val3)) |
| 245 | matches++; |
| 246 | |
| 247 | if (!of_property_read_u32(of_node, field4, &val4)) |
| 248 | matches++; |
| 249 | |
| 250 | if (!matches) |
| 251 | return 0; |
| 252 | |
| 253 | if (matches < 4) |
| 254 | newval = kszphy_extended_read(phydev, reg); |
| 255 | else |
| 256 | newval = 0; |
| 257 | |
| 258 | if (val1 != -1) |
| 259 | newval = ((newval & 0xfff0) | ((val1 / PS_TO_REG) & 0xf) << 0); |
| 260 | |
Hubert Chaumette | 6a11974 | 2014-04-22 15:01:04 +0200 | [diff] [blame] | 261 | if (val2 != -2) |
Sean Cross | 954c396 | 2013-08-21 01:46:12 +0000 | [diff] [blame] | 262 | newval = ((newval & 0xff0f) | ((val2 / PS_TO_REG) & 0xf) << 4); |
| 263 | |
Hubert Chaumette | 6a11974 | 2014-04-22 15:01:04 +0200 | [diff] [blame] | 264 | if (val3 != -3) |
Sean Cross | 954c396 | 2013-08-21 01:46:12 +0000 | [diff] [blame] | 265 | newval = ((newval & 0xf0ff) | ((val3 / PS_TO_REG) & 0xf) << 8); |
| 266 | |
Hubert Chaumette | 6a11974 | 2014-04-22 15:01:04 +0200 | [diff] [blame] | 267 | if (val4 != -4) |
Sean Cross | 954c396 | 2013-08-21 01:46:12 +0000 | [diff] [blame] | 268 | newval = ((newval & 0x0fff) | ((val4 / PS_TO_REG) & 0xf) << 12); |
| 269 | |
| 270 | return kszphy_extended_write(phydev, reg, newval); |
| 271 | } |
| 272 | |
| 273 | static int ksz9021_config_init(struct phy_device *phydev) |
| 274 | { |
| 275 | struct device *dev = &phydev->dev; |
| 276 | struct device_node *of_node = dev->of_node; |
| 277 | |
| 278 | if (!of_node && dev->parent->of_node) |
| 279 | of_node = dev->parent->of_node; |
| 280 | |
| 281 | if (of_node) { |
| 282 | ksz9021_load_values_from_of(phydev, of_node, |
| 283 | MII_KSZPHY_CLK_CONTROL_PAD_SKEW, |
| 284 | "txen-skew-ps", "txc-skew-ps", |
| 285 | "rxdv-skew-ps", "rxc-skew-ps"); |
| 286 | ksz9021_load_values_from_of(phydev, of_node, |
| 287 | MII_KSZPHY_RX_DATA_PAD_SKEW, |
| 288 | "rxd0-skew-ps", "rxd1-skew-ps", |
| 289 | "rxd2-skew-ps", "rxd3-skew-ps"); |
| 290 | ksz9021_load_values_from_of(phydev, of_node, |
| 291 | MII_KSZPHY_TX_DATA_PAD_SKEW, |
| 292 | "txd0-skew-ps", "txd1-skew-ps", |
| 293 | "txd2-skew-ps", "txd3-skew-ps"); |
| 294 | } |
| 295 | return 0; |
| 296 | } |
| 297 | |
Hubert Chaumette | 6e4b827 | 2014-05-06 09:40:17 +0200 | [diff] [blame] | 298 | #define MII_KSZ9031RN_MMD_CTRL_REG 0x0d |
| 299 | #define MII_KSZ9031RN_MMD_REGDATA_REG 0x0e |
| 300 | #define OP_DATA 1 |
| 301 | #define KSZ9031_PS_TO_REG 60 |
| 302 | |
| 303 | /* Extended registers */ |
| 304 | #define MII_KSZ9031RN_CONTROL_PAD_SKEW 4 |
| 305 | #define MII_KSZ9031RN_RX_DATA_PAD_SKEW 5 |
| 306 | #define MII_KSZ9031RN_TX_DATA_PAD_SKEW 6 |
| 307 | #define MII_KSZ9031RN_CLK_PAD_SKEW 8 |
| 308 | |
| 309 | static int ksz9031_extended_write(struct phy_device *phydev, |
| 310 | u8 mode, u32 dev_addr, u32 regnum, u16 val) |
| 311 | { |
| 312 | phy_write(phydev, MII_KSZ9031RN_MMD_CTRL_REG, dev_addr); |
| 313 | phy_write(phydev, MII_KSZ9031RN_MMD_REGDATA_REG, regnum); |
| 314 | phy_write(phydev, MII_KSZ9031RN_MMD_CTRL_REG, (mode << 14) | dev_addr); |
| 315 | return phy_write(phydev, MII_KSZ9031RN_MMD_REGDATA_REG, val); |
| 316 | } |
| 317 | |
| 318 | static int ksz9031_extended_read(struct phy_device *phydev, |
| 319 | u8 mode, u32 dev_addr, u32 regnum) |
| 320 | { |
| 321 | phy_write(phydev, MII_KSZ9031RN_MMD_CTRL_REG, dev_addr); |
| 322 | phy_write(phydev, MII_KSZ9031RN_MMD_REGDATA_REG, regnum); |
| 323 | phy_write(phydev, MII_KSZ9031RN_MMD_CTRL_REG, (mode << 14) | dev_addr); |
| 324 | return phy_read(phydev, MII_KSZ9031RN_MMD_REGDATA_REG); |
| 325 | } |
| 326 | |
| 327 | static int ksz9031_of_load_skew_values(struct phy_device *phydev, |
| 328 | struct device_node *of_node, |
| 329 | u16 reg, size_t field_sz, |
| 330 | char *field[], u8 numfields) |
| 331 | { |
| 332 | int val[4] = {-1, -2, -3, -4}; |
| 333 | int matches = 0; |
| 334 | u16 mask; |
| 335 | u16 maxval; |
| 336 | u16 newval; |
| 337 | int i; |
| 338 | |
| 339 | for (i = 0; i < numfields; i++) |
| 340 | if (!of_property_read_u32(of_node, field[i], val + i)) |
| 341 | matches++; |
| 342 | |
| 343 | if (!matches) |
| 344 | return 0; |
| 345 | |
| 346 | if (matches < numfields) |
| 347 | newval = ksz9031_extended_read(phydev, OP_DATA, 2, reg); |
| 348 | else |
| 349 | newval = 0; |
| 350 | |
| 351 | maxval = (field_sz == 4) ? 0xf : 0x1f; |
| 352 | for (i = 0; i < numfields; i++) |
| 353 | if (val[i] != -(i + 1)) { |
| 354 | mask = 0xffff; |
| 355 | mask ^= maxval << (field_sz * i); |
| 356 | newval = (newval & mask) | |
| 357 | (((val[i] / KSZ9031_PS_TO_REG) & maxval) |
| 358 | << (field_sz * i)); |
| 359 | } |
| 360 | |
| 361 | return ksz9031_extended_write(phydev, OP_DATA, 2, reg, newval); |
| 362 | } |
| 363 | |
| 364 | static int ksz9031_config_init(struct phy_device *phydev) |
| 365 | { |
| 366 | struct device *dev = &phydev->dev; |
| 367 | struct device_node *of_node = dev->of_node; |
| 368 | char *clk_skews[2] = {"rxc-skew-ps", "txc-skew-ps"}; |
| 369 | char *rx_data_skews[4] = { |
| 370 | "rxd0-skew-ps", "rxd1-skew-ps", |
| 371 | "rxd2-skew-ps", "rxd3-skew-ps" |
| 372 | }; |
| 373 | char *tx_data_skews[4] = { |
| 374 | "txd0-skew-ps", "txd1-skew-ps", |
| 375 | "txd2-skew-ps", "txd3-skew-ps" |
| 376 | }; |
| 377 | char *control_skews[2] = {"txen-skew-ps", "rxdv-skew-ps"}; |
| 378 | |
| 379 | if (!of_node && dev->parent->of_node) |
| 380 | of_node = dev->parent->of_node; |
| 381 | |
| 382 | if (of_node) { |
| 383 | ksz9031_of_load_skew_values(phydev, of_node, |
| 384 | MII_KSZ9031RN_CLK_PAD_SKEW, 5, |
| 385 | clk_skews, 2); |
| 386 | |
| 387 | ksz9031_of_load_skew_values(phydev, of_node, |
| 388 | MII_KSZ9031RN_CONTROL_PAD_SKEW, 4, |
| 389 | control_skews, 2); |
| 390 | |
| 391 | ksz9031_of_load_skew_values(phydev, of_node, |
| 392 | MII_KSZ9031RN_RX_DATA_PAD_SKEW, 4, |
| 393 | rx_data_skews, 4); |
| 394 | |
| 395 | ksz9031_of_load_skew_values(phydev, of_node, |
| 396 | MII_KSZ9031RN_TX_DATA_PAD_SKEW, 4, |
| 397 | tx_data_skews, 4); |
| 398 | } |
| 399 | return 0; |
| 400 | } |
| 401 | |
Jean-Christophe PLAGNIOL-VILLARD | 93272e0 | 2012-11-21 05:38:07 +0000 | [diff] [blame] | 402 | #define KSZ8873MLL_GLOBAL_CONTROL_4 0x06 |
| 403 | #define KSZ8873MLL_GLOBAL_CONTROL_4_DUPLEX (1 << 6) |
| 404 | #define KSZ8873MLL_GLOBAL_CONTROL_4_SPEED (1 << 4) |
Jingoo Han | 32d73b1 | 2013-08-06 17:29:35 +0900 | [diff] [blame] | 405 | static int ksz8873mll_read_status(struct phy_device *phydev) |
Jean-Christophe PLAGNIOL-VILLARD | 93272e0 | 2012-11-21 05:38:07 +0000 | [diff] [blame] | 406 | { |
| 407 | int regval; |
| 408 | |
| 409 | /* dummy read */ |
| 410 | regval = phy_read(phydev, KSZ8873MLL_GLOBAL_CONTROL_4); |
| 411 | |
| 412 | regval = phy_read(phydev, KSZ8873MLL_GLOBAL_CONTROL_4); |
| 413 | |
| 414 | if (regval & KSZ8873MLL_GLOBAL_CONTROL_4_DUPLEX) |
| 415 | phydev->duplex = DUPLEX_HALF; |
| 416 | else |
| 417 | phydev->duplex = DUPLEX_FULL; |
| 418 | |
| 419 | if (regval & KSZ8873MLL_GLOBAL_CONTROL_4_SPEED) |
| 420 | phydev->speed = SPEED_10; |
| 421 | else |
| 422 | phydev->speed = SPEED_100; |
| 423 | |
| 424 | phydev->link = 1; |
| 425 | phydev->pause = phydev->asym_pause = 0; |
| 426 | |
| 427 | return 0; |
| 428 | } |
| 429 | |
| 430 | static int ksz8873mll_config_aneg(struct phy_device *phydev) |
| 431 | { |
| 432 | return 0; |
| 433 | } |
| 434 | |
Vince Bridgers | 1993694 | 2014-07-29 15:19:58 -0500 | [diff] [blame] | 435 | /* This routine returns -1 as an indication to the caller that the |
| 436 | * Micrel ksz9021 10/100/1000 PHY does not support standard IEEE |
| 437 | * MMD extended PHY registers. |
| 438 | */ |
| 439 | static int |
| 440 | ksz9021_rd_mmd_phyreg(struct phy_device *phydev, int ptrad, int devnum, |
| 441 | int regnum) |
| 442 | { |
| 443 | return -1; |
| 444 | } |
| 445 | |
| 446 | /* This routine does nothing since the Micrel ksz9021 does not support |
| 447 | * standard IEEE MMD extended PHY registers. |
| 448 | */ |
| 449 | static void |
| 450 | ksz9021_wr_mmd_phyreg(struct phy_device *phydev, int ptrad, int devnum, |
| 451 | int regnum, u32 val) |
| 452 | { |
| 453 | } |
| 454 | |
Sascha Hauer | 1fadee0 | 2014-10-10 09:48:05 +0200 | [diff] [blame] | 455 | static int ksz8021_probe(struct phy_device *phydev) |
| 456 | { |
| 457 | struct clk *clk; |
| 458 | |
| 459 | clk = devm_clk_get(&phydev->dev, "rmii-ref"); |
| 460 | if (!IS_ERR(clk)) { |
| 461 | unsigned long rate = clk_get_rate(clk); |
| 462 | |
| 463 | if (rate > 24500000 && rate < 25500000) { |
| 464 | phydev->dev_flags |= MICREL_PHY_25MHZ_CLK; |
| 465 | } else if (rate > 49500000 && rate < 50500000) { |
| 466 | phydev->dev_flags |= MICREL_PHY_50MHZ_CLK; |
| 467 | } else { |
| 468 | dev_err(&phydev->dev, "Clock rate out of range: %ld\n", rate); |
| 469 | return -EINVAL; |
| 470 | } |
| 471 | } |
| 472 | |
| 473 | return 0; |
| 474 | } |
| 475 | |
Christian Hohnstaedt | d5bf907 | 2012-07-04 05:44:34 +0000 | [diff] [blame] | 476 | static struct phy_driver ksphy_driver[] = { |
| 477 | { |
Choi, David | 51f932c | 2010-06-28 15:23:41 +0000 | [diff] [blame] | 478 | .phy_id = PHY_ID_KS8737, |
David J. Choi | d050700 | 2010-04-29 06:12:41 +0000 | [diff] [blame] | 479 | .phy_id_mask = 0x00fffff0, |
Choi, David | 51f932c | 2010-06-28 15:23:41 +0000 | [diff] [blame] | 480 | .name = "Micrel KS8737", |
| 481 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause), |
| 482 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
David J. Choi | d050700 | 2010-04-29 06:12:41 +0000 | [diff] [blame] | 483 | .config_init = kszphy_config_init, |
| 484 | .config_aneg = genphy_config_aneg, |
| 485 | .read_status = genphy_read_status, |
Choi, David | 51f932c | 2010-06-28 15:23:41 +0000 | [diff] [blame] | 486 | .ack_interrupt = kszphy_ack_interrupt, |
| 487 | .config_intr = ks8737_config_intr, |
Patrice Vilchez | 1a5465f | 2013-09-19 19:40:48 +0200 | [diff] [blame] | 488 | .suspend = genphy_suspend, |
| 489 | .resume = genphy_resume, |
David J. Choi | d050700 | 2010-04-29 06:12:41 +0000 | [diff] [blame] | 490 | .driver = { .owner = THIS_MODULE,}, |
Christian Hohnstaedt | d5bf907 | 2012-07-04 05:44:34 +0000 | [diff] [blame] | 491 | }, { |
Marek Vasut | 212ea99 | 2012-09-23 16:58:49 +0000 | [diff] [blame] | 492 | .phy_id = PHY_ID_KSZ8021, |
| 493 | .phy_id_mask = 0x00ffffff, |
David J. Choi | 7ab59dc | 2013-01-23 14:05:15 +0000 | [diff] [blame] | 494 | .name = "Micrel KSZ8021 or KSZ8031", |
Marek Vasut | 212ea99 | 2012-09-23 16:58:49 +0000 | [diff] [blame] | 495 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause | |
| 496 | SUPPORTED_Asym_Pause), |
| 497 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
Sascha Hauer | 1fadee0 | 2014-10-10 09:48:05 +0200 | [diff] [blame] | 498 | .probe = ksz8021_probe, |
Marek Vasut | 212ea99 | 2012-09-23 16:58:49 +0000 | [diff] [blame] | 499 | .config_init = ksz8021_config_init, |
| 500 | .config_aneg = genphy_config_aneg, |
| 501 | .read_status = genphy_read_status, |
| 502 | .ack_interrupt = kszphy_ack_interrupt, |
| 503 | .config_intr = kszphy_config_intr, |
Patrice Vilchez | 1a5465f | 2013-09-19 19:40:48 +0200 | [diff] [blame] | 504 | .suspend = genphy_suspend, |
| 505 | .resume = genphy_resume, |
Marek Vasut | 212ea99 | 2012-09-23 16:58:49 +0000 | [diff] [blame] | 506 | .driver = { .owner = THIS_MODULE,}, |
| 507 | }, { |
Hector Palacios | b818d1a | 2013-03-10 22:50:02 +0000 | [diff] [blame] | 508 | .phy_id = PHY_ID_KSZ8031, |
| 509 | .phy_id_mask = 0x00ffffff, |
| 510 | .name = "Micrel KSZ8031", |
| 511 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause | |
| 512 | SUPPORTED_Asym_Pause), |
| 513 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
Sascha Hauer | 1fadee0 | 2014-10-10 09:48:05 +0200 | [diff] [blame] | 514 | .probe = ksz8021_probe, |
Hector Palacios | b818d1a | 2013-03-10 22:50:02 +0000 | [diff] [blame] | 515 | .config_init = ksz8021_config_init, |
| 516 | .config_aneg = genphy_config_aneg, |
| 517 | .read_status = genphy_read_status, |
| 518 | .ack_interrupt = kszphy_ack_interrupt, |
| 519 | .config_intr = kszphy_config_intr, |
Patrice Vilchez | 1a5465f | 2013-09-19 19:40:48 +0200 | [diff] [blame] | 520 | .suspend = genphy_suspend, |
| 521 | .resume = genphy_resume, |
Hector Palacios | b818d1a | 2013-03-10 22:50:02 +0000 | [diff] [blame] | 522 | .driver = { .owner = THIS_MODULE,}, |
| 523 | }, { |
Marek Vasut | 510d573 | 2012-09-23 16:58:50 +0000 | [diff] [blame] | 524 | .phy_id = PHY_ID_KSZ8041, |
David J. Choi | d050700 | 2010-04-29 06:12:41 +0000 | [diff] [blame] | 525 | .phy_id_mask = 0x00fffff0, |
Marek Vasut | 510d573 | 2012-09-23 16:58:50 +0000 | [diff] [blame] | 526 | .name = "Micrel KSZ8041", |
Choi, David | 51f932c | 2010-06-28 15:23:41 +0000 | [diff] [blame] | 527 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause |
| 528 | | SUPPORTED_Asym_Pause), |
| 529 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
Ben Dooks | 20d8435 | 2014-02-26 11:48:00 +0000 | [diff] [blame] | 530 | .config_init = kszphy_config_init_led8041, |
David J. Choi | d050700 | 2010-04-29 06:12:41 +0000 | [diff] [blame] | 531 | .config_aneg = genphy_config_aneg, |
| 532 | .read_status = genphy_read_status, |
Choi, David | 51f932c | 2010-06-28 15:23:41 +0000 | [diff] [blame] | 533 | .ack_interrupt = kszphy_ack_interrupt, |
| 534 | .config_intr = kszphy_config_intr, |
Patrice Vilchez | 1a5465f | 2013-09-19 19:40:48 +0200 | [diff] [blame] | 535 | .suspend = genphy_suspend, |
| 536 | .resume = genphy_resume, |
Choi, David | 51f932c | 2010-06-28 15:23:41 +0000 | [diff] [blame] | 537 | .driver = { .owner = THIS_MODULE,}, |
Christian Hohnstaedt | d5bf907 | 2012-07-04 05:44:34 +0000 | [diff] [blame] | 538 | }, { |
Sergei Shtylyov | 4bd7b51 | 2013-12-10 02:20:41 +0300 | [diff] [blame] | 539 | .phy_id = PHY_ID_KSZ8041RNLI, |
| 540 | .phy_id_mask = 0x00fffff0, |
| 541 | .name = "Micrel KSZ8041RNLI", |
| 542 | .features = PHY_BASIC_FEATURES | |
| 543 | SUPPORTED_Pause | SUPPORTED_Asym_Pause, |
| 544 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
Ben Dooks | 20d8435 | 2014-02-26 11:48:00 +0000 | [diff] [blame] | 545 | .config_init = kszphy_config_init_led8041, |
Sergei Shtylyov | 4bd7b51 | 2013-12-10 02:20:41 +0300 | [diff] [blame] | 546 | .config_aneg = genphy_config_aneg, |
| 547 | .read_status = genphy_read_status, |
| 548 | .ack_interrupt = kszphy_ack_interrupt, |
| 549 | .config_intr = kszphy_config_intr, |
| 550 | .suspend = genphy_suspend, |
| 551 | .resume = genphy_resume, |
| 552 | .driver = { .owner = THIS_MODULE,}, |
| 553 | }, { |
Marek Vasut | 510d573 | 2012-09-23 16:58:50 +0000 | [diff] [blame] | 554 | .phy_id = PHY_ID_KSZ8051, |
Choi, David | 51f932c | 2010-06-28 15:23:41 +0000 | [diff] [blame] | 555 | .phy_id_mask = 0x00fffff0, |
Marek Vasut | 510d573 | 2012-09-23 16:58:50 +0000 | [diff] [blame] | 556 | .name = "Micrel KSZ8051", |
Choi, David | 51f932c | 2010-06-28 15:23:41 +0000 | [diff] [blame] | 557 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause |
| 558 | | SUPPORTED_Asym_Pause), |
| 559 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
Baruch Siach | d606ef3 | 2011-02-14 02:05:33 +0000 | [diff] [blame] | 560 | .config_init = ks8051_config_init, |
Choi, David | 51f932c | 2010-06-28 15:23:41 +0000 | [diff] [blame] | 561 | .config_aneg = genphy_config_aneg, |
| 562 | .read_status = genphy_read_status, |
| 563 | .ack_interrupt = kszphy_ack_interrupt, |
| 564 | .config_intr = kszphy_config_intr, |
Patrice Vilchez | 1a5465f | 2013-09-19 19:40:48 +0200 | [diff] [blame] | 565 | .suspend = genphy_suspend, |
| 566 | .resume = genphy_resume, |
Choi, David | 51f932c | 2010-06-28 15:23:41 +0000 | [diff] [blame] | 567 | .driver = { .owner = THIS_MODULE,}, |
Christian Hohnstaedt | d5bf907 | 2012-07-04 05:44:34 +0000 | [diff] [blame] | 568 | }, { |
Marek Vasut | 510d573 | 2012-09-23 16:58:50 +0000 | [diff] [blame] | 569 | .phy_id = PHY_ID_KSZ8001, |
| 570 | .name = "Micrel KSZ8001 or KS8721", |
Jason Wang | 48d7d0a | 2012-06-17 22:52:09 +0000 | [diff] [blame] | 571 | .phy_id_mask = 0x00ffffff, |
Choi, David | 51f932c | 2010-06-28 15:23:41 +0000 | [diff] [blame] | 572 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause), |
| 573 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
Ben Dooks | 20d8435 | 2014-02-26 11:48:00 +0000 | [diff] [blame] | 574 | .config_init = kszphy_config_init_led8041, |
Choi, David | 51f932c | 2010-06-28 15:23:41 +0000 | [diff] [blame] | 575 | .config_aneg = genphy_config_aneg, |
| 576 | .read_status = genphy_read_status, |
| 577 | .ack_interrupt = kszphy_ack_interrupt, |
| 578 | .config_intr = kszphy_config_intr, |
Patrice Vilchez | 1a5465f | 2013-09-19 19:40:48 +0200 | [diff] [blame] | 579 | .suspend = genphy_suspend, |
| 580 | .resume = genphy_resume, |
David J. Choi | d050700 | 2010-04-29 06:12:41 +0000 | [diff] [blame] | 581 | .driver = { .owner = THIS_MODULE,}, |
Christian Hohnstaedt | d5bf907 | 2012-07-04 05:44:34 +0000 | [diff] [blame] | 582 | }, { |
David J. Choi | 7ab59dc | 2013-01-23 14:05:15 +0000 | [diff] [blame] | 583 | .phy_id = PHY_ID_KSZ8081, |
| 584 | .name = "Micrel KSZ8081 or KSZ8091", |
| 585 | .phy_id_mask = 0x00fffff0, |
| 586 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause), |
| 587 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| 588 | .config_init = kszphy_config_init, |
| 589 | .config_aneg = genphy_config_aneg, |
| 590 | .read_status = genphy_read_status, |
| 591 | .ack_interrupt = kszphy_ack_interrupt, |
| 592 | .config_intr = kszphy_config_intr, |
Patrice Vilchez | 1a5465f | 2013-09-19 19:40:48 +0200 | [diff] [blame] | 593 | .suspend = genphy_suspend, |
| 594 | .resume = genphy_resume, |
David J. Choi | 7ab59dc | 2013-01-23 14:05:15 +0000 | [diff] [blame] | 595 | .driver = { .owner = THIS_MODULE,}, |
| 596 | }, { |
| 597 | .phy_id = PHY_ID_KSZ8061, |
| 598 | .name = "Micrel KSZ8061", |
| 599 | .phy_id_mask = 0x00fffff0, |
| 600 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause), |
| 601 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| 602 | .config_init = kszphy_config_init, |
| 603 | .config_aneg = genphy_config_aneg, |
| 604 | .read_status = genphy_read_status, |
| 605 | .ack_interrupt = kszphy_ack_interrupt, |
| 606 | .config_intr = kszphy_config_intr, |
Patrice Vilchez | 1a5465f | 2013-09-19 19:40:48 +0200 | [diff] [blame] | 607 | .suspend = genphy_suspend, |
| 608 | .resume = genphy_resume, |
David J. Choi | 7ab59dc | 2013-01-23 14:05:15 +0000 | [diff] [blame] | 609 | .driver = { .owner = THIS_MODULE,}, |
| 610 | }, { |
David J. Choi | d050700 | 2010-04-29 06:12:41 +0000 | [diff] [blame] | 611 | .phy_id = PHY_ID_KSZ9021, |
Jason Wang | 48d7d0a | 2012-06-17 22:52:09 +0000 | [diff] [blame] | 612 | .phy_id_mask = 0x000ffffe, |
David J. Choi | d050700 | 2010-04-29 06:12:41 +0000 | [diff] [blame] | 613 | .name = "Micrel KSZ9021 Gigabit PHY", |
Vlastimil Kosar | 32fcafb | 2013-02-28 08:45:22 +0000 | [diff] [blame] | 614 | .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause), |
Choi, David | 51f932c | 2010-06-28 15:23:41 +0000 | [diff] [blame] | 615 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
Sean Cross | 954c396 | 2013-08-21 01:46:12 +0000 | [diff] [blame] | 616 | .config_init = ksz9021_config_init, |
David J. Choi | d050700 | 2010-04-29 06:12:41 +0000 | [diff] [blame] | 617 | .config_aneg = genphy_config_aneg, |
| 618 | .read_status = genphy_read_status, |
Choi, David | 51f932c | 2010-06-28 15:23:41 +0000 | [diff] [blame] | 619 | .ack_interrupt = kszphy_ack_interrupt, |
| 620 | .config_intr = ksz9021_config_intr, |
Patrice Vilchez | 1a5465f | 2013-09-19 19:40:48 +0200 | [diff] [blame] | 621 | .suspend = genphy_suspend, |
| 622 | .resume = genphy_resume, |
Vince Bridgers | 1993694 | 2014-07-29 15:19:58 -0500 | [diff] [blame] | 623 | .read_mmd_indirect = ksz9021_rd_mmd_phyreg, |
| 624 | .write_mmd_indirect = ksz9021_wr_mmd_phyreg, |
David J. Choi | d050700 | 2010-04-29 06:12:41 +0000 | [diff] [blame] | 625 | .driver = { .owner = THIS_MODULE, }, |
Jean-Christophe PLAGNIOL-VILLARD | 93272e0 | 2012-11-21 05:38:07 +0000 | [diff] [blame] | 626 | }, { |
David J. Choi | 7ab59dc | 2013-01-23 14:05:15 +0000 | [diff] [blame] | 627 | .phy_id = PHY_ID_KSZ9031, |
| 628 | .phy_id_mask = 0x00fffff0, |
| 629 | .name = "Micrel KSZ9031 Gigabit PHY", |
Mike Looijmans | 95e8b10 | 2014-09-15 12:06:33 +0200 | [diff] [blame] | 630 | .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause), |
David J. Choi | 7ab59dc | 2013-01-23 14:05:15 +0000 | [diff] [blame] | 631 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
Hubert Chaumette | 6e4b827 | 2014-05-06 09:40:17 +0200 | [diff] [blame] | 632 | .config_init = ksz9031_config_init, |
David J. Choi | 7ab59dc | 2013-01-23 14:05:15 +0000 | [diff] [blame] | 633 | .config_aneg = genphy_config_aneg, |
| 634 | .read_status = genphy_read_status, |
| 635 | .ack_interrupt = kszphy_ack_interrupt, |
| 636 | .config_intr = ksz9021_config_intr, |
Patrice Vilchez | 1a5465f | 2013-09-19 19:40:48 +0200 | [diff] [blame] | 637 | .suspend = genphy_suspend, |
| 638 | .resume = genphy_resume, |
David J. Choi | 7ab59dc | 2013-01-23 14:05:15 +0000 | [diff] [blame] | 639 | .driver = { .owner = THIS_MODULE, }, |
| 640 | }, { |
Jean-Christophe PLAGNIOL-VILLARD | 93272e0 | 2012-11-21 05:38:07 +0000 | [diff] [blame] | 641 | .phy_id = PHY_ID_KSZ8873MLL, |
| 642 | .phy_id_mask = 0x00fffff0, |
| 643 | .name = "Micrel KSZ8873MLL Switch", |
| 644 | .features = (SUPPORTED_Pause | SUPPORTED_Asym_Pause), |
| 645 | .flags = PHY_HAS_MAGICANEG, |
| 646 | .config_init = kszphy_config_init, |
| 647 | .config_aneg = ksz8873mll_config_aneg, |
| 648 | .read_status = ksz8873mll_read_status, |
Patrice Vilchez | 1a5465f | 2013-09-19 19:40:48 +0200 | [diff] [blame] | 649 | .suspend = genphy_suspend, |
| 650 | .resume = genphy_resume, |
Jean-Christophe PLAGNIOL-VILLARD | 93272e0 | 2012-11-21 05:38:07 +0000 | [diff] [blame] | 651 | .driver = { .owner = THIS_MODULE, }, |
David J. Choi | 7ab59dc | 2013-01-23 14:05:15 +0000 | [diff] [blame] | 652 | }, { |
| 653 | .phy_id = PHY_ID_KSZ886X, |
| 654 | .phy_id_mask = 0x00fffff0, |
| 655 | .name = "Micrel KSZ886X Switch", |
| 656 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause), |
| 657 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| 658 | .config_init = kszphy_config_init, |
| 659 | .config_aneg = genphy_config_aneg, |
| 660 | .read_status = genphy_read_status, |
Patrice Vilchez | 1a5465f | 2013-09-19 19:40:48 +0200 | [diff] [blame] | 661 | .suspend = genphy_suspend, |
| 662 | .resume = genphy_resume, |
David J. Choi | 7ab59dc | 2013-01-23 14:05:15 +0000 | [diff] [blame] | 663 | .driver = { .owner = THIS_MODULE, }, |
Christian Hohnstaedt | d5bf907 | 2012-07-04 05:44:34 +0000 | [diff] [blame] | 664 | } }; |
David J. Choi | d050700 | 2010-04-29 06:12:41 +0000 | [diff] [blame] | 665 | |
Johan Hovold | 50fd715 | 2014-11-11 19:45:59 +0100 | [diff] [blame] | 666 | module_phy_driver(ksphy_driver); |
David J. Choi | d050700 | 2010-04-29 06:12:41 +0000 | [diff] [blame] | 667 | |
| 668 | MODULE_DESCRIPTION("Micrel PHY driver"); |
| 669 | MODULE_AUTHOR("David J. Choi"); |
| 670 | MODULE_LICENSE("GPL"); |
David S. Miller | 52a60ed | 2010-05-03 15:48:29 -0700 | [diff] [blame] | 671 | |
Uwe Kleine-König | cf93c94 | 2010-10-03 23:43:32 +0000 | [diff] [blame] | 672 | static struct mdio_device_id __maybe_unused micrel_tbl[] = { |
Jason Wang | 48d7d0a | 2012-06-17 22:52:09 +0000 | [diff] [blame] | 673 | { PHY_ID_KSZ9021, 0x000ffffe }, |
David J. Choi | 7ab59dc | 2013-01-23 14:05:15 +0000 | [diff] [blame] | 674 | { PHY_ID_KSZ9031, 0x00fffff0 }, |
Marek Vasut | 510d573 | 2012-09-23 16:58:50 +0000 | [diff] [blame] | 675 | { PHY_ID_KSZ8001, 0x00ffffff }, |
Choi, David | 51f932c | 2010-06-28 15:23:41 +0000 | [diff] [blame] | 676 | { PHY_ID_KS8737, 0x00fffff0 }, |
Marek Vasut | 212ea99 | 2012-09-23 16:58:49 +0000 | [diff] [blame] | 677 | { PHY_ID_KSZ8021, 0x00ffffff }, |
Hector Palacios | b818d1a | 2013-03-10 22:50:02 +0000 | [diff] [blame] | 678 | { PHY_ID_KSZ8031, 0x00ffffff }, |
Marek Vasut | 510d573 | 2012-09-23 16:58:50 +0000 | [diff] [blame] | 679 | { PHY_ID_KSZ8041, 0x00fffff0 }, |
| 680 | { PHY_ID_KSZ8051, 0x00fffff0 }, |
David J. Choi | 7ab59dc | 2013-01-23 14:05:15 +0000 | [diff] [blame] | 681 | { PHY_ID_KSZ8061, 0x00fffff0 }, |
| 682 | { PHY_ID_KSZ8081, 0x00fffff0 }, |
Jean-Christophe PLAGNIOL-VILLARD | 93272e0 | 2012-11-21 05:38:07 +0000 | [diff] [blame] | 683 | { PHY_ID_KSZ8873MLL, 0x00fffff0 }, |
David J. Choi | 7ab59dc | 2013-01-23 14:05:15 +0000 | [diff] [blame] | 684 | { PHY_ID_KSZ886X, 0x00fffff0 }, |
David S. Miller | 52a60ed | 2010-05-03 15:48:29 -0700 | [diff] [blame] | 685 | { } |
| 686 | }; |
| 687 | |
| 688 | MODULE_DEVICE_TABLE(mdio, micrel_tbl); |