hc
2024-05-11 297b60346df8beafee954a0fd7c2d64f33f3b9bc
kernel/arch/sparc/include/asm/floppy_64.h
....@@ -47,8 +47,9 @@
4747 static struct platform_device *floppy_op = NULL;
4848
4949 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);
5253 void (*fd_enable_dma) (void);
5354 void (*fd_disable_dma) (void);
5455 void (*fd_set_dma_mode) (int);
....@@ -62,8 +63,8 @@
6263
6364 static struct sun_floppy_ops sun_fdops;
6465
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)
6768 #define fd_enable_dma() sun_fdops.fd_enable_dma()
6869 #define fd_disable_dma() sun_fdops.fd_disable_dma()
6970 #define fd_request_dma() (0) /* nothing... */
....@@ -97,42 +98,43 @@
9798 /* No 64k boundary crossing problems on the Sparc. */
9899 #define CROSS_64KB(a,s) (0)
99100
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)
101102 {
102103 udelay(5);
103
- switch(port & 7) {
104
+ switch (reg) {
104105 default:
105
- printk("floppy: Asked to read unknown port %lx\n", port);
106
+ printk("floppy: Asked to read unknown port %x\n", reg);
106107 panic("floppy: Port bolixed.");
107
- case 4: /* FD_STATUS */
108
+ case FD_STATUS:
108109 return sbus_readb(&sun_fdc->status_82077) & ~STATUS_DMA;
109
- case 5: /* FD_DATA */
110
+ case FD_DATA:
110111 return sbus_readb(&sun_fdc->data_82077);
111
- case 7: /* FD_DIR */
112
+ case FD_DIR:
112113 /* XXX: Is DCL on 0x80 in sun4m? */
113114 return sbus_readb(&sun_fdc->dir_82077);
114115 }
115116 panic("sun_82072_fd_inb: How did I get here?");
116117 }
117118
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)
119121 {
120122 udelay(5);
121
- switch(port & 7) {
123
+ switch (reg) {
122124 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);
124126 panic("floppy: Port bolixed.");
125
- case 2: /* FD_DOR */
127
+ case FD_DOR:
126128 /* Happily, the 82077 has a real DOR register. */
127129 sbus_writeb(value, &sun_fdc->dor_82077);
128130 break;
129
- case 5: /* FD_DATA */
131
+ case FD_DATA:
130132 sbus_writeb(value, &sun_fdc->data_82077);
131133 break;
132
- case 7: /* FD_DCR */
134
+ case FD_DCR:
133135 sbus_writeb(value, &sun_fdc->dcr_82077);
134136 break;
135
- case 4: /* FD_STATUS */
137
+ case FD_DSR:
136138 sbus_writeb(value, &sun_fdc->status_82077);
137139 break;
138140 }
....@@ -298,19 +300,21 @@
298300
299301 irqreturn_t floppy_interrupt(int irq, void *dev_id);
300302
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)
302304 {
303305 udelay(5);
304
- return inb(port);
306
+ return inb(base + reg);
305307 }
306308
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)
308311 {
309312 udelay(5);
310
- outb(val, port);
313
+ outb(val, base + reg);
311314 }
312315
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)
314318 {
315319 udelay(5);
316320 /*
....@@ -320,16 +324,17 @@
320324 * this does not hurt correct hardware like the AXmp.
321325 * (Eddie, Sep 12 1998).
322326 */
323
- if (port == ((unsigned long)sun_fdc) + 2) {
327
+ if (reg == FD_DOR) {
324328 if (((val & 0x03) == sun_pci_broken_drive) && (val & 0x20)) {
325329 val |= 0x10;
326330 }
327331 }
328
- outb(val, port);
332
+ outb(val, base + reg);
329333 }
330334
331335 #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)
333338 {
334339 udelay(5);
335340 /*
....@@ -339,13 +344,13 @@
339344 * this does not hurt correct hardware like the AXmp.
340345 * (Eddie, Sep 12 1998).
341346 */
342
- if (port == ((unsigned long)sun_fdc) + 2) {
347
+ if (reg == FD_DOR) {
343348 if (((val & 0x03) == sun_pci_broken_drive) && (val & 0x10)) {
344349 val &= ~(0x03);
345350 val |= 0x21;
346351 }
347352 }
348
- outb(val, port);
353
+ outb(val, base + reg);
349354 }
350355 #endif /* PCI_FDC_SWAP_DRIVES */
351356
....@@ -528,9 +533,9 @@
528533
529534 static int __init ebus_fdthree_p(struct device_node *dp)
530535 {
531
- if (!strcmp(dp->name, "fdthree"))
536
+ if (of_node_name_eq(dp, "fdthree"))
532537 return 1;
533
- if (!strcmp(dp->name, "floppy")) {
538
+ if (of_node_name_eq(dp, "floppy")) {
534539 const char *compat;
535540
536541 compat = of_get_property(dp, "compatible", NULL);
....@@ -555,7 +560,7 @@
555560 op = NULL;
556561
557562 for_each_node_by_name(dp, "SUNW,fdtwo") {
558
- if (strcmp(dp->parent->name, "sbus"))
563
+ if (!of_node_name_eq(dp->parent, "sbus"))
559564 continue;
560565 op = of_find_device_by_node(dp);
561566 if (op)
....@@ -656,7 +661,7 @@
656661 */
657662 config = 0;
658663 for (dp = ebus_dp->child; dp; dp = dp->sibling) {
659
- if (!strcmp(dp->name, "ecpp")) {
664
+ if (of_node_name_eq(dp, "ecpp")) {
660665 struct platform_device *ecpp_op;
661666
662667 ecpp_op = of_find_device_by_node(dp);