pinctrl-at91-pio4.c 30 KB

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