[PATCH v5 0/8] Add Starfive JH7110 Cadence USB driver

E Shattow lucent at gmail.com
Fri Nov 22 09:16:42 CET 2024


On Fri, Oct 11, 2024 at 8:13 PM Minda Chen <minda.chen at starfivetech.com> wrote:
>
> Add Starfive JH7110 Cadence USB driver and related PHY driver.
> So the codes can be used in visionfive2 and star64 7110 board.
>
> The driver is almost the same with kernel driver.
>
> Test with Star64 JH7110 board USB 3.0 + USB 2.0 host.
> The code can work.
>
> - Star64 using USB 3.0 and USB 2.0 host must add below board dts setting.
> (Vbus bin setting. If usb host in Other JH7110 board vbus pin is not GPIO,
> don't require to set this)
>
> 1. usb pin setting
>         usb_pins: usb0-0 {
>                 driver-vbus-pin {
>                         pinmux = <GPIOMUX(25, GPOUT_SYS_USB_DRIVE_VBUS,
>                                           GPOEN_ENABLE,
>                                           GPI_NONE)>;
>                         bias-disable;
>                         input-disable;
>                         input-schmitt-disable;
>                         slew-rate = <0>;
>                 };
>         };
>
> 2. related dts node setting(USB 3.0 host)
> &pcie0 {
>         status = "disabled";
> };
>
> &pciephy0 {
>         starfive,sys-syscon = <&sys_syscon>;
>         starfive,stg-syscon = <&stg_syscon 0x148 0x1f4>;
>         status = "okay";
> };
>
> &usb0 {
>         pinctrl-names = "default";
>         pinctrl-0 = <&usb_pins>;
>         dr_mode = "host";
>         status = "okay";
> };
>
> &usb_cdns3 {
>         phys = <&usbphy0>, <&pciephy0>;
>         phy-names = "cdns3,usb2-phy", "cdns3,usb3-phy";
> };
>
> - If other board is USB 2.0 host, Just set dr mode is OKay.
> &usb0 {
>         dr_mode = "host";
>         status = "okay";
> };
>
> - previous version
>   v1: https://patchwork.ozlabs.org/project/uboot/cover/20240504150358.19600-1-minda.chen@starfivetech.com/
>   v2: https://patchwork.ozlabs.org/project/uboot/cover/20240704055014.55117-1-minda.chen@starfivetech.com/
>   v3: https://patchwork.ozlabs.org/project/uboot/cover/20240719013822.101374-1-minda.chen@starfivetech.com/
>   v4: https://patchwork.ozlabs.org/project/uboot/cover/20240829013058.6178-1-minda.chen@starfivetech.com/
>
> - patch description.
>
> patch1: Add set phy mode function in cdns3 core driver
>         which is used by Starfive JH7110.
> patch2-3: USB and PCIe 2.0 (usb 3.0) PHY drivier
> patch4: Cadence USB wrapper driver.
> patch5: Add JH7110 USB default overcurrent pin.
> patch6-7 dts, config update.
> patch8: MAINTAINERS update
>
> - change:
>         v5:
>         - patch 2-4 format changed.
>         - For pareparing enable OF_UPSTREAM, patch4 get the dr mode
>           from parent device dts node not the cdns core device dts.
>         - patch2 add a common usb syscon setting headfile.
>         - delete v4 patch8 and the star64 dts setting can be setting
>           int star64 board dts configuration if the OF_UPSTREAM is
>           enable.
>         v4:
>         - patch 2 Add usb split setting, default set USB 2.0 only.
>         - patch 5 move to spl stage.
>         - Add a new patch 8 for star64 board usb host, vbus pin setting
>           and usb 3.0
>         v3:
>         - patch 1 Move the added code to cdns3_drd_update_mode().
>         - patch 1-4 correct the code format.(follow Rogers's comments.)
>         - patch 3 using regmap_field.
>
>         v2:
>         - patch 1 Move the added code to cdns3_core_init_role(). Must
>           set PHY mode before calling cdns3 role start function.
>         - patch 1-4 correct the code format.(follow Marek's comments.)
>         - patch 2 Add set 125M clock in PHY init function.
>         - Add new patch5.
>
>
> Minda Chen (8):
>   usb: cdns3: Set USB PHY mode in cdns3_drd_update_mode()
>   phy: starfive: Add Starfive JH7110 USB 2.0 PHY driver
>   phy: starfive: Add Starfive JH7110 PCIe 2.0 PHY driver
>   usb: cdns: starfive: Add cdns USB driver
>   spl: starfive: visionfive2: Disable USB overcurrent pin by default.
>   configs: starfive: Add visionfive2 cadence USB configuration
>   dts: starfive: Add JH7110 Cadence USB dts node
>   MAINTAINERS: Update Starfive visionfive2 maintain files.
>
>  .../dts/jh7110-starfive-visionfive-2.dtsi     |   5 +
>  arch/riscv/dts/jh7110.dtsi                    |  53 ++++
>  arch/riscv/include/asm/arch-jh7110/gpio.h     |   5 +
>  board/starfive/visionfive2/MAINTAINERS        |   2 +
>  board/starfive/visionfive2/spl.c              |   3 +
>  configs/starfive_visionfive2_defconfig        |  10 +
>  drivers/phy/Kconfig                           |   1 +
>  drivers/phy/Makefile                          |   1 +
>  drivers/phy/starfive/Kconfig                  |  21 ++
>  drivers/phy/starfive/Makefile                 |   7 +
>  drivers/phy/starfive/phy-jh7110-pcie.c        | 239 ++++++++++++++++++
>  drivers/phy/starfive/phy-jh7110-usb-syscon.h  |   9 +
>  drivers/phy/starfive/phy-jh7110-usb2.c        | 162 ++++++++++++
>  drivers/usb/cdns3/Kconfig                     |   7 +
>  drivers/usb/cdns3/Makefile                    |   2 +
>  drivers/usb/cdns3/cdns3-starfive.c            | 183 ++++++++++++++
>  drivers/usb/cdns3/core.c                      |   3 +
>  drivers/usb/cdns3/drd.c                       |  14 +
>  18 files changed, 727 insertions(+)
>  create mode 100644 drivers/phy/starfive/Kconfig
>  create mode 100644 drivers/phy/starfive/Makefile
>  create mode 100644 drivers/phy/starfive/phy-jh7110-pcie.c
>  create mode 100644 drivers/phy/starfive/phy-jh7110-usb-syscon.h
>  create mode 100644 drivers/phy/starfive/phy-jh7110-usb2.c
>  create mode 100644 drivers/usb/cdns3/cdns3-starfive.c
>
>
> base-commit: c530f6079c70219e01022142b404bf8a6b572366
> --
> 2.17.1
>

Hi Minda,

Can you please depend on series "Support OF_UPSTREAM for StarFive
JH7110", and with changes requested by Marek?

Also I have patches for review on Linux kernel mailing list to provide
some of the dts nodes we will need to allow host USB mode on Star64
and Mars:
 "riscv: dts: starfive: jh7110-pine64-star64: enable usb0 host function"
 "riscv: dts: starfive: jh7110-milkv-mars: enable usb0 host function"

This can allow your series to apply on U-Boot without extra dts?

Thanks,

-E


More information about the U-Boot mailing list