Lines Matching refs:chip

16 int mv88e6165_phy_read(struct mv88e6xxx_chip *chip, struct mii_bus *bus,  in mv88e6165_phy_read()  argument
19 return mv88e6xxx_read(chip, addr, reg, val); in mv88e6165_phy_read()
22 int mv88e6165_phy_write(struct mv88e6xxx_chip *chip, struct mii_bus *bus, in mv88e6165_phy_write() argument
25 return mv88e6xxx_write(chip, addr, reg, val); in mv88e6165_phy_write()
28 int mv88e6xxx_phy_read(struct mv88e6xxx_chip *chip, int phy, int reg, u16 *val) in mv88e6xxx_phy_read() argument
33 bus = mv88e6xxx_default_mdio_bus(chip); in mv88e6xxx_phy_read()
37 if (!chip->info->ops->phy_read) in mv88e6xxx_phy_read()
40 return chip->info->ops->phy_read(chip, bus, addr, reg, val); in mv88e6xxx_phy_read()
43 int mv88e6xxx_phy_write(struct mv88e6xxx_chip *chip, int phy, int reg, u16 val) in mv88e6xxx_phy_write() argument
48 bus = mv88e6xxx_default_mdio_bus(chip); in mv88e6xxx_phy_write()
52 if (!chip->info->ops->phy_write) in mv88e6xxx_phy_write()
55 return chip->info->ops->phy_write(chip, bus, addr, reg, val); in mv88e6xxx_phy_write()
58 int mv88e6xxx_phy_read_c45(struct mv88e6xxx_chip *chip, int phy, int devad, in mv88e6xxx_phy_read_c45() argument
64 bus = mv88e6xxx_default_mdio_bus(chip); in mv88e6xxx_phy_read_c45()
68 if (!chip->info->ops->phy_read_c45) in mv88e6xxx_phy_read_c45()
71 return chip->info->ops->phy_read_c45(chip, bus, addr, devad, reg, val); in mv88e6xxx_phy_read_c45()
74 int mv88e6xxx_phy_write_c45(struct mv88e6xxx_chip *chip, int phy, int devad, in mv88e6xxx_phy_write_c45() argument
80 bus = mv88e6xxx_default_mdio_bus(chip); in mv88e6xxx_phy_write_c45()
84 if (!chip->info->ops->phy_write_c45) in mv88e6xxx_phy_write_c45()
87 return chip->info->ops->phy_write_c45(chip, bus, addr, devad, reg, val); in mv88e6xxx_phy_write_c45()
90 static int mv88e6xxx_phy_page_get(struct mv88e6xxx_chip *chip, int phy, u8 page) in mv88e6xxx_phy_page_get() argument
92 return mv88e6xxx_phy_write(chip, phy, MV88E6XXX_PHY_PAGE, page); in mv88e6xxx_phy_page_get()
95 static void mv88e6xxx_phy_page_put(struct mv88e6xxx_chip *chip, int phy) in mv88e6xxx_phy_page_put() argument
102 err = mv88e6xxx_phy_write(chip, phy, MV88E6XXX_PHY_PAGE, in mv88e6xxx_phy_page_put()
105 dev_err(chip->dev, in mv88e6xxx_phy_page_put()
111 int mv88e6xxx_phy_page_read(struct mv88e6xxx_chip *chip, int phy, in mv88e6xxx_phy_page_read() argument
120 err = mv88e6xxx_phy_page_get(chip, phy, page); in mv88e6xxx_phy_page_read()
122 err = mv88e6xxx_phy_read(chip, phy, reg, val); in mv88e6xxx_phy_page_read()
123 mv88e6xxx_phy_page_put(chip, phy); in mv88e6xxx_phy_page_read()
129 int mv88e6xxx_phy_page_write(struct mv88e6xxx_chip *chip, int phy, in mv88e6xxx_phy_page_write() argument
138 err = mv88e6xxx_phy_page_get(chip, phy, page); in mv88e6xxx_phy_page_write()
140 err = mv88e6xxx_phy_write(chip, phy, MV88E6XXX_PHY_PAGE, page); in mv88e6xxx_phy_page_write()
142 err = mv88e6xxx_phy_write(chip, phy, reg, val); in mv88e6xxx_phy_page_write()
144 mv88e6xxx_phy_page_put(chip, phy); in mv88e6xxx_phy_page_write()
150 static int mv88e6xxx_phy_ppu_disable(struct mv88e6xxx_chip *chip) in mv88e6xxx_phy_ppu_disable() argument
152 if (!chip->info->ops->ppu_disable) in mv88e6xxx_phy_ppu_disable()
155 return chip->info->ops->ppu_disable(chip); in mv88e6xxx_phy_ppu_disable()
158 static int mv88e6xxx_phy_ppu_enable(struct mv88e6xxx_chip *chip) in mv88e6xxx_phy_ppu_enable() argument
160 if (!chip->info->ops->ppu_enable) in mv88e6xxx_phy_ppu_enable()
163 return chip->info->ops->ppu_enable(chip); in mv88e6xxx_phy_ppu_enable()
168 struct mv88e6xxx_chip *chip; in mv88e6xxx_phy_ppu_reenable_work() local
170 chip = container_of(ugly, struct mv88e6xxx_chip, ppu_work); in mv88e6xxx_phy_ppu_reenable_work()
172 mv88e6xxx_reg_lock(chip); in mv88e6xxx_phy_ppu_reenable_work()
174 if (mutex_trylock(&chip->ppu_mutex)) { in mv88e6xxx_phy_ppu_reenable_work()
175 if (mv88e6xxx_phy_ppu_enable(chip) == 0) in mv88e6xxx_phy_ppu_reenable_work()
176 chip->ppu_disabled = 0; in mv88e6xxx_phy_ppu_reenable_work()
177 mutex_unlock(&chip->ppu_mutex); in mv88e6xxx_phy_ppu_reenable_work()
180 mv88e6xxx_reg_unlock(chip); in mv88e6xxx_phy_ppu_reenable_work()
185 struct mv88e6xxx_chip *chip = from_timer(chip, t, ppu_timer); in mv88e6xxx_phy_ppu_reenable_timer() local
187 schedule_work(&chip->ppu_work); in mv88e6xxx_phy_ppu_reenable_timer()
190 static int mv88e6xxx_phy_ppu_access_get(struct mv88e6xxx_chip *chip) in mv88e6xxx_phy_ppu_access_get() argument
194 mutex_lock(&chip->ppu_mutex); in mv88e6xxx_phy_ppu_access_get()
201 if (!chip->ppu_disabled) { in mv88e6xxx_phy_ppu_access_get()
202 ret = mv88e6xxx_phy_ppu_disable(chip); in mv88e6xxx_phy_ppu_access_get()
204 mutex_unlock(&chip->ppu_mutex); in mv88e6xxx_phy_ppu_access_get()
207 chip->ppu_disabled = 1; in mv88e6xxx_phy_ppu_access_get()
209 del_timer(&chip->ppu_timer); in mv88e6xxx_phy_ppu_access_get()
216 static void mv88e6xxx_phy_ppu_access_put(struct mv88e6xxx_chip *chip) in mv88e6xxx_phy_ppu_access_put() argument
219 mod_timer(&chip->ppu_timer, jiffies + msecs_to_jiffies(10)); in mv88e6xxx_phy_ppu_access_put()
220 mutex_unlock(&chip->ppu_mutex); in mv88e6xxx_phy_ppu_access_put()
223 static void mv88e6xxx_phy_ppu_state_init(struct mv88e6xxx_chip *chip) in mv88e6xxx_phy_ppu_state_init() argument
225 mutex_init(&chip->ppu_mutex); in mv88e6xxx_phy_ppu_state_init()
226 INIT_WORK(&chip->ppu_work, mv88e6xxx_phy_ppu_reenable_work); in mv88e6xxx_phy_ppu_state_init()
227 timer_setup(&chip->ppu_timer, mv88e6xxx_phy_ppu_reenable_timer, 0); in mv88e6xxx_phy_ppu_state_init()
230 static void mv88e6xxx_phy_ppu_state_destroy(struct mv88e6xxx_chip *chip) in mv88e6xxx_phy_ppu_state_destroy() argument
232 del_timer_sync(&chip->ppu_timer); in mv88e6xxx_phy_ppu_state_destroy()
235 int mv88e6185_phy_ppu_read(struct mv88e6xxx_chip *chip, struct mii_bus *bus, in mv88e6185_phy_ppu_read() argument
240 err = mv88e6xxx_phy_ppu_access_get(chip); in mv88e6185_phy_ppu_read()
242 err = mv88e6xxx_read(chip, addr, reg, val); in mv88e6185_phy_ppu_read()
243 mv88e6xxx_phy_ppu_access_put(chip); in mv88e6185_phy_ppu_read()
249 int mv88e6185_phy_ppu_write(struct mv88e6xxx_chip *chip, struct mii_bus *bus, in mv88e6185_phy_ppu_write() argument
254 err = mv88e6xxx_phy_ppu_access_get(chip); in mv88e6185_phy_ppu_write()
256 err = mv88e6xxx_write(chip, addr, reg, val); in mv88e6185_phy_ppu_write()
257 mv88e6xxx_phy_ppu_access_put(chip); in mv88e6185_phy_ppu_write()
263 void mv88e6xxx_phy_init(struct mv88e6xxx_chip *chip) in mv88e6xxx_phy_init() argument
265 if (chip->info->ops->ppu_enable && chip->info->ops->ppu_disable) in mv88e6xxx_phy_init()
266 mv88e6xxx_phy_ppu_state_init(chip); in mv88e6xxx_phy_init()
269 void mv88e6xxx_phy_destroy(struct mv88e6xxx_chip *chip) in mv88e6xxx_phy_destroy() argument
271 if (chip->info->ops->ppu_enable && chip->info->ops->ppu_disable) in mv88e6xxx_phy_destroy()
272 mv88e6xxx_phy_ppu_state_destroy(chip); in mv88e6xxx_phy_destroy()
275 int mv88e6xxx_phy_setup(struct mv88e6xxx_chip *chip) in mv88e6xxx_phy_setup() argument
277 return mv88e6xxx_phy_ppu_enable(chip); in mv88e6xxx_phy_setup()