mbox series

[v2,00/17] Basic StarFive JH7110 RISC-V SoC support

Message ID 20230118081132.31403-1-yanhong.wang@starfivetech.com
Headers show
Series Basic StarFive JH7110 RISC-V SoC support | expand

Message

Yanhong Wang Jan. 18, 2023, 8:11 a.m. UTC
This series of patches base on the latest branch/master, and add support
for the StarFive JH7110 RISC-V SoC and VisionFive V2 board. In order for
this to be achieved, the respective DT nodes have been added,  and the
required defconfigs have been added to the boards' defconfig. What is more,
the basic required DM drivers have been added, such as reset, clock, pinctrl,
uart, ram etc.

Note that the register base address of reset controller is same with the
clock controller. Therefore, there is no device tree node alone for reset
driver. It binds device node in the clock driver.

The u-boot-spl and u-boot has been tested on the VisionFive V2 boards which
equip with JH7110 SoC and works normally.

For more information and support, you can visit RVspace wiki[1].

[1] https://wiki.rvspace.org/

Changes in v2:
- Renamed file 'jh7110-regs.h' to 'regs.h'.
- Reworded the clear L2 LIM memory code in C.
- Removed flash init call in 'spl_soc_init' function.
- Reworded the clock driver.
- Rename the macro 'SET_DIV' to 'ASSIGNED_CLOCK_PARENTS' in 'spl.c'.
- Moved the device tree node 'dmc@15700000' from 'jh7110-u-boot.dtsi' to
  'starfive_visionfive2-u-boot.dtsi'.

Previous versions:
v1 - https://patchwork.ozlabs.org/project/uboot/cover/20221212025020.23778-1-yanhong.wang@starfivetech.com/

Jianlong Huang (1):
  dt-bindings: pinctrl: Add StarFive JH7110 pinctrl definitions

Kuan Lim Lee (1):
  pinctrl: starfive: Add StarFive JH7110 driver

Yanhong Wang (15):
  riscv: cpu: jh7110: Add support for jh7110 SoC
  cache: starfive: Add StarFive JH7110 support
  dt-bindings: reset: Add StarFive JH7110 reset definitions
  reset: starfive: jh7110: Add reset driver for StarFive JH7110 SoC
  dt-bindings: clock: Add StarFive JH7110 clock definitions
  clk: starfive: Add StarFive JH7110 clock driver
  ram: starfive: add ddr driver
  board: starfive: add StarFive VisionFive v2 board support
  riscv: cpu: jh7110: Add Kconfig for StarFive JH7110 SoC
  board: starfive: Add Kconfig for StarFive VisionFive v2 Board
  board: starfive: Add TARGET_STARFIVE_VISIONFIVE2 to Kconfig
  riscv: dts: jh7110: Add initial StarFive JH7110 device tree
  riscv: dts: jh7110: Add initial u-boot device tree
  riscv: dts: jh7110: Add initial StarFive VisionFive v2 board device
    tree
  configs: starfive: add starfive_visionfive2_defconfig

 arch/riscv/Kconfig                            |    5 +
 arch/riscv/cpu/jh7110/Kconfig                 |   28 +
 arch/riscv/cpu/jh7110/Makefile                |   10 +
 arch/riscv/cpu/jh7110/cpu.c                   |   23 +
 arch/riscv/cpu/jh7110/dram.c                  |   38 +
 arch/riscv/cpu/jh7110/spl.c                   |   64 +
 arch/riscv/dts/Makefile                       |    2 +-
 arch/riscv/dts/jh7110-u-boot.dtsi             |   72 +
 arch/riscv/dts/jh7110.dtsi                    |  497 +++++
 .../dts/starfive_visionfive2-u-boot.dtsi      |   84 +
 arch/riscv/dts/starfive_visionfive2.dts       |  234 ++
 arch/riscv/include/asm/arch-jh7110/regs.h     |   19 +
 arch/riscv/include/asm/arch-jh7110/spl.h      |   12 +
 board/starfive/visionfive2/Kconfig            |   53 +
 board/starfive/visionfive2/MAINTAINERS        |    7 +
 board/starfive/visionfive2/Makefile           |    7 +
 board/starfive/visionfive2/spl.c              |  118 +
 .../visionfive2/starfive_visionfive2.c        |   38 +
 configs/starfive_visionfive2_defconfig        |   72 +
 drivers/cache/cache-sifive-ccache.c           |    1 +
 drivers/clk/Kconfig                           |    1 +
 drivers/clk/Makefile                          |    1 +
 drivers/clk/starfive/Kconfig                  |   17 +
 drivers/clk/starfive/Makefile                 |    4 +
 drivers/clk/starfive/clk-jh7110-pll.c         |  293 +++
 drivers/clk/starfive/clk-jh7110.c             |  559 +++++
 drivers/clk/starfive/clk.h                    |   60 +
 drivers/pinctrl/Kconfig                       |    1 +
 drivers/pinctrl/Makefile                      |    1 +
 drivers/pinctrl/starfive/Kconfig              |   16 +
 drivers/pinctrl/starfive/Makefile             |    6 +
 drivers/pinctrl/starfive/pinctrl-jh7110-aon.c |  113 +
 drivers/pinctrl/starfive/pinctrl-jh7110-sys.c |  399 ++++
 drivers/pinctrl/starfive/pinctrl-starfive.c   |  428 ++++
 drivers/pinctrl/starfive/pinctrl-starfive.h   |   55 +
 drivers/ram/Kconfig                           |    1 +
 drivers/ram/Makefile                          |    4 +-
 drivers/ram/starfive/Kconfig                  |    5 +
 drivers/ram/starfive/Makefile                 |   11 +
 drivers/ram/starfive/ddrcsr_boot.c            |  339 +++
 drivers/ram/starfive/ddrphy_start.c           |  279 +++
 drivers/ram/starfive/ddrphy_train.c           |  383 ++++
 drivers/ram/starfive/ddrphy_utils.c           | 1955 +++++++++++++++++
 drivers/ram/starfive/starfive_ddr.c           |  161 ++
 drivers/ram/starfive/starfive_ddr.h           |   65 +
 drivers/reset/Kconfig                         |   16 +
 drivers/reset/Makefile                        |    1 +
 drivers/reset/reset-jh7110.c                  |  158 ++
 include/configs/starfive-visionfive2.h        |   18 +
 include/dt-bindings/clock/starfive-jh7110.h   |  271 +++
 .../pinctrl/pinctrl-starfive-jh7110.h         |  427 ++++
 include/dt-bindings/reset/starfive-jh7110.h   |  183 ++
 52 files changed, 7613 insertions(+), 2 deletions(-)
 create mode 100644 arch/riscv/cpu/jh7110/Kconfig
 create mode 100644 arch/riscv/cpu/jh7110/Makefile
 create mode 100644 arch/riscv/cpu/jh7110/cpu.c
 create mode 100644 arch/riscv/cpu/jh7110/dram.c
 create mode 100644 arch/riscv/cpu/jh7110/spl.c
 create mode 100644 arch/riscv/dts/jh7110-u-boot.dtsi
 create mode 100644 arch/riscv/dts/jh7110.dtsi
 create mode 100644 arch/riscv/dts/starfive_visionfive2-u-boot.dtsi
 create mode 100644 arch/riscv/dts/starfive_visionfive2.dts
 create mode 100644 arch/riscv/include/asm/arch-jh7110/regs.h
 create mode 100644 arch/riscv/include/asm/arch-jh7110/spl.h
 create mode 100644 board/starfive/visionfive2/Kconfig
 create mode 100644 board/starfive/visionfive2/MAINTAINERS
 create mode 100644 board/starfive/visionfive2/Makefile
 create mode 100644 board/starfive/visionfive2/spl.c
 create mode 100644 board/starfive/visionfive2/starfive_visionfive2.c
 create mode 100644 configs/starfive_visionfive2_defconfig
 create mode 100644 drivers/clk/starfive/Kconfig
 create mode 100644 drivers/clk/starfive/Makefile
 create mode 100644 drivers/clk/starfive/clk-jh7110-pll.c
 create mode 100644 drivers/clk/starfive/clk-jh7110.c
 create mode 100644 drivers/clk/starfive/clk.h
 create mode 100644 drivers/pinctrl/starfive/Kconfig
 create mode 100644 drivers/pinctrl/starfive/Makefile
 create mode 100644 drivers/pinctrl/starfive/pinctrl-jh7110-aon.c
 create mode 100644 drivers/pinctrl/starfive/pinctrl-jh7110-sys.c
 create mode 100644 drivers/pinctrl/starfive/pinctrl-starfive.c
 create mode 100644 drivers/pinctrl/starfive/pinctrl-starfive.h
 create mode 100644 drivers/ram/starfive/Kconfig
 create mode 100644 drivers/ram/starfive/Makefile
 create mode 100644 drivers/ram/starfive/ddrcsr_boot.c
 create mode 100644 drivers/ram/starfive/ddrphy_start.c
 create mode 100644 drivers/ram/starfive/ddrphy_train.c
 create mode 100644 drivers/ram/starfive/ddrphy_utils.c
 create mode 100644 drivers/ram/starfive/starfive_ddr.c
 create mode 100644 drivers/ram/starfive/starfive_ddr.h
 create mode 100644 drivers/reset/reset-jh7110.c
 create mode 100644 include/configs/starfive-visionfive2.h
 create mode 100644 include/dt-bindings/clock/starfive-jh7110.h
 create mode 100644 include/dt-bindings/pinctrl/pinctrl-starfive-jh7110.h
 create mode 100644 include/dt-bindings/reset/starfive-jh7110.h


