netarm_gen_module.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. /*
  2. * include/asm-armnommu/arch-netarm/netarm_gen_module.h
  3. *
  4. * Copyright (C) 2005
  5. * Art Shipkowski, Videon Central, Inc., <art@videon-central.com>
  6. *
  7. * Copyright (C) 2000, 2001 NETsilicon, Inc.
  8. * Copyright (C) 2000, 2001 Red Hat, Inc.
  9. *
  10. * This software is copyrighted by Red Hat. LICENSEE agrees that
  11. * it will not delete this copyright notice, trademarks or protective
  12. * notices from any copy made by LICENSEE.
  13. *
  14. * This software is provided "AS-IS" and any express or implied
  15. * warranties or conditions, including but not limited to any
  16. * implied warranties of merchantability and fitness for a particular
  17. * purpose regarding this software. In no event shall Red Hat
  18. * be liable for any indirect, consequential, or incidental damages,
  19. * loss of profits or revenue, loss of use or data, or interruption
  20. * of business, whether the alleged damages are labeled in contract,
  21. * tort, or indemnity.
  22. *
  23. * This program is free software; you can redistribute it and/or modify
  24. * it under the terms of the GNU General Public License as published by
  25. * the Free Software Foundation; either version 2 of the License, or
  26. * (at your option) any later version.
  27. *
  28. * You should have received a copy of the GNU General Public License
  29. * along with this program; if not, write to the Free Software
  30. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  31. *
  32. * author(s) : Joe deBlaquiere
  33. *
  34. * Modified to support NS7520 by Art Shipkowski.
  35. */
  36. #ifndef __NETARM_GEN_MODULE_REGISTERS_H
  37. #define __NETARM_GEN_MODULE_REGISTERS_H
  38. /* GEN unit register offsets */
  39. #define NETARM_GEN_MODULE_BASE (0xFFB00000)
  40. #define get_gen_reg_addr(c) ((volatile unsigned int *)(NETARM_GEN_MODULE_BASE + (c)))
  41. #define NETARM_GEN_SYSTEM_CONTROL (0x00)
  42. #define NETARM_GEN_STATUS_CONTROL (0x04)
  43. #define NETARM_GEN_PLL_CONTROL (0x08)
  44. #define NETARM_GEN_SOFTWARE_SERVICE (0x0c)
  45. #define NETARM_GEN_TIMER1_CONTROL (0x10)
  46. #define NETARM_GEN_TIMER1_STATUS (0x14)
  47. #define NETARM_GEN_TIMER2_CONTROL (0x18)
  48. #define NETARM_GEN_TIMER2_STATUS (0x1c)
  49. #define NETARM_GEN_PORTA (0x20)
  50. #ifndef CONFIG_NETARM_NS7520
  51. #define NETARM_GEN_PORTB (0x24)
  52. #endif
  53. #define NETARM_GEN_PORTC (0x28)
  54. #define NETARM_GEN_INTR_ENABLE (0x30)
  55. #define NETARM_GEN_INTR_ENABLE_SET (0x34)
  56. #define NETARM_GEN_INTR_ENABLE_CLR (0x38)
  57. #define NETARM_GEN_INTR_STATUS_EN (0x34)
  58. #define NETARM_GEN_INTR_STATUS_RAW (0x38)
  59. #define NETARM_GEN_CACHE_CONTROL1 (0x40)
  60. #define NETARM_GEN_CACHE_CONTROL2 (0x44)
  61. /* select bitfield definitions */
  62. /* System Control Register ( 0xFFB0_0000 ) */
  63. #define NETARM_GEN_SYS_CFG_LENDIAN (0x80000000)
  64. #define NETARM_GEN_SYS_CFG_BENDIAN (0x00000000)
  65. #define NETARM_GEN_SYS_CFG_BUSQRTR (0x00000000)
  66. #define NETARM_GEN_SYS_CFG_BUSHALF (0x20000000)
  67. #define NETARM_GEN_SYS_CFG_BUSFULL (0x40000000)
  68. #define NETARM_GEN_SYS_CFG_BCLK_DISABLE (0x10000000)
  69. #define NETARM_GEN_SYS_CFG_WDOG_EN (0x01000000)
  70. #define NETARM_GEN_SYS_CFG_WDOG_IRQ (0x00000000)
  71. #define NETARM_GEN_SYS_CFG_WDOG_FIQ (0x00400000)
  72. #define NETARM_GEN_SYS_CFG_WDOG_RST (0x00800000)
  73. #define NETARM_GEN_SYS_CFG_WDOG_24 (0x00000000)
  74. #define NETARM_GEN_SYS_CFG_WDOG_26 (0x00100000)
  75. #define NETARM_GEN_SYS_CFG_WDOG_28 (0x00200000)
  76. #define NETARM_GEN_SYS_CFG_WDOG_29 (0x00300000)
  77. #define NETARM_GEN_SYS_CFG_BUSMON_EN (0x00040000)
  78. #define NETARM_GEN_SYS_CFG_BUSMON_128 (0x00000000)
  79. #define NETARM_GEN_SYS_CFG_BUSMON_64 (0x00010000)
  80. #define NETARM_GEN_SYS_CFG_BUSMON_32 (0x00020000)
  81. #define NETARM_GEN_SYS_CFG_BUSMON_16 (0x00030000)
  82. #define NETARM_GEN_SYS_CFG_USER_EN (0x00008000)
  83. #define NETARM_GEN_SYS_CFG_BUSER_EN (0x00004000)
  84. #define NETARM_GEN_SYS_CFG_BUSARB_INT (0x00002000)
  85. #define NETARM_GEN_SYS_CFG_BUSARB_EXT (0x00000000)
  86. #define NETARM_GEN_SYS_CFG_DMATST (0x00001000)
  87. #define NETARM_GEN_SYS_CFG_TEALAST (0x00000800)
  88. #define NETARM_GEN_SYS_CFG_ALIGN_ABORT (0x00000400)
  89. #define NETARM_GEN_SYS_CFG_CACHE_EN (0x00000200)
  90. #define NETARM_GEN_SYS_CFG_WRI_BUF_EN (0x00000100)
  91. #define NETARM_GEN_SYS_CFG_CACHE_INIT (0x00000080)
  92. /* PLL Control Register ( 0xFFB0_0008 ) */
  93. #define NETARM_GEN_PLL_CTL_PLLCNT_MASK (0x0F000000)
  94. #define NETARM_GEN_PLL_CTL_PLLCNT(x) (((x)<<24) & \
  95. NETARM_GEN_PLL_CTL_PLLCNT_MASK)
  96. /* Defaults for POLTST and ICP Fields in PLL CTL */
  97. #define NETARM_GEN_PLL_CTL_OUTDIV(x) (x)
  98. #define NETARM_GEN_PLL_CTL_INDIV(x) ((x)<<6)
  99. #define NETARM_GEN_PLL_CTL_POLTST_DEF (0x00000E00)
  100. #define NETARM_GEN_PLL_CTL_ICP_DEF (0x0000003C)
  101. /* Software Service Register ( 0xFFB0_000C ) */
  102. #define NETARM_GEN_SW_SVC_RESETA (0x123)
  103. #define NETARM_GEN_SW_SVC_RESETB (0x321)
  104. /* PORT C Register ( 0xFFB0_0028 ) */
  105. #ifndef CONFIG_NETARM_NS7520
  106. #define NETARM_GEN_PORT_MODE(x) (((x)<<24) + (0xFF00))
  107. #define NETARM_GEN_PORT_DIR(x) (((x)<<16) + (0xFF00))
  108. #else
  109. #define NETARM_GEN_PORT_MODE(x) ((x)<<24)
  110. #define NETARM_GEN_PORT_DIR(x) ((x)<<16)
  111. #define NETARM_GEN_PORT_CSF(x) ((x)<<8)
  112. #endif
  113. /* Timer Registers ( 0xFFB0_0010 0xFFB0_0018 ) */
  114. #define NETARM_GEN_TCTL_ENABLE (0x80000000)
  115. #define NETARM_GEN_TCTL_INT_ENABLE (0x40000000)
  116. #define NETARM_GEN_TCTL_USE_IRQ (0x00000000)
  117. #define NETARM_GEN_TCTL_USE_FIQ (0x20000000)
  118. #define NETARM_GEN_TCTL_USE_PRESCALE (0x10000000)
  119. #define NETARM_GEN_TCTL_INIT_COUNT(x) ((x) & 0x1FF)
  120. #define NETARM_GEN_TSTAT_INTPEN (0x40000000)
  121. #if ~defined(CONFIG_NETARM_NS7520)
  122. #define NETARM_GEN_TSTAT_CTC_MASK (0x000001FF)
  123. #else
  124. #define NETARM_GEN_TSTAT_CTC_MASK (0x0FFFFFFF)
  125. #endif
  126. /* prescale to msecs conversion */
  127. #if !defined(CONFIG_NETARM_PLL_BYPASS)
  128. #define NETARM_GEN_TIMER_MSEC_P(x) ( ( ( 20480 ) * ( 0x1FF - ( (x) & \
  129. NETARM_GEN_TSTAT_CTC_MASK ) + \
  130. 1 ) ) / (NETARM_XTAL_FREQ/1000) )
  131. #define NETARM_GEN_TIMER_SET_HZ(x) ( ( ((NETARM_XTAL_FREQ/(20480*(x)))-1) & \
  132. NETARM_GEN_TSTAT_CTC_MASK ) | \
  133. NETARM_GEN_TCTL_USE_PRESCALE )
  134. #else
  135. #define NETARM_GEN_TIMER_MSEC_P(x) ( ( ( 4096 ) * ( 0x1FF - ( (x) & \
  136. NETARM_GEN_TSTAT_CTC_MASK ) + \
  137. 1 ) ) / (NETARM_XTAL_FREQ/1000) )
  138. #define NETARM_GEN_TIMER_SET_HZ(x) ( ( ((NETARM_XTAL_FREQ/(4096*(x)))-1) & \
  139. NETARM_GEN_TSTAT_CTC_MASK ) | \
  140. NETARM_GEN_TCTL_USE_PRESCALE )
  141. #endif
  142. #endif