aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ppc/pmac.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ppc/pmac.c')
-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);