aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ppc
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 11:36:38 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 11:36:38 -0400
commitcb7500db0e94c61b79712bc081dd90da68a4a40c (patch)
treee56b553579544bb3e1105e07c3a7e10381baca31 /drivers/ide/ppc
parentb81c2266e36f6bdf0c7186d21b375e32d8929df8 (diff)
ide-mpc8xx: make m8xx_ide_init_ports() return an error value
* Make m8xx_ide_init_ports() return an error value. * Update mpc8xx_ide_probe() to setup/probe only ports for which m8xx_ide_init_ports() succedded. Cc: Vitaly Bordug <vitb@kernel.crashing.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ppc')
-rw-r--r--drivers/ide/ppc/mpc8xx.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/drivers/ide/ppc/mpc8xx.c b/drivers/ide/ppc/mpc8xx.c
index a784a97ca7ec..3f8539f1ccd3 100644
--- a/drivers/ide/ppc/mpc8xx.c
+++ b/drivers/ide/ppc/mpc8xx.c
@@ -127,7 +127,7 @@ static int pcmcia_schlvl = PCMCIA_SCHLVL;
127 * MPC8xx's internal PCMCIA interface 127 * MPC8xx's internal PCMCIA interface
128 */ 128 */
129#if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT) 129#if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT)
130static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port) 130static int __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
131{ 131{
132 unsigned long *p = hw->io_ports; 132 unsigned long *p = hw->io_ports;
133 int i; 133 int i;
@@ -236,7 +236,7 @@ static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
236 if (pcmp->pcmc_pipr & (M8XX_PCMCIA_CD1(_slot_)|M8XX_PCMCIA_CD2(_slot_))) { 236 if (pcmp->pcmc_pipr & (M8XX_PCMCIA_CD1(_slot_)|M8XX_PCMCIA_CD2(_slot_))) {
237 printk ("No card in slot %c: PIPR=%08x\n", 237 printk ("No card in slot %c: PIPR=%08x\n",
238 'A' + _slot_, (u32) pcmp->pcmc_pipr); 238 'A' + _slot_, (u32) pcmp->pcmc_pipr);
239 return; /* No card in slot */ 239 return -ENODEV; /* No card in slot */
240 } 240 }
241 241
242 check_ide_device (pcmcia_base); 242 check_ide_device (pcmcia_base);
@@ -279,9 +279,6 @@ static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
279 } 279 }
280#endif /* CONFIG_IDE_8xx_PCCARD */ 280#endif /* CONFIG_IDE_8xx_PCCARD */
281 281
282 ide_hwifs[data_port].pio_mask = ATA_PIO4;
283 ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode;
284
285 /* Enable Harddisk Interrupt, 282 /* Enable Harddisk Interrupt,
286 * and make it edge sensitive 283 * and make it edge sensitive
287 */ 284 */
@@ -296,6 +293,8 @@ static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
296 /* Enable falling edge irq */ 293 /* Enable falling edge irq */
297 pcmp->pcmc_per = 0x100000 >> (16 * _slot_); 294 pcmp->pcmc_per = 0x100000 >> (16 * _slot_);
298#endif /* CONFIG_IDE_8xx_PCCARD */ 295#endif /* CONFIG_IDE_8xx_PCCARD */
296
297 return 0;
299} 298}
300#endif /* CONFIG_IDE_8xx_PCCARD || CONFIG_IDE_8xx_DIRECT */ 299#endif /* CONFIG_IDE_8xx_PCCARD || CONFIG_IDE_8xx_DIRECT */
301 300
@@ -304,7 +303,7 @@ static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
304 * MPC8xx's internal PCMCIA interface 303 * MPC8xx's internal PCMCIA interface
305 */ 304 */
306#if defined(CONFIG_IDE_EXT_DIRECT) 305#if defined(CONFIG_IDE_EXT_DIRECT)
307static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port) 306static int __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
308{ 307{
309 unsigned long *p = hw->io_ports; 308 unsigned long *p = hw->io_ports;
310 int i; 309 int i;
@@ -357,15 +356,14 @@ static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
357 hw->irq = ioport_dsc[data_port].irq; 356 hw->irq = ioport_dsc[data_port].irq;
358 hw->ack_intr = (ide_ack_intr_t *)ide_interrupt_ack; 357 hw->ack_intr = (ide_ack_intr_t *)ide_interrupt_ack;
359 358
360 ide_hwifs[data_port].pio_mask = ATA_PIO4;
361 ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode;
362
363 /* Enable Harddisk Interrupt, 359 /* Enable Harddisk Interrupt,
364 * and make it edge sensitive 360 * and make it edge sensitive
365 */ 361 */
366 /* (11-18) Set edge detect for irq, no wakeup from low power mode */ 362 /* (11-18) Set edge detect for irq, no wakeup from low power mode */
367 ((immap_t *) IMAP_ADDR)->im_siu_conf.sc_siel |= 363 ((immap_t *) IMAP_ADDR)->im_siu_conf.sc_siel |=
368 (0x80000000 >> ioport_dsc[data_port].irq); 364 (0x80000000 >> ioport_dsc[data_port].irq);
365
366 return 0;
369} 367}
370#endif /* CONFIG_IDE_8xx_DIRECT */ 368#endif /* CONFIG_IDE_8xx_DIRECT */
371 369
@@ -794,14 +792,26 @@ static int __init mpc8xx_ide_probe(void)
794 792
795#ifdef IDE0_BASE_OFFSET 793#ifdef IDE0_BASE_OFFSET
796 memset(&hw, 0, sizeof(hw)); 794 memset(&hw, 0, sizeof(hw));
797 m8xx_ide_init_ports(&hw, 0); 795 if (!m8xx_ide_init_ports(&hw, 0)) {
798 ide_init_port_hw(&ide_hwifs[0], &hw); 796 ide_hwif_t *hwif = &ide_hwifs[0];
799 idx[0] = 0; 797
798 ide_init_port_hw(hwif, &hw);
799 hwif->pio_mask = ATA_PIO4;
800 hwif->set_pio_mode = m8xx_ide_set_pio_mode;
801
802 idx[0] = 0;
803 }
800#ifdef IDE1_BASE_OFFSET 804#ifdef IDE1_BASE_OFFSET
801 memset(&hw, 0, sizeof(hw)); 805 memset(&hw, 0, sizeof(hw));
802 m8xx_ide_init_ports(&hw, 1); 806 if (!m8xx_ide_init_ports(&hw, 1)) {
803 ide_init_port_hw(&ide_hwifs[1], &hw); 807 ide_hwif_t *mate = &ide_hwifs[1];
804 idx[1] = 1; 808
809 ide_init_port_hw(mate, &hw);
810 mate->pio_mask = ATA_PIO4;
811 mate->set_pio_mode = m8xx_ide_set_pio_mode;
812
813 idx[1] = 1;
814 }
805#endif 815#endif
806#endif 816#endif
807 817