Lines Matching +full:device +full:- +full:addr
1 // SPDX-License-Identifier: GPL-2.0+
12 #include <linux/device.h>
40 #include "mdio-boardinfo.h"
45 mdiodev->reset_gpio = gpiod_get_optional(&mdiodev->dev, in mdiobus_register_gpiod()
47 if (IS_ERR(mdiodev->reset_gpio)) in mdiobus_register_gpiod()
48 return PTR_ERR(mdiodev->reset_gpio); in mdiobus_register_gpiod()
50 if (mdiodev->reset_gpio) in mdiobus_register_gpiod()
51 gpiod_set_consumer_name(mdiodev->reset_gpio, "PHY reset"); in mdiobus_register_gpiod()
60 reset = reset_control_get_optional_exclusive(&mdiodev->dev, "phy"); in mdiobus_register_reset()
64 mdiodev->reset_ctrl = reset; in mdiobus_register_reset()
73 if (mdiodev->bus->mdio_map[mdiodev->addr]) in mdiobus_register_device()
74 return -EBUSY; in mdiobus_register_device()
76 if (mdiodev->flags & MDIO_DEVICE_FLAG_PHY) { in mdiobus_register_device()
89 mdiodev->bus->mdio_map[mdiodev->addr] = mdiodev; in mdiobus_register_device()
97 if (mdiodev->bus->mdio_map[mdiodev->addr] != mdiodev) in mdiobus_unregister_device()
98 return -EINVAL; in mdiobus_unregister_device()
100 reset_control_put(mdiodev->reset_ctrl); in mdiobus_unregister_device()
102 mdiodev->bus->mdio_map[mdiodev->addr] = NULL; in mdiobus_unregister_device()
108 static struct mdio_device *mdiobus_find_device(struct mii_bus *bus, int addr) in mdiobus_find_device() argument
110 bool addr_valid = addr >= 0 && addr < ARRAY_SIZE(bus->mdio_map); in mdiobus_find_device()
112 if (WARN_ONCE(!addr_valid, "addr %d out of range\n", addr)) in mdiobus_find_device()
115 return bus->mdio_map[addr]; in mdiobus_find_device()
118 struct phy_device *mdiobus_get_phy(struct mii_bus *bus, int addr) in mdiobus_get_phy() argument
122 mdiodev = mdiobus_find_device(bus, addr); in mdiobus_get_phy()
126 if (!(mdiodev->flags & MDIO_DEVICE_FLAG_PHY)) in mdiobus_get_phy()
133 bool mdiobus_is_registered_device(struct mii_bus *bus, int addr) in mdiobus_is_registered_device() argument
135 return mdiobus_find_device(bus, addr) != NULL; in mdiobus_is_registered_device()
140 * mdiobus_alloc_size - allocate a mii_bus structure
142 * If non-zero, then bus->priv is points to that memory.
164 bus->state = MDIOBUS_ALLOCATED; in mdiobus_alloc_size()
166 bus->priv = (void *)bus + aligned_size; in mdiobus_alloc_size()
168 /* Initialise the interrupts to polling and 64-bit seqcounts */ in mdiobus_alloc_size()
170 bus->irq[i] = PHY_POLL; in mdiobus_alloc_size()
171 u64_stats_init(&bus->stats[i].syncp); in mdiobus_alloc_size()
179 * mdiobus_release - mii_bus device release callback
180 * @d: the target struct device that contains the mii_bus
185 static void mdiobus_release(struct device *d) in mdiobus_release()
189 WARN(bus->state != MDIOBUS_RELEASED && in mdiobus_release()
191 bus->state != MDIOBUS_ALLOCATED, in mdiobus_release()
193 bus->id); in mdiobus_release()
195 if (bus->state == MDIOBUS_RELEASED) in mdiobus_release()
202 int addr; member
213 start = u64_stats_fetch_begin(&s->syncp); in mdio_bus_get_stat()
215 } while (u64_stats_fetch_retry(&s->syncp, start)); in mdio_bus_get_stat()
226 val += mdio_bus_get_stat(&bus->stats[i], offset); in mdio_bus_get_global_stat()
231 static ssize_t mdio_bus_stat_field_show(struct device *dev, in mdio_bus_stat_field_show()
241 sattr = eattr->var; in mdio_bus_stat_field_show()
243 if (sattr->addr < 0) in mdio_bus_stat_field_show()
244 val = mdio_bus_get_global_stat(bus, sattr->field_offset); in mdio_bus_stat_field_show()
246 val = mdio_bus_get_stat(&bus->stats[sattr->addr], in mdio_bus_stat_field_show()
247 sattr->field_offset); in mdio_bus_stat_field_show()
252 static ssize_t mdio_bus_device_stat_field_show(struct device *dev, in mdio_bus_device_stat_field_show()
257 struct mii_bus *bus = mdiodev->bus; in mdio_bus_device_stat_field_show()
260 int addr = mdiodev->addr; in mdio_bus_device_stat_field_show() local
264 sattr = eattr->var; in mdio_bus_device_stat_field_show()
266 val = mdio_bus_get_stat(&bus->stats[addr], sattr->field_offset); in mdio_bus_device_stat_field_show()
277 -1, offsetof(struct mdio_bus_stats, field) \
285 -1, offsetof(struct mdio_bus_stats, field) \
297 #define MDIO_BUS_STATS_ADDR_ATTR_DECL(field, addr, file) \ argument
298 static struct dev_ext_attribute dev_attr_mdio_bus_addr_##field##_##addr = { \
303 addr, offsetof(struct mdio_bus_stats, field) \
307 #define MDIO_BUS_STATS_ADDR_ATTR(field, addr) \ argument
308 MDIO_BUS_STATS_ADDR_ATTR_DECL(field, addr, \
309 __stringify(field) "_" __stringify(addr))
311 #define MDIO_BUS_STATS_ADDR_ATTR_GROUP_DECL(addr) \ argument
312 MDIO_BUS_STATS_ADDR_ATTR(transfers, addr); \
313 MDIO_BUS_STATS_ADDR_ATTR(errors, addr); \
314 MDIO_BUS_STATS_ADDR_ATTR(writes, addr); \
315 MDIO_BUS_STATS_ADDR_ATTR(reads, addr) \
350 #define MDIO_BUS_STATS_ADDR_ATTR_GROUP(addr) \ argument
351 &dev_attr_mdio_bus_addr_transfers_##addr.attr.attr, \
352 &dev_attr_mdio_bus_addr_errors_##addr.attr.attr, \
353 &dev_attr_mdio_bus_addr_writes_##addr.attr.attr, \
354 &dev_attr_mdio_bus_addr_reads_##addr.attr.attr \
413 * mdio_find_bus - Given the name of a mdiobus, find the mii_bus.
417 * embedded struct device will have its reference count incremented,
422 struct device *d; in mdio_find_bus()
431 * of_mdio_find_bus - Given an mii_bus node, find the mii_bus.
435 * embedded struct device will have its reference count incremented,
445 struct device *d; in of_mdio_find_bus()
456 * matches the mdio device's address with its 'reg' property. If
457 * found, set the of_node pointer for the mdio device. This allows
458 * auto-probed phy devices to be supplied with information passed in
462 static int of_mdiobus_find_phy(struct device *dev, struct mdio_device *mdiodev, in of_mdiobus_find_phy()
468 int addr; in of_mdiobus_find_phy() local
470 if (of_node_name_eq(child, "ethernet-phy-package")) { in of_mdiobus_find_phy()
474 return -EINVAL; in of_mdiobus_find_phy()
488 addr = of_mdio_parse_addr(dev, child); in of_mdiobus_find_phy()
489 if (addr < 0) in of_mdiobus_find_phy()
492 if (addr == mdiodev->addr) { in of_mdiobus_find_phy()
495 * device. Do _not_ use of_node_put(child) here. in of_mdiobus_find_phy()
501 return -ENODEV; in of_mdiobus_find_phy()
507 struct device *dev = &mdiodev->dev; in of_mdiobus_link_mdiodev()
509 if (dev->of_node || !bus->dev.of_node) in of_mdiobus_link_mdiodev()
512 of_mdiobus_find_phy(dev, mdiodev, bus->dev.of_node); in of_mdiobus_link_mdiodev()
522 * mdiobus_create_device - create a full MDIO device given
535 mdiodev = mdio_device_create(bus, bi->mdio_addr); in mdiobus_create_device()
537 return -ENODEV; in mdiobus_create_device()
539 strscpy(mdiodev->modalias, bi->modalias, in mdiobus_create_device()
540 sizeof(mdiodev->modalias)); in mdiobus_create_device()
541 mdiodev->bus_match = mdio_device_bus_match; in mdiobus_create_device()
542 mdiodev->dev.platform_data = (void *)bi->platform_data; in mdiobus_create_device()
551 static struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr, bool c45) in mdiobus_scan() argument
553 struct phy_device *phydev = ERR_PTR(-ENODEV); in mdiobus_scan()
556 phydev = get_phy_device(bus, addr, c45); in mdiobus_scan()
560 /* For DT, see if the auto-probed phy has a corresponding child in mdiobus_scan()
563 of_mdiobus_link_mdiodev(bus, &phydev->mdio); in mdiobus_scan()
568 return ERR_PTR(-ENODEV); in mdiobus_scan()
575 * mdiobus_scan_c22 - scan one address on a bus for C22 MDIO devices.
577 * @addr: address on bus to scan
586 struct phy_device *mdiobus_scan_c22(struct mii_bus *bus, int addr) in mdiobus_scan_c22() argument
588 return mdiobus_scan(bus, addr, false); in mdiobus_scan_c22()
593 * mdiobus_scan_c45 - scan one address on a bus for C45 MDIO devices.
595 * @addr: address on bus to scan
604 static struct phy_device *mdiobus_scan_c45(struct mii_bus *bus, int addr) in mdiobus_scan_c45() argument
606 return mdiobus_scan(bus, addr, true); in mdiobus_scan_c45()
614 if ((bus->phy_mask & BIT(i)) == 0) { in mdiobus_scan_bus_c22()
618 if (IS_ERR(phydev) && (PTR_ERR(phydev) != -ENODEV)) in mdiobus_scan_bus_c22()
630 if ((bus->phy_mask & BIT(i)) == 0) { in mdiobus_scan_bus_c45()
633 /* Don't scan C45 if we already have a C22 device */ in mdiobus_scan_bus_c45()
634 if (bus->mdio_map[i]) in mdiobus_scan_bus_c45()
638 if (IS_ERR(phydev) && (PTR_ERR(phydev) != -ENODEV)) in mdiobus_scan_bus_c45()
648 * themselves which was intended for another device. Now that C22
663 oui = phydev->phy_id >> 10; in mdiobus_prevent_c45_scan()
672 * __mdiobus_register - bring up all the PHYs on a given bus and attach them to bus
692 if (!bus || !bus->name) in __mdiobus_register()
693 return -EINVAL; in __mdiobus_register()
696 if (!!bus->read != !!bus->write || !!bus->read_c45 != !!bus->write_c45) in __mdiobus_register()
697 return -EINVAL; in __mdiobus_register()
700 if (!bus->read && !bus->read_c45) in __mdiobus_register()
701 return -EINVAL; in __mdiobus_register()
703 if (bus->parent && bus->parent->of_node) in __mdiobus_register()
704 bus->parent->of_node->fwnode.flags |= in __mdiobus_register()
707 WARN(bus->state != MDIOBUS_ALLOCATED && in __mdiobus_register()
708 bus->state != MDIOBUS_UNREGISTERED, in __mdiobus_register()
709 "%s: not in ALLOCATED or UNREGISTERED state\n", bus->id); in __mdiobus_register()
711 bus->owner = owner; in __mdiobus_register()
712 bus->dev.parent = bus->parent; in __mdiobus_register()
713 bus->dev.class = &mdio_bus_class; in __mdiobus_register()
714 bus->dev.groups = NULL; in __mdiobus_register()
715 dev_set_name(&bus->dev, "%s", bus->id); in __mdiobus_register()
723 if (bus->state == MDIOBUS_ALLOCATED) in __mdiobus_register()
724 fwnode_handle_get(dev_fwnode(&bus->dev)); in __mdiobus_register()
727 * the device in mdiobus_free() in __mdiobus_register()
731 bus->state = MDIOBUS_UNREGISTERED; in __mdiobus_register()
733 err = device_register(&bus->dev); in __mdiobus_register()
735 pr_err("mii_bus %s failed to register\n", bus->id); in __mdiobus_register()
736 return -EINVAL; in __mdiobus_register()
739 mutex_init(&bus->mdio_lock); in __mdiobus_register()
740 mutex_init(&bus->shared_lock); in __mdiobus_register()
743 gpiod = devm_gpiod_get_optional(&bus->dev, "reset", GPIOD_OUT_HIGH); in __mdiobus_register()
745 err = dev_err_probe(&bus->dev, PTR_ERR(gpiod), in __mdiobus_register()
747 bus->id); in __mdiobus_register()
748 device_del(&bus->dev); in __mdiobus_register()
751 bus->reset_gpiod = gpiod; in __mdiobus_register()
752 fsleep(bus->reset_delay_us); in __mdiobus_register()
754 if (bus->reset_post_delay_us > 0) in __mdiobus_register()
755 fsleep(bus->reset_post_delay_us); in __mdiobus_register()
758 if (bus->reset) { in __mdiobus_register()
759 err = bus->reset(bus); in __mdiobus_register()
764 if (bus->read) { in __mdiobus_register()
772 if (!prevent_c45_scan && bus->read_c45) { in __mdiobus_register()
780 bus->state = MDIOBUS_REGISTERED; in __mdiobus_register()
781 dev_dbg(&bus->dev, "probed\n"); in __mdiobus_register()
786 mdiodev = bus->mdio_map[i]; in __mdiobus_register()
790 mdiodev->device_remove(mdiodev); in __mdiobus_register()
791 mdiodev->device_free(mdiodev); in __mdiobus_register()
795 if (bus->reset_gpiod) in __mdiobus_register()
796 gpiod_set_value_cansleep(bus->reset_gpiod, 1); in __mdiobus_register()
798 device_del(&bus->dev); in __mdiobus_register()
808 if (WARN_ON_ONCE(bus->state != MDIOBUS_REGISTERED)) in mdiobus_unregister()
810 bus->state = MDIOBUS_UNREGISTERED; in mdiobus_unregister()
813 mdiodev = bus->mdio_map[i]; in mdiobus_unregister()
817 if (mdiodev->reset_gpio) in mdiobus_unregister()
818 gpiod_put(mdiodev->reset_gpio); in mdiobus_unregister()
820 mdiodev->device_remove(mdiodev); in mdiobus_unregister()
821 mdiodev->device_free(mdiodev); in mdiobus_unregister()
825 if (bus->reset_gpiod) in mdiobus_unregister()
826 gpiod_set_value_cansleep(bus->reset_gpiod, 1); in mdiobus_unregister()
828 device_del(&bus->dev); in mdiobus_unregister()
833 * mdiobus_free - free a struct mii_bus
836 * This function releases the reference to the underlying device
843 if (bus->state == MDIOBUS_ALLOCATED) { in mdiobus_free()
848 WARN(bus->state != MDIOBUS_UNREGISTERED, in mdiobus_free()
849 "%s: not in UNREGISTERED state\n", bus->id); in mdiobus_free()
850 bus->state = MDIOBUS_RELEASED; in mdiobus_free()
852 put_device(&bus->dev); in mdiobus_free()
859 u64_stats_update_begin(&stats->syncp); in mdiobus_stats_acct()
861 u64_stats_inc(&stats->transfers); in mdiobus_stats_acct()
863 u64_stats_inc(&stats->errors); in mdiobus_stats_acct()
868 u64_stats_inc(&stats->reads); in mdiobus_stats_acct()
870 u64_stats_inc(&stats->writes); in mdiobus_stats_acct()
872 u64_stats_update_end(&stats->syncp); in mdiobus_stats_acct()
877 * __mdiobus_read - Unlocked version of the mdiobus_read function
879 * @addr: the phy address
886 int __mdiobus_read(struct mii_bus *bus, int addr, u32 regnum) in __mdiobus_read() argument
890 lockdep_assert_held_once(&bus->mdio_lock); in __mdiobus_read()
892 if (bus->read) in __mdiobus_read()
893 retval = bus->read(bus, addr, regnum); in __mdiobus_read()
895 retval = -EOPNOTSUPP; in __mdiobus_read()
897 trace_mdio_access(bus, 1, addr, regnum, retval, retval); in __mdiobus_read()
898 mdiobus_stats_acct(&bus->stats[addr], true, retval); in __mdiobus_read()
905 * __mdiobus_write - Unlocked version of the mdiobus_write function
907 * @addr: the phy address
915 int __mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val) in __mdiobus_write() argument
919 lockdep_assert_held_once(&bus->mdio_lock); in __mdiobus_write()
921 if (bus->write) in __mdiobus_write()
922 err = bus->write(bus, addr, regnum, val); in __mdiobus_write()
924 err = -EOPNOTSUPP; in __mdiobus_write()
926 trace_mdio_access(bus, 0, addr, regnum, val, err); in __mdiobus_write()
927 mdiobus_stats_acct(&bus->stats[addr], false, err); in __mdiobus_write()
934 * __mdiobus_modify_changed - Unlocked version of the mdiobus_modify function
936 * @addr: the phy address
942 * device. Any error returns a negative number.
946 int __mdiobus_modify_changed(struct mii_bus *bus, int addr, u32 regnum, in __mdiobus_modify_changed() argument
951 ret = __mdiobus_read(bus, addr, regnum); in __mdiobus_modify_changed()
959 ret = __mdiobus_write(bus, addr, regnum, new); in __mdiobus_modify_changed()
966 * __mdiobus_c45_read - Unlocked version of the mdiobus_c45_read function
968 * @addr: the phy address
969 * @devad: device address to read
976 int __mdiobus_c45_read(struct mii_bus *bus, int addr, int devad, u32 regnum) in __mdiobus_c45_read() argument
980 lockdep_assert_held_once(&bus->mdio_lock); in __mdiobus_c45_read()
982 if (bus->read_c45) in __mdiobus_c45_read()
983 retval = bus->read_c45(bus, addr, devad, regnum); in __mdiobus_c45_read()
985 retval = -EOPNOTSUPP; in __mdiobus_c45_read()
987 trace_mdio_access(bus, 1, addr, regnum, retval, retval); in __mdiobus_c45_read()
988 mdiobus_stats_acct(&bus->stats[addr], true, retval); in __mdiobus_c45_read()
995 * __mdiobus_c45_write - Unlocked version of the mdiobus_write function
997 * @addr: the phy address
998 * @devad: device address to read
1006 int __mdiobus_c45_write(struct mii_bus *bus, int addr, int devad, u32 regnum, in __mdiobus_c45_write() argument
1011 lockdep_assert_held_once(&bus->mdio_lock); in __mdiobus_c45_write()
1013 if (bus->write_c45) in __mdiobus_c45_write()
1014 err = bus->write_c45(bus, addr, devad, regnum, val); in __mdiobus_c45_write()
1016 err = -EOPNOTSUPP; in __mdiobus_c45_write()
1018 trace_mdio_access(bus, 0, addr, regnum, val, err); in __mdiobus_c45_write()
1019 mdiobus_stats_acct(&bus->stats[addr], false, err); in __mdiobus_c45_write()
1026 * __mdiobus_c45_modify_changed - Unlocked version of the mdiobus_modify function
1028 * @addr: the phy address
1029 * @devad: device address to read
1035 * device. Any error returns a negative number.
1039 static int __mdiobus_c45_modify_changed(struct mii_bus *bus, int addr, in __mdiobus_c45_modify_changed() argument
1045 ret = __mdiobus_c45_read(bus, addr, devad, regnum); in __mdiobus_c45_modify_changed()
1053 ret = __mdiobus_c45_write(bus, addr, devad, regnum, new); in __mdiobus_c45_modify_changed()
1059 * mdiobus_read_nested - Nested version of the mdiobus_read function
1061 * @addr: the phy address
1071 int mdiobus_read_nested(struct mii_bus *bus, int addr, u32 regnum) in mdiobus_read_nested() argument
1075 mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); in mdiobus_read_nested()
1076 retval = __mdiobus_read(bus, addr, regnum); in mdiobus_read_nested()
1077 mutex_unlock(&bus->mdio_lock); in mdiobus_read_nested()
1084 * mdiobus_read - Convenience function for reading a given MII mgmt register
1086 * @addr: the phy address
1093 int mdiobus_read(struct mii_bus *bus, int addr, u32 regnum) in mdiobus_read() argument
1097 mutex_lock(&bus->mdio_lock); in mdiobus_read()
1098 retval = __mdiobus_read(bus, addr, regnum); in mdiobus_read()
1099 mutex_unlock(&bus->mdio_lock); in mdiobus_read()
1106 * mdiobus_c45_read - Convenience function for reading a given MII mgmt register
1108 * @addr: the phy address
1109 * @devad: device address to read
1116 int mdiobus_c45_read(struct mii_bus *bus, int addr, int devad, u32 regnum) in mdiobus_c45_read() argument
1120 mutex_lock(&bus->mdio_lock); in mdiobus_c45_read()
1121 retval = __mdiobus_c45_read(bus, addr, devad, regnum); in mdiobus_c45_read()
1122 mutex_unlock(&bus->mdio_lock); in mdiobus_c45_read()
1129 * mdiobus_c45_read_nested - Nested version of the mdiobus_c45_read function
1131 * @addr: the phy address
1132 * @devad: device address to read
1142 int mdiobus_c45_read_nested(struct mii_bus *bus, int addr, int devad, in mdiobus_c45_read_nested() argument
1147 mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); in mdiobus_c45_read_nested()
1148 retval = __mdiobus_c45_read(bus, addr, devad, regnum); in mdiobus_c45_read_nested()
1149 mutex_unlock(&bus->mdio_lock); in mdiobus_c45_read_nested()
1156 * mdiobus_write_nested - Nested version of the mdiobus_write function
1158 * @addr: the phy address
1169 int mdiobus_write_nested(struct mii_bus *bus, int addr, u32 regnum, u16 val) in mdiobus_write_nested() argument
1173 mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); in mdiobus_write_nested()
1174 err = __mdiobus_write(bus, addr, regnum, val); in mdiobus_write_nested()
1175 mutex_unlock(&bus->mdio_lock); in mdiobus_write_nested()
1182 * mdiobus_write - Convenience function for writing a given MII mgmt register
1184 * @addr: the phy address
1192 int mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val) in mdiobus_write() argument
1196 mutex_lock(&bus->mdio_lock); in mdiobus_write()
1197 err = __mdiobus_write(bus, addr, regnum, val); in mdiobus_write()
1198 mutex_unlock(&bus->mdio_lock); in mdiobus_write()
1205 * mdiobus_c45_write - Convenience function for writing a given MII mgmt register
1207 * @addr: the phy address
1208 * @devad: device address to read
1216 int mdiobus_c45_write(struct mii_bus *bus, int addr, int devad, u32 regnum, in mdiobus_c45_write() argument
1221 mutex_lock(&bus->mdio_lock); in mdiobus_c45_write()
1222 err = __mdiobus_c45_write(bus, addr, devad, regnum, val); in mdiobus_c45_write()
1223 mutex_unlock(&bus->mdio_lock); in mdiobus_c45_write()
1230 * mdiobus_c45_write_nested - Nested version of the mdiobus_c45_write function
1232 * @addr: the phy address
1233 * @devad: device address to read
1244 int mdiobus_c45_write_nested(struct mii_bus *bus, int addr, int devad, in mdiobus_c45_write_nested() argument
1249 mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); in mdiobus_c45_write_nested()
1250 err = __mdiobus_c45_write(bus, addr, devad, regnum, val); in mdiobus_c45_write_nested()
1251 mutex_unlock(&bus->mdio_lock); in mdiobus_c45_write_nested()
1258 * __mdiobus_modify - Convenience function for modifying a given mdio device
1261 * @addr: the phy address
1266 int __mdiobus_modify(struct mii_bus *bus, int addr, u32 regnum, u16 mask, in __mdiobus_modify() argument
1271 err = __mdiobus_modify_changed(bus, addr, regnum, mask, set); in __mdiobus_modify()
1278 * mdiobus_modify - Convenience function for modifying a given mdio device
1281 * @addr: the phy address
1286 int mdiobus_modify(struct mii_bus *bus, int addr, u32 regnum, u16 mask, u16 set) in mdiobus_modify() argument
1290 mutex_lock(&bus->mdio_lock); in mdiobus_modify()
1291 err = __mdiobus_modify(bus, addr, regnum, mask, set); in mdiobus_modify()
1292 mutex_unlock(&bus->mdio_lock); in mdiobus_modify()
1299 * mdiobus_c45_modify - Convenience function for modifying a given mdio device
1302 * @addr: the phy address
1303 * @devad: device address to read
1308 int mdiobus_c45_modify(struct mii_bus *bus, int addr, int devad, u32 regnum, in mdiobus_c45_modify() argument
1313 mutex_lock(&bus->mdio_lock); in mdiobus_c45_modify()
1314 err = __mdiobus_c45_modify_changed(bus, addr, devad, regnum, in mdiobus_c45_modify()
1316 mutex_unlock(&bus->mdio_lock); in mdiobus_c45_modify()
1323 * mdiobus_modify_changed - Convenience function for modifying a given mdio
1324 * device register and returning if it changed
1326 * @addr: the phy address
1331 int mdiobus_modify_changed(struct mii_bus *bus, int addr, u32 regnum, in mdiobus_modify_changed() argument
1336 mutex_lock(&bus->mdio_lock); in mdiobus_modify_changed()
1337 err = __mdiobus_modify_changed(bus, addr, regnum, mask, set); in mdiobus_modify_changed()
1338 mutex_unlock(&bus->mdio_lock); in mdiobus_modify_changed()
1345 * mdiobus_c45_modify_changed - Convenience function for modifying a given mdio
1346 * device register and returning if it changed
1348 * @addr: the phy address
1349 * @devad: device address to read
1354 int mdiobus_c45_modify_changed(struct mii_bus *bus, int addr, int devad, in mdiobus_c45_modify_changed() argument
1359 mutex_lock(&bus->mdio_lock); in mdiobus_c45_modify_changed()
1360 err = __mdiobus_c45_modify_changed(bus, addr, devad, regnum, mask, set); in mdiobus_c45_modify_changed()
1361 mutex_unlock(&bus->mdio_lock); in mdiobus_c45_modify_changed()
1368 * mdio_bus_match - determine if given MDIO driver supports the given
1369 * MDIO device
1370 * @dev: target MDIO device
1373 * Description: Given a MDIO device, and a MDIO driver, return 1 if
1374 * the driver supports the device. Otherwise, return 0. This may
1378 static int mdio_bus_match(struct device *dev, const struct device_driver *drv) in mdio_bus_match()
1383 /* Both the driver and device must type-match */ in mdio_bus_match()
1384 if (!(mdiodrv->mdiodrv.flags & MDIO_DEVICE_IS_PHY) != in mdio_bus_match()
1385 !(mdio->flags & MDIO_DEVICE_FLAG_PHY)) in mdio_bus_match()
1391 if (mdio->bus_match) in mdio_bus_match()
1392 return mdio->bus_match(dev, drv); in mdio_bus_match()
1397 static int mdio_uevent(const struct device *dev, struct kobj_uevent_env *env) in mdio_uevent()
1401 /* Some devices have extra OF data and an OF-style MODALIAS */ in mdio_uevent()
1403 if (rc != -ENODEV) in mdio_uevent()
1460 MODULE_DESCRIPTION("MDIO bus/device layer");