diff options
author | yanhong.wang <yanhong.wang@starfivetech.com> | 2022-05-12 11:48:52 +0300 |
---|---|---|
committer | Yanhong Wang <yanhong.wang@linux.starfivetech.com> | 2022-10-18 11:24:35 +0300 |
commit | cafd9e471a9e6d7dae0fc5549a94e11e2aea221b (patch) | |
tree | 9fb185d47b6227482138a1b0f2d065dadb1d2827 /arch | |
parent | e81a6b4b7a58f56772b48db74ccadfc77a733fe1 (diff) | |
download | u-boot-cafd9e471a9e6d7dae0fc5549a94e11e2aea221b.tar.xz |
GPIO:Starfive-jh7110: Add macro definition
Add macro definition of GPIO
Signed-off-by: yanhong.wang <yanhong.wang@starfivetech.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/riscv/include/asm/arch-jh7110/gpio.h | 21 |
1 files changed, 21 insertions, 0 deletions
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 |