2 * linux/drivers/ide/ppc/ide-m8xx.c
4 * Copyright (C) 2000, 2001 Wolfgang Denk, wd@denx.de
5 * Modified for direct IDE interface
6 * by Thomas Lange, thomas@corelatus.com
7 * Modified for direct IDE interface on 8xx without using the PCMCIA
9 * by Steven.Scholz@imc-berlin.de
10 * Moved out of arch/ppc/kernel/m8xx_setup.c, other minor cleanups
11 * by Mathew Locke <mattl@mvista.com>
14 #include <linux/config.h>
15 #include <linux/errno.h>
16 #include <linux/sched.h>
17 #include <linux/kernel.h>
19 #include <linux/stddef.h>
20 #include <linux/unistd.h>
21 #include <linux/ptrace.h>
22 #include <linux/slab.h>
23 #include <linux/user.h>
24 #include <linux/a.out.h>
25 #include <linux/tty.h>
26 #include <linux/major.h>
27 #include <linux/interrupt.h>
28 #include <linux/reboot.h>
29 #include <linux/init.h>
30 #include <linux/ioport.h>
31 #include <linux/ide.h>
32 #include <linux/bootmem.h>
34 #include <asm/mpc8xx.h>
36 #include <asm/processor.h>
37 #include <asm/residual.h>
39 #include <asm/pgtable.h>
41 #include <asm/8xx_immap.h>
42 #include <asm/machdep.h>
45 static int identify (volatile u8
*p
);
46 static void print_fixed (volatile u8
*p
);
47 static void print_funcid (int func
);
48 static int check_ide_device (unsigned long base
);
50 static void ide_interrupt_ack (void *dev
);
51 static void m8xx_ide_tuneproc(ide_drive_t
*drive
, u8 pio
);
53 typedef struct ide_ioport_desc
{
54 unsigned long base_off
; /* Offset to PCMCIA memory */
55 unsigned long reg_off
[IDE_NR_PORTS
]; /* controller register offsets */
59 ide_ioport_desc_t ioport_dsc
[MAX_HWIFS
] = {
60 #ifdef IDE0_BASE_OFFSET
64 IDE0_ERROR_REG_OFFSET
,
65 IDE0_NSECTOR_REG_OFFSET
,
66 IDE0_SECTOR_REG_OFFSET
,
69 IDE0_SELECT_REG_OFFSET
,
70 IDE0_STATUS_REG_OFFSET
,
71 IDE0_CONTROL_REG_OFFSET
,
76 #ifdef IDE1_BASE_OFFSET
80 IDE1_ERROR_REG_OFFSET
,
81 IDE1_NSECTOR_REG_OFFSET
,
82 IDE1_SECTOR_REG_OFFSET
,
85 IDE1_SELECT_REG_OFFSET
,
86 IDE1_STATUS_REG_OFFSET
,
87 IDE1_CONTROL_REG_OFFSET
,
92 #endif /* IDE1_BASE_OFFSET */
93 #endif /* IDE0_BASE_OFFSET */
96 ide_pio_timings_t ide_pio_clocks
[6];
97 int hold_time
[6] = {30, 20, 15, 10, 10, 10 }; /* PIO Mode 5 with IORDY (nonstandard) */
100 * Warning: only 1 (ONE) PCMCIA slot supported here,
101 * which must be correctly initialized by the firmware (PPCBoot).
103 static int _slot_
= -1; /* will be read from PCMCIA registers */
105 /* Make clock cycles and always round up */
106 #define PCMCIA_MK_CLKS( t, T ) (( (t) * ((T)/1000000) + 999U ) / 1000U )
114 m8xx_ide_default_irq(unsigned long base
)
116 #ifdef CONFIG_BLK_DEV_MPC8xx_IDE
117 if (base
>= MAX_HWIFS
)
120 printk("[%d] m8xx_ide_default_irq %d\n",__LINE__
,ioport_dsc
[base
].irq
);
122 return (ioport_dsc
[base
].irq
);
129 m8xx_ide_default_io_base(int index
)
134 #define M8XX_PCMCIA_CD2(slot) (0x10000000 >> (slot << 4))
135 #define M8XX_PCMCIA_CD1(slot) (0x08000000 >> (slot << 4))
138 * The TQM850L hardware has two pins swapped! Grrrrgh!
140 #ifdef CONFIG_TQM850L
141 #define __MY_PCMCIA_GCRX_CXRESET PCMCIA_GCRX_CXOE
142 #define __MY_PCMCIA_GCRX_CXOE PCMCIA_GCRX_CXRESET
144 #define __MY_PCMCIA_GCRX_CXRESET PCMCIA_GCRX_CXRESET
145 #define __MY_PCMCIA_GCRX_CXOE PCMCIA_GCRX_CXOE
148 #if defined(CONFIG_BLK_DEV_MPC8xx_IDE) && defined(CONFIG_IDE_8xx_PCCARD)
149 #define PCMCIA_SCHLVL IDE0_INTERRUPT /* Status Change Interrupt Level */
150 static int pcmcia_schlvl
= PCMCIA_SCHLVL
;
154 * See include/linux/ide.h for definition of hw_regs_t (p, base)
158 * m8xx_ide_init_hwif_ports for a direct IDE interface _using_
160 #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT)
162 m8xx_ide_init_hwif_ports(hw_regs_t
*hw
, unsigned long data_port
,
163 unsigned long ctrl_port
, int *irq
)
165 unsigned long *p
= hw
->io_ports
;
172 volatile pcmcia_win_t
*win
;
173 volatile pcmconf8xx_t
*pcmp
;
178 static unsigned long pcmcia_base
= 0;
185 pcmp
= (pcmconf8xx_t
*)(&(((immap_t
*)IMAP_ADDR
)->im_pcmcia
));
189 * Read out PCMCIA registers. Since the reset values
190 * are undefined, we sure hope that they have been
194 /* Scan all registers for valid settings */
195 pcmcia_phy_base
= 0xFFFFFFFF;
197 /* br0 is start of brX and orX regs */
198 win
= (pcmcia_win_t
*) \
199 (&(((immap_t
*)IMAP_ADDR
)->im_pcmcia
.pcmc_pbr0
));
200 for (i
= 0; i
< 8; i
++) {
201 if (win
->or & 1) { /* This bank is marked as valid */
202 if (win
->br
< pcmcia_phy_base
) {
203 pcmcia_phy_base
= win
->br
;
205 if ((win
->br
+ PCMCIA_MEM_SIZE
) > pcmcia_phy_end
) {
206 pcmcia_phy_end
= win
->br
+ PCMCIA_MEM_SIZE
;
208 /* Check which slot that has been defined */
209 _slot_
= (win
->or >> 2) & 1;
215 printk ("PCMCIA slot %c: phys mem %08x...%08x (size %08x)\n",
217 pcmcia_phy_base
, pcmcia_phy_end
,
218 pcmcia_phy_end
- pcmcia_phy_base
);
220 pcmcia_base
=(unsigned long)ioremap(pcmcia_phy_base
,
221 pcmcia_phy_end
-pcmcia_phy_base
);
224 printk ("PCMCIA virt base: %08lx\n", pcmcia_base
);
226 /* Compute clock cycles for PIO timings */
227 for (i
=0; i
<6; ++i
) {
228 bd_t
*binfo
= (bd_t
*)__res
;
231 PCMCIA_MK_CLKS (hold_time
[i
],
233 ide_pio_clocks
[i
].setup_time
=
234 PCMCIA_MK_CLKS (ide_pio_timings
[i
].setup_time
,
236 ide_pio_clocks
[i
].active_time
=
237 PCMCIA_MK_CLKS (ide_pio_timings
[i
].active_time
,
239 ide_pio_clocks
[i
].cycle_time
=
240 PCMCIA_MK_CLKS (ide_pio_timings
[i
].cycle_time
,
243 printk ("PIO mode %d timings: %d/%d/%d => %d/%d/%d\n",
245 ide_pio_clocks
[i
].setup_time
,
246 ide_pio_clocks
[i
].active_time
,
247 ide_pio_clocks
[i
].hold_time
,
248 ide_pio_clocks
[i
].cycle_time
,
249 ide_pio_timings
[i
].setup_time
,
250 ide_pio_timings
[i
].active_time
,
251 ide_pio_timings
[i
].hold_time
,
252 ide_pio_timings
[i
].cycle_time
);
257 if (data_port
>= MAX_HWIFS
)
261 printk ("PCMCIA slot has not been defined! Using A as default\n");
265 #ifdef CONFIG_IDE_8xx_PCCARD
268 printk ("PIPR = 0x%08X slot %c ==> mask = 0x%X\n",
271 M8XX_PCMCIA_CD1(_slot_
) | M8XX_PCMCIA_CD2(_slot_
) );
274 if (pcmp
->pcmc_pipr
& (M8XX_PCMCIA_CD1(_slot_
)|M8XX_PCMCIA_CD2(_slot_
))) {
275 printk ("No card in slot %c: PIPR=%08x\n",
276 'A' + _slot_
, (u32
) pcmp
->pcmc_pipr
);
277 return; /* No card in slot */
280 check_ide_device (pcmcia_base
);
282 #endif /* CONFIG_IDE_8xx_PCCARD */
284 base
= pcmcia_base
+ ioport_dsc
[data_port
].base_off
;
286 printk ("base: %08x + %08x = %08x\n",
287 pcmcia_base
, ioport_dsc
[data_port
].base_off
, base
);
290 for (i
= 0; i
< IDE_NR_PORTS
; ++i
) {
292 printk ("port[%d]: %08x + %08x = %08x\n",
295 ioport_dsc
[data_port
].reg_off
[i
],
296 i
, base
+ ioport_dsc
[data_port
].reg_off
[i
]);
298 *p
++ = base
+ ioport_dsc
[data_port
].reg_off
[i
];
302 #ifdef CONFIG_IDE_8xx_PCCARD
305 *irq
= ioport_dsc
[data_port
].irq
;
307 pgcrx
= &((immap_t
*) IMAP_ADDR
)->im_pcmcia
.pcmc_pgcrb
;
309 pgcrx
= &((immap_t
*) IMAP_ADDR
)->im_pcmcia
.pcmc_pgcra
;
312 reg
|= mk_int_int_mask (pcmcia_schlvl
) << 24;
313 reg
|= mk_int_int_mask (pcmcia_schlvl
) << 16;
315 #else /* direct connected IDE drive, i.e. external IRQ, not the PCMCIA irq */
316 *irq
= ioport_dsc
[data_port
].irq
;
317 #endif /* CONFIG_IDE_8xx_PCCARD */
320 /* register routine to tune PIO mode */
321 ide_hwifs
[data_port
].tuneproc
= m8xx_ide_tuneproc
;
323 hw
->ack_intr
= (ide_ack_intr_t
*) ide_interrupt_ack
;
324 /* Enable Harddisk Interrupt,
325 * and make it edge sensitive
327 /* (11-18) Set edge detect for irq, no wakeup from low power mode */
328 ((immap_t
*)IMAP_ADDR
)->im_siu_conf
.sc_siel
|=
329 (0x80000000 >> ioport_dsc
[data_port
].irq
);
331 #ifdef CONFIG_IDE_8xx_PCCARD
332 /* Make sure we don't get garbage irq */
333 ((immap_t
*) IMAP_ADDR
)->im_pcmcia
.pcmc_pscr
= 0xFFFF;
335 /* Enable falling edge irq */
336 pcmp
->pcmc_per
= 0x100000 >> (16 * _slot_
);
337 #endif /* CONFIG_IDE_8xx_PCCARD */
338 } /* m8xx_ide_init_hwif_ports() using 8xx internal PCMCIA interface */
339 #endif /* CONFIG_IDE_8xx_PCCARD || CONFIG_IDE_8xx_DIRECT */
342 * m8xx_ide_init_hwif_ports for a direct IDE interface _not_ using
343 * MPC8xx's internal PCMCIA interface
345 #if defined(CONFIG_IDE_EXT_DIRECT)
346 void m8xx_ide_init_hwif_ports (hw_regs_t
*hw
,
347 unsigned long data_port
, unsigned long ctrl_port
, int *irq
)
349 unsigned long *p
= hw
->io_ports
;
354 static unsigned long ide_base
= 0;
364 * - add code to read ORx, BRx
366 ide_phy_base
= CFG_ATA_BASE_ADDR
;
367 ide_phy_end
= CFG_ATA_BASE_ADDR
+ 0x200;
369 printk ("IDE phys mem : %08x...%08x (size %08x)\n",
370 ide_phy_base
, ide_phy_end
,
371 ide_phy_end
- ide_phy_base
);
373 ide_base
=(unsigned long)ioremap(ide_phy_base
,
374 ide_phy_end
-ide_phy_base
);
377 printk ("IDE virt base: %08lx\n", ide_base
);
381 if (data_port
>= MAX_HWIFS
)
384 base
= ide_base
+ ioport_dsc
[data_port
].base_off
;
386 printk ("base: %08x + %08x = %08x\n",
387 ide_base
, ioport_dsc
[data_port
].base_off
, base
);
390 for (i
= 0; i
< IDE_NR_PORTS
; ++i
) {
392 printk ("port[%d]: %08x + %08x = %08x\n",
395 ioport_dsc
[data_port
].reg_off
[i
],
396 i
, base
+ ioport_dsc
[data_port
].reg_off
[i
]);
398 *p
++ = base
+ ioport_dsc
[data_port
].reg_off
[i
];
402 /* direct connected IDE drive, i.e. external IRQ */
403 *irq
= ioport_dsc
[data_port
].irq
;
406 /* register routine to tune PIO mode */
407 ide_hwifs
[data_port
].tuneproc
= m8xx_ide_tuneproc
;
409 hw
->ack_intr
= (ide_ack_intr_t
*) ide_interrupt_ack
;
410 /* Enable Harddisk Interrupt,
411 * and make it edge sensitive
413 /* (11-18) Set edge detect for irq, no wakeup from low power mode */
414 ((immap_t
*) IMAP_ADDR
)->im_siu_conf
.sc_siel
|=
415 (0x80000000 >> ioport_dsc
[data_port
].irq
);
416 } /* m8xx_ide_init_hwif_ports() for CONFIG_IDE_8xx_DIRECT */
418 #endif /* CONFIG_IDE_8xx_DIRECT */
421 /* -------------------------------------------------------------------- */
426 #define PCMCIA_SHT(t) ((t & 0x0F)<<16) /* Strobe Hold Time */
427 #define PCMCIA_SST(t) ((t & 0x0F)<<12) /* Strobe Setup Time */
428 #define PCMCIA_SL(t) ((t==32) ? 0 : ((t & 0x1F)<<7)) /* Strobe Length */
432 /* Calculate PIO timings */
434 m8xx_ide_tuneproc(ide_drive_t
*drive
, u8 pio
)
437 #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT)
438 volatile pcmconf8xx_t
*pcmp
;
439 ulong timing
, mask
, reg
;
442 pio
= ide_get_best_pio_mode(drive
, pio
, 4, &d
);
445 printk("%s[%d] %s: best PIO mode: %d\n",
446 __FILE__
,__LINE__
,__FUNCTION__
, pio
);
449 #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT)
450 pcmp
= (pcmconf8xx_t
*)(&(((immap_t
*)IMAP_ADDR
)->im_pcmcia
));
452 mask
= ~(PCMCIA_SHT(0xFF) | PCMCIA_SST(0xFF) | PCMCIA_SL(0xFF));
454 timing
= PCMCIA_SHT(hold_time
[pio
] )
455 | PCMCIA_SST(ide_pio_clocks
[pio
].setup_time
)
456 | PCMCIA_SL (ide_pio_clocks
[pio
].active_time
)
460 printk ("Setting timing bits 0x%08lx in PCMCIA controller\n", timing
);
462 if ((reg
= pcmp
->pcmc_por0
& mask
) != 0)
463 pcmp
->pcmc_por0
= reg
| timing
;
465 if ((reg
= pcmp
->pcmc_por1
& mask
) != 0)
466 pcmp
->pcmc_por1
= reg
| timing
;
468 if ((reg
= pcmp
->pcmc_por2
& mask
) != 0)
469 pcmp
->pcmc_por2
= reg
| timing
;
471 if ((reg
= pcmp
->pcmc_por3
& mask
) != 0)
472 pcmp
->pcmc_por3
= reg
| timing
;
474 if ((reg
= pcmp
->pcmc_por4
& mask
) != 0)
475 pcmp
->pcmc_por4
= reg
| timing
;
477 if ((reg
= pcmp
->pcmc_por5
& mask
) != 0)
478 pcmp
->pcmc_por5
= reg
| timing
;
480 if ((reg
= pcmp
->pcmc_por6
& mask
) != 0)
481 pcmp
->pcmc_por6
= reg
| timing
;
483 if ((reg
= pcmp
->pcmc_por7
& mask
) != 0)
484 pcmp
->pcmc_por7
= reg
| timing
;
486 #elif defined(CONFIG_IDE_EXT_DIRECT)
488 printk("%s[%d] %s: not implemented yet!\n",
489 __FILE__
,__LINE__
,__FUNCTION__
);
490 #endif /* defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_PCMCIA */
494 ide_interrupt_ack (void *dev
)
496 #ifdef CONFIG_IDE_8xx_PCCARD
499 #if (PCMCIA_SOCKETS_NO == 2)
503 /* get interrupt sources */
505 pscr
= ((volatile immap_t
*)IMAP_ADDR
)->im_pcmcia
.pcmc_pscr
;
506 pipr
= ((volatile immap_t
*)IMAP_ADDR
)->im_pcmcia
.pcmc_pipr
;
509 * report only if both card detect signals are the same
511 * we depend on that CD2 is the bit to the left of CD1...
515 printk("PCMCIA slot has not been defined! Using A as default\n");
519 if(((pipr
& M8XX_PCMCIA_CD2(_slot_
)) >> 1) ^
520 (pipr
& M8XX_PCMCIA_CD1(_slot_
)) ) {
521 printk ("card detect interrupt\n");
523 /* clear the interrupt sources */
524 ((immap_t
*)IMAP_ADDR
)->im_pcmcia
.pcmc_pscr
= pscr
;
526 #else /* ! CONFIG_IDE_8xx_PCCARD */
528 * Only CONFIG_IDE_8xx_PCCARD is using the interrupt of the
529 * MPC8xx's PCMCIA controller, so there is nothing to be done here
530 * for CONFIG_IDE_8xx_DIRECT and CONFIG_IDE_EXT_DIRECT.
531 * The interrupt is handled somewhere else. -- Steven
533 #endif /* CONFIG_IDE_8xx_PCCARD */
541 #define CISTPL_NULL 0x00
542 #define CISTPL_DEVICE 0x01
543 #define CISTPL_LONGLINK_CB 0x02
544 #define CISTPL_INDIRECT 0x03
545 #define CISTPL_CONFIG_CB 0x04
546 #define CISTPL_CFTABLE_ENTRY_CB 0x05
547 #define CISTPL_LONGLINK_MFC 0x06
548 #define CISTPL_BAR 0x07
549 #define CISTPL_PWR_MGMNT 0x08
550 #define CISTPL_EXTDEVICE 0x09
551 #define CISTPL_CHECKSUM 0x10
552 #define CISTPL_LONGLINK_A 0x11
553 #define CISTPL_LONGLINK_C 0x12
554 #define CISTPL_LINKTARGET 0x13
555 #define CISTPL_NO_LINK 0x14
556 #define CISTPL_VERS_1 0x15
557 #define CISTPL_ALTSTR 0x16
558 #define CISTPL_DEVICE_A 0x17
559 #define CISTPL_JEDEC_C 0x18
560 #define CISTPL_JEDEC_A 0x19
561 #define CISTPL_CONFIG 0x1a
562 #define CISTPL_CFTABLE_ENTRY 0x1b
563 #define CISTPL_DEVICE_OC 0x1c
564 #define CISTPL_DEVICE_OA 0x1d
565 #define CISTPL_DEVICE_GEO 0x1e
566 #define CISTPL_DEVICE_GEO_A 0x1f
567 #define CISTPL_MANFID 0x20
568 #define CISTPL_FUNCID 0x21
569 #define CISTPL_FUNCE 0x22
570 #define CISTPL_SWIL 0x23
571 #define CISTPL_END 0xff
574 * CIS Function ID codes
576 #define CISTPL_FUNCID_MULTI 0x00
577 #define CISTPL_FUNCID_MEMORY 0x01
578 #define CISTPL_FUNCID_SERIAL 0x02
579 #define CISTPL_FUNCID_PARALLEL 0x03
580 #define CISTPL_FUNCID_FIXED 0x04
581 #define CISTPL_FUNCID_VIDEO 0x05
582 #define CISTPL_FUNCID_NETWORK 0x06
583 #define CISTPL_FUNCID_AIMS 0x07
584 #define CISTPL_FUNCID_SCSI 0x08
587 * Fixed Disk FUNCE codes
589 #define CISTPL_IDE_INTERFACE 0x01
591 #define CISTPL_FUNCE_IDE_IFACE 0x01
592 #define CISTPL_FUNCE_IDE_MASTER 0x02
593 #define CISTPL_FUNCE_IDE_SLAVE 0x03
595 /* First feature byte */
596 #define CISTPL_IDE_SILICON 0x04
597 #define CISTPL_IDE_UNIQUE 0x08
598 #define CISTPL_IDE_DUAL 0x10
600 /* Second feature byte */
601 #define CISTPL_IDE_HAS_SLEEP 0x01
602 #define CISTPL_IDE_HAS_STANDBY 0x02
603 #define CISTPL_IDE_HAS_IDLE 0x04
604 #define CISTPL_IDE_LOW_POWER 0x08
605 #define CISTPL_IDE_REG_INHIBIT 0x10
606 #define CISTPL_IDE_HAS_INDEX 0x20
607 #define CISTPL_IDE_IOIS16 0x40
610 /* -------------------------------------------------------------------- */
613 #define MAX_TUPEL_SZ 512
614 #define MAX_FEATURES 4
616 static int check_ide_device (unsigned long base
)
618 volatile u8
*ident
= NULL
;
619 volatile u8
*feature_p
[MAX_FEATURES
];
620 volatile u8
*p
, *start
;
624 unsigned short config_base
= 0;
629 printk ("PCMCIA MEM: %08lX\n", base
);
631 start
= p
= (volatile u8
*) base
;
633 while ((p
- start
) < MAX_TUPEL_SZ
) {
637 if (code
== 0xFF) { /* End of chain */
643 { volatile u8
*q
= p
;
644 printk ("\nTuple code %02x length %d\n\tData:",
647 for (i
= 0; i
< len
; ++i
) {
648 printk (" %02x", *q
);
652 #endif /* DEBUG_PCMCIA */
661 if (n_features
< MAX_FEATURES
)
662 feature_p
[n_features
++] = p
;
665 config_base
= (*(p
+6) << 8) + (*(p
+4));
672 found
= identify (ident
);
674 if (func_id
!= ((u8
)~0)) {
675 print_funcid (func_id
);
677 if (func_id
== CISTPL_FUNCID_FIXED
)
680 return (1); /* no disk drive */
683 for (i
=0; i
<n_features
; ++i
) {
684 print_fixed (feature_p
[i
]);
688 printk ("unknown card type\n");
692 /* set level mode irq and I/O mapped device in config reg*/
693 *((u8
*)(base
+ config_base
)) = 0x41;
698 /* ------------------------------------------------------------------------- */
700 static void print_funcid (int func
)
703 case CISTPL_FUNCID_MULTI
:
704 printk (" Multi-Function");
706 case CISTPL_FUNCID_MEMORY
:
709 case CISTPL_FUNCID_SERIAL
:
710 printk (" Serial Port");
712 case CISTPL_FUNCID_PARALLEL
:
713 printk (" Parallel Port");
715 case CISTPL_FUNCID_FIXED
:
716 printk (" Fixed Disk");
718 case CISTPL_FUNCID_VIDEO
:
719 printk (" Video Adapter");
721 case CISTPL_FUNCID_NETWORK
:
722 printk (" Network Adapter");
724 case CISTPL_FUNCID_AIMS
:
725 printk (" AIMS Card");
727 case CISTPL_FUNCID_SCSI
:
728 printk (" SCSI Adapter");
737 /* ------------------------------------------------------------------------- */
739 static void print_fixed (volatile u8
*p
)
745 case CISTPL_FUNCE_IDE_IFACE
:
748 printk ((iface
== CISTPL_IDE_INTERFACE
) ? " IDE" : " unknown");
749 printk (" interface ");
752 case CISTPL_FUNCE_IDE_MASTER
:
753 case CISTPL_FUNCE_IDE_SLAVE
:
757 printk ((f1
& CISTPL_IDE_SILICON
) ? " [silicon]" : " [rotating]");
759 if (f1
& CISTPL_IDE_UNIQUE
)
760 printk (" [unique]");
762 printk ((f1
& CISTPL_IDE_DUAL
) ? " [dual]" : " [single]");
764 if (f2
& CISTPL_IDE_HAS_SLEEP
)
767 if (f2
& CISTPL_IDE_HAS_STANDBY
)
768 printk (" [standby]");
770 if (f2
& CISTPL_IDE_HAS_IDLE
)
773 if (f2
& CISTPL_IDE_LOW_POWER
)
774 printk (" [low power]");
776 if (f2
& CISTPL_IDE_REG_INHIBIT
)
777 printk (" [reg inhibit]");
779 if (f2
& CISTPL_IDE_HAS_INDEX
)
782 if (f2
& CISTPL_IDE_IOIS16
)
783 printk (" [IOis16]");
791 /* ------------------------------------------------------------------------- */
794 #define MAX_IDENT_CHARS 64
795 #define MAX_IDENT_FIELDS 4
797 static u8
*known_cards
[] = {
802 static int identify (volatile u8
*p
)
804 u8 id_str
[MAX_IDENT_CHARS
];
811 return (0); /* Don't know */
816 for (i
=0; i
<=4 && !done
; ++i
, p
+=2) {
817 while ((data
= *p
) != '\0') {
823 if (t
== &id_str
[MAX_IDENT_CHARS
-1]) {
833 while (--t
> id_str
) {
839 printk ("Card ID: %s\n", id_str
);
841 for (card
=known_cards
; *card
; ++card
) {
842 if (strcmp(*card
, id_str
) == 0) { /* found! */
847 return (0); /* don't know */
850 void m8xx_ide_init(void)
852 ppc_ide_md
.default_irq
= m8xx_ide_default_irq
;
853 ppc_ide_md
.default_io_base
= m8xx_ide_default_io_base
;
854 ppc_ide_md
.ide_init_hwif
= m8xx_ide_init_hwif_ports
;