base-commit: 348064ee2c8f9494b91b55729ac60c5db79ef129

Comments

Conor Dooley Jan. 21, 2023, 9:36 p.m. UTC | #1
On Wed, Jan 18, 2023 at 04:11:15PM +0800, Yanhong Wang wrote:
> This series of patches base on the latest branch/master, and add support
> for the StarFive JH7110 RISC-V SoC and VisionFive V2 board. In order for
> this to be achieved, the respective DT nodes have been added,  and the
> required defconfigs have been added to the boards' defconfig. What is more,
> the basic required DM drivers have been added, such as reset, clock, pinctrl,
> uart, ram etc.
> 
> Note that the register base address of reset controller is same with the
> clock controller. Therefore, there is no device tree node alone for reset
> driver. It binds device node in the clock driver.
> 
> The u-boot-spl and u-boot has been tested on the VisionFive V2 boards which
> equip with JH7110 SoC and works normally.
> 
> For more information and support, you can visit RVspace wiki[1].
> 
> [1] https://wiki.rvspace.org/
> 
> Changes in v2:
> - Renamed file 'jh7110-regs.h' to 'regs.h'.
> - Reworded the clear L2 LIM memory code in C.
> - Removed flash init call in 'spl_soc_init' function.
> - Reworded the clock driver.
> - Rename the macro 'SET_DIV' to 'ASSIGNED_CLOCK_PARENTS' in 'spl.c'.
> - Moved the device tree node 'dmc@15700000' from 'jh7110-u-boot.dtsi' to
>   'starfive_visionfive2-u-boot.dtsi'.
> 
> Previous versions:
> v1 - https://patchwork.ozlabs.org/project/uboot/cover/20221212025020.23778-1-yanhong.wang@starfivetech.com/
> 
> Jianlong Huang (1):
>   dt-bindings: pinctrl: Add StarFive JH7110 pinctrl definitions
> 
> Kuan Lim Lee (1):
>   pinctrl: starfive: Add StarFive JH7110 driver
> 
> Yanhong Wang (15):
>   riscv: cpu: jh7110: Add support for jh7110 SoC
>   cache: starfive: Add StarFive JH7110 support
>   dt-bindings: reset: Add StarFive JH7110 reset definitions
>   reset: starfive: jh7110: Add reset driver for StarFive JH7110 SoC
>   dt-bindings: clock: Add StarFive JH7110 clock definitions
>   clk: starfive: Add StarFive JH7110 clock driver
>   ram: starfive: add ddr driver
>   board: starfive: add StarFive VisionFive v2 board support
>   riscv: cpu: jh7110: Add Kconfig for StarFive JH7110 SoC
>   board: starfive: Add Kconfig for StarFive VisionFive v2 Board
>   board: starfive: Add TARGET_STARFIVE_VISIONFIVE2 to Kconfig
>   riscv: dts: jh7110: Add initial StarFive JH7110 device tree
>   riscv: dts: jh7110: Add initial u-boot device tree
>   riscv: dts: jh7110: Add initial StarFive VisionFive v2 board device
>     tree
>   configs: starfive: add starfive_visionfive2_defconfig

