Commit 08c3f57c authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Jeff Garzik

DM9000: Remove the 2 resources probe scheme.

The dm9000 driver accepts either 2 or 3 resources to describe the platform
devices. The 2 resources case abuses the ioresource mechanism by passing
ioremap()ed memory through the platform device resources. This patch removes
that case and converts boards that were using it to the 3 resources scheme.
Signed-off-by: default avatarBen Dooks <ben-linux@fluff.org>
Signed-off-by: default avatarLaurent Pinchart <laurentp@cse-semaphore.com>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent e35c3269
...@@ -528,7 +528,6 @@ dm9000_probe(struct platform_device *pdev) ...@@ -528,7 +528,6 @@ dm9000_probe(struct platform_device *pdev)
struct board_info *db; /* Point a board information structure */ struct board_info *db; /* Point a board information structure */
struct net_device *ndev; struct net_device *ndev;
const unsigned char *mac_src; const unsigned char *mac_src;
unsigned long base;
int ret = 0; int ret = 0;
int iosize; int iosize;
int i; int i;
...@@ -558,81 +557,64 @@ dm9000_probe(struct platform_device *pdev) ...@@ -558,81 +557,64 @@ dm9000_probe(struct platform_device *pdev)
INIT_DELAYED_WORK(&db->phy_poll, dm9000_poll_work); INIT_DELAYED_WORK(&db->phy_poll, dm9000_poll_work);
if (pdev->num_resources < 2) { if (pdev->num_resources < 3) {
ret = -ENODEV; ret = -ENODEV;
goto out; goto out;
} else if (pdev->num_resources == 2) { }
base = pdev->resource[0].start;
if (!request_mem_region(base, 4, ndev->name)) {
ret = -EBUSY;
goto out;
}
ndev->base_addr = base;
ndev->irq = pdev->resource[1].start;
db->io_addr = (void __iomem *)base;
db->io_data = (void __iomem *)(base + 4);
/* ensure at least we have a default set of IO routines */ db->addr_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
dm9000_set_io(db, 2); db->data_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
db->irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
} else { if (db->addr_res == NULL || db->data_res == NULL ||
db->addr_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); db->irq_res == NULL) {
db->data_res = platform_get_resource(pdev, IORESOURCE_MEM, 1); dev_err(db->dev, "insufficient resources\n");
db->irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); ret = -ENOENT;
goto out;
if (db->addr_res == NULL || db->data_res == NULL || }
db->irq_res == NULL) {
dev_err(db->dev, "insufficient resources\n");
ret = -ENOENT;
goto out;
}
i = res_size(db->addr_res); iosize = res_size(db->addr_res);
db->addr_req = request_mem_region(db->addr_res->start, i, db->addr_req = request_mem_region(db->addr_res->start, iosize,
pdev->name); pdev->name);
if (db->addr_req == NULL) { if (db->addr_req == NULL) {
dev_err(db->dev, "cannot claim address reg area\n"); dev_err(db->dev, "cannot claim address reg area\n");
ret = -EIO; ret = -EIO;
goto out; goto out;
} }
db->io_addr = ioremap(db->addr_res->start, i);
if (db->io_addr == NULL) { db->io_addr = ioremap(db->addr_res->start, iosize);
dev_err(db->dev, "failed to ioremap address reg\n");
ret = -EINVAL;
goto out;
}
iosize = res_size(db->data_res); if (db->io_addr == NULL) {
db->data_req = request_mem_region(db->data_res->start, iosize, dev_err(db->dev, "failed to ioremap address reg\n");
pdev->name); ret = -EINVAL;
goto out;
}
if (db->data_req == NULL) { iosize = res_size(db->data_res);
dev_err(db->dev, "cannot claim data reg area\n"); db->data_req = request_mem_region(db->data_res->start, iosize,
ret = -EIO; pdev->name);
goto out;
}
db->io_data = ioremap(db->data_res->start, iosize); if (db->data_req == NULL) {
dev_err(db->dev, "cannot claim data reg area\n");
ret = -EIO;
goto out;
}
if (db->io_data == NULL) { db->io_data = ioremap(db->data_res->start, iosize);
dev_err(db->dev,"failed to ioremap data reg\n");
ret = -EINVAL;
goto out;
}
/* fill in parameters for net-dev structure */ if (db->io_data == NULL) {
dev_err(db->dev, "failed to ioremap data reg\n");
ret = -EINVAL;
goto out;
}
ndev->base_addr = (unsigned long)db->io_addr; /* fill in parameters for net-dev structure */
ndev->irq = db->irq_res->start; ndev->base_addr = (unsigned long)db->io_addr;
ndev->irq = db->irq_res->start;
/* ensure at least we have a default set of IO routines */ /* ensure at least we have a default set of IO routines */
dm9000_set_io(db, iosize); dm9000_set_io(db, iosize);
}
/* check to see if anything is being over-ridden */ /* check to see if anything is being over-ridden */
if (pdata != NULL) { if (pdata != NULL) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment