Lines Matching refs:dev
26 * $FreeBSD: releng/11.0/sys/dev/etherswitch/arswitch/arswitch_reg.c 292738 2015-12-26 02:31:39Z adrian $
47 #include <dev/iicbus/iic.h>
48 #include <dev/iicbus/iiconf.h>
49 #include <dev/iicbus/iicbus.h>
50 #include <dev/mii/mii.h>
51 #include <dev/mii/miivar.h>
52 #include <dev/mdio/mdio.h>
54 #include <dev/etherswitch/etherswitch.h>
56 #include <dev/etherswitch/arswitch/arswitchreg.h>
57 #include <dev/etherswitch/arswitch/arswitchvar.h>
58 #include <dev/etherswitch/arswitch/arswitch_reg.h>
65 arswitch_split_setpage(device_t dev, uint32_t addr, uint16_t *phy,
68 struct arswitch_softc *sc = device_get_softc(dev);
76 MDIO_WRITEREG(device_get_parent(dev), 0x18, 0, page);
88 arswitch_readreg16(device_t dev, int addr)
92 arswitch_split_setpage(dev, addr, &phy, ®);
93 return (MDIO_READREG(device_get_parent(dev), 0x10 | phy, reg));
100 arswitch_writereg16(device_t dev, int addr, int data)
104 arswitch_split_setpage(dev, addr, &phy, ®);
105 return (MDIO_WRITEREG(device_get_parent(dev), 0x10 | phy, reg, data));
118 arswitch_writedbg(device_t dev, int phy, uint16_t dbg_addr,
121 (void) MDIO_WRITEREG(device_get_parent(dev), phy,
123 (void) MDIO_WRITEREG(device_get_parent(dev), phy,
128 arswitch_writemmd(device_t dev, int phy, uint16_t dbg_addr,
131 (void) MDIO_WRITEREG(device_get_parent(dev), phy,
133 (void) MDIO_WRITEREG(device_get_parent(dev), phy,
138 arswitch_reg_read32(device_t dev, int phy, int reg)
141 lo = MDIO_READREG(device_get_parent(dev), phy, reg);
142 hi = MDIO_READREG(device_get_parent(dev), phy, reg + 1);
148 arswitch_reg_write32(device_t dev, int phy, int reg, uint32_t value)
154 sc = device_get_softc(dev);
159 r = MDIO_WRITEREG(device_get_parent(dev),
161 r |= MDIO_WRITEREG(device_get_parent(dev),
164 r = MDIO_WRITEREG(device_get_parent(dev),
166 r |= MDIO_WRITEREG(device_get_parent(dev),
174 arswitch_readreg(device_t dev, int addr)
178 arswitch_split_setpage(dev, addr, &phy, ®);
179 return arswitch_reg_read32(dev, 0x10 | phy, reg);
183 arswitch_writereg(device_t dev, int addr, int value)
188 sc = device_get_softc(dev);
190 arswitch_split_setpage(dev, addr, &phy, ®);
191 return (arswitch_reg_write32(dev, 0x10 | phy, reg, value));
202 arswitch_readreg_lsb(device_t dev, int addr)
205 return (arswitch_readreg16(dev, addr));
209 arswitch_readreg_msb(device_t dev, int addr)
212 return (arswitch_readreg16(dev, addr + 2) << 16);
216 arswitch_writereg_lsb(device_t dev, int addr, int data)
219 return (arswitch_writereg16(dev, addr, data & 0xffff));
223 arswitch_writereg_msb(device_t dev, int addr, int data)
226 return (arswitch_writereg16(dev, addr + 2, (data >> 16) & 0xffff));
230 arswitch_modifyreg(device_t dev, int addr, int mask, int set)
235 arswitch_split_setpage(dev, addr, &phy, ®);
237 value = arswitch_reg_read32(dev, 0x10 | phy, reg);
240 return (arswitch_reg_write32(dev, 0x10 | phy, reg, value));
244 arswitch_waitreg(device_t dev, int addr, int mask, int val, int timeout)
249 arswitch_split_setpage(dev, addr, &phy, ®);
253 v = arswitch_reg_read32(dev, 0x10 | phy, reg);