Lines Matching refs:cphy
28 #include "cphy.h"
38 static int led_init(struct cphy *cphy)
44 (void) mdio_write(cphy, 0x3, 0x8304, 0xdddd);
48 static int led_link(struct cphy *cphy, u32 do_enable)
53 (void) mdio_read(cphy, 0x1, 0x7, &led);
57 (void) mdio_write(cphy, 0x1, 0x7, led);
60 (void) mdio_write(cphy, 0x1, 0x7, led);
67 static int mv88x201x_reset(struct cphy *cphy, int wait)
75 static int mv88x201x_interrupt_enable(struct cphy *cphy)
78 (void) mdio_write(cphy, 0x1, 0x9002, 0x1);
81 if (t1_is_asic(cphy->adapter)) {
84 (void) t1_tpi_read(cphy->adapter, A_ELMER0_INT_ENABLE, &elmer);
86 (void) t1_tpi_write(cphy->adapter, A_ELMER0_INT_ENABLE, elmer);
91 static int mv88x201x_interrupt_disable(struct cphy *cphy)
94 (void) mdio_write(cphy, 0x1, 0x9002, 0x0);
97 if (t1_is_asic(cphy->adapter)) {
100 (void) t1_tpi_read(cphy->adapter, A_ELMER0_INT_ENABLE, &elmer);
102 (void) t1_tpi_write(cphy->adapter, A_ELMER0_INT_ENABLE, elmer);
107 static int mv88x201x_interrupt_clear(struct cphy *cphy)
114 (void) mdio_read(cphy, 0x1, 0x9003, &val);
115 (void) mdio_read(cphy, 0x1, 0x9004, &val);
116 (void) mdio_read(cphy, 0x1, 0x9005, &val);
121 (void) mdio_read(cphy, 0x1, 0x1, &val);
125 (void) mdio_read(cphy, 0x1, 0x1, &val);
127 (void) mdio_read(cphy, 0x1, 0x9005, &val);
131 (void) mdio_read(cphy, 0x1, 0x9003, &val);
132 (void) mdio_read(cphy, 0x1, 0x9004, &val);
136 if (t1_is_asic(cphy->adapter)) {
137 (void) t1_tpi_read(cphy->adapter, A_ELMER0_INT_CAUSE, &elmer);
139 (void) t1_tpi_write(cphy->adapter, A_ELMER0_INT_CAUSE, elmer);
144 static int mv88x201x_interrupt_handler(struct cphy *cphy)
147 (void) mv88x201x_interrupt_clear(cphy);
156 static int mv88x201x_set_loopback(struct cphy *cphy, int on)
161 static int mv88x201x_get_link_status(struct cphy *cphy, int *link_ok,
169 (void) mdio_read(cphy, 0x1, 0x1, &val);
173 (void) led_link(cphy, *link_ok);
184 static void mv88x201x_destroy(struct cphy *cphy)
186 t1_os_free((void *) cphy, sizeof(*cphy));
218 static struct cphy *mv88x201x_phy_create(adapter_t *adapter, int phy_addr,
222 struct cphy *cphy = t1_os_malloc_wait_zero(sizeof(*cphy));
224 if (!cphy)
227 cphy_init(cphy, adapter, phy_addr, &mv88x201x_ops, mdio_ops);
230 (void) mdio_read(cphy, 0x3, 0x8300, &val);
231 (void) mdio_write(cphy, 0x3, 0x8300, val | 1);
234 (void) mdio_read(cphy, 0x1, 0x8, &val);
235 (void) mdio_read(cphy, 0x3, 0x8, &val);
238 (void) led_init(cphy);
239 return cphy;