pinctrl-at91-pio4.c 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099
  1. /*
  2. * Driver for the Atmel PIO4 controller
  3. *
  4. * Copyright (C) 2015 Atmel,
  5. * 2015 Ludovic Desroches <ludovic.desroches@atmel.com>
  6. *
  7. * This software is licensed under the terms of the GNU General Public
  8. * License version 2, as published by the Free Software Foundation, and
  9. * may be copied, distributed, and modified under those terms.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. */
  16. #include <linux/clk.h>
  17. #include <linux/gpio/driver.h>
  18. /* FIXME: needed for gpio_to_irq(), get rid of this */
  19. #include <linux/gpio.h>
  20. #include <linux/interrupt.h>
  21. #include <linux/io.h>
  22. #include <linux/module.h>
  23. #include <linux/of.h>
  24. #include <linux/platform_device.h>
  25. #include <linux/pinctrl/pinconf.h>
  26. #include <linux/pinctrl/pinconf-generic.h>
  27. #include <linux/pinctrl/pinctrl.h>
  28. #include <linux/pinctrl/pinmux.h>
  29. #include <linux/slab.h>
  30. #include "core.h"
  31. #include "pinconf.h"
  32. #include "pinctrl-utils.h"
  33. /*
  34. * Warning:
  35. * In order to not introduce confusion between Atmel PIO groups and pinctrl
  36. * framework groups, Atmel PIO groups will be called banks, line is kept to
  37. * designed the pin id into this bank.
  38. */
  39. #define ATMEL_PIO_MSKR 0x0000
  40. #define ATMEL_PIO_CFGR 0x0004
  41. #define ATMEL_PIO_CFGR_FUNC_MASK GENMASK(2, 0)
  42. #define ATMEL_PIO_DIR_MASK BIT(8)
  43. #define ATMEL_PIO_PUEN_MASK BIT(9)
  44. #define ATMEL_PIO_PDEN_MASK BIT(10)
  45. #define ATMEL_PIO_IFEN_MASK BIT(12)
  46. #define ATMEL_PIO_IFSCEN_MASK BIT(13)
  47. #define ATMEL_PIO_OPD_MASK BIT(14)
  48. #define ATMEL_PIO_SCHMITT_MASK BIT(15)
  49. #define ATMEL_PIO_CFGR_EVTSEL_MASK GENMASK(26, 24)
  50. #define ATMEL_PIO_CFGR_EVTSEL_FALLING (0 << 24)
  51. #define ATMEL_PIO_CFGR_EVTSEL_RISING (1 << 24)
  52. #define ATMEL_PIO_CFGR_EVTSEL_BOTH (2 << 24)
  53. #define ATMEL_PIO_CFGR_EVTSEL_LOW (3 << 24)
  54. #define ATMEL_PIO_CFGR_EVTSEL_HIGH (4 << 24)
  55. #define ATMEL_PIO_PDSR 0x0008
  56. #define ATMEL_PIO_LOCKSR 0x000C
  57. #define ATMEL_PIO_SODR 0x0010
  58. #define ATMEL_PIO_CODR 0x0014
  59. #define ATMEL_PIO_ODSR 0x0018
  60. #define ATMEL_PIO_IER 0x0020
  61. #define ATMEL_PIO_IDR 0x0024
  62. #define ATMEL_PIO_IMR 0x0028
  63. #define ATMEL_PIO_ISR 0x002C
  64. #define ATMEL_PIO_IOFR 0x003C
  65. #define ATMEL_PIO_NPINS_PER_BANK 32
  66. #define ATMEL_PIO_BANK(pin_id) (pin_id / ATMEL_PIO_NPINS_PER_BANK)
  67. #define ATMEL_PIO_LINE(pin_id) (pin_id % ATMEL_PIO_NPINS_PER_BANK)
  68. #define ATMEL_PIO_BANK_OFFSET 0x40
  69. #define ATMEL_GET_PIN_NO(pinfunc) ((pinfunc) & 0xff)
  70. #define ATMEL_GET_PIN_FUNC(pinfunc) ((pinfunc >> 16) & 0xf)
  71. #define ATMEL_GET_PIN_IOSET(pinfunc) ((pinfunc >> 20) & 0xf)
  72. struct atmel_pioctrl_data {
  73. unsigned nbanks;
  74. };
  75. struct atmel_group {
  76. const char *name;
  77. u32 pin;
  78. };
  79. struct atmel_pin {
  80. unsigned pin_id;
  81. unsigned mux;
  82. unsigned ioset;
  83. unsigned bank;
  84. unsigned line;
  85. const char *device;
  86. };
  87. /**
  88. * struct atmel_pioctrl - Atmel PIO controller (pinmux + gpio)
  89. * @reg_base: base address of the controller.
  90. * @clk: clock of the controller.
  91. * @nbanks: number of PIO groups, it can vary depending on the SoC.
  92. * @pinctrl_dev: pinctrl device registered.
  93. * @groups: groups table to provide group name and pin in the group to pinctrl.
  94. * @group_names: group names table to provide all the group/pin names to
  95. * pinctrl or gpio.
  96. * @pins: pins table used for both pinctrl and gpio. pin_id, bank and line
  97. * fields are set at probe time. Other ones are set when parsing dt
  98. * pinctrl.
  99. * @npins: number of pins.
  100. * @gpio_chip: gpio chip registered.
  101. * @irq_domain: irq domain for the gpio controller.
  102. * @irqs: table containing the hw irq number of the bank. The index of the
  103. * table is the bank id.
  104. * @dev: device entry for the Atmel PIO controller.
  105. * @node: node of the Atmel PIO controller.
  106. */
  107. struct atmel_pioctrl {
  108. void __iomem *reg_base;
  109. struct clk *clk;
  110. unsigned nbanks;
  111. struct pinctrl_dev *pinctrl_dev;
  112. struct atmel_group *groups;
  113. const char * const *group_names;
  114. struct atmel_pin **pins;
  115. unsigned npins;
  116. struct gpio_chip *gpio_chip;
  117. struct irq_domain *irq_domain;
  118. int *irqs;
  119. unsigned *pm_wakeup_sources;
  120. unsigned *pm_suspend_backup;
  121. struct device *dev;
  122. struct device_node *node;
  123. };
  124. static const char * const atmel_functions[] = {
  125. "GPIO", "A", "B", "C", "D", "E", "F", "G"
  126. };
  127. /* --- GPIO --- */
  128. static unsigned int atmel_gpio_read(struct atmel_pioctrl *atmel_pioctrl,
  129. unsigned int bank, unsigned int reg)
  130. {
  131. return readl_relaxed(atmel_pioctrl->reg_base
  132. + ATMEL_PIO_BANK_OFFSET * bank + reg);
  133. }
  134. static void atmel_gpio_write(struct atmel_pioctrl *atmel_pioctrl,
  135. unsigned int bank, unsigned int reg,
  136. unsigned int val)
  137. {
  138. writel_relaxed(val, atmel_pioctrl->reg_base
  139. + ATMEL_PIO_BANK_OFFSET * bank + reg);
  140. }
  141. static void atmel_gpio_irq_ack(struct irq_data *d)
  142. {
  143. /*
  144. * Nothing to do, interrupt is cleared when reading the status
  145. * register.
  146. */
  147. }
  148. static int atmel_gpio_irq_set_type(struct irq_data *d, unsigned type)
  149. {
  150. struct atmel_pioctrl *atmel_pioctrl = irq_data_get_irq_chip_data(d);
  151. struct atmel_pin *pin = atmel_pioctrl->pins[d->hwirq];
  152. unsigned reg;
  153. atmel_gpio_write(atmel_pioctrl, pin->bank, ATMEL_PIO_MSKR,
  154. BIT(pin->line));
  155. reg = atmel_gpio_read(atmel_pioctrl, pin->bank, ATMEL_PIO_CFGR);
  156. reg &= (~ATMEL_PIO_CFGR_EVTSEL_MASK);
  157. switch (type) {
  158. case IRQ_TYPE_EDGE_RISING:
  159. irq_set_handler_locked(d, handle_edge_irq);
  160. reg |= ATMEL_PIO_CFGR_EVTSEL_RISING;
  161. break;
  162. case IRQ_TYPE_EDGE_FALLING:
  163. irq_set_handler_locked(d, handle_edge_irq);
  164. reg |= ATMEL_PIO_CFGR_EVTSEL_FALLING;
  165. break;
  166. case IRQ_TYPE_EDGE_BOTH:
  167. irq_set_handler_locked(d, handle_edge_irq);
  168. reg |= ATMEL_PIO_CFGR_EVTSEL_BOTH;
  169. break;
  170. case IRQ_TYPE_LEVEL_LOW:
  171. irq_set_handler_locked(d, handle_level_irq);
  172. reg |= ATMEL_PIO_CFGR_EVTSEL_LOW;
  173. break;
  174. case IRQ_TYPE_LEVEL_HIGH:
  175. irq_set_handler_locked(d, handle_level_irq);
  176. reg |= ATMEL_PIO_CFGR_EVTSEL_HIGH;
  177. break;
  178. case IRQ_TYPE_NONE:
  179. default:
  180. return -EINVAL;
  181. }
  182. atmel_gpio_write(atmel_pioctrl, pin->bank, ATMEL_PIO_CFGR, reg);
  183. return 0;
  184. }
  185. static void atmel_gpio_irq_mask(struct irq_data *d)
  186. {
  187. struct atmel_pioctrl *atmel_pioctrl = irq_data_get_irq_chip_data(d);
  188. struct atmel_pin *pin = atmel_pioctrl->pins[d->hwirq];
  189. atmel_gpio_write(atmel_pioctrl, pin->bank, ATMEL_PIO_IDR,
  190. BIT(pin->line));
  191. }
  192. static void atmel_gpio_irq_unmask(struct irq_data *d)
  193. {
  194. struct atmel_pioctrl *atmel_pioctrl = irq_data_get_irq_chip_data(d);
  195. struct atmel_pin *pin = atmel_pioctrl->pins[d->hwirq];
  196. atmel_gpio_write(atmel_pioctrl, pin->bank, ATMEL_PIO_IER,
  197. BIT(pin->line));
  198. }
  199. #ifdef CONFIG_PM_SLEEP
  200. static int atmel_gpio_irq_set_wake(struct irq_data *d, unsigned int on)
  201. {
  202. struct atmel_pioctrl *atmel_pioctrl = irq_data_get_irq_chip_data(d);
  203. int bank = ATMEL_PIO_BANK(d->hwirq);
  204. int line = ATMEL_PIO_LINE(d->hwirq);
  205. /* The gpio controller has one interrupt line per bank. */
  206. irq_set_irq_wake(atmel_pioctrl->irqs[bank], on);
  207. if (on)
  208. atmel_pioctrl->pm_wakeup_sources[bank] |= BIT(line);
  209. else
  210. atmel_pioctrl->pm_wakeup_sources[bank] &= ~(BIT(line));
  211. return 0;
  212. }
  213. #else
  214. #define atmel_gpio_irq_set_wake NULL
  215. #endif /* CONFIG_PM_SLEEP */
  216. static struct irq_chip atmel_gpio_irq_chip = {
  217. .name = "GPIO",
  218. .irq_ack = atmel_gpio_irq_ack,
  219. .irq_mask = atmel_gpio_irq_mask,
  220. .irq_unmask = atmel_gpio_irq_unmask,
  221. .irq_set_type = atmel_gpio_irq_set_type,
  222. .irq_set_wake = atmel_gpio_irq_set_wake,
  223. };
  224. static void atmel_gpio_irq_handler(struct irq_desc *desc)
  225. {
  226. unsigned int irq = irq_desc_get_irq(desc);
  227. struct atmel_pioctrl *atmel_pioctrl = irq_desc_get_handler_data(desc);
  228. struct irq_chip *chip = irq_desc_get_chip(desc);
  229. unsigned long isr;
  230. int n, bank = -1;
  231. /* Find from which bank is the irq received. */
  232. for (n = 0; n < atmel_pioctrl->nbanks; n++) {
  233. if (atmel_pioctrl->irqs[n] == irq) {
  234. bank = n;
  235. break;
  236. }
  237. }
  238. if (bank < 0) {
  239. dev_err(atmel_pioctrl->dev,
  240. "no bank associated to irq %u\n", irq);
  241. return;
  242. }
  243. chained_irq_enter(chip, desc);
  244. for (;;) {
  245. isr = (unsigned long)atmel_gpio_read(atmel_pioctrl, bank,
  246. ATMEL_PIO_ISR);
  247. isr &= (unsigned long)atmel_gpio_read(atmel_pioctrl, bank,
  248. ATMEL_PIO_IMR);
  249. if (!isr)
  250. break;
  251. for_each_set_bit(n, &isr, BITS_PER_LONG)
  252. generic_handle_irq(gpio_to_irq(bank *
  253. ATMEL_PIO_NPINS_PER_BANK + n));
  254. }
  255. chained_irq_exit(chip, desc);
  256. }
  257. static int atmel_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
  258. {
  259. struct atmel_pioctrl *atmel_pioctrl = gpiochip_get_data(chip);
  260. struct atmel_pin *pin = atmel_pioctrl->pins[offset];
  261. unsigned reg;
  262. atmel_gpio_write(atmel_pioctrl, pin->bank, ATMEL_PIO_MSKR,
  263. BIT(pin->line));
  264. reg = atmel_gpio_read(atmel_pioctrl, pin->bank, ATMEL_PIO_CFGR);
  265. reg &= ~ATMEL_PIO_DIR_MASK;
  266. atmel_gpio_write(atmel_pioctrl, pin->bank, ATMEL_PIO_CFGR, reg);
  267. return 0;
  268. }
  269. static int atmel_gpio_get(struct gpio_chip *chip, unsigned offset)
  270. {
  271. struct atmel_pioctrl *atmel_pioctrl = gpiochip_get_data(chip);
  272. struct atmel_pin *pin = atmel_pioctrl->pins[offset];
  273. unsigned reg;
  274. reg = atmel_gpio_read(atmel_pioctrl, pin->bank, ATMEL_PIO_PDSR);
  275. return !!(reg & BIT(pin->line));
  276. }
  277. static int atmel_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
  278. int value)
  279. {
  280. struct atmel_pioctrl *atmel_pioctrl = gpiochip_get_data(chip);
  281. struct atmel_pin *pin = atmel_pioctrl->pins[offset];
  282. unsigned reg;
  283. atmel_gpio_write(atmel_pioctrl, pin->bank,
  284. value ? ATMEL_PIO_SODR : ATMEL_PIO_CODR,
  285. BIT(pin->line));
  286. atmel_gpio_write(atmel_pioctrl, pin->bank, ATMEL_PIO_MSKR,
  287. BIT(pin->line));
  288. reg = atmel_gpio_read(atmel_pioctrl, pin->bank, ATMEL_PIO_CFGR);
  289. reg |= ATMEL_PIO_DIR_MASK;
  290. atmel_gpio_write(atmel_pioctrl, pin->bank, ATMEL_PIO_CFGR, reg);
  291. return 0;
  292. }
  293. static void atmel_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
  294. {
  295. struct atmel_pioctrl *atmel_pioctrl = gpiochip_get_data(chip);
  296. struct atmel_pin *pin = atmel_pioctrl->pins[offset];
  297. atmel_gpio_write(atmel_pioctrl, pin->bank,
  298. val ? ATMEL_PIO_SODR : ATMEL_PIO_CODR,
  299. BIT(pin->line));
  300. }
  301. static int atmel_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
  302. {
  303. struct atmel_pioctrl *atmel_pioctrl = gpiochip_get_data(chip);
  304. return irq_find_mapping(atmel_pioctrl->irq_domain, offset);
  305. }
  306. static struct gpio_chip atmel_gpio_chip = {
  307. .direction_input = atmel_gpio_direction_input,
  308. .get = atmel_gpio_get,
  309. .direction_output = atmel_gpio_direction_output,
  310. .set = atmel_gpio_set,
  311. .to_irq = atmel_gpio_to_irq,
  312. .base = 0,
  313. };
  314. /* --- PINCTRL --- */
  315. static unsigned int atmel_pin_config_read(struct pinctrl_dev *pctldev,
  316. unsigned pin_id)
  317. {
  318. struct atmel_pioctrl *atmel_pioctrl = pinctrl_dev_get_drvdata(pctldev);
  319. unsigned bank = atmel_pioctrl->pins[pin_id]->bank;
  320. unsigned line = atmel_pioctrl->pins[pin_id]->line;
  321. void __iomem *addr = atmel_pioctrl->reg_base
  322. + bank * ATMEL_PIO_BANK_OFFSET;
  323. writel_relaxed(BIT(line), addr + ATMEL_PIO_MSKR);
  324. /* Have to set MSKR first, to access the right pin CFGR. */
  325. wmb();
  326. return readl_relaxed(addr + ATMEL_PIO_CFGR);
  327. }
  328. static void atmel_pin_config_write(struct pinctrl_dev *pctldev,
  329. unsigned pin_id, u32 conf)
  330. {
  331. struct atmel_pioctrl *atmel_pioctrl = pinctrl_dev_get_drvdata(pctldev);
  332. unsigned bank = atmel_pioctrl->pins[pin_id]->bank;
  333. unsigned line = atmel_pioctrl->pins[pin_id]->line;
  334. void __iomem *addr = atmel_pioctrl->reg_base
  335. + bank * ATMEL_PIO_BANK_OFFSET;
  336. writel_relaxed(BIT(line), addr + ATMEL_PIO_MSKR);
  337. /* Have to set MSKR first, to access the right pin CFGR. */
  338. wmb();
  339. writel_relaxed(conf, addr + ATMEL_PIO_CFGR);
  340. }
  341. static int atmel_pctl_get_groups_count(struct pinctrl_dev *pctldev)
  342. {
  343. struct atmel_pioctrl *atmel_pioctrl = pinctrl_dev_get_drvdata(pctldev);
  344. return atmel_pioctrl->npins;
  345. }
  346. static const char *atmel_pctl_get_group_name(struct pinctrl_dev *pctldev,
  347. unsigned selector)
  348. {
  349. struct atmel_pioctrl *atmel_pioctrl = pinctrl_dev_get_drvdata(pctldev);
  350. return atmel_pioctrl->groups[selector].name;
  351. }
  352. static int atmel_pctl_get_group_pins(struct pinctrl_dev *pctldev,
  353. unsigned selector, const unsigned **pins,
  354. unsigned *num_pins)
  355. {
  356. struct atmel_pioctrl *atmel_pioctrl = pinctrl_dev_get_drvdata(pctldev);
  357. *pins = (unsigned *)&atmel_pioctrl->groups[selector].pin;
  358. *num_pins = 1;
  359. return 0;
  360. }
  361. struct atmel_group *atmel_pctl_find_group_by_pin(struct pinctrl_dev *pctldev,
  362. unsigned pin)
  363. {
  364. struct atmel_pioctrl *atmel_pioctrl = pinctrl_dev_get_drvdata(pctldev);
  365. int i;
  366. for (i = 0; i < atmel_pioctrl->npins; i++) {
  367. struct atmel_group *grp = atmel_pioctrl->groups + i;
  368. if (grp->pin == pin)
  369. return grp;
  370. }
  371. return NULL;
  372. }
  373. static int atmel_pctl_xlate_pinfunc(struct pinctrl_dev *pctldev,
  374. struct device_node *np,
  375. u32 pinfunc, const char **grp_name,
  376. const char **func_name)
  377. {
  378. struct atmel_pioctrl *atmel_pioctrl = pinctrl_dev_get_drvdata(pctldev);
  379. unsigned pin_id, func_id;
  380. struct atmel_group *grp;
  381. pin_id = ATMEL_GET_PIN_NO(pinfunc);
  382. func_id = ATMEL_GET_PIN_FUNC(pinfunc);
  383. if (func_id >= ARRAY_SIZE(atmel_functions))
  384. return -EINVAL;
  385. *func_name = atmel_functions[func_id];
  386. grp = atmel_pctl_find_group_by_pin(pctldev, pin_id);
  387. if (!grp)
  388. return -EINVAL;
  389. *grp_name = grp->name;
  390. atmel_pioctrl->pins[pin_id]->mux = func_id;
  391. atmel_pioctrl->pins[pin_id]->ioset = ATMEL_GET_PIN_IOSET(pinfunc);
  392. /* Want the device name not the group one. */
  393. if (np->parent == atmel_pioctrl->node)
  394. atmel_pioctrl->pins[pin_id]->device = np->name;
  395. else
  396. atmel_pioctrl->pins[pin_id]->device = np->parent->name;
  397. return 0;
  398. }
  399. static int atmel_pctl_dt_subnode_to_map(struct pinctrl_dev *pctldev,
  400. struct device_node *np,
  401. struct pinctrl_map **map,
  402. unsigned *reserved_maps,
  403. unsigned *num_maps)
  404. {
  405. unsigned num_pins, num_configs, reserve;
  406. unsigned long *configs;
  407. struct property *pins;
  408. bool has_config;
  409. u32 pinfunc;
  410. int ret, i;
  411. pins = of_find_property(np, "pinmux", NULL);
  412. if (!pins)
  413. return -EINVAL;
  414. ret = pinconf_generic_parse_dt_config(np, pctldev, &configs,
  415. &num_configs);
  416. if (ret < 0) {
  417. dev_err(pctldev->dev, "%s: could not parse node property\n",
  418. of_node_full_name(np));
  419. return ret;
  420. }
  421. if (num_configs)
  422. has_config = true;
  423. num_pins = pins->length / sizeof(u32);
  424. if (!num_pins) {
  425. dev_err(pctldev->dev, "no pins found in node %s\n",
  426. of_node_full_name(np));
  427. ret = -EINVAL;
  428. goto exit;
  429. }
  430. /*
  431. * Reserve maps, at least there is a mux map and an optional conf
  432. * map for each pin.
  433. */
  434. reserve = 1;
  435. if (has_config && num_pins >= 1)
  436. reserve++;
  437. reserve *= num_pins;
  438. ret = pinctrl_utils_reserve_map(pctldev, map, reserved_maps, num_maps,
  439. reserve);
  440. if (ret < 0)
  441. goto exit;
  442. for (i = 0; i < num_pins; i++) {
  443. const char *group, *func;
  444. ret = of_property_read_u32_index(np, "pinmux", i, &pinfunc);
  445. if (ret)
  446. goto exit;
  447. ret = atmel_pctl_xlate_pinfunc(pctldev, np, pinfunc, &group,
  448. &func);
  449. if (ret)
  450. goto exit;
  451. pinctrl_utils_add_map_mux(pctldev, map, reserved_maps, num_maps,
  452. group, func);
  453. if (has_config) {
  454. ret = pinctrl_utils_add_map_configs(pctldev, map,
  455. reserved_maps, num_maps, group,
  456. configs, num_configs,
  457. PIN_MAP_TYPE_CONFIGS_GROUP);
  458. if (ret < 0)
  459. goto exit;
  460. }
  461. }
  462. exit:
  463. kfree(configs);
  464. return ret;
  465. }
  466. static int atmel_pctl_dt_node_to_map(struct pinctrl_dev *pctldev,
  467. struct device_node *np_config,
  468. struct pinctrl_map **map,
  469. unsigned *num_maps)
  470. {
  471. struct device_node *np;
  472. unsigned reserved_maps;
  473. int ret;
  474. *map = NULL;
  475. *num_maps = 0;
  476. reserved_maps = 0;
  477. /*
  478. * If all the pins of a device have the same configuration (or no one),
  479. * it is useless to add a subnode, so directly parse node referenced by
  480. * phandle.
  481. */
  482. ret = atmel_pctl_dt_subnode_to_map(pctldev, np_config, map,
  483. &reserved_maps, num_maps);
  484. if (ret) {
  485. for_each_child_of_node(np_config, np) {
  486. ret = atmel_pctl_dt_subnode_to_map(pctldev, np, map,
  487. &reserved_maps, num_maps);
  488. if (ret < 0)
  489. break;
  490. }
  491. }
  492. if (ret < 0) {
  493. pinctrl_utils_dt_free_map(pctldev, *map, *num_maps);
  494. dev_err(pctldev->dev, "can't create maps for node %s\n",
  495. np_config->full_name);
  496. }
  497. return ret;
  498. }
  499. static const struct pinctrl_ops atmel_pctlops = {
  500. .get_groups_count = atmel_pctl_get_groups_count,
  501. .get_group_name = atmel_pctl_get_group_name,
  502. .get_group_pins = atmel_pctl_get_group_pins,
  503. .dt_node_to_map = atmel_pctl_dt_node_to_map,
  504. .dt_free_map = pinctrl_utils_dt_free_map,
  505. };
  506. static int atmel_pmx_get_functions_count(struct pinctrl_dev *pctldev)
  507. {
  508. return ARRAY_SIZE(atmel_functions);
  509. }
  510. static const char *atmel_pmx_get_function_name(struct pinctrl_dev *pctldev,
  511. unsigned selector)
  512. {
  513. return atmel_functions[selector];
  514. }
  515. static int atmel_pmx_get_function_groups(struct pinctrl_dev *pctldev,
  516. unsigned selector,
  517. const char * const **groups,
  518. unsigned * const num_groups)
  519. {
  520. struct atmel_pioctrl *atmel_pioctrl = pinctrl_dev_get_drvdata(pctldev);
  521. *groups = atmel_pioctrl->group_names;
  522. *num_groups = atmel_pioctrl->npins;
  523. return 0;
  524. }
  525. static int atmel_pmx_set_mux(struct pinctrl_dev *pctldev,
  526. unsigned function,
  527. unsigned group)
  528. {
  529. struct atmel_pioctrl *atmel_pioctrl = pinctrl_dev_get_drvdata(pctldev);
  530. unsigned pin;
  531. u32 conf;
  532. dev_dbg(pctldev->dev, "enable function %s group %s\n",
  533. atmel_functions[function], atmel_pioctrl->groups[group].name);
  534. pin = atmel_pioctrl->groups[group].pin;
  535. conf = atmel_pin_config_read(pctldev, pin);
  536. conf &= (~ATMEL_PIO_CFGR_FUNC_MASK);
  537. conf |= (function & ATMEL_PIO_CFGR_FUNC_MASK);
  538. dev_dbg(pctldev->dev, "pin: %u, conf: 0x%08x\n", pin, conf);
  539. atmel_pin_config_write(pctldev, pin, conf);
  540. return 0;
  541. }
  542. static const struct pinmux_ops atmel_pmxops = {
  543. .get_functions_count = atmel_pmx_get_functions_count,
  544. .get_function_name = atmel_pmx_get_function_name,
  545. .get_function_groups = atmel_pmx_get_function_groups,
  546. .set_mux = atmel_pmx_set_mux,
  547. };
  548. static int atmel_conf_pin_config_group_get(struct pinctrl_dev *pctldev,
  549. unsigned group,
  550. unsigned long *config)
  551. {
  552. struct atmel_pioctrl *atmel_pioctrl = pinctrl_dev_get_drvdata(pctldev);
  553. unsigned param = pinconf_to_config_param(*config), arg = 0;
  554. struct atmel_group *grp = atmel_pioctrl->groups + group;
  555. unsigned pin_id = grp->pin;
  556. u32 res;
  557. res = atmel_pin_config_read(pctldev, pin_id);
  558. switch (param) {
  559. case PIN_CONFIG_BIAS_PULL_UP:
  560. if (!(res & ATMEL_PIO_PUEN_MASK))
  561. return -EINVAL;
  562. arg = 1;
  563. break;
  564. case PIN_CONFIG_BIAS_PULL_DOWN:
  565. if ((res & ATMEL_PIO_PUEN_MASK) ||
  566. (!(res & ATMEL_PIO_PDEN_MASK)))
  567. return -EINVAL;
  568. arg = 1;
  569. break;
  570. case PIN_CONFIG_BIAS_DISABLE:
  571. if ((res & ATMEL_PIO_PUEN_MASK) ||
  572. ((res & ATMEL_PIO_PDEN_MASK)))
  573. return -EINVAL;
  574. arg = 1;
  575. break;
  576. case PIN_CONFIG_DRIVE_OPEN_DRAIN:
  577. if (!(res & ATMEL_PIO_OPD_MASK))
  578. return -EINVAL;
  579. arg = 1;
  580. break;
  581. case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
  582. if (!(res & ATMEL_PIO_SCHMITT_MASK))
  583. return -EINVAL;
  584. arg = 1;
  585. break;
  586. default:
  587. return -ENOTSUPP;
  588. }
  589. *config = pinconf_to_config_packed(param, arg);
  590. return 0;
  591. }
  592. static int atmel_conf_pin_config_group_set(struct pinctrl_dev *pctldev,
  593. unsigned group,
  594. unsigned long *configs,
  595. unsigned num_configs)
  596. {
  597. struct atmel_pioctrl *atmel_pioctrl = pinctrl_dev_get_drvdata(pctldev);
  598. struct atmel_group *grp = atmel_pioctrl->groups + group;
  599. unsigned bank, pin, pin_id = grp->pin;
  600. u32 mask, conf = 0;
  601. int i;
  602. conf = atmel_pin_config_read(pctldev, pin_id);
  603. for (i = 0; i < num_configs; i++) {
  604. unsigned param = pinconf_to_config_param(configs[i]);
  605. unsigned arg = pinconf_to_config_argument(configs[i]);
  606. dev_dbg(pctldev->dev, "%s: pin=%u, config=0x%lx\n",
  607. __func__, pin_id, configs[i]);
  608. switch (param) {
  609. case PIN_CONFIG_BIAS_DISABLE:
  610. conf &= (~ATMEL_PIO_PUEN_MASK);
  611. conf &= (~ATMEL_PIO_PDEN_MASK);
  612. break;
  613. case PIN_CONFIG_BIAS_PULL_UP:
  614. conf |= ATMEL_PIO_PUEN_MASK;
  615. break;
  616. case PIN_CONFIG_BIAS_PULL_DOWN:
  617. conf |= ATMEL_PIO_PDEN_MASK;
  618. break;
  619. case PIN_CONFIG_DRIVE_OPEN_DRAIN:
  620. if (arg == 0)
  621. conf &= (~ATMEL_PIO_OPD_MASK);
  622. else
  623. conf |= ATMEL_PIO_OPD_MASK;
  624. break;
  625. case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
  626. if (arg == 0)
  627. conf |= ATMEL_PIO_SCHMITT_MASK;
  628. else
  629. conf &= (~ATMEL_PIO_SCHMITT_MASK);
  630. break;
  631. case PIN_CONFIG_INPUT_DEBOUNCE:
  632. if (arg == 0) {
  633. conf &= (~ATMEL_PIO_IFEN_MASK);
  634. conf &= (~ATMEL_PIO_IFSCEN_MASK);
  635. } else {
  636. /*
  637. * We don't care about the debounce value for several reasons:
  638. * - can't have different debounce periods inside a same group,
  639. * - the register to configure this period is a secure register.
  640. * The debouncing filter can filter a pulse with a duration of less
  641. * than 1/2 slow clock period.
  642. */
  643. conf |= ATMEL_PIO_IFEN_MASK;
  644. conf |= ATMEL_PIO_IFSCEN_MASK;
  645. }
  646. break;
  647. case PIN_CONFIG_OUTPUT:
  648. conf |= ATMEL_PIO_DIR_MASK;
  649. bank = ATMEL_PIO_BANK(pin_id);
  650. pin = ATMEL_PIO_LINE(pin_id);
  651. mask = 1 << pin;
  652. if (arg == 0) {
  653. writel_relaxed(mask, atmel_pioctrl->reg_base +
  654. bank * ATMEL_PIO_BANK_OFFSET +
  655. ATMEL_PIO_CODR);
  656. } else {
  657. writel_relaxed(mask, atmel_pioctrl->reg_base +
  658. bank * ATMEL_PIO_BANK_OFFSET +
  659. ATMEL_PIO_SODR);
  660. }
  661. break;
  662. default:
  663. dev_warn(pctldev->dev,
  664. "unsupported configuration parameter: %u\n",
  665. param);
  666. continue;
  667. }
  668. }
  669. dev_dbg(pctldev->dev, "%s: reg=0x%08x\n", __func__, conf);
  670. atmel_pin_config_write(pctldev, pin_id, conf);
  671. return 0;
  672. }
  673. static void atmel_conf_pin_config_dbg_show(struct pinctrl_dev *pctldev,
  674. struct seq_file *s, unsigned pin_id)
  675. {
  676. struct atmel_pioctrl *atmel_pioctrl = pinctrl_dev_get_drvdata(pctldev);
  677. u32 conf;
  678. if (!atmel_pioctrl->pins[pin_id]->device)
  679. return;
  680. if (atmel_pioctrl->pins[pin_id])
  681. seq_printf(s, " (%s, ioset %u) ",
  682. atmel_pioctrl->pins[pin_id]->device,
  683. atmel_pioctrl->pins[pin_id]->ioset);
  684. conf = atmel_pin_config_read(pctldev, pin_id);
  685. if (conf & ATMEL_PIO_PUEN_MASK)
  686. seq_printf(s, "%s ", "pull-up");
  687. if (conf & ATMEL_PIO_PDEN_MASK)
  688. seq_printf(s, "%s ", "pull-down");
  689. if (conf & ATMEL_PIO_IFEN_MASK)
  690. seq_printf(s, "%s ", "debounce");
  691. if (conf & ATMEL_PIO_OPD_MASK)
  692. seq_printf(s, "%s ", "open-drain");
  693. if (conf & ATMEL_PIO_SCHMITT_MASK)
  694. seq_printf(s, "%s ", "schmitt");
  695. }
  696. static const struct pinconf_ops atmel_confops = {
  697. .pin_config_group_get = atmel_conf_pin_config_group_get,
  698. .pin_config_group_set = atmel_conf_pin_config_group_set,
  699. .pin_config_dbg_show = atmel_conf_pin_config_dbg_show,
  700. };
  701. static struct pinctrl_desc atmel_pinctrl_desc = {
  702. .name = "atmel_pinctrl",
  703. .confops = &atmel_confops,
  704. .pctlops = &atmel_pctlops,
  705. .pmxops = &atmel_pmxops,
  706. };
  707. static int __maybe_unused atmel_pctrl_suspend(struct device *dev)
  708. {
  709. struct platform_device *pdev = to_platform_device(dev);
  710. struct atmel_pioctrl *atmel_pioctrl = platform_get_drvdata(pdev);
  711. int i;
  712. /*
  713. * For each bank, save IMR to restore it later and disable all GPIO
  714. * interrupts excepting the ones marked as wakeup sources.
  715. */
  716. for (i = 0; i < atmel_pioctrl->nbanks; i++) {
  717. atmel_pioctrl->pm_suspend_backup[i] =
  718. atmel_gpio_read(atmel_pioctrl, i, ATMEL_PIO_IMR);
  719. atmel_gpio_write(atmel_pioctrl, i, ATMEL_PIO_IDR,
  720. ~atmel_pioctrl->pm_wakeup_sources[i]);
  721. }
  722. return 0;
  723. }
  724. static int __maybe_unused atmel_pctrl_resume(struct device *dev)
  725. {
  726. struct platform_device *pdev = to_platform_device(dev);
  727. struct atmel_pioctrl *atmel_pioctrl = platform_get_drvdata(pdev);
  728. int i;
  729. for (i = 0; i < atmel_pioctrl->nbanks; i++)
  730. atmel_gpio_write(atmel_pioctrl, i, ATMEL_PIO_IER,
  731. atmel_pioctrl->pm_suspend_backup[i]);
  732. return 0;
  733. }
  734. static const struct dev_pm_ops atmel_pctrl_pm_ops = {
  735. SET_SYSTEM_SLEEP_PM_OPS(atmel_pctrl_suspend, atmel_pctrl_resume)
  736. };
  737. /*
  738. * The number of banks can be different from a SoC to another one.
  739. * We can have up to 16 banks.
  740. */
  741. static const struct atmel_pioctrl_data atmel_sama5d2_pioctrl_data = {
  742. .nbanks = 4,
  743. };
  744. static const struct of_device_id atmel_pctrl_of_match[] = {
  745. {
  746. .compatible = "atmel,sama5d2-pinctrl",
  747. .data = &atmel_sama5d2_pioctrl_data,
  748. }, {
  749. /* sentinel */
  750. }
  751. };
  752. MODULE_DEVICE_TABLE(of, atmel_pctrl_of_match);
  753. static int atmel_pinctrl_probe(struct platform_device *pdev)
  754. {
  755. struct device *dev = &pdev->dev;
  756. struct pinctrl_pin_desc *pin_desc;
  757. const char **group_names;
  758. const struct of_device_id *match;
  759. int i, ret;
  760. struct resource *res;
  761. struct atmel_pioctrl *atmel_pioctrl;
  762. struct atmel_pioctrl_data *atmel_pioctrl_data;
  763. atmel_pioctrl = devm_kzalloc(dev, sizeof(*atmel_pioctrl), GFP_KERNEL);
  764. if (!atmel_pioctrl)
  765. return -ENOMEM;
  766. atmel_pioctrl->dev = dev;
  767. atmel_pioctrl->node = dev->of_node;
  768. platform_set_drvdata(pdev, atmel_pioctrl);
  769. match = of_match_node(atmel_pctrl_of_match, dev->of_node);
  770. if (!match) {
  771. dev_err(dev, "unknown compatible string\n");
  772. return -ENODEV;
  773. }
  774. atmel_pioctrl_data = (struct atmel_pioctrl_data *)match->data;
  775. atmel_pioctrl->nbanks = atmel_pioctrl_data->nbanks;
  776. atmel_pioctrl->npins = atmel_pioctrl->nbanks * ATMEL_PIO_NPINS_PER_BANK;
  777. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  778. if (!res) {
  779. dev_err(dev, "unable to get atmel pinctrl resource\n");
  780. return -EINVAL;
  781. }
  782. atmel_pioctrl->reg_base = devm_ioremap_resource(dev, res);
  783. if (IS_ERR(atmel_pioctrl->reg_base))
  784. return -EINVAL;
  785. atmel_pioctrl->clk = devm_clk_get(dev, NULL);
  786. if (IS_ERR(atmel_pioctrl->clk)) {
  787. dev_err(dev, "failed to get clock\n");
  788. return PTR_ERR(atmel_pioctrl->clk);
  789. }
  790. atmel_pioctrl->pins = devm_kzalloc(dev, sizeof(*atmel_pioctrl->pins)
  791. * atmel_pioctrl->npins, GFP_KERNEL);
  792. if (!atmel_pioctrl->pins)
  793. return -ENOMEM;
  794. pin_desc = devm_kzalloc(dev, sizeof(*pin_desc)
  795. * atmel_pioctrl->npins, GFP_KERNEL);
  796. if (!pin_desc)
  797. return -ENOMEM;
  798. atmel_pinctrl_desc.pins = pin_desc;
  799. atmel_pinctrl_desc.npins = atmel_pioctrl->npins;
  800. /* One pin is one group since a pin can achieve all functions. */
  801. group_names = devm_kzalloc(dev, sizeof(*group_names)
  802. * atmel_pioctrl->npins, GFP_KERNEL);
  803. if (!group_names)
  804. return -ENOMEM;
  805. atmel_pioctrl->group_names = group_names;
  806. atmel_pioctrl->groups = devm_kzalloc(&pdev->dev,
  807. sizeof(*atmel_pioctrl->groups) * atmel_pioctrl->npins,
  808. GFP_KERNEL);
  809. if (!atmel_pioctrl->groups)
  810. return -ENOMEM;
  811. for (i = 0 ; i < atmel_pioctrl->npins; i++) {
  812. struct atmel_group *group = atmel_pioctrl->groups + i;
  813. unsigned bank = ATMEL_PIO_BANK(i);
  814. unsigned line = ATMEL_PIO_LINE(i);
  815. atmel_pioctrl->pins[i] = devm_kzalloc(dev,
  816. sizeof(**atmel_pioctrl->pins), GFP_KERNEL);
  817. if (!atmel_pioctrl->pins[i])
  818. return -ENOMEM;
  819. atmel_pioctrl->pins[i]->pin_id = i;
  820. atmel_pioctrl->pins[i]->bank = bank;
  821. atmel_pioctrl->pins[i]->line = line;
  822. pin_desc[i].number = i;
  823. /* Pin naming convention: P(bank_name)(bank_pin_number). */
  824. pin_desc[i].name = kasprintf(GFP_KERNEL, "P%c%d",
  825. bank + 'A', line);
  826. group->name = group_names[i] = pin_desc[i].name;
  827. group->pin = pin_desc[i].number;
  828. dev_dbg(dev, "pin_id=%u, bank=%u, line=%u", i, bank, line);
  829. }
  830. atmel_pioctrl->gpio_chip = &atmel_gpio_chip;
  831. atmel_pioctrl->gpio_chip->of_node = dev->of_node;
  832. atmel_pioctrl->gpio_chip->ngpio = atmel_pioctrl->npins;
  833. atmel_pioctrl->gpio_chip->label = dev_name(dev);
  834. atmel_pioctrl->gpio_chip->parent = dev;
  835. atmel_pioctrl->gpio_chip->names = atmel_pioctrl->group_names;
  836. atmel_pioctrl->pm_wakeup_sources = devm_kzalloc(dev,
  837. sizeof(*atmel_pioctrl->pm_wakeup_sources)
  838. * atmel_pioctrl->nbanks, GFP_KERNEL);
  839. if (!atmel_pioctrl->pm_wakeup_sources)
  840. return -ENOMEM;
  841. atmel_pioctrl->pm_suspend_backup = devm_kzalloc(dev,
  842. sizeof(*atmel_pioctrl->pm_suspend_backup)
  843. * atmel_pioctrl->nbanks, GFP_KERNEL);
  844. if (!atmel_pioctrl->pm_suspend_backup)
  845. return -ENOMEM;
  846. atmel_pioctrl->irqs = devm_kzalloc(dev, sizeof(*atmel_pioctrl->irqs)
  847. * atmel_pioctrl->nbanks, GFP_KERNEL);
  848. if (!atmel_pioctrl->irqs)
  849. return -ENOMEM;
  850. /* There is one controller but each bank has its own irq line. */
  851. for (i = 0; i < atmel_pioctrl->nbanks; i++) {
  852. res = platform_get_resource(pdev, IORESOURCE_IRQ, i);
  853. if (!res) {
  854. dev_err(dev, "missing irq resource for group %c\n",
  855. 'A' + i);
  856. return -EINVAL;
  857. }
  858. atmel_pioctrl->irqs[i] = res->start;
  859. irq_set_chained_handler(res->start, atmel_gpio_irq_handler);
  860. irq_set_handler_data(res->start, atmel_pioctrl);
  861. dev_dbg(dev, "bank %i: irq=%pr\n", i, res);
  862. }
  863. atmel_pioctrl->irq_domain = irq_domain_add_linear(dev->of_node,
  864. atmel_pioctrl->gpio_chip->ngpio,
  865. &irq_domain_simple_ops, NULL);
  866. if (!atmel_pioctrl->irq_domain) {
  867. dev_err(dev, "can't add the irq domain\n");
  868. return -ENODEV;
  869. }
  870. atmel_pioctrl->irq_domain->name = "atmel gpio";
  871. for (i = 0; i < atmel_pioctrl->npins; i++) {
  872. int irq = irq_create_mapping(atmel_pioctrl->irq_domain, i);
  873. irq_set_chip_and_handler(irq, &atmel_gpio_irq_chip,
  874. handle_simple_irq);
  875. irq_set_chip_data(irq, atmel_pioctrl);
  876. dev_dbg(dev,
  877. "atmel gpio irq domain: hwirq: %d, linux irq: %d\n",
  878. i, irq);
  879. }
  880. ret = clk_prepare_enable(atmel_pioctrl->clk);
  881. if (ret) {
  882. dev_err(dev, "failed to prepare and enable clock\n");
  883. goto clk_prepare_enable_error;
  884. }
  885. atmel_pioctrl->pinctrl_dev = pinctrl_register(&atmel_pinctrl_desc,
  886. &pdev->dev,
  887. atmel_pioctrl);
  888. if (!atmel_pioctrl->pinctrl_dev) {
  889. dev_err(dev, "pinctrl registration failed\n");
  890. goto pinctrl_register_error;
  891. }
  892. ret = gpiochip_add_data(atmel_pioctrl->gpio_chip, atmel_pioctrl);
  893. if (ret) {
  894. dev_err(dev, "failed to add gpiochip\n");
  895. goto gpiochip_add_error;
  896. }
  897. ret = gpiochip_add_pin_range(atmel_pioctrl->gpio_chip, dev_name(dev),
  898. 0, 0, atmel_pioctrl->gpio_chip->ngpio);
  899. if (ret) {
  900. dev_err(dev, "failed to add gpio pin range\n");
  901. goto gpiochip_add_pin_range_error;
  902. }
  903. dev_info(&pdev->dev, "atmel pinctrl initialized\n");
  904. return 0;
  905. clk_prepare_enable_error:
  906. irq_domain_remove(atmel_pioctrl->irq_domain);
  907. pinctrl_register_error:
  908. clk_disable_unprepare(atmel_pioctrl->clk);
  909. gpiochip_add_error:
  910. pinctrl_unregister(atmel_pioctrl->pinctrl_dev);
  911. gpiochip_add_pin_range_error:
  912. gpiochip_remove(atmel_pioctrl->gpio_chip);
  913. return ret;
  914. }
  915. int atmel_pinctrl_remove(struct platform_device *pdev)
  916. {
  917. struct atmel_pioctrl *atmel_pioctrl = platform_get_drvdata(pdev);
  918. irq_domain_remove(atmel_pioctrl->irq_domain);
  919. clk_disable_unprepare(atmel_pioctrl->clk);
  920. pinctrl_unregister(atmel_pioctrl->pinctrl_dev);
  921. gpiochip_remove(atmel_pioctrl->gpio_chip);
  922. return 0;
  923. }
  924. static struct platform_driver atmel_pinctrl_driver = {
  925. .driver = {
  926. .name = "pinctrl-at91-pio4",
  927. .of_match_table = atmel_pctrl_of_match,
  928. .pm = &atmel_pctrl_pm_ops,
  929. },
  930. .probe = atmel_pinctrl_probe,
  931. .remove = atmel_pinctrl_remove,
  932. };
  933. module_platform_driver(atmel_pinctrl_driver);
  934. MODULE_AUTHOR(Ludovic Desroches <ludovic.desroches@atmel.com>);
  935. MODULE_DESCRIPTION("Atmel PIO4 pinctrl driver");
  936. MODULE_LICENSE("GPL v2");