Apologies if I have missed it somewhere - but where is patch 12?
I don't see it on lore.kernel.org nor in my inbox :(

Thanks,
Conor.
Sean Anderson Jan. 21, 2023, 9:56 p.m. UTC | #2
On 1/21/23 16:36, Conor Dooley wrote:
> On Wed, Jan 18, 2023 at 04:11:15PM +0800, Yanhong Wang wrote:
>> This series of patches base on the latest branch/master, and add support
>> for the StarFive JH7110 RISC-V SoC and VisionFive V2 board. In order for
>> this to be achieved, the respective DT nodes have been added,  and the
>> required defconfigs have been added to the boards' defconfig. What is more,
>> the basic required DM drivers have been added, such as reset, clock, pinctrl,
>> uart, ram etc.
>>
>> Note that the register base address of reset controller is same with the
>> clock controller. Therefore, there is no device tree node alone for reset
>> driver. It binds device node in the clock driver.
>>
>> The u-boot-spl and u-boot has been tested on the VisionFive V2 boards which
>> equip with JH7110 SoC and works normally.
>>
>> For more information and support, you can visit RVspace wiki[1].
>>
>> [1] https://wiki.rvspace.org/
>>
>> Changes in v2:
>> - Renamed file 'jh7110-regs.h' to 'regs.h'.
>> - Reworded the clear L2 LIM memory code in C.
>> - Removed flash init call in 'spl_soc_init' function.
>> - Reworded the clock driver.
>> - Rename the macro 'SET_DIV' to 'ASSIGNED_CLOCK_PARENTS' in 'spl.c'.
>> - Moved the device tree node 'dmc@15700000' from 'jh7110-u-boot.dtsi' to
>>    'starfive_visionfive2-u-boot.dtsi'.
>>
>> Previous versions:
>> v1 - https://patchwork.ozlabs.org/project/uboot/cover/20221212025020.23778-1-yanhong.wang@starfivetech.com/
>>
>> Jianlong Huang (1):
>>    dt-bindings: pinctrl: Add StarFive JH7110 pinctrl definitions
>>
>> Kuan Lim Lee (1):
>>    pinctrl: starfive: Add StarFive JH7110 driver
>>
>> Yanhong Wang (15):
>>    riscv: cpu: jh7110: Add support for jh7110 SoC
>>    cache: starfive: Add StarFive JH7110 support
>>    dt-bindings: reset: Add StarFive JH7110 reset definitions
>>    reset: starfive: jh7110: Add reset driver for StarFive JH7110 SoC
>>    dt-bindings: clock: Add StarFive JH7110 clock definitions
>>    clk: starfive: Add StarFive JH7110 clock driver
>>    ram: starfive: add ddr driver
>>    board: starfive: add StarFive VisionFive v2 board support
>>    riscv: cpu: jh7110: Add Kconfig for StarFive JH7110 SoC
>>    board: starfive: Add Kconfig for StarFive VisionFive v2 Board
>>    board: starfive: Add TARGET_STARFIVE_VISIONFIVE2 to Kconfig
>>    riscv: dts: jh7110: Add initial StarFive JH7110 device tree
>>    riscv: dts: jh7110: Add initial u-boot device tree
>>    riscv: dts: jh7110: Add initial StarFive VisionFive v2 board device
>>      tree
>>    configs: starfive: add starfive_visionfive2_defconfig
> 
> Apologies if I have missed it somewhere - but where is patch 12?
> I don't see it on lore.kernel.org nor in my inbox :(
> 
> Thanks,
> Conor.
> 

https://lore.kernel.org/all/20230118082907.31629-1-yanhong.wang@starfivetech.com/

Not sure why it isn't with the rest of the series.

--Sean
Conor Dooley Jan. 21, 2023, 10:05 p.m. UTC | #3
> > Apologies if I have missed it somewhere - but where is patch 12?
> > I don't see it on lore.kernel.org nor in my inbox :(

> https://lore.kernel.org/all/20230118082907.31629-1-yanhong.wang@starfivetech.com/

Oh, thanks! Hopefully I can provide a tested-by so...

> Not sure why it isn't with the rest of the series.

Ehh, well it seems to be missing an In-Reply-To header, so perhaps it
was missing from the directory or w/e they ran send-email from & only
sent at a later date.

FWIW Yanhong, git send-email allows you to set that header so that
things do get threaded properly. AFAIU it's --in-reply-to=<msg-id>

Happy New Year,
Conor.
Conor Dooley Jan. 22, 2023, 6:42 p.m. UTC | #4
On Sat, Jan 21, 2023 at 10:05:47PM +0000, Conor Dooley wrote:
> > > Apologies if I have missed it somewhere - but where is patch 12?
> > > I don't see it on lore.kernel.org nor in my inbox :(
> 
> > https://lore.kernel.org/all/20230118082907.31629-1-yanhong.wang@starfivetech.com/
> 
> Oh, thanks! Hopefully I can provide a tested-by so...

Well it gets to console etc and there's not really much more than that
to really test until some of the peripheral support patches arrive.
Ethernet in particular would be great ;). So for non-SPL:
Tested-by: Conor Dooley <conor.dooley@microchip.com>

I can't test the SPL though unfortunately, as the program required to
"package" it has no source code AFAICT and doesn't run on my system.

Thanks,
Conor.

> > Not sure why it isn't with the rest of the series.
> 
> Ehh, well it seems to be missing an In-Reply-To header, so perhaps it
> was missing from the directory or w/e they ran send-email from & only
> sent at a later date.
> 
> FWIW Yanhong, git send-email allows you to set that header so that
> things do get threaded properly. AFAIU it's --in-reply-to=<msg-id>
> 
> Happy New Year,
> Conor.
>
Heinrich Schuchardt Jan. 24, 2023, 12:28 a.m. UTC | #5
On 1/18/23 09:11, Yanhong Wang wrote:
> This series of patches base on the latest branch/master, and add support
> for the StarFive JH7110 RISC-V SoC and VisionFive V2 board. In order for
> this to be achieved, the respective DT nodes have been added,  and the
> required defconfigs have been added to the boards' defconfig. What is more,
> the basic required DM drivers have been added, such as reset, clock, pinctrl,
> uart, ram etc.
> 
> Note that the register base address of reset controller is same with the
> clock controller. Therefore, there is no device tree node alone for reset
> driver. It binds device node in the clock driver.
> 
> The u-boot-spl and u-boot has been tested on the VisionFive V2 boards which
> equip with JH7110 SoC and works normally.
> 
> For more information and support, you can visit RVspace wiki[1].

