aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/include/asm/floppy_64.h
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-08-27 04:55:54 -0400
committerDavid S. Miller <davem@davemloft.net>2008-08-29 05:15:01 -0400
commit10a104f9c591c3b1175bbb03ecb0bc8f2a4a16ee (patch)
treecf792205a9a827ed53d45b0ff2f2df76cf8df017 /arch/sparc/include/asm/floppy_64.h
parent237f8aafa348d56e6ad24c49ebd23bd927fedb31 (diff)
sparc64: Convert SBUS floppy probing to use OF device objects.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/include/asm/floppy_64.h')
-rw-r--r--arch/sparc/include/asm/floppy_64.h45
1 files changed, 27 insertions, 18 deletions
diff --git a/arch/sparc/include/asm/floppy_64.h b/arch/sparc/include/asm/floppy_64.h
index c39db1060bc7..d8fb0602745e 100644
--- a/arch/sparc/include/asm/floppy_64.h
+++ b/arch/sparc/include/asm/floppy_64.h
@@ -1,6 +1,6 @@
1/* floppy.h: Sparc specific parts of the Floppy driver. 1/* floppy.h: Sparc specific parts of the Floppy driver.
2 * 2 *
3 * Copyright (C) 1996, 2007 David S. Miller (davem@davemloft.net) 3 * Copyright (C) 1996, 2007, 2008 David S. Miller (davem@davemloft.net)
4 * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) 4 * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
5 * 5 *
6 * Ultra/PCI support added: Sep 1997 Eddie C. Dost (ecd@skynet.be) 6 * Ultra/PCI support added: Sep 1997 Eddie C. Dost (ecd@skynet.be)
@@ -11,6 +11,8 @@
11 11
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/pci.h> 13#include <linux/pci.h>
14#include <linux/of.h>
15#include <linux/of_device.h>
14 16
15#include <asm/page.h> 17#include <asm/page.h>
16#include <asm/pgtable.h> 18#include <asm/pgtable.h>
@@ -18,7 +20,6 @@
18#include <asm/idprom.h> 20#include <asm/idprom.h>
19#include <asm/oplib.h> 21#include <asm/oplib.h>
20#include <asm/auxio.h> 22#include <asm/auxio.h>
21#include <asm/sbus.h>
22#include <asm/irq.h> 23#include <asm/irq.h>
23 24
24 25
@@ -50,7 +51,7 @@ struct sun_flpy_controller {
50/* You'll only ever find one controller on an Ultra anyways. */ 51/* You'll only ever find one controller on an Ultra anyways. */
51static struct sun_flpy_controller *sun_fdc = (struct sun_flpy_controller *)-1; 52static struct sun_flpy_controller *sun_fdc = (struct sun_flpy_controller *)-1;
52unsigned long fdc_status; 53unsigned long fdc_status;
53static struct sbus_dev *floppy_sdev = NULL; 54static struct of_device *floppy_op = NULL;
54 55
55struct sun_floppy_ops { 56struct sun_floppy_ops {
56 unsigned char (*fd_inb) (unsigned long port); 57 unsigned char (*fd_inb) (unsigned long port);
@@ -559,22 +560,28 @@ static int __init ebus_fdthree_p(struct linux_ebus_device *edev)
559 560
560static unsigned long __init sun_floppy_init(void) 561static unsigned long __init sun_floppy_init(void)
561{ 562{
562 char state[128];
563 struct sbus_bus *bus;
564 struct sbus_dev *sdev = NULL;
565 static int initialized = 0; 563 static int initialized = 0;
564 struct device_node *dp;
565 struct of_device *op;
566 const char *prop;
567 char state[128];
566 568
567 if (initialized) 569 if (initialized)
568 return sun_floppy_types[0]; 570 return sun_floppy_types[0];
569 initialized = 1; 571 initialized = 1;
570 572
571 for_all_sbusdev (sdev, bus) { 573 op = NULL;
572 if (!strcmp(sdev->prom_name, "SUNW,fdtwo")) 574
575 for_each_node_by_name(dp, "SUNW,fdtwo") {
576 if (strcmp(dp->parent->name, "sbus"))
577 continue;
578 op = of_find_device_by_node(dp);
579 if (op)
573 break; 580 break;
574 } 581 }
575 if(sdev) { 582 if (op) {
576 floppy_sdev = sdev; 583 floppy_op = op;
577 FLOPPY_IRQ = sdev->irqs[0]; 584 FLOPPY_IRQ = op->irqs[0];
578 } else { 585 } else {
579#ifdef CONFIG_PCI 586#ifdef CONFIG_PCI
580 struct linux_ebus *ebus; 587 struct linux_ebus *ebus;
@@ -593,7 +600,9 @@ static unsigned long __init sun_floppy_init(void)
593 if (!edev) 600 if (!edev)
594 return 0; 601 return 0;
595 602
596 state_prop = of_get_property(edev->prom_node, "status", NULL); 603 op = &edev->ofdev;
604
605 state_prop = of_get_property(op->node, "status", NULL);
597 if (state_prop && !strncmp(state_prop, "disabled", 8)) 606 if (state_prop && !strncmp(state_prop, "disabled", 8))
598 return 0; 607 return 0;
599 608
@@ -720,22 +729,22 @@ static unsigned long __init sun_floppy_init(void)
720 return 0; 729 return 0;
721#endif 730#endif
722 } 731 }
723 prom_getproperty(sdev->prom_node, "status", state, sizeof(state)); 732 prop = of_get_property(op->node, "status", NULL);
724 if(!strncmp(state, "disabled", 8)) 733 if (prop && !strncmp(state, "disabled", 8))
725 return 0; 734 return 0;
726 735
727 /* 736 /*
728 * We cannot do sbus_ioremap here: it does request_region, 737 * We cannot do of_ioremap here: it does request_region,
729 * which the generic floppy driver tries to do once again. 738 * which the generic floppy driver tries to do once again.
730 * But we must use the sdev resource values as they have 739 * But we must use the sdev resource values as they have
731 * had parent ranges applied. 740 * had parent ranges applied.
732 */ 741 */
733 sun_fdc = (struct sun_flpy_controller *) 742 sun_fdc = (struct sun_flpy_controller *)
734 (sdev->resource[0].start + 743 (op->resource[0].start +
735 ((sdev->resource[0].flags & 0x1ffUL) << 32UL)); 744 ((op->resource[0].flags & 0x1ffUL) << 32UL));
736 745
737 /* Last minute sanity check... */ 746 /* Last minute sanity check... */
738 if(sbus_readb(&sun_fdc->status1_82077) == 0xff) { 747 if (sbus_readb(&sun_fdc->status1_82077) == 0xff) {
739 sun_fdc = (struct sun_flpy_controller *)-1; 748 sun_fdc = (struct sun_flpy_controller *)-1;
740 return 0; 749 return 0;
741 } 750 }