ide.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * linux/include/asm-arm/arch-sa1100/ide.h
  3. *
  4. * Copyright (c) 1998 Hugo Fiennes & Nicolas Pitre
  5. *
  6. * 18-aug-2000: Cleanup by Erik Mouw (J.A.K.Mouw@its.tudelft.nl)
  7. * Get rid of the special ide_init_hwif_ports() functions
  8. * and make a generalised function that can be used by all
  9. * architectures.
  10. */
  11. #include <asm/irq.h>
  12. #include <asm/hardware.h>
  13. #include <asm/mach-types.h>
  14. #error "This code is broken and needs update to match with current ide support"
  15. /*
  16. * Set up a hw structure for a specified data port, control port and IRQ.
  17. * This should follow whatever the default interface uses.
  18. */
  19. static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
  20. unsigned long ctrl_port, int *irq)
  21. {
  22. unsigned long reg = data_port;
  23. int i;
  24. int regincr = 1;
  25. /* The Empeg board has the first two address lines unused */
  26. if (machine_is_empeg())
  27. regincr = 1 << 2;
  28. /* The LART doesn't use A0 for IDE */
  29. if (machine_is_lart())
  30. regincr = 1 << 1;
  31. memset(hw, 0, sizeof(*hw));
  32. for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
  33. hw->io_ports[i] = reg;
  34. reg += regincr;
  35. }
  36. hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
  37. if (irq)
  38. *irq = 0;
  39. }
  40. /*
  41. * This registers the standard ports for this architecture with the IDE
  42. * driver.
  43. */
  44. static __inline__ void
  45. ide_init_default_hwifs(void)
  46. {
  47. if (machine_is_lart()) {
  48. #ifdef CONFIG_SA1100_LART
  49. hw_regs_t hw;
  50. /* Enable GPIO as interrupt line */
  51. GPDR &= ~LART_GPIO_IDE;
  52. set_irq_type(LART_IRQ_IDE, IRQT_RISING);
  53. /* set PCMCIA interface timing */
  54. MECR = 0x00060006;
  55. /* init the interface */
  56. ide_init_hwif_ports(&hw, PCMCIA_IO_0_BASE + 0x0000, PCMCIA_IO_0_BASE + 0x1000, NULL);
  57. hw.irq = LART_IRQ_IDE;
  58. ide_register_hw(&hw);
  59. #endif
  60. }
  61. }