xref: /openbmc/linux/drivers/net/phy/micrel.c (revision 6e4b82730c7525504fc485b370c7f09e594e2e96)
1d0507009SDavid J. Choi /*
2d0507009SDavid J. Choi  * drivers/net/phy/micrel.c
3d0507009SDavid J. Choi  *
4d0507009SDavid J. Choi  * Driver for Micrel PHYs
5d0507009SDavid J. Choi  *
6d0507009SDavid J. Choi  * Author: David J. Choi
7d0507009SDavid J. Choi  *
87ab59dc1SDavid J. Choi  * Copyright (c) 2010-2013 Micrel, Inc.
9d0507009SDavid J. Choi  *
10d0507009SDavid J. Choi  * This program is free software; you can redistribute  it and/or modify it
11d0507009SDavid J. Choi  * under  the terms of  the GNU General  Public License as published by the
12d0507009SDavid J. Choi  * Free Software Foundation;  either version 2 of the  License, or (at your
13d0507009SDavid J. Choi  * option) any later version.
14d0507009SDavid J. Choi  *
157ab59dc1SDavid J. Choi  * Support : Micrel Phys:
167ab59dc1SDavid J. Choi  *		Giga phys: ksz9021, ksz9031
177ab59dc1SDavid J. Choi  *		100/10 Phys : ksz8001, ksz8721, ksz8737, ksz8041
187ab59dc1SDavid J. Choi  *			   ksz8021, ksz8031, ksz8051,
197ab59dc1SDavid J. Choi  *			   ksz8081, ksz8091,
207ab59dc1SDavid J. Choi  *			   ksz8061,
217ab59dc1SDavid J. Choi  *		Switch : ksz8873, ksz886x
22d0507009SDavid J. Choi  */
23d0507009SDavid J. Choi 
24d0507009SDavid J. Choi #include <linux/kernel.h>
25d0507009SDavid J. Choi #include <linux/module.h>
26d0507009SDavid J. Choi #include <linux/phy.h>
27d606ef3fSBaruch Siach #include <linux/micrel_phy.h>
28954c3967SSean Cross #include <linux/of.h>
29d0507009SDavid J. Choi 
30212ea99aSMarek Vasut /* Operation Mode Strap Override */
31212ea99aSMarek Vasut #define MII_KSZPHY_OMSO				0x16
32212ea99aSMarek Vasut #define KSZPHY_OMSO_B_CAST_OFF			(1 << 9)
33212ea99aSMarek Vasut #define KSZPHY_OMSO_RMII_OVERRIDE		(1 << 1)
34212ea99aSMarek Vasut #define KSZPHY_OMSO_MII_OVERRIDE		(1 << 0)
35212ea99aSMarek Vasut 
3651f932c4SChoi, David /* general Interrupt control/status reg in vendor specific block. */
3751f932c4SChoi, David #define MII_KSZPHY_INTCS			0x1B
3851f932c4SChoi, David #define	KSZPHY_INTCS_JABBER			(1 << 15)
3951f932c4SChoi, David #define	KSZPHY_INTCS_RECEIVE_ERR		(1 << 14)
4051f932c4SChoi, David #define	KSZPHY_INTCS_PAGE_RECEIVE		(1 << 13)
4151f932c4SChoi, David #define	KSZPHY_INTCS_PARELLEL			(1 << 12)
4251f932c4SChoi, David #define	KSZPHY_INTCS_LINK_PARTNER_ACK		(1 << 11)
4351f932c4SChoi, David #define	KSZPHY_INTCS_LINK_DOWN			(1 << 10)
4451f932c4SChoi, David #define	KSZPHY_INTCS_REMOTE_FAULT		(1 << 9)
4551f932c4SChoi, David #define	KSZPHY_INTCS_LINK_UP			(1 << 8)
4651f932c4SChoi, David #define	KSZPHY_INTCS_ALL			(KSZPHY_INTCS_LINK_UP |\
4751f932c4SChoi, David 						KSZPHY_INTCS_LINK_DOWN)
4851f932c4SChoi, David 
4951f932c4SChoi, David /* general PHY control reg in vendor specific block. */
5051f932c4SChoi, David #define	MII_KSZPHY_CTRL			0x1F
5151f932c4SChoi, David /* bitmap of PHY register to set interrupt mode */
5251f932c4SChoi, David #define KSZPHY_CTRL_INT_ACTIVE_HIGH		(1 << 9)
5351f932c4SChoi, David #define KSZ9021_CTRL_INT_ACTIVE_HIGH		(1 << 14)
5451f932c4SChoi, David #define KS8737_CTRL_INT_ACTIVE_HIGH		(1 << 14)
55d606ef3fSBaruch Siach #define KSZ8051_RMII_50MHZ_CLK			(1 << 7)
5651f932c4SChoi, David 
57954c3967SSean Cross /* Write/read to/from extended registers */
58954c3967SSean Cross #define MII_KSZPHY_EXTREG                       0x0b
59954c3967SSean Cross #define KSZPHY_EXTREG_WRITE                     0x8000
60954c3967SSean Cross 
61954c3967SSean Cross #define MII_KSZPHY_EXTREG_WRITE                 0x0c
62954c3967SSean Cross #define MII_KSZPHY_EXTREG_READ                  0x0d
63954c3967SSean Cross 
64954c3967SSean Cross /* Extended registers */
65954c3967SSean Cross #define MII_KSZPHY_CLK_CONTROL_PAD_SKEW         0x104
66954c3967SSean Cross #define MII_KSZPHY_RX_DATA_PAD_SKEW             0x105
67954c3967SSean Cross #define MII_KSZPHY_TX_DATA_PAD_SKEW             0x106
68954c3967SSean Cross 
69954c3967SSean Cross #define PS_TO_REG				200
70954c3967SSean Cross 
71b6bb4dfcSHector Palacios static int ksz_config_flags(struct phy_device *phydev)
72b6bb4dfcSHector Palacios {
73b6bb4dfcSHector Palacios 	int regval;
74b6bb4dfcSHector Palacios 
75b6bb4dfcSHector Palacios 	if (phydev->dev_flags & MICREL_PHY_50MHZ_CLK) {
76b6bb4dfcSHector Palacios 		regval = phy_read(phydev, MII_KSZPHY_CTRL);
77b6bb4dfcSHector Palacios 		regval |= KSZ8051_RMII_50MHZ_CLK;
78b6bb4dfcSHector Palacios 		return phy_write(phydev, MII_KSZPHY_CTRL, regval);
79b6bb4dfcSHector Palacios 	}
80b6bb4dfcSHector Palacios 	return 0;
81b6bb4dfcSHector Palacios }
82b6bb4dfcSHector Palacios 
83954c3967SSean Cross static int kszphy_extended_write(struct phy_device *phydev,
84954c3967SSean Cross 				u32 regnum, u16 val)
85954c3967SSean Cross {
86954c3967SSean Cross 	phy_write(phydev, MII_KSZPHY_EXTREG, KSZPHY_EXTREG_WRITE | regnum);
87954c3967SSean Cross 	return phy_write(phydev, MII_KSZPHY_EXTREG_WRITE, val);
88954c3967SSean Cross }
89954c3967SSean Cross 
90954c3967SSean Cross static int kszphy_extended_read(struct phy_device *phydev,
91954c3967SSean Cross 				u32 regnum)
92954c3967SSean Cross {
93954c3967SSean Cross 	phy_write(phydev, MII_KSZPHY_EXTREG, regnum);
94954c3967SSean Cross 	return phy_read(phydev, MII_KSZPHY_EXTREG_READ);
95954c3967SSean Cross }
96954c3967SSean Cross 
9751f932c4SChoi, David static int kszphy_ack_interrupt(struct phy_device *phydev)
9851f932c4SChoi, David {
9951f932c4SChoi, David 	/* bit[7..0] int status, which is a read and clear register. */
10051f932c4SChoi, David 	int rc;
10151f932c4SChoi, David 
10251f932c4SChoi, David 	rc = phy_read(phydev, MII_KSZPHY_INTCS);
10351f932c4SChoi, David 
10451f932c4SChoi, David 	return (rc < 0) ? rc : 0;
10551f932c4SChoi, David }
10651f932c4SChoi, David 
10751f932c4SChoi, David static int kszphy_set_interrupt(struct phy_device *phydev)
10851f932c4SChoi, David {
10951f932c4SChoi, David 	int temp;
11051f932c4SChoi, David 	temp = (PHY_INTERRUPT_ENABLED == phydev->interrupts) ?
11151f932c4SChoi, David 		KSZPHY_INTCS_ALL : 0;
11251f932c4SChoi, David 	return phy_write(phydev, MII_KSZPHY_INTCS, temp);
11351f932c4SChoi, David }
11451f932c4SChoi, David 
11551f932c4SChoi, David static int kszphy_config_intr(struct phy_device *phydev)
11651f932c4SChoi, David {
11751f932c4SChoi, David 	int temp, rc;
11851f932c4SChoi, David 
11951f932c4SChoi, David 	/* set the interrupt pin active low */
12051f932c4SChoi, David 	temp = phy_read(phydev, MII_KSZPHY_CTRL);
12151f932c4SChoi, David 	temp &= ~KSZPHY_CTRL_INT_ACTIVE_HIGH;
12251f932c4SChoi, David 	phy_write(phydev, MII_KSZPHY_CTRL, temp);
12351f932c4SChoi, David 	rc = kszphy_set_interrupt(phydev);
12451f932c4SChoi, David 	return rc < 0 ? rc : 0;
12551f932c4SChoi, David }
12651f932c4SChoi, David 
12751f932c4SChoi, David static int ksz9021_config_intr(struct phy_device *phydev)
12851f932c4SChoi, David {
12951f932c4SChoi, David 	int temp, rc;
13051f932c4SChoi, David 
13151f932c4SChoi, David 	/* set the interrupt pin active low */
13251f932c4SChoi, David 	temp = phy_read(phydev, MII_KSZPHY_CTRL);
13351f932c4SChoi, David 	temp &= ~KSZ9021_CTRL_INT_ACTIVE_HIGH;
13451f932c4SChoi, David 	phy_write(phydev, MII_KSZPHY_CTRL, temp);
13551f932c4SChoi, David 	rc = kszphy_set_interrupt(phydev);
13651f932c4SChoi, David 	return rc < 0 ? rc : 0;
13751f932c4SChoi, David }
13851f932c4SChoi, David 
13951f932c4SChoi, David static int ks8737_config_intr(struct phy_device *phydev)
14051f932c4SChoi, David {
14151f932c4SChoi, David 	int temp, rc;
14251f932c4SChoi, David 
14351f932c4SChoi, David 	/* set the interrupt pin active low */
14451f932c4SChoi, David 	temp = phy_read(phydev, MII_KSZPHY_CTRL);
14551f932c4SChoi, David 	temp &= ~KS8737_CTRL_INT_ACTIVE_HIGH;
14651f932c4SChoi, David 	phy_write(phydev, MII_KSZPHY_CTRL, temp);
14751f932c4SChoi, David 	rc = kszphy_set_interrupt(phydev);
14851f932c4SChoi, David 	return rc < 0 ? rc : 0;
14951f932c4SChoi, David }
150d0507009SDavid J. Choi 
15120d8435aSBen Dooks static int kszphy_setup_led(struct phy_device *phydev,
15220d8435aSBen Dooks 			    unsigned int reg, unsigned int shift)
15320d8435aSBen Dooks {
15420d8435aSBen Dooks 
15520d8435aSBen Dooks 	struct device *dev = &phydev->dev;
15620d8435aSBen Dooks 	struct device_node *of_node = dev->of_node;
15720d8435aSBen Dooks 	int rc, temp;
15820d8435aSBen Dooks 	u32 val;
15920d8435aSBen Dooks 
16020d8435aSBen Dooks 	if (!of_node && dev->parent->of_node)
16120d8435aSBen Dooks 		of_node = dev->parent->of_node;
16220d8435aSBen Dooks 
16320d8435aSBen Dooks 	if (of_property_read_u32(of_node, "micrel,led-mode", &val))
16420d8435aSBen Dooks 		return 0;
16520d8435aSBen Dooks 
16620d8435aSBen Dooks 	temp = phy_read(phydev, reg);
16720d8435aSBen Dooks 	if (temp < 0)
16820d8435aSBen Dooks 		return temp;
16920d8435aSBen Dooks 
17028bdc499SSergei Shtylyov 	temp &= ~(3 << shift);
17120d8435aSBen Dooks 	temp |= val << shift;
17220d8435aSBen Dooks 	rc = phy_write(phydev, reg, temp);
17320d8435aSBen Dooks 
17420d8435aSBen Dooks 	return rc < 0 ? rc : 0;
17520d8435aSBen Dooks }
17620d8435aSBen Dooks 
177d0507009SDavid J. Choi static int kszphy_config_init(struct phy_device *phydev)
178d0507009SDavid J. Choi {
179d0507009SDavid J. Choi 	return 0;
180d0507009SDavid J. Choi }
181d0507009SDavid J. Choi 
18220d8435aSBen Dooks static int kszphy_config_init_led8041(struct phy_device *phydev)
18320d8435aSBen Dooks {
18420d8435aSBen Dooks 	/* single led control, register 0x1e bits 15..14 */
18520d8435aSBen Dooks 	return kszphy_setup_led(phydev, 0x1e, 14);
18620d8435aSBen Dooks }
18720d8435aSBen Dooks 
188212ea99aSMarek Vasut static int ksz8021_config_init(struct phy_device *phydev)
189212ea99aSMarek Vasut {
190212ea99aSMarek Vasut 	const u16 val = KSZPHY_OMSO_B_CAST_OFF | KSZPHY_OMSO_RMII_OVERRIDE;
19120d8435aSBen Dooks 	int rc;
19220d8435aSBen Dooks 
19320d8435aSBen Dooks 	rc = kszphy_setup_led(phydev, 0x1f, 4);
19420d8435aSBen Dooks 	if (rc)
19520d8435aSBen Dooks 		dev_err(&phydev->dev, "failed to set led mode\n");
19620d8435aSBen Dooks 
197212ea99aSMarek Vasut 	phy_write(phydev, MII_KSZPHY_OMSO, val);
198b6bb4dfcSHector Palacios 	rc = ksz_config_flags(phydev);
199b6bb4dfcSHector Palacios 	return rc < 0 ? rc : 0;
200212ea99aSMarek Vasut }
201212ea99aSMarek Vasut 
202d606ef3fSBaruch Siach static int ks8051_config_init(struct phy_device *phydev)
203d606ef3fSBaruch Siach {
204b6bb4dfcSHector Palacios 	int rc;
205d606ef3fSBaruch Siach 
20620d8435aSBen Dooks 	rc = kszphy_setup_led(phydev, 0x1f, 4);
20720d8435aSBen Dooks 	if (rc)
20820d8435aSBen Dooks 		dev_err(&phydev->dev, "failed to set led mode\n");
20920d8435aSBen Dooks 
210b6bb4dfcSHector Palacios 	rc = ksz_config_flags(phydev);
211b6bb4dfcSHector Palacios 	return rc < 0 ? rc : 0;
212d606ef3fSBaruch Siach }
213d606ef3fSBaruch Siach 
214954c3967SSean Cross static int ksz9021_load_values_from_of(struct phy_device *phydev,
215954c3967SSean Cross 				       struct device_node *of_node, u16 reg,
216954c3967SSean Cross 				       char *field1, char *field2,
217954c3967SSean Cross 				       char *field3, char *field4)
218954c3967SSean Cross {
219954c3967SSean Cross 	int val1 = -1;
220954c3967SSean Cross 	int val2 = -2;
221954c3967SSean Cross 	int val3 = -3;
222954c3967SSean Cross 	int val4 = -4;
223954c3967SSean Cross 	int newval;
224954c3967SSean Cross 	int matches = 0;
225954c3967SSean Cross 
226954c3967SSean Cross 	if (!of_property_read_u32(of_node, field1, &val1))
227954c3967SSean Cross 		matches++;
228954c3967SSean Cross 
229954c3967SSean Cross 	if (!of_property_read_u32(of_node, field2, &val2))
230954c3967SSean Cross 		matches++;
231954c3967SSean Cross 
232954c3967SSean Cross 	if (!of_property_read_u32(of_node, field3, &val3))
233954c3967SSean Cross 		matches++;
234954c3967SSean Cross 
235954c3967SSean Cross 	if (!of_property_read_u32(of_node, field4, &val4))
236954c3967SSean Cross 		matches++;
237954c3967SSean Cross 
238954c3967SSean Cross 	if (!matches)
239954c3967SSean Cross 		return 0;
240954c3967SSean Cross 
241954c3967SSean Cross 	if (matches < 4)
242954c3967SSean Cross 		newval = kszphy_extended_read(phydev, reg);
243954c3967SSean Cross 	else
244954c3967SSean Cross 		newval = 0;
245954c3967SSean Cross 
246954c3967SSean Cross 	if (val1 != -1)
247954c3967SSean Cross 		newval = ((newval & 0xfff0) | ((val1 / PS_TO_REG) & 0xf) << 0);
248954c3967SSean Cross 
2496a119745SHubert Chaumette 	if (val2 != -2)
250954c3967SSean Cross 		newval = ((newval & 0xff0f) | ((val2 / PS_TO_REG) & 0xf) << 4);
251954c3967SSean Cross 
2526a119745SHubert Chaumette 	if (val3 != -3)
253954c3967SSean Cross 		newval = ((newval & 0xf0ff) | ((val3 / PS_TO_REG) & 0xf) << 8);
254954c3967SSean Cross 
2556a119745SHubert Chaumette 	if (val4 != -4)
256954c3967SSean Cross 		newval = ((newval & 0x0fff) | ((val4 / PS_TO_REG) & 0xf) << 12);
257954c3967SSean Cross 
258954c3967SSean Cross 	return kszphy_extended_write(phydev, reg, newval);
259954c3967SSean Cross }
260954c3967SSean Cross 
261954c3967SSean Cross static int ksz9021_config_init(struct phy_device *phydev)
262954c3967SSean Cross {
263954c3967SSean Cross 	struct device *dev = &phydev->dev;
264954c3967SSean Cross 	struct device_node *of_node = dev->of_node;
265954c3967SSean Cross 
266954c3967SSean Cross 	if (!of_node && dev->parent->of_node)
267954c3967SSean Cross 		of_node = dev->parent->of_node;
268954c3967SSean Cross 
269954c3967SSean Cross 	if (of_node) {
270954c3967SSean Cross 		ksz9021_load_values_from_of(phydev, of_node,
271954c3967SSean Cross 				    MII_KSZPHY_CLK_CONTROL_PAD_SKEW,
272954c3967SSean Cross 				    "txen-skew-ps", "txc-skew-ps",
273954c3967SSean Cross 				    "rxdv-skew-ps", "rxc-skew-ps");
274954c3967SSean Cross 		ksz9021_load_values_from_of(phydev, of_node,
275954c3967SSean Cross 				    MII_KSZPHY_RX_DATA_PAD_SKEW,
276954c3967SSean Cross 				    "rxd0-skew-ps", "rxd1-skew-ps",
277954c3967SSean Cross 				    "rxd2-skew-ps", "rxd3-skew-ps");
278954c3967SSean Cross 		ksz9021_load_values_from_of(phydev, of_node,
279954c3967SSean Cross 				    MII_KSZPHY_TX_DATA_PAD_SKEW,
280954c3967SSean Cross 				    "txd0-skew-ps", "txd1-skew-ps",
281954c3967SSean Cross 				    "txd2-skew-ps", "txd3-skew-ps");
282954c3967SSean Cross 	}
283954c3967SSean Cross 	return 0;
284954c3967SSean Cross }
285954c3967SSean Cross 
286*6e4b8273SHubert Chaumette #define MII_KSZ9031RN_MMD_CTRL_REG	0x0d
287*6e4b8273SHubert Chaumette #define MII_KSZ9031RN_MMD_REGDATA_REG	0x0e
288*6e4b8273SHubert Chaumette #define OP_DATA				1
289*6e4b8273SHubert Chaumette #define KSZ9031_PS_TO_REG		60
290*6e4b8273SHubert Chaumette 
291*6e4b8273SHubert Chaumette /* Extended registers */
292*6e4b8273SHubert Chaumette #define MII_KSZ9031RN_CONTROL_PAD_SKEW	4
293*6e4b8273SHubert Chaumette #define MII_KSZ9031RN_RX_DATA_PAD_SKEW	5
294*6e4b8273SHubert Chaumette #define MII_KSZ9031RN_TX_DATA_PAD_SKEW	6
295*6e4b8273SHubert Chaumette #define MII_KSZ9031RN_CLK_PAD_SKEW	8
296*6e4b8273SHubert Chaumette 
297*6e4b8273SHubert Chaumette static int ksz9031_extended_write(struct phy_device *phydev,
298*6e4b8273SHubert Chaumette 				  u8 mode, u32 dev_addr, u32 regnum, u16 val)
299*6e4b8273SHubert Chaumette {
300*6e4b8273SHubert Chaumette 	phy_write(phydev, MII_KSZ9031RN_MMD_CTRL_REG, dev_addr);
301*6e4b8273SHubert Chaumette 	phy_write(phydev, MII_KSZ9031RN_MMD_REGDATA_REG, regnum);
302*6e4b8273SHubert Chaumette 	phy_write(phydev, MII_KSZ9031RN_MMD_CTRL_REG, (mode << 14) | dev_addr);
303*6e4b8273SHubert Chaumette 	return phy_write(phydev, MII_KSZ9031RN_MMD_REGDATA_REG, val);
304*6e4b8273SHubert Chaumette }
305*6e4b8273SHubert Chaumette 
306*6e4b8273SHubert Chaumette static int ksz9031_extended_read(struct phy_device *phydev,
307*6e4b8273SHubert Chaumette 				 u8 mode, u32 dev_addr, u32 regnum)
308*6e4b8273SHubert Chaumette {
309*6e4b8273SHubert Chaumette 	phy_write(phydev, MII_KSZ9031RN_MMD_CTRL_REG, dev_addr);
310*6e4b8273SHubert Chaumette 	phy_write(phydev, MII_KSZ9031RN_MMD_REGDATA_REG, regnum);
311*6e4b8273SHubert Chaumette 	phy_write(phydev, MII_KSZ9031RN_MMD_CTRL_REG, (mode << 14) | dev_addr);
312*6e4b8273SHubert Chaumette 	return phy_read(phydev, MII_KSZ9031RN_MMD_REGDATA_REG);
313*6e4b8273SHubert Chaumette }
314*6e4b8273SHubert Chaumette 
315*6e4b8273SHubert Chaumette static int ksz9031_of_load_skew_values(struct phy_device *phydev,
316*6e4b8273SHubert Chaumette 				       struct device_node *of_node,
317*6e4b8273SHubert Chaumette 				       u16 reg, size_t field_sz,
318*6e4b8273SHubert Chaumette 				       char *field[], u8 numfields)
319*6e4b8273SHubert Chaumette {
320*6e4b8273SHubert Chaumette 	int val[4] = {-1, -2, -3, -4};
321*6e4b8273SHubert Chaumette 	int matches = 0;
322*6e4b8273SHubert Chaumette 	u16 mask;
323*6e4b8273SHubert Chaumette 	u16 maxval;
324*6e4b8273SHubert Chaumette 	u16 newval;
325*6e4b8273SHubert Chaumette 	int i;
326*6e4b8273SHubert Chaumette 
327*6e4b8273SHubert Chaumette 	for (i = 0; i < numfields; i++)
328*6e4b8273SHubert Chaumette 		if (!of_property_read_u32(of_node, field[i], val + i))
329*6e4b8273SHubert Chaumette 			matches++;
330*6e4b8273SHubert Chaumette 
331*6e4b8273SHubert Chaumette 	if (!matches)
332*6e4b8273SHubert Chaumette 		return 0;
333*6e4b8273SHubert Chaumette 
334*6e4b8273SHubert Chaumette 	if (matches < numfields)
335*6e4b8273SHubert Chaumette 		newval = ksz9031_extended_read(phydev, OP_DATA, 2, reg);
336*6e4b8273SHubert Chaumette 	else
337*6e4b8273SHubert Chaumette 		newval = 0;
338*6e4b8273SHubert Chaumette 
339*6e4b8273SHubert Chaumette 	maxval = (field_sz == 4) ? 0xf : 0x1f;
340*6e4b8273SHubert Chaumette 	for (i = 0; i < numfields; i++)
341*6e4b8273SHubert Chaumette 		if (val[i] != -(i + 1)) {
342*6e4b8273SHubert Chaumette 			mask = 0xffff;
343*6e4b8273SHubert Chaumette 			mask ^= maxval << (field_sz * i);
344*6e4b8273SHubert Chaumette 			newval = (newval & mask) |
345*6e4b8273SHubert Chaumette 				(((val[i] / KSZ9031_PS_TO_REG) & maxval)
346*6e4b8273SHubert Chaumette 					<< (field_sz * i));
347*6e4b8273SHubert Chaumette 		}
348*6e4b8273SHubert Chaumette 
349*6e4b8273SHubert Chaumette 	return ksz9031_extended_write(phydev, OP_DATA, 2, reg, newval);
350*6e4b8273SHubert Chaumette }
351*6e4b8273SHubert Chaumette 
352*6e4b8273SHubert Chaumette static int ksz9031_config_init(struct phy_device *phydev)
353*6e4b8273SHubert Chaumette {
354*6e4b8273SHubert Chaumette 	struct device *dev = &phydev->dev;
355*6e4b8273SHubert Chaumette 	struct device_node *of_node = dev->of_node;
356*6e4b8273SHubert Chaumette 	char *clk_skews[2] = {"rxc-skew-ps", "txc-skew-ps"};
357*6e4b8273SHubert Chaumette 	char *rx_data_skews[4] = {
358*6e4b8273SHubert Chaumette 		"rxd0-skew-ps", "rxd1-skew-ps",
359*6e4b8273SHubert Chaumette 		"rxd2-skew-ps", "rxd3-skew-ps"
360*6e4b8273SHubert Chaumette 	};
361*6e4b8273SHubert Chaumette 	char *tx_data_skews[4] = {
362*6e4b8273SHubert Chaumette 		"txd0-skew-ps", "txd1-skew-ps",
363*6e4b8273SHubert Chaumette 		"txd2-skew-ps", "txd3-skew-ps"
364*6e4b8273SHubert Chaumette 	};
365*6e4b8273SHubert Chaumette 	char *control_skews[2] = {"txen-skew-ps", "rxdv-skew-ps"};
366*6e4b8273SHubert Chaumette 
367*6e4b8273SHubert Chaumette 	if (!of_node && dev->parent->of_node)
368*6e4b8273SHubert Chaumette 		of_node = dev->parent->of_node;
369*6e4b8273SHubert Chaumette 
370*6e4b8273SHubert Chaumette 	if (of_node) {
371*6e4b8273SHubert Chaumette 		ksz9031_of_load_skew_values(phydev, of_node,
372*6e4b8273SHubert Chaumette 				MII_KSZ9031RN_CLK_PAD_SKEW, 5,
373*6e4b8273SHubert Chaumette 				clk_skews, 2);
374*6e4b8273SHubert Chaumette 
375*6e4b8273SHubert Chaumette 		ksz9031_of_load_skew_values(phydev, of_node,
376*6e4b8273SHubert Chaumette 				MII_KSZ9031RN_CONTROL_PAD_SKEW, 4,
377*6e4b8273SHubert Chaumette 				control_skews, 2);
378*6e4b8273SHubert Chaumette 
379*6e4b8273SHubert Chaumette 		ksz9031_of_load_skew_values(phydev, of_node,
380*6e4b8273SHubert Chaumette 				MII_KSZ9031RN_RX_DATA_PAD_SKEW, 4,
381*6e4b8273SHubert Chaumette 				rx_data_skews, 4);
382*6e4b8273SHubert Chaumette 
383*6e4b8273SHubert Chaumette 		ksz9031_of_load_skew_values(phydev, of_node,
384*6e4b8273SHubert Chaumette 				MII_KSZ9031RN_TX_DATA_PAD_SKEW, 4,
385*6e4b8273SHubert Chaumette 				tx_data_skews, 4);
386*6e4b8273SHubert Chaumette 	}
387*6e4b8273SHubert Chaumette 	return 0;
388*6e4b8273SHubert Chaumette }
389*6e4b8273SHubert Chaumette 
39093272e07SJean-Christophe PLAGNIOL-VILLARD #define KSZ8873MLL_GLOBAL_CONTROL_4	0x06
39193272e07SJean-Christophe PLAGNIOL-VILLARD #define KSZ8873MLL_GLOBAL_CONTROL_4_DUPLEX	(1 << 6)
39293272e07SJean-Christophe PLAGNIOL-VILLARD #define KSZ8873MLL_GLOBAL_CONTROL_4_SPEED	(1 << 4)
39332d73b14SJingoo Han static int ksz8873mll_read_status(struct phy_device *phydev)
39493272e07SJean-Christophe PLAGNIOL-VILLARD {
39593272e07SJean-Christophe PLAGNIOL-VILLARD 	int regval;
39693272e07SJean-Christophe PLAGNIOL-VILLARD 
39793272e07SJean-Christophe PLAGNIOL-VILLARD 	/* dummy read */
39893272e07SJean-Christophe PLAGNIOL-VILLARD 	regval = phy_read(phydev, KSZ8873MLL_GLOBAL_CONTROL_4);
39993272e07SJean-Christophe PLAGNIOL-VILLARD 
40093272e07SJean-Christophe PLAGNIOL-VILLARD 	regval = phy_read(phydev, KSZ8873MLL_GLOBAL_CONTROL_4);
40193272e07SJean-Christophe PLAGNIOL-VILLARD 
40293272e07SJean-Christophe PLAGNIOL-VILLARD 	if (regval & KSZ8873MLL_GLOBAL_CONTROL_4_DUPLEX)
40393272e07SJean-Christophe PLAGNIOL-VILLARD 		phydev->duplex = DUPLEX_HALF;
40493272e07SJean-Christophe PLAGNIOL-VILLARD 	else
40593272e07SJean-Christophe PLAGNIOL-VILLARD 		phydev->duplex = DUPLEX_FULL;
40693272e07SJean-Christophe PLAGNIOL-VILLARD 
40793272e07SJean-Christophe PLAGNIOL-VILLARD 	if (regval & KSZ8873MLL_GLOBAL_CONTROL_4_SPEED)
40893272e07SJean-Christophe PLAGNIOL-VILLARD 		phydev->speed = SPEED_10;
40993272e07SJean-Christophe PLAGNIOL-VILLARD 	else
41093272e07SJean-Christophe PLAGNIOL-VILLARD 		phydev->speed = SPEED_100;
41193272e07SJean-Christophe PLAGNIOL-VILLARD 
41293272e07SJean-Christophe PLAGNIOL-VILLARD 	phydev->link = 1;
41393272e07SJean-Christophe PLAGNIOL-VILLARD 	phydev->pause = phydev->asym_pause = 0;
41493272e07SJean-Christophe PLAGNIOL-VILLARD 
41593272e07SJean-Christophe PLAGNIOL-VILLARD 	return 0;
41693272e07SJean-Christophe PLAGNIOL-VILLARD }
41793272e07SJean-Christophe PLAGNIOL-VILLARD 
41893272e07SJean-Christophe PLAGNIOL-VILLARD static int ksz8873mll_config_aneg(struct phy_device *phydev)
41993272e07SJean-Christophe PLAGNIOL-VILLARD {
42093272e07SJean-Christophe PLAGNIOL-VILLARD 	return 0;
42193272e07SJean-Christophe PLAGNIOL-VILLARD }
42293272e07SJean-Christophe PLAGNIOL-VILLARD 
423d5bf9071SChristian Hohnstaedt static struct phy_driver ksphy_driver[] = {
424d5bf9071SChristian Hohnstaedt {
42551f932c4SChoi, David 	.phy_id		= PHY_ID_KS8737,
426d0507009SDavid J. Choi 	.phy_id_mask	= 0x00fffff0,
42751f932c4SChoi, David 	.name		= "Micrel KS8737",
42851f932c4SChoi, David 	.features	= (PHY_BASIC_FEATURES | SUPPORTED_Pause),
42951f932c4SChoi, David 	.flags		= PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
430d0507009SDavid J. Choi 	.config_init	= kszphy_config_init,
431d0507009SDavid J. Choi 	.config_aneg	= genphy_config_aneg,
432d0507009SDavid J. Choi 	.read_status	= genphy_read_status,
43351f932c4SChoi, David 	.ack_interrupt	= kszphy_ack_interrupt,
43451f932c4SChoi, David 	.config_intr	= ks8737_config_intr,
4351a5465f5SPatrice Vilchez 	.suspend	= genphy_suspend,
4361a5465f5SPatrice Vilchez 	.resume		= genphy_resume,
437d0507009SDavid J. Choi 	.driver		= { .owner = THIS_MODULE,},
438d5bf9071SChristian Hohnstaedt }, {
439212ea99aSMarek Vasut 	.phy_id		= PHY_ID_KSZ8021,
440212ea99aSMarek Vasut 	.phy_id_mask	= 0x00ffffff,
4417ab59dc1SDavid J. Choi 	.name		= "Micrel KSZ8021 or KSZ8031",
442212ea99aSMarek Vasut 	.features	= (PHY_BASIC_FEATURES | SUPPORTED_Pause |
443212ea99aSMarek Vasut 			   SUPPORTED_Asym_Pause),
444212ea99aSMarek Vasut 	.flags		= PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
445212ea99aSMarek Vasut 	.config_init	= ksz8021_config_init,
446212ea99aSMarek Vasut 	.config_aneg	= genphy_config_aneg,
447212ea99aSMarek Vasut 	.read_status	= genphy_read_status,
448212ea99aSMarek Vasut 	.ack_interrupt	= kszphy_ack_interrupt,
449212ea99aSMarek Vasut 	.config_intr	= kszphy_config_intr,
4501a5465f5SPatrice Vilchez 	.suspend	= genphy_suspend,
4511a5465f5SPatrice Vilchez 	.resume		= genphy_resume,
452212ea99aSMarek Vasut 	.driver		= { .owner = THIS_MODULE,},
453212ea99aSMarek Vasut }, {
454b818d1a7SHector Palacios 	.phy_id		= PHY_ID_KSZ8031,
455b818d1a7SHector Palacios 	.phy_id_mask	= 0x00ffffff,
456b818d1a7SHector Palacios 	.name		= "Micrel KSZ8031",
457b818d1a7SHector Palacios 	.features	= (PHY_BASIC_FEATURES | SUPPORTED_Pause |
458b818d1a7SHector Palacios 			   SUPPORTED_Asym_Pause),
459b818d1a7SHector Palacios 	.flags		= PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
460b818d1a7SHector Palacios 	.config_init	= ksz8021_config_init,
461b818d1a7SHector Palacios 	.config_aneg	= genphy_config_aneg,
462b818d1a7SHector Palacios 	.read_status	= genphy_read_status,
463b818d1a7SHector Palacios 	.ack_interrupt	= kszphy_ack_interrupt,
464b818d1a7SHector Palacios 	.config_intr	= kszphy_config_intr,
4651a5465f5SPatrice Vilchez 	.suspend	= genphy_suspend,
4661a5465f5SPatrice Vilchez 	.resume		= genphy_resume,
467b818d1a7SHector Palacios 	.driver		= { .owner = THIS_MODULE,},
468b818d1a7SHector Palacios }, {
469510d573fSMarek Vasut 	.phy_id		= PHY_ID_KSZ8041,
470d0507009SDavid J. Choi 	.phy_id_mask	= 0x00fffff0,
471510d573fSMarek Vasut 	.name		= "Micrel KSZ8041",
47251f932c4SChoi, David 	.features	= (PHY_BASIC_FEATURES | SUPPORTED_Pause
47351f932c4SChoi, David 				| SUPPORTED_Asym_Pause),
47451f932c4SChoi, David 	.flags		= PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
47520d8435aSBen Dooks 	.config_init	= kszphy_config_init_led8041,
476d0507009SDavid J. Choi 	.config_aneg	= genphy_config_aneg,
477d0507009SDavid J. Choi 	.read_status	= genphy_read_status,
47851f932c4SChoi, David 	.ack_interrupt	= kszphy_ack_interrupt,
47951f932c4SChoi, David 	.config_intr	= kszphy_config_intr,
4801a5465f5SPatrice Vilchez 	.suspend	= genphy_suspend,
4811a5465f5SPatrice Vilchez 	.resume		= genphy_resume,
48251f932c4SChoi, David 	.driver		= { .owner = THIS_MODULE,},
483d5bf9071SChristian Hohnstaedt }, {
4844bd7b512SSergei Shtylyov 	.phy_id		= PHY_ID_KSZ8041RNLI,
4854bd7b512SSergei Shtylyov 	.phy_id_mask	= 0x00fffff0,
4864bd7b512SSergei Shtylyov 	.name		= "Micrel KSZ8041RNLI",
4874bd7b512SSergei Shtylyov 	.features	= PHY_BASIC_FEATURES |
4884bd7b512SSergei Shtylyov 			  SUPPORTED_Pause | SUPPORTED_Asym_Pause,
4894bd7b512SSergei Shtylyov 	.flags		= PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
49020d8435aSBen Dooks 	.config_init	= kszphy_config_init_led8041,
4914bd7b512SSergei Shtylyov 	.config_aneg	= genphy_config_aneg,
4924bd7b512SSergei Shtylyov 	.read_status	= genphy_read_status,
4934bd7b512SSergei Shtylyov 	.ack_interrupt	= kszphy_ack_interrupt,
4944bd7b512SSergei Shtylyov 	.config_intr	= kszphy_config_intr,
4954bd7b512SSergei Shtylyov 	.suspend	= genphy_suspend,
4964bd7b512SSergei Shtylyov 	.resume		= genphy_resume,
4974bd7b512SSergei Shtylyov 	.driver		= { .owner = THIS_MODULE,},
4984bd7b512SSergei Shtylyov }, {
499510d573fSMarek Vasut 	.phy_id		= PHY_ID_KSZ8051,
50051f932c4SChoi, David 	.phy_id_mask	= 0x00fffff0,
501510d573fSMarek Vasut 	.name		= "Micrel KSZ8051",
50251f932c4SChoi, David 	.features	= (PHY_BASIC_FEATURES | SUPPORTED_Pause
50351f932c4SChoi, David 				| SUPPORTED_Asym_Pause),
50451f932c4SChoi, David 	.flags		= PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
505d606ef3fSBaruch Siach 	.config_init	= ks8051_config_init,
50651f932c4SChoi, David 	.config_aneg	= genphy_config_aneg,
50751f932c4SChoi, David 	.read_status	= genphy_read_status,
50851f932c4SChoi, David 	.ack_interrupt	= kszphy_ack_interrupt,
50951f932c4SChoi, David 	.config_intr	= kszphy_config_intr,
5101a5465f5SPatrice Vilchez 	.suspend	= genphy_suspend,
5111a5465f5SPatrice Vilchez 	.resume		= genphy_resume,
51251f932c4SChoi, David 	.driver		= { .owner = THIS_MODULE,},
513d5bf9071SChristian Hohnstaedt }, {
514510d573fSMarek Vasut 	.phy_id		= PHY_ID_KSZ8001,
515510d573fSMarek Vasut 	.name		= "Micrel KSZ8001 or KS8721",
51648d7d0adSJason Wang 	.phy_id_mask	= 0x00ffffff,
51751f932c4SChoi, David 	.features	= (PHY_BASIC_FEATURES | SUPPORTED_Pause),
51851f932c4SChoi, David 	.flags		= PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
51920d8435aSBen Dooks 	.config_init	= kszphy_config_init_led8041,
52051f932c4SChoi, David 	.config_aneg	= genphy_config_aneg,
52151f932c4SChoi, David 	.read_status	= genphy_read_status,
52251f932c4SChoi, David 	.ack_interrupt	= kszphy_ack_interrupt,
52351f932c4SChoi, David 	.config_intr	= kszphy_config_intr,
5241a5465f5SPatrice Vilchez 	.suspend	= genphy_suspend,
5251a5465f5SPatrice Vilchez 	.resume		= genphy_resume,
526d0507009SDavid J. Choi 	.driver		= { .owner = THIS_MODULE,},
527d5bf9071SChristian Hohnstaedt }, {
5287ab59dc1SDavid J. Choi 	.phy_id		= PHY_ID_KSZ8081,
5297ab59dc1SDavid J. Choi 	.name		= "Micrel KSZ8081 or KSZ8091",
5307ab59dc1SDavid J. Choi 	.phy_id_mask	= 0x00fffff0,
5317ab59dc1SDavid J. Choi 	.features	= (PHY_BASIC_FEATURES | SUPPORTED_Pause),
5327ab59dc1SDavid J. Choi 	.flags		= PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
5337ab59dc1SDavid J. Choi 	.config_init	= kszphy_config_init,
5347ab59dc1SDavid J. Choi 	.config_aneg	= genphy_config_aneg,
5357ab59dc1SDavid J. Choi 	.read_status	= genphy_read_status,
5367ab59dc1SDavid J. Choi 	.ack_interrupt	= kszphy_ack_interrupt,
5377ab59dc1SDavid J. Choi 	.config_intr	= kszphy_config_intr,
5381a5465f5SPatrice Vilchez 	.suspend	= genphy_suspend,
5391a5465f5SPatrice Vilchez 	.resume		= genphy_resume,
5407ab59dc1SDavid J. Choi 	.driver		= { .owner = THIS_MODULE,},
5417ab59dc1SDavid J. Choi }, {
5427ab59dc1SDavid J. Choi 	.phy_id		= PHY_ID_KSZ8061,
5437ab59dc1SDavid J. Choi 	.name		= "Micrel KSZ8061",
5447ab59dc1SDavid J. Choi 	.phy_id_mask	= 0x00fffff0,
5457ab59dc1SDavid J. Choi 	.features	= (PHY_BASIC_FEATURES | SUPPORTED_Pause),
5467ab59dc1SDavid J. Choi 	.flags		= PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
5477ab59dc1SDavid J. Choi 	.config_init	= kszphy_config_init,
5487ab59dc1SDavid J. Choi 	.config_aneg	= genphy_config_aneg,
5497ab59dc1SDavid J. Choi 	.read_status	= genphy_read_status,
5507ab59dc1SDavid J. Choi 	.ack_interrupt	= kszphy_ack_interrupt,
5517ab59dc1SDavid J. Choi 	.config_intr	= kszphy_config_intr,
5521a5465f5SPatrice Vilchez 	.suspend	= genphy_suspend,
5531a5465f5SPatrice Vilchez 	.resume		= genphy_resume,
5547ab59dc1SDavid J. Choi 	.driver		= { .owner = THIS_MODULE,},
5557ab59dc1SDavid J. Choi }, {
556d0507009SDavid J. Choi 	.phy_id		= PHY_ID_KSZ9021,
55748d7d0adSJason Wang 	.phy_id_mask	= 0x000ffffe,
558d0507009SDavid J. Choi 	.name		= "Micrel KSZ9021 Gigabit PHY",
55932fcafbcSVlastimil Kosar 	.features	= (PHY_GBIT_FEATURES | SUPPORTED_Pause),
56051f932c4SChoi, David 	.flags		= PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
561954c3967SSean Cross 	.config_init	= ksz9021_config_init,
562d0507009SDavid J. Choi 	.config_aneg	= genphy_config_aneg,
563d0507009SDavid J. Choi 	.read_status	= genphy_read_status,
56451f932c4SChoi, David 	.ack_interrupt	= kszphy_ack_interrupt,
56551f932c4SChoi, David 	.config_intr	= ksz9021_config_intr,
5661a5465f5SPatrice Vilchez 	.suspend	= genphy_suspend,
5671a5465f5SPatrice Vilchez 	.resume		= genphy_resume,
568d0507009SDavid J. Choi 	.driver		= { .owner = THIS_MODULE, },
56993272e07SJean-Christophe PLAGNIOL-VILLARD }, {
5707ab59dc1SDavid J. Choi 	.phy_id		= PHY_ID_KSZ9031,
5717ab59dc1SDavid J. Choi 	.phy_id_mask	= 0x00fffff0,
5727ab59dc1SDavid J. Choi 	.name		= "Micrel KSZ9031 Gigabit PHY",
5737ab59dc1SDavid J. Choi 	.features	= (PHY_GBIT_FEATURES | SUPPORTED_Pause
5747ab59dc1SDavid J. Choi 				| SUPPORTED_Asym_Pause),
5757ab59dc1SDavid J. Choi 	.flags		= PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
576*6e4b8273SHubert Chaumette 	.config_init	= ksz9031_config_init,
5777ab59dc1SDavid J. Choi 	.config_aneg	= genphy_config_aneg,
5787ab59dc1SDavid J. Choi 	.read_status	= genphy_read_status,
5797ab59dc1SDavid J. Choi 	.ack_interrupt	= kszphy_ack_interrupt,
5807ab59dc1SDavid J. Choi 	.config_intr	= ksz9021_config_intr,
5811a5465f5SPatrice Vilchez 	.suspend	= genphy_suspend,
5821a5465f5SPatrice Vilchez 	.resume		= genphy_resume,
5837ab59dc1SDavid J. Choi 	.driver		= { .owner = THIS_MODULE, },
5847ab59dc1SDavid J. Choi }, {
58593272e07SJean-Christophe PLAGNIOL-VILLARD 	.phy_id		= PHY_ID_KSZ8873MLL,
58693272e07SJean-Christophe PLAGNIOL-VILLARD 	.phy_id_mask	= 0x00fffff0,
58793272e07SJean-Christophe PLAGNIOL-VILLARD 	.name		= "Micrel KSZ8873MLL Switch",
58893272e07SJean-Christophe PLAGNIOL-VILLARD 	.features	= (SUPPORTED_Pause | SUPPORTED_Asym_Pause),
58993272e07SJean-Christophe PLAGNIOL-VILLARD 	.flags		= PHY_HAS_MAGICANEG,
59093272e07SJean-Christophe PLAGNIOL-VILLARD 	.config_init	= kszphy_config_init,
59193272e07SJean-Christophe PLAGNIOL-VILLARD 	.config_aneg	= ksz8873mll_config_aneg,
59293272e07SJean-Christophe PLAGNIOL-VILLARD 	.read_status	= ksz8873mll_read_status,
5931a5465f5SPatrice Vilchez 	.suspend	= genphy_suspend,
5941a5465f5SPatrice Vilchez 	.resume		= genphy_resume,
59593272e07SJean-Christophe PLAGNIOL-VILLARD 	.driver		= { .owner = THIS_MODULE, },
5967ab59dc1SDavid J. Choi }, {
5977ab59dc1SDavid J. Choi 	.phy_id		= PHY_ID_KSZ886X,
5987ab59dc1SDavid J. Choi 	.phy_id_mask	= 0x00fffff0,
5997ab59dc1SDavid J. Choi 	.name		= "Micrel KSZ886X Switch",
6007ab59dc1SDavid J. Choi 	.features	= (PHY_BASIC_FEATURES | SUPPORTED_Pause),
6017ab59dc1SDavid J. Choi 	.flags		= PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
6027ab59dc1SDavid J. Choi 	.config_init	= kszphy_config_init,
6037ab59dc1SDavid J. Choi 	.config_aneg	= genphy_config_aneg,
6047ab59dc1SDavid J. Choi 	.read_status	= genphy_read_status,
6051a5465f5SPatrice Vilchez 	.suspend	= genphy_suspend,
6061a5465f5SPatrice Vilchez 	.resume		= genphy_resume,
6077ab59dc1SDavid J. Choi 	.driver		= { .owner = THIS_MODULE, },
608d5bf9071SChristian Hohnstaedt } };
609d0507009SDavid J. Choi 
610d0507009SDavid J. Choi static int __init ksphy_init(void)
611d0507009SDavid J. Choi {
612d5bf9071SChristian Hohnstaedt 	return phy_drivers_register(ksphy_driver,
613d5bf9071SChristian Hohnstaedt 		ARRAY_SIZE(ksphy_driver));
614d0507009SDavid J. Choi }
615d0507009SDavid J. Choi 
616d0507009SDavid J. Choi static void __exit ksphy_exit(void)
617d0507009SDavid J. Choi {
618d5bf9071SChristian Hohnstaedt 	phy_drivers_unregister(ksphy_driver,
619d5bf9071SChristian Hohnstaedt 		ARRAY_SIZE(ksphy_driver));
620d0507009SDavid J. Choi }
621d0507009SDavid J. Choi 
622d0507009SDavid J. Choi module_init(ksphy_init);
623d0507009SDavid J. Choi module_exit(ksphy_exit);
624d0507009SDavid J. Choi 
625d0507009SDavid J. Choi MODULE_DESCRIPTION("Micrel PHY driver");
626d0507009SDavid J. Choi MODULE_AUTHOR("David J. Choi");
627d0507009SDavid J. Choi MODULE_LICENSE("GPL");
62852a60ed2SDavid S. Miller 
629cf93c945SUwe Kleine-König static struct mdio_device_id __maybe_unused micrel_tbl[] = {
63048d7d0adSJason Wang 	{ PHY_ID_KSZ9021, 0x000ffffe },
6317ab59dc1SDavid J. Choi 	{ PHY_ID_KSZ9031, 0x00fffff0 },
632510d573fSMarek Vasut 	{ PHY_ID_KSZ8001, 0x00ffffff },
63351f932c4SChoi, David 	{ PHY_ID_KS8737, 0x00fffff0 },
634212ea99aSMarek Vasut 	{ PHY_ID_KSZ8021, 0x00ffffff },
635b818d1a7SHector Palacios 	{ PHY_ID_KSZ8031, 0x00ffffff },
636510d573fSMarek Vasut 	{ PHY_ID_KSZ8041, 0x00fffff0 },
637510d573fSMarek Vasut 	{ PHY_ID_KSZ8051, 0x00fffff0 },
6387ab59dc1SDavid J. Choi 	{ PHY_ID_KSZ8061, 0x00fffff0 },
6397ab59dc1SDavid J. Choi 	{ PHY_ID_KSZ8081, 0x00fffff0 },
64093272e07SJean-Christophe PLAGNIOL-VILLARD 	{ PHY_ID_KSZ8873MLL, 0x00fffff0 },
6417ab59dc1SDavid J. Choi 	{ PHY_ID_KSZ886X, 0x00fffff0 },
64252a60ed2SDavid S. Miller 	{ }
64352a60ed2SDavid S. Miller };
64452a60ed2SDavid S. Miller 
64552a60ed2SDavid S. Miller MODULE_DEVICE_TABLE(mdio, micrel_tbl);
646