Merge with Linux 2.3.40.
[linux-2.6/linux-mips.git] / include / asm-arm / arch-sa1100 / ide.h
blob3a1f00e3d0a2a085e9d76bc7fad5158e8fe359ee
1 /*
2 * linux/include/asm-arm/arch-sa1100/ide.h
4 * Copyright (c) 1998 Hugo Fiennes & Nicolas Pitre
6 */
8 #include <linux/config.h>
10 #ifdef CONFIG_BLK_DEV_IDE
12 #include <asm/irq.h>
13 #include <asm/arch/hardware.h>
16 * Set up a hw structure for a specified data port, control port and IRQ.
17 * This should follow whatever the default interface uses.
19 static __inline__ void
20 ide_init_hwif_ports(hw_regs_t *hw, int data_port, int ctrl_port, int irq)
22 ide_ioreg_t reg;
23 int i;
25 memset(hw, 0, sizeof(*hw));
27 #ifdef CONFIG_SA1100_EMPEG
28 /* The Empeg board has the first two address lines unused */
29 #define IO_SHIFT 2
30 #else
31 #define IO_SHIFT 0
32 #endif
34 reg = (ide_ioreg_t) (data_port << IO_SHIFT);
35 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
36 hw->io_ports[i] = reg;
37 reg += (1 << IO_SHIFT);
39 hw->io_ports[IDE_CONTROL_OFFSET] = (ide_ioreg_t) (ctrl_port << IO_SHIFT);
40 hw->irq = irq;
44 * This registers the standard ports for this architecture with the IDE
45 * driver.
47 static __inline__ void
48 ide_init_default_hwifs(void)
50 hw_regs_t hw;
52 #if defined( CONFIG_SA1100_EMPEG )
53 /* First, do the SA1100 setup */
55 /* PCMCIA IO space */
56 MECR=0x21062106;
58 /* Issue 3 is much neater than issue 2 */
59 GPDR&=~(EMPEG_IDE1IRQ|EMPEG_IDE2IRQ);
61 /* Interrupts on rising edge: lines are inverted before they get to
62 the SA */
63 GRER&=~(EMPEG_IDE1IRQ|EMPEG_IDE2IRQ);
64 GFER|=(EMPEG_IDE1IRQ|EMPEG_IDE2IRQ);
66 /* Take hard drives out of reset */
67 GPSR=(EMPEG_IDERESET);
69 /* Clear GEDR */
70 GEDR=0xffffffff;
72 /* Sonja and her successors have two IDE ports. */
73 /* MAC 23/4/1999, swap these round so that the left hand
74 hard disk is hda when viewed from the front. This
75 doesn't match the silkscreen however. */
76 ide_init_hwif_ports(&hw,0x10,0x1e,EMPEG_IRQ_IDE2);
77 ide_register_hw(&hw, NULL);
78 ide_init_hwif_ports(&hw,0x00,0x0e,EMPEG_IRQ_IDE1);
79 ide_register_hw(&hw, NULL);
81 #elif defined( CONFIG_SA1100_VICTOR )
82 /* Enable appropriate GPIOs as interrupt lines */
83 GPDR &= ~GPIO_GPIO7;
84 GRER |= GPIO_GPIO7;
85 GFER &= ~GPIO_GPIO7;
86 GEDR = GPIO_GPIO7;
87 /* set the pcmcia interface timing */
88 MECR = 0x00060006;
90 ide_init_hwif_ports(&hw, 0x1f0, 0x3f6, IRQ_GPIO7);
91 ide_register_hw(&hw, NULL);
92 #else
93 #error Missing IDE interface definition in include/asm/arch/ide.h
94 #endif
97 #endif