s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 1 | /* |
| 2 | * MPC52xx gpio driver |
| 3 | * |
| 4 | * Copyright (c) 2008 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 |
| 8 | * as published by the Free Software Foundation. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 18 | */ |
| 19 | |
| 20 | #include <linux/of.h> |
| 21 | #include <linux/kernel.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 22 | #include <linux/slab.h> |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 23 | #include <linux/of_gpio.h> |
| 24 | #include <linux/io.h> |
| 25 | #include <linux/of_platform.h> |
Paul Gortmaker | bb207ef | 2011-07-03 13:38:09 -0400 | [diff] [blame] | 26 | #include <linux/module.h> |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 27 | |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 28 | #include <asm/mpc52xx.h> |
| 29 | #include <sysdev/fsl_soc.h> |
| 30 | |
| 31 | static DEFINE_SPINLOCK(gpio_lock); |
| 32 | |
| 33 | struct mpc52xx_gpiochip { |
| 34 | struct of_mm_gpio_chip mmchip; |
| 35 | unsigned int shadow_dvo; |
| 36 | unsigned int shadow_gpioe; |
| 37 | unsigned int shadow_ddr; |
| 38 | }; |
| 39 | |
| 40 | /* |
| 41 | * GPIO LIB API implementation for wakeup GPIOs. |
| 42 | * |
| 43 | * There's a maximum of 8 wakeup GPIOs. Which of these are available |
| 44 | * for use depends on your board setup. |
| 45 | * |
| 46 | * 0 -> GPIO_WKUP_7 |
| 47 | * 1 -> GPIO_WKUP_6 |
| 48 | * 2 -> PSC6_1 |
| 49 | * 3 -> PSC6_0 |
| 50 | * 4 -> ETH_17 |
| 51 | * 5 -> PSC3_9 |
| 52 | * 6 -> PSC2_4 |
| 53 | * 7 -> PSC1_4 |
| 54 | * |
| 55 | */ |
| 56 | static int mpc52xx_wkup_gpio_get(struct gpio_chip *gc, unsigned int gpio) |
| 57 | { |
| 58 | struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); |
| 59 | struct mpc52xx_gpio_wkup __iomem *regs = mm_gc->regs; |
| 60 | unsigned int ret; |
| 61 | |
| 62 | ret = (in_8(®s->wkup_ival) >> (7 - gpio)) & 1; |
| 63 | |
| 64 | pr_debug("%s: gpio: %d ret: %d\n", __func__, gpio, ret); |
| 65 | |
| 66 | return ret; |
| 67 | } |
| 68 | |
| 69 | static inline void |
| 70 | __mpc52xx_wkup_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) |
| 71 | { |
| 72 | struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); |
Linus Walleij | 837c270 | 2015-12-07 10:25:36 +0100 | [diff] [blame] | 73 | struct mpc52xx_gpiochip *chip = gpiochip_get_data(gc); |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 74 | struct mpc52xx_gpio_wkup __iomem *regs = mm_gc->regs; |
| 75 | |
| 76 | if (val) |
| 77 | chip->shadow_dvo |= 1 << (7 - gpio); |
| 78 | else |
| 79 | chip->shadow_dvo &= ~(1 << (7 - gpio)); |
| 80 | |
| 81 | out_8(®s->wkup_dvo, chip->shadow_dvo); |
| 82 | } |
| 83 | |
| 84 | static void |
| 85 | mpc52xx_wkup_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) |
| 86 | { |
| 87 | unsigned long flags; |
| 88 | |
| 89 | spin_lock_irqsave(&gpio_lock, flags); |
| 90 | |
| 91 | __mpc52xx_wkup_gpio_set(gc, gpio, val); |
| 92 | |
| 93 | spin_unlock_irqrestore(&gpio_lock, flags); |
| 94 | |
| 95 | pr_debug("%s: gpio: %d val: %d\n", __func__, gpio, val); |
| 96 | } |
| 97 | |
| 98 | static int mpc52xx_wkup_gpio_dir_in(struct gpio_chip *gc, unsigned int gpio) |
| 99 | { |
| 100 | struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); |
Linus Walleij | 837c270 | 2015-12-07 10:25:36 +0100 | [diff] [blame] | 101 | struct mpc52xx_gpiochip *chip = gpiochip_get_data(gc); |
Al Viro | 9307245 | 2008-06-02 10:59:02 +0100 | [diff] [blame] | 102 | struct mpc52xx_gpio_wkup __iomem *regs = mm_gc->regs; |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 103 | unsigned long flags; |
| 104 | |
| 105 | spin_lock_irqsave(&gpio_lock, flags); |
| 106 | |
| 107 | /* set the direction */ |
| 108 | chip->shadow_ddr &= ~(1 << (7 - gpio)); |
| 109 | out_8(®s->wkup_ddr, chip->shadow_ddr); |
| 110 | |
| 111 | /* and enable the pin */ |
| 112 | chip->shadow_gpioe |= 1 << (7 - gpio); |
| 113 | out_8(®s->wkup_gpioe, chip->shadow_gpioe); |
| 114 | |
| 115 | spin_unlock_irqrestore(&gpio_lock, flags); |
| 116 | |
| 117 | return 0; |
| 118 | } |
| 119 | |
| 120 | static int |
| 121 | mpc52xx_wkup_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) |
| 122 | { |
| 123 | struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); |
Al Viro | 9307245 | 2008-06-02 10:59:02 +0100 | [diff] [blame] | 124 | struct mpc52xx_gpio_wkup __iomem *regs = mm_gc->regs; |
Linus Walleij | 837c270 | 2015-12-07 10:25:36 +0100 | [diff] [blame] | 125 | struct mpc52xx_gpiochip *chip = gpiochip_get_data(gc); |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 126 | unsigned long flags; |
| 127 | |
| 128 | spin_lock_irqsave(&gpio_lock, flags); |
| 129 | |
| 130 | __mpc52xx_wkup_gpio_set(gc, gpio, val); |
| 131 | |
| 132 | /* Then set direction */ |
| 133 | chip->shadow_ddr |= 1 << (7 - gpio); |
| 134 | out_8(®s->wkup_ddr, chip->shadow_ddr); |
| 135 | |
| 136 | /* Finally enable the pin */ |
| 137 | chip->shadow_gpioe |= 1 << (7 - gpio); |
| 138 | out_8(®s->wkup_gpioe, chip->shadow_gpioe); |
| 139 | |
| 140 | spin_unlock_irqrestore(&gpio_lock, flags); |
| 141 | |
| 142 | pr_debug("%s: gpio: %d val: %d\n", __func__, gpio, val); |
| 143 | |
| 144 | return 0; |
| 145 | } |
| 146 | |
Bill Pemberton | 3836309 | 2012-11-19 13:22:34 -0500 | [diff] [blame] | 147 | static int mpc52xx_wkup_gpiochip_probe(struct platform_device *ofdev) |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 148 | { |
| 149 | struct mpc52xx_gpiochip *chip; |
Al Viro | 9307245 | 2008-06-02 10:59:02 +0100 | [diff] [blame] | 150 | struct mpc52xx_gpio_wkup __iomem *regs; |
Anton Vorontsov | a19e3da | 2010-06-08 07:48:16 -0600 | [diff] [blame] | 151 | struct gpio_chip *gc; |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 152 | int ret; |
| 153 | |
Ricardo Ribalda Delgado | f91b2db | 2015-01-18 12:39:26 +0100 | [diff] [blame] | 154 | chip = devm_kzalloc(&ofdev->dev, sizeof(*chip), GFP_KERNEL); |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 155 | if (!chip) |
| 156 | return -ENOMEM; |
| 157 | |
Ricardo Ribalda Delgado | f91b2db | 2015-01-18 12:39:26 +0100 | [diff] [blame] | 158 | platform_set_drvdata(ofdev, chip); |
| 159 | |
Anton Vorontsov | a19e3da | 2010-06-08 07:48:16 -0600 | [diff] [blame] | 160 | gc = &chip->mmchip.gc; |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 161 | |
Anton Vorontsov | a19e3da | 2010-06-08 07:48:16 -0600 | [diff] [blame] | 162 | gc->ngpio = 8; |
| 163 | gc->direction_input = mpc52xx_wkup_gpio_dir_in; |
| 164 | gc->direction_output = mpc52xx_wkup_gpio_dir_out; |
| 165 | gc->get = mpc52xx_wkup_gpio_get; |
| 166 | gc->set = mpc52xx_wkup_gpio_set; |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 167 | |
Linus Walleij | 837c270 | 2015-12-07 10:25:36 +0100 | [diff] [blame] | 168 | ret = of_mm_gpiochip_add_data(ofdev->dev.of_node, &chip->mmchip, chip); |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 169 | if (ret) |
| 170 | return ret; |
| 171 | |
| 172 | regs = chip->mmchip.regs; |
| 173 | chip->shadow_gpioe = in_8(®s->wkup_gpioe); |
| 174 | chip->shadow_ddr = in_8(®s->wkup_ddr); |
| 175 | chip->shadow_dvo = in_8(®s->wkup_dvo); |
| 176 | |
| 177 | return 0; |
| 178 | } |
| 179 | |
Grant Likely | a454dc5 | 2010-07-22 15:52:34 -0600 | [diff] [blame] | 180 | static int mpc52xx_gpiochip_remove(struct platform_device *ofdev) |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 181 | { |
Ricardo Ribalda Delgado | f91b2db | 2015-01-18 12:39:26 +0100 | [diff] [blame] | 182 | struct mpc52xx_gpiochip *chip = platform_get_drvdata(ofdev); |
| 183 | |
| 184 | of_mm_gpiochip_remove(&chip->mmchip); |
| 185 | |
| 186 | return 0; |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 187 | } |
| 188 | |
| 189 | static const struct of_device_id mpc52xx_wkup_gpiochip_match[] = { |
Grant Likely | 6eae1ac | 2011-07-06 11:54:19 -0600 | [diff] [blame] | 190 | { .compatible = "fsl,mpc5200-gpio-wkup", }, |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 191 | {} |
| 192 | }; |
| 193 | |
Grant Likely | 0000612 | 2011-02-22 19:59:54 -0700 | [diff] [blame] | 194 | static struct platform_driver mpc52xx_wkup_gpiochip_driver = { |
Grant Likely | 4018294 | 2010-04-13 16:13:02 -0700 | [diff] [blame] | 195 | .driver = { |
Grant Likely | 6eae1ac | 2011-07-06 11:54:19 -0600 | [diff] [blame] | 196 | .name = "mpc5200-gpio-wkup", |
Grant Likely | 4018294 | 2010-04-13 16:13:02 -0700 | [diff] [blame] | 197 | .of_match_table = mpc52xx_wkup_gpiochip_match, |
| 198 | }, |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 199 | .probe = mpc52xx_wkup_gpiochip_probe, |
| 200 | .remove = mpc52xx_gpiochip_remove, |
| 201 | }; |
| 202 | |
| 203 | /* |
| 204 | * GPIO LIB API implementation for simple GPIOs |
| 205 | * |
| 206 | * There's a maximum of 32 simple GPIOs. Which of these are available |
| 207 | * for use depends on your board setup. |
| 208 | * The numbering reflects the bit numbering in the port registers: |
| 209 | * |
| 210 | * 0..1 > reserved |
| 211 | * 2..3 > IRDA |
| 212 | * 4..7 > ETHR |
| 213 | * 8..11 > reserved |
| 214 | * 12..15 > USB |
| 215 | * 16..17 > reserved |
| 216 | * 18..23 > PSC3 |
| 217 | * 24..27 > PSC2 |
| 218 | * 28..31 > PSC1 |
| 219 | */ |
| 220 | static int mpc52xx_simple_gpio_get(struct gpio_chip *gc, unsigned int gpio) |
| 221 | { |
| 222 | struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); |
| 223 | struct mpc52xx_gpio __iomem *regs = mm_gc->regs; |
| 224 | unsigned int ret; |
| 225 | |
| 226 | ret = (in_be32(®s->simple_ival) >> (31 - gpio)) & 1; |
| 227 | |
| 228 | return ret; |
| 229 | } |
| 230 | |
| 231 | static inline void |
| 232 | __mpc52xx_simple_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) |
| 233 | { |
| 234 | struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); |
Linus Walleij | 837c270 | 2015-12-07 10:25:36 +0100 | [diff] [blame] | 235 | struct mpc52xx_gpiochip *chip = gpiochip_get_data(gc); |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 236 | struct mpc52xx_gpio __iomem *regs = mm_gc->regs; |
| 237 | |
| 238 | if (val) |
| 239 | chip->shadow_dvo |= 1 << (31 - gpio); |
| 240 | else |
| 241 | chip->shadow_dvo &= ~(1 << (31 - gpio)); |
| 242 | out_be32(®s->simple_dvo, chip->shadow_dvo); |
| 243 | } |
| 244 | |
| 245 | static void |
| 246 | mpc52xx_simple_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) |
| 247 | { |
| 248 | unsigned long flags; |
| 249 | |
| 250 | spin_lock_irqsave(&gpio_lock, flags); |
| 251 | |
| 252 | __mpc52xx_simple_gpio_set(gc, gpio, val); |
| 253 | |
| 254 | spin_unlock_irqrestore(&gpio_lock, flags); |
| 255 | |
| 256 | pr_debug("%s: gpio: %d val: %d\n", __func__, gpio, val); |
| 257 | } |
| 258 | |
| 259 | static int mpc52xx_simple_gpio_dir_in(struct gpio_chip *gc, unsigned int gpio) |
| 260 | { |
| 261 | struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); |
Linus Walleij | 837c270 | 2015-12-07 10:25:36 +0100 | [diff] [blame] | 262 | struct mpc52xx_gpiochip *chip = gpiochip_get_data(gc); |
Al Viro | 9307245 | 2008-06-02 10:59:02 +0100 | [diff] [blame] | 263 | struct mpc52xx_gpio __iomem *regs = mm_gc->regs; |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 264 | unsigned long flags; |
| 265 | |
| 266 | spin_lock_irqsave(&gpio_lock, flags); |
| 267 | |
| 268 | /* set the direction */ |
| 269 | chip->shadow_ddr &= ~(1 << (31 - gpio)); |
| 270 | out_be32(®s->simple_ddr, chip->shadow_ddr); |
| 271 | |
| 272 | /* and enable the pin */ |
| 273 | chip->shadow_gpioe |= 1 << (31 - gpio); |
| 274 | out_be32(®s->simple_gpioe, chip->shadow_gpioe); |
| 275 | |
| 276 | spin_unlock_irqrestore(&gpio_lock, flags); |
| 277 | |
| 278 | return 0; |
| 279 | } |
| 280 | |
| 281 | static int |
| 282 | mpc52xx_simple_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) |
| 283 | { |
| 284 | struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); |
Linus Walleij | 837c270 | 2015-12-07 10:25:36 +0100 | [diff] [blame] | 285 | struct mpc52xx_gpiochip *chip = gpiochip_get_data(gc); |
Al Viro | 9307245 | 2008-06-02 10:59:02 +0100 | [diff] [blame] | 286 | struct mpc52xx_gpio __iomem *regs = mm_gc->regs; |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 287 | unsigned long flags; |
| 288 | |
| 289 | spin_lock_irqsave(&gpio_lock, flags); |
| 290 | |
| 291 | /* First set initial value */ |
| 292 | __mpc52xx_simple_gpio_set(gc, gpio, val); |
| 293 | |
| 294 | /* Then set direction */ |
| 295 | chip->shadow_ddr |= 1 << (31 - gpio); |
| 296 | out_be32(®s->simple_ddr, chip->shadow_ddr); |
| 297 | |
| 298 | /* Finally enable the pin */ |
| 299 | chip->shadow_gpioe |= 1 << (31 - gpio); |
| 300 | out_be32(®s->simple_gpioe, chip->shadow_gpioe); |
| 301 | |
| 302 | spin_unlock_irqrestore(&gpio_lock, flags); |
| 303 | |
| 304 | pr_debug("%s: gpio: %d val: %d\n", __func__, gpio, val); |
| 305 | |
| 306 | return 0; |
| 307 | } |
| 308 | |
Bill Pemberton | 3836309 | 2012-11-19 13:22:34 -0500 | [diff] [blame] | 309 | static int mpc52xx_simple_gpiochip_probe(struct platform_device *ofdev) |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 310 | { |
| 311 | struct mpc52xx_gpiochip *chip; |
Anton Vorontsov | a19e3da | 2010-06-08 07:48:16 -0600 | [diff] [blame] | 312 | struct gpio_chip *gc; |
Al Viro | 9307245 | 2008-06-02 10:59:02 +0100 | [diff] [blame] | 313 | struct mpc52xx_gpio __iomem *regs; |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 314 | int ret; |
| 315 | |
Ricardo Ribalda Delgado | f91b2db | 2015-01-18 12:39:26 +0100 | [diff] [blame] | 316 | chip = devm_kzalloc(&ofdev->dev, sizeof(*chip), GFP_KERNEL); |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 317 | if (!chip) |
| 318 | return -ENOMEM; |
| 319 | |
Ricardo Ribalda Delgado | f91b2db | 2015-01-18 12:39:26 +0100 | [diff] [blame] | 320 | platform_set_drvdata(ofdev, chip); |
| 321 | |
Anton Vorontsov | a19e3da | 2010-06-08 07:48:16 -0600 | [diff] [blame] | 322 | gc = &chip->mmchip.gc; |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 323 | |
Anton Vorontsov | a19e3da | 2010-06-08 07:48:16 -0600 | [diff] [blame] | 324 | gc->ngpio = 32; |
| 325 | gc->direction_input = mpc52xx_simple_gpio_dir_in; |
| 326 | gc->direction_output = mpc52xx_simple_gpio_dir_out; |
| 327 | gc->get = mpc52xx_simple_gpio_get; |
| 328 | gc->set = mpc52xx_simple_gpio_set; |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 329 | |
Linus Walleij | 837c270 | 2015-12-07 10:25:36 +0100 | [diff] [blame] | 330 | ret = of_mm_gpiochip_add_data(ofdev->dev.of_node, &chip->mmchip, chip); |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 331 | if (ret) |
| 332 | return ret; |
| 333 | |
| 334 | regs = chip->mmchip.regs; |
| 335 | chip->shadow_gpioe = in_be32(®s->simple_gpioe); |
| 336 | chip->shadow_ddr = in_be32(®s->simple_ddr); |
| 337 | chip->shadow_dvo = in_be32(®s->simple_dvo); |
| 338 | |
| 339 | return 0; |
| 340 | } |
| 341 | |
| 342 | static const struct of_device_id mpc52xx_simple_gpiochip_match[] = { |
Grant Likely | 6eae1ac | 2011-07-06 11:54:19 -0600 | [diff] [blame] | 343 | { .compatible = "fsl,mpc5200-gpio", }, |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 344 | {} |
| 345 | }; |
| 346 | |
Grant Likely | 0000612 | 2011-02-22 19:59:54 -0700 | [diff] [blame] | 347 | static struct platform_driver mpc52xx_simple_gpiochip_driver = { |
Grant Likely | 4018294 | 2010-04-13 16:13:02 -0700 | [diff] [blame] | 348 | .driver = { |
Grant Likely | 6eae1ac | 2011-07-06 11:54:19 -0600 | [diff] [blame] | 349 | .name = "mpc5200-gpio", |
Grant Likely | 4018294 | 2010-04-13 16:13:02 -0700 | [diff] [blame] | 350 | .of_match_table = mpc52xx_simple_gpiochip_match, |
| 351 | }, |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 352 | .probe = mpc52xx_simple_gpiochip_probe, |
| 353 | .remove = mpc52xx_gpiochip_remove, |
| 354 | }; |
| 355 | |
Thierry Reding | 20d7090 | 2015-12-02 17:19:55 +0100 | [diff] [blame] | 356 | static struct platform_driver * const drivers[] = { |
| 357 | &mpc52xx_wkup_gpiochip_driver, |
| 358 | &mpc52xx_simple_gpiochip_driver, |
| 359 | }; |
| 360 | |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 361 | static int __init mpc52xx_gpio_init(void) |
| 362 | { |
Thierry Reding | 20d7090 | 2015-12-02 17:19:55 +0100 | [diff] [blame] | 363 | return platform_register_drivers(drivers, ARRAY_SIZE(drivers)); |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 364 | } |
| 365 | |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 366 | /* Make sure we get initialised before anyone else tries to use us */ |
| 367 | subsys_initcall(mpc52xx_gpio_init); |
| 368 | |
Ricardo Ribalda Delgado | f91b2db | 2015-01-18 12:39:26 +0100 | [diff] [blame] | 369 | static void __exit mpc52xx_gpio_exit(void) |
| 370 | { |
Thierry Reding | 20d7090 | 2015-12-02 17:19:55 +0100 | [diff] [blame] | 371 | platform_unregister_drivers(drivers, ARRAY_SIZE(drivers)); |
Ricardo Ribalda Delgado | f91b2db | 2015-01-18 12:39:26 +0100 | [diff] [blame] | 372 | } |
| 373 | module_exit(mpc52xx_gpio_exit); |
s.hauer@pengutronix.de | 3cd2550c | 2008-04-25 20:56:04 +1000 | [diff] [blame] | 374 | |
| 375 | MODULE_DESCRIPTION("Freescale MPC52xx gpio driver"); |
| 376 | MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de"); |
| 377 | MODULE_LICENSE("GPL v2"); |
| 378 | |