ia64/kvm: compilation fix. export account_system_vtime.
[pv_ops_mirror.git] / drivers / ide / arm / bast-ide.c
blob713cef20622e986b3ff0e183861c9c0a8154c697
1 /*
2 * Copyright (c) 2003-2004 Simtec Electronics
3 * Ben Dooks <ben@simtec.co.uk>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 */
11 #include <linux/module.h>
12 #include <linux/errno.h>
13 #include <linux/ide.h>
14 #include <linux/init.h>
16 #include <asm/mach-types.h>
18 #include <asm/io.h>
19 #include <asm/irq.h>
20 #include <asm/arch/map.h>
21 #include <asm/arch/bast-map.h>
22 #include <asm/arch/bast-irq.h>
24 #define DRV_NAME "bast-ide"
26 static int __init bastide_register(unsigned int base, unsigned int aux, int irq)
28 ide_hwif_t *hwif;
29 hw_regs_t hw;
30 int i;
31 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
33 memset(&hw, 0, sizeof(hw));
35 base += BAST_IDE_CS;
36 aux += BAST_IDE_CS;
38 for (i = 0; i <= 7; i++) {
39 hw.io_ports_array[i] = (unsigned long)base;
40 base += 0x20;
43 hw.io_ports.ctl_addr = aux + (6 * 0x20);
44 hw.irq = irq;
46 hwif = ide_find_port();
47 if (hwif == NULL)
48 goto out;
50 i = hwif->index;
52 ide_init_port_data(hwif, i);
53 ide_init_port_hw(hwif, &hw);
54 hwif->port_ops = NULL;
56 idx[0] = i;
58 ide_device_add(idx, NULL);
59 out:
60 return 0;
63 static int __init bastide_init(void)
65 unsigned long base = BAST_VA_IDEPRI + BAST_IDE_CS;
67 /* we can treat the VR1000 and the BAST the same */
69 if (!(machine_is_bast() || machine_is_vr1000()))
70 return 0;
72 printk("BAST: IDE driver, (c) 2003-2004 Simtec Electronics\n");
74 if (!request_mem_region(base, 0x400000, DRV_NAME)) {
75 printk(KERN_ERR "%s: resources busy\n", DRV_NAME);
76 return -EBUSY;
79 bastide_register(BAST_VA_IDEPRI, BAST_VA_IDEPRIAUX, IRQ_IDE0);
80 bastide_register(BAST_VA_IDESEC, BAST_VA_IDESECAUX, IRQ_IDE1);
82 return 0;
85 module_init(bastide_init);
87 MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
88 MODULE_LICENSE("GPL");
89 MODULE_DESCRIPTION("Simtec BAST / Thorcom VR1000 IDE driver");