Lines Matching +full:i2c +full:- +full:parent
1 // SPDX-License-Identifier: GPL-2.0
3 * MDIO I2C bridge
5 * Copyright (C) 2015-2016 Russell King
7 * Network PHYs can appear on I2C buses when they are part of SFP module.
12 #include <linux/i2c.h>
13 #include <linux/mdio/mdio-i2c.h>
17 * I2C bus addresses 0x50 and 0x51 are normally an EEPROM, which is
33 struct i2c_adapter *i2c = bus->priv; in i2c_mii_read() local
51 msgs[0].len = p - addr; in i2c_mii_read()
58 ret = i2c_transfer(i2c, msgs, ARRAY_SIZE(msgs)); in i2c_mii_read()
67 struct i2c_adapter *i2c = bus->priv; in i2c_mii_write() local
86 msg.len = p - data; in i2c_mii_write()
89 ret = i2c_transfer(i2c, &msg, 1); in i2c_mii_write()
94 struct mii_bus *mdio_i2c_alloc(struct device *parent, struct i2c_adapter *i2c) in mdio_i2c_alloc() argument
98 if (!i2c_check_functionality(i2c, I2C_FUNC_I2C)) in mdio_i2c_alloc()
99 return ERR_PTR(-EINVAL); in mdio_i2c_alloc()
103 return ERR_PTR(-ENOMEM); in mdio_i2c_alloc()
105 snprintf(mii->id, MII_BUS_ID_SIZE, "i2c:%s", dev_name(parent)); in mdio_i2c_alloc()
106 mii->parent = parent; in mdio_i2c_alloc()
107 mii->read = i2c_mii_read; in mdio_i2c_alloc()
108 mii->write = i2c_mii_write; in mdio_i2c_alloc()
109 mii->priv = i2c; in mdio_i2c_alloc()
116 MODULE_DESCRIPTION("MDIO I2C bridge library");