0001
0002
0003
0004
0005
0006
0007
0008 #include <linux/bitmap.h>
0009 #include <linux/bitops.h>
0010 #include <linux/clk.h>
0011 #include <linux/errno.h>
0012 #include <linux/gpio/driver.h>
0013 #include <linux/init.h>
0014 #include <linux/interrupt.h>
0015 #include <linux/io.h>
0016 #include <linux/irq.h>
0017 #include <linux/module.h>
0018 #include <linux/of_device.h>
0019 #include <linux/of_platform.h>
0020 #include <linux/pm_runtime.h>
0021 #include <linux/slab.h>
0022
0023
0024 #define XGPIO_DATA_OFFSET (0x0)
0025 #define XGPIO_TRI_OFFSET (0x4)
0026
0027 #define XGPIO_CHANNEL0_OFFSET 0x0
0028 #define XGPIO_CHANNEL1_OFFSET 0x8
0029
0030 #define XGPIO_GIER_OFFSET 0x11c
0031 #define XGPIO_GIER_IE BIT(31)
0032 #define XGPIO_IPISR_OFFSET 0x120
0033 #define XGPIO_IPIER_OFFSET 0x128
0034
0035
0036 #if defined(CONFIG_ARCH_ZYNQ) || defined(CONFIG_X86)
0037 # define xgpio_readreg(offset) readl(offset)
0038 # define xgpio_writereg(offset, val) writel(val, offset)
0039 #else
0040 # define xgpio_readreg(offset) __raw_readl(offset)
0041 # define xgpio_writereg(offset, val) __raw_writel(val, offset)
0042 #endif
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061 struct xgpio_instance {
0062 struct gpio_chip gc;
0063 void __iomem *regs;
0064 DECLARE_BITMAP(hw_map, 64);
0065 DECLARE_BITMAP(sw_map, 64);
0066 DECLARE_BITMAP(state, 64);
0067 DECLARE_BITMAP(last_irq_read, 64);
0068 DECLARE_BITMAP(dir, 64);
0069 spinlock_t gpio_lock;
0070 int irq;
0071 struct irq_chip irqchip;
0072 DECLARE_BITMAP(enable, 64);
0073 DECLARE_BITMAP(rising_edge, 64);
0074 DECLARE_BITMAP(falling_edge, 64);
0075 struct clk *clk;
0076 };
0077
0078 static inline int xgpio_from_bit(struct xgpio_instance *chip, int bit)
0079 {
0080 return bitmap_bitremap(bit, chip->hw_map, chip->sw_map, 64);
0081 }
0082
0083 static inline int xgpio_to_bit(struct xgpio_instance *chip, int gpio)
0084 {
0085 return bitmap_bitremap(gpio, chip->sw_map, chip->hw_map, 64);
0086 }
0087
0088 static inline u32 xgpio_get_value32(const unsigned long *map, int bit)
0089 {
0090 const size_t index = BIT_WORD(bit);
0091 const unsigned long offset = (bit % BITS_PER_LONG) & BIT(5);
0092
0093 return (map[index] >> offset) & 0xFFFFFFFFul;
0094 }
0095
0096 static inline void xgpio_set_value32(unsigned long *map, int bit, u32 v)
0097 {
0098 const size_t index = BIT_WORD(bit);
0099 const unsigned long offset = (bit % BITS_PER_LONG) & BIT(5);
0100
0101 map[index] &= ~(0xFFFFFFFFul << offset);
0102 map[index] |= (unsigned long)v << offset;
0103 }
0104
0105 static inline int xgpio_regoffset(struct xgpio_instance *chip, int ch)
0106 {
0107 switch (ch) {
0108 case 0:
0109 return XGPIO_CHANNEL0_OFFSET;
0110 case 1:
0111 return XGPIO_CHANNEL1_OFFSET;
0112 default:
0113 return -EINVAL;
0114 }
0115 }
0116
0117 static void xgpio_read_ch(struct xgpio_instance *chip, int reg, int bit, unsigned long *a)
0118 {
0119 void __iomem *addr = chip->regs + reg + xgpio_regoffset(chip, bit / 32);
0120
0121 xgpio_set_value32(a, bit, xgpio_readreg(addr));
0122 }
0123
0124 static void xgpio_write_ch(struct xgpio_instance *chip, int reg, int bit, unsigned long *a)
0125 {
0126 void __iomem *addr = chip->regs + reg + xgpio_regoffset(chip, bit / 32);
0127
0128 xgpio_writereg(addr, xgpio_get_value32(a, bit));
0129 }
0130
0131 static void xgpio_read_ch_all(struct xgpio_instance *chip, int reg, unsigned long *a)
0132 {
0133 int bit, lastbit = xgpio_to_bit(chip, chip->gc.ngpio - 1);
0134
0135 for (bit = 0; bit <= lastbit ; bit += 32)
0136 xgpio_read_ch(chip, reg, bit, a);
0137 }
0138
0139 static void xgpio_write_ch_all(struct xgpio_instance *chip, int reg, unsigned long *a)
0140 {
0141 int bit, lastbit = xgpio_to_bit(chip, chip->gc.ngpio - 1);
0142
0143 for (bit = 0; bit <= lastbit ; bit += 32)
0144 xgpio_write_ch(chip, reg, bit, a);
0145 }
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158 static int xgpio_get(struct gpio_chip *gc, unsigned int gpio)
0159 {
0160 struct xgpio_instance *chip = gpiochip_get_data(gc);
0161 int bit = xgpio_to_bit(chip, gpio);
0162 DECLARE_BITMAP(state, 64);
0163
0164 xgpio_read_ch(chip, XGPIO_DATA_OFFSET, bit, state);
0165
0166 return test_bit(bit, state);
0167 }
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178 static void xgpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
0179 {
0180 unsigned long flags;
0181 struct xgpio_instance *chip = gpiochip_get_data(gc);
0182 int bit = xgpio_to_bit(chip, gpio);
0183
0184 spin_lock_irqsave(&chip->gpio_lock, flags);
0185
0186
0187 __assign_bit(bit, chip->state, val);
0188
0189 xgpio_write_ch(chip, XGPIO_DATA_OFFSET, bit, chip->state);
0190
0191 spin_unlock_irqrestore(&chip->gpio_lock, flags);
0192 }
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203 static void xgpio_set_multiple(struct gpio_chip *gc, unsigned long *mask,
0204 unsigned long *bits)
0205 {
0206 DECLARE_BITMAP(hw_mask, 64);
0207 DECLARE_BITMAP(hw_bits, 64);
0208 DECLARE_BITMAP(state, 64);
0209 unsigned long flags;
0210 struct xgpio_instance *chip = gpiochip_get_data(gc);
0211
0212 bitmap_remap(hw_mask, mask, chip->sw_map, chip->hw_map, 64);
0213 bitmap_remap(hw_bits, bits, chip->sw_map, chip->hw_map, 64);
0214
0215 spin_lock_irqsave(&chip->gpio_lock, flags);
0216
0217 bitmap_replace(state, chip->state, hw_bits, hw_mask, 64);
0218
0219 xgpio_write_ch_all(chip, XGPIO_DATA_OFFSET, state);
0220
0221 bitmap_copy(chip->state, state, 64);
0222
0223 spin_unlock_irqrestore(&chip->gpio_lock, flags);
0224 }
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235 static int xgpio_dir_in(struct gpio_chip *gc, unsigned int gpio)
0236 {
0237 unsigned long flags;
0238 struct xgpio_instance *chip = gpiochip_get_data(gc);
0239 int bit = xgpio_to_bit(chip, gpio);
0240
0241 spin_lock_irqsave(&chip->gpio_lock, flags);
0242
0243
0244 __set_bit(bit, chip->dir);
0245 xgpio_write_ch(chip, XGPIO_TRI_OFFSET, bit, chip->dir);
0246
0247 spin_unlock_irqrestore(&chip->gpio_lock, flags);
0248
0249 return 0;
0250 }
0251
0252
0253
0254
0255
0256
0257
0258
0259
0260
0261
0262
0263
0264 static int xgpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
0265 {
0266 unsigned long flags;
0267 struct xgpio_instance *chip = gpiochip_get_data(gc);
0268 int bit = xgpio_to_bit(chip, gpio);
0269
0270 spin_lock_irqsave(&chip->gpio_lock, flags);
0271
0272
0273 __assign_bit(bit, chip->state, val);
0274 xgpio_write_ch(chip, XGPIO_DATA_OFFSET, bit, chip->state);
0275
0276
0277 __clear_bit(bit, chip->dir);
0278 xgpio_write_ch(chip, XGPIO_TRI_OFFSET, bit, chip->dir);
0279
0280 spin_unlock_irqrestore(&chip->gpio_lock, flags);
0281
0282 return 0;
0283 }
0284
0285
0286
0287
0288
0289 static void xgpio_save_regs(struct xgpio_instance *chip)
0290 {
0291 xgpio_write_ch_all(chip, XGPIO_DATA_OFFSET, chip->state);
0292 xgpio_write_ch_all(chip, XGPIO_TRI_OFFSET, chip->dir);
0293 }
0294
0295 static int xgpio_request(struct gpio_chip *chip, unsigned int offset)
0296 {
0297 int ret;
0298
0299 ret = pm_runtime_get_sync(chip->parent);
0300
0301
0302
0303
0304 return ret < 0 ? ret : 0;
0305 }
0306
0307 static void xgpio_free(struct gpio_chip *chip, unsigned int offset)
0308 {
0309 pm_runtime_put(chip->parent);
0310 }
0311
0312 static int __maybe_unused xgpio_suspend(struct device *dev)
0313 {
0314 struct xgpio_instance *gpio = dev_get_drvdata(dev);
0315 struct irq_data *data = irq_get_irq_data(gpio->irq);
0316
0317 if (!data) {
0318 dev_dbg(dev, "IRQ not connected\n");
0319 return pm_runtime_force_suspend(dev);
0320 }
0321
0322 if (!irqd_is_wakeup_set(data))
0323 return pm_runtime_force_suspend(dev);
0324
0325 return 0;
0326 }
0327
0328
0329
0330
0331
0332
0333
0334
0335
0336 static int xgpio_remove(struct platform_device *pdev)
0337 {
0338 struct xgpio_instance *gpio = platform_get_drvdata(pdev);
0339
0340 pm_runtime_get_sync(&pdev->dev);
0341 pm_runtime_put_noidle(&pdev->dev);
0342 pm_runtime_disable(&pdev->dev);
0343 clk_disable_unprepare(gpio->clk);
0344
0345 return 0;
0346 }
0347
0348
0349
0350
0351
0352
0353
0354 static void xgpio_irq_ack(struct irq_data *irq_data)
0355 {
0356 }
0357
0358 static int __maybe_unused xgpio_resume(struct device *dev)
0359 {
0360 struct xgpio_instance *gpio = dev_get_drvdata(dev);
0361 struct irq_data *data = irq_get_irq_data(gpio->irq);
0362
0363 if (!data) {
0364 dev_dbg(dev, "IRQ not connected\n");
0365 return pm_runtime_force_resume(dev);
0366 }
0367
0368 if (!irqd_is_wakeup_set(data))
0369 return pm_runtime_force_resume(dev);
0370
0371 return 0;
0372 }
0373
0374 static int __maybe_unused xgpio_runtime_suspend(struct device *dev)
0375 {
0376 struct xgpio_instance *gpio = dev_get_drvdata(dev);
0377
0378 clk_disable(gpio->clk);
0379
0380 return 0;
0381 }
0382
0383 static int __maybe_unused xgpio_runtime_resume(struct device *dev)
0384 {
0385 struct xgpio_instance *gpio = dev_get_drvdata(dev);
0386
0387 return clk_enable(gpio->clk);
0388 }
0389
0390 static const struct dev_pm_ops xgpio_dev_pm_ops = {
0391 SET_SYSTEM_SLEEP_PM_OPS(xgpio_suspend, xgpio_resume)
0392 SET_RUNTIME_PM_OPS(xgpio_runtime_suspend,
0393 xgpio_runtime_resume, NULL)
0394 };
0395
0396
0397
0398
0399
0400 static void xgpio_irq_mask(struct irq_data *irq_data)
0401 {
0402 unsigned long flags;
0403 struct xgpio_instance *chip = irq_data_get_irq_chip_data(irq_data);
0404 int irq_offset = irqd_to_hwirq(irq_data);
0405 int bit = xgpio_to_bit(chip, irq_offset);
0406 u32 mask = BIT(bit / 32), temp;
0407
0408 spin_lock_irqsave(&chip->gpio_lock, flags);
0409
0410 __clear_bit(bit, chip->enable);
0411
0412 if (xgpio_get_value32(chip->enable, bit) == 0) {
0413
0414 temp = xgpio_readreg(chip->regs + XGPIO_IPIER_OFFSET);
0415 temp &= ~mask;
0416 xgpio_writereg(chip->regs + XGPIO_IPIER_OFFSET, temp);
0417 }
0418 spin_unlock_irqrestore(&chip->gpio_lock, flags);
0419 }
0420
0421
0422
0423
0424
0425 static void xgpio_irq_unmask(struct irq_data *irq_data)
0426 {
0427 unsigned long flags;
0428 struct xgpio_instance *chip = irq_data_get_irq_chip_data(irq_data);
0429 int irq_offset = irqd_to_hwirq(irq_data);
0430 int bit = xgpio_to_bit(chip, irq_offset);
0431 u32 old_enable = xgpio_get_value32(chip->enable, bit);
0432 u32 mask = BIT(bit / 32), val;
0433
0434 spin_lock_irqsave(&chip->gpio_lock, flags);
0435
0436 __set_bit(bit, chip->enable);
0437
0438 if (old_enable == 0) {
0439
0440 val = xgpio_readreg(chip->regs + XGPIO_IPISR_OFFSET);
0441 val &= mask;
0442 xgpio_writereg(chip->regs + XGPIO_IPISR_OFFSET, val);
0443
0444
0445 xgpio_read_ch(chip, XGPIO_DATA_OFFSET, bit, chip->last_irq_read);
0446
0447
0448 val = xgpio_readreg(chip->regs + XGPIO_IPIER_OFFSET);
0449 val |= mask;
0450 xgpio_writereg(chip->regs + XGPIO_IPIER_OFFSET, val);
0451 }
0452
0453 spin_unlock_irqrestore(&chip->gpio_lock, flags);
0454 }
0455
0456
0457
0458
0459
0460
0461
0462
0463
0464 static int xgpio_set_irq_type(struct irq_data *irq_data, unsigned int type)
0465 {
0466 struct xgpio_instance *chip = irq_data_get_irq_chip_data(irq_data);
0467 int irq_offset = irqd_to_hwirq(irq_data);
0468 int bit = xgpio_to_bit(chip, irq_offset);
0469
0470
0471
0472
0473
0474
0475
0476 switch (type & IRQ_TYPE_SENSE_MASK) {
0477 case IRQ_TYPE_EDGE_BOTH:
0478 __set_bit(bit, chip->rising_edge);
0479 __set_bit(bit, chip->falling_edge);
0480 break;
0481 case IRQ_TYPE_EDGE_RISING:
0482 __set_bit(bit, chip->rising_edge);
0483 __clear_bit(bit, chip->falling_edge);
0484 break;
0485 case IRQ_TYPE_EDGE_FALLING:
0486 __clear_bit(bit, chip->rising_edge);
0487 __set_bit(bit, chip->falling_edge);
0488 break;
0489 default:
0490 return -EINVAL;
0491 }
0492
0493 irq_set_handler_locked(irq_data, handle_edge_irq);
0494 return 0;
0495 }
0496
0497
0498
0499
0500
0501 static void xgpio_irqhandler(struct irq_desc *desc)
0502 {
0503 struct xgpio_instance *chip = irq_desc_get_handler_data(desc);
0504 struct gpio_chip *gc = &chip->gc;
0505 struct irq_chip *irqchip = irq_desc_get_chip(desc);
0506 DECLARE_BITMAP(rising, 64);
0507 DECLARE_BITMAP(falling, 64);
0508 DECLARE_BITMAP(all, 64);
0509 int irq_offset;
0510 u32 status;
0511 u32 bit;
0512
0513 status = xgpio_readreg(chip->regs + XGPIO_IPISR_OFFSET);
0514 xgpio_writereg(chip->regs + XGPIO_IPISR_OFFSET, status);
0515
0516 chained_irq_enter(irqchip, desc);
0517
0518 spin_lock(&chip->gpio_lock);
0519
0520 xgpio_read_ch_all(chip, XGPIO_DATA_OFFSET, all);
0521
0522 bitmap_complement(rising, chip->last_irq_read, 64);
0523 bitmap_and(rising, rising, all, 64);
0524 bitmap_and(rising, rising, chip->enable, 64);
0525 bitmap_and(rising, rising, chip->rising_edge, 64);
0526
0527 bitmap_complement(falling, all, 64);
0528 bitmap_and(falling, falling, chip->last_irq_read, 64);
0529 bitmap_and(falling, falling, chip->enable, 64);
0530 bitmap_and(falling, falling, chip->falling_edge, 64);
0531
0532 bitmap_copy(chip->last_irq_read, all, 64);
0533 bitmap_or(all, rising, falling, 64);
0534
0535 spin_unlock(&chip->gpio_lock);
0536
0537 dev_dbg(gc->parent, "IRQ rising %*pb falling %*pb\n", 64, rising, 64, falling);
0538
0539 for_each_set_bit(bit, all, 64) {
0540 irq_offset = xgpio_from_bit(chip, bit);
0541 generic_handle_domain_irq(gc->irq.domain, irq_offset);
0542 }
0543
0544 chained_irq_exit(irqchip, desc);
0545 }
0546
0547
0548
0549
0550
0551
0552
0553
0554
0555 static int xgpio_probe(struct platform_device *pdev)
0556 {
0557 struct xgpio_instance *chip;
0558 int status = 0;
0559 struct device_node *np = pdev->dev.of_node;
0560 u32 is_dual = 0;
0561 u32 cells = 2;
0562 u32 width[2];
0563 u32 state[2];
0564 u32 dir[2];
0565 struct gpio_irq_chip *girq;
0566 u32 temp;
0567
0568 chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL);
0569 if (!chip)
0570 return -ENOMEM;
0571
0572 platform_set_drvdata(pdev, chip);
0573
0574
0575 of_property_read_u32(np, "xlnx,is-dual", &is_dual);
0576
0577
0578 memset32(width, 0, ARRAY_SIZE(width));
0579 memset32(state, 0, ARRAY_SIZE(state));
0580 memset32(dir, 0xFFFFFFFF, ARRAY_SIZE(dir));
0581
0582
0583 of_property_read_u32(np, "xlnx,dout-default", &state[0]);
0584 of_property_read_u32(np, "xlnx,dout-default-2", &state[1]);
0585
0586 bitmap_from_arr32(chip->state, state, 64);
0587
0588
0589 of_property_read_u32(np, "xlnx,tri-default", &dir[0]);
0590 of_property_read_u32(np, "xlnx,tri-default-2", &dir[1]);
0591
0592 bitmap_from_arr32(chip->dir, dir, 64);
0593
0594
0595 if (of_property_read_u32(np, "#gpio-cells", &cells))
0596 dev_dbg(&pdev->dev, "Missing gpio-cells property\n");
0597
0598 if (cells != 2) {
0599 dev_err(&pdev->dev, "#gpio-cells mismatch\n");
0600 return -EINVAL;
0601 }
0602
0603
0604
0605
0606
0607 if (of_property_read_u32(np, "xlnx,gpio-width", &width[0]))
0608 width[0] = 32;
0609
0610 if (width[0] > 32)
0611 return -EINVAL;
0612
0613 if (is_dual && of_property_read_u32(np, "xlnx,gpio2-width", &width[1]))
0614 width[1] = 32;
0615
0616 if (width[1] > 32)
0617 return -EINVAL;
0618
0619
0620 bitmap_set(chip->sw_map, 0, width[0] + width[1]);
0621
0622
0623 bitmap_set(chip->hw_map, 0, width[0]);
0624 bitmap_set(chip->hw_map, 32, width[1]);
0625
0626 spin_lock_init(&chip->gpio_lock);
0627
0628 chip->gc.base = -1;
0629 chip->gc.ngpio = bitmap_weight(chip->hw_map, 64);
0630 chip->gc.parent = &pdev->dev;
0631 chip->gc.direction_input = xgpio_dir_in;
0632 chip->gc.direction_output = xgpio_dir_out;
0633 chip->gc.of_gpio_n_cells = cells;
0634 chip->gc.get = xgpio_get;
0635 chip->gc.set = xgpio_set;
0636 chip->gc.request = xgpio_request;
0637 chip->gc.free = xgpio_free;
0638 chip->gc.set_multiple = xgpio_set_multiple;
0639
0640 chip->gc.label = dev_name(&pdev->dev);
0641
0642 chip->regs = devm_platform_ioremap_resource(pdev, 0);
0643 if (IS_ERR(chip->regs)) {
0644 dev_err(&pdev->dev, "failed to ioremap memory resource\n");
0645 return PTR_ERR(chip->regs);
0646 }
0647
0648 chip->clk = devm_clk_get_optional(&pdev->dev, NULL);
0649 if (IS_ERR(chip->clk))
0650 return dev_err_probe(&pdev->dev, PTR_ERR(chip->clk), "input clock not found.\n");
0651
0652 status = clk_prepare_enable(chip->clk);
0653 if (status < 0) {
0654 dev_err(&pdev->dev, "Failed to prepare clk\n");
0655 return status;
0656 }
0657 pm_runtime_get_noresume(&pdev->dev);
0658 pm_runtime_set_active(&pdev->dev);
0659 pm_runtime_enable(&pdev->dev);
0660
0661 xgpio_save_regs(chip);
0662
0663 chip->irq = platform_get_irq_optional(pdev, 0);
0664 if (chip->irq <= 0)
0665 goto skip_irq;
0666
0667 chip->irqchip.name = "gpio-xilinx";
0668 chip->irqchip.irq_ack = xgpio_irq_ack;
0669 chip->irqchip.irq_mask = xgpio_irq_mask;
0670 chip->irqchip.irq_unmask = xgpio_irq_unmask;
0671 chip->irqchip.irq_set_type = xgpio_set_irq_type;
0672
0673
0674 xgpio_writereg(chip->regs + XGPIO_IPIER_OFFSET, 0);
0675
0676 temp = xgpio_readreg(chip->regs + XGPIO_IPISR_OFFSET);
0677 xgpio_writereg(chip->regs + XGPIO_IPISR_OFFSET, temp);
0678
0679 xgpio_writereg(chip->regs + XGPIO_GIER_OFFSET, XGPIO_GIER_IE);
0680
0681 girq = &chip->gc.irq;
0682 girq->chip = &chip->irqchip;
0683 girq->parent_handler = xgpio_irqhandler;
0684 girq->num_parents = 1;
0685 girq->parents = devm_kcalloc(&pdev->dev, 1,
0686 sizeof(*girq->parents),
0687 GFP_KERNEL);
0688 if (!girq->parents) {
0689 status = -ENOMEM;
0690 goto err_pm_put;
0691 }
0692 girq->parents[0] = chip->irq;
0693 girq->default_type = IRQ_TYPE_NONE;
0694 girq->handler = handle_bad_irq;
0695
0696 skip_irq:
0697 status = devm_gpiochip_add_data(&pdev->dev, &chip->gc, chip);
0698 if (status) {
0699 dev_err(&pdev->dev, "failed to add GPIO chip\n");
0700 goto err_pm_put;
0701 }
0702
0703 pm_runtime_put(&pdev->dev);
0704 return 0;
0705
0706 err_pm_put:
0707 pm_runtime_disable(&pdev->dev);
0708 pm_runtime_put_noidle(&pdev->dev);
0709 clk_disable_unprepare(chip->clk);
0710 return status;
0711 }
0712
0713 static const struct of_device_id xgpio_of_match[] = {
0714 { .compatible = "xlnx,xps-gpio-1.00.a", },
0715 { },
0716 };
0717
0718 MODULE_DEVICE_TABLE(of, xgpio_of_match);
0719
0720 static struct platform_driver xgpio_plat_driver = {
0721 .probe = xgpio_probe,
0722 .remove = xgpio_remove,
0723 .driver = {
0724 .name = "gpio-xilinx",
0725 .of_match_table = xgpio_of_match,
0726 .pm = &xgpio_dev_pm_ops,
0727 },
0728 };
0729
0730 static int __init xgpio_init(void)
0731 {
0732 return platform_driver_register(&xgpio_plat_driver);
0733 }
0734
0735 subsys_initcall(xgpio_init);
0736
0737 static void __exit xgpio_exit(void)
0738 {
0739 platform_driver_unregister(&xgpio_plat_driver);
0740 }
0741 module_exit(xgpio_exit);
0742
0743 MODULE_AUTHOR("Xilinx, Inc.");
0744 MODULE_DESCRIPTION("Xilinx GPIO driver");
0745 MODULE_LICENSE("GPL");