pinctrl-exynos.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  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;
  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. }
  142. if (idx == nr_banks) {
  143. dev_err(d->dev, "pin bank not found for ext-gpio interrupt\n");
  144. return NULL;
  145. }
  146. eint_data = devm_kzalloc(d->dev, sizeof(*eint_data), GFP_KERNEL);
  147. if (!eint_data) {
  148. dev_err(d->dev, "no memory for eint-gpio data\n");
  149. return NULL;
  150. }
  151. eint_data->bank = bank;
  152. eint_data->pin = hw - irq_base;
  153. eint_data->eint_offset = bank->eint_offset;
  154. return eint_data;
  155. }
  156. static int exynos_gpio_irq_map(struct irq_domain *h, unsigned int virq,
  157. irq_hw_number_t hw)
  158. {
  159. struct samsung_pinctrl_drv_data *d = h->host_data;
  160. struct exynos_geint_data *eint_data;
  161. eint_data = exynos_get_eint_data(hw, d);
  162. if (!eint_data)
  163. return -EINVAL;
  164. irq_set_handler_data(virq, eint_data);
  165. irq_set_chip_data(virq, h->host_data);
  166. irq_set_chip_and_handler(virq, &exynos_gpio_irq_chip,
  167. handle_level_irq);
  168. set_irq_flags(virq, IRQF_VALID);
  169. return 0;
  170. }
  171. static void exynos_gpio_irq_unmap(struct irq_domain *h, unsigned int virq)
  172. {
  173. struct samsung_pinctrl_drv_data *d = h->host_data;
  174. struct exynos_geint_data *eint_data;
  175. eint_data = irq_get_handler_data(virq);
  176. devm_kfree(d->dev, eint_data);
  177. }
  178. /*
  179. * irq domain callbacks for external gpio interrupt controller.
  180. */
  181. static const struct irq_domain_ops exynos_gpio_irqd_ops = {
  182. .map = exynos_gpio_irq_map,
  183. .unmap = exynos_gpio_irq_unmap,
  184. .xlate = irq_domain_xlate_twocell,
  185. };
  186. static irqreturn_t exynos_eint_gpio_irq(int irq, void *data)
  187. {
  188. struct samsung_pinctrl_drv_data *d = data;
  189. struct samsung_pin_ctrl *ctrl = d->ctrl;
  190. struct samsung_pin_bank *bank = ctrl->pin_banks;
  191. unsigned int svc, group, pin, virq;
  192. svc = readl(d->virt_base + ctrl->svc);
  193. group = EXYNOS_SVC_GROUP(svc);
  194. pin = svc & EXYNOS_SVC_NUM_MASK;
  195. if (!group)
  196. return IRQ_HANDLED;
  197. bank += (group - 1);
  198. virq = irq_linear_revmap(d->gpio_irqd, bank->irq_base + pin);
  199. if (!virq)
  200. return IRQ_NONE;
  201. generic_handle_irq(virq);
  202. return IRQ_HANDLED;
  203. }
  204. /*
  205. * exynos_eint_gpio_init() - setup handling of external gpio interrupts.
  206. * @d: driver data of samsung pinctrl driver.
  207. */
  208. static int exynos_eint_gpio_init(struct samsung_pinctrl_drv_data *d)
  209. {
  210. struct device *dev = d->dev;
  211. unsigned int ret;
  212. if (!d->irq) {
  213. dev_err(dev, "irq number not available\n");
  214. return -EINVAL;
  215. }
  216. ret = devm_request_irq(dev, d->irq, exynos_eint_gpio_irq,
  217. 0, dev_name(dev), d);
  218. if (ret) {
  219. dev_err(dev, "irq request failed\n");
  220. return -ENXIO;
  221. }
  222. d->gpio_irqd = irq_domain_add_linear(dev->of_node, d->ctrl->nr_gint,
  223. &exynos_gpio_irqd_ops, d);
  224. if (!d->gpio_irqd) {
  225. dev_err(dev, "gpio irq domain allocation failed\n");
  226. return -ENXIO;
  227. }
  228. return 0;
  229. }
  230. static void exynos_wkup_irq_unmask(struct irq_data *irqd)
  231. {
  232. struct samsung_pinctrl_drv_data *d = irq_data_get_irq_chip_data(irqd);
  233. unsigned int bank = irqd->hwirq / EXYNOS_EINT_MAX_PER_BANK;
  234. unsigned int pin = irqd->hwirq & (EXYNOS_EINT_MAX_PER_BANK - 1);
  235. unsigned long reg_mask = d->ctrl->weint_mask + (bank << 2);
  236. unsigned long mask;
  237. mask = readl(d->virt_base + reg_mask);
  238. mask &= ~(1 << pin);
  239. writel(mask, d->virt_base + reg_mask);
  240. }
  241. static void exynos_wkup_irq_mask(struct irq_data *irqd)
  242. {
  243. struct samsung_pinctrl_drv_data *d = irq_data_get_irq_chip_data(irqd);
  244. unsigned int bank = irqd->hwirq / EXYNOS_EINT_MAX_PER_BANK;
  245. unsigned int pin = irqd->hwirq & (EXYNOS_EINT_MAX_PER_BANK - 1);
  246. unsigned long reg_mask = d->ctrl->weint_mask + (bank << 2);
  247. unsigned long mask;
  248. mask = readl(d->virt_base + reg_mask);
  249. mask |= 1 << pin;
  250. writel(mask, d->virt_base + reg_mask);
  251. }
  252. static void exynos_wkup_irq_ack(struct irq_data *irqd)
  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 pend = d->ctrl->weint_pend + (bank << 2);
  258. writel(1 << pin, d->virt_base + pend);
  259. }
  260. static int exynos_wkup_irq_set_type(struct irq_data *irqd, unsigned int type)
  261. {
  262. struct samsung_pinctrl_drv_data *d = irq_data_get_irq_chip_data(irqd);
  263. unsigned int bank = irqd->hwirq / EXYNOS_EINT_MAX_PER_BANK;
  264. unsigned int pin = irqd->hwirq & (EXYNOS_EINT_MAX_PER_BANK - 1);
  265. unsigned long reg_con = d->ctrl->weint_con + (bank << 2);
  266. unsigned long shift = EXYNOS_EINT_CON_LEN * pin;
  267. unsigned long con, trig_type;
  268. switch (type) {
  269. case IRQ_TYPE_EDGE_RISING:
  270. trig_type = EXYNOS_EINT_EDGE_RISING;
  271. break;
  272. case IRQ_TYPE_EDGE_FALLING:
  273. trig_type = EXYNOS_EINT_EDGE_FALLING;
  274. break;
  275. case IRQ_TYPE_EDGE_BOTH:
  276. trig_type = EXYNOS_EINT_EDGE_BOTH;
  277. break;
  278. case IRQ_TYPE_LEVEL_HIGH:
  279. trig_type = EXYNOS_EINT_LEVEL_HIGH;
  280. break;
  281. case IRQ_TYPE_LEVEL_LOW:
  282. trig_type = EXYNOS_EINT_LEVEL_LOW;
  283. break;
  284. default:
  285. pr_err("unsupported external interrupt type\n");
  286. return -EINVAL;
  287. }
  288. if (type & IRQ_TYPE_EDGE_BOTH)
  289. __irq_set_handler_locked(irqd->irq, handle_edge_irq);
  290. else
  291. __irq_set_handler_locked(irqd->irq, handle_level_irq);
  292. con = readl(d->virt_base + reg_con);
  293. con &= ~(EXYNOS_EINT_CON_MASK << shift);
  294. con |= trig_type << shift;
  295. writel(con, d->virt_base + reg_con);
  296. return 0;
  297. }
  298. /*
  299. * irq_chip for wakeup interrupts
  300. */
  301. static struct irq_chip exynos_wkup_irq_chip = {
  302. .name = "exynos_wkup_irq_chip",
  303. .irq_unmask = exynos_wkup_irq_unmask,
  304. .irq_mask = exynos_wkup_irq_mask,
  305. .irq_ack = exynos_wkup_irq_ack,
  306. .irq_set_type = exynos_wkup_irq_set_type,
  307. };
  308. /* interrupt handler for wakeup interrupts 0..15 */
  309. static void exynos_irq_eint0_15(unsigned int irq, struct irq_desc *desc)
  310. {
  311. struct exynos_weint_data *eintd = irq_get_handler_data(irq);
  312. struct irq_chip *chip = irq_get_chip(irq);
  313. int eint_irq;
  314. chained_irq_enter(chip, desc);
  315. chip->irq_mask(&desc->irq_data);
  316. if (chip->irq_ack)
  317. chip->irq_ack(&desc->irq_data);
  318. eint_irq = irq_linear_revmap(eintd->domain, eintd->irq);
  319. generic_handle_irq(eint_irq);
  320. chip->irq_unmask(&desc->irq_data);
  321. chained_irq_exit(chip, desc);
  322. }
  323. static inline void exynos_irq_demux_eint(int irq_base, unsigned long pend,
  324. struct irq_domain *domain)
  325. {
  326. unsigned int irq;
  327. while (pend) {
  328. irq = fls(pend) - 1;
  329. generic_handle_irq(irq_find_mapping(domain, irq_base + irq));
  330. pend &= ~(1 << irq);
  331. }
  332. }
  333. /* interrupt handler for wakeup interrupt 16 */
  334. static void exynos_irq_demux_eint16_31(unsigned int irq, struct irq_desc *desc)
  335. {
  336. struct irq_chip *chip = irq_get_chip(irq);
  337. struct exynos_weint_data *eintd = irq_get_handler_data(irq);
  338. struct samsung_pinctrl_drv_data *d = eintd->domain->host_data;
  339. unsigned long pend;
  340. unsigned long mask;
  341. chained_irq_enter(chip, desc);
  342. pend = readl(d->virt_base + d->ctrl->weint_pend + 0x8);
  343. mask = readl(d->virt_base + d->ctrl->weint_mask + 0x8);
  344. exynos_irq_demux_eint(16, pend & ~mask, eintd->domain);
  345. pend = readl(d->virt_base + d->ctrl->weint_pend + 0xC);
  346. mask = readl(d->virt_base + d->ctrl->weint_mask + 0xC);
  347. exynos_irq_demux_eint(24, pend & ~mask, eintd->domain);
  348. chained_irq_exit(chip, desc);
  349. }
  350. static int exynos_wkup_irq_map(struct irq_domain *h, unsigned int virq,
  351. irq_hw_number_t hw)
  352. {
  353. irq_set_chip_and_handler(virq, &exynos_wkup_irq_chip, handle_level_irq);
  354. irq_set_chip_data(virq, h->host_data);
  355. set_irq_flags(virq, IRQF_VALID);
  356. return 0;
  357. }
  358. /*
  359. * irq domain callbacks for external wakeup interrupt controller.
  360. */
  361. static const struct irq_domain_ops exynos_wkup_irqd_ops = {
  362. .map = exynos_wkup_irq_map,
  363. .xlate = irq_domain_xlate_twocell,
  364. };
  365. /*
  366. * exynos_eint_wkup_init() - setup handling of external wakeup interrupts.
  367. * @d: driver data of samsung pinctrl driver.
  368. */
  369. static int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d)
  370. {
  371. struct device *dev = d->dev;
  372. struct device_node *wkup_np = NULL;
  373. struct device_node *np;
  374. struct exynos_weint_data *weint_data;
  375. int idx, irq;
  376. for_each_child_of_node(dev->of_node, np) {
  377. if (of_match_node(exynos_wkup_irq_ids, np)) {
  378. wkup_np = np;
  379. break;
  380. }
  381. }
  382. if (!wkup_np)
  383. return -ENODEV;
  384. d->wkup_irqd = irq_domain_add_linear(wkup_np, d->ctrl->nr_wint,
  385. &exynos_wkup_irqd_ops, d);
  386. if (!d->wkup_irqd) {
  387. dev_err(dev, "wakeup irq domain allocation failed\n");
  388. return -ENXIO;
  389. }
  390. weint_data = devm_kzalloc(dev, sizeof(*weint_data) * 17, GFP_KERNEL);
  391. if (!weint_data) {
  392. dev_err(dev, "could not allocate memory for weint_data\n");
  393. return -ENOMEM;
  394. }
  395. irq = irq_of_parse_and_map(wkup_np, 16);
  396. if (irq) {
  397. weint_data[16].domain = d->wkup_irqd;
  398. irq_set_chained_handler(irq, exynos_irq_demux_eint16_31);
  399. irq_set_handler_data(irq, &weint_data[16]);
  400. } else {
  401. dev_err(dev, "irq number for EINT16-32 not found\n");
  402. }
  403. for (idx = 0; idx < 16; idx++) {
  404. weint_data[idx].domain = d->wkup_irqd;
  405. weint_data[idx].irq = idx;
  406. irq = irq_of_parse_and_map(wkup_np, idx);
  407. if (irq) {
  408. irq_set_handler_data(irq, &weint_data[idx]);
  409. irq_set_chained_handler(irq, exynos_irq_eint0_15);
  410. } else {
  411. dev_err(dev, "irq number for eint-%x not found\n", idx);
  412. }
  413. }
  414. return 0;
  415. }
  416. /* pin banks of exynos4210 pin-controller 0 */
  417. static struct samsung_pin_bank exynos4210_pin_banks0[] = {
  418. EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00),
  419. EXYNOS_PIN_BANK_EINTG(6, 0x020, "gpa1", 0x04),
  420. EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpb", 0x08),
  421. EXYNOS_PIN_BANK_EINTG(5, 0x060, "gpc0", 0x0c),
  422. EXYNOS_PIN_BANK_EINTG(5, 0x080, "gpc1", 0x10),
  423. EXYNOS_PIN_BANK_EINTG(4, 0x0A0, "gpd0", 0x14),
  424. EXYNOS_PIN_BANK_EINTG(4, 0x0C0, "gpd1", 0x18),
  425. EXYNOS_PIN_BANK_EINTG(5, 0x0E0, "gpe0", 0x1c),
  426. EXYNOS_PIN_BANK_EINTG(8, 0x100, "gpe1", 0x20),
  427. EXYNOS_PIN_BANK_EINTG(6, 0x120, "gpe2", 0x24),
  428. EXYNOS_PIN_BANK_EINTG(8, 0x140, "gpe3", 0x28),
  429. EXYNOS_PIN_BANK_EINTG(8, 0x160, "gpe4", 0x2c),
  430. EXYNOS_PIN_BANK_EINTG(8, 0x180, "gpf0", 0x30),
  431. EXYNOS_PIN_BANK_EINTG(8, 0x1A0, "gpf1", 0x34),
  432. EXYNOS_PIN_BANK_EINTG(8, 0x1C0, "gpf2", 0x38),
  433. EXYNOS_PIN_BANK_EINTG(6, 0x1E0, "gpf3", 0x3c),
  434. };
  435. /* pin banks of exynos4210 pin-controller 1 */
  436. static struct samsung_pin_bank exynos4210_pin_banks1[] = {
  437. EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpj0", 0x00),
  438. EXYNOS_PIN_BANK_EINTG(5, 0x020, "gpj1", 0x04),
  439. EXYNOS_PIN_BANK_EINTG(7, 0x040, "gpk0", 0x08),
  440. EXYNOS_PIN_BANK_EINTG(7, 0x060, "gpk1", 0x0c),
  441. EXYNOS_PIN_BANK_EINTG(7, 0x080, "gpk2", 0x10),
  442. EXYNOS_PIN_BANK_EINTG(7, 0x0A0, "gpk3", 0x14),
  443. EXYNOS_PIN_BANK_EINTG(8, 0x0C0, "gpl0", 0x18),
  444. EXYNOS_PIN_BANK_EINTG(3, 0x0E0, "gpl1", 0x1c),
  445. EXYNOS_PIN_BANK_EINTG(8, 0x100, "gpl2", 0x20),
  446. EXYNOS_PIN_BANK_EINTN(6, 0x120, "gpy0"),
  447. EXYNOS_PIN_BANK_EINTN(4, 0x140, "gpy1"),
  448. EXYNOS_PIN_BANK_EINTN(6, 0x160, "gpy2"),
  449. EXYNOS_PIN_BANK_EINTN(8, 0x180, "gpy3"),
  450. EXYNOS_PIN_BANK_EINTN(8, 0x1A0, "gpy4"),
  451. EXYNOS_PIN_BANK_EINTN(8, 0x1C0, "gpy5"),
  452. EXYNOS_PIN_BANK_EINTN(8, 0x1E0, "gpy6"),
  453. EXYNOS_PIN_BANK_EINTN(8, 0xC00, "gpx0"),
  454. EXYNOS_PIN_BANK_EINTN(8, 0xC20, "gpx1"),
  455. EXYNOS_PIN_BANK_EINTN(8, 0xC40, "gpx2"),
  456. EXYNOS_PIN_BANK_EINTN(8, 0xC60, "gpx3"),
  457. };
  458. /* pin banks of exynos4210 pin-controller 2 */
  459. static struct samsung_pin_bank exynos4210_pin_banks2[] = {
  460. EXYNOS_PIN_BANK_EINTN(7, 0x000, "gpz"),
  461. };
  462. /*
  463. * Samsung pinctrl driver data for Exynos4210 SoC. Exynos4210 SoC includes
  464. * three gpio/pin-mux/pinconfig controllers.
  465. */
  466. struct samsung_pin_ctrl exynos4210_pin_ctrl[] = {
  467. {
  468. /* pin-controller instance 0 data */
  469. .pin_banks = exynos4210_pin_banks0,
  470. .nr_banks = ARRAY_SIZE(exynos4210_pin_banks0),
  471. .geint_con = EXYNOS_GPIO_ECON_OFFSET,
  472. .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
  473. .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
  474. .svc = EXYNOS_SVC_OFFSET,
  475. .eint_gpio_init = exynos_eint_gpio_init,
  476. .label = "exynos4210-gpio-ctrl0",
  477. }, {
  478. /* pin-controller instance 1 data */
  479. .pin_banks = exynos4210_pin_banks1,
  480. .nr_banks = ARRAY_SIZE(exynos4210_pin_banks1),
  481. .nr_wint = 32,
  482. .geint_con = EXYNOS_GPIO_ECON_OFFSET,
  483. .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
  484. .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
  485. .weint_con = EXYNOS_WKUP_ECON_OFFSET,
  486. .weint_mask = EXYNOS_WKUP_EMASK_OFFSET,
  487. .weint_pend = EXYNOS_WKUP_EPEND_OFFSET,
  488. .svc = EXYNOS_SVC_OFFSET,
  489. .eint_gpio_init = exynos_eint_gpio_init,
  490. .eint_wkup_init = exynos_eint_wkup_init,
  491. .label = "exynos4210-gpio-ctrl1",
  492. }, {
  493. /* pin-controller instance 2 data */
  494. .pin_banks = exynos4210_pin_banks2,
  495. .nr_banks = ARRAY_SIZE(exynos4210_pin_banks2),
  496. .label = "exynos4210-gpio-ctrl2",
  497. },
  498. };