falconide.c 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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_CONTROL 0x39
  30. /*
  31. * falconide_intr_lock is used to obtain access to the IDE interrupt,
  32. * which is shared between several drivers.
  33. */
  34. int falconide_intr_lock;
  35. EXPORT_SYMBOL(falconide_intr_lock);
  36. static void __init falconide_setup_ports(hw_regs_t *hw)
  37. {
  38. int i;
  39. memset(hw, 0, sizeof(*hw));
  40. hw->io_ports[IDE_DATA_OFFSET] = ATA_HD_BASE;
  41. for (i = 1; i < 8; i++)
  42. hw->io_ports[i] = ATA_HD_BASE + 1 + i * 4;
  43. hw->io_ports[IDE_CONTROL_OFFSET] = ATA_HD_BASE + ATA_HD_CONTROL;
  44. hw->irq = IRQ_MFP_IDE;
  45. hw->ack_intr = NULL;
  46. }
  47. /*
  48. * Probe for a Falcon IDE interface
  49. */
  50. static int __init falconide_init(void)
  51. {
  52. hw_regs_t hw;
  53. ide_hwif_t *hwif;
  54. if (!MACH_IS_ATARI || !ATARIHW_PRESENT(IDE))
  55. return 0;
  56. printk(KERN_INFO "ide: Falcon IDE controller\n");
  57. falconide_setup_ports(&hw);
  58. hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
  59. if (hwif) {
  60. u8 index = hwif->index;
  61. u8 idx[4] = { index, 0xff, 0xff, 0xff };
  62. ide_init_port_data(hwif, index);
  63. ide_init_port_hw(hwif, &hw);
  64. ide_get_lock(NULL, NULL);
  65. ide_device_add(idx, NULL);
  66. ide_release_lock();
  67. }
  68. return 0;
  69. }
  70. module_init(falconide_init);
  71. MODULE_LICENSE("GPL");