falconide.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * Atari Falcon IDE Driver
  3. *
  4. * Created 12 Jul 1997 by Geert Uytterhoeven
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file COPYING in the main directory of this archive for
  8. * more details.
  9. */
  10. #include <linux/module.h>
  11. #include <linux/types.h>
  12. #include <linux/mm.h>
  13. #include <linux/interrupt.h>
  14. #include <linux/blkdev.h>
  15. #include <linux/hdreg.h>
  16. #include <linux/ide.h>
  17. #include <linux/init.h>
  18. #include <asm/setup.h>
  19. #include <asm/atarihw.h>
  20. #include <asm/atariints.h>
  21. #include <asm/atari_stdma.h>
  22. /*
  23. * Base of the IDE interface
  24. */
  25. #define ATA_HD_BASE 0xfff00000
  26. /*
  27. * Offsets from the above base
  28. */
  29. #define ATA_HD_DATA 0x00
  30. #define ATA_HD_ERROR 0x05 /* see err-bits */
  31. #define ATA_HD_NSECTOR 0x09 /* nr of sectors to read/write */
  32. #define ATA_HD_SECTOR 0x0d /* starting sector */
  33. #define ATA_HD_LCYL 0x11 /* starting cylinder */
  34. #define ATA_HD_HCYL 0x15 /* high byte of starting cyl */
  35. #define ATA_HD_SELECT 0x19 /* 101dhhhh , d=drive, hhhh=head */
  36. #define ATA_HD_STATUS 0x1d /* see status-bits */
  37. #define ATA_HD_CONTROL 0x39
  38. static int falconide_offsets[IDE_NR_PORTS] __initdata = {
  39. ATA_HD_DATA, ATA_HD_ERROR, ATA_HD_NSECTOR, ATA_HD_SECTOR, ATA_HD_LCYL,
  40. ATA_HD_HCYL, ATA_HD_SELECT, ATA_HD_STATUS, ATA_HD_CONTROL, -1
  41. };
  42. /*
  43. * falconide_intr_lock is used to obtain access to the IDE interrupt,
  44. * which is shared between several drivers.
  45. */
  46. int falconide_intr_lock;
  47. EXPORT_SYMBOL(falconide_intr_lock);
  48. /*
  49. * Probe for a Falcon IDE interface
  50. */
  51. static int __init falconide_init(void)
  52. {
  53. if (MACH_IS_ATARI && ATARIHW_PRESENT(IDE)) {
  54. hw_regs_t hw;
  55. ide_hwif_t *hwif;
  56. printk(KERN_INFO "ide: Falcon IDE controller\n");
  57. ide_setup_ports(&hw, ATA_HD_BASE, falconide_offsets,
  58. 0, 0, NULL,
  59. // falconide_iops,
  60. IRQ_MFP_IDE);
  61. hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
  62. if (hwif) {
  63. u8 index = hwif->index;
  64. u8 idx[4] = { index, 0xff, 0xff, 0xff };
  65. ide_init_port_data(hwif, index);
  66. ide_init_port_hw(hwif, &hw);
  67. ide_device_add(idx, NULL);
  68. }
  69. }
  70. return 0;
  71. }
  72. module_init(falconide_init);