ebi.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * (C) Copyright 2008 Stefan Roese <sr@denx.de>, DENX Software Engineering
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #ifndef __EBI__
  7. #define __EBI__
  8. #include <common.h>
  9. #include <asm/io.h>
  10. #include "vct.h"
  11. #define EXT_DEVICE_CHANNEL_3 (0x30000000)
  12. #define EXT_DEVICE_CHANNEL_2 (0x20000000)
  13. #define EXT_DEVICE_CHANNEL_1 (0x10000000)
  14. #define EXT_CPU_ACCESS_ACTIVE (0x00000001)
  15. #define EXT_DMA_ACCESS_ACTIVE (1 << 14)
  16. #define EXT_CPU_IORDY_SL (0x00000001)
  17. #define EBI_CPU_WRITE (1 << 31)
  18. #define EBI_CPU_ID_SHIFT (28)
  19. #define EBI_CPU_ADDR_MASK ~(~0UL << EBI_CPU_ID_SHIFT)
  20. /* position of various bit slices in timing register EBI_DEV[01]_TIM1_RD1 */
  21. #define ADDR_LATCH_ENABLE 0
  22. #define ADDR_ACTIVATION 4
  23. #define CHIP_SELECT_START 8
  24. #define OUTPUT_ENABLE_START 12
  25. #define WAIT_TIME 28
  26. #define READ_DURATION 20
  27. /* position of various bit slices in timing register EBI_DEV[01]_TIM1_RD2 */
  28. #define OUTPUT_ENABLE_END 0
  29. #define CHIP_SELECT_END 4
  30. #define ADDR_DEACTIVATION 8
  31. #define RECOVER_TIME 12
  32. #define ACK_TIME 20
  33. /* various bits in configuration register EBI_DEV[01]_CONFIG1 */
  34. #define EBI_EXTERNAL_DATA_8 (1 << 8)
  35. #define EBI_EXT_ADDR_SHIFT (1 << 22)
  36. #define EBI_EXTERNAL_DATA_16 EBI_EXT_ADDR_SHIFT
  37. #define EBI_CHIP_SELECT_1 0x2
  38. #define EBI_CHIP_SELECT_2 0x4
  39. #define EBI_BUSY_EN_RD (1 << 12)
  40. #define DIR_ACCESS_WRITE (1 << 20)
  41. #define DIR_ACCESS_MASK (1 << 20)
  42. /* various bits in configuration register EBI_DEV[01]_CONFIG2 */
  43. #define ADDRESS_INCREMENT_ON 0x0
  44. #define ADDRESS_INCREMENT_OFF 0x100
  45. #define QUEUE_LENGTH_1 0x40
  46. #define QUEUE_LENGTH_2 0x80
  47. #define QUEUE_LENGTH_3 0xC0
  48. #define QUEUE_LENGTH_4 0
  49. #define CPU_TRANSFER_SIZE_32 0
  50. #define CPU_TRANSFER_SIZE_16 0x10
  51. #define CPU_TRANSFER_SIZE_8 0x20
  52. #define READ_ENDIANNESS_ABCD 0
  53. #define READ_ENDIANNESS_DCBA 0x4
  54. #define READ_ENDIANNESS_BADC 0x8
  55. #define READ_ENDIANNESS_CDAB 0xC
  56. #define WRITE_ENDIANNESS_ABCD 0
  57. #define WRITE_ENDIANNESS_DCBA 0x1
  58. #define WRITE_ENDIANNESS_BADC 0x2
  59. #define WRITE_ENDIANNESS_CDAB 0x3
  60. /* various bits in configuration register EBI_CTRL_SIG_ACTLV */
  61. #define IORDY_ACTIVELEVEL_HIGH (1 << 14)
  62. #define ALE_ACTIVELEVEL_HIGH (1 << 8)
  63. /* bits in register EBI_SIG_LEVEL */
  64. #define IORDY_LEVEL_MASK 1
  65. static inline void ebi_wait(void)
  66. {
  67. while (reg_read(EBI_STATUS(EBI_BASE)) & EXT_CPU_ACCESS_ACTIVE)
  68. ; /* wait */
  69. }
  70. #endif