Hello Yanhong,

Which version of OpenSBI is needed for this series to work?

Could you, please, provide a file in doc/board/starfive/ describing how 
to build and install U-Boot on the board.

Is tool create_sbl from https://github.com/starfive-tech/Tools still 
required? Can the source code for that tool be made available? Ideally 
this would be integrated into binman.

This is what I have in my notes:

cd Tools && \
./create_sbl $(uboot_wrkdir)/spl/u-boot-spl.bin 0x01010101

Best regards

Heinrich

> 
> [1] https://wiki.rvspace.org/
> 
> Changes in v2:
> - Renamed file 'jh7110-regs.h' to 'regs.h'.
> - Reworded the clear L2 LIM memory code in C.
> - Removed flash init call in 'spl_soc_init' function.
> - Reworded the clock driver.
> - Rename the macro 'SET_DIV' to 'ASSIGNED_CLOCK_PARENTS' in 'spl.c'.
> - Moved the device tree node 'dmc@15700000' from 'jh7110-u-boot.dtsi' to
>    'starfive_visionfive2-u-boot.dtsi'.
> 
> Previous versions:
> v1 - https://patchwork.ozlabs.org/project/uboot/cover/20221212025020.23778-1-yanhong.wang@starfivetech.com/
> 
> Jianlong Huang (1):
>    dt-bindings: pinctrl: Add StarFive JH7110 pinctrl definitions
> 
> Kuan Lim Lee (1):
>    pinctrl: starfive: Add StarFive JH7110 driver
> 
> Yanhong Wang (15):
>    riscv: cpu: jh7110: Add support for jh7110 SoC
>    cache: starfive: Add StarFive JH7110 support
>    dt-bindings: reset: Add StarFive JH7110 reset definitions
>    reset: starfive: jh7110: Add reset driver for StarFive JH7110 SoC
>    dt-bindings: clock: Add StarFive JH7110 clock definitions
>    clk: starfive: Add StarFive JH7110 clock driver
>    ram: starfive: add ddr driver
>    board: starfive: add StarFive VisionFive v2 board support
>    riscv: cpu: jh7110: Add Kconfig for StarFive JH7110 SoC
>    board: starfive: Add Kconfig for StarFive VisionFive v2 Board
>    board: starfive: Add TARGET_STARFIVE_VISIONFIVE2 to Kconfig
>    riscv: dts: jh7110: Add initial StarFive JH7110 device tree
>    riscv: dts: jh7110: Add initial u-boot device tree
>    riscv: dts: jh7110: Add initial StarFive VisionFive v2 board device
>      tree
>    configs: starfive: add starfive_visionfive2_defconfig
> 
>   arch/riscv/Kconfig                            |    5 +
>   arch/riscv/cpu/jh7110/Kconfig                 |   28 +
>   arch/riscv/cpu/jh7110/Makefile                |   10 +
>   arch/riscv/cpu/jh7110/cpu.c                   |   23 +
>   arch/riscv/cpu/jh7110/dram.c                  |   38 +
>   arch/riscv/cpu/jh7110/spl.c                   |   64 +
>   arch/riscv/dts/Makefile                       |    2 +-
>   arch/riscv/dts/jh7110-u-boot.dtsi             |   72 +
>   arch/riscv/dts/jh7110.dtsi                    |  497 +++++
>   .../dts/starfive_visionfive2-u-boot.dtsi      |   84 +
>   arch/riscv/dts/starfive_visionfive2.dts       |  234 ++
>   arch/riscv/include/asm/arch-jh7110/regs.h     |   19 +
>   arch/riscv/include/asm/arch-jh7110/spl.h      |   12 +
>   board/starfive/visionfive2/Kconfig            |   53 +
>   board/starfive/visionfive2/MAINTAINERS        |    7 +
>   board/starfive/visionfive2/Makefile           |    7 +
>   board/starfive/visionfive2/spl.c              |  118 +
>   .../visionfive2/starfive_visionfive2.c        |   38 +
>   configs/starfive_visionfive2_defconfig        |   72 +
>   drivers/cache/cache-sifive-ccache.c           |    1 +
>   drivers/clk/Kconfig                           |    1 +
>   drivers/clk/Makefile                          |    1 +
>   drivers/clk/starfive/Kconfig                  |   17 +
>   drivers/clk/starfive/Makefile                 |    4 +
>   drivers/clk/starfive/clk-jh7110-pll.c         |  293 +++
>   drivers/clk/starfive/clk-jh7110.c             |  559 +++++
>   drivers/clk/starfive/clk.h                    |   60 +
>   drivers/pinctrl/Kconfig                       |    1 +
>   drivers/pinctrl/Makefile                      |    1 +
>   drivers/pinctrl/starfive/Kconfig              |   16 +
>   drivers/pinctrl/starfive/Makefile             |    6 +
>   drivers/pinctrl/starfive/pinctrl-jh7110-aon.c |  113 +
>   drivers/pinctrl/starfive/pinctrl-jh7110-sys.c |  399 ++++
>   drivers/pinctrl/starfive/pinctrl-starfive.c   |  428 ++++
>   drivers/pinctrl/starfive/pinctrl-starfive.h   |   55 +
>   drivers/ram/Kconfig                           |    1 +
>   drivers/ram/Makefile                          |    4 +-
>   drivers/ram/starfive/Kconfig                  |    5 +
>   drivers/ram/starfive/Makefile                 |   11 +
>   drivers/ram/starfive/ddrcsr_boot.c            |  339 +++
>   drivers/ram/starfive/ddrphy_start.c           |  279 +++
>   drivers/ram/starfive/ddrphy_train.c           |  383 ++++
>   drivers/ram/starfive/ddrphy_utils.c           | 1955 +++++++++++++++++
>   drivers/ram/starfive/starfive_ddr.c           |  161 ++
>   drivers/ram/starfive/starfive_ddr.h           |   65 +
>   drivers/reset/Kconfig                         |   16 +
>   drivers/reset/Makefile                        |    1 +
>   drivers/reset/reset-jh7110.c                  |  158 ++
>   include/configs/starfive-visionfive2.h        |   18 +
>   include/dt-bindings/clock/starfive-jh7110.h   |  271 +++
>   .../pinctrl/pinctrl-starfive-jh7110.h         |  427 ++++
>   include/dt-bindings/reset/starfive-jh7110.h   |  183 ++
>   52 files changed, 7613 insertions(+), 2 deletions(-)
>   create mode 100644 arch/riscv/cpu/jh7110/Kconfig
>   create mode 100644 arch/riscv/cpu/jh7110/Makefile
>   create mode 100644 arch/riscv/cpu/jh7110/cpu.c
>   create mode 100644 arch/riscv/cpu/jh7110/dram.c
>   create mode 100644 arch/riscv/cpu/jh7110/spl.c
>   create mode 100644 arch/riscv/dts/jh7110-u-boot.dtsi
>   create mode 100644 arch/riscv/dts/jh7110.dtsi
>   create mode 100644 arch/riscv/dts/starfive_visionfive2-u-boot.dtsi
>   create mode 100644 arch/riscv/dts/starfive_visionfive2.dts
>   create mode 100644 arch/riscv/include/asm/arch-jh7110/regs.h
>   create mode 100644 arch/riscv/include/asm/arch-jh7110/spl.h
>   create mode 100644 board/starfive/visionfive2/Kconfig
>   create mode 100644 board/starfive/visionfive2/MAINTAINERS
>   create mode 100644 board/starfive/visionfive2/Makefile
>   create mode 100644 board/starfive/visionfive2/spl.c
>   create mode 100644 board/starfive/visionfive2/starfive_visionfive2.c
>   create mode 100644 configs/starfive_visionfive2_defconfig
>   create mode 100644 drivers/clk/starfive/Kconfig
>   create mode 100644 drivers/clk/starfive/Makefile
>   create mode 100644 drivers/clk/starfive/clk-jh7110-pll.c
>   create mode 100644 drivers/clk/starfive/clk-jh7110.c
>   create mode 100644 drivers/clk/starfive/clk.h
>   create mode 100644 drivers/pinctrl/starfive/Kconfig
>   create mode 100644 drivers/pinctrl/starfive/Makefile
>   create mode 100644 drivers/pinctrl/starfive/pinctrl-jh7110-aon.c
>   create mode 100644 drivers/pinctrl/starfive/pinctrl-jh7110-sys.c
>   create mode 100644 drivers/pinctrl/starfive/pinctrl-starfive.c
>   create mode 100644 drivers/pinctrl/starfive/pinctrl-starfive.h
>   create mode 100644 drivers/ram/starfive/Kconfig
>   create mode 100644 drivers/ram/starfive/Makefile
>   create mode 100644 drivers/ram/starfive/ddrcsr_boot.c
>   create mode 100644 drivers/ram/starfive/ddrphy_start.c
>   create mode 100644 drivers/ram/starfive/ddrphy_train.c
>   create mode 100644 drivers/ram/starfive/ddrphy_utils.c
>   create mode 100644 drivers/ram/starfive/starfive_ddr.c
>   create mode 100644 drivers/ram/starfive/starfive_ddr.h
>   create mode 100644 drivers/reset/reset-jh7110.c
>   create mode 100644 include/configs/starfive-visionfive2.h
>   create mode 100644 include/dt-bindings/clock/starfive-jh7110.h
>   create mode 100644 include/dt-bindings/pinctrl/pinctrl-starfive-jh7110.h
>   create mode 100644 include/dt-bindings/reset/starfive-jh7110.h
> 
> 
> base-commit: 348064ee2c8f9494b91b55729ac60c5db79ef129
> Tested-by: Conor Dooley <conor.dooley@microchip.com>
Andreas Schwab Jan. 24, 2023, 2:46 p.m. UTC | #6
On Jan 18 2023, Yanhong Wang wrote:

