Re: FYI: Rock64 USB3 port no longer works for main [so: 14] (looks like dtb changes invalidating use of the old .dtbo and needing kernel changes)

From: Emmanuel Vadot <manu_at_bidouilliste.com>
Date: Tue, 15 Nov 2022 13:05:22 UTC
On Fri, 4 Nov 2022 12:31:51 -0700
Mark Millard <marklmi@yahoo.com> wrote:

> On 2022-Oct-22, at 23:00, Mark Millard <marklmi@yahoo.com> wrote:
> 
> > Well, turns out that part of the "Import device-tree files
> > from Linux 5.14" is:
> > 
> > https://cgit.freebsd.org/src/commit/sys/contrib/device-tree/src/arm64/rockchip/rk3328-rock64.dts?id=5956d97f4b32
> > 
> > which has:
> > 
> > diff --git a/sys/contrib/device-tree/src/arm64/rockchip/rk3328-rock64.dts b/sys/contrib/device-tree/src/arm64/rockchip/rk3328-rock64.dts
> > index 3bef1f39bc6e..1b0f7e4551ea 100644
> > --- a/sys/contrib/device-tree/src/arm64/rockchip/rk3328-rock64.dts
> > +++ b/sys/contrib/device-tree/src/arm64/rockchip/rk3328-rock64.dts
> > @@ -381,6 +381,11 @@
> > 	status = "okay";
> > };
> > 
> > +&usbdrd3 {
> > +	dr_mode = "host";
> > +	status = "okay";
> > +};
> > +
> > &usb_host0_ehci {
> > 	status = "okay";
> > };
> > 
> > usbdrd3 is for USB3, so "host" now has a sort of dtb change
> > in the interfacing for supporting host-mode USB3. The old:
> > 
> > /usr/main-src/sys/dts/arm64/overlays/rk3328-dwc3.dtso
> > 
> > has, in part:
> > 
> >        usbdrd3: usb@ff600000 {
> >                compatible = "rockchip,rk3328-dwc3";
> >                clocks = <&cru SCLK_USB3OTG_REF>, <&cru SCLK_USB3OTG_SUSPEND>,
> >                         <&cru ACLK_USB3OTG>;
> >                clock-names = "ref_clk", "suspend_clk",
> >                              "bus_clk";
> >                #address-cells = <2>;
> >                #size-cells = <2>;
> >                ranges;
> >                status = "okay";
> > 
> >                usbdrd_dwc3: dwc3@ff600000 {
> >                        compatible = "snps,dwc3";
> >                        reg = <0x0 0xff600000 0x0 0x100000>;
> >                        interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;
> >                        dr_mode = "host";
> >                        phy_type = "utmi_wide";
> >                        snps,dis_enblslpm_quirk;
> >                        snps,dis-u2-freeclk-exists-quirk;
> >                        snps,dis_u2_susphy_quirk;
> >                        snps,dis_u3_susphy_quirk;
> >                        snps,dis-del-phy-power-chg-quirk;
> >                        snps,dis-tx-ipgap-linecheck-quirk;
> >                        status = "okay";
> >                };
> >        };
> > 
> > which looks to me to likely now conflict with the below --given
> > the added "host" usage as of 5.14 reported above:
> > 
> > /usr/main-src/sys/contrib/device-tree/src/arm64/rockchip/rk3328.dtsi
> > 
> > that, as of the 5.13 import, has:
> > 
> >        usbdrd3: usb@ff600000 {
> >                compatible = "rockchip,rk3328-dwc3", "snps,dwc3";
> >                reg = <0x0 0xff600000 0x0 0x100000>;
> >                interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;
> >                clocks = <&cru SCLK_USB3OTG_REF>, <&cru SCLK_USB3OTG_SUSPEND>,
> >                         <&cru ACLK_USB3OTG>;
> >                clock-names = "ref_clk", "suspend_clk",
> >                              "bus_clk";
> >                dr_mode = "otg";
> >                phy_type = "utmi_wide";
> >                snps,dis-del-phy-power-chg-quirk;
> >                snps,dis_enblslpm_quirk;
> >                snps,dis-tx-ipgap-linecheck-quirk;
> >                snps,dis-u2-freeclk-exists-quirk;
> >                snps,dis_u2_susphy_quirk;
> >                snps,dis_u3_susphy_quirk;
> >                status = "disabled";
> >        };
> > 
> > My guess would be that some kernel changes are required
> > in order to track this structural changes, not just
> > avoiding the old .dtbo . Testing showed that disabling
> > the load of the .dtbo was insufficient to fix things.
> 
> FYI:
> 
> The mainline Linux commit that addeed usbdrd3 to
> arch/arm64/boot/dts/rockchip/rk3328.dtsi is the
> following from 2021-03-24:
> 
> https://github.com/torvalds/linux/commit/44dd5e2106dc2fd01697b539085818d1d1c58df0
> 
> The mainline Linux commit that added the enabling of
> the USB3 host mode in
> arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
> is the following from 2021-05-01:
> 
> https://github.com/torvalds/linux/commit/bbac8bd65f5402281cb7b0452c1c5f367387b459
> 
> ===
> Mark Millard
> marklmi at yahoo.com
> 
> 

 Hi Mark,

 See https://reviews.freebsd.org/D37392 (and child reviews) for a fix.
 This was indeed the import of the new DTS files that caused the first
problem (there is no glue node in rk3328.dtsi like in other SoCs or
like our overlay). The other commit responsible for breaking USB3
support was the addition to RK356x SoC, the check was bad for when to
force USB2.

 Cheers,

-- 
Emmanuel Vadot <manu@bidouilliste.com> <manu@freebsd.org>