ide.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 <linux/config.h>
  12. #include <asm/irq.h>
  13. #include <asm/hardware.h>
  14. #include <asm/mach-types.h>
  15. #error "This code is broken and needs update to match with current ide support"
  16. /*
  17. * Set up a hw structure for a specified data port, control port and IRQ.
  18. * This should follow whatever the default interface uses.
  19. */
  20. static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
  21. unsigned long ctrl_port, int *irq)
  22. {
  23. unsigned long reg = data_port;
  24. int i;
  25. int regincr = 1;
  26. /* The Empeg board has the first two address lines unused */
  27. if (machine_is_empeg())
  28. regincr = 1 << 2;
  29. /* The LART doesn't use A0 for IDE */
  30. if (machine_is_lart())
  31. regincr = 1 << 1;
  32. memset(hw, 0, sizeof(*hw));
  33. for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
  34. hw->io_ports[i] = reg;
  35. reg += regincr;
  36. }
  37. hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
  38. if (irq)
  39. *irq = 0;
  40. }
  41. /*
  42. * This registers the standard ports for this architecture with the IDE
  43. * driver.
  44. */
  45. static __inline__ void
  46. ide_init_default_hwifs(void)
  47. {
  48. if (machine_is_lart()) {
  49. #ifdef CONFIG_SA1100_LART
  50. hw_regs_t hw;
  51. /* Enable GPIO as interrupt line */
  52. GPDR &= ~LART_GPIO_IDE;
  53. set_irq_type(LART_IRQ_IDE, IRQT_RISING);
  54. /* set PCMCIA interface timing */
  55. MECR = 0x00060006;
  56. /* init the interface */
  57. ide_init_hwif_ports(&hw, PCMCIA_IO_0_BASE + 0x0000, PCMCIA_IO_0_BASE + 0x1000, NULL);
  58. hw.irq = LART_IRQ_IDE;
  59. ide_register_hw(&hw);
  60. #endif
  61. }
  62. }