mbox series

[0/8] riscv: spacemit: k1: add clock reset drivers, switch to upstream DT

Message ID 20260510-b4-k1-clk-reset-upstream-dts-v1-0-db0b0503ee44@riscstar.com
Headers show
Series riscv: spacemit: k1: add clock reset drivers, switch to upstream DT | expand

Message

Guodong Xu May 10, 2026, 12:06 p.m. UTC
Currently U-Boot's SpacemiT K1 ships its own arch/riscv/dts/k1.dtsi and a
spacemit,k1-reset binding that has no node in the upstream
(kernel-mainline) K1 dts. After list discussion [1], this series
moves U-Boot to the upstream DT before further K1 work lands.

In the upstream DT, each K1 syscon provides both clocks and resets.
The kernel's clock driver spawns the reset child via the auxiliary
bus. This patchset does the same in U-Boot: each clock driver
spawns a UCLASS_RESET sibling on the same ofnode.

Patch 1/8 adds the K1 clock driver.
Patch 2/8 adds a new syscon-bound reset driver with no DT of_match. At this
          point, the legacy reset driver and local dts are still there.
Patch 3/8 has each per-syscon clock driver spawn the reset child on the
          same ofnode, the way the kernel uses auxiliary devices.
Patch 4/8 enables the clock driver.
Patch 5/8 switches BPI-F3 to dts/upstream/.
Patch 6/8, 7/8 and 8/8 clean up the legacy reset driver and local dts files.

Old and new reset drivers coexist from 2/8 through 6/8 so the series
is bisectable.

The K1 SPL bring-up [2] and PIN/SPI [3] series will be rebased on
this and resent once it lands.

Link: https://lore.kernel.org/u-boot/20260507140558.GU1614990@bill-the-cat/ [1]
Link: https://lore.kernel.org/u-boot/20260325223232.1553212-1-raymondmaoca@gmail.com/ [2]
Link: https://lore.kernel.org/u-boot/20260422143112.1329478-1-raymondmaoca@gmail.com/ [3]

Signed-off-by: Guodong Xu <guodong@riscstar.com>
---
Guodong Xu (7):
      reset: spacemit: k1: introduce syscon-bound reset driver
      clk: spacemit: k1: spawn reset device from per-syscon clock drivers
      configs: bananapi-f3: enable Spacemit K1 clock driver
      dts: k1: switch BPI-F3 build to upstream DT
      dts: k1: drop legacy local DT files
      reset: spacemit: k1: drop legacy spacemit,k1-reset driver
      dt-bindings: reset: drop spacemit-k1-reset.h

Junhui Liu (1):
      clk: spacemit: Add support for K1 SoC

 arch/riscv/dts/Makefile                       |    1 -
 arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi     |   30 +
 arch/riscv/dts/k1-bananapi-f3.dts             |   28 -
 arch/riscv/dts/k1-pinctrl.dtsi                |   19 -
 arch/riscv/dts/k1.dtsi                        |  480 -------
 configs/bananapi-f3_defconfig                 |    6 +-
 drivers/clk/Kconfig                           |    5 +-
 drivers/clk/Makefile                          |    1 +
 drivers/clk/spacemit/Kconfig                  |   23 +
 drivers/clk/spacemit/Makefile                 |    7 +
 drivers/clk/spacemit/clk-k1.c                 | 1759 +++++++++++++++++++++++++
 drivers/clk/spacemit/clk_common.h             |   79 ++
 drivers/clk/spacemit/clk_ddn.c                |   93 ++
 drivers/clk/spacemit/clk_ddn.h                |   53 +
 drivers/clk/spacemit/clk_mix.c                |  403 ++++++
 drivers/clk/spacemit/clk_mix.h                |  224 ++++
 drivers/clk/spacemit/clk_pll.c                |  157 +++
 drivers/clk/spacemit/clk_pll.h                |   81 ++
 drivers/reset/Kconfig                         |    7 -
 drivers/reset/Makefile                        |    2 +-
 drivers/reset/reset-spacemit-k1.c             |  548 --------
 drivers/reset/spacemit/Makefile               |    5 +
 drivers/reset/spacemit/reset-spacemit-k1.c    |  289 ++++
 include/dt-bindings/reset/spacemit-k1-reset.h |  118 --
 include/soc/spacemit/k1-reset.h               |   23 +
 include/soc/spacemit/k1-syscon.h              |  149 +++
 26 files changed, 3384 insertions(+), 1206 deletions(-)
