Skip to content

Commit 0ba69e0

Browse files
Uwe Kleine-Königlinusw
authored andcommitted
gpio: mpc8xxx: add support for MPC5125
The gpio controller on MPC5125 is identical to the MPC5121 register wise, the only difference is that the lines 0..3 are input only instead of 28..31 on MPC5121. Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
1 parent 82e39b0 commit 0ba69e0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

drivers/gpio/gpio-mpc8xxx.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,15 @@ static int mpc5121_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val
174174
return mpc8xxx_gpio_dir_out(gc, gpio, val);
175175
}
176176

177+
static int mpc5125_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
178+
{
179+
/* GPIO 0..3 are input only on MPC5125 */
180+
if (gpio <= 3)
181+
return -EINVAL;
182+
183+
return mpc8xxx_gpio_dir_out(gc, gpio, val);
184+
}
185+
177186
static int mpc8xxx_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
178187
{
179188
struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc);
@@ -341,6 +350,11 @@ static const struct mpc8xxx_gpio_devtype mpc512x_gpio_devtype = {
341350
.irq_set_type = mpc512x_irq_set_type,
342351
};
343352

353+
static const struct mpc8xxx_gpio_devtype mpc5125_gpio_devtype = {
354+
.gpio_dir_out = mpc5125_gpio_dir_out,
355+
.irq_set_type = mpc512x_irq_set_type,
356+
};
357+
344358
static const struct mpc8xxx_gpio_devtype mpc8572_gpio_devtype = {
345359
.gpio_get = mpc8572_gpio_get,
346360
};
@@ -356,6 +370,7 @@ static const struct of_device_id mpc8xxx_gpio_ids[] = {
356370
{ .compatible = "fsl,mpc8572-gpio", .data = &mpc8572_gpio_devtype, },
357371
{ .compatible = "fsl,mpc8610-gpio", },
358372
{ .compatible = "fsl,mpc5121-gpio", .data = &mpc512x_gpio_devtype, },
373+
{ .compatible = "fsl,mpc5125-gpio", .data = &mpc5125_gpio_devtype, },
359374
{ .compatible = "fsl,pq3-gpio", },
360375
{ .compatible = "fsl,qoriq-gpio", },
361376
{}

0 commit comments

Comments
 (0)