aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/legacy
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-26 14:13:05 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-26 14:13:05 -0500
commit57c802e84f9c759c3d1794a9dbe81bc10444df62 (patch)
treee8774704b3394b12efbb787022cc11b48a13dec0 /drivers/ide/legacy
parent8f8e8483f667d79739007b25f0e59a540fb9fa51 (diff)
ide: add ide_init_port_hw() helper
* Add ide_init_port_hw() helper. * rapide.c: convert rapide_locate_hwif() to rapide_setup_ports() and use ide_init_port_hw(). * ide_platform.c: convert plat_ide_locate_hwif() to plat_ide_setup_ports() and use ide_init_port_hw(). * sgiioc4.c: use ide_init_port_hw(). * pmac.c: add 'hw_regs_t *hw' argument to pmac_ide_setup_device(), setup 'hw' in pmac_ide_{macio,pci}_attach() and use ide_init_port_hw() in pmac_ide_setup_device(). This patch is a preparation for the future changes in the IDE probing code. There should be no functionality changes caused by this patch. Cc: Russell King <rmk@arm.linux.org.uk> Cc: Anton Vorontsov <avorontsov@ru.mvista.com> Cc: Jeremy Higdon <jeremy@sgi.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/legacy')
-rw-r--r--drivers/ide/legacy/ide_platform.c55
1 files changed, 28 insertions, 27 deletions
diff --git a/drivers/ide/legacy/ide_platform.c b/drivers/ide/legacy/ide_platform.c
index 7bb79f53dac8..69a0fb0e564f 100644
--- a/drivers/ide/legacy/ide_platform.c
+++ b/drivers/ide/legacy/ide_platform.c
@@ -28,39 +28,27 @@ static struct {
28 int index; 28 int index;
29} hwif_prop; 29} hwif_prop;
30 30
31static ide_hwif_t *__devinit plat_ide_locate_hwif(void __iomem *base, 31static void __devinit plat_ide_setup_ports(hw_regs_t *hw,
32 void __iomem *ctrl, struct pata_platform_info *pdata, int irq, 32 void __iomem *base,
33 int mmio) 33 void __iomem *ctrl,
34 struct pata_platform_info *pdata,
35 int irq)
34{ 36{
35 unsigned long port = (unsigned long)base; 37 unsigned long port = (unsigned long)base;
36 ide_hwif_t *hwif = ide_find_port(port);
37 int i; 38 int i;
38 39
39 if (hwif == NULL) 40 hw->io_ports[IDE_DATA_OFFSET] = port;
40 goto out;
41
42 hwif->io_ports[IDE_DATA_OFFSET] = port;
43 41
44 port += (1 << pdata->ioport_shift); 42 port += (1 << pdata->ioport_shift);
45 for (i = IDE_ERROR_OFFSET; i <= IDE_STATUS_OFFSET; 43 for (i = IDE_ERROR_OFFSET; i <= IDE_STATUS_OFFSET;
46 i++, port += (1 << pdata->ioport_shift)) 44 i++, port += (1 << pdata->ioport_shift))
47 hwif->io_ports[i] = port; 45 hw->io_ports[i] = port;
48
49 hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl;
50 46
51 hwif->irq = irq; 47 hw->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl;
52 48
53 hwif->chipset = ide_generic; 49 hw->irq = irq;
54 50
55 if (mmio) { 51 hw->chipset = ide_generic;
56 hwif->mmio = 1;
57 default_hwif_mmiops(hwif);
58 }
59
60 hwif_prop.hwif = hwif;
61 hwif_prop.index = hwif->index;
62out:
63 return hwif;
64} 52}
65 53
66static int __devinit plat_ide_probe(struct platform_device *pdev) 54static int __devinit plat_ide_probe(struct platform_device *pdev)
@@ -71,6 +59,7 @@ static int __devinit plat_ide_probe(struct platform_device *pdev)
71 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; 59 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
72 int ret = 0; 60 int ret = 0;
73 int mmio = 0; 61 int mmio = 0;
62 hw_regs_t hw;
74 63
75 pdata = pdev->dev.platform_data; 64 pdata = pdev->dev.platform_data;
76 65
@@ -106,15 +95,27 @@ static int __devinit plat_ide_probe(struct platform_device *pdev)
106 res_alt->start, res_alt->end - res_alt->start + 1); 95 res_alt->start, res_alt->end - res_alt->start + 1);
107 } 96 }
108 97
109 hwif = plat_ide_locate_hwif(hwif_prop.plat_ide_mapbase, 98 hwif = ide_find_port((unsigned long)hwif_prop.plat_ide_mapbase);
110 hwif_prop.plat_ide_alt_mapbase, pdata, res_irq->start, mmio);
111
112 if (!hwif) { 99 if (!hwif) {
113 ret = -ENODEV; 100 ret = -ENODEV;
114 goto out; 101 goto out;
115 } 102 }
116 hwif->gendev.parent = &pdev->dev; 103
117 hwif->noprobe = 0; 104 memset(&hw, 0, sizeof(hw));
105 plat_ide_setup_ports(&hw, hwif_prop.plat_ide_mapbase,
106 hwif_prop.plat_ide_alt_mapbase,
107 pdata, res_irq->start);
108 hw.dev = &pdev->dev;
109
110 ide_init_port_hw(hwif, &hw);
111
112 if (mmio) {
113 hwif->mmio = 1;
114 default_hwif_mmiops(hwif);
115 }
116
117 hwif_prop.hwif = hwif;
118 hwif_prop.index = hwif->index;
118 119
119 idx[0] = hwif->index; 120 idx[0] = hwif->index;
120 121