gpio-npcm-sgpio.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Nuvoton NPCM Serial GPIO Driver
  4. *
  5. * Copyright (C) 2021 Nuvoton Technologies
  6. */
  7. #include <linux/bitfield.h>
  8. #include <linux/clk.h>
  9. #include <linux/gpio/driver.h>
  10. #include <linux/hashtable.h>
  11. #include <linux/init.h>
  12. #include <linux/io.h>
  13. #include <linux/module.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/spinlock.h>
  16. #include <linux/string.h>
  17. #include <linux/units.h>
  18. #define MAX_NR_HW_SGPIO 64
  19. #define NPCM_IOXCFG1 0x2A
  20. #define NPCM_IOXCFG1_SFT_CLK GENMASK(3, 0)
  21. #define NPCM_IOXCFG1_SCLK_POL BIT(4)
  22. #define NPCM_IOXCFG1_LDSH_POL BIT(5)
  23. #define NPCM_IOXCTS 0x28
  24. #define NPCM_IOXCTS_IOXIF_EN BIT(7)
  25. #define NPCM_IOXCTS_RD_MODE GENMASK(2, 1)
  26. #define NPCM_IOXCTS_RD_MODE_PERIODIC BIT(2)
  27. #define NPCM_IOXCFG2 0x2B
  28. #define NPCM_IOXCFG2_PORT GENMASK(3, 0)
  29. #define NPCM_IXOEVCFG_MASK GENMASK(1, 0)
  30. #define NPCM_IXOEVCFG_FALLING BIT(1)
  31. #define NPCM_IXOEVCFG_RISING BIT(0)
  32. #define NPCM_IXOEVCFG_BOTH (NPCM_IXOEVCFG_FALLING | NPCM_IXOEVCFG_RISING)
  33. #define NPCM_CLK_MHZ (8 * HZ_PER_MHZ)
  34. #define NPCM_750_OPT 6
  35. #define NPCM_845_OPT 5
  36. #define GPIO_BANK(x) ((x) / 8)
  37. #define GPIO_BIT(x) ((x) % 8)
  38. /*
  39. * Select the frequency of shift clock.
  40. * The shift clock is a division of the APB clock.
  41. */
  42. struct npcm_clk_cfg {
  43. unsigned int *sft_clk;
  44. unsigned int *clk_sel;
  45. unsigned int cfg_opt;
  46. };
  47. struct npcm_sgpio {
  48. struct gpio_chip chip;
  49. struct clk *pclk;
  50. struct irq_chip intc;
  51. raw_spinlock_t lock;
  52. void __iomem *base;
  53. int irq;
  54. u8 nin_sgpio;
  55. u8 nout_sgpio;
  56. u8 in_port;
  57. u8 out_port;
  58. u8 int_type[MAX_NR_HW_SGPIO];
  59. };
  60. struct npcm_sgpio_bank {
  61. u8 rdata_reg;
  62. u8 wdata_reg;
  63. u8 event_config;
  64. u8 event_status;
  65. };
  66. enum npcm_sgpio_reg {
  67. READ_DATA,
  68. WRITE_DATA,
  69. EVENT_CFG,
  70. EVENT_STS,
  71. };
  72. static const struct npcm_sgpio_bank npcm_sgpio_banks[] = {
  73. {
  74. .wdata_reg = 0x00,
  75. .rdata_reg = 0x08,
  76. .event_config = 0x10,
  77. .event_status = 0x20,
  78. },
  79. {
  80. .wdata_reg = 0x01,
  81. .rdata_reg = 0x09,
  82. .event_config = 0x12,
  83. .event_status = 0x21,
  84. },
  85. {
  86. .wdata_reg = 0x02,
  87. .rdata_reg = 0x0a,
  88. .event_config = 0x14,
  89. .event_status = 0x22,
  90. },
  91. {
  92. .wdata_reg = 0x03,
  93. .rdata_reg = 0x0b,
  94. .event_config = 0x16,
  95. .event_status = 0x23,
  96. },
  97. {
  98. .wdata_reg = 0x04,
  99. .rdata_reg = 0x0c,
  100. .event_config = 0x18,
  101. .event_status = 0x24,
  102. },
  103. {
  104. .wdata_reg = 0x05,
  105. .rdata_reg = 0x0d,
  106. .event_config = 0x1a,
  107. .event_status = 0x25,
  108. },
  109. {
  110. .wdata_reg = 0x06,
  111. .rdata_reg = 0x0e,
  112. .event_config = 0x1c,
  113. .event_status = 0x26,
  114. },
  115. {
  116. .wdata_reg = 0x07,
  117. .rdata_reg = 0x0f,
  118. .event_config = 0x1e,
  119. .event_status = 0x27,
  120. },
  121. };
  122. static void __iomem *bank_reg(struct npcm_sgpio *gpio,
  123. const struct npcm_sgpio_bank *bank,
  124. const enum npcm_sgpio_reg reg)
  125. {
  126. switch (reg) {
  127. case READ_DATA:
  128. return gpio->base + bank->rdata_reg;
  129. case WRITE_DATA:
  130. return gpio->base + bank->wdata_reg;
  131. case EVENT_CFG:
  132. return gpio->base + bank->event_config;
  133. case EVENT_STS:
  134. return gpio->base + bank->event_status;
  135. default:
  136. /* actually if code runs to here, it's an error case */
  137. dev_WARN(gpio->chip.parent, "Getting here is an error condition");
  138. return NULL;
  139. }
  140. }
  141. static const struct npcm_sgpio_bank *offset_to_bank(unsigned int offset)
  142. {
  143. unsigned int bank = GPIO_BANK(offset);
  144. return &npcm_sgpio_banks[bank];
  145. }
  146. static void npcm_sgpio_irqd_to_data(struct irq_data *d,
  147. struct npcm_sgpio **gpio,
  148. const struct npcm_sgpio_bank **bank,
  149. u8 *bit, unsigned int *offset)
  150. {
  151. struct npcm_sgpio *internal;
  152. *offset = irqd_to_hwirq(d);
  153. internal = irq_data_get_irq_chip_data(d);
  154. *gpio = internal;
  155. *offset -= internal->nout_sgpio;
  156. *bank = offset_to_bank(*offset);
  157. *bit = GPIO_BIT(*offset);
  158. }
  159. static int npcm_sgpio_init_port(struct npcm_sgpio *gpio)
  160. {
  161. u8 in_port, out_port, set_port, reg;
  162. in_port = GPIO_BANK(gpio->nin_sgpio);
  163. if (GPIO_BIT(gpio->nin_sgpio) > 0)
  164. in_port += 1;
  165. out_port = GPIO_BANK(gpio->nout_sgpio);
  166. if (GPIO_BIT(gpio->nout_sgpio) > 0)
  167. out_port += 1;
  168. gpio->in_port = in_port;
  169. gpio->out_port = out_port;
  170. set_port = (out_port & NPCM_IOXCFG2_PORT) << 4 |
  171. (in_port & NPCM_IOXCFG2_PORT);
  172. iowrite8(set_port, gpio->base + NPCM_IOXCFG2);
  173. reg = ioread8(gpio->base + NPCM_IOXCFG2);
  174. return reg == set_port ? 0 : -EINVAL;
  175. }
  176. static int npcm_sgpio_dir_in(struct gpio_chip *gc, unsigned int offset)
  177. {
  178. struct npcm_sgpio *gpio = gpiochip_get_data(gc);
  179. return offset < gpio->nout_sgpio ? -EINVAL : 0;
  180. }
  181. static int npcm_sgpio_dir_out(struct gpio_chip *gc, unsigned int offset, int val)
  182. {
  183. gc->set(gc, offset, val);
  184. return 0;
  185. }
  186. static int npcm_sgpio_get_direction(struct gpio_chip *gc, unsigned int offset)
  187. {
  188. struct npcm_sgpio *gpio = gpiochip_get_data(gc);
  189. if (offset < gpio->nout_sgpio)
  190. return GPIO_LINE_DIRECTION_OUT;
  191. return GPIO_LINE_DIRECTION_IN;
  192. }
  193. static void npcm_sgpio_set(struct gpio_chip *gc, unsigned int offset, int val)
  194. {
  195. struct npcm_sgpio *gpio = gpiochip_get_data(gc);
  196. const struct npcm_sgpio_bank *bank = offset_to_bank(offset);
  197. void __iomem *addr;
  198. u8 reg = 0;
  199. addr = bank_reg(gpio, bank, WRITE_DATA);
  200. reg = ioread8(addr);
  201. if (val)
  202. reg |= BIT(GPIO_BIT(offset));
  203. else
  204. reg &= ~BIT(GPIO_BIT(offset));
  205. iowrite8(reg, addr);
  206. }
  207. static int npcm_sgpio_get(struct gpio_chip *gc, unsigned int offset)
  208. {
  209. struct npcm_sgpio *gpio = gpiochip_get_data(gc);
  210. const struct npcm_sgpio_bank *bank;
  211. void __iomem *addr;
  212. u8 reg;
  213. if (offset < gpio->nout_sgpio) {
  214. bank = offset_to_bank(offset);
  215. addr = bank_reg(gpio, bank, WRITE_DATA);
  216. } else {
  217. offset -= gpio->nout_sgpio;
  218. bank = offset_to_bank(offset);
  219. addr = bank_reg(gpio, bank, READ_DATA);
  220. }
  221. reg = ioread8(addr);
  222. return !!(reg & BIT(GPIO_BIT(offset)));
  223. }
  224. static void npcm_sgpio_setup_enable(struct npcm_sgpio *gpio, bool enable)
  225. {
  226. u8 reg;
  227. reg = ioread8(gpio->base + NPCM_IOXCTS);
  228. reg = (reg & ~NPCM_IOXCTS_RD_MODE) | NPCM_IOXCTS_RD_MODE_PERIODIC;
  229. if (enable)
  230. reg |= NPCM_IOXCTS_IOXIF_EN;
  231. else
  232. reg &= ~NPCM_IOXCTS_IOXIF_EN;
  233. iowrite8(reg, gpio->base + NPCM_IOXCTS);
  234. }
  235. static int npcm_sgpio_setup_clk(struct npcm_sgpio *gpio,
  236. const struct npcm_clk_cfg *clk_cfg)
  237. {
  238. unsigned long apb_freq;
  239. u32 val;
  240. u8 tmp;
  241. int i;
  242. apb_freq = clk_get_rate(gpio->pclk);
  243. tmp = ioread8(gpio->base + NPCM_IOXCFG1) & ~NPCM_IOXCFG1_SFT_CLK;
  244. for (i = clk_cfg->cfg_opt-1; i > 0; i--) {
  245. val = apb_freq / clk_cfg->sft_clk[i];
  246. if (NPCM_CLK_MHZ > val) {
  247. iowrite8(clk_cfg->clk_sel[i] | tmp,
  248. gpio->base + NPCM_IOXCFG1);
  249. return 0;
  250. }
  251. }
  252. return -EINVAL;
  253. }
  254. static void npcm_sgpio_irq_init_valid_mask(struct gpio_chip *gc,
  255. unsigned long *valid_mask,
  256. unsigned int ngpios)
  257. {
  258. struct npcm_sgpio *gpio = gpiochip_get_data(gc);
  259. /* input GPIOs in the high range */
  260. bitmap_set(valid_mask, gpio->nout_sgpio, gpio->nin_sgpio);
  261. bitmap_clear(valid_mask, 0, gpio->nout_sgpio);
  262. }
  263. static void npcm_sgpio_irq_set_mask(struct irq_data *d, bool set)
  264. {
  265. const struct npcm_sgpio_bank *bank;
  266. struct npcm_sgpio *gpio;
  267. unsigned long flags;
  268. void __iomem *addr;
  269. unsigned int offset;
  270. u16 reg, type;
  271. u8 bit;
  272. npcm_sgpio_irqd_to_data(d, &gpio, &bank, &bit, &offset);
  273. addr = bank_reg(gpio, bank, EVENT_CFG);
  274. reg = ioread16(addr);
  275. if (set) {
  276. reg &= ~(NPCM_IXOEVCFG_MASK << (bit * 2));
  277. } else {
  278. type = gpio->int_type[offset];
  279. reg |= (type << (bit * 2));
  280. }
  281. raw_spin_lock_irqsave(&gpio->lock, flags);
  282. npcm_sgpio_setup_enable(gpio, false);
  283. iowrite16(reg, addr);
  284. npcm_sgpio_setup_enable(gpio, true);
  285. addr = bank_reg(gpio, bank, EVENT_STS);
  286. reg = ioread8(addr);
  287. reg |= BIT(bit);
  288. iowrite8(reg, addr);
  289. raw_spin_unlock_irqrestore(&gpio->lock, flags);
  290. }
  291. static void npcm_sgpio_irq_ack(struct irq_data *d)
  292. {
  293. const struct npcm_sgpio_bank *bank;
  294. struct npcm_sgpio *gpio;
  295. unsigned long flags;
  296. void __iomem *status_addr;
  297. unsigned int offset;
  298. u8 bit;
  299. npcm_sgpio_irqd_to_data(d, &gpio, &bank, &bit, &offset);
  300. status_addr = bank_reg(gpio, bank, EVENT_STS);
  301. raw_spin_lock_irqsave(&gpio->lock, flags);
  302. iowrite8(BIT(bit), status_addr);
  303. raw_spin_unlock_irqrestore(&gpio->lock, flags);
  304. }
  305. static void npcm_sgpio_irq_mask(struct irq_data *d)
  306. {
  307. npcm_sgpio_irq_set_mask(d, true);
  308. }
  309. static void npcm_sgpio_irq_unmask(struct irq_data *d)
  310. {
  311. npcm_sgpio_irq_set_mask(d, false);
  312. }
  313. static int npcm_sgpio_set_type(struct irq_data *d, unsigned int type)
  314. {
  315. const struct npcm_sgpio_bank *bank;
  316. irq_flow_handler_t handler;
  317. struct npcm_sgpio *gpio;
  318. unsigned long flags;
  319. void __iomem *addr;
  320. unsigned int offset;
  321. u16 reg, val;
  322. u8 bit;
  323. npcm_sgpio_irqd_to_data(d, &gpio, &bank, &bit, &offset);
  324. switch (type & IRQ_TYPE_SENSE_MASK) {
  325. case IRQ_TYPE_EDGE_BOTH:
  326. val = NPCM_IXOEVCFG_BOTH;
  327. break;
  328. case IRQ_TYPE_EDGE_RISING:
  329. case IRQ_TYPE_LEVEL_HIGH:
  330. val = NPCM_IXOEVCFG_RISING;
  331. break;
  332. case IRQ_TYPE_EDGE_FALLING:
  333. case IRQ_TYPE_LEVEL_LOW:
  334. val = NPCM_IXOEVCFG_FALLING;
  335. break;
  336. default:
  337. return -EINVAL;
  338. }
  339. if (type & IRQ_TYPE_LEVEL_MASK)
  340. handler = handle_level_irq;
  341. else
  342. handler = handle_edge_irq;
  343. gpio->int_type[offset] = val;
  344. raw_spin_lock_irqsave(&gpio->lock, flags);
  345. npcm_sgpio_setup_enable(gpio, false);
  346. addr = bank_reg(gpio, bank, EVENT_CFG);
  347. reg = ioread16(addr);
  348. reg |= (val << (bit * 2));
  349. iowrite16(reg, addr);
  350. npcm_sgpio_setup_enable(gpio, true);
  351. raw_spin_unlock_irqrestore(&gpio->lock, flags);
  352. irq_set_handler_locked(d, handler);
  353. return 0;
  354. }
  355. static void npcm_sgpio_irq_handler(struct irq_desc *desc)
  356. {
  357. struct gpio_chip *gc = irq_desc_get_handler_data(desc);
  358. struct irq_chip *ic = irq_desc_get_chip(desc);
  359. struct npcm_sgpio *gpio = gpiochip_get_data(gc);
  360. unsigned int i, j;
  361. unsigned long reg;
  362. chained_irq_enter(ic, desc);
  363. for (i = 0; i < ARRAY_SIZE(npcm_sgpio_banks); i++) {
  364. const struct npcm_sgpio_bank *bank = &npcm_sgpio_banks[i];
  365. reg = ioread8(bank_reg(gpio, bank, EVENT_STS));
  366. for_each_set_bit(j, &reg, 8)
  367. generic_handle_domain_irq(gc->irq.domain,
  368. i * 8 + gpio->nout_sgpio + j);
  369. }
  370. chained_irq_exit(ic, desc);
  371. }
  372. static const struct irq_chip sgpio_irq_chip = {
  373. .name = "sgpio-irq",
  374. .irq_ack = npcm_sgpio_irq_ack,
  375. .irq_mask = npcm_sgpio_irq_mask,
  376. .irq_unmask = npcm_sgpio_irq_unmask,
  377. .irq_set_type = npcm_sgpio_set_type,
  378. .flags = IRQCHIP_IMMUTABLE | IRQCHIP_MASK_ON_SUSPEND,
  379. GPIOCHIP_IRQ_RESOURCE_HELPERS,
  380. };
  381. static int npcm_sgpio_setup_irqs(struct npcm_sgpio *gpio,
  382. struct platform_device *pdev)
  383. {
  384. int rc, i;
  385. struct gpio_irq_chip *irq;
  386. rc = platform_get_irq(pdev, 0);
  387. if (rc < 0)
  388. return rc;
  389. gpio->irq = rc;
  390. npcm_sgpio_setup_enable(gpio, false);
  391. /* Disable IRQ and clear Interrupt status registers for all SGPIO Pins. */
  392. for (i = 0; i < ARRAY_SIZE(npcm_sgpio_banks); i++) {
  393. const struct npcm_sgpio_bank *bank = &npcm_sgpio_banks[i];
  394. iowrite16(0, bank_reg(gpio, bank, EVENT_CFG));
  395. iowrite8(0xff, bank_reg(gpio, bank, EVENT_STS));
  396. }
  397. irq = &gpio->chip.irq;
  398. gpio_irq_chip_set_chip(irq, &sgpio_irq_chip);
  399. irq->init_valid_mask = npcm_sgpio_irq_init_valid_mask;
  400. irq->handler = handle_bad_irq;
  401. irq->default_type = IRQ_TYPE_NONE;
  402. irq->parent_handler = npcm_sgpio_irq_handler;
  403. irq->parent_handler_data = gpio;
  404. irq->parents = &gpio->irq;
  405. irq->num_parents = 1;
  406. return 0;
  407. }
  408. static int npcm_sgpio_probe(struct platform_device *pdev)
  409. {
  410. struct npcm_sgpio *gpio;
  411. const struct npcm_clk_cfg *clk_cfg;
  412. int rc;
  413. u32 nin_gpios, nout_gpios;
  414. gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
  415. if (!gpio)
  416. return -ENOMEM;
  417. gpio->base = devm_platform_ioremap_resource(pdev, 0);
  418. if (IS_ERR(gpio->base))
  419. return PTR_ERR(gpio->base);
  420. clk_cfg = device_get_match_data(&pdev->dev);
  421. if (!clk_cfg)
  422. return -EINVAL;
  423. rc = device_property_read_u32(&pdev->dev, "nuvoton,input-ngpios",
  424. &nin_gpios);
  425. if (rc < 0)
  426. return dev_err_probe(&pdev->dev, rc, "Could not read ngpios property\n");
  427. rc = device_property_read_u32(&pdev->dev, "nuvoton,output-ngpios",
  428. &nout_gpios);
  429. if (rc < 0)
  430. return dev_err_probe(&pdev->dev, rc, "Could not read ngpios property\n");
  431. gpio->nin_sgpio = nin_gpios;
  432. gpio->nout_sgpio = nout_gpios;
  433. if (gpio->nin_sgpio > MAX_NR_HW_SGPIO ||
  434. gpio->nout_sgpio > MAX_NR_HW_SGPIO)
  435. return dev_err_probe(&pdev->dev, -EINVAL, "Number of GPIOs exceeds the maximum of %d: input: %d output: %d\n", MAX_NR_HW_SGPIO, nin_gpios, nout_gpios);
  436. gpio->pclk = devm_clk_get(&pdev->dev, NULL);
  437. if (IS_ERR(gpio->pclk))
  438. return dev_err_probe(&pdev->dev, PTR_ERR(gpio->pclk), "Could not get pclk\n");
  439. rc = npcm_sgpio_setup_clk(gpio, clk_cfg);
  440. if (rc < 0)
  441. return dev_err_probe(&pdev->dev, rc, "Failed to setup clock\n");
  442. raw_spin_lock_init(&gpio->lock);
  443. gpio->chip.parent = &pdev->dev;
  444. gpio->chip.ngpio = gpio->nin_sgpio + gpio->nout_sgpio;
  445. gpio->chip.direction_input = npcm_sgpio_dir_in;
  446. gpio->chip.direction_output = npcm_sgpio_dir_out;
  447. gpio->chip.get_direction = npcm_sgpio_get_direction;
  448. gpio->chip.get = npcm_sgpio_get;
  449. gpio->chip.set = npcm_sgpio_set;
  450. gpio->chip.label = dev_name(&pdev->dev);
  451. gpio->chip.base = -1;
  452. rc = npcm_sgpio_init_port(gpio);
  453. if (rc < 0)
  454. return rc;
  455. rc = npcm_sgpio_setup_irqs(gpio, pdev);
  456. if (rc < 0)
  457. return rc;
  458. rc = devm_gpiochip_add_data(&pdev->dev, &gpio->chip, gpio);
  459. if (rc)
  460. return dev_err_probe(&pdev->dev, rc, "GPIO registering failed\n");
  461. npcm_sgpio_setup_enable(gpio, true);
  462. return 0;
  463. }
  464. static unsigned int npcm750_SFT_CLK[NPCM_750_OPT] = {
  465. 1024, 32, 8, 4, 3, 2,
  466. };
  467. static unsigned int npcm750_CLK_SEL[NPCM_750_OPT] = {
  468. 0x00, 0x05, 0x07, 0x0C, 0x0D, 0x0E,
  469. };
  470. static unsigned int npcm845_SFT_CLK[NPCM_845_OPT] = {
  471. 1024, 32, 16, 8, 4,
  472. };
  473. static unsigned int npcm845_CLK_SEL[NPCM_845_OPT] = {
  474. 0x00, 0x05, 0x06, 0x07, 0x0C,
  475. };
  476. static struct npcm_clk_cfg npcm750_sgpio_pdata = {
  477. .sft_clk = npcm750_SFT_CLK,
  478. .clk_sel = npcm750_CLK_SEL,
  479. .cfg_opt = NPCM_750_OPT,
  480. };
  481. static const struct npcm_clk_cfg npcm845_sgpio_pdata = {
  482. .sft_clk = npcm845_SFT_CLK,
  483. .clk_sel = npcm845_CLK_SEL,
  484. .cfg_opt = NPCM_845_OPT,
  485. };
  486. static const struct of_device_id npcm_sgpio_of_table[] = {
  487. { .compatible = "nuvoton,npcm750-sgpio", .data = &npcm750_sgpio_pdata, },
  488. { .compatible = "nuvoton,npcm845-sgpio", .data = &npcm845_sgpio_pdata, },
  489. {}
  490. };
  491. MODULE_DEVICE_TABLE(of, npcm_sgpio_of_table);
  492. static struct platform_driver npcm_sgpio_driver = {
  493. .driver = {
  494. .name = KBUILD_MODNAME,
  495. .of_match_table = npcm_sgpio_of_table,
  496. },
  497. .probe = npcm_sgpio_probe,
  498. };
  499. module_platform_driver(npcm_sgpio_driver);
  500. MODULE_AUTHOR("Jim Liu <jjliu0@nuvoton.com>");
  501. MODULE_AUTHOR("Joseph Liu <kwliu@nuvoton.com>");
  502. MODULE_DESCRIPTION("Nuvoton NPCM Serial GPIO Driver");
  503. MODULE_LICENSE("GPL v2");