pinctrl-exynos.c 17 KB

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