aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-08-27 20:01:57 -0400
committerDavid S. Miller <davem@davemloft.net>2008-08-29 05:13:10 -0400
commit334ae614772b1147435dce9be3911f9040dff0d9 (patch)
treea443e687646ab25744b20e43963f728870122e97 /drivers/net
parent7f06a3b2c162573c924f425053227a52b4bd7cb1 (diff)
sparc: Kill SBUS DVMA layer.
This thing was completely pointless. Just find the OF device in the parent of drivers that want to program this device, and map the DMA regs inside such drivers too. This also moves the dummy claim_dma_lock() and release_dma_lock() implementation to floppy_32.h, which makes it handle this issue just like floppy_64.h does. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/sunlance.c51
1 files changed, 27 insertions, 24 deletions
diff --git a/drivers/net/sunlance.c b/drivers/net/sunlance.c
index 4e994f87469e..24ffecb1ce23 100644
--- a/drivers/net/sunlance.c
+++ b/drivers/net/sunlance.c
@@ -248,7 +248,7 @@ struct lance_private {
248 int rx_new, tx_new; 248 int rx_new, tx_new;
249 int rx_old, tx_old; 249 int rx_old, tx_old;
250 250
251 struct sbus_dma *ledma; /* If set this points to ledma */ 251 struct of_device *ledma; /* If set this points to ledma */
252 char tpe; /* cable-selection is TPE */ 252 char tpe; /* cable-selection is TPE */
253 char auto_select; /* cable-selection by carrier */ 253 char auto_select; /* cable-selection by carrier */
254 char burst_sizes; /* ledma SBus burst sizes */ 254 char burst_sizes; /* ledma SBus burst sizes */
@@ -1273,6 +1273,12 @@ static void lance_free_hwresources(struct lance_private *lp)
1273{ 1273{
1274 if (lp->lregs) 1274 if (lp->lregs)
1275 sbus_iounmap(lp->lregs, LANCE_REG_SIZE); 1275 sbus_iounmap(lp->lregs, LANCE_REG_SIZE);
1276 if (lp->dregs) {
1277 struct of_device *ledma = lp->ledma;
1278
1279 of_iounmap(&ledma->resource[0], lp->dregs,
1280 resource_size(&ledma->resource[0]));
1281 }
1276 if (lp->init_block_iomem) { 1282 if (lp->init_block_iomem) {
1277 sbus_iounmap(lp->init_block_iomem, 1283 sbus_iounmap(lp->init_block_iomem,
1278 sizeof(struct lance_init_block)); 1284 sizeof(struct lance_init_block));
@@ -1309,7 +1315,7 @@ static const struct ethtool_ops sparc_lance_ethtool_ops = {
1309}; 1315};
1310 1316
1311static int __devinit sparc_lance_probe_one(struct sbus_dev *sdev, 1317static int __devinit sparc_lance_probe_one(struct sbus_dev *sdev,
1312 struct sbus_dma *ledma, 1318 struct of_device *ledma,
1313 struct sbus_dev *lebuffer) 1319 struct sbus_dev *lebuffer)
1314{ 1320{
1315 static unsigned version_printed; 1321 static unsigned version_printed;
@@ -1345,6 +1351,18 @@ static int __devinit sparc_lance_probe_one(struct sbus_dev *sdev,
1345 goto fail; 1351 goto fail;
1346 } 1352 }
1347 1353
1354 lp->ledma = ledma;
1355 if (lp->ledma) {
1356 lp->dregs = of_ioremap(&ledma->resource[0], 0,
1357 resource_size(&ledma->resource[0]),
1358 "ledma");
1359 if (!lp->dregs) {
1360 printk(KERN_ERR "SunLance: Cannot map "
1361 "ledma registers.\n");
1362 goto fail;
1363 }
1364 }
1365
1348 lp->sdev = sdev; 1366 lp->sdev = sdev;
1349 if (lebuffer) { 1367 if (lebuffer) {
1350 /* sanity check */ 1368 /* sanity check */
@@ -1383,11 +1401,10 @@ static int __devinit sparc_lance_probe_one(struct sbus_dev *sdev,
1383 LE_C3_BCON)); 1401 LE_C3_BCON));
1384 1402
1385 lp->name = lancestr; 1403 lp->name = lancestr;
1386 lp->ledma = ledma;
1387 1404
1388 lp->burst_sizes = 0; 1405 lp->burst_sizes = 0;
1389 if (lp->ledma) { 1406 if (lp->ledma) {
1390 struct device_node *ledma_dp = ledma->sdev->ofdev.node; 1407 struct device_node *ledma_dp = ledma->node;
1391 const char *prop; 1408 const char *prop;
1392 unsigned int sbmask; 1409 unsigned int sbmask;
1393 u32 csr; 1410 u32 csr;
@@ -1435,8 +1452,6 @@ no_link_test:
1435 lp->tpe = 1; 1452 lp->tpe = 1;
1436 } 1453 }
1437 1454
1438 lp->dregs = ledma->regs;
1439
1440 /* Reset ledma */ 1455 /* Reset ledma */
1441 csr = sbus_readl(lp->dregs + DMA_CSR); 1456 csr = sbus_readl(lp->dregs + DMA_CSR);
1442 sbus_writel(csr | DMA_RST_ENET, lp->dregs + DMA_CSR); 1457 sbus_writel(csr | DMA_RST_ENET, lp->dregs + DMA_CSR);
@@ -1486,18 +1501,6 @@ fail:
1486 return -ENODEV; 1501 return -ENODEV;
1487} 1502}
1488 1503
1489/* On 4m, find the associated dma for the lance chip */
1490static struct sbus_dma * __devinit find_ledma(struct sbus_dev *sdev)
1491{
1492 struct sbus_dma *p;
1493
1494 for_each_dvma(p) {
1495 if (p->sdev == sdev)
1496 return p;
1497 }
1498 return NULL;
1499}
1500
1501#ifdef CONFIG_SUN4 1504#ifdef CONFIG_SUN4
1502 1505
1503#include <asm/sun4paddr.h> 1506#include <asm/sun4paddr.h>
@@ -1541,13 +1544,13 @@ static int __devinit sunlance_sbus_probe(struct of_device *dev, const struct of_
1541 int err; 1544 int err;
1542 1545
1543 if (sdev->parent) { 1546 if (sdev->parent) {
1544 struct of_device *parent = &sdev->parent->ofdev; 1547 struct device_node *parent_node = sdev->parent->ofdev.node;
1545 1548 struct of_device *parent;
1546 if (!strcmp(parent->node->name, "ledma")) {
1547 struct sbus_dma *ledma = find_ledma(to_sbus_device(&parent->dev));
1548 1549
1549 err = sparc_lance_probe_one(sdev, ledma, NULL); 1550 parent = of_find_device_by_node(parent_node);
1550 } else if (!strcmp(parent->node->name, "lebuffer")) { 1551 if (parent && !strcmp(parent->node->name, "ledma")) {
1552 err = sparc_lance_probe_one(sdev, parent, NULL);
1553 } else if (parent && !strcmp(parent->node->name, "lebuffer")) {
1551 err = sparc_lance_probe_one(sdev, NULL, to_sbus_device(&parent->dev)); 1554 err = sparc_lance_probe_one(sdev, NULL, to_sbus_device(&parent->dev));
1552 } else 1555 } else
1553 err = sparc_lance_probe_one(sdev, NULL, NULL); 1556 err = sparc_lance_probe_one(sdev, NULL, NULL);