> This series of patches base on the latest branch/master, and add support
> for the StarFive JH7110 RISC-V SoC and VisionFive V2 board. In order for
> this to be achieved, the respective DT nodes have been added,  and the
> required defconfigs have been added to the boards' defconfig. What is more,
> the basic required DM drivers have been added, such as reset, clock, pinctrl,
> uart, ram etc.
>
> Note that the register base address of reset controller is same with the
> clock controller. Therefore, there is no device tree node alone for reset
> driver. It binds device node in the clock driver.
>
> The u-boot-spl and u-boot has been tested on the VisionFive V2 boards which
> equip with JH7110 SoC and works normally.

I tried to put that on an SD card for testing and boot from it, but the
SPL cannot read it, thus fails to load U-Boot proper.

U-Boot SPL 2023.01-00735-gc8fc99adce (Jan 24 2023 - 15:11:27 +0100)
DDR version: dc2e84f0.
Trying to boot from MMC2
spl: partition error
SPL: failed to boot from all boot devices
Jan Kiszka Feb. 6, 2023, 7:38 a.m. UTC | #7
On 18.01.23 09:11, Yanhong Wang wrote:
> This series of patches base on the latest branch/master, and add support
> for the StarFive JH7110 RISC-V SoC and VisionFive V2 board. In order for
> this to be achieved, the respective DT nodes have been added,  and the
> required defconfigs have been added to the boards' defconfig. What is more,
> the basic required DM drivers have been added, such as reset, clock, pinctrl,
> uart, ram etc.
> 
> Note that the register base address of reset controller is same with the
> clock controller. Therefore, there is no device tree node alone for reset
> driver. It binds device node in the clock driver.
> 
> The u-boot-spl and u-boot has been tested on the VisionFive V2 boards which
> equip with JH7110 SoC and works normally.
> 
> For more information and support, you can visit RVspace wiki[1].
> 
> [1] https://wiki.rvspace.org/

I'm missing a doc/board/starfive/visionfive2.rst in this, similar to
what we did with doc/board/siemens/iot2050.rst (and many others as well).

I would also suggest adding binman support so that a flash.bin (or
however you call it) is generated that contains the completely ingrated
firmware, consisting of U-Boot SPL, OpenSBI and U-Boot proper. Would
avoid having to model the details downstream in Yocto, Isar, etc.

