aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/myri_sbus.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-08-27 02:36:58 -0400
committerDavid S. Miller <davem@davemloft.net>2008-08-29 05:13:32 -0400
commit9e6b6e7d8e48dedc384a377941feecec99be889e (patch)
treed7f1357125eab09718f49da08e0a0d34b11dc752 /drivers/net/myri_sbus.c
parent63237eeb5ac92d618a0a6055f4b1f65c5d14682b (diff)
myri_sbus: Convert to pure OF driver.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/myri_sbus.c')
-rw-r--r--drivers/net/myri_sbus.c156
1 files changed, 68 insertions, 88 deletions
diff --git a/drivers/net/myri_sbus.c b/drivers/net/myri_sbus.c
index f2a3ff24de44..03867b10f37e 100644
--- a/drivers/net/myri_sbus.c
+++ b/drivers/net/myri_sbus.c
@@ -1,6 +1,6 @@
1/* myri_sbus.c: MyriCOM MyriNET SBUS card driver. 1/* myri_sbus.c: MyriCOM MyriNET SBUS card driver.
2 * 2 *
3 * Copyright (C) 1996, 1999, 2006 David S. Miller (davem@davemloft.net) 3 * Copyright (C) 1996, 1999, 2006, 2008 David S. Miller (davem@davemloft.net)
4 */ 4 */
5 5
6static char version[] = 6static char version[] =
@@ -23,6 +23,8 @@ static char version[] =
23#include <linux/skbuff.h> 23#include <linux/skbuff.h>
24#include <linux/bitops.h> 24#include <linux/bitops.h>
25#include <linux/dma-mapping.h> 25#include <linux/dma-mapping.h>
26#include <linux/of.h>
27#include <linux/of_device.h>
26 28
27#include <net/dst.h> 29#include <net/dst.h>
28#include <net/arp.h> 30#include <net/arp.h>
@@ -34,7 +36,6 @@ static char version[] =
34#include <asm/dma.h> 36#include <asm/dma.h>
35#include <asm/byteorder.h> 37#include <asm/byteorder.h>
36#include <asm/idprom.h> 38#include <asm/idprom.h>
37#include <asm/sbus.h>
38#include <asm/openprom.h> 39#include <asm/openprom.h>
39#include <asm/oplib.h> 40#include <asm/oplib.h>
40#include <asm/auxio.h> 41#include <asm/auxio.h>
@@ -244,7 +245,7 @@ static void myri_clean_rings(struct myri_eth *mp)
244 u32 dma_addr; 245 u32 dma_addr;
245 246
246 dma_addr = sbus_readl(&rxd->myri_scatters[0].addr); 247 dma_addr = sbus_readl(&rxd->myri_scatters[0].addr);
247 dma_unmap_single(&mp->myri_sdev->ofdev.dev, dma_addr, 248 dma_unmap_single(&mp->myri_op->dev, dma_addr,
248 RX_ALLOC_SIZE, DMA_FROM_DEVICE); 249 RX_ALLOC_SIZE, DMA_FROM_DEVICE);
249 dev_kfree_skb(mp->rx_skbs[i]); 250 dev_kfree_skb(mp->rx_skbs[i]);
250 mp->rx_skbs[i] = NULL; 251 mp->rx_skbs[i] = NULL;
@@ -261,7 +262,7 @@ static void myri_clean_rings(struct myri_eth *mp)
261 u32 dma_addr; 262 u32 dma_addr;
262 263
263 dma_addr = sbus_readl(&txd->myri_gathers[0].addr); 264 dma_addr = sbus_readl(&txd->myri_gathers[0].addr);
264 dma_unmap_single(&mp->myri_sdev->ofdev.dev, dma_addr, 265 dma_unmap_single(&mp->myri_op->dev, dma_addr,
265 (skb->len + 3) & ~3, 266 (skb->len + 3) & ~3,
266 DMA_TO_DEVICE); 267 DMA_TO_DEVICE);
267 dev_kfree_skb(mp->tx_skbs[i]); 268 dev_kfree_skb(mp->tx_skbs[i]);
@@ -292,7 +293,7 @@ static void myri_init_rings(struct myri_eth *mp, int from_irq)
292 skb->dev = dev; 293 skb->dev = dev;
293 skb_put(skb, RX_ALLOC_SIZE); 294 skb_put(skb, RX_ALLOC_SIZE);
294 295
295 dma_addr = dma_map_single(&mp->myri_sdev->ofdev.dev, 296 dma_addr = dma_map_single(&mp->myri_op->dev,
296 skb->data, RX_ALLOC_SIZE, 297 skb->data, RX_ALLOC_SIZE,
297 DMA_FROM_DEVICE); 298 DMA_FROM_DEVICE);
298 sbus_writel(dma_addr, &rxd[i].myri_scatters[0].addr); 299 sbus_writel(dma_addr, &rxd[i].myri_scatters[0].addr);
@@ -350,7 +351,7 @@ static void myri_tx(struct myri_eth *mp, struct net_device *dev)
350 351
351 DTX(("SKB[%d] ", entry)); 352 DTX(("SKB[%d] ", entry));
352 dma_addr = sbus_readl(&sq->myri_txd[entry].myri_gathers[0].addr); 353 dma_addr = sbus_readl(&sq->myri_txd[entry].myri_gathers[0].addr);
353 dma_unmap_single(&mp->myri_sdev->ofdev.dev, dma_addr, 354 dma_unmap_single(&mp->myri_op->dev, dma_addr,
354 skb->len, DMA_TO_DEVICE); 355 skb->len, DMA_TO_DEVICE);
355 dev_kfree_skb(skb); 356 dev_kfree_skb(skb);
356 mp->tx_skbs[entry] = NULL; 357 mp->tx_skbs[entry] = NULL;
@@ -430,7 +431,7 @@ static void myri_rx(struct myri_eth *mp, struct net_device *dev)
430 431
431 /* Check for errors. */ 432 /* Check for errors. */
432 DRX(("rxd[%d]: %p len[%d] csum[%08x] ", entry, rxd, len, csum)); 433 DRX(("rxd[%d]: %p len[%d] csum[%08x] ", entry, rxd, len, csum));
433 dma_sync_single_for_cpu(&mp->myri_sdev->ofdev.dev, 434 dma_sync_single_for_cpu(&mp->myri_op->dev,
434 sbus_readl(&rxd->myri_scatters[0].addr), 435 sbus_readl(&rxd->myri_scatters[0].addr),
435 RX_ALLOC_SIZE, DMA_FROM_DEVICE); 436 RX_ALLOC_SIZE, DMA_FROM_DEVICE);
436 if (len < (ETH_HLEN + MYRI_PAD_LEN) || (skb->data[0] != MYRI_PAD_LEN)) { 437 if (len < (ETH_HLEN + MYRI_PAD_LEN) || (skb->data[0] != MYRI_PAD_LEN)) {
@@ -449,7 +450,7 @@ static void myri_rx(struct myri_eth *mp, struct net_device *dev)
449 drops++; 450 drops++;
450 DRX(("DROP ")); 451 DRX(("DROP "));
451 dev->stats.rx_dropped++; 452 dev->stats.rx_dropped++;
452 dma_sync_single_for_device(&mp->myri_sdev->ofdev.dev, 453 dma_sync_single_for_device(&mp->myri_op->dev,
453 sbus_readl(&rxd->myri_scatters[0].addr), 454 sbus_readl(&rxd->myri_scatters[0].addr),
454 RX_ALLOC_SIZE, 455 RX_ALLOC_SIZE,
455 DMA_FROM_DEVICE); 456 DMA_FROM_DEVICE);
@@ -471,14 +472,14 @@ static void myri_rx(struct myri_eth *mp, struct net_device *dev)
471 DRX(("skb_alloc(FAILED) ")); 472 DRX(("skb_alloc(FAILED) "));
472 goto drop_it; 473 goto drop_it;
473 } 474 }
474 dma_unmap_single(&mp->myri_sdev->ofdev.dev, 475 dma_unmap_single(&mp->myri_op->dev,
475 sbus_readl(&rxd->myri_scatters[0].addr), 476 sbus_readl(&rxd->myri_scatters[0].addr),
476 RX_ALLOC_SIZE, 477 RX_ALLOC_SIZE,
477 DMA_FROM_DEVICE); 478 DMA_FROM_DEVICE);
478 mp->rx_skbs[index] = new_skb; 479 mp->rx_skbs[index] = new_skb;
479 new_skb->dev = dev; 480 new_skb->dev = dev;
480 skb_put(new_skb, RX_ALLOC_SIZE); 481 skb_put(new_skb, RX_ALLOC_SIZE);
481 dma_addr = dma_map_single(&mp->myri_sdev->ofdev.dev, 482 dma_addr = dma_map_single(&mp->myri_op->dev,
482 new_skb->data, 483 new_skb->data,
483 RX_ALLOC_SIZE, 484 RX_ALLOC_SIZE,
484 DMA_FROM_DEVICE); 485 DMA_FROM_DEVICE);
@@ -507,7 +508,7 @@ static void myri_rx(struct myri_eth *mp, struct net_device *dev)
507 508
508 /* Reuse original ring buffer. */ 509 /* Reuse original ring buffer. */
509 DRX(("reuse ")); 510 DRX(("reuse "));
510 dma_sync_single_for_device(&mp->myri_sdev->ofdev.dev, 511 dma_sync_single_for_device(&mp->myri_op->dev,
511 sbus_readl(&rxd->myri_scatters[0].addr), 512 sbus_readl(&rxd->myri_scatters[0].addr),
512 RX_ALLOC_SIZE, 513 RX_ALLOC_SIZE,
513 DMA_FROM_DEVICE); 514 DMA_FROM_DEVICE);
@@ -659,7 +660,7 @@ static int myri_start_xmit(struct sk_buff *skb, struct net_device *dev)
659 sbus_writew((skb->data[4] << 8) | skb->data[5], &txd->addr[3]); 660 sbus_writew((skb->data[4] << 8) | skb->data[5], &txd->addr[3]);
660 } 661 }
661 662
662 dma_addr = dma_map_single(&mp->myri_sdev->ofdev.dev, skb->data, 663 dma_addr = dma_map_single(&mp->myri_op->dev, skb->data,
663 len, DMA_TO_DEVICE); 664 len, DMA_TO_DEVICE);
664 sbus_writel(dma_addr, &txd->myri_gathers[0].addr); 665 sbus_writel(dma_addr, &txd->myri_gathers[0].addr);
665 sbus_writel(len, &txd->myri_gathers[0].len); 666 sbus_writel(len, &txd->myri_gathers[0].len);
@@ -899,30 +900,30 @@ static const struct header_ops myri_header_ops = {
899 .cache_update = myri_header_cache_update, 900 .cache_update = myri_header_cache_update,
900}; 901};
901 902
902static int __devinit myri_ether_init(struct sbus_dev *sdev) 903static int __devinit myri_sbus_probe(struct of_device *op, const struct of_device_id *match)
903{ 904{
904 static int num; 905 struct device_node *dp = op->node;
905 static unsigned version_printed; 906 static unsigned version_printed;
906 struct net_device *dev; 907 struct net_device *dev;
907 struct myri_eth *mp;
908 unsigned char prop_buf[32];
909 int i;
910 DECLARE_MAC_BUF(mac); 908 DECLARE_MAC_BUF(mac);
909 struct myri_eth *mp;
910 const void *prop;
911 static int num;
912 int i, len;
911 913
912 DET(("myri_ether_init(%p,%d):\n", sdev, num)); 914 DET(("myri_ether_init(%p,%d):\n", op, num));
913 dev = alloc_etherdev(sizeof(struct myri_eth)); 915 dev = alloc_etherdev(sizeof(struct myri_eth));
914
915 if (!dev) 916 if (!dev)
916 return -ENOMEM; 917 return -ENOMEM;
917 918
918 if (version_printed++ == 0) 919 if (version_printed++ == 0)
919 printk(version); 920 printk(version);
920 921
921 SET_NETDEV_DEV(dev, &sdev->ofdev.dev); 922 SET_NETDEV_DEV(dev, &op->dev);
922 923
923 mp = (struct myri_eth *) dev->priv; 924 mp = netdev_priv(dev);
924 spin_lock_init(&mp->irq_lock); 925 spin_lock_init(&mp->irq_lock);
925 mp->myri_sdev = sdev; 926 mp->myri_op = op;
926 927
927 /* Clean out skb arrays. */ 928 /* Clean out skb arrays. */
928 for (i = 0; i < (RX_RING_SIZE + 1); i++) 929 for (i = 0; i < (RX_RING_SIZE + 1); i++)
@@ -932,55 +933,44 @@ static int __devinit myri_ether_init(struct sbus_dev *sdev)
932 mp->tx_skbs[i] = NULL; 933 mp->tx_skbs[i] = NULL;
933 934
934 /* First check for EEPROM information. */ 935 /* First check for EEPROM information. */
935 i = prom_getproperty(sdev->prom_node, "myrinet-eeprom-info", 936 prop = of_get_property(dp, "myrinet-eeprom-info", &len);
936 (char *)&mp->eeprom, sizeof(struct myri_eeprom)); 937
937 DET(("prom_getprop(myrinet-eeprom-info) returns %d\n", i)); 938 if (prop)
938 if (i == 0 || i == -1) { 939 memcpy(&mp->eeprom, prop, sizeof(struct myri_eeprom));
940 if (!prop) {
939 /* No eeprom property, must cook up the values ourselves. */ 941 /* No eeprom property, must cook up the values ourselves. */
940 DET(("No EEPROM: ")); 942 DET(("No EEPROM: "));
941 mp->eeprom.bus_type = BUS_TYPE_SBUS; 943 mp->eeprom.bus_type = BUS_TYPE_SBUS;
942 mp->eeprom.cpuvers = prom_getintdefault(sdev->prom_node,"cpu_version",0); 944 mp->eeprom.cpuvers =
943 mp->eeprom.cval = prom_getintdefault(sdev->prom_node,"clock_value",0); 945 of_getintprop_default(dp, "cpu_version", 0);
944 mp->eeprom.ramsz = prom_getintdefault(sdev->prom_node,"sram_size",0); 946 mp->eeprom.cval =
945 DET(("cpuvers[%d] cval[%d] ramsz[%d]\n", mp->eeprom.cpuvers, 947 of_getintprop_default(dp, "clock_value", 0);
946 mp->eeprom.cval, mp->eeprom.ramsz)); 948 mp->eeprom.ramsz = of_getintprop_default(dp, "sram_size", 0);
947 if (mp->eeprom.cpuvers == 0) { 949 if (!mp->eeprom.cpuvers)
948 DET(("EEPROM: cpuvers was zero, setting to %04x\n",CPUVERS_2_3));
949 mp->eeprom.cpuvers = CPUVERS_2_3; 950 mp->eeprom.cpuvers = CPUVERS_2_3;
950 } 951 if (mp->eeprom.cpuvers < CPUVERS_3_0)
951 if (mp->eeprom.cpuvers < CPUVERS_3_0) {
952 DET(("EEPROM: cpuvers < CPUVERS_3_0, clockval set to zero.\n"));
953 mp->eeprom.cval = 0; 952 mp->eeprom.cval = 0;
954 } 953 if (!mp->eeprom.ramsz)
955 if (mp->eeprom.ramsz == 0) {
956 DET(("EEPROM: ramsz == 0, setting to 128k\n"));
957 mp->eeprom.ramsz = (128 * 1024); 954 mp->eeprom.ramsz = (128 * 1024);
958 } 955
959 i = prom_getproperty(sdev->prom_node, "myrinet-board-id", 956 prop = of_get_property(dp, "myrinet-board-id", &len);
960 &prop_buf[0], 10); 957 if (prop)
961 DET(("EEPROM: prom_getprop(myrinet-board-id) returns %d\n", i)); 958 memcpy(&mp->eeprom.id[0], prop, 6);
962 if ((i != 0) && (i != -1))
963 memcpy(&mp->eeprom.id[0], &prop_buf[0], 6);
964 else 959 else
965 set_boardid_from_idprom(mp, num); 960 set_boardid_from_idprom(mp, num);
966 i = prom_getproperty(sdev->prom_node, "fpga_version", 961
967 &mp->eeprom.fvers[0], 32); 962 prop = of_get_property(dp, "fpga_version", &len);
968 DET(("EEPROM: prom_getprop(fpga_version) returns %d\n", i)); 963 if (prop)
969 if (i == 0 || i == -1) 964 memcpy(&mp->eeprom.fvers[0], prop, 32);
965 else
970 memset(&mp->eeprom.fvers[0], 0, 32); 966 memset(&mp->eeprom.fvers[0], 0, 32);
971 967
972 if (mp->eeprom.cpuvers == CPUVERS_4_1) { 968 if (mp->eeprom.cpuvers == CPUVERS_4_1) {
973 DET(("EEPROM: cpuvers CPUVERS_4_1, ")); 969 if (mp->eeprom.ramsz == (128 * 1024))
974 if (mp->eeprom.ramsz == (128 * 1024)) {
975 DET(("ramsize 128k, setting to 256k, "));
976 mp->eeprom.ramsz = (256 * 1024); 970 mp->eeprom.ramsz = (256 * 1024);
977 } 971 if ((mp->eeprom.cval == 0x40414041) ||
978 if ((mp->eeprom.cval==0x40414041)||(mp->eeprom.cval==0x90449044)){ 972 (mp->eeprom.cval == 0x90449044))
979 DET(("changing cval from %08x to %08x ",
980 mp->eeprom.cval, 0x50e450e4));
981 mp->eeprom.cval = 0x50e450e4; 973 mp->eeprom.cval = 0x50e450e4;
982 }
983 DET(("\n"));
984 } 974 }
985 } 975 }
986#ifdef DEBUG_DETECT 976#ifdef DEBUG_DETECT
@@ -999,8 +989,8 @@ static int __devinit myri_ether_init(struct sbus_dev *sdev)
999 * XXX only a valid version for PCI cards? Ask feldy... 989 * XXX only a valid version for PCI cards? Ask feldy...
1000 */ 990 */
1001 DET(("Mapping regs for cpuvers < CPUVERS_4_0\n")); 991 DET(("Mapping regs for cpuvers < CPUVERS_4_0\n"));
1002 mp->regs = sbus_ioremap(&sdev->resource[0], 0, 992 mp->regs = of_ioremap(&op->resource[0], 0,
1003 mp->reg_size, "MyriCOM Regs"); 993 mp->reg_size, "MyriCOM Regs");
1004 if (!mp->regs) { 994 if (!mp->regs) {
1005 printk("MyriCOM: Cannot map MyriCOM registers.\n"); 995 printk("MyriCOM: Cannot map MyriCOM registers.\n");
1006 goto err; 996 goto err;
@@ -1009,13 +999,12 @@ static int __devinit myri_ether_init(struct sbus_dev *sdev)
1009 mp->lregs = mp->lanai + (0x10000 * 2); 999 mp->lregs = mp->lanai + (0x10000 * 2);
1010 } else { 1000 } else {
1011 DET(("Mapping regs for cpuvers >= CPUVERS_4_0\n")); 1001 DET(("Mapping regs for cpuvers >= CPUVERS_4_0\n"));
1012 mp->cregs = sbus_ioremap(&sdev->resource[0], 0, 1002 mp->cregs = of_ioremap(&op->resource[0], 0,
1013 PAGE_SIZE, "MyriCOM Control Regs"); 1003 PAGE_SIZE, "MyriCOM Control Regs");
1014 mp->lregs = sbus_ioremap(&sdev->resource[0], (256 * 1024), 1004 mp->lregs = of_ioremap(&op->resource[0], (256 * 1024),
1015 PAGE_SIZE, "MyriCOM LANAI Regs"); 1005 PAGE_SIZE, "MyriCOM LANAI Regs");
1016 mp->lanai = 1006 mp->lanai = of_ioremap(&op->resource[0], (512 * 1024),
1017 sbus_ioremap(&sdev->resource[0], (512 * 1024), 1007 mp->eeprom.ramsz, "MyriCOM SRAM");
1018 mp->eeprom.ramsz, "MyriCOM SRAM");
1019 } 1008 }
1020 DET(("Registers mapped: cregs[%p] lregs[%p] lanai[%p]\n", 1009 DET(("Registers mapped: cregs[%p] lregs[%p] lanai[%p]\n",
1021 mp->cregs, mp->lregs, mp->lanai)); 1010 mp->cregs, mp->lregs, mp->lanai));
@@ -1047,16 +1036,15 @@ static int __devinit myri_ether_init(struct sbus_dev *sdev)
1047 myri_reset_on(mp->cregs); 1036 myri_reset_on(mp->cregs);
1048 1037
1049 /* Get the supported DVMA burst sizes from our SBUS. */ 1038 /* Get the supported DVMA burst sizes from our SBUS. */
1050 mp->myri_bursts = prom_getintdefault(mp->myri_sdev->bus->prom_node, 1039 mp->myri_bursts = of_getintprop_default(dp->parent,
1051 "burst-sizes", 0x00); 1040 "burst-sizes", 0x00);
1052
1053 if (!sbus_can_burst64()) 1041 if (!sbus_can_burst64())
1054 mp->myri_bursts &= ~(DMA_BURST64); 1042 mp->myri_bursts &= ~(DMA_BURST64);
1055 1043
1056 DET(("MYRI bursts %02x\n", mp->myri_bursts)); 1044 DET(("MYRI bursts %02x\n", mp->myri_bursts));
1057 1045
1058 /* Encode SBUS interrupt level in second control register. */ 1046 /* Encode SBUS interrupt level in second control register. */
1059 i = prom_getint(sdev->prom_node, "interrupts"); 1047 i = of_getintprop_default(dp, "interrupts", 0);
1060 if (i == 0) 1048 if (i == 0)
1061 i = 4; 1049 i = 4;
1062 DET(("prom_getint(interrupts)==%d, irqlvl set to %04x\n", 1050 DET(("prom_getint(interrupts)==%d, irqlvl set to %04x\n",
@@ -1071,7 +1059,7 @@ static int __devinit myri_ether_init(struct sbus_dev *sdev)
1071 dev->tx_timeout = &myri_tx_timeout; 1059 dev->tx_timeout = &myri_tx_timeout;
1072 dev->watchdog_timeo = 5*HZ; 1060 dev->watchdog_timeo = 5*HZ;
1073 dev->set_multicast_list = &myri_set_multicast; 1061 dev->set_multicast_list = &myri_set_multicast;
1074 dev->irq = sdev->irqs[0]; 1062 dev->irq = op->irqs[0];
1075 1063
1076 /* Register interrupt handler now. */ 1064 /* Register interrupt handler now. */
1077 DET(("Requesting MYRIcom IRQ line.\n")); 1065 DET(("Requesting MYRIcom IRQ line.\n"));
@@ -1096,7 +1084,7 @@ static int __devinit myri_ether_init(struct sbus_dev *sdev)
1096 goto err_free_irq; 1084 goto err_free_irq;
1097 } 1085 }
1098 1086
1099 dev_set_drvdata(&sdev->ofdev.dev, mp); 1087 dev_set_drvdata(&op->dev, mp);
1100 1088
1101 num++; 1089 num++;
1102 1090
@@ -1113,17 +1101,9 @@ err:
1113 return -ENODEV; 1101 return -ENODEV;
1114} 1102}
1115 1103
1116 1104static int __devexit myri_sbus_remove(struct of_device *op)
1117static int __devinit myri_sbus_probe(struct of_device *dev, const struct of_device_id *match)
1118{
1119 struct sbus_dev *sdev = to_sbus_device(&dev->dev);
1120
1121 return myri_ether_init(sdev);
1122}
1123
1124static int __devexit myri_sbus_remove(struct of_device *dev)
1125{ 1105{
1126 struct myri_eth *mp = dev_get_drvdata(&dev->dev); 1106 struct myri_eth *mp = dev_get_drvdata(&op->dev);
1127 struct net_device *net_dev = mp->dev; 1107 struct net_device *net_dev = mp->dev;
1128 1108
1129 unregister_netdevice(net_dev); 1109 unregister_netdevice(net_dev);
@@ -1131,16 +1111,16 @@ static int __devexit myri_sbus_remove(struct of_device *dev)
1131 free_irq(net_dev->irq, net_dev); 1111 free_irq(net_dev->irq, net_dev);
1132 1112
1133 if (mp->eeprom.cpuvers < CPUVERS_4_0) { 1113 if (mp->eeprom.cpuvers < CPUVERS_4_0) {
1134 sbus_iounmap(mp->regs, mp->reg_size); 1114 of_iounmap(&op->resource[0], mp->regs, mp->reg_size);
1135 } else { 1115 } else {
1136 sbus_iounmap(mp->cregs, PAGE_SIZE); 1116 of_iounmap(&op->resource[0], mp->cregs, PAGE_SIZE);
1137 sbus_iounmap(mp->lregs, (256 * 1024)); 1117 of_iounmap(&op->resource[0], mp->lregs, (256 * 1024));
1138 sbus_iounmap(mp->lanai, (512 * 1024)); 1118 of_iounmap(&op->resource[0], mp->lanai, (512 * 1024));
1139 } 1119 }
1140 1120
1141 free_netdev(net_dev); 1121 free_netdev(net_dev);
1142 1122
1143 dev_set_drvdata(&dev->dev, NULL); 1123 dev_set_drvdata(&op->dev, NULL);
1144 1124
1145 return 0; 1125 return 0;
1146} 1126}
@@ -1166,7 +1146,7 @@ static struct of_platform_driver myri_sbus_driver = {
1166 1146
1167static int __init myri_sbus_init(void) 1147static int __init myri_sbus_init(void)
1168{ 1148{
1169 return of_register_driver(&myri_sbus_driver, &sbus_bus_type); 1149 return of_register_driver(&myri_sbus_driver, &of_bus_type);
1170} 1150}
1171 1151
1172static void __exit myri_sbus_exit(void) 1152static void __exit myri_sbus_exit(void)