summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-08-17 09:37:02 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2011-08-17 09:37:02 +0200
commitba13dc4776cfd2bd9bb32817b6d815119ec86a14 (patch)
tree1e41608b9f8a922ff3ed633149703a2ce818eed8
parentddbbeee82214c5edcdeb7da0a1d480d1d32104d0 (diff)
parent79884012c66390845b977cd1cab2db1f9cd0a3b5 (diff)
downloadbarebox-ba13dc4776cfd2bd9bb32817b6d815119ec86a14.tar.gz
barebox-ba13dc4776cfd2bd9bb32817b6d815119ec86a14.tar.xz
Merge branch 'pu' into next
-rw-r--r--common/console.c2
-rw-r--r--drivers/base/driver.c27
-rw-r--r--drivers/mci/atmel_mci.c1
-rw-r--r--drivers/mci/imx-esdhc.c1
-rw-r--r--drivers/mci/imx.c1
-rw-r--r--drivers/mci/mci-core.c9
-rw-r--r--drivers/mci/omap_hsmmc.c1
-rw-r--r--drivers/net/altera_tse.c2
-rw-r--r--drivers/net/at91_ether.c1
-rw-r--r--drivers/net/cs8900.c1
-rw-r--r--drivers/net/dm9000.c2
-rw-r--r--drivers/net/ep93xx.c2
-rw-r--r--drivers/net/fec_imx.c2
-rw-r--r--drivers/net/fec_mpc5200.c2
-rw-r--r--drivers/net/macb.c2
-rw-r--r--drivers/net/miidev.c2
-rw-r--r--drivers/net/netx_eth.c2
-rw-r--r--drivers/net/smc91111.c2
-rw-r--r--drivers/net/smc911x.c2
-rw-r--r--drivers/net/usb/asix.c1
-rw-r--r--drivers/net/usb/smsc95xx.c1
-rw-r--r--drivers/net/usb/usbnet.c1
-rw-r--r--drivers/spi/spi.c1
-rw-r--r--include/mci.h1
-rw-r--r--include/miidev.h1
-rw-r--r--include/net.h1
-rw-r--r--net/eth.c4
27 files changed, 58 insertions, 17 deletions
diff --git a/common/console.c b/common/console.c
index d60e57fc4..1f6ee93b4 100644
--- a/common/console.c
+++ b/common/console.c
@@ -132,6 +132,8 @@ int console_register(struct console_device *newcdev)
dev->id = -1;
strcpy(dev->name, "cs");
dev->type_data = newcdev;
+ if (newcdev->dev)
+ dev_add_child(newcdev->dev, dev);
register_device(dev);
if (newcdev->setbrg) {
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index b8b2f3960..0b8010314 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -283,32 +283,33 @@ void devices_shutdown(void)
}
#ifdef CONFIG_CMD_DEVINFO
-static int do_devinfo_subtree(struct device_d *dev, int depth, char edge)
+static int do_devinfo_subtree(struct device_d *dev, int depth)
{
struct device_d *child;
struct cdev *cdev;
int i;
for (i = 0; i < depth; i++)
- printf("| ");
+ printf(" ");
- printf("%c----%s", edge, dev_name(dev));
+ printf("`---- %s", dev_name(dev));
if (!list_empty(&dev->cdevs)) {
- printf(" (");
+ printf("\n");
list_for_each_entry(cdev, &dev->cdevs, devices_list) {
- printf("%s", cdev->name);
- if (!list_is_last(&cdev->devices_list, &dev->cdevs))
- printf(", ");
+ for (i = 0; i < depth + 1; i++)
+ printf(" ");
+ printf("`---- 0x%08lx-0x%08lx: /dev/%s\n",
+ cdev->offset,
+ cdev->offset + cdev->size - 1,
+ cdev->name);
}
- printf(")");
+ } else {
+ printf("\n");
}
- printf("\n");
if (!list_empty(&dev->children)) {
device_for_each_child(dev, child) {
- do_devinfo_subtree(child, depth + 1,
- list_is_last(&child->sibling,
- &dev->children) ? '`' : '|');
+ do_devinfo_subtree(child, depth + 1);
}
}
@@ -328,7 +329,7 @@ static int do_devinfo(struct command *cmdtp, int argc, char *argv[])
for_each_device(dev) {
if (!dev->parent)
- do_devinfo_subtree(dev, 0, '|');
+ do_devinfo_subtree(dev, 0);
}
printf("\ndrivers:\n");
diff --git a/drivers/mci/atmel_mci.c b/drivers/mci/atmel_mci.c
index b4489dd19..71aec16fa 100644
--- a/drivers/mci/atmel_mci.c
+++ b/drivers/mci/atmel_mci.c
@@ -449,6 +449,7 @@ static int mci_probe(struct device_d *hw_dev)
host->mci.send_cmd = mci_request;
host->mci.set_ios = mci_set_ios;
host->mci.init = mci_reset;
+ host->mci.hw_dev = hw_dev;
host->mci.host_caps = pd->host_caps;
if (pd->bus_width >= 4)
diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c
index e20b3b7a6..358f0dc25 100644
--- a/drivers/mci/imx-esdhc.c
+++ b/drivers/mci/imx-esdhc.c
@@ -485,6 +485,7 @@ static int fsl_esdhc_probe(struct device_d *dev)
host->mci.set_ios = esdhc_set_ios;
host->mci.init = esdhc_init;
host->mci.host_caps = MMC_MODE_4BIT;
+ host->mci.hw_dev = dev;
host->mci.voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
diff --git a/drivers/mci/imx.c b/drivers/mci/imx.c
index 1f96e9660..905c251db 100644
--- a/drivers/mci/imx.c
+++ b/drivers/mci/imx.c
@@ -492,6 +492,7 @@ static int mxcmci_probe(struct device_d *dev)
host->mci.set_ios = mxcmci_set_ios;
host->mci.init = mxcmci_init;
host->mci.host_caps = MMC_MODE_4BIT;
+ host->mci.hw_dev = dev;
host->base = dev_request_mem_region(dev, 0);
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index fea26916c..681de0a44 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -1177,6 +1177,7 @@ static int mci_card_probe(struct device_d *mci_dev)
struct mci_host *host = GET_MCI_PDATA(mci_dev);
struct ata_interface *p;
int rc;
+ struct device_d *dev;
/* start with a host interface reset */
rc = (host->init)(host, mci_dev);
@@ -1228,7 +1229,8 @@ static int mci_card_probe(struct device_d *mci_dev)
p->read = mci_sd_read;
p->priv = mci_dev;
- add_generic_device("disk", -1, NULL, 0, mci->capacity, IORESOURCE_MEM, p);
+ dev = add_generic_device("disk", -1, NULL, 0, mci->capacity, IORESOURCE_MEM, p);
+ dev_add_child(&host->dev, dev);
pr_debug("SD Card successfully added\n");
@@ -1359,12 +1361,11 @@ device_initcall(mci_init);
*/
int mci_register(struct mci_host *host)
{
- struct device_d *mci_dev;
-
- mci_dev = xzalloc(sizeof(struct device_d));
+ struct device_d *mci_dev = &host->dev;
strcpy(mci_dev->name, mci_driver.name);
mci_dev->platform_data = (void*)host;
+ dev_add_child(host->hw_dev, mci_dev);
return register_device(mci_dev);
}
diff --git a/drivers/mci/omap_hsmmc.c b/drivers/mci/omap_hsmmc.c
index f47f1907c..5fdf445c7 100644
--- a/drivers/mci/omap_hsmmc.c
+++ b/drivers/mci/omap_hsmmc.c
@@ -557,6 +557,7 @@ static int omap_mmc_probe(struct device_d *dev)
hsmmc->mci.set_ios = mmc_set_ios;
hsmmc->mci.init = mmc_init_setup;
hsmmc->mci.host_caps = MMC_MODE_4BIT | MMC_MODE_HS_52MHz | MMC_MODE_HS;
+ hsmmc->mci.hw_dev = dev;
hsmmc->base = dev_request_mem_region(dev, 0);
diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c
index e7dabda5d..7e456c762 100644
--- a/drivers/net/altera_tse.c
+++ b/drivers/net/altera_tse.c
@@ -518,6 +518,7 @@ static int tse_probe(struct device_d *dev)
edev->halt = tse_eth_halt;
edev->get_ethaddr = tse_get_ethaddr;
edev->set_ethaddr = tse_set_ethaddr;
+ edev->parent = dev;
#ifdef CONFIG_TSE_USE_DEDICATED_DESC_MEM
tx_desc = dev_request_mem_region(dev, 3);
@@ -548,6 +549,7 @@ static int tse_probe(struct device_d *dev)
miidev->write = tse_phy_write;
miidev->flags = 0;
miidev->edev = edev;
+ miidev->parent = dev;
if (dev->platform_data != NULL)
miidev->address = *((int8_t *)(dev->platform_data));
diff --git a/drivers/net/at91_ether.c b/drivers/net/at91_ether.c
index d5e26a15d..8d0b43b9e 100644
--- a/drivers/net/at91_ether.c
+++ b/drivers/net/at91_ether.c
@@ -272,6 +272,7 @@ static int at91rm9200_eth_init (struct device_d *dev)
edev->halt = at91rm9200_eth_halt;
edev->get_ethaddr = at91rm9200_get_ethaddr;
edev->set_ethaddr = at91rm9200_set_ethaddr;
+ edev->parent = dev;
p_mac = AT91C_BASE_EMAC;
diff --git a/drivers/net/cs8900.c b/drivers/net/cs8900.c
index d954e39d7..33afc5e0f 100644
--- a/drivers/net/cs8900.c
+++ b/drivers/net/cs8900.c
@@ -458,6 +458,7 @@ static int cs8900_probe(struct device_d *dev)
edev->halt = cs8900_halt;
edev->get_ethaddr = cs8900_get_ethaddr;
edev->set_ethaddr = cs8900_set_ethaddr;
+ edev->parent = dev;
eth_register(edev);
return 0;
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index be14317ef..e9ec61b37 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -513,6 +513,7 @@ static int dm9000_probe(struct device_d *dev)
edev->halt = dm9000_eth_halt;
edev->set_ethaddr = dm9000_set_ethaddr;
edev->get_ethaddr = dm9000_get_ethaddr;
+ edev->parent = dev;
/* RESET device */
dm9000_reset(priv);
@@ -540,6 +541,7 @@ static int dm9000_probe(struct device_d *dev)
priv->miidev.address = 0;
priv->miidev.flags = 0;
priv->miidev.edev = edev;
+ priv->miidev.parent = dev;
mii_register(&priv->miidev);
eth_register(edev);
diff --git a/drivers/net/ep93xx.c b/drivers/net/ep93xx.c
index 7821cd24c..954ec789f 100644
--- a/drivers/net/ep93xx.c
+++ b/drivers/net/ep93xx.c
@@ -497,11 +497,13 @@ static int ep93xx_eth_probe(struct device_d *dev)
edev->halt = ep93xx_eth_halt;
edev->get_ethaddr = ep93xx_eth_get_ethaddr;
edev->set_ethaddr = ep93xx_eth_set_ethaddr;
+ edev->parent = dev;
priv->miidev.read = ep93xx_phy_read;
priv->miidev.write = ep93xx_phy_write;
priv->miidev.address = 0;
priv->miidev.flags = 0;
+ priv->miidev.parent = dev;
priv->tx_dq.base = calloc(NUMTXDESC,
sizeof(struct tx_descriptor));
diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index 8b4f43974..3b0f266a2 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -612,6 +612,7 @@ static int fec_probe(struct device_d *dev)
edev->halt = fec_halt;
edev->get_ethaddr = fec_get_hwaddr;
edev->set_ethaddr = fec_set_hwaddr;
+ edev->parent = dev;
fec->regs = dev_request_mem_region(dev, 0);
@@ -644,6 +645,7 @@ static int fec_probe(struct device_d *dev)
fec->miidev.address = pdata->phy_addr;
fec->miidev.flags = pdata->xcv_type == MII10 ? MIIDEV_FORCE_10 : 0;
fec->miidev.edev = edev;
+ fec->miidev.parent = dev;
mii_register(&fec->miidev);
}
diff --git a/drivers/net/fec_mpc5200.c b/drivers/net/fec_mpc5200.c
index 310d70d86..403aad523 100644
--- a/drivers/net/fec_mpc5200.c
+++ b/drivers/net/fec_mpc5200.c
@@ -672,6 +672,7 @@ int mpc5xxx_fec_probe(struct device_d *dev)
edev->halt = mpc5xxx_fec_halt;
edev->get_ethaddr = mpc5xxx_fec_get_ethaddr;
edev->set_ethaddr = mpc5xxx_fec_set_ethaddr;
+ edev->parent = dev;
fec->eth = dev_request_mem_region(dev, 0);
fec->tbdBase = (FEC_TBD *)FEC_BD_BASE;
@@ -687,6 +688,7 @@ int mpc5xxx_fec_probe(struct device_d *dev)
fec->miidev.address = CONFIG_PHY_ADDR;
fec->miidev.flags = pdata->xcv_type == MII10 ? MIIDEV_FORCE_10 : 0;
fec->miidev.edev = edev;
+ fec->miidev.parent = dev;
mii_register(&fec->miidev);
}
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 95ad3d728..898cf3d1a 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -433,6 +433,7 @@ static int macb_probe(struct device_d *dev)
edev->halt = macb_halt;
edev->get_ethaddr = pdata->get_ethaddr ? pdata->get_ethaddr : macb_get_ethaddr;
edev->set_ethaddr = macb_set_ethaddr;
+ edev->parent = dev;
macb->miidev.read = macb_phy_read;
macb->miidev.write = macb_phy_write;
@@ -440,6 +441,7 @@ static int macb_probe(struct device_d *dev)
macb->miidev.flags = pdata->flags & AT91SAM_ETHER_FORCE_LINK ?
MIIDEV_FORCE_LINK : 0;
macb->miidev.edev = edev;
+ macb->miidev.parent = dev;
macb->flags = pdata->flags;
macb->rx_buffer = xmalloc(CFG_MACB_RX_BUFFER_SIZE);
diff --git a/drivers/net/miidev.c b/drivers/net/miidev.c
index fa9d79e82..501a4f8e1 100644
--- a/drivers/net/miidev.c
+++ b/drivers/net/miidev.c
@@ -210,6 +210,8 @@ int mii_register(struct mii_device *mdev)
mdev->dev.priv = mdev;
mdev->dev.id = -1;
strcpy(mdev->dev.name, "miidev");
+ if (mdev->parent)
+ dev_add_child(mdev->parent, &mdev->dev);
return register_device(&mdev->dev);
}
diff --git a/drivers/net/netx_eth.c b/drivers/net/netx_eth.c
index fd40f6271..5503bc94d 100644
--- a/drivers/net/netx_eth.c
+++ b/drivers/net/netx_eth.c
@@ -258,11 +258,13 @@ static int netx_eth_probe(struct device_d *dev)
edev->halt = netx_eth_halt;
edev->get_ethaddr = netx_eth_get_ethaddr;
edev->set_ethaddr = netx_eth_set_ethaddr;
+ edev->parent = dev;
priv->miidev.read = netx_miidev_read;
priv->miidev.write = netx_miidev_write;
priv->miidev.address = 0;
priv->miidev.flags = 0;
+ priv->miidev.parent = dev;
netx_eth_init_phy();
mii_register(&priv->miidev);
diff --git a/drivers/net/smc91111.c b/drivers/net/smc91111.c
index 1c1ffea54..2313aaeb6 100644
--- a/drivers/net/smc91111.c
+++ b/drivers/net/smc91111.c
@@ -1311,12 +1311,14 @@ static int smc91c111_probe(struct device_d *dev)
edev->halt = smc91c111_eth_halt;
edev->get_ethaddr = smc91c111_get_ethaddr;
edev->set_ethaddr = smc91c111_set_ethaddr;
+ edev->parent = dev;
priv->miidev.read = smc91c111_phy_read;
priv->miidev.write = smc91c111_phy_write;
priv->miidev.address = 0;
priv->miidev.flags = 0;
priv->miidev.edev = edev;
+ priv->miidev.parent = dev;
priv->base = dev_request_mem_region(dev, 0);
smc91c111_reset(edev);
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 8c6f9fc19..fba61c460 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -725,12 +725,14 @@ static int smc911x_probe(struct device_d *dev)
edev->halt = smc911x_eth_halt;
edev->get_ethaddr = smc911x_get_ethaddr;
edev->set_ethaddr = smc911x_set_ethaddr;
+ edev->parent = dev;
priv->miidev.read = smc911x_phy_read;
priv->miidev.write = smc911x_phy_write;
priv->miidev.address = 1;
priv->miidev.flags = 0;
priv->miidev.edev = edev;
+ priv->miidev.parent = dev;
priv->base = base;
smc911x_reset(edev);
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index d148925b0..be5a170d7 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -474,6 +474,7 @@ static int asix_init_mii(struct usbnet *dev)
dev->miidev.address = asix_get_phy_addr(dev);
dev->miidev.flags = 0;
dev->miidev.edev = &dev->edev;
+ dev->miidev.parent = &dev->udev->dev;
return mii_register(&dev->miidev);
}
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index ae137fb97..b51899292 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -444,6 +444,7 @@ static int smsc95xx_phy_initialize(struct usbnet *dev)
dev->miidev.address = 1; /* FIXME: asix_get_phy_addr(dev); */
dev->miidev.flags = 0;
dev->miidev.edev = &dev->edev;
+ dev->miidev.parent = &dev->udev->dev;
// dev->miidev.name = dev->edev.name;
/* reset phy and wait for reset to complete */
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index cd658ed52..5ffd7a603 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -206,6 +206,7 @@ int usbnet_probe(struct usb_device *usbdev, const struct usb_device_id *prod)
edev->recv = usbnet_recv,
edev->halt = usbnet_halt,
edev->priv = undev;
+ edev->parent = &usbdev->dev;
info = (struct driver_info *)prod->driver_info;
undev->driver_info = info;
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 80586947b..b561f9da2 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -79,6 +79,7 @@ struct spi_device *spi_new_device(struct spi_master *master,
proxy->dev.platform_data = chip->platform_data;
strcpy(proxy->dev.name, chip->name);
proxy->dev.type_data = proxy;
+ dev_add_child(master->dev, &proxy->dev);
status = register_device(&proxy->dev);
/* drivers may modify this initial i/o setup */
diff --git a/include/mci.h b/include/mci.h
index 8c669ca0a..69cffe8d3 100644
--- a/include/mci.h
+++ b/include/mci.h
@@ -194,6 +194,7 @@ struct mci_data {
/** host information */
struct mci_host {
struct device_d *hw_dev; /**< the host MCI hardware device */
+ struct device_d dev; /**< our device */
unsigned voltages;
unsigned host_caps; /**< Host's interface capabilities, refer MMC_VDD_* */
unsigned f_min; /**< host interface lower limit */
diff --git a/include/miidev.h b/include/miidev.h
index 6f653d9f0..21727effc 100644
--- a/include/miidev.h
+++ b/include/miidev.h
@@ -33,6 +33,7 @@
struct mii_device {
struct device_d dev;
+ struct device_d *parent;
int address; /* The address the phy has on the bus */
int (*read) (struct mii_device *dev, int addr, int reg);
diff --git a/include/net.h b/include/net.h
index 1272f23c0..d0f834102 100644
--- a/include/net.h
+++ b/include/net.h
@@ -43,6 +43,7 @@ struct eth_device {
void *priv;
struct device_d dev;
+ struct device_d *parent;
struct list_head list;
};
diff --git a/net/eth.c b/net/eth.c
index 2a801f5ce..621cb5935 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -199,6 +199,10 @@ int eth_register(struct eth_device *edev)
strcpy(edev->dev.name, "eth");
edev->dev.id = -1;
+
+ if (edev->parent)
+ dev_add_child(edev->parent, &edev->dev);
+
register_device(&edev->dev);
dev->type_data = edev;