gpio-regs.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /* gpio-regs.h: on-chip general purpose I/O registers
  2. *
  3. * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the License, or (at your option) any later version.
  10. */
  11. #ifndef _ASM_GPIO_REGS
  12. #define _ASM_GPIO_REGS
  13. #define __reg(ADDR) (*(volatile unsigned long *)(ADDR))
  14. #define __get_PDR() ({ __reg(0xfeff0400); })
  15. #define __set_PDR(V) do { __reg(0xfeff0400) = (V); mb(); } while(0)
  16. #define __get_GPDR() ({ __reg(0xfeff0408); })
  17. #define __set_GPDR(V) do { __reg(0xfeff0408) = (V); mb(); } while(0)
  18. #define __get_SIR() ({ __reg(0xfeff0410); })
  19. #define __set_SIR(V) do { __reg(0xfeff0410) = (V); mb(); } while(0)
  20. #define __get_SOR() ({ __reg(0xfeff0418); })
  21. #define __set_SOR(V) do { __reg(0xfeff0418) = (V); mb(); } while(0)
  22. #define __set_PDSR(V) do { __reg(0xfeff0420) = (V); mb(); } while(0)
  23. #define __set_PDCR(V) do { __reg(0xfeff0428) = (V); mb(); } while(0)
  24. #define __get_RSTR() ({ __reg(0xfeff0500); })
  25. #define __set_RSTR(V) do { __reg(0xfeff0500) = (V); mb(); } while(0)
  26. /* PDR definitions */
  27. #define PDR_GPIO_DATA(X) (1 << (X))
  28. /* GPDR definitions */
  29. #define GPDR_INPUT 0
  30. #define GPDR_OUTPUT 1
  31. #define GPDR_DREQ0_BIT 0x00001000
  32. #define GPDR_DREQ1_BIT 0x00008000
  33. #define GPDR_DREQ2_BIT 0x00040000
  34. #define GPDR_DREQ3_BIT 0x00080000
  35. #define GPDR_DREQ4_BIT 0x00004000
  36. #define GPDR_DREQ5_BIT 0x00020000
  37. #define GPDR_DREQ6_BIT 0x00100000
  38. #define GPDR_DREQ7_BIT 0x00200000
  39. #define GPDR_DACK0_BIT 0x00002000
  40. #define GPDR_DACK1_BIT 0x00010000
  41. #define GPDR_DACK2_BIT 0x00100000
  42. #define GPDR_DACK3_BIT 0x00200000
  43. #define GPDR_DONE0_BIT 0x00004000
  44. #define GPDR_DONE1_BIT 0x00020000
  45. #define GPDR_GPIO_DIR(X,D) ((D) << (X))
  46. /* SIR definitions */
  47. #define SIR_GPIO_INPUT 0
  48. #define SIR_DREQ7_INPUT 0x00200000
  49. #define SIR_DREQ6_INPUT 0x00100000
  50. #define SIR_DREQ3_INPUT 0x00080000
  51. #define SIR_DREQ2_INPUT 0x00040000
  52. #define SIR_DREQ5_INPUT 0x00020000
  53. #define SIR_DREQ1_INPUT 0x00008000
  54. #define SIR_DREQ4_INPUT 0x00004000
  55. #define SIR_DREQ0_INPUT 0x00001000
  56. #define SIR_RXD1_INPUT 0x00000400
  57. #define SIR_CTS0_INPUT 0x00000100
  58. #define SIR_RXD0_INPUT 0x00000040
  59. #define SIR_GATE1_INPUT 0x00000020
  60. #define SIR_GATE0_INPUT 0x00000010
  61. #define SIR_IRQ3_INPUT 0x00000008
  62. #define SIR_IRQ2_INPUT 0x00000004
  63. #define SIR_IRQ1_INPUT 0x00000002
  64. #define SIR_IRQ0_INPUT 0x00000001
  65. #define SIR_DREQ_BITS (SIR_DREQ0_INPUT | SIR_DREQ1_INPUT | \
  66. SIR_DREQ2_INPUT | SIR_DREQ3_INPUT | \
  67. SIR_DREQ4_INPUT | SIR_DREQ5_INPUT | \
  68. SIR_DREQ6_INPUT | SIR_DREQ7_INPUT)
  69. /* SOR definitions */
  70. #define SOR_GPIO_OUTPUT 0
  71. #define SOR_DACK3_OUTPUT 0x00200000
  72. #define SOR_DACK2_OUTPUT 0x00100000
  73. #define SOR_DONE1_OUTPUT 0x00020000
  74. #define SOR_DACK1_OUTPUT 0x00010000
  75. #define SOR_DONE0_OUTPUT 0x00004000
  76. #define SOR_DACK0_OUTPUT 0x00002000
  77. #define SOR_TXD1_OUTPUT 0x00000800
  78. #define SOR_RTS0_OUTPUT 0x00000200
  79. #define SOR_TXD0_OUTPUT 0x00000080
  80. #define SOR_TOUT1_OUTPUT 0x00000020
  81. #define SOR_TOUT0_OUTPUT 0x00000010
  82. #define SOR_DONE_BITS (SOR_DONE0_OUTPUT | SOR_DONE1_OUTPUT)
  83. #define SOR_DACK_BITS (SOR_DACK0_OUTPUT | SOR_DACK1_OUTPUT | \
  84. SOR_DACK2_OUTPUT | SOR_DACK3_OUTPUT)
  85. /* PDSR definitions */
  86. #define PDSR_UNCHANGED 0
  87. #define PDSR_SET_BIT(X) (1 << (X))
  88. /* PDCR definitions */
  89. #define PDCR_UNCHANGED 0
  90. #define PDCR_CLEAR_BIT(X) (1 << (X))
  91. /* RSTR definitions */
  92. /* Read Only */
  93. #define RSTR_POWERON 0x00000400
  94. #define RSTR_SOFTRESET_STATUS 0x00000100
  95. /* Write Only */
  96. #define RSTR_SOFTRESET 0x00000001
  97. #endif /* _ASM_GPIO_REGS */