pinctrl-exynos.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. /*
  2. * Exynos specific support for Samsung pinctrl/gpiolib driver with eint support.
  3. *
  4. * Copyright (c) 2012 Samsung Electronics Co., Ltd.
  5. * http://www.samsung.com
  6. * Copyright (c) 2012 Linaro Ltd
  7. * http://www.linaro.org
  8. *
  9. * Author: Thomas Abraham <thomas.ab@samsung.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 as published by
  13. * the Free Software Foundation; either version 2 of the License, or
  14. * (at your option) any later version.
  15. *
  16. * This file contains the Samsung Exynos specific information required by the
  17. * the Samsung pinctrl/gpiolib driver. It also includes the implementation of
  18. * external gpio and wakeup interrupt support.
  19. */
  20. #include <linux/module.h>
  21. #include <linux/device.h>
  22. #include <linux/interrupt.h>
  23. #include <linux/irqdomain.h>
  24. #include <linux/irq.h>
  25. #include <linux/of_irq.h>
  26. #include <linux/io.h>
  27. #include <linux/slab.h>
  28. #include <linux/err.h>
  29. #include <asm/mach/irq.h>
  30. #include "pinctrl-samsung.h"
  31. #include "pinctrl-exynos.h"
  32. /* list of external wakeup controllers supported */
  33. static const struct of_device_id exynos_wkup_irq_ids[] = {
  34. { .compatible = "samsung,exynos4210-wakeup-eint", },
  35. };
  36. static void exynos_gpio_irq_unmask(struct irq_data *irqd)
  37. {
  38. struct samsung_pinctrl_drv_data *d = irqd->domain->host_data;
  39. struct exynos_geint_data *edata = irq_data_get_irq_handler_data(irqd);
  40. unsigned long reg_mask = d->ctrl->geint_mask + edata->eint_offset;
  41. unsigned long mask;
  42. mask = readl(d->virt_base + reg_mask);
  43. mask &= ~(1 << edata->pin);
  44. writel(mask, d->virt_base + reg_mask);
  45. }
  46. static void exynos_gpio_irq_mask(struct irq_data *irqd)
  47. {
  48. struct samsung_pinctrl_drv_data *d = irqd->domain->host_data;
  49. struct exynos_geint_data *edata = irq_data_get_irq_handler_data(irqd);
  50. unsigned long reg_mask = d->ctrl->geint_mask + edata->eint_offset;
  51. unsigned long mask;
  52. mask = readl(d->virt_base + reg_mask);
  53. mask |= 1 << edata->pin;
  54. writel(mask, d->virt_base + reg_mask);
  55. }
  56. static void exynos_gpio_irq_ack(struct irq_data *irqd)
  57. {
  58. struct samsung_pinctrl_drv_data *d = irqd->domain->host_data;
  59. struct exynos_geint_data *edata = irq_data_get_irq_handler_data(irqd);
  60. unsigned long reg_pend = d->ctrl->geint_pend + edata->eint_offset;
  61. writel(1 << edata->pin, d->virt_base + reg_pend);
  62. }
  63. static int exynos_gpio_irq_set_type(struct irq_data *irqd, unsigned int type)
  64. {
  65. struct samsung_pinctrl_drv_data *d = irqd->domain->host_data;
  66. struct samsung_pin_ctrl *ctrl = d->ctrl;
  67. struct exynos_geint_data *edata = irq_data_get_irq_handler_data(irqd);
  68. struct samsung_pin_bank *bank = edata->bank;
  69. unsigned int shift = EXYNOS_EINT_CON_LEN * edata->pin;
  70. unsigned int con, trig_type;
  71. unsigned long reg_con = ctrl->geint_con + edata->eint_offset;
  72. unsigned int mask;
  73. switch (type) {
  74. case IRQ_TYPE_EDGE_RISING:
  75. trig_type = EXYNOS_EINT_EDGE_RISING;
  76. break;
  77. case IRQ_TYPE_EDGE_FALLING:
  78. trig_type = EXYNOS_EINT_EDGE_FALLING;
  79. break;
  80. case IRQ_TYPE_EDGE_BOTH:
  81. trig_type = EXYNOS_EINT_EDGE_BOTH;
  82. break;
  83. case IRQ_TYPE_LEVEL_HIGH:
  84. trig_type = EXYNOS_EINT_LEVEL_HIGH;
  85. break;
  86. case IRQ_TYPE_LEVEL_LOW:
  87. trig_type = EXYNOS_EINT_LEVEL_LOW;
  88. break;
  89. default:
  90. pr_err("unsupported external interrupt type\n");
  91. return -EINVAL;
  92. }
  93. if (type & IRQ_TYPE_EDGE_BOTH)
  94. __irq_set_handler_locked(irqd->irq, handle_edge_irq);
  95. else
  96. __irq_set_handler_locked(irqd->irq, handle_level_irq);
  97. con = readl(d->virt_base + reg_con);
  98. con &= ~(EXYNOS_EINT_CON_MASK << shift);
  99. con |= trig_type << shift;
  100. writel(con, d->virt_base + reg_con);
  101. reg_con = bank->pctl_offset;
  102. shift = edata->pin * bank->func_width;
  103. mask = (1 << bank->func_width) - 1;
  104. con = readl(d->virt_base + reg_con);
  105. con &= ~(mask << shift);
  106. con |= EXYNOS_EINT_FUNC << shift;
  107. writel(con, d->virt_base + reg_con);
  108. return 0;
  109. }
  110. /*
  111. * irq_chip for gpio interrupts.
  112. */
  113. static struct irq_chip exynos_gpio_irq_chip = {
  114. .name = "exynos_gpio_irq_chip",
  115. .irq_unmask = exynos_gpio_irq_unmask,
  116. .irq_mask = exynos_gpio_irq_mask,
  117. .irq_ack = exynos_gpio_irq_ack,
  118. .irq_set_type = exynos_gpio_irq_set_type,
  119. };
  120. /*
  121. * given a controller-local external gpio interrupt number, prepare the handler
  122. * data for it.
  123. */
  124. static struct exynos_geint_data *exynos_get_eint_data(irq_hw_number_t hw,
  125. struct samsung_pinctrl_drv_data *d)
  126. {
  127. struct samsung_pin_bank *bank = d->ctrl->pin_banks;
  128. struct exynos_geint_data *eint_data;
  129. unsigned int nr_banks = d->ctrl->nr_banks, idx;
  130. unsigned int irq_base = 0, eint_offset = 0;
  131. if (hw >= d->ctrl->nr_gint) {
  132. dev_err(d->dev, "unsupported ext-gpio interrupt\n");
  133. return NULL;
  134. }
  135. for (idx = 0; idx < nr_banks; idx++, bank++) {
  136. if (bank->eint_type != EINT_TYPE_GPIO)
  137. continue;
  138. if ((hw >= irq_base) && (hw < (irq_base + bank->nr_pins)))
  139. break;
  140. irq_base += bank->nr_pins;
  141. eint_offset += 4;
  142. }
  143. if (idx == nr_banks) {
  144. dev_err(d->dev, "pin bank not found for ext-gpio interrupt\n");
  145. return NULL;
  146. }
  147. eint_data = devm_kzalloc(d->dev, sizeof(*eint_data), GFP_KERNEL);
  148. if (!eint_data) {
  149. dev_err(d->dev, "no memory for eint-gpio data\n");
  150. return NULL;
  151. }
  152. eint_data->bank = bank;
  153. eint_data->pin = hw - irq_base;
  154. eint_data->eint_offset = eint_offset;
  155. return eint_data;
  156. }
  157. static int exynos_gpio_irq_map(struct irq_domain *h, unsigned int virq,
  158. irq_hw_number_t hw)
  159. {
  160. struct samsung_pinctrl_drv_data *d = h->host_data;
  161. struct exynos_geint_data *eint_data;
  162. eint_data = exynos_get_eint_data(hw, d);
  163. if (!eint_data)
  164. return -EINVAL;
  165. irq_set_handler_data(virq, eint_data);
  166. irq_set_chip_data(virq, h->host_data);
  167. irq_set_chip_and_handler(virq, &exynos_gpio_irq_chip,
  168. handle_level_irq);
  169. set_irq_flags(virq, IRQF_VALID);
  170. return 0;
  171. }
  172. static void exynos_gpio_irq_unmap(struct irq_domain *h, unsigned int virq)
  173. {
  174. struct samsung_pinctrl_drv_data *d = h->host_data;
  175. struct exynos_geint_data *eint_data;
  176. eint_data = irq_get_handler_data(virq);
  177. devm_kfree(d->dev, eint_data);
  178. }
  179. /*
  180. * irq domain callbacks for external gpio interrupt controller.
  181. */
  182. static const struct irq_domain_ops exynos_gpio_irqd_ops = {
  183. .map = exynos_gpio_irq_map,
  184. .unmap = exynos_gpio_irq_unmap,
  185. .xlate = irq_domain_xlate_twocell,
  186. };
  187. static irqreturn_t exynos_eint_gpio_irq(int irq, void *data)
  188. {
  189. struct samsung_pinctrl_drv_data *d = data;
  190. struct samsung_pin_ctrl *ctrl = d->ctrl;
  191. struct samsung_pin_bank *bank = ctrl->pin_banks;
  192. unsigned int svc, group, pin, virq;
  193. svc = readl(d->virt_base + ctrl->svc);
  194. group = EXYNOS_SVC_GROUP(svc);
  195. pin = svc & EXYNOS_SVC_NUM_MASK;
  196. if (!group)
  197. return IRQ_HANDLED;
  198. bank += (group - 1);
  199. virq = irq_linear_revmap(d->gpio_irqd, bank->irq_base + pin);
  200. if (!virq)
  201. return IRQ_NONE;
  202. generic_handle_irq(virq);
  203. return IRQ_HANDLED;
  204. }
  205. /*
  206. * exynos_eint_gpio_init() - setup handling of external gpio interrupts.
  207. * @d: driver data of samsung pinctrl driver.
  208. */
  209. static int exynos_eint_gpio_init(struct samsung_pinctrl_drv_data *d)
  210. {
  211. struct device *dev = d->dev;
  212. unsigned int ret;
  213. if (!d->irq) {
  214. dev_err(dev, "irq number not available\n");
  215. return -EINVAL;
  216. }
  217. ret = devm_request_irq(dev, d->irq, exynos_eint_gpio_irq,
  218. 0, dev_name(dev), d);
  219. if (ret) {
  220. dev_err(dev, "irq request failed\n");
  221. return -ENXIO;
  222. }
  223. d->gpio_irqd = irq_domain_add_linear(dev->of_node, d->ctrl->nr_gint,
  224. &exynos_gpio_irqd_ops, d);
  225. if (!d->gpio_irqd) {
  226. dev_err(dev, "gpio irq domain allocation failed\n");
  227. return -ENXIO;
  228. }
  229. return 0;
  230. }
  231. static void exynos_wkup_irq_unmask(struct irq_data *irqd)
  232. {
  233. struct samsung_pinctrl_drv_data *d = irq_data_get_irq_chip_data(irqd);
  234. unsigned int bank = irqd->hwirq / EXYNOS_EINT_MAX_PER_BANK;
  235. unsigned int pin = irqd->hwirq & (EXYNOS_EINT_MAX_PER_BANK - 1);
  236. unsigned long reg_mask = d->ctrl->weint_mask + (bank << 2);
  237. unsigned long mask;
  238. mask = readl(d->virt_base + reg_mask);
  239. mask &= ~(1 << pin);
  240. writel(mask, d->virt_base + reg_mask);
  241. }
  242. static void exynos_wkup_irq_mask(struct irq_data *irqd)
  243. {
  244. struct samsung_pinctrl_drv_data *d = irq_data_get_irq_chip_data(irqd);
  245. unsigned int bank = irqd->hwirq / EXYNOS_EINT_MAX_PER_BANK;
  246. unsigned int pin = irqd->hwirq & (EXYNOS_EINT_MAX_PER_BANK - 1);
  247. unsigned long reg_mask = d->ctrl->weint_mask + (bank << 2);
  248. unsigned long mask;
  249. mask = readl(d->virt_base + reg_mask);
  250. mask |= 1 << pin;
  251. writel(mask, d->virt_base + reg_mask);
  252. }
  253. static void exynos_wkup_irq_ack(struct irq_data *irqd)
  254. {
  255. struct samsung_pinctrl_drv_data *d = irq_data_get_irq_chip_data(irqd);
  256. unsigned int bank = irqd->hwirq / EXYNOS_EINT_MAX_PER_BANK;
  257. unsigned int pin = irqd->hwirq & (EXYNOS_EINT_MAX_PER_BANK - 1);
  258. unsigned long pend = d->ctrl->weint_pend + (bank << 2);
  259. writel(1 << pin, d->virt_base + pend);
  260. }
  261. static int exynos_wkup_irq_set_type(struct irq_data *irqd, unsigned int type)
  262. {
  263. struct samsung_pinctrl_drv_data *d = irq_data_get_irq_chip_data(irqd);
  264. unsigned int bank = irqd->hwirq / EXYNOS_EINT_MAX_PER_BANK;
  265. unsigned int pin = irqd->hwirq & (EXYNOS_EINT_MAX_PER_BANK - 1);
  266. unsigned long reg_con = d->ctrl->weint_con + (bank << 2);
  267. unsigned long shift = EXYNOS_EINT_CON_LEN * pin;
  268. unsigned long con, trig_type;
  269. switch (type) {
  270. case IRQ_TYPE_EDGE_RISING:
  271. trig_type = EXYNOS_EINT_EDGE_RISING;
  272. break;
  273. case IRQ_TYPE_EDGE_FALLING:
  274. trig_type = EXYNOS_EINT_EDGE_FALLING;
  275. break;
  276. case IRQ_TYPE_EDGE_BOTH:
  277. trig_type = EXYNOS_EINT_EDGE_BOTH;
  278. break;
  279. case IRQ_TYPE_LEVEL_HIGH:
  280. trig_type = EXYNOS_EINT_LEVEL_HIGH;
  281. break;
  282. case IRQ_TYPE_LEVEL_LOW:
  283. trig_type = EXYNOS_EINT_LEVEL_LOW;
  284. break;
  285. default:
  286. pr_err("unsupported external interrupt type\n");
  287. return -EINVAL;
  288. }
  289. if (type & IRQ_TYPE_EDGE_BOTH)
  290. __irq_set_handler_locked(irqd->irq, handle_edge_irq);
  291. else
  292. __irq_set_handler_locked(irqd->irq, handle_level_irq);
  293. con = readl(d->virt_base + reg_con);
  294. con &= ~(EXYNOS_EINT_CON_MASK << shift);
  295. con |= trig_type << shift;
  296. writel(con, d->virt_base + reg_con);
  297. return 0;
  298. }
  299. /*
  300. * irq_chip for wakeup interrupts
  301. */
  302. static struct irq_chip exynos_wkup_irq_chip = {
  303. .name = "exynos_wkup_irq_chip",
  304. .irq_unmask = exynos_wkup_irq_unmask,
  305. .irq_mask = exynos_wkup_irq_mask,
  306. .irq_ack = exynos_wkup_irq_ack,
  307. .irq_set_type = exynos_wkup_irq_set_type,
  308. };
  309. /* interrupt handler for wakeup interrupts 0..15 */
  310. static void exynos_irq_eint0_15(unsigned int irq, struct irq_desc *desc)
  311. {
  312. struct exynos_weint_data *eintd = irq_get_handler_data(irq);
  313. struct irq_chip *chip = irq_get_chip(irq);
  314. int eint_irq;
  315. chained_irq_enter(chip, desc);
  316. chip->irq_mask(&desc->irq_data);
  317. if (chip->irq_ack)
  318. chip->irq_ack(&desc->irq_data);
  319. eint_irq = irq_linear_revmap(eintd->domain, eintd->irq);
  320. generic_handle_irq(eint_irq);
  321. chip->irq_unmask(&desc->irq_data);
  322. chained_irq_exit(chip, desc);
  323. }
  324. static inline void exynos_irq_demux_eint(int irq_base, unsigned long pend,
  325. struct irq_domain *domain)
  326. {
  327. unsigned int irq;
  328. while (pend) {
  329. irq = fls(pend) - 1;
  330. generic_handle_irq(irq_find_mapping(domain, irq_base + irq));
  331. pend &= ~(1 << irq);
  332. }
  333. }
  334. /* interrupt handler for wakeup interrupt 16 */
  335. static void exynos_irq_demux_eint16_31(unsigned int irq, struct irq_desc *desc)
  336. {
  337. struct irq_chip *chip = irq_get_chip(irq);
  338. struct exynos_weint_data *eintd = irq_get_handler_data(irq);
  339. struct samsung_pinctrl_drv_data *d = eintd->domain->host_data;
  340. unsigned long pend;
  341. unsigned long mask;
  342. chained_irq_enter(chip, desc);
  343. pend = readl(d->virt_base + d->ctrl->weint_pend + 0x8);
  344. mask = readl(d->virt_base + d->ctrl->weint_mask + 0x8);
  345. exynos_irq_demux_eint(16, pend & ~mask, eintd->domain);
  346. pend = readl(d->virt_base + d->ctrl->weint_pend + 0xC);
  347. mask = readl(d->virt_base + d->ctrl->weint_mask + 0xC);
  348. exynos_irq_demux_eint(24, pend & ~mask, eintd->domain);
  349. chained_irq_exit(chip, desc);
  350. }
  351. static int exynos_wkup_irq_map(struct irq_domain *h, unsigned int virq,
  352. irq_hw_number_t hw)
  353. {
  354. irq_set_chip_and_handler(virq, &exynos_wkup_irq_chip, handle_level_irq);
  355. irq_set_chip_data(virq, h->host_data);
  356. set_irq_flags(virq, IRQF_VALID);
  357. return 0;
  358. }
  359. /*
  360. * irq domain callbacks for external wakeup interrupt controller.
  361. */
  362. static const struct irq_domain_ops exynos_wkup_irqd_ops = {
  363. .map = exynos_wkup_irq_map,
  364. .xlate = irq_domain_xlate_twocell,
  365. };
  366. /*
  367. * exynos_eint_wkup_init() - setup handling of external wakeup interrupts.
  368. * @d: driver data of samsung pinctrl driver.
  369. */
  370. static int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d)
  371. {
  372. struct device *dev = d->dev;
  373. struct device_node *wkup_np = NULL;
  374. struct device_node *np;
  375. struct exynos_weint_data *weint_data;
  376. int idx, irq;
  377. for_each_child_of_node(dev->of_node, np) {
  378. if (of_match_node(exynos_wkup_irq_ids, np)) {
  379. wkup_np = np;
  380. break;
  381. }
  382. }
  383. if (!wkup_np)
  384. return -ENODEV;
  385. d->wkup_irqd = irq_domain_add_linear(wkup_np, d->ctrl->nr_wint,
  386. &exynos_wkup_irqd_ops, d);
  387. if (!d->wkup_irqd) {
  388. dev_err(dev, "wakeup irq domain allocation failed\n");
  389. return -ENXIO;
  390. }
  391. weint_data = devm_kzalloc(dev, sizeof(*weint_data) * 17, GFP_KERNEL);
  392. if (!weint_data) {
  393. dev_err(dev, "could not allocate memory for weint_data\n");
  394. return -ENOMEM;
  395. }
  396. irq = irq_of_parse_and_map(wkup_np, 16);
  397. if (irq) {
  398. weint_data[16].domain = d->wkup_irqd;
  399. irq_set_chained_handler(irq, exynos_irq_demux_eint16_31);
  400. irq_set_handler_data(irq, &weint_data[16]);
  401. } else {
  402. dev_err(dev, "irq number for EINT16-32 not found\n");
  403. }
  404. for (idx = 0; idx < 16; idx++) {
  405. weint_data[idx].domain = d->wkup_irqd;
  406. weint_data[idx].irq = idx;
  407. irq = irq_of_parse_and_map(wkup_np, idx);
  408. if (irq) {
  409. irq_set_handler_data(irq, &weint_data[idx]);
  410. irq_set_chained_handler(irq, exynos_irq_eint0_15);
  411. } else {
  412. dev_err(dev, "irq number for eint-%x not found\n", idx);
  413. }
  414. }
  415. return 0;
  416. }
  417. /* pin banks of exynos4210 pin-controller 0 */
  418. static struct samsung_pin_bank exynos4210_pin_banks0[] = {
  419. EXYNOS_PIN_BANK_EINTG(0x000, EXYNOS4210_GPIO_A0, "gpa0"),
  420. EXYNOS_PIN_BANK_EINTG(0x020, EXYNOS4210_GPIO_A1, "gpa1"),
  421. EXYNOS_PIN_BANK_EINTG(0x040, EXYNOS4210_GPIO_B, "gpb"),
  422. EXYNOS_PIN_BANK_EINTG(0x060, EXYNOS4210_GPIO_C0, "gpc0"),
  423. EXYNOS_PIN_BANK_EINTG(0x080, EXYNOS4210_GPIO_C1, "gpc1"),
  424. EXYNOS_PIN_BANK_EINTG(0x0A0, EXYNOS4210_GPIO_D0, "gpd0"),
  425. EXYNOS_PIN_BANK_EINTG(0x0C0, EXYNOS4210_GPIO_D1, "gpd1"),
  426. EXYNOS_PIN_BANK_EINTG(0x0E0, EXYNOS4210_GPIO_E0, "gpe0"),
  427. EXYNOS_PIN_BANK_EINTG(0x100, EXYNOS4210_GPIO_E1, "gpe1"),
  428. EXYNOS_PIN_BANK_EINTG(0x120, EXYNOS4210_GPIO_E2, "gpe2"),
  429. EXYNOS_PIN_BANK_EINTG(0x140, EXYNOS4210_GPIO_E3, "gpe3"),
  430. EXYNOS_PIN_BANK_EINTG(0x160, EXYNOS4210_GPIO_E4, "gpe4"),
  431. EXYNOS_PIN_BANK_EINTG(0x180, EXYNOS4210_GPIO_F0, "gpf0"),
  432. EXYNOS_PIN_BANK_EINTG(0x1A0, EXYNOS4210_GPIO_F1, "gpf1"),
  433. EXYNOS_PIN_BANK_EINTG(0x1C0, EXYNOS4210_GPIO_F2, "gpf2"),
  434. EXYNOS_PIN_BANK_EINTG(0x1E0, EXYNOS4210_GPIO_F3, "gpf3"),
  435. };
  436. /* pin banks of exynos4210 pin-controller 1 */
  437. static struct samsung_pin_bank exynos4210_pin_banks1[] = {
  438. EXYNOS_PIN_BANK_EINTG(0x000, EXYNOS4210_GPIO_J0, "gpj0"),
  439. EXYNOS_PIN_BANK_EINTG(0x020, EXYNOS4210_GPIO_J1, "gpj1"),
  440. EXYNOS_PIN_BANK_EINTG(0x040, EXYNOS4210_GPIO_K0, "gpk0"),
  441. EXYNOS_PIN_BANK_EINTG(0x060, EXYNOS4210_GPIO_K1, "gpk1"),
  442. EXYNOS_PIN_BANK_EINTG(0x080, EXYNOS4210_GPIO_K2, "gpk2"),
  443. EXYNOS_PIN_BANK_EINTG(0x0A0, EXYNOS4210_GPIO_K3, "gpk3"),
  444. EXYNOS_PIN_BANK_EINTG(0x0C0, EXYNOS4210_GPIO_L0, "gpl0"),
  445. EXYNOS_PIN_BANK_EINTG(0x0E0, EXYNOS4210_GPIO_L1, "gpl1"),
  446. EXYNOS_PIN_BANK_EINTG(0x100, EXYNOS4210_GPIO_L2, "gpl2"),
  447. EXYNOS_PIN_BANK_EINTN(0x120, EXYNOS4210_GPIO_Y0, "gpy0"),
  448. EXYNOS_PIN_BANK_EINTN(0x140, EXYNOS4210_GPIO_Y1, "gpy1"),
  449. EXYNOS_PIN_BANK_EINTN(0x160, EXYNOS4210_GPIO_Y2, "gpy2"),
  450. EXYNOS_PIN_BANK_EINTN(0x180, EXYNOS4210_GPIO_Y3, "gpy3"),
  451. EXYNOS_PIN_BANK_EINTN(0x1A0, EXYNOS4210_GPIO_Y4, "gpy4"),
  452. EXYNOS_PIN_BANK_EINTN(0x1C0, EXYNOS4210_GPIO_Y5, "gpy5"),
  453. EXYNOS_PIN_BANK_EINTN(0x1E0, EXYNOS4210_GPIO_Y6, "gpy6"),
  454. EXYNOS_PIN_BANK_EINTN(0xC00, EXYNOS4210_GPIO_X0, "gpx0"),
  455. EXYNOS_PIN_BANK_EINTN(0xC20, EXYNOS4210_GPIO_X1, "gpx1"),
  456. EXYNOS_PIN_BANK_EINTN(0xC40, EXYNOS4210_GPIO_X2, "gpx2"),
  457. EXYNOS_PIN_BANK_EINTN(0xC60, EXYNOS4210_GPIO_X3, "gpx3"),
  458. };
  459. /* pin banks of exynos4210 pin-controller 2 */
  460. static struct samsung_pin_bank exynos4210_pin_banks2[] = {
  461. EXYNOS_PIN_BANK_EINTN(0x000, EXYNOS4210_GPIO_Z, "gpz"),
  462. };
  463. /*
  464. * Samsung pinctrl driver data for Exynos4210 SoC. Exynos4210 SoC includes
  465. * three gpio/pin-mux/pinconfig controllers.
  466. */
  467. struct samsung_pin_ctrl exynos4210_pin_ctrl[] = {
  468. {
  469. /* pin-controller instance 0 data */
  470. .pin_banks = exynos4210_pin_banks0,
  471. .nr_banks = ARRAY_SIZE(exynos4210_pin_banks0),
  472. .base = EXYNOS4210_GPIO_A0_START,
  473. .nr_pins = EXYNOS4210_GPIOA_NR_PINS,
  474. .nr_gint = EXYNOS4210_GPIOA_NR_GINT,
  475. .geint_con = EXYNOS_GPIO_ECON_OFFSET,
  476. .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
  477. .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
  478. .svc = EXYNOS_SVC_OFFSET,
  479. .eint_gpio_init = exynos_eint_gpio_init,
  480. .label = "exynos4210-gpio-ctrl0",
  481. }, {
  482. /* pin-controller instance 1 data */
  483. .pin_banks = exynos4210_pin_banks1,
  484. .nr_banks = ARRAY_SIZE(exynos4210_pin_banks1),
  485. .base = EXYNOS4210_GPIOA_NR_PINS,
  486. .nr_pins = EXYNOS4210_GPIOB_NR_PINS,
  487. .nr_gint = EXYNOS4210_GPIOB_NR_GINT,
  488. .nr_wint = 32,
  489. .geint_con = EXYNOS_GPIO_ECON_OFFSET,
  490. .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
  491. .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
  492. .weint_con = EXYNOS_WKUP_ECON_OFFSET,
  493. .weint_mask = EXYNOS_WKUP_EMASK_OFFSET,
  494. .weint_pend = EXYNOS_WKUP_EPEND_OFFSET,
  495. .svc = EXYNOS_SVC_OFFSET,
  496. .eint_gpio_init = exynos_eint_gpio_init,
  497. .eint_wkup_init = exynos_eint_wkup_init,
  498. .label = "exynos4210-gpio-ctrl1",
  499. }, {
  500. /* pin-controller instance 2 data */
  501. .pin_banks = exynos4210_pin_banks2,
  502. .nr_banks = ARRAY_SIZE(exynos4210_pin_banks2),
  503. .base = EXYNOS4210_GPIOA_NR_PINS +
  504. EXYNOS4210_GPIOB_NR_PINS,
  505. .nr_pins = EXYNOS4210_GPIOC_NR_PINS,
  506. .label = "exynos4210-gpio-ctrl2",
  507. },
  508. };