ARM: sunxi: add Allwinner B288 and the PocketBook Verse
Subsystems (13)
v2 cover ARM: sunxi: add Allwinner B288 and the PocketBook Verse
The Allwinner B288 (sun8iw10p1) is a dual Cortex-A7 SoC used in e-book readers. This series adds the CCU and pin controller drivers, the RTC, I2C, MMC and NMI compatibles, the SoC .dtsi, and one board: the PocketBook Verse (PB629), a 6" reader.
The B288 is closest to the A64: most of its PLLs are bit-identical. The clock and pin descriptions come from Allwinner's BSP, cross-checked against ccu-sun50i-a64.c. Tested on a PB629, boots to userspace.
Changes since v1:
- Add this cover letter.
- Drop both new bindings; add the compatibles to the existing allwinner,sun4i-a10-{ccu,pinctrl}.yaml instead.
- Rewrite the pinctrl driver in the DT-provided pinmux style.
Pablo Mazzini (11):
dt-bindings: clock: sun4i-a10-ccu: add Allwinner B288
clk: sunxi-ng: add Allwinner B288 CCU driver
dt-bindings: pinctrl: sun4i-a10: add Allwinner B288
pinctrl: sunxi: add Allwinner B288 pin controller driver
dt-bindings: rtc: sun6i-a31: add Allwinner B288
rtc: sun6i: add Allwinner B288 compatible
dt-bindings: i2c: mv64xxx: add Allwinner B288
dt-bindings: mmc: sun4i-a10-mmc: add Allwinner B288
dt-bindings: interrupt-controller: add Allwinner B288 NMI
dt-bindings: arm: sunxi: add PocketBook Verse
ARM: sunxi: add B288 and the PocketBook Verse board
.../devicetree/bindings/arm/sunxi.yaml | 5 + .../clock/allwinner,sun4i-a10-ccu.yaml | 1 + .../bindings/i2c/marvell,mv64xxx-i2c.yaml | 1 + .../allwinner,sun7i-a20-sc-nmi.yaml | 1 + .../bindings/mmc/allwinner,sun4i-a10-mmc.yaml | 2 + .../pinctrl/allwinner,sun4i-a10-pinctrl.yaml | 23 + .../bindings/rtc/allwinner,sun6i-a31-rtc.yaml | 2 + arch/arm/boot/dts/allwinner/Makefile | 1 + .../allwinner/sun8i-b288-pocketbook-verse.dts | 122 ++++ arch/arm/boot/dts/allwinner/sun8i-b288.dtsi | 304 ++++++++ arch/arm/mach-sunxi/sunxi.c | 1 + drivers/clk/sunxi-ng/Kconfig | 5 + drivers/clk/sunxi-ng/Makefile | 1 + drivers/clk/sunxi-ng/ccu-sun8i-b288.c | 660 ++++++++++++++++++ drivers/clk/sunxi-ng/ccu-sun8i-b288.h | 10 + drivers/pinctrl/sunxi/Kconfig | 10 + drivers/pinctrl/sunxi/Makefile | 1 + drivers/pinctrl/sunxi/pinctrl-sun8i-b288.c | 53 ++ drivers/rtc/rtc-sun6i.c | 1 + include/dt-bindings/clock/sun8i-b288-ccu.h | 88 +++ include/dt-bindings/reset/sun8i-b288-ccu.h | 45 ++ 21 files changed, 1337 insertions(+) create mode 100644 arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts create mode 100644 arch/arm/boot/dts/allwinner/sun8i-b288.dtsi create mode 100644 drivers/clk/sunxi-ng/ccu-sun8i-b288.c create mode 100644 drivers/clk/sunxi-ng/ccu-sun8i-b288.h create mode 100644 drivers/pinctrl/sunxi/pinctrl-sun8i-b288.c create mode 100644 include/dt-bindings/clock/sun8i-b288-ccu.h create mode 100644 include/dt-bindings/reset/sun8i-b288-ccu.h
Signature · 1 line
2.53.0
PATCH v2 1/11 dt-bindings: clock: sun4i-a10-ccu: add Allwinner B288
The B288 (sun8iw10p1) is a dual Cortex-A7 SoC used in e-book readers. Its CCU needs only the two oscillator inputs, so it fits the existing schema without changes.
--- .../clock/allwinner,sun4i-a10-ccu.yaml | 1 + include/dt-bindings/clock/sun8i-b288-ccu.h | 88 +++++++++++++++++++ include/dt-bindings/reset/sun8i-b288-ccu.h | 45 ++++++++++ 3 files changed, 134 insertions(+) create mode 100644 include/dt-bindings/clock/sun8i-b288-ccu.h create mode 100644 include/dt-bindings/reset/sun8i-b288-ccu.h
Documentation/devicetree/bindings/clock/allwinner,sun4i-a10-ccu.yaml +1 -0
@@ -28,6 +28,7 @@ properties: - allwinner,sun8i-a33-ccu - allwinner,sun8i-a83t-ccu - allwinner,sun8i-a83t-r-ccu + - allwinner,sun8i-b288-ccu - allwinner,sun8i-h3-ccu - allwinner,sun8i-h3-r-ccu - allwinner,sun8i-r40-ccu
include/dt-bindings/clock/sun8i-b288-ccu.h new file +88 -0
88 lines not on this page · raw message
include/dt-bindings/reset/sun8i-b288-ccu.h new file +45 -0
45 lines not on this page · raw message
Signature · 1 line
2.53.0
Re: [PATCH v2 01/11] dt-bindings: clock: sun4i-a10-ccu: add Allwinner B288
Quoted 5 lines · Pablo Mazzini
The B288 (sun8iw10p1) is a dual Cortex-A7 SoC used in e-book readers. Its CCU needs only the two oscillator inputs, so it fits the existing schema without changes.
Signed-off-by Pablo Mazzini <[email protected]>
Best regards,
Krzysztof
PATCH v2 2/11 clk: sunxi-ng: add Allwinner B288 CCU driver
In reply to Pablo MazziniCovers the PLLs, the CPU/AHB/APB tree, the module clocks and the bus gates and resets.
--- drivers/clk/sunxi-ng/Kconfig | 5 + drivers/clk/sunxi-ng/Makefile | 1 + drivers/clk/sunxi-ng/ccu-sun8i-b288.c | 660 ++++++++++++++++++++++++++ drivers/clk/sunxi-ng/ccu-sun8i-b288.h | 10 + 4 files changed, 676 insertions(+) create mode 100644 drivers/clk/sunxi-ng/ccu-sun8i-b288.c create mode 100644 drivers/clk/sunxi-ng/ccu-sun8i-b288.h
drivers/clk/sunxi-ng/Kconfig +5 -0
@@ -88,6 +88,11 @@ config SUN6I_RTC_CCU default ARCH_SUNXI depends on MACH_SUN8I || ARM64 || RISCV || COMPILE_TEST +config SUN8I_B288_CCU + tristate "Support for the Allwinner B288 CCU" + default ARCH_SUNXI + depends on MACH_SUN8I || COMPILE_TEST + config SUN8I_A23_CCU tristate "Support for the Allwinner A23 CCU" default ARCH_SUNXI
drivers/clk/sunxi-ng/Makefile +1 -0
@@ -40,6 +40,7 @@ obj-$(CONFIG_SUN4I_A10_CCU) += sun4i-a10-ccu.o obj-$(CONFIG_SUN5I_CCU) += sun5i-ccu.o obj-$(CONFIG_SUN6I_A31_CCU) += sun6i-a31-ccu.o obj-$(CONFIG_SUN6I_RTC_CCU) += sun6i-rtc-ccu.o +obj-$(CONFIG_SUN8I_B288_CCU) += ccu-sun8i-b288.o obj-$(CONFIG_SUN8I_A23_CCU) += sun8i-a23-ccu.o obj-$(CONFIG_SUN8I_A33_CCU) += sun8i-a33-ccu.o obj-$(CONFIG_SUN8I_A83T_CCU) += sun8i-a83t-ccu.o
drivers/clk/sunxi-ng/ccu-sun8i-b288.c new file +660 -0
660 lines not on this page · raw message
drivers/clk/sunxi-ng/ccu-sun8i-b288.h new file +10 -0
@@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _CCU_SUN8I_B288_H_ +#define _CCU_SUN8I_B288_H_ + +#include <dt-bindings/clock/sun8i-b288-ccu.h> +#include <dt-bindings/reset/sun8i-b288-ccu.h> + +#define CLK_NUMBER (CLK_MMC1_OUTPUT + 1) + +#endif /* _CCU_SUN8I_B288_H_ */
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH v2 02/11] clk: sunxi-ng: add Allwinner B288 CCU driver
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] clk: sunxi-ng: pll-ddr0/1 lack required update bit logic causing rate desync --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] clk: sunxi-ng: pll-ddr0/1 lack required update bit logic causing rate desync --
commit e45a1df66351c0556d843abaca74cd27fa7b5854
Author: Pablo Mazzini <[email protected]>
clk: sunxi-ng: add Allwinner B288 CCU driver
This commit introduces the Clock Control Unit (CCU) driver for the Allwinner B288 SoC. It covers the PLLs, the CPU/AHB/APB tree, the module clocks, and the bus gates and resets.
Quoted 5 lines
drivers/clk/sunxi-ng/ccu-sun8i-b288.c new file +0
-0
[ ... ]
Quoted 5 lines
drivers/clk/sunxi-ng/ccu-sun8i-b288.c new file +5
-0+/* +* PLL_DDR0 @ 0x020 -- DIVERGES FROM A64, which is NKM with N[12:8] K[5:4]. +* The B288 has a 7-bit N and no K: the value boot0 leaves here sets +* bit 13, which the A64's 5-bit N field cannot hold. +*
drivers/clk/sunxi-ng/ccu-sun8i-b288.c line 92
Quoted 10 lines
drivers/clk/sunxi-ng/ccu-sun8i-b288.c new file +10
-0+* The vendor's bit-30 apply/update has no mainline equivalent and is not +* modelled, nor are the sigma-delta patterns at 0x2ac..0x2b8. +*/ +static SUNXI_CCU_NM_WITH_GATE_LOCK(pll_ddr0_clk, "pll-ddr0", +"osc24M" ,0x020 , +8 ,7 ,/* N */ +0 ,2 ,/* M */ +BIT (31 ),/* gate */ +BIT (28 ),/* lock */ + CLK_SET_RATE_UNGATE);
[Severity: Medium]
Does this configuration break frequency scaling for pll-ddr0?
The pll-ddr0 clock is registered with the CLK_SET_RATE_UNGATE flag but relies on ccu_nm_ops. If a driver or subsystem (such as devfreq) calls clk_set_rate() on pll-ddr0, it will write new M/N factors to the registers but fail to toggle the required update bit (bit 30).
This causes the hardware to ignore the new configuration while the kernel state reflects the new frequency, breaking clock tree consistency. Since the comment above mentions the vendor's bit-30 apply/update has no mainline equivalent and is not modelled, how does the driver intend to handle rate updates safely?
[ ... ]
drivers/clk/sunxi-ng/ccu-sun8i-b288.c line 177
Quoted 8 lines
drivers/clk/sunxi-ng/ccu-sun8i-b288.c new file +8
-0+/* PLL_DDR1 @ 0x04c -- B288 only. Same layout; this is the one feeding DRAM. */ +static SUNXI_CCU_NM_WITH_GATE_LOCK(pll_ddr1_clk, "pll-ddr1", +"osc24M" ,0x04c , +8 ,7 ,/* N */ +0 ,2 ,/* M */ +BIT (31 ),/* gate */ +BIT (28 ),/* lock */ + CLK_SET_RATE_UNGATE);
[Severity: Medium]
Does pll-ddr1 also suffer from the missing bit 30 update logic during frequency scaling?
Similar to pll_ddr0_clk, this clock uses the same operations and exposes a set_rate callback, but appears to lack the necessary mechanism to toggle the bit-30 update bit when writing the new configuration.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
PATCH v2 3/11 dt-bindings: pinctrl: sun4i-a10: add Allwinner B288
In reply to Pablo MazziniThe B288 driver takes its mux values from the DT, so allwinner,pinmux becomes an allowed property here, required for this compatible only.
--- .../pinctrl/allwinner,sun4i-a10-pinctrl.yaml | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+)
Documentation/devicetree/bindings/pinctrl/allwinner,sun4i-a10-pinctrl.yaml +23 -0
@@ -39,6 +39,7 @@ properties: - allwinner,sun8i-a33-pinctrl - allwinner,sun8i-a83t-pinctrl - allwinner,sun8i-a83t-r-pinctrl + - allwinner,sun8i-b288-pinctrl - allwinner,sun8i-h3-pinctrl - allwinner,sun8i-h3-r-pinctrl - allwinner,sun8i-r40-pinctrl
@@ -120,6 +121,15 @@ patternProperties: $ref: /schemas/types.yaml#/definitions/uint32 enum: [10, 20, 30, 40] + allwinner,pinmux: + $ref: /schemas/types.yaml#/definitions/uint32-array + description: + Pinmux selector value, for each pin. Only used by SoCs whose + driver takes the mux values from the DT instead of an in-driver + table. Almost every time this value is the same for all pins, so + any array shorter than the number of pins will repeat the last + value, to allow just specifying a single cell, for all cells. + required: - pins - function
@@ -144,6 +154,19 @@ allOf: # warnings. - $ref: pinctrl.yaml# + + # The B288 driver has no in-driver pin table, so the mux values have to + # come from the DT. + - if: + properties: + compatible: + const: allwinner,sun8i-b288-pinctrl + + then: + patternProperties: + "^([rs]-)?(([a-z0-9]{3,}|[a-oq-z0-9][a-z0-9]*?)?-)+?(p[a-ilm][0-9]*?-)??pins?$": + required: + - allwinner,pinmux - if: not: properties:
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH v2 03/11] dt-bindings: pinctrl: sun4i-a10: add Allwinner B288
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] dt-bindings: pinctrl: sunxi: missing b288 interrupts constraint validation --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] dt-bindings: pinctrl: sunxi: missing b288 interrupts constraint validation --
commit 5d0ff1f67ca22e7e0aeb81a6bb9183820225e5b3
Author: Pablo Mazzini <[email protected]>
dt-bindings: pinctrl: sun4i-a10: add Allwinner B288
The B288 driver takes its mux values from the DT, so allwinner,pinmux becomes an allowed property here, required for this compatible only.
Documentation/devicetree/bindings/pinctrl/allwinner,sun4i-a10-pinctrl.yaml properties: · line 42
Quoted 9 lines
Documentation/devicetree/bindings/pinctrl/allwinner,sun4i-a10-pinctrl.yaml +1
-0@@ -39,6 +39,7 @@ properties: - allwinner,sun8i-a33-pinctrl - allwinner,sun8i-a83t-pinctrl - allwinner,sun8i-a83t-r-pinctrl + - allwinner,sun8i-b288-pinctrl
[Severity: Medium]
Since this compatible is for hardware with exactly 4 interrupt banks, shouldn't it also be added to the later allOf constraints block in this file that enforces exact hardware limits for interrupts?
For example:
- if:
properties:
compatible:
enum:
- allwinner,sun6i-a31-pinctrl
- allwinner,sun6i-a31s-pinctrl
- allwinner,sun50i-h6-pinctrl
- allwinner,sun8i-b288-pinctrl
then:
properties:
interrupts:
minItems: 4
maxItems: 4
Without this, validation for this variant falls back to the broad global default of 1 to 8 interrupts.
Does this allow a device tree with an incorrect number of interrupts for the B288 to silently pass validation?
Quoted 3 lines
Documentation/devicetree/bindings/pinctrl/allwinner,sun4i-a10-pinctrl.yaml +0
-0- allwinner,sun8i-h3-pinctrl - allwinner,sun8i-h3-r-pinctrl - allwinner,sun8i-r40-pinctrl
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
PATCH v2 4/11 pinctrl: sunxi: add Allwinner B288 pin controller driver
In reply to Pablo Mazzini80 pins across ports B, C, D, F and G; the mux values come from the DT. Port C has no external interrupts. PH0 is BSP FPGA-only and omitted.
--- drivers/pinctrl/sunxi/Kconfig | 10 ++++ drivers/pinctrl/sunxi/Makefile | 1 + drivers/pinctrl/sunxi/pinctrl-sun8i-b288.c | 53 ++++++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 drivers/pinctrl/sunxi/pinctrl-sun8i-b288.c
drivers/pinctrl/sunxi/Kconfig +10 -0
@@ -56,6 +56,16 @@ config PINCTRL_SUN8I_A23_R default MACH_SUN8I select PINCTRL_SUNXI +config PINCTRL_SUN8I_B288 + bool "Support for the Allwinner B288 PIO" + default MACH_SUN8I + select PINCTRL_SUNXI + help + Say Y here to enable pin controller and GPIO support for the + Allwinner B288 (sun8iw10p1) SoC, as used in e-book readers such + as the PocketBook Verse. This covers ports B, C, D, F and G, + including the four banks of external interrupt capable pins. + config PINCTRL_SUN8I_H3 bool "Support for the Allwinner H3 PIO" default MACH_SUN8I
drivers/pinctrl/sunxi/Makefile +1 -0
@@ -18,6 +18,7 @@ obj-$(CONFIG_PINCTRL_SUN50I_A100) += pinctrl-sun50i-a100.o obj-$(CONFIG_PINCTRL_SUN50I_A100_R) += pinctrl-sun50i-a100-r.o obj-$(CONFIG_PINCTRL_SUN8I_A83T) += pinctrl-sun8i-a83t.o obj-$(CONFIG_PINCTRL_SUN8I_A83T_R) += pinctrl-sun8i-a83t-r.o +obj-$(CONFIG_PINCTRL_SUN8I_B288) += pinctrl-sun8i-b288.o obj-$(CONFIG_PINCTRL_SUN8I_H3) += pinctrl-sun8i-h3.o obj-$(CONFIG_PINCTRL_SUN8I_H3_R) += pinctrl-sun8i-h3-r.o obj-$(CONFIG_PINCTRL_SUN8I_V3S) += pinctrl-sun8i-v3s.o
drivers/pinctrl/sunxi/pinctrl-sun8i-b288.c new file +53 -0
53 lines not on this page · raw message
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH v2 04/11] pinctrl: sunxi: add Allwinner B288 pin controller driver
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] pinctrl: out-of-bounds access and corrupt IRQ mapping due to shifted bank index - [High] pinctrl…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] pinctrl: out-of-bounds access and corrupt IRQ mapping due to shifted bank index
- [High] pinctrl: NULL pointer dereference on probe deferral due to global state leak --
commit c211ae9972d97b1239a013dc4594d43764f7806c
Author: Pablo Mazzini <[email protected]>
pinctrl: sunxi: add Allwinner B288 pin controller driver
This commit adds pin controller and GPIO support for the Allwinner B288 SoC. It defines 80 pins across ports B, C, D, F, and G, omitting port A completely.
Quoted 6 lines
drivers/pinctrl/sunxi/pinctrl-sun8i-b288.c new file +0
-0@@ -0,0 +1,53 @@
[ ... ]
drivers/pinctrl/sunxi/pinctrl-sun8i-b288.c line 27
Quoted 11 lines
drivers/pinctrl/sunxi/pinctrl-sun8i-b288.c new file +11
-0+/* PH0 exists only on the BSP's FPGA platform and is omitted. */ +static const u8 b288_nr_bank_pins[SUNXI_PINCTRL_MAX_BANKS ] = +/* PA PB PC PD PE PF PG */ + {0 ,17 ,15 ,29 ,0 ,7 ,12 }; + +/* Port C has no external interrupts. */ +static const unsigned int b288_irq_bank_map[] = {1 ,3 ,5 ,6 }; + +static const u8 b288_irq_bank_muxes[SUNXI_PINCTRL_MAX_BANKS ] = +/* PA PB PC PD PE PF PG */ + {0 ,6 ,0 ,6 ,0 ,6 ,6 };
[Severity: High]
Does this pin layout trigger an out-of-bounds access and corrupt the IRQ mapping?
Because bank PA has 0 pins, PB (bank 1) is the first bank processed. In drivers/pinctrl/sunxi/pinctrl-sunxi-dt.c:prepare_function_table(), last_bank is initialized to 0. When PB is processed, bank > last_bank (1 > 0) evaluates to true, which erroneously increments irq_bank to 1 for the first bank instead of 0:
if (bank > last_bank) irq_bank++;
This shifts all logical IRQ banks so PB gets irqbank=1, PD=2, PF=3, and PG=4. Since b288_irq_bank_map only has 4 elements, processing PG (irqbank=4) causes sunxi_irq_hw_bank_num() to read out of bounds.
Further, sunxi_pinctrl_build_state() will write out of bounds past the end of pctl->irq_array:
int irqnum = func->irqnum + func->irqbank * IRQ_PER_BANK; pctl->irq_array[irqnum] = pin->pin.number;
Since func->irqbank evaluates to 4 (which is >= desc->irq_banks), this causes boot-time memory corruption and breaks IRQ routing for all pins.
drivers/pinctrl/sunxi/pinctrl-sun8i-b288.c line 39
Quoted 11 lines
drivers/pinctrl/sunxi/pinctrl-sun8i-b288.c new file +11
-0+static struct sunxi_pinctrl_desc b288_pinctrl_data = { + .irq_banks =ARRAY_SIZE (b288_irq_bank_map), + .irq_bank_map = b288_irq_bank_map, +}; + +static int b288_pinctrl_probe (struct platform_device *pdev) +{ +return sunxi_pinctrl_dt_table_init (pdev, b288_nr_bank_pins, + b288_irq_bank_muxes, + &b288_pinctrl_data,0 ); +}
[Severity: High]
Does passing this static global struct to the framework leak state on probe deferral, leading to a NULL pointer dereference?
The b288_pinctrl_data struct is a static global passed to sunxi_pinctrl_dt_table_init(). Inside init_pins_table(), desc->npins is unconditionally incremented into the global state:
desc->npins += pins_per_bank[i];
If sunxi_pinctrl_init_with_flags() subsequently defers probe (e.g., waiting for a clock or PMIC), desc->npins permanently retains the 80 count. On the next probe attempt, desc->npins becomes 160.
This causes devm_kcalloc() to allocate 160 descriptors, but only the first 80 are properly initialized with names. The trailing 80 elements retain NULL pin.name pointers, which causes a crash during re-probe in prepare_function_table() when iterating over the uninitialized elements:
if (strcmp(pins[i].pin.name, name)) continue;
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
PATCH v2 5/11 dt-bindings: rtc: sun6i-a31: add Allwinner B288
In reply to Pablo MazziniThe B288 RTC wires one alarm interrupt, not two.
--- .../devicetree/bindings/rtc/allwinner,sun6i-a31-rtc.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/rtc/allwinner,sun6i-a31-rtc.yaml +2 -0
@@ -19,6 +19,7 @@ properties: - enum: - allwinner,sun6i-a31-rtc - allwinner,sun8i-a23-rtc + - allwinner,sun8i-b288-rtc - allwinner,sun8i-h3-rtc - allwinner,sun8i-r40-rtc - allwinner,sun8i-v3-rtc
@@ -162,6 +163,7 @@ allOf: compatible: contains: enum: + - allwinner,sun8i-b288-rtc - allwinner,sun8i-r40-rtc - allwinner,sun50i-h616-rtc - allwinner,sun50i-r329-rtc
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH v2 05/11] dt-bindings: rtc: sun6i-a31: add Allwinner B288
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] dt-bindings: rtc: missing clock-output-names constraints for sun8i-b288-rtc --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] dt-bindings: rtc: missing clock-output-names constraints for sun8i-b288-rtc --
commit dc864843d6f807d8dbbd6c391ac70a1992bc2e0f
Author: Pablo Mazzini <[email protected]>
dt-bindings: rtc: sun6i-a31: add Allwinner B288
The B288 RTC wires one alarm interrupt, not two.
Quoted 4 lines
Documentation/devicetree/bindings/rtc/allwinner,sun6i-a31-rtc.yaml +0
-0
[ ... ]
Documentation/devicetree/bindings/rtc/allwinner,sun6i-a31-rtc.yaml allOf: · line 169
Quoted 8 lines
Documentation/devicetree/bindings/rtc/allwinner,sun6i-a31-rtc.yaml +1
-0@@ -162,6 +163,7 @@ allOf: compatible: contains: enum: + - allwinner,sun8i-b288-rtc - allwinner,sun8i-r40-rtc - allwinner,sun50i-h616-rtc - allwinner,sun50i-r329-rtc
[Severity: Low]
Does the new allwinner,sun8i-b288-rtc compatible string need to be added to one of the clock-output-names conditional blocks as well?
Because it is omitted from the earlier conditional blocks in the allOf section that strictly enforce clock-output-names constraints for all other compatibles, it falls back to the default allowing 1 to 3 items.
This could allow an incorrect number of clock-output-names in a device tree configuration to silently pass dtbs_check.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
Re: [PATCH v2 05/11] dt-bindings: rtc: sun6i-a31: add Allwinner B288
In reply to Pablo MazziniQuoted 7 lines · Pablo Mazzini
The B288 RTC wires one alarm interrupt, not two.
Signed-off-by Pablo Mazzini <[email protected]>--- .../devicetree/bindings/rtc/allwinner,sun6i-a31-rtc.yaml | 2 ++ 1 file changed, 2 insertions(+)
Seems like valid and unaddressed comment from Sashiko, so dropping from DT Patchwork.
Best regards,
Krzysztof
Re: [PATCH v2 05/11] dt-bindings: rtc: sun6i-a31: add Allwinner B288
Hi Krzysztof,
Thanks, will fix in v3.
Regards,
Pablo
Quoted 16 lines · Krzysztof Kozlowski
Quoted 7 lines · Pablo Mazzini
The B288 RTC wires one alarm interrupt, not two.
Signed-off-by Pablo Mazzini <[email protected]>--- .../devicetree/bindings/rtc/allwinner,sun6i-a31-rtc.yaml | 2 ++ 1 file changed, 2 insertions(+)Seems like valid and unaddressed comment from Sashiko, so dropping from DT Patchwork.
Best regards,
Krzysztof
PATCH v2 6/11 rtc: sun6i: add Allwinner B288 compatible
In reply to Pablo MazziniThe driver only uses one alarm interrupt, so no functional change.
--- drivers/rtc/rtc-sun6i.c | 1 + 1 file changed, 1 insertion(+)
drivers/rtc/rtc-sun6i.c +1 -0
@@ -859,6 +859,7 @@ static int sun6i_rtc_probe(struct platform_device *pdev)static const struct of_device_id sun6i_rtc_dt_ids[] = { { .compatible ="allwinner,sun6i-a31-rtc" }, { .compatible ="allwinner,sun8i-a23-rtc" }, + { .compatible ="allwinner,sun8i-b288-rtc" }, { .compatible ="allwinner,sun8i-h3-rtc" }, { .compatible ="allwinner,sun8i-r40-rtc" }, { .compatible ="allwinner,sun8i-v3-rtc" },
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH v2 06/11] rtc: sun6i: add Allwinner B288 compatible
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 3 lines
The driver only uses one alarm interrupt, so no functional change.
Signed-off-by Pablo Mazzini <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=6
PATCH v2 7/11 dt-bindings: i2c: mv64xxx: add Allwinner B288
In reply to Pablo MazziniThe B288 controller follows the existing Allwinner variant.
--- Documentation/devicetree/bindings/i2c/marvell,mv64xxx-i2c.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/i2c/marvell,mv64xxx-i2c.yaml +1 -0
@@ -21,6 +21,7 @@ properties: - enum: - allwinner,suniv-f1c100s-i2c - allwinner,sun8i-a23-i2c + - allwinner,sun8i-b288-i2c - allwinner,sun8i-a83t-i2c - allwinner,sun8i-v536-i2c - allwinner,sun50i-a64-i2c
Signature · 1 line
2.53.0
Re: [PATCH v2 07/11] dt-bindings: i2c: mv64xxx: add Allwinner B288
Hi Pablo,
Quoted 3 lines · Pablo Mazzini
The B288 controller follows the existing Allwinner variant.
Signed-off-by Pablo Mazzini <[email protected]>
Thanks,
Andi
Re: [PATCH v2 07/11] dt-bindings: i2c: mv64xxx: add Allwinner B288
In reply to Pablo MazziniQuoted 6 lines · Pablo Mazzini
The B288 controller follows the existing Allwinner variant.
Signed-off-by Pablo Mazzini <[email protected]>--- Documentation/devicetree/bindings/i2c/marvell,mv64xxx-i2c.yaml | 1 + 1 file changed, 1 insertion(+)
Best regards,
Krzysztof
PATCH v2 8/11 dt-bindings: mmc: sun4i-a10-mmc: add Allwinner B288
In reply to Pablo MazziniAdd the MMC and eMMC compatibles.
--- .../devicetree/bindings/mmc/allwinner,sun4i-a10-mmc.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/mmc/allwinner,sun4i-a10-mmc.yaml +2 -0
@@ -32,10 +32,12 @@ properties: - items: - enum: - allwinner,sun8i-a83t-mmc + - allwinner,sun8i-b288-mmc - allwinner,suniv-f1c100s-mmc - const: allwinner,sun7i-a20-mmc - items: - enum: + - allwinner,sun8i-b288-emmc - allwinner,sun8i-r40-emmc - allwinner,sun50i-h5-emmc - allwinner,sun50i-h6-emmc
Signature · 1 line
2.53.0
Re: [PATCH v2 08/11] dt-bindings: mmc: sun4i-a10-mmc: add Allwinner B288
Quoted 6 lines · Pablo Mazzini
Add the MMC and eMMC compatibles.
Signed-off-by Pablo Mazzini <[email protected]>--- .../devicetree/bindings/mmc/allwinner,sun4i-a10-mmc.yaml | 2 ++ 1 file changed, 2 insertions(+)
Best regards,
Krzysztof
Re: [PATCH v2 08/11] dt-bindings: mmc: sun4i-a10-mmc: add Allwinner B288
In reply to Pablo MazziniQuoted 4 lines · Pablo Mazzini
Add the MMC and eMMC compatibles.
Signed-off-by Pablo Mazzini <[email protected]>
Applied for next, thanks!
Kind regards
Uffe
Quoted 24 lines
--- .../devicetree/bindings/mmc/allwinner,sun4i-a10-mmc.yaml | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/mmc/allwinner,sun4i-a10-mmc.yaml +2
-1@@ -32,10 +32,12 @@ properties: - items: - enum: - allwinner,sun8i-a83t-mmc + - allwinner,sun8i-b288-mmc - allwinner,suniv-f1c100s-mmc - const: allwinner,sun7i-a20-mmc - items: - enum: + - allwinner,sun8i-b288-emmc - allwinner,sun8i-r40-emmc - allwinner,sun50i-h5-emmc - allwinner,sun50i-h6-emmc --2.53.0
PATCH v2 9/11 dt-bindings: interrupt-controller: add Allwinner B288 NMI
In reply to Pablo MazziniSame register layout as the sun9i-a80 NMI, like the V3s.
--- .../interrupt-controller/allwinner,sun7i-a20-sc-nmi.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/interrupt-controller/allwinner,sun7i-a20-sc-nmi.yaml +1 -0
@@ -29,6 +29,7 @@ properties: - const: allwinner,sun55i-a523-nmi - items: - enum: + - allwinner,sun8i-b288-nmi - allwinner,sun8i-v3s-nmi - allwinner,sun50i-a100-nmi - allwinner,sun50i-h616-nmi
Signature · 1 line
2.53.0
Re: [PATCH v2 09/11] dt-bindings: interrupt-controller: add Allwinner B288 NMI
Quoted 6 lines · Pablo Mazzini
Same register layout as the sun9i-a80 NMI, like the V3s.
Signed-off-by Pablo Mazzini <[email protected]>--- .../interrupt-controller/allwinner,sun7i-a20-sc-nmi.yaml | 1 + 1 file changed, 1 insertion(+)
Best regards,
Krzysztof
PATCH v2 10/11 dt-bindings: arm: sunxi: add PocketBook Verse
In reply to Pablo MazziniA 6" e-book reader built around the Allwinner B288.
--- Documentation/devicetree/bindings/arm/sunxi.yaml | 5 +++++ 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/arm/sunxi.yaml +5 -0
@@ -811,6 +811,11 @@ properties: - const: pocketbook,614-plus - const: allwinner,sun5i-a13 + - description: PocketBook Verse (PB629) + items: + - const: pocketbook,verse + - const: allwinner,sun8i-b288 + - description: Point of View Protab2-IPS9 items: - const: pov,protab2-ips9
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH v2 10/11] dt-bindings: arm: sunxi: add PocketBook Verse
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider: - [Medium] rtc: sun6i: missing clock provider initialization for sun8i-b288-rtc - [Low] dt-bindings…
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [Medium] rtc: sun6i: missing clock provider initialization for sun8i-b288-rtc
- [Low] dt-bindings: pinctrl: missing interrupts array constraint for sun8i-b288-pinctrl
- [Low] dt-bindings: pinctrl: allwinner,pinmux property allowed across all sunxi SoCs
- [Low] dt-bindings: rtc: missing clock-output-names constraint for sun8i-b288-rtc --
commit 52bfb11b9f38d6aaa40748a8fbc5e4f1f1b2ec66
Author: Pablo Mazzini <[email protected]>
dt-bindings: arm: sunxi: add PocketBook Verse
This commit adds a new compatible string for the PocketBook Verse (PB629), a 6" e-book reader built around the Allwinner B288 SoC.
Documentation/devicetree/bindings/arm/sunxi.yaml properties: · line 817
Quoted 12 lines
Documentation/devicetree/bindings/arm/sunxi.yaml +4
-0@@ -811,6 +811,11 @@ properties: - const: pocketbook,614-plus - const: allwinner,sun5i-a13 + - description: PocketBook Verse (PB629) + items: + - const: pocketbook,verse + - const: allwinner,sun8i-b288
[Severity: Medium]
Is there a missing clock provider initialization for the sun8i-b288-rtc companion driver?
Looking at sun6i_rtc_dt_ids() in drivers/rtc/rtc-sun6i.c, the compatible string is registered:
{ .compatible = "allwinner,sun8i-b288-rtc" },but it lacks the necessary CLK_OF_DECLARE_DRIVER() block to actually initialize early clock structures. This omission means the RTC driver fails to register as a clock provider. Any driver attempting to acquire <&rtc 0> via of_clk_get() or similar will trigger an EPROBE_DEFER.
[Severity: Low]
Does the sun8i-b288-pinctrl compatible also need to be added to the interrupts constraint block in the pinctrl schema?
In Documentation/devicetree/bindings/pinctrl/allwinner,sun4i-a10-pinctrl.yaml:
- if:
properties:
compatible:
enum:
- allwinner,sun6i-a31-pinctrl
- allwinner,sun6i-a31s-pinctrl
- allwinner,sun50i-h6-pinctrl
then:
properties:
interrupts:
minItems: 4
maxItems: 4
This conditional block restricts the interrupts array size to exactly 4. Without including the new sun8i-b288-pinctrl compatible, the schema permits incorrect interrupt arrays (defaulting to 1 to 8 items) for the b288 pinctrl, bypassing strict validation.
[Severity: Low]
Does this allow the b288-specific allwinner,pinmux property to leak into the global sunxi pinctrl namespace?
In the same allwinner,sun4i-a10-pinctrl.yaml file, the allOf block includes:
then:
patternProperties:
"^([rs]-)?(([a-z0-9]{3,}|[a-oq-z0-9][a-z0-9]*?)?-)+?(p[a-ilm][0-9]*?-)??pins?$":
required:
- allwinner,pinmux
This makes the property required for b288 without rejecting it for all other compatibles. Adding the property to any non-b288 board device tree would incorrectly pass dt_binding_check. An additional conditional block rejecting this property for non-b288 devices must be added after this block to prevent schema bypass.
[Severity: Low]
Are we missing a clock-output-names constraint for the sun8i-b288-rtc?
In Documentation/devicetree/bindings/rtc/allwinner,sun6i-a31-rtc.yaml, the allOf block contains constraints like:
- if:
properties:
compatible:
contains:
const: allwinner,sun6i-a31-rtc
The sun8i-b288-rtc compatible must be added to one of these conditional blocks to restrict its clock-output-names length. Because it is omitted, the schema incorrectly allows 1 to 3 clock output names for the b288 RTC instead of strictly enforcing 1.
Quoted 4 lines
Documentation/devicetree/bindings/arm/sunxi.yaml +1
-0+ - description: Point of View Protab2-IPS9 items: - const: pov,protab2-ips9
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=10
PATCH v2 11/11 ARM: sunxi: add B288 and the PocketBook Verse board
In reply to Pablo Mazziniarm,cpu-registers-not-fw-configured is required: Allwinner's boot0 sets neither CNTFRQ nor CNTVOFF, so the virtual timer storms. Same reason as commit 121b96cd9d7e ("ARM: sun6i: Enable ARM arch timers").
The watchdog interrupt was measured on hardware via GICD_ISPENDR.
--- arch/arm/boot/dts/allwinner/Makefile | 1 + .../allwinner/sun8i-b288-pocketbook-verse.dts | 122 +++++++ arch/arm/boot/dts/allwinner/sun8i-b288.dtsi | 304 ++++++++++++++++++ arch/arm/mach-sunxi/sunxi.c | 1 + 4 files changed, 428 insertions(+) create mode 100644 arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts create mode 100644 arch/arm/boot/dts/allwinner/sun8i-b288.dtsi
arch/arm/boot/dts/allwinner/Makefile +1 -0
@@ -227,6 +227,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \ sun8i-a83t-bananapi-m3.dtb \ sun8i-a83t-cubietruck-plus.dtb \ sun8i-a83t-tbs-a711.dtb \ + sun8i-b288-pocketbook-verse.dtb \ sun8i-h2-plus-bananapi-m2-zero.dtb \ sun8i-h2-plus-libretech-all-h3-cc.dtb \ sun8i-h2-plus-orangepi-r1.dtb \
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts new file +122 -0
122 lines not on this page · raw message
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +304 -0
304 lines not on this page · raw message
arch/arm/mach-sunxi/sunxi.c +1 -0
@@ -61,6 +61,7 @@ MACHINE_ENDstatic const char *const sun8i_board_dt_compat[] = {"allwinner,sun8i-a23" ,"allwinner,sun8i-a33" , +"allwinner,sun8i-b288" ,"allwinner,sun8i-h2-plus" ,"allwinner,sun8i-h3" ,"allwinner,sun8i-r40" ,
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH v2 11/11] ARM: sunxi: add B288 and the PocketBook Verse board
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Medium] arm: missing SMP enable-method prevents secondary CPU boot - [Low] serial: missing pinctrl…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] arm: missing SMP enable-method prevents secondary CPU boot
- [Low] serial: missing pinctrl assignment for uart0
--
commit 5bd2057523d9c0e8b398682ab9b915f189883892
Author: Pablo Mazzini <[email protected]>
ARM: sunxi: add B288 and the PocketBook Verse board
This commit introduces device tree support for the Allwinner B288 SoC and the PocketBook Verse board. It configures the CPU, timers, and basic peripherals like MMC, I2C, and UART.
Quoted 5 lines
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts new file +0
-0
[ ... ]
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts
Quoted 3 lines
+&uart0 {
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts new file +2
-0+ status = "okay"; +};
[Severity: Low]
Is the pin control configuration missing here? The uart0 node is enabled, but it lacks the pinctrl-names and pinctrl-0 properties.
There is a uart0_pb_pins group defined in sun8i-b288.dtsi, but it appears to be unreferenced. Without explicit pinctrl properties, the kernel might rely on the bootloader's initial pin state, which could lead to a broken serial console after suspend/resume cycles.
[ ... ]
Quoted 5 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +0
-0
[ ... ]
Quoted 10 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +10
-0+ cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu0: cpu@0 { + compatible = "arm,cortex-a7"; + device_type = "cpu"; + reg = <0>; + clocks = <&ccu CLK_CPUX>; + clock-names = "cpu";
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi line 53
Quoted 10 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +10
-0+ }; + + cpu1: cpu@1 { + compatible = "arm,cortex-a7"; + device_type = "cpu"; + reg = <1>; + clocks = <&ccu CLK_CPUX>; + clock-names = "cpu"; + }; + };
[Severity: Medium]
Does the cpus block or the cpu1 node need an enable-method property to properly bring up the secondary core?
Because this board uses Allwinner's boot0 rather than PSCI, the kernel's smp_init() sequence may not have the necessary operations to wake this secondary core if a custom enable-method isn't defined, which would result in the loss of SMP functionality.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=11
Re: [PATCH v2 11/11] ARM: sunxi: add B288 and the PocketBook Verse board
In reply to Pablo MazziniHi,
many thanks for cobbling this together, I do understand that this is tricky without schematics or even a manual.
Quoted 3 lines · Pablo Mazzini
arm,cpu-registers-not-fw-configured is required: Allwinner's boot0 sets neither CNTFRQ nor CNTVOFF, so the virtual timer storms. Same reason as commit
121b96cd9d7e("ARM: sun6i: Enable ARM arch timers").
Are you planning on going ahead with just boot0 in the long run? Given the age of the platform, and it being close to the A64, I expect a U-Boot port being pretty straight-forward. Chances are the DRAM controller (the biggest hurdle here) is very similar to the H3/A64/R40 generation, for which we already have a unified driver.
And in general: how do you boot this device, then? I guess you somehow trick boot0 into booting a mainline kernel? Is there some documentation about this?
Can you please create a wiki page about the device, and describe your device-specific findings in there? There is https://linux-sunxi.org/PocketBook_Basic_Lux_4_(PB618) already, which you can use as inspiration. Or maybe, if they are very similar, use that very page, even.
Quoted 43 lines
The watchdog interrupt was measured on hardware via
GICD_ISPENDR.Signed-off-by Pablo Mazzini <[email protected]>--- arch/arm/boot/dts/allwinner/Makefile | 1 + .../allwinner/sun8i-b288-pocketbook-verse.dts | 122 +++++++ arch/arm/boot/dts/allwinner/sun8i-b288.dtsi | 304 ++++++++++++++++++ arch/arm/mach-sunxi/sunxi.c | 1 + 4 files changed, 428 insertions(+)create mode 100644
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dtscreate mode 100644arch/arm/boot/dts/allwinner/sun8i-b288.dtsiarch/arm/boot/dts/allwinner/Makefile +1
-0@@ -227,6 +227,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \ sun8i-a83t-bananapi-m3.dtb \ sun8i-a83t-cubietruck-plus.dtb \ sun8i-a83t-tbs-a711.dtb \ + sun8i-b288-pocketbook-verse.dtb \ sun8i-h2-plus-bananapi-m2-zero.dtb \ sun8i-h2-plus-libretech-all-h3-cc.dtb \ sun8i-h2-plus-orangepi-r1.dtb \arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts new file +13
-0@@ -0,0 +1,122 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * PocketBook Verse (PB629), an Allwinner B288 based e-reader. + */ + +/dts-v1/; +#include "sun8i-b288.dtsi" + +#include <dt-bindings/gpio/gpio.h> + +/ { + model = "PocketBook Verse"; + compatible = "pocketbook,verse", "allwinner,sun8i-b288";
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts line 23
Quoted 10 lines
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts new file +10
-0+ + aliases { + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory@40000000 {
We typically don't hardcode memory nodes in the DT, but leave this up to the bootloader to populate, based on either detection or hard-coding *there*. I guess this eBook reader only comes in this one configuration?
Maybe we could allow this node in here, then, to increase compatiblity? Depends a bit on how involved this boot0 setup is, I guess.
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts line 36
Quoted 13 lines
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts new file +13
-0+ device_type = "memory"; + reg = <0x40000000 0x20000000>; + }; +}; + +&uart0 { + status = "okay"; +}; + +&mmc0 { + vmmc-supply = <®_dldo2>; + bus-width = <4>; + cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
I guess this is microSD, so without a write-protection switch? Then please add the "disable-wp;" property.
Also this is missing the pinctrl properties, to describe the pinmux used. As you describe the PortB UART0 pins in the .dtsi, just reference them here.
And are you sure the vmmc-supply is dldo2? Does the VCC pin on the SD card slot go to 0V when you turn that regulator off?
Just asking because on this generation of devices we most often see DCDC1 supplying the SD card, as it needs to be powered at reset time, to allow the BROM reading from the SD card.
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts line 42
Quoted 6 lines
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts new file +6
-0+ status = "okay"; +}; + +&mmc3 { + vmmc-supply = <®_dcdc1>; + vqmmc-supply = <®_dldo1>;
If this is a 1.8V eMMC, then please add the 1.8V properties:
mmc-ddr-1_8v;
mmc-hs200-1_8v;(given that these modes work).
And again the pinctrl nodes are missing.
Quoted 7 lines
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts new file +7
-0+ bus-width = <8>; + non-removable; + cap-mmc-hw-reset; + status = "okay"; +}; + +&pio {
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts line 59
Quoted 10 lines
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts new file +10
-0+ vcc-pc-supply = <®_dldo1>; + vcc-pd-supply = <®_dldo1>; + /* + * PC and PD are named in the vendor rail list; PF is not. It is not + * on dldo2: with that rail off, a pull-up on PF6 still reads card + * detect correctly, so the bank has its own supply. dcdc1 is the + * only remaining candidate, carrying vcc-io and vcc-card. Derived + * from the rail naming plus that measurement, not from a schematic. + */ + vcc-pf-supply = <®_dcdc1>;
Yes, on older SoCs PortF is internally powered by the VCC-IO pin, and is fixed at 3.3V. Compare the datasheets from the A64 and H3, for instance. And VCC-IO is traditionally powered by DCDC1, since it needs the most juice.
In any case, I think we don't need the comment, since it's a common setup.
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts line 65
Quoted 6 lines
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts new file +6
-0+}; + +&i2c0 { + status = "okay"; + + axp22x: pmic@34 {
Can you add a comment here that this is labelled as AXP227?
Quoted 36 lines
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts new file +36
-0+ compatible = "x-powers,axp221"; + reg = <0x34>; + interrupt-parent = <&nmi_intc>; + interrupts = <0 IRQ_TYPE_LEVEL_LOW>; + }; +}; + +#include "axp22x.dtsi" + +®_dcdc1 { + regulator-always-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-name = "vcc-io"; +}; + +®_dcdc2 { + regulator-always-on; + regulator-min-microvolt = <1260000>; + regulator-max-microvolt = <1260000>; + regulator-name = "vdd-cpu"; +}; + +®_dcdc4 { + regulator-always-on; + regulator-min-microvolt = <1100000>; + regulator-max-microvolt = <1100000>; + regulator-name = "vdd-sys"; +}; + +®_dcdc5 { + regulator-always-on; + regulator-min-microvolt = <1350000>; + regulator-max-microvolt = <1350000>; + regulator-name = "vcc-dram"; +};
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts line 111
Quoted 10 lines
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts new file +10
-0+ +®_aldo3 { + regulator-always-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-name = "avcc"; +}; + +®_dldo1 { + regulator-always-on;
Do you really need the always-on here?
Does it power more than the eMMC? Can you boot from SD card and use the system with that property removed, and the kernel turning it off?
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts line 118
Quoted 7 lines
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts new file +7
-0+ regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcc-pc"; +}; + +®_dldo2 { + /* Powers the microSD slot (slot pin 4), switched per card scan. */
What does "switched per card scan" mean?
And it's rather uncommon to see the SD card powered by a separate PMIC line, since it needs to be on at reset, to allow the BROM to access it. According to the AXP221 datasheet, dldo2 is off at reset, so can you please somehow check this? It might be different on the AXP227, but worth a try, I think.
Quoted 18 lines
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts new file +4
-0+ regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc-sdcv"; +};arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +8
-0@@ -0,0 +1,304 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Allwinner B288 (sun8iw10p1) SoC + * + * Addresses and interrupts come from the PocketBook Verse (PB629) vendor + * device tree, cross-checked against the BSP clk-sun8iw10.c. + */ +
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi line 18
Quoted 10 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +10
-0+#include <dt-bindings/interrupt-controller/arm-gic.h> +#include <dt-bindings/clock/sun8i-b288-ccu.h> +#include <dt-bindings/reset/sun8i-b288-ccu.h> + +/ { + #address-cells = <1>; + #size-cells = <1>; + interrupt-parent = <&gic>; + + clocks {
I don't think we put the crystals in their own node anymore. I see that we did this for the 32-bit Allwinner SoCs, but it's pointless.
Quoted 25 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +25
-0+ osc24M: osc24M-clk { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-frequency = <24000000>; + clock-output-names = "osc24M"; + }; + + osc32k: osc32k-clk { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-frequency = <32768>; + clock-output-names = "osc32k"; + }; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu0: cpu@0 { + compatible = "arm,cortex-a7"; + device_type = "cpu"; + reg = <0>; + clocks = <&ccu CLK_CPUX>; + clock-names = "cpu";
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi line 53
Quoted 10 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +10
-0+ }; + + cpu1: cpu@1 { + compatible = "arm,cortex-a7"; + device_type = "cpu"; + reg = <1>; + clocks = <&ccu CLK_CPUX>; + clock-names = "cpu"; + }; + };
So how does SMP work here, exactly? For the later 32-bit SoCs, we rely on a PSCI implmenetation in U-Boot, and I would strongly recommend doing so here as well.
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi line 62
Quoted 9 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +9
-0+ + timer { + compatible = "arm,armv7-timer"; + interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>, + <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>, + <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>, + <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>; + clock-frequency = <24000000>; + arm,cpu-registers-not-fw-configured;
Meh, as the comments in the binding say: please fix your firmware ;-)
I am not completely against it if boot0 is the firmware to use for a while, but if we go with U-Boot, it would be nicely fixed there.
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi
Quoted 11 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +11
-0+ }; + + soc { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + /* + * mmc0 is a v4p1x controller, so it runs in the old timing + * mode and needs the sample and output phase clocks.
I think the comment can end here.
But it would need to be moved below, above the actual mmc0 node.
Quoted 23 lines
Do not
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +22
-0+ * give it the sun50i-a64-mmc fallback: that selects the new + * timing mode, which this block does not implement. + */ + nmi_intc: interrupt-controller@1c000d0 { + compatible = "allwinner,sun8i-b288-nmi", + "allwinner,sun9i-a80-nmi"; + interrupt-controller; + #interrupt-cells = <2>; + reg = <0x01c000d0 0x0c>; + interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>; + }; + + mmc0: mmc@1c0f000 { + compatible = "allwinner,sun8i-b288-mmc", + "allwinner,sun7i-a20-mmc"; + reg = <0x01c0f000 0x1000>; + clocks = <&ccu CLK_BUS_SDMMC0_BUS>, + <&ccu CLK_MMC0>, + <&ccu CLK_MMC0_OUTPUT>, + <&ccu CLK_MMC0_SAMPLE>; + clock-names = "ahb", "mmc", "output", "sample"; + resets = <&ccu RST_BUS_MMC0>;
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi line 105
Quoted 10 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +10
-0+ reset-names = "ahb"; + interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&mmc0_pins>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <0>; + }; + + /* SDXC v4.5. The soldered eMMC; shares the PC pads with mmc2. */
This comment should go. Pinmuxing is described separately, and "the soldered eMMC" does not belong into a .dtsi file, since it's board specific. If you really want to document some of your findings, you can do so in the commit message.
Quoted 12 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +12
-0+ mmc3: mmc@1c12000 { + compatible = "allwinner,sun8i-b288-emmc", + "allwinner,sun50i-a64-emmc"; + reg = <0x01c12000 0x1000>; + clocks = <&ccu CLK_BUS_SDMMC3_BUS>, <&ccu CLK_MMC3>; + clock-names = "ahb", "mmc"; + resets = <&ccu RST_BUS_MMC3>; + reset-names = "ahb"; + interrupts = <GIC_SPI 63 IRQ_TYPE_LEVEL_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&mmc3_pins>; + status = "disabled";
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi line 127
Quoted 10 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +10
-0+ #address-cells = <1>; + #size-cells = <0>; + }; + + /* + * mmc2 (0x01c11000) is an SDHCI-style controller, not SDXC, and + * has no upstream binding. It loses the PC pad arbitration to + * mmc3 and is unused here, so it is left undescribed rather than + * given a wrong compatible. + */
You can shorten the comment to:
"mc2 @0x01c11000 is an unsupported SDHCI-style controller."
Quoted 27 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +27
-0+ + ccu: clock-controller@1c20000 { + compatible = "allwinner,sun8i-b288-ccu"; + reg = <0x01c20000 0x400>; + clocks = <&osc24M>, <&osc32k>; + clock-names = "hosc", "losc"; + #clock-cells = <1>; + #reset-cells = <1>; + }; + + rtc: rtc@1c20400 { + compatible = "allwinner,sun8i-b288-rtc"; + reg = <0x01c20400 0x400>; + interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>; + clock-output-names = "osc32k"; + clocks = <&osc32k>; + #clock-cells = <1>; + }; + + pio: pinctrl@1c20800 { + compatible = "allwinner,sun8i-b288-pinctrl"; + reg = <0x01c20800 0x400>; + interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&ccu CLK_BUS_PIO>, <&osc24M>, <&osc32k>;
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi line 164
Quoted 10 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +10
-0+ clock-names = "apb", "hosc", "losc"; + gpio-controller; + #gpio-cells = <3>; + interrupt-controller; + #interrupt-cells = <3>; + + mmc0_pins: mmc0-pins { + pins = "PF0", "PF1", "PF2", + "PF3", "PF4", "PF5"; + function = "sdc0";
We do not use the BSP function naming, but "mmc0" instead.
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi line 172
Quoted 8 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +8
-0+ allwinner,pinmux = <2>; + drive-strength = <30>; + bias-pull-up; + }; + + i2c0_pins: i2c0-pins { + pins = "PB6", "PB7"; + function = "twi0";
Same here, "i2c0" please.
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi line 180
Quoted 8 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +8
-0+ allwinner,pinmux = <2>; + }; + + mmc3_pins: mmc3-pins { + pins = "PC1", "PC4", "PC5", "PC6", + "PC7", "PC8", "PC9", "PC10", + "PC11", "PC12", "PC13", "PC14"; + function = "sdc3";
function = "mmc3";
Quoted 4 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +4
-0+ allwinner,pinmux = <5>; + drive-strength = <40>; + bias-pull-up; + };
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi line 194
Quoted 10 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +10
-0+ + uart0_pb_pins: uart0-pb-pins { + pins = "PB4", "PB5"; + function = "uart0"; + allwinner,pinmux = <2>; + }; + }; + + wdt: watchdog@1c20ca0 { + compatible = "allwinner,sun6i-a31-wdt";
I think lately we used this as a fallback, paired with a SoC specific compatible first.
In many aspects the more recent DTs under the arch/arm64 directory are more modern and a better source to copy from.
Quoted 115 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +110
-0+ reg = <0x01c20ca0 0x20>; + interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&osc24M>; + }; + + uart0: serial@1c28000 { + compatible = "snps,dw-apb-uart"; + reg = <0x01c28000 0x400>; + interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>; + reg-shift = <2>; + reg-io-width = <4>; + clocks = <&ccu CLK_BUS_UART0>; + resets = <&ccu RST_BUS_UART0>; + status = "disabled"; + }; + + uart1: serial@1c28400 { + compatible = "snps,dw-apb-uart"; + reg = <0x01c28400 0x400>; + interrupts = <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>; + reg-shift = <2>; + reg-io-width = <4>; + clocks = <&ccu CLK_BUS_UART1>; + resets = <&ccu RST_BUS_UART1>; + status = "disabled"; + }; + + uart2: serial@1c28800 { + compatible = "snps,dw-apb-uart"; + reg = <0x01c28800 0x400>; + interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>; + reg-shift = <2>; + reg-io-width = <4>; + clocks = <&ccu CLK_BUS_UART2>; + resets = <&ccu RST_BUS_UART2>; + status = "disabled"; + }; + + uart3: serial@1c28c00 { + compatible = "snps,dw-apb-uart"; + reg = <0x01c28c00 0x400>; + interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>; + reg-shift = <2>; + reg-io-width = <4>; + clocks = <&ccu CLK_BUS_UART3>; + resets = <&ccu RST_BUS_UART3>; + status = "disabled"; + }; + + uart4: serial@1c29000 { + compatible = "snps,dw-apb-uart"; + reg = <0x01c29000 0x400>; + interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>; + reg-shift = <2>; + reg-io-width = <4>; + clocks = <&ccu CLK_BUS_UART4>; + resets = <&ccu RST_BUS_UART4>; + status = "disabled"; + }; + + i2c0: i2c@1c2ac00 { + compatible = "allwinner,sun8i-b288-i2c", + "allwinner,sun6i-a31-i2c"; + reg = <0x01c2ac00 0x400>; + interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&ccu CLK_BUS_TWI0>; + resets = <&ccu RST_BUS_I2C0>; + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_pins>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <0>; + }; + + i2c1: i2c@1c2b000 { + compatible = "allwinner,sun8i-b288-i2c", + "allwinner,sun6i-a31-i2c"; + reg = <0x01c2b000 0x400>; + interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&ccu CLK_BUS_TWI1>; + resets = <&ccu RST_BUS_I2C1>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <0>; + }; + + i2c2: i2c@1c2b400 { + compatible = "allwinner,sun8i-b288-i2c", + "allwinner,sun6i-a31-i2c"; + reg = <0x01c2b400 0x400>; + interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&ccu CLK_BUS_TWI2>; + resets = <&ccu RST_BUS_I2C2>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <0>; + }; + + gic: interrupt-controller@1c81000 { + compatible = "arm,gic-400"; + reg = <0x01c81000 0x1000>, + <0x01c82000 0x2000>, + <0x01c84000 0x2000>, + <0x01c86000 0x2000>; + interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_HIGH)>; + interrupt-controller; + #interrupt-cells = <3>; + }; + }; +};arch/arm/mach-sunxi/sunxi.c +0
-0
arch/arm/mach-sunxi/sunxi.c MACHINE_END · line 64
Quoted 4 lines
arch/arm/mach-sunxi/sunxi.c +1
-0@@ -61,6 +61,7 @@ MACHINE_ENDstatic const char *const sun8i_board_dt_compat[] = {"allwinner,sun8i-a23" ,"allwinner,sun8i-a33" , +"allwinner,sun8i-b288" ,
Do we really need that entry? Or at least do we need the timer init part of that? And in any case it doesn't belong into the DT patch, as it's Linux code, not DT or binding related.
Cheers,
Andre
Quoted 3 lines
arch/arm/mach-sunxi/sunxi.c +0
-0"allwinner,sun8i-h2-plus" ,"allwinner,sun8i-h3" , "allwinner,sun8i-r40",
Re: [PATCH v2 11/11] ARM: sunxi: add B288 and the PocketBook Verse board
Hi Andre,
thanks for the detailed review.
Quoted 1 line
Are you planning on going ahead with just boot0 in the long run?
No, I'll work on U-Boot, but it needs the DT upstream first.
Quoted 1 line
And in general: how do you boot this device, then?
Over FEL: SPL, U-Boot and the kernel are loaded over USB.
Quoted 1 line
Can you please create a wiki page about the device
Will do.
Quoted 1 line
We typically don't hardcode memory nodes in the DT
Dropped for v3, U-Boot fills it in.
Quoted 2 lines
please add the "disable-wp;" property.
[...] just reference them here.
Done for v3.
Quoted 1 line
And are you sure the vmmc-supply is dldo2?
Yes: the vendor's board config maps the microSD vmmc to axp227_dldo2, which is off at power-on.
Quoted 1 line
If this is a 1.8V eMMC, then please add the 1.8V properties
Added; the eMMC runs in HS200.
Quoted 2 lines
Can you add a comment here that this is labelled as AXP227? Do you really need the always-on here?
Comment added. always-on dropped: the eMMC and the pin controller keep DLDO1 enabled.
Quoted 1 line
What does "switched per card scan" mean?
The MMC core switches DLDO2 on only while a card is present. Reworded.
Quoted 2 lines
I don't think we put the crystals in their own node anymore. So how does SMP work here, exactly?
Crystals moved out for v3. SMP will use PSCI from U-Boot.
Quoted 1 line
Meh, as the comments in the binding say: please fix your firmware ;-)
Dropped for v3, U-Boot sets CNTFRQ and CNTVOFF.
Quoted 1 line
[comments, function names, watchdog compatible,
sunxi.centry]
All done for v3: comments trimmed, mmc0/i2c0/mmc3 function names, a B288 watchdog compatible with the A31 fallback, and the sunxi.c entry dropped, as the generic machine works.
Thanks,
Pablo
Quoted 604 lines · Andre Przywara
Hi,
many thanks for cobbling this together, I do understand that this is tricky without schematics or even a manual.
Quoted 3 lines · Pablo Mazzini
arm,cpu-registers-not-fw-configured is required: Allwinner's boot0 sets neither CNTFRQ nor CNTVOFF, so the virtual timer storms. Same reason as commit
121b96cd9d7e("ARM: sun6i: Enable ARM arch timers").Are you planning on going ahead with just boot0 in the long run? Given the age of the platform, and it being close to the A64, I expect a U-Boot port being pretty straight-forward. Chances are the DRAM controller (the biggest hurdle here) is very similar to the H3/A64/R40 generation, for which we already have a unified driver.
And in general: how do you boot this device, then? I guess you somehow trick boot0 into booting a mainline kernel? Is there some documentation about this?
Can you please create a wiki page about the device, and describe your device-specific findings in there? There is
https://linux-sunxi.org/PocketBook_Basic_Lux_4_(PB618) already, which you can use as inspiration. Or maybe, if they are very similar, use that very page, even.Quoted 43 lines
The watchdog interrupt was measured on hardware via
GICD_ISPENDR.Signed-off-by Pablo Mazzini <[email protected]>--- arch/arm/boot/dts/allwinner/Makefile | 1 + .../allwinner/sun8i-b288-pocketbook-verse.dts | 122 +++++++ arch/arm/boot/dts/allwinner/sun8i-b288.dtsi | 304 ++++++++++++++++++ arch/arm/mach-sunxi/sunxi.c | 1 + 4 files changed, 428 insertions(+)create mode 100644
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dtscreate mode 100644arch/arm/boot/dts/allwinner/sun8i-b288.dtsiarch/arm/boot/dts/allwinner/Makefile +1
-0@@ -227,6 +227,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \ sun8i-a83t-bananapi-m3.dtb \ sun8i-a83t-cubietruck-plus.dtb \ sun8i-a83t-tbs-a711.dtb \ + sun8i-b288-pocketbook-verse.dtb \ sun8i-h2-plus-bananapi-m2-zero.dtb \ sun8i-h2-plus-libretech-all-h3-cc.dtb \ sun8i-h2-plus-orangepi-r1.dtb \arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts new file +13
-0@@ -0,0 +1,122 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * PocketBook Verse (PB629), an Allwinner B288 based e-reader. + */ + +/dts-v1/; +#include "sun8i-b288.dtsi" + +#include <dt-bindings/gpio/gpio.h> + +/ { + model = "PocketBook Verse"; + compatible = "pocketbook,verse", "allwinner,sun8i-b288";arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts line 23
Quoted 10 lines
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts new file +10
-0+ + aliases { + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory@40000000 {We typically don't hardcode memory nodes in the DT, but leave this up to the bootloader to populate, based on either detection or hard-coding *there*.
I guess this eBook reader only comes in this one configuration? Maybe we could allow this node in here, then, to increase compatiblity? Depends a bit on how involved this boot0 setup is, I guess.arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts line 36
Quoted 13 lines
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts new file +13
-0+ device_type = "memory"; + reg = <0x40000000 0x20000000>; + }; +}; + +&uart0 { + status = "okay"; +}; + +&mmc0 { + vmmc-supply = <®_dldo2>; + bus-width = <4>; + cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */I guess this is microSD, so without a write-protection switch? Then please add the "disable-wp;" property.
Also this is missing the pinctrl properties, to describe the pinmux used. As you describe the PortB UART0 pins in the .dtsi, just reference them here.And are you sure the vmmc-supply is dldo2? Does the VCC pin on the SD card slot go to 0V when you turn that regulator off?
Just asking because on this generation of devices we most often see DCDC1 supplying the SD card, as it needs to be powered at reset time, to allow the BROM reading from the SD card.arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts line 42
Quoted 6 lines
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts new file +6
-0+ status = "okay"; +}; + +&mmc3 { + vmmc-supply = <®_dcdc1>; + vqmmc-supply = <®_dldo1>;If this is a 1.8V eMMC, then please add the 1.8V properties:
mmc-ddr-1_8v; mmc-hs200-1_8v;(given that these modes work).
And again the pinctrl nodes are missing.Quoted 7 lines
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts new file +7
-0+ bus-width = <8>; + non-removable; + cap-mmc-hw-reset; + status = "okay"; +}; + +&pio {arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts line 59
Quoted 10 lines
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts new file +10
-0+ vcc-pc-supply = <®_dldo1>; + vcc-pd-supply = <®_dldo1>; + /* + * PC and PD are named in the vendor rail list; PF is not. It is not + * on dldo2: with that rail off, a pull-up on PF6 still reads card + * detect correctly, so the bank has its own supply. dcdc1 is the + * only remaining candidate, carrying vcc-io and vcc-card. Derived + * from the rail naming plus that measurement, not from a schematic. + */ + vcc-pf-supply = <®_dcdc1>;Yes, on older SoCs PortF is internally powered by the VCC-IO pin, and is fixed at 3.3V. Compare the datasheets from the A64 and H3, for instance. And VCC-IO is traditionally powered by DCDC1, since it needs the most juice. In any case, I think we don't need the comment, since it's a common setup.
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts line 65
Quoted 6 lines
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts new file +6
-0+}; + +&i2c0 { + status = "okay"; + + axp22x: pmic@34 {Can you add a comment here that this is labelled as AXP227?
Quoted 36 lines
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts new file +36
-0+ compatible = "x-powers,axp221"; + reg = <0x34>; + interrupt-parent = <&nmi_intc>; + interrupts = <0 IRQ_TYPE_LEVEL_LOW>; + }; +}; + +#include "axp22x.dtsi" + +®_dcdc1 { + regulator-always-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-name = "vcc-io"; +}; + +®_dcdc2 { + regulator-always-on; + regulator-min-microvolt = <1260000>; + regulator-max-microvolt = <1260000>; + regulator-name = "vdd-cpu"; +}; + +®_dcdc4 { + regulator-always-on; + regulator-min-microvolt = <1100000>; + regulator-max-microvolt = <1100000>; + regulator-name = "vdd-sys"; +}; + +®_dcdc5 { + regulator-always-on; + regulator-min-microvolt = <1350000>; + regulator-max-microvolt = <1350000>; + regulator-name = "vcc-dram"; +};arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts line 111
Quoted 10 lines
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts new file +10
-0+ +®_aldo3 { + regulator-always-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-name = "avcc"; +}; + +®_dldo1 { + regulator-always-on;Do you really need the always-on here?
Does it power more than the eMMC? Can you boot from SD card and use the system with that property removed, and the kernel turning it off?arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts line 118
Quoted 7 lines
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts new file +7
-0+ regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcc-pc"; +}; + +®_dldo2 { + /* Powers the microSD slot (slot pin 4), switched per card scan. */What does "switched per card scan" mean?
And it's rather uncommon to see the SD card powered by a separate PMIC line, since it needs to be on at reset, to allow the BROM to access it. According to the AXP221 datasheet, dldo2 is off at reset, so can you please somehow check this? It might be different on the AXP227, but worth a try, I think.Quoted 18 lines
arch/arm/boot/dts/allwinner/sun8i-b288-pocketbook-verse.dts new file +4
-0+ regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc-sdcv"; +};arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +8
-0@@ -0,0 +1,304 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Allwinner B288 (sun8iw10p1) SoC + * + * Addresses and interrupts come from the PocketBook Verse (PB629) vendor + * device tree, cross-checked against the BSP clk-sun8iw10.c. + */ +arch/arm/boot/dts/allwinner/sun8i-b288.dtsi line 18
Quoted 10 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +10
-0+#include <dt-bindings/interrupt-controller/arm-gic.h> +#include <dt-bindings/clock/sun8i-b288-ccu.h> +#include <dt-bindings/reset/sun8i-b288-ccu.h> + +/ { + #address-cells = <1>; + #size-cells = <1>; + interrupt-parent = <&gic>; + + clocks {I don't think we put the crystals in their own node anymore. I see that we did this for the 32-bit Allwinner SoCs, but it's pointless.
Quoted 25 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +25
-0+ osc24M: osc24M-clk { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-frequency = <24000000>; + clock-output-names = "osc24M"; + }; + + osc32k: osc32k-clk { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-frequency = <32768>; + clock-output-names = "osc32k"; + }; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu0: cpu@0 { + compatible = "arm,cortex-a7"; + device_type = "cpu"; + reg = <0>; + clocks = <&ccu CLK_CPUX>; + clock-names = "cpu";arch/arm/boot/dts/allwinner/sun8i-b288.dtsi line 53
Quoted 10 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +10
-0+ }; + + cpu1: cpu@1 { + compatible = "arm,cortex-a7"; + device_type = "cpu"; + reg = <1>; + clocks = <&ccu CLK_CPUX>; + clock-names = "cpu"; + }; + };So how does SMP work here, exactly? For the later 32-bit SoCs, we rely on a PSCI implmenetation in U-Boot, and I would strongly recommend doing so here as well.
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi line 62
Quoted 9 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +9
-0+ + timer { + compatible = "arm,armv7-timer"; + interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>, + <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>, + <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>, + <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>; + clock-frequency = <24000000>; + arm,cpu-registers-not-fw-configured;Meh, as the comments in the binding say: please fix your firmware ;-) I am not completely against it if boot0 is the firmware to use for a while, but if we go with U-Boot, it would be nicely fixed there.
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi
Quoted 11 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +11
-0+ }; + + soc { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + /* + * mmc0 is a v4p1x controller, so it runs in the old timing + * mode and needs the sample and output phase clocks.I think the comment can end here.
But it would need to be moved below, above the actual mmc0 node.Quoted 23 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +22
-0Do not + * give it the sun50i-a64-mmc fallback: that selects the new + * timing mode, which this block does not implement. + */ + nmi_intc: interrupt-controller@1c000d0 { + compatible = "allwinner,sun8i-b288-nmi", + "allwinner,sun9i-a80-nmi"; + interrupt-controller; + #interrupt-cells = <2>; + reg = <0x01c000d0 0x0c>; + interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>; + }; + + mmc0: mmc@1c0f000 { + compatible = "allwinner,sun8i-b288-mmc", + "allwinner,sun7i-a20-mmc"; + reg = <0x01c0f000 0x1000>; + clocks = <&ccu CLK_BUS_SDMMC0_BUS>, + <&ccu CLK_MMC0>, + <&ccu CLK_MMC0_OUTPUT>, + <&ccu CLK_MMC0_SAMPLE>; + clock-names = "ahb", "mmc", "output", "sample"; + resets = <&ccu RST_BUS_MMC0>;arch/arm/boot/dts/allwinner/sun8i-b288.dtsi line 105
Quoted 10 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +10
-0+ reset-names = "ahb"; + interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&mmc0_pins>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <0>; + }; + + /* SDXC v4.5. The soldered eMMC; shares the PC pads with mmc2. */This comment should go. Pinmuxing is described separately, and "the soldered eMMC" does not belong into a .dtsi file, since it's board specific. If you really want to document some of your findings, you can do so in the commit message.
Quoted 12 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +12
-0+ mmc3: mmc@1c12000 { + compatible = "allwinner,sun8i-b288-emmc", + "allwinner,sun50i-a64-emmc"; + reg = <0x01c12000 0x1000>; + clocks = <&ccu CLK_BUS_SDMMC3_BUS>, <&ccu CLK_MMC3>; + clock-names = "ahb", "mmc"; + resets = <&ccu RST_BUS_MMC3>; + reset-names = "ahb"; + interrupts = <GIC_SPI 63 IRQ_TYPE_LEVEL_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&mmc3_pins>; + status = "disabled";arch/arm/boot/dts/allwinner/sun8i-b288.dtsi line 127
Quoted 10 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +10
-0+ #address-cells = <1>; + #size-cells = <0>; + }; + + /* + * mmc2 (0x01c11000) is an SDHCI-style controller, not SDXC, and + * has no upstream binding. It loses the PC pad arbitration to + * mmc3 and is unused here, so it is left undescribed rather than + * given a wrong compatible. + */You can shorten the comment to:
"mc2 @0x01c11000 is an unsupported SDHCI-style controller."Quoted 27 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +27
-0+ + ccu: clock-controller@1c20000 { + compatible = "allwinner,sun8i-b288-ccu"; + reg = <0x01c20000 0x400>; + clocks = <&osc24M>, <&osc32k>; + clock-names = "hosc", "losc"; + #clock-cells = <1>; + #reset-cells = <1>; + }; + + rtc: rtc@1c20400 { + compatible = "allwinner,sun8i-b288-rtc"; + reg = <0x01c20400 0x400>; + interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>; + clock-output-names = "osc32k"; + clocks = <&osc32k>; + #clock-cells = <1>; + }; + + pio: pinctrl@1c20800 { + compatible = "allwinner,sun8i-b288-pinctrl"; + reg = <0x01c20800 0x400>; + interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&ccu CLK_BUS_PIO>, <&osc24M>, <&osc32k>;arch/arm/boot/dts/allwinner/sun8i-b288.dtsi line 164
Quoted 10 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +10
-0+ clock-names = "apb", "hosc", "losc"; + gpio-controller; + #gpio-cells = <3>; + interrupt-controller; + #interrupt-cells = <3>; + + mmc0_pins: mmc0-pins { + pins = "PF0", "PF1", "PF2", + "PF3", "PF4", "PF5"; + function = "sdc0";We do not use the BSP function naming, but "mmc0" instead.
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi line 172
Quoted 8 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +8
-0+ allwinner,pinmux = <2>; + drive-strength = <30>; + bias-pull-up; + }; + + i2c0_pins: i2c0-pins { + pins = "PB6", "PB7"; + function = "twi0";Same here, "i2c0" please.
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi line 180
Quoted 8 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +8
-0+ allwinner,pinmux = <2>; + }; + + mmc3_pins: mmc3-pins { + pins = "PC1", "PC4", "PC5", "PC6", + "PC7", "PC8", "PC9", "PC10", + "PC11", "PC12", "PC13", "PC14"; + function = "sdc3";function = "mmc3";
Quoted 4 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +4
-0+ allwinner,pinmux = <5>; + drive-strength = <40>; + bias-pull-up; + };arch/arm/boot/dts/allwinner/sun8i-b288.dtsi line 194
Quoted 10 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +10
-0+ + uart0_pb_pins: uart0-pb-pins { + pins = "PB4", "PB5"; + function = "uart0"; + allwinner,pinmux = <2>; + }; + }; + + wdt: watchdog@1c20ca0 { + compatible = "allwinner,sun6i-a31-wdt";I think lately we used this as a fallback, paired with a SoC specific compatible first.
In many aspects the more recent DTs under thearch/arm64directory are more modern and a better source to copy from.Quoted 115 lines
arch/arm/boot/dts/allwinner/sun8i-b288.dtsi new file +110
-0+ reg = <0x01c20ca0 0x20>; + interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&osc24M>; + }; + + uart0: serial@1c28000 { + compatible = "snps,dw-apb-uart"; + reg = <0x01c28000 0x400>; + interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>; + reg-shift = <2>; + reg-io-width = <4>; + clocks = <&ccu CLK_BUS_UART0>; + resets = <&ccu RST_BUS_UART0>; + status = "disabled"; + }; + + uart1: serial@1c28400 { + compatible = "snps,dw-apb-uart"; + reg = <0x01c28400 0x400>; + interrupts = <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>; + reg-shift = <2>; + reg-io-width = <4>; + clocks = <&ccu CLK_BUS_UART1>; + resets = <&ccu RST_BUS_UART1>; + status = "disabled"; + }; + + uart2: serial@1c28800 { + compatible = "snps,dw-apb-uart"; + reg = <0x01c28800 0x400>; + interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>; + reg-shift = <2>; + reg-io-width = <4>; + clocks = <&ccu CLK_BUS_UART2>; + resets = <&ccu RST_BUS_UART2>; + status = "disabled"; + }; + + uart3: serial@1c28c00 { + compatible = "snps,dw-apb-uart"; + reg = <0x01c28c00 0x400>; + interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>; + reg-shift = <2>; + reg-io-width = <4>; + clocks = <&ccu CLK_BUS_UART3>; + resets = <&ccu RST_BUS_UART3>; + status = "disabled"; + }; + + uart4: serial@1c29000 { + compatible = "snps,dw-apb-uart"; + reg = <0x01c29000 0x400>; + interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>; + reg-shift = <2>; + reg-io-width = <4>; + clocks = <&ccu CLK_BUS_UART4>; + resets = <&ccu RST_BUS_UART4>; + status = "disabled"; + }; + + i2c0: i2c@1c2ac00 { + compatible = "allwinner,sun8i-b288-i2c", + "allwinner,sun6i-a31-i2c"; + reg = <0x01c2ac00 0x400>; + interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&ccu CLK_BUS_TWI0>; + resets = <&ccu RST_BUS_I2C0>; + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_pins>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <0>; + }; + + i2c1: i2c@1c2b000 { + compatible = "allwinner,sun8i-b288-i2c", + "allwinner,sun6i-a31-i2c"; + reg = <0x01c2b000 0x400>; + interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&ccu CLK_BUS_TWI1>; + resets = <&ccu RST_BUS_I2C1>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <0>; + }; + + i2c2: i2c@1c2b400 { + compatible = "allwinner,sun8i-b288-i2c", + "allwinner,sun6i-a31-i2c"; + reg = <0x01c2b400 0x400>; + interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&ccu CLK_BUS_TWI2>; + resets = <&ccu RST_BUS_I2C2>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <0>; + }; + + gic: interrupt-controller@1c81000 { + compatible = "arm,gic-400"; + reg = <0x01c81000 0x1000>, + <0x01c82000 0x2000>, + <0x01c84000 0x2000>, + <0x01c86000 0x2000>; + interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_HIGH)>; + interrupt-controller; + #interrupt-cells = <3>; + }; + }; +};arch/arm/mach-sunxi/sunxi.c +0
-0arch/arm/mach-sunxi/sunxi.c MACHINE_END · line 64
Quoted 4 lines
arch/arm/mach-sunxi/sunxi.c +1
-0@@ -61,6 +61,7 @@ MACHINE_ENDstatic const char *const sun8i_board_dt_compat[] = {"allwinner,sun8i-a23" ,"allwinner,sun8i-a33" , +"allwinner,sun8i-b288" ,Do we really need that entry? Or at least do we need the timer init part of that?
And in any case it doesn't belong into the DT patch, as it's Linux code, not DT or binding related.Cheers,
AndreQuoted 3 lines
arch/arm/mach-sunxi/sunxi.c +0
-0"allwinner,sun8i-h2-plus" ,"allwinner,sun8i-h3" , "allwinner,sun8i-r40",