gpio-davinci.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. /*
  2. * TI DaVinci GPIO Support
  3. *
  4. * Copyright (c) 2006-2007 David Brownell
  5. * Copyright (c) 2007, MontaVista Software, Inc. <source@mvista.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. */
  12. #include <linux/gpio.h>
  13. #include <linux/errno.h>
  14. #include <linux/kernel.h>
  15. #include <linux/clk.h>
  16. #include <linux/err.h>
  17. #include <linux/io.h>
  18. #include <linux/irq.h>
  19. #include <linux/irqdomain.h>
  20. #include <linux/module.h>
  21. #include <linux/of.h>
  22. #include <linux/of_device.h>
  23. #include <linux/platform_device.h>
  24. #include <linux/platform_data/gpio-davinci.h>
  25. #include <linux/irqchip/chained_irq.h>
  26. struct davinci_gpio_regs {
  27. u32 dir;
  28. u32 out_data;
  29. u32 set_data;
  30. u32 clr_data;
  31. u32 in_data;
  32. u32 set_rising;
  33. u32 clr_rising;
  34. u32 set_falling;
  35. u32 clr_falling;
  36. u32 intstat;
  37. };
  38. typedef struct irq_chip *(*gpio_get_irq_chip_cb_t)(unsigned int irq);
  39. #define BINTEN 0x8 /* GPIO Interrupt Per-Bank Enable Register */
  40. #define chip2controller(chip) \
  41. container_of(chip, struct davinci_gpio_controller, chip)
  42. static void __iomem *gpio_base;
  43. static struct davinci_gpio_regs __iomem *gpio2regs(unsigned gpio)
  44. {
  45. void __iomem *ptr;
  46. if (gpio < 32 * 1)
  47. ptr = gpio_base + 0x10;
  48. else if (gpio < 32 * 2)
  49. ptr = gpio_base + 0x38;
  50. else if (gpio < 32 * 3)
  51. ptr = gpio_base + 0x60;
  52. else if (gpio < 32 * 4)
  53. ptr = gpio_base + 0x88;
  54. else if (gpio < 32 * 5)
  55. ptr = gpio_base + 0xb0;
  56. else
  57. ptr = NULL;
  58. return ptr;
  59. }
  60. static inline struct davinci_gpio_regs __iomem *irq2regs(struct irq_data *d)
  61. {
  62. struct davinci_gpio_regs __iomem *g;
  63. g = (__force struct davinci_gpio_regs __iomem *)irq_data_get_irq_chip_data(d);
  64. return g;
  65. }
  66. static int davinci_gpio_irq_setup(struct platform_device *pdev);
  67. /*--------------------------------------------------------------------------*/
  68. /* board setup code *MUST* setup pinmux and enable the GPIO clock. */
  69. static inline int __davinci_direction(struct gpio_chip *chip,
  70. unsigned offset, bool out, int value)
  71. {
  72. struct davinci_gpio_controller *d = chip2controller(chip);
  73. struct davinci_gpio_regs __iomem *g = d->regs;
  74. unsigned long flags;
  75. u32 temp;
  76. u32 mask = 1 << offset;
  77. spin_lock_irqsave(&d->lock, flags);
  78. temp = readl_relaxed(&g->dir);
  79. if (out) {
  80. temp &= ~mask;
  81. writel_relaxed(mask, value ? &g->set_data : &g->clr_data);
  82. } else {
  83. temp |= mask;
  84. }
  85. writel_relaxed(temp, &g->dir);
  86. spin_unlock_irqrestore(&d->lock, flags);
  87. return 0;
  88. }
  89. static int davinci_direction_in(struct gpio_chip *chip, unsigned offset)
  90. {
  91. return __davinci_direction(chip, offset, false, 0);
  92. }
  93. static int
  94. davinci_direction_out(struct gpio_chip *chip, unsigned offset, int value)
  95. {
  96. return __davinci_direction(chip, offset, true, value);
  97. }
  98. /*
  99. * Read the pin's value (works even if it's set up as output);
  100. * returns zero/nonzero.
  101. *
  102. * Note that changes are synched to the GPIO clock, so reading values back
  103. * right after you've set them may give old values.
  104. */
  105. static int davinci_gpio_get(struct gpio_chip *chip, unsigned offset)
  106. {
  107. struct davinci_gpio_controller *d = chip2controller(chip);
  108. struct davinci_gpio_regs __iomem *g = d->regs;
  109. return (1 << offset) & readl_relaxed(&g->in_data);
  110. }
  111. /*
  112. * Assuming the pin is muxed as a gpio output, set its output value.
  113. */
  114. static void
  115. davinci_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
  116. {
  117. struct davinci_gpio_controller *d = chip2controller(chip);
  118. struct davinci_gpio_regs __iomem *g = d->regs;
  119. writel_relaxed((1 << offset), value ? &g->set_data : &g->clr_data);
  120. }
  121. static struct davinci_gpio_platform_data *
  122. davinci_gpio_get_pdata(struct platform_device *pdev)
  123. {
  124. struct device_node *dn = pdev->dev.of_node;
  125. struct davinci_gpio_platform_data *pdata;
  126. int ret;
  127. u32 val;
  128. if (!IS_ENABLED(CONFIG_OF) || !pdev->dev.of_node)
  129. return pdev->dev.platform_data;
  130. pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
  131. if (!pdata)
  132. return NULL;
  133. ret = of_property_read_u32(dn, "ti,ngpio", &val);
  134. if (ret)
  135. goto of_err;
  136. pdata->ngpio = val;
  137. ret = of_property_read_u32(dn, "ti,davinci-gpio-unbanked", &val);
  138. if (ret)
  139. goto of_err;
  140. pdata->gpio_unbanked = val;
  141. return pdata;
  142. of_err:
  143. dev_err(&pdev->dev, "Populating pdata from DT failed: err %d\n", ret);
  144. return NULL;
  145. }
  146. #ifdef CONFIG_OF_GPIO
  147. static int davinci_gpio_of_xlate(struct gpio_chip *gc,
  148. const struct of_phandle_args *gpiospec,
  149. u32 *flags)
  150. {
  151. struct davinci_gpio_controller *chips = dev_get_drvdata(gc->dev);
  152. struct davinci_gpio_platform_data *pdata = dev_get_platdata(gc->dev);
  153. if (gpiospec->args[0] > pdata->ngpio)
  154. return -EINVAL;
  155. if (gc != &chips[gpiospec->args[0] / 32].chip)
  156. return -EINVAL;
  157. if (flags)
  158. *flags = gpiospec->args[1];
  159. return gpiospec->args[0] % 32;
  160. }
  161. #endif
  162. static int davinci_gpio_probe(struct platform_device *pdev)
  163. {
  164. int i, base;
  165. unsigned ngpio;
  166. struct davinci_gpio_controller *chips;
  167. struct davinci_gpio_platform_data *pdata;
  168. struct davinci_gpio_regs __iomem *regs;
  169. struct device *dev = &pdev->dev;
  170. struct resource *res;
  171. pdata = davinci_gpio_get_pdata(pdev);
  172. if (!pdata) {
  173. dev_err(dev, "No platform data found\n");
  174. return -EINVAL;
  175. }
  176. dev->platform_data = pdata;
  177. /*
  178. * The gpio banks conceptually expose a segmented bitmap,
  179. * and "ngpio" is one more than the largest zero-based
  180. * bit index that's valid.
  181. */
  182. ngpio = pdata->ngpio;
  183. if (ngpio == 0) {
  184. dev_err(dev, "How many GPIOs?\n");
  185. return -EINVAL;
  186. }
  187. if (WARN_ON(ARCH_NR_GPIOS < ngpio))
  188. ngpio = ARCH_NR_GPIOS;
  189. chips = devm_kzalloc(dev,
  190. ngpio * sizeof(struct davinci_gpio_controller),
  191. GFP_KERNEL);
  192. if (!chips)
  193. return -ENOMEM;
  194. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  195. gpio_base = devm_ioremap_resource(dev, res);
  196. if (IS_ERR(gpio_base))
  197. return PTR_ERR(gpio_base);
  198. for (i = 0, base = 0; base < ngpio; i++, base += 32) {
  199. chips[i].chip.label = "DaVinci";
  200. chips[i].chip.direction_input = davinci_direction_in;
  201. chips[i].chip.get = davinci_gpio_get;
  202. chips[i].chip.direction_output = davinci_direction_out;
  203. chips[i].chip.set = davinci_gpio_set;
  204. chips[i].chip.base = base;
  205. chips[i].chip.ngpio = ngpio - base;
  206. if (chips[i].chip.ngpio > 32)
  207. chips[i].chip.ngpio = 32;
  208. #ifdef CONFIG_OF_GPIO
  209. chips[i].chip.of_gpio_n_cells = 2;
  210. chips[i].chip.of_xlate = davinci_gpio_of_xlate;
  211. chips[i].chip.dev = dev;
  212. chips[i].chip.of_node = dev->of_node;
  213. #endif
  214. spin_lock_init(&chips[i].lock);
  215. regs = gpio2regs(base);
  216. chips[i].regs = regs;
  217. chips[i].set_data = &regs->set_data;
  218. chips[i].clr_data = &regs->clr_data;
  219. chips[i].in_data = &regs->in_data;
  220. gpiochip_add(&chips[i].chip);
  221. }
  222. platform_set_drvdata(pdev, chips);
  223. davinci_gpio_irq_setup(pdev);
  224. return 0;
  225. }
  226. /*--------------------------------------------------------------------------*/
  227. /*
  228. * We expect irqs will normally be set up as input pins, but they can also be
  229. * used as output pins ... which is convenient for testing.
  230. *
  231. * NOTE: The first few GPIOs also have direct INTC hookups in addition
  232. * to their GPIOBNK0 irq, with a bit less overhead.
  233. *
  234. * All those INTC hookups (direct, plus several IRQ banks) can also
  235. * serve as EDMA event triggers.
  236. */
  237. static void gpio_irq_disable(struct irq_data *d)
  238. {
  239. struct davinci_gpio_regs __iomem *g = irq2regs(d);
  240. u32 mask = (u32) irq_data_get_irq_handler_data(d);
  241. writel_relaxed(mask, &g->clr_falling);
  242. writel_relaxed(mask, &g->clr_rising);
  243. }
  244. static void gpio_irq_enable(struct irq_data *d)
  245. {
  246. struct davinci_gpio_regs __iomem *g = irq2regs(d);
  247. u32 mask = (u32) irq_data_get_irq_handler_data(d);
  248. unsigned status = irqd_get_trigger_type(d);
  249. status &= IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING;
  250. if (!status)
  251. status = IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING;
  252. if (status & IRQ_TYPE_EDGE_FALLING)
  253. writel_relaxed(mask, &g->set_falling);
  254. if (status & IRQ_TYPE_EDGE_RISING)
  255. writel_relaxed(mask, &g->set_rising);
  256. }
  257. static int gpio_irq_type(struct irq_data *d, unsigned trigger)
  258. {
  259. if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING))
  260. return -EINVAL;
  261. return 0;
  262. }
  263. static struct irq_chip gpio_irqchip = {
  264. .name = "GPIO",
  265. .irq_enable = gpio_irq_enable,
  266. .irq_disable = gpio_irq_disable,
  267. .irq_set_type = gpio_irq_type,
  268. .flags = IRQCHIP_SET_TYPE_MASKED,
  269. };
  270. static void gpio_irq_handler(struct irq_desc *desc)
  271. {
  272. unsigned int irq = irq_desc_get_irq(desc);
  273. struct davinci_gpio_regs __iomem *g;
  274. u32 mask = 0xffff;
  275. struct davinci_gpio_controller *d;
  276. d = (struct davinci_gpio_controller *)irq_desc_get_handler_data(desc);
  277. g = (struct davinci_gpio_regs __iomem *)d->regs;
  278. /* we only care about one bank */
  279. if (irq & 1)
  280. mask <<= 16;
  281. /* temporarily mask (level sensitive) parent IRQ */
  282. chained_irq_enter(irq_desc_get_chip(desc), desc);
  283. while (1) {
  284. u32 status;
  285. int bit;
  286. /* ack any irqs */
  287. status = readl_relaxed(&g->intstat) & mask;
  288. if (!status)
  289. break;
  290. writel_relaxed(status, &g->intstat);
  291. /* now demux them to the right lowlevel handler */
  292. while (status) {
  293. bit = __ffs(status);
  294. status &= ~BIT(bit);
  295. generic_handle_irq(
  296. irq_find_mapping(d->irq_domain,
  297. d->chip.base + bit));
  298. }
  299. }
  300. chained_irq_exit(irq_desc_get_chip(desc), desc);
  301. /* now it may re-trigger */
  302. }
  303. static int gpio_to_irq_banked(struct gpio_chip *chip, unsigned offset)
  304. {
  305. struct davinci_gpio_controller *d = chip2controller(chip);
  306. if (d->irq_domain)
  307. return irq_create_mapping(d->irq_domain, d->chip.base + offset);
  308. else
  309. return -ENXIO;
  310. }
  311. static int gpio_to_irq_unbanked(struct gpio_chip *chip, unsigned offset)
  312. {
  313. struct davinci_gpio_controller *d = chip2controller(chip);
  314. /*
  315. * NOTE: we assume for now that only irqs in the first gpio_chip
  316. * can provide direct-mapped IRQs to AINTC (up to 32 GPIOs).
  317. */
  318. if (offset < d->gpio_unbanked)
  319. return d->gpio_irq + offset;
  320. else
  321. return -ENODEV;
  322. }
  323. static int gpio_irq_type_unbanked(struct irq_data *data, unsigned trigger)
  324. {
  325. struct davinci_gpio_controller *d;
  326. struct davinci_gpio_regs __iomem *g;
  327. u32 mask;
  328. d = (struct davinci_gpio_controller *)irq_data_get_irq_handler_data(data);
  329. g = (struct davinci_gpio_regs __iomem *)d->regs;
  330. mask = __gpio_mask(data->irq - d->gpio_irq);
  331. if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING))
  332. return -EINVAL;
  333. writel_relaxed(mask, (trigger & IRQ_TYPE_EDGE_FALLING)
  334. ? &g->set_falling : &g->clr_falling);
  335. writel_relaxed(mask, (trigger & IRQ_TYPE_EDGE_RISING)
  336. ? &g->set_rising : &g->clr_rising);
  337. return 0;
  338. }
  339. static int
  340. davinci_gpio_irq_map(struct irq_domain *d, unsigned int irq,
  341. irq_hw_number_t hw)
  342. {
  343. struct davinci_gpio_regs __iomem *g = gpio2regs(hw);
  344. irq_set_chip_and_handler_name(irq, &gpio_irqchip, handle_simple_irq,
  345. "davinci_gpio");
  346. irq_set_irq_type(irq, IRQ_TYPE_NONE);
  347. irq_set_chip_data(irq, (__force void *)g);
  348. irq_set_handler_data(irq, (void *)__gpio_mask(hw));
  349. return 0;
  350. }
  351. static const struct irq_domain_ops davinci_gpio_irq_ops = {
  352. .map = davinci_gpio_irq_map,
  353. .xlate = irq_domain_xlate_onetwocell,
  354. };
  355. static struct irq_chip *davinci_gpio_get_irq_chip(unsigned int irq)
  356. {
  357. static struct irq_chip_type gpio_unbanked;
  358. gpio_unbanked = *container_of(irq_get_chip(irq),
  359. struct irq_chip_type, chip);
  360. return &gpio_unbanked.chip;
  361. };
  362. static struct irq_chip *keystone_gpio_get_irq_chip(unsigned int irq)
  363. {
  364. static struct irq_chip gpio_unbanked;
  365. gpio_unbanked = *irq_get_chip(irq);
  366. return &gpio_unbanked;
  367. };
  368. static const struct of_device_id davinci_gpio_ids[];
  369. /*
  370. * NOTE: for suspend/resume, probably best to make a platform_device with
  371. * suspend_late/resume_resume calls hooking into results of the set_wake()
  372. * calls ... so if no gpios are wakeup events the clock can be disabled,
  373. * with outputs left at previously set levels, and so that VDD3P3V.IOPWDN0
  374. * (dm6446) can be set appropriately for GPIOV33 pins.
  375. */
  376. static int davinci_gpio_irq_setup(struct platform_device *pdev)
  377. {
  378. unsigned gpio, bank;
  379. int irq;
  380. struct clk *clk;
  381. u32 binten = 0;
  382. unsigned ngpio, bank_irq;
  383. struct device *dev = &pdev->dev;
  384. struct resource *res;
  385. struct davinci_gpio_controller *chips = platform_get_drvdata(pdev);
  386. struct davinci_gpio_platform_data *pdata = dev->platform_data;
  387. struct davinci_gpio_regs __iomem *g;
  388. struct irq_domain *irq_domain = NULL;
  389. const struct of_device_id *match;
  390. struct irq_chip *irq_chip;
  391. gpio_get_irq_chip_cb_t gpio_get_irq_chip;
  392. /*
  393. * Use davinci_gpio_get_irq_chip by default to handle non DT cases
  394. */
  395. gpio_get_irq_chip = davinci_gpio_get_irq_chip;
  396. match = of_match_device(of_match_ptr(davinci_gpio_ids),
  397. dev);
  398. if (match)
  399. gpio_get_irq_chip = (gpio_get_irq_chip_cb_t)match->data;
  400. ngpio = pdata->ngpio;
  401. res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
  402. if (!res) {
  403. dev_err(dev, "Invalid IRQ resource\n");
  404. return -EBUSY;
  405. }
  406. bank_irq = res->start;
  407. if (!bank_irq) {
  408. dev_err(dev, "Invalid IRQ resource\n");
  409. return -ENODEV;
  410. }
  411. clk = devm_clk_get(dev, "gpio");
  412. if (IS_ERR(clk)) {
  413. printk(KERN_ERR "Error %ld getting gpio clock?\n",
  414. PTR_ERR(clk));
  415. return PTR_ERR(clk);
  416. }
  417. clk_prepare_enable(clk);
  418. if (!pdata->gpio_unbanked) {
  419. irq = irq_alloc_descs(-1, 0, ngpio, 0);
  420. if (irq < 0) {
  421. dev_err(dev, "Couldn't allocate IRQ numbers\n");
  422. return irq;
  423. }
  424. irq_domain = irq_domain_add_legacy(NULL, ngpio, irq, 0,
  425. &davinci_gpio_irq_ops,
  426. chips);
  427. if (!irq_domain) {
  428. dev_err(dev, "Couldn't register an IRQ domain\n");
  429. return -ENODEV;
  430. }
  431. }
  432. /*
  433. * Arrange gpio_to_irq() support, handling either direct IRQs or
  434. * banked IRQs. Having GPIOs in the first GPIO bank use direct
  435. * IRQs, while the others use banked IRQs, would need some setup
  436. * tweaks to recognize hardware which can do that.
  437. */
  438. for (gpio = 0, bank = 0; gpio < ngpio; bank++, gpio += 32) {
  439. chips[bank].chip.to_irq = gpio_to_irq_banked;
  440. chips[bank].irq_domain = irq_domain;
  441. }
  442. /*
  443. * AINTC can handle direct/unbanked IRQs for GPIOs, with the GPIO
  444. * controller only handling trigger modes. We currently assume no
  445. * IRQ mux conflicts; gpio_irq_type_unbanked() is only for GPIOs.
  446. */
  447. if (pdata->gpio_unbanked) {
  448. /* pass "bank 0" GPIO IRQs to AINTC */
  449. chips[0].chip.to_irq = gpio_to_irq_unbanked;
  450. chips[0].gpio_irq = bank_irq;
  451. chips[0].gpio_unbanked = pdata->gpio_unbanked;
  452. binten = GENMASK(pdata->gpio_unbanked / 16, 0);
  453. /* AINTC handles mask/unmask; GPIO handles triggering */
  454. irq = bank_irq;
  455. irq_chip = gpio_get_irq_chip(irq);
  456. irq_chip->name = "GPIO-AINTC";
  457. irq_chip->irq_set_type = gpio_irq_type_unbanked;
  458. /* default trigger: both edges */
  459. g = gpio2regs(0);
  460. writel_relaxed(~0, &g->set_falling);
  461. writel_relaxed(~0, &g->set_rising);
  462. /* set the direct IRQs up to use that irqchip */
  463. for (gpio = 0; gpio < pdata->gpio_unbanked; gpio++, irq++) {
  464. irq_set_chip(irq, irq_chip);
  465. irq_set_handler_data(irq, &chips[gpio / 32]);
  466. irq_set_status_flags(irq, IRQ_TYPE_EDGE_BOTH);
  467. }
  468. goto done;
  469. }
  470. /*
  471. * Or, AINTC can handle IRQs for banks of 16 GPIO IRQs, which we
  472. * then chain through our own handler.
  473. */
  474. for (gpio = 0, bank = 0; gpio < ngpio; bank++, bank_irq++, gpio += 16) {
  475. /* disabled by default, enabled only as needed */
  476. g = gpio2regs(gpio);
  477. writel_relaxed(~0, &g->clr_falling);
  478. writel_relaxed(~0, &g->clr_rising);
  479. /*
  480. * Each chip handles 32 gpios, and each irq bank consists of 16
  481. * gpio irqs. Pass the irq bank's corresponding controller to
  482. * the chained irq handler.
  483. */
  484. irq_set_chained_handler_and_data(bank_irq, gpio_irq_handler,
  485. &chips[gpio / 32]);
  486. binten |= BIT(bank);
  487. }
  488. done:
  489. /*
  490. * BINTEN -- per-bank interrupt enable. genirq would also let these
  491. * bits be set/cleared dynamically.
  492. */
  493. writel_relaxed(binten, gpio_base + BINTEN);
  494. return 0;
  495. }
  496. #if IS_ENABLED(CONFIG_OF)
  497. static const struct of_device_id davinci_gpio_ids[] = {
  498. { .compatible = "ti,keystone-gpio", keystone_gpio_get_irq_chip},
  499. { .compatible = "ti,dm6441-gpio", davinci_gpio_get_irq_chip},
  500. { /* sentinel */ },
  501. };
  502. MODULE_DEVICE_TABLE(of, davinci_gpio_ids);
  503. #endif
  504. static struct platform_driver davinci_gpio_driver = {
  505. .probe = davinci_gpio_probe,
  506. .driver = {
  507. .name = "davinci_gpio",
  508. .of_match_table = of_match_ptr(davinci_gpio_ids),
  509. },
  510. };
  511. /**
  512. * GPIO driver registration needs to be done before machine_init functions
  513. * access GPIO. Hence davinci_gpio_drv_reg() is a postcore_initcall.
  514. */
  515. static int __init davinci_gpio_drv_reg(void)
  516. {
  517. return platform_driver_register(&davinci_gpio_driver);
  518. }
  519. postcore_initcall(davinci_gpio_drv_reg);