pinctrl-cherryview.c 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519
  1. /*
  2. * Cherryview/Braswell pinctrl driver
  3. *
  4. * Copyright (C) 2014, Intel Corporation
  5. * Author: Mika Westerberg <mika.westerberg@linux.intel.com>
  6. *
  7. * This driver is based on the original Cherryview GPIO driver by
  8. * Ning Li <ning.li@intel.com>
  9. * Alan Cox <alan@linux.intel.com>
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. */
  15. #include <linux/kernel.h>
  16. #include <linux/module.h>
  17. #include <linux/init.h>
  18. #include <linux/types.h>
  19. #include <linux/gpio.h>
  20. #include <linux/gpio/driver.h>
  21. #include <linux/acpi.h>
  22. #include <linux/pinctrl/pinctrl.h>
  23. #include <linux/pinctrl/pinmux.h>
  24. #include <linux/pinctrl/pinconf.h>
  25. #include <linux/pinctrl/pinconf-generic.h>
  26. #include <linux/platform_device.h>
  27. #define CHV_INTSTAT 0x300
  28. #define CHV_INTMASK 0x380
  29. #define FAMILY_PAD_REGS_OFF 0x4400
  30. #define FAMILY_PAD_REGS_SIZE 0x400
  31. #define MAX_FAMILY_PAD_GPIO_NO 15
  32. #define GPIO_REGS_SIZE 8
  33. #define CHV_PADCTRL0 0x000
  34. #define CHV_PADCTRL0_INTSEL_SHIFT 28
  35. #define CHV_PADCTRL0_INTSEL_MASK (0xf << CHV_PADCTRL0_INTSEL_SHIFT)
  36. #define CHV_PADCTRL0_TERM_UP BIT(23)
  37. #define CHV_PADCTRL0_TERM_SHIFT 20
  38. #define CHV_PADCTRL0_TERM_MASK (7 << CHV_PADCTRL0_TERM_SHIFT)
  39. #define CHV_PADCTRL0_TERM_20K 1
  40. #define CHV_PADCTRL0_TERM_5K 2
  41. #define CHV_PADCTRL0_TERM_1K 4
  42. #define CHV_PADCTRL0_PMODE_SHIFT 16
  43. #define CHV_PADCTRL0_PMODE_MASK (0xf << CHV_PADCTRL0_PMODE_SHIFT)
  44. #define CHV_PADCTRL0_GPIOEN BIT(15)
  45. #define CHV_PADCTRL0_GPIOCFG_SHIFT 8
  46. #define CHV_PADCTRL0_GPIOCFG_MASK (7 << CHV_PADCTRL0_GPIOCFG_SHIFT)
  47. #define CHV_PADCTRL0_GPIOCFG_GPIO 0
  48. #define CHV_PADCTRL0_GPIOCFG_GPO 1
  49. #define CHV_PADCTRL0_GPIOCFG_GPI 2
  50. #define CHV_PADCTRL0_GPIOCFG_HIZ 3
  51. #define CHV_PADCTRL0_GPIOTXSTATE BIT(1)
  52. #define CHV_PADCTRL0_GPIORXSTATE BIT(0)
  53. #define CHV_PADCTRL1 0x004
  54. #define CHV_PADCTRL1_CFGLOCK BIT(31)
  55. #define CHV_PADCTRL1_INVRXTX_SHIFT 4
  56. #define CHV_PADCTRL1_INVRXTX_MASK (0xf << CHV_PADCTRL1_INVRXTX_SHIFT)
  57. #define CHV_PADCTRL1_INVRXTX_TXENABLE (2 << CHV_PADCTRL1_INVRXTX_SHIFT)
  58. #define CHV_PADCTRL1_ODEN BIT(3)
  59. #define CHV_PADCTRL1_INVRXTX_RXDATA (4 << CHV_PADCTRL1_INVRXTX_SHIFT)
  60. #define CHV_PADCTRL1_INTWAKECFG_MASK 7
  61. #define CHV_PADCTRL1_INTWAKECFG_FALLING 1
  62. #define CHV_PADCTRL1_INTWAKECFG_RISING 2
  63. #define CHV_PADCTRL1_INTWAKECFG_BOTH 3
  64. #define CHV_PADCTRL1_INTWAKECFG_LEVEL 4
  65. /**
  66. * struct chv_alternate_function - A per group or per pin alternate function
  67. * @pin: Pin number (only used in per pin configs)
  68. * @mode: Mode the pin should be set in
  69. * @invert_oe: Invert OE for this pin
  70. */
  71. struct chv_alternate_function {
  72. unsigned pin;
  73. u8 mode;
  74. bool invert_oe;
  75. };
  76. /**
  77. * struct chv_pincgroup - describes a CHV pin group
  78. * @name: Name of the group
  79. * @pins: An array of pins in this group
  80. * @npins: Number of pins in this group
  81. * @altfunc: Alternate function applied to all pins in this group
  82. * @overrides: Alternate function override per pin or %NULL if not used
  83. * @noverrides: Number of per pin alternate function overrides if
  84. * @overrides != NULL.
  85. */
  86. struct chv_pingroup {
  87. const char *name;
  88. const unsigned *pins;
  89. size_t npins;
  90. struct chv_alternate_function altfunc;
  91. const struct chv_alternate_function *overrides;
  92. size_t noverrides;
  93. };
  94. /**
  95. * struct chv_function - A CHV pinmux function
  96. * @name: Name of the function
  97. * @groups: An array of groups for this function
  98. * @ngroups: Number of groups in @groups
  99. */
  100. struct chv_function {
  101. const char *name;
  102. const char * const *groups;
  103. size_t ngroups;
  104. };
  105. /**
  106. * struct chv_gpio_pinrange - A range of pins that can be used as GPIOs
  107. * @base: Start pin number
  108. * @npins: Number of pins in this range
  109. */
  110. struct chv_gpio_pinrange {
  111. unsigned base;
  112. unsigned npins;
  113. };
  114. /**
  115. * struct chv_community - A community specific configuration
  116. * @uid: ACPI _UID used to match the community
  117. * @pins: All pins in this community
  118. * @npins: Number of pins
  119. * @groups: All groups in this community
  120. * @ngroups: Number of groups
  121. * @functions: All functions in this community
  122. * @nfunctions: Number of functions
  123. * @ngpios: Number of GPIOs in this community
  124. * @gpio_ranges: An array of GPIO ranges in this community
  125. * @ngpio_ranges: Number of GPIO ranges
  126. * @ngpios: Total number of GPIOs in this community
  127. */
  128. struct chv_community {
  129. const char *uid;
  130. const struct pinctrl_pin_desc *pins;
  131. size_t npins;
  132. const struct chv_pingroup *groups;
  133. size_t ngroups;
  134. const struct chv_function *functions;
  135. size_t nfunctions;
  136. const struct chv_gpio_pinrange *gpio_ranges;
  137. size_t ngpio_ranges;
  138. size_t ngpios;
  139. };
  140. /**
  141. * struct chv_pinctrl - CHV pinctrl private structure
  142. * @dev: Pointer to the parent device
  143. * @pctldesc: Pin controller description
  144. * @pctldev: Pointer to the pin controller device
  145. * @chip: GPIO chip in this pin controller
  146. * @regs: MMIO registers
  147. * @lock: Lock to serialize register accesses
  148. * @intr_lines: Stores mapping between 16 HW interrupt wires and GPIO
  149. * offset (in GPIO number space)
  150. * @community: Community this pinctrl instance represents
  151. *
  152. * The first group in @groups is expected to contain all pins that can be
  153. * used as GPIOs.
  154. */
  155. struct chv_pinctrl {
  156. struct device *dev;
  157. struct pinctrl_desc pctldesc;
  158. struct pinctrl_dev *pctldev;
  159. struct gpio_chip chip;
  160. void __iomem *regs;
  161. spinlock_t lock;
  162. unsigned intr_lines[16];
  163. const struct chv_community *community;
  164. };
  165. #define gpiochip_to_pinctrl(c) container_of(c, struct chv_pinctrl, chip)
  166. #define ALTERNATE_FUNCTION(p, m, i) \
  167. { \
  168. .pin = (p), \
  169. .mode = (m), \
  170. .invert_oe = (i), \
  171. }
  172. #define PIN_GROUP(n, p, m, i) \
  173. { \
  174. .name = (n), \
  175. .pins = (p), \
  176. .npins = ARRAY_SIZE((p)), \
  177. .altfunc.mode = (m), \
  178. .altfunc.invert_oe = (i), \
  179. }
  180. #define PIN_GROUP_WITH_OVERRIDE(n, p, m, i, o) \
  181. { \
  182. .name = (n), \
  183. .pins = (p), \
  184. .npins = ARRAY_SIZE((p)), \
  185. .altfunc.mode = (m), \
  186. .altfunc.invert_oe = (i), \
  187. .overrides = (o), \
  188. .noverrides = ARRAY_SIZE((o)), \
  189. }
  190. #define FUNCTION(n, g) \
  191. { \
  192. .name = (n), \
  193. .groups = (g), \
  194. .ngroups = ARRAY_SIZE((g)), \
  195. }
  196. #define GPIO_PINRANGE(start, end) \
  197. { \
  198. .base = (start), \
  199. .npins = (end) - (start) + 1, \
  200. }
  201. static const struct pinctrl_pin_desc southwest_pins[] = {
  202. PINCTRL_PIN(0, "FST_SPI_D2"),
  203. PINCTRL_PIN(1, "FST_SPI_D0"),
  204. PINCTRL_PIN(2, "FST_SPI_CLK"),
  205. PINCTRL_PIN(3, "FST_SPI_D3"),
  206. PINCTRL_PIN(4, "FST_SPI_CS1_B"),
  207. PINCTRL_PIN(5, "FST_SPI_D1"),
  208. PINCTRL_PIN(6, "FST_SPI_CS0_B"),
  209. PINCTRL_PIN(7, "FST_SPI_CS2_B"),
  210. PINCTRL_PIN(15, "UART1_RTS_B"),
  211. PINCTRL_PIN(16, "UART1_RXD"),
  212. PINCTRL_PIN(17, "UART2_RXD"),
  213. PINCTRL_PIN(18, "UART1_CTS_B"),
  214. PINCTRL_PIN(19, "UART2_RTS_B"),
  215. PINCTRL_PIN(20, "UART1_TXD"),
  216. PINCTRL_PIN(21, "UART2_TXD"),
  217. PINCTRL_PIN(22, "UART2_CTS_B"),
  218. PINCTRL_PIN(30, "MF_HDA_CLK"),
  219. PINCTRL_PIN(31, "MF_HDA_RSTB"),
  220. PINCTRL_PIN(32, "MF_HDA_SDIO"),
  221. PINCTRL_PIN(33, "MF_HDA_SDO"),
  222. PINCTRL_PIN(34, "MF_HDA_DOCKRSTB"),
  223. PINCTRL_PIN(35, "MF_HDA_SYNC"),
  224. PINCTRL_PIN(36, "MF_HDA_SDI1"),
  225. PINCTRL_PIN(37, "MF_HDA_DOCKENB"),
  226. PINCTRL_PIN(45, "I2C5_SDA"),
  227. PINCTRL_PIN(46, "I2C4_SDA"),
  228. PINCTRL_PIN(47, "I2C6_SDA"),
  229. PINCTRL_PIN(48, "I2C5_SCL"),
  230. PINCTRL_PIN(49, "I2C_NFC_SDA"),
  231. PINCTRL_PIN(50, "I2C4_SCL"),
  232. PINCTRL_PIN(51, "I2C6_SCL"),
  233. PINCTRL_PIN(52, "I2C_NFC_SCL"),
  234. PINCTRL_PIN(60, "I2C1_SDA"),
  235. PINCTRL_PIN(61, "I2C0_SDA"),
  236. PINCTRL_PIN(62, "I2C2_SDA"),
  237. PINCTRL_PIN(63, "I2C1_SCL"),
  238. PINCTRL_PIN(64, "I2C3_SDA"),
  239. PINCTRL_PIN(65, "I2C0_SCL"),
  240. PINCTRL_PIN(66, "I2C2_SCL"),
  241. PINCTRL_PIN(67, "I2C3_SCL"),
  242. PINCTRL_PIN(75, "SATA_GP0"),
  243. PINCTRL_PIN(76, "SATA_GP1"),
  244. PINCTRL_PIN(77, "SATA_LEDN"),
  245. PINCTRL_PIN(78, "SATA_GP2"),
  246. PINCTRL_PIN(79, "MF_SMB_ALERTB"),
  247. PINCTRL_PIN(80, "SATA_GP3"),
  248. PINCTRL_PIN(81, "MF_SMB_CLK"),
  249. PINCTRL_PIN(82, "MF_SMB_DATA"),
  250. PINCTRL_PIN(90, "PCIE_CLKREQ0B"),
  251. PINCTRL_PIN(91, "PCIE_CLKREQ1B"),
  252. PINCTRL_PIN(92, "GP_SSP_2_CLK"),
  253. PINCTRL_PIN(93, "PCIE_CLKREQ2B"),
  254. PINCTRL_PIN(94, "GP_SSP_2_RXD"),
  255. PINCTRL_PIN(95, "PCIE_CLKREQ3B"),
  256. PINCTRL_PIN(96, "GP_SSP_2_FS"),
  257. PINCTRL_PIN(97, "GP_SSP_2_TXD"),
  258. };
  259. static const unsigned southwest_fspi_pins[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
  260. static const unsigned southwest_uart0_pins[] = { 16, 20 };
  261. static const unsigned southwest_uart1_pins[] = { 15, 16, 18, 20 };
  262. static const unsigned southwest_uart2_pins[] = { 17, 19, 21, 22 };
  263. static const unsigned southwest_i2c0_pins[] = { 61, 65 };
  264. static const unsigned southwest_hda_pins[] = { 30, 31, 32, 33, 34, 35, 36, 37 };
  265. static const unsigned southwest_lpe_pins[] = {
  266. 30, 31, 32, 33, 34, 35, 36, 37, 92, 94, 96, 97,
  267. };
  268. static const unsigned southwest_i2c1_pins[] = { 60, 63 };
  269. static const unsigned southwest_i2c2_pins[] = { 62, 66 };
  270. static const unsigned southwest_i2c3_pins[] = { 64, 67 };
  271. static const unsigned southwest_i2c4_pins[] = { 46, 50 };
  272. static const unsigned southwest_i2c5_pins[] = { 45, 48 };
  273. static const unsigned southwest_i2c6_pins[] = { 47, 51 };
  274. static const unsigned southwest_i2c_nfc_pins[] = { 49, 52 };
  275. static const unsigned southwest_smbus_pins[] = { 79, 81, 82 };
  276. static const unsigned southwest_spi3_pins[] = { 76, 79, 80, 81, 82 };
  277. /* LPE I2S TXD pins need to have invert_oe set */
  278. static const struct chv_alternate_function southwest_lpe_altfuncs[] = {
  279. ALTERNATE_FUNCTION(30, 1, true),
  280. ALTERNATE_FUNCTION(34, 1, true),
  281. ALTERNATE_FUNCTION(97, 1, true),
  282. };
  283. /*
  284. * Two spi3 chipselects are available in different mode than the main spi3
  285. * functionality, which is using mode 1.
  286. */
  287. static const struct chv_alternate_function southwest_spi3_altfuncs[] = {
  288. ALTERNATE_FUNCTION(76, 3, false),
  289. ALTERNATE_FUNCTION(80, 3, false),
  290. };
  291. static const struct chv_pingroup southwest_groups[] = {
  292. PIN_GROUP("uart0_grp", southwest_uart0_pins, 2, false),
  293. PIN_GROUP("uart1_grp", southwest_uart1_pins, 1, false),
  294. PIN_GROUP("uart2_grp", southwest_uart2_pins, 1, false),
  295. PIN_GROUP("hda_grp", southwest_hda_pins, 2, false),
  296. PIN_GROUP("i2c0_grp", southwest_i2c0_pins, 1, true),
  297. PIN_GROUP("i2c1_grp", southwest_i2c1_pins, 1, true),
  298. PIN_GROUP("i2c2_grp", southwest_i2c2_pins, 1, true),
  299. PIN_GROUP("i2c3_grp", southwest_i2c3_pins, 1, true),
  300. PIN_GROUP("i2c4_grp", southwest_i2c4_pins, 1, true),
  301. PIN_GROUP("i2c5_grp", southwest_i2c5_pins, 1, true),
  302. PIN_GROUP("i2c6_grp", southwest_i2c6_pins, 1, true),
  303. PIN_GROUP("i2c_nfc_grp", southwest_i2c_nfc_pins, 2, true),
  304. PIN_GROUP_WITH_OVERRIDE("lpe_grp", southwest_lpe_pins, 1, false,
  305. southwest_lpe_altfuncs),
  306. PIN_GROUP_WITH_OVERRIDE("spi3_grp", southwest_spi3_pins, 2, false,
  307. southwest_spi3_altfuncs),
  308. };
  309. static const char * const southwest_uart0_groups[] = { "uart0_grp" };
  310. static const char * const southwest_uart1_groups[] = { "uart1_grp" };
  311. static const char * const southwest_uart2_groups[] = { "uart2_grp" };
  312. static const char * const southwest_hda_groups[] = { "hda_grp" };
  313. static const char * const southwest_lpe_groups[] = { "lpe_grp" };
  314. static const char * const southwest_i2c0_groups[] = { "i2c0_grp" };
  315. static const char * const southwest_i2c1_groups[] = { "i2c1_grp" };
  316. static const char * const southwest_i2c2_groups[] = { "i2c2_grp" };
  317. static const char * const southwest_i2c3_groups[] = { "i2c3_grp" };
  318. static const char * const southwest_i2c4_groups[] = { "i2c4_grp" };
  319. static const char * const southwest_i2c5_groups[] = { "i2c5_grp" };
  320. static const char * const southwest_i2c6_groups[] = { "i2c6_grp" };
  321. static const char * const southwest_i2c_nfc_groups[] = { "i2c_nfc_grp" };
  322. static const char * const southwest_spi3_groups[] = { "spi3_grp" };
  323. /*
  324. * Only do pinmuxing for certain LPSS devices for now. Rest of the pins are
  325. * enabled only as GPIOs.
  326. */
  327. static const struct chv_function southwest_functions[] = {
  328. FUNCTION("uart0", southwest_uart0_groups),
  329. FUNCTION("uart1", southwest_uart1_groups),
  330. FUNCTION("uart2", southwest_uart2_groups),
  331. FUNCTION("hda", southwest_hda_groups),
  332. FUNCTION("lpe", southwest_lpe_groups),
  333. FUNCTION("i2c0", southwest_i2c0_groups),
  334. FUNCTION("i2c1", southwest_i2c1_groups),
  335. FUNCTION("i2c2", southwest_i2c2_groups),
  336. FUNCTION("i2c3", southwest_i2c3_groups),
  337. FUNCTION("i2c4", southwest_i2c4_groups),
  338. FUNCTION("i2c5", southwest_i2c5_groups),
  339. FUNCTION("i2c6", southwest_i2c6_groups),
  340. FUNCTION("i2c_nfc", southwest_i2c_nfc_groups),
  341. FUNCTION("spi3", southwest_spi3_groups),
  342. };
  343. static const struct chv_gpio_pinrange southwest_gpio_ranges[] = {
  344. GPIO_PINRANGE(0, 7),
  345. GPIO_PINRANGE(15, 22),
  346. GPIO_PINRANGE(30, 37),
  347. GPIO_PINRANGE(45, 52),
  348. GPIO_PINRANGE(60, 67),
  349. GPIO_PINRANGE(75, 82),
  350. GPIO_PINRANGE(90, 97),
  351. };
  352. static const struct chv_community southwest_community = {
  353. .uid = "1",
  354. .pins = southwest_pins,
  355. .npins = ARRAY_SIZE(southwest_pins),
  356. .groups = southwest_groups,
  357. .ngroups = ARRAY_SIZE(southwest_groups),
  358. .functions = southwest_functions,
  359. .nfunctions = ARRAY_SIZE(southwest_functions),
  360. .gpio_ranges = southwest_gpio_ranges,
  361. .ngpio_ranges = ARRAY_SIZE(southwest_gpio_ranges),
  362. .ngpios = ARRAY_SIZE(southwest_pins),
  363. };
  364. static const struct pinctrl_pin_desc north_pins[] = {
  365. PINCTRL_PIN(0, "GPIO_DFX_0"),
  366. PINCTRL_PIN(1, "GPIO_DFX_3"),
  367. PINCTRL_PIN(2, "GPIO_DFX_7"),
  368. PINCTRL_PIN(3, "GPIO_DFX_1"),
  369. PINCTRL_PIN(4, "GPIO_DFX_5"),
  370. PINCTRL_PIN(5, "GPIO_DFX_4"),
  371. PINCTRL_PIN(6, "GPIO_DFX_8"),
  372. PINCTRL_PIN(7, "GPIO_DFX_2"),
  373. PINCTRL_PIN(8, "GPIO_DFX_6"),
  374. PINCTRL_PIN(15, "GPIO_SUS0"),
  375. PINCTRL_PIN(16, "SEC_GPIO_SUS10"),
  376. PINCTRL_PIN(17, "GPIO_SUS3"),
  377. PINCTRL_PIN(18, "GPIO_SUS7"),
  378. PINCTRL_PIN(19, "GPIO_SUS1"),
  379. PINCTRL_PIN(20, "GPIO_SUS5"),
  380. PINCTRL_PIN(21, "SEC_GPIO_SUS11"),
  381. PINCTRL_PIN(22, "GPIO_SUS4"),
  382. PINCTRL_PIN(23, "SEC_GPIO_SUS8"),
  383. PINCTRL_PIN(24, "GPIO_SUS2"),
  384. PINCTRL_PIN(25, "GPIO_SUS6"),
  385. PINCTRL_PIN(26, "CX_PREQ_B"),
  386. PINCTRL_PIN(27, "SEC_GPIO_SUS9"),
  387. PINCTRL_PIN(30, "TRST_B"),
  388. PINCTRL_PIN(31, "TCK"),
  389. PINCTRL_PIN(32, "PROCHOT_B"),
  390. PINCTRL_PIN(33, "SVIDO_DATA"),
  391. PINCTRL_PIN(34, "TMS"),
  392. PINCTRL_PIN(35, "CX_PRDY_B_2"),
  393. PINCTRL_PIN(36, "TDO_2"),
  394. PINCTRL_PIN(37, "CX_PRDY_B"),
  395. PINCTRL_PIN(38, "SVIDO_ALERT_B"),
  396. PINCTRL_PIN(39, "TDO"),
  397. PINCTRL_PIN(40, "SVIDO_CLK"),
  398. PINCTRL_PIN(41, "TDI"),
  399. PINCTRL_PIN(45, "GP_CAMERASB_05"),
  400. PINCTRL_PIN(46, "GP_CAMERASB_02"),
  401. PINCTRL_PIN(47, "GP_CAMERASB_08"),
  402. PINCTRL_PIN(48, "GP_CAMERASB_00"),
  403. PINCTRL_PIN(49, "GP_CAMERASB_06"),
  404. PINCTRL_PIN(50, "GP_CAMERASB_10"),
  405. PINCTRL_PIN(51, "GP_CAMERASB_03"),
  406. PINCTRL_PIN(52, "GP_CAMERASB_09"),
  407. PINCTRL_PIN(53, "GP_CAMERASB_01"),
  408. PINCTRL_PIN(54, "GP_CAMERASB_07"),
  409. PINCTRL_PIN(55, "GP_CAMERASB_11"),
  410. PINCTRL_PIN(56, "GP_CAMERASB_04"),
  411. PINCTRL_PIN(60, "PANEL0_BKLTEN"),
  412. PINCTRL_PIN(61, "HV_DDI0_HPD"),
  413. PINCTRL_PIN(62, "HV_DDI2_DDC_SDA"),
  414. PINCTRL_PIN(63, "PANEL1_BKLTCTL"),
  415. PINCTRL_PIN(64, "HV_DDI1_HPD"),
  416. PINCTRL_PIN(65, "PANEL0_BKLTCTL"),
  417. PINCTRL_PIN(66, "HV_DDI0_DDC_SDA"),
  418. PINCTRL_PIN(67, "HV_DDI2_DDC_SCL"),
  419. PINCTRL_PIN(68, "HV_DDI2_HPD"),
  420. PINCTRL_PIN(69, "PANEL1_VDDEN"),
  421. PINCTRL_PIN(70, "PANEL1_BKLTEN"),
  422. PINCTRL_PIN(71, "HV_DDI0_DDC_SCL"),
  423. PINCTRL_PIN(72, "PANEL0_VDDEN"),
  424. };
  425. static const struct chv_gpio_pinrange north_gpio_ranges[] = {
  426. GPIO_PINRANGE(0, 8),
  427. GPIO_PINRANGE(15, 27),
  428. GPIO_PINRANGE(30, 41),
  429. GPIO_PINRANGE(45, 56),
  430. GPIO_PINRANGE(60, 72),
  431. };
  432. static const struct chv_community north_community = {
  433. .uid = "2",
  434. .pins = north_pins,
  435. .npins = ARRAY_SIZE(north_pins),
  436. .gpio_ranges = north_gpio_ranges,
  437. .ngpio_ranges = ARRAY_SIZE(north_gpio_ranges),
  438. .ngpios = ARRAY_SIZE(north_pins),
  439. };
  440. static const struct pinctrl_pin_desc east_pins[] = {
  441. PINCTRL_PIN(0, "PMU_SLP_S3_B"),
  442. PINCTRL_PIN(1, "PMU_BATLOW_B"),
  443. PINCTRL_PIN(2, "SUS_STAT_B"),
  444. PINCTRL_PIN(3, "PMU_SLP_S0IX_B"),
  445. PINCTRL_PIN(4, "PMU_AC_PRESENT"),
  446. PINCTRL_PIN(5, "PMU_PLTRST_B"),
  447. PINCTRL_PIN(6, "PMU_SUSCLK"),
  448. PINCTRL_PIN(7, "PMU_SLP_LAN_B"),
  449. PINCTRL_PIN(8, "PMU_PWRBTN_B"),
  450. PINCTRL_PIN(9, "PMU_SLP_S4_B"),
  451. PINCTRL_PIN(10, "PMU_WAKE_B"),
  452. PINCTRL_PIN(11, "PMU_WAKE_LAN_B"),
  453. PINCTRL_PIN(15, "MF_ISH_GPIO_3"),
  454. PINCTRL_PIN(16, "MF_ISH_GPIO_7"),
  455. PINCTRL_PIN(17, "MF_ISH_I2C1_SCL"),
  456. PINCTRL_PIN(18, "MF_ISH_GPIO_1"),
  457. PINCTRL_PIN(19, "MF_ISH_GPIO_5"),
  458. PINCTRL_PIN(20, "MF_ISH_GPIO_9"),
  459. PINCTRL_PIN(21, "MF_ISH_GPIO_0"),
  460. PINCTRL_PIN(22, "MF_ISH_GPIO_4"),
  461. PINCTRL_PIN(23, "MF_ISH_GPIO_8"),
  462. PINCTRL_PIN(24, "MF_ISH_GPIO_2"),
  463. PINCTRL_PIN(25, "MF_ISH_GPIO_6"),
  464. PINCTRL_PIN(26, "MF_ISH_I2C1_SDA"),
  465. };
  466. static const struct chv_gpio_pinrange east_gpio_ranges[] = {
  467. GPIO_PINRANGE(0, 11),
  468. GPIO_PINRANGE(15, 26),
  469. };
  470. static const struct chv_community east_community = {
  471. .uid = "3",
  472. .pins = east_pins,
  473. .npins = ARRAY_SIZE(east_pins),
  474. .gpio_ranges = east_gpio_ranges,
  475. .ngpio_ranges = ARRAY_SIZE(east_gpio_ranges),
  476. .ngpios = ARRAY_SIZE(east_pins),
  477. };
  478. static const struct pinctrl_pin_desc southeast_pins[] = {
  479. PINCTRL_PIN(0, "MF_PLT_CLK0"),
  480. PINCTRL_PIN(1, "PWM1"),
  481. PINCTRL_PIN(2, "MF_PLT_CLK1"),
  482. PINCTRL_PIN(3, "MF_PLT_CLK4"),
  483. PINCTRL_PIN(4, "MF_PLT_CLK3"),
  484. PINCTRL_PIN(5, "PWM0"),
  485. PINCTRL_PIN(6, "MF_PLT_CLK5"),
  486. PINCTRL_PIN(7, "MF_PLT_CLK2"),
  487. PINCTRL_PIN(15, "SDMMC2_D3_CD_B"),
  488. PINCTRL_PIN(16, "SDMMC1_CLK"),
  489. PINCTRL_PIN(17, "SDMMC1_D0"),
  490. PINCTRL_PIN(18, "SDMMC2_D1"),
  491. PINCTRL_PIN(19, "SDMMC2_CLK"),
  492. PINCTRL_PIN(20, "SDMMC1_D2"),
  493. PINCTRL_PIN(21, "SDMMC2_D2"),
  494. PINCTRL_PIN(22, "SDMMC2_CMD"),
  495. PINCTRL_PIN(23, "SDMMC1_CMD"),
  496. PINCTRL_PIN(24, "SDMMC1_D1"),
  497. PINCTRL_PIN(25, "SDMMC2_D0"),
  498. PINCTRL_PIN(26, "SDMMC1_D3_CD_B"),
  499. PINCTRL_PIN(30, "SDMMC3_D1"),
  500. PINCTRL_PIN(31, "SDMMC3_CLK"),
  501. PINCTRL_PIN(32, "SDMMC3_D3"),
  502. PINCTRL_PIN(33, "SDMMC3_D2"),
  503. PINCTRL_PIN(34, "SDMMC3_CMD"),
  504. PINCTRL_PIN(35, "SDMMC3_D0"),
  505. PINCTRL_PIN(45, "MF_LPC_AD2"),
  506. PINCTRL_PIN(46, "LPC_CLKRUNB"),
  507. PINCTRL_PIN(47, "MF_LPC_AD0"),
  508. PINCTRL_PIN(48, "LPC_FRAMEB"),
  509. PINCTRL_PIN(49, "MF_LPC_CLKOUT1"),
  510. PINCTRL_PIN(50, "MF_LPC_AD3"),
  511. PINCTRL_PIN(51, "MF_LPC_CLKOUT0"),
  512. PINCTRL_PIN(52, "MF_LPC_AD1"),
  513. PINCTRL_PIN(60, "SPI1_MISO"),
  514. PINCTRL_PIN(61, "SPI1_CSO_B"),
  515. PINCTRL_PIN(62, "SPI1_CLK"),
  516. PINCTRL_PIN(63, "MMC1_D6"),
  517. PINCTRL_PIN(64, "SPI1_MOSI"),
  518. PINCTRL_PIN(65, "MMC1_D5"),
  519. PINCTRL_PIN(66, "SPI1_CS1_B"),
  520. PINCTRL_PIN(67, "MMC1_D4_SD_WE"),
  521. PINCTRL_PIN(68, "MMC1_D7"),
  522. PINCTRL_PIN(69, "MMC1_RCLK"),
  523. PINCTRL_PIN(75, "USB_OC1_B"),
  524. PINCTRL_PIN(76, "PMU_RESETBUTTON_B"),
  525. PINCTRL_PIN(77, "GPIO_ALERT"),
  526. PINCTRL_PIN(78, "SDMMC3_PWR_EN_B"),
  527. PINCTRL_PIN(79, "ILB_SERIRQ"),
  528. PINCTRL_PIN(80, "USB_OC0_B"),
  529. PINCTRL_PIN(81, "SDMMC3_CD_B"),
  530. PINCTRL_PIN(82, "SPKR"),
  531. PINCTRL_PIN(83, "SUSPWRDNACK"),
  532. PINCTRL_PIN(84, "SPARE_PIN"),
  533. PINCTRL_PIN(85, "SDMMC3_1P8_EN"),
  534. };
  535. static const unsigned southeast_pwm0_pins[] = { 5 };
  536. static const unsigned southeast_pwm1_pins[] = { 1 };
  537. static const unsigned southeast_sdmmc1_pins[] = {
  538. 16, 17, 20, 23, 24, 26, 63, 65, 67, 68, 69,
  539. };
  540. static const unsigned southeast_sdmmc2_pins[] = { 15, 18, 19, 21, 22, 25 };
  541. static const unsigned southeast_sdmmc3_pins[] = {
  542. 30, 31, 32, 33, 34, 35, 78, 81, 85,
  543. };
  544. static const unsigned southeast_spi1_pins[] = { 60, 61, 62, 64, 66 };
  545. static const unsigned southeast_spi2_pins[] = { 2, 3, 4, 6, 7 };
  546. static const struct chv_pingroup southeast_groups[] = {
  547. PIN_GROUP("pwm0_grp", southeast_pwm0_pins, 1, false),
  548. PIN_GROUP("pwm1_grp", southeast_pwm1_pins, 1, false),
  549. PIN_GROUP("sdmmc1_grp", southeast_sdmmc1_pins, 1, false),
  550. PIN_GROUP("sdmmc2_grp", southeast_sdmmc2_pins, 1, false),
  551. PIN_GROUP("sdmmc3_grp", southeast_sdmmc3_pins, 1, false),
  552. PIN_GROUP("spi1_grp", southeast_spi1_pins, 1, false),
  553. PIN_GROUP("spi2_grp", southeast_spi2_pins, 4, false),
  554. };
  555. static const char * const southeast_pwm0_groups[] = { "pwm0_grp" };
  556. static const char * const southeast_pwm1_groups[] = { "pwm1_grp" };
  557. static const char * const southeast_sdmmc1_groups[] = { "sdmmc1_grp" };
  558. static const char * const southeast_sdmmc2_groups[] = { "sdmmc2_grp" };
  559. static const char * const southeast_sdmmc3_groups[] = { "sdmmc3_grp" };
  560. static const char * const southeast_spi1_groups[] = { "spi1_grp" };
  561. static const char * const southeast_spi2_groups[] = { "spi2_grp" };
  562. static const struct chv_function southeast_functions[] = {
  563. FUNCTION("pwm0", southeast_pwm0_groups),
  564. FUNCTION("pwm1", southeast_pwm1_groups),
  565. FUNCTION("sdmmc1", southeast_sdmmc1_groups),
  566. FUNCTION("sdmmc2", southeast_sdmmc2_groups),
  567. FUNCTION("sdmmc3", southeast_sdmmc3_groups),
  568. FUNCTION("spi1", southeast_spi1_groups),
  569. FUNCTION("spi2", southeast_spi2_groups),
  570. };
  571. static const struct chv_gpio_pinrange southeast_gpio_ranges[] = {
  572. GPIO_PINRANGE(0, 7),
  573. GPIO_PINRANGE(15, 26),
  574. GPIO_PINRANGE(30, 35),
  575. GPIO_PINRANGE(45, 52),
  576. GPIO_PINRANGE(60, 69),
  577. GPIO_PINRANGE(75, 85),
  578. };
  579. static const struct chv_community southeast_community = {
  580. .uid = "4",
  581. .pins = southeast_pins,
  582. .npins = ARRAY_SIZE(southeast_pins),
  583. .groups = southeast_groups,
  584. .ngroups = ARRAY_SIZE(southeast_groups),
  585. .functions = southeast_functions,
  586. .nfunctions = ARRAY_SIZE(southeast_functions),
  587. .gpio_ranges = southeast_gpio_ranges,
  588. .ngpio_ranges = ARRAY_SIZE(southeast_gpio_ranges),
  589. .ngpios = ARRAY_SIZE(southeast_pins),
  590. };
  591. static const struct chv_community *chv_communities[] = {
  592. &southwest_community,
  593. &north_community,
  594. &east_community,
  595. &southeast_community,
  596. };
  597. static void __iomem *chv_padreg(struct chv_pinctrl *pctrl, unsigned offset,
  598. unsigned reg)
  599. {
  600. unsigned family_no = offset / MAX_FAMILY_PAD_GPIO_NO;
  601. unsigned pad_no = offset % MAX_FAMILY_PAD_GPIO_NO;
  602. offset = FAMILY_PAD_REGS_OFF + FAMILY_PAD_REGS_SIZE * family_no +
  603. GPIO_REGS_SIZE * pad_no;
  604. return pctrl->regs + offset + reg;
  605. }
  606. static void chv_writel(u32 value, void __iomem *reg)
  607. {
  608. writel(value, reg);
  609. /* simple readback to confirm the bus transferring done */
  610. readl(reg);
  611. }
  612. /* When Pad Cfg is locked, driver can only change GPIOTXState or GPIORXState */
  613. static bool chv_pad_locked(struct chv_pinctrl *pctrl, unsigned offset)
  614. {
  615. void __iomem *reg;
  616. reg = chv_padreg(pctrl, offset, CHV_PADCTRL1);
  617. return readl(reg) & CHV_PADCTRL1_CFGLOCK;
  618. }
  619. static int chv_get_groups_count(struct pinctrl_dev *pctldev)
  620. {
  621. struct chv_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
  622. return pctrl->community->ngroups;
  623. }
  624. static const char *chv_get_group_name(struct pinctrl_dev *pctldev,
  625. unsigned group)
  626. {
  627. struct chv_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
  628. return pctrl->community->groups[group].name;
  629. }
  630. static int chv_get_group_pins(struct pinctrl_dev *pctldev, unsigned group,
  631. const unsigned **pins, unsigned *npins)
  632. {
  633. struct chv_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
  634. *pins = pctrl->community->groups[group].pins;
  635. *npins = pctrl->community->groups[group].npins;
  636. return 0;
  637. }
  638. static void chv_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
  639. unsigned offset)
  640. {
  641. struct chv_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
  642. unsigned long flags;
  643. u32 ctrl0, ctrl1;
  644. bool locked;
  645. spin_lock_irqsave(&pctrl->lock, flags);
  646. ctrl0 = readl(chv_padreg(pctrl, offset, CHV_PADCTRL0));
  647. ctrl1 = readl(chv_padreg(pctrl, offset, CHV_PADCTRL1));
  648. locked = chv_pad_locked(pctrl, offset);
  649. spin_unlock_irqrestore(&pctrl->lock, flags);
  650. if (ctrl0 & CHV_PADCTRL0_GPIOEN) {
  651. seq_puts(s, "GPIO ");
  652. } else {
  653. u32 mode;
  654. mode = ctrl0 & CHV_PADCTRL0_PMODE_MASK;
  655. mode >>= CHV_PADCTRL0_PMODE_SHIFT;
  656. seq_printf(s, "mode %d ", mode);
  657. }
  658. seq_printf(s, "ctrl0 0x%08x ctrl1 0x%08x", ctrl0, ctrl1);
  659. if (locked)
  660. seq_puts(s, " [LOCKED]");
  661. }
  662. static const struct pinctrl_ops chv_pinctrl_ops = {
  663. .get_groups_count = chv_get_groups_count,
  664. .get_group_name = chv_get_group_name,
  665. .get_group_pins = chv_get_group_pins,
  666. .pin_dbg_show = chv_pin_dbg_show,
  667. };
  668. static int chv_get_functions_count(struct pinctrl_dev *pctldev)
  669. {
  670. struct chv_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
  671. return pctrl->community->nfunctions;
  672. }
  673. static const char *chv_get_function_name(struct pinctrl_dev *pctldev,
  674. unsigned function)
  675. {
  676. struct chv_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
  677. return pctrl->community->functions[function].name;
  678. }
  679. static int chv_get_function_groups(struct pinctrl_dev *pctldev,
  680. unsigned function,
  681. const char * const **groups,
  682. unsigned * const ngroups)
  683. {
  684. struct chv_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
  685. *groups = pctrl->community->functions[function].groups;
  686. *ngroups = pctrl->community->functions[function].ngroups;
  687. return 0;
  688. }
  689. static int chv_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned function,
  690. unsigned group)
  691. {
  692. struct chv_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
  693. const struct chv_pingroup *grp;
  694. unsigned long flags;
  695. int i;
  696. grp = &pctrl->community->groups[group];
  697. spin_lock_irqsave(&pctrl->lock, flags);
  698. /* Check first that the pad is not locked */
  699. for (i = 0; i < grp->npins; i++) {
  700. if (chv_pad_locked(pctrl, grp->pins[i])) {
  701. dev_warn(pctrl->dev, "unable to set mode for locked pin %u\n",
  702. grp->pins[i]);
  703. spin_unlock_irqrestore(&pctrl->lock, flags);
  704. return -EBUSY;
  705. }
  706. }
  707. for (i = 0; i < grp->npins; i++) {
  708. const struct chv_alternate_function *altfunc = &grp->altfunc;
  709. int pin = grp->pins[i];
  710. void __iomem *reg;
  711. u32 value;
  712. /* Check if there is pin-specific config */
  713. if (grp->overrides) {
  714. int j;
  715. for (j = 0; j < grp->noverrides; j++) {
  716. if (grp->overrides[j].pin == pin) {
  717. altfunc = &grp->overrides[j];
  718. break;
  719. }
  720. }
  721. }
  722. reg = chv_padreg(pctrl, pin, CHV_PADCTRL0);
  723. value = readl(reg);
  724. /* Disable GPIO mode */
  725. value &= ~CHV_PADCTRL0_GPIOEN;
  726. /* Set to desired mode */
  727. value &= ~CHV_PADCTRL0_PMODE_MASK;
  728. value |= altfunc->mode << CHV_PADCTRL0_PMODE_SHIFT;
  729. chv_writel(value, reg);
  730. /* Update for invert_oe */
  731. reg = chv_padreg(pctrl, pin, CHV_PADCTRL1);
  732. value = readl(reg) & ~CHV_PADCTRL1_INVRXTX_MASK;
  733. if (altfunc->invert_oe)
  734. value |= CHV_PADCTRL1_INVRXTX_TXENABLE;
  735. chv_writel(value, reg);
  736. dev_dbg(pctrl->dev, "configured pin %u mode %u OE %sinverted\n",
  737. pin, altfunc->mode, altfunc->invert_oe ? "" : "not ");
  738. }
  739. spin_unlock_irqrestore(&pctrl->lock, flags);
  740. return 0;
  741. }
  742. static int chv_gpio_request_enable(struct pinctrl_dev *pctldev,
  743. struct pinctrl_gpio_range *range,
  744. unsigned offset)
  745. {
  746. struct chv_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
  747. unsigned long flags;
  748. void __iomem *reg;
  749. u32 value;
  750. spin_lock_irqsave(&pctrl->lock, flags);
  751. if (chv_pad_locked(pctrl, offset)) {
  752. value = readl(chv_padreg(pctrl, offset, CHV_PADCTRL0));
  753. if (!(value & CHV_PADCTRL0_GPIOEN)) {
  754. /* Locked so cannot enable */
  755. spin_unlock_irqrestore(&pctrl->lock, flags);
  756. return -EBUSY;
  757. }
  758. } else {
  759. int i;
  760. /* Reset the interrupt mapping */
  761. for (i = 0; i < ARRAY_SIZE(pctrl->intr_lines); i++) {
  762. if (pctrl->intr_lines[i] == offset) {
  763. pctrl->intr_lines[i] = 0;
  764. break;
  765. }
  766. }
  767. /* Disable interrupt generation */
  768. reg = chv_padreg(pctrl, offset, CHV_PADCTRL1);
  769. value = readl(reg);
  770. value &= ~CHV_PADCTRL1_INTWAKECFG_MASK;
  771. value &= ~CHV_PADCTRL1_INVRXTX_MASK;
  772. chv_writel(value, reg);
  773. /* Switch to a GPIO mode */
  774. reg = chv_padreg(pctrl, offset, CHV_PADCTRL0);
  775. value = readl(reg) | CHV_PADCTRL0_GPIOEN;
  776. chv_writel(value, reg);
  777. }
  778. spin_unlock_irqrestore(&pctrl->lock, flags);
  779. return 0;
  780. }
  781. static void chv_gpio_disable_free(struct pinctrl_dev *pctldev,
  782. struct pinctrl_gpio_range *range,
  783. unsigned offset)
  784. {
  785. struct chv_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
  786. unsigned long flags;
  787. void __iomem *reg;
  788. u32 value;
  789. spin_lock_irqsave(&pctrl->lock, flags);
  790. reg = chv_padreg(pctrl, offset, CHV_PADCTRL0);
  791. value = readl(reg) & ~CHV_PADCTRL0_GPIOEN;
  792. chv_writel(value, reg);
  793. spin_unlock_irqrestore(&pctrl->lock, flags);
  794. }
  795. static int chv_gpio_set_direction(struct pinctrl_dev *pctldev,
  796. struct pinctrl_gpio_range *range,
  797. unsigned offset, bool input)
  798. {
  799. struct chv_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
  800. void __iomem *reg = chv_padreg(pctrl, offset, CHV_PADCTRL0);
  801. unsigned long flags;
  802. u32 ctrl0;
  803. spin_lock_irqsave(&pctrl->lock, flags);
  804. ctrl0 = readl(reg) & ~CHV_PADCTRL0_GPIOCFG_MASK;
  805. if (input)
  806. ctrl0 |= CHV_PADCTRL0_GPIOCFG_GPI << CHV_PADCTRL0_GPIOCFG_SHIFT;
  807. else
  808. ctrl0 |= CHV_PADCTRL0_GPIOCFG_GPO << CHV_PADCTRL0_GPIOCFG_SHIFT;
  809. chv_writel(ctrl0, reg);
  810. spin_unlock_irqrestore(&pctrl->lock, flags);
  811. return 0;
  812. }
  813. static const struct pinmux_ops chv_pinmux_ops = {
  814. .get_functions_count = chv_get_functions_count,
  815. .get_function_name = chv_get_function_name,
  816. .get_function_groups = chv_get_function_groups,
  817. .set_mux = chv_pinmux_set_mux,
  818. .gpio_request_enable = chv_gpio_request_enable,
  819. .gpio_disable_free = chv_gpio_disable_free,
  820. .gpio_set_direction = chv_gpio_set_direction,
  821. };
  822. static int chv_config_get(struct pinctrl_dev *pctldev, unsigned pin,
  823. unsigned long *config)
  824. {
  825. struct chv_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
  826. enum pin_config_param param = pinconf_to_config_param(*config);
  827. unsigned long flags;
  828. u32 ctrl0, ctrl1;
  829. u16 arg = 0;
  830. u32 term;
  831. spin_lock_irqsave(&pctrl->lock, flags);
  832. ctrl0 = readl(chv_padreg(pctrl, pin, CHV_PADCTRL0));
  833. ctrl1 = readl(chv_padreg(pctrl, pin, CHV_PADCTRL1));
  834. spin_unlock_irqrestore(&pctrl->lock, flags);
  835. term = (ctrl0 & CHV_PADCTRL0_TERM_MASK) >> CHV_PADCTRL0_TERM_SHIFT;
  836. switch (param) {
  837. case PIN_CONFIG_BIAS_DISABLE:
  838. if (term)
  839. return -EINVAL;
  840. break;
  841. case PIN_CONFIG_BIAS_PULL_UP:
  842. if (!(ctrl0 & CHV_PADCTRL0_TERM_UP))
  843. return -EINVAL;
  844. switch (term) {
  845. case CHV_PADCTRL0_TERM_20K:
  846. arg = 20000;
  847. break;
  848. case CHV_PADCTRL0_TERM_5K:
  849. arg = 5000;
  850. break;
  851. case CHV_PADCTRL0_TERM_1K:
  852. arg = 1000;
  853. break;
  854. }
  855. break;
  856. case PIN_CONFIG_BIAS_PULL_DOWN:
  857. if (!term || (ctrl0 & CHV_PADCTRL0_TERM_UP))
  858. return -EINVAL;
  859. switch (term) {
  860. case CHV_PADCTRL0_TERM_20K:
  861. arg = 20000;
  862. break;
  863. case CHV_PADCTRL0_TERM_5K:
  864. arg = 5000;
  865. break;
  866. }
  867. break;
  868. case PIN_CONFIG_DRIVE_OPEN_DRAIN:
  869. if (!(ctrl1 & CHV_PADCTRL1_ODEN))
  870. return -EINVAL;
  871. break;
  872. case PIN_CONFIG_BIAS_HIGH_IMPEDANCE: {
  873. u32 cfg;
  874. cfg = ctrl0 & CHV_PADCTRL0_GPIOCFG_MASK;
  875. cfg >>= CHV_PADCTRL0_GPIOCFG_SHIFT;
  876. if (cfg != CHV_PADCTRL0_GPIOCFG_HIZ)
  877. return -EINVAL;
  878. break;
  879. }
  880. default:
  881. return -ENOTSUPP;
  882. }
  883. *config = pinconf_to_config_packed(param, arg);
  884. return 0;
  885. }
  886. static int chv_config_set_pull(struct chv_pinctrl *pctrl, unsigned pin,
  887. enum pin_config_param param, u16 arg)
  888. {
  889. void __iomem *reg = chv_padreg(pctrl, pin, CHV_PADCTRL0);
  890. unsigned long flags;
  891. u32 ctrl0, pull;
  892. spin_lock_irqsave(&pctrl->lock, flags);
  893. ctrl0 = readl(reg);
  894. switch (param) {
  895. case PIN_CONFIG_BIAS_DISABLE:
  896. ctrl0 &= ~(CHV_PADCTRL0_TERM_MASK | CHV_PADCTRL0_TERM_UP);
  897. break;
  898. case PIN_CONFIG_BIAS_PULL_UP:
  899. ctrl0 &= ~(CHV_PADCTRL0_TERM_MASK | CHV_PADCTRL0_TERM_UP);
  900. switch (arg) {
  901. case 1000:
  902. /* For 1k there is only pull up */
  903. pull = CHV_PADCTRL0_TERM_1K << CHV_PADCTRL0_TERM_SHIFT;
  904. break;
  905. case 5000:
  906. pull = CHV_PADCTRL0_TERM_5K << CHV_PADCTRL0_TERM_SHIFT;
  907. break;
  908. case 20000:
  909. pull = CHV_PADCTRL0_TERM_20K << CHV_PADCTRL0_TERM_SHIFT;
  910. break;
  911. default:
  912. spin_unlock_irqrestore(&pctrl->lock, flags);
  913. return -EINVAL;
  914. }
  915. ctrl0 |= CHV_PADCTRL0_TERM_UP | pull;
  916. break;
  917. case PIN_CONFIG_BIAS_PULL_DOWN:
  918. ctrl0 &= ~(CHV_PADCTRL0_TERM_MASK | CHV_PADCTRL0_TERM_UP);
  919. switch (arg) {
  920. case 5000:
  921. pull = CHV_PADCTRL0_TERM_5K << CHV_PADCTRL0_TERM_SHIFT;
  922. break;
  923. case 20000:
  924. pull = CHV_PADCTRL0_TERM_20K << CHV_PADCTRL0_TERM_SHIFT;
  925. break;
  926. default:
  927. spin_unlock_irqrestore(&pctrl->lock, flags);
  928. return -EINVAL;
  929. }
  930. ctrl0 |= pull;
  931. break;
  932. default:
  933. spin_unlock_irqrestore(&pctrl->lock, flags);
  934. return -EINVAL;
  935. }
  936. chv_writel(ctrl0, reg);
  937. spin_unlock_irqrestore(&pctrl->lock, flags);
  938. return 0;
  939. }
  940. static int chv_config_set(struct pinctrl_dev *pctldev, unsigned pin,
  941. unsigned long *configs, unsigned nconfigs)
  942. {
  943. struct chv_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
  944. enum pin_config_param param;
  945. int i, ret;
  946. u16 arg;
  947. if (chv_pad_locked(pctrl, pin))
  948. return -EBUSY;
  949. for (i = 0; i < nconfigs; i++) {
  950. param = pinconf_to_config_param(configs[i]);
  951. arg = pinconf_to_config_argument(configs[i]);
  952. switch (param) {
  953. case PIN_CONFIG_BIAS_DISABLE:
  954. case PIN_CONFIG_BIAS_PULL_UP:
  955. case PIN_CONFIG_BIAS_PULL_DOWN:
  956. ret = chv_config_set_pull(pctrl, pin, param, arg);
  957. if (ret)
  958. return ret;
  959. break;
  960. default:
  961. return -ENOTSUPP;
  962. }
  963. dev_dbg(pctrl->dev, "pin %d set config %d arg %u\n", pin,
  964. param, arg);
  965. }
  966. return 0;
  967. }
  968. static const struct pinconf_ops chv_pinconf_ops = {
  969. .is_generic = true,
  970. .pin_config_set = chv_config_set,
  971. .pin_config_get = chv_config_get,
  972. };
  973. static struct pinctrl_desc chv_pinctrl_desc = {
  974. .pctlops = &chv_pinctrl_ops,
  975. .pmxops = &chv_pinmux_ops,
  976. .confops = &chv_pinconf_ops,
  977. .owner = THIS_MODULE,
  978. };
  979. static int chv_gpio_request(struct gpio_chip *chip, unsigned offset)
  980. {
  981. return pinctrl_request_gpio(chip->base + offset);
  982. }
  983. static void chv_gpio_free(struct gpio_chip *chip, unsigned offset)
  984. {
  985. pinctrl_free_gpio(chip->base + offset);
  986. }
  987. static unsigned chv_gpio_offset_to_pin(struct chv_pinctrl *pctrl,
  988. unsigned offset)
  989. {
  990. return pctrl->community->pins[offset].number;
  991. }
  992. static int chv_gpio_get(struct gpio_chip *chip, unsigned offset)
  993. {
  994. struct chv_pinctrl *pctrl = gpiochip_to_pinctrl(chip);
  995. int pin = chv_gpio_offset_to_pin(pctrl, offset);
  996. u32 ctrl0, cfg;
  997. ctrl0 = readl(chv_padreg(pctrl, pin, CHV_PADCTRL0));
  998. cfg = ctrl0 & CHV_PADCTRL0_GPIOCFG_MASK;
  999. cfg >>= CHV_PADCTRL0_GPIOCFG_SHIFT;
  1000. if (cfg == CHV_PADCTRL0_GPIOCFG_GPO)
  1001. return !!(ctrl0 & CHV_PADCTRL0_GPIOTXSTATE);
  1002. return !!(ctrl0 & CHV_PADCTRL0_GPIORXSTATE);
  1003. }
  1004. static void chv_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
  1005. {
  1006. struct chv_pinctrl *pctrl = gpiochip_to_pinctrl(chip);
  1007. unsigned pin = chv_gpio_offset_to_pin(pctrl, offset);
  1008. unsigned long flags;
  1009. void __iomem *reg;
  1010. u32 ctrl0;
  1011. spin_lock_irqsave(&pctrl->lock, flags);
  1012. reg = chv_padreg(pctrl, pin, CHV_PADCTRL0);
  1013. ctrl0 = readl(reg);
  1014. if (value)
  1015. ctrl0 |= CHV_PADCTRL0_GPIOTXSTATE;
  1016. else
  1017. ctrl0 &= ~CHV_PADCTRL0_GPIOTXSTATE;
  1018. chv_writel(ctrl0, reg);
  1019. spin_unlock_irqrestore(&pctrl->lock, flags);
  1020. }
  1021. static int chv_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
  1022. {
  1023. struct chv_pinctrl *pctrl = gpiochip_to_pinctrl(chip);
  1024. unsigned pin = chv_gpio_offset_to_pin(pctrl, offset);
  1025. u32 ctrl0, direction;
  1026. ctrl0 = readl(chv_padreg(pctrl, pin, CHV_PADCTRL0));
  1027. direction = ctrl0 & CHV_PADCTRL0_GPIOCFG_MASK;
  1028. direction >>= CHV_PADCTRL0_GPIOCFG_SHIFT;
  1029. return direction != CHV_PADCTRL0_GPIOCFG_GPO;
  1030. }
  1031. static int chv_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
  1032. {
  1033. return pinctrl_gpio_direction_input(chip->base + offset);
  1034. }
  1035. static int chv_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
  1036. int value)
  1037. {
  1038. return pinctrl_gpio_direction_output(chip->base + offset);
  1039. }
  1040. static const struct gpio_chip chv_gpio_chip = {
  1041. .owner = THIS_MODULE,
  1042. .request = chv_gpio_request,
  1043. .free = chv_gpio_free,
  1044. .get_direction = chv_gpio_get_direction,
  1045. .direction_input = chv_gpio_direction_input,
  1046. .direction_output = chv_gpio_direction_output,
  1047. .get = chv_gpio_get,
  1048. .set = chv_gpio_set,
  1049. };
  1050. static void chv_gpio_irq_ack(struct irq_data *d)
  1051. {
  1052. struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
  1053. struct chv_pinctrl *pctrl = gpiochip_to_pinctrl(gc);
  1054. int pin = chv_gpio_offset_to_pin(pctrl, irqd_to_hwirq(d));
  1055. u32 intr_line;
  1056. spin_lock(&pctrl->lock);
  1057. intr_line = readl(chv_padreg(pctrl, pin, CHV_PADCTRL0));
  1058. intr_line &= CHV_PADCTRL0_INTSEL_MASK;
  1059. intr_line >>= CHV_PADCTRL0_INTSEL_SHIFT;
  1060. chv_writel(BIT(intr_line), pctrl->regs + CHV_INTSTAT);
  1061. spin_unlock(&pctrl->lock);
  1062. }
  1063. static void chv_gpio_irq_mask_unmask(struct irq_data *d, bool mask)
  1064. {
  1065. struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
  1066. struct chv_pinctrl *pctrl = gpiochip_to_pinctrl(gc);
  1067. int pin = chv_gpio_offset_to_pin(pctrl, irqd_to_hwirq(d));
  1068. u32 value, intr_line;
  1069. unsigned long flags;
  1070. spin_lock_irqsave(&pctrl->lock, flags);
  1071. intr_line = readl(chv_padreg(pctrl, pin, CHV_PADCTRL0));
  1072. intr_line &= CHV_PADCTRL0_INTSEL_MASK;
  1073. intr_line >>= CHV_PADCTRL0_INTSEL_SHIFT;
  1074. value = readl(pctrl->regs + CHV_INTMASK);
  1075. if (mask)
  1076. value &= ~BIT(intr_line);
  1077. else
  1078. value |= BIT(intr_line);
  1079. chv_writel(value, pctrl->regs + CHV_INTMASK);
  1080. spin_unlock_irqrestore(&pctrl->lock, flags);
  1081. }
  1082. static void chv_gpio_irq_mask(struct irq_data *d)
  1083. {
  1084. chv_gpio_irq_mask_unmask(d, true);
  1085. }
  1086. static void chv_gpio_irq_unmask(struct irq_data *d)
  1087. {
  1088. chv_gpio_irq_mask_unmask(d, false);
  1089. }
  1090. static int chv_gpio_irq_type(struct irq_data *d, unsigned type)
  1091. {
  1092. struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
  1093. struct chv_pinctrl *pctrl = gpiochip_to_pinctrl(gc);
  1094. unsigned offset = irqd_to_hwirq(d);
  1095. int pin = chv_gpio_offset_to_pin(pctrl, offset);
  1096. unsigned long flags;
  1097. u32 value;
  1098. spin_lock_irqsave(&pctrl->lock, flags);
  1099. /*
  1100. * Pins which can be used as shared interrupt are configured in
  1101. * BIOS. Driver trusts BIOS configurations and assigns different
  1102. * handler according to the irq type.
  1103. *
  1104. * Driver needs to save the mapping between each pin and
  1105. * its interrupt line.
  1106. * 1. If the pin cfg is locked in BIOS:
  1107. * Trust BIOS has programmed IntWakeCfg bits correctly,
  1108. * driver just needs to save the mapping.
  1109. * 2. If the pin cfg is not locked in BIOS:
  1110. * Driver programs the IntWakeCfg bits and save the mapping.
  1111. */
  1112. if (!chv_pad_locked(pctrl, pin)) {
  1113. void __iomem *reg = chv_padreg(pctrl, pin, CHV_PADCTRL1);
  1114. value = readl(reg);
  1115. value &= ~CHV_PADCTRL1_INTWAKECFG_MASK;
  1116. value &= ~CHV_PADCTRL1_INVRXTX_MASK;
  1117. if (type & IRQ_TYPE_EDGE_BOTH) {
  1118. if ((type & IRQ_TYPE_EDGE_BOTH) == IRQ_TYPE_EDGE_BOTH)
  1119. value |= CHV_PADCTRL1_INTWAKECFG_BOTH;
  1120. else if (type & IRQ_TYPE_EDGE_RISING)
  1121. value |= CHV_PADCTRL1_INTWAKECFG_RISING;
  1122. else if (type & IRQ_TYPE_EDGE_FALLING)
  1123. value |= CHV_PADCTRL1_INTWAKECFG_FALLING;
  1124. } else if (type & IRQ_TYPE_LEVEL_MASK) {
  1125. value |= CHV_PADCTRL1_INTWAKECFG_LEVEL;
  1126. if (type & IRQ_TYPE_LEVEL_LOW)
  1127. value |= CHV_PADCTRL1_INVRXTX_RXDATA;
  1128. }
  1129. chv_writel(value, reg);
  1130. }
  1131. value = readl(chv_padreg(pctrl, pin, CHV_PADCTRL0));
  1132. value &= CHV_PADCTRL0_INTSEL_MASK;
  1133. value >>= CHV_PADCTRL0_INTSEL_SHIFT;
  1134. pctrl->intr_lines[value] = offset;
  1135. if (type & IRQ_TYPE_EDGE_BOTH)
  1136. __irq_set_handler_locked(d->irq, handle_edge_irq);
  1137. else if (type & IRQ_TYPE_LEVEL_MASK)
  1138. __irq_set_handler_locked(d->irq, handle_level_irq);
  1139. spin_unlock_irqrestore(&pctrl->lock, flags);
  1140. return 0;
  1141. }
  1142. static struct irq_chip chv_gpio_irqchip = {
  1143. .name = "chv-gpio",
  1144. .irq_ack = chv_gpio_irq_ack,
  1145. .irq_mask = chv_gpio_irq_mask,
  1146. .irq_unmask = chv_gpio_irq_unmask,
  1147. .irq_set_type = chv_gpio_irq_type,
  1148. .flags = IRQCHIP_SKIP_SET_WAKE,
  1149. };
  1150. static void chv_gpio_irq_handler(unsigned irq, struct irq_desc *desc)
  1151. {
  1152. struct gpio_chip *gc = irq_desc_get_handler_data(desc);
  1153. struct chv_pinctrl *pctrl = gpiochip_to_pinctrl(gc);
  1154. struct irq_chip *chip = irq_get_chip(irq);
  1155. unsigned long pending;
  1156. u32 intr_line;
  1157. chained_irq_enter(chip, desc);
  1158. pending = readl(pctrl->regs + CHV_INTSTAT);
  1159. for_each_set_bit(intr_line, &pending, 16) {
  1160. unsigned irq, offset;
  1161. offset = pctrl->intr_lines[intr_line];
  1162. irq = irq_find_mapping(gc->irqdomain, offset);
  1163. generic_handle_irq(irq);
  1164. }
  1165. chained_irq_exit(chip, desc);
  1166. }
  1167. static int chv_gpio_probe(struct chv_pinctrl *pctrl, int irq)
  1168. {
  1169. const struct chv_gpio_pinrange *range;
  1170. struct gpio_chip *chip = &pctrl->chip;
  1171. int ret, i, offset;
  1172. *chip = chv_gpio_chip;
  1173. chip->ngpio = pctrl->community->ngpios;
  1174. chip->label = dev_name(pctrl->dev);
  1175. chip->dev = pctrl->dev;
  1176. chip->base = -1;
  1177. ret = gpiochip_add(chip);
  1178. if (ret) {
  1179. dev_err(pctrl->dev, "Failed to register gpiochip\n");
  1180. return ret;
  1181. }
  1182. for (i = 0, offset = 0; i < pctrl->community->ngpio_ranges; i++) {
  1183. range = &pctrl->community->gpio_ranges[i];
  1184. ret = gpiochip_add_pin_range(chip, dev_name(pctrl->dev), offset,
  1185. range->base, range->npins);
  1186. if (ret) {
  1187. dev_err(pctrl->dev, "failed to add GPIO pin range\n");
  1188. goto fail;
  1189. }
  1190. offset += range->npins;
  1191. }
  1192. /* Mask and clear all interrupts */
  1193. chv_writel(0, pctrl->regs + CHV_INTMASK);
  1194. chv_writel(0xffff, pctrl->regs + CHV_INTSTAT);
  1195. ret = gpiochip_irqchip_add(chip, &chv_gpio_irqchip, 0,
  1196. handle_simple_irq, IRQ_TYPE_NONE);
  1197. if (ret) {
  1198. dev_err(pctrl->dev, "failed to add IRQ chip\n");
  1199. goto fail;
  1200. }
  1201. gpiochip_set_chained_irqchip(chip, &chv_gpio_irqchip, irq,
  1202. chv_gpio_irq_handler);
  1203. return 0;
  1204. fail:
  1205. gpiochip_remove(chip);
  1206. return ret;
  1207. }
  1208. static int chv_pinctrl_probe(struct platform_device *pdev)
  1209. {
  1210. struct chv_pinctrl *pctrl;
  1211. struct acpi_device *adev;
  1212. struct resource *res;
  1213. int ret, irq, i;
  1214. adev = ACPI_COMPANION(&pdev->dev);
  1215. if (!adev)
  1216. return -ENODEV;
  1217. pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL);
  1218. if (!pctrl)
  1219. return -ENOMEM;
  1220. for (i = 0; i < ARRAY_SIZE(chv_communities); i++)
  1221. if (!strcmp(adev->pnp.unique_id, chv_communities[i]->uid)) {
  1222. pctrl->community = chv_communities[i];
  1223. break;
  1224. }
  1225. if (i == ARRAY_SIZE(chv_communities))
  1226. return -ENODEV;
  1227. spin_lock_init(&pctrl->lock);
  1228. pctrl->dev = &pdev->dev;
  1229. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  1230. pctrl->regs = devm_ioremap_resource(&pdev->dev, res);
  1231. if (IS_ERR(pctrl->regs))
  1232. return PTR_ERR(pctrl->regs);
  1233. irq = platform_get_irq(pdev, 0);
  1234. if (irq < 0) {
  1235. dev_err(&pdev->dev, "failed to get interrupt number\n");
  1236. return irq;
  1237. }
  1238. pctrl->pctldesc = chv_pinctrl_desc;
  1239. pctrl->pctldesc.name = dev_name(&pdev->dev);
  1240. pctrl->pctldesc.pins = pctrl->community->pins;
  1241. pctrl->pctldesc.npins = pctrl->community->npins;
  1242. pctrl->pctldev = pinctrl_register(&pctrl->pctldesc, &pdev->dev, pctrl);
  1243. if (!pctrl->pctldev) {
  1244. dev_err(&pdev->dev, "failed to register pinctrl driver\n");
  1245. return -ENODEV;
  1246. }
  1247. ret = chv_gpio_probe(pctrl, irq);
  1248. if (ret) {
  1249. pinctrl_unregister(pctrl->pctldev);
  1250. return ret;
  1251. }
  1252. platform_set_drvdata(pdev, pctrl);
  1253. return 0;
  1254. }
  1255. static int chv_pinctrl_remove(struct platform_device *pdev)
  1256. {
  1257. struct chv_pinctrl *pctrl = platform_get_drvdata(pdev);
  1258. gpiochip_remove(&pctrl->chip);
  1259. pinctrl_unregister(pctrl->pctldev);
  1260. return 0;
  1261. }
  1262. static const struct acpi_device_id chv_pinctrl_acpi_match[] = {
  1263. { "INT33FF" },
  1264. { }
  1265. };
  1266. MODULE_DEVICE_TABLE(acpi, chv_pinctrl_acpi_match);
  1267. static struct platform_driver chv_pinctrl_driver = {
  1268. .probe = chv_pinctrl_probe,
  1269. .remove = chv_pinctrl_remove,
  1270. .driver = {
  1271. .name = "cherryview-pinctrl",
  1272. .owner = THIS_MODULE,
  1273. .acpi_match_table = chv_pinctrl_acpi_match,
  1274. },
  1275. };
  1276. static int __init chv_pinctrl_init(void)
  1277. {
  1278. return platform_driver_register(&chv_pinctrl_driver);
  1279. }
  1280. subsys_initcall(chv_pinctrl_init);
  1281. static void __exit chv_pinctrl_exit(void)
  1282. {
  1283. platform_driver_unregister(&chv_pinctrl_driver);
  1284. }
  1285. module_exit(chv_pinctrl_exit);
  1286. MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com>");
  1287. MODULE_DESCRIPTION("Intel Cherryview/Braswell pinctrl driver");
  1288. MODULE_LICENSE("GPL v2");