2 * linux/drivers/ide/ppc/cpci405ide.c -- CPCI405 IDE Driver
4 * Copyright (C) 2001-2003 Stefan Roese, stefan.roese@esd-electronics.de
6 * This driver was written based on information obtained from the MacOS IDE
7 * driver binary by Mikael Forselius
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file COPYING in the main directory of this archive for
14 #include <linux/types.h>
16 #include <linux/interrupt.h>
17 #include <linux/blkdev.h>
18 #include <linux/hdreg.h>
19 #include <linux/delay.h>
20 #include <linux/ide.h>
21 #include <linux/init.h>
25 * Base of the IDE interface
28 #define CPCI405_HD_BASE 0xf0100000
31 * Offsets from the above base (scaling 4)
34 #define CPCI405_HD_DATA 0x00
35 #define CPCI405_HD_ERROR 0x01 /* see err-bits */
36 #define CPCI405_HD_NSECTOR 0x02 /* nr of sectors to read/write */
37 #define CPCI405_HD_SECTOR 0x03 /* starting sector */
38 #define CPCI405_HD_LCYL 0x04 /* starting cylinder */
39 #define CPCI405_HD_HCYL 0x05 /* high byte of starting cyl */
40 #define CPCI405_HD_SELECT 0x06 /* 101dhhhh , d=drive, hhhh=head */
41 #define CPCI405_HD_STATUS 0x07 /* see status-bits */
42 #define CPCI405_HD_CONTROL 0x0e /* control/altstatus */
44 #define CPCI405_IRQ_IDE 0x1f
46 static int cpci405ide_offsets[IDE_NR_PORTS] __initdata = {
47 CPCI405_HD_DATA, CPCI405_HD_ERROR, CPCI405_HD_NSECTOR, CPCI405_HD_SECTOR,
48 CPCI405_HD_LCYL, CPCI405_HD_HCYL, CPCI405_HD_SELECT, CPCI405_HD_STATUS,
52 static void *cpci405_ide_base_mapped;
56 * Probe for a CPCI405 IDE interface
59 void __init cpci405ide_init(void)
64 cpci405_ide_base_mapped =
65 ioremap((unsigned long) CPCI405_HD_BASE, 0x200) - _IO_BASE;
66 ide_setup_ports(&hw, (ide_ioreg_t)cpci405_ide_base_mapped,
67 cpci405ide_offsets, 0, 0, NULL, CPCI405_IRQ_IDE);
68 index = ide_register_hw(&hw, NULL);
70 printk("ide%d: CPCI405 IDE interface\n", index);