pinctrl-exynos.c 21 KB

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