aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ppc
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/ppc
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/ppc')
-rw-r--r--drivers/ide/ppc/pmac.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index 6a4b0d479897..36e4b9570746 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -1012,12 +1012,11 @@ pmac_ide_do_resume(ide_hwif_t *hwif)
1012 * rare machines unfortunately, but it's better this way. 1012 * rare machines unfortunately, but it's better this way.
1013 */ 1013 */
1014static int 1014static int
1015pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) 1015pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw)
1016{ 1016{
1017 struct device_node *np = pmif->node; 1017 struct device_node *np = pmif->node;
1018 const int *bidp; 1018 const int *bidp;
1019 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; 1019 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
1020 hw_regs_t hw;
1021 1020
1022 pmif->cable_80 = 0; 1021 pmif->cable_80 = 0;
1023 pmif->broken_dma = pmif->broken_dma_warn = 0; 1022 pmif->broken_dma = pmif->broken_dma_warn = 0;
@@ -1103,11 +1102,9 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
1103 /* Tell common code _not_ to mess with resources */ 1102 /* Tell common code _not_ to mess with resources */
1104 hwif->mmio = 1; 1103 hwif->mmio = 1;
1105 hwif->hwif_data = pmif; 1104 hwif->hwif_data = pmif;
1106 memset(&hw, 0, sizeof(hw)); 1105 hw->chipset = ide_pmac;
1107 pmac_ide_init_hwif_ports(&hw, pmif->regbase, 0, &hwif->irq); 1106 ide_init_port_hw(hwif, hw);
1108 memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports)); 1107 hwif->noprobe = pmif->mediabay;
1109 hwif->chipset = ide_pmac;
1110 hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET] || pmif->mediabay;
1111 hwif->hold = pmif->mediabay; 1108 hwif->hold = pmif->mediabay;
1112 hwif->cbl = pmif->cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40; 1109 hwif->cbl = pmif->cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40;
1113 hwif->drives[0].unmask = 1; 1110 hwif->drives[0].unmask = 1;
@@ -1163,6 +1160,7 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match)
1163 ide_hwif_t *hwif; 1160 ide_hwif_t *hwif;
1164 pmac_ide_hwif_t *pmif; 1161 pmac_ide_hwif_t *pmif;
1165 int i, rc; 1162 int i, rc;
1163 hw_regs_t hw;
1166 1164
1167 i = 0; 1165 i = 0;
1168 while (i < MAX_HWIFS && (ide_hwifs[i].io_ports[IDE_DATA_OFFSET] != 0 1166 while (i < MAX_HWIFS && (ide_hwifs[i].io_ports[IDE_DATA_OFFSET] != 0
@@ -1205,7 +1203,6 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match)
1205 regbase = (unsigned long) base; 1203 regbase = (unsigned long) base;
1206 1204
1207 hwif->pci_dev = mdev->bus->pdev; 1205 hwif->pci_dev = mdev->bus->pdev;
1208 hwif->gendev.parent = &mdev->ofdev.dev;
1209 1206
1210 pmif->mdev = mdev; 1207 pmif->mdev = mdev;
1211 pmif->node = mdev->ofdev.node; 1208 pmif->node = mdev->ofdev.node;
@@ -1223,7 +1220,12 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match)
1223#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ 1220#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
1224 dev_set_drvdata(&mdev->ofdev.dev, hwif); 1221 dev_set_drvdata(&mdev->ofdev.dev, hwif);
1225 1222
1226 rc = pmac_ide_setup_device(pmif, hwif); 1223 memset(&hw, 0, sizeof(hw));
1224 pmac_ide_init_hwif_ports(&hw, pmif->regbase, 0, NULL);
1225 hw.irq = irq;
1226 hw.dev = &mdev->ofdev.dev;
1227
1228 rc = pmac_ide_setup_device(pmif, hwif, &hw);
1227 if (rc != 0) { 1229 if (rc != 0) {
1228 /* The inteface is released to the common IDE layer */ 1230 /* The inteface is released to the common IDE layer */
1229 dev_set_drvdata(&mdev->ofdev.dev, NULL); 1231 dev_set_drvdata(&mdev->ofdev.dev, NULL);
@@ -1282,6 +1284,7 @@ pmac_ide_pci_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1282 void __iomem *base; 1284 void __iomem *base;
1283 unsigned long rbase, rlen; 1285 unsigned long rbase, rlen;
1284 int i, rc; 1286 int i, rc;
1287 hw_regs_t hw;
1285 1288
1286 np = pci_device_to_OF_node(pdev); 1289 np = pci_device_to_OF_node(pdev);
1287 if (np == NULL) { 1290 if (np == NULL) {
@@ -1315,7 +1318,6 @@ pmac_ide_pci_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1315 } 1318 }
1316 1319
1317 hwif->pci_dev = pdev; 1320 hwif->pci_dev = pdev;
1318 hwif->gendev.parent = &pdev->dev;
1319 pmif->mdev = NULL; 1321 pmif->mdev = NULL;
1320 pmif->node = np; 1322 pmif->node = np;
1321 1323
@@ -1332,7 +1334,12 @@ pmac_ide_pci_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1332 1334
1333 pci_set_drvdata(pdev, hwif); 1335 pci_set_drvdata(pdev, hwif);
1334 1336
1335 rc = pmac_ide_setup_device(pmif, hwif); 1337 memset(&hw, 0, sizeof(hw));
1338 pmac_ide_init_hwif_ports(&hw, pmif->regbase, 0, NULL);
1339 hw.irq = pdev->irq;
1340 hw.dev = &pdev->dev;
1341
1342 rc = pmac_ide_setup_device(pmif, hwif, &hw);
1336 if (rc != 0) { 1343 if (rc != 0) {
1337 /* The inteface is released to the common IDE layer */ 1344 /* The inteface is released to the common IDE layer */
1338 pci_set_drvdata(pdev, NULL); 1345 pci_set_drvdata(pdev, NULL);