pinctrl-exynos.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  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_pin_bank *bank = irq_data_get_irq_chip_data(irqd);
  39. struct samsung_pinctrl_drv_data *d = bank->drvdata;
  40. unsigned long reg_mask = d->ctrl->geint_mask + bank->eint_offset;
  41. unsigned long mask;
  42. mask = readl(d->virt_base + reg_mask);
  43. mask &= ~(1 << irqd->hwirq);
  44. writel(mask, d->virt_base + reg_mask);
  45. }
  46. static void exynos_gpio_irq_mask(struct irq_data *irqd)
  47. {
  48. struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd);
  49. struct samsung_pinctrl_drv_data *d = bank->drvdata;
  50. unsigned long reg_mask = d->ctrl->geint_mask + bank->eint_offset;
  51. unsigned long mask;
  52. mask = readl(d->virt_base + reg_mask);
  53. mask |= 1 << irqd->hwirq;
  54. writel(mask, d->virt_base + reg_mask);
  55. }
  56. static void exynos_gpio_irq_ack(struct irq_data *irqd)
  57. {
  58. struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd);
  59. struct samsung_pinctrl_drv_data *d = bank->drvdata;
  60. unsigned long reg_pend = d->ctrl->geint_pend + bank->eint_offset;
  61. writel(1 << irqd->hwirq, 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_pin_bank *bank = irq_data_get_irq_chip_data(irqd);
  66. struct samsung_pinctrl_drv_data *d = bank->drvdata;
  67. struct samsung_pin_ctrl *ctrl = d->ctrl;
  68. unsigned int pin = irqd->hwirq;
  69. unsigned int shift = EXYNOS_EINT_CON_LEN * pin;
  70. unsigned int con, trig_type;
  71. unsigned long reg_con = ctrl->geint_con + bank->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 = 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. static int exynos_gpio_irq_map(struct irq_domain *h, unsigned int virq,
  121. irq_hw_number_t hw)
  122. {
  123. struct samsung_pin_bank *b = h->host_data;
  124. irq_set_chip_data(virq, b);
  125. irq_set_chip_and_handler(virq, &exynos_gpio_irq_chip,
  126. handle_level_irq);
  127. set_irq_flags(virq, IRQF_VALID);
  128. return 0;
  129. }
  130. /*
  131. * irq domain callbacks for external gpio interrupt controller.
  132. */
  133. static const struct irq_domain_ops exynos_gpio_irqd_ops = {
  134. .map = exynos_gpio_irq_map,
  135. .xlate = irq_domain_xlate_twocell,
  136. };
  137. static irqreturn_t exynos_eint_gpio_irq(int irq, void *data)
  138. {
  139. struct samsung_pinctrl_drv_data *d = data;
  140. struct samsung_pin_ctrl *ctrl = d->ctrl;
  141. struct samsung_pin_bank *bank = ctrl->pin_banks;
  142. unsigned int svc, group, pin, virq;
  143. svc = readl(d->virt_base + ctrl->svc);
  144. group = EXYNOS_SVC_GROUP(svc);
  145. pin = svc & EXYNOS_SVC_NUM_MASK;
  146. if (!group)
  147. return IRQ_HANDLED;
  148. bank += (group - 1);
  149. virq = irq_linear_revmap(bank->irq_domain, pin);
  150. if (!virq)
  151. return IRQ_NONE;
  152. generic_handle_irq(virq);
  153. return IRQ_HANDLED;
  154. }
  155. /*
  156. * exynos_eint_gpio_init() - setup handling of external gpio interrupts.
  157. * @d: driver data of samsung pinctrl driver.
  158. */
  159. static int exynos_eint_gpio_init(struct samsung_pinctrl_drv_data *d)
  160. {
  161. struct samsung_pin_bank *bank;
  162. struct device *dev = d->dev;
  163. unsigned int ret;
  164. unsigned int i;
  165. if (!d->irq) {
  166. dev_err(dev, "irq number not available\n");
  167. return -EINVAL;
  168. }
  169. ret = devm_request_irq(dev, d->irq, exynos_eint_gpio_irq,
  170. 0, dev_name(dev), d);
  171. if (ret) {
  172. dev_err(dev, "irq request failed\n");
  173. return -ENXIO;
  174. }
  175. bank = d->ctrl->pin_banks;
  176. for (i = 0; i < d->ctrl->nr_banks; ++i, ++bank) {
  177. if (bank->eint_type != EINT_TYPE_GPIO)
  178. continue;
  179. bank->irq_domain = irq_domain_add_linear(bank->of_node,
  180. bank->nr_pins, &exynos_gpio_irqd_ops, bank);
  181. if (!bank->irq_domain) {
  182. dev_err(dev, "gpio irq domain add failed\n");
  183. return -ENXIO;
  184. }
  185. }
  186. return 0;
  187. }
  188. static void exynos_wkup_irq_unmask(struct irq_data *irqd)
  189. {
  190. struct samsung_pin_bank *b = irq_data_get_irq_chip_data(irqd);
  191. struct samsung_pinctrl_drv_data *d = b->drvdata;
  192. unsigned long reg_mask = d->ctrl->weint_mask + b->eint_offset;
  193. unsigned long mask;
  194. mask = readl(d->virt_base + reg_mask);
  195. mask &= ~(1 << irqd->hwirq);
  196. writel(mask, d->virt_base + reg_mask);
  197. }
  198. static void exynos_wkup_irq_mask(struct irq_data *irqd)
  199. {
  200. struct samsung_pin_bank *b = irq_data_get_irq_chip_data(irqd);
  201. struct samsung_pinctrl_drv_data *d = b->drvdata;
  202. unsigned long reg_mask = d->ctrl->weint_mask + b->eint_offset;
  203. unsigned long mask;
  204. mask = readl(d->virt_base + reg_mask);
  205. mask |= 1 << irqd->hwirq;
  206. writel(mask, d->virt_base + reg_mask);
  207. }
  208. static void exynos_wkup_irq_ack(struct irq_data *irqd)
  209. {
  210. struct samsung_pin_bank *b = irq_data_get_irq_chip_data(irqd);
  211. struct samsung_pinctrl_drv_data *d = b->drvdata;
  212. unsigned long pend = d->ctrl->weint_pend + b->eint_offset;
  213. writel(1 << irqd->hwirq, d->virt_base + pend);
  214. }
  215. static int exynos_wkup_irq_set_type(struct irq_data *irqd, unsigned int type)
  216. {
  217. struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd);
  218. struct samsung_pinctrl_drv_data *d = bank->drvdata;
  219. unsigned int pin = irqd->hwirq;
  220. unsigned long reg_con = d->ctrl->weint_con + bank->eint_offset;
  221. unsigned long shift = EXYNOS_EINT_CON_LEN * pin;
  222. unsigned long con, trig_type;
  223. unsigned int mask;
  224. switch (type) {
  225. case IRQ_TYPE_EDGE_RISING:
  226. trig_type = EXYNOS_EINT_EDGE_RISING;
  227. break;
  228. case IRQ_TYPE_EDGE_FALLING:
  229. trig_type = EXYNOS_EINT_EDGE_FALLING;
  230. break;
  231. case IRQ_TYPE_EDGE_BOTH:
  232. trig_type = EXYNOS_EINT_EDGE_BOTH;
  233. break;
  234. case IRQ_TYPE_LEVEL_HIGH:
  235. trig_type = EXYNOS_EINT_LEVEL_HIGH;
  236. break;
  237. case IRQ_TYPE_LEVEL_LOW:
  238. trig_type = EXYNOS_EINT_LEVEL_LOW;
  239. break;
  240. default:
  241. pr_err("unsupported external interrupt type\n");
  242. return -EINVAL;
  243. }
  244. if (type & IRQ_TYPE_EDGE_BOTH)
  245. __irq_set_handler_locked(irqd->irq, handle_edge_irq);
  246. else
  247. __irq_set_handler_locked(irqd->irq, handle_level_irq);
  248. con = readl(d->virt_base + reg_con);
  249. con &= ~(EXYNOS_EINT_CON_MASK << shift);
  250. con |= trig_type << shift;
  251. writel(con, d->virt_base + reg_con);
  252. reg_con = bank->pctl_offset;
  253. shift = pin * bank->func_width;
  254. mask = (1 << bank->func_width) - 1;
  255. con = readl(d->virt_base + reg_con);
  256. con &= ~(mask << shift);
  257. con |= EXYNOS_EINT_FUNC << shift;
  258. writel(con, d->virt_base + reg_con);
  259. return 0;
  260. }
  261. /*
  262. * irq_chip for wakeup interrupts
  263. */
  264. static struct irq_chip exynos_wkup_irq_chip = {
  265. .name = "exynos_wkup_irq_chip",
  266. .irq_unmask = exynos_wkup_irq_unmask,
  267. .irq_mask = exynos_wkup_irq_mask,
  268. .irq_ack = exynos_wkup_irq_ack,
  269. .irq_set_type = exynos_wkup_irq_set_type,
  270. };
  271. /* interrupt handler for wakeup interrupts 0..15 */
  272. static void exynos_irq_eint0_15(unsigned int irq, struct irq_desc *desc)
  273. {
  274. struct exynos_weint_data *eintd = irq_get_handler_data(irq);
  275. struct samsung_pin_bank *bank = eintd->bank;
  276. struct irq_chip *chip = irq_get_chip(irq);
  277. int eint_irq;
  278. chained_irq_enter(chip, desc);
  279. chip->irq_mask(&desc->irq_data);
  280. if (chip->irq_ack)
  281. chip->irq_ack(&desc->irq_data);
  282. eint_irq = irq_linear_revmap(bank->irq_domain, eintd->irq);
  283. generic_handle_irq(eint_irq);
  284. chip->irq_unmask(&desc->irq_data);
  285. chained_irq_exit(chip, desc);
  286. }
  287. static inline void exynos_irq_demux_eint(unsigned long pend,
  288. struct irq_domain *domain)
  289. {
  290. unsigned int irq;
  291. while (pend) {
  292. irq = fls(pend) - 1;
  293. generic_handle_irq(irq_find_mapping(domain, irq));
  294. pend &= ~(1 << irq);
  295. }
  296. }
  297. /* interrupt handler for wakeup interrupt 16 */
  298. static void exynos_irq_demux_eint16_31(unsigned int irq, struct irq_desc *desc)
  299. {
  300. struct irq_chip *chip = irq_get_chip(irq);
  301. struct exynos_muxed_weint_data *eintd = irq_get_handler_data(irq);
  302. struct samsung_pinctrl_drv_data *d = eintd->banks[0]->drvdata;
  303. struct samsung_pin_ctrl *ctrl = d->ctrl;
  304. unsigned long pend;
  305. unsigned long mask;
  306. int i;
  307. chained_irq_enter(chip, desc);
  308. for (i = 0; i < eintd->nr_banks; ++i) {
  309. struct samsung_pin_bank *b = eintd->banks[i];
  310. pend = readl(d->virt_base + ctrl->weint_pend + b->eint_offset);
  311. mask = readl(d->virt_base + ctrl->weint_mask + b->eint_offset);
  312. exynos_irq_demux_eint(pend & ~mask, b->irq_domain);
  313. }
  314. chained_irq_exit(chip, desc);
  315. }
  316. static int exynos_wkup_irq_map(struct irq_domain *h, unsigned int virq,
  317. irq_hw_number_t hw)
  318. {
  319. irq_set_chip_and_handler(virq, &exynos_wkup_irq_chip, handle_level_irq);
  320. irq_set_chip_data(virq, h->host_data);
  321. set_irq_flags(virq, IRQF_VALID);
  322. return 0;
  323. }
  324. /*
  325. * irq domain callbacks for external wakeup interrupt controller.
  326. */
  327. static const struct irq_domain_ops exynos_wkup_irqd_ops = {
  328. .map = exynos_wkup_irq_map,
  329. .xlate = irq_domain_xlate_twocell,
  330. };
  331. /*
  332. * exynos_eint_wkup_init() - setup handling of external wakeup interrupts.
  333. * @d: driver data of samsung pinctrl driver.
  334. */
  335. static int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d)
  336. {
  337. struct device *dev = d->dev;
  338. struct device_node *wkup_np = NULL;
  339. struct device_node *np;
  340. struct samsung_pin_bank *bank;
  341. struct exynos_weint_data *weint_data;
  342. struct exynos_muxed_weint_data *muxed_data;
  343. unsigned int muxed_banks = 0;
  344. unsigned int i;
  345. int idx, irq;
  346. for_each_child_of_node(dev->of_node, np) {
  347. if (of_match_node(exynos_wkup_irq_ids, np)) {
  348. wkup_np = np;
  349. break;
  350. }
  351. }
  352. if (!wkup_np)
  353. return -ENODEV;
  354. bank = d->ctrl->pin_banks;
  355. for (i = 0; i < d->ctrl->nr_banks; ++i, ++bank) {
  356. if (bank->eint_type != EINT_TYPE_WKUP)
  357. continue;
  358. bank->irq_domain = irq_domain_add_linear(bank->of_node,
  359. bank->nr_pins, &exynos_wkup_irqd_ops, bank);
  360. if (!bank->irq_domain) {
  361. dev_err(dev, "wkup irq domain add failed\n");
  362. return -ENXIO;
  363. }
  364. if (!of_find_property(bank->of_node, "interrupts", NULL)) {
  365. bank->eint_type = EINT_TYPE_WKUP_MUX;
  366. ++muxed_banks;
  367. continue;
  368. }
  369. weint_data = devm_kzalloc(dev, bank->nr_pins
  370. * sizeof(*weint_data), GFP_KERNEL);
  371. if (!weint_data) {
  372. dev_err(dev, "could not allocate memory for weint_data\n");
  373. return -ENOMEM;
  374. }
  375. for (idx = 0; idx < bank->nr_pins; ++idx) {
  376. irq = irq_of_parse_and_map(bank->of_node, idx);
  377. if (!irq) {
  378. dev_err(dev, "irq number for eint-%s-%d not found\n",
  379. bank->name, idx);
  380. continue;
  381. }
  382. weint_data[idx].irq = idx;
  383. weint_data[idx].bank = bank;
  384. irq_set_handler_data(irq, &weint_data[idx]);
  385. irq_set_chained_handler(irq, exynos_irq_eint0_15);
  386. }
  387. }
  388. if (!muxed_banks)
  389. return 0;
  390. irq = irq_of_parse_and_map(wkup_np, 0);
  391. if (!irq) {
  392. dev_err(dev, "irq number for muxed EINTs not found\n");
  393. return 0;
  394. }
  395. muxed_data = devm_kzalloc(dev, sizeof(*muxed_data)
  396. + muxed_banks*sizeof(struct samsung_pin_bank *), GFP_KERNEL);
  397. if (!muxed_data) {
  398. dev_err(dev, "could not allocate memory for muxed_data\n");
  399. return -ENOMEM;
  400. }
  401. irq_set_chained_handler(irq, exynos_irq_demux_eint16_31);
  402. irq_set_handler_data(irq, muxed_data);
  403. bank = d->ctrl->pin_banks;
  404. idx = 0;
  405. for (i = 0; i < d->ctrl->nr_banks; ++i, ++bank) {
  406. if (bank->eint_type != EINT_TYPE_WKUP_MUX)
  407. continue;
  408. muxed_data->banks[idx++] = bank;
  409. }
  410. muxed_data->nr_banks = muxed_banks;
  411. return 0;
  412. }
  413. /* pin banks of exynos4210 pin-controller 0 */
  414. static struct samsung_pin_bank exynos4210_pin_banks0[] = {
  415. EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00),
  416. EXYNOS_PIN_BANK_EINTG(6, 0x020, "gpa1", 0x04),
  417. EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpb", 0x08),
  418. EXYNOS_PIN_BANK_EINTG(5, 0x060, "gpc0", 0x0c),
  419. EXYNOS_PIN_BANK_EINTG(5, 0x080, "gpc1", 0x10),
  420. EXYNOS_PIN_BANK_EINTG(4, 0x0A0, "gpd0", 0x14),
  421. EXYNOS_PIN_BANK_EINTG(4, 0x0C0, "gpd1", 0x18),
  422. EXYNOS_PIN_BANK_EINTG(5, 0x0E0, "gpe0", 0x1c),
  423. EXYNOS_PIN_BANK_EINTG(8, 0x100, "gpe1", 0x20),
  424. EXYNOS_PIN_BANK_EINTG(6, 0x120, "gpe2", 0x24),
  425. EXYNOS_PIN_BANK_EINTG(8, 0x140, "gpe3", 0x28),
  426. EXYNOS_PIN_BANK_EINTG(8, 0x160, "gpe4", 0x2c),
  427. EXYNOS_PIN_BANK_EINTG(8, 0x180, "gpf0", 0x30),
  428. EXYNOS_PIN_BANK_EINTG(8, 0x1A0, "gpf1", 0x34),
  429. EXYNOS_PIN_BANK_EINTG(8, 0x1C0, "gpf2", 0x38),
  430. EXYNOS_PIN_BANK_EINTG(6, 0x1E0, "gpf3", 0x3c),
  431. };
  432. /* pin banks of exynos4210 pin-controller 1 */
  433. static struct samsung_pin_bank exynos4210_pin_banks1[] = {
  434. EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpj0", 0x00),
  435. EXYNOS_PIN_BANK_EINTG(5, 0x020, "gpj1", 0x04),
  436. EXYNOS_PIN_BANK_EINTG(7, 0x040, "gpk0", 0x08),
  437. EXYNOS_PIN_BANK_EINTG(7, 0x060, "gpk1", 0x0c),
  438. EXYNOS_PIN_BANK_EINTG(7, 0x080, "gpk2", 0x10),
  439. EXYNOS_PIN_BANK_EINTG(7, 0x0A0, "gpk3", 0x14),
  440. EXYNOS_PIN_BANK_EINTG(8, 0x0C0, "gpl0", 0x18),
  441. EXYNOS_PIN_BANK_EINTG(3, 0x0E0, "gpl1", 0x1c),
  442. EXYNOS_PIN_BANK_EINTG(8, 0x100, "gpl2", 0x20),
  443. EXYNOS_PIN_BANK_EINTN(6, 0x120, "gpy0"),
  444. EXYNOS_PIN_BANK_EINTN(4, 0x140, "gpy1"),
  445. EXYNOS_PIN_BANK_EINTN(6, 0x160, "gpy2"),
  446. EXYNOS_PIN_BANK_EINTN(8, 0x180, "gpy3"),
  447. EXYNOS_PIN_BANK_EINTN(8, 0x1A0, "gpy4"),
  448. EXYNOS_PIN_BANK_EINTN(8, 0x1C0, "gpy5"),
  449. EXYNOS_PIN_BANK_EINTN(8, 0x1E0, "gpy6"),
  450. EXYNOS_PIN_BANK_EINTW(8, 0xC00, "gpx0", 0x00),
  451. EXYNOS_PIN_BANK_EINTW(8, 0xC20, "gpx1", 0x04),
  452. EXYNOS_PIN_BANK_EINTW(8, 0xC40, "gpx2", 0x08),
  453. EXYNOS_PIN_BANK_EINTW(8, 0xC60, "gpx3", 0x0c),
  454. };
  455. /* pin banks of exynos4210 pin-controller 2 */
  456. static struct samsung_pin_bank exynos4210_pin_banks2[] = {
  457. EXYNOS_PIN_BANK_EINTN(7, 0x000, "gpz"),
  458. };
  459. /*
  460. * Samsung pinctrl driver data for Exynos4210 SoC. Exynos4210 SoC includes
  461. * three gpio/pin-mux/pinconfig controllers.
  462. */
  463. struct samsung_pin_ctrl exynos4210_pin_ctrl[] = {
  464. {
  465. /* pin-controller instance 0 data */
  466. .pin_banks = exynos4210_pin_banks0,
  467. .nr_banks = ARRAY_SIZE(exynos4210_pin_banks0),
  468. .geint_con = EXYNOS_GPIO_ECON_OFFSET,
  469. .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
  470. .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
  471. .svc = EXYNOS_SVC_OFFSET,
  472. .eint_gpio_init = exynos_eint_gpio_init,
  473. .label = "exynos4210-gpio-ctrl0",
  474. }, {
  475. /* pin-controller instance 1 data */
  476. .pin_banks = exynos4210_pin_banks1,
  477. .nr_banks = ARRAY_SIZE(exynos4210_pin_banks1),
  478. .geint_con = EXYNOS_GPIO_ECON_OFFSET,
  479. .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
  480. .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
  481. .weint_con = EXYNOS_WKUP_ECON_OFFSET,
  482. .weint_mask = EXYNOS_WKUP_EMASK_OFFSET,
  483. .weint_pend = EXYNOS_WKUP_EPEND_OFFSET,
  484. .svc = EXYNOS_SVC_OFFSET,
  485. .eint_gpio_init = exynos_eint_gpio_init,
  486. .eint_wkup_init = exynos_eint_wkup_init,
  487. .label = "exynos4210-gpio-ctrl1",
  488. }, {
  489. /* pin-controller instance 2 data */
  490. .pin_banks = exynos4210_pin_banks2,
  491. .nr_banks = ARRAY_SIZE(exynos4210_pin_banks2),
  492. .label = "exynos4210-gpio-ctrl2",
  493. },
  494. };
  495. /* pin banks of exynos4x12 pin-controller 0 */
  496. static struct samsung_pin_bank exynos4x12_pin_banks0[] = {
  497. EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00),
  498. EXYNOS_PIN_BANK_EINTG(6, 0x020, "gpa1", 0x04),
  499. EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpb", 0x08),
  500. EXYNOS_PIN_BANK_EINTG(5, 0x060, "gpc0", 0x0c),
  501. EXYNOS_PIN_BANK_EINTG(5, 0x080, "gpc1", 0x10),
  502. EXYNOS_PIN_BANK_EINTG(4, 0x0A0, "gpd0", 0x14),
  503. EXYNOS_PIN_BANK_EINTG(4, 0x0C0, "gpd1", 0x18),
  504. EXYNOS_PIN_BANK_EINTG(8, 0x180, "gpf0", 0x30),
  505. EXYNOS_PIN_BANK_EINTG(8, 0x1A0, "gpf1", 0x34),
  506. EXYNOS_PIN_BANK_EINTG(8, 0x1C0, "gpf2", 0x38),
  507. EXYNOS_PIN_BANK_EINTG(6, 0x1E0, "gpf3", 0x3c),
  508. EXYNOS_PIN_BANK_EINTG(8, 0x240, "gpj0", 0x40),
  509. EXYNOS_PIN_BANK_EINTG(5, 0x260, "gpj1", 0x44),
  510. };
  511. /* pin banks of exynos4x12 pin-controller 1 */
  512. static struct samsung_pin_bank exynos4x12_pin_banks1[] = {
  513. EXYNOS_PIN_BANK_EINTG(7, 0x040, "gpk0", 0x08),
  514. EXYNOS_PIN_BANK_EINTG(7, 0x060, "gpk1", 0x0c),
  515. EXYNOS_PIN_BANK_EINTG(7, 0x080, "gpk2", 0x10),
  516. EXYNOS_PIN_BANK_EINTG(7, 0x0A0, "gpk3", 0x14),
  517. EXYNOS_PIN_BANK_EINTG(7, 0x0C0, "gpl0", 0x18),
  518. EXYNOS_PIN_BANK_EINTG(2, 0x0E0, "gpl1", 0x1c),
  519. EXYNOS_PIN_BANK_EINTG(8, 0x100, "gpl2", 0x20),
  520. EXYNOS_PIN_BANK_EINTG(8, 0x260, "gpm0", 0x24),
  521. EXYNOS_PIN_BANK_EINTG(7, 0x280, "gpm1", 0x28),
  522. EXYNOS_PIN_BANK_EINTG(5, 0x2A0, "gpm2", 0x2c),
  523. EXYNOS_PIN_BANK_EINTG(8, 0x2C0, "gpm3", 0x30),
  524. EXYNOS_PIN_BANK_EINTG(8, 0x2E0, "gpm4", 0x34),
  525. EXYNOS_PIN_BANK_EINTN(6, 0x120, "gpy0"),
  526. EXYNOS_PIN_BANK_EINTN(4, 0x140, "gpy1"),
  527. EXYNOS_PIN_BANK_EINTN(6, 0x160, "gpy2"),
  528. EXYNOS_PIN_BANK_EINTN(8, 0x180, "gpy3"),
  529. EXYNOS_PIN_BANK_EINTN(8, 0x1A0, "gpy4"),
  530. EXYNOS_PIN_BANK_EINTN(8, 0x1C0, "gpy5"),
  531. EXYNOS_PIN_BANK_EINTN(8, 0x1E0, "gpy6"),
  532. EXYNOS_PIN_BANK_EINTW(8, 0xC00, "gpx0", 0x00),
  533. EXYNOS_PIN_BANK_EINTW(8, 0xC20, "gpx1", 0x04),
  534. EXYNOS_PIN_BANK_EINTW(8, 0xC40, "gpx2", 0x08),
  535. EXYNOS_PIN_BANK_EINTW(8, 0xC60, "gpx3", 0x0c),
  536. };
  537. /* pin banks of exynos4x12 pin-controller 2 */
  538. static struct samsung_pin_bank exynos4x12_pin_banks2[] = {
  539. EXYNOS_PIN_BANK_EINTG(7, 0x000, "gpz", 0x00),
  540. };
  541. /* pin banks of exynos4x12 pin-controller 3 */
  542. static struct samsung_pin_bank exynos4x12_pin_banks3[] = {
  543. EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpv0", 0x00),
  544. EXYNOS_PIN_BANK_EINTG(8, 0x020, "gpv1", 0x04),
  545. EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpv2", 0x08),
  546. EXYNOS_PIN_BANK_EINTG(8, 0x060, "gpv3", 0x0c),
  547. EXYNOS_PIN_BANK_EINTG(2, 0x080, "gpv4", 0x10),
  548. };
  549. /*
  550. * Samsung pinctrl driver data for Exynos4x12 SoC. Exynos4x12 SoC includes
  551. * four gpio/pin-mux/pinconfig controllers.
  552. */
  553. struct samsung_pin_ctrl exynos4x12_pin_ctrl[] = {
  554. {
  555. /* pin-controller instance 0 data */
  556. .pin_banks = exynos4x12_pin_banks0,
  557. .nr_banks = ARRAY_SIZE(exynos4x12_pin_banks0),
  558. .geint_con = EXYNOS_GPIO_ECON_OFFSET,
  559. .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
  560. .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
  561. .svc = EXYNOS_SVC_OFFSET,
  562. .eint_gpio_init = exynos_eint_gpio_init,
  563. .label = "exynos4x12-gpio-ctrl0",
  564. }, {
  565. /* pin-controller instance 1 data */
  566. .pin_banks = exynos4x12_pin_banks1,
  567. .nr_banks = ARRAY_SIZE(exynos4x12_pin_banks1),
  568. .geint_con = EXYNOS_GPIO_ECON_OFFSET,
  569. .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
  570. .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
  571. .weint_con = EXYNOS_WKUP_ECON_OFFSET,
  572. .weint_mask = EXYNOS_WKUP_EMASK_OFFSET,
  573. .weint_pend = EXYNOS_WKUP_EPEND_OFFSET,
  574. .svc = EXYNOS_SVC_OFFSET,
  575. .eint_gpio_init = exynos_eint_gpio_init,
  576. .eint_wkup_init = exynos_eint_wkup_init,
  577. .label = "exynos4x12-gpio-ctrl1",
  578. }, {
  579. /* pin-controller instance 2 data */
  580. .pin_banks = exynos4x12_pin_banks2,
  581. .nr_banks = ARRAY_SIZE(exynos4x12_pin_banks2),
  582. .geint_con = EXYNOS_GPIO_ECON_OFFSET,
  583. .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
  584. .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
  585. .svc = EXYNOS_SVC_OFFSET,
  586. .eint_gpio_init = exynos_eint_gpio_init,
  587. .label = "exynos4x12-gpio-ctrl2",
  588. }, {
  589. /* pin-controller instance 3 data */
  590. .pin_banks = exynos4x12_pin_banks3,
  591. .nr_banks = ARRAY_SIZE(exynos4x12_pin_banks3),
  592. .geint_con = EXYNOS_GPIO_ECON_OFFSET,
  593. .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
  594. .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
  595. .svc = EXYNOS_SVC_OFFSET,
  596. .eint_gpio_init = exynos_eint_gpio_init,
  597. .label = "exynos4x12-gpio-ctrl3",
  598. },
  599. };