Merge branch 'pu/am335x'
This commit is contained in:
commit
f13f1c269e
|
@ -916,20 +916,22 @@ static int cpsw_slave_setup(struct cpsw_slave *slave, int slave_num,
|
|||
struct phy_device *phy;
|
||||
|
||||
phy = mdiobus_scan(&priv->miibus, priv->slaves[slave_num].phy_id);
|
||||
if (IS_ERR(phy))
|
||||
return PTR_ERR(phy);
|
||||
if (IS_ERR(phy)) {
|
||||
ret = PTR_ERR(phy);
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
phy->dev.device_node = priv->slaves[slave_num].dev.device_node;
|
||||
ret = phy_register_device(phy);
|
||||
if (ret)
|
||||
return ret;
|
||||
goto err_out;
|
||||
|
||||
sprintf(dev->name, "cpsw-slave");
|
||||
dev->id = slave->slave_num;
|
||||
dev->parent = priv->dev;
|
||||
ret = register_device(dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
goto err_register_dev;
|
||||
|
||||
dev_dbg(&slave->dev, "* %s\n", __func__);
|
||||
|
||||
|
@ -948,7 +950,20 @@ static int cpsw_slave_setup(struct cpsw_slave *slave, int slave_num,
|
|||
edev->set_ethaddr = cpsw_set_hwaddr;
|
||||
edev->parent = dev;
|
||||
|
||||
return eth_register(edev);
|
||||
ret = eth_register(edev);
|
||||
if (ret)
|
||||
goto err_register_edev;
|
||||
|
||||
return 0;
|
||||
|
||||
err_register_dev:
|
||||
phy_unregister_device(phy);
|
||||
err_register_edev:
|
||||
unregister_device(dev);
|
||||
err_out:
|
||||
slave->slave_num = -1;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct cpsw_data {
|
||||
|
@ -1219,6 +1234,8 @@ int cpsw_probe(struct device_d *dev)
|
|||
}
|
||||
}
|
||||
|
||||
dev->priv = priv;
|
||||
|
||||
return 0;
|
||||
out:
|
||||
free(priv->slaves);
|
||||
|
@ -1227,6 +1244,22 @@ out:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void cpsw_remove(struct device_d *dev)
|
||||
{
|
||||
struct cpsw_priv *priv = dev->priv;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < priv->num_slaves; i++) {
|
||||
struct cpsw_slave *slave = &priv->slaves[i];
|
||||
if (slave->slave_num < 0)
|
||||
continue;
|
||||
|
||||
eth_unregister(&slave->edev);
|
||||
}
|
||||
|
||||
mdiobus_unregister(&priv->miibus);
|
||||
}
|
||||
|
||||
static __maybe_unused struct of_device_id cpsw_dt_ids[] = {
|
||||
{
|
||||
.compatible = "ti,cpsw",
|
||||
|
@ -1238,6 +1271,7 @@ static __maybe_unused struct of_device_id cpsw_dt_ids[] = {
|
|||
static struct driver_d cpsw_driver = {
|
||||
.name = "cpsw",
|
||||
.probe = cpsw_probe,
|
||||
.remove = cpsw_remove,
|
||||
.of_compatible = DRV_OF_COMPAT(cpsw_dt_ids),
|
||||
};
|
||||
device_platform_driver(cpsw_driver);
|
||||
|
|
|
@ -272,6 +272,17 @@ int phy_register_device(struct phy_device *phydev)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void phy_unregister_device(struct phy_device *phydev)
|
||||
{
|
||||
if (!phydev->registered)
|
||||
return;
|
||||
|
||||
phydev->bus->phy_map[phydev->addr] = NULL;
|
||||
|
||||
unregister_device(&phydev->dev);
|
||||
phydev->registered = 0;
|
||||
}
|
||||
|
||||
static struct phy_device *of_mdio_find_phy(struct eth_device *edev)
|
||||
{
|
||||
struct device_d *dev;
|
||||
|
|
|
@ -139,6 +139,7 @@ int musb_register(struct musb *musb)
|
|||
host->submit_control_msg = submit_control_msg;
|
||||
host->submit_bulk_msg = submit_bulk_msg;
|
||||
|
||||
musb->controller->priv = musb;
|
||||
musb->controller->detect = musb_detect;
|
||||
usb_register_host(host);
|
||||
|
||||
|
|
|
@ -129,14 +129,17 @@ struct dsps_glue {
|
|||
struct musb_hdrc_platform_data pdata;
|
||||
};
|
||||
|
||||
static struct dsps_glue *to_dsps_glue(struct musb *musb)
|
||||
{
|
||||
return container_of(musb, struct dsps_glue, musb);
|
||||
}
|
||||
|
||||
/**
|
||||
* dsps_musb_enable - enable interrupts
|
||||
*/
|
||||
static void dsps_musb_enable(struct musb *musb)
|
||||
{
|
||||
struct device_d *dev = musb->controller;
|
||||
struct device_d *pdev = dev;
|
||||
struct dsps_glue *glue = pdev->priv;
|
||||
struct dsps_glue *glue = to_dsps_glue(musb);
|
||||
const struct dsps_musb_wrapper *wrp = glue->wrp;
|
||||
void __iomem *reg_base = musb->ctrl_base;
|
||||
u32 epmask, coremask;
|
||||
|
@ -158,9 +161,7 @@ static void dsps_musb_enable(struct musb *musb)
|
|||
*/
|
||||
static void dsps_musb_disable(struct musb *musb)
|
||||
{
|
||||
struct device_d *dev = musb->controller;
|
||||
struct device_d *pdev = dev;
|
||||
struct dsps_glue *glue = pdev->priv;
|
||||
struct dsps_glue *glue = to_dsps_glue(musb);
|
||||
const struct dsps_musb_wrapper *wrp = glue->wrp;
|
||||
void __iomem *reg_base = musb->ctrl_base;
|
||||
|
||||
|
@ -173,8 +174,7 @@ static void dsps_musb_disable(struct musb *musb)
|
|||
static irqreturn_t dsps_interrupt(struct musb *musb)
|
||||
{
|
||||
void __iomem *reg_base = musb->ctrl_base;
|
||||
struct device_d *dev = musb->controller;
|
||||
struct dsps_glue *glue = dev->priv;
|
||||
struct dsps_glue *glue = to_dsps_glue(musb);
|
||||
const struct dsps_musb_wrapper *wrp = glue->wrp;
|
||||
unsigned long flags;
|
||||
irqreturn_t ret = IRQ_NONE;
|
||||
|
@ -213,8 +213,7 @@ out:
|
|||
|
||||
static int dsps_musb_init(struct musb *musb)
|
||||
{
|
||||
struct device_d *dev = musb->controller;
|
||||
struct dsps_glue *glue = dev->priv;
|
||||
struct dsps_glue *glue = to_dsps_glue(musb);
|
||||
const struct dsps_musb_wrapper *wrp = glue->wrp;
|
||||
u32 rev, val, mode;
|
||||
|
||||
|
@ -377,8 +376,6 @@ static int dsps_probe(struct device_d *dev)
|
|||
glue->dev = dev;
|
||||
glue->wrp = wrp;
|
||||
|
||||
dev->priv = glue;
|
||||
|
||||
pdata = &glue->pdata;
|
||||
|
||||
glue->musb.mregs = dev_request_mem_region(dev, 0);
|
||||
|
|
|
@ -266,6 +266,7 @@ int phy_init(void);
|
|||
int phy_init_hw(struct phy_device *phydev);
|
||||
|
||||
int phy_register_device(struct phy_device* dev);
|
||||
void phy_unregister_device(struct phy_device *phydev);
|
||||
|
||||
/**
|
||||
* phy_read - Convenience function for reading a given PHY register
|
||||
|
|
Loading…
Reference in New Issue