ar71xx_regs.h 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325
  1. /*
  2. * Atheros AR71XX/AR724X/AR913X SoC register definitions
  3. *
  4. * Copyright (C) 2010-2011 Jaiganesh Narayanan <jnarayanan@atheros.com>
  5. * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
  6. * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
  7. *
  8. * Parts of this file are based on Atheros' 2.6.15/2.6.31 BSP
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License version 2 as published
  12. * by the Free Software Foundation.
  13. */
  14. #ifndef __ASM_MACH_AR71XX_REGS_H
  15. #define __ASM_MACH_AR71XX_REGS_H
  16. #include <linux/types.h>
  17. #include <linux/io.h>
  18. #include <linux/bitops.h>
  19. #define AR71XX_APB_BASE 0x18000000
  20. #define AR71XX_GE0_BASE 0x19000000
  21. #define AR71XX_GE0_SIZE 0x10000
  22. #define AR71XX_GE1_BASE 0x1a000000
  23. #define AR71XX_GE1_SIZE 0x10000
  24. #define AR71XX_EHCI_BASE 0x1b000000
  25. #define AR71XX_EHCI_SIZE 0x1000
  26. #define AR71XX_OHCI_BASE 0x1c000000
  27. #define AR71XX_OHCI_SIZE 0x1000
  28. #define AR71XX_SPI_BASE 0x1f000000
  29. #define AR71XX_SPI_SIZE 0x01000000
  30. #define AR71XX_DDR_CTRL_BASE (AR71XX_APB_BASE + 0x00000000)
  31. #define AR71XX_DDR_CTRL_SIZE 0x100
  32. #define AR71XX_UART_BASE (AR71XX_APB_BASE + 0x00020000)
  33. #define AR71XX_UART_SIZE 0x100
  34. #define AR71XX_USB_CTRL_BASE (AR71XX_APB_BASE + 0x00030000)
  35. #define AR71XX_USB_CTRL_SIZE 0x100
  36. #define AR71XX_GPIO_BASE (AR71XX_APB_BASE + 0x00040000)
  37. #define AR71XX_GPIO_SIZE 0x100
  38. #define AR71XX_PLL_BASE (AR71XX_APB_BASE + 0x00050000)
  39. #define AR71XX_PLL_SIZE 0x100
  40. #define AR71XX_RESET_BASE (AR71XX_APB_BASE + 0x00060000)
  41. #define AR71XX_RESET_SIZE 0x100
  42. #define AR71XX_MII_BASE (AR71XX_APB_BASE + 0x00070000)
  43. #define AR71XX_MII_SIZE 0x100
  44. #define AR71XX_PCI_MEM_BASE 0x10000000
  45. #define AR71XX_PCI_MEM_SIZE 0x07000000
  46. #define AR71XX_PCI_WIN0_OFFS 0x10000000
  47. #define AR71XX_PCI_WIN1_OFFS 0x11000000
  48. #define AR71XX_PCI_WIN2_OFFS 0x12000000
  49. #define AR71XX_PCI_WIN3_OFFS 0x13000000
  50. #define AR71XX_PCI_WIN4_OFFS 0x14000000
  51. #define AR71XX_PCI_WIN5_OFFS 0x15000000
  52. #define AR71XX_PCI_WIN6_OFFS 0x16000000
  53. #define AR71XX_PCI_WIN7_OFFS 0x07000000
  54. #define AR71XX_PCI_CFG_BASE \
  55. (AR71XX_PCI_MEM_BASE + AR71XX_PCI_WIN7_OFFS + 0x10000)
  56. #define AR71XX_PCI_CFG_SIZE 0x100
  57. #define AR7240_USB_CTRL_BASE (AR71XX_APB_BASE + 0x00030000)
  58. #define AR7240_USB_CTRL_SIZE 0x100
  59. #define AR7240_OHCI_BASE 0x1b000000
  60. #define AR7240_OHCI_SIZE 0x1000
  61. #define AR724X_PCI_MEM_BASE 0x10000000
  62. #define AR724X_PCI_MEM_SIZE 0x04000000
  63. #define AR724X_PCI_CFG_BASE 0x14000000
  64. #define AR724X_PCI_CFG_SIZE 0x1000
  65. #define AR724X_PCI_CRP_BASE (AR71XX_APB_BASE + 0x000c0000)
  66. #define AR724X_PCI_CRP_SIZE 0x1000
  67. #define AR724X_PCI_CTRL_BASE (AR71XX_APB_BASE + 0x000f0000)
  68. #define AR724X_PCI_CTRL_SIZE 0x100
  69. #define AR724X_EHCI_BASE 0x1b000000
  70. #define AR724X_EHCI_SIZE 0x1000
  71. #define AR913X_EHCI_BASE 0x1b000000
  72. #define AR913X_EHCI_SIZE 0x1000
  73. #define AR913X_WMAC_BASE (AR71XX_APB_BASE + 0x000C0000)
  74. #define AR913X_WMAC_SIZE 0x30000
  75. #define AR933X_UART_BASE (AR71XX_APB_BASE + 0x00020000)
  76. #define AR933X_UART_SIZE 0x14
  77. #define AR933X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000)
  78. #define AR933X_GMAC_SIZE 0x04
  79. #define AR933X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000)
  80. #define AR933X_WMAC_SIZE 0x20000
  81. #define AR933X_EHCI_BASE 0x1b000000
  82. #define AR933X_EHCI_SIZE 0x1000
  83. #define AR934X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000)
  84. #define AR934X_GMAC_SIZE 0x14
  85. #define AR934X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000)
  86. #define AR934X_WMAC_SIZE 0x20000
  87. #define AR934X_EHCI_BASE 0x1b000000
  88. #define AR934X_EHCI_SIZE 0x200
  89. #define AR934X_NFC_BASE 0x1b000200
  90. #define AR934X_NFC_SIZE 0xb8
  91. #define AR934X_SRIF_BASE (AR71XX_APB_BASE + 0x00116000)
  92. #define AR934X_SRIF_SIZE 0x1000
  93. #define QCA953X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000)
  94. #define QCA953X_GMAC_SIZE 0x14
  95. #define QCA953X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000)
  96. #define QCA953X_WMAC_SIZE 0x20000
  97. #define QCA953X_EHCI_BASE 0x1b000000
  98. #define QCA953X_EHCI_SIZE 0x200
  99. #define QCA953X_SRIF_BASE (AR71XX_APB_BASE + 0x00116000)
  100. #define QCA953X_SRIF_SIZE 0x1000
  101. #define QCA953X_PCI_CFG_BASE0 0x14000000
  102. #define QCA953X_PCI_CTRL_BASE0 (AR71XX_APB_BASE + 0x000f0000)
  103. #define QCA953X_PCI_CRP_BASE0 (AR71XX_APB_BASE + 0x000c0000)
  104. #define QCA953X_PCI_MEM_BASE0 0x10000000
  105. #define QCA953X_PCI_MEM_SIZE 0x02000000
  106. #define QCA955X_PCI_MEM_BASE0 0x10000000
  107. #define QCA955X_PCI_MEM_BASE1 0x12000000
  108. #define QCA955X_PCI_MEM_SIZE 0x02000000
  109. #define QCA955X_PCI_CFG_BASE0 0x14000000
  110. #define QCA955X_PCI_CFG_BASE1 0x16000000
  111. #define QCA955X_PCI_CFG_SIZE 0x1000
  112. #define QCA955X_PCI_CRP_BASE0 (AR71XX_APB_BASE + 0x000c0000)
  113. #define QCA955X_PCI_CRP_BASE1 (AR71XX_APB_BASE + 0x00250000)
  114. #define QCA955X_PCI_CRP_SIZE 0x1000
  115. #define QCA955X_PCI_CTRL_BASE0 (AR71XX_APB_BASE + 0x000f0000)
  116. #define QCA955X_PCI_CTRL_BASE1 (AR71XX_APB_BASE + 0x00280000)
  117. #define QCA955X_PCI_CTRL_SIZE 0x100
  118. #define QCA955X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000)
  119. #define QCA955X_GMAC_SIZE 0x40
  120. #define QCA955X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000)
  121. #define QCA955X_WMAC_SIZE 0x20000
  122. #define QCA955X_EHCI0_BASE 0x1b000000
  123. #define QCA955X_EHCI1_BASE 0x1b400000
  124. #define QCA955X_EHCI_SIZE 0x1000
  125. #define QCA955X_NFC_BASE 0x1b800200
  126. #define QCA955X_NFC_SIZE 0xb8
  127. #define QCA956X_PCI_MEM_BASE1 0x12000000
  128. #define QCA956X_PCI_MEM_SIZE 0x02000000
  129. #define QCA956X_PCI_CFG_BASE1 0x16000000
  130. #define QCA956X_PCI_CFG_SIZE 0x1000
  131. #define QCA956X_PCI_CRP_BASE1 (AR71XX_APB_BASE + 0x00250000)
  132. #define QCA956X_PCI_CRP_SIZE 0x1000
  133. #define QCA956X_PCI_CTRL_BASE1 (AR71XX_APB_BASE + 0x00280000)
  134. #define QCA956X_PCI_CTRL_SIZE 0x100
  135. #define QCA956X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000)
  136. #define QCA956X_WMAC_SIZE 0x20000
  137. #define QCA956X_EHCI0_BASE 0x1b000000
  138. #define QCA956X_EHCI1_BASE 0x1b400000
  139. #define QCA956X_EHCI_SIZE 0x200
  140. #define QCA956X_GMAC_SGMII_BASE (AR71XX_APB_BASE + 0x00070000)
  141. #define QCA956X_GMAC_SGMII_SIZE 0x64
  142. #define QCA956X_PLL_BASE (AR71XX_APB_BASE + 0x00050000)
  143. #define QCA956X_PLL_SIZE 0x50
  144. #define QCA956X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000)
  145. #define QCA956X_GMAC_SIZE 0x64
  146. /*
  147. * Hidden Registers
  148. */
  149. #define QCA956X_MAC_CFG_BASE 0xb9000000
  150. #define QCA956X_MAC_CFG_SIZE 0x64
  151. #define QCA956X_MAC_CFG1_REG 0x00
  152. #define QCA956X_MAC_CFG1_SOFT_RST BIT(31)
  153. #define QCA956X_MAC_CFG1_RX_RST BIT(19)
  154. #define QCA956X_MAC_CFG1_TX_RST BIT(18)
  155. #define QCA956X_MAC_CFG1_LOOPBACK BIT(8)
  156. #define QCA956X_MAC_CFG1_RX_EN BIT(2)
  157. #define QCA956X_MAC_CFG1_TX_EN BIT(0)
  158. #define QCA956X_MAC_CFG2_REG 0x04
  159. #define QCA956X_MAC_CFG2_IF_1000 BIT(9)
  160. #define QCA956X_MAC_CFG2_IF_10_100 BIT(8)
  161. #define QCA956X_MAC_CFG2_HUGE_FRAME_EN BIT(5)
  162. #define QCA956X_MAC_CFG2_LEN_CHECK BIT(4)
  163. #define QCA956X_MAC_CFG2_PAD_CRC_EN BIT(2)
  164. #define QCA956X_MAC_CFG2_FDX BIT(0)
  165. #define QCA956X_MAC_MII_MGMT_CFG_REG 0x20
  166. #define QCA956X_MGMT_CFG_CLK_DIV_20 0x07
  167. #define QCA956X_MAC_FIFO_CFG0_REG 0x48
  168. #define QCA956X_MAC_FIFO_CFG1_REG 0x4c
  169. #define QCA956X_MAC_FIFO_CFG2_REG 0x50
  170. #define QCA956X_MAC_FIFO_CFG3_REG 0x54
  171. #define QCA956X_MAC_FIFO_CFG4_REG 0x58
  172. #define QCA956X_MAC_FIFO_CFG5_REG 0x5c
  173. #define QCA956X_DAM_RESET_OFFSET 0xb90001bc
  174. #define QCA956X_DAM_RESET_SIZE 0x4
  175. #define QCA956X_INLINE_CHKSUM_ENG BIT(27)
  176. /*
  177. * DDR_CTRL block
  178. */
  179. #define AR71XX_DDR_REG_PCI_WIN0 0x7c
  180. #define AR71XX_DDR_REG_PCI_WIN1 0x80
  181. #define AR71XX_DDR_REG_PCI_WIN2 0x84
  182. #define AR71XX_DDR_REG_PCI_WIN3 0x88
  183. #define AR71XX_DDR_REG_PCI_WIN4 0x8c
  184. #define AR71XX_DDR_REG_PCI_WIN5 0x90
  185. #define AR71XX_DDR_REG_PCI_WIN6 0x94
  186. #define AR71XX_DDR_REG_PCI_WIN7 0x98
  187. #define AR71XX_DDR_REG_FLUSH_GE0 0x9c
  188. #define AR71XX_DDR_REG_FLUSH_GE1 0xa0
  189. #define AR71XX_DDR_REG_FLUSH_USB 0xa4
  190. #define AR71XX_DDR_REG_FLUSH_PCI 0xa8
  191. #define AR724X_DDR_REG_FLUSH_GE0 0x7c
  192. #define AR724X_DDR_REG_FLUSH_GE1 0x80
  193. #define AR724X_DDR_REG_FLUSH_USB 0x84
  194. #define AR724X_DDR_REG_FLUSH_PCIE 0x88
  195. #define AR913X_DDR_REG_FLUSH_GE0 0x7c
  196. #define AR913X_DDR_REG_FLUSH_GE1 0x80
  197. #define AR913X_DDR_REG_FLUSH_USB 0x84
  198. #define AR913X_DDR_REG_FLUSH_WMAC 0x88
  199. #define AR933X_DDR_REG_FLUSH_GE0 0x7c
  200. #define AR933X_DDR_REG_FLUSH_GE1 0x80
  201. #define AR933X_DDR_REG_FLUSH_USB 0x84
  202. #define AR933X_DDR_REG_FLUSH_WMAC 0x88
  203. #define AR934X_DDR_REG_FLUSH_GE0 0x9c
  204. #define AR934X_DDR_REG_FLUSH_GE1 0xa0
  205. #define AR934X_DDR_REG_FLUSH_USB 0xa4
  206. #define AR934X_DDR_REG_FLUSH_PCIE 0xa8
  207. #define AR934X_DDR_REG_FLUSH_WMAC 0xac
  208. #define QCA953X_DDR_REG_FLUSH_GE0 0x9c
  209. #define QCA953X_DDR_REG_FLUSH_GE1 0xa0
  210. #define QCA953X_DDR_REG_FLUSH_USB 0xa4
  211. #define QCA953X_DDR_REG_FLUSH_PCIE 0xa8
  212. #define QCA953X_DDR_REG_FLUSH_WMAC 0xac
  213. /*
  214. * PLL block
  215. */
  216. #define AR71XX_PLL_REG_CPU_CONFIG 0x00
  217. #define AR71XX_PLL_REG_SEC_CONFIG 0x04
  218. #define AR71XX_PLL_REG_ETH0_INT_CLOCK 0x10
  219. #define AR71XX_PLL_REG_ETH1_INT_CLOCK 0x14
  220. #define AR71XX_PLL_FB_SHIFT 3
  221. #define AR71XX_PLL_FB_MASK 0x1f
  222. #define AR71XX_CPU_DIV_SHIFT 16
  223. #define AR71XX_CPU_DIV_MASK 0x3
  224. #define AR71XX_DDR_DIV_SHIFT 18
  225. #define AR71XX_DDR_DIV_MASK 0x3
  226. #define AR71XX_AHB_DIV_SHIFT 20
  227. #define AR71XX_AHB_DIV_MASK 0x7
  228. #define AR71XX_ETH0_PLL_SHIFT 17
  229. #define AR71XX_ETH1_PLL_SHIFT 19
  230. #define AR724X_PLL_REG_CPU_CONFIG 0x00
  231. #define AR724X_PLL_REG_PCIE_CONFIG 0x10
  232. #define AR724X_PLL_REG_PCIE_CONFIG_PPL_BYPASS BIT(16)
  233. #define AR724X_PLL_REG_PCIE_CONFIG_PPL_RESET BIT(25)
  234. #define AR724X_PLL_FB_SHIFT 0
  235. #define AR724X_PLL_FB_MASK 0x3ff
  236. #define AR724X_PLL_REF_DIV_SHIFT 10
  237. #define AR724X_PLL_REF_DIV_MASK 0xf
  238. #define AR724X_AHB_DIV_SHIFT 19
  239. #define AR724X_AHB_DIV_MASK 0x1
  240. #define AR724X_DDR_DIV_SHIFT 22
  241. #define AR724X_DDR_DIV_MASK 0x3
  242. #define AR7242_PLL_REG_ETH0_INT_CLOCK 0x2c
  243. #define AR913X_PLL_REG_CPU_CONFIG 0x00
  244. #define AR913X_PLL_REG_ETH_CONFIG 0x04
  245. #define AR913X_PLL_REG_ETH0_INT_CLOCK 0x14
  246. #define AR913X_PLL_REG_ETH1_INT_CLOCK 0x18
  247. #define AR913X_PLL_FB_SHIFT 0
  248. #define AR913X_PLL_FB_MASK 0x3ff
  249. #define AR913X_DDR_DIV_SHIFT 22
  250. #define AR913X_DDR_DIV_MASK 0x3
  251. #define AR913X_AHB_DIV_SHIFT 19
  252. #define AR913X_AHB_DIV_MASK 0x1
  253. #define AR913X_ETH0_PLL_SHIFT 20
  254. #define AR913X_ETH1_PLL_SHIFT 22
  255. #define AR933X_PLL_CPU_CONFIG_REG 0x00
  256. #define AR933X_PLL_CLOCK_CTRL_REG 0x08
  257. #define AR933X_PLL_CPU_CONFIG_NINT_SHIFT 10
  258. #define AR933X_PLL_CPU_CONFIG_NINT_MASK 0x3f
  259. #define AR933X_PLL_CPU_CONFIG_REFDIV_SHIFT 16
  260. #define AR933X_PLL_CPU_CONFIG_REFDIV_MASK 0x1f
  261. #define AR933X_PLL_CPU_CONFIG_OUTDIV_SHIFT 23
  262. #define AR933X_PLL_CPU_CONFIG_OUTDIV_MASK 0x7
  263. #define AR933X_PLL_CLOCK_CTRL_BYPASS BIT(2)
  264. #define AR933X_PLL_CLOCK_CTRL_CPU_DIV_SHIFT 5
  265. #define AR933X_PLL_CLOCK_CTRL_CPU_DIV_MASK 0x3
  266. #define AR933X_PLL_CLOCK_CTRL_DDR_DIV_SHIFT 10
  267. #define AR933X_PLL_CLOCK_CTRL_DDR_DIV_MASK 0x3
  268. #define AR933X_PLL_CLOCK_CTRL_AHB_DIV_SHIFT 15
  269. #define AR933X_PLL_CLOCK_CTRL_AHB_DIV_MASK 0x7
  270. #define AR934X_PLL_CPU_CONFIG_REG 0x00
  271. #define AR934X_PLL_DDR_CONFIG_REG 0x04
  272. #define AR934X_PLL_CPU_DDR_CLK_CTRL_REG 0x08
  273. #define AR934X_PLL_SWITCH_CLOCK_CONTROL_REG 0x24
  274. #define AR934X_PLL_ETH_XMII_CONTROL_REG 0x2c
  275. #define AR934X_PLL_CPU_CONFIG_NFRAC_SHIFT 0
  276. #define AR934X_PLL_CPU_CONFIG_NFRAC_MASK 0x3f
  277. #define AR934X_PLL_CPU_CONFIG_NINT_SHIFT 6
  278. #define AR934X_PLL_CPU_CONFIG_NINT_MASK 0x3f
  279. #define AR934X_PLL_CPU_CONFIG_REFDIV_SHIFT 12
  280. #define AR934X_PLL_CPU_CONFIG_REFDIV_MASK 0x1f
  281. #define AR934X_PLL_CPU_CONFIG_OUTDIV_SHIFT 19
  282. #define AR934X_PLL_CPU_CONFIG_OUTDIV_MASK 0x3
  283. #define AR934X_PLL_DDR_CONFIG_NFRAC_SHIFT 0
  284. #define AR934X_PLL_DDR_CONFIG_NFRAC_MASK 0x3ff
  285. #define AR934X_PLL_DDR_CONFIG_NINT_SHIFT 10
  286. #define AR934X_PLL_DDR_CONFIG_NINT_MASK 0x3f
  287. #define AR934X_PLL_DDR_CONFIG_REFDIV_SHIFT 16
  288. #define AR934X_PLL_DDR_CONFIG_REFDIV_MASK 0x1f
  289. #define AR934X_PLL_DDR_CONFIG_OUTDIV_SHIFT 23
  290. #define AR934X_PLL_DDR_CONFIG_OUTDIV_MASK 0x7
  291. #define AR934X_PLL_CPU_DDR_CLK_CTRL_CPU_PLL_BYPASS BIT(2)
  292. #define AR934X_PLL_CPU_DDR_CLK_CTRL_DDR_PLL_BYPASS BIT(3)
  293. #define AR934X_PLL_CPU_DDR_CLK_CTRL_AHB_PLL_BYPASS BIT(4)
  294. #define AR934X_PLL_CPU_DDR_CLK_CTRL_CPU_POST_DIV_SHIFT 5
  295. #define AR934X_PLL_CPU_DDR_CLK_CTRL_CPU_POST_DIV_MASK 0x1f
  296. #define AR934X_PLL_CPU_DDR_CLK_CTRL_DDR_POST_DIV_SHIFT 10
  297. #define AR934X_PLL_CPU_DDR_CLK_CTRL_DDR_POST_DIV_MASK 0x1f
  298. #define AR934X_PLL_CPU_DDR_CLK_CTRL_AHB_POST_DIV_SHIFT 15
  299. #define AR934X_PLL_CPU_DDR_CLK_CTRL_AHB_POST_DIV_MASK 0x1f
  300. #define AR934X_PLL_CPU_DDR_CLK_CTRL_CPUCLK_FROM_CPUPLL BIT(20)
  301. #define AR934X_PLL_CPU_DDR_CLK_CTRL_DDRCLK_FROM_DDRPLL BIT(21)
  302. #define AR934X_PLL_CPU_DDR_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24)
  303. #define AR934X_PLL_SWITCH_CLOCK_CONTROL_MDIO_CLK_SEL BIT(6)
  304. #define QCA953X_PLL_CPU_CONFIG_REG 0x00
  305. #define QCA953X_PLL_DDR_CONFIG_REG 0x04
  306. #define QCA953X_PLL_CLK_CTRL_REG 0x08
  307. #define QCA953X_PLL_SWITCH_CLOCK_CONTROL_REG 0x24
  308. #define QCA953X_PLL_ETH_XMII_CONTROL_REG 0x2c
  309. #define QCA953X_PLL_ETH_SGMII_CONTROL_REG 0x48
  310. #define QCA953X_PLL_CPU_CONFIG_NFRAC_SHIFT 0
  311. #define QCA953X_PLL_CPU_CONFIG_NFRAC_MASK 0x3f
  312. #define QCA953X_PLL_CPU_CONFIG_NINT_SHIFT 6
  313. #define QCA953X_PLL_CPU_CONFIG_NINT_MASK 0x3f
  314. #define QCA953X_PLL_CPU_CONFIG_REFDIV_SHIFT 12
  315. #define QCA953X_PLL_CPU_CONFIG_REFDIV_MASK 0x1f
  316. #define QCA953X_PLL_CPU_CONFIG_OUTDIV_SHIFT 19
  317. #define QCA953X_PLL_CPU_CONFIG_OUTDIV_MASK 0x7
  318. #define QCA953X_PLL_DDR_CONFIG_NFRAC_SHIFT 0
  319. #define QCA953X_PLL_DDR_CONFIG_NFRAC_MASK 0x3ff
  320. #define QCA953X_PLL_DDR_CONFIG_NINT_SHIFT 10
  321. #define QCA953X_PLL_DDR_CONFIG_NINT_MASK 0x3f
  322. #define QCA953X_PLL_DDR_CONFIG_REFDIV_SHIFT 16
  323. #define QCA953X_PLL_DDR_CONFIG_REFDIV_MASK 0x1f
  324. #define QCA953X_PLL_DDR_CONFIG_OUTDIV_SHIFT 23
  325. #define QCA953X_PLL_DDR_CONFIG_OUTDIV_MASK 0x7
  326. #define QCA953X_PLL_CLK_CTRL_CPU_PLL_BYPASS BIT(2)
  327. #define QCA953X_PLL_CLK_CTRL_DDR_PLL_BYPASS BIT(3)
  328. #define QCA953X_PLL_CLK_CTRL_AHB_PLL_BYPASS BIT(4)
  329. #define QCA953X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT 5
  330. #define QCA953X_PLL_CLK_CTRL_CPU_POST_DIV_MASK 0x1f
  331. #define QCA953X_PLL_CLK_CTRL_DDR_POST_DIV_SHIFT 10
  332. #define QCA953X_PLL_CLK_CTRL_DDR_POST_DIV_MASK 0x1f
  333. #define QCA953X_PLL_CLK_CTRL_AHB_POST_DIV_SHIFT 15
  334. #define QCA953X_PLL_CLK_CTRL_AHB_POST_DIV_MASK 0x1f
  335. #define QCA953X_PLL_CLK_CTRL_CPUCLK_FROM_CPUPLL BIT(20)
  336. #define QCA953X_PLL_CLK_CTRL_DDRCLK_FROM_DDRPLL BIT(21)
  337. #define QCA953X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24)
  338. #define QCA955X_PLL_CPU_CONFIG_REG 0x00
  339. #define QCA955X_PLL_DDR_CONFIG_REG 0x04
  340. #define QCA955X_PLL_CLK_CTRL_REG 0x08
  341. #define QCA955X_PLL_ETH_XMII_CONTROL_REG 0x28
  342. #define QCA955X_PLL_ETH_SGMII_CONTROL_REG 0x48
  343. #define QCA955X_PLL_ETH_SGMII_SERDES_REG 0x4c
  344. #define QCA955X_PLL_CPU_CONFIG_NFRAC_SHIFT 0
  345. #define QCA955X_PLL_CPU_CONFIG_NFRAC_MASK 0x3f
  346. #define QCA955X_PLL_CPU_CONFIG_NINT_SHIFT 6
  347. #define QCA955X_PLL_CPU_CONFIG_NINT_MASK 0x3f
  348. #define QCA955X_PLL_CPU_CONFIG_REFDIV_SHIFT 12
  349. #define QCA955X_PLL_CPU_CONFIG_REFDIV_MASK 0x1f
  350. #define QCA955X_PLL_CPU_CONFIG_OUTDIV_SHIFT 19
  351. #define QCA955X_PLL_CPU_CONFIG_OUTDIV_MASK 0x3
  352. #define QCA955X_PLL_DDR_CONFIG_NFRAC_SHIFT 0
  353. #define QCA955X_PLL_DDR_CONFIG_NFRAC_MASK 0x3ff
  354. #define QCA955X_PLL_DDR_CONFIG_NINT_SHIFT 10
  355. #define QCA955X_PLL_DDR_CONFIG_NINT_MASK 0x3f
  356. #define QCA955X_PLL_DDR_CONFIG_REFDIV_SHIFT 16
  357. #define QCA955X_PLL_DDR_CONFIG_REFDIV_MASK 0x1f
  358. #define QCA955X_PLL_DDR_CONFIG_OUTDIV_SHIFT 23
  359. #define QCA955X_PLL_DDR_CONFIG_OUTDIV_MASK 0x7
  360. #define QCA955X_PLL_CLK_CTRL_CPU_PLL_BYPASS BIT(2)
  361. #define QCA955X_PLL_CLK_CTRL_DDR_PLL_BYPASS BIT(3)
  362. #define QCA955X_PLL_CLK_CTRL_AHB_PLL_BYPASS BIT(4)
  363. #define QCA955X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT 5
  364. #define QCA955X_PLL_CLK_CTRL_CPU_POST_DIV_MASK 0x1f
  365. #define QCA955X_PLL_CLK_CTRL_DDR_POST_DIV_SHIFT 10
  366. #define QCA955X_PLL_CLK_CTRL_DDR_POST_DIV_MASK 0x1f
  367. #define QCA955X_PLL_CLK_CTRL_AHB_POST_DIV_SHIFT 15
  368. #define QCA955X_PLL_CLK_CTRL_AHB_POST_DIV_MASK 0x1f
  369. #define QCA955X_PLL_CLK_CTRL_CPUCLK_FROM_CPUPLL BIT(20)
  370. #define QCA955X_PLL_CLK_CTRL_DDRCLK_FROM_DDRPLL BIT(21)
  371. #define QCA955X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24)
  372. #define QCA955X_PLL_ETH_SGMII_SERDES_LOCK_DETECT BIT(2)
  373. #define QCA955X_PLL_ETH_SGMII_SERDES_PLL_REFCLK BIT(1)
  374. #define QCA955X_PLL_ETH_SGMII_SERDES_EN_PLL BIT(0)
  375. #define QCA956X_PLL_CPU_CONFIG_REG 0x00
  376. #define QCA956X_PLL_CPU_CONFIG1_REG 0x04
  377. #define QCA956X_PLL_DDR_CONFIG_REG 0x08
  378. #define QCA956X_PLL_DDR_CONFIG1_REG 0x0c
  379. #define QCA956X_PLL_CLK_CTRL_REG 0x10
  380. #define QCA956X_PLL_SWITCH_CLOCK_CONTROL_REG 0x28
  381. #define QCA956X_PLL_ETH_XMII_CONTROL_REG 0x30
  382. #define QCA956X_PLL_ETH_SGMII_SERDES_REG 0x4c
  383. #define QCA956X_PLL_CPU_CONFIG_REFDIV_SHIFT 12
  384. #define QCA956X_PLL_CPU_CONFIG_REFDIV_MASK 0x1f
  385. #define QCA956X_PLL_CPU_CONFIG_OUTDIV_SHIFT 19
  386. #define QCA956X_PLL_CPU_CONFIG_OUTDIV_MASK 0x7
  387. #define QCA956X_PLL_CPU_CONFIG1_NFRAC_L_SHIFT 0
  388. #define QCA956X_PLL_CPU_CONFIG1_NFRAC_L_MASK 0x1f
  389. #define QCA956X_PLL_CPU_CONFIG1_NFRAC_H_SHIFT 5
  390. #define QCA956X_PLL_CPU_CONFIG1_NFRAC_H_MASK 0x1fff
  391. #define QCA956X_PLL_CPU_CONFIG1_NINT_SHIFT 18
  392. #define QCA956X_PLL_CPU_CONFIG1_NINT_MASK 0x1ff
  393. #define QCA956X_PLL_DDR_CONFIG_REFDIV_SHIFT 16
  394. #define QCA956X_PLL_DDR_CONFIG_REFDIV_MASK 0x1f
  395. #define QCA956X_PLL_DDR_CONFIG_OUTDIV_SHIFT 23
  396. #define QCA956X_PLL_DDR_CONFIG_OUTDIV_MASK 0x7
  397. #define QCA956X_PLL_DDR_CONFIG1_NFRAC_L_SHIFT 0
  398. #define QCA956X_PLL_DDR_CONFIG1_NFRAC_L_MASK 0x1f
  399. #define QCA956X_PLL_DDR_CONFIG1_NFRAC_H_SHIFT 5
  400. #define QCA956X_PLL_DDR_CONFIG1_NFRAC_H_MASK 0x1fff
  401. #define QCA956X_PLL_DDR_CONFIG1_NINT_SHIFT 18
  402. #define QCA956X_PLL_DDR_CONFIG1_NINT_MASK 0x1ff
  403. #define QCA956X_PLL_CLK_CTRL_CPU_PLL_BYPASS BIT(2)
  404. #define QCA956X_PLL_CLK_CTRL_DDR_PLL_BYPASS BIT(3)
  405. #define QCA956X_PLL_CLK_CTRL_AHB_PLL_BYPASS BIT(4)
  406. #define QCA956X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT 5
  407. #define QCA956X_PLL_CLK_CTRL_CPU_POST_DIV_MASK 0x1f
  408. #define QCA956X_PLL_CLK_CTRL_DDR_POST_DIV_SHIFT 10
  409. #define QCA956X_PLL_CLK_CTRL_DDR_POST_DIV_MASK 0x1f
  410. #define QCA956X_PLL_CLK_CTRL_AHB_POST_DIV_SHIFT 15
  411. #define QCA956X_PLL_CLK_CTRL_AHB_POST_DIV_MASK 0x1f
  412. #define QCA956X_PLL_CLK_CTRL_CPU_DDRCLK_FROM_DDRPLL BIT(20)
  413. #define QCA956X_PLL_CLK_CTRL_CPU_DDRCLK_FROM_CPUPLL BIT(21)
  414. #define QCA956X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24)
  415. #define QCA956X_PLL_SWITCH_CLOCK_SPARE_I2C_CLK_SELB BIT(5)
  416. #define QCA956X_PLL_SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_1 BIT(6)
  417. #define QCA956X_PLL_SWITCH_CLOCK_SPARE_UART1_CLK_SEL BIT(7)
  418. #define QCA956X_PLL_SWITCH_CLOCK_SPARE_USB_REFCLK_FREQ_SEL_SHIFT 8
  419. #define QCA956X_PLL_SWITCH_CLOCK_SPARE_USB_REFCLK_FREQ_SEL_MASK 0xf
  420. #define QCA956X_PLL_SWITCH_CLOCK_SPARE_EN_PLL_TOP BIT(12)
  421. #define QCA956X_PLL_SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_2 BIT(13)
  422. #define QCA956X_PLL_SWITCH_CLOCK_SPARE_MDIO_CLK_SEL1_1 BIT(14)
  423. #define QCA956X_PLL_SWITCH_CLOCK_SPARE_MDIO_CLK_SEL1_2 BIT(15)
  424. #define QCA956X_PLL_SWITCH_CLOCK_SPARE_SWITCH_FUNC_TST_MODE BIT(16)
  425. #define QCA956X_PLL_SWITCH_CLOCK_SPARE_EEE_ENABLE BIT(17)
  426. #define QCA956X_PLL_SWITCH_CLOCK_SPARE_OEN_CLK125M_PLL BIT(18)
  427. #define QCA956X_PLL_SWITCH_CLOCK_SPARE_SWITCHCLK_SEL BIT(19)
  428. #define QCA956X_PLL_ETH_XMII_TX_INVERT BIT(1)
  429. #define QCA956X_PLL_ETH_XMII_GIGE BIT(25)
  430. #define QCA956X_PLL_ETH_XMII_RX_DELAY_SHIFT 28
  431. #define QCA956X_PLL_ETH_XMII_RX_DELAY_MASK 0x3
  432. #define QCA956X_PLL_ETH_XMII_TX_DELAY_SHIFT 26
  433. #define QCA956X_PLL_ETH_XMII_TX_DELAY_MASK 3
  434. #define QCA956X_PLL_ETH_SGMII_SERDES_LOCK_DETECT BIT(2)
  435. #define QCA956X_PLL_ETH_SGMII_SERDES_PLL_REFCLK BIT(1)
  436. #define QCA956X_PLL_ETH_SGMII_SERDES_EN_PLL BIT(0)
  437. /*
  438. * USB_CONFIG block
  439. */
  440. #define AR71XX_USB_CTRL_REG_FLADJ 0x00
  441. #define AR71XX_USB_CTRL_REG_CONFIG 0x04
  442. /*
  443. * RESET block
  444. */
  445. #define AR71XX_RESET_REG_TIMER 0x00
  446. #define AR71XX_RESET_REG_TIMER_RELOAD 0x04
  447. #define AR71XX_RESET_REG_WDOG_CTRL 0x08
  448. #define AR71XX_RESET_REG_WDOG 0x0c
  449. #define AR71XX_RESET_REG_MISC_INT_STATUS 0x10
  450. #define AR71XX_RESET_REG_MISC_INT_ENABLE 0x14
  451. #define AR71XX_RESET_REG_PCI_INT_STATUS 0x18
  452. #define AR71XX_RESET_REG_PCI_INT_ENABLE 0x1c
  453. #define AR71XX_RESET_REG_GLOBAL_INT_STATUS 0x20
  454. #define AR71XX_RESET_REG_RESET_MODULE 0x24
  455. #define AR71XX_RESET_REG_PERFC_CTRL 0x2c
  456. #define AR71XX_RESET_REG_PERFC0 0x30
  457. #define AR71XX_RESET_REG_PERFC1 0x34
  458. #define AR71XX_RESET_REG_REV_ID 0x90
  459. #define AR913X_RESET_REG_GLOBAL_INT_STATUS 0x18
  460. #define AR913X_RESET_REG_RESET_MODULE 0x1c
  461. #define AR913X_RESET_REG_PERF_CTRL 0x20
  462. #define AR913X_RESET_REG_PERFC0 0x24
  463. #define AR913X_RESET_REG_PERFC1 0x28
  464. #define AR724X_RESET_REG_RESET_MODULE 0x1c
  465. #define AR933X_RESET_REG_RESET_MODULE 0x1c
  466. #define AR933X_RESET_REG_BOOTSTRAP 0xac
  467. #define AR934X_RESET_REG_RESET_MODULE 0x1c
  468. #define AR934X_RESET_REG_BOOTSTRAP 0xb0
  469. #define AR934X_RESET_REG_PCIE_WMAC_INT_STATUS 0xac
  470. #define QCA953X_RESET_REG_RESET_MODULE 0x1c
  471. #define QCA953X_RESET_REG_BOOTSTRAP 0xb0
  472. #define QCA953X_RESET_REG_PCIE_WMAC_INT_STATUS 0xac
  473. #define QCA955X_RESET_REG_RESET_MODULE 0x1c
  474. #define QCA955X_RESET_REG_BOOTSTRAP 0xb0
  475. #define QCA955X_RESET_REG_EXT_INT_STATUS 0xac
  476. #define QCA956X_RESET_REG_RESET_MODULE 0x1c
  477. #define QCA956X_RESET_REG_BOOTSTRAP 0xb0
  478. #define QCA956X_RESET_REG_EXT_INT_STATUS 0xac
  479. #define MISC_INT_MIPS_SI_TIMERINT_MASK BIT(28)
  480. #define MISC_INT_ETHSW BIT(12)
  481. #define MISC_INT_TIMER4 BIT(10)
  482. #define MISC_INT_TIMER3 BIT(9)
  483. #define MISC_INT_TIMER2 BIT(8)
  484. #define MISC_INT_DMA BIT(7)
  485. #define MISC_INT_OHCI BIT(6)
  486. #define MISC_INT_PERFC BIT(5)
  487. #define MISC_INT_WDOG BIT(4)
  488. #define MISC_INT_UART BIT(3)
  489. #define MISC_INT_GPIO BIT(2)
  490. #define MISC_INT_ERROR BIT(1)
  491. #define MISC_INT_TIMER BIT(0)
  492. #define AR71XX_RESET_EXTERNAL BIT(28)
  493. #define AR71XX_RESET_FULL_CHIP BIT(24)
  494. #define AR71XX_RESET_CPU_NMI BIT(21)
  495. #define AR71XX_RESET_CPU_COLD BIT(20)
  496. #define AR71XX_RESET_DMA BIT(19)
  497. #define AR71XX_RESET_SLIC BIT(18)
  498. #define AR71XX_RESET_STEREO BIT(17)
  499. #define AR71XX_RESET_DDR BIT(16)
  500. #define AR71XX_RESET_GE1_MAC BIT(13)
  501. #define AR71XX_RESET_GE1_PHY BIT(12)
  502. #define AR71XX_RESET_USBSUS_OVERRIDE BIT(10)
  503. #define AR71XX_RESET_GE0_MAC BIT(9)
  504. #define AR71XX_RESET_GE0_PHY BIT(8)
  505. #define AR71XX_RESET_USB_OHCI_DLL BIT(6)
  506. #define AR71XX_RESET_USB_HOST BIT(5)
  507. #define AR71XX_RESET_USB_PHY BIT(4)
  508. #define AR71XX_RESET_PCI_BUS BIT(1)
  509. #define AR71XX_RESET_PCI_CORE BIT(0)
  510. #define AR7240_RESET_USB_HOST BIT(5)
  511. #define AR7240_RESET_OHCI_DLL BIT(3)
  512. #define AR724X_RESET_GE1_MDIO BIT(23)
  513. #define AR724X_RESET_GE0_MDIO BIT(22)
  514. #define AR724X_RESET_PCIE_PHY_SERIAL BIT(10)
  515. #define AR724X_RESET_PCIE_PHY BIT(7)
  516. #define AR724X_RESET_PCIE BIT(6)
  517. #define AR724X_RESET_USB_HOST BIT(5)
  518. #define AR724X_RESET_USB_PHY BIT(4)
  519. #define AR724X_RESET_USBSUS_OVERRIDE BIT(3)
  520. #define AR913X_RESET_AMBA2WMAC BIT(22)
  521. #define AR913X_RESET_USBSUS_OVERRIDE BIT(10)
  522. #define AR913X_RESET_USB_HOST BIT(5)
  523. #define AR913X_RESET_USB_PHY BIT(4)
  524. #define AR933X_RESET_GE1_MDIO BIT(23)
  525. #define AR933X_RESET_GE0_MDIO BIT(22)
  526. #define AR933X_RESET_GE1_MAC BIT(13)
  527. #define AR933X_RESET_WMAC BIT(11)
  528. #define AR933X_RESET_GE0_MAC BIT(9)
  529. #define AR933X_RESET_USB_HOST BIT(5)
  530. #define AR933X_RESET_USB_PHY BIT(4)
  531. #define AR933X_RESET_USBSUS_OVERRIDE BIT(3)
  532. #define AR934X_RESET_HOST BIT(31)
  533. #define AR934X_RESET_SLIC BIT(30)
  534. #define AR934X_RESET_HDMA BIT(29)
  535. #define AR934X_RESET_EXTERNAL BIT(28)
  536. #define AR934X_RESET_RTC BIT(27)
  537. #define AR934X_RESET_PCIE_EP_INT BIT(26)
  538. #define AR934X_RESET_CHKSUM_ACC BIT(25)
  539. #define AR934X_RESET_FULL_CHIP BIT(24)
  540. #define AR934X_RESET_GE1_MDIO BIT(23)
  541. #define AR934X_RESET_GE0_MDIO BIT(22)
  542. #define AR934X_RESET_CPU_NMI BIT(21)
  543. #define AR934X_RESET_CPU_COLD BIT(20)
  544. #define AR934X_RESET_HOST_RESET_INT BIT(19)
  545. #define AR934X_RESET_PCIE_EP BIT(18)
  546. #define AR934X_RESET_UART1 BIT(17)
  547. #define AR934X_RESET_DDR BIT(16)
  548. #define AR934X_RESET_USB_PHY_PLL_PWD_EXT BIT(15)
  549. #define AR934X_RESET_NANDF BIT(14)
  550. #define AR934X_RESET_GE1_MAC BIT(13)
  551. #define AR934X_RESET_ETH_SWITCH_ANALOG BIT(12)
  552. #define AR934X_RESET_USB_PHY_ANALOG BIT(11)
  553. #define AR934X_RESET_HOST_DMA_INT BIT(10)
  554. #define AR934X_RESET_GE0_MAC BIT(9)
  555. #define AR934X_RESET_ETH_SWITCH BIT(8)
  556. #define AR934X_RESET_PCIE_PHY BIT(7)
  557. #define AR934X_RESET_PCIE BIT(6)
  558. #define AR934X_RESET_USB_HOST BIT(5)
  559. #define AR934X_RESET_USB_PHY BIT(4)
  560. #define AR934X_RESET_USBSUS_OVERRIDE BIT(3)
  561. #define AR934X_RESET_LUT BIT(2)
  562. #define AR934X_RESET_MBOX BIT(1)
  563. #define AR934X_RESET_I2S BIT(0)
  564. #define QCA953X_RESET_USB_EXT_PWR BIT(29)
  565. #define QCA953X_RESET_EXTERNAL BIT(28)
  566. #define QCA953X_RESET_RTC BIT(27)
  567. #define QCA953X_RESET_FULL_CHIP BIT(24)
  568. #define QCA953X_RESET_GE1_MDIO BIT(23)
  569. #define QCA953X_RESET_GE0_MDIO BIT(22)
  570. #define QCA953X_RESET_CPU_NMI BIT(21)
  571. #define QCA953X_RESET_CPU_COLD BIT(20)
  572. #define QCA953X_RESET_DDR BIT(16)
  573. #define QCA953X_RESET_USB_PHY_PLL_PWD_EXT BIT(15)
  574. #define QCA953X_RESET_GE1_MAC BIT(13)
  575. #define QCA953X_RESET_ETH_SWITCH_ANALOG BIT(12)
  576. #define QCA953X_RESET_USB_PHY_ANALOG BIT(11)
  577. #define QCA953X_RESET_GE0_MAC BIT(9)
  578. #define QCA953X_RESET_ETH_SWITCH BIT(8)
  579. #define QCA953X_RESET_PCIE_PHY BIT(7)
  580. #define QCA953X_RESET_PCIE BIT(6)
  581. #define QCA953X_RESET_USB_HOST BIT(5)
  582. #define QCA953X_RESET_USB_PHY BIT(4)
  583. #define QCA953X_RESET_USBSUS_OVERRIDE BIT(3)
  584. #define QCA955X_RESET_HOST BIT(31)
  585. #define QCA955X_RESET_SLIC BIT(30)
  586. #define QCA955X_RESET_HDMA BIT(29)
  587. #define QCA955X_RESET_EXTERNAL BIT(28)
  588. #define QCA955X_RESET_RTC BIT(27)
  589. #define QCA955X_RESET_PCIE_EP_INT BIT(26)
  590. #define QCA955X_RESET_CHKSUM_ACC BIT(25)
  591. #define QCA955X_RESET_FULL_CHIP BIT(24)
  592. #define QCA955X_RESET_GE1_MDIO BIT(23)
  593. #define QCA955X_RESET_GE0_MDIO BIT(22)
  594. #define QCA955X_RESET_CPU_NMI BIT(21)
  595. #define QCA955X_RESET_CPU_COLD BIT(20)
  596. #define QCA955X_RESET_HOST_RESET_INT BIT(19)
  597. #define QCA955X_RESET_PCIE_EP BIT(18)
  598. #define QCA955X_RESET_UART1 BIT(17)
  599. #define QCA955X_RESET_DDR BIT(16)
  600. #define QCA955X_RESET_USB_PHY_PLL_PWD_EXT BIT(15)
  601. #define QCA955X_RESET_NANDF BIT(14)
  602. #define QCA955X_RESET_GE1_MAC BIT(13)
  603. #define QCA955X_RESET_SGMII_ANALOG BIT(12)
  604. #define QCA955X_RESET_USB_PHY_ANALOG BIT(11)
  605. #define QCA955X_RESET_HOST_DMA_INT BIT(10)
  606. #define QCA955X_RESET_GE0_MAC BIT(9)
  607. #define QCA955X_RESET_SGMII BIT(8)
  608. #define QCA955X_RESET_PCIE_PHY BIT(7)
  609. #define QCA955X_RESET_PCIE BIT(6)
  610. #define QCA955X_RESET_USB_HOST BIT(5)
  611. #define QCA955X_RESET_USB_PHY BIT(4)
  612. #define QCA955X_RESET_USBSUS_OVERRIDE BIT(3)
  613. #define QCA955X_RESET_LUT BIT(2)
  614. #define QCA955X_RESET_MBOX BIT(1)
  615. #define QCA955X_RESET_I2S BIT(0)
  616. #define QCA956X_RESET_EXTERNAL BIT(28)
  617. #define QCA956X_RESET_FULL_CHIP BIT(24)
  618. #define QCA956X_RESET_GE1_MDIO BIT(23)
  619. #define QCA956X_RESET_GE0_MDIO BIT(22)
  620. #define QCA956X_RESET_CPU_NMI BIT(21)
  621. #define QCA956X_RESET_CPU_COLD BIT(20)
  622. #define QCA956X_RESET_DMA BIT(19)
  623. #define QCA956X_RESET_DDR BIT(16)
  624. #define QCA956X_RESET_GE1_MAC BIT(13)
  625. #define QCA956X_RESET_SGMII_ANALOG BIT(12)
  626. #define QCA956X_RESET_USB_PHY_ANALOG BIT(11)
  627. #define QCA956X_RESET_GE0_MAC BIT(9)
  628. #define QCA956X_RESET_SGMII BIT(8)
  629. #define QCA956X_RESET_USB_HOST BIT(5)
  630. #define QCA956X_RESET_USB_PHY BIT(4)
  631. #define QCA956X_RESET_USBSUS_OVERRIDE BIT(3)
  632. #define QCA956X_RESET_SWITCH_ANALOG BIT(2)
  633. #define QCA956X_RESET_SWITCH BIT(0)
  634. #define AR933X_BOOTSTRAP_MDIO_GPIO_EN BIT(18)
  635. #define AR933X_BOOTSTRAP_EEPBUSY BIT(4)
  636. #define AR933X_BOOTSTRAP_REF_CLK_40 BIT(0)
  637. #define AR934X_BOOTSTRAP_SW_OPTION8 BIT(23)
  638. #define AR934X_BOOTSTRAP_SW_OPTION7 BIT(22)
  639. #define AR934X_BOOTSTRAP_SW_OPTION6 BIT(21)
  640. #define AR934X_BOOTSTRAP_SW_OPTION5 BIT(20)
  641. #define AR934X_BOOTSTRAP_SW_OPTION4 BIT(19)
  642. #define AR934X_BOOTSTRAP_SW_OPTION3 BIT(18)
  643. #define AR934X_BOOTSTRAP_SW_OPTION2 BIT(17)
  644. #define AR934X_BOOTSTRAP_SW_OPTION1 BIT(16)
  645. #define AR934X_BOOTSTRAP_USB_MODE_DEVICE BIT(7)
  646. #define AR934X_BOOTSTRAP_PCIE_RC BIT(6)
  647. #define AR934X_BOOTSTRAP_EJTAG_MODE BIT(5)
  648. #define AR934X_BOOTSTRAP_REF_CLK_40 BIT(4)
  649. #define AR934X_BOOTSTRAP_BOOT_FROM_SPI BIT(2)
  650. #define AR934X_BOOTSTRAP_SDRAM_DISABLED BIT(1)
  651. #define AR934X_BOOTSTRAP_DDR1 BIT(0)
  652. #define QCA953X_BOOTSTRAP_SW_OPTION2 BIT(12)
  653. #define QCA953X_BOOTSTRAP_SW_OPTION1 BIT(11)
  654. #define QCA953X_BOOTSTRAP_EJTAG_MODE BIT(5)
  655. #define QCA953X_BOOTSTRAP_REF_CLK_40 BIT(4)
  656. #define QCA953X_BOOTSTRAP_SDRAM_DISABLED BIT(1)
  657. #define QCA953X_BOOTSTRAP_DDR1 BIT(0)
  658. #define QCA955X_BOOTSTRAP_REF_CLK_40 BIT(4)
  659. #define QCA956X_BOOTSTRAP_REF_CLK_40 BIT(2)
  660. #define AR934X_PCIE_WMAC_INT_WMAC_MISC BIT(0)
  661. #define AR934X_PCIE_WMAC_INT_WMAC_TX BIT(1)
  662. #define AR934X_PCIE_WMAC_INT_WMAC_RXLP BIT(2)
  663. #define AR934X_PCIE_WMAC_INT_WMAC_RXHP BIT(3)
  664. #define AR934X_PCIE_WMAC_INT_PCIE_RC BIT(4)
  665. #define AR934X_PCIE_WMAC_INT_PCIE_RC0 BIT(5)
  666. #define AR934X_PCIE_WMAC_INT_PCIE_RC1 BIT(6)
  667. #define AR934X_PCIE_WMAC_INT_PCIE_RC2 BIT(7)
  668. #define AR934X_PCIE_WMAC_INT_PCIE_RC3 BIT(8)
  669. #define AR934X_PCIE_WMAC_INT_WMAC_ALL \
  670. (AR934X_PCIE_WMAC_INT_WMAC_MISC | AR934X_PCIE_WMAC_INT_WMAC_TX | \
  671. AR934X_PCIE_WMAC_INT_WMAC_RXLP | AR934X_PCIE_WMAC_INT_WMAC_RXHP)
  672. #define AR934X_PCIE_WMAC_INT_PCIE_ALL \
  673. (AR934X_PCIE_WMAC_INT_PCIE_RC | AR934X_PCIE_WMAC_INT_PCIE_RC0 | \
  674. AR934X_PCIE_WMAC_INT_PCIE_RC1 | AR934X_PCIE_WMAC_INT_PCIE_RC2 | \
  675. AR934X_PCIE_WMAC_INT_PCIE_RC3)
  676. #define QCA953X_PCIE_WMAC_INT_WMAC_MISC BIT(0)
  677. #define QCA953X_PCIE_WMAC_INT_WMAC_TX BIT(1)
  678. #define QCA953X_PCIE_WMAC_INT_WMAC_RXLP BIT(2)
  679. #define QCA953X_PCIE_WMAC_INT_WMAC_RXHP BIT(3)
  680. #define QCA953X_PCIE_WMAC_INT_PCIE_RC BIT(4)
  681. #define QCA953X_PCIE_WMAC_INT_PCIE_RC0 BIT(5)
  682. #define QCA953X_PCIE_WMAC_INT_PCIE_RC1 BIT(6)
  683. #define QCA953X_PCIE_WMAC_INT_PCIE_RC2 BIT(7)
  684. #define QCA953X_PCIE_WMAC_INT_PCIE_RC3 BIT(8)
  685. #define QCA953X_PCIE_WMAC_INT_WMAC_ALL \
  686. (QCA953X_PCIE_WMAC_INT_WMAC_MISC | QCA953X_PCIE_WMAC_INT_WMAC_TX | \
  687. QCA953X_PCIE_WMAC_INT_WMAC_RXLP | QCA953X_PCIE_WMAC_INT_WMAC_RXHP)
  688. #define QCA953X_PCIE_WMAC_INT_PCIE_ALL \
  689. (QCA953X_PCIE_WMAC_INT_PCIE_RC | QCA953X_PCIE_WMAC_INT_PCIE_RC0 | \
  690. QCA953X_PCIE_WMAC_INT_PCIE_RC1 | QCA953X_PCIE_WMAC_INT_PCIE_RC2 | \
  691. QCA953X_PCIE_WMAC_INT_PCIE_RC3)
  692. #define QCA955X_EXT_INT_WMAC_MISC BIT(0)
  693. #define QCA955X_EXT_INT_WMAC_TX BIT(1)
  694. #define QCA955X_EXT_INT_WMAC_RXLP BIT(2)
  695. #define QCA955X_EXT_INT_WMAC_RXHP BIT(3)
  696. #define QCA955X_EXT_INT_PCIE_RC1 BIT(4)
  697. #define QCA955X_EXT_INT_PCIE_RC1_INT0 BIT(5)
  698. #define QCA955X_EXT_INT_PCIE_RC1_INT1 BIT(6)
  699. #define QCA955X_EXT_INT_PCIE_RC1_INT2 BIT(7)
  700. #define QCA955X_EXT_INT_PCIE_RC1_INT3 BIT(8)
  701. #define QCA955X_EXT_INT_PCIE_RC2 BIT(12)
  702. #define QCA955X_EXT_INT_PCIE_RC2_INT0 BIT(13)
  703. #define QCA955X_EXT_INT_PCIE_RC2_INT1 BIT(14)
  704. #define QCA955X_EXT_INT_PCIE_RC2_INT2 BIT(15)
  705. #define QCA955X_EXT_INT_PCIE_RC2_INT3 BIT(16)
  706. #define QCA955X_EXT_INT_USB1 BIT(24)
  707. #define QCA955X_EXT_INT_USB2 BIT(28)
  708. #define QCA955X_EXT_INT_WMAC_ALL \
  709. (QCA955X_EXT_INT_WMAC_MISC | QCA955X_EXT_INT_WMAC_TX | \
  710. QCA955X_EXT_INT_WMAC_RXLP | QCA955X_EXT_INT_WMAC_RXHP)
  711. #define QCA955X_EXT_INT_PCIE_RC1_ALL \
  712. (QCA955X_EXT_INT_PCIE_RC1 | QCA955X_EXT_INT_PCIE_RC1_INT0 | \
  713. QCA955X_EXT_INT_PCIE_RC1_INT1 | QCA955X_EXT_INT_PCIE_RC1_INT2 | \
  714. QCA955X_EXT_INT_PCIE_RC1_INT3)
  715. #define QCA955X_EXT_INT_PCIE_RC2_ALL \
  716. (QCA955X_EXT_INT_PCIE_RC2 | QCA955X_EXT_INT_PCIE_RC2_INT0 | \
  717. QCA955X_EXT_INT_PCIE_RC2_INT1 | QCA955X_EXT_INT_PCIE_RC2_INT2 | \
  718. QCA955X_EXT_INT_PCIE_RC2_INT3)
  719. #define QCA956X_EXT_INT_WMAC_MISC BIT(0)
  720. #define QCA956X_EXT_INT_WMAC_TX BIT(1)
  721. #define QCA956X_EXT_INT_WMAC_RXLP BIT(2)
  722. #define QCA956X_EXT_INT_WMAC_RXHP BIT(3)
  723. #define QCA956X_EXT_INT_PCIE_RC1 BIT(4)
  724. #define QCA956X_EXT_INT_PCIE_RC1_INT0 BIT(5)
  725. #define QCA956X_EXT_INT_PCIE_RC1_INT1 BIT(6)
  726. #define QCA956X_EXT_INT_PCIE_RC1_INT2 BIT(7)
  727. #define QCA956X_EXT_INT_PCIE_RC1_INT3 BIT(8)
  728. #define QCA956X_EXT_INT_PCIE_RC2 BIT(12)
  729. #define QCA956X_EXT_INT_PCIE_RC2_INT0 BIT(13)
  730. #define QCA956X_EXT_INT_PCIE_RC2_INT1 BIT(14)
  731. #define QCA956X_EXT_INT_PCIE_RC2_INT2 BIT(15)
  732. #define QCA956X_EXT_INT_PCIE_RC2_INT3 BIT(16)
  733. #define QCA956X_EXT_INT_USB1 BIT(24)
  734. #define QCA956X_EXT_INT_USB2 BIT(28)
  735. #define QCA956X_EXT_INT_WMAC_ALL \
  736. (QCA956X_EXT_INT_WMAC_MISC | QCA956X_EXT_INT_WMAC_TX | \
  737. QCA956X_EXT_INT_WMAC_RXLP | QCA956X_EXT_INT_WMAC_RXHP)
  738. #define QCA956X_EXT_INT_PCIE_RC1_ALL \
  739. (QCA956X_EXT_INT_PCIE_RC1 | QCA956X_EXT_INT_PCIE_RC1_INT0 | \
  740. QCA956X_EXT_INT_PCIE_RC1_INT1 | QCA956X_EXT_INT_PCIE_RC1_INT2 | \
  741. QCA956X_EXT_INT_PCIE_RC1_INT3)
  742. #define QCA956X_EXT_INT_PCIE_RC2_ALL \
  743. (QCA956X_EXT_INT_PCIE_RC2 | QCA956X_EXT_INT_PCIE_RC2_INT0 | \
  744. QCA956X_EXT_INT_PCIE_RC2_INT1 | QCA956X_EXT_INT_PCIE_RC2_INT2 | \
  745. QCA956X_EXT_INT_PCIE_RC2_INT3)
  746. #define REV_ID_MAJOR_MASK 0xfff0
  747. #define REV_ID_MAJOR_AR71XX 0x00a0
  748. #define REV_ID_MAJOR_AR913X 0x00b0
  749. #define REV_ID_MAJOR_AR7240 0x00c0
  750. #define REV_ID_MAJOR_AR7241 0x0100
  751. #define REV_ID_MAJOR_AR7242 0x1100
  752. #define REV_ID_MAJOR_AR9330 0x0110
  753. #define REV_ID_MAJOR_AR9331 0x1110
  754. #define REV_ID_MAJOR_AR9341 0x0120
  755. #define REV_ID_MAJOR_AR9342 0x1120
  756. #define REV_ID_MAJOR_AR9344 0x2120
  757. #define REV_ID_MAJOR_QCA9533 0x0140
  758. #define REV_ID_MAJOR_QCA9533_V2 0x0160
  759. #define REV_ID_MAJOR_QCA9556 0x0130
  760. #define REV_ID_MAJOR_QCA9558 0x1130
  761. #define REV_ID_MAJOR_TP9343 0x0150
  762. #define REV_ID_MAJOR_QCA956X 0x1150
  763. #define AR71XX_REV_ID_MINOR_MASK 0x3
  764. #define AR71XX_REV_ID_MINOR_AR7130 0x0
  765. #define AR71XX_REV_ID_MINOR_AR7141 0x1
  766. #define AR71XX_REV_ID_MINOR_AR7161 0x2
  767. #define AR71XX_REV_ID_REVISION_MASK 0x3
  768. #define AR71XX_REV_ID_REVISION_SHIFT 2
  769. #define AR913X_REV_ID_MINOR_MASK 0x3
  770. #define AR913X_REV_ID_MINOR_AR9130 0x0
  771. #define AR913X_REV_ID_MINOR_AR9132 0x1
  772. #define AR913X_REV_ID_REVISION_MASK 0x3
  773. #define AR913X_REV_ID_REVISION_SHIFT 2
  774. #define AR933X_REV_ID_REVISION_MASK 0x3
  775. #define AR724X_REV_ID_REVISION_MASK 0x3
  776. #define AR934X_REV_ID_REVISION_MASK 0xf
  777. #define QCA953X_REV_ID_REVISION_MASK 0xf
  778. #define QCA955X_REV_ID_REVISION_MASK 0xf
  779. #define QCA956X_REV_ID_REVISION_MASK 0xf
  780. /*
  781. * SPI block
  782. */
  783. #define AR71XX_SPI_REG_FS 0x00 /* Function Select */
  784. #define AR71XX_SPI_REG_CTRL 0x04 /* SPI Control */
  785. #define AR71XX_SPI_REG_IOC 0x08 /* SPI I/O Control */
  786. #define AR71XX_SPI_REG_RDS 0x0c /* Read Data Shift */
  787. #define AR71XX_SPI_FS_GPIO BIT(0) /* Enable GPIO mode */
  788. #define AR71XX_SPI_CTRL_RD BIT(6) /* Remap Disable */
  789. #define AR71XX_SPI_CTRL_DIV_MASK 0x3f
  790. #define AR71XX_SPI_IOC_DO BIT(0) /* Data Out pin */
  791. #define AR71XX_SPI_IOC_CLK BIT(8) /* CLK pin */
  792. #define AR71XX_SPI_IOC_CS(n) BIT(16 + (n))
  793. #define AR71XX_SPI_IOC_CS0 AR71XX_SPI_IOC_CS(0)
  794. #define AR71XX_SPI_IOC_CS1 AR71XX_SPI_IOC_CS(1)
  795. #define AR71XX_SPI_IOC_CS2 AR71XX_SPI_IOC_CS(2)
  796. #define AR71XX_SPI_IOC_CS_ALL (AR71XX_SPI_IOC_CS0 | AR71XX_SPI_IOC_CS1 | \
  797. AR71XX_SPI_IOC_CS2)
  798. /*
  799. * GPIO block
  800. */
  801. #define AR71XX_GPIO_REG_OE 0x00
  802. #define AR71XX_GPIO_REG_IN 0x04
  803. #define AR71XX_GPIO_REG_OUT 0x08
  804. #define AR71XX_GPIO_REG_SET 0x0c
  805. #define AR71XX_GPIO_REG_CLEAR 0x10
  806. #define AR71XX_GPIO_REG_INT_MODE 0x14
  807. #define AR71XX_GPIO_REG_INT_TYPE 0x18
  808. #define AR71XX_GPIO_REG_INT_POLARITY 0x1c
  809. #define AR71XX_GPIO_REG_INT_PENDING 0x20
  810. #define AR71XX_GPIO_REG_INT_ENABLE 0x24
  811. #define AR71XX_GPIO_REG_FUNC 0x28
  812. #define AR934X_GPIO_REG_OUT_FUNC0 0x2c
  813. #define AR934X_GPIO_REG_OUT_FUNC1 0x30
  814. #define AR934X_GPIO_REG_OUT_FUNC2 0x34
  815. #define AR934X_GPIO_REG_OUT_FUNC3 0x38
  816. #define AR934X_GPIO_REG_OUT_FUNC4 0x3c
  817. #define AR934X_GPIO_REG_OUT_FUNC5 0x40
  818. #define AR934X_GPIO_REG_FUNC 0x6c
  819. #define QCA953X_GPIO_REG_OUT_FUNC0 0x2c
  820. #define QCA953X_GPIO_REG_OUT_FUNC1 0x30
  821. #define QCA953X_GPIO_REG_OUT_FUNC2 0x34
  822. #define QCA953X_GPIO_REG_OUT_FUNC3 0x38
  823. #define QCA953X_GPIO_REG_OUT_FUNC4 0x3c
  824. #define QCA953X_GPIO_REG_IN_ENABLE0 0x44
  825. #define QCA953X_GPIO_REG_FUNC 0x6c
  826. #define QCA953X_GPIO_OUT_MUX_SPI_CS1 10
  827. #define QCA953X_GPIO_OUT_MUX_SPI_CS2 11
  828. #define QCA953X_GPIO_OUT_MUX_SPI_CS0 9
  829. #define QCA953X_GPIO_OUT_MUX_SPI_CLK 8
  830. #define QCA953X_GPIO_OUT_MUX_SPI_MOSI 12
  831. #define QCA953X_GPIO_OUT_MUX_LED_LINK1 41
  832. #define QCA953X_GPIO_OUT_MUX_LED_LINK2 42
  833. #define QCA953X_GPIO_OUT_MUX_LED_LINK3 43
  834. #define QCA953X_GPIO_OUT_MUX_LED_LINK4 44
  835. #define QCA953X_GPIO_OUT_MUX_LED_LINK5 45
  836. #define QCA955X_GPIO_REG_OUT_FUNC0 0x2c
  837. #define QCA955X_GPIO_REG_OUT_FUNC1 0x30
  838. #define QCA955X_GPIO_REG_OUT_FUNC2 0x34
  839. #define QCA955X_GPIO_REG_OUT_FUNC3 0x38
  840. #define QCA955X_GPIO_REG_OUT_FUNC4 0x3c
  841. #define QCA955X_GPIO_REG_OUT_FUNC5 0x40
  842. #define QCA955X_GPIO_REG_FUNC 0x6c
  843. #define QCA956X_GPIO_REG_OUT_FUNC0 0x2c
  844. #define QCA956X_GPIO_REG_OUT_FUNC1 0x30
  845. #define QCA956X_GPIO_REG_OUT_FUNC2 0x34
  846. #define QCA956X_GPIO_REG_OUT_FUNC3 0x38
  847. #define QCA956X_GPIO_REG_OUT_FUNC4 0x3c
  848. #define QCA956X_GPIO_REG_OUT_FUNC5 0x40
  849. #define QCA956X_GPIO_REG_IN_ENABLE0 0x44
  850. #define QCA956X_GPIO_REG_IN_ENABLE3 0x50
  851. #define QCA956X_GPIO_REG_FUNC 0x6c
  852. #define QCA956X_GPIO_OUT_MUX_GE0_MDO 32
  853. #define QCA956X_GPIO_OUT_MUX_GE0_MDC 33
  854. #define AR71XX_GPIO_COUNT 16
  855. #define AR7240_GPIO_COUNT 18
  856. #define AR7241_GPIO_COUNT 20
  857. #define AR913X_GPIO_COUNT 22
  858. #define AR933X_GPIO_COUNT 30
  859. #define AR934X_GPIO_COUNT 23
  860. #define QCA953X_GPIO_COUNT 18
  861. #define QCA955X_GPIO_COUNT 24
  862. #define QCA956X_GPIO_COUNT 23
  863. /*
  864. * SRIF block
  865. */
  866. #define AR934X_SRIF_CPU_DPLL1_REG 0x1c0
  867. #define AR934X_SRIF_CPU_DPLL2_REG 0x1c4
  868. #define AR934X_SRIF_CPU_DPLL3_REG 0x1c8
  869. #define AR934X_SRIF_DDR_DPLL1_REG 0x240
  870. #define AR934X_SRIF_DDR_DPLL2_REG 0x244
  871. #define AR934X_SRIF_DDR_DPLL3_REG 0x248
  872. #define AR934X_SRIF_DPLL1_REFDIV_SHIFT 27
  873. #define AR934X_SRIF_DPLL1_REFDIV_MASK 0x1f
  874. #define AR934X_SRIF_DPLL1_NINT_SHIFT 18
  875. #define AR934X_SRIF_DPLL1_NINT_MASK 0x1ff
  876. #define AR934X_SRIF_DPLL1_NFRAC_MASK 0x0003ffff
  877. #define AR934X_SRIF_DPLL2_LOCAL_PLL BIT(30)
  878. #define AR934X_SRIF_DPLL2_OUTDIV_SHIFT 13
  879. #define AR934X_SRIF_DPLL2_OUTDIV_MASK 0x7
  880. #define QCA953X_SRIF_CPU_DPLL1_REG 0x1c0
  881. #define QCA953X_SRIF_CPU_DPLL2_REG 0x1c4
  882. #define QCA953X_SRIF_CPU_DPLL3_REG 0x1c8
  883. #define QCA953X_SRIF_DDR_DPLL1_REG 0x240
  884. #define QCA953X_SRIF_DDR_DPLL2_REG 0x244
  885. #define QCA953X_SRIF_DDR_DPLL3_REG 0x248
  886. #define QCA953X_SRIF_DPLL1_REFDIV_SHIFT 27
  887. #define QCA953X_SRIF_DPLL1_REFDIV_MASK 0x1f
  888. #define QCA953X_SRIF_DPLL1_NINT_SHIFT 18
  889. #define QCA953X_SRIF_DPLL1_NINT_MASK 0x1ff
  890. #define QCA953X_SRIF_DPLL1_NFRAC_MASK 0x0003ffff
  891. #define QCA953X_SRIF_DPLL2_LOCAL_PLL BIT(30)
  892. #define QCA953X_SRIF_DPLL2_OUTDIV_SHIFT 13
  893. #define QCA953X_SRIF_DPLL2_OUTDIV_MASK 0x7
  894. #define AR71XX_GPIO_FUNC_STEREO_EN BIT(17)
  895. #define AR71XX_GPIO_FUNC_SLIC_EN BIT(16)
  896. #define AR71XX_GPIO_FUNC_SPI_CS2_EN BIT(13)
  897. #define AR71XX_GPIO_FUNC_SPI_CS1_EN BIT(12)
  898. #define AR71XX_GPIO_FUNC_UART_EN BIT(8)
  899. #define AR71XX_GPIO_FUNC_USB_OC_EN BIT(4)
  900. #define AR71XX_GPIO_FUNC_USB_CLK_EN BIT(0)
  901. #define AR724X_GPIO_FUNC_GE0_MII_CLK_EN BIT(19)
  902. #define AR724X_GPIO_FUNC_SPI_EN BIT(18)
  903. #define AR724X_GPIO_FUNC_SPI_CS_EN2 BIT(14)
  904. #define AR724X_GPIO_FUNC_SPI_CS_EN1 BIT(13)
  905. #define AR724X_GPIO_FUNC_CLK_OBS5_EN BIT(12)
  906. #define AR724X_GPIO_FUNC_CLK_OBS4_EN BIT(11)
  907. #define AR724X_GPIO_FUNC_CLK_OBS3_EN BIT(10)
  908. #define AR724X_GPIO_FUNC_CLK_OBS2_EN BIT(9)
  909. #define AR724X_GPIO_FUNC_CLK_OBS1_EN BIT(8)
  910. #define AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN BIT(7)
  911. #define AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN BIT(6)
  912. #define AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN BIT(5)
  913. #define AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN BIT(4)
  914. #define AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN BIT(3)
  915. #define AR724X_GPIO_FUNC_UART_RTS_CTS_EN BIT(2)
  916. #define AR724X_GPIO_FUNC_UART_EN BIT(1)
  917. #define AR724X_GPIO_FUNC_JTAG_DISABLE BIT(0)
  918. #define AR913X_GPIO_FUNC_WMAC_LED_EN BIT(22)
  919. #define AR913X_GPIO_FUNC_EXP_PORT_CS_EN BIT(21)
  920. #define AR913X_GPIO_FUNC_I2S_REFCLKEN BIT(20)
  921. #define AR913X_GPIO_FUNC_I2S_MCKEN BIT(19)
  922. #define AR913X_GPIO_FUNC_I2S1_EN BIT(18)
  923. #define AR913X_GPIO_FUNC_I2S0_EN BIT(17)
  924. #define AR913X_GPIO_FUNC_SLIC_EN BIT(16)
  925. #define AR913X_GPIO_FUNC_UART_RTSCTS_EN BIT(9)
  926. #define AR913X_GPIO_FUNC_UART_EN BIT(8)
  927. #define AR913X_GPIO_FUNC_USB_CLK_EN BIT(4)
  928. #define AR933X_GPIO_FUNC_SPDIF2TCK BIT(31)
  929. #define AR933X_GPIO_FUNC_SPDIF_EN BIT(30)
  930. #define AR933X_GPIO_FUNC_I2SO_22_18_EN BIT(29)
  931. #define AR933X_GPIO_FUNC_I2S_MCK_EN BIT(27)
  932. #define AR933X_GPIO_FUNC_I2SO_EN BIT(26)
  933. #define AR933X_GPIO_FUNC_ETH_SWITCH_LED_DUPL BIT(25)
  934. #define AR933X_GPIO_FUNC_ETH_SWITCH_LED_COLL BIT(24)
  935. #define AR933X_GPIO_FUNC_ETH_SWITCH_LED_ACT BIT(23)
  936. #define AR933X_GPIO_FUNC_SPI_EN BIT(18)
  937. #define AR933X_GPIO_FUNC_SPI_CS_EN2 BIT(14)
  938. #define AR933X_GPIO_FUNC_SPI_CS_EN1 BIT(13)
  939. #define AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN BIT(7)
  940. #define AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN BIT(6)
  941. #define AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN BIT(5)
  942. #define AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN BIT(4)
  943. #define AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN BIT(3)
  944. #define AR933X_GPIO_FUNC_UART_RTS_CTS_EN BIT(2)
  945. #define AR933X_GPIO_FUNC_UART_EN BIT(1)
  946. #define AR933X_GPIO_FUNC_JTAG_DISABLE BIT(0)
  947. #define AR934X_GPIO_FUNC_CLK_OBS7_EN BIT(9)
  948. #define AR934X_GPIO_FUNC_CLK_OBS6_EN BIT(8)
  949. #define AR934X_GPIO_FUNC_CLK_OBS5_EN BIT(7)
  950. #define AR934X_GPIO_FUNC_CLK_OBS4_EN BIT(6)
  951. #define AR934X_GPIO_FUNC_CLK_OBS3_EN BIT(5)
  952. #define AR934X_GPIO_FUNC_CLK_OBS2_EN BIT(4)
  953. #define AR934X_GPIO_FUNC_CLK_OBS1_EN BIT(3)
  954. #define AR934X_GPIO_FUNC_CLK_OBS0_EN BIT(2)
  955. #define AR934X_GPIO_FUNC_JTAG_DISABLE BIT(1)
  956. #define AR934X_GPIO_OUT_GPIO 0
  957. #define AR934X_GPIO_OUT_SPI_CS1 7
  958. #define AR934X_GPIO_OUT_LED_LINK0 41
  959. #define AR934X_GPIO_OUT_LED_LINK1 42
  960. #define AR934X_GPIO_OUT_LED_LINK2 43
  961. #define AR934X_GPIO_OUT_LED_LINK3 44
  962. #define AR934X_GPIO_OUT_LED_LINK4 45
  963. #define AR934X_GPIO_OUT_EXT_LNA0 46
  964. #define AR934X_GPIO_OUT_EXT_LNA1 47
  965. #define QCA955X_GPIO_FUNC_CLK_OBS7_EN BIT(9)
  966. #define QCA955X_GPIO_FUNC_CLK_OBS6_EN BIT(8)
  967. #define QCA955X_GPIO_FUNC_CLK_OBS5_EN BIT(7)
  968. #define QCA955X_GPIO_FUNC_CLK_OBS4_EN BIT(6)
  969. #define QCA955X_GPIO_FUNC_CLK_OBS3_EN BIT(5)
  970. #define QCA955X_GPIO_FUNC_CLK_OBS2_EN BIT(4)
  971. #define QCA955X_GPIO_FUNC_CLK_OBS1_EN BIT(3)
  972. #define QCA955X_GPIO_FUNC_JTAG_DISABLE BIT(1)
  973. #define QCA955X_GPIO_OUT_GPIO 0
  974. #define QCA955X_MII_EXT_MDI 1
  975. #define QCA955X_SLIC_DATA_OUT 3
  976. #define QCA955X_SLIC_PCM_FS 4
  977. #define QCA955X_SLIC_PCM_CLK 5
  978. #define QCA955X_SPI_CLK 8
  979. #define QCA955X_SPI_CS_0 9
  980. #define QCA955X_SPI_CS_1 10
  981. #define QCA955X_SPI_CS_2 11
  982. #define QCA955X_SPI_MISO 12
  983. #define QCA955X_I2S_CLK 13
  984. #define QCA955X_I2S_WS 14
  985. #define QCA955X_I2S_SD 15
  986. #define QCA955X_I2S_MCK 16
  987. #define QCA955X_SPDIF_OUT 17
  988. #define QCA955X_UART1_TD 18
  989. #define QCA955X_UART1_RTS 19
  990. #define QCA955X_UART1_RD 20
  991. #define QCA955X_UART1_CTS 21
  992. #define QCA955X_UART0_SOUT 22
  993. #define QCA955X_SPDIF2_OUT 23
  994. #define QCA955X_LED_SGMII_SPEED0 24
  995. #define QCA955X_LED_SGMII_SPEED1 25
  996. #define QCA955X_LED_SGMII_DUPLEX 26
  997. #define QCA955X_LED_SGMII_LINK_UP 27
  998. #define QCA955X_SGMII_SPEED0_INVERT 28
  999. #define QCA955X_SGMII_SPEED1_INVERT 29
  1000. #define QCA955X_SGMII_DUPLEX_INVERT 30
  1001. #define QCA955X_SGMII_LINK_UP_INVERT 31
  1002. #define QCA955X_GE1_MII_MDO 32
  1003. #define QCA955X_GE1_MII_MDC 33
  1004. #define QCA955X_SWCOM2 38
  1005. #define QCA955X_SWCOM3 39
  1006. #define QCA955X_MAC2_GPIO 40
  1007. #define QCA955X_MAC3_GPIO 41
  1008. #define QCA955X_ATT_LED 42
  1009. #define QCA955X_PWR_LED 43
  1010. #define QCA955X_TX_FRAME 44
  1011. #define QCA955X_RX_CLEAR_EXTERNAL 45
  1012. #define QCA955X_LED_NETWORK_EN 46
  1013. #define QCA955X_LED_POWER_EN 47
  1014. #define QCA955X_WMAC_GLUE_WOW 68
  1015. #define QCA955X_RX_CLEAR_EXTENSION 70
  1016. #define QCA955X_CP_NAND_CS1 73
  1017. #define QCA955X_USB_SUSPEND 74
  1018. #define QCA955X_ETH_TX_ERR 75
  1019. #define QCA955X_DDR_DQ_OE 76
  1020. #define QCA955X_CLKREQ_N_EP 77
  1021. #define QCA955X_CLKREQ_N_RC 78
  1022. #define QCA955X_CLK_OBS0 79
  1023. #define QCA955X_CLK_OBS1 80
  1024. #define QCA955X_CLK_OBS2 81
  1025. #define QCA955X_CLK_OBS3 82
  1026. #define QCA955X_CLK_OBS4 83
  1027. #define QCA955X_CLK_OBS5 84
  1028. /*
  1029. * MII_CTRL block
  1030. */
  1031. #define AR71XX_MII_REG_MII0_CTRL 0x00
  1032. #define AR71XX_MII_REG_MII1_CTRL 0x04
  1033. #define AR71XX_MII_CTRL_IF_MASK 3
  1034. #define AR71XX_MII_CTRL_SPEED_SHIFT 4
  1035. #define AR71XX_MII_CTRL_SPEED_MASK 3
  1036. #define AR71XX_MII_CTRL_SPEED_10 0
  1037. #define AR71XX_MII_CTRL_SPEED_100 1
  1038. #define AR71XX_MII_CTRL_SPEED_1000 2
  1039. #define AR71XX_MII0_CTRL_IF_GMII 0
  1040. #define AR71XX_MII0_CTRL_IF_MII 1
  1041. #define AR71XX_MII0_CTRL_IF_RGMII 2
  1042. #define AR71XX_MII0_CTRL_IF_RMII 3
  1043. #define AR71XX_MII1_CTRL_IF_RGMII 0
  1044. #define AR71XX_MII1_CTRL_IF_RMII 1
  1045. /*
  1046. * AR933X GMAC interface
  1047. */
  1048. #define AR933X_GMAC_REG_ETH_CFG 0x00
  1049. #define AR933X_ETH_CFG_RGMII_GE0 BIT(0)
  1050. #define AR933X_ETH_CFG_MII_GE0 BIT(1)
  1051. #define AR933X_ETH_CFG_GMII_GE0 BIT(2)
  1052. #define AR933X_ETH_CFG_MII_GE0_MASTER BIT(3)
  1053. #define AR933X_ETH_CFG_MII_GE0_SLAVE BIT(4)
  1054. #define AR933X_ETH_CFG_MII_GE0_ERR_EN BIT(5)
  1055. #define AR933X_ETH_CFG_SW_PHY_SWAP BIT(7)
  1056. #define AR933X_ETH_CFG_SW_PHY_ADDR_SWAP BIT(8)
  1057. #define AR933X_ETH_CFG_RMII_GE0 BIT(9)
  1058. #define AR933X_ETH_CFG_RMII_GE0_SPD_10 0
  1059. #define AR933X_ETH_CFG_RMII_GE0_SPD_100 BIT(10)
  1060. /*
  1061. * AR934X GMAC Interface
  1062. */
  1063. #define AR934X_GMAC_REG_ETH_CFG 0x00
  1064. #define AR934X_ETH_CFG_RGMII_GMAC0 BIT(0)
  1065. #define AR934X_ETH_CFG_MII_GMAC0 BIT(1)
  1066. #define AR934X_ETH_CFG_GMII_GMAC0 BIT(2)
  1067. #define AR934X_ETH_CFG_MII_GMAC0_MASTER BIT(3)
  1068. #define AR934X_ETH_CFG_MII_GMAC0_SLAVE BIT(4)
  1069. #define AR934X_ETH_CFG_MII_GMAC0_ERR_EN BIT(5)
  1070. #define AR934X_ETH_CFG_SW_ONLY_MODE BIT(6)
  1071. #define AR934X_ETH_CFG_SW_PHY_SWAP BIT(7)
  1072. #define AR934X_ETH_CFG_SW_APB_ACCESS BIT(9)
  1073. #define AR934X_ETH_CFG_RMII_GMAC0 BIT(10)
  1074. #define AR933X_ETH_CFG_MII_CNTL_SPEED BIT(11)
  1075. #define AR934X_ETH_CFG_RMII_GMAC0_MASTER BIT(12)
  1076. #define AR933X_ETH_CFG_SW_ACC_MSB_FIRST BIT(13)
  1077. #define AR934X_ETH_CFG_RXD_DELAY BIT(14)
  1078. #define AR934X_ETH_CFG_RXD_DELAY_MASK 0x3
  1079. #define AR934X_ETH_CFG_RXD_DELAY_SHIFT 14
  1080. #define AR934X_ETH_CFG_RDV_DELAY BIT(16)
  1081. #define AR934X_ETH_CFG_RDV_DELAY_MASK 0x3
  1082. #define AR934X_ETH_CFG_RDV_DELAY_SHIFT 16
  1083. /*
  1084. * QCA953X GMAC Interface
  1085. */
  1086. #define QCA953X_GMAC_REG_ETH_CFG 0x00
  1087. #define QCA953X_ETH_CFG_SW_ONLY_MODE BIT(6)
  1088. #define QCA953X_ETH_CFG_SW_PHY_SWAP BIT(7)
  1089. #define QCA953X_ETH_CFG_SW_APB_ACCESS BIT(9)
  1090. #define QCA953X_ETH_CFG_SW_ACC_MSB_FIRST BIT(13)
  1091. /*
  1092. * QCA955X GMAC Interface
  1093. */
  1094. #define QCA955X_GMAC_REG_ETH_CFG 0x00
  1095. #define QCA955X_GMAC_REG_SGMII_SERDES 0x18
  1096. #define QCA955X_ETH_CFG_RGMII_EN BIT(0)
  1097. #define QCA955X_ETH_CFG_MII_GE0 BIT(1)
  1098. #define QCA955X_ETH_CFG_GMII_GE0 BIT(2)
  1099. #define QCA955X_ETH_CFG_MII_GE0_MASTER BIT(3)
  1100. #define QCA955X_ETH_CFG_MII_GE0_SLAVE BIT(4)
  1101. #define QCA955X_ETH_CFG_GE0_ERR_EN BIT(5)
  1102. #define QCA955X_ETH_CFG_GE0_SGMII BIT(6)
  1103. #define QCA955X_ETH_CFG_RMII_GE0 BIT(10)
  1104. #define QCA955X_ETH_CFG_MII_CNTL_SPEED BIT(11)
  1105. #define QCA955X_ETH_CFG_RMII_GE0_MASTER BIT(12)
  1106. #define QCA955X_ETH_CFG_RXD_DELAY_MASK 0x3
  1107. #define QCA955X_ETH_CFG_RXD_DELAY_SHIFT 14
  1108. #define QCA955X_ETH_CFG_RDV_DELAY BIT(16)
  1109. #define QCA955X_ETH_CFG_RDV_DELAY_MASK 0x3
  1110. #define QCA955X_ETH_CFG_RDV_DELAY_SHIFT 16
  1111. #define QCA955X_ETH_CFG_TXD_DELAY_MASK 0x3
  1112. #define QCA955X_ETH_CFG_TXD_DELAY_SHIFT 18
  1113. #define QCA955X_ETH_CFG_TXE_DELAY_MASK 0x3
  1114. #define QCA955X_ETH_CFG_TXE_DELAY_SHIFT 20
  1115. #define QCA955X_SGMII_SERDES_LOCK_DETECT_STATUS BIT(15)
  1116. #define QCA955X_SGMII_SERDES_RES_CALIBRATION_SHIFT 23
  1117. #define QCA955X_SGMII_SERDES_RES_CALIBRATION_MASK 0xf
  1118. /*
  1119. * QCA956X GMAC Interface
  1120. */
  1121. #define QCA956X_GMAC_REG_ETH_CFG 0x00
  1122. #define QCA956X_GMAC_REG_SGMII_RESET 0x14
  1123. #define QCA956X_GMAC_REG_SGMII_SERDES 0x18
  1124. #define QCA956X_GMAC_REG_MR_AN_CONTROL 0x1c
  1125. #define QCA956X_GMAC_REG_SGMII_CONFIG 0x34
  1126. #define QCA956X_GMAC_REG_SGMII_DEBUG 0x58
  1127. #define QCA956X_ETH_CFG_RGMII_EN BIT(0)
  1128. #define QCA956X_ETH_CFG_GE0_SGMII BIT(6)
  1129. #define QCA956X_ETH_CFG_SW_ONLY_MODE BIT(7)
  1130. #define QCA956X_ETH_CFG_SW_PHY_SWAP BIT(8)
  1131. #define QCA956X_ETH_CFG_SW_PHY_ADDR_SWAP BIT(9)
  1132. #define QCA956X_ETH_CFG_SW_APB_ACCESS BIT(10)
  1133. #define QCA956X_ETH_CFG_SW_ACC_MSB_FIRST BIT(13)
  1134. #define QCA956X_ETH_CFG_RXD_DELAY_MASK 0x3
  1135. #define QCA956X_ETH_CFG_RXD_DELAY_SHIFT 14
  1136. #define QCA956X_ETH_CFG_RDV_DELAY_MASK 0x3
  1137. #define QCA956X_ETH_CFG_RDV_DELAY_SHIFT 16
  1138. #define QCA956X_SGMII_RESET_RX_CLK_N_RESET 0x0
  1139. #define QCA956X_SGMII_RESET_RX_CLK_N BIT(0)
  1140. #define QCA956X_SGMII_RESET_TX_CLK_N BIT(1)
  1141. #define QCA956X_SGMII_RESET_RX_125M_N BIT(2)
  1142. #define QCA956X_SGMII_RESET_TX_125M_N BIT(3)
  1143. #define QCA956X_SGMII_RESET_HW_RX_125M_N BIT(4)
  1144. #define QCA956X_SGMII_SERDES_CDR_BW_MASK 0x3
  1145. #define QCA956X_SGMII_SERDES_CDR_BW_SHIFT 1
  1146. #define QCA956X_SGMII_SERDES_TX_DR_CTRL_MASK 0x7
  1147. #define QCA956X_SGMII_SERDES_TX_DR_CTRL_SHIFT 4
  1148. #define QCA956X_SGMII_SERDES_PLL_BW BIT(8)
  1149. #define QCA956X_SGMII_SERDES_VCO_FAST BIT(9)
  1150. #define QCA956X_SGMII_SERDES_VCO_SLOW BIT(10)
  1151. #define QCA956X_SGMII_SERDES_LOCK_DETECT_STATUS BIT(15)
  1152. #define QCA956X_SGMII_SERDES_EN_SIGNAL_DETECT BIT(16)
  1153. #define QCA956X_SGMII_SERDES_FIBER_SDO BIT(17)
  1154. #define QCA956X_SGMII_SERDES_RES_CALIBRATION_SHIFT 23
  1155. #define QCA956X_SGMII_SERDES_RES_CALIBRATION_MASK 0xf
  1156. #define QCA956X_SGMII_SERDES_VCO_REG_SHIFT 27
  1157. #define QCA956X_SGMII_SERDES_VCO_REG_MASK 0xf
  1158. #define QCA956X_MR_AN_CONTROL_AN_ENABLE BIT(12)
  1159. #define QCA956X_MR_AN_CONTROL_PHY_RESET BIT(15)
  1160. #define QCA956X_SGMII_CONFIG_MODE_CTRL_SHIFT 0
  1161. #define QCA956X_SGMII_CONFIG_MODE_CTRL_MASK 0x7
  1162. #endif /* __ASM_MACH_AR71XX_REGS_H */