ebi.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. * (C) Copyright 2008 Stefan Roese <sr@denx.de>, DENX Software Engineering
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License as
  6. * published by the Free Software Foundation; either version 2 of
  7. * the License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  17. * MA 02111-1307 USA
  18. */
  19. #ifndef __EBI__
  20. #define __EBI__
  21. #include <common.h>
  22. #include <asm/io.h>
  23. #include "vct.h"
  24. #define EXT_DEVICE_CHANNEL_3 (0x30000000)
  25. #define EXT_DEVICE_CHANNEL_2 (0x20000000)
  26. #define EXT_DEVICE_CHANNEL_1 (0x10000000)
  27. #define EXT_CPU_ACCESS_ACTIVE (0x00000001)
  28. #define EXT_DMA_ACCESS_ACTIVE (1 << 14)
  29. #define EXT_CPU_IORDY_SL (0x00000001)
  30. #define EBI_CPU_WRITE (1 << 31)
  31. #define EBI_CPU_ID_SHIFT (28)
  32. #define EBI_CPU_ADDR_MASK ~(~0UL << EBI_CPU_ID_SHIFT)
  33. /* position of various bit slices in timing register EBI_DEV[01]_TIM1_RD1 */
  34. #define ADDR_LATCH_ENABLE 0
  35. #define ADDR_ACTIVATION 4
  36. #define CHIP_SELECT_START 8
  37. #define OUTPUT_ENABLE_START 12
  38. #define WAIT_TIME 28
  39. #define READ_DURATION 20
  40. /* position of various bit slices in timing register EBI_DEV[01]_TIM1_RD2 */
  41. #define OUTPUT_ENABLE_END 0
  42. #define CHIP_SELECT_END 4
  43. #define ADDR_DEACTIVATION 8
  44. #define RECOVER_TIME 12
  45. #define ACK_TIME 20
  46. /* various bits in configuration register EBI_DEV[01]_CONFIG1 */
  47. #define EBI_EXTERNAL_DATA_8 (1 << 8)
  48. #define EBI_EXT_ADDR_SHIFT (1 << 22)
  49. #define EBI_EXTERNAL_DATA_16 EBI_EXT_ADDR_SHIFT
  50. #define EBI_CHIP_SELECT_1 0x2
  51. #define EBI_CHIP_SELECT_2 0x4
  52. #define EBI_BUSY_EN_RD (1 << 12)
  53. #define DIR_ACCESS_WRITE (1 << 20)
  54. #define DIR_ACCESS_MASK (1 << 20)
  55. /* various bits in configuration register EBI_DEV[01]_CONFIG2 */
  56. #define ADDRESS_INCREMENT_ON 0x0
  57. #define ADDRESS_INCREMENT_OFF 0x100
  58. #define QUEUE_LENGTH_1 0x40
  59. #define QUEUE_LENGTH_2 0x80
  60. #define QUEUE_LENGTH_3 0xC0
  61. #define QUEUE_LENGTH_4 0
  62. #define CPU_TRANSFER_SIZE_32 0
  63. #define CPU_TRANSFER_SIZE_16 0x10
  64. #define CPU_TRANSFER_SIZE_8 0x20
  65. #define READ_ENDIANNESS_ABCD 0
  66. #define READ_ENDIANNESS_DCBA 0x4
  67. #define READ_ENDIANNESS_BADC 0x8
  68. #define READ_ENDIANNESS_CDAB 0xC
  69. #define WRITE_ENDIANNESS_ABCD 0
  70. #define WRITE_ENDIANNESS_DCBA 0x1
  71. #define WRITE_ENDIANNESS_BADC 0x2
  72. #define WRITE_ENDIANNESS_CDAB 0x3
  73. /* various bits in configuration register EBI_CTRL_SIG_ACTLV */
  74. #define IORDY_ACTIVELEVEL_HIGH (1 << 14)
  75. #define ALE_ACTIVELEVEL_HIGH (1 << 8)
  76. /* bits in register EBI_SIG_LEVEL */
  77. #define IORDY_LEVEL_MASK 1
  78. static inline void ebi_wait(void)
  79. {
  80. while (reg_read(EBI_STATUS(EBI_BASE)) & EXT_CPU_ACCESS_ACTIVE)
  81. ; /* wait */
  82. }
  83. #endif