.. | .. |
---|
47 | 47 | static struct platform_device *floppy_op = NULL; |
---|
48 | 48 | |
---|
49 | 49 | struct sun_floppy_ops { |
---|
50 | | - unsigned char (*fd_inb) (unsigned long port); |
---|
51 | | - void (*fd_outb) (unsigned char value, unsigned long port); |
---|
| 50 | + unsigned char (*fd_inb) (unsigned long port, unsigned int reg); |
---|
| 51 | + void (*fd_outb) (unsigned char value, unsigned long base, |
---|
| 52 | + unsigned int reg); |
---|
52 | 53 | void (*fd_enable_dma) (void); |
---|
53 | 54 | void (*fd_disable_dma) (void); |
---|
54 | 55 | void (*fd_set_dma_mode) (int); |
---|
.. | .. |
---|
62 | 63 | |
---|
63 | 64 | static struct sun_floppy_ops sun_fdops; |
---|
64 | 65 | |
---|
65 | | -#define fd_inb(port) sun_fdops.fd_inb(port) |
---|
66 | | -#define fd_outb(value,port) sun_fdops.fd_outb(value,port) |
---|
| 66 | +#define fd_inb(base, reg) sun_fdops.fd_inb(base, reg) |
---|
| 67 | +#define fd_outb(value, base, reg) sun_fdops.fd_outb(value, base, reg) |
---|
67 | 68 | #define fd_enable_dma() sun_fdops.fd_enable_dma() |
---|
68 | 69 | #define fd_disable_dma() sun_fdops.fd_disable_dma() |
---|
69 | 70 | #define fd_request_dma() (0) /* nothing... */ |
---|
.. | .. |
---|
97 | 98 | /* No 64k boundary crossing problems on the Sparc. */ |
---|
98 | 99 | #define CROSS_64KB(a,s) (0) |
---|
99 | 100 | |
---|
100 | | -static unsigned char sun_82077_fd_inb(unsigned long port) |
---|
| 101 | +static unsigned char sun_82077_fd_inb(unsigned long base, unsigned int reg) |
---|
101 | 102 | { |
---|
102 | 103 | udelay(5); |
---|
103 | | - switch(port & 7) { |
---|
| 104 | + switch (reg) { |
---|
104 | 105 | default: |
---|
105 | | - printk("floppy: Asked to read unknown port %lx\n", port); |
---|
| 106 | + printk("floppy: Asked to read unknown port %x\n", reg); |
---|
106 | 107 | panic("floppy: Port bolixed."); |
---|
107 | | - case 4: /* FD_STATUS */ |
---|
| 108 | + case FD_STATUS: |
---|
108 | 109 | return sbus_readb(&sun_fdc->status_82077) & ~STATUS_DMA; |
---|
109 | | - case 5: /* FD_DATA */ |
---|
| 110 | + case FD_DATA: |
---|
110 | 111 | return sbus_readb(&sun_fdc->data_82077); |
---|
111 | | - case 7: /* FD_DIR */ |
---|
| 112 | + case FD_DIR: |
---|
112 | 113 | /* XXX: Is DCL on 0x80 in sun4m? */ |
---|
113 | 114 | return sbus_readb(&sun_fdc->dir_82077); |
---|
114 | 115 | } |
---|
115 | 116 | panic("sun_82072_fd_inb: How did I get here?"); |
---|
116 | 117 | } |
---|
117 | 118 | |
---|
118 | | -static void sun_82077_fd_outb(unsigned char value, unsigned long port) |
---|
| 119 | +static void sun_82077_fd_outb(unsigned char value, unsigned long base, |
---|
| 120 | + unsigned int reg) |
---|
119 | 121 | { |
---|
120 | 122 | udelay(5); |
---|
121 | | - switch(port & 7) { |
---|
| 123 | + switch (reg) { |
---|
122 | 124 | default: |
---|
123 | | - printk("floppy: Asked to write to unknown port %lx\n", port); |
---|
| 125 | + printk("floppy: Asked to write to unknown port %x\n", reg); |
---|
124 | 126 | panic("floppy: Port bolixed."); |
---|
125 | | - case 2: /* FD_DOR */ |
---|
| 127 | + case FD_DOR: |
---|
126 | 128 | /* Happily, the 82077 has a real DOR register. */ |
---|
127 | 129 | sbus_writeb(value, &sun_fdc->dor_82077); |
---|
128 | 130 | break; |
---|
129 | | - case 5: /* FD_DATA */ |
---|
| 131 | + case FD_DATA: |
---|
130 | 132 | sbus_writeb(value, &sun_fdc->data_82077); |
---|
131 | 133 | break; |
---|
132 | | - case 7: /* FD_DCR */ |
---|
| 134 | + case FD_DCR: |
---|
133 | 135 | sbus_writeb(value, &sun_fdc->dcr_82077); |
---|
134 | 136 | break; |
---|
135 | | - case 4: /* FD_STATUS */ |
---|
| 137 | + case FD_DSR: |
---|
136 | 138 | sbus_writeb(value, &sun_fdc->status_82077); |
---|
137 | 139 | break; |
---|
138 | 140 | } |
---|
.. | .. |
---|
298 | 300 | |
---|
299 | 301 | irqreturn_t floppy_interrupt(int irq, void *dev_id); |
---|
300 | 302 | |
---|
301 | | -static unsigned char sun_pci_fd_inb(unsigned long port) |
---|
| 303 | +static unsigned char sun_pci_fd_inb(unsigned long base, unsigned int reg) |
---|
302 | 304 | { |
---|
303 | 305 | udelay(5); |
---|
304 | | - return inb(port); |
---|
| 306 | + return inb(base + reg); |
---|
305 | 307 | } |
---|
306 | 308 | |
---|
307 | | -static void sun_pci_fd_outb(unsigned char val, unsigned long port) |
---|
| 309 | +static void sun_pci_fd_outb(unsigned char val, unsigned long base, |
---|
| 310 | + unsigned int reg) |
---|
308 | 311 | { |
---|
309 | 312 | udelay(5); |
---|
310 | | - outb(val, port); |
---|
| 313 | + outb(val, base + reg); |
---|
311 | 314 | } |
---|
312 | 315 | |
---|
313 | | -static void sun_pci_fd_broken_outb(unsigned char val, unsigned long port) |
---|
| 316 | +static void sun_pci_fd_broken_outb(unsigned char val, unsigned long base, |
---|
| 317 | + unsigned int reg) |
---|
314 | 318 | { |
---|
315 | 319 | udelay(5); |
---|
316 | 320 | /* |
---|
.. | .. |
---|
320 | 324 | * this does not hurt correct hardware like the AXmp. |
---|
321 | 325 | * (Eddie, Sep 12 1998). |
---|
322 | 326 | */ |
---|
323 | | - if (port == ((unsigned long)sun_fdc) + 2) { |
---|
| 327 | + if (reg == FD_DOR) { |
---|
324 | 328 | if (((val & 0x03) == sun_pci_broken_drive) && (val & 0x20)) { |
---|
325 | 329 | val |= 0x10; |
---|
326 | 330 | } |
---|
327 | 331 | } |
---|
328 | | - outb(val, port); |
---|
| 332 | + outb(val, base + reg); |
---|
329 | 333 | } |
---|
330 | 334 | |
---|
331 | 335 | #ifdef PCI_FDC_SWAP_DRIVES |
---|
332 | | -static void sun_pci_fd_lde_broken_outb(unsigned char val, unsigned long port) |
---|
| 336 | +static void sun_pci_fd_lde_broken_outb(unsigned char val, unsigned long base, |
---|
| 337 | + unsigned int reg) |
---|
333 | 338 | { |
---|
334 | 339 | udelay(5); |
---|
335 | 340 | /* |
---|
.. | .. |
---|
339 | 344 | * this does not hurt correct hardware like the AXmp. |
---|
340 | 345 | * (Eddie, Sep 12 1998). |
---|
341 | 346 | */ |
---|
342 | | - if (port == ((unsigned long)sun_fdc) + 2) { |
---|
| 347 | + if (reg == FD_DOR) { |
---|
343 | 348 | if (((val & 0x03) == sun_pci_broken_drive) && (val & 0x10)) { |
---|
344 | 349 | val &= ~(0x03); |
---|
345 | 350 | val |= 0x21; |
---|
346 | 351 | } |
---|
347 | 352 | } |
---|
348 | | - outb(val, port); |
---|
| 353 | + outb(val, base + reg); |
---|
349 | 354 | } |
---|
350 | 355 | #endif /* PCI_FDC_SWAP_DRIVES */ |
---|
351 | 356 | |
---|
.. | .. |
---|
528 | 533 | |
---|
529 | 534 | static int __init ebus_fdthree_p(struct device_node *dp) |
---|
530 | 535 | { |
---|
531 | | - if (!strcmp(dp->name, "fdthree")) |
---|
| 536 | + if (of_node_name_eq(dp, "fdthree")) |
---|
532 | 537 | return 1; |
---|
533 | | - if (!strcmp(dp->name, "floppy")) { |
---|
| 538 | + if (of_node_name_eq(dp, "floppy")) { |
---|
534 | 539 | const char *compat; |
---|
535 | 540 | |
---|
536 | 541 | compat = of_get_property(dp, "compatible", NULL); |
---|
.. | .. |
---|
555 | 560 | op = NULL; |
---|
556 | 561 | |
---|
557 | 562 | for_each_node_by_name(dp, "SUNW,fdtwo") { |
---|
558 | | - if (strcmp(dp->parent->name, "sbus")) |
---|
| 563 | + if (!of_node_name_eq(dp->parent, "sbus")) |
---|
559 | 564 | continue; |
---|
560 | 565 | op = of_find_device_by_node(dp); |
---|
561 | 566 | if (op) |
---|
.. | .. |
---|
656 | 661 | */ |
---|
657 | 662 | config = 0; |
---|
658 | 663 | for (dp = ebus_dp->child; dp; dp = dp->sibling) { |
---|
659 | | - if (!strcmp(dp->name, "ecpp")) { |
---|
| 664 | + if (of_node_name_eq(dp, "ecpp")) { |
---|
660 | 665 | struct platform_device *ecpp_op; |
---|
661 | 666 | |
---|
662 | 667 | ecpp_op = of_find_device_by_node(dp); |
---|