Lines Matching +full:bus +full:- +full:err
1 // SPDX-License-Identifier: GPL-2.0-or-later
16 int mv88e6165_phy_read(struct mv88e6xxx_chip *chip, struct mii_bus *bus, in mv88e6165_phy_read() argument
22 int mv88e6165_phy_write(struct mv88e6xxx_chip *chip, struct mii_bus *bus, in mv88e6165_phy_write() argument
31 struct mii_bus *bus; in mv88e6xxx_phy_read() local
33 bus = mv88e6xxx_default_mdio_bus(chip); in mv88e6xxx_phy_read()
34 if (!bus) in mv88e6xxx_phy_read()
35 return -EOPNOTSUPP; in mv88e6xxx_phy_read()
37 if (!chip->info->ops->phy_read) in mv88e6xxx_phy_read()
38 return -EOPNOTSUPP; in mv88e6xxx_phy_read()
40 return chip->info->ops->phy_read(chip, bus, addr, reg, val); in mv88e6xxx_phy_read()
46 struct mii_bus *bus; in mv88e6xxx_phy_write() local
48 bus = mv88e6xxx_default_mdio_bus(chip); in mv88e6xxx_phy_write()
49 if (!bus) in mv88e6xxx_phy_write()
50 return -EOPNOTSUPP; in mv88e6xxx_phy_write()
52 if (!chip->info->ops->phy_write) in mv88e6xxx_phy_write()
53 return -EOPNOTSUPP; in mv88e6xxx_phy_write()
55 return chip->info->ops->phy_write(chip, bus, addr, reg, val); in mv88e6xxx_phy_write()
62 struct mii_bus *bus; in mv88e6xxx_phy_read_c45() local
64 bus = mv88e6xxx_default_mdio_bus(chip); in mv88e6xxx_phy_read_c45()
65 if (!bus) in mv88e6xxx_phy_read_c45()
66 return -EOPNOTSUPP; in mv88e6xxx_phy_read_c45()
68 if (!chip->info->ops->phy_read_c45) in mv88e6xxx_phy_read_c45()
69 return -EOPNOTSUPP; in mv88e6xxx_phy_read_c45()
71 return chip->info->ops->phy_read_c45(chip, bus, addr, devad, reg, val); in mv88e6xxx_phy_read_c45()
78 struct mii_bus *bus; in mv88e6xxx_phy_write_c45() local
80 bus = mv88e6xxx_default_mdio_bus(chip); in mv88e6xxx_phy_write_c45()
81 if (!bus) in mv88e6xxx_phy_write_c45()
82 return -EOPNOTSUPP; in mv88e6xxx_phy_write_c45()
84 if (!chip->info->ops->phy_write_c45) in mv88e6xxx_phy_write_c45()
85 return -EOPNOTSUPP; in mv88e6xxx_phy_write_c45()
87 return chip->info->ops->phy_write_c45(chip, bus, addr, devad, reg, val); in mv88e6xxx_phy_write_c45()
97 int err; in mv88e6xxx_phy_page_put() local
100 * MDIO bus in mv88e6xxx_phy_page_put()
102 err = mv88e6xxx_phy_write(chip, phy, MV88E6XXX_PHY_PAGE, in mv88e6xxx_phy_page_put()
104 if (unlikely(err)) { in mv88e6xxx_phy_page_put()
105 dev_err(chip->dev, in mv88e6xxx_phy_page_put()
107 phy, err); in mv88e6xxx_phy_page_put()
114 int err; in mv88e6xxx_phy_page_read() local
118 return -EINVAL; in mv88e6xxx_phy_page_read()
120 err = mv88e6xxx_phy_page_get(chip, phy, page); in mv88e6xxx_phy_page_read()
121 if (!err) { in mv88e6xxx_phy_page_read()
122 err = mv88e6xxx_phy_read(chip, phy, reg, val); in mv88e6xxx_phy_page_read()
126 return err; in mv88e6xxx_phy_page_read()
132 int err; in mv88e6xxx_phy_page_write() local
136 return -EINVAL; in mv88e6xxx_phy_page_write()
138 err = mv88e6xxx_phy_page_get(chip, phy, page); in mv88e6xxx_phy_page_write()
139 if (!err) { in mv88e6xxx_phy_page_write()
140 err = mv88e6xxx_phy_write(chip, phy, MV88E6XXX_PHY_PAGE, page); in mv88e6xxx_phy_page_write()
141 if (!err) in mv88e6xxx_phy_page_write()
142 err = mv88e6xxx_phy_write(chip, phy, reg, val); in mv88e6xxx_phy_page_write()
147 return err; in mv88e6xxx_phy_page_write()
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()
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()
174 if (mutex_trylock(&chip->ppu_mutex)) { 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()
187 schedule_work(&chip->ppu_work); in mv88e6xxx_phy_ppu_reenable_timer()
194 mutex_lock(&chip->ppu_mutex); in mv88e6xxx_phy_ppu_access_get()
198 * disabled, cancel the timer that is going to re-enable in mv88e6xxx_phy_ppu_access_get()
201 if (!chip->ppu_disabled) { 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 timer_delete(&chip->ppu_timer); in mv88e6xxx_phy_ppu_access_get()
218 /* Schedule a timer to re-enable the PHY polling unit. */ in mv88e6xxx_phy_ppu_access_put()
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()
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()
232 mutex_lock(&chip->ppu_mutex); in mv88e6xxx_phy_ppu_state_destroy()
233 timer_delete_sync(&chip->ppu_timer); in mv88e6xxx_phy_ppu_state_destroy()
234 cancel_work_sync(&chip->ppu_work); in mv88e6xxx_phy_ppu_state_destroy()
235 mutex_unlock(&chip->ppu_mutex); in mv88e6xxx_phy_ppu_state_destroy()
238 int mv88e6185_phy_ppu_read(struct mv88e6xxx_chip *chip, struct mii_bus *bus, in mv88e6185_phy_ppu_read() argument
241 int err; in mv88e6185_phy_ppu_read() local
243 err = mv88e6xxx_phy_ppu_access_get(chip); in mv88e6185_phy_ppu_read()
244 if (!err) { in mv88e6185_phy_ppu_read()
245 err = mv88e6xxx_read(chip, addr, reg, val); in mv88e6185_phy_ppu_read()
249 return err; in mv88e6185_phy_ppu_read()
252 int mv88e6185_phy_ppu_write(struct mv88e6xxx_chip *chip, struct mii_bus *bus, in mv88e6185_phy_ppu_write() argument
255 int err; in mv88e6185_phy_ppu_write() local
257 err = mv88e6xxx_phy_ppu_access_get(chip); in mv88e6185_phy_ppu_write()
258 if (!err) { in mv88e6185_phy_ppu_write()
259 err = mv88e6xxx_write(chip, addr, reg, val); in mv88e6185_phy_ppu_write()
263 return err; in mv88e6185_phy_ppu_write()
268 if (chip->info->ops->ppu_enable && chip->info->ops->ppu_disable) in mv88e6xxx_phy_init()
274 if (chip->info->ops->ppu_enable && chip->info->ops->ppu_disable) in mv88e6xxx_phy_destroy()