2 * Xilinx PS GPIO device driver
4 * 2009-2011 (c) Xilinx, Inc.
6 * This program is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU General Public License as published by the Free Software
8 * Foundation; either version 2 of the License, or (at your option) any later
11 * You should have received a copy of the GNU General Public License along with
12 * this program; if not, write to the Free Software Foundation, Inc., 675 Mass
13 * Ave, Cambridge, MA 02139, USA.
16 #include <linux/export.h>
17 #include <linux/module.h>
19 #include <linux/irq.h>
20 #include <linux/gpio.h>
21 #include <linux/init.h>
22 #include <linux/errno.h>
23 #include <linux/interrupt.h>
24 #include <linux/platform_device.h>
25 #include <linux/slab.h>
26 #include <linux/pm_runtime.h>
27 #ifdef CONFIG_COMMON_CLK
28 #include <linux/err.h>
29 #include <linux/clk.h>
32 #define DRIVER_NAME "xgpiops"
34 /* Register offsets for the GPIO device */
36 #define XGPIOPS_DATA_LSW_OFFSET(BANK) (0x000 + (8 * BANK)) /* LSW Mask &
38 #define XGPIOPS_DATA_MSW_OFFSET(BANK) (0x004 + (8 * BANK)) /* MSW Mask &
40 #define XGPIOPS_DATA_OFFSET(BANK) (0x040 + (4 * BANK)) /* Data Register
42 #define XGPIOPS_DIRM_OFFSET(BANK) (0x204 + (0x40 * BANK)) /* Direction
44 #define XGPIOPS_OUTEN_OFFSET(BANK) (0x208 + (0x40 * BANK)) /* Output
47 #define XGPIOPS_INTMASK_OFFSET(BANK) (0x20C + (0x40 * BANK)) /* Interrupt
49 #define XGPIOPS_INTEN_OFFSET(BANK) (0x210 + (0x40 * BANK)) /* Interrupt
52 #define XGPIOPS_INTDIS_OFFSET(BANK) (0x214 + (0x40 * BANK)) /* Interrupt
55 #define XGPIOPS_INTSTS_OFFSET(BANK) (0x218 + (0x40 * BANK)) /* Interrupt
58 #define XGPIOPS_INTTYPE_OFFSET(BANK) (0x21C + (0x40 * BANK)) /* Interrupt
61 #define XGPIOPS_INTPOL_OFFSET(BANK) (0x220 + (0x40 * BANK)) /* Interrupt
64 #define XGPIOPS_INTANY_OFFSET(BANK) (0x224 + (0x40 * BANK)) /* Interrupt on
67 /* Read/Write access to the GPIO PS registers */
68 #define xgpiops_readreg(offset) __raw_readl(offset)
69 #define xgpiops_writereg(val, offset) __raw_writel(val, offset)
71 static unsigned int xgpiops_pin_table
[] = {
79 * struct xgpiops - gpio device private data structure
80 * @chip: instance of the gpio_chip
81 * @base_addr: base address of the GPIO device
82 * @gpio_lock: lock used for synchronization
85 struct gpio_chip chip
;
86 void __iomem
*base_addr
;
87 #ifdef CONFIG_COMMON_CLK
94 * xgpiops_get_bank_pin - Get the bank number and pin number within that bank
95 * for a given pin in the GPIO device
96 * @pin_num: gpio pin number within the device
97 * @bank_num: an output parameter used to return the bank number of the gpio
99 * @bank_pin_num: an output parameter used to return pin number within a bank
100 * for the given gpio pin
102 * Returns the bank number.
104 static inline void xgpiops_get_bank_pin(unsigned int pin_num
,
105 unsigned int *bank_num
,
106 unsigned int *bank_pin_num
)
108 for (*bank_num
= 0; *bank_num
< 4; (*bank_num
)++)
109 if (pin_num
<= xgpiops_pin_table
[*bank_num
])
113 *bank_pin_num
= pin_num
;
115 *bank_pin_num
= pin_num
%
116 (xgpiops_pin_table
[*bank_num
- 1] + 1);
120 * xgpiops_get_value - Get the state of the specified pin of GPIO device
121 * @chip: gpio_chip instance to be worked on
122 * @pin: gpio pin number within the device
124 * This function reads the state of the specified pin of the GPIO device.
125 * It returns 0 if the pin is low, 1 if pin is high.
127 static int xgpiops_get_value(struct gpio_chip
*chip
, unsigned int pin
)
129 unsigned int bank_num
, bank_pin_num
;
130 struct xgpiops
*gpio
= container_of(chip
, struct xgpiops
, chip
);
132 xgpiops_get_bank_pin(pin
, &bank_num
, &bank_pin_num
);
134 return (xgpiops_readreg(gpio
->base_addr
+
135 XGPIOPS_DATA_OFFSET(bank_num
)) >>
140 * xgpiops_set_value - Modify the state of the pin with specified value
141 * @chip: gpio_chip instance to be worked on
142 * @pin: gpio pin number within the device
143 * @state: value used to modify the state of the specified pin
145 * This function calculates the register offset (i.e to lower 16 bits or
146 * upper 16 bits) based on the given pin number and sets the state of a
147 * gpio pin to the specified value. The state is either 0 or non-zero.
149 static void xgpiops_set_value(struct gpio_chip
*chip
, unsigned int pin
,
153 unsigned int reg_offset
;
154 unsigned int bank_num
, bank_pin_num
;
155 struct xgpiops
*gpio
= container_of(chip
, struct xgpiops
, chip
);
157 xgpiops_get_bank_pin(pin
, &bank_num
, &bank_pin_num
);
159 if (bank_pin_num
>= 16) {
160 bank_pin_num
-= 16; /* only 16 data bits in bit maskable reg */
161 reg_offset
= XGPIOPS_DATA_MSW_OFFSET(bank_num
);
163 reg_offset
= XGPIOPS_DATA_LSW_OFFSET(bank_num
);
166 * get the 32 bit value to be written to the mask/data register where
167 * the upper 16 bits is the mask and lower 16 bits is the data
171 state
= ~(1 << (bank_pin_num
+ 16)) & ((state
<< bank_pin_num
) |
174 spin_lock_irqsave(&gpio
->gpio_lock
, flags
);
175 xgpiops_writereg(state
, gpio
->base_addr
+ reg_offset
);
176 spin_unlock_irqrestore(&gpio
->gpio_lock
, flags
);
180 * xgpiops_dir_in - Set the direction of the specified GPIO pin as input
181 * @chip: gpio_chip instance to be worked on
182 * @pin: gpio pin number within the device
184 * This function uses the read-modify-write sequence to set the direction of
185 * the gpio pin as input. Returns 0 always.
187 static int xgpiops_dir_in(struct gpio_chip
*chip
, unsigned int pin
)
189 unsigned int reg
, bank_num
, bank_pin_num
;
190 struct xgpiops
*gpio
= container_of(chip
, struct xgpiops
, chip
);
192 xgpiops_get_bank_pin(pin
, &bank_num
, &bank_pin_num
);
193 /* clear the bit in direction mode reg to set the pin as input */
194 reg
= xgpiops_readreg(gpio
->base_addr
+
195 XGPIOPS_DIRM_OFFSET(bank_num
));
196 reg
&= ~(1 << bank_pin_num
);
197 xgpiops_writereg(reg
,
198 gpio
->base_addr
+ XGPIOPS_DIRM_OFFSET(bank_num
));
204 * xgpiops_dir_out - Set the direction of the specified GPIO pin as output
205 * @chip: gpio_chip instance to be worked on
206 * @pin: gpio pin number within the device
207 * @state: value to be written to specified pin
209 * This function sets the direction of specified GPIO pin as output, configures
210 * the Output Enable register for the pin and uses xgpiops_set to set the state
211 * of the pin to the value specified. Returns 0 always.
213 static int xgpiops_dir_out(struct gpio_chip
*chip
, unsigned int pin
, int state
)
215 struct xgpiops
*gpio
= container_of(chip
, struct xgpiops
, chip
);
216 unsigned int reg
, bank_num
, bank_pin_num
;
218 xgpiops_get_bank_pin(pin
, &bank_num
, &bank_pin_num
);
220 /* set the GPIO pin as output */
221 reg
= xgpiops_readreg(gpio
->base_addr
+
222 XGPIOPS_DIRM_OFFSET(bank_num
));
223 reg
|= 1 << bank_pin_num
;
224 xgpiops_writereg(reg
,
225 gpio
->base_addr
+ XGPIOPS_DIRM_OFFSET(bank_num
));
227 /* configure the output enable reg for the pin */
228 reg
= xgpiops_readreg(gpio
->base_addr
+
229 XGPIOPS_OUTEN_OFFSET(bank_num
));
230 reg
|= 1 << bank_pin_num
;
231 xgpiops_writereg(reg
,
232 gpio
->base_addr
+ XGPIOPS_OUTEN_OFFSET(bank_num
));
234 /* set the state of the pin */
235 xgpiops_set_value(chip
, pin
, state
);
240 * xgpiops_irq_ack - Acknowledge the interrupt of a gpio pin
241 * @irq_data: irq data containing irq number of gpio pin for the interrupt to ack
243 * This function calculates gpio pin number from irq number and sets the bit
244 * in the Interrupt Status Register of the corresponding bank, to ACK the irq.
246 static void xgpiops_irq_ack(struct irq_data
*irq_data
)
248 struct xgpiops
*gpio
= (struct xgpiops
*)irq_data_get_irq_chip_data(irq_data
);
249 unsigned int device_pin_num
, bank_num
, bank_pin_num
;
250 unsigned int irq_sts
;
252 device_pin_num
= irq_to_gpio(irq_data
->irq
); /* get pin num within the device */
253 xgpiops_get_bank_pin(device_pin_num
, &bank_num
, &bank_pin_num
);
254 irq_sts
= xgpiops_readreg(gpio
->base_addr
+
255 XGPIOPS_INTSTS_OFFSET(bank_num
)) |
257 xgpiops_writereg(irq_sts
,
258 gpio
->base_addr
+ (XGPIOPS_INTSTS_OFFSET(bank_num
)));
262 * xgpiops_irq_mask - Disable the interrupts for a gpio pin
263 * @irq: irq number of gpio pin for which interrupt is to be disabled
265 * This function calculates gpio pin number from irq number and sets the
266 * bit in the Interrupt Disable register of the corresponding bank to disable
267 * interrupts for that pin.
269 static void xgpiops_irq_mask(struct irq_data
*irq_data
)
271 struct xgpiops
*gpio
= (struct xgpiops
*)irq_data_get_irq_chip_data(irq_data
);
272 unsigned int device_pin_num
, bank_num
, bank_pin_num
;
273 unsigned int irq_dis
;
275 device_pin_num
= irq_to_gpio(irq_data
->irq
); /* get pin num within the device */
276 xgpiops_get_bank_pin(device_pin_num
, &bank_num
, &bank_pin_num
);
277 irq_dis
= xgpiops_readreg(gpio
->base_addr
+
278 XGPIOPS_INTDIS_OFFSET(bank_num
)) |
280 xgpiops_writereg(irq_dis
,
281 gpio
->base_addr
+ XGPIOPS_INTDIS_OFFSET(bank_num
));
285 * xgpiops_irq_unmask - Enable the interrupts for a gpio pin
286 * @irq_data: irq data containing irq number of gpio pin for the interrupt to enable
288 * This function calculates the gpio pin number from irq number and sets the
289 * bit in the Interrupt Enable register of the corresponding bank to enable
290 * interrupts for that pin.
292 static void xgpiops_irq_unmask(struct irq_data
*irq_data
)
294 struct xgpiops
*gpio
= (struct xgpiops
*)irq_data_get_irq_chip_data(irq_data
);
295 unsigned int device_pin_num
, bank_num
, bank_pin_num
;
298 device_pin_num
= irq_to_gpio(irq_data
->irq
); /* get pin num within the device */
299 xgpiops_get_bank_pin(device_pin_num
, &bank_num
, &bank_pin_num
);
300 irq_en
= xgpiops_readreg(gpio
->base_addr
+
301 XGPIOPS_INTEN_OFFSET(bank_num
)) |
303 xgpiops_writereg(irq_en
,
304 gpio
->base_addr
+ XGPIOPS_INTEN_OFFSET(bank_num
));
308 * xgpiops_set_irq_type - Set the irq type for a gpio pin
309 * @irq_data: irq data containing irq number of gpio pin
310 * @type: interrupt type that is to be set for the gpio pin
312 * This function gets the gpio pin number and its bank from the gpio pin number
313 * and configures the INT_TYPE, INT_POLARITY and INT_ANY registers. Returns 0,
314 * negative error otherwise.
315 * TYPE-EDGE_RISING, INT_TYPE - 1, INT_POLARITY - 1, INT_ANY - 0;
316 * TYPE-EDGE_FALLING, INT_TYPE - 1, INT_POLARITY - 0, INT_ANY - 0;
317 * TYPE-EDGE_BOTH, INT_TYPE - 1, INT_POLARITY - NA, INT_ANY - 1;
318 * TYPE-LEVEL_HIGH, INT_TYPE - 0, INT_POLARITY - 1, INT_ANY - NA;
319 * TYPE-LEVEL_LOW, INT_TYPE - 0, INT_POLARITY - 0, INT_ANY - NA
321 static int xgpiops_set_irq_type(struct irq_data
*irq_data
, unsigned int type
)
323 struct xgpiops
*gpio
= (struct xgpiops
*)irq_data_get_irq_chip_data(irq_data
);
324 unsigned int device_pin_num
, bank_num
, bank_pin_num
;
325 unsigned int int_type
, int_pol
, int_any
;
327 device_pin_num
= irq_to_gpio(irq_data
->irq
); /* get pin num within the device */
328 xgpiops_get_bank_pin(device_pin_num
, &bank_num
, &bank_pin_num
);
330 int_type
= xgpiops_readreg(gpio
->base_addr
+
331 XGPIOPS_INTTYPE_OFFSET(bank_num
));
332 int_pol
= xgpiops_readreg(gpio
->base_addr
+
333 XGPIOPS_INTPOL_OFFSET(bank_num
));
334 int_any
= xgpiops_readreg(gpio
->base_addr
+
335 XGPIOPS_INTANY_OFFSET(bank_num
));
338 * based on the type requested, configure the INT_TYPE, INT_POLARITY
339 * and INT_ANY registers
342 case IRQ_TYPE_EDGE_RISING
:
343 int_type
|= (1 << bank_pin_num
);
344 int_pol
|= (1 << bank_pin_num
);
345 int_any
&= ~(1 << bank_pin_num
);
347 case IRQ_TYPE_EDGE_FALLING
:
348 int_type
|= (1 << bank_pin_num
);
349 int_pol
&= ~(1 << bank_pin_num
);
350 int_any
&= ~(1 << bank_pin_num
);
352 case IRQ_TYPE_EDGE_BOTH
:
353 int_type
|= (1 << bank_pin_num
);
354 int_any
|= (1 << bank_pin_num
);
356 case IRQ_TYPE_LEVEL_HIGH
:
357 int_type
&= ~(1 << bank_pin_num
);
358 int_pol
|= (1 << bank_pin_num
);
360 case IRQ_TYPE_LEVEL_LOW
:
361 int_type
&= ~(1 << bank_pin_num
);
362 int_pol
&= ~(1 << bank_pin_num
);
368 xgpiops_writereg(int_type
,
369 gpio
->base_addr
+ XGPIOPS_INTTYPE_OFFSET(bank_num
));
370 xgpiops_writereg(int_pol
,
371 gpio
->base_addr
+ XGPIOPS_INTPOL_OFFSET(bank_num
));
372 xgpiops_writereg(int_any
,
373 gpio
->base_addr
+ XGPIOPS_INTANY_OFFSET(bank_num
));
377 /* irq chip descriptor */
378 static struct irq_chip xgpiops_irqchip
= {
380 .irq_ack
= xgpiops_irq_ack
,
381 .irq_mask
= xgpiops_irq_mask
,
382 .irq_unmask
= xgpiops_irq_unmask
,
383 .irq_set_type
= xgpiops_set_irq_type
,
387 * xgpiops_irqhandler - IRQ handler for the gpio banks of a gpio device
388 * @irq: irq number of the gpio bank where interrupt has occurred
389 * @desc: irq descriptor instance of the 'irq'
391 * This function reads the Interrupt Status Register of each bank to get the
392 * gpio pin number which has triggered an interrupt. It then acks the triggered
393 * interrupt and calls the pin specific handler set by the higher layer
394 * application for that pin.
395 * Note: A bug is reported if no handler is set for the gpio pin.
397 void xgpiops_irqhandler(unsigned int irq
, struct irq_desc
*desc
)
399 int gpio_irq
= (int)irq_get_handler_data(irq
);
400 struct xgpiops
*gpio
= (struct xgpiops
*)irq_get_chip_data(gpio_irq
);
401 unsigned int int_sts
, int_enb
, bank_num
;
402 struct irq_desc
*gpio_irq_desc
;
403 struct irq_chip
*chip
= irq_desc_get_chip(desc
);
404 struct irq_data
*irq_data
= irq_get_chip_data(irq
);
406 chip
->irq_ack(irq_data
);
407 for (bank_num
= 0; bank_num
< 4; bank_num
++) {
408 int_sts
= xgpiops_readreg(gpio
->base_addr
+
409 XGPIOPS_INTSTS_OFFSET(bank_num
));
410 int_enb
= xgpiops_readreg(gpio
->base_addr
+
411 XGPIOPS_INTMASK_OFFSET(bank_num
));
413 * handle only the interrupts which are enabled in interrupt
417 for (; int_sts
!= 0; int_sts
>>= 1, gpio_irq
++) {
418 if ((int_sts
& 1) == 0)
420 BUG_ON(!(irq_desc
[gpio_irq
].handle_irq
));
421 gpio_irq_desc
= irq_to_desc(gpio_irq
);
422 chip
->irq_ack(irq_data
);
424 /* call the pin specific handler */
425 irq_desc
[gpio_irq
].handle_irq(gpio_irq
,
426 &irq_desc
[gpio_irq
]);
428 /* shift to first virtual irq of next bank */
429 gpio_irq
= (int)irq_get_handler_data(irq
) +
430 (xgpiops_pin_table
[bank_num
] + 1);
432 chip
->irq_unmask(irq_data
);
435 #if defined(CONFIG_PM) && defined(CONFIG_COMMON_CLK)
436 static int xgpiops_suspend(struct device
*_dev
)
438 struct platform_device
*pdev
= container_of(_dev
,
439 struct platform_device
, dev
);
440 struct xgpiops
*gpio
= platform_get_drvdata(pdev
);
442 clk_disable(gpio
->clk
);
446 static int xgpiops_resume(struct device
*_dev
)
448 struct platform_device
*pdev
= container_of(_dev
,
449 struct platform_device
, dev
);
450 struct xgpiops
*gpio
= platform_get_drvdata(pdev
);
452 return clk_enable(gpio
->clk
);
455 #ifdef CONFIG_PM_RUNTIME
456 static int xgpiops_idle(struct device
*dev
)
458 return pm_schedule_suspend(dev
, 1);
461 static int xgpiops_request(struct gpio_chip
*chip
, unsigned offset
)
463 return pm_runtime_get(chip
->dev
);
466 static void xgpiops_free(struct gpio_chip
*chip
, unsigned offset
)
468 pm_runtime_put(chip
->dev
);
471 static UNIVERSAL_DEV_PM_OPS(xgpiops_dev_pm_ops
, xgpiops_suspend
, xgpiops_resume
,
473 #else /* ! CONFIG_PM_RUNTIME */
474 static SIMPLE_DEV_PM_OPS(xgpiops_dev_pm_ops
, xgpiops_suspend
, xgpiops_resume
);
475 #define xgpiops_request NULL
476 #define xgpiops_free NULL
477 #endif /* ! CONFIG_PM_RUNTIME */
479 #define XGPIOPS_PM (&xgpiops_dev_pm_ops)
481 #else /*! CONFIG_PM && ! CONFIG_COMMON_CLK */
482 #define XGPIOPS_PM NULL
483 #define xgpiops_request NULL
484 #define xgpiops_free NULL
485 #endif /*! CONFIG_PM && ! CONFIG_COMMON_CLK */
488 * xgpiops_probe - Initialization method for a xgpiops device
489 * @pdev: platform device instance
491 * This function allocates memory resources for the gpio device and registers
492 * all the banks of the device. It will also set up interrupts for the gpio
494 * Note: Interrupts are disabled for all the banks during initialization.
495 * Returns 0 on success, negative error otherwise.
497 static int __init
xgpiops_probe(struct platform_device
*pdev
)
500 unsigned int irq_num
;
501 struct xgpiops
*gpio
;
502 struct gpio_chip
*chip
;
503 resource_size_t remap_size
;
504 struct resource
*mem_res
= NULL
;
505 int pin_num
, bank_num
, gpio_irq
;
507 gpio
= kzalloc(sizeof(struct xgpiops
), GFP_KERNEL
);
509 dev_err(&pdev
->dev
, "couldn't allocate memory for gpio private "
514 spin_lock_init(&gpio
->gpio_lock
);
516 platform_set_drvdata(pdev
, gpio
);
518 mem_res
= platform_get_resource(pdev
, IORESOURCE_MEM
, 0);
520 dev_err(&pdev
->dev
, "No memory resource\n");
525 remap_size
= mem_res
->end
- mem_res
->start
+ 1;
526 if (!request_mem_region(mem_res
->start
, remap_size
, pdev
->name
)) {
527 dev_err(&pdev
->dev
, "Cannot request IO\n");
532 gpio
->base_addr
= ioremap(mem_res
->start
, remap_size
);
533 if (gpio
->base_addr
== NULL
) {
534 dev_err(&pdev
->dev
, "Couldn't ioremap memory at 0x%08lx\n",
535 (unsigned long)mem_res
->start
);
537 goto err_release_region
;
540 irq_num
= platform_get_irq(pdev
, 0);
542 /* configure the gpio chip */
544 chip
->label
= "xgpiops";
545 chip
->owner
= THIS_MODULE
;
546 chip
->dev
= &pdev
->dev
;
547 chip
->get
= xgpiops_get_value
;
548 chip
->set
= xgpiops_set_value
;
549 chip
->request
= xgpiops_request
;
550 chip
->free
= xgpiops_free
;
551 chip
->direction_input
= xgpiops_dir_in
;
552 chip
->direction_output
= xgpiops_dir_out
;
553 chip
->dbg_show
= NULL
;
554 chip
->base
= 0; /* default pin base */
558 /* report a bug if gpio chip registration fails */
559 ret
= gpiochip_add(chip
);
561 dev_err(&pdev
->dev
, "gpio chip registration failed\n");
564 dev_info(&pdev
->dev
, "gpio at 0x%08lx mapped to 0x%08lx\n",
565 (unsigned long)mem_res
->start
,
566 (unsigned long)gpio
->base_addr
);
569 #ifdef CONFIG_COMMON_CLK
570 /* Enable GPIO clock */
571 gpio
->clk
= clk_get_sys("GPIO_APER", NULL
);
572 if (IS_ERR(gpio
->clk
)) {
573 pr_err("Xilinx GPIOPS clock not found.\n");
574 ret
= PTR_ERR(gpio
->clk
);
575 goto err_chip_remove
;
577 ret
= clk_prepare_enable(gpio
->clk
);
579 pr_err("Xilinx GPIOPS unable to enable clock.\n");
584 /* disable interrupts for all banks */
585 for (bank_num
= 0; bank_num
< 4; bank_num
++) {
586 xgpiops_writereg(0xffffffff, gpio
->base_addr
+
587 XGPIOPS_INTDIS_OFFSET(bank_num
));
591 * set the irq chip, handler and irq chip data for callbacks for
594 gpio_irq
= XGPIOPS_IRQBASE
;
595 for (pin_num
= 0; pin_num
< ARCH_NR_GPIOS
; pin_num
++, gpio_irq
++) {
596 irq_set_chip(gpio_irq
, &xgpiops_irqchip
);
597 irq_set_chip_data(gpio_irq
, (void *)gpio
);
598 irq_set_handler(gpio_irq
, handle_simple_irq
);
599 irq_set_status_flags(gpio_irq
, IRQF_VALID
);
602 irq_set_handler_data(irq_num
, (void *)(XGPIOPS_IRQBASE
));
603 irq_set_chained_handler(irq_num
, xgpiops_irqhandler
);
605 pm_runtime_set_active(&pdev
->dev
);
606 pm_runtime_enable(&pdev
->dev
);
610 #ifdef CONFIG_COMMON_CLK
614 gpiochip_remove(chip
);
617 iounmap(gpio
->base_addr
);
619 release_mem_region(mem_res
->start
, remap_size
);
621 platform_set_drvdata(pdev
, NULL
);
627 static int xgpiops_remove(struct platform_device
*pdev
)
629 #ifdef CONFIG_COMMON_CLK
630 struct xgpiops
*gpio
= platform_get_drvdata(pdev
);
632 clk_disable_unprepare(gpio
->clk
);
639 static struct of_device_id xgpiops_of_match
[] __devinitdata
= {
640 { .compatible
= "xlnx,ps7-gpio-1.00.a", },
641 { /* end of table */}
643 MODULE_DEVICE_TABLE(of
, xgpiops_of_match
);
646 static struct platform_driver xgpiops_driver
= {
649 .owner
= THIS_MODULE
,
652 .of_match_table
= xgpiops_of_match
,
655 .probe
= xgpiops_probe
,
656 .remove
= xgpiops_remove
,
660 * xgpiops_init - Initial driver registration call
662 static int __init
xgpiops_init(void)
664 return platform_driver_register(&xgpiops_driver
);
667 postcore_initcall(xgpiops_init
);