From cafd9e471a9e6d7dae0fc5549a94e11e2aea221b Mon Sep 17 00:00:00 2001 From: "yanhong.wang" Date: Thu, 12 May 2022 16:48:52 +0800 Subject: GPIO:Starfive-jh7110: Add macro definition Add macro definition of GPIO Signed-off-by: yanhong.wang --- arch/riscv/include/asm/arch-jh7110/gpio.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'arch/riscv') diff --git a/arch/riscv/include/asm/arch-jh7110/gpio.h b/arch/riscv/include/asm/arch-jh7110/gpio.h index 80675d64de..d83f6d2d9f 100644 --- a/arch/riscv/include/asm/arch-jh7110/gpio.h +++ b/arch/riscv/include/asm/arch-jh7110/gpio.h @@ -46,6 +46,27 @@ struct starfive_gpio_platdata { void *base; }; +#define SYS_IOMUX_DOEN(gpio, oen) \ + clrsetbits_le32(SYS_IOMUX_BASE+GPIO_OFFSET(gpio), \ + GPIO_DOEN_MASK << GPIO_SHIFT(gpio), \ + (oen) << GPIO_SHIFT(gpio)) + +#define SYS_IOMUX_DOUT(gpio, gpo) \ + clrsetbits_le32(SYS_IOMUX_BASE + GPIO_DOUT + GPIO_OFFSET(gpio),\ + GPIO_DOUT_MASK << GPIO_SHIFT(gpio),\ + ((gpo) & GPIO_DOUT_MASK) << GPIO_SHIFT(gpio)) + +#define SYS_IOMUX_DIN(gpio, gpi)\ + clrsetbits_le32(SYS_IOMUX_BASE + GPIO_DIN + GPIO_OFFSET(gpi),\ + GPIO_DIN_MASK << GPIO_SHIFT(gpi),\ + ((gpio+2) & GPIO_DIN_MASK) << GPIO_SHIFT(gpi)) + +#define SYS_IOMUX_COMPLEX(gpio, gpi, gpo, oen) do {\ + SYS_IOMUX_DOEN(gpio, oen);\ + SYS_IOMUX_DOUT(gpio, gpo);\ + SYS_IOMUX_DIN(gpio, gpi); \ + } while (0) + #ifdef __cplusplus } #endif -- cgit v1.2.3