pinctrl-exynos.c 17 KB

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