aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ppc/pmac.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:49 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:49 -0400
commit07eb106f3a69400b628b7b6ca3464a1a8f847fa3 (patch)
tree02e3c23ff1356d6054f108f455f1b74000fa2f29 /drivers/ide/ppc/pmac.c
parent7b8797acd499d59ed03c7a5b98d82cdf054fd04d (diff)
ide-pmac: add ->init_dev method (take 4)
v2/3: * Build fixes from Stephen Rothwell. v4: * Fix ->noprobe setting. (From Benjamin Herrenschmidt) Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ppc/pmac.c')
-rw-r--r--drivers/ide/ppc/pmac.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index 9244b58e0548..4530b49e7dd0 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -941,7 +941,25 @@ static u8 pmac_ide_cable_detect(ide_hwif_t *hwif)
941 return ATA_CBL_PATA40; 941 return ATA_CBL_PATA40;
942} 942}
943 943
944static void pmac_ide_init_dev(ide_drive_t *drive)
945{
946 ide_hwif_t *hwif = drive->hwif;
947 pmac_ide_hwif_t *pmif =
948 (pmac_ide_hwif_t *)dev_get_drvdata(hwif->gendev.parent);
949
950 if (pmif->mediabay) {
951#ifdef CONFIG_PMAC_MEDIABAY
952 if (check_media_bay_by_base(pmif->regbase, MB_CD) == 0) {
953 drive->noprobe = 0;
954 return;
955 }
956#endif
957 drive->noprobe = 1;
958 }
959}
960
944static const struct ide_port_ops pmac_ide_ata6_port_ops = { 961static const struct ide_port_ops pmac_ide_ata6_port_ops = {
962 .init_dev = pmac_ide_init_dev,
945 .set_pio_mode = pmac_ide_set_pio_mode, 963 .set_pio_mode = pmac_ide_set_pio_mode,
946 .set_dma_mode = pmac_ide_set_dma_mode, 964 .set_dma_mode = pmac_ide_set_dma_mode,
947 .selectproc = pmac_ide_kauai_selectproc, 965 .selectproc = pmac_ide_kauai_selectproc,
@@ -949,6 +967,7 @@ static const struct ide_port_ops pmac_ide_ata6_port_ops = {
949}; 967};
950 968
951static const struct ide_port_ops pmac_ide_ata4_port_ops = { 969static const struct ide_port_ops pmac_ide_ata4_port_ops = {
970 .init_dev = pmac_ide_init_dev,
952 .set_pio_mode = pmac_ide_set_pio_mode, 971 .set_pio_mode = pmac_ide_set_pio_mode,
953 .set_dma_mode = pmac_ide_set_dma_mode, 972 .set_dma_mode = pmac_ide_set_dma_mode,
954 .selectproc = pmac_ide_selectproc, 973 .selectproc = pmac_ide_selectproc,
@@ -956,6 +975,7 @@ static const struct ide_port_ops pmac_ide_ata4_port_ops = {
956}; 975};
957 976
958static const struct ide_port_ops pmac_ide_port_ops = { 977static const struct ide_port_ops pmac_ide_port_ops = {
978 .init_dev = pmac_ide_init_dev,
959 .set_pio_mode = pmac_ide_set_pio_mode, 979 .set_pio_mode = pmac_ide_set_pio_mode,
960 .set_dma_mode = pmac_ide_set_dma_mode, 980 .set_dma_mode = pmac_ide_set_dma_mode,
961 .selectproc = pmac_ide_selectproc, 981 .selectproc = pmac_ide_selectproc,
@@ -1069,17 +1089,6 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw)
1069 hwif->index, model_name[pmif->kind], pmif->aapl_bus_id, 1089 hwif->index, model_name[pmif->kind], pmif->aapl_bus_id,
1070 pmif->mediabay ? " (mediabay)" : "", hwif->irq); 1090 pmif->mediabay ? " (mediabay)" : "", hwif->irq);
1071 1091
1072 if (pmif->mediabay) {
1073#ifdef CONFIG_PMAC_MEDIABAY
1074 if (check_media_bay_by_base(pmif->regbase, MB_CD)) {
1075#else
1076 if (1) {
1077#endif
1078 hwif->drives[0].noprobe = 1;
1079 hwif->drives[1].noprobe = 1;
1080 }
1081 }
1082
1083 idx[0] = hwif->index; 1092 idx[0] = hwif->index;
1084 1093
1085 ide_device_add(idx, &d); 1094 ide_device_add(idx, &d);