gpio-lpc32xx.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * GPIO driver for LPC32xx SoC
  4. *
  5. * Author: Kevin Wells <[email protected]>
  6. *
  7. * Copyright (C) 2010 NXP Semiconductors
  8. */
  9. #include <linux/kernel.h>
  10. #include <linux/init.h>
  11. #include <linux/io.h>
  12. #include <linux/errno.h>
  13. #include <linux/gpio/driver.h>
  14. #include <linux/of.h>
  15. #include <linux/platform_device.h>
  16. #include <linux/module.h>
  17. #define LPC32XX_GPIO_P3_INP_STATE (0x000)
  18. #define LPC32XX_GPIO_P3_OUTP_SET (0x004)
  19. #define LPC32XX_GPIO_P3_OUTP_CLR (0x008)
  20. #define LPC32XX_GPIO_P3_OUTP_STATE (0x00C)
  21. #define LPC32XX_GPIO_P2_DIR_SET (0x010)
  22. #define LPC32XX_GPIO_P2_DIR_CLR (0x014)
  23. #define LPC32XX_GPIO_P2_DIR_STATE (0x018)
  24. #define LPC32XX_GPIO_P2_INP_STATE (0x01C)
  25. #define LPC32XX_GPIO_P2_OUTP_SET (0x020)
  26. #define LPC32XX_GPIO_P2_OUTP_CLR (0x024)
  27. #define LPC32XX_GPIO_P2_MUX_SET (0x028)
  28. #define LPC32XX_GPIO_P2_MUX_CLR (0x02C)
  29. #define LPC32XX_GPIO_P2_MUX_STATE (0x030)
  30. #define LPC32XX_GPIO_P0_INP_STATE (0x040)
  31. #define LPC32XX_GPIO_P0_OUTP_SET (0x044)
  32. #define LPC32XX_GPIO_P0_OUTP_CLR (0x048)
  33. #define LPC32XX_GPIO_P0_OUTP_STATE (0x04C)
  34. #define LPC32XX_GPIO_P0_DIR_SET (0x050)
  35. #define LPC32XX_GPIO_P0_DIR_CLR (0x054)
  36. #define LPC32XX_GPIO_P0_DIR_STATE (0x058)
  37. #define LPC32XX_GPIO_P1_INP_STATE (0x060)
  38. #define LPC32XX_GPIO_P1_OUTP_SET (0x064)
  39. #define LPC32XX_GPIO_P1_OUTP_CLR (0x068)
  40. #define LPC32XX_GPIO_P1_OUTP_STATE (0x06C)
  41. #define LPC32XX_GPIO_P1_DIR_SET (0x070)
  42. #define LPC32XX_GPIO_P1_DIR_CLR (0x074)
  43. #define LPC32XX_GPIO_P1_DIR_STATE (0x078)
  44. #define GPIO012_PIN_TO_BIT(x) (1 << (x))
  45. #define GPIO3_PIN_TO_BIT(x) (1 << ((x) + 25))
  46. #define GPO3_PIN_TO_BIT(x) (1 << (x))
  47. #define GPIO012_PIN_IN_SEL(x, y) (((x) >> (y)) & 1)
  48. #define GPIO3_PIN_IN_SHIFT(x) ((x) == 5 ? 24 : 10 + (x))
  49. #define GPIO3_PIN_IN_SEL(x, y) (((x) >> GPIO3_PIN_IN_SHIFT(y)) & 1)
  50. #define GPIO3_PIN5_IN_SEL(x) (((x) >> 24) & 1)
  51. #define GPI3_PIN_IN_SEL(x, y) (((x) >> (y)) & 1)
  52. #define GPO3_PIN_IN_SEL(x, y) (((x) >> (y)) & 1)
  53. #define LPC32XX_GPIO_P0_MAX 8
  54. #define LPC32XX_GPIO_P1_MAX 24
  55. #define LPC32XX_GPIO_P2_MAX 13
  56. #define LPC32XX_GPIO_P3_MAX 6
  57. #define LPC32XX_GPI_P3_MAX 29
  58. #define LPC32XX_GPO_P3_MAX 24
  59. #define LPC32XX_GPIO_P0_GRP 0
  60. #define LPC32XX_GPIO_P1_GRP (LPC32XX_GPIO_P0_GRP + LPC32XX_GPIO_P0_MAX)
  61. #define LPC32XX_GPIO_P2_GRP (LPC32XX_GPIO_P1_GRP + LPC32XX_GPIO_P1_MAX)
  62. #define LPC32XX_GPIO_P3_GRP (LPC32XX_GPIO_P2_GRP + LPC32XX_GPIO_P2_MAX)
  63. #define LPC32XX_GPI_P3_GRP (LPC32XX_GPIO_P3_GRP + LPC32XX_GPIO_P3_MAX)
  64. #define LPC32XX_GPO_P3_GRP (LPC32XX_GPI_P3_GRP + LPC32XX_GPI_P3_MAX)
  65. struct gpio_regs {
  66. unsigned long inp_state;
  67. unsigned long outp_state;
  68. unsigned long outp_set;
  69. unsigned long outp_clr;
  70. unsigned long dir_set;
  71. unsigned long dir_clr;
  72. };
  73. /*
  74. * GPIO names
  75. */
  76. static const char *gpio_p0_names[LPC32XX_GPIO_P0_MAX] = {
  77. "p0.0", "p0.1", "p0.2", "p0.3",
  78. "p0.4", "p0.5", "p0.6", "p0.7"
  79. };
  80. static const char *gpio_p1_names[LPC32XX_GPIO_P1_MAX] = {
  81. "p1.0", "p1.1", "p1.2", "p1.3",
  82. "p1.4", "p1.5", "p1.6", "p1.7",
  83. "p1.8", "p1.9", "p1.10", "p1.11",
  84. "p1.12", "p1.13", "p1.14", "p1.15",
  85. "p1.16", "p1.17", "p1.18", "p1.19",
  86. "p1.20", "p1.21", "p1.22", "p1.23",
  87. };
  88. static const char *gpio_p2_names[LPC32XX_GPIO_P2_MAX] = {
  89. "p2.0", "p2.1", "p2.2", "p2.3",
  90. "p2.4", "p2.5", "p2.6", "p2.7",
  91. "p2.8", "p2.9", "p2.10", "p2.11",
  92. "p2.12"
  93. };
  94. static const char *gpio_p3_names[LPC32XX_GPIO_P3_MAX] = {
  95. "gpio00", "gpio01", "gpio02", "gpio03",
  96. "gpio04", "gpio05"
  97. };
  98. static const char *gpi_p3_names[LPC32XX_GPI_P3_MAX] = {
  99. "gpi00", "gpi01", "gpi02", "gpi03",
  100. "gpi04", "gpi05", "gpi06", "gpi07",
  101. "gpi08", "gpi09", NULL, NULL,
  102. NULL, NULL, NULL, "gpi15",
  103. "gpi16", "gpi17", "gpi18", "gpi19",
  104. "gpi20", "gpi21", "gpi22", "gpi23",
  105. "gpi24", "gpi25", "gpi26", "gpi27",
  106. "gpi28"
  107. };
  108. static const char *gpo_p3_names[LPC32XX_GPO_P3_MAX] = {
  109. "gpo00", "gpo01", "gpo02", "gpo03",
  110. "gpo04", "gpo05", "gpo06", "gpo07",
  111. "gpo08", "gpo09", "gpo10", "gpo11",
  112. "gpo12", "gpo13", "gpo14", "gpo15",
  113. "gpo16", "gpo17", "gpo18", "gpo19",
  114. "gpo20", "gpo21", "gpo22", "gpo23"
  115. };
  116. static struct gpio_regs gpio_grp_regs_p0 = {
  117. .inp_state = LPC32XX_GPIO_P0_INP_STATE,
  118. .outp_set = LPC32XX_GPIO_P0_OUTP_SET,
  119. .outp_clr = LPC32XX_GPIO_P0_OUTP_CLR,
  120. .dir_set = LPC32XX_GPIO_P0_DIR_SET,
  121. .dir_clr = LPC32XX_GPIO_P0_DIR_CLR,
  122. };
  123. static struct gpio_regs gpio_grp_regs_p1 = {
  124. .inp_state = LPC32XX_GPIO_P1_INP_STATE,
  125. .outp_set = LPC32XX_GPIO_P1_OUTP_SET,
  126. .outp_clr = LPC32XX_GPIO_P1_OUTP_CLR,
  127. .dir_set = LPC32XX_GPIO_P1_DIR_SET,
  128. .dir_clr = LPC32XX_GPIO_P1_DIR_CLR,
  129. };
  130. static struct gpio_regs gpio_grp_regs_p2 = {
  131. .inp_state = LPC32XX_GPIO_P2_INP_STATE,
  132. .outp_set = LPC32XX_GPIO_P2_OUTP_SET,
  133. .outp_clr = LPC32XX_GPIO_P2_OUTP_CLR,
  134. .dir_set = LPC32XX_GPIO_P2_DIR_SET,
  135. .dir_clr = LPC32XX_GPIO_P2_DIR_CLR,
  136. };
  137. static struct gpio_regs gpio_grp_regs_p3 = {
  138. .inp_state = LPC32XX_GPIO_P3_INP_STATE,
  139. .outp_state = LPC32XX_GPIO_P3_OUTP_STATE,
  140. .outp_set = LPC32XX_GPIO_P3_OUTP_SET,
  141. .outp_clr = LPC32XX_GPIO_P3_OUTP_CLR,
  142. .dir_set = LPC32XX_GPIO_P2_DIR_SET,
  143. .dir_clr = LPC32XX_GPIO_P2_DIR_CLR,
  144. };
  145. struct lpc32xx_gpio_chip {
  146. struct gpio_chip chip;
  147. struct gpio_regs *gpio_grp;
  148. void __iomem *reg_base;
  149. };
  150. static inline u32 gpreg_read(struct lpc32xx_gpio_chip *group, unsigned long offset)
  151. {
  152. return __raw_readl(group->reg_base + offset);
  153. }
  154. static inline void gpreg_write(struct lpc32xx_gpio_chip *group, u32 val, unsigned long offset)
  155. {
  156. __raw_writel(val, group->reg_base + offset);
  157. }
  158. static void __set_gpio_dir_p012(struct lpc32xx_gpio_chip *group,
  159. unsigned pin, int input)
  160. {
  161. if (input)
  162. gpreg_write(group, GPIO012_PIN_TO_BIT(pin),
  163. group->gpio_grp->dir_clr);
  164. else
  165. gpreg_write(group, GPIO012_PIN_TO_BIT(pin),
  166. group->gpio_grp->dir_set);
  167. }
  168. static void __set_gpio_dir_p3(struct lpc32xx_gpio_chip *group,
  169. unsigned pin, int input)
  170. {
  171. u32 u = GPIO3_PIN_TO_BIT(pin);
  172. if (input)
  173. gpreg_write(group, u, group->gpio_grp->dir_clr);
  174. else
  175. gpreg_write(group, u, group->gpio_grp->dir_set);
  176. }
  177. static void __set_gpio_level_p012(struct lpc32xx_gpio_chip *group,
  178. unsigned pin, int high)
  179. {
  180. if (high)
  181. gpreg_write(group, GPIO012_PIN_TO_BIT(pin),
  182. group->gpio_grp->outp_set);
  183. else
  184. gpreg_write(group, GPIO012_PIN_TO_BIT(pin),
  185. group->gpio_grp->outp_clr);
  186. }
  187. static void __set_gpio_level_p3(struct lpc32xx_gpio_chip *group,
  188. unsigned pin, int high)
  189. {
  190. u32 u = GPIO3_PIN_TO_BIT(pin);
  191. if (high)
  192. gpreg_write(group, u, group->gpio_grp->outp_set);
  193. else
  194. gpreg_write(group, u, group->gpio_grp->outp_clr);
  195. }
  196. static void __set_gpo_level_p3(struct lpc32xx_gpio_chip *group,
  197. unsigned pin, int high)
  198. {
  199. if (high)
  200. gpreg_write(group, GPO3_PIN_TO_BIT(pin), group->gpio_grp->outp_set);
  201. else
  202. gpreg_write(group, GPO3_PIN_TO_BIT(pin), group->gpio_grp->outp_clr);
  203. }
  204. static int __get_gpio_state_p012(struct lpc32xx_gpio_chip *group,
  205. unsigned pin)
  206. {
  207. return GPIO012_PIN_IN_SEL(gpreg_read(group, group->gpio_grp->inp_state),
  208. pin);
  209. }
  210. static int __get_gpio_state_p3(struct lpc32xx_gpio_chip *group,
  211. unsigned pin)
  212. {
  213. int state = gpreg_read(group, group->gpio_grp->inp_state);
  214. /*
  215. * P3 GPIO pin input mapping is not contiguous, GPIOP3-0..4 is mapped
  216. * to bits 10..14, while GPIOP3-5 is mapped to bit 24.
  217. */
  218. return GPIO3_PIN_IN_SEL(state, pin);
  219. }
  220. static int __get_gpi_state_p3(struct lpc32xx_gpio_chip *group,
  221. unsigned pin)
  222. {
  223. return GPI3_PIN_IN_SEL(gpreg_read(group, group->gpio_grp->inp_state), pin);
  224. }
  225. static int __get_gpo_state_p3(struct lpc32xx_gpio_chip *group,
  226. unsigned pin)
  227. {
  228. return GPO3_PIN_IN_SEL(gpreg_read(group, group->gpio_grp->outp_state), pin);
  229. }
  230. /*
  231. * GPIO primitives.
  232. */
  233. static int lpc32xx_gpio_dir_input_p012(struct gpio_chip *chip,
  234. unsigned pin)
  235. {
  236. struct lpc32xx_gpio_chip *group = gpiochip_get_data(chip);
  237. __set_gpio_dir_p012(group, pin, 1);
  238. return 0;
  239. }
  240. static int lpc32xx_gpio_dir_input_p3(struct gpio_chip *chip,
  241. unsigned pin)
  242. {
  243. struct lpc32xx_gpio_chip *group = gpiochip_get_data(chip);
  244. __set_gpio_dir_p3(group, pin, 1);
  245. return 0;
  246. }
  247. static int lpc32xx_gpio_dir_in_always(struct gpio_chip *chip,
  248. unsigned pin)
  249. {
  250. return 0;
  251. }
  252. static int lpc32xx_gpio_get_value_p012(struct gpio_chip *chip, unsigned pin)
  253. {
  254. struct lpc32xx_gpio_chip *group = gpiochip_get_data(chip);
  255. return !!__get_gpio_state_p012(group, pin);
  256. }
  257. static int lpc32xx_gpio_get_value_p3(struct gpio_chip *chip, unsigned pin)
  258. {
  259. struct lpc32xx_gpio_chip *group = gpiochip_get_data(chip);
  260. return !!__get_gpio_state_p3(group, pin);
  261. }
  262. static int lpc32xx_gpi_get_value(struct gpio_chip *chip, unsigned pin)
  263. {
  264. struct lpc32xx_gpio_chip *group = gpiochip_get_data(chip);
  265. return !!__get_gpi_state_p3(group, pin);
  266. }
  267. static int lpc32xx_gpio_dir_output_p012(struct gpio_chip *chip, unsigned pin,
  268. int value)
  269. {
  270. struct lpc32xx_gpio_chip *group = gpiochip_get_data(chip);
  271. __set_gpio_level_p012(group, pin, value);
  272. __set_gpio_dir_p012(group, pin, 0);
  273. return 0;
  274. }
  275. static int lpc32xx_gpio_dir_output_p3(struct gpio_chip *chip, unsigned pin,
  276. int value)
  277. {
  278. struct lpc32xx_gpio_chip *group = gpiochip_get_data(chip);
  279. __set_gpio_level_p3(group, pin, value);
  280. __set_gpio_dir_p3(group, pin, 0);
  281. return 0;
  282. }
  283. static int lpc32xx_gpio_dir_out_always(struct gpio_chip *chip, unsigned pin,
  284. int value)
  285. {
  286. struct lpc32xx_gpio_chip *group = gpiochip_get_data(chip);
  287. __set_gpo_level_p3(group, pin, value);
  288. return 0;
  289. }
  290. static void lpc32xx_gpio_set_value_p012(struct gpio_chip *chip, unsigned pin,
  291. int value)
  292. {
  293. struct lpc32xx_gpio_chip *group = gpiochip_get_data(chip);
  294. __set_gpio_level_p012(group, pin, value);
  295. }
  296. static void lpc32xx_gpio_set_value_p3(struct gpio_chip *chip, unsigned pin,
  297. int value)
  298. {
  299. struct lpc32xx_gpio_chip *group = gpiochip_get_data(chip);
  300. __set_gpio_level_p3(group, pin, value);
  301. }
  302. static void lpc32xx_gpo_set_value(struct gpio_chip *chip, unsigned pin,
  303. int value)
  304. {
  305. struct lpc32xx_gpio_chip *group = gpiochip_get_data(chip);
  306. __set_gpo_level_p3(group, pin, value);
  307. }
  308. static int lpc32xx_gpo_get_value(struct gpio_chip *chip, unsigned pin)
  309. {
  310. struct lpc32xx_gpio_chip *group = gpiochip_get_data(chip);
  311. return !!__get_gpo_state_p3(group, pin);
  312. }
  313. static int lpc32xx_gpio_request(struct gpio_chip *chip, unsigned pin)
  314. {
  315. if (pin < chip->ngpio)
  316. return 0;
  317. return -EINVAL;
  318. }
  319. static int lpc32xx_gpio_to_irq_p01(struct gpio_chip *chip, unsigned offset)
  320. {
  321. return -ENXIO;
  322. }
  323. static int lpc32xx_gpio_to_irq_gpio_p3(struct gpio_chip *chip, unsigned offset)
  324. {
  325. return -ENXIO;
  326. }
  327. static int lpc32xx_gpio_to_irq_gpi_p3(struct gpio_chip *chip, unsigned offset)
  328. {
  329. return -ENXIO;
  330. }
  331. static struct lpc32xx_gpio_chip lpc32xx_gpiochip[] = {
  332. {
  333. .chip = {
  334. .label = "gpio_p0",
  335. .direction_input = lpc32xx_gpio_dir_input_p012,
  336. .get = lpc32xx_gpio_get_value_p012,
  337. .direction_output = lpc32xx_gpio_dir_output_p012,
  338. .set = lpc32xx_gpio_set_value_p012,
  339. .request = lpc32xx_gpio_request,
  340. .to_irq = lpc32xx_gpio_to_irq_p01,
  341. .base = LPC32XX_GPIO_P0_GRP,
  342. .ngpio = LPC32XX_GPIO_P0_MAX,
  343. .names = gpio_p0_names,
  344. .can_sleep = false,
  345. },
  346. .gpio_grp = &gpio_grp_regs_p0,
  347. },
  348. {
  349. .chip = {
  350. .label = "gpio_p1",
  351. .direction_input = lpc32xx_gpio_dir_input_p012,
  352. .get = lpc32xx_gpio_get_value_p012,
  353. .direction_output = lpc32xx_gpio_dir_output_p012,
  354. .set = lpc32xx_gpio_set_value_p012,
  355. .request = lpc32xx_gpio_request,
  356. .to_irq = lpc32xx_gpio_to_irq_p01,
  357. .base = LPC32XX_GPIO_P1_GRP,
  358. .ngpio = LPC32XX_GPIO_P1_MAX,
  359. .names = gpio_p1_names,
  360. .can_sleep = false,
  361. },
  362. .gpio_grp = &gpio_grp_regs_p1,
  363. },
  364. {
  365. .chip = {
  366. .label = "gpio_p2",
  367. .direction_input = lpc32xx_gpio_dir_input_p012,
  368. .get = lpc32xx_gpio_get_value_p012,
  369. .direction_output = lpc32xx_gpio_dir_output_p012,
  370. .set = lpc32xx_gpio_set_value_p012,
  371. .request = lpc32xx_gpio_request,
  372. .base = LPC32XX_GPIO_P2_GRP,
  373. .ngpio = LPC32XX_GPIO_P2_MAX,
  374. .names = gpio_p2_names,
  375. .can_sleep = false,
  376. },
  377. .gpio_grp = &gpio_grp_regs_p2,
  378. },
  379. {
  380. .chip = {
  381. .label = "gpio_p3",
  382. .direction_input = lpc32xx_gpio_dir_input_p3,
  383. .get = lpc32xx_gpio_get_value_p3,
  384. .direction_output = lpc32xx_gpio_dir_output_p3,
  385. .set = lpc32xx_gpio_set_value_p3,
  386. .request = lpc32xx_gpio_request,
  387. .to_irq = lpc32xx_gpio_to_irq_gpio_p3,
  388. .base = LPC32XX_GPIO_P3_GRP,
  389. .ngpio = LPC32XX_GPIO_P3_MAX,
  390. .names = gpio_p3_names,
  391. .can_sleep = false,
  392. },
  393. .gpio_grp = &gpio_grp_regs_p3,
  394. },
  395. {
  396. .chip = {
  397. .label = "gpi_p3",
  398. .direction_input = lpc32xx_gpio_dir_in_always,
  399. .get = lpc32xx_gpi_get_value,
  400. .request = lpc32xx_gpio_request,
  401. .to_irq = lpc32xx_gpio_to_irq_gpi_p3,
  402. .base = LPC32XX_GPI_P3_GRP,
  403. .ngpio = LPC32XX_GPI_P3_MAX,
  404. .names = gpi_p3_names,
  405. .can_sleep = false,
  406. },
  407. .gpio_grp = &gpio_grp_regs_p3,
  408. },
  409. {
  410. .chip = {
  411. .label = "gpo_p3",
  412. .direction_output = lpc32xx_gpio_dir_out_always,
  413. .set = lpc32xx_gpo_set_value,
  414. .get = lpc32xx_gpo_get_value,
  415. .request = lpc32xx_gpio_request,
  416. .base = LPC32XX_GPO_P3_GRP,
  417. .ngpio = LPC32XX_GPO_P3_MAX,
  418. .names = gpo_p3_names,
  419. .can_sleep = false,
  420. },
  421. .gpio_grp = &gpio_grp_regs_p3,
  422. },
  423. };
  424. static int lpc32xx_of_xlate(struct gpio_chip *gc,
  425. const struct of_phandle_args *gpiospec, u32 *flags)
  426. {
  427. /* Is this the correct bank? */
  428. u32 bank = gpiospec->args[0];
  429. if ((bank >= ARRAY_SIZE(lpc32xx_gpiochip) ||
  430. (gc != &lpc32xx_gpiochip[bank].chip)))
  431. return -EINVAL;
  432. if (flags)
  433. *flags = gpiospec->args[2];
  434. return gpiospec->args[1];
  435. }
  436. static int lpc32xx_gpio_probe(struct platform_device *pdev)
  437. {
  438. int i;
  439. void __iomem *reg_base;
  440. reg_base = devm_platform_ioremap_resource(pdev, 0);
  441. if (IS_ERR(reg_base))
  442. return PTR_ERR(reg_base);
  443. for (i = 0; i < ARRAY_SIZE(lpc32xx_gpiochip); i++) {
  444. lpc32xx_gpiochip[i].chip.parent = &pdev->dev;
  445. if (pdev->dev.of_node) {
  446. lpc32xx_gpiochip[i].chip.of_xlate = lpc32xx_of_xlate;
  447. lpc32xx_gpiochip[i].chip.of_gpio_n_cells = 3;
  448. lpc32xx_gpiochip[i].reg_base = reg_base;
  449. }
  450. devm_gpiochip_add_data(&pdev->dev, &lpc32xx_gpiochip[i].chip,
  451. &lpc32xx_gpiochip[i]);
  452. }
  453. return 0;
  454. }
  455. #ifdef CONFIG_OF
  456. static const struct of_device_id lpc32xx_gpio_of_match[] = {
  457. { .compatible = "nxp,lpc3220-gpio", },
  458. { },
  459. };
  460. #endif
  461. static struct platform_driver lpc32xx_gpio_driver = {
  462. .driver = {
  463. .name = "lpc32xx-gpio",
  464. .of_match_table = of_match_ptr(lpc32xx_gpio_of_match),
  465. },
  466. .probe = lpc32xx_gpio_probe,
  467. };
  468. module_platform_driver(lpc32xx_gpio_driver);
  469. MODULE_AUTHOR("Kevin Wells <[email protected]>");
  470. MODULE_LICENSE("GPL");
  471. MODULE_DESCRIPTION("GPIO driver for LPC32xx SoC");