blob: 062a1be7492944a5b97bed2696302ff03df2693e [file] [log] [blame]
Baruch Siach1e9c2852009-06-18 16:48:58 -07001/*
Grant Likelyc103de22011-06-04 18:38:28 -06002 * Copyright (C) 2008, 2009 Provigent Ltd.
Baruch Siach1e9c2852009-06-18 16:48:58 -07003 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * Driver for the ARM PrimeCell(tm) General Purpose Input/Output (PL061)
9 *
10 * Data sheet: ARM DDI 0190B, September 2000
11 */
12#include <linux/spinlock.h>
13#include <linux/errno.h>
14#include <linux/module.h>
Baruch Siach1e9c2852009-06-18 16:48:58 -070015#include <linux/io.h>
16#include <linux/ioport.h>
17#include <linux/irq.h>
Haojian Zhuangf1f70472013-02-17 19:42:49 +080018#include <linux/irqdomain.h>
Catalin Marinasde88cbb2013-01-18 15:31:37 +000019#include <linux/irqchip/chained_irq.h>
Baruch Siach1e9c2852009-06-18 16:48:58 -070020#include <linux/bitops.h>
21#include <linux/workqueue.h>
22#include <linux/gpio.h>
23#include <linux/device.h>
24#include <linux/amba/bus.h>
25#include <linux/amba/pl061.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090026#include <linux/slab.h>
Haojian Zhuang39b70ee2013-02-17 19:42:51 +080027#include <linux/pinctrl/consumer.h>
Deepak Sikrie198a8de2011-11-18 15:20:12 +053028#include <linux/pm.h>
Baruch Siach1e9c2852009-06-18 16:48:58 -070029
30#define GPIODIR 0x400
31#define GPIOIS 0x404
32#define GPIOIBE 0x408
33#define GPIOIEV 0x40C
34#define GPIOIE 0x410
35#define GPIORIS 0x414
36#define GPIOMIS 0x418
37#define GPIOIC 0x41C
38
39#define PL061_GPIO_NR 8
40
Deepak Sikrie198a8de2011-11-18 15:20:12 +053041#ifdef CONFIG_PM
42struct pl061_context_save_regs {
43 u8 gpio_data;
44 u8 gpio_dir;
45 u8 gpio_is;
46 u8 gpio_ibe;
47 u8 gpio_iev;
48 u8 gpio_ie;
49};
50#endif
Baruch Siach1e9c2852009-06-18 16:48:58 -070051
Baruch Siach1e9c2852009-06-18 16:48:58 -070052struct pl061_gpio {
Baruch Siach835c1922012-11-22 11:46:14 +020053 spinlock_t lock;
Baruch Siach1e9c2852009-06-18 16:48:58 -070054
55 void __iomem *base;
Haojian Zhuangf1f70472013-02-17 19:42:49 +080056 struct irq_domain *domain;
Baruch Siach1e9c2852009-06-18 16:48:58 -070057 struct gpio_chip gc;
Deepak Sikrie198a8de2011-11-18 15:20:12 +053058
59#ifdef CONFIG_PM
60 struct pl061_context_save_regs csave_regs;
61#endif
Baruch Siach1e9c2852009-06-18 16:48:58 -070062};
63
Haojian Zhuang39b70ee2013-02-17 19:42:51 +080064static int pl061_gpio_request(struct gpio_chip *chip, unsigned offset)
65{
66 /*
67 * Map back to global GPIO space and request muxing, the direction
68 * parameter does not matter for this controller.
69 */
70 int gpio = chip->base + offset;
71
72 return pinctrl_request_gpio(gpio);
73}
74
Axel Lin22ce4462013-03-15 20:52:07 +080075static void pl061_gpio_free(struct gpio_chip *chip, unsigned offset)
76{
77 int gpio = chip->base + offset;
78
79 pinctrl_free_gpio(gpio);
80}
81
Baruch Siach1e9c2852009-06-18 16:48:58 -070082static int pl061_direction_input(struct gpio_chip *gc, unsigned offset)
83{
84 struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc);
85 unsigned long flags;
86 unsigned char gpiodir;
87
88 if (offset >= gc->ngpio)
89 return -EINVAL;
90
91 spin_lock_irqsave(&chip->lock, flags);
92 gpiodir = readb(chip->base + GPIODIR);
93 gpiodir &= ~(1 << offset);
94 writeb(gpiodir, chip->base + GPIODIR);
95 spin_unlock_irqrestore(&chip->lock, flags);
96
97 return 0;
98}
99
100static int pl061_direction_output(struct gpio_chip *gc, unsigned offset,
101 int value)
102{
103 struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc);
104 unsigned long flags;
105 unsigned char gpiodir;
106
107 if (offset >= gc->ngpio)
108 return -EINVAL;
109
110 spin_lock_irqsave(&chip->lock, flags);
111 writeb(!!value << offset, chip->base + (1 << (offset + 2)));
112 gpiodir = readb(chip->base + GPIODIR);
113 gpiodir |= 1 << offset;
114 writeb(gpiodir, chip->base + GPIODIR);
viresh kumar64b997c52010-04-21 09:42:05 +0100115
116 /*
117 * gpio value is set again, because pl061 doesn't allow to set value of
118 * a gpio pin before configuring it in OUT mode.
119 */
120 writeb(!!value << offset, chip->base + (1 << (offset + 2)));
Baruch Siach1e9c2852009-06-18 16:48:58 -0700121 spin_unlock_irqrestore(&chip->lock, flags);
122
123 return 0;
124}
125
126static int pl061_get_value(struct gpio_chip *gc, unsigned offset)
127{
128 struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc);
129
130 return !!readb(chip->base + (1 << (offset + 2)));
131}
132
133static void pl061_set_value(struct gpio_chip *gc, unsigned offset, int value)
134{
135 struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc);
136
137 writeb(!!value << offset, chip->base + (1 << (offset + 2)));
138}
139
Baruch Siach50efacf2009-06-30 11:41:39 -0700140static int pl061_to_irq(struct gpio_chip *gc, unsigned offset)
141{
142 struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc);
143
Haojian Zhuangf1f70472013-02-17 19:42:49 +0800144 return irq_create_mapping(chip->domain, offset);
Baruch Siach50efacf2009-06-30 11:41:39 -0700145}
146
Lennert Buytenhekb2221862011-01-12 17:00:16 -0800147static int pl061_irq_type(struct irq_data *d, unsigned trigger)
Baruch Siach1e9c2852009-06-18 16:48:58 -0700148{
Haojian Zhuangf1f70472013-02-17 19:42:49 +0800149 struct pl061_gpio *chip = irq_data_get_irq_chip_data(d);
150 int offset = irqd_to_hwirq(d);
Baruch Siach1e9c2852009-06-18 16:48:58 -0700151 unsigned long flags;
152 u8 gpiois, gpioibe, gpioiev;
Linus Walleij438a2c92013-11-26 12:59:51 +0100153 u8 bit = BIT(offset);
Baruch Siach1e9c2852009-06-18 16:48:58 -0700154
Axel Linc1cc9b92010-05-26 14:42:19 -0700155 if (offset < 0 || offset >= PL061_GPIO_NR)
Baruch Siach1e9c2852009-06-18 16:48:58 -0700156 return -EINVAL;
157
Haojian Zhuangf1f70472013-02-17 19:42:49 +0800158 spin_lock_irqsave(&chip->lock, flags);
Baruch Siach1e9c2852009-06-18 16:48:58 -0700159
160 gpioiev = readb(chip->base + GPIOIEV);
Baruch Siach1e9c2852009-06-18 16:48:58 -0700161 gpiois = readb(chip->base + GPIOIS);
Baruch Siach1e9c2852009-06-18 16:48:58 -0700162 gpioibe = readb(chip->base + GPIOIBE);
Baruch Siach1e9c2852009-06-18 16:48:58 -0700163
Linus Walleij438a2c92013-11-26 12:59:51 +0100164 if (trigger & (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) {
165 gpiois |= bit;
166 if (trigger & IRQ_TYPE_LEVEL_HIGH)
167 gpioiev |= bit;
168 else
169 gpioiev &= ~bit;
170 } else
171 gpiois &= ~bit;
172
173 if ((trigger & IRQ_TYPE_EDGE_BOTH) == IRQ_TYPE_EDGE_BOTH)
174 /* Setting this makes GPIOEV be ignored */
175 gpioibe |= bit;
176 else {
177 gpioibe &= ~bit;
178 if (trigger & IRQ_TYPE_EDGE_RISING)
179 gpioiev |= bit;
180 else if (trigger & IRQ_TYPE_EDGE_FALLING)
181 gpioiev &= ~bit;
182 }
183
184 writeb(gpiois, chip->base + GPIOIS);
185 writeb(gpioibe, chip->base + GPIOIBE);
Baruch Siach1e9c2852009-06-18 16:48:58 -0700186 writeb(gpioiev, chip->base + GPIOIEV);
187
Haojian Zhuangf1f70472013-02-17 19:42:49 +0800188 spin_unlock_irqrestore(&chip->lock, flags);
Baruch Siach1e9c2852009-06-18 16:48:58 -0700189
190 return 0;
191}
192
Baruch Siach1e9c2852009-06-18 16:48:58 -0700193static void pl061_irq_handler(unsigned irq, struct irq_desc *desc)
194{
Rob Herring2de0dbc2012-01-04 10:36:07 -0600195 unsigned long pending;
196 int offset;
197 struct pl061_gpio *chip = irq_desc_get_handler_data(desc);
Rob Herringdece9042011-12-09 14:12:53 -0600198 struct irq_chip *irqchip = irq_desc_get_chip(desc);
Baruch Siach1e9c2852009-06-18 16:48:58 -0700199
Rob Herringdece9042011-12-09 14:12:53 -0600200 chained_irq_enter(irqchip, desc);
Baruch Siach1e9c2852009-06-18 16:48:58 -0700201
Rob Herring2de0dbc2012-01-04 10:36:07 -0600202 pending = readb(chip->base + GPIOMIS);
203 writeb(pending, chip->base + GPIOIC);
204 if (pending) {
Akinobu Mita984b3f52010-03-05 13:41:37 -0800205 for_each_set_bit(offset, &pending, PL061_GPIO_NR)
Baruch Siach50efacf2009-06-30 11:41:39 -0700206 generic_handle_irq(pl061_to_irq(&chip->gc, offset));
Baruch Siach1e9c2852009-06-18 16:48:58 -0700207 }
Rob Herring2de0dbc2012-01-04 10:36:07 -0600208
Rob Herringdece9042011-12-09 14:12:53 -0600209 chained_irq_exit(irqchip, desc);
Baruch Siach1e9c2852009-06-18 16:48:58 -0700210}
211
Haojian Zhuangf1f70472013-02-17 19:42:49 +0800212static void pl061_irq_mask(struct irq_data *d)
Rob Herring3ab52472011-10-21 08:05:53 -0500213{
Haojian Zhuangf1f70472013-02-17 19:42:49 +0800214 struct pl061_gpio *chip = irq_data_get_irq_chip_data(d);
215 u8 mask = 1 << (irqd_to_hwirq(d) % PL061_GPIO_NR);
216 u8 gpioie;
Rob Herring3ab52472011-10-21 08:05:53 -0500217
Haojian Zhuangf1f70472013-02-17 19:42:49 +0800218 spin_lock(&chip->lock);
219 gpioie = readb(chip->base + GPIOIE) & ~mask;
220 writeb(gpioie, chip->base + GPIOIE);
221 spin_unlock(&chip->lock);
Baruch Siach1e9c2852009-06-18 16:48:58 -0700222}
223
Haojian Zhuangf1f70472013-02-17 19:42:49 +0800224static void pl061_irq_unmask(struct irq_data *d)
225{
226 struct pl061_gpio *chip = irq_data_get_irq_chip_data(d);
227 u8 mask = 1 << (irqd_to_hwirq(d) % PL061_GPIO_NR);
228 u8 gpioie;
229
230 spin_lock(&chip->lock);
231 gpioie = readb(chip->base + GPIOIE) | mask;
232 writeb(gpioie, chip->base + GPIOIE);
233 spin_unlock(&chip->lock);
234}
235
Linus Walleijf6f29312013-11-26 12:33:41 +0100236static unsigned int pl061_irq_startup(struct irq_data *d)
237{
238 struct pl061_gpio *chip = irq_data_get_irq_chip_data(d);
239
240 if (gpio_lock_as_irq(&chip->gc, irqd_to_hwirq(d)))
241 dev_err(chip->gc.dev,
242 "unable to lock HW IRQ %lu for IRQ\n",
243 irqd_to_hwirq(d));
244 pl061_irq_unmask(d);
245 return 0;
246}
247
248static void pl061_irq_shutdown(struct irq_data *d)
249{
250 struct pl061_gpio *chip = irq_data_get_irq_chip_data(d);
251
252 pl061_irq_mask(d);
253 gpio_unlock_as_irq(&chip->gc, irqd_to_hwirq(d));
254}
255
Haojian Zhuangf1f70472013-02-17 19:42:49 +0800256static struct irq_chip pl061_irqchip = {
Linus Walleij9ae7e9e2013-11-26 14:19:44 +0100257 .name = "pl061",
Haojian Zhuangf1f70472013-02-17 19:42:49 +0800258 .irq_mask = pl061_irq_mask,
259 .irq_unmask = pl061_irq_unmask,
260 .irq_set_type = pl061_irq_type,
Linus Walleijf6f29312013-11-26 12:33:41 +0100261 .irq_startup = pl061_irq_startup,
262 .irq_shutdown = pl061_irq_shutdown,
Haojian Zhuangf1f70472013-02-17 19:42:49 +0800263};
264
Linus Walleijf8f669f2013-10-11 19:40:16 +0200265static int pl061_irq_map(struct irq_domain *d, unsigned int irq,
266 irq_hw_number_t hwirq)
Haojian Zhuangf1f70472013-02-17 19:42:49 +0800267{
268 struct pl061_gpio *chip = d->host_data;
269
Linus Walleij9ae7e9e2013-11-26 14:19:44 +0100270 irq_set_chip_and_handler(irq, &pl061_irqchip, handle_simple_irq);
Linus Walleijf8f669f2013-10-11 19:40:16 +0200271 irq_set_chip_data(irq, chip);
272 irq_set_irq_type(irq, IRQ_TYPE_NONE);
Haojian Zhuangf1f70472013-02-17 19:42:49 +0800273
274 return 0;
275}
276
277static const struct irq_domain_ops pl061_domain_ops = {
278 .map = pl061_irq_map,
279 .xlate = irq_domain_xlate_twocell,
280};
281
Tobias Klauser8944df72012-10-05 11:45:28 +0200282static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
Baruch Siach1e9c2852009-06-18 16:48:58 -0700283{
Tobias Klauser8944df72012-10-05 11:45:28 +0200284 struct device *dev = &adev->dev;
Jingoo Hane56aee12013-07-30 17:08:05 +0900285 struct pl061_platform_data *pdata = dev_get_platdata(dev);
Baruch Siach1e9c2852009-06-18 16:48:58 -0700286 struct pl061_gpio *chip;
Haojian Zhuangf1f70472013-02-17 19:42:49 +0800287 int ret, irq, i, irq_base;
Baruch Siach1e9c2852009-06-18 16:48:58 -0700288
Tobias Klauser8944df72012-10-05 11:45:28 +0200289 chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
Baruch Siach1e9c2852009-06-18 16:48:58 -0700290 if (chip == NULL)
291 return -ENOMEM;
292
Rob Herring76c05c82011-08-10 16:31:46 -0500293 if (pdata) {
294 chip->gc.base = pdata->gpio_base;
Haojian Zhuangf1f70472013-02-17 19:42:49 +0800295 irq_base = pdata->irq_base;
Linus Walleij78087552013-11-22 10:11:49 +0100296 if (irq_base <= 0) {
297 dev_err(&adev->dev, "invalid IRQ base in pdata\n");
Haojian Zhuangf1f70472013-02-17 19:42:49 +0800298 return -ENODEV;
Linus Walleij78087552013-11-22 10:11:49 +0100299 }
Haojian Zhuangf1f70472013-02-17 19:42:49 +0800300 } else {
Rob Herring76c05c82011-08-10 16:31:46 -0500301 chip->gc.base = -1;
Haojian Zhuangf1f70472013-02-17 19:42:49 +0800302 irq_base = 0;
303 }
Rob Herring76c05c82011-08-10 16:31:46 -0500304
Tobias Klauser8944df72012-10-05 11:45:28 +0200305 if (!devm_request_mem_region(dev, adev->res.start,
Linus Walleij78087552013-11-22 10:11:49 +0100306 resource_size(&adev->res), "pl061")) {
307 dev_err(&adev->dev, "no memory region\n");
Tobias Klauser8944df72012-10-05 11:45:28 +0200308 return -EBUSY;
Linus Walleij78087552013-11-22 10:11:49 +0100309 }
Baruch Siach1e9c2852009-06-18 16:48:58 -0700310
Tobias Klauser8944df72012-10-05 11:45:28 +0200311 chip->base = devm_ioremap(dev, adev->res.start,
Haojian Zhuangf1f70472013-02-17 19:42:49 +0800312 resource_size(&adev->res));
Linus Walleij78087552013-11-22 10:11:49 +0100313 if (!chip->base) {
314 dev_err(&adev->dev, "could not remap memory\n");
Tobias Klauser8944df72012-10-05 11:45:28 +0200315 return -ENOMEM;
Linus Walleij78087552013-11-22 10:11:49 +0100316 }
Baruch Siach1e9c2852009-06-18 16:48:58 -0700317
318 spin_lock_init(&chip->lock);
Baruch Siach1e9c2852009-06-18 16:48:58 -0700319
Haojian Zhuang39b70ee2013-02-17 19:42:51 +0800320 chip->gc.request = pl061_gpio_request;
Axel Lin22ce4462013-03-15 20:52:07 +0800321 chip->gc.free = pl061_gpio_free;
Baruch Siach1e9c2852009-06-18 16:48:58 -0700322 chip->gc.direction_input = pl061_direction_input;
323 chip->gc.direction_output = pl061_direction_output;
324 chip->gc.get = pl061_get_value;
325 chip->gc.set = pl061_set_value;
Baruch Siach50efacf2009-06-30 11:41:39 -0700326 chip->gc.to_irq = pl061_to_irq;
Baruch Siach1e9c2852009-06-18 16:48:58 -0700327 chip->gc.ngpio = PL061_GPIO_NR;
Tobias Klauser8944df72012-10-05 11:45:28 +0200328 chip->gc.label = dev_name(dev);
329 chip->gc.dev = dev;
Baruch Siach1e9c2852009-06-18 16:48:58 -0700330 chip->gc.owner = THIS_MODULE;
331
Baruch Siach1e9c2852009-06-18 16:48:58 -0700332 ret = gpiochip_add(&chip->gc);
333 if (ret)
Tobias Klauser8944df72012-10-05 11:45:28 +0200334 return ret;
Baruch Siach1e9c2852009-06-18 16:48:58 -0700335
336 /*
337 * irq_chip support
338 */
Baruch Siach1e9c2852009-06-18 16:48:58 -0700339 writeb(0, chip->base + GPIOIE); /* disable irqs */
Tobias Klauser8944df72012-10-05 11:45:28 +0200340 irq = adev->irq[0];
Linus Walleij78087552013-11-22 10:11:49 +0100341 if (irq < 0) {
342 dev_err(&adev->dev, "invalid IRQ\n");
Tobias Klauser8944df72012-10-05 11:45:28 +0200343 return -ENODEV;
Linus Walleij78087552013-11-22 10:11:49 +0100344 }
Tobias Klauser8944df72012-10-05 11:45:28 +0200345
Thomas Gleixnerb51804b2011-03-24 21:27:36 +0000346 irq_set_chained_handler(irq, pl061_irq_handler);
Rob Herring2de0dbc2012-01-04 10:36:07 -0600347 irq_set_handler_data(irq, chip);
Baruch Siach1e9c2852009-06-18 16:48:58 -0700348
Linus Walleij2ba31542013-11-27 08:47:02 +0100349 chip->domain = irq_domain_add_simple(adev->dev.of_node, PL061_GPIO_NR,
350 irq_base, &pl061_domain_ops, chip);
Linus Walleij78087552013-11-22 10:11:49 +0100351 if (!chip->domain) {
352 dev_err(&adev->dev, "no irq domain\n");
Linus Walleij2ba31542013-11-27 08:47:02 +0100353 return -ENODEV;
Linus Walleij78087552013-11-22 10:11:49 +0100354 }
Linus Walleij2ba31542013-11-27 08:47:02 +0100355
Baruch Siach1e9c2852009-06-18 16:48:58 -0700356 for (i = 0; i < PL061_GPIO_NR; i++) {
Rob Herring76c05c82011-08-10 16:31:46 -0500357 if (pdata) {
358 if (pdata->directions & (1 << i))
359 pl061_direction_output(&chip->gc, i,
360 pdata->values & (1 << i));
361 else
362 pl061_direction_input(&chip->gc, i);
363 }
Baruch Siach1e9c2852009-06-18 16:48:58 -0700364 }
365
Tobias Klauser8944df72012-10-05 11:45:28 +0200366 amba_set_drvdata(adev, chip);
Linus Walleij78087552013-11-22 10:11:49 +0100367 dev_info(&adev->dev, "PL061 GPIO chip @%08x registered\n",
368 adev->res.start);
Deepak Sikrie198a8de2011-11-18 15:20:12 +0530369
Baruch Siach1e9c2852009-06-18 16:48:58 -0700370 return 0;
Baruch Siach1e9c2852009-06-18 16:48:58 -0700371}
372
Deepak Sikrie198a8de2011-11-18 15:20:12 +0530373#ifdef CONFIG_PM
374static int pl061_suspend(struct device *dev)
375{
376 struct pl061_gpio *chip = dev_get_drvdata(dev);
377 int offset;
378
379 chip->csave_regs.gpio_data = 0;
380 chip->csave_regs.gpio_dir = readb(chip->base + GPIODIR);
381 chip->csave_regs.gpio_is = readb(chip->base + GPIOIS);
382 chip->csave_regs.gpio_ibe = readb(chip->base + GPIOIBE);
383 chip->csave_regs.gpio_iev = readb(chip->base + GPIOIEV);
384 chip->csave_regs.gpio_ie = readb(chip->base + GPIOIE);
385
386 for (offset = 0; offset < PL061_GPIO_NR; offset++) {
387 if (chip->csave_regs.gpio_dir & (1 << offset))
388 chip->csave_regs.gpio_data |=
389 pl061_get_value(&chip->gc, offset) << offset;
390 }
391
392 return 0;
393}
394
395static int pl061_resume(struct device *dev)
396{
397 struct pl061_gpio *chip = dev_get_drvdata(dev);
398 int offset;
399
400 for (offset = 0; offset < PL061_GPIO_NR; offset++) {
401 if (chip->csave_regs.gpio_dir & (1 << offset))
402 pl061_direction_output(&chip->gc, offset,
403 chip->csave_regs.gpio_data &
404 (1 << offset));
405 else
406 pl061_direction_input(&chip->gc, offset);
407 }
408
409 writeb(chip->csave_regs.gpio_is, chip->base + GPIOIS);
410 writeb(chip->csave_regs.gpio_ibe, chip->base + GPIOIBE);
411 writeb(chip->csave_regs.gpio_iev, chip->base + GPIOIEV);
412 writeb(chip->csave_regs.gpio_ie, chip->base + GPIOIE);
413
414 return 0;
415}
416
Viresh Kumar6e33ace2012-01-11 15:25:20 +0530417static const struct dev_pm_ops pl061_dev_pm_ops = {
418 .suspend = pl061_suspend,
419 .resume = pl061_resume,
420 .freeze = pl061_suspend,
421 .restore = pl061_resume,
422};
Deepak Sikrie198a8de2011-11-18 15:20:12 +0530423#endif
424
Russell King2c39c9e2010-07-27 08:50:16 +0100425static struct amba_id pl061_ids[] = {
Baruch Siach1e9c2852009-06-18 16:48:58 -0700426 {
427 .id = 0x00041061,
428 .mask = 0x000fffff,
429 },
430 { 0, 0 },
431};
432
Dave Martin955b6782011-10-05 15:15:21 +0100433MODULE_DEVICE_TABLE(amba, pl061_ids);
434
Baruch Siach1e9c2852009-06-18 16:48:58 -0700435static struct amba_driver pl061_gpio_driver = {
436 .drv = {
437 .name = "pl061_gpio",
Deepak Sikrie198a8de2011-11-18 15:20:12 +0530438#ifdef CONFIG_PM
439 .pm = &pl061_dev_pm_ops,
440#endif
Baruch Siach1e9c2852009-06-18 16:48:58 -0700441 },
442 .id_table = pl061_ids,
443 .probe = pl061_probe,
444};
445
446static int __init pl061_gpio_init(void)
447{
448 return amba_driver_register(&pl061_gpio_driver);
449}
Haojian Zhuang5985d762013-01-18 15:31:13 +0800450module_init(pl061_gpio_init);
Baruch Siach1e9c2852009-06-18 16:48:58 -0700451
452MODULE_AUTHOR("Baruch Siach <baruch@tkos.co.il>");
453MODULE_DESCRIPTION("PL061 GPIO driver");
454MODULE_LICENSE("GPL");