2 * Copyright (C) 2000, 2001 Wolfgang Denk, wd@denx.de
3 * Modified for direct IDE interface
4 * by Thomas Lange, thomas@corelatus.com
5 * Modified for direct IDE interface on 8xx without using the PCMCIA
7 * by Steven.Scholz@imc-berlin.de
8 * Moved out of arch/ppc/kernel/m8xx_setup.c, other minor cleanups
9 * by Mathew Locke <mattl@mvista.com>
12 #include <linux/errno.h>
13 #include <linux/kernel.h>
15 #include <linux/stddef.h>
16 #include <linux/unistd.h>
17 #include <linux/ptrace.h>
18 #include <linux/slab.h>
19 #include <linux/user.h>
20 #include <linux/tty.h>
21 #include <linux/major.h>
22 #include <linux/interrupt.h>
23 #include <linux/reboot.h>
24 #include <linux/init.h>
25 #include <linux/ioport.h>
26 #include <linux/ide.h>
27 #include <linux/bootmem.h>
29 #include <asm/mpc8xx.h>
31 #include <asm/processor.h>
33 #include <asm/pgtable.h>
35 #include <asm/8xx_immap.h>
36 #include <asm/machdep.h>
39 static int identify (volatile u8
*p
);
40 static void print_fixed (volatile u8
*p
);
41 static void print_funcid (int func
);
42 static int check_ide_device (unsigned long base
);
44 static void ide_interrupt_ack (void *dev
);
45 static void m8xx_ide_set_pio_mode(ide_drive_t
*drive
, const u8 pio
);
47 typedef struct ide_ioport_desc
{
48 unsigned long base_off
; /* Offset to PCMCIA memory */
49 unsigned long reg_off
[IDE_NR_PORTS
]; /* controller register offsets */
53 ide_ioport_desc_t ioport_dsc
[MAX_HWIFS
] = {
54 #ifdef IDE0_BASE_OFFSET
58 IDE0_ERROR_REG_OFFSET
,
59 IDE0_NSECTOR_REG_OFFSET
,
60 IDE0_SECTOR_REG_OFFSET
,
63 IDE0_SELECT_REG_OFFSET
,
64 IDE0_STATUS_REG_OFFSET
,
65 IDE0_CONTROL_REG_OFFSET
,
70 #ifdef IDE1_BASE_OFFSET
74 IDE1_ERROR_REG_OFFSET
,
75 IDE1_NSECTOR_REG_OFFSET
,
76 IDE1_SECTOR_REG_OFFSET
,
79 IDE1_SELECT_REG_OFFSET
,
80 IDE1_STATUS_REG_OFFSET
,
81 IDE1_CONTROL_REG_OFFSET
,
86 #endif /* IDE1_BASE_OFFSET */
87 #endif /* IDE0_BASE_OFFSET */
90 ide_pio_timings_t ide_pio_clocks
[6];
91 int hold_time
[6] = {30, 20, 15, 10, 10, 10 }; /* PIO Mode 5 with IORDY (nonstandard) */
94 * Warning: only 1 (ONE) PCMCIA slot supported here,
95 * which must be correctly initialized by the firmware (PPCBoot).
97 static int _slot_
= -1; /* will be read from PCMCIA registers */
99 /* Make clock cycles and always round up */
100 #define PCMCIA_MK_CLKS( t, T ) (( (t) * ((T)/1000000) + 999U ) / 1000U )
108 m8xx_ide_default_irq(unsigned long base
)
110 #ifdef CONFIG_BLK_DEV_MPC8xx_IDE
111 if (base
>= MAX_HWIFS
)
114 printk("[%d] m8xx_ide_default_irq %d\n",__LINE__
,ioport_dsc
[base
].irq
);
116 return (ioport_dsc
[base
].irq
);
123 m8xx_ide_default_io_base(int index
)
128 #define M8XX_PCMCIA_CD2(slot) (0x10000000 >> (slot << 4))
129 #define M8XX_PCMCIA_CD1(slot) (0x08000000 >> (slot << 4))
132 * The TQM850L hardware has two pins swapped! Grrrrgh!
134 #ifdef CONFIG_TQM850L
135 #define __MY_PCMCIA_GCRX_CXRESET PCMCIA_GCRX_CXOE
136 #define __MY_PCMCIA_GCRX_CXOE PCMCIA_GCRX_CXRESET
138 #define __MY_PCMCIA_GCRX_CXRESET PCMCIA_GCRX_CXRESET
139 #define __MY_PCMCIA_GCRX_CXOE PCMCIA_GCRX_CXOE
142 #if defined(CONFIG_BLK_DEV_MPC8xx_IDE) && defined(CONFIG_IDE_8xx_PCCARD)
143 #define PCMCIA_SCHLVL IDE0_INTERRUPT /* Status Change Interrupt Level */
144 static int pcmcia_schlvl
= PCMCIA_SCHLVL
;
148 * See include/linux/ide.h for definition of hw_regs_t (p, base)
152 * m8xx_ide_init_hwif_ports for a direct IDE interface _using_
154 #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT)
156 m8xx_ide_init_hwif_ports(hw_regs_t
*hw
, unsigned long data_port
,
157 unsigned long ctrl_port
, int *irq
)
159 unsigned long *p
= hw
->io_ports
;
166 volatile pcmcia_win_t
*win
;
167 volatile pcmconf8xx_t
*pcmp
;
172 static unsigned long pcmcia_base
= 0;
179 pcmp
= (pcmconf8xx_t
*)(&(((immap_t
*)IMAP_ADDR
)->im_pcmcia
));
183 * Read out PCMCIA registers. Since the reset values
184 * are undefined, we sure hope that they have been
188 /* Scan all registers for valid settings */
189 pcmcia_phy_base
= 0xFFFFFFFF;
191 /* br0 is start of brX and orX regs */
192 win
= (pcmcia_win_t
*) \
193 (&(((immap_t
*)IMAP_ADDR
)->im_pcmcia
.pcmc_pbr0
));
194 for (i
= 0; i
< 8; i
++) {
195 if (win
->or & 1) { /* This bank is marked as valid */
196 if (win
->br
< pcmcia_phy_base
) {
197 pcmcia_phy_base
= win
->br
;
199 if ((win
->br
+ PCMCIA_MEM_SIZE
) > pcmcia_phy_end
) {
200 pcmcia_phy_end
= win
->br
+ PCMCIA_MEM_SIZE
;
202 /* Check which slot that has been defined */
203 _slot_
= (win
->or >> 2) & 1;
209 printk ("PCMCIA slot %c: phys mem %08x...%08x (size %08x)\n",
211 pcmcia_phy_base
, pcmcia_phy_end
,
212 pcmcia_phy_end
- pcmcia_phy_base
);
214 pcmcia_base
=(unsigned long)ioremap(pcmcia_phy_base
,
215 pcmcia_phy_end
-pcmcia_phy_base
);
218 printk ("PCMCIA virt base: %08lx\n", pcmcia_base
);
220 /* Compute clock cycles for PIO timings */
221 for (i
=0; i
<6; ++i
) {
222 bd_t
*binfo
= (bd_t
*)__res
;
225 PCMCIA_MK_CLKS (hold_time
[i
],
227 ide_pio_clocks
[i
].setup_time
=
228 PCMCIA_MK_CLKS (ide_pio_timings
[i
].setup_time
,
230 ide_pio_clocks
[i
].active_time
=
231 PCMCIA_MK_CLKS (ide_pio_timings
[i
].active_time
,
233 ide_pio_clocks
[i
].cycle_time
=
234 PCMCIA_MK_CLKS (ide_pio_timings
[i
].cycle_time
,
237 printk ("PIO mode %d timings: %d/%d/%d => %d/%d/%d\n",
239 ide_pio_clocks
[i
].setup_time
,
240 ide_pio_clocks
[i
].active_time
,
241 ide_pio_clocks
[i
].hold_time
,
242 ide_pio_clocks
[i
].cycle_time
,
243 ide_pio_timings
[i
].setup_time
,
244 ide_pio_timings
[i
].active_time
,
245 ide_pio_timings
[i
].hold_time
,
246 ide_pio_timings
[i
].cycle_time
);
251 if (data_port
>= MAX_HWIFS
)
255 printk ("PCMCIA slot has not been defined! Using A as default\n");
259 #ifdef CONFIG_IDE_8xx_PCCARD
262 printk ("PIPR = 0x%08X slot %c ==> mask = 0x%X\n",
265 M8XX_PCMCIA_CD1(_slot_
) | M8XX_PCMCIA_CD2(_slot_
) );
268 if (pcmp
->pcmc_pipr
& (M8XX_PCMCIA_CD1(_slot_
)|M8XX_PCMCIA_CD2(_slot_
))) {
269 printk ("No card in slot %c: PIPR=%08x\n",
270 'A' + _slot_
, (u32
) pcmp
->pcmc_pipr
);
271 return; /* No card in slot */
274 check_ide_device (pcmcia_base
);
276 #endif /* CONFIG_IDE_8xx_PCCARD */
278 base
= pcmcia_base
+ ioport_dsc
[data_port
].base_off
;
280 printk ("base: %08x + %08x = %08x\n",
281 pcmcia_base
, ioport_dsc
[data_port
].base_off
, base
);
284 for (i
= 0; i
< IDE_NR_PORTS
; ++i
) {
286 printk ("port[%d]: %08x + %08x = %08x\n",
289 ioport_dsc
[data_port
].reg_off
[i
],
290 i
, base
+ ioport_dsc
[data_port
].reg_off
[i
]);
292 *p
++ = base
+ ioport_dsc
[data_port
].reg_off
[i
];
296 #ifdef CONFIG_IDE_8xx_PCCARD
299 *irq
= ioport_dsc
[data_port
].irq
;
301 pgcrx
= &((immap_t
*) IMAP_ADDR
)->im_pcmcia
.pcmc_pgcrb
;
303 pgcrx
= &((immap_t
*) IMAP_ADDR
)->im_pcmcia
.pcmc_pgcra
;
306 reg
|= mk_int_int_mask (pcmcia_schlvl
) << 24;
307 reg
|= mk_int_int_mask (pcmcia_schlvl
) << 16;
309 #else /* direct connected IDE drive, i.e. external IRQ, not the PCMCIA irq */
310 *irq
= ioport_dsc
[data_port
].irq
;
311 #endif /* CONFIG_IDE_8xx_PCCARD */
314 ide_hwifs
[data_port
].pio_mask
= ATA_PIO4
;
315 ide_hwifs
[data_port
].set_pio_mode
= m8xx_ide_set_pio_mode
;
316 ide_hwifs
[data_port
].ack_intr
= (ide_ack_intr_t
*)ide_interrupt_ack
;
318 /* Enable Harddisk Interrupt,
319 * and make it edge sensitive
321 /* (11-18) Set edge detect for irq, no wakeup from low power mode */
322 ((immap_t
*)IMAP_ADDR
)->im_siu_conf
.sc_siel
|=
323 (0x80000000 >> ioport_dsc
[data_port
].irq
);
325 #ifdef CONFIG_IDE_8xx_PCCARD
326 /* Make sure we don't get garbage irq */
327 ((immap_t
*) IMAP_ADDR
)->im_pcmcia
.pcmc_pscr
= 0xFFFF;
329 /* Enable falling edge irq */
330 pcmp
->pcmc_per
= 0x100000 >> (16 * _slot_
);
331 #endif /* CONFIG_IDE_8xx_PCCARD */
332 } /* m8xx_ide_init_hwif_ports() using 8xx internal PCMCIA interface */
333 #endif /* CONFIG_IDE_8xx_PCCARD || CONFIG_IDE_8xx_DIRECT */
336 * m8xx_ide_init_hwif_ports for a direct IDE interface _not_ using
337 * MPC8xx's internal PCMCIA interface
339 #if defined(CONFIG_IDE_EXT_DIRECT)
340 void m8xx_ide_init_hwif_ports (hw_regs_t
*hw
,
341 unsigned long data_port
, unsigned long ctrl_port
, int *irq
)
343 unsigned long *p
= hw
->io_ports
;
348 static unsigned long ide_base
= 0;
358 * - add code to read ORx, BRx
360 ide_phy_base
= CFG_ATA_BASE_ADDR
;
361 ide_phy_end
= CFG_ATA_BASE_ADDR
+ 0x200;
363 printk ("IDE phys mem : %08x...%08x (size %08x)\n",
364 ide_phy_base
, ide_phy_end
,
365 ide_phy_end
- ide_phy_base
);
367 ide_base
=(unsigned long)ioremap(ide_phy_base
,
368 ide_phy_end
-ide_phy_base
);
371 printk ("IDE virt base: %08lx\n", ide_base
);
375 if (data_port
>= MAX_HWIFS
)
378 base
= ide_base
+ ioport_dsc
[data_port
].base_off
;
380 printk ("base: %08x + %08x = %08x\n",
381 ide_base
, ioport_dsc
[data_port
].base_off
, base
);
384 for (i
= 0; i
< IDE_NR_PORTS
; ++i
) {
386 printk ("port[%d]: %08x + %08x = %08x\n",
389 ioport_dsc
[data_port
].reg_off
[i
],
390 i
, base
+ ioport_dsc
[data_port
].reg_off
[i
]);
392 *p
++ = base
+ ioport_dsc
[data_port
].reg_off
[i
];
396 /* direct connected IDE drive, i.e. external IRQ */
397 *irq
= ioport_dsc
[data_port
].irq
;
400 ide_hwifs
[data_port
].pio_mask
= ATA_PIO4
;
401 ide_hwifs
[data_port
].set_pio_mode
= m8xx_ide_set_pio_mode
;
402 ide_hwifs
[data_port
].ack_intr
= (ide_ack_intr_t
*)ide_interrupt_ack
;
404 /* Enable Harddisk Interrupt,
405 * and make it edge sensitive
407 /* (11-18) Set edge detect for irq, no wakeup from low power mode */
408 ((immap_t
*) IMAP_ADDR
)->im_siu_conf
.sc_siel
|=
409 (0x80000000 >> ioport_dsc
[data_port
].irq
);
410 } /* m8xx_ide_init_hwif_ports() for CONFIG_IDE_8xx_DIRECT */
412 #endif /* CONFIG_IDE_8xx_DIRECT */
415 /* -------------------------------------------------------------------- */
420 #define PCMCIA_SHT(t) ((t & 0x0F)<<16) /* Strobe Hold Time */
421 #define PCMCIA_SST(t) ((t & 0x0F)<<12) /* Strobe Setup Time */
422 #define PCMCIA_SL(t) ((t==32) ? 0 : ((t & 0x1F)<<7)) /* Strobe Length */
425 /* Calculate PIO timings */
426 static void m8xx_ide_set_pio_mode(ide_drive_t
*drive
, const u8 pio
)
428 #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT)
429 volatile pcmconf8xx_t
*pcmp
;
430 ulong timing
, mask
, reg
;
432 pcmp
= (pcmconf8xx_t
*)(&(((immap_t
*)IMAP_ADDR
)->im_pcmcia
));
434 mask
= ~(PCMCIA_SHT(0xFF) | PCMCIA_SST(0xFF) | PCMCIA_SL(0xFF));
436 timing
= PCMCIA_SHT(hold_time
[pio
] )
437 | PCMCIA_SST(ide_pio_clocks
[pio
].setup_time
)
438 | PCMCIA_SL (ide_pio_clocks
[pio
].active_time
)
442 printk ("Setting timing bits 0x%08lx in PCMCIA controller\n", timing
);
444 if ((reg
= pcmp
->pcmc_por0
& mask
) != 0)
445 pcmp
->pcmc_por0
= reg
| timing
;
447 if ((reg
= pcmp
->pcmc_por1
& mask
) != 0)
448 pcmp
->pcmc_por1
= reg
| timing
;
450 if ((reg
= pcmp
->pcmc_por2
& mask
) != 0)
451 pcmp
->pcmc_por2
= reg
| timing
;
453 if ((reg
= pcmp
->pcmc_por3
& mask
) != 0)
454 pcmp
->pcmc_por3
= reg
| timing
;
456 if ((reg
= pcmp
->pcmc_por4
& mask
) != 0)
457 pcmp
->pcmc_por4
= reg
| timing
;
459 if ((reg
= pcmp
->pcmc_por5
& mask
) != 0)
460 pcmp
->pcmc_por5
= reg
| timing
;
462 if ((reg
= pcmp
->pcmc_por6
& mask
) != 0)
463 pcmp
->pcmc_por6
= reg
| timing
;
465 if ((reg
= pcmp
->pcmc_por7
& mask
) != 0)
466 pcmp
->pcmc_por7
= reg
| timing
;
468 #elif defined(CONFIG_IDE_EXT_DIRECT)
470 printk("%s[%d] %s: not implemented yet!\n",
471 __FILE__
,__LINE__
,__FUNCTION__
);
472 #endif /* defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_PCMCIA */
476 ide_interrupt_ack (void *dev
)
478 #ifdef CONFIG_IDE_8xx_PCCARD
481 #if (PCMCIA_SOCKETS_NO == 2)
485 /* get interrupt sources */
487 pscr
= ((volatile immap_t
*)IMAP_ADDR
)->im_pcmcia
.pcmc_pscr
;
488 pipr
= ((volatile immap_t
*)IMAP_ADDR
)->im_pcmcia
.pcmc_pipr
;
491 * report only if both card detect signals are the same
493 * we depend on that CD2 is the bit to the left of CD1...
497 printk("PCMCIA slot has not been defined! Using A as default\n");
501 if(((pipr
& M8XX_PCMCIA_CD2(_slot_
)) >> 1) ^
502 (pipr
& M8XX_PCMCIA_CD1(_slot_
)) ) {
503 printk ("card detect interrupt\n");
505 /* clear the interrupt sources */
506 ((immap_t
*)IMAP_ADDR
)->im_pcmcia
.pcmc_pscr
= pscr
;
508 #else /* ! CONFIG_IDE_8xx_PCCARD */
510 * Only CONFIG_IDE_8xx_PCCARD is using the interrupt of the
511 * MPC8xx's PCMCIA controller, so there is nothing to be done here
512 * for CONFIG_IDE_8xx_DIRECT and CONFIG_IDE_EXT_DIRECT.
513 * The interrupt is handled somewhere else. -- Steven
515 #endif /* CONFIG_IDE_8xx_PCCARD */
523 #define CISTPL_NULL 0x00
524 #define CISTPL_DEVICE 0x01
525 #define CISTPL_LONGLINK_CB 0x02
526 #define CISTPL_INDIRECT 0x03
527 #define CISTPL_CONFIG_CB 0x04
528 #define CISTPL_CFTABLE_ENTRY_CB 0x05
529 #define CISTPL_LONGLINK_MFC 0x06
530 #define CISTPL_BAR 0x07
531 #define CISTPL_PWR_MGMNT 0x08
532 #define CISTPL_EXTDEVICE 0x09
533 #define CISTPL_CHECKSUM 0x10
534 #define CISTPL_LONGLINK_A 0x11
535 #define CISTPL_LONGLINK_C 0x12
536 #define CISTPL_LINKTARGET 0x13
537 #define CISTPL_NO_LINK 0x14
538 #define CISTPL_VERS_1 0x15
539 #define CISTPL_ALTSTR 0x16
540 #define CISTPL_DEVICE_A 0x17
541 #define CISTPL_JEDEC_C 0x18
542 #define CISTPL_JEDEC_A 0x19
543 #define CISTPL_CONFIG 0x1a
544 #define CISTPL_CFTABLE_ENTRY 0x1b
545 #define CISTPL_DEVICE_OC 0x1c
546 #define CISTPL_DEVICE_OA 0x1d
547 #define CISTPL_DEVICE_GEO 0x1e
548 #define CISTPL_DEVICE_GEO_A 0x1f
549 #define CISTPL_MANFID 0x20
550 #define CISTPL_FUNCID 0x21
551 #define CISTPL_FUNCE 0x22
552 #define CISTPL_SWIL 0x23
553 #define CISTPL_END 0xff
556 * CIS Function ID codes
558 #define CISTPL_FUNCID_MULTI 0x00
559 #define CISTPL_FUNCID_MEMORY 0x01
560 #define CISTPL_FUNCID_SERIAL 0x02
561 #define CISTPL_FUNCID_PARALLEL 0x03
562 #define CISTPL_FUNCID_FIXED 0x04
563 #define CISTPL_FUNCID_VIDEO 0x05
564 #define CISTPL_FUNCID_NETWORK 0x06
565 #define CISTPL_FUNCID_AIMS 0x07
566 #define CISTPL_FUNCID_SCSI 0x08
569 * Fixed Disk FUNCE codes
571 #define CISTPL_IDE_INTERFACE 0x01
573 #define CISTPL_FUNCE_IDE_IFACE 0x01
574 #define CISTPL_FUNCE_IDE_MASTER 0x02
575 #define CISTPL_FUNCE_IDE_SLAVE 0x03
577 /* First feature byte */
578 #define CISTPL_IDE_SILICON 0x04
579 #define CISTPL_IDE_UNIQUE 0x08
580 #define CISTPL_IDE_DUAL 0x10
582 /* Second feature byte */
583 #define CISTPL_IDE_HAS_SLEEP 0x01
584 #define CISTPL_IDE_HAS_STANDBY 0x02
585 #define CISTPL_IDE_HAS_IDLE 0x04
586 #define CISTPL_IDE_LOW_POWER 0x08
587 #define CISTPL_IDE_REG_INHIBIT 0x10
588 #define CISTPL_IDE_HAS_INDEX 0x20
589 #define CISTPL_IDE_IOIS16 0x40
592 /* -------------------------------------------------------------------- */
595 #define MAX_TUPEL_SZ 512
596 #define MAX_FEATURES 4
598 static int check_ide_device (unsigned long base
)
600 volatile u8
*ident
= NULL
;
601 volatile u8
*feature_p
[MAX_FEATURES
];
602 volatile u8
*p
, *start
;
606 unsigned short config_base
= 0;
611 printk ("PCMCIA MEM: %08lX\n", base
);
613 start
= p
= (volatile u8
*) base
;
615 while ((p
- start
) < MAX_TUPEL_SZ
) {
619 if (code
== 0xFF) { /* End of chain */
625 { volatile u8
*q
= p
;
626 printk ("\nTuple code %02x length %d\n\tData:",
629 for (i
= 0; i
< len
; ++i
) {
630 printk (" %02x", *q
);
634 #endif /* DEBUG_PCMCIA */
643 if (n_features
< MAX_FEATURES
)
644 feature_p
[n_features
++] = p
;
647 config_base
= (*(p
+6) << 8) + (*(p
+4));
654 found
= identify (ident
);
656 if (func_id
!= ((u8
)~0)) {
657 print_funcid (func_id
);
659 if (func_id
== CISTPL_FUNCID_FIXED
)
662 return (1); /* no disk drive */
665 for (i
=0; i
<n_features
; ++i
) {
666 print_fixed (feature_p
[i
]);
670 printk ("unknown card type\n");
674 /* set level mode irq and I/O mapped device in config reg*/
675 *((u8
*)(base
+ config_base
)) = 0x41;
680 /* ------------------------------------------------------------------------- */
682 static void print_funcid (int func
)
685 case CISTPL_FUNCID_MULTI
:
686 printk (" Multi-Function");
688 case CISTPL_FUNCID_MEMORY
:
691 case CISTPL_FUNCID_SERIAL
:
692 printk (" Serial Port");
694 case CISTPL_FUNCID_PARALLEL
:
695 printk (" Parallel Port");
697 case CISTPL_FUNCID_FIXED
:
698 printk (" Fixed Disk");
700 case CISTPL_FUNCID_VIDEO
:
701 printk (" Video Adapter");
703 case CISTPL_FUNCID_NETWORK
:
704 printk (" Network Adapter");
706 case CISTPL_FUNCID_AIMS
:
707 printk (" AIMS Card");
709 case CISTPL_FUNCID_SCSI
:
710 printk (" SCSI Adapter");
719 /* ------------------------------------------------------------------------- */
721 static void print_fixed (volatile u8
*p
)
727 case CISTPL_FUNCE_IDE_IFACE
:
730 printk ((iface
== CISTPL_IDE_INTERFACE
) ? " IDE" : " unknown");
731 printk (" interface ");
734 case CISTPL_FUNCE_IDE_MASTER
:
735 case CISTPL_FUNCE_IDE_SLAVE
:
739 printk ((f1
& CISTPL_IDE_SILICON
) ? " [silicon]" : " [rotating]");
741 if (f1
& CISTPL_IDE_UNIQUE
)
742 printk (" [unique]");
744 printk ((f1
& CISTPL_IDE_DUAL
) ? " [dual]" : " [single]");
746 if (f2
& CISTPL_IDE_HAS_SLEEP
)
749 if (f2
& CISTPL_IDE_HAS_STANDBY
)
750 printk (" [standby]");
752 if (f2
& CISTPL_IDE_HAS_IDLE
)
755 if (f2
& CISTPL_IDE_LOW_POWER
)
756 printk (" [low power]");
758 if (f2
& CISTPL_IDE_REG_INHIBIT
)
759 printk (" [reg inhibit]");
761 if (f2
& CISTPL_IDE_HAS_INDEX
)
764 if (f2
& CISTPL_IDE_IOIS16
)
765 printk (" [IOis16]");
773 /* ------------------------------------------------------------------------- */
776 #define MAX_IDENT_CHARS 64
777 #define MAX_IDENT_FIELDS 4
779 static u8
*known_cards
[] = {
784 static int identify (volatile u8
*p
)
786 u8 id_str
[MAX_IDENT_CHARS
];
793 return (0); /* Don't know */
798 for (i
=0; i
<=4 && !done
; ++i
, p
+=2) {
799 while ((data
= *p
) != '\0') {
805 if (t
== &id_str
[MAX_IDENT_CHARS
-1]) {
815 while (--t
> id_str
) {
821 printk ("Card ID: %s\n", id_str
);
823 for (card
=known_cards
; *card
; ++card
) {
824 if (strcmp(*card
, id_str
) == 0) { /* found! */
829 return (0); /* don't know */
832 void m8xx_ide_init(void)
834 ppc_ide_md
.default_irq
= m8xx_ide_default_irq
;
835 ppc_ide_md
.default_io_base
= m8xx_ide_default_io_base
;
836 ppc_ide_md
.ide_init_hwif
= m8xx_ide_init_hwif_ports
;
839 static int __init
mpc8xx_ide_probe(void)
841 u8 idx
[4] = { 0xff, 0xff, 0xff, 0xff };
843 #ifdef IDE0_BASE_OFFSET
845 #ifdef IDE1_BASE_OFFSET
850 ide_device_add(idx
, NULL
);
855 module_init(mpc8xx_ide_probe
);