diff options
Diffstat (limited to 'arch/riscv/include/asm/arch-jh7110/gpio.h')
-rw-r--r-- | arch/riscv/include/asm/arch-jh7110/gpio.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/arch/riscv/include/asm/arch-jh7110/gpio.h b/arch/riscv/include/asm/arch-jh7110/gpio.h index 60e887c289..68a9bdc9ed 100644 --- a/arch/riscv/include/asm/arch-jh7110/gpio.h +++ b/arch/riscv/include/asm/arch-jh7110/gpio.h @@ -20,6 +20,14 @@ extern "C" { #define GPIO_DOEN_MASK 0x3f #define GPIO_DOUT_MASK 0x7f #define GPIO_DIN_MASK 0x7f +#define GPIO_DS_MASK 0x06 +#define GPIO_DS_SHIFT 1 +#define GPIO_SLEW_MASK BIT(5) +#define GPIO_SLEW_SHIFT 5 +#define GPIO_PULL_MASK 0x18 +#define GPIO_PULL_SHIFT 3 +#define GPIO_PULL_UP 1 +#define GPIO_PULL_DOWN 2 #define NR_GPIOS 64 @@ -38,8 +46,10 @@ enum gpio_state { #define GPIO_DOUT 0x40 #define GPIO_DIN 0x80 #define GPIO_EN 0xdc -#define GPIO_LOW_IE 0x100 +#define GPIO_LOW_IE 0x100 #define GPIO_HIGH_IE 0x104 +#define GPIO_CONFIG 0x120 + /* Details about a GPIO bank */ struct starfive_gpio_platdata { @@ -61,6 +71,18 @@ struct starfive_gpio_platdata { GPIO_DIN_MASK << GPIO_SHIFT(gpi),\ ((gpio+2) & GPIO_DIN_MASK) << GPIO_SHIFT(gpi)) +#define SYS_IOMUX_SET_DS(gpio, ds) \ + clrsetbits_le32(SYS_IOMUX_BASE + GPIO_CONFIG + gpio * 4, \ + GPIO_DS_MASK, (ds) << GPIO_DS_SHIFT) + +#define SYS_IOMUX_SET_SLEW(gpio, slew) \ + clrsetbits_le32(SYS_IOMUX_BASE + GPIO_CONFIG + gpio * 4, \ + GPIO_SLEW_MASK, (slew) << GPIO_SLEW_SHIFT) + +#define SYS_IOMUX_SET_PULL(gpio, pull) \ + clrsetbits_le32(SYS_IOMUX_BASE + GPIO_CONFIG + gpio * 4, \ + GPIO_PULL_MASK, (pull) << GPIO_PULL_SHIFT) + #define SYS_IOMUX_COMPLEX(gpio, gpi, gpo, oen) do {\ SYS_IOMUX_DOEN(gpio, oen);\ SYS_IOMUX_DOUT(gpio, gpo);\ |