gpio: renesas: Migrate to pinctrl GPIO accessors
Switch to generic pin controller API for configuring pins as GPIOs instead of using the ad-hoc call into the R-Car PFC driver. Moreover, add .free() implementation for the GPIO controller. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Alex Kiernan <alex.kiernan@gmail.com> Cc: Christoph Muellner <christoph.muellner@theobroma-systems.com> Cc: Eugeniu Rosca <roscaeugeniu@gmail.com> Cc: Patrice Chotard <patrice.chotard@st.com> Cc: Patrick DELAUNAY <patrick.delaunay@st.com> Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Cc: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
89ba7c5a8c
commit
fbf26bea39
@ -6,6 +6,7 @@
|
|||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <clk.h>
|
#include <clk.h>
|
||||||
#include <dm.h>
|
#include <dm.h>
|
||||||
|
#include <dm/pinctrl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <asm/gpio.h>
|
#include <asm/gpio.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
@ -117,19 +118,17 @@ static int rcar_gpio_get_function(struct udevice *dev, unsigned offset)
|
|||||||
static int rcar_gpio_request(struct udevice *dev, unsigned offset,
|
static int rcar_gpio_request(struct udevice *dev, unsigned offset,
|
||||||
const char *label)
|
const char *label)
|
||||||
{
|
{
|
||||||
struct rcar_gpio_priv *priv = dev_get_priv(dev);
|
return pinctrl_gpio_request(dev, offset);
|
||||||
struct udevice *pctldev;
|
}
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = uclass_get_device(UCLASS_PINCTRL, 0, &pctldev);
|
static int rcar_gpio_free(struct udevice *dev, unsigned offset)
|
||||||
if (ret)
|
{
|
||||||
return ret;
|
return pinctrl_gpio_free(dev, offset);
|
||||||
|
|
||||||
return sh_pfc_config_mux_for_gpio(pctldev, priv->pfc_offset + offset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct dm_gpio_ops rcar_gpio_ops = {
|
static const struct dm_gpio_ops rcar_gpio_ops = {
|
||||||
.request = rcar_gpio_request,
|
.request = rcar_gpio_request,
|
||||||
|
.free = rcar_gpio_free,
|
||||||
.direction_input = rcar_gpio_direction_input,
|
.direction_input = rcar_gpio_direction_input,
|
||||||
.direction_output = rcar_gpio_direction_output,
|
.direction_output = rcar_gpio_direction_output,
|
||||||
.get_value = rcar_gpio_get_value,
|
.get_value = rcar_gpio_get_value,
|
||||||
|
Loading…
Reference in New Issue
Block a user