Lines Matching full:cphy

30 #include "cphy.h"
40 static int led_init(struct cphy *cphy) in led_init() argument
46 cphy_mdio_write(cphy, MDIO_MMD_PCS, 0x8304, 0xdddd); in led_init()
50 static int led_link(struct cphy *cphy, u32 do_enable) in led_link() argument
55 cphy_mdio_read(cphy, MDIO_MMD_PMAPMD, MDIO_CTRL2, &led); in led_link()
59 cphy_mdio_write(cphy, MDIO_MMD_PMAPMD, MDIO_CTRL2, led); in led_link()
62 cphy_mdio_write(cphy, MDIO_MMD_PMAPMD, MDIO_CTRL2, led); in led_link()
68 static int mv88x201x_reset(struct cphy *cphy, int wait) in mv88x201x_reset() argument
76 static int mv88x201x_interrupt_enable(struct cphy *cphy) in mv88x201x_interrupt_enable() argument
79 cphy_mdio_write(cphy, MDIO_MMD_PMAPMD, MDIO_PMA_LASI_CTRL, in mv88x201x_interrupt_enable()
83 if (t1_is_asic(cphy->adapter)) { in mv88x201x_interrupt_enable()
86 t1_tpi_read(cphy->adapter, A_ELMER0_INT_ENABLE, &elmer); in mv88x201x_interrupt_enable()
88 t1_tpi_write(cphy->adapter, A_ELMER0_INT_ENABLE, elmer); in mv88x201x_interrupt_enable()
93 static int mv88x201x_interrupt_disable(struct cphy *cphy) in mv88x201x_interrupt_disable() argument
96 cphy_mdio_write(cphy, MDIO_MMD_PMAPMD, MDIO_PMA_LASI_CTRL, 0x0); in mv88x201x_interrupt_disable()
99 if (t1_is_asic(cphy->adapter)) { in mv88x201x_interrupt_disable()
102 t1_tpi_read(cphy->adapter, A_ELMER0_INT_ENABLE, &elmer); in mv88x201x_interrupt_disable()
104 t1_tpi_write(cphy->adapter, A_ELMER0_INT_ENABLE, elmer); in mv88x201x_interrupt_disable()
109 static int mv88x201x_interrupt_clear(struct cphy *cphy) in mv88x201x_interrupt_clear() argument
116 cphy_mdio_read(cphy, MDIO_MMD_PMAPMD, MDIO_PMA_LASI_RXSTAT, &val); in mv88x201x_interrupt_clear()
117 cphy_mdio_read(cphy, MDIO_MMD_PMAPMD, MDIO_PMA_LASI_TXSTAT, &val); in mv88x201x_interrupt_clear()
118 cphy_mdio_read(cphy, MDIO_MMD_PMAPMD, MDIO_PMA_LASI_STAT, &val); in mv88x201x_interrupt_clear()
123 cphy_mdio_read(cphy, MDIO_MMD_PMAPMD, MDIO_STAT1, &val); in mv88x201x_interrupt_clear()
127 cphy_mdio_read(cphy, MDIO_MMD_PMAPMD, MDIO_STAT1, &val); in mv88x201x_interrupt_clear()
129 cphy_mdio_read(cphy, MDIO_MMD_PMAPMD, MDIO_PMA_LASI_STAT, &val); in mv88x201x_interrupt_clear()
133 cphy_mdio_read(cphy, MDIO_MMD_PMAPMD, MDIO_PMA_LASI_RXSTAT, &val); in mv88x201x_interrupt_clear()
134 cphy_mdio_read(cphy, MDIO_MMD_PMAPMD, MDIO_PMA_LASI_TXSTAT, &val); in mv88x201x_interrupt_clear()
138 if (t1_is_asic(cphy->adapter)) { in mv88x201x_interrupt_clear()
139 t1_tpi_read(cphy->adapter, A_ELMER0_INT_CAUSE, &elmer); in mv88x201x_interrupt_clear()
141 t1_tpi_write(cphy->adapter, A_ELMER0_INT_CAUSE, elmer); in mv88x201x_interrupt_clear()
146 static int mv88x201x_interrupt_handler(struct cphy *cphy) in mv88x201x_interrupt_handler() argument
149 mv88x201x_interrupt_clear(cphy); in mv88x201x_interrupt_handler()
157 static int mv88x201x_set_loopback(struct cphy *cphy, int on) in mv88x201x_set_loopback() argument
162 static int mv88x201x_get_link_status(struct cphy *cphy, int *link_ok, in mv88x201x_get_link_status() argument
169 cphy_mdio_read(cphy, MDIO_MMD_PMAPMD, MDIO_STAT1, &val); in mv88x201x_get_link_status()
173 led_link(cphy, *link_ok); in mv88x201x_get_link_status()
184 static void mv88x201x_destroy(struct cphy *cphy) in mv88x201x_destroy() argument
186 kfree(cphy); in mv88x201x_destroy()
202 static struct cphy *mv88x201x_phy_create(struct net_device *dev, int phy_addr, in mv88x201x_phy_create()
206 struct cphy *cphy = kzalloc(sizeof(*cphy), GFP_KERNEL); in mv88x201x_phy_create() local
208 if (!cphy) in mv88x201x_phy_create()
211 cphy_init(cphy, dev, phy_addr, &mv88x201x_ops, mdio_ops); in mv88x201x_phy_create()
214 cphy_mdio_read(cphy, MDIO_MMD_PCS, 0x8300, &val); in mv88x201x_phy_create()
215 cphy_mdio_write(cphy, MDIO_MMD_PCS, 0x8300, val | 1); in mv88x201x_phy_create()
218 cphy_mdio_read(cphy, MDIO_MMD_PMAPMD, MDIO_STAT2, &val); in mv88x201x_phy_create()
219 cphy_mdio_read(cphy, MDIO_MMD_PCS, MDIO_STAT2, &val); in mv88x201x_phy_create()
222 led_init(cphy); in mv88x201x_phy_create()
223 return cphy; in mv88x201x_phy_create()