aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/sunlance.c51
-rw-r--r--drivers/sbus/Makefile2
-rw-r--r--drivers/sbus/dvma.c136
-rw-r--r--drivers/sbus/sbus.c2
-rw-r--r--drivers/scsi/esp_scsi.h3
-rw-r--r--drivers/scsi/sun_esp.c122
6 files changed, 99 insertions, 217 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);
diff --git a/drivers/sbus/Makefile b/drivers/sbus/Makefile
index 7b1d24d95308..56f73318eba2 100644
--- a/drivers/sbus/Makefile
+++ b/drivers/sbus/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5ifneq ($(ARCH),m68k) 5ifneq ($(ARCH),m68k)
6obj-y := sbus.o dvma.o 6obj-y := sbus.o
7endif 7endif
8 8
9obj-$(CONFIG_SBUSCHAR) += char/ 9obj-$(CONFIG_SBUSCHAR) += char/
diff --git a/drivers/sbus/dvma.c b/drivers/sbus/dvma.c
deleted file mode 100644
index ab0d2de3324c..000000000000
--- a/drivers/sbus/dvma.c
+++ /dev/null
@@ -1,136 +0,0 @@
1/* dvma.c: Routines that are used to access DMA on the Sparc SBus.
2 *
3 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
4 */
5
6#include <linux/string.h>
7#include <linux/kernel.h>
8#include <linux/slab.h>
9#include <linux/init.h>
10#include <linux/delay.h>
11
12#include <asm/oplib.h>
13#include <asm/io.h>
14#include <asm/dma.h>
15#include <asm/sbus.h>
16
17struct sbus_dma *dma_chain;
18
19static void __init init_one_dvma(struct sbus_dma *dma, int num_dma)
20{
21 printk("dma%d: ", num_dma);
22
23 dma->next = NULL;
24 dma->running = 0; /* No transfers going on as of yet */
25 dma->allocated = 0; /* No one has allocated us yet */
26 switch(sbus_readl(dma->regs + DMA_CSR)&DMA_DEVICE_ID) {
27 case DMA_VERS0:
28 dma->revision = dvmarev0;
29 printk("Revision 0 ");
30 break;
31 case DMA_ESCV1:
32 dma->revision = dvmaesc1;
33 printk("ESC Revision 1 ");
34 break;
35 case DMA_VERS1:
36 dma->revision = dvmarev1;
37 printk("Revision 1 ");
38 break;
39 case DMA_VERS2:
40 dma->revision = dvmarev2;
41 printk("Revision 2 ");
42 break;
43 case DMA_VERHME:
44 dma->revision = dvmahme;
45 printk("HME DVMA gate array ");
46 break;
47 case DMA_VERSPLUS:
48 dma->revision = dvmarevplus;
49 printk("Revision 1 PLUS ");
50 break;
51 default:
52 printk("unknown dma version %08x",
53 sbus_readl(dma->regs + DMA_CSR) & DMA_DEVICE_ID);
54 dma->allocated = 1;
55 break;
56 }
57 printk("\n");
58}
59
60/* Probe this SBus DMA module(s) */
61void __init dvma_init(struct sbus_bus *sbus)
62{
63 struct sbus_dev *this_dev;
64 struct sbus_dma *dma;
65 struct sbus_dma *dchain;
66 static int num_dma = 0;
67
68 for_each_sbusdev(this_dev, sbus) {
69 char *name = this_dev->prom_name;
70 int hme = 0;
71
72 if(!strcmp(name, "SUNW,fas"))
73 hme = 1;
74 else if(strcmp(name, "dma") &&
75 strcmp(name, "ledma") &&
76 strcmp(name, "espdma"))
77 continue;
78
79 /* Found one... */
80 dma = kmalloc(sizeof(struct sbus_dma), GFP_ATOMIC);
81
82 dma->sdev = this_dev;
83
84 /* Put at end of dma chain */
85 dchain = dma_chain;
86 if(dchain) {
87 while(dchain->next)
88 dchain = dchain->next;
89 dchain->next = dma;
90 } else {
91 /* We're the first in line */
92 dma_chain = dma;
93 }
94
95 dma->regs = sbus_ioremap(&dma->sdev->resource[0], 0,
96 dma->sdev->resource[0].end - dma->sdev->resource[0].start + 1,
97 "dma");
98
99 dma->node = dma->sdev->prom_node;
100
101 init_one_dvma(dma, num_dma++);
102 }
103}
104
105#ifdef CONFIG_SUN4
106
107#include <asm/sun4paddr.h>
108
109void __init sun4_dvma_init(void)
110{
111 struct sbus_dma *dma;
112 struct resource r;
113
114 if(sun4_dma_physaddr) {
115 dma = kmalloc(sizeof(struct sbus_dma), GFP_ATOMIC);
116
117 /* No SBUS */
118 dma->sdev = NULL;
119
120 /* Only one DMA device */
121 dma_chain = dma;
122
123 memset(&r, 0, sizeof(r));
124 r.start = sun4_dma_physaddr;
125 dma->regs = sbus_ioremap(&r, 0, PAGE_SIZE, "dma");
126
127 /* No prom node */
128 dma->node = 0x0;
129
130 init_one_dvma(dma, 0);
131 } else {
132 dma_chain = NULL;
133 }
134}
135
136#endif
diff --git a/drivers/sbus/sbus.c b/drivers/sbus/sbus.c
index 53e5e7bf545c..69491625d869 100644
--- a/drivers/sbus/sbus.c
+++ b/drivers/sbus/sbus.c
@@ -285,8 +285,6 @@ static void __init build_one_sbus(struct device_node *dp, int num_sbus)
285 } 285 }
286 286
287 sbus_fixup_all_regs(sbus->devices); 287 sbus_fixup_all_regs(sbus->devices);
288
289 dvma_init(sbus);
290} 288}
291 289
292static int __init sbus_init(void) 290static int __init sbus_init(void)
diff --git a/drivers/scsi/esp_scsi.h b/drivers/scsi/esp_scsi.h
index bb43a1388188..28e22acf87ea 100644
--- a/drivers/scsi/esp_scsi.h
+++ b/drivers/scsi/esp_scsi.h
@@ -521,7 +521,8 @@ struct esp {
521 521
522 struct completion *eh_reset; 522 struct completion *eh_reset;
523 523
524 struct sbus_dma *dma; 524 void *dma;
525 int dmarev;
525}; 526};
526 527
527/* A front-end driver for the ESP chip should do the following in 528/* A front-end driver for the ESP chip should do the following in
diff --git a/drivers/scsi/sun_esp.c b/drivers/scsi/sun_esp.c
index f9cf70151366..d110b94f111e 100644
--- a/drivers/scsi/sun_esp.c
+++ b/drivers/scsi/sun_esp.c
@@ -1,6 +1,6 @@
1/* sun_esp.c: ESP front-end for Sparc SBUS systems. 1/* sun_esp.c: ESP front-end for Sparc SBUS systems.
2 * 2 *
3 * Copyright (C) 2007 David S. Miller (davem@davemloft.net) 3 * Copyright (C) 2007, 2008 David S. Miller (davem@davemloft.net)
4 */ 4 */
5 5
6#include <linux/kernel.h> 6#include <linux/kernel.h>
@@ -30,39 +30,48 @@
30#define dma_write32(VAL, REG) \ 30#define dma_write32(VAL, REG) \
31 sbus_writel((VAL), esp->dma_regs + (REG)) 31 sbus_writel((VAL), esp->dma_regs + (REG))
32 32
33static int __devinit esp_sbus_find_dma(struct esp *esp, struct sbus_dev *dma_sdev) 33/* DVMA chip revisions */
34{ 34enum dvma_rev {
35 struct sbus_dev *sdev = esp->dev; 35 dvmarev0,
36 struct sbus_dma *dma; 36 dvmaesc1,
37 dvmarev1,
38 dvmarev2,
39 dvmarev3,
40 dvmarevplus,
41 dvmahme
42};
37 43
38 if (dma_sdev != NULL) { 44static int __devinit esp_sbus_setup_dma(struct esp *esp,
39 for_each_dvma(dma) { 45 struct of_device *dma_of)
40 if (dma->sdev == dma_sdev) 46{
41 break; 47 esp->dma = dma_of;
42 }
43 } else {
44 for_each_dvma(dma) {
45 if (dma->sdev == NULL)
46 break;
47 48
48 /* If bus + slot are the same and it has the 49 esp->dma_regs = of_ioremap(&dma_of->resource[0], 0,
49 * correct OBP name, it's ours. 50 resource_size(&dma_of->resource[0]),
50 */ 51 "espdma");
51 if (sdev->bus == dma->sdev->bus && 52 if (!esp->dma_regs)
52 sdev->slot == dma->sdev->slot && 53 return -ENOMEM;
53 (!strcmp(dma->sdev->prom_name, "dma") ||
54 !strcmp(dma->sdev->prom_name, "espdma")))
55 break;
56 }
57 }
58 54
59 if (dma == NULL) { 55 switch (dma_read32(DMA_CSR) & DMA_DEVICE_ID) {
60 printk(KERN_ERR PFX "[%s] Cannot find dma.\n", 56 case DMA_VERS0:
61 sdev->ofdev.node->full_name); 57 esp->dmarev = dvmarev0;
62 return -ENODEV; 58 break;
59 case DMA_ESCV1:
60 esp->dmarev = dvmaesc1;
61 break;
62 case DMA_VERS1:
63 esp->dmarev = dvmarev1;
64 break;
65 case DMA_VERS2:
66 esp->dmarev = dvmarev2;
67 break;
68 case DMA_VERHME:
69 esp->dmarev = dvmahme;
70 break;
71 case DMA_VERSPLUS:
72 esp->dmarev = dvmarevplus;
73 break;
63 } 74 }
64 esp->dma = dma;
65 esp->dma_regs = dma->regs;
66 75
67 return 0; 76 return 0;
68 77
@@ -165,19 +174,18 @@ static void __devinit esp_get_clock_params(struct esp *esp)
165 esp->cfreq = fmhz; 174 esp->cfreq = fmhz;
166} 175}
167 176
168static void __devinit esp_get_bursts(struct esp *esp, struct sbus_dev *dma) 177static void __devinit esp_get_bursts(struct esp *esp, struct of_device *dma_of)
169{ 178{
179 struct device_node *dma_dp = dma_of->node;
170 struct sbus_dev *sdev = esp->dev; 180 struct sbus_dev *sdev = esp->dev;
171 struct device_node *dp = sdev->ofdev.node; 181 struct device_node *dp;
172 u8 bursts; 182 u8 bursts, val;
173 183
184 dp = sdev->ofdev.node;
174 bursts = of_getintprop_default(dp, "burst-sizes", 0xff); 185 bursts = of_getintprop_default(dp, "burst-sizes", 0xff);
175 if (dma) { 186 val = of_getintprop_default(dma_dp, "burst-sizes", 0xff);
176 struct device_node *dma_dp = dma->ofdev.node; 187 if (val != 0xff)
177 u8 val = of_getintprop_default(dma_dp, "burst-sizes", 0xff); 188 bursts &= val;
178 if (val != 0xff)
179 bursts &= val;
180 }
181 189
182 if (sdev->bus) { 190 if (sdev->bus) {
183 u8 val = of_getintprop_default(sdev->bus->ofdev.node, 191 u8 val = of_getintprop_default(sdev->bus->ofdev.node,
@@ -194,7 +202,7 @@ static void __devinit esp_get_bursts(struct esp *esp, struct sbus_dev *dma)
194 esp->bursts = bursts; 202 esp->bursts = bursts;
195} 203}
196 204
197static void __devinit esp_sbus_get_props(struct esp *esp, struct sbus_dev *espdma) 205static void __devinit esp_sbus_get_props(struct esp *esp, struct of_device *espdma)
198{ 206{
199 esp_get_scsi_id(esp); 207 esp_get_scsi_id(esp);
200 esp_get_differential(esp); 208 esp_get_differential(esp);
@@ -259,12 +267,12 @@ static void sbus_esp_reset_dma(struct esp *esp)
259 can_do_burst64 = (esp->bursts & DMA_BURST64) != 0; 267 can_do_burst64 = (esp->bursts & DMA_BURST64) != 0;
260 268
261 /* Put the DVMA into a known state. */ 269 /* Put the DVMA into a known state. */
262 if (esp->dma->revision != dvmahme) { 270 if (esp->dmarev != dvmahme) {
263 val = dma_read32(DMA_CSR); 271 val = dma_read32(DMA_CSR);
264 dma_write32(val | DMA_RST_SCSI, DMA_CSR); 272 dma_write32(val | DMA_RST_SCSI, DMA_CSR);
265 dma_write32(val & ~DMA_RST_SCSI, DMA_CSR); 273 dma_write32(val & ~DMA_RST_SCSI, DMA_CSR);
266 } 274 }
267 switch (esp->dma->revision) { 275 switch (esp->dmarev) {
268 case dvmahme: 276 case dvmahme:
269 dma_write32(DMA_RESET_FAS366, DMA_CSR); 277 dma_write32(DMA_RESET_FAS366, DMA_CSR);
270 dma_write32(DMA_RST_SCSI, DMA_CSR); 278 dma_write32(DMA_RST_SCSI, DMA_CSR);
@@ -346,14 +354,14 @@ static void sbus_esp_dma_drain(struct esp *esp)
346 u32 csr; 354 u32 csr;
347 int lim; 355 int lim;
348 356
349 if (esp->dma->revision == dvmahme) 357 if (esp->dmarev == dvmahme)
350 return; 358 return;
351 359
352 csr = dma_read32(DMA_CSR); 360 csr = dma_read32(DMA_CSR);
353 if (!(csr & DMA_FIFO_ISDRAIN)) 361 if (!(csr & DMA_FIFO_ISDRAIN))
354 return; 362 return;
355 363
356 if (esp->dma->revision != dvmarev3 && esp->dma->revision != dvmaesc1) 364 if (esp->dmarev != dvmarev3 && esp->dmarev != dvmaesc1)
357 dma_write32(csr | DMA_FIFO_STDRAIN, DMA_CSR); 365 dma_write32(csr | DMA_FIFO_STDRAIN, DMA_CSR);
358 366
359 lim = 1000; 367 lim = 1000;
@@ -369,7 +377,7 @@ static void sbus_esp_dma_drain(struct esp *esp)
369 377
370static void sbus_esp_dma_invalidate(struct esp *esp) 378static void sbus_esp_dma_invalidate(struct esp *esp)
371{ 379{
372 if (esp->dma->revision == dvmahme) { 380 if (esp->dmarev == dvmahme) {
373 dma_write32(DMA_RST_SCSI, DMA_CSR); 381 dma_write32(DMA_RST_SCSI, DMA_CSR);
374 382
375 esp->prev_hme_dmacsr = ((esp->prev_hme_dmacsr | 383 esp->prev_hme_dmacsr = ((esp->prev_hme_dmacsr |
@@ -440,7 +448,7 @@ static void sbus_esp_send_dma_cmd(struct esp *esp, u32 addr, u32 esp_count,
440 else 448 else
441 csr &= ~DMA_ST_WRITE; 449 csr &= ~DMA_ST_WRITE;
442 dma_write32(csr, DMA_CSR); 450 dma_write32(csr, DMA_CSR);
443 if (esp->dma->revision == dvmaesc1) { 451 if (esp->dmarev == dvmaesc1) {
444 u32 end = PAGE_ALIGN(addr + dma_count + 16U); 452 u32 end = PAGE_ALIGN(addr + dma_count + 16U);
445 dma_write32(end - addr, DMA_COUNT); 453 dma_write32(end - addr, DMA_COUNT);
446 } 454 }
@@ -478,7 +486,7 @@ static const struct esp_driver_ops sbus_esp_ops = {
478 486
479static int __devinit esp_sbus_probe_one(struct device *dev, 487static int __devinit esp_sbus_probe_one(struct device *dev,
480 struct sbus_dev *esp_dev, 488 struct sbus_dev *esp_dev,
481 struct sbus_dev *espdma, 489 struct of_device *espdma,
482 struct sbus_bus *sbus, 490 struct sbus_bus *sbus,
483 int hme) 491 int hme)
484{ 492{
@@ -503,7 +511,7 @@ static int __devinit esp_sbus_probe_one(struct device *dev,
503 if (hme) 511 if (hme)
504 esp->flags |= ESP_FLAG_WIDE_CAPABLE; 512 esp->flags |= ESP_FLAG_WIDE_CAPABLE;
505 513
506 err = esp_sbus_find_dma(esp, espdma); 514 err = esp_sbus_setup_dma(esp, espdma);
507 if (err < 0) 515 if (err < 0)
508 goto fail_unlink; 516 goto fail_unlink;
509 517
@@ -525,7 +533,7 @@ static int __devinit esp_sbus_probe_one(struct device *dev,
525 * come up with the reset bit set, so make sure that 533 * come up with the reset bit set, so make sure that
526 * is clear first. 534 * is clear first.
527 */ 535 */
528 if (esp->dma->revision == dvmaesc1) { 536 if (esp->dmarev == dvmaesc1) {
529 u32 val = dma_read32(DMA_CSR); 537 u32 val = dma_read32(DMA_CSR);
530 538
531 dma_write32(val & ~DMA_RST_SCSI, DMA_CSR); 539 dma_write32(val & ~DMA_RST_SCSI, DMA_CSR);
@@ -556,26 +564,32 @@ fail:
556static int __devinit esp_sbus_probe(struct of_device *dev, const struct of_device_id *match) 564static int __devinit esp_sbus_probe(struct of_device *dev, const struct of_device_id *match)
557{ 565{
558 struct sbus_dev *sdev = to_sbus_device(&dev->dev); 566 struct sbus_dev *sdev = to_sbus_device(&dev->dev);
567 struct device_node *dma_node = NULL;
559 struct device_node *dp = dev->node; 568 struct device_node *dp = dev->node;
560 struct sbus_dev *dma_sdev = NULL; 569 struct of_device *dma_of = NULL;
561 int hme = 0; 570 int hme = 0;
562 571
563 if (dp->parent && 572 if (dp->parent &&
564 (!strcmp(dp->parent->name, "espdma") || 573 (!strcmp(dp->parent->name, "espdma") ||
565 !strcmp(dp->parent->name, "dma"))) 574 !strcmp(dp->parent->name, "dma")))
566 dma_sdev = sdev->parent; 575 dma_node = dp->parent;
567 else if (!strcmp(dp->name, "SUNW,fas")) { 576 else if (!strcmp(dp->name, "SUNW,fas")) {
568 dma_sdev = sdev; 577 dma_node = sdev->ofdev.node;
569 hme = 1; 578 hme = 1;
570 } 579 }
580 if (dma_node)
581 dma_of = of_find_device_by_node(dma_node);
582 if (!dma_of)
583 return -ENODEV;
571 584
572 return esp_sbus_probe_one(&dev->dev, sdev, dma_sdev, 585 return esp_sbus_probe_one(&dev->dev, sdev, dma_of,
573 sdev->bus, hme); 586 sdev->bus, hme);
574} 587}
575 588
576static int __devexit esp_sbus_remove(struct of_device *dev) 589static int __devexit esp_sbus_remove(struct of_device *dev)
577{ 590{
578 struct esp *esp = dev_get_drvdata(&dev->dev); 591 struct esp *esp = dev_get_drvdata(&dev->dev);
592 struct of_device *dma_of = esp->dma;
579 unsigned int irq = esp->host->irq; 593 unsigned int irq = esp->host->irq;
580 u32 val; 594 u32 val;
581 595
@@ -590,6 +604,8 @@ static int __devexit esp_sbus_remove(struct of_device *dev)
590 esp->command_block, 604 esp->command_block,
591 esp->command_block_dma); 605 esp->command_block_dma);
592 sbus_iounmap(esp->regs, SBUS_ESP_REG_SIZE); 606 sbus_iounmap(esp->regs, SBUS_ESP_REG_SIZE);
607 of_iounmap(&dma_of->resource[0], esp->dma_regs,
608 resource_size(&dma_of->resource[0]));
593 609
594 scsi_host_put(esp->host); 610 scsi_host_put(esp->host);
595 611