pinctrl-u300.c 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112
  1. /*
  2. * Driver for the U300 pin controller
  3. *
  4. * Based on the original U300 padmux functions
  5. * Copyright (C) 2009-2011 ST-Ericsson AB
  6. * Author: Martin Persson <martin.persson@stericsson.com>
  7. * Author: Linus Walleij <linus.walleij@linaro.org>
  8. *
  9. * The DB3350 design and control registers are oriented around pads rather than
  10. * pins, so we enumerate the pads we can mux rather than actual pins. The pads
  11. * are connected to different pins in different packaging types, so it would
  12. * be confusing.
  13. */
  14. #include <linux/init.h>
  15. #include <linux/module.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/io.h>
  18. #include <linux/slab.h>
  19. #include <linux/err.h>
  20. #include <linux/pinctrl/pinctrl.h>
  21. #include <linux/pinctrl/pinmux.h>
  22. #include <linux/pinctrl/pinconf.h>
  23. #include <linux/pinctrl/pinconf-generic.h>
  24. #include "pinctrl-coh901.h"
  25. /*
  26. * Register definitions for the U300 Padmux control registers in the
  27. * system controller
  28. */
  29. /* PAD MUX Control register 1 (LOW) 16bit (R/W) */
  30. #define U300_SYSCON_PMC1LR 0x007C
  31. #define U300_SYSCON_PMC1LR_MASK 0xFFFF
  32. #define U300_SYSCON_PMC1LR_CDI_MASK 0xC000
  33. #define U300_SYSCON_PMC1LR_CDI_CDI 0x0000
  34. #define U300_SYSCON_PMC1LR_CDI_EMIF 0x4000
  35. /* For BS335 */
  36. #define U300_SYSCON_PMC1LR_CDI_CDI2 0x8000
  37. #define U300_SYSCON_PMC1LR_CDI_WCDMA_APP_GPIO 0xC000
  38. /* For BS365 */
  39. #define U300_SYSCON_PMC1LR_CDI_GPIO 0x8000
  40. #define U300_SYSCON_PMC1LR_CDI_WCDMA 0xC000
  41. /* Common defs */
  42. #define U300_SYSCON_PMC1LR_PDI_MASK 0x3000
  43. #define U300_SYSCON_PMC1LR_PDI_PDI 0x0000
  44. #define U300_SYSCON_PMC1LR_PDI_EGG 0x1000
  45. #define U300_SYSCON_PMC1LR_PDI_WCDMA 0x3000
  46. #define U300_SYSCON_PMC1LR_MMCSD_MASK 0x0C00
  47. #define U300_SYSCON_PMC1LR_MMCSD_MMCSD 0x0000
  48. #define U300_SYSCON_PMC1LR_MMCSD_MSPRO 0x0400
  49. #define U300_SYSCON_PMC1LR_MMCSD_DSP 0x0800
  50. #define U300_SYSCON_PMC1LR_MMCSD_WCDMA 0x0C00
  51. #define U300_SYSCON_PMC1LR_ETM_MASK 0x0300
  52. #define U300_SYSCON_PMC1LR_ETM_ACC 0x0000
  53. #define U300_SYSCON_PMC1LR_ETM_APP 0x0100
  54. #define U300_SYSCON_PMC1LR_EMIF_1_CS2_MASK 0x00C0
  55. #define U300_SYSCON_PMC1LR_EMIF_1_CS2_STATIC 0x0000
  56. #define U300_SYSCON_PMC1LR_EMIF_1_CS2_NFIF 0x0040
  57. #define U300_SYSCON_PMC1LR_EMIF_1_CS2_SDRAM 0x0080
  58. #define U300_SYSCON_PMC1LR_EMIF_1_CS2_STATIC_2GB 0x00C0
  59. #define U300_SYSCON_PMC1LR_EMIF_1_CS1_MASK 0x0030
  60. #define U300_SYSCON_PMC1LR_EMIF_1_CS1_STATIC 0x0000
  61. #define U300_SYSCON_PMC1LR_EMIF_1_CS1_NFIF 0x0010
  62. #define U300_SYSCON_PMC1LR_EMIF_1_CS1_SDRAM 0x0020
  63. #define U300_SYSCON_PMC1LR_EMIF_1_CS1_SEMI 0x0030
  64. #define U300_SYSCON_PMC1LR_EMIF_1_CS0_MASK 0x000C
  65. #define U300_SYSCON_PMC1LR_EMIF_1_CS0_STATIC 0x0000
  66. #define U300_SYSCON_PMC1LR_EMIF_1_CS0_NFIF 0x0004
  67. #define U300_SYSCON_PMC1LR_EMIF_1_CS0_SDRAM 0x0008
  68. #define U300_SYSCON_PMC1LR_EMIF_1_CS0_SEMI 0x000C
  69. #define U300_SYSCON_PMC1LR_EMIF_1_MASK 0x0003
  70. #define U300_SYSCON_PMC1LR_EMIF_1_STATIC 0x0000
  71. #define U300_SYSCON_PMC1LR_EMIF_1_SDRAM0 0x0001
  72. #define U300_SYSCON_PMC1LR_EMIF_1_SDRAM1 0x0002
  73. #define U300_SYSCON_PMC1LR_EMIF_1 0x0003
  74. /* PAD MUX Control register 2 (HIGH) 16bit (R/W) */
  75. #define U300_SYSCON_PMC1HR 0x007E
  76. #define U300_SYSCON_PMC1HR_MASK 0xFFFF
  77. #define U300_SYSCON_PMC1HR_MISC_2_MASK 0xC000
  78. #define U300_SYSCON_PMC1HR_MISC_2_APP_GPIO 0x0000
  79. #define U300_SYSCON_PMC1HR_MISC_2_MSPRO 0x4000
  80. #define U300_SYSCON_PMC1HR_MISC_2_DSP 0x8000
  81. #define U300_SYSCON_PMC1HR_MISC_2_AAIF 0xC000
  82. #define U300_SYSCON_PMC1HR_APP_GPIO_2_MASK 0x3000
  83. #define U300_SYSCON_PMC1HR_APP_GPIO_2_APP_GPIO 0x0000
  84. #define U300_SYSCON_PMC1HR_APP_GPIO_2_NFIF 0x1000
  85. #define U300_SYSCON_PMC1HR_APP_GPIO_2_DSP 0x2000
  86. #define U300_SYSCON_PMC1HR_APP_GPIO_2_AAIF 0x3000
  87. #define U300_SYSCON_PMC1HR_APP_GPIO_1_MASK 0x0C00
  88. #define U300_SYSCON_PMC1HR_APP_GPIO_1_APP_GPIO 0x0000
  89. #define U300_SYSCON_PMC1HR_APP_GPIO_1_MMC 0x0400
  90. #define U300_SYSCON_PMC1HR_APP_GPIO_1_DSP 0x0800
  91. #define U300_SYSCON_PMC1HR_APP_GPIO_1_AAIF 0x0C00
  92. #define U300_SYSCON_PMC1HR_APP_SPI_CS_2_MASK 0x0300
  93. #define U300_SYSCON_PMC1HR_APP_SPI_CS_2_APP_GPIO 0x0000
  94. #define U300_SYSCON_PMC1HR_APP_SPI_CS_2_SPI 0x0100
  95. #define U300_SYSCON_PMC1HR_APP_SPI_CS_2_AAIF 0x0300
  96. #define U300_SYSCON_PMC1HR_APP_SPI_CS_1_MASK 0x00C0
  97. #define U300_SYSCON_PMC1HR_APP_SPI_CS_1_APP_GPIO 0x0000
  98. #define U300_SYSCON_PMC1HR_APP_SPI_CS_1_SPI 0x0040
  99. #define U300_SYSCON_PMC1HR_APP_SPI_CS_1_AAIF 0x00C0
  100. #define U300_SYSCON_PMC1HR_APP_SPI_2_MASK 0x0030
  101. #define U300_SYSCON_PMC1HR_APP_SPI_2_APP_GPIO 0x0000
  102. #define U300_SYSCON_PMC1HR_APP_SPI_2_SPI 0x0010
  103. #define U300_SYSCON_PMC1HR_APP_SPI_2_DSP 0x0020
  104. #define U300_SYSCON_PMC1HR_APP_SPI_2_AAIF 0x0030
  105. #define U300_SYSCON_PMC1HR_APP_UART0_2_MASK 0x000C
  106. #define U300_SYSCON_PMC1HR_APP_UART0_2_APP_GPIO 0x0000
  107. #define U300_SYSCON_PMC1HR_APP_UART0_2_UART0 0x0004
  108. #define U300_SYSCON_PMC1HR_APP_UART0_2_NFIF_CS 0x0008
  109. #define U300_SYSCON_PMC1HR_APP_UART0_2_AAIF 0x000C
  110. #define U300_SYSCON_PMC1HR_APP_UART0_1_MASK 0x0003
  111. #define U300_SYSCON_PMC1HR_APP_UART0_1_APP_GPIO 0x0000
  112. #define U300_SYSCON_PMC1HR_APP_UART0_1_UART0 0x0001
  113. #define U300_SYSCON_PMC1HR_APP_UART0_1_AAIF 0x0003
  114. /* Padmux 2 control */
  115. #define U300_SYSCON_PMC2R 0x100
  116. #define U300_SYSCON_PMC2R_APP_MISC_0_MASK 0x00C0
  117. #define U300_SYSCON_PMC2R_APP_MISC_0_APP_GPIO 0x0000
  118. #define U300_SYSCON_PMC2R_APP_MISC_0_EMIF_SDRAM 0x0040
  119. #define U300_SYSCON_PMC2R_APP_MISC_0_MMC 0x0080
  120. #define U300_SYSCON_PMC2R_APP_MISC_0_CDI2 0x00C0
  121. #define U300_SYSCON_PMC2R_APP_MISC_1_MASK 0x0300
  122. #define U300_SYSCON_PMC2R_APP_MISC_1_APP_GPIO 0x0000
  123. #define U300_SYSCON_PMC2R_APP_MISC_1_EMIF_SDRAM 0x0100
  124. #define U300_SYSCON_PMC2R_APP_MISC_1_MMC 0x0200
  125. #define U300_SYSCON_PMC2R_APP_MISC_1_CDI2 0x0300
  126. #define U300_SYSCON_PMC2R_APP_MISC_2_MASK 0x0C00
  127. #define U300_SYSCON_PMC2R_APP_MISC_2_APP_GPIO 0x0000
  128. #define U300_SYSCON_PMC2R_APP_MISC_2_EMIF_SDRAM 0x0400
  129. #define U300_SYSCON_PMC2R_APP_MISC_2_MMC 0x0800
  130. #define U300_SYSCON_PMC2R_APP_MISC_2_CDI2 0x0C00
  131. #define U300_SYSCON_PMC2R_APP_MISC_3_MASK 0x3000
  132. #define U300_SYSCON_PMC2R_APP_MISC_3_APP_GPIO 0x0000
  133. #define U300_SYSCON_PMC2R_APP_MISC_3_EMIF_SDRAM 0x1000
  134. #define U300_SYSCON_PMC2R_APP_MISC_3_MMC 0x2000
  135. #define U300_SYSCON_PMC2R_APP_MISC_3_CDI2 0x3000
  136. #define U300_SYSCON_PMC2R_APP_MISC_4_MASK 0xC000
  137. #define U300_SYSCON_PMC2R_APP_MISC_4_APP_GPIO 0x0000
  138. #define U300_SYSCON_PMC2R_APP_MISC_4_EMIF_SDRAM 0x4000
  139. #define U300_SYSCON_PMC2R_APP_MISC_4_MMC 0x8000
  140. #define U300_SYSCON_PMC2R_APP_MISC_4_ACC_GPIO 0xC000
  141. /* TODO: More SYSCON registers missing */
  142. #define U300_SYSCON_PMC3R 0x10C
  143. #define U300_SYSCON_PMC3R_APP_MISC_11_MASK 0xC000
  144. #define U300_SYSCON_PMC3R_APP_MISC_11_SPI 0x4000
  145. #define U300_SYSCON_PMC3R_APP_MISC_10_MASK 0x3000
  146. #define U300_SYSCON_PMC3R_APP_MISC_10_SPI 0x1000
  147. /* TODO: Missing other configs */
  148. #define U300_SYSCON_PMC4R 0x168
  149. #define U300_SYSCON_PMC4R_APP_MISC_12_MASK 0x0003
  150. #define U300_SYSCON_PMC4R_APP_MISC_12_APP_GPIO 0x0000
  151. #define U300_SYSCON_PMC4R_APP_MISC_13_MASK 0x000C
  152. #define U300_SYSCON_PMC4R_APP_MISC_13_CDI 0x0000
  153. #define U300_SYSCON_PMC4R_APP_MISC_13_SMIA 0x0004
  154. #define U300_SYSCON_PMC4R_APP_MISC_13_SMIA2 0x0008
  155. #define U300_SYSCON_PMC4R_APP_MISC_13_APP_GPIO 0x000C
  156. #define U300_SYSCON_PMC4R_APP_MISC_14_MASK 0x0030
  157. #define U300_SYSCON_PMC4R_APP_MISC_14_CDI 0x0000
  158. #define U300_SYSCON_PMC4R_APP_MISC_14_SMIA 0x0010
  159. #define U300_SYSCON_PMC4R_APP_MISC_14_CDI2 0x0020
  160. #define U300_SYSCON_PMC4R_APP_MISC_14_APP_GPIO 0x0030
  161. #define U300_SYSCON_PMC4R_APP_MISC_16_MASK 0x0300
  162. #define U300_SYSCON_PMC4R_APP_MISC_16_APP_GPIO_13 0x0000
  163. #define U300_SYSCON_PMC4R_APP_MISC_16_APP_UART1_CTS 0x0100
  164. #define U300_SYSCON_PMC4R_APP_MISC_16_EMIF_1_STATIC_CS5_N 0x0200
  165. #define DRIVER_NAME "pinctrl-u300"
  166. /*
  167. * The DB3350 has 467 pads, I have enumerated the pads clockwise around the
  168. * edges of the silicon, finger by finger. LTCORNER upper left is pad 0.
  169. * Data taken from the PadRing chart, arranged like this:
  170. *
  171. * 0 ..... 104
  172. * 466 105
  173. * . .
  174. * . .
  175. * 358 224
  176. * 357 .... 225
  177. */
  178. #define U300_NUM_PADS 467
  179. /* Pad names for the pinmux subsystem */
  180. static const struct pinctrl_pin_desc u300_pads[] = {
  181. /* Pads along the top edge of the chip */
  182. PINCTRL_PIN(0, "P PAD VDD 28"),
  183. PINCTRL_PIN(1, "P PAD GND 28"),
  184. PINCTRL_PIN(2, "PO SIM RST N"),
  185. PINCTRL_PIN(3, "VSSIO 25"),
  186. PINCTRL_PIN(4, "VSSA ADDA ESDSUB"),
  187. PINCTRL_PIN(5, "PWR VSSCOMMON"),
  188. PINCTRL_PIN(6, "PI ADC I1 POS"),
  189. PINCTRL_PIN(7, "PI ADC I1 NEG"),
  190. PINCTRL_PIN(8, "PWR VSSAD0"),
  191. PINCTRL_PIN(9, "PWR VCCAD0"),
  192. PINCTRL_PIN(10, "PI ADC Q1 NEG"),
  193. PINCTRL_PIN(11, "PI ADC Q1 POS"),
  194. PINCTRL_PIN(12, "PWR VDDAD"),
  195. PINCTRL_PIN(13, "PWR GNDAD"),
  196. PINCTRL_PIN(14, "PI ADC I2 POS"),
  197. PINCTRL_PIN(15, "PI ADC I2 NEG"),
  198. PINCTRL_PIN(16, "PWR VSSAD1"),
  199. PINCTRL_PIN(17, "PWR VCCAD1"),
  200. PINCTRL_PIN(18, "PI ADC Q2 NEG"),
  201. PINCTRL_PIN(19, "PI ADC Q2 POS"),
  202. PINCTRL_PIN(20, "VSSA ADDA ESDSUB"),
  203. PINCTRL_PIN(21, "PWR VCCGPAD"),
  204. PINCTRL_PIN(22, "PI TX POW"),
  205. PINCTRL_PIN(23, "PWR VSSGPAD"),
  206. PINCTRL_PIN(24, "PO DAC I POS"),
  207. PINCTRL_PIN(25, "PO DAC I NEG"),
  208. PINCTRL_PIN(26, "PO DAC Q POS"),
  209. PINCTRL_PIN(27, "PO DAC Q NEG"),
  210. PINCTRL_PIN(28, "PWR VSSDA"),
  211. PINCTRL_PIN(29, "PWR VCCDA"),
  212. PINCTRL_PIN(30, "VSSA ADDA ESDSUB"),
  213. PINCTRL_PIN(31, "P PAD VDDIO 11"),
  214. PINCTRL_PIN(32, "PI PLL 26 FILTVDD"),
  215. PINCTRL_PIN(33, "PI PLL 26 VCONT"),
  216. PINCTRL_PIN(34, "PWR AGNDPLL2V5 32 13"),
  217. PINCTRL_PIN(35, "PWR AVDDPLL2V5 32 13"),
  218. PINCTRL_PIN(36, "VDDA PLL ESD"),
  219. PINCTRL_PIN(37, "VSSA PLL ESD"),
  220. PINCTRL_PIN(38, "VSS PLL"),
  221. PINCTRL_PIN(39, "VDDC PLL"),
  222. PINCTRL_PIN(40, "PWR AGNDPLL2V5 26 60"),
  223. PINCTRL_PIN(41, "PWR AVDDPLL2V5 26 60"),
  224. PINCTRL_PIN(42, "PWR AVDDPLL2V5 26 208"),
  225. PINCTRL_PIN(43, "PWR AGNDPLL2V5 26 208"),
  226. PINCTRL_PIN(44, "PWR AVDDPLL2V5 13 208"),
  227. PINCTRL_PIN(45, "PWR AGNDPLL2V5 13 208"),
  228. PINCTRL_PIN(46, "P PAD VSSIO 11"),
  229. PINCTRL_PIN(47, "P PAD VSSIO 12"),
  230. PINCTRL_PIN(48, "PI POW RST N"),
  231. PINCTRL_PIN(49, "VDDC IO"),
  232. PINCTRL_PIN(50, "P PAD VDDIO 16"),
  233. PINCTRL_PIN(51, "PO RF WCDMA EN 4"),
  234. PINCTRL_PIN(52, "PO RF WCDMA EN 3"),
  235. PINCTRL_PIN(53, "PO RF WCDMA EN 2"),
  236. PINCTRL_PIN(54, "PO RF WCDMA EN 1"),
  237. PINCTRL_PIN(55, "PO RF WCDMA EN 0"),
  238. PINCTRL_PIN(56, "PO GSM PA ENABLE"),
  239. PINCTRL_PIN(57, "PO RF DATA STRB"),
  240. PINCTRL_PIN(58, "PO RF DATA2"),
  241. PINCTRL_PIN(59, "PIO RF DATA1"),
  242. PINCTRL_PIN(60, "PIO RF DATA0"),
  243. PINCTRL_PIN(61, "P PAD VDD 11"),
  244. PINCTRL_PIN(62, "P PAD GND 11"),
  245. PINCTRL_PIN(63, "P PAD VSSIO 16"),
  246. PINCTRL_PIN(64, "P PAD VDDIO 18"),
  247. PINCTRL_PIN(65, "PO RF CTRL STRB2"),
  248. PINCTRL_PIN(66, "PO RF CTRL STRB1"),
  249. PINCTRL_PIN(67, "PO RF CTRL STRB0"),
  250. PINCTRL_PIN(68, "PIO RF CTRL DATA"),
  251. PINCTRL_PIN(69, "PO RF CTRL CLK"),
  252. PINCTRL_PIN(70, "PO TX ADC STRB"),
  253. PINCTRL_PIN(71, "PO ANT SW 2"),
  254. PINCTRL_PIN(72, "PO ANT SW 3"),
  255. PINCTRL_PIN(73, "PO ANT SW 0"),
  256. PINCTRL_PIN(74, "PO ANT SW 1"),
  257. PINCTRL_PIN(75, "PO M CLKRQ"),
  258. PINCTRL_PIN(76, "PI M CLK"),
  259. PINCTRL_PIN(77, "PI RTC CLK"),
  260. PINCTRL_PIN(78, "P PAD VDD 8"),
  261. PINCTRL_PIN(79, "P PAD GND 8"),
  262. PINCTRL_PIN(80, "P PAD VSSIO 13"),
  263. PINCTRL_PIN(81, "P PAD VDDIO 13"),
  264. PINCTRL_PIN(82, "PO SYS 1 CLK"),
  265. PINCTRL_PIN(83, "PO SYS 2 CLK"),
  266. PINCTRL_PIN(84, "PO SYS 0 CLK"),
  267. PINCTRL_PIN(85, "PI SYS 0 CLKRQ"),
  268. PINCTRL_PIN(86, "PO PWR MNGT CTRL 1"),
  269. PINCTRL_PIN(87, "PO PWR MNGT CTRL 0"),
  270. PINCTRL_PIN(88, "PO RESOUT2 RST N"),
  271. PINCTRL_PIN(89, "PO RESOUT1 RST N"),
  272. PINCTRL_PIN(90, "PO RESOUT0 RST N"),
  273. PINCTRL_PIN(91, "PI SERVICE N"),
  274. PINCTRL_PIN(92, "P PAD VDD 29"),
  275. PINCTRL_PIN(93, "P PAD GND 29"),
  276. PINCTRL_PIN(94, "P PAD VSSIO 8"),
  277. PINCTRL_PIN(95, "P PAD VDDIO 8"),
  278. PINCTRL_PIN(96, "PI EXT IRQ1 N"),
  279. PINCTRL_PIN(97, "PI EXT IRQ0 N"),
  280. PINCTRL_PIN(98, "PIO DC ON"),
  281. PINCTRL_PIN(99, "PIO ACC APP I2C DATA"),
  282. PINCTRL_PIN(100, "PIO ACC APP I2C CLK"),
  283. PINCTRL_PIN(101, "P PAD VDD 12"),
  284. PINCTRL_PIN(102, "P PAD GND 12"),
  285. PINCTRL_PIN(103, "P PAD VSSIO 14"),
  286. PINCTRL_PIN(104, "P PAD VDDIO 14"),
  287. /* Pads along the right edge of the chip */
  288. PINCTRL_PIN(105, "PIO APP I2C1 DATA"),
  289. PINCTRL_PIN(106, "PIO APP I2C1 CLK"),
  290. PINCTRL_PIN(107, "PO KEY OUT0"),
  291. PINCTRL_PIN(108, "PO KEY OUT1"),
  292. PINCTRL_PIN(109, "PO KEY OUT2"),
  293. PINCTRL_PIN(110, "PO KEY OUT3"),
  294. PINCTRL_PIN(111, "PO KEY OUT4"),
  295. PINCTRL_PIN(112, "PI KEY IN0"),
  296. PINCTRL_PIN(113, "PI KEY IN1"),
  297. PINCTRL_PIN(114, "PI KEY IN2"),
  298. PINCTRL_PIN(115, "P PAD VDDIO 15"),
  299. PINCTRL_PIN(116, "P PAD VSSIO 15"),
  300. PINCTRL_PIN(117, "P PAD GND 13"),
  301. PINCTRL_PIN(118, "P PAD VDD 13"),
  302. PINCTRL_PIN(119, "PI KEY IN3"),
  303. PINCTRL_PIN(120, "PI KEY IN4"),
  304. PINCTRL_PIN(121, "PI KEY IN5"),
  305. PINCTRL_PIN(122, "PIO APP PCM I2S1 DATA B"),
  306. PINCTRL_PIN(123, "PIO APP PCM I2S1 DATA A"),
  307. PINCTRL_PIN(124, "PIO APP PCM I2S1 WS"),
  308. PINCTRL_PIN(125, "PIO APP PCM I2S1 CLK"),
  309. PINCTRL_PIN(126, "PIO APP PCM I2S0 DATA B"),
  310. PINCTRL_PIN(127, "PIO APP PCM I2S0 DATA A"),
  311. PINCTRL_PIN(128, "PIO APP PCM I2S0 WS"),
  312. PINCTRL_PIN(129, "PIO APP PCM I2S0 CLK"),
  313. PINCTRL_PIN(130, "P PAD VDD 17"),
  314. PINCTRL_PIN(131, "P PAD GND 17"),
  315. PINCTRL_PIN(132, "P PAD VSSIO 19"),
  316. PINCTRL_PIN(133, "P PAD VDDIO 19"),
  317. PINCTRL_PIN(134, "UART0 RTS"),
  318. PINCTRL_PIN(135, "UART0 CTS"),
  319. PINCTRL_PIN(136, "UART0 TX"),
  320. PINCTRL_PIN(137, "UART0 RX"),
  321. PINCTRL_PIN(138, "PIO ACC SPI DO"),
  322. PINCTRL_PIN(139, "PIO ACC SPI DI"),
  323. PINCTRL_PIN(140, "PIO ACC SPI CS0 N"),
  324. PINCTRL_PIN(141, "PIO ACC SPI CS1 N"),
  325. PINCTRL_PIN(142, "PIO ACC SPI CS2 N"),
  326. PINCTRL_PIN(143, "PIO ACC SPI CLK"),
  327. PINCTRL_PIN(144, "PO PDI EXT RST N"),
  328. PINCTRL_PIN(145, "P PAD VDDIO 22"),
  329. PINCTRL_PIN(146, "P PAD VSSIO 22"),
  330. PINCTRL_PIN(147, "P PAD GND 18"),
  331. PINCTRL_PIN(148, "P PAD VDD 18"),
  332. PINCTRL_PIN(149, "PIO PDI C0"),
  333. PINCTRL_PIN(150, "PIO PDI C1"),
  334. PINCTRL_PIN(151, "PIO PDI C2"),
  335. PINCTRL_PIN(152, "PIO PDI C3"),
  336. PINCTRL_PIN(153, "PIO PDI C4"),
  337. PINCTRL_PIN(154, "PIO PDI C5"),
  338. PINCTRL_PIN(155, "PIO PDI D0"),
  339. PINCTRL_PIN(156, "PIO PDI D1"),
  340. PINCTRL_PIN(157, "PIO PDI D2"),
  341. PINCTRL_PIN(158, "PIO PDI D3"),
  342. PINCTRL_PIN(159, "P PAD VDDIO 21"),
  343. PINCTRL_PIN(160, "P PAD VSSIO 21"),
  344. PINCTRL_PIN(161, "PIO PDI D4"),
  345. PINCTRL_PIN(162, "PIO PDI D5"),
  346. PINCTRL_PIN(163, "PIO PDI D6"),
  347. PINCTRL_PIN(164, "PIO PDI D7"),
  348. PINCTRL_PIN(165, "PIO MS INS"),
  349. PINCTRL_PIN(166, "MMC DATA DIR LS"),
  350. PINCTRL_PIN(167, "MMC DATA 3"),
  351. PINCTRL_PIN(168, "MMC DATA 2"),
  352. PINCTRL_PIN(169, "MMC DATA 1"),
  353. PINCTRL_PIN(170, "MMC DATA 0"),
  354. PINCTRL_PIN(171, "MMC CMD DIR LS"),
  355. PINCTRL_PIN(172, "P PAD VDD 27"),
  356. PINCTRL_PIN(173, "P PAD GND 27"),
  357. PINCTRL_PIN(174, "P PAD VSSIO 20"),
  358. PINCTRL_PIN(175, "P PAD VDDIO 20"),
  359. PINCTRL_PIN(176, "MMC CMD"),
  360. PINCTRL_PIN(177, "MMC CLK"),
  361. PINCTRL_PIN(178, "PIO APP GPIO 14"),
  362. PINCTRL_PIN(179, "PIO APP GPIO 13"),
  363. PINCTRL_PIN(180, "PIO APP GPIO 11"),
  364. PINCTRL_PIN(181, "PIO APP GPIO 25"),
  365. PINCTRL_PIN(182, "PIO APP GPIO 24"),
  366. PINCTRL_PIN(183, "PIO APP GPIO 23"),
  367. PINCTRL_PIN(184, "PIO APP GPIO 22"),
  368. PINCTRL_PIN(185, "PIO APP GPIO 21"),
  369. PINCTRL_PIN(186, "PIO APP GPIO 20"),
  370. PINCTRL_PIN(187, "P PAD VDD 19"),
  371. PINCTRL_PIN(188, "P PAD GND 19"),
  372. PINCTRL_PIN(189, "P PAD VSSIO 23"),
  373. PINCTRL_PIN(190, "P PAD VDDIO 23"),
  374. PINCTRL_PIN(191, "PIO APP GPIO 19"),
  375. PINCTRL_PIN(192, "PIO APP GPIO 18"),
  376. PINCTRL_PIN(193, "PIO APP GPIO 17"),
  377. PINCTRL_PIN(194, "PIO APP GPIO 16"),
  378. PINCTRL_PIN(195, "PI CI D1"),
  379. PINCTRL_PIN(196, "PI CI D0"),
  380. PINCTRL_PIN(197, "PI CI HSYNC"),
  381. PINCTRL_PIN(198, "PI CI VSYNC"),
  382. PINCTRL_PIN(199, "PI CI EXT CLK"),
  383. PINCTRL_PIN(200, "PO CI EXT RST N"),
  384. PINCTRL_PIN(201, "P PAD VSSIO 43"),
  385. PINCTRL_PIN(202, "P PAD VDDIO 43"),
  386. PINCTRL_PIN(203, "PI CI D6"),
  387. PINCTRL_PIN(204, "PI CI D7"),
  388. PINCTRL_PIN(205, "PI CI D2"),
  389. PINCTRL_PIN(206, "PI CI D3"),
  390. PINCTRL_PIN(207, "PI CI D4"),
  391. PINCTRL_PIN(208, "PI CI D5"),
  392. PINCTRL_PIN(209, "PI CI D8"),
  393. PINCTRL_PIN(210, "PI CI D9"),
  394. PINCTRL_PIN(211, "P PAD VDD 20"),
  395. PINCTRL_PIN(212, "P PAD GND 20"),
  396. PINCTRL_PIN(213, "P PAD VSSIO 24"),
  397. PINCTRL_PIN(214, "P PAD VDDIO 24"),
  398. PINCTRL_PIN(215, "P PAD VDDIO 26"),
  399. PINCTRL_PIN(216, "PO EMIF 1 A26"),
  400. PINCTRL_PIN(217, "PO EMIF 1 A25"),
  401. PINCTRL_PIN(218, "P PAD VSSIO 26"),
  402. PINCTRL_PIN(219, "PO EMIF 1 A24"),
  403. PINCTRL_PIN(220, "PO EMIF 1 A23"),
  404. /* Pads along the bottom edge of the chip */
  405. PINCTRL_PIN(221, "PO EMIF 1 A22"),
  406. PINCTRL_PIN(222, "PO EMIF 1 A21"),
  407. PINCTRL_PIN(223, "P PAD VDD 21"),
  408. PINCTRL_PIN(224, "P PAD GND 21"),
  409. PINCTRL_PIN(225, "P PAD VSSIO 27"),
  410. PINCTRL_PIN(226, "P PAD VDDIO 27"),
  411. PINCTRL_PIN(227, "PO EMIF 1 A20"),
  412. PINCTRL_PIN(228, "PO EMIF 1 A19"),
  413. PINCTRL_PIN(229, "PO EMIF 1 A18"),
  414. PINCTRL_PIN(230, "PO EMIF 1 A17"),
  415. PINCTRL_PIN(231, "P PAD VDDIO 28"),
  416. PINCTRL_PIN(232, "P PAD VSSIO 28"),
  417. PINCTRL_PIN(233, "PO EMIF 1 A16"),
  418. PINCTRL_PIN(234, "PIO EMIF 1 D15"),
  419. PINCTRL_PIN(235, "PO EMIF 1 A15"),
  420. PINCTRL_PIN(236, "PIO EMIF 1 D14"),
  421. PINCTRL_PIN(237, "P PAD VDD 22"),
  422. PINCTRL_PIN(238, "P PAD GND 22"),
  423. PINCTRL_PIN(239, "P PAD VSSIO 29"),
  424. PINCTRL_PIN(240, "P PAD VDDIO 29"),
  425. PINCTRL_PIN(241, "PO EMIF 1 A14"),
  426. PINCTRL_PIN(242, "PIO EMIF 1 D13"),
  427. PINCTRL_PIN(243, "PO EMIF 1 A13"),
  428. PINCTRL_PIN(244, "PIO EMIF 1 D12"),
  429. PINCTRL_PIN(245, "P PAD VSSIO 30"),
  430. PINCTRL_PIN(246, "P PAD VDDIO 30"),
  431. PINCTRL_PIN(247, "PO EMIF 1 A12"),
  432. PINCTRL_PIN(248, "PIO EMIF 1 D11"),
  433. PINCTRL_PIN(249, "PO EMIF 1 A11"),
  434. PINCTRL_PIN(250, "PIO EMIF 1 D10"),
  435. PINCTRL_PIN(251, "P PAD VSSIO 31"),
  436. PINCTRL_PIN(252, "P PAD VDDIO 31"),
  437. PINCTRL_PIN(253, "PO EMIF 1 A10"),
  438. PINCTRL_PIN(254, "PIO EMIF 1 D09"),
  439. PINCTRL_PIN(255, "PO EMIF 1 A09"),
  440. PINCTRL_PIN(256, "P PAD VDDIO 32"),
  441. PINCTRL_PIN(257, "P PAD VSSIO 32"),
  442. PINCTRL_PIN(258, "P PAD GND 24"),
  443. PINCTRL_PIN(259, "P PAD VDD 24"),
  444. PINCTRL_PIN(260, "PIO EMIF 1 D08"),
  445. PINCTRL_PIN(261, "PO EMIF 1 A08"),
  446. PINCTRL_PIN(262, "PIO EMIF 1 D07"),
  447. PINCTRL_PIN(263, "PO EMIF 1 A07"),
  448. PINCTRL_PIN(264, "P PAD VDDIO 33"),
  449. PINCTRL_PIN(265, "P PAD VSSIO 33"),
  450. PINCTRL_PIN(266, "PIO EMIF 1 D06"),
  451. PINCTRL_PIN(267, "PO EMIF 1 A06"),
  452. PINCTRL_PIN(268, "PIO EMIF 1 D05"),
  453. PINCTRL_PIN(269, "PO EMIF 1 A05"),
  454. PINCTRL_PIN(270, "P PAD VDDIO 34"),
  455. PINCTRL_PIN(271, "P PAD VSSIO 34"),
  456. PINCTRL_PIN(272, "PIO EMIF 1 D04"),
  457. PINCTRL_PIN(273, "PO EMIF 1 A04"),
  458. PINCTRL_PIN(274, "PIO EMIF 1 D03"),
  459. PINCTRL_PIN(275, "PO EMIF 1 A03"),
  460. PINCTRL_PIN(276, "P PAD VDDIO 35"),
  461. PINCTRL_PIN(277, "P PAD VSSIO 35"),
  462. PINCTRL_PIN(278, "P PAD GND 23"),
  463. PINCTRL_PIN(279, "P PAD VDD 23"),
  464. PINCTRL_PIN(280, "PIO EMIF 1 D02"),
  465. PINCTRL_PIN(281, "PO EMIF 1 A02"),
  466. PINCTRL_PIN(282, "PIO EMIF 1 D01"),
  467. PINCTRL_PIN(283, "PO EMIF 1 A01"),
  468. PINCTRL_PIN(284, "P PAD VDDIO 36"),
  469. PINCTRL_PIN(285, "P PAD VSSIO 36"),
  470. PINCTRL_PIN(286, "PIO EMIF 1 D00"),
  471. PINCTRL_PIN(287, "PO EMIF 1 BE1 N"),
  472. PINCTRL_PIN(288, "PO EMIF 1 BE0 N"),
  473. PINCTRL_PIN(289, "PO EMIF 1 ADV N"),
  474. PINCTRL_PIN(290, "P PAD VDDIO 37"),
  475. PINCTRL_PIN(291, "P PAD VSSIO 37"),
  476. PINCTRL_PIN(292, "PO EMIF 1 SD CKE0"),
  477. PINCTRL_PIN(293, "PO EMIF 1 OE N"),
  478. PINCTRL_PIN(294, "PO EMIF 1 WE N"),
  479. PINCTRL_PIN(295, "P PAD VDDIO 38"),
  480. PINCTRL_PIN(296, "P PAD VSSIO 38"),
  481. PINCTRL_PIN(297, "PO EMIF 1 CLK"),
  482. PINCTRL_PIN(298, "PIO EMIF 1 SD CLK"),
  483. PINCTRL_PIN(299, "P PAD VSSIO 45 (not bonded)"),
  484. PINCTRL_PIN(300, "P PAD VDDIO 42"),
  485. PINCTRL_PIN(301, "P PAD VSSIO 42"),
  486. PINCTRL_PIN(302, "P PAD GND 31"),
  487. PINCTRL_PIN(303, "P PAD VDD 31"),
  488. PINCTRL_PIN(304, "PI EMIF 1 RET CLK"),
  489. PINCTRL_PIN(305, "PI EMIF 1 WAIT N"),
  490. PINCTRL_PIN(306, "PI EMIF 1 NFIF READY"),
  491. PINCTRL_PIN(307, "PO EMIF 1 SD CKE1"),
  492. PINCTRL_PIN(308, "PO EMIF 1 CS3 N"),
  493. PINCTRL_PIN(309, "P PAD VDD 25"),
  494. PINCTRL_PIN(310, "P PAD GND 25"),
  495. PINCTRL_PIN(311, "P PAD VSSIO 39"),
  496. PINCTRL_PIN(312, "P PAD VDDIO 39"),
  497. PINCTRL_PIN(313, "PO EMIF 1 CS2 N"),
  498. PINCTRL_PIN(314, "PO EMIF 1 CS1 N"),
  499. PINCTRL_PIN(315, "PO EMIF 1 CS0 N"),
  500. PINCTRL_PIN(316, "PO ETM TRACE PKT0"),
  501. PINCTRL_PIN(317, "PO ETM TRACE PKT1"),
  502. PINCTRL_PIN(318, "PO ETM TRACE PKT2"),
  503. PINCTRL_PIN(319, "P PAD VDD 30"),
  504. PINCTRL_PIN(320, "P PAD GND 30"),
  505. PINCTRL_PIN(321, "P PAD VSSIO 44"),
  506. PINCTRL_PIN(322, "P PAD VDDIO 44"),
  507. PINCTRL_PIN(323, "PO ETM TRACE PKT3"),
  508. PINCTRL_PIN(324, "PO ETM TRACE PKT4"),
  509. PINCTRL_PIN(325, "PO ETM TRACE PKT5"),
  510. PINCTRL_PIN(326, "PO ETM TRACE PKT6"),
  511. PINCTRL_PIN(327, "PO ETM TRACE PKT7"),
  512. PINCTRL_PIN(328, "PO ETM PIPE STAT0"),
  513. PINCTRL_PIN(329, "P PAD VDD 26"),
  514. PINCTRL_PIN(330, "P PAD GND 26"),
  515. PINCTRL_PIN(331, "P PAD VSSIO 40"),
  516. PINCTRL_PIN(332, "P PAD VDDIO 40"),
  517. PINCTRL_PIN(333, "PO ETM PIPE STAT1"),
  518. PINCTRL_PIN(334, "PO ETM PIPE STAT2"),
  519. PINCTRL_PIN(335, "PO ETM TRACE CLK"),
  520. PINCTRL_PIN(336, "PO ETM TRACE SYNC"),
  521. PINCTRL_PIN(337, "PIO ACC GPIO 33"),
  522. PINCTRL_PIN(338, "PIO ACC GPIO 32"),
  523. PINCTRL_PIN(339, "PIO ACC GPIO 30"),
  524. PINCTRL_PIN(340, "PIO ACC GPIO 29"),
  525. PINCTRL_PIN(341, "P PAD VDDIO 17"),
  526. PINCTRL_PIN(342, "P PAD VSSIO 17"),
  527. PINCTRL_PIN(343, "P PAD GND 15"),
  528. PINCTRL_PIN(344, "P PAD VDD 15"),
  529. PINCTRL_PIN(345, "PIO ACC GPIO 28"),
  530. PINCTRL_PIN(346, "PIO ACC GPIO 27"),
  531. PINCTRL_PIN(347, "PIO ACC GPIO 16"),
  532. PINCTRL_PIN(348, "PI TAP TMS"),
  533. PINCTRL_PIN(349, "PI TAP TDI"),
  534. PINCTRL_PIN(350, "PO TAP TDO"),
  535. PINCTRL_PIN(351, "PI TAP RST N"),
  536. /* Pads along the left edge of the chip */
  537. PINCTRL_PIN(352, "PI EMU MODE 0"),
  538. PINCTRL_PIN(353, "PO TAP RET CLK"),
  539. PINCTRL_PIN(354, "PI TAP CLK"),
  540. PINCTRL_PIN(355, "PO EMIF 0 SD CS N"),
  541. PINCTRL_PIN(356, "PO EMIF 0 SD CAS N"),
  542. PINCTRL_PIN(357, "PO EMIF 0 SD WE N"),
  543. PINCTRL_PIN(358, "P PAD VDDIO 1"),
  544. PINCTRL_PIN(359, "P PAD VSSIO 1"),
  545. PINCTRL_PIN(360, "P PAD GND 1"),
  546. PINCTRL_PIN(361, "P PAD VDD 1"),
  547. PINCTRL_PIN(362, "PO EMIF 0 SD CKE"),
  548. PINCTRL_PIN(363, "PO EMIF 0 SD DQML"),
  549. PINCTRL_PIN(364, "PO EMIF 0 SD DQMU"),
  550. PINCTRL_PIN(365, "PO EMIF 0 SD RAS N"),
  551. PINCTRL_PIN(366, "PIO EMIF 0 D15"),
  552. PINCTRL_PIN(367, "PO EMIF 0 A15"),
  553. PINCTRL_PIN(368, "PIO EMIF 0 D14"),
  554. PINCTRL_PIN(369, "PO EMIF 0 A14"),
  555. PINCTRL_PIN(370, "PIO EMIF 0 D13"),
  556. PINCTRL_PIN(371, "PO EMIF 0 A13"),
  557. PINCTRL_PIN(372, "P PAD VDDIO 2"),
  558. PINCTRL_PIN(373, "P PAD VSSIO 2"),
  559. PINCTRL_PIN(374, "P PAD GND 2"),
  560. PINCTRL_PIN(375, "P PAD VDD 2"),
  561. PINCTRL_PIN(376, "PIO EMIF 0 D12"),
  562. PINCTRL_PIN(377, "PO EMIF 0 A12"),
  563. PINCTRL_PIN(378, "PIO EMIF 0 D11"),
  564. PINCTRL_PIN(379, "PO EMIF 0 A11"),
  565. PINCTRL_PIN(380, "PIO EMIF 0 D10"),
  566. PINCTRL_PIN(381, "PO EMIF 0 A10"),
  567. PINCTRL_PIN(382, "PIO EMIF 0 D09"),
  568. PINCTRL_PIN(383, "PO EMIF 0 A09"),
  569. PINCTRL_PIN(384, "PIO EMIF 0 D08"),
  570. PINCTRL_PIN(385, "PO EMIF 0 A08"),
  571. PINCTRL_PIN(386, "PIO EMIF 0 D07"),
  572. PINCTRL_PIN(387, "PO EMIF 0 A07"),
  573. PINCTRL_PIN(388, "P PAD VDDIO 3"),
  574. PINCTRL_PIN(389, "P PAD VSSIO 3"),
  575. PINCTRL_PIN(390, "P PAD GND 3"),
  576. PINCTRL_PIN(391, "P PAD VDD 3"),
  577. PINCTRL_PIN(392, "PO EFUSE RDOUT1"),
  578. PINCTRL_PIN(393, "PIO EMIF 0 D06"),
  579. PINCTRL_PIN(394, "PO EMIF 0 A06"),
  580. PINCTRL_PIN(395, "PIO EMIF 0 D05"),
  581. PINCTRL_PIN(396, "PO EMIF 0 A05"),
  582. PINCTRL_PIN(397, "PIO EMIF 0 D04"),
  583. PINCTRL_PIN(398, "PO EMIF 0 A04"),
  584. PINCTRL_PIN(399, "A PADS/A VDDCO1v82v5 GND 80U SF LIN VDDCO AF"),
  585. PINCTRL_PIN(400, "PWR VDDCO AF"),
  586. PINCTRL_PIN(401, "PWR EFUSE HV1"),
  587. PINCTRL_PIN(402, "P PAD VSSIO 4"),
  588. PINCTRL_PIN(403, "P PAD VDDIO 4"),
  589. PINCTRL_PIN(404, "P PAD GND 4"),
  590. PINCTRL_PIN(405, "P PAD VDD 4"),
  591. PINCTRL_PIN(406, "PIO EMIF 0 D03"),
  592. PINCTRL_PIN(407, "PO EMIF 0 A03"),
  593. PINCTRL_PIN(408, "PWR EFUSE HV2"),
  594. PINCTRL_PIN(409, "PWR EFUSE HV3"),
  595. PINCTRL_PIN(410, "PIO EMIF 0 D02"),
  596. PINCTRL_PIN(411, "PO EMIF 0 A02"),
  597. PINCTRL_PIN(412, "PIO EMIF 0 D01"),
  598. PINCTRL_PIN(413, "P PAD VDDIO 5"),
  599. PINCTRL_PIN(414, "P PAD VSSIO 5"),
  600. PINCTRL_PIN(415, "P PAD GND 5"),
  601. PINCTRL_PIN(416, "P PAD VDD 5"),
  602. PINCTRL_PIN(417, "PO EMIF 0 A01"),
  603. PINCTRL_PIN(418, "PIO EMIF 0 D00"),
  604. PINCTRL_PIN(419, "IF 0 SD CLK"),
  605. PINCTRL_PIN(420, "APP SPI CLK"),
  606. PINCTRL_PIN(421, "APP SPI DO"),
  607. PINCTRL_PIN(422, "APP SPI DI"),
  608. PINCTRL_PIN(423, "APP SPI CS0"),
  609. PINCTRL_PIN(424, "APP SPI CS1"),
  610. PINCTRL_PIN(425, "APP SPI CS2"),
  611. PINCTRL_PIN(426, "PIO APP GPIO 10"),
  612. PINCTRL_PIN(427, "P PAD VDDIO 41"),
  613. PINCTRL_PIN(428, "P PAD VSSIO 41"),
  614. PINCTRL_PIN(429, "P PAD GND 6"),
  615. PINCTRL_PIN(430, "P PAD VDD 6"),
  616. PINCTRL_PIN(431, "PIO ACC SDIO0 CMD"),
  617. PINCTRL_PIN(432, "PIO ACC SDIO0 CK"),
  618. PINCTRL_PIN(433, "PIO ACC SDIO0 D3"),
  619. PINCTRL_PIN(434, "PIO ACC SDIO0 D2"),
  620. PINCTRL_PIN(435, "PIO ACC SDIO0 D1"),
  621. PINCTRL_PIN(436, "PIO ACC SDIO0 D0"),
  622. PINCTRL_PIN(437, "PIO USB PU"),
  623. PINCTRL_PIN(438, "PIO USB SP"),
  624. PINCTRL_PIN(439, "PIO USB DAT VP"),
  625. PINCTRL_PIN(440, "PIO USB SE0 VM"),
  626. PINCTRL_PIN(441, "PIO USB OE"),
  627. PINCTRL_PIN(442, "PIO USB SUSP"),
  628. PINCTRL_PIN(443, "P PAD VSSIO 6"),
  629. PINCTRL_PIN(444, "P PAD VDDIO 6"),
  630. PINCTRL_PIN(445, "PIO USB PUEN"),
  631. PINCTRL_PIN(446, "PIO ACC UART0 RX"),
  632. PINCTRL_PIN(447, "PIO ACC UART0 TX"),
  633. PINCTRL_PIN(448, "PIO ACC UART0 CTS"),
  634. PINCTRL_PIN(449, "PIO ACC UART0 RTS"),
  635. PINCTRL_PIN(450, "PIO ACC UART3 RX"),
  636. PINCTRL_PIN(451, "PIO ACC UART3 TX"),
  637. PINCTRL_PIN(452, "PIO ACC UART3 CTS"),
  638. PINCTRL_PIN(453, "PIO ACC UART3 RTS"),
  639. PINCTRL_PIN(454, "PIO ACC IRDA TX"),
  640. PINCTRL_PIN(455, "P PAD VDDIO 7"),
  641. PINCTRL_PIN(456, "P PAD VSSIO 7"),
  642. PINCTRL_PIN(457, "P PAD GND 7"),
  643. PINCTRL_PIN(458, "P PAD VDD 7"),
  644. PINCTRL_PIN(459, "PIO ACC IRDA RX"),
  645. PINCTRL_PIN(460, "PIO ACC PCM I2S CLK"),
  646. PINCTRL_PIN(461, "PIO ACC PCM I2S WS"),
  647. PINCTRL_PIN(462, "PIO ACC PCM I2S DATA A"),
  648. PINCTRL_PIN(463, "PIO ACC PCM I2S DATA B"),
  649. PINCTRL_PIN(464, "PO SIM CLK"),
  650. PINCTRL_PIN(465, "PIO ACC IRDA SD"),
  651. PINCTRL_PIN(466, "PIO SIM DATA"),
  652. };
  653. /**
  654. * @dev: a pointer back to containing device
  655. * @virtbase: the offset to the controller in virtual memory
  656. */
  657. struct u300_pmx {
  658. struct device *dev;
  659. struct pinctrl_dev *pctl;
  660. void __iomem *virtbase;
  661. };
  662. /**
  663. * u300_pmx_registers - the array of registers read/written for each pinmux
  664. * shunt setting
  665. */
  666. static const u32 u300_pmx_registers[] = {
  667. U300_SYSCON_PMC1LR,
  668. U300_SYSCON_PMC1HR,
  669. U300_SYSCON_PMC2R,
  670. U300_SYSCON_PMC3R,
  671. U300_SYSCON_PMC4R,
  672. };
  673. /**
  674. * struct u300_pin_group - describes a U300 pin group
  675. * @name: the name of this specific pin group
  676. * @pins: an array of discrete physical pins used in this group, taken
  677. * from the driver-local pin enumeration space
  678. * @num_pins: the number of pins in this group array, i.e. the number of
  679. * elements in .pins so we can iterate over that array
  680. */
  681. struct u300_pin_group {
  682. const char *name;
  683. const unsigned int *pins;
  684. const unsigned num_pins;
  685. };
  686. /**
  687. * struct pmx_onmask - mask bits to enable/disable padmux
  688. * @mask: mask bits to disable
  689. * @val: mask bits to enable
  690. *
  691. * onmask lazy dog:
  692. * onmask = {
  693. * {"PMC1LR" mask, "PMC1LR" value},
  694. * {"PMC1HR" mask, "PMC1HR" value},
  695. * {"PMC2R" mask, "PMC2R" value},
  696. * {"PMC3R" mask, "PMC3R" value},
  697. * {"PMC4R" mask, "PMC4R" value}
  698. * }
  699. */
  700. struct u300_pmx_mask {
  701. u16 mask;
  702. u16 bits;
  703. };
  704. /* The chip power pins are VDD, GND, VDDIO and VSSIO */
  705. static const unsigned power_pins[] = { 0, 1, 3, 31, 46, 47, 49, 50, 61, 62, 63,
  706. 64, 78, 79, 80, 81, 92, 93, 94, 95, 101, 102, 103, 104, 115, 116, 117,
  707. 118, 130, 131, 132, 133, 145, 146, 147, 148, 159, 160, 172, 173, 174,
  708. 175, 187, 188, 189, 190, 201, 202, 211, 212, 213, 214, 215, 218, 223,
  709. 224, 225, 226, 231, 232, 237, 238, 239, 240, 245, 246, 251, 252, 256,
  710. 257, 258, 259, 264, 265, 270, 271, 276, 277, 278, 279, 284, 285, 290,
  711. 291, 295, 296, 299, 300, 301, 302, 303, 309, 310, 311, 312, 319, 320,
  712. 321, 322, 329, 330, 331, 332, 341, 342, 343, 344, 358, 359, 360, 361,
  713. 372, 373, 374, 375, 388, 389, 390, 391, 402, 403, 404, 405, 413, 414,
  714. 415, 416, 427, 428, 429, 430, 443, 444, 455, 456, 457, 458 };
  715. static const unsigned emif0_pins[] = { 355, 356, 357, 362, 363, 364, 365, 366,
  716. 367, 368, 369, 370, 371, 376, 377, 378, 379, 380, 381, 382, 383, 384,
  717. 385, 386, 387, 393, 394, 395, 396, 397, 398, 406, 407, 410, 411, 412,
  718. 417, 418 };
  719. static const unsigned emif1_pins[] = { 216, 217, 219, 220, 221, 222, 227, 228,
  720. 229, 230, 233, 234, 235, 236, 241, 242, 243, 244, 247, 248, 249, 250,
  721. 253, 254, 255, 260, 261, 262, 263, 266, 267, 268, 269, 272, 273, 274,
  722. 275, 280, 281, 282, 283, 286, 287, 288, 289, 292, 293, 294, 297, 298,
  723. 304, 305, 306, 307, 308, 313, 314, 315 };
  724. static const unsigned uart0_pins[] = { 134, 135, 136, 137 };
  725. static const unsigned mmc0_pins[] = { 166, 167, 168, 169, 170, 171, 176, 177 };
  726. static const unsigned spi0_pins[] = { 420, 421, 422, 423, 424, 425 };
  727. static const struct u300_pmx_mask emif0_mask[] = {
  728. {0, 0},
  729. {0, 0},
  730. {0, 0},
  731. {0, 0},
  732. {0, 0},
  733. };
  734. static const struct u300_pmx_mask emif1_mask[] = {
  735. /*
  736. * This connects the SDRAM to CS2 and a NAND flash to
  737. * CS0 on the EMIF.
  738. */
  739. {
  740. U300_SYSCON_PMC1LR_EMIF_1_CS2_MASK |
  741. U300_SYSCON_PMC1LR_EMIF_1_CS1_MASK |
  742. U300_SYSCON_PMC1LR_EMIF_1_CS0_MASK |
  743. U300_SYSCON_PMC1LR_EMIF_1_MASK,
  744. U300_SYSCON_PMC1LR_EMIF_1_CS2_SDRAM |
  745. U300_SYSCON_PMC1LR_EMIF_1_CS1_STATIC |
  746. U300_SYSCON_PMC1LR_EMIF_1_CS0_NFIF |
  747. U300_SYSCON_PMC1LR_EMIF_1_SDRAM0
  748. },
  749. {0, 0},
  750. {0, 0},
  751. {0, 0},
  752. {0, 0},
  753. };
  754. static const struct u300_pmx_mask uart0_mask[] = {
  755. {0, 0},
  756. {
  757. U300_SYSCON_PMC1HR_APP_UART0_1_MASK |
  758. U300_SYSCON_PMC1HR_APP_UART0_2_MASK,
  759. U300_SYSCON_PMC1HR_APP_UART0_1_UART0 |
  760. U300_SYSCON_PMC1HR_APP_UART0_2_UART0
  761. },
  762. {0, 0},
  763. {0, 0},
  764. {0, 0},
  765. };
  766. static const struct u300_pmx_mask mmc0_mask[] = {
  767. { U300_SYSCON_PMC1LR_MMCSD_MASK, U300_SYSCON_PMC1LR_MMCSD_MMCSD},
  768. {0, 0},
  769. {0, 0},
  770. {0, 0},
  771. { U300_SYSCON_PMC4R_APP_MISC_12_MASK,
  772. U300_SYSCON_PMC4R_APP_MISC_12_APP_GPIO }
  773. };
  774. static const struct u300_pmx_mask spi0_mask[] = {
  775. {0, 0},
  776. {
  777. U300_SYSCON_PMC1HR_APP_SPI_2_MASK |
  778. U300_SYSCON_PMC1HR_APP_SPI_CS_1_MASK |
  779. U300_SYSCON_PMC1HR_APP_SPI_CS_2_MASK,
  780. U300_SYSCON_PMC1HR_APP_SPI_2_SPI |
  781. U300_SYSCON_PMC1HR_APP_SPI_CS_1_SPI |
  782. U300_SYSCON_PMC1HR_APP_SPI_CS_2_SPI
  783. },
  784. {0, 0},
  785. {0, 0},
  786. {0, 0}
  787. };
  788. static const struct u300_pin_group u300_pin_groups[] = {
  789. {
  790. .name = "powergrp",
  791. .pins = power_pins,
  792. .num_pins = ARRAY_SIZE(power_pins),
  793. },
  794. {
  795. .name = "emif0grp",
  796. .pins = emif0_pins,
  797. .num_pins = ARRAY_SIZE(emif0_pins),
  798. },
  799. {
  800. .name = "emif1grp",
  801. .pins = emif1_pins,
  802. .num_pins = ARRAY_SIZE(emif1_pins),
  803. },
  804. {
  805. .name = "uart0grp",
  806. .pins = uart0_pins,
  807. .num_pins = ARRAY_SIZE(uart0_pins),
  808. },
  809. {
  810. .name = "mmc0grp",
  811. .pins = mmc0_pins,
  812. .num_pins = ARRAY_SIZE(mmc0_pins),
  813. },
  814. {
  815. .name = "spi0grp",
  816. .pins = spi0_pins,
  817. .num_pins = ARRAY_SIZE(spi0_pins),
  818. },
  819. };
  820. static int u300_get_groups_count(struct pinctrl_dev *pctldev)
  821. {
  822. return ARRAY_SIZE(u300_pin_groups);
  823. }
  824. static const char *u300_get_group_name(struct pinctrl_dev *pctldev,
  825. unsigned selector)
  826. {
  827. return u300_pin_groups[selector].name;
  828. }
  829. static int u300_get_group_pins(struct pinctrl_dev *pctldev, unsigned selector,
  830. const unsigned **pins,
  831. unsigned *num_pins)
  832. {
  833. *pins = u300_pin_groups[selector].pins;
  834. *num_pins = u300_pin_groups[selector].num_pins;
  835. return 0;
  836. }
  837. static void u300_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
  838. unsigned offset)
  839. {
  840. seq_printf(s, " " DRIVER_NAME);
  841. }
  842. static const struct pinctrl_ops u300_pctrl_ops = {
  843. .get_groups_count = u300_get_groups_count,
  844. .get_group_name = u300_get_group_name,
  845. .get_group_pins = u300_get_group_pins,
  846. .pin_dbg_show = u300_pin_dbg_show,
  847. };
  848. /*
  849. * Here we define the available functions and their corresponding pin groups
  850. */
  851. /**
  852. * struct u300_pmx_func - describes U300 pinmux functions
  853. * @name: the name of this specific function
  854. * @groups: corresponding pin groups
  855. * @onmask: bits to set to enable this when doing pin muxing
  856. */
  857. struct u300_pmx_func {
  858. const char *name;
  859. const char * const *groups;
  860. const unsigned num_groups;
  861. const struct u300_pmx_mask *mask;
  862. };
  863. static const char * const powergrps[] = { "powergrp" };
  864. static const char * const emif0grps[] = { "emif0grp" };
  865. static const char * const emif1grps[] = { "emif1grp" };
  866. static const char * const uart0grps[] = { "uart0grp" };
  867. static const char * const mmc0grps[] = { "mmc0grp" };
  868. static const char * const spi0grps[] = { "spi0grp" };
  869. static const struct u300_pmx_func u300_pmx_functions[] = {
  870. {
  871. .name = "power",
  872. .groups = powergrps,
  873. .num_groups = ARRAY_SIZE(powergrps),
  874. /* Mask is N/A */
  875. },
  876. {
  877. .name = "emif0",
  878. .groups = emif0grps,
  879. .num_groups = ARRAY_SIZE(emif0grps),
  880. .mask = emif0_mask,
  881. },
  882. {
  883. .name = "emif1",
  884. .groups = emif1grps,
  885. .num_groups = ARRAY_SIZE(emif1grps),
  886. .mask = emif1_mask,
  887. },
  888. {
  889. .name = "uart0",
  890. .groups = uart0grps,
  891. .num_groups = ARRAY_SIZE(uart0grps),
  892. .mask = uart0_mask,
  893. },
  894. {
  895. .name = "mmc0",
  896. .groups = mmc0grps,
  897. .num_groups = ARRAY_SIZE(mmc0grps),
  898. .mask = mmc0_mask,
  899. },
  900. {
  901. .name = "spi0",
  902. .groups = spi0grps,
  903. .num_groups = ARRAY_SIZE(spi0grps),
  904. .mask = spi0_mask,
  905. },
  906. };
  907. static void u300_pmx_endisable(struct u300_pmx *upmx, unsigned selector,
  908. bool enable)
  909. {
  910. u16 regval, val, mask;
  911. int i;
  912. const struct u300_pmx_mask *upmx_mask;
  913. upmx_mask = u300_pmx_functions[selector].mask;
  914. for (i = 0; i < ARRAY_SIZE(u300_pmx_registers); i++) {
  915. if (enable)
  916. val = upmx_mask->bits;
  917. else
  918. val = 0;
  919. mask = upmx_mask->mask;
  920. if (mask != 0) {
  921. regval = readw(upmx->virtbase + u300_pmx_registers[i]);
  922. regval &= ~mask;
  923. regval |= val;
  924. writew(regval, upmx->virtbase + u300_pmx_registers[i]);
  925. }
  926. upmx_mask++;
  927. }
  928. }
  929. static int u300_pmx_set_mux(struct pinctrl_dev *pctldev, unsigned selector,
  930. unsigned group)
  931. {
  932. struct u300_pmx *upmx;
  933. /* There is nothing to do with the power pins */
  934. if (selector == 0)
  935. return 0;
  936. upmx = pinctrl_dev_get_drvdata(pctldev);
  937. u300_pmx_endisable(upmx, selector, true);
  938. return 0;
  939. }
  940. static int u300_pmx_get_funcs_count(struct pinctrl_dev *pctldev)
  941. {
  942. return ARRAY_SIZE(u300_pmx_functions);
  943. }
  944. static const char *u300_pmx_get_func_name(struct pinctrl_dev *pctldev,
  945. unsigned selector)
  946. {
  947. return u300_pmx_functions[selector].name;
  948. }
  949. static int u300_pmx_get_groups(struct pinctrl_dev *pctldev, unsigned selector,
  950. const char * const **groups,
  951. unsigned * const num_groups)
  952. {
  953. *groups = u300_pmx_functions[selector].groups;
  954. *num_groups = u300_pmx_functions[selector].num_groups;
  955. return 0;
  956. }
  957. static const struct pinmux_ops u300_pmx_ops = {
  958. .get_functions_count = u300_pmx_get_funcs_count,
  959. .get_function_name = u300_pmx_get_func_name,
  960. .get_function_groups = u300_pmx_get_groups,
  961. .set_mux = u300_pmx_set_mux,
  962. };
  963. static int u300_pin_config_get(struct pinctrl_dev *pctldev, unsigned pin,
  964. unsigned long *config)
  965. {
  966. struct pinctrl_gpio_range *range =
  967. pinctrl_find_gpio_range_from_pin(pctldev, pin);
  968. /* We get config for those pins we CAN get it for and that's it */
  969. if (!range)
  970. return -ENOTSUPP;
  971. return u300_gpio_config_get(range->gc,
  972. (pin - range->pin_base + range->base),
  973. config);
  974. }
  975. static int u300_pin_config_set(struct pinctrl_dev *pctldev, unsigned pin,
  976. unsigned long *configs, unsigned num_configs)
  977. {
  978. struct pinctrl_gpio_range *range =
  979. pinctrl_find_gpio_range_from_pin(pctldev, pin);
  980. int ret, i;
  981. if (!range)
  982. return -EINVAL;
  983. for (i = 0; i < num_configs; i++) {
  984. /* Note: none of these configurations take any argument */
  985. ret = u300_gpio_config_set(range->gc,
  986. (pin - range->pin_base + range->base),
  987. pinconf_to_config_param(configs[i]));
  988. if (ret)
  989. return ret;
  990. } /* for each config */
  991. return 0;
  992. }
  993. static const struct pinconf_ops u300_pconf_ops = {
  994. .is_generic = true,
  995. .pin_config_get = u300_pin_config_get,
  996. .pin_config_set = u300_pin_config_set,
  997. };
  998. static struct pinctrl_desc u300_pmx_desc = {
  999. .name = DRIVER_NAME,
  1000. .pins = u300_pads,
  1001. .npins = ARRAY_SIZE(u300_pads),
  1002. .pctlops = &u300_pctrl_ops,
  1003. .pmxops = &u300_pmx_ops,
  1004. .confops = &u300_pconf_ops,
  1005. .owner = THIS_MODULE,
  1006. };
  1007. static int u300_pmx_probe(struct platform_device *pdev)
  1008. {
  1009. struct u300_pmx *upmx;
  1010. struct resource *res;
  1011. /* Create state holders etc for this driver */
  1012. upmx = devm_kzalloc(&pdev->dev, sizeof(*upmx), GFP_KERNEL);
  1013. if (!upmx)
  1014. return -ENOMEM;
  1015. upmx->dev = &pdev->dev;
  1016. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  1017. upmx->virtbase = devm_ioremap_resource(&pdev->dev, res);
  1018. if (IS_ERR(upmx->virtbase))
  1019. return PTR_ERR(upmx->virtbase);
  1020. upmx->pctl = devm_pinctrl_register(&pdev->dev, &u300_pmx_desc, upmx);
  1021. if (IS_ERR(upmx->pctl)) {
  1022. dev_err(&pdev->dev, "could not register U300 pinmux driver\n");
  1023. return PTR_ERR(upmx->pctl);
  1024. }
  1025. platform_set_drvdata(pdev, upmx);
  1026. dev_info(&pdev->dev, "initialized U300 pin control driver\n");
  1027. return 0;
  1028. }
  1029. static const struct of_device_id u300_pinctrl_match[] = {
  1030. { .compatible = "stericsson,pinctrl-u300" },
  1031. {},
  1032. };
  1033. static struct platform_driver u300_pmx_driver = {
  1034. .driver = {
  1035. .name = DRIVER_NAME,
  1036. .of_match_table = u300_pinctrl_match,
  1037. },
  1038. .probe = u300_pmx_probe,
  1039. };
  1040. static int __init u300_pmx_init(void)
  1041. {
  1042. return platform_driver_register(&u300_pmx_driver);
  1043. }
  1044. arch_initcall(u300_pmx_init);
  1045. static void __exit u300_pmx_exit(void)
  1046. {
  1047. platform_driver_unregister(&u300_pmx_driver);
  1048. }
  1049. module_exit(u300_pmx_exit);
  1050. MODULE_AUTHOR("Linus Walleij <linus.walleij@linaro.org>");
  1051. MODULE_DESCRIPTION("U300 pin control driver");
  1052. MODULE_LICENSE("GPL v2");