patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / include / asm-arm / arch-lh7a40x / ide.h
1 /* include/asm-arm/arch-lh7a40x/ide.h
2  *
3  *  Copyright (C) 2004 Logic Product Development
4  *
5  *  This program is free software; you can redistribute it and/or
6  *  modify it under the terms of the GNU General Public License
7  *  version 2 as published by the Free Software Foundation.
8  *
9  */
10
11 #ifndef __ASM_ARCH_IDE_H
12 #define __ASM_ARCH_IDE_H
13
14 #if defined (CONFIG_MACH_LPD7A400) || defined (CONFIG_MACH_LPD7A404)
15
16 /*  This implementation of ide.h only applies to the LPD CardEngines.
17  *  Thankfully, there is less to do for the KEV.
18  */
19
20 #include <linux/config.h>
21 #include <asm/irq.h>
22 #include <asm/hardware.h>
23 #include <asm/arch/registers.h>
24
25 #define IDE_REG_LINE    (1<<12) /* A12 drives !REG  */
26 #define IDE_ALT_LINE    (1<<11) /* Unused A11 allows non-overlapping regions */
27 #define IDE_CONTROLREG_OFFSET   (0xe)
28
29 void lpd7a40x_hwif_ioops (struct hwif_s* hwif);
30
31 static __inline__ void ide_init_hwif_ports (hw_regs_t *hw, int data_port,
32                                             int ctrl_port, int *irq)
33 {
34         ide_ioreg_t reg;
35         int i;
36         int regincr = 1;
37
38         memset (hw, 0, sizeof (*hw));
39
40         reg = (ide_ioreg_t) data_port;
41
42         for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
43                 hw->io_ports[i] = reg;
44                 reg += regincr;
45         }
46
47         hw->io_ports[IDE_CONTROL_OFFSET] = (ide_ioreg_t) ctrl_port;
48
49         if (irq)
50                 *irq = IDE_NO_IRQ;
51 }
52
53 static __inline__  void ide_init_default_hwifs (void)
54 {
55         hw_regs_t hw;
56         struct hwif_s* hwif;
57
58         ide_init_hwif_ports (&hw,
59                              CF_VIRT + IDE_REG_LINE,
60                              CF_VIRT + IDE_REG_LINE + IDE_ALT_LINE
61                              + IDE_CONTROLREG_OFFSET,
62                              NULL);
63
64         ide_register_hw (&hw, &hwif);
65         lpd7a40x_hwif_ioops (hwif); /* Override IO routines */
66 }
67 #endif
68
69 #endif