Jan
Bin Meng Feb. 7, 2023, 3:46 p.m. UTC | #8
On Mon, Feb 6, 2023 at 3:39 PM Jan Kiszka <jan.kiszka@siemens.com> wrote:
>
> On 18.01.23 09:11, Yanhong Wang wrote:
> > This series of patches base on the latest branch/master, and add support
> > for the StarFive JH7110 RISC-V SoC and VisionFive V2 board. In order for
> > this to be achieved, the respective DT nodes have been added,  and the
> > required defconfigs have been added to the boards' defconfig. What is more,
> > the basic required DM drivers have been added, such as reset, clock, pinctrl,
> > uart, ram etc.
> >
> > Note that the register base address of reset controller is same with the
> > clock controller. Therefore, there is no device tree node alone for reset
> > driver. It binds device node in the clock driver.
> >
> > The u-boot-spl and u-boot has been tested on the VisionFive V2 boards which
> > equip with JH7110 SoC and works normally.
> >
> > For more information and support, you can visit RVspace wiki[1].
> >
> > [1] https://wiki.rvspace.org/
>
> I'm missing a doc/board/starfive/visionfive2.rst in this, similar to
> what we did with doc/board/siemens/iot2050.rst (and many others as well).
>
> I would also suggest adding binman support so that a flash.bin (or
> however you call it) is generated that contains the completely ingrated
> firmware, consisting of U-Boot SPL, OpenSBI and U-Boot proper. Would
> avoid having to model the details downstream in Yocto, Isar, etc.
>

Indeed, I see Simon requested in another thread asking binman update
for SiFive boards.

Adding binman support would be nice!

Regards,
Bin
Conor Dooley Feb. 10, 2023, 5:41 p.m. UTC | #9
On Sun, Jan 22, 2023 at 06:42:04PM +0000, Conor Dooley wrote:
> On Sat, Jan 21, 2023 at 10:05:47PM +0000, Conor Dooley wrote:
> > > > Apologies if I have missed it somewhere - but where is patch 12?
> > > > I don't see it on lore.kernel.org nor in my inbox :(
> > 
> > > https://lore.kernel.org/all/20230118082907.31629-1-yanhong.wang@starfivetech.com/
> > 
> > Oh, thanks! Hopefully I can provide a tested-by so...
> 
> Well it gets to console etc and there's not really much more than that
> to really test until some of the peripheral support patches arrive.
> Ethernet in particular would be great ;). So for non-SPL:
> Tested-by: Conor Dooley <conor.dooley@microchip.com>
> 
> I can't test the SPL though unfortunately, as the program required to
> "package" it has no source code AFAICT and doesn't run on my system.

StarFive released the source for this yesterday [1] and I was able to
successfully test the SPL too. Happy upgrade my qualified tested-by to
one for the whole series:
Tested-by: Conor Dooley <conor.dooley@microchip.com>

This patchset is far more stable than the SPL shipped with the board,
which I suspect has issues with "training"/initialisation of the DDR.

U-Boot proper was boot looping during either tftp or bootm loados more
than 90% of the time with the SPL the vendor ships but seems to be
stable with this version? It is with fingers crossed at the very least.

Cheers,
Conor.

1 - https://github.com/starfive-tech/Tools/tree/master/spl_tool
> > > Not sure why it isn't with the rest of the series.
> > 
> > Ehh, well it seems to be missing an In-Reply-To header, so perhaps it
> > was missing from the directory or w/e they ran send-email from & only
> > sent at a later date.
> > 
> > FWIW Yanhong, git send-email allows you to set that header so that
> > things do get threaded properly. AFAIU it's --in-reply-to=<msg-id>
> > 
> > Happy New Year,
> > Conor.
> > 
> 
>
Yanhong Wang Feb. 16, 2023, 7:39 a.m. UTC | #10
On 2023/1/22 5:56, Sean Anderson wrote:
> On 1/21/23 16:36, Conor Dooley wrote:
>> On Wed, Jan 18, 2023 at 04:11:15PM +0800, Yanhong Wang wrote:
>>> This series of patches base on the latest branch/master, and add support
>>> for the StarFive JH7110 RISC-V SoC and VisionFive V2 board. In order for
>>> this to be achieved, the respective DT nodes have been added,  and the
>>> required defconfigs have been added to the boards' defconfig. What is more,
>>> the basic required DM drivers have been added, such as reset, clock, pinctrl,
>>> uart, ram etc.
>>>
>>> Note that the register base address of reset controller is same with the
>>> clock controller. Therefore, there is no device tree node alone for reset
>>> driver. It binds device node in the clock driver.
>>>
>>> The u-boot-spl and u-boot has been tested on the VisionFive V2 boards which
>>> equip with JH7110 SoC and works normally.
>>>
>>> For more information and support, you can visit RVspace wiki[1].
>>>
>>> [1] https://wiki.rvspace.org/
>>>
>>> Changes in v2:
>>> - Renamed file 'jh7110-regs.h' to 'regs.h'.
>>> - Reworded the clear L2 LIM memory code in C.
>>> - Removed flash init call in 'spl_soc_init' function.
>>> - Reworded the clock driver.
>>> - Rename the macro 'SET_DIV' to 'ASSIGNED_CLOCK_PARENTS' in 'spl.c'.
>>> - Moved the device tree node 'dmc@15700000' from 'jh7110-u-boot.dtsi' to
>>>    'starfive_visionfive2-u-boot.dtsi'.
>>>
>>> Previous versions:
>>> v1 - https://patchwork.ozlabs.org/project/uboot/cover/20221212025020.23778-1-yanhong.wang@starfivetech.com/
>>>
>>> Jianlong Huang (1):
>>>    dt-bindings: pinctrl: Add StarFive JH7110 pinctrl definitions
>>>
>>> Kuan Lim Lee (1):
>>>    pinctrl: starfive: Add StarFive JH7110 driver
>>>
>>> Yanhong Wang (15):
>>>    riscv: cpu: jh7110: Add support for jh7110 SoC
>>>    cache: starfive: Add StarFive JH7110 support
>>>    dt-bindings: reset: Add StarFive JH7110 reset definitions
>>>    reset: starfive: jh7110: Add reset driver for StarFive JH7110 SoC
>>>    dt-bindings: clock: Add StarFive JH7110 clock definitions
>>>    clk: starfive: Add StarFive JH7110 clock driver
>>>    ram: starfive: add ddr driver
>>>    board: starfive: add StarFive VisionFive v2 board support
>>>    riscv: cpu: jh7110: Add Kconfig for StarFive JH7110 SoC
>>>    board: starfive: Add Kconfig for StarFive VisionFive v2 Board
>>>    board: starfive: Add TARGET_STARFIVE_VISIONFIVE2 to Kconfig
>>>    riscv: dts: jh7110: Add initial StarFive JH7110 device tree
>>>    riscv: dts: jh7110: Add initial u-boot device tree
>>>    riscv: dts: jh7110: Add initial StarFive VisionFive v2 board device
>>>      tree
>>>    configs: starfive: add starfive_visionfive2_defconfig
>>
>> Apologies if I have missed it somewhere - but where is patch 12?
>> I don't see it on lore.kernel.org nor in my inbox :(
>>
>> Thanks,
>> Conor.
>>
> 
> https://lore.kernel.org/all/20230118082907.31629-1-yanhong.wang@starfivetech.com/
> 
> Not sure why it isn't with the rest of the series.
> 

