pinctrl-exynos.c 21 KB

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