bast-ide.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* linux/drivers/ide/arm/bast-ide.c
  2. *
  3. * Copyright (c) 2003-2004 Simtec Electronics
  4. * Ben Dooks <ben@simtec.co.uk>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. *
  10. */
  11. #include <linux/module.h>
  12. #include <linux/errno.h>
  13. #include <linux/ide.h>
  14. #include <linux/init.h>
  15. #include <asm/mach-types.h>
  16. #include <asm/io.h>
  17. #include <asm/irq.h>
  18. #include <asm/arch/map.h>
  19. #include <asm/arch/bast-map.h>
  20. #include <asm/arch/bast-irq.h>
  21. /* list of registered interfaces */
  22. static ide_hwif_t *ifs[2];
  23. static int __init
  24. bastide_register(unsigned int base, unsigned int aux, int irq,
  25. ide_hwif_t **hwif)
  26. {
  27. hw_regs_t hw;
  28. int i;
  29. memset(&hw, 0, sizeof(hw));
  30. base += BAST_IDE_CS;
  31. aux += BAST_IDE_CS;
  32. for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
  33. hw.io_ports[i] = (unsigned long)base;
  34. base += 0x20;
  35. }
  36. hw.io_ports[IDE_CONTROL_OFFSET] = aux + (6 * 0x20);
  37. hw.irq = irq;
  38. ide_register_hw(&hw, hwif);
  39. return 0;
  40. }
  41. static int __init bastide_init(void)
  42. {
  43. /* we can treat the VR1000 and the BAST the same */
  44. if (!(machine_is_bast() || machine_is_vr1000()))
  45. return 0;
  46. printk("BAST: IDE driver, (c) 2003-2004 Simtec Electronics\n");
  47. bastide_register(BAST_VA_IDEPRI, BAST_VA_IDEPRIAUX, IRQ_IDE0, &ifs[0]);
  48. bastide_register(BAST_VA_IDESEC, BAST_VA_IDESECAUX, IRQ_IDE1, &ifs[1]);
  49. return 0;
  50. }
  51. module_init(bastide_init);
  52. MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
  53. MODULE_LICENSE("GPL");
  54. MODULE_DESCRIPTION("Simtec BAST / Thorcom VR1000 IDE driver");