It was reported send fail when sending patch 12, so it was sent separately later

> --Sean
Yanhong Wang Feb. 16, 2023, 9:01 a.m. UTC | #11
On 2023/1/24 8:28, Heinrich Schuchardt wrote:
> 
> 
> On 1/18/23 09:11, Yanhong Wang wrote:
>> This series of patches base on the latest branch/master, and add support
>> for the StarFive JH7110 RISC-V SoC and VisionFive V2 board. In order for
>> this to be achieved, the respective DT nodes have been added,  and the
>> required defconfigs have been added to the boards' defconfig. What is more,
>> the basic required DM drivers have been added, such as reset, clock, pinctrl,
>> uart, ram etc.
>>
>> Note that the register base address of reset controller is same with the
>> clock controller. Therefore, there is no device tree node alone for reset
>> driver. It binds device node in the clock driver.
>>
>> The u-boot-spl and u-boot has been tested on the VisionFive V2 boards which
>> equip with JH7110 SoC and works normally.
>>
>> For more information and support, you can visit RVspace wiki[1].
> 
> Hello Yanhong,
> 
> Which version of OpenSBI is needed for this series to work?
> 
> Could you, please, provide a file in doc/board/starfive/ describing how to build and install U-Boot on the board.
> 
> Is tool create_sbl from https://github.com/starfive-tech/Tools still required? Can the source code for that tool be made available? Ideally this would be integrated into binman.
> 
> This is what I have in my notes:
> 
> cd Tools && \
> ./create_sbl $(uboot_wrkdir)/spl/u-boot-spl.bin 0x01010101
> 

Thanks. Yes, u-boot-spl.bin also need to be converted by the create_sbl tool.

The source code of the tool has been available. View details [1]

I will add doc/board/starfive/visionfive2.rst to describe how to build and install u-boot on the board in the next version.

[1]  https://github.com/starfive-tech/Tools/tree/master/spl_tool

