aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ppc/mpc8xx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ppc/mpc8xx.c')
-rw-r--r--drivers/ide/ppc/mpc8xx.c58
1 files changed, 42 insertions, 16 deletions
diff --git a/drivers/ide/ppc/mpc8xx.c b/drivers/ide/ppc/mpc8xx.c
index a784a97ca7ec..467656f06ccc 100644
--- a/drivers/ide/ppc/mpc8xx.c
+++ b/drivers/ide/ppc/mpc8xx.c
@@ -36,6 +36,8 @@
36#include <asm/machdep.h> 36#include <asm/machdep.h>
37#include <asm/irq.h> 37#include <asm/irq.h>
38 38
39#define DRV_NAME "ide-mpc8xx"
40
39static int identify (volatile u8 *p); 41static int identify (volatile u8 *p);
40static void print_fixed (volatile u8 *p); 42static void print_fixed (volatile u8 *p);
41static void print_funcid (int func); 43static void print_funcid (int func);
@@ -127,7 +129,7 @@ static int pcmcia_schlvl = PCMCIA_SCHLVL;
127 * MPC8xx's internal PCMCIA interface 129 * MPC8xx's internal PCMCIA interface
128 */ 130 */
129#if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT) 131#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) 132static int __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
131{ 133{
132 unsigned long *p = hw->io_ports; 134 unsigned long *p = hw->io_ports;
133 int i; 135 int i;
@@ -182,6 +184,13 @@ static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
182 pcmcia_phy_base, pcmcia_phy_end, 184 pcmcia_phy_base, pcmcia_phy_end,
183 pcmcia_phy_end - pcmcia_phy_base); 185 pcmcia_phy_end - pcmcia_phy_base);
184 186
187 if (!request_mem_region(pcmcia_phy_base,
188 pcmcia_phy_end - pcmcia_phy_base,
189 DRV_NAME)) {
190 printk(KERN_ERR "%s: resources busy\n", DRV_NAME);
191 return -EBUSY;
192 }
193
185 pcmcia_base=(unsigned long)ioremap(pcmcia_phy_base, 194 pcmcia_base=(unsigned long)ioremap(pcmcia_phy_base,
186 pcmcia_phy_end-pcmcia_phy_base); 195 pcmcia_phy_end-pcmcia_phy_base);
187 196
@@ -236,7 +245,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_))) { 245 if (pcmp->pcmc_pipr & (M8XX_PCMCIA_CD1(_slot_)|M8XX_PCMCIA_CD2(_slot_))) {
237 printk ("No card in slot %c: PIPR=%08x\n", 246 printk ("No card in slot %c: PIPR=%08x\n",
238 'A' + _slot_, (u32) pcmp->pcmc_pipr); 247 'A' + _slot_, (u32) pcmp->pcmc_pipr);
239 return; /* No card in slot */ 248 return -ENODEV; /* No card in slot */
240 } 249 }
241 250
242 check_ide_device (pcmcia_base); 251 check_ide_device (pcmcia_base);
@@ -279,9 +288,6 @@ static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
279 } 288 }
280#endif /* CONFIG_IDE_8xx_PCCARD */ 289#endif /* CONFIG_IDE_8xx_PCCARD */
281 290
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, 291 /* Enable Harddisk Interrupt,
286 * and make it edge sensitive 292 * and make it edge sensitive
287 */ 293 */
@@ -296,6 +302,8 @@ static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
296 /* Enable falling edge irq */ 302 /* Enable falling edge irq */
297 pcmp->pcmc_per = 0x100000 >> (16 * _slot_); 303 pcmp->pcmc_per = 0x100000 >> (16 * _slot_);
298#endif /* CONFIG_IDE_8xx_PCCARD */ 304#endif /* CONFIG_IDE_8xx_PCCARD */
305
306 return 0;
299} 307}
300#endif /* CONFIG_IDE_8xx_PCCARD || CONFIG_IDE_8xx_DIRECT */ 308#endif /* CONFIG_IDE_8xx_PCCARD || CONFIG_IDE_8xx_DIRECT */
301 309
@@ -304,7 +312,7 @@ static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
304 * MPC8xx's internal PCMCIA interface 312 * MPC8xx's internal PCMCIA interface
305 */ 313 */
306#if defined(CONFIG_IDE_EXT_DIRECT) 314#if defined(CONFIG_IDE_EXT_DIRECT)
307static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port) 315static int __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
308{ 316{
309 unsigned long *p = hw->io_ports; 317 unsigned long *p = hw->io_ports;
310 int i; 318 int i;
@@ -327,7 +335,12 @@ static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
327 printk ("IDE phys mem : %08x...%08x (size %08x)\n", 335 printk ("IDE phys mem : %08x...%08x (size %08x)\n",
328 ide_phy_base, ide_phy_end, 336 ide_phy_base, ide_phy_end,
329 ide_phy_end - ide_phy_base); 337 ide_phy_end - ide_phy_base);
330 338
339 if (!request_mem_region(ide_phy_base, 0x200, DRV_NAME)) {
340 printk(KERN_ERR "%s: resources busy\n", DRV_NAME);
341 return -EBUSY;
342 }
343
331 ide_base=(unsigned long)ioremap(ide_phy_base, 344 ide_base=(unsigned long)ioremap(ide_phy_base,
332 ide_phy_end-ide_phy_base); 345 ide_phy_end-ide_phy_base);
333 346
@@ -357,15 +370,14 @@ static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
357 hw->irq = ioport_dsc[data_port].irq; 370 hw->irq = ioport_dsc[data_port].irq;
358 hw->ack_intr = (ide_ack_intr_t *)ide_interrupt_ack; 371 hw->ack_intr = (ide_ack_intr_t *)ide_interrupt_ack;
359 372
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, 373 /* Enable Harddisk Interrupt,
364 * and make it edge sensitive 374 * and make it edge sensitive
365 */ 375 */
366 /* (11-18) Set edge detect for irq, no wakeup from low power mode */ 376 /* (11-18) Set edge detect for irq, no wakeup from low power mode */
367 ((immap_t *) IMAP_ADDR)->im_siu_conf.sc_siel |= 377 ((immap_t *) IMAP_ADDR)->im_siu_conf.sc_siel |=
368 (0x80000000 >> ioport_dsc[data_port].irq); 378 (0x80000000 >> ioport_dsc[data_port].irq);
379
380 return 0;
369} 381}
370#endif /* CONFIG_IDE_8xx_DIRECT */ 382#endif /* CONFIG_IDE_8xx_DIRECT */
371 383
@@ -794,14 +806,28 @@ static int __init mpc8xx_ide_probe(void)
794 806
795#ifdef IDE0_BASE_OFFSET 807#ifdef IDE0_BASE_OFFSET
796 memset(&hw, 0, sizeof(hw)); 808 memset(&hw, 0, sizeof(hw));
797 m8xx_ide_init_ports(&hw, 0); 809 if (!m8xx_ide_init_ports(&hw, 0)) {
798 ide_init_port_hw(&ide_hwifs[0], &hw); 810 ide_hwif_t *hwif = &ide_hwifs[0];
799 idx[0] = 0; 811
812 ide_init_port_hw(hwif, &hw);
813 hwif->mmio = 1;
814 hwif->pio_mask = ATA_PIO4;
815 hwif->set_pio_mode = m8xx_ide_set_pio_mode;
816
817 idx[0] = 0;
818 }
800#ifdef IDE1_BASE_OFFSET 819#ifdef IDE1_BASE_OFFSET
801 memset(&hw, 0, sizeof(hw)); 820 memset(&hw, 0, sizeof(hw));
802 m8xx_ide_init_ports(&hw, 1); 821 if (!m8xx_ide_init_ports(&hw, 1)) {
803 ide_init_port_hw(&ide_hwifs[1], &hw); 822 ide_hwif_t *mate = &ide_hwifs[1];
804 idx[1] = 1; 823
824 ide_init_port_hw(mate, &hw);
825 mate->mmio = 1;
826 mate->pio_mask = ATA_PIO4;
827 mate->set_pio_mode = m8xx_ide_set_pio_mode;
828
829 idx[1] = 1;
830 }
805#endif 831#endif
806#endif 832#endif
807 833