Skip to contentSkip to conversation

sunxi: add the Allwinner B288 and the PocketBook Verse

PATCH In review Pablo Mazzini 2 participants 10 messages Oct 16

Subsystems (9)
lore
Share & tools
lore
#0 lore raw

cover sunxi: add the Allwinner B288 and the PocketBook Verse

The Allwinner B288 (sun8iw10p1) is a dual Cortex-A7 SoC used in e-book readers. This series adds SPL and U-Boot support for it, and one board:
the PocketBook Verse (PB629).

The DT is still under review for Linux. Until it reaches dts/upstream, the last patch carries a copy in arch/arm/dts.

Tested on a PB629.

Pablo Mazzini (7):
sunxi: add support for the Allwinner B288
sunxi: dram: support the Allwinner B288
dt-bindings: clock: add the Allwinner B288 CCU
clk: sunxi: add the Allwinner B288 gates and resets
pinctrl: sunxi: add the Allwinner B288 PIO
mmc: sunxi: B288 mmc0/mmc1 run off PLL_PERIPH0 2x
sunxi: add the PocketBook Verse

 arch/arm/cpu/armv7/sunxi/psci.c              |   9 +-
 arch/arm/dts/Makefile                        |   2 +
 arch/arm/dts/sun8i-b288-pocketbook-verse.dts | 114 ++++++++
 arch/arm/dts/sun8i-b288.dtsi                 | 292 +++++++++++++++++++
 arch/arm/include/asm/arch-sunxi/cpu.h        |   1 +
 arch/arm/include/asm/arch-sunxi/cpu_sun4i.h  |  16 +-
 arch/arm/mach-sunxi/Kconfig                  |  14 +
 arch/arm/mach-sunxi/board.c                  |   4 +
 arch/arm/mach-sunxi/clock_sun6i.c            |   1 +
 arch/arm/mach-sunxi/cpu_info.c               |   2 +
 arch/arm/mach-sunxi/dram_sunxi_dw.c          |  97 +++++-
 board/sunxi/MAINTAINERS                      |   6 +
 configs/pocketbook_verse_defconfig           |  10 +
 drivers/clk/sunxi/Kconfig                    |   7 +
 drivers/clk/sunxi/Makefile                   |   1 +
 drivers/clk/sunxi/clk_b288.c                 | 101 +++++++
 drivers/clk/sunxi/clk_sunxi.c                |   5 +
 drivers/mmc/sunxi_mmc.c                      |   7 +
 drivers/pinctrl/sunxi/Kconfig                |   5 +
 drivers/pinctrl/sunxi/pinctrl-sunxi.c        |  22 ++
 include/dt-bindings/clock/sun8i-b288-ccu.h   |  82 ++++++
 include/dt-bindings/reset/sun8i-b288-ccu.h   |  45 +++
 include/sunxi_gpio.h                         |   1 +
 23 files changed, 827 insertions(+), 17 deletions(-)
 create mode 100644 arch/arm/dts/sun8i-b288-pocketbook-verse.dts
 create mode 100644 arch/arm/dts/sun8i-b288.dtsi
 create mode 100644 configs/pocketbook_verse_defconfig
 create mode 100644 drivers/clk/sunxi/clk_b288.c
 create mode 100644 include/dt-bindings/clock/sun8i-b288-ccu.h
 create mode 100644 include/dt-bindings/reset/sun8i-b288-ccu.h

base-commit: 65a7532545336e4b73e049a69436e255da7df961

Signature · 1 line
2.52.0
#1 lore raw

PATCH 1/7 sunxi: add support for the Allwinner B288

The B288 is a dual Cortex-A7 SoC of the sun8i family, used in e-readers. Its memory map follows the H3, but the RTC, CPUCFG and SID sit where the A20 has them, and there is no SRAM A2.

---
 arch/arm/cpu/armv7/sunxi/psci.c             |  9 +++++++--
 arch/arm/include/asm/arch-sunxi/cpu.h       |  1 +
 arch/arm/include/asm/arch-sunxi/cpu_sun4i.h | 16 +++++++++++++---
 arch/arm/mach-sunxi/Kconfig                 | 13 +++++++++++++
 arch/arm/mach-sunxi/board.c                 |  4 ++++
 arch/arm/mach-sunxi/clock_sun6i.c           |  1 +
 arch/arm/mach-sunxi/cpu_info.c              |  2 ++
 include/sunxi_gpio.h                        |  1 +
 8 files changed, 42 insertions(+), 5 deletions(-)
arch/arm/cpu/armv7/sunxi/psci.c +7 -2
index 4c30f3294b7..18a93546f16 100644
@@ -53,6 +53,7 @@
  * CPU state, rather than the older CPUCFG system.
  */
 #define SUN8I_R528_SOFT_ENTRY			(0x1c8)