> Best regards
> 
> Heinrich
> 
>>
>> [1] https://wiki.rvspace.org/
>>
>> Changes in v2:
>> - Renamed file 'jh7110-regs.h' to 'regs.h'.
>> - Reworded the clear L2 LIM memory code in C.
>> - Removed flash init call in 'spl_soc_init' function.
>> - Reworded the clock driver.
>> - Rename the macro 'SET_DIV' to 'ASSIGNED_CLOCK_PARENTS' in 'spl.c'.
>> - Moved the device tree node 'dmc@15700000' from 'jh7110-u-boot.dtsi' to
>>    'starfive_visionfive2-u-boot.dtsi'.
>>
>> Previous versions:
>> v1 - https://patchwork.ozlabs.org/project/uboot/cover/20221212025020.23778-1-yanhong.wang@starfivetech.com/
>>
>> Jianlong Huang (1):
>>    dt-bindings: pinctrl: Add StarFive JH7110 pinctrl definitions
>>
>> Kuan Lim Lee (1):
>>    pinctrl: starfive: Add StarFive JH7110 driver
>>
>> Yanhong Wang (15):
>>    riscv: cpu: jh7110: Add support for jh7110 SoC
>>    cache: starfive: Add StarFive JH7110 support
>>    dt-bindings: reset: Add StarFive JH7110 reset definitions
>>    reset: starfive: jh7110: Add reset driver for StarFive JH7110 SoC
>>    dt-bindings: clock: Add StarFive JH7110 clock definitions
>>    clk: starfive: Add StarFive JH7110 clock driver
>>    ram: starfive: add ddr driver
>>    board: starfive: add StarFive VisionFive v2 board support
>>    riscv: cpu: jh7110: Add Kconfig for StarFive JH7110 SoC
>>    board: starfive: Add Kconfig for StarFive VisionFive v2 Board
>>    board: starfive: Add TARGET_STARFIVE_VISIONFIVE2 to Kconfig
>>    riscv: dts: jh7110: Add initial StarFive JH7110 device tree
>>    riscv: dts: jh7110: Add initial u-boot device tree
>>    riscv: dts: jh7110: Add initial StarFive VisionFive v2 board device
>>      tree
>>    configs: starfive: add starfive_visionfive2_defconfig
>>
>>   arch/riscv/Kconfig                            |    5 +
>>   arch/riscv/cpu/jh7110/Kconfig                 |   28 +
>>   arch/riscv/cpu/jh7110/Makefile                |   10 +
>>   arch/riscv/cpu/jh7110/cpu.c                   |   23 +
>>   arch/riscv/cpu/jh7110/dram.c                  |   38 +
>>   arch/riscv/cpu/jh7110/spl.c                   |   64 +
>>   arch/riscv/dts/Makefile                       |    2 +-
>>   arch/riscv/dts/jh7110-u-boot.dtsi             |   72 +
>>   arch/riscv/dts/jh7110.dtsi                    |  497 +++++
>>   .../dts/starfive_visionfive2-u-boot.dtsi      |   84 +
>>   arch/riscv/dts/starfive_visionfive2.dts       |  234 ++
>>   arch/riscv/include/asm/arch-jh7110/regs.h     |   19 +
>>   arch/riscv/include/asm/arch-jh7110/spl.h      |   12 +
>>   board/starfive/visionfive2/Kconfig            |   53 +
>>   board/starfive/visionfive2/MAINTAINERS        |    7 +
>>   board/starfive/visionfive2/Makefile           |    7 +
>>   board/starfive/visionfive2/spl.c              |  118 +
>>   .../visionfive2/starfive_visionfive2.c        |   38 +
>>   configs/starfive_visionfive2_defconfig        |   72 +
>>   drivers/cache/cache-sifive-ccache.c           |    1 +
>>   drivers/clk/Kconfig                           |    1 +
>>   drivers/clk/Makefile                          |    1 +
>>   drivers/clk/starfive/Kconfig                  |   17 +
>>   drivers/clk/starfive/Makefile                 |    4 +
>>   drivers/clk/starfive/clk-jh7110-pll.c         |  293 +++
>>   drivers/clk/starfive/clk-jh7110.c             |  559 +++++
>>   drivers/clk/starfive/clk.h                    |   60 +
>>   drivers/pinctrl/Kconfig                       |    1 +
>>   drivers/pinctrl/Makefile                      |    1 +
>>   drivers/pinctrl/starfive/Kconfig              |   16 +
>>   drivers/pinctrl/starfive/Makefile             |    6 +
>>   drivers/pinctrl/starfive/pinctrl-jh7110-aon.c |  113 +
>>   drivers/pinctrl/starfive/pinctrl-jh7110-sys.c |  399 ++++
>>   drivers/pinctrl/starfive/pinctrl-starfive.c   |  428 ++++
>>   drivers/pinctrl/starfive/pinctrl-starfive.h   |   55 +
>>   drivers/ram/Kconfig                           |    1 +
>>   drivers/ram/Makefile                          |    4 +-
>>   drivers/ram/starfive/Kconfig                  |    5 +
>>   drivers/ram/starfive/Makefile                 |   11 +
>>   drivers/ram/starfive/ddrcsr_boot.c            |  339 +++
>>   drivers/ram/starfive/ddrphy_start.c           |  279 +++
>>   drivers/ram/starfive/ddrphy_train.c           |  383 ++++
>>   drivers/ram/starfive/ddrphy_utils.c           | 1955 +++++++++++++++++
>>   drivers/ram/starfive/starfive_ddr.c           |  161 ++
>>   drivers/ram/starfive/starfive_ddr.h           |   65 +
>>   drivers/reset/Kconfig                         |   16 +
>>   drivers/reset/Makefile                        |    1 +
>>   drivers/reset/reset-jh7110.c                  |  158 ++
>>   include/configs/starfive-visionfive2.h        |   18 +
>>   include/dt-bindings/clock/starfive-jh7110.h   |  271 +++
>>   .../pinctrl/pinctrl-starfive-jh7110.h         |  427 ++++
>>   include/dt-bindings/reset/starfive-jh7110.h   |  183 ++
>>   52 files changed, 7613 insertions(+), 2 deletions(-)
>>   create mode 100644 arch/riscv/cpu/jh7110/Kconfig
>>   create mode 100644 arch/riscv/cpu/jh7110/Makefile
>>   create mode 100644 arch/riscv/cpu/jh7110/cpu.c
>>   create mode 100644 arch/riscv/cpu/jh7110/dram.c
>>   create mode 100644 arch/riscv/cpu/jh7110/spl.c
>>   create mode 100644 arch/riscv/dts/jh7110-u-boot.dtsi
>>   create mode 100644 arch/riscv/dts/jh7110.dtsi
>>   create mode 100644 arch/riscv/dts/starfive_visionfive2-u-boot.dtsi
>>   create mode 100644 arch/riscv/dts/starfive_visionfive2.dts
>>   create mode 100644 arch/riscv/include/asm/arch-jh7110/regs.h
>>   create mode 100644 arch/riscv/include/asm/arch-jh7110/spl.h
>>   create mode 100644 board/starfive/visionfive2/Kconfig
>>   create mode 100644 board/starfive/visionfive2/MAINTAINERS
>>   create mode 100644 board/starfive/visionfive2/Makefile
>>   create mode 100644 board/starfive/visionfive2/spl.c
>>   create mode 100644 board/starfive/visionfive2/starfive_visionfive2.c
>>   create mode 100644 configs/starfive_visionfive2_defconfig
>>   create mode 100644 drivers/clk/starfive/Kconfig
>>   create mode 100644 drivers/clk/starfive/Makefile
>>   create mode 100644 drivers/clk/starfive/clk-jh7110-pll.c
>>   create mode 100644 drivers/clk/starfive/clk-jh7110.c
>>   create mode 100644 drivers/clk/starfive/clk.h
>>   create mode 100644 drivers/pinctrl/starfive/Kconfig
>>   create mode 100644 drivers/pinctrl/starfive/Makefile
>>   create mode 100644 drivers/pinctrl/starfive/pinctrl-jh7110-aon.c
>>   create mode 100644 drivers/pinctrl/starfive/pinctrl-jh7110-sys.c
>>   create mode 100644 drivers/pinctrl/starfive/pinctrl-starfive.c
>>   create mode 100644 drivers/pinctrl/starfive/pinctrl-starfive.h
>>   create mode 100644 drivers/ram/starfive/Kconfig
>>   create mode 100644 drivers/ram/starfive/Makefile
>>   create mode 100644 drivers/ram/starfive/ddrcsr_boot.c
>>   create mode 100644 drivers/ram/starfive/ddrphy_start.c
>>   create mode 100644 drivers/ram/starfive/ddrphy_train.c
>>   create mode 100644 drivers/ram/starfive/ddrphy_utils.c
>>   create mode 100644 drivers/ram/starfive/starfive_ddr.c
>>   create mode 100644 drivers/ram/starfive/starfive_ddr.h
>>   create mode 100644 drivers/reset/reset-jh7110.c
>>   create mode 100644 include/configs/starfive-visionfive2.h
>>   create mode 100644 include/dt-bindings/clock/starfive-jh7110.h
>>   create mode 100644 include/dt-bindings/pinctrl/pinctrl-starfive-jh7110.h
>>   create mode 100644 include/dt-bindings/reset/starfive-jh7110.h
>>
>>
>> base-commit: 348064ee2c8f9494b91b55729ac60c5db79ef129
>> Tested-by: Conor Dooley <conor.dooley@microchip.com>