[PATCH v2 v2 1/8] pinctrl: k1: add IO power domain configuration support

Yao Zi me at ziyao.cc
Tue Jun 30 10:55:03 CEST 2026


On Mon, Jun 29, 2026 at 11:51:15PM +0800, Eric Chung wrote:
> Dual-voltage GPIO banks default to 3.3V, but when externally supplied
> with 1.8V the internal logic must be explicitly reconfigured to match.
> 
> Add the ability to program IO power domain control registers through the
> APBC block. These registers require unlocking the AIB Secure Access
> Register (ASAR) before every read/write, since configuring a 1.8V domain
> while 3.3V is externally supplied can cause back-powering and pin damage.
> 
> Signed-off-by: Eric Chung <eric.chung at riscstar.com>
> ---
>  drivers/pinctrl/spacemit/pinctrl-k1.c | 84 ++++++++++++++++++++++++++++++++++-
>  1 file changed, 82 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pinctrl/spacemit/pinctrl-k1.c b/drivers/pinctrl/spacemit/pinctrl-k1.c
> index 3ebc397213b..5d3236aac94 100644
> --- a/drivers/pinctrl/spacemit/pinctrl-k1.c
> +++ b/drivers/pinctrl/spacemit/pinctrl-k1.c

...

> @@ -34,8 +36,24 @@
>  #define PAD_PULLUP		BIT(14)
>  #define PAD_PULL_EN		BIT(15)
>  
> -#define PIN_POWER_STATE_1V8		1800
> -#define PIN_POWER_STATE_3V3		3300
> +#define IO_PWR_DOMAIN_OFFSET	0x800
> +
> +#define IO_PWR_DOMAIN_GPIO2_Kx  0x0c
> +#define IO_PWR_DOMAIN_MMC_Kx    0x1c
> +
> +#define IO_PWR_DOMAIN_GPIO3_K1  0x10
> +#define IO_PWR_DOMAIN_QSPI_K1   0x20

Why these four offsets aren't sorted?

> +#define IO_PWR_DOMAIN_V18EN	BIT(2)
> +
> +#define APBC_ASFAR		0x50
> +#define APBC_ASSAR		0x54
> +
> +#define APBC_ASFAR_AKEY		0xbaba
> +#define APBC_ASSAR_AKEY		0xeb10
> +
> +#define PIN_POWER_STATE_1V8	1800
> +#define PIN_POWER_STATE_3V3	3300
>  
>  enum spacemit_pin_io_type {
>  	IO_TYPE_NONE = 0,

...

> @@ -485,6 +559,11 @@ static int spacemit_pinctrl_probe(struct udevice *dev)
>  		dev_err(dev, "Fail to allocate memory\n");
>  		return -ENOMEM;
>  	}
> +	priv->regmap = syscon_regmap_lookup_by_phandle(dev, "spacemit,apbc");

So with this patch, the driver depends on syscon symbols, and you should
reflect this in Kconfig.

Regards,
Yao Zi


More information about the U-Boot mailing list