+ /*
+ * First we look for Ebus-bases su's
+ */
+ for_each_ebus(ebus) {
+ for_each_ebusdev(dev, ebus) {
+ if (dev->prom_node == up->port_node) {
+ /*
+ * The EBus is broken on sparc; it delivers
+ * virtual addresses in resources. Oh well...
+ * This is correct on sparc64, though.
+ */
+ up->port.membase = (char *) dev->resource[0].start;
+ /*
+ * This is correct on both architectures.
+ */
+ up->port.mapbase = dev->resource[0].start;
+ up->port.irq = dev->irqs[0];
+ goto ebus_done;
+ }
+ }
+ }
+
+#ifdef CONFIG_SPARC64
+ for_each_isa(isa_br) {
+ for_each_isadev(isa_dev, isa_br) {
+ if (isa_dev->prom_node == up->port_node) {
+ /* Same on sparc64. Cool architecure... */
+ up->port.membase = (char *) isa_dev->resource.start;
+ up->port.mapbase = isa_dev->resource.start;
+ up->port.irq = isa_dev->irq;
+ goto ebus_done;
+ }
+ }
+ }
+#endif
+
+#ifdef CONFIG_SPARC64
+ /*
+ * Not on Ebus, bailing.
+ */
+ return;
+#else
+ /*
+ * Not on Ebus, must be OBIO.
+ */
+ if (prom_getproperty(up->port_node, "reg",
+ (char *)®0, sizeof(reg0)) == -1) {
+ prom_printf("sunsu: no \"reg\" property\n");
+ return;
+ }
+ prom_apply_obio_ranges(®0, 1);
+ if (reg0.which_io != 0) { /* Just in case... */
+ prom_printf("sunsu: bus number nonzero: 0x%x:%x\n",
+ reg0.which_io, reg0.phys_addr);
+ return;
+ }
+ up->port.mapbase = reg0.phys_addr;
+ if ((up->port.membase = ioremap(reg0.phys_addr, reg0.reg_size)) == 0) {
+ prom_printf("sunsu: Cannot map registers.\n");
+ return;
+ }
+
+ /*
+ * 0x20 is sun4m thing, Dave Redman heritage.
+ * See arch/sparc/kernel/irq.c.
+ */
+#define IRQ_4M(n) ((n)|0x20)
+
+ /*
+ * There is no intr property on MrCoffee, so hardwire it.
+ */
+ up->port.irq = IRQ_4M(13);
+#endif
+
+ebus_done:
+