falconide.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. #define DRV_NAME "falconide"
  23. /*
  24. * Base of the IDE interface
  25. */
  26. #define ATA_HD_BASE 0xfff00000
  27. /*
  28. * Offsets from the above base
  29. */
  30. #define ATA_HD_CONTROL 0x39
  31. /*
  32. * falconide_intr_lock is used to obtain access to the IDE interrupt,
  33. * which is shared between several drivers.
  34. */
  35. int falconide_intr_lock;
  36. EXPORT_SYMBOL(falconide_intr_lock);
  37. static void __init falconide_setup_ports(hw_regs_t *hw)
  38. {
  39. int i;
  40. memset(hw, 0, sizeof(*hw));
  41. hw->io_ports[IDE_DATA_OFFSET] = ATA_HD_BASE;
  42. for (i = 1; i < 8; i++)
  43. hw->io_ports[i] = ATA_HD_BASE + 1 + i * 4;
  44. hw->io_ports[IDE_CONTROL_OFFSET] = ATA_HD_BASE + ATA_HD_CONTROL;
  45. hw->irq = IRQ_MFP_IDE;
  46. hw->ack_intr = NULL;
  47. }
  48. /*
  49. * Probe for a Falcon IDE interface
  50. */
  51. static int __init falconide_init(void)
  52. {
  53. hw_regs_t hw;
  54. ide_hwif_t *hwif;
  55. if (!MACH_IS_ATARI || !ATARIHW_PRESENT(IDE))
  56. return 0;
  57. printk(KERN_INFO "ide: Falcon IDE controller\n");
  58. if (!request_mem_region(ATA_HD_BASE, 0x40, DRV_NAME)) {
  59. printk(KERN_ERR "%s: resources busy\n", DRV_NAME);
  60. return -EBUSY;
  61. }
  62. falconide_setup_ports(&hw);
  63. hwif = ide_find_port();
  64. if (hwif) {
  65. u8 index = hwif->index;
  66. u8 idx[4] = { index, 0xff, 0xff, 0xff };
  67. ide_init_port_data(hwif, index);
  68. ide_init_port_hw(hwif, &hw);
  69. hwif->mmio = 1;
  70. ide_get_lock(NULL, NULL);
  71. ide_device_add(idx, NULL);
  72. ide_release_lock();
  73. }
  74. return 0;
  75. }
  76. module_init(falconide_init);
  77. MODULE_LICENSE("GPL");