---
base-commit: 24db98cdf911b6ca362209e674bf9412441c1095
change-id: 20260510-b4-k1-clk-reset-upstream-dts-cbf1f3a79cfb

Best regards,
--  
Guodong Xu <guodong@riscstar.com>

Comments

Vincent Legoll May 10, 2026, 7:44 p.m. UTC | #1
Hello Guodong Xu,

On 5/10/26 14:06, Guodong Xu wrote:
> Currently U-Boot's SpacemiT K1 ships its own arch/riscv/dts/k1.dtsi and a
> spacemit,k1-reset binding that has no node in the upstream
> (kernel-mainline) K1 dts. After list discussion [1], this series
> moves U-Boot to the upstream DT before further K1 work lands.
>
> In the upstream DT, each K1 syscon provides both clocks and resets.
> The kernel's clock driver spawns the reset child via the auxiliary
> bus. This patchset does the same in U-Boot: each clock driver
> spawns a UCLASS_RESET sibling on the same ofnode.
>
> Patch 1/8 adds the K1 clock driver.
> Patch 2/8 adds a new syscon-bound reset driver with no DT of_match. At this
>            point, the legacy reset driver and local dts are still there.
> Patch 3/8 has each per-syscon clock driver spawn the reset child on the
>            same ofnode, the way the kernel uses auxiliary devices.
> Patch 4/8 enables the clock driver.
> Patch 5/8 switches BPI-F3 to dts/upstream/.
> Patch 6/8, 7/8 and 8/8 clean up the legacy reset driver and local dts files.
>
> Old and new reset drivers coexist from 2/8 through 6/8 so the series
> is bisectable.
>
> The K1 SPL bring-up [2] and PIN/SPI [3] series will be rebased on
> this and resent once it lands.
>
> Link: https://lore.kernel.org/u-boot/20260507140558.GU1614990@bill-the-cat/ [1]
> Link: https://lore.kernel.org/u-boot/20260325223232.1553212-1-raymondmaoca@gmail.com/ [2]
> Link: https://lore.kernel.org/u-boot/20260422143112.1329478-1-raymondmaoca@gmail.com/ [3]
>
> [...]
>
> ---
> base-commit: 24db98cdf911b6ca362209e674bf9412441c1095
> change-id: 20260510-b4-k1-clk-reset-upstream-dts-cbf1f3a79cfb


I tried to apply this locally but failed:

$ git log --oneline -1
24db98cdf91 (HEAD -> test) Merge tag 'u-boot-imx-next-20260318' of 
https://gitlab.denx.de/u-boot/custodians/u-boot-imx into next

$ git status
On branch test
nothing to commit, working tree clean

$ wget 
https://lore.kernel.org/u-boot/20260510-b4-k1-clk-reset-upstream-dts-v1-0-db0b0503ee44@riscstar.com/t.mbox.gz 
\

  -O ~/Downloads/PATCH-0-8-riscv-spacemit-k1-add-clock-reset-drivers-switch-to-upstream-DT.mbox.gz


$ gzip -dc 
~/Downloads/PATCH-0-8-riscv-spacemit-k1-add-clock-reset-drivers-switch-to-upstream-DT.mbox.gz 
| git am
Applying: riscv: spacemit: k1: add clock reset drivers, switch to 
upstream DT
error: No valid patches in input (allow with "--allow-empty")
Patch failed at 0001 riscv: spacemit: k1: add clock reset drivers, 
switch to upstream DT
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am 
--abort".
hint: Disable this message with "git config set advice.mergeConflict false"

I had a similar failure with the mbox downloaded with:

$ b4 mbox 
https://lore.kernel.org/u-boot/20260510-b4-k1-clk-reset-upstream-dts-v1-0-db0b0503ee44@riscstar.com/T/#t


I also tried to apply to master branch without success

Is there something I'm doing wrong ?

