pinctrl-spear1340.c 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047
  1. /*
  2. * Driver for the ST Microelectronics SPEAr1340 pinmux
  3. *
  4. * Copyright (C) 2012 ST Microelectronics
  5. * Viresh Kumar <vireshk@kernel.org>
  6. *
  7. * This file is licensed under the terms of the GNU General Public
  8. * License version 2. This program is licensed "as is" without any
  9. * warranty of any kind, whether express or implied.
  10. */
  11. #include <linux/err.h>
  12. #include <linux/init.h>
  13. #include <linux/module.h>
  14. #include <linux/of_device.h>
  15. #include <linux/platform_device.h>
  16. #include "pinctrl-spear.h"
  17. #define DRIVER_NAME "spear1340-pinmux"
  18. /* pins */
  19. static const struct pinctrl_pin_desc spear1340_pins[] = {
  20. SPEAR_PIN_0_TO_101,
  21. SPEAR_PIN_102_TO_245,
  22. PINCTRL_PIN(246, "PLGPIO246"),
  23. PINCTRL_PIN(247, "PLGPIO247"),
  24. PINCTRL_PIN(248, "PLGPIO248"),
  25. PINCTRL_PIN(249, "PLGPIO249"),
  26. PINCTRL_PIN(250, "PLGPIO250"),
  27. PINCTRL_PIN(251, "PLGPIO251"),
  28. };
  29. /* In SPEAr1340 there are two levels of pad muxing */
  30. /* - pads as gpio OR peripherals */
  31. #define PAD_FUNCTION_EN_1 0x668
  32. #define PAD_FUNCTION_EN_2 0x66C
  33. #define PAD_FUNCTION_EN_3 0x670
  34. #define PAD_FUNCTION_EN_4 0x674
  35. #define PAD_FUNCTION_EN_5 0x690
  36. #define PAD_FUNCTION_EN_6 0x694
  37. #define PAD_FUNCTION_EN_7 0x698
  38. #define PAD_FUNCTION_EN_8 0x69C
  39. /* - If peripherals, then primary OR alternate peripheral */
  40. #define PAD_SHARED_IP_EN_1 0x6A0
  41. #define PAD_SHARED_IP_EN_2 0x6A4
  42. /*
  43. * Macro's for first level of pmx - pads as gpio OR peripherals. There are 8
  44. * registers with 32 bits each for handling gpio pads, register 8 has only 26
  45. * relevant bits.
  46. */
  47. /* macro's for making pads as gpio's */
  48. #define PADS_AS_GPIO_REG0_MASK 0xFFFFFFFE
  49. #define PADS_AS_GPIO_REGS_MASK 0xFFFFFFFF
  50. #define PADS_AS_GPIO_REG7_MASK 0x07FFFFFF
  51. /* macro's for making pads as peripherals */
  52. #define FSMC_16_BIT_AND_KBD_ROW_COL_REG0_MASK 0x00000FFE
  53. #define UART0_ENH_AND_GPT_REG0_MASK 0x0003F000
  54. #define PWM1_AND_KBD_COL5_REG0_MASK 0x00040000
  55. #define I2C1_REG0_MASK 0x01080000
  56. #define SPDIF_IN_REG0_MASK 0x00100000
  57. #define PWM2_AND_GPT0_TMR0_CPT_REG0_MASK 0x00400000
  58. #define PWM3_AND_GPT0_TMR1_CLK_REG0_MASK 0x00800000
  59. #define PWM0_AND_SSP0_CS1_REG0_MASK 0x02000000
  60. #define VIP_AND_CAM3_REG0_MASK 0xFC200000
  61. #define VIP_AND_CAM3_REG1_MASK 0x0000000F
  62. #define VIP_REG1_MASK 0x00001EF0
  63. #define VIP_AND_CAM2_REG1_MASK 0x007FE100
  64. #define VIP_AND_CAM1_REG1_MASK 0xFF800000
  65. #define VIP_AND_CAM1_REG2_MASK 0x00000003
  66. #define VIP_AND_CAM0_REG2_MASK 0x00001FFC
  67. #define SMI_REG2_MASK 0x0021E000
  68. #define SSP0_REG2_MASK 0x001E0000
  69. #define TS_AND_SSP0_CS2_REG2_MASK 0x00400000
  70. #define UART0_REG2_MASK 0x01800000
  71. #define UART1_REG2_MASK 0x06000000
  72. #define I2S_IN_REG2_MASK 0xF8000000
  73. #define DEVS_GRP_AND_MIPHY_DBG_REG3_MASK 0x000001FE
  74. #define I2S_OUT_REG3_MASK 0x000001EF
  75. #define I2S_IN_REG3_MASK 0x00000010
  76. #define GMAC_REG3_MASK 0xFFFFFE00
  77. #define GMAC_REG4_MASK 0x0000001F
  78. #define DEVS_GRP_AND_MIPHY_DBG_REG4_MASK 0x7FFFFF20
  79. #define SSP0_CS3_REG4_MASK 0x00000020
  80. #define I2C0_REG4_MASK 0x000000C0
  81. #define CEC0_REG4_MASK 0x00000100
  82. #define CEC1_REG4_MASK 0x00000200
  83. #define SPDIF_OUT_REG4_MASK 0x00000400
  84. #define CLCD_REG4_MASK 0x7FFFF800
  85. #define CLCD_AND_ARM_TRACE_REG4_MASK 0x80000000
  86. #define CLCD_AND_ARM_TRACE_REG5_MASK 0xFFFFFFFF
  87. #define CLCD_AND_ARM_TRACE_REG6_MASK 0x00000001
  88. #define FSMC_PNOR_AND_MCIF_REG6_MASK 0x073FFFFE
  89. #define MCIF_REG6_MASK 0xF8C00000
  90. #define MCIF_REG7_MASK 0x000043FF
  91. #define FSMC_8BIT_REG7_MASK 0x07FFBC00
  92. /* other registers */
  93. #define PERIP_CFG 0x42C
  94. /* PERIP_CFG register masks */
  95. #define SSP_CS_CTL_HW 0
  96. #define SSP_CS_CTL_SW 1
  97. #define SSP_CS_CTL_MASK 1
  98. #define SSP_CS_CTL_SHIFT 21
  99. #define SSP_CS_VAL_MASK 1
  100. #define SSP_CS_VAL_SHIFT 20
  101. #define SSP_CS_SEL_CS0 0
  102. #define SSP_CS_SEL_CS1 1
  103. #define SSP_CS_SEL_CS2 2
  104. #define SSP_CS_SEL_MASK 3
  105. #define SSP_CS_SEL_SHIFT 18
  106. #define I2S_CHNL_2_0 (0)
  107. #define I2S_CHNL_3_1 (1)
  108. #define I2S_CHNL_5_1 (2)
  109. #define I2S_CHNL_7_1 (3)
  110. #define I2S_CHNL_PLAY_SHIFT (4)
  111. #define I2S_CHNL_PLAY_MASK (3 << 4)
  112. #define I2S_CHNL_REC_SHIFT (6)
  113. #define I2S_CHNL_REC_MASK (3 << 6)
  114. #define SPDIF_OUT_ENB_MASK (1 << 2)
  115. #define SPDIF_OUT_ENB_SHIFT 2
  116. #define MCIF_SEL_SD 1
  117. #define MCIF_SEL_CF 2
  118. #define MCIF_SEL_XD 3
  119. #define MCIF_SEL_MASK 3
  120. #define MCIF_SEL_SHIFT 0
  121. #define GMAC_CLK_CFG 0x248
  122. #define GMAC_PHY_IF_GMII_VAL (0 << 3)
  123. #define GMAC_PHY_IF_RGMII_VAL (1 << 3)
  124. #define GMAC_PHY_IF_SGMII_VAL (2 << 3)
  125. #define GMAC_PHY_IF_RMII_VAL (4 << 3)
  126. #define GMAC_PHY_IF_SEL_MASK (7 << 3)
  127. #define GMAC_PHY_INPUT_ENB_VAL 0
  128. #define GMAC_PHY_SYNT_ENB_VAL 1
  129. #define GMAC_PHY_CLK_MASK 1
  130. #define GMAC_PHY_CLK_SHIFT 2
  131. #define GMAC_PHY_125M_PAD_VAL 0
  132. #define GMAC_PHY_PLL2_VAL 1
  133. #define GMAC_PHY_OSC3_VAL 2
  134. #define GMAC_PHY_INPUT_CLK_MASK 3
  135. #define GMAC_PHY_INPUT_CLK_SHIFT 0
  136. #define PCIE_SATA_CFG 0x424
  137. /* PCIE CFG MASks */
  138. #define PCIE_CFG_DEVICE_PRESENT (1 << 11)
  139. #define PCIE_CFG_POWERUP_RESET (1 << 10)
  140. #define PCIE_CFG_CORE_CLK_EN (1 << 9)
  141. #define PCIE_CFG_AUX_CLK_EN (1 << 8)
  142. #define SATA_CFG_TX_CLK_EN (1 << 4)
  143. #define SATA_CFG_RX_CLK_EN (1 << 3)
  144. #define SATA_CFG_POWERUP_RESET (1 << 2)
  145. #define SATA_CFG_PM_CLK_EN (1 << 1)
  146. #define PCIE_SATA_SEL_PCIE (0)
  147. #define PCIE_SATA_SEL_SATA (1)
  148. #define SATA_PCIE_CFG_MASK 0xF1F
  149. #define PCIE_CFG_VAL (PCIE_SATA_SEL_PCIE | PCIE_CFG_AUX_CLK_EN | \
  150. PCIE_CFG_CORE_CLK_EN | PCIE_CFG_POWERUP_RESET |\
  151. PCIE_CFG_DEVICE_PRESENT)
  152. #define SATA_CFG_VAL (PCIE_SATA_SEL_SATA | SATA_CFG_PM_CLK_EN | \
  153. SATA_CFG_POWERUP_RESET | SATA_CFG_RX_CLK_EN | \
  154. SATA_CFG_TX_CLK_EN)
  155. /* Macro's for second level of pmx - pads as primary OR alternate peripheral */
  156. /* Write 0 to enable FSMC_16_BIT */
  157. #define KBD_ROW_COL_MASK (1 << 0)
  158. /* Write 0 to enable UART0_ENH */
  159. #define GPT_MASK (1 << 1) /* Only clk & cpt */
  160. /* Write 0 to enable PWM1 */
  161. #define KBD_COL5_MASK (1 << 2)
  162. /* Write 0 to enable PWM2 */
  163. #define GPT0_TMR0_CPT_MASK (1 << 3) /* Only clk & cpt */
  164. /* Write 0 to enable PWM3 */
  165. #define GPT0_TMR1_CLK_MASK (1 << 4) /* Only clk & cpt */
  166. /* Write 0 to enable PWM0 */
  167. #define SSP0_CS1_MASK (1 << 5)
  168. /* Write 0 to enable VIP */
  169. #define CAM3_MASK (1 << 6)
  170. /* Write 0 to enable VIP */
  171. #define CAM2_MASK (1 << 7)
  172. /* Write 0 to enable VIP */
  173. #define CAM1_MASK (1 << 8)
  174. /* Write 0 to enable VIP */
  175. #define CAM0_MASK (1 << 9)
  176. /* Write 0 to enable TS */
  177. #define SSP0_CS2_MASK (1 << 10)
  178. /* Write 0 to enable FSMC PNOR */
  179. #define MCIF_MASK (1 << 11)
  180. /* Write 0 to enable CLCD */
  181. #define ARM_TRACE_MASK (1 << 12)
  182. /* Write 0 to enable I2S, SSP0_CS2, CEC0, 1, SPDIF out, CLCD */
  183. #define MIPHY_DBG_MASK (1 << 13)
  184. /*
  185. * Pad multiplexing for making all pads as gpio's. This is done to override the
  186. * values passed from bootloader and start from scratch.
  187. */
  188. static const unsigned pads_as_gpio_pins[] = { 12, 88, 89, 251 };
  189. static struct spear_muxreg pads_as_gpio_muxreg[] = {
  190. {
  191. .reg = PAD_FUNCTION_EN_1,
  192. .mask = PADS_AS_GPIO_REG0_MASK,
  193. .val = 0x0,
  194. }, {
  195. .reg = PAD_FUNCTION_EN_2,
  196. .mask = PADS_AS_GPIO_REGS_MASK,
  197. .val = 0x0,
  198. }, {
  199. .reg = PAD_FUNCTION_EN_3,
  200. .mask = PADS_AS_GPIO_REGS_MASK,
  201. .val = 0x0,
  202. }, {
  203. .reg = PAD_FUNCTION_EN_4,
  204. .mask = PADS_AS_GPIO_REGS_MASK,
  205. .val = 0x0,
  206. }, {
  207. .reg = PAD_FUNCTION_EN_5,
  208. .mask = PADS_AS_GPIO_REGS_MASK,
  209. .val = 0x0,
  210. }, {
  211. .reg = PAD_FUNCTION_EN_6,
  212. .mask = PADS_AS_GPIO_REGS_MASK,
  213. .val = 0x0,
  214. }, {
  215. .reg = PAD_FUNCTION_EN_7,
  216. .mask = PADS_AS_GPIO_REGS_MASK,
  217. .val = 0x0,
  218. }, {
  219. .reg = PAD_FUNCTION_EN_8,
  220. .mask = PADS_AS_GPIO_REG7_MASK,
  221. .val = 0x0,
  222. },
  223. };
  224. static struct spear_modemux pads_as_gpio_modemux[] = {
  225. {
  226. .muxregs = pads_as_gpio_muxreg,
  227. .nmuxregs = ARRAY_SIZE(pads_as_gpio_muxreg),
  228. },
  229. };
  230. static struct spear_pingroup pads_as_gpio_pingroup = {
  231. .name = "pads_as_gpio_grp",
  232. .pins = pads_as_gpio_pins,
  233. .npins = ARRAY_SIZE(pads_as_gpio_pins),
  234. .modemuxs = pads_as_gpio_modemux,
  235. .nmodemuxs = ARRAY_SIZE(pads_as_gpio_modemux),
  236. };
  237. static const char *const pads_as_gpio_grps[] = { "pads_as_gpio_grp" };
  238. static struct spear_function pads_as_gpio_function = {
  239. .name = "pads_as_gpio",
  240. .groups = pads_as_gpio_grps,
  241. .ngroups = ARRAY_SIZE(pads_as_gpio_grps),
  242. };
  243. /* Pad multiplexing for fsmc_8bit device */
  244. static const unsigned fsmc_8bit_pins[] = { 233, 234, 235, 236, 238, 239, 240,
  245. 241, 242, 243, 244, 245, 246, 247, 248, 249 };
  246. static struct spear_muxreg fsmc_8bit_muxreg[] = {
  247. {
  248. .reg = PAD_FUNCTION_EN_8,
  249. .mask = FSMC_8BIT_REG7_MASK,
  250. .val = FSMC_8BIT_REG7_MASK,
  251. }
  252. };
  253. static struct spear_modemux fsmc_8bit_modemux[] = {
  254. {
  255. .muxregs = fsmc_8bit_muxreg,
  256. .nmuxregs = ARRAY_SIZE(fsmc_8bit_muxreg),
  257. },
  258. };
  259. static struct spear_pingroup fsmc_8bit_pingroup = {
  260. .name = "fsmc_8bit_grp",
  261. .pins = fsmc_8bit_pins,
  262. .npins = ARRAY_SIZE(fsmc_8bit_pins),
  263. .modemuxs = fsmc_8bit_modemux,
  264. .nmodemuxs = ARRAY_SIZE(fsmc_8bit_modemux),
  265. };
  266. /* Pad multiplexing for fsmc_16bit device */
  267. static const unsigned fsmc_16bit_pins[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
  268. static struct spear_muxreg fsmc_16bit_muxreg[] = {
  269. {
  270. .reg = PAD_SHARED_IP_EN_1,
  271. .mask = KBD_ROW_COL_MASK,
  272. .val = 0,
  273. }, {
  274. .reg = PAD_FUNCTION_EN_1,
  275. .mask = FSMC_16_BIT_AND_KBD_ROW_COL_REG0_MASK,
  276. .val = FSMC_16_BIT_AND_KBD_ROW_COL_REG0_MASK,
  277. },
  278. };
  279. static struct spear_modemux fsmc_16bit_modemux[] = {
  280. {
  281. .muxregs = fsmc_16bit_muxreg,
  282. .nmuxregs = ARRAY_SIZE(fsmc_16bit_muxreg),
  283. },
  284. };
  285. static struct spear_pingroup fsmc_16bit_pingroup = {
  286. .name = "fsmc_16bit_grp",
  287. .pins = fsmc_16bit_pins,
  288. .npins = ARRAY_SIZE(fsmc_16bit_pins),
  289. .modemuxs = fsmc_16bit_modemux,
  290. .nmodemuxs = ARRAY_SIZE(fsmc_16bit_modemux),
  291. };
  292. /* pad multiplexing for fsmc_pnor device */
  293. static const unsigned fsmc_pnor_pins[] = { 192, 193, 194, 195, 196, 197, 198,
  294. 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212,
  295. 215, 216, 217 };
  296. static struct spear_muxreg fsmc_pnor_muxreg[] = {
  297. {
  298. .reg = PAD_SHARED_IP_EN_1,
  299. .mask = MCIF_MASK,
  300. .val = 0,
  301. }, {
  302. .reg = PAD_FUNCTION_EN_7,
  303. .mask = FSMC_PNOR_AND_MCIF_REG6_MASK,
  304. .val = FSMC_PNOR_AND_MCIF_REG6_MASK,
  305. },
  306. };
  307. static struct spear_modemux fsmc_pnor_modemux[] = {
  308. {
  309. .muxregs = fsmc_pnor_muxreg,
  310. .nmuxregs = ARRAY_SIZE(fsmc_pnor_muxreg),
  311. },
  312. };
  313. static struct spear_pingroup fsmc_pnor_pingroup = {
  314. .name = "fsmc_pnor_grp",
  315. .pins = fsmc_pnor_pins,
  316. .npins = ARRAY_SIZE(fsmc_pnor_pins),
  317. .modemuxs = fsmc_pnor_modemux,
  318. .nmodemuxs = ARRAY_SIZE(fsmc_pnor_modemux),
  319. };
  320. static const char *const fsmc_grps[] = { "fsmc_8bit_grp", "fsmc_16bit_grp",
  321. "fsmc_pnor_grp" };
  322. static struct spear_function fsmc_function = {
  323. .name = "fsmc",
  324. .groups = fsmc_grps,
  325. .ngroups = ARRAY_SIZE(fsmc_grps),
  326. };
  327. /* pad multiplexing for keyboard rows-cols device */
  328. static const unsigned keyboard_row_col_pins[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
  329. 10 };
  330. static struct spear_muxreg keyboard_row_col_muxreg[] = {
  331. {
  332. .reg = PAD_SHARED_IP_EN_1,
  333. .mask = KBD_ROW_COL_MASK,
  334. .val = KBD_ROW_COL_MASK,
  335. }, {
  336. .reg = PAD_FUNCTION_EN_1,
  337. .mask = FSMC_16_BIT_AND_KBD_ROW_COL_REG0_MASK,
  338. .val = FSMC_16_BIT_AND_KBD_ROW_COL_REG0_MASK,
  339. },
  340. };
  341. static struct spear_modemux keyboard_row_col_modemux[] = {
  342. {
  343. .muxregs = keyboard_row_col_muxreg,
  344. .nmuxregs = ARRAY_SIZE(keyboard_row_col_muxreg),
  345. },
  346. };
  347. static struct spear_pingroup keyboard_row_col_pingroup = {
  348. .name = "keyboard_row_col_grp",
  349. .pins = keyboard_row_col_pins,
  350. .npins = ARRAY_SIZE(keyboard_row_col_pins),
  351. .modemuxs = keyboard_row_col_modemux,
  352. .nmodemuxs = ARRAY_SIZE(keyboard_row_col_modemux),
  353. };
  354. /* pad multiplexing for keyboard col5 device */
  355. static const unsigned keyboard_col5_pins[] = { 17 };
  356. static struct spear_muxreg keyboard_col5_muxreg[] = {
  357. {
  358. .reg = PAD_SHARED_IP_EN_1,
  359. .mask = KBD_COL5_MASK,
  360. .val = KBD_COL5_MASK,
  361. }, {
  362. .reg = PAD_FUNCTION_EN_1,
  363. .mask = PWM1_AND_KBD_COL5_REG0_MASK,
  364. .val = PWM1_AND_KBD_COL5_REG0_MASK,
  365. },
  366. };
  367. static struct spear_modemux keyboard_col5_modemux[] = {
  368. {
  369. .muxregs = keyboard_col5_muxreg,
  370. .nmuxregs = ARRAY_SIZE(keyboard_col5_muxreg),
  371. },
  372. };
  373. static struct spear_pingroup keyboard_col5_pingroup = {
  374. .name = "keyboard_col5_grp",
  375. .pins = keyboard_col5_pins,
  376. .npins = ARRAY_SIZE(keyboard_col5_pins),
  377. .modemuxs = keyboard_col5_modemux,
  378. .nmodemuxs = ARRAY_SIZE(keyboard_col5_modemux),
  379. };
  380. static const char *const keyboard_grps[] = { "keyboard_row_col_grp",
  381. "keyboard_col5_grp" };
  382. static struct spear_function keyboard_function = {
  383. .name = "keyboard",
  384. .groups = keyboard_grps,
  385. .ngroups = ARRAY_SIZE(keyboard_grps),
  386. };
  387. /* pad multiplexing for spdif_in device */
  388. static const unsigned spdif_in_pins[] = { 19 };
  389. static struct spear_muxreg spdif_in_muxreg[] = {
  390. {
  391. .reg = PAD_FUNCTION_EN_1,
  392. .mask = SPDIF_IN_REG0_MASK,
  393. .val = SPDIF_IN_REG0_MASK,
  394. },
  395. };
  396. static struct spear_modemux spdif_in_modemux[] = {
  397. {
  398. .muxregs = spdif_in_muxreg,
  399. .nmuxregs = ARRAY_SIZE(spdif_in_muxreg),
  400. },
  401. };
  402. static struct spear_pingroup spdif_in_pingroup = {
  403. .name = "spdif_in_grp",
  404. .pins = spdif_in_pins,
  405. .npins = ARRAY_SIZE(spdif_in_pins),
  406. .modemuxs = spdif_in_modemux,
  407. .nmodemuxs = ARRAY_SIZE(spdif_in_modemux),
  408. };
  409. static const char *const spdif_in_grps[] = { "spdif_in_grp" };
  410. static struct spear_function spdif_in_function = {
  411. .name = "spdif_in",
  412. .groups = spdif_in_grps,
  413. .ngroups = ARRAY_SIZE(spdif_in_grps),
  414. };
  415. /* pad multiplexing for spdif_out device */
  416. static const unsigned spdif_out_pins[] = { 137 };
  417. static struct spear_muxreg spdif_out_muxreg[] = {
  418. {
  419. .reg = PAD_FUNCTION_EN_5,
  420. .mask = SPDIF_OUT_REG4_MASK,
  421. .val = SPDIF_OUT_REG4_MASK,
  422. }, {
  423. .reg = PERIP_CFG,
  424. .mask = SPDIF_OUT_ENB_MASK,
  425. .val = SPDIF_OUT_ENB_MASK,
  426. }
  427. };
  428. static struct spear_modemux spdif_out_modemux[] = {
  429. {
  430. .muxregs = spdif_out_muxreg,
  431. .nmuxregs = ARRAY_SIZE(spdif_out_muxreg),
  432. },
  433. };
  434. static struct spear_pingroup spdif_out_pingroup = {
  435. .name = "spdif_out_grp",
  436. .pins = spdif_out_pins,
  437. .npins = ARRAY_SIZE(spdif_out_pins),
  438. .modemuxs = spdif_out_modemux,
  439. .nmodemuxs = ARRAY_SIZE(spdif_out_modemux),
  440. };
  441. static const char *const spdif_out_grps[] = { "spdif_out_grp" };
  442. static struct spear_function spdif_out_function = {
  443. .name = "spdif_out",
  444. .groups = spdif_out_grps,
  445. .ngroups = ARRAY_SIZE(spdif_out_grps),
  446. };
  447. /* pad multiplexing for gpt_0_1 device */
  448. static const unsigned gpt_0_1_pins[] = { 11, 12, 13, 14, 15, 16, 21, 22 };
  449. static struct spear_muxreg gpt_0_1_muxreg[] = {
  450. {
  451. .reg = PAD_SHARED_IP_EN_1,
  452. .mask = GPT_MASK | GPT0_TMR0_CPT_MASK | GPT0_TMR1_CLK_MASK,
  453. .val = GPT_MASK | GPT0_TMR0_CPT_MASK | GPT0_TMR1_CLK_MASK,
  454. }, {
  455. .reg = PAD_FUNCTION_EN_1,
  456. .mask = UART0_ENH_AND_GPT_REG0_MASK |
  457. PWM2_AND_GPT0_TMR0_CPT_REG0_MASK |
  458. PWM3_AND_GPT0_TMR1_CLK_REG0_MASK,
  459. .val = UART0_ENH_AND_GPT_REG0_MASK |
  460. PWM2_AND_GPT0_TMR0_CPT_REG0_MASK |
  461. PWM3_AND_GPT0_TMR1_CLK_REG0_MASK,
  462. },
  463. };
  464. static struct spear_modemux gpt_0_1_modemux[] = {
  465. {
  466. .muxregs = gpt_0_1_muxreg,
  467. .nmuxregs = ARRAY_SIZE(gpt_0_1_muxreg),
  468. },
  469. };
  470. static struct spear_pingroup gpt_0_1_pingroup = {
  471. .name = "gpt_0_1_grp",
  472. .pins = gpt_0_1_pins,
  473. .npins = ARRAY_SIZE(gpt_0_1_pins),
  474. .modemuxs = gpt_0_1_modemux,
  475. .nmodemuxs = ARRAY_SIZE(gpt_0_1_modemux),
  476. };
  477. static const char *const gpt_0_1_grps[] = { "gpt_0_1_grp" };
  478. static struct spear_function gpt_0_1_function = {
  479. .name = "gpt_0_1",
  480. .groups = gpt_0_1_grps,
  481. .ngroups = ARRAY_SIZE(gpt_0_1_grps),
  482. };
  483. /* pad multiplexing for pwm0 device */
  484. static const unsigned pwm0_pins[] = { 24 };
  485. static struct spear_muxreg pwm0_muxreg[] = {
  486. {
  487. .reg = PAD_SHARED_IP_EN_1,
  488. .mask = SSP0_CS1_MASK,
  489. .val = 0,
  490. }, {
  491. .reg = PAD_FUNCTION_EN_1,
  492. .mask = PWM0_AND_SSP0_CS1_REG0_MASK,
  493. .val = PWM0_AND_SSP0_CS1_REG0_MASK,
  494. },
  495. };
  496. static struct spear_modemux pwm0_modemux[] = {
  497. {
  498. .muxregs = pwm0_muxreg,
  499. .nmuxregs = ARRAY_SIZE(pwm0_muxreg),
  500. },
  501. };
  502. static struct spear_pingroup pwm0_pingroup = {
  503. .name = "pwm0_grp",
  504. .pins = pwm0_pins,
  505. .npins = ARRAY_SIZE(pwm0_pins),
  506. .modemuxs = pwm0_modemux,
  507. .nmodemuxs = ARRAY_SIZE(pwm0_modemux),
  508. };
  509. /* pad multiplexing for pwm1 device */
  510. static const unsigned pwm1_pins[] = { 17 };
  511. static struct spear_muxreg pwm1_muxreg[] = {
  512. {
  513. .reg = PAD_SHARED_IP_EN_1,
  514. .mask = KBD_COL5_MASK,
  515. .val = 0,
  516. }, {
  517. .reg = PAD_FUNCTION_EN_1,
  518. .mask = PWM1_AND_KBD_COL5_REG0_MASK,
  519. .val = PWM1_AND_KBD_COL5_REG0_MASK,
  520. },
  521. };
  522. static struct spear_modemux pwm1_modemux[] = {
  523. {
  524. .muxregs = pwm1_muxreg,
  525. .nmuxregs = ARRAY_SIZE(pwm1_muxreg),
  526. },
  527. };
  528. static struct spear_pingroup pwm1_pingroup = {
  529. .name = "pwm1_grp",
  530. .pins = pwm1_pins,
  531. .npins = ARRAY_SIZE(pwm1_pins),
  532. .modemuxs = pwm1_modemux,
  533. .nmodemuxs = ARRAY_SIZE(pwm1_modemux),
  534. };
  535. /* pad multiplexing for pwm2 device */
  536. static const unsigned pwm2_pins[] = { 21 };
  537. static struct spear_muxreg pwm2_muxreg[] = {
  538. {
  539. .reg = PAD_SHARED_IP_EN_1,
  540. .mask = GPT0_TMR0_CPT_MASK,
  541. .val = 0,
  542. }, {
  543. .reg = PAD_FUNCTION_EN_1,
  544. .mask = PWM2_AND_GPT0_TMR0_CPT_REG0_MASK,
  545. .val = PWM2_AND_GPT0_TMR0_CPT_REG0_MASK,
  546. },
  547. };
  548. static struct spear_modemux pwm2_modemux[] = {
  549. {
  550. .muxregs = pwm2_muxreg,
  551. .nmuxregs = ARRAY_SIZE(pwm2_muxreg),
  552. },
  553. };
  554. static struct spear_pingroup pwm2_pingroup = {
  555. .name = "pwm2_grp",
  556. .pins = pwm2_pins,
  557. .npins = ARRAY_SIZE(pwm2_pins),
  558. .modemuxs = pwm2_modemux,
  559. .nmodemuxs = ARRAY_SIZE(pwm2_modemux),
  560. };
  561. /* pad multiplexing for pwm3 device */
  562. static const unsigned pwm3_pins[] = { 22 };
  563. static struct spear_muxreg pwm3_muxreg[] = {
  564. {
  565. .reg = PAD_SHARED_IP_EN_1,
  566. .mask = GPT0_TMR1_CLK_MASK,
  567. .val = 0,
  568. }, {
  569. .reg = PAD_FUNCTION_EN_1,
  570. .mask = PWM3_AND_GPT0_TMR1_CLK_REG0_MASK,
  571. .val = PWM3_AND_GPT0_TMR1_CLK_REG0_MASK,
  572. },
  573. };
  574. static struct spear_modemux pwm3_modemux[] = {
  575. {
  576. .muxregs = pwm3_muxreg,
  577. .nmuxregs = ARRAY_SIZE(pwm3_muxreg),
  578. },
  579. };
  580. static struct spear_pingroup pwm3_pingroup = {
  581. .name = "pwm3_grp",
  582. .pins = pwm3_pins,
  583. .npins = ARRAY_SIZE(pwm3_pins),
  584. .modemuxs = pwm3_modemux,
  585. .nmodemuxs = ARRAY_SIZE(pwm3_modemux),
  586. };
  587. static const char *const pwm_grps[] = { "pwm0_grp", "pwm1_grp", "pwm2_grp",
  588. "pwm3_grp" };
  589. static struct spear_function pwm_function = {
  590. .name = "pwm",
  591. .groups = pwm_grps,
  592. .ngroups = ARRAY_SIZE(pwm_grps),
  593. };
  594. /* pad multiplexing for vip_mux device */
  595. static const unsigned vip_mux_pins[] = { 35, 36, 37, 38, 40, 41, 42, 43 };
  596. static struct spear_muxreg vip_mux_muxreg[] = {
  597. {
  598. .reg = PAD_FUNCTION_EN_2,
  599. .mask = VIP_REG1_MASK,
  600. .val = VIP_REG1_MASK,
  601. },
  602. };
  603. static struct spear_modemux vip_mux_modemux[] = {
  604. {
  605. .muxregs = vip_mux_muxreg,
  606. .nmuxregs = ARRAY_SIZE(vip_mux_muxreg),
  607. },
  608. };
  609. static struct spear_pingroup vip_mux_pingroup = {
  610. .name = "vip_mux_grp",
  611. .pins = vip_mux_pins,
  612. .npins = ARRAY_SIZE(vip_mux_pins),
  613. .modemuxs = vip_mux_modemux,
  614. .nmodemuxs = ARRAY_SIZE(vip_mux_modemux),
  615. };
  616. /* pad multiplexing for vip_mux_cam0 (disables cam0) device */
  617. static const unsigned vip_mux_cam0_pins[] = { 65, 66, 67, 68, 69, 70, 71, 72,
  618. 73, 74, 75 };
  619. static struct spear_muxreg vip_mux_cam0_muxreg[] = {
  620. {
  621. .reg = PAD_SHARED_IP_EN_1,
  622. .mask = CAM0_MASK,
  623. .val = 0,
  624. }, {
  625. .reg = PAD_FUNCTION_EN_3,
  626. .mask = VIP_AND_CAM0_REG2_MASK,
  627. .val = VIP_AND_CAM0_REG2_MASK,
  628. },
  629. };
  630. static struct spear_modemux vip_mux_cam0_modemux[] = {
  631. {
  632. .muxregs = vip_mux_cam0_muxreg,
  633. .nmuxregs = ARRAY_SIZE(vip_mux_cam0_muxreg),
  634. },
  635. };
  636. static struct spear_pingroup vip_mux_cam0_pingroup = {
  637. .name = "vip_mux_cam0_grp",
  638. .pins = vip_mux_cam0_pins,
  639. .npins = ARRAY_SIZE(vip_mux_cam0_pins),
  640. .modemuxs = vip_mux_cam0_modemux,
  641. .nmodemuxs = ARRAY_SIZE(vip_mux_cam0_modemux),
  642. };
  643. /* pad multiplexing for vip_mux_cam1 (disables cam1) device */
  644. static const unsigned vip_mux_cam1_pins[] = { 54, 55, 56, 57, 58, 59, 60, 61,
  645. 62, 63, 64 };
  646. static struct spear_muxreg vip_mux_cam1_muxreg[] = {
  647. {
  648. .reg = PAD_SHARED_IP_EN_1,
  649. .mask = CAM1_MASK,
  650. .val = 0,
  651. }, {
  652. .reg = PAD_FUNCTION_EN_2,
  653. .mask = VIP_AND_CAM1_REG1_MASK,
  654. .val = VIP_AND_CAM1_REG1_MASK,
  655. }, {
  656. .reg = PAD_FUNCTION_EN_3,
  657. .mask = VIP_AND_CAM1_REG2_MASK,
  658. .val = VIP_AND_CAM1_REG2_MASK,
  659. },
  660. };
  661. static struct spear_modemux vip_mux_cam1_modemux[] = {
  662. {
  663. .muxregs = vip_mux_cam1_muxreg,
  664. .nmuxregs = ARRAY_SIZE(vip_mux_cam1_muxreg),
  665. },
  666. };
  667. static struct spear_pingroup vip_mux_cam1_pingroup = {
  668. .name = "vip_mux_cam1_grp",
  669. .pins = vip_mux_cam1_pins,
  670. .npins = ARRAY_SIZE(vip_mux_cam1_pins),
  671. .modemuxs = vip_mux_cam1_modemux,
  672. .nmodemuxs = ARRAY_SIZE(vip_mux_cam1_modemux),
  673. };
  674. /* pad multiplexing for vip_mux_cam2 (disables cam2) device */
  675. static const unsigned vip_mux_cam2_pins[] = { 39, 44, 45, 46, 47, 48, 49, 50,
  676. 51, 52, 53 };
  677. static struct spear_muxreg vip_mux_cam2_muxreg[] = {
  678. {
  679. .reg = PAD_SHARED_IP_EN_1,
  680. .mask = CAM2_MASK,
  681. .val = 0,
  682. }, {
  683. .reg = PAD_FUNCTION_EN_2,
  684. .mask = VIP_AND_CAM2_REG1_MASK,
  685. .val = VIP_AND_CAM2_REG1_MASK,
  686. },
  687. };
  688. static struct spear_modemux vip_mux_cam2_modemux[] = {
  689. {
  690. .muxregs = vip_mux_cam2_muxreg,
  691. .nmuxregs = ARRAY_SIZE(vip_mux_cam2_muxreg),
  692. },
  693. };
  694. static struct spear_pingroup vip_mux_cam2_pingroup = {
  695. .name = "vip_mux_cam2_grp",
  696. .pins = vip_mux_cam2_pins,
  697. .npins = ARRAY_SIZE(vip_mux_cam2_pins),
  698. .modemuxs = vip_mux_cam2_modemux,
  699. .nmodemuxs = ARRAY_SIZE(vip_mux_cam2_modemux),
  700. };
  701. /* pad multiplexing for vip_mux_cam3 (disables cam3) device */
  702. static const unsigned vip_mux_cam3_pins[] = { 20, 25, 26, 27, 28, 29, 30, 31,
  703. 32, 33, 34 };
  704. static struct spear_muxreg vip_mux_cam3_muxreg[] = {
  705. {
  706. .reg = PAD_SHARED_IP_EN_1,
  707. .mask = CAM3_MASK,
  708. .val = 0,
  709. }, {
  710. .reg = PAD_FUNCTION_EN_1,
  711. .mask = VIP_AND_CAM3_REG0_MASK,
  712. .val = VIP_AND_CAM3_REG0_MASK,
  713. }, {
  714. .reg = PAD_FUNCTION_EN_2,
  715. .mask = VIP_AND_CAM3_REG1_MASK,
  716. .val = VIP_AND_CAM3_REG1_MASK,
  717. },
  718. };
  719. static struct spear_modemux vip_mux_cam3_modemux[] = {
  720. {
  721. .muxregs = vip_mux_cam3_muxreg,
  722. .nmuxregs = ARRAY_SIZE(vip_mux_cam3_muxreg),
  723. },
  724. };
  725. static struct spear_pingroup vip_mux_cam3_pingroup = {
  726. .name = "vip_mux_cam3_grp",
  727. .pins = vip_mux_cam3_pins,
  728. .npins = ARRAY_SIZE(vip_mux_cam3_pins),
  729. .modemuxs = vip_mux_cam3_modemux,
  730. .nmodemuxs = ARRAY_SIZE(vip_mux_cam3_modemux),
  731. };
  732. static const char *const vip_grps[] = { "vip_mux_grp", "vip_mux_cam0_grp" ,
  733. "vip_mux_cam1_grp" , "vip_mux_cam2_grp", "vip_mux_cam3_grp" };
  734. static struct spear_function vip_function = {
  735. .name = "vip",
  736. .groups = vip_grps,
  737. .ngroups = ARRAY_SIZE(vip_grps),
  738. };
  739. /* pad multiplexing for cam0 device */
  740. static const unsigned cam0_pins[] = { 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75
  741. };
  742. static struct spear_muxreg cam0_muxreg[] = {
  743. {
  744. .reg = PAD_SHARED_IP_EN_1,
  745. .mask = CAM0_MASK,
  746. .val = CAM0_MASK,
  747. }, {
  748. .reg = PAD_FUNCTION_EN_3,
  749. .mask = VIP_AND_CAM0_REG2_MASK,
  750. .val = VIP_AND_CAM0_REG2_MASK,
  751. },
  752. };
  753. static struct spear_modemux cam0_modemux[] = {
  754. {
  755. .muxregs = cam0_muxreg,
  756. .nmuxregs = ARRAY_SIZE(cam0_muxreg),
  757. },
  758. };
  759. static struct spear_pingroup cam0_pingroup = {
  760. .name = "cam0_grp",
  761. .pins = cam0_pins,
  762. .npins = ARRAY_SIZE(cam0_pins),
  763. .modemuxs = cam0_modemux,
  764. .nmodemuxs = ARRAY_SIZE(cam0_modemux),
  765. };
  766. static const char *const cam0_grps[] = { "cam0_grp" };
  767. static struct spear_function cam0_function = {
  768. .name = "cam0",
  769. .groups = cam0_grps,
  770. .ngroups = ARRAY_SIZE(cam0_grps),
  771. };
  772. /* pad multiplexing for cam1 device */
  773. static const unsigned cam1_pins[] = { 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64
  774. };
  775. static struct spear_muxreg cam1_muxreg[] = {
  776. {
  777. .reg = PAD_SHARED_IP_EN_1,
  778. .mask = CAM1_MASK,
  779. .val = CAM1_MASK,
  780. }, {
  781. .reg = PAD_FUNCTION_EN_2,
  782. .mask = VIP_AND_CAM1_REG1_MASK,
  783. .val = VIP_AND_CAM1_REG1_MASK,
  784. }, {
  785. .reg = PAD_FUNCTION_EN_3,
  786. .mask = VIP_AND_CAM1_REG2_MASK,
  787. .val = VIP_AND_CAM1_REG2_MASK,
  788. },
  789. };
  790. static struct spear_modemux cam1_modemux[] = {
  791. {
  792. .muxregs = cam1_muxreg,
  793. .nmuxregs = ARRAY_SIZE(cam1_muxreg),
  794. },
  795. };
  796. static struct spear_pingroup cam1_pingroup = {
  797. .name = "cam1_grp",
  798. .pins = cam1_pins,
  799. .npins = ARRAY_SIZE(cam1_pins),
  800. .modemuxs = cam1_modemux,
  801. .nmodemuxs = ARRAY_SIZE(cam1_modemux),
  802. };
  803. static const char *const cam1_grps[] = { "cam1_grp" };
  804. static struct spear_function cam1_function = {
  805. .name = "cam1",
  806. .groups = cam1_grps,
  807. .ngroups = ARRAY_SIZE(cam1_grps),
  808. };
  809. /* pad multiplexing for cam2 device */
  810. static const unsigned cam2_pins[] = { 39, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53
  811. };
  812. static struct spear_muxreg cam2_muxreg[] = {
  813. {
  814. .reg = PAD_SHARED_IP_EN_1,
  815. .mask = CAM2_MASK,
  816. .val = CAM2_MASK,
  817. }, {
  818. .reg = PAD_FUNCTION_EN_2,
  819. .mask = VIP_AND_CAM2_REG1_MASK,
  820. .val = VIP_AND_CAM2_REG1_MASK,
  821. },
  822. };
  823. static struct spear_modemux cam2_modemux[] = {
  824. {
  825. .muxregs = cam2_muxreg,
  826. .nmuxregs = ARRAY_SIZE(cam2_muxreg),
  827. },
  828. };
  829. static struct spear_pingroup cam2_pingroup = {
  830. .name = "cam2_grp",
  831. .pins = cam2_pins,
  832. .npins = ARRAY_SIZE(cam2_pins),
  833. .modemuxs = cam2_modemux,
  834. .nmodemuxs = ARRAY_SIZE(cam2_modemux),
  835. };
  836. static const char *const cam2_grps[] = { "cam2_grp" };
  837. static struct spear_function cam2_function = {
  838. .name = "cam2",
  839. .groups = cam2_grps,
  840. .ngroups = ARRAY_SIZE(cam2_grps),
  841. };
  842. /* pad multiplexing for cam3 device */
  843. static const unsigned cam3_pins[] = { 20, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34
  844. };
  845. static struct spear_muxreg cam3_muxreg[] = {
  846. {
  847. .reg = PAD_SHARED_IP_EN_1,
  848. .mask = CAM3_MASK,
  849. .val = CAM3_MASK,
  850. }, {
  851. .reg = PAD_FUNCTION_EN_1,
  852. .mask = VIP_AND_CAM3_REG0_MASK,
  853. .val = VIP_AND_CAM3_REG0_MASK,
  854. }, {
  855. .reg = PAD_FUNCTION_EN_2,
  856. .mask = VIP_AND_CAM3_REG1_MASK,
  857. .val = VIP_AND_CAM3_REG1_MASK,
  858. },
  859. };
  860. static struct spear_modemux cam3_modemux[] = {
  861. {
  862. .muxregs = cam3_muxreg,
  863. .nmuxregs = ARRAY_SIZE(cam3_muxreg),
  864. },
  865. };
  866. static struct spear_pingroup cam3_pingroup = {
  867. .name = "cam3_grp",
  868. .pins = cam3_pins,
  869. .npins = ARRAY_SIZE(cam3_pins),
  870. .modemuxs = cam3_modemux,
  871. .nmodemuxs = ARRAY_SIZE(cam3_modemux),
  872. };
  873. static const char *const cam3_grps[] = { "cam3_grp" };
  874. static struct spear_function cam3_function = {
  875. .name = "cam3",
  876. .groups = cam3_grps,
  877. .ngroups = ARRAY_SIZE(cam3_grps),
  878. };
  879. /* pad multiplexing for smi device */
  880. static const unsigned smi_pins[] = { 76, 77, 78, 79, 84 };
  881. static struct spear_muxreg smi_muxreg[] = {
  882. {
  883. .reg = PAD_FUNCTION_EN_3,
  884. .mask = SMI_REG2_MASK,
  885. .val = SMI_REG2_MASK,
  886. },
  887. };
  888. static struct spear_modemux smi_modemux[] = {
  889. {
  890. .muxregs = smi_muxreg,
  891. .nmuxregs = ARRAY_SIZE(smi_muxreg),
  892. },
  893. };
  894. static struct spear_pingroup smi_pingroup = {
  895. .name = "smi_grp",
  896. .pins = smi_pins,
  897. .npins = ARRAY_SIZE(smi_pins),
  898. .modemuxs = smi_modemux,
  899. .nmodemuxs = ARRAY_SIZE(smi_modemux),
  900. };
  901. static const char *const smi_grps[] = { "smi_grp" };
  902. static struct spear_function smi_function = {
  903. .name = "smi",
  904. .groups = smi_grps,
  905. .ngroups = ARRAY_SIZE(smi_grps),
  906. };
  907. /* pad multiplexing for ssp0 device */
  908. static const unsigned ssp0_pins[] = { 80, 81, 82, 83 };
  909. static struct spear_muxreg ssp0_muxreg[] = {
  910. {
  911. .reg = PAD_FUNCTION_EN_3,
  912. .mask = SSP0_REG2_MASK,
  913. .val = SSP0_REG2_MASK,
  914. },
  915. };
  916. static struct spear_modemux ssp0_modemux[] = {
  917. {
  918. .muxregs = ssp0_muxreg,
  919. .nmuxregs = ARRAY_SIZE(ssp0_muxreg),
  920. },
  921. };
  922. static struct spear_pingroup ssp0_pingroup = {
  923. .name = "ssp0_grp",
  924. .pins = ssp0_pins,
  925. .npins = ARRAY_SIZE(ssp0_pins),
  926. .modemuxs = ssp0_modemux,
  927. .nmodemuxs = ARRAY_SIZE(ssp0_modemux),
  928. };
  929. /* pad multiplexing for ssp0_cs1 device */
  930. static const unsigned ssp0_cs1_pins[] = { 24 };
  931. static struct spear_muxreg ssp0_cs1_muxreg[] = {
  932. {
  933. .reg = PAD_SHARED_IP_EN_1,
  934. .mask = SSP0_CS1_MASK,
  935. .val = SSP0_CS1_MASK,
  936. }, {
  937. .reg = PAD_FUNCTION_EN_1,
  938. .mask = PWM0_AND_SSP0_CS1_REG0_MASK,
  939. .val = PWM0_AND_SSP0_CS1_REG0_MASK,
  940. },
  941. };
  942. static struct spear_modemux ssp0_cs1_modemux[] = {
  943. {
  944. .muxregs = ssp0_cs1_muxreg,
  945. .nmuxregs = ARRAY_SIZE(ssp0_cs1_muxreg),
  946. },
  947. };
  948. static struct spear_pingroup ssp0_cs1_pingroup = {
  949. .name = "ssp0_cs1_grp",
  950. .pins = ssp0_cs1_pins,
  951. .npins = ARRAY_SIZE(ssp0_cs1_pins),
  952. .modemuxs = ssp0_cs1_modemux,
  953. .nmodemuxs = ARRAY_SIZE(ssp0_cs1_modemux),
  954. };
  955. /* pad multiplexing for ssp0_cs2 device */
  956. static const unsigned ssp0_cs2_pins[] = { 85 };
  957. static struct spear_muxreg ssp0_cs2_muxreg[] = {
  958. {
  959. .reg = PAD_SHARED_IP_EN_1,
  960. .mask = SSP0_CS2_MASK,
  961. .val = SSP0_CS2_MASK,
  962. }, {
  963. .reg = PAD_FUNCTION_EN_3,
  964. .mask = TS_AND_SSP0_CS2_REG2_MASK,
  965. .val = TS_AND_SSP0_CS2_REG2_MASK,
  966. },
  967. };
  968. static struct spear_modemux ssp0_cs2_modemux[] = {
  969. {
  970. .muxregs = ssp0_cs2_muxreg,
  971. .nmuxregs = ARRAY_SIZE(ssp0_cs2_muxreg),
  972. },
  973. };
  974. static struct spear_pingroup ssp0_cs2_pingroup = {
  975. .name = "ssp0_cs2_grp",
  976. .pins = ssp0_cs2_pins,
  977. .npins = ARRAY_SIZE(ssp0_cs2_pins),
  978. .modemuxs = ssp0_cs2_modemux,
  979. .nmodemuxs = ARRAY_SIZE(ssp0_cs2_modemux),
  980. };
  981. /* pad multiplexing for ssp0_cs3 device */
  982. static const unsigned ssp0_cs3_pins[] = { 132 };
  983. static struct spear_muxreg ssp0_cs3_muxreg[] = {
  984. {
  985. .reg = PAD_FUNCTION_EN_5,
  986. .mask = SSP0_CS3_REG4_MASK,
  987. .val = SSP0_CS3_REG4_MASK,
  988. },
  989. };
  990. static struct spear_modemux ssp0_cs3_modemux[] = {
  991. {
  992. .muxregs = ssp0_cs3_muxreg,
  993. .nmuxregs = ARRAY_SIZE(ssp0_cs3_muxreg),
  994. },
  995. };
  996. static struct spear_pingroup ssp0_cs3_pingroup = {
  997. .name = "ssp0_cs3_grp",
  998. .pins = ssp0_cs3_pins,
  999. .npins = ARRAY_SIZE(ssp0_cs3_pins),
  1000. .modemuxs = ssp0_cs3_modemux,
  1001. .nmodemuxs = ARRAY_SIZE(ssp0_cs3_modemux),
  1002. };
  1003. static const char *const ssp0_grps[] = { "ssp0_grp", "ssp0_cs1_grp",
  1004. "ssp0_cs2_grp", "ssp0_cs3_grp" };
  1005. static struct spear_function ssp0_function = {
  1006. .name = "ssp0",
  1007. .groups = ssp0_grps,
  1008. .ngroups = ARRAY_SIZE(ssp0_grps),
  1009. };
  1010. /* pad multiplexing for uart0 device */
  1011. static const unsigned uart0_pins[] = { 86, 87 };
  1012. static struct spear_muxreg uart0_muxreg[] = {
  1013. {
  1014. .reg = PAD_FUNCTION_EN_3,
  1015. .mask = UART0_REG2_MASK,
  1016. .val = UART0_REG2_MASK,
  1017. },
  1018. };
  1019. static struct spear_modemux uart0_modemux[] = {
  1020. {
  1021. .muxregs = uart0_muxreg,
  1022. .nmuxregs = ARRAY_SIZE(uart0_muxreg),
  1023. },
  1024. };
  1025. static struct spear_pingroup uart0_pingroup = {
  1026. .name = "uart0_grp",
  1027. .pins = uart0_pins,
  1028. .npins = ARRAY_SIZE(uart0_pins),
  1029. .modemuxs = uart0_modemux,
  1030. .nmodemuxs = ARRAY_SIZE(uart0_modemux),
  1031. };
  1032. /* pad multiplexing for uart0_enh device */
  1033. static const unsigned uart0_enh_pins[] = { 11, 12, 13, 14, 15, 16 };
  1034. static struct spear_muxreg uart0_enh_muxreg[] = {
  1035. {
  1036. .reg = PAD_SHARED_IP_EN_1,
  1037. .mask = GPT_MASK,
  1038. .val = 0,
  1039. }, {
  1040. .reg = PAD_FUNCTION_EN_1,
  1041. .mask = UART0_ENH_AND_GPT_REG0_MASK,
  1042. .val = UART0_ENH_AND_GPT_REG0_MASK,
  1043. },
  1044. };
  1045. static struct spear_modemux uart0_enh_modemux[] = {
  1046. {
  1047. .muxregs = uart0_enh_muxreg,
  1048. .nmuxregs = ARRAY_SIZE(uart0_enh_muxreg),
  1049. },
  1050. };
  1051. static struct spear_pingroup uart0_enh_pingroup = {
  1052. .name = "uart0_enh_grp",
  1053. .pins = uart0_enh_pins,
  1054. .npins = ARRAY_SIZE(uart0_enh_pins),
  1055. .modemuxs = uart0_enh_modemux,
  1056. .nmodemuxs = ARRAY_SIZE(uart0_enh_modemux),
  1057. };
  1058. static const char *const uart0_grps[] = { "uart0_grp", "uart0_enh_grp" };
  1059. static struct spear_function uart0_function = {
  1060. .name = "uart0",
  1061. .groups = uart0_grps,
  1062. .ngroups = ARRAY_SIZE(uart0_grps),
  1063. };
  1064. /* pad multiplexing for uart1 device */
  1065. static const unsigned uart1_pins[] = { 88, 89 };
  1066. static struct spear_muxreg uart1_muxreg[] = {
  1067. {
  1068. .reg = PAD_FUNCTION_EN_3,
  1069. .mask = UART1_REG2_MASK,
  1070. .val = UART1_REG2_MASK,
  1071. },
  1072. };
  1073. static struct spear_modemux uart1_modemux[] = {
  1074. {
  1075. .muxregs = uart1_muxreg,
  1076. .nmuxregs = ARRAY_SIZE(uart1_muxreg),
  1077. },
  1078. };
  1079. static struct spear_pingroup uart1_pingroup = {
  1080. .name = "uart1_grp",
  1081. .pins = uart1_pins,
  1082. .npins = ARRAY_SIZE(uart1_pins),
  1083. .modemuxs = uart1_modemux,
  1084. .nmodemuxs = ARRAY_SIZE(uart1_modemux),
  1085. };
  1086. static const char *const uart1_grps[] = { "uart1_grp" };
  1087. static struct spear_function uart1_function = {
  1088. .name = "uart1",
  1089. .groups = uart1_grps,
  1090. .ngroups = ARRAY_SIZE(uart1_grps),
  1091. };
  1092. /* pad multiplexing for i2s_in device */
  1093. static const unsigned i2s_in_pins[] = { 90, 91, 92, 93, 94, 99 };
  1094. static struct spear_muxreg i2s_in_muxreg[] = {
  1095. {
  1096. .reg = PAD_FUNCTION_EN_3,
  1097. .mask = I2S_IN_REG2_MASK,
  1098. .val = I2S_IN_REG2_MASK,
  1099. }, {
  1100. .reg = PAD_FUNCTION_EN_4,
  1101. .mask = I2S_IN_REG3_MASK,
  1102. .val = I2S_IN_REG3_MASK,
  1103. },
  1104. };
  1105. static struct spear_modemux i2s_in_modemux[] = {
  1106. {
  1107. .muxregs = i2s_in_muxreg,
  1108. .nmuxregs = ARRAY_SIZE(i2s_in_muxreg),
  1109. },
  1110. };
  1111. static struct spear_pingroup i2s_in_pingroup = {
  1112. .name = "i2s_in_grp",
  1113. .pins = i2s_in_pins,
  1114. .npins = ARRAY_SIZE(i2s_in_pins),
  1115. .modemuxs = i2s_in_modemux,
  1116. .nmodemuxs = ARRAY_SIZE(i2s_in_modemux),
  1117. };
  1118. /* pad multiplexing for i2s_out device */
  1119. static const unsigned i2s_out_pins[] = { 95, 96, 97, 98, 100, 101, 102, 103 };
  1120. static struct spear_muxreg i2s_out_muxreg[] = {
  1121. {
  1122. .reg = PAD_FUNCTION_EN_4,
  1123. .mask = I2S_OUT_REG3_MASK,
  1124. .val = I2S_OUT_REG3_MASK,
  1125. },
  1126. };
  1127. static struct spear_modemux i2s_out_modemux[] = {
  1128. {
  1129. .muxregs = i2s_out_muxreg,
  1130. .nmuxregs = ARRAY_SIZE(i2s_out_muxreg),
  1131. },
  1132. };
  1133. static struct spear_pingroup i2s_out_pingroup = {
  1134. .name = "i2s_out_grp",
  1135. .pins = i2s_out_pins,
  1136. .npins = ARRAY_SIZE(i2s_out_pins),
  1137. .modemuxs = i2s_out_modemux,
  1138. .nmodemuxs = ARRAY_SIZE(i2s_out_modemux),
  1139. };
  1140. static const char *const i2s_grps[] = { "i2s_in_grp", "i2s_out_grp" };
  1141. static struct spear_function i2s_function = {
  1142. .name = "i2s",
  1143. .groups = i2s_grps,
  1144. .ngroups = ARRAY_SIZE(i2s_grps),
  1145. };
  1146. /* pad multiplexing for gmac device */
  1147. static const unsigned gmac_pins[] = { 104, 105, 106, 107, 108, 109, 110, 111,
  1148. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
  1149. 126, 127, 128, 129, 130, 131 };
  1150. #define GMAC_MUXREG \
  1151. { \
  1152. .reg = PAD_FUNCTION_EN_4, \
  1153. .mask = GMAC_REG3_MASK, \
  1154. .val = GMAC_REG3_MASK, \
  1155. }, { \
  1156. .reg = PAD_FUNCTION_EN_5, \
  1157. .mask = GMAC_REG4_MASK, \
  1158. .val = GMAC_REG4_MASK, \
  1159. }
  1160. /* pad multiplexing for gmii device */
  1161. static struct spear_muxreg gmii_muxreg[] = {
  1162. GMAC_MUXREG,
  1163. {
  1164. .reg = GMAC_CLK_CFG,
  1165. .mask = GMAC_PHY_IF_SEL_MASK,
  1166. .val = GMAC_PHY_IF_GMII_VAL,
  1167. },
  1168. };
  1169. static struct spear_modemux gmii_modemux[] = {
  1170. {
  1171. .muxregs = gmii_muxreg,
  1172. .nmuxregs = ARRAY_SIZE(gmii_muxreg),
  1173. },
  1174. };
  1175. static struct spear_pingroup gmii_pingroup = {
  1176. .name = "gmii_grp",
  1177. .pins = gmac_pins,
  1178. .npins = ARRAY_SIZE(gmac_pins),
  1179. .modemuxs = gmii_modemux,
  1180. .nmodemuxs = ARRAY_SIZE(gmii_modemux),
  1181. };
  1182. /* pad multiplexing for rgmii device */
  1183. static struct spear_muxreg rgmii_muxreg[] = {
  1184. GMAC_MUXREG,
  1185. {
  1186. .reg = GMAC_CLK_CFG,
  1187. .mask = GMAC_PHY_IF_SEL_MASK,
  1188. .val = GMAC_PHY_IF_RGMII_VAL,
  1189. },
  1190. };
  1191. static struct spear_modemux rgmii_modemux[] = {
  1192. {
  1193. .muxregs = rgmii_muxreg,
  1194. .nmuxregs = ARRAY_SIZE(rgmii_muxreg),
  1195. },
  1196. };
  1197. static struct spear_pingroup rgmii_pingroup = {
  1198. .name = "rgmii_grp",
  1199. .pins = gmac_pins,
  1200. .npins = ARRAY_SIZE(gmac_pins),
  1201. .modemuxs = rgmii_modemux,
  1202. .nmodemuxs = ARRAY_SIZE(rgmii_modemux),
  1203. };
  1204. /* pad multiplexing for rmii device */
  1205. static struct spear_muxreg rmii_muxreg[] = {
  1206. GMAC_MUXREG,
  1207. {
  1208. .reg = GMAC_CLK_CFG,
  1209. .mask = GMAC_PHY_IF_SEL_MASK,
  1210. .val = GMAC_PHY_IF_RMII_VAL,
  1211. },
  1212. };
  1213. static struct spear_modemux rmii_modemux[] = {
  1214. {
  1215. .muxregs = rmii_muxreg,
  1216. .nmuxregs = ARRAY_SIZE(rmii_muxreg),
  1217. },
  1218. };
  1219. static struct spear_pingroup rmii_pingroup = {
  1220. .name = "rmii_grp",
  1221. .pins = gmac_pins,
  1222. .npins = ARRAY_SIZE(gmac_pins),
  1223. .modemuxs = rmii_modemux,
  1224. .nmodemuxs = ARRAY_SIZE(rmii_modemux),
  1225. };
  1226. /* pad multiplexing for sgmii device */
  1227. static struct spear_muxreg sgmii_muxreg[] = {
  1228. GMAC_MUXREG,
  1229. {
  1230. .reg = GMAC_CLK_CFG,
  1231. .mask = GMAC_PHY_IF_SEL_MASK,
  1232. .val = GMAC_PHY_IF_SGMII_VAL,
  1233. },
  1234. };
  1235. static struct spear_modemux sgmii_modemux[] = {
  1236. {
  1237. .muxregs = sgmii_muxreg,
  1238. .nmuxregs = ARRAY_SIZE(sgmii_muxreg),
  1239. },
  1240. };
  1241. static struct spear_pingroup sgmii_pingroup = {
  1242. .name = "sgmii_grp",
  1243. .pins = gmac_pins,
  1244. .npins = ARRAY_SIZE(gmac_pins),
  1245. .modemuxs = sgmii_modemux,
  1246. .nmodemuxs = ARRAY_SIZE(sgmii_modemux),
  1247. };
  1248. static const char *const gmac_grps[] = { "gmii_grp", "rgmii_grp", "rmii_grp",
  1249. "sgmii_grp" };
  1250. static struct spear_function gmac_function = {
  1251. .name = "gmac",
  1252. .groups = gmac_grps,
  1253. .ngroups = ARRAY_SIZE(gmac_grps),
  1254. };
  1255. /* pad multiplexing for i2c0 device */
  1256. static const unsigned i2c0_pins[] = { 133, 134 };
  1257. static struct spear_muxreg i2c0_muxreg[] = {
  1258. {
  1259. .reg = PAD_FUNCTION_EN_5,
  1260. .mask = I2C0_REG4_MASK,
  1261. .val = I2C0_REG4_MASK,
  1262. },
  1263. };
  1264. static struct spear_modemux i2c0_modemux[] = {
  1265. {
  1266. .muxregs = i2c0_muxreg,
  1267. .nmuxregs = ARRAY_SIZE(i2c0_muxreg),
  1268. },
  1269. };
  1270. static struct spear_pingroup i2c0_pingroup = {
  1271. .name = "i2c0_grp",
  1272. .pins = i2c0_pins,
  1273. .npins = ARRAY_SIZE(i2c0_pins),
  1274. .modemuxs = i2c0_modemux,
  1275. .nmodemuxs = ARRAY_SIZE(i2c0_modemux),
  1276. };
  1277. static const char *const i2c0_grps[] = { "i2c0_grp" };
  1278. static struct spear_function i2c0_function = {
  1279. .name = "i2c0",
  1280. .groups = i2c0_grps,
  1281. .ngroups = ARRAY_SIZE(i2c0_grps),
  1282. };
  1283. /* pad multiplexing for i2c1 device */
  1284. static const unsigned i2c1_pins[] = { 18, 23 };
  1285. static struct spear_muxreg i2c1_muxreg[] = {
  1286. {
  1287. .reg = PAD_FUNCTION_EN_1,
  1288. .mask = I2C1_REG0_MASK,
  1289. .val = I2C1_REG0_MASK,
  1290. },
  1291. };
  1292. static struct spear_modemux i2c1_modemux[] = {
  1293. {
  1294. .muxregs = i2c1_muxreg,
  1295. .nmuxregs = ARRAY_SIZE(i2c1_muxreg),
  1296. },
  1297. };
  1298. static struct spear_pingroup i2c1_pingroup = {
  1299. .name = "i2c1_grp",
  1300. .pins = i2c1_pins,
  1301. .npins = ARRAY_SIZE(i2c1_pins),
  1302. .modemuxs = i2c1_modemux,
  1303. .nmodemuxs = ARRAY_SIZE(i2c1_modemux),
  1304. };
  1305. static const char *const i2c1_grps[] = { "i2c1_grp" };
  1306. static struct spear_function i2c1_function = {
  1307. .name = "i2c1",
  1308. .groups = i2c1_grps,
  1309. .ngroups = ARRAY_SIZE(i2c1_grps),
  1310. };
  1311. /* pad multiplexing for cec0 device */
  1312. static const unsigned cec0_pins[] = { 135 };
  1313. static struct spear_muxreg cec0_muxreg[] = {
  1314. {
  1315. .reg = PAD_FUNCTION_EN_5,
  1316. .mask = CEC0_REG4_MASK,
  1317. .val = CEC0_REG4_MASK,
  1318. },
  1319. };
  1320. static struct spear_modemux cec0_modemux[] = {
  1321. {
  1322. .muxregs = cec0_muxreg,
  1323. .nmuxregs = ARRAY_SIZE(cec0_muxreg),
  1324. },
  1325. };
  1326. static struct spear_pingroup cec0_pingroup = {
  1327. .name = "cec0_grp",
  1328. .pins = cec0_pins,
  1329. .npins = ARRAY_SIZE(cec0_pins),
  1330. .modemuxs = cec0_modemux,
  1331. .nmodemuxs = ARRAY_SIZE(cec0_modemux),
  1332. };
  1333. static const char *const cec0_grps[] = { "cec0_grp" };
  1334. static struct spear_function cec0_function = {
  1335. .name = "cec0",
  1336. .groups = cec0_grps,
  1337. .ngroups = ARRAY_SIZE(cec0_grps),
  1338. };
  1339. /* pad multiplexing for cec1 device */
  1340. static const unsigned cec1_pins[] = { 136 };
  1341. static struct spear_muxreg cec1_muxreg[] = {
  1342. {
  1343. .reg = PAD_FUNCTION_EN_5,
  1344. .mask = CEC1_REG4_MASK,
  1345. .val = CEC1_REG4_MASK,
  1346. },
  1347. };
  1348. static struct spear_modemux cec1_modemux[] = {
  1349. {
  1350. .muxregs = cec1_muxreg,
  1351. .nmuxregs = ARRAY_SIZE(cec1_muxreg),
  1352. },
  1353. };
  1354. static struct spear_pingroup cec1_pingroup = {
  1355. .name = "cec1_grp",
  1356. .pins = cec1_pins,
  1357. .npins = ARRAY_SIZE(cec1_pins),
  1358. .modemuxs = cec1_modemux,
  1359. .nmodemuxs = ARRAY_SIZE(cec1_modemux),
  1360. };
  1361. static const char *const cec1_grps[] = { "cec1_grp" };
  1362. static struct spear_function cec1_function = {
  1363. .name = "cec1",
  1364. .groups = cec1_grps,
  1365. .ngroups = ARRAY_SIZE(cec1_grps),
  1366. };
  1367. /* pad multiplexing for mcif devices */
  1368. static const unsigned mcif_pins[] = { 193, 194, 195, 196, 197, 198, 199, 200,
  1369. 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214,
  1370. 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228,
  1371. 229, 230, 231, 232, 237 };
  1372. #define MCIF_MUXREG \
  1373. { \
  1374. .reg = PAD_SHARED_IP_EN_1, \
  1375. .mask = MCIF_MASK, \
  1376. .val = MCIF_MASK, \
  1377. }, { \
  1378. .reg = PAD_FUNCTION_EN_7, \
  1379. .mask = FSMC_PNOR_AND_MCIF_REG6_MASK | MCIF_REG6_MASK, \
  1380. .val = FSMC_PNOR_AND_MCIF_REG6_MASK | MCIF_REG6_MASK, \
  1381. }, { \
  1382. .reg = PAD_FUNCTION_EN_8, \
  1383. .mask = MCIF_REG7_MASK, \
  1384. .val = MCIF_REG7_MASK, \
  1385. }
  1386. /* Pad multiplexing for sdhci device */
  1387. static struct spear_muxreg sdhci_muxreg[] = {
  1388. MCIF_MUXREG,
  1389. {
  1390. .reg = PERIP_CFG,
  1391. .mask = MCIF_SEL_MASK,
  1392. .val = MCIF_SEL_SD,
  1393. },
  1394. };
  1395. static struct spear_modemux sdhci_modemux[] = {
  1396. {
  1397. .muxregs = sdhci_muxreg,
  1398. .nmuxregs = ARRAY_SIZE(sdhci_muxreg),
  1399. },
  1400. };
  1401. static struct spear_pingroup sdhci_pingroup = {
  1402. .name = "sdhci_grp",
  1403. .pins = mcif_pins,
  1404. .npins = ARRAY_SIZE(mcif_pins),
  1405. .modemuxs = sdhci_modemux,
  1406. .nmodemuxs = ARRAY_SIZE(sdhci_modemux),
  1407. };
  1408. static const char *const sdhci_grps[] = { "sdhci_grp" };
  1409. static struct spear_function sdhci_function = {
  1410. .name = "sdhci",
  1411. .groups = sdhci_grps,
  1412. .ngroups = ARRAY_SIZE(sdhci_grps),
  1413. };
  1414. /* Pad multiplexing for cf device */
  1415. static struct spear_muxreg cf_muxreg[] = {
  1416. MCIF_MUXREG,
  1417. {
  1418. .reg = PERIP_CFG,
  1419. .mask = MCIF_SEL_MASK,
  1420. .val = MCIF_SEL_CF,
  1421. },
  1422. };
  1423. static struct spear_modemux cf_modemux[] = {
  1424. {
  1425. .muxregs = cf_muxreg,
  1426. .nmuxregs = ARRAY_SIZE(cf_muxreg),
  1427. },
  1428. };
  1429. static struct spear_pingroup cf_pingroup = {
  1430. .name = "cf_grp",
  1431. .pins = mcif_pins,
  1432. .npins = ARRAY_SIZE(mcif_pins),
  1433. .modemuxs = cf_modemux,
  1434. .nmodemuxs = ARRAY_SIZE(cf_modemux),
  1435. };
  1436. static const char *const cf_grps[] = { "cf_grp" };
  1437. static struct spear_function cf_function = {
  1438. .name = "cf",
  1439. .groups = cf_grps,
  1440. .ngroups = ARRAY_SIZE(cf_grps),
  1441. };
  1442. /* Pad multiplexing for xd device */
  1443. static struct spear_muxreg xd_muxreg[] = {
  1444. MCIF_MUXREG,
  1445. {
  1446. .reg = PERIP_CFG,
  1447. .mask = MCIF_SEL_MASK,
  1448. .val = MCIF_SEL_XD,
  1449. },
  1450. };
  1451. static struct spear_modemux xd_modemux[] = {
  1452. {
  1453. .muxregs = xd_muxreg,
  1454. .nmuxregs = ARRAY_SIZE(xd_muxreg),
  1455. },
  1456. };
  1457. static struct spear_pingroup xd_pingroup = {
  1458. .name = "xd_grp",
  1459. .pins = mcif_pins,
  1460. .npins = ARRAY_SIZE(mcif_pins),
  1461. .modemuxs = xd_modemux,
  1462. .nmodemuxs = ARRAY_SIZE(xd_modemux),
  1463. };
  1464. static const char *const xd_grps[] = { "xd_grp" };
  1465. static struct spear_function xd_function = {
  1466. .name = "xd",
  1467. .groups = xd_grps,
  1468. .ngroups = ARRAY_SIZE(xd_grps),
  1469. };
  1470. /* pad multiplexing for clcd device */
  1471. static const unsigned clcd_pins[] = { 138, 139, 140, 141, 142, 143, 144, 145,
  1472. 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1473. 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173,
  1474. 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
  1475. 188, 189, 190, 191 };
  1476. static struct spear_muxreg clcd_muxreg[] = {
  1477. {
  1478. .reg = PAD_SHARED_IP_EN_1,
  1479. .mask = ARM_TRACE_MASK | MIPHY_DBG_MASK,
  1480. .val = 0,
  1481. }, {
  1482. .reg = PAD_FUNCTION_EN_5,
  1483. .mask = CLCD_REG4_MASK | CLCD_AND_ARM_TRACE_REG4_MASK,
  1484. .val = CLCD_REG4_MASK | CLCD_AND_ARM_TRACE_REG4_MASK,
  1485. }, {
  1486. .reg = PAD_FUNCTION_EN_6,
  1487. .mask = CLCD_AND_ARM_TRACE_REG5_MASK,
  1488. .val = CLCD_AND_ARM_TRACE_REG5_MASK,
  1489. }, {
  1490. .reg = PAD_FUNCTION_EN_7,
  1491. .mask = CLCD_AND_ARM_TRACE_REG6_MASK,
  1492. .val = CLCD_AND_ARM_TRACE_REG6_MASK,
  1493. },
  1494. };
  1495. static struct spear_modemux clcd_modemux[] = {
  1496. {
  1497. .muxregs = clcd_muxreg,
  1498. .nmuxregs = ARRAY_SIZE(clcd_muxreg),
  1499. },
  1500. };
  1501. static struct spear_pingroup clcd_pingroup = {
  1502. .name = "clcd_grp",
  1503. .pins = clcd_pins,
  1504. .npins = ARRAY_SIZE(clcd_pins),
  1505. .modemuxs = clcd_modemux,
  1506. .nmodemuxs = ARRAY_SIZE(clcd_modemux),
  1507. };
  1508. /* Disable cld runtime to save panel damage */
  1509. static struct spear_muxreg clcd_sleep_muxreg[] = {
  1510. {
  1511. .reg = PAD_SHARED_IP_EN_1,
  1512. .mask = ARM_TRACE_MASK | MIPHY_DBG_MASK,
  1513. .val = 0,
  1514. }, {
  1515. .reg = PAD_FUNCTION_EN_5,
  1516. .mask = CLCD_REG4_MASK | CLCD_AND_ARM_TRACE_REG4_MASK,
  1517. .val = 0x0,
  1518. }, {
  1519. .reg = PAD_FUNCTION_EN_6,
  1520. .mask = CLCD_AND_ARM_TRACE_REG5_MASK,
  1521. .val = 0x0,
  1522. }, {
  1523. .reg = PAD_FUNCTION_EN_7,
  1524. .mask = CLCD_AND_ARM_TRACE_REG6_MASK,
  1525. .val = 0x0,
  1526. },
  1527. };
  1528. static struct spear_modemux clcd_sleep_modemux[] = {
  1529. {
  1530. .muxregs = clcd_sleep_muxreg,
  1531. .nmuxregs = ARRAY_SIZE(clcd_sleep_muxreg),
  1532. },
  1533. };
  1534. static struct spear_pingroup clcd_sleep_pingroup = {
  1535. .name = "clcd_sleep_grp",
  1536. .pins = clcd_pins,
  1537. .npins = ARRAY_SIZE(clcd_pins),
  1538. .modemuxs = clcd_sleep_modemux,
  1539. .nmodemuxs = ARRAY_SIZE(clcd_sleep_modemux),
  1540. };
  1541. static const char *const clcd_grps[] = { "clcd_grp", "clcd_sleep_grp" };
  1542. static struct spear_function clcd_function = {
  1543. .name = "clcd",
  1544. .groups = clcd_grps,
  1545. .ngroups = ARRAY_SIZE(clcd_grps),
  1546. };
  1547. /* pad multiplexing for arm_trace device */
  1548. static const unsigned arm_trace_pins[] = { 158, 159, 160, 161, 162, 163, 164,
  1549. 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178,
  1550. 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
  1551. 193, 194, 195, 196, 197, 198, 199, 200 };
  1552. static struct spear_muxreg arm_trace_muxreg[] = {
  1553. {
  1554. .reg = PAD_SHARED_IP_EN_1,
  1555. .mask = ARM_TRACE_MASK,
  1556. .val = ARM_TRACE_MASK,
  1557. }, {
  1558. .reg = PAD_FUNCTION_EN_5,
  1559. .mask = CLCD_AND_ARM_TRACE_REG4_MASK,
  1560. .val = CLCD_AND_ARM_TRACE_REG4_MASK,
  1561. }, {
  1562. .reg = PAD_FUNCTION_EN_6,
  1563. .mask = CLCD_AND_ARM_TRACE_REG5_MASK,
  1564. .val = CLCD_AND_ARM_TRACE_REG5_MASK,
  1565. }, {
  1566. .reg = PAD_FUNCTION_EN_7,
  1567. .mask = CLCD_AND_ARM_TRACE_REG6_MASK,
  1568. .val = CLCD_AND_ARM_TRACE_REG6_MASK,
  1569. },
  1570. };
  1571. static struct spear_modemux arm_trace_modemux[] = {
  1572. {
  1573. .muxregs = arm_trace_muxreg,
  1574. .nmuxregs = ARRAY_SIZE(arm_trace_muxreg),
  1575. },
  1576. };
  1577. static struct spear_pingroup arm_trace_pingroup = {
  1578. .name = "arm_trace_grp",
  1579. .pins = arm_trace_pins,
  1580. .npins = ARRAY_SIZE(arm_trace_pins),
  1581. .modemuxs = arm_trace_modemux,
  1582. .nmodemuxs = ARRAY_SIZE(arm_trace_modemux),
  1583. };
  1584. static const char *const arm_trace_grps[] = { "arm_trace_grp" };
  1585. static struct spear_function arm_trace_function = {
  1586. .name = "arm_trace",
  1587. .groups = arm_trace_grps,
  1588. .ngroups = ARRAY_SIZE(arm_trace_grps),
  1589. };
  1590. /* pad multiplexing for miphy_dbg device */
  1591. static const unsigned miphy_dbg_pins[] = { 96, 97, 98, 99, 100, 101, 102, 103,
  1592. 132, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147,
  1593. 148, 149, 150, 151, 152, 153, 154, 155, 156, 157 };
  1594. static struct spear_muxreg miphy_dbg_muxreg[] = {
  1595. {
  1596. .reg = PAD_SHARED_IP_EN_1,
  1597. .mask = MIPHY_DBG_MASK,
  1598. .val = MIPHY_DBG_MASK,
  1599. }, {
  1600. .reg = PAD_FUNCTION_EN_5,
  1601. .mask = DEVS_GRP_AND_MIPHY_DBG_REG4_MASK,
  1602. .val = DEVS_GRP_AND_MIPHY_DBG_REG4_MASK,
  1603. },
  1604. };
  1605. static struct spear_modemux miphy_dbg_modemux[] = {
  1606. {
  1607. .muxregs = miphy_dbg_muxreg,
  1608. .nmuxregs = ARRAY_SIZE(miphy_dbg_muxreg),
  1609. },
  1610. };
  1611. static struct spear_pingroup miphy_dbg_pingroup = {
  1612. .name = "miphy_dbg_grp",
  1613. .pins = miphy_dbg_pins,
  1614. .npins = ARRAY_SIZE(miphy_dbg_pins),
  1615. .modemuxs = miphy_dbg_modemux,
  1616. .nmodemuxs = ARRAY_SIZE(miphy_dbg_modemux),
  1617. };
  1618. static const char *const miphy_dbg_grps[] = { "miphy_dbg_grp" };
  1619. static struct spear_function miphy_dbg_function = {
  1620. .name = "miphy_dbg",
  1621. .groups = miphy_dbg_grps,
  1622. .ngroups = ARRAY_SIZE(miphy_dbg_grps),
  1623. };
  1624. /* pad multiplexing for pcie device */
  1625. static const unsigned pcie_pins[] = { 250 };
  1626. static struct spear_muxreg pcie_muxreg[] = {
  1627. {
  1628. .reg = PCIE_SATA_CFG,
  1629. .mask = SATA_PCIE_CFG_MASK,
  1630. .val = PCIE_CFG_VAL,
  1631. },
  1632. };
  1633. static struct spear_modemux pcie_modemux[] = {
  1634. {
  1635. .muxregs = pcie_muxreg,
  1636. .nmuxregs = ARRAY_SIZE(pcie_muxreg),
  1637. },
  1638. };
  1639. static struct spear_pingroup pcie_pingroup = {
  1640. .name = "pcie_grp",
  1641. .pins = pcie_pins,
  1642. .npins = ARRAY_SIZE(pcie_pins),
  1643. .modemuxs = pcie_modemux,
  1644. .nmodemuxs = ARRAY_SIZE(pcie_modemux),
  1645. };
  1646. static const char *const pcie_grps[] = { "pcie_grp" };
  1647. static struct spear_function pcie_function = {
  1648. .name = "pcie",
  1649. .groups = pcie_grps,
  1650. .ngroups = ARRAY_SIZE(pcie_grps),
  1651. };
  1652. /* pad multiplexing for sata device */
  1653. static const unsigned sata_pins[] = { 250 };
  1654. static struct spear_muxreg sata_muxreg[] = {
  1655. {
  1656. .reg = PCIE_SATA_CFG,
  1657. .mask = SATA_PCIE_CFG_MASK,
  1658. .val = SATA_CFG_VAL,
  1659. },
  1660. };
  1661. static struct spear_modemux sata_modemux[] = {
  1662. {
  1663. .muxregs = sata_muxreg,
  1664. .nmuxregs = ARRAY_SIZE(sata_muxreg),
  1665. },
  1666. };
  1667. static struct spear_pingroup sata_pingroup = {
  1668. .name = "sata_grp",
  1669. .pins = sata_pins,
  1670. .npins = ARRAY_SIZE(sata_pins),
  1671. .modemuxs = sata_modemux,
  1672. .nmodemuxs = ARRAY_SIZE(sata_modemux),
  1673. };
  1674. static const char *const sata_grps[] = { "sata_grp" };
  1675. static struct spear_function sata_function = {
  1676. .name = "sata",
  1677. .groups = sata_grps,
  1678. .ngroups = ARRAY_SIZE(sata_grps),
  1679. };
  1680. /* pingroups */
  1681. static struct spear_pingroup *spear1340_pingroups[] = {
  1682. &pads_as_gpio_pingroup,
  1683. &fsmc_8bit_pingroup,
  1684. &fsmc_16bit_pingroup,
  1685. &fsmc_pnor_pingroup,
  1686. &keyboard_row_col_pingroup,
  1687. &keyboard_col5_pingroup,
  1688. &spdif_in_pingroup,
  1689. &spdif_out_pingroup,
  1690. &gpt_0_1_pingroup,
  1691. &pwm0_pingroup,
  1692. &pwm1_pingroup,
  1693. &pwm2_pingroup,
  1694. &pwm3_pingroup,
  1695. &vip_mux_pingroup,
  1696. &vip_mux_cam0_pingroup,
  1697. &vip_mux_cam1_pingroup,
  1698. &vip_mux_cam2_pingroup,
  1699. &vip_mux_cam3_pingroup,
  1700. &cam0_pingroup,
  1701. &cam1_pingroup,
  1702. &cam2_pingroup,
  1703. &cam3_pingroup,
  1704. &smi_pingroup,
  1705. &ssp0_pingroup,
  1706. &ssp0_cs1_pingroup,
  1707. &ssp0_cs2_pingroup,
  1708. &ssp0_cs3_pingroup,
  1709. &uart0_pingroup,
  1710. &uart0_enh_pingroup,
  1711. &uart1_pingroup,
  1712. &i2s_in_pingroup,
  1713. &i2s_out_pingroup,
  1714. &gmii_pingroup,
  1715. &rgmii_pingroup,
  1716. &rmii_pingroup,
  1717. &sgmii_pingroup,
  1718. &i2c0_pingroup,
  1719. &i2c1_pingroup,
  1720. &cec0_pingroup,
  1721. &cec1_pingroup,
  1722. &sdhci_pingroup,
  1723. &cf_pingroup,
  1724. &xd_pingroup,
  1725. &clcd_sleep_pingroup,
  1726. &clcd_pingroup,
  1727. &arm_trace_pingroup,
  1728. &miphy_dbg_pingroup,
  1729. &pcie_pingroup,
  1730. &sata_pingroup,
  1731. };
  1732. /* functions */
  1733. static struct spear_function *spear1340_functions[] = {
  1734. &pads_as_gpio_function,
  1735. &fsmc_function,
  1736. &keyboard_function,
  1737. &spdif_in_function,
  1738. &spdif_out_function,
  1739. &gpt_0_1_function,
  1740. &pwm_function,
  1741. &vip_function,
  1742. &cam0_function,
  1743. &cam1_function,
  1744. &cam2_function,
  1745. &cam3_function,
  1746. &smi_function,
  1747. &ssp0_function,
  1748. &uart0_function,
  1749. &uart1_function,
  1750. &i2s_function,
  1751. &gmac_function,
  1752. &i2c0_function,
  1753. &i2c1_function,
  1754. &cec0_function,
  1755. &cec1_function,
  1756. &sdhci_function,
  1757. &cf_function,
  1758. &xd_function,
  1759. &clcd_function,
  1760. &arm_trace_function,
  1761. &miphy_dbg_function,
  1762. &pcie_function,
  1763. &sata_function,
  1764. };
  1765. static void gpio_request_endisable(struct spear_pmx *pmx, int pin,
  1766. bool enable)
  1767. {
  1768. unsigned int regoffset, regindex, bitoffset;
  1769. unsigned int val;
  1770. /* pin++ as gpio configuration starts from 2nd bit of base register */
  1771. pin++;
  1772. regindex = pin / 32;
  1773. bitoffset = pin % 32;
  1774. if (regindex <= 3)
  1775. regoffset = PAD_FUNCTION_EN_1 + regindex * sizeof(int *);
  1776. else
  1777. regoffset = PAD_FUNCTION_EN_5 + (regindex - 4) * sizeof(int *);
  1778. val = pmx_readl(pmx, regoffset);
  1779. if (enable)
  1780. val &= ~(0x1 << bitoffset);
  1781. else
  1782. val |= 0x1 << bitoffset;
  1783. pmx_writel(pmx, val, regoffset);
  1784. }
  1785. static struct spear_pinctrl_machdata spear1340_machdata = {
  1786. .pins = spear1340_pins,
  1787. .npins = ARRAY_SIZE(spear1340_pins),
  1788. .groups = spear1340_pingroups,
  1789. .ngroups = ARRAY_SIZE(spear1340_pingroups),
  1790. .functions = spear1340_functions,
  1791. .nfunctions = ARRAY_SIZE(spear1340_functions),
  1792. .gpio_request_endisable = gpio_request_endisable,
  1793. .modes_supported = false,
  1794. };
  1795. static const struct of_device_id spear1340_pinctrl_of_match[] = {
  1796. {
  1797. .compatible = "st,spear1340-pinmux",
  1798. },
  1799. {},
  1800. };
  1801. static int spear1340_pinctrl_probe(struct platform_device *pdev)
  1802. {
  1803. return spear_pinctrl_probe(pdev, &spear1340_machdata);
  1804. }
  1805. static struct platform_driver spear1340_pinctrl_driver = {
  1806. .driver = {
  1807. .name = DRIVER_NAME,
  1808. .of_match_table = spear1340_pinctrl_of_match,
  1809. },
  1810. .probe = spear1340_pinctrl_probe,
  1811. };
  1812. static int __init spear1340_pinctrl_init(void)
  1813. {
  1814. return platform_driver_register(&spear1340_pinctrl_driver);
  1815. }
  1816. arch_initcall(spear1340_pinctrl_init);
  1817. static void __exit spear1340_pinctrl_exit(void)
  1818. {
  1819. platform_driver_unregister(&spear1340_pinctrl_driver);
  1820. }
  1821. module_exit(spear1340_pinctrl_exit);
  1822. MODULE_AUTHOR("Viresh Kumar <vireshk@kernel.org>");
  1823. MODULE_DESCRIPTION("ST Microelectronics SPEAr1340 pinctrl driver");
  1824. MODULE_LICENSE("GPL v2");
  1825. MODULE_DEVICE_TABLE(of, spear1340_pinctrl_of_match);