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/errno.h>
15 #include <linux/kernel.h>
17 #include <linux/stddef.h>
18 #include <linux/unistd.h>
19 #include <linux/ptrace.h>
20 #include <linux/slab.h>
21 #include <linux/user.h>
22 #include <linux/a.out.h>
23 #include <linux/tty.h>
24 #include <linux/major.h>
25 #include <linux/interrupt.h>
26 #include <linux/reboot.h>
27 #include <linux/init.h>
28 #include <linux/ioport.h>
29 #include <linux/ide.h>
30 #include <linux/bootmem.h>
32 #include <asm/mpc8xx.h>
34 #include <asm/processor.h>
36 #include <asm/pgtable.h>
38 #include <asm/8xx_immap.h>
39 #include <asm/machdep.h>
42 static int identify (volatile u8
*p
);
43 static void print_fixed (volatile u8
*p
);
44 static void print_funcid (int func
);
45 static int check_ide_device (unsigned long base
);
47 static void ide_interrupt_ack (void *dev
);
48 static void m8xx_ide_set_pio_mode(ide_drive_t
*drive
, const u8 pio
);
50 typedef struct ide_ioport_desc
{
51 unsigned long base_off
; /* Offset to PCMCIA memory */
52 unsigned long reg_off
[IDE_NR_PORTS
]; /* controller register offsets */
56 ide_ioport_desc_t ioport_dsc
[MAX_HWIFS
] = {
57 #ifdef IDE0_BASE_OFFSET
61 IDE0_ERROR_REG_OFFSET
,
62 IDE0_NSECTOR_REG_OFFSET
,
63 IDE0_SECTOR_REG_OFFSET
,
66 IDE0_SELECT_REG_OFFSET
,
67 IDE0_STATUS_REG_OFFSET
,
68 IDE0_CONTROL_REG_OFFSET
,
73 #ifdef IDE1_BASE_OFFSET
77 IDE1_ERROR_REG_OFFSET
,
78 IDE1_NSECTOR_REG_OFFSET
,
79 IDE1_SECTOR_REG_OFFSET
,
82 IDE1_SELECT_REG_OFFSET
,
83 IDE1_STATUS_REG_OFFSET
,
84 IDE1_CONTROL_REG_OFFSET
,
89 #endif /* IDE1_BASE_OFFSET */
90 #endif /* IDE0_BASE_OFFSET */
93 ide_pio_timings_t ide_pio_clocks
[6];
94 int hold_time
[6] = {30, 20, 15, 10, 10, 10 }; /* PIO Mode 5 with IORDY (nonstandard) */
97 * Warning: only 1 (ONE) PCMCIA slot supported here,
98 * which must be correctly initialized by the firmware (PPCBoot).
100 static int _slot_
= -1; /* will be read from PCMCIA registers */
102 /* Make clock cycles and always round up */
103 #define PCMCIA_MK_CLKS( t, T ) (( (t) * ((T)/1000000) + 999U ) / 1000U )
111 m8xx_ide_default_irq(unsigned long base
)
113 #ifdef CONFIG_BLK_DEV_MPC8xx_IDE
114 if (base
>= MAX_HWIFS
)
117 printk("[%d] m8xx_ide_default_irq %d\n",__LINE__
,ioport_dsc
[base
].irq
);
119 return (ioport_dsc
[base
].irq
);
126 m8xx_ide_default_io_base(int index
)
131 #define M8XX_PCMCIA_CD2(slot) (0x10000000 >> (slot << 4))
132 #define M8XX_PCMCIA_CD1(slot) (0x08000000 >> (slot << 4))
135 * The TQM850L hardware has two pins swapped! Grrrrgh!
137 #ifdef CONFIG_TQM850L
138 #define __MY_PCMCIA_GCRX_CXRESET PCMCIA_GCRX_CXOE
139 #define __MY_PCMCIA_GCRX_CXOE PCMCIA_GCRX_CXRESET
141 #define __MY_PCMCIA_GCRX_CXRESET PCMCIA_GCRX_CXRESET
142 #define __MY_PCMCIA_GCRX_CXOE PCMCIA_GCRX_CXOE
145 #if defined(CONFIG_BLK_DEV_MPC8xx_IDE) && defined(CONFIG_IDE_8xx_PCCARD)
146 #define PCMCIA_SCHLVL IDE0_INTERRUPT /* Status Change Interrupt Level */
147 static int pcmcia_schlvl
= PCMCIA_SCHLVL
;
151 * See include/linux/ide.h for definition of hw_regs_t (p, base)
155 * m8xx_ide_init_hwif_ports for a direct IDE interface _using_
157 #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT)
159 m8xx_ide_init_hwif_ports(hw_regs_t
*hw
, unsigned long data_port
,
160 unsigned long ctrl_port
, int *irq
)
162 unsigned long *p
= hw
->io_ports
;
169 volatile pcmcia_win_t
*win
;
170 volatile pcmconf8xx_t
*pcmp
;
175 static unsigned long pcmcia_base
= 0;
182 pcmp
= (pcmconf8xx_t
*)(&(((immap_t
*)IMAP_ADDR
)->im_pcmcia
));
186 * Read out PCMCIA registers. Since the reset values
187 * are undefined, we sure hope that they have been
191 /* Scan all registers for valid settings */
192 pcmcia_phy_base
= 0xFFFFFFFF;
194 /* br0 is start of brX and orX regs */
195 win
= (pcmcia_win_t
*) \
196 (&(((immap_t
*)IMAP_ADDR
)->im_pcmcia
.pcmc_pbr0
));
197 for (i
= 0; i
< 8; i
++) {
198 if (win
->or & 1) { /* This bank is marked as valid */
199 if (win
->br
< pcmcia_phy_base
) {
200 pcmcia_phy_base
= win
->br
;
202 if ((win
->br
+ PCMCIA_MEM_SIZE
) > pcmcia_phy_end
) {
203 pcmcia_phy_end
= win
->br
+ PCMCIA_MEM_SIZE
;
205 /* Check which slot that has been defined */
206 _slot_
= (win
->or >> 2) & 1;
212 printk ("PCMCIA slot %c: phys mem %08x...%08x (size %08x)\n",
214 pcmcia_phy_base
, pcmcia_phy_end
,
215 pcmcia_phy_end
- pcmcia_phy_base
);
217 pcmcia_base
=(unsigned long)ioremap(pcmcia_phy_base
,
218 pcmcia_phy_end
-pcmcia_phy_base
);
221 printk ("PCMCIA virt base: %08lx\n", pcmcia_base
);
223 /* Compute clock cycles for PIO timings */
224 for (i
=0; i
<6; ++i
) {
225 bd_t
*binfo
= (bd_t
*)__res
;
228 PCMCIA_MK_CLKS (hold_time
[i
],
230 ide_pio_clocks
[i
].setup_time
=
231 PCMCIA_MK_CLKS (ide_pio_timings
[i
].setup_time
,
233 ide_pio_clocks
[i
].active_time
=
234 PCMCIA_MK_CLKS (ide_pio_timings
[i
].active_time
,
236 ide_pio_clocks
[i
].cycle_time
=
237 PCMCIA_MK_CLKS (ide_pio_timings
[i
].cycle_time
,
240 printk ("PIO mode %d timings: %d/%d/%d => %d/%d/%d\n",
242 ide_pio_clocks
[i
].setup_time
,
243 ide_pio_clocks
[i
].active_time
,
244 ide_pio_clocks
[i
].hold_time
,
245 ide_pio_clocks
[i
].cycle_time
,
246 ide_pio_timings
[i
].setup_time
,
247 ide_pio_timings
[i
].active_time
,
248 ide_pio_timings
[i
].hold_time
,
249 ide_pio_timings
[i
].cycle_time
);
254 if (data_port
>= MAX_HWIFS
)
258 printk ("PCMCIA slot has not been defined! Using A as default\n");
262 #ifdef CONFIG_IDE_8xx_PCCARD
265 printk ("PIPR = 0x%08X slot %c ==> mask = 0x%X\n",
268 M8XX_PCMCIA_CD1(_slot_
) | M8XX_PCMCIA_CD2(_slot_
) );
271 if (pcmp
->pcmc_pipr
& (M8XX_PCMCIA_CD1(_slot_
)|M8XX_PCMCIA_CD2(_slot_
))) {
272 printk ("No card in slot %c: PIPR=%08x\n",
273 'A' + _slot_
, (u32
) pcmp
->pcmc_pipr
);
274 return; /* No card in slot */
277 check_ide_device (pcmcia_base
);
279 #endif /* CONFIG_IDE_8xx_PCCARD */
281 base
= pcmcia_base
+ ioport_dsc
[data_port
].base_off
;
283 printk ("base: %08x + %08x = %08x\n",
284 pcmcia_base
, ioport_dsc
[data_port
].base_off
, base
);
287 for (i
= 0; i
< IDE_NR_PORTS
; ++i
) {
289 printk ("port[%d]: %08x + %08x = %08x\n",
292 ioport_dsc
[data_port
].reg_off
[i
],
293 i
, base
+ ioport_dsc
[data_port
].reg_off
[i
]);
295 *p
++ = base
+ ioport_dsc
[data_port
].reg_off
[i
];
299 #ifdef CONFIG_IDE_8xx_PCCARD
302 *irq
= ioport_dsc
[data_port
].irq
;
304 pgcrx
= &((immap_t
*) IMAP_ADDR
)->im_pcmcia
.pcmc_pgcrb
;
306 pgcrx
= &((immap_t
*) IMAP_ADDR
)->im_pcmcia
.pcmc_pgcra
;
309 reg
|= mk_int_int_mask (pcmcia_schlvl
) << 24;
310 reg
|= mk_int_int_mask (pcmcia_schlvl
) << 16;
312 #else /* direct connected IDE drive, i.e. external IRQ, not the PCMCIA irq */
313 *irq
= ioport_dsc
[data_port
].irq
;
314 #endif /* CONFIG_IDE_8xx_PCCARD */
317 ide_hwifs
[data_port
].pio_mask
= ATA_PIO4
;
318 ide_hwifs
[data_port
].set_pio_mode
= m8xx_ide_set_pio_mode
;
319 ide_hwifs
[data_port
].ack_intr
= (ide_ack_intr_t
*)ide_interrupt_ack
;
321 /* Enable Harddisk Interrupt,
322 * and make it edge sensitive
324 /* (11-18) Set edge detect for irq, no wakeup from low power mode */
325 ((immap_t
*)IMAP_ADDR
)->im_siu_conf
.sc_siel
|=
326 (0x80000000 >> ioport_dsc
[data_port
].irq
);
328 #ifdef CONFIG_IDE_8xx_PCCARD
329 /* Make sure we don't get garbage irq */
330 ((immap_t
*) IMAP_ADDR
)->im_pcmcia
.pcmc_pscr
= 0xFFFF;
332 /* Enable falling edge irq */
333 pcmp
->pcmc_per
= 0x100000 >> (16 * _slot_
);
334 #endif /* CONFIG_IDE_8xx_PCCARD */
335 } /* m8xx_ide_init_hwif_ports() using 8xx internal PCMCIA interface */
336 #endif /* CONFIG_IDE_8xx_PCCARD || CONFIG_IDE_8xx_DIRECT */
339 * m8xx_ide_init_hwif_ports for a direct IDE interface _not_ using
340 * MPC8xx's internal PCMCIA interface
342 #if defined(CONFIG_IDE_EXT_DIRECT)
343 void m8xx_ide_init_hwif_ports (hw_regs_t
*hw
,
344 unsigned long data_port
, unsigned long ctrl_port
, int *irq
)
346 unsigned long *p
= hw
->io_ports
;
351 static unsigned long ide_base
= 0;
361 * - add code to read ORx, BRx
363 ide_phy_base
= CFG_ATA_BASE_ADDR
;
364 ide_phy_end
= CFG_ATA_BASE_ADDR
+ 0x200;
366 printk ("IDE phys mem : %08x...%08x (size %08x)\n",
367 ide_phy_base
, ide_phy_end
,
368 ide_phy_end
- ide_phy_base
);
370 ide_base
=(unsigned long)ioremap(ide_phy_base
,
371 ide_phy_end
-ide_phy_base
);
374 printk ("IDE virt base: %08lx\n", ide_base
);
378 if (data_port
>= MAX_HWIFS
)
381 base
= ide_base
+ ioport_dsc
[data_port
].base_off
;
383 printk ("base: %08x + %08x = %08x\n",
384 ide_base
, ioport_dsc
[data_port
].base_off
, base
);
387 for (i
= 0; i
< IDE_NR_PORTS
; ++i
) {
389 printk ("port[%d]: %08x + %08x = %08x\n",
392 ioport_dsc
[data_port
].reg_off
[i
],
393 i
, base
+ ioport_dsc
[data_port
].reg_off
[i
]);
395 *p
++ = base
+ ioport_dsc
[data_port
].reg_off
[i
];
399 /* direct connected IDE drive, i.e. external IRQ */
400 *irq
= ioport_dsc
[data_port
].irq
;
403 ide_hwifs
[data_port
].pio_mask
= ATA_PIO4
;
404 ide_hwifs
[data_port
].set_pio_mode
= m8xx_ide_set_pio_mode
;
405 ide_hwifs
[data_port
].ack_intr
= (ide_ack_intr_t
*)ide_interrupt_ack
;
407 /* Enable Harddisk Interrupt,
408 * and make it edge sensitive
410 /* (11-18) Set edge detect for irq, no wakeup from low power mode */
411 ((immap_t
*) IMAP_ADDR
)->im_siu_conf
.sc_siel
|=
412 (0x80000000 >> ioport_dsc
[data_port
].irq
);
413 } /* m8xx_ide_init_hwif_ports() for CONFIG_IDE_8xx_DIRECT */
415 #endif /* CONFIG_IDE_8xx_DIRECT */
418 /* -------------------------------------------------------------------- */
423 #define PCMCIA_SHT(t) ((t & 0x0F)<<16) /* Strobe Hold Time */
424 #define PCMCIA_SST(t) ((t & 0x0F)<<12) /* Strobe Setup Time */
425 #define PCMCIA_SL(t) ((t==32) ? 0 : ((t & 0x1F)<<7)) /* Strobe Length */
428 /* Calculate PIO timings */
429 static void m8xx_ide_set_pio_mode(ide_drive_t
*drive
, const u8 pio
)
431 #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT)
432 volatile pcmconf8xx_t
*pcmp
;
433 ulong timing
, mask
, reg
;
435 pcmp
= (pcmconf8xx_t
*)(&(((immap_t
*)IMAP_ADDR
)->im_pcmcia
));
437 mask
= ~(PCMCIA_SHT(0xFF) | PCMCIA_SST(0xFF) | PCMCIA_SL(0xFF));
439 timing
= PCMCIA_SHT(hold_time
[pio
] )
440 | PCMCIA_SST(ide_pio_clocks
[pio
].setup_time
)
441 | PCMCIA_SL (ide_pio_clocks
[pio
].active_time
)
445 printk ("Setting timing bits 0x%08lx in PCMCIA controller\n", timing
);
447 if ((reg
= pcmp
->pcmc_por0
& mask
) != 0)
448 pcmp
->pcmc_por0
= reg
| timing
;
450 if ((reg
= pcmp
->pcmc_por1
& mask
) != 0)
451 pcmp
->pcmc_por1
= reg
| timing
;
453 if ((reg
= pcmp
->pcmc_por2
& mask
) != 0)
454 pcmp
->pcmc_por2
= reg
| timing
;
456 if ((reg
= pcmp
->pcmc_por3
& mask
) != 0)
457 pcmp
->pcmc_por3
= reg
| timing
;
459 if ((reg
= pcmp
->pcmc_por4
& mask
) != 0)
460 pcmp
->pcmc_por4
= reg
| timing
;
462 if ((reg
= pcmp
->pcmc_por5
& mask
) != 0)
463 pcmp
->pcmc_por5
= reg
| timing
;
465 if ((reg
= pcmp
->pcmc_por6
& mask
) != 0)
466 pcmp
->pcmc_por6
= reg
| timing
;
468 if ((reg
= pcmp
->pcmc_por7
& mask
) != 0)
469 pcmp
->pcmc_por7
= reg
| timing
;
471 #elif defined(CONFIG_IDE_EXT_DIRECT)
473 printk("%s[%d] %s: not implemented yet!\n",
474 __FILE__
,__LINE__
,__FUNCTION__
);
475 #endif /* defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_PCMCIA */
479 ide_interrupt_ack (void *dev
)
481 #ifdef CONFIG_IDE_8xx_PCCARD
484 #if (PCMCIA_SOCKETS_NO == 2)
488 /* get interrupt sources */
490 pscr
= ((volatile immap_t
*)IMAP_ADDR
)->im_pcmcia
.pcmc_pscr
;
491 pipr
= ((volatile immap_t
*)IMAP_ADDR
)->im_pcmcia
.pcmc_pipr
;
494 * report only if both card detect signals are the same
496 * we depend on that CD2 is the bit to the left of CD1...
500 printk("PCMCIA slot has not been defined! Using A as default\n");
504 if(((pipr
& M8XX_PCMCIA_CD2(_slot_
)) >> 1) ^
505 (pipr
& M8XX_PCMCIA_CD1(_slot_
)) ) {
506 printk ("card detect interrupt\n");
508 /* clear the interrupt sources */
509 ((immap_t
*)IMAP_ADDR
)->im_pcmcia
.pcmc_pscr
= pscr
;
511 #else /* ! CONFIG_IDE_8xx_PCCARD */
513 * Only CONFIG_IDE_8xx_PCCARD is using the interrupt of the
514 * MPC8xx's PCMCIA controller, so there is nothing to be done here
515 * for CONFIG_IDE_8xx_DIRECT and CONFIG_IDE_EXT_DIRECT.
516 * The interrupt is handled somewhere else. -- Steven
518 #endif /* CONFIG_IDE_8xx_PCCARD */
526 #define CISTPL_NULL 0x00
527 #define CISTPL_DEVICE 0x01
528 #define CISTPL_LONGLINK_CB 0x02
529 #define CISTPL_INDIRECT 0x03
530 #define CISTPL_CONFIG_CB 0x04
531 #define CISTPL_CFTABLE_ENTRY_CB 0x05
532 #define CISTPL_LONGLINK_MFC 0x06
533 #define CISTPL_BAR 0x07
534 #define CISTPL_PWR_MGMNT 0x08
535 #define CISTPL_EXTDEVICE 0x09
536 #define CISTPL_CHECKSUM 0x10
537 #define CISTPL_LONGLINK_A 0x11
538 #define CISTPL_LONGLINK_C 0x12
539 #define CISTPL_LINKTARGET 0x13
540 #define CISTPL_NO_LINK 0x14
541 #define CISTPL_VERS_1 0x15
542 #define CISTPL_ALTSTR 0x16
543 #define CISTPL_DEVICE_A 0x17
544 #define CISTPL_JEDEC_C 0x18
545 #define CISTPL_JEDEC_A 0x19
546 #define CISTPL_CONFIG 0x1a
547 #define CISTPL_CFTABLE_ENTRY 0x1b
548 #define CISTPL_DEVICE_OC 0x1c
549 #define CISTPL_DEVICE_OA 0x1d
550 #define CISTPL_DEVICE_GEO 0x1e
551 #define CISTPL_DEVICE_GEO_A 0x1f
552 #define CISTPL_MANFID 0x20
553 #define CISTPL_FUNCID 0x21
554 #define CISTPL_FUNCE 0x22
555 #define CISTPL_SWIL 0x23
556 #define CISTPL_END 0xff
559 * CIS Function ID codes
561 #define CISTPL_FUNCID_MULTI 0x00
562 #define CISTPL_FUNCID_MEMORY 0x01
563 #define CISTPL_FUNCID_SERIAL 0x02
564 #define CISTPL_FUNCID_PARALLEL 0x03
565 #define CISTPL_FUNCID_FIXED 0x04
566 #define CISTPL_FUNCID_VIDEO 0x05
567 #define CISTPL_FUNCID_NETWORK 0x06
568 #define CISTPL_FUNCID_AIMS 0x07
569 #define CISTPL_FUNCID_SCSI 0x08
572 * Fixed Disk FUNCE codes
574 #define CISTPL_IDE_INTERFACE 0x01
576 #define CISTPL_FUNCE_IDE_IFACE 0x01
577 #define CISTPL_FUNCE_IDE_MASTER 0x02
578 #define CISTPL_FUNCE_IDE_SLAVE 0x03
580 /* First feature byte */
581 #define CISTPL_IDE_SILICON 0x04
582 #define CISTPL_IDE_UNIQUE 0x08
583 #define CISTPL_IDE_DUAL 0x10
585 /* Second feature byte */
586 #define CISTPL_IDE_HAS_SLEEP 0x01
587 #define CISTPL_IDE_HAS_STANDBY 0x02
588 #define CISTPL_IDE_HAS_IDLE 0x04
589 #define CISTPL_IDE_LOW_POWER 0x08
590 #define CISTPL_IDE_REG_INHIBIT 0x10
591 #define CISTPL_IDE_HAS_INDEX 0x20
592 #define CISTPL_IDE_IOIS16 0x40
595 /* -------------------------------------------------------------------- */
598 #define MAX_TUPEL_SZ 512
599 #define MAX_FEATURES 4
601 static int check_ide_device (unsigned long base
)
603 volatile u8
*ident
= NULL
;
604 volatile u8
*feature_p
[MAX_FEATURES
];
605 volatile u8
*p
, *start
;
609 unsigned short config_base
= 0;
614 printk ("PCMCIA MEM: %08lX\n", base
);
616 start
= p
= (volatile u8
*) base
;
618 while ((p
- start
) < MAX_TUPEL_SZ
) {
622 if (code
== 0xFF) { /* End of chain */
628 { volatile u8
*q
= p
;
629 printk ("\nTuple code %02x length %d\n\tData:",
632 for (i
= 0; i
< len
; ++i
) {
633 printk (" %02x", *q
);
637 #endif /* DEBUG_PCMCIA */
646 if (n_features
< MAX_FEATURES
)
647 feature_p
[n_features
++] = p
;
650 config_base
= (*(p
+6) << 8) + (*(p
+4));
657 found
= identify (ident
);
659 if (func_id
!= ((u8
)~0)) {
660 print_funcid (func_id
);
662 if (func_id
== CISTPL_FUNCID_FIXED
)
665 return (1); /* no disk drive */
668 for (i
=0; i
<n_features
; ++i
) {
669 print_fixed (feature_p
[i
]);
673 printk ("unknown card type\n");
677 /* set level mode irq and I/O mapped device in config reg*/
678 *((u8
*)(base
+ config_base
)) = 0x41;
683 /* ------------------------------------------------------------------------- */
685 static void print_funcid (int func
)
688 case CISTPL_FUNCID_MULTI
:
689 printk (" Multi-Function");
691 case CISTPL_FUNCID_MEMORY
:
694 case CISTPL_FUNCID_SERIAL
:
695 printk (" Serial Port");
697 case CISTPL_FUNCID_PARALLEL
:
698 printk (" Parallel Port");
700 case CISTPL_FUNCID_FIXED
:
701 printk (" Fixed Disk");
703 case CISTPL_FUNCID_VIDEO
:
704 printk (" Video Adapter");
706 case CISTPL_FUNCID_NETWORK
:
707 printk (" Network Adapter");
709 case CISTPL_FUNCID_AIMS
:
710 printk (" AIMS Card");
712 case CISTPL_FUNCID_SCSI
:
713 printk (" SCSI Adapter");
722 /* ------------------------------------------------------------------------- */
724 static void print_fixed (volatile u8
*p
)
730 case CISTPL_FUNCE_IDE_IFACE
:
733 printk ((iface
== CISTPL_IDE_INTERFACE
) ? " IDE" : " unknown");
734 printk (" interface ");
737 case CISTPL_FUNCE_IDE_MASTER
:
738 case CISTPL_FUNCE_IDE_SLAVE
:
742 printk ((f1
& CISTPL_IDE_SILICON
) ? " [silicon]" : " [rotating]");
744 if (f1
& CISTPL_IDE_UNIQUE
)
745 printk (" [unique]");
747 printk ((f1
& CISTPL_IDE_DUAL
) ? " [dual]" : " [single]");
749 if (f2
& CISTPL_IDE_HAS_SLEEP
)
752 if (f2
& CISTPL_IDE_HAS_STANDBY
)
753 printk (" [standby]");
755 if (f2
& CISTPL_IDE_HAS_IDLE
)
758 if (f2
& CISTPL_IDE_LOW_POWER
)
759 printk (" [low power]");
761 if (f2
& CISTPL_IDE_REG_INHIBIT
)
762 printk (" [reg inhibit]");
764 if (f2
& CISTPL_IDE_HAS_INDEX
)
767 if (f2
& CISTPL_IDE_IOIS16
)
768 printk (" [IOis16]");
776 /* ------------------------------------------------------------------------- */
779 #define MAX_IDENT_CHARS 64
780 #define MAX_IDENT_FIELDS 4
782 static u8
*known_cards
[] = {
787 static int identify (volatile u8
*p
)
789 u8 id_str
[MAX_IDENT_CHARS
];
796 return (0); /* Don't know */
801 for (i
=0; i
<=4 && !done
; ++i
, p
+=2) {
802 while ((data
= *p
) != '\0') {
808 if (t
== &id_str
[MAX_IDENT_CHARS
-1]) {
818 while (--t
> id_str
) {
824 printk ("Card ID: %s\n", id_str
);
826 for (card
=known_cards
; *card
; ++card
) {
827 if (strcmp(*card
, id_str
) == 0) { /* found! */
832 return (0); /* don't know */
835 void m8xx_ide_init(void)
837 ppc_ide_md
.default_irq
= m8xx_ide_default_irq
;
838 ppc_ide_md
.default_io_base
= m8xx_ide_default_io_base
;
839 ppc_ide_md
.ide_init_hwif
= m8xx_ide_init_hwif_ports
;