2 * linux/include/asm-arm/arch-sa1100/ide.h
4 * Copyright (c) 1998 Hugo Fiennes & Nicolas Pitre
6 * 18-aug-2000: Cleanup by Erik Mouw (J.A.K.Mouw@its.tudelft.nl)
7 * Get rid of the special ide_init_hwif_ports() functions
8 * and make a generalised function that can be used by all
12 #include <linux/config.h>
14 #include <asm/hardware.h>
15 #include <asm/mach-types.h>
19 * Set up a hw structure for a specified data port, control port and IRQ.
20 * This should follow whatever the default interface uses.
22 static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
23 unsigned long ctrl_port, int *irq)
25 unsigned long reg = data_port;
29 /* The Empeg board has the first two address lines unused */
30 if (machine_is_empeg())
33 /* The LART doesn't use A0 for IDE */
34 if (machine_is_lart())
37 memset(hw, 0, sizeof(*hw));
39 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
40 hw->io_ports[i] = reg;
44 hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
50 #ifdef CONFIG_SA1100_TRIZEPS
51 #include <asm/arch/trizeps.h>
55 * This registers the standard ports for this architecture with the IDE
58 static __inline__ void
59 ide_init_default_hwifs(void)
61 if( machine_is_empeg() ){
62 #ifdef CONFIG_SA1100_EMPEG
65 /* First, do the SA1100 setup */
70 /* Issue 3 is much neater than issue 2 */
71 GPDR&=~(EMPEG_IDE1IRQ|EMPEG_IDE2IRQ);
73 /* Interrupts on rising edge: lines are inverted before they get to
75 set_GPIO_IRQ_edge( (EMPEG_IDE1IRQ|EMPEG_IDE2IRQ), GPIO_FALLING_EDGE );
77 /* Take hard drives out of reset */
78 GPSR=(EMPEG_IDERESET);
80 /* Sonja and her successors have two IDE ports. */
81 /* MAC 23/4/1999, swap these round so that the left hand
82 hard disk is hda when viewed from the front. This
83 doesn't match the silkscreen however. */
84 ide_init_hwif_ports(&hw, PCMCIA_IO_0_BASE + 0x40, PCMCIA_IO_0_BASE + 0x78, NULL);
85 hw.irq = EMPEG_IRQ_IDE2;
87 ide_init_hwif_ports(&hw, PCMCIA_IO_0_BASE + 0x00, PCMCIA_IO_0_BASE + 0x38, NULL);
88 hw.irq = ,EMPEG_IRQ_IDE1;
93 else if( machine_is_victor() ){
94 #ifdef CONFIG_SA1100_VICTOR
97 /* Enable appropriate GPIOs as interrupt lines */
99 set_GPIO_IRQ_edge( GPIO_GPIO7, GPIO_RISING_EDGE );
101 /* set the pcmcia interface timing */
104 ide_init_hwif_ports(&hw, PCMCIA_IO_0_BASE + 0x1f0, PCMCIA_IO_0_BASE + 0x3f6, NULL);
106 ide_register_hw(&hw);
109 else if (machine_is_lart()) {
110 #ifdef CONFIG_SA1100_LART
113 /* Enable GPIO as interrupt line */
114 GPDR &= ~LART_GPIO_IDE;
115 set_irq_type(LART_IRQ_IDE, IRQT_RISING);
117 /* set PCMCIA interface timing */
120 /* init the interface */
121 ide_init_hwif_ports(&hw, PCMCIA_IO_0_BASE + 0x0000, PCMCIA_IO_0_BASE + 0x1000, NULL);
122 hw.irq = LART_IRQ_IDE;
123 ide_register_hw(&hw);
126 else if( machine_is_trizeps() ){
127 #ifdef CONFIG_SA1100_TRIZEPS
130 /* Enable appropriate GPIOs as interrupt lines */
131 GPDR &= ~GPIO_GPIO(TRIZEPS_IRQ_IDE);
132 set_irq_type( TRIZEPS_IRQ_IDE, IRQT_RISING );
134 /* set the pcmcia interface timing */
135 //MECR = 0x00060006; // Done on trizeps init
137 /* Take hard drives out of reset */
138 GPSR = GPIO_GPIO(TRIZEPS_IRQ_IDE);
140 ide_init_hwif_ports(&hw, TRIZEPS_IDE_CS0 + 0, TRIZEPS_IDE_CS1 + 6, NULL);
141 hw.irq = TRIZEPS_IRQ_IDE;
142 ide_register_hw(&hw, NULL);