Skip to content

Instantly share code, notes, and snippets.

@apritzel
Created June 17, 2025 13:57
Show Gist options
  • Select an option

  • Save apritzel/34a2a623cf73eadef13730bf8810d74d to your computer and use it in GitHub Desktop.

Select an option

Save apritzel/34a2a623cf73eadef13730bf8810d74d to your computer and use it in GitHub Desktop.
Allwinner B288 U-Boot pinctrl sketch
diff --git a/drivers/pinctrl/sunxi/Kconfig b/drivers/pinctrl/sunxi/Kconfig
index 54314992299..114632307b8 100644
--- a/drivers/pinctrl/sunxi/Kconfig
+++ b/drivers/pinctrl/sunxi/Kconfig
@@ -149,4 +149,8 @@ config PINCTRL_SUN55I_A523_R
default MACH_SUN55I_A523
select PINCTRL_SUNXI
+config PINCTRL_SUN8I_B288
+ bool "Support for the Allwinner B288 PIO"
+ select PINCTRL_SUNXI
+
endif
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
index 46b266a3a1d..f5b45dda01d 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
@@ -846,6 +846,31 @@ static const struct sunxi_pinctrl_desc __maybe_unused sun55i_a523_r_pinctrl_desc
.num_banks = 2,
};
+static const struct sunxi_pinctrl_function sun8i_b288_pinctrl_functions[] = {
+ { "gpio_in", 0 },
+ { "gpio_out", 1 },
+ { "i2c0", 2 }, /* PB6-PB7 */
+ { "i2c1", 4 }, /* PB */
+ { "mmc0", 2 }, /* PF0-PF5 */
+ { "mmc1", 5 }, /* PG0-PG5 */
+ { "mmc2", 3 }, /* PC1-PC14 */
+ { "mmc3", 5 }, /* PC1-PC14 */
+ { "spi0", 4 }, /* PC0-PC3 */
+#if IS_ENABLED(CONFIG_UART0_PORT_F)
+ { "uart0", 4 }, /* PF2-PF4 */
+#else
+ { "uart0", 2 }, /* PB4-PB5 */
+#endif
+ { "uart2", 2 }, /* PB0-PB3 */
+};
+
+static const struct sunxi_pinctrl_desc __maybe_unused sun8i_b288_pinctrl_desc = {
+ .functions = sun8i_b288_pinctrl_functions,
+ .num_functions = ARRAY_SIZE(sun8i_b288_pinctrl_functions),
+ .first_bank = SUNXI_GPIO_A,
+ .num_banks = 7,
+};
+
static const struct udevice_id sunxi_pinctrl_ids[] = {
#ifdef CONFIG_PINCTRL_SUNIV_F1C100S
{
@@ -1032,6 +1057,12 @@ static const struct udevice_id sunxi_pinctrl_ids[] = {
.compatible = "allwinner,sun55i-a523-r-pinctrl",
.data = (ulong)&sun55i_a523_r_pinctrl_desc,
},
+#endif
+#ifdef CONFIG_PINCTRL_SUN8I_B288
+ {
+ .compatible = "allwinner,sun8i-b288-pinctrl",
+ .data = (ulong)&sun8i_b288_pinctrl_desc,
+ },
#endif
{}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment