aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/legacy
diff options
context:
space:
mode:
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