Lines Matching refs:cphy
30 #include "cphy.h"
43 static void mdio_set_bit(struct cphy *cphy, int reg, u32 bitval)
47 (void) simple_mdio_read(cphy, reg, &val);
48 (void) simple_mdio_write(cphy, reg, val | bitval);
54 static void mdio_clear_bit(struct cphy *cphy, int reg, u32 bitval)
58 (void) simple_mdio_read(cphy, reg, &val);
59 (void) simple_mdio_write(cphy, reg, val & ~bitval);
68 * PARAMS: cphy - Pointer to PHY instance data.
74 static int mv88e1xxx_reset(struct cphy *cphy, int wait)
79 mdio_set_bit(cphy, MII_BMCR, BMCR_RESET);
82 (void) simple_mdio_read(cphy, MII_BMCR, &ctl);
91 static int mv88e1xxx_interrupt_enable(struct cphy *cphy)
94 (void) simple_mdio_write(cphy, MV88E1XXX_INTERRUPT_ENABLE_REGISTER,
98 if (t1_is_asic(cphy->adapter)) {
101 (void) t1_tpi_read(cphy->adapter, A_ELMER0_INT_ENABLE, &elmer);
103 if (is_T2(cphy->adapter)) {
106 (void) t1_tpi_write(cphy->adapter, A_ELMER0_INT_ENABLE, elmer);
111 static int mv88e1xxx_interrupt_disable(struct cphy *cphy)
114 (void) simple_mdio_write(cphy, MV88E1XXX_INTERRUPT_ENABLE_REGISTER, 0);
117 if (t1_is_asic(cphy->adapter)) {
120 (void) t1_tpi_read(cphy->adapter, A_ELMER0_INT_ENABLE, &elmer);
122 if (is_T2(cphy->adapter)) {
125 (void) t1_tpi_write(cphy->adapter, A_ELMER0_INT_ENABLE, elmer);
130 static int mv88e1xxx_interrupt_clear(struct cphy *cphy)
135 (void) simple_mdio_read(cphy, MV88E1XXX_INTERRUPT_STATUS_REGISTER, &elmer);
138 if (t1_is_asic(cphy->adapter)) {
139 (void) t1_tpi_read(cphy->adapter, A_ELMER0_INT_CAUSE, &elmer);
141 if (is_T2(cphy->adapter)) {
144 (void) t1_tpi_write(cphy->adapter, A_ELMER0_INT_CAUSE, elmer);
153 static int mv88e1xxx_set_speed_duplex(struct cphy *phy, int speed, int duplex)
176 static int mv88e1xxx_crossover_set(struct cphy *cphy, int crossover)
180 (void) simple_mdio_read(cphy, MV88E1XXX_SPECIFIC_CNTRL_REGISTER, &data32);
183 (void) simple_mdio_write(cphy, MV88E1XXX_SPECIFIC_CNTRL_REGISTER, data32);
187 static int mv88e1xxx_autoneg_enable(struct cphy *cphy)
191 (void) mv88e1xxx_crossover_set(cphy, CROSSOVER_AUTO);
193 (void) simple_mdio_read(cphy, MII_BMCR, &ctl);
196 (void) simple_mdio_write(cphy, MII_BMCR, ctl);
200 static int mv88e1xxx_autoneg_disable(struct cphy *cphy)
208 (void) mv88e1xxx_crossover_set(cphy, CROSSOVER_MDI);
214 (void) simple_mdio_read(cphy, MII_BMCR, &ctl);
216 (void) simple_mdio_write(cphy, MII_BMCR, ctl | BMCR_ANRESTART);
220 static int mv88e1xxx_autoneg_restart(struct cphy *cphy)
222 mdio_set_bit(cphy, MII_BMCR, BMCR_ANRESTART);
226 static int mv88e1xxx_advertise(struct cphy *phy, unsigned int advertise_map)
258 static int mv88e1xxx_set_loopback(struct cphy *cphy, int on)
261 mdio_set_bit(cphy, MII_BMCR, BMCR_LOOPBACK);
263 mdio_clear_bit(cphy, MII_BMCR, BMCR_LOOPBACK);
267 static int mv88e1xxx_get_link_status(struct cphy *cphy, int *link_ok,
273 (void) simple_mdio_read(cphy, MV88E1XXX_SPECIFIC_STATUS_REGISTER, &status);
299 static int mv88e1xxx_downshift_set(struct cphy *cphy, int downshift_enable)
303 (void) simple_mdio_read(cphy, MV88E1XXX_EXT_PHY_SPECIFIC_CNTRL_REGISTER, &val);
313 (void) simple_mdio_write(cphy, MV88E1XXX_EXT_PHY_SPECIFIC_CNTRL_REGISTER, val);
317 static int mv88e1xxx_interrupt_handler(struct cphy *cphy)
329 (void) simple_mdio_read(cphy, MV88E1XXX_INTERRUPT_STATUS_REGISTER,
335 (void) simple_mdio_read(cphy,
339 cphy->state |= PHY_LINK_UP;
341 cphy->state &= ~PHY_LINK_UP;
342 if (cphy->state & PHY_AUTONEG_EN)
343 cphy->state &= ~PHY_AUTONEG_RDY;
349 cphy->state |= PHY_AUTONEG_RDY;
351 if ((cphy->state & (PHY_LINK_UP | PHY_AUTONEG_RDY)) ==
358 static void mv88e1xxx_destroy(struct cphy *cphy)
360 t1_os_free((void *)cphy, sizeof(*cphy));
397 static struct cphy *mv88e1xxx_phy_create(adapter_t *adapter, int phy_addr,
400 struct cphy *cphy = t1_os_malloc_wait_zero(sizeof(*cphy));
402 if (!cphy) return NULL;
404 cphy_init(cphy, adapter, phy_addr, &mv88e1xxx_ops, mdio_ops);
412 (void) simple_mdio_write(cphy, MV88E1XXX_EXTENDED_ADDR_REGISTER, 0xB);
413 (void) simple_mdio_write(cphy, MV88E1XXX_EXTENDED_REGISTER, 0x8004);
415 (void) mv88e1xxx_downshift_set(cphy, 1); /* Enable downshift */
419 (void) simple_mdio_write(cphy,
423 return cphy;