2 * linux/include/asm-cris/ide.h
4 * Copyright (C) 2000, 2001, 2002 Axis Communications AB
11 * This file contains the ETRAX 100LX specific IDE code.
14 #ifndef __ASMCRIS_IDE_H
15 #define __ASMCRIS_IDE_H
19 #include <asm/svinto.h>
21 /* ETRAX 100 can support 4 IDE busses on the same pins (serialized) */
25 extern __inline__ int ide_default_irq(ide_ioreg_t base)
27 /* all IDE busses share the same IRQ, number 4.
28 * this has the side-effect that ide-probe.c will cluster our 4 interfaces
29 * together in a hwgroup, and will serialize accesses. this is good, because
30 * we can't access more than one interface at the same time on ETRAX100.
35 extern __inline__ ide_ioreg_t ide_default_io_base(int index)
37 /* we have no real I/O base address per interface, since all go through the
38 * same register. but in a bitfield in that register, we have the i/f number.
39 * so we can use the io_base to remember that bitfield.
41 static const unsigned long io_bases[MAX_HWIFS] = {
42 IO_FIELD(R_ATA_CTRL_DATA, sel, 0),
43 IO_FIELD(R_ATA_CTRL_DATA, sel, 1),
44 IO_FIELD(R_ATA_CTRL_DATA, sel, 2),
45 IO_FIELD(R_ATA_CTRL_DATA, sel, 3)
47 return io_bases[index];
50 /* this is called once for each interface, to setup the port addresses. data_port is the result
51 * of the ide_default_io_base call above. ctrl_port will be 0, but that is don't care for us.
54 extern __inline__ void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq)
58 /* fill in ports for ATA addresses 0 to 7 */
60 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
61 hw->io_ports[i] = data_port |
62 IO_FIELD(R_ATA_CTRL_DATA, addr, i) |
63 IO_STATE(R_ATA_CTRL_DATA, cs0, active);
66 /* the IDE control register is at ATA address 6, with CS1 active instead of CS0 */
68 hw->io_ports[IDE_CONTROL_OFFSET] = data_port |
69 IO_FIELD(R_ATA_CTRL_DATA, addr, 6) |
70 IO_STATE(R_ATA_CTRL_DATA, cs1, active);
72 /* whats this for ? */
74 hw->io_ports[IDE_IRQ_OFFSET] = 0;
77 extern __inline__ void ide_init_default_hwifs(void)
82 for(index = 0; index < MAX_HWIFS; index++) {
83 ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
84 hw.irq = ide_default_irq(ide_default_io_base(index));
85 ide_register_hw(&hw, NULL);
89 /* some configuration options we don't need */
91 #undef SUPPORT_VLB_SYNC
92 #define SUPPORT_VLB_SYNC 0
94 #endif /* __KERNEL__ */
96 #endif /* __ASMCRIS_IDE_H */