gpio-mxc.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  1. // SPDX-License-Identifier: GPL-2.0+
  2. //
  3. // MXC GPIO support. (c) 2008 Daniel Mack <daniel@caiaq.de>
  4. // Copyright 2008 Juergen Beisert, kernel@pengutronix.de
  5. //
  6. // Based on code from Freescale Semiconductor,
  7. // Authors: Daniel Mack, Juergen Beisert.
  8. // Copyright (C) 2004-2010 Freescale Semiconductor, Inc. All Rights Reserved.
  9. #include <linux/clk.h>
  10. #include <linux/err.h>
  11. #include <linux/init.h>
  12. #include <linux/interrupt.h>
  13. #include <linux/io.h>
  14. #include <linux/irq.h>
  15. #include <linux/irqdomain.h>
  16. #include <linux/irqchip/chained_irq.h>
  17. #include <linux/platform_device.h>
  18. #include <linux/slab.h>
  19. #include <linux/syscore_ops.h>
  20. #include <linux/gpio/driver.h>
  21. #include <linux/of.h>
  22. #include <linux/of_device.h>
  23. #include <linux/bug.h>
  24. enum mxc_gpio_hwtype {
  25. IMX1_GPIO, /* runs on i.mx1 */
  26. IMX21_GPIO, /* runs on i.mx21 and i.mx27 */
  27. IMX31_GPIO, /* runs on i.mx31 */
  28. IMX35_GPIO, /* runs on all other i.mx */
  29. };
  30. /* device type dependent stuff */
  31. struct mxc_gpio_hwdata {
  32. unsigned dr_reg;
  33. unsigned gdir_reg;
  34. unsigned psr_reg;
  35. unsigned icr1_reg;
  36. unsigned icr2_reg;
  37. unsigned imr_reg;
  38. unsigned isr_reg;
  39. int edge_sel_reg;
  40. unsigned low_level;
  41. unsigned high_level;
  42. unsigned rise_edge;
  43. unsigned fall_edge;
  44. };
  45. struct mxc_gpio_reg_saved {
  46. u32 icr1;
  47. u32 icr2;
  48. u32 imr;
  49. u32 gdir;
  50. u32 edge_sel;
  51. u32 dr;
  52. };
  53. struct mxc_gpio_port {
  54. struct list_head node;
  55. void __iomem *base;
  56. struct clk *clk;
  57. int irq;
  58. int irq_high;
  59. struct irq_domain *domain;
  60. struct gpio_chip gc;
  61. struct device *dev;
  62. u32 both_edges;
  63. struct mxc_gpio_reg_saved gpio_saved_reg;
  64. bool power_off;
  65. };
  66. static struct mxc_gpio_hwdata imx1_imx21_gpio_hwdata = {
  67. .dr_reg = 0x1c,
  68. .gdir_reg = 0x00,
  69. .psr_reg = 0x24,
  70. .icr1_reg = 0x28,
  71. .icr2_reg = 0x2c,
  72. .imr_reg = 0x30,
  73. .isr_reg = 0x34,
  74. .edge_sel_reg = -EINVAL,
  75. .low_level = 0x03,
  76. .high_level = 0x02,
  77. .rise_edge = 0x00,
  78. .fall_edge = 0x01,
  79. };
  80. static struct mxc_gpio_hwdata imx31_gpio_hwdata = {
  81. .dr_reg = 0x00,
  82. .gdir_reg = 0x04,
  83. .psr_reg = 0x08,
  84. .icr1_reg = 0x0c,
  85. .icr2_reg = 0x10,
  86. .imr_reg = 0x14,
  87. .isr_reg = 0x18,
  88. .edge_sel_reg = -EINVAL,
  89. .low_level = 0x00,
  90. .high_level = 0x01,
  91. .rise_edge = 0x02,
  92. .fall_edge = 0x03,
  93. };
  94. static struct mxc_gpio_hwdata imx35_gpio_hwdata = {
  95. .dr_reg = 0x00,
  96. .gdir_reg = 0x04,
  97. .psr_reg = 0x08,
  98. .icr1_reg = 0x0c,
  99. .icr2_reg = 0x10,
  100. .imr_reg = 0x14,
  101. .isr_reg = 0x18,
  102. .edge_sel_reg = 0x1c,
  103. .low_level = 0x00,
  104. .high_level = 0x01,
  105. .rise_edge = 0x02,
  106. .fall_edge = 0x03,
  107. };
  108. static enum mxc_gpio_hwtype mxc_gpio_hwtype;
  109. static struct mxc_gpio_hwdata *mxc_gpio_hwdata;
  110. #define GPIO_DR (mxc_gpio_hwdata->dr_reg)
  111. #define GPIO_GDIR (mxc_gpio_hwdata->gdir_reg)
  112. #define GPIO_PSR (mxc_gpio_hwdata->psr_reg)
  113. #define GPIO_ICR1 (mxc_gpio_hwdata->icr1_reg)
  114. #define GPIO_ICR2 (mxc_gpio_hwdata->icr2_reg)
  115. #define GPIO_IMR (mxc_gpio_hwdata->imr_reg)
  116. #define GPIO_ISR (mxc_gpio_hwdata->isr_reg)
  117. #define GPIO_EDGE_SEL (mxc_gpio_hwdata->edge_sel_reg)
  118. #define GPIO_INT_LOW_LEV (mxc_gpio_hwdata->low_level)
  119. #define GPIO_INT_HIGH_LEV (mxc_gpio_hwdata->high_level)
  120. #define GPIO_INT_RISE_EDGE (mxc_gpio_hwdata->rise_edge)
  121. #define GPIO_INT_FALL_EDGE (mxc_gpio_hwdata->fall_edge)
  122. #define GPIO_INT_BOTH_EDGES 0x4
  123. static const struct platform_device_id mxc_gpio_devtype[] = {
  124. {
  125. .name = "imx1-gpio",
  126. .driver_data = IMX1_GPIO,
  127. }, {
  128. .name = "imx21-gpio",
  129. .driver_data = IMX21_GPIO,
  130. }, {
  131. .name = "imx31-gpio",
  132. .driver_data = IMX31_GPIO,
  133. }, {
  134. .name = "imx35-gpio",
  135. .driver_data = IMX35_GPIO,
  136. }, {
  137. /* sentinel */
  138. }
  139. };
  140. static const struct of_device_id mxc_gpio_dt_ids[] = {
  141. { .compatible = "fsl,imx1-gpio", .data = &mxc_gpio_devtype[IMX1_GPIO], },
  142. { .compatible = "fsl,imx21-gpio", .data = &mxc_gpio_devtype[IMX21_GPIO], },
  143. { .compatible = "fsl,imx31-gpio", .data = &mxc_gpio_devtype[IMX31_GPIO], },
  144. { .compatible = "fsl,imx35-gpio", .data = &mxc_gpio_devtype[IMX35_GPIO], },
  145. { .compatible = "fsl,imx7d-gpio", .data = &mxc_gpio_devtype[IMX35_GPIO], },
  146. { /* sentinel */ }
  147. };
  148. /*
  149. * MX2 has one interrupt *for all* gpio ports. The list is used
  150. * to save the references to all ports, so that mx2_gpio_irq_handler
  151. * can walk through all interrupt status registers.
  152. */
  153. static LIST_HEAD(mxc_gpio_ports);
  154. /* Note: This driver assumes 32 GPIOs are handled in one register */
  155. static int gpio_set_irq_type(struct irq_data *d, u32 type)
  156. {
  157. struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
  158. struct mxc_gpio_port *port = gc->private;
  159. u32 bit, val;
  160. u32 gpio_idx = d->hwirq;
  161. int edge;
  162. void __iomem *reg = port->base;
  163. port->both_edges &= ~(1 << gpio_idx);
  164. switch (type) {
  165. case IRQ_TYPE_EDGE_RISING:
  166. edge = GPIO_INT_RISE_EDGE;
  167. break;
  168. case IRQ_TYPE_EDGE_FALLING:
  169. edge = GPIO_INT_FALL_EDGE;
  170. break;
  171. case IRQ_TYPE_EDGE_BOTH:
  172. if (GPIO_EDGE_SEL >= 0) {
  173. edge = GPIO_INT_BOTH_EDGES;
  174. } else {
  175. val = port->gc.get(&port->gc, gpio_idx);
  176. if (val) {
  177. edge = GPIO_INT_LOW_LEV;
  178. pr_debug("mxc: set GPIO %d to low trigger\n", gpio_idx);
  179. } else {
  180. edge = GPIO_INT_HIGH_LEV;
  181. pr_debug("mxc: set GPIO %d to high trigger\n", gpio_idx);
  182. }
  183. port->both_edges |= 1 << gpio_idx;
  184. }
  185. break;
  186. case IRQ_TYPE_LEVEL_LOW:
  187. edge = GPIO_INT_LOW_LEV;
  188. break;
  189. case IRQ_TYPE_LEVEL_HIGH:
  190. edge = GPIO_INT_HIGH_LEV;
  191. break;
  192. default:
  193. return -EINVAL;
  194. }
  195. if (GPIO_EDGE_SEL >= 0) {
  196. val = readl(port->base + GPIO_EDGE_SEL);
  197. if (edge == GPIO_INT_BOTH_EDGES)
  198. writel(val | (1 << gpio_idx),
  199. port->base + GPIO_EDGE_SEL);
  200. else
  201. writel(val & ~(1 << gpio_idx),
  202. port->base + GPIO_EDGE_SEL);
  203. }
  204. if (edge != GPIO_INT_BOTH_EDGES) {
  205. reg += GPIO_ICR1 + ((gpio_idx & 0x10) >> 2); /* lower or upper register */
  206. bit = gpio_idx & 0xf;
  207. val = readl(reg) & ~(0x3 << (bit << 1));
  208. writel(val | (edge << (bit << 1)), reg);
  209. }
  210. writel(1 << gpio_idx, port->base + GPIO_ISR);
  211. return 0;
  212. }
  213. static void mxc_flip_edge(struct mxc_gpio_port *port, u32 gpio)
  214. {
  215. void __iomem *reg = port->base;
  216. u32 bit, val;
  217. int edge;
  218. reg += GPIO_ICR1 + ((gpio & 0x10) >> 2); /* lower or upper register */
  219. bit = gpio & 0xf;
  220. val = readl(reg);
  221. edge = (val >> (bit << 1)) & 3;
  222. val &= ~(0x3 << (bit << 1));
  223. if (edge == GPIO_INT_HIGH_LEV) {
  224. edge = GPIO_INT_LOW_LEV;
  225. pr_debug("mxc: switch GPIO %d to low trigger\n", gpio);
  226. } else if (edge == GPIO_INT_LOW_LEV) {
  227. edge = GPIO_INT_HIGH_LEV;
  228. pr_debug("mxc: switch GPIO %d to high trigger\n", gpio);
  229. } else {
  230. pr_err("mxc: invalid configuration for GPIO %d: %x\n",
  231. gpio, edge);
  232. return;
  233. }
  234. writel(val | (edge << (bit << 1)), reg);
  235. }
  236. /* handle 32 interrupts in one status register */
  237. static void mxc_gpio_irq_handler(struct mxc_gpio_port *port, u32 irq_stat)
  238. {
  239. while (irq_stat != 0) {
  240. int irqoffset = fls(irq_stat) - 1;
  241. if (port->both_edges & (1 << irqoffset))
  242. mxc_flip_edge(port, irqoffset);
  243. generic_handle_irq(irq_find_mapping(port->domain, irqoffset));
  244. irq_stat &= ~(1 << irqoffset);
  245. }
  246. }
  247. /* MX1 and MX3 has one interrupt *per* gpio port */
  248. static void mx3_gpio_irq_handler(struct irq_desc *desc)
  249. {
  250. u32 irq_stat;
  251. struct mxc_gpio_port *port = irq_desc_get_handler_data(desc);
  252. struct irq_chip *chip = irq_desc_get_chip(desc);
  253. chained_irq_enter(chip, desc);
  254. irq_stat = readl(port->base + GPIO_ISR) & readl(port->base + GPIO_IMR);
  255. mxc_gpio_irq_handler(port, irq_stat);
  256. chained_irq_exit(chip, desc);
  257. }
  258. /* MX2 has one interrupt *for all* gpio ports */
  259. static void mx2_gpio_irq_handler(struct irq_desc *desc)
  260. {
  261. u32 irq_msk, irq_stat;
  262. struct mxc_gpio_port *port;
  263. struct irq_chip *chip = irq_desc_get_chip(desc);
  264. chained_irq_enter(chip, desc);
  265. /* walk through all interrupt status registers */
  266. list_for_each_entry(port, &mxc_gpio_ports, node) {
  267. irq_msk = readl(port->base + GPIO_IMR);
  268. if (!irq_msk)
  269. continue;
  270. irq_stat = readl(port->base + GPIO_ISR) & irq_msk;
  271. if (irq_stat)
  272. mxc_gpio_irq_handler(port, irq_stat);
  273. }
  274. chained_irq_exit(chip, desc);
  275. }
  276. /*
  277. * Set interrupt number "irq" in the GPIO as a wake-up source.
  278. * While system is running, all registered GPIO interrupts need to have
  279. * wake-up enabled. When system is suspended, only selected GPIO interrupts
  280. * need to have wake-up enabled.
  281. * @param irq interrupt source number
  282. * @param enable enable as wake-up if equal to non-zero
  283. * @return This function returns 0 on success.
  284. */
  285. static int gpio_set_wake_irq(struct irq_data *d, u32 enable)
  286. {
  287. struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
  288. struct mxc_gpio_port *port = gc->private;
  289. u32 gpio_idx = d->hwirq;
  290. int ret;
  291. if (enable) {
  292. if (port->irq_high && (gpio_idx >= 16))
  293. ret = enable_irq_wake(port->irq_high);
  294. else
  295. ret = enable_irq_wake(port->irq);
  296. } else {
  297. if (port->irq_high && (gpio_idx >= 16))
  298. ret = disable_irq_wake(port->irq_high);
  299. else
  300. ret = disable_irq_wake(port->irq);
  301. }
  302. return ret;
  303. }
  304. static int mxc_gpio_init_gc(struct mxc_gpio_port *port, int irq_base)
  305. {
  306. struct irq_chip_generic *gc;
  307. struct irq_chip_type *ct;
  308. int rv;
  309. gc = devm_irq_alloc_generic_chip(port->dev, "gpio-mxc", 1, irq_base,
  310. port->base, handle_level_irq);
  311. if (!gc)
  312. return -ENOMEM;
  313. gc->private = port;
  314. ct = gc->chip_types;
  315. ct->chip.irq_ack = irq_gc_ack_set_bit;
  316. ct->chip.irq_mask = irq_gc_mask_clr_bit;
  317. ct->chip.irq_unmask = irq_gc_mask_set_bit;
  318. ct->chip.irq_set_type = gpio_set_irq_type;
  319. ct->chip.irq_set_wake = gpio_set_wake_irq;
  320. ct->chip.flags = IRQCHIP_MASK_ON_SUSPEND;
  321. ct->regs.ack = GPIO_ISR;
  322. ct->regs.mask = GPIO_IMR;
  323. rv = devm_irq_setup_generic_chip(port->dev, gc, IRQ_MSK(32),
  324. IRQ_GC_INIT_NESTED_LOCK,
  325. IRQ_NOREQUEST, 0);
  326. return rv;
  327. }
  328. static void mxc_gpio_get_hw(struct platform_device *pdev)
  329. {
  330. const struct of_device_id *of_id =
  331. of_match_device(mxc_gpio_dt_ids, &pdev->dev);
  332. enum mxc_gpio_hwtype hwtype;
  333. if (of_id)
  334. pdev->id_entry = of_id->data;
  335. hwtype = pdev->id_entry->driver_data;
  336. if (mxc_gpio_hwtype) {
  337. /*
  338. * The driver works with a reasonable presupposition,
  339. * that is all gpio ports must be the same type when
  340. * running on one soc.
  341. */
  342. BUG_ON(mxc_gpio_hwtype != hwtype);
  343. return;
  344. }
  345. if (hwtype == IMX35_GPIO)
  346. mxc_gpio_hwdata = &imx35_gpio_hwdata;
  347. else if (hwtype == IMX31_GPIO)
  348. mxc_gpio_hwdata = &imx31_gpio_hwdata;
  349. else
  350. mxc_gpio_hwdata = &imx1_imx21_gpio_hwdata;
  351. mxc_gpio_hwtype = hwtype;
  352. }
  353. static int mxc_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
  354. {
  355. struct mxc_gpio_port *port = gpiochip_get_data(gc);
  356. return irq_find_mapping(port->domain, offset);
  357. }
  358. static int mxc_gpio_probe(struct platform_device *pdev)
  359. {
  360. struct device_node *np = pdev->dev.of_node;
  361. struct mxc_gpio_port *port;
  362. struct resource *iores;
  363. int irq_base;
  364. int err;
  365. mxc_gpio_get_hw(pdev);
  366. port = devm_kzalloc(&pdev->dev, sizeof(*port), GFP_KERNEL);
  367. if (!port)
  368. return -ENOMEM;
  369. port->dev = &pdev->dev;
  370. iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  371. port->base = devm_ioremap_resource(&pdev->dev, iores);
  372. if (IS_ERR(port->base))
  373. return PTR_ERR(port->base);
  374. port->irq_high = platform_get_irq(pdev, 1);
  375. if (port->irq_high < 0)
  376. port->irq_high = 0;
  377. port->irq = platform_get_irq(pdev, 0);
  378. if (port->irq < 0)
  379. return port->irq;
  380. /* the controller clock is optional */
  381. port->clk = devm_clk_get(&pdev->dev, NULL);
  382. if (IS_ERR(port->clk)) {
  383. if (PTR_ERR(port->clk) == -EPROBE_DEFER)
  384. return -EPROBE_DEFER;
  385. port->clk = NULL;
  386. }
  387. err = clk_prepare_enable(port->clk);
  388. if (err) {
  389. dev_err(&pdev->dev, "Unable to enable clock.\n");
  390. return err;
  391. }
  392. if (of_device_is_compatible(np, "fsl,imx7d-gpio"))
  393. port->power_off = true;
  394. /* disable the interrupt and clear the status */
  395. writel(0, port->base + GPIO_IMR);
  396. writel(~0, port->base + GPIO_ISR);
  397. if (mxc_gpio_hwtype == IMX21_GPIO) {
  398. /*
  399. * Setup one handler for all GPIO interrupts. Actually setting
  400. * the handler is needed only once, but doing it for every port
  401. * is more robust and easier.
  402. */
  403. irq_set_chained_handler(port->irq, mx2_gpio_irq_handler);
  404. } else {
  405. /* setup one handler for each entry */
  406. irq_set_chained_handler_and_data(port->irq,
  407. mx3_gpio_irq_handler, port);
  408. if (port->irq_high > 0)
  409. /* setup handler for GPIO 16 to 31 */
  410. irq_set_chained_handler_and_data(port->irq_high,
  411. mx3_gpio_irq_handler,
  412. port);
  413. }
  414. err = bgpio_init(&port->gc, &pdev->dev, 4,
  415. port->base + GPIO_PSR,
  416. port->base + GPIO_DR, NULL,
  417. port->base + GPIO_GDIR, NULL,
  418. BGPIOF_READ_OUTPUT_REG_SET);
  419. if (err)
  420. goto out_bgio;
  421. if (of_property_read_bool(np, "gpio-ranges")) {
  422. port->gc.request = gpiochip_generic_request;
  423. port->gc.free = gpiochip_generic_free;
  424. }
  425. port->gc.to_irq = mxc_gpio_to_irq;
  426. port->gc.base = (pdev->id < 0) ? of_alias_get_id(np, "gpio") * 32 :
  427. pdev->id * 32;
  428. err = devm_gpiochip_add_data(&pdev->dev, &port->gc, port);
  429. if (err)
  430. goto out_bgio;
  431. irq_base = devm_irq_alloc_descs(&pdev->dev, -1, 0, 32, numa_node_id());
  432. if (irq_base < 0) {
  433. err = irq_base;
  434. goto out_bgio;
  435. }
  436. port->domain = irq_domain_add_legacy(np, 32, irq_base, 0,
  437. &irq_domain_simple_ops, NULL);
  438. if (!port->domain) {
  439. err = -ENODEV;
  440. goto out_bgio;
  441. }
  442. /* gpio-mxc can be a generic irq chip */
  443. err = mxc_gpio_init_gc(port, irq_base);
  444. if (err < 0)
  445. goto out_irqdomain_remove;
  446. list_add_tail(&port->node, &mxc_gpio_ports);
  447. platform_set_drvdata(pdev, port);
  448. return 0;
  449. out_irqdomain_remove:
  450. irq_domain_remove(port->domain);
  451. out_bgio:
  452. clk_disable_unprepare(port->clk);
  453. dev_info(&pdev->dev, "%s failed with errno %d\n", __func__, err);
  454. return err;
  455. }
  456. static void mxc_gpio_save_regs(struct mxc_gpio_port *port)
  457. {
  458. if (!port->power_off)
  459. return;
  460. port->gpio_saved_reg.icr1 = readl(port->base + GPIO_ICR1);
  461. port->gpio_saved_reg.icr2 = readl(port->base + GPIO_ICR2);
  462. port->gpio_saved_reg.imr = readl(port->base + GPIO_IMR);
  463. port->gpio_saved_reg.gdir = readl(port->base + GPIO_GDIR);
  464. port->gpio_saved_reg.edge_sel = readl(port->base + GPIO_EDGE_SEL);
  465. port->gpio_saved_reg.dr = readl(port->base + GPIO_DR);
  466. }
  467. static void mxc_gpio_restore_regs(struct mxc_gpio_port *port)
  468. {
  469. if (!port->power_off)
  470. return;
  471. writel(port->gpio_saved_reg.icr1, port->base + GPIO_ICR1);
  472. writel(port->gpio_saved_reg.icr2, port->base + GPIO_ICR2);
  473. writel(port->gpio_saved_reg.imr, port->base + GPIO_IMR);
  474. writel(port->gpio_saved_reg.gdir, port->base + GPIO_GDIR);
  475. writel(port->gpio_saved_reg.edge_sel, port->base + GPIO_EDGE_SEL);
  476. writel(port->gpio_saved_reg.dr, port->base + GPIO_DR);
  477. }
  478. static int mxc_gpio_syscore_suspend(void)
  479. {
  480. struct mxc_gpio_port *port;
  481. /* walk through all ports */
  482. list_for_each_entry(port, &mxc_gpio_ports, node) {
  483. mxc_gpio_save_regs(port);
  484. clk_disable_unprepare(port->clk);
  485. }
  486. return 0;
  487. }
  488. static void mxc_gpio_syscore_resume(void)
  489. {
  490. struct mxc_gpio_port *port;
  491. int ret;
  492. /* walk through all ports */
  493. list_for_each_entry(port, &mxc_gpio_ports, node) {
  494. ret = clk_prepare_enable(port->clk);
  495. if (ret) {
  496. pr_err("mxc: failed to enable gpio clock %d\n", ret);
  497. return;
  498. }
  499. mxc_gpio_restore_regs(port);
  500. }
  501. }
  502. static struct syscore_ops mxc_gpio_syscore_ops = {
  503. .suspend = mxc_gpio_syscore_suspend,
  504. .resume = mxc_gpio_syscore_resume,
  505. };
  506. static struct platform_driver mxc_gpio_driver = {
  507. .driver = {
  508. .name = "gpio-mxc",
  509. .of_match_table = mxc_gpio_dt_ids,
  510. .suppress_bind_attrs = true,
  511. },
  512. .probe = mxc_gpio_probe,
  513. .id_table = mxc_gpio_devtype,
  514. };
  515. static int __init gpio_mxc_init(void)
  516. {
  517. register_syscore_ops(&mxc_gpio_syscore_ops);
  518. return platform_driver_register(&mxc_gpio_driver);
  519. }
  520. subsys_initcall(gpio_mxc_init);