diff options
author | Andrei Stefanescu <andrei.stefanescu@oss.nxp.com> | 2024-07-23 16:18:30 +0300 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2024-08-05 11:17:43 +0300 |
commit | 846d9b8628a493b2eb38f1eb779a199fae7093dd (patch) | |
tree | 7d4888cf15eb96c5902710d58e39ef149d132fab /drivers/pinctrl/nxp/pinctrl-s32cc.c | |
parent | 14411957096609b172a2d9fc1c985daa5c80f23d (diff) | |
download | linux-846d9b8628a493b2eb38f1eb779a199fae7093dd.tar.xz |
pinctrl: s32cc: enable the input buffer for a GPIO
The IBE (input buffer enable) should be enabled for a GPIO. Reading the
value will return the one from the input register, writing the value
will return the one from the output register.
This offers the flexibility to check if the value intended to be set
matches the actual physical one.
Signed-off-by: Florin Buica <florin.buica@nxp.com>
Signed-off-by: Andrei Stefanescu <andrei.stefanescu@oss.nxp.com>
Link: https://lore.kernel.org/20240723131832.1171036-2-andrei.stefanescu@oss.nxp.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/nxp/pinctrl-s32cc.c')
-rw-r--r-- | drivers/pinctrl/nxp/pinctrl-s32cc.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/pinctrl/nxp/pinctrl-s32cc.c b/drivers/pinctrl/nxp/pinctrl-s32cc.c index f2609a35c312..fc7e5d34c622 100644 --- a/drivers/pinctrl/nxp/pinctrl-s32cc.c +++ b/drivers/pinctrl/nxp/pinctrl-s32cc.c @@ -2,7 +2,7 @@ /* * Core driver for the S32 CC (Common Chassis) pin controller * - * Copyright 2017-2022 NXP + * Copyright 2017-2022,2024 NXP * Copyright (C) 2022 SUSE LLC * Copyright 2015-2016 Freescale Semiconductor, Inc. */ @@ -431,16 +431,15 @@ static int s32_pmx_gpio_set_direction(struct pinctrl_dev *pctldev, unsigned int offset, bool input) { - unsigned int config; + /* Always enable IBE for GPIOs. This allows us to read the + * actual line value and compare it with the one set. + */ + unsigned int config = S32_MSCR_IBE; unsigned int mask = S32_MSCR_IBE | S32_MSCR_OBE; - if (input) { - /* Disable output buffer and enable input buffer */ - config = S32_MSCR_IBE; - } else { - /* Disable input buffer and enable output buffer */ - config = S32_MSCR_OBE; - } + /* Enable output buffer */ + if (!input) + config |= S32_MSCR_OBE; return s32_regmap_update(pctldev, offset, mask, config); } |