+#define SUN8I_B288_SOFT_ENTRY			(0x1e4)
 #define SUN8I_R528_C0_RST_CTRL			(0x0000)
 #define SUN8I_R528_C0_CTRL_REG0			(0x0010)
 #define SUN8I_R528_C0_CPU_STATUS		(0x0080)
@@ -126,6 +127,9 @@ static void __secure sunxi_cpu_set_entry(int __always_unused cpu, void *entry)
 	} else if (IS_ENABLED(CONFIG_MACH_SUN8I_R528)) {
 		writel((u32)entry,
 		       SUNXI_R_CPUCFG_BASE + SUN8I_R528_SOFT_ENTRY);
+	} else if (IS_ENABLED(CONFIG_MACH_SUN8I_B288)) {
+		/* the B288 BROM takes the secondary entry from the RTC */
+		writel((u32)entry, SUNXI_RTC_BASE + SUN8I_B288_SOFT_ENTRY);
 	} else {
 		writel((u32)entry, SUNXI_CPUCFG_BASE + SUNXI_PRIV0);
 	}
@@ -144,8 +148,9 @@ static void __secure sunxi_cpu_set_power(int cpu, bool on)
 	} else if (IS_ENABLED(CONFIG_MACH_SUN8I_R40)) {
 		clamp = (void *)SUNXI_CPUCFG_BASE + SUN8I_R40_PWR_CLAMP(cpu);
 		pwroff = (void *)SUNXI_CPUCFG_BASE + SUN8I_R40_PWROFF;
-	} else if (IS_ENABLED(CONFIG_MACH_SUN8I_R528)) {
-		/* R528 leaves both cores powered up, manages them via reset */
+	} else if (IS_ENABLED(CONFIG_MACH_SUN8I_R528) ||
+		   IS_ENABLED(CONFIG_MACH_SUN8I_B288)) {
+		/* Both leave the cores powered and manage them via reset */
 		return;
 	} else {
 		if (IS_ENABLED(CONFIG_MACH_SUN6I) ||
arch/arm/include/asm/arch-sunxi/cpu.h +1 -0
index 768c6572d6b..7515d98959d 100644
@@ -21,5 +21,6 @@
 #define SOCID_V3S	0x1681
 #define SOCID_H5	0x1718
 #define SOCID_R40	0x1701
+#define SOCID_B288	0x1699
 
 #endif /* _SUNXI_CPU_H */
arch/arm/include/asm/arch-sunxi/cpu_sun4i.h +13 -3
index f023a4cfd93..559544daf58 100644
@@ -13,7 +13,8 @@
 
 #if defined(CONFIG_SUNXI_GEN_SUN6I) && \
     !defined(CONFIG_MACH_SUN8I_R40) && \
-    !defined(CONFIG_MACH_SUN8I_V3S)
+    !defined(CONFIG_MACH_SUN8I_V3S) && \
+    !defined(CONFIG_MACH_SUN8I_B288)
 #define SUNXI_SRAM_A2_BASE		0x00040000
 #ifdef CONFIG_MACH_SUN8I_H3
 #define SUNXI_SRAM_A2_SIZE		(48 * 1024)	/* 16+32 kiB */
@@ -77,6 +78,9 @@ defined(CONFIG_MACH_SUN50I)
 /* SID address space starts at 0x01c1400, but e-fuse is at offset 0x200 */
 #define SUNXI_SIDC_BASE			0x01c14000
 #define SUNXI_SID_BASE			0x01c14200
+#elif defined(CONFIG_MACH_SUN8I_B288)
+/* The H3's SID address, but with the e-fuse at offset 0, as on the A10 */
+#define SUNXI_SID_BASE			0x01c14000
 #else
 #define SUNXI_SID_BASE			0x01c23800
 #endif
@@ -86,7 +90,8 @@ defined(CONFIG_MACH_SUN50I)
 #define SUNXI_TP_BASE			0x01c25000
 #define SUNXI_PMU_BASE			0x01c25400
 
-#if defined CONFIG_MACH_SUN7I || defined CONFIG_MACH_SUN8I_R40
+#if defined CONFIG_MACH_SUN7I || defined CONFIG_MACH_SUN8I_R40 || \
+    defined CONFIG_MACH_SUN8I_B288
 #define SUNXI_CPUCFG_BASE		0x01c25c00
 #endif
 
@@ -144,12 +149,17 @@ defined(CONFIG_MACH_SUN50I)
 #define SUNXI_HDMI_BASE			0x01ee0000
 #endif
 
+#ifdef CONFIG_MACH_SUN8I_B288
+#define SUNXI_RTC_BASE			0x01c20400
+#else
 #define SUNXI_RTC_BASE			0x01f00000
+#endif
 #define SUNXI_PRCM_BASE			0x01f01400
 
 #if defined CONFIG_SUNXI_GEN_SUN6I && \
     !defined CONFIG_MACH_SUN8I_A83T && \
-    !defined CONFIG_MACH_SUN8I_R40
+    !defined CONFIG_MACH_SUN8I_R40 && \
+    !defined CONFIG_MACH_SUN8I_B288
 #define SUNXI_CPUCFG_BASE		0x01f01c00
 #endif
 
arch/arm/mach-sunxi/Kconfig +13 -0
index b0c5d3cd903..ed2402f71f2 100644
@@ -490,6 +490,18 @@ config MACH_SUN8I_R528
 	select DRAM_SUN20I_D1
 	imply OF_UPSTREAM
 
+config MACH_SUN8I_B288
+	bool "sun8i (Allwinner B288)"
+	select CPU_V7A
+	select CPU_V7_HAS_NONSEC
+	select CPU_V7_HAS_VIRT
+	select ARCH_SUPPORT_PSCI
+	select SUNXI_GEN_SUN6I
+	select SUNXI_DRAM_DW
+	select SUNXI_DRAM_DW_32BIT
+	select SUPPORT_SPL
+	imply OF_UPSTREAM
+
 config MACH_SUN8I_V3S
 	bool "sun8i (Allwinner V3/V3s/S3/S3L)"
 	select CPU_V7A
@@ -579,6 +591,7 @@ config MACH_SUN8I
 	default y if MACH_SUNXI_H3_H5
 	default y if MACH_SUN8I_R40
 	default y if MACH_SUN8I_V3S
+	default y if MACH_SUN8I_B288
 
 config RESERVE_ALLWINNER_BOOT0_HEADER
 	bool "reserve space for Allwinner boot0 header"
arch/arm/mach-sunxi/board.c +4 -0
index 432b1c10f92..c2b01896da9 100644
@@ -153,6 +153,10 @@ static int gpio_init(void)
 	sunxi_gpio_set_cfgpin(SUNXI_GPB(8), SUN8I_V3S_GPB_UART0);
 	sunxi_gpio_set_cfgpin(SUNXI_GPB(9), SUN8I_V3S_GPB_UART0);
 	sunxi_gpio_set_pull(SUNXI_GPB(9), SUNXI_GPIO_PULL_UP);
+#elif CONFIG_CONS_INDEX == 1 && defined(CONFIG_MACH_SUN8I_B288)
+	sunxi_gpio_set_cfgpin(SUNXI_GPB(4), SUN8I_B288_GPB_UART0);
+	sunxi_gpio_set_cfgpin(SUNXI_GPB(5), SUN8I_B288_GPB_UART0);
+	sunxi_gpio_set_pull(SUNXI_GPB(5), SUNXI_GPIO_PULL_UP);
 #elif CONFIG_CONS_INDEX == 1 && defined(CONFIG_MACH_SUN9I)
 	sunxi_gpio_set_cfgpin(SUNXI_GPH(12), SUN9I_GPH_UART0);
 	sunxi_gpio_set_cfgpin(SUNXI_GPH(13), SUN9I_GPH_UART0);
arch/arm/mach-sunxi/clock_sun6i.c +1 -0
index 657736c7ac2..d8e549a0adb 100644
@@ -305,6 +305,7 @@ void clock_set_pll10(unsigned int clk)
 
 #if defined(CONFIG_MACH_SUN8I_A33) || \
     defined(CONFIG_MACH_SUN8I_R40) || \
+    defined(CONFIG_MACH_SUN8I_B288) || \
     defined(CONFIG_MACH_SUN50I)
 void clock_set_pll11(unsigned int clk, bool sigma_delta_enable)
 {
arch/arm/mach-sunxi/cpu_info.c +2 -0
index c3a51d9956e..7c04105ad6d 100644
@@ -86,6 +86,8 @@ int print_cpuinfo(void)
 	printf("CPU:   Allwinner A33 (SUN8I %04x)\n", sunxi_get_sram_id());
 #elif defined CONFIG_MACH_SUN8I_A83T
 	printf("CPU:   Allwinner A83T (SUN8I %04x)\n", sunxi_get_sram_id());
+#elif defined CONFIG_MACH_SUN8I_B288
+	printf("CPU:   Allwinner B288 (SUN8I %04x)\n", sunxi_get_sram_id());
 #elif defined CONFIG_MACH_SUN8I_H3
 	printf("CPU:   Allwinner H3 (SUN8I %04x)\n", sunxi_get_sram_id());
 #elif defined CONFIG_MACH_SUN8I_R40
include/sunxi_gpio.h +1 -0
index 12b54c8dda4..ad2bd0470f8 100644
@@ -116,6 +116,7 @@ enum sunxi_gpio_number {
 #define SUN8I_A33_GPB_UART0	3
 #define SUN8I_A83T_GPB_UART0	2
 #define SUN8I_V3S_GPB_UART0	3
+#define SUN8I_B288_GPB_UART0	2
 #define SUN50I_GPB_UART0	4
 
 #define SUNXI_GPC_NAND		2
Signature · 1 line
2.52.0
#2 lore raw

PATCH 2/7 sunxi: dram: support the Allwinner B288

In reply to Pablo Mazzini

The B288 has the DW controller and PHY of the H3, set up as on the H5. Gate training finds its ranks and bus width, as in the vendor code.

---
 arch/arm/mach-sunxi/Kconfig         |  1 +
 arch/arm/mach-sunxi/dram_sunxi_dw.c | 97 +++++++++++++++++++++++++----
 2 files changed, 86 insertions(+), 12 deletions(-)
arch/arm/mach-sunxi/Kconfig +1 -0
index ed2402f71f2..0326c7a976b 100644
@@ -788,6 +788,7 @@ config DRAM_ODT_EN
 	depends on !MACH_SUN50I_H616
 	depends on !MACH_SUN55I_A523
 	default y if MACH_SUN8I_A23
+	default y if MACH_SUN8I_B288
 	default y if MACH_SUNXI_H3_H5
 	default y if MACH_SUN8I_R40
 	default y if MACH_SUN50I
arch/arm/mach-sunxi/dram_sunxi_dw.c +85 -12

198 lines not on this page · raw message

Signature · 1 line
2.52.0
#3 lore raw

PATCH 3/7 dt-bindings: clock: add the Allwinner B288 CCU

In reply to Pablo Mazzini

The clock and reset indices of the B288 CCU, as under review for Linux.

---
 include/dt-bindings/clock/sun8i-b288-ccu.h | 82 ++++++++++++++++++++++
 include/dt-bindings/reset/sun8i-b288-ccu.h | 45 ++++++++++++
 2 files changed, 127 insertions(+)
 create mode 100644 include/dt-bindings/clock/sun8i-b288-ccu.h
 create mode 100644 include/dt-bindings/reset/sun8i-b288-ccu.h
include/dt-bindings/clock/sun8i-b288-ccu.h new file +82 -0
new file mode 100644
index 00000000000..c9b9eaf979a
@@ -0,0 +1,82 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */
+#ifndef _DT_BINDINGS_CLK_SUN8I_B288_H_
+#define _DT_BINDINGS_CLK_SUN8I_B288_H_
+
+#define CLK_PLL_CPUX	0
+#define CLK_PLL_AUDIO_BASE	1
+#define CLK_PLL_VIDEO0	2
+#define CLK_PLL_DDR0	3
+#define CLK_PLL_PERIPH0	4
+#define CLK_PLL_VIDEO1	5
+#define CLK_PLL_24M	6
+#define CLK_PLL_PERIPH1	7
+#define CLK_PLL_DE	8
+#define CLK_PLL_DDR1	9
+
+#define CLK_PLL_PERIPH0_2X	10
+#define CLK_PLL_PERIPH1_2X	11
+#define CLK_CPUX	12
+#define CLK_AXI	13
+#define CLK_CPUAPB	14
+#define CLK_AHB1	15
+#define CLK_APB1	16
+#define CLK_APB2	17
+
+#define CLK_NAND	18
+#define CLK_MMC0	19
+#define CLK_MMC1	20
+#define CLK_MMC2	21
+#define CLK_MMC3	22
+#define CLK_SPI0	23
+#define CLK_SPI1	24
+#define CLK_SPI2	25
+#define CLK_DRAM	26
+#define CLK_DE	27
+#define CLK_EE	28
+#define CLK_EDMA	29
+#define CLK_TCON0	30
+#define CLK_MBUS	31
+
+#define CLK_BUS_THS	32
+#define CLK_BUS_NAND	33
+#define CLK_BUS_SDMMC0_BUS	34
+#define CLK_BUS_SDMMC1_BUS	35
+#define CLK_BUS_SDMMC2_BUS	36
+#define CLK_BUS_SDMMC3_BUS	37
+#define CLK_BUS_SPI0	38
+#define CLK_BUS_SPI1	39
+#define CLK_BUS_SPI2	40
+#define CLK_BUS_I2S0	41
+#define CLK_BUS_I2S1	42
+#define CLK_BUS_SPDIF	43
+#define CLK_BUS_DSD	44
+#define CLK_BUS_DMIC	45
+#define CLK_BUS_USBOHCI0	46
+#define CLK_BUS_USBEHCI0	47
+#define CLK_BUS_USBOTG	48
+#define CLK_BUS_DE	49
+#define CLK_BUS_EE	50
+#define CLK_BUS_TCON0	51
+#define CLK_BUS_CSI	52
+#define CLK_BUS_ADDA	53
+#define CLK_BUS_SDRAM	54
+#define CLK_BUS_PSRAM	55
+#define CLK_BUS_DMA	56
+#define CLK_BUS_UART0	57
+#define CLK_BUS_UART1	58
+#define CLK_BUS_UART2	59
+#define CLK_BUS_UART3	60
+#define CLK_BUS_UART4	61
+#define CLK_BUS_UART5	62
+#define CLK_BUS_TWI0	63
+#define CLK_BUS_TWI1	64
+#define CLK_BUS_TWI2	65
+#define CLK_BUS_PIO	66
+#define CLK_BUS_GPADC	67
+#define CLK_BUS_KEYADC	68
+#define CLK_MMC0_SAMPLE	69
+#define CLK_MMC0_OUTPUT	70
+#define CLK_MMC1_SAMPLE	71
+#define CLK_MMC1_OUTPUT	72
+
+#endif
include/dt-bindings/reset/sun8i-b288-ccu.h new file +45 -0

45 lines not on this page · raw message

Signature · 1 line
2.52.0
#4 lore raw

PATCH 4/7 clk: sunxi: add the Allwinner B288 gates and resets

In reply to Pablo Mazzini

The bus clock gates and resets, as in the Linux CCU driver.

---
 drivers/clk/sunxi/Kconfig     |   7 +++
 drivers/clk/sunxi/Makefile    |   1 +
 drivers/clk/sunxi/clk_b288.c  | 101 ++++++++++++++++++++++++++++++++++
 drivers/clk/sunxi/clk_sunxi.c |   5 ++
 4 files changed, 114 insertions(+)
 create mode 100644 drivers/clk/sunxi/clk_b288.c
drivers/clk/sunxi/Kconfig +7 -0
index 1c1cc82719c..e4fe6f63626 100644
@@ -52,6 +52,13 @@ config CLK_SUN8I_A23
 	  This enables common clock driver support for platforms based
 	  on Allwinner A23/A33 SoC.
 
+config CLK_SUN8I_B288
+	bool "Clock driver for Allwinner B288"
+	default MACH_SUN8I_B288
+	help
+	  This enables common clock driver support for platforms based
+	  on Allwinner B288 SoC.
+
 config CLK_SUN8I_A83T
 	bool "Clock driver for Allwinner A83T"
 	default MACH_SUN8I_A83T
drivers/clk/sunxi/Makefile +1 -0
index 93b542cebcd..4f278ff551a 100644
@@ -15,6 +15,7 @@ obj-$(CONFIG_CLK_SUN6I_A31) += clk_a31.o
 obj-$(CONFIG_CLK_SUN6I_A31_R) += clk_a31_r.o
 obj-$(CONFIG_CLK_SUN8I_A23) += clk_a23.o
 obj-$(CONFIG_CLK_SUN8I_A83T) += clk_a83t.o
+obj-$(CONFIG_CLK_SUN8I_B288) += clk_b288.o
 obj-$(CONFIG_CLK_SUN8I_R40) += clk_r40.o
 obj-$(CONFIG_CLK_SUN8I_V3S) += clk_v3s.o
 obj-$(CONFIG_CLK_SUN9I_A80) += clk_a80.o
drivers/clk/sunxi/clk_b288.c new file +101 -0

101 lines not on this page · raw message

drivers/clk/sunxi/clk_sunxi.c +5 -0
index 046d5d1605a..5f40f30fe89 100644
@@ -117,6 +117,7 @@ extern const struct ccu_desc a64_ccu_desc;
 extern const struct ccu_desc a80_ccu_desc;
 extern const struct ccu_desc a80_mmc_clk_desc;
 extern const struct ccu_desc a83t_ccu_desc;
+extern const struct ccu_desc b288_ccu_desc;
 extern const struct ccu_desc d1_ccu_desc;
 extern const struct ccu_desc f1c100s_ccu_desc;
 extern const struct ccu_desc h3_ccu_desc;
@@ -154,6 +155,10 @@ static const struct udevice_id sunxi_clk_ids[] = {
 	{ .compatible = "allwinner,sun8i-a33-ccu",
 	  .data = (ulong)&a23_ccu_desc },
 #endif
+#ifdef CONFIG_CLK_SUN8I_B288
+	{ .compatible = "allwinner,sun8i-b288-ccu",
+	  .data = (ulong)&b288_ccu_desc },
+#endif
 #ifdef CONFIG_CLK_SUN8I_A83T
 	{ .compatible = "allwinner,sun8i-a83t-ccu",
 	  .data = (ulong)&a83t_ccu_desc },
Signature · 1 line
2.52.0
#5 lore raw

PATCH 5/7 pinctrl: sunxi: add the Allwinner B288 PIO

In reply to Pablo Mazzini

The pin functions used by the PocketBook Verse.

---
 drivers/pinctrl/sunxi/Kconfig         |  5 +++++
 drivers/pinctrl/sunxi/pinctrl-sunxi.c | 22 ++++++++++++++++++++++
 2 files changed, 27 insertions(+)
drivers/pinctrl/sunxi/Kconfig +5 -0
index 54314992299..748a4140fbd 100644
@@ -54,6 +54,11 @@ config PINCTRL_SUN8I_A33
 	default MACH_SUN8I_A33
 	select PINCTRL_SUNXI
 
+config PINCTRL_SUN8I_B288
+	bool "Support for the Allwinner B288 PIO"
+	default MACH_SUN8I_B288
+	select PINCTRL_SUNXI
+
 config PINCTRL_SUN8I_A83T
 	bool "Support for the Allwinner A83T PIO"
 	default MACH_SUN8I_A83T
drivers/pinctrl/sunxi/pinctrl-sunxi.c +22 -0
index ab4e88c9918..29219c11b93 100644
@@ -448,6 +448,22 @@ static const struct sunxi_pinctrl_desc __maybe_unused sun8i_a33_pinctrl_desc = {
 	.num_banks	= 8,
 };
 
+static const struct sunxi_pinctrl_function sun8i_b288_pinctrl_functions[] = {
+	{ "gpio_in",	0 },
+	{ "gpio_out",	1 },
+	{ "i2c0",	2 },	/* PB6-PB7 */
+	{ "mmc0",	2 },	/* PF0-PF5 */
+	{ "mmc3",	5 },	/* PC1, PC4-PC14 */
+	{ "uart0",	2 },	/* PB4-PB5 */
+};
+
+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 sunxi_pinctrl_function sun8i_a83t_pinctrl_functions[] = {
 	{ "gmac",	4 },	/* PD2-PD23 */
 	{ "gpio_in",	0 },
@@ -912,6 +928,12 @@ static const struct udevice_id sunxi_pinctrl_ids[] = {
 		.data = (ulong)&sun8i_a33_pinctrl_desc,
 	},
 #endif
+#ifdef CONFIG_PINCTRL_SUN8I_B288
+	{
+		.compatible = "allwinner,sun8i-b288-pinctrl",
+		.data = (ulong)&sun8i_b288_pinctrl_desc,
+	},
+#endif
 #ifdef CONFIG_PINCTRL_SUN8I_A83T
 	{
 		.compatible = "allwinner,sun8i-a83t-pinctrl",
Signature · 1 line
2.52.0
#6 lore raw

PATCH 6/7 mmc: sunxi: B288 mmc0/mmc1 run off PLL_PERIPH0 2x

In reply to Pablo Mazzini

Their mux input 1 is PLL_PERIPH0 2x, and unlike mmc2/mmc3 they do not halve it.

---
 drivers/mmc/sunxi_mmc.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/mmc/sunxi_mmc.c +7 -0
index 84f4e4c2198..7329ca3e24e 100644
@@ -100,6 +100,13 @@ static int mmc_set_mod_clk(struct sunxi_mmc_priv *priv, unsigned int hz)
 		if (IS_ENABLED(CONFIG_MACH_SUN8I_R528))
 			pll_hz /= 2;
 
+		/*
+		 * The B288's mux input 1 is PLL_PERIPH0 2x, and only the
+		 * mmc2/mmc3 controllers halve it.
+		 */
+		if (IS_ENABLED(CONFIG_MACH_SUN8I_B288) && priv->mmc_no < 2)
+			pll_hz *= 2;
+
 		/*
 		 * The A523/T527 uses PERIPH0_400M as the MMC0/1 input clock,
 		 * and PERIPH0_800M for MMC2. There is also the hidden divider
Signature · 1 line
2.52.0
#7 lore raw

PATCH 7/7 sunxi: add the PocketBook Verse

In reply to Pablo Mazzini

An Allwinner B288 e-reader. The DT is a copy of the one under review for Linux, until it can come from dts/upstream.

---
 arch/arm/dts/Makefile                        |   2 +
 arch/arm/dts/sun8i-b288-pocketbook-verse.dts | 114 ++++++++
 arch/arm/dts/sun8i-b288.dtsi                 | 292 +++++++++++++++++++
 board/sunxi/MAINTAINERS                      |   6 +
 configs/pocketbook_verse_defconfig           |  10 +
 5 files changed, 424 insertions(+)
 create mode 100644 arch/arm/dts/sun8i-b288-pocketbook-verse.dts
 create mode 100644 arch/arm/dts/sun8i-b288.dtsi
 create mode 100644 configs/pocketbook_verse_defconfig
arch/arm/dts/Makefile +2 -0
index 099e3f082b6..039fbab2a90 100644
@@ -586,6 +586,8 @@ dtb-$(CONFIG_MACH_SUN8I_A83T) += \
 	sun8i-a83t-bananapi-m3.dtb \
 	sun8i-a83t-cubietruck-plus.dtb \
 	sun8i-a83t-tbs-a711.dtb
+dtb-$(CONFIG_MACH_SUN8I_B288) += \
+	sun8i-b288-pocketbook-verse.dtb
 dtb-$(CONFIG_MACH_SUN8I_H3) += \
 	sun8i-h2-plus-bananapi-m2-zero.dtb \
 	sun8i-h2-plus-libretech-all-h3-cc.dtb \
arch/arm/dts/sun8i-b288-pocketbook-verse.dts new file +114 -0

114 lines not on this page · raw message

arch/arm/dts/sun8i-b288.dtsi new file +292 -0

292 lines not on this page · raw message

board/sunxi/MAINTAINERS +6 -0
index df745f14649..53fd2666f21 100644
@@ -539,6 +539,12 @@ M:	Arnaud Ferraris <[email protected]>
 S:	Maintained
 F:	configs/pinetab_defconfig
 
+POCKETBOOK VERSE BOARD
+M:	Pablo Mazzini <[email protected]>
+S:	Maintained
+F:	arch/arm/dts/sun8i-b288*
+F:	configs/pocketbook_verse_defconfig
+
 R16 EVB PARROT BOARD
 M:	Quentin Schulz <[email protected]>
 S:	Maintained
configs/pocketbook_verse_defconfig new file +10 -0
new file mode 100644
index 00000000000..df86ab4b786
@@ -0,0 +1,10 @@
+CONFIG_ARM=y
+CONFIG_ARCH_SUNXI=y
+CONFIG_DEFAULT_DEVICE_TREE="sun8i-b288-pocketbook-verse"
+CONFIG_DRAM_CLK=672
+CONFIG_SPL=y
+CONFIG_MACH_SUN8I_B288=y
+CONFIG_DRAM_ZQ=3881977
+# CONFIG_HAS_ARMV7_SECURE_BASE is not set
+# CONFIG_OF_UPSTREAM is not set
+CONFIG_NO_NET=y
Signature · 1 line
2.52.0
#8 lore raw
In reply to Pablo Mazzini

Hi Pablo,

Quoted 5 lines · Pablo Mazzini

The Allwinner B288 (sun8iw10p1) is a dual Cortex-A7 SoC used in e-book readers. This series adds SPL and U-Boot support for it, and one board:
the PocketBook Verse (PB629).

Quoted 1 line

The DT is still under review for Linux. Until it reaches

dts/upstream, the last patch carries a copy in arch/arm/dts.

Thanks for sending this, much appreciated. I had a coarse look over this, and this looks fine on the first glance.
As you said, this is somewhat blocked on the DT merge on the Linux side, which will probably not happen this year anymore (v7.5-rc1 would be the earliest).
But meanwhile, in preparation for that, could you please reorder the patches, so you enable the devices first (clocks, pinctrl, mmc), then DRAM, then the general support patch, with the defconfig on top.

For the DT parts: please try to emulate the future situation, so put the files in the directories where they would end up eventually. You can try to take the Linux DT binding patch (for clock and reset), and just change the paths in there to point to the respective dts/upstream directories. This is what would happen anyway, look for those cherry-picks and upstream references in the dts/upstream git log. And the patch(es) wouldn't be taken as such anyway, but they provide a test base and reference for other people, until the DT lands.

There is no need to send a new version now, just wait until you receive some review or other comments.

Cheers,
Andre

Quoted 45 lines

Tested on a PB629.

Pablo Mazzini (7):
sunxi: add support for the Allwinner B288
sunxi: dram: support the Allwinner B288
dt-bindings: clock: add the Allwinner B288 CCU
clk: sunxi: add the Allwinner B288 gates and resets
pinctrl: sunxi: add the Allwinner B288 PIO
mmc: sunxi: B288 mmc0/mmc1 run off PLL_PERIPH0 2x
sunxi: add the PocketBook Verse

  arch/arm/cpu/armv7/sunxi/psci.c              |   9 +-
  arch/arm/dts/Makefile                        |   2 +
  arch/arm/dts/sun8i-b288-pocketbook-verse.dts | 114 ++++++++
  arch/arm/dts/sun8i-b288.dtsi                 | 292 +++++++++++++++++++
  arch/arm/include/asm/arch-sunxi/cpu.h        |   1 +
  arch/arm/include/asm/arch-sunxi/cpu_sun4i.h  |  16 +-
  arch/arm/mach-sunxi/Kconfig                  |  14 +
  arch/arm/mach-sunxi/board.c                  |   4 +
  arch/arm/mach-sunxi/clock_sun6i.c            |   1 +
  arch/arm/mach-sunxi/cpu_info.c               |   2 +
  arch/arm/mach-sunxi/dram_sunxi_dw.c          |  97 +++++-
  board/sunxi/MAINTAINERS                      |   6 +
  configs/pocketbook_verse_defconfig           |  10 +
  drivers/clk/sunxi/Kconfig                    |   7 +
  drivers/clk/sunxi/Makefile                   |   1 +
  drivers/clk/sunxi/clk_b288.c                 | 101 +++++++
  drivers/clk/sunxi/clk_sunxi.c                |   5 +
  drivers/mmc/sunxi_mmc.c                      |   7 +
  drivers/pinctrl/sunxi/Kconfig                |   5 +
  drivers/pinctrl/sunxi/pinctrl-sunxi.c        |  22 ++
  include/dt-bindings/clock/sun8i-b288-ccu.h   |  82 ++++++
  include/dt-bindings/reset/sun8i-b288-ccu.h   |  45 +++
  include/sunxi_gpio.h                         |   1 +
  23 files changed, 827 insertions(+), 17 deletions(-)

create mode 100644 arch/arm/dts/sun8i-b288-pocketbook-verse.dts create mode 100644 arch/arm/dts/sun8i-b288.dtsi create mode 100644 configs/pocketbook_verse_defconfig create mode 100644 drivers/clk/sunxi/clk_b288.c create mode 100644 include/dt-bindings/clock/sun8i-b288-ccu.h create mode 100644 include/dt-bindings/reset/sun8i-b288-ccu.h

base-commit: 65a7532545336e4b73e049a69436e255da7df961

#9 lore raw

Hi Andre,

Thanks for having a look. I'll reorder the patches and move the DT bits to dts/upstream for v2, once there's more feedback.

Pablo

Quoted 80 lines · Andre Przywara

Hi Pablo,

Quoted 5 lines · Pablo Mazzini

The Allwinner B288 (sun8iw10p1) is a dual Cortex-A7 SoC used in e-book readers. This series adds SPL and U-Boot support for it, and one board:
the PocketBook Verse (PB629).

Quoted 1 line

The DT is still under review for Linux. Until it reaches

dts/upstream, the last patch carries a copy in arch/arm/dts.

Thanks for sending this, much appreciated. I had a coarse look over this, and this looks fine on the first glance.
As you said, this is somewhat blocked on the DT merge on the Linux side, which will probably not happen this year anymore (v7.5-rc1 would be the earliest).
But meanwhile, in preparation for that, could you please reorder the patches, so you enable the devices first (clocks, pinctrl, mmc), then DRAM, then the general support patch, with the defconfig on top.

For the DT parts: please try to emulate the future situation, so put the files in the directories where they would end up eventually. You can try to take the Linux DT binding patch (for clock and reset), and just change the paths in there to point to the respective dts/upstream directories. This is what would happen anyway, look for those cherry-picks and upstream references in the dts/upstream git log. And the patch(es) wouldn't be taken as such anyway, but they provide a test base and reference for other people, until the DT lands.

There is no need to send a new version now, just wait until you receive some review or other comments.

Cheers,
Andre

Quoted 45 lines

Tested on a PB629.

Pablo Mazzini (7):
sunxi: add support for the Allwinner B288
sunxi: dram: support the Allwinner B288
dt-bindings: clock: add the Allwinner B288 CCU
clk: sunxi: add the Allwinner B288 gates and resets
pinctrl: sunxi: add the Allwinner B288 PIO
mmc: sunxi: B288 mmc0/mmc1 run off PLL_PERIPH0 2x
sunxi: add the PocketBook Verse

  arch/arm/cpu/armv7/sunxi/psci.c              |   9 +-
  arch/arm/dts/Makefile                        |   2 +
  arch/arm/dts/sun8i-b288-pocketbook-verse.dts | 114 ++++++++
  arch/arm/dts/sun8i-b288.dtsi                 | 292 +++++++++++++++++++
  arch/arm/include/asm/arch-sunxi/cpu.h        |   1 +
  arch/arm/include/asm/arch-sunxi/cpu_sun4i.h  |  16 +-
  arch/arm/mach-sunxi/Kconfig                  |  14 +
  arch/arm/mach-sunxi/board.c                  |   4 +
  arch/arm/mach-sunxi/clock_sun6i.c            |   1 +
  arch/arm/mach-sunxi/cpu_info.c               |   2 +
  arch/arm/mach-sunxi/dram_sunxi_dw.c          |  97 +++++-
  board/sunxi/MAINTAINERS                      |   6 +
  configs/pocketbook_verse_defconfig           |  10 +
  drivers/clk/sunxi/Kconfig                    |   7 +
  drivers/clk/sunxi/Makefile                   |   1 +
  drivers/clk/sunxi/clk_b288.c                 | 101 +++++++
  drivers/clk/sunxi/clk_sunxi.c                |   5 +
  drivers/mmc/sunxi_mmc.c                      |   7 +
  drivers/pinctrl/sunxi/Kconfig                |   5 +
  drivers/pinctrl/sunxi/pinctrl-sunxi.c        |  22 ++
  include/dt-bindings/clock/sun8i-b288-ccu.h   |  82 ++++++
  include/dt-bindings/reset/sun8i-b288-ccu.h   |  45 +++
  include/sunxi_gpio.h                         |   1 +
  23 files changed, 827 insertions(+), 17 deletions(-)

create mode 100644 arch/arm/dts/sun8i-b288-pocketbook-verse.dts create mode 100644 arch/arm/dts/sun8i-b288.dtsi create mode 100644 configs/pocketbook_verse_defconfig create mode 100644 drivers/clk/sunxi/clk_b288.c create mode 100644 include/dt-bindings/clock/sun8i-b288-ccu.h create mode 100644 include/dt-bindings/reset/sun8i-b288-ccu.h

base-commit: 65a7532545336e4b73e049a69436e255da7df961