pinctrl-exynos.c 20 KB

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