dm: core: Access device ofnode through functions
At present ofnode is present in the device even if it is never used. With of-platdata this field is not used, so can be removed. In preparation for this, change the access to go through inline functions. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -957,7 +957,7 @@ phy_interface_t fman_read_sys_if(struct udevice *dev)
|
||||
{
|
||||
const char *if_str;
|
||||
|
||||
if_str = ofnode_read_string(dev->node, "phy-connection-type");
|
||||
if_str = ofnode_read_string(dev_ofnode(dev), "phy-connection-type");
|
||||
debug("MAC system interface mode %s\n", if_str);
|
||||
|
||||
return phy_get_interface_by_name(if_str);
|
||||
@@ -969,7 +969,7 @@ static int fm_eth_bind(struct udevice *dev)
|
||||
char mac_name[11];
|
||||
u32 fm, num;
|
||||
|
||||
if (ofnode_read_u32(ofnode_get_parent(dev->node), "cell-index", &fm)) {
|
||||
if (ofnode_read_u32(ofnode_get_parent(dev_ofnode(dev)), "cell-index", &fm)) {
|
||||
printf("FMan node property cell-index missing\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ static int enetc_bind(struct udevice *dev)
|
||||
* and some are not, use different naming scheme - enetc-N based on
|
||||
* PCI function # and enetc#N based on interface count
|
||||
*/
|
||||
if (ofnode_valid(dev->node))
|
||||
if (ofnode_valid(dev_ofnode(dev)))
|
||||
sprintf(name, "enetc-%u", PCI_FUNC(pci_get_devfn(dev)));
|
||||
else
|
||||
sprintf(name, "enetc#%u", eth_num_devices++);
|
||||
@@ -253,12 +253,12 @@ static void enetc_start_pcs(struct udevice *dev)
|
||||
mdio_register(&priv->imdio);
|
||||
}
|
||||
|
||||
if (!ofnode_valid(dev->node)) {
|
||||
if (!ofnode_valid(dev_ofnode(dev))) {
|
||||
enetc_dbg(dev, "no enetc ofnode found, skipping PCS set-up\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if_str = ofnode_read_string(dev->node, "phy-mode");
|
||||
if_str = ofnode_read_string(dev_ofnode(dev), "phy-mode");
|
||||
if (if_str)
|
||||
priv->if_type = phy_get_interface_by_name(if_str);
|
||||
else
|
||||
@@ -306,7 +306,7 @@ static int enetc_probe(struct udevice *dev)
|
||||
{
|
||||
struct enetc_priv *priv = dev_get_priv(dev);
|
||||
|
||||
if (ofnode_valid(dev->node) && !ofnode_is_available(dev->node)) {
|
||||
if (ofnode_valid(dev_ofnode(dev)) && !ofnode_is_available(dev_ofnode(dev))) {
|
||||
enetc_dbg(dev, "interface disabled\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ static int enetc_mdio_bind(struct udevice *dev)
|
||||
* and some are not, use different naming scheme - enetc-N based on
|
||||
* PCI function # and enetc#N based on interface count
|
||||
*/
|
||||
if (ofnode_valid(dev->node))
|
||||
if (ofnode_valid(dev_ofnode(dev)))
|
||||
sprintf(name, "emdio-%u", PCI_FUNC(pci_get_devfn(dev)));
|
||||
else
|
||||
sprintf(name, "emdio#%u", eth_num_devices++);
|
||||
|
||||
@@ -107,8 +107,8 @@ static const struct mdio_ops ipq4019_mdio_ops = {
|
||||
|
||||
static int ipq4019_mdio_bind(struct udevice *dev)
|
||||
{
|
||||
if (ofnode_valid(dev->node))
|
||||
device_set_name(dev, ofnode_get_name(dev->node));
|
||||
if (ofnode_valid(dev_ofnode(dev)))
|
||||
device_set_name(dev, ofnode_get_name(dev_ofnode(dev)));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ static int mdio_mux_i2creg_probe(struct udevice *dev)
|
||||
}
|
||||
|
||||
/* parent should be an I2C chip, grandparent should be an I2C bus */
|
||||
chip_node = ofnode_get_parent(dev->node);
|
||||
chip_node = ofnode_get_parent(dev_ofnode(dev));
|
||||
bus_node = ofnode_get_parent(chip_node);
|
||||
|
||||
err = uclass_get_device_by_ofnode(UCLASS_I2C, bus_node, &i2c_bus);
|
||||
|
||||
@@ -197,8 +197,8 @@ static int mvmdio_write(struct udevice *dev, int addr, int devad, int reg,
|
||||
*/
|
||||
static int mvmdio_bind(struct udevice *dev)
|
||||
{
|
||||
if (ofnode_valid(dev->node))
|
||||
device_set_name(dev, ofnode_get_name(dev->node));
|
||||
if (ofnode_valid(dev_ofnode(dev)))
|
||||
device_set_name(dev, ofnode_get_name(dev_ofnode(dev)));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ read_error:
|
||||
|
||||
int octeontx_smi_probe(struct udevice *dev)
|
||||
{
|
||||
int ret, subnode, cnt = 0, node = dev->node.of_offset;
|
||||
int ret, subnode, cnt = 0, node = dev_ofnode(dev).of_offset;
|
||||
struct mii_dev *bus;
|
||||
struct octeontx_smi_priv *priv;
|
||||
pci_dev_t bdf = dm_pci_get_bdf(dev);
|
||||
|
||||
@@ -707,7 +707,8 @@ static int init_phy(struct tsec_private *priv)
|
||||
tsec_configure_serdes(priv);
|
||||
|
||||
#if defined(CONFIG_DM_ETH) && defined(CONFIG_DM_MDIO)
|
||||
if (ofnode_valid(ofnode_find_subnode(priv->dev->node, "fixed-link")))
|
||||
if (ofnode_valid(ofnode_find_subnode(dev_ofnode(priv->dev),
|
||||
"fixed-link")))
|
||||
phydev = phy_connect(NULL, 0, priv->dev, priv->interface);
|
||||
else
|
||||
phydev = dm_eth_phy_connect(priv->dev);
|
||||
|
||||
Reference in New Issue
Block a user