Regards
Yao Zi May 11, 2026, 4:52 a.m. UTC | #2
On Sun, May 10, 2026 at 09:44:14PM +0200, Vincent Legoll wrote:
> Hello Guodong Xu,
> 
> On 5/10/26 14:06, Guodong Xu wrote:
> > Currently U-Boot's SpacemiT K1 ships its own arch/riscv/dts/k1.dtsi and a
> > spacemit,k1-reset binding that has no node in the upstream
> > (kernel-mainline) K1 dts. After list discussion [1], this series
> > moves U-Boot to the upstream DT before further K1 work lands.
> > 
> > In the upstream DT, each K1 syscon provides both clocks and resets.
> > The kernel's clock driver spawns the reset child via the auxiliary
> > bus. This patchset does the same in U-Boot: each clock driver
> > spawns a UCLASS_RESET sibling on the same ofnode.
> > 
> > Patch 1/8 adds the K1 clock driver.
> > Patch 2/8 adds a new syscon-bound reset driver with no DT of_match. At this
> >            point, the legacy reset driver and local dts are still there.
> > Patch 3/8 has each per-syscon clock driver spawn the reset child on the
> >            same ofnode, the way the kernel uses auxiliary devices.
> > Patch 4/8 enables the clock driver.
> > Patch 5/8 switches BPI-F3 to dts/upstream/.
> > Patch 6/8, 7/8 and 8/8 clean up the legacy reset driver and local dts files.
> > 
> > Old and new reset drivers coexist from 2/8 through 6/8 so the series
> > is bisectable.
> > 
> > The K1 SPL bring-up [2] and PIN/SPI [3] series will be rebased on
> > this and resent once it lands.
> > 
> > Link: https://lore.kernel.org/u-boot/20260507140558.GU1614990@bill-the-cat/ [1]
> > Link: https://lore.kernel.org/u-boot/20260325223232.1553212-1-raymondmaoca@gmail.com/ [2]
> > Link: https://lore.kernel.org/u-boot/20260422143112.1329478-1-raymondmaoca@gmail.com/ [3]
> > 
> > [...]
> > 
> > ---
> > base-commit: 24db98cdf911b6ca362209e674bf9412441c1095
> > change-id: 20260510-b4-k1-clk-reset-upstream-dts-cbf1f3a79cfb
> 
> 
> I tried to apply this locally but failed:
> 
> $ git log --oneline -1
> 24db98cdf91 (HEAD -> test) Merge tag 'u-boot-imx-next-20260318' of
> https://gitlab.denx.de/u-boot/custodians/u-boot-imx into next
> 
> $ git status
> On branch test
> nothing to commit, working tree clean
> 
> $ wget https://lore.kernel.org/u-boot/20260510-b4-k1-clk-reset-upstream-dts-v1-0-db0b0503ee44@riscstar.com/t.mbox.gz
> \
> 
>  -O ~/Downloads/PATCH-0-8-riscv-spacemit-k1-add-clock-reset-drivers-switch-to-upstream-DT.mbox.gz
> 
> 
> $ gzip -dc ~/Downloads/PATCH-0-8-riscv-spacemit-k1-add-clock-reset-drivers-switch-to-upstream-DT.mbox.gz
> | git am
> Applying: riscv: spacemit: k1: add clock reset drivers, switch to upstream
> DT
> error: No valid patches in input (allow with "--allow-empty")
> Patch failed at 0001 riscv: spacemit: k1: add clock reset drivers, switch to
> upstream DT
> hint: Use 'git am --show-current-patch=diff' to see the failed patch
> hint: When you have resolved this problem, run "git am --continue".
> hint: If you prefer to skip this patch, run "git am --skip" instead.
> hint: To restore the original branch and stop patching, run "git am
> --abort".
> hint: Disable this message with "git config set advice.mergeConflict false"
> 
> I had a similar failure with the mbox downloaded with:

Because the first mail in the mbox file is the cover letter, not a real
patch, thus contains no code changes and couldn't be applied by default.

Try

	b4 shazam 20260510-b4-k1-clk-reset-upstream-dts-v1-0-db0b0503ee44@riscstar.com

instead, which applies the series cleanly at least on my side. With
git am you might skip application of the first mail manually by

	git am --skip

and continue with rest of the series.

> $ b4 mbox https://lore.kernel.org/u-boot/20260510-b4-k1-clk-reset-upstream-dts-v1-0-db0b0503ee44@riscstar.com/T/#t
> 
> 
> I also tried to apply to master branch without success
> 
> Is there something I'm doing wrong ?
> 
> Regards
> 

Regards,
Yao Zi
Vincent Legoll May 11, 2026, 6:51 a.m. UTC | #3
Hello,

I was sure it was something silly...


On 5/11/26 06:52, Yao Zi wrote:
> b4 shazam20260510-b4-k1-clk-reset-upstream-dts-v1-0-db0b0503ee44@riscstar.com


That's my first use of b4 tool, so not really up to speed with it, 
thanks for the right incantation, this works.

I'll report my testing, this evening (CET).