BPI-M3 booted via a variant of head -r324743 with an external ECHI USB root file system: what I changed to have it happen [Lucky it worked? sc->pmu[off] usage?]

Mark Millard markmi at dsl-only.net
Thu Oct 26 08:44:14 UTC 2017


[It looks like I got the naming wrong for
pmu0 and pmu1 vs. pmu1 and pmu2, despite
things appearing to operate?]

On 2017-Oct-23, at 8:43 PM, Mark Millard <markmi at dsl-only.net> wrote:

> . . .
> The changes:
> 
> # svnlite diff /usr/src/sys/boot/fdt/dts/arm/a83t.dtsi
> Index: /usr/src/sys/boot/fdt/dts/arm/a83t.dtsi
> ===================================================================
> --- /usr/src/sys/boot/fdt/dts/arm/a83t.dtsi	(revision 324743)
> +++ /usr/src/sys/boot/fdt/dts/arm/a83t.dtsi	(working copy)
> @@ -179,6 +179,9 @@
> 			reg = <0x01c19400 0x2c>,
> 			      <0x01c1a800 0x4>,
> 			      <0x01c1b800 0x4>;
> +			reg-names = "phy_ctrl",
> +				    "pmu0",
> +				    "pmu1";
> 			clocks = <&usb_clk 8>,
> 				 <&usb_clk 9>,
> 				 <&usb_clk 10>,

I found linux 4.14 drafts of:

/arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts

and the files that are included from there,
indirections included. The:

/arch/arm/boot/dts/sun8i-a83t.dtsi

that has the analogous content has:

		usbphy: phy at 1c19400 {
			compatible = "allwinner,sun8i-a83t-usb-phy";
			reg = <0x01c19400 0x10>,
			      <0x01c1a800 0x14>,
			      <0x01c1b800 0x14>;
			reg-names = "phy_ctrl",
				    "pmu1",
				    "pmu2";

In the FreeBSD head code:

/usr/src/sys/arm/allwinner/aw_usbphy.c

the pmu<?> naming differences would change
which sc->pmu[off] examples end up with
bus_alloc_resource_any return values assigned:


        /* Get regulators */
        for (off = 0; off < sc->phy_conf->num_phys; off++) {
                snprintf(pname, sizeof(pname), "usb%d_vbus-supply", off);
                if (regulator_get_by_ofw_property(dev, 0, pname, &reg) == 0)
                        sc->reg[off] = reg;
         
                snprintf(pname, sizeof(pname), "pmu%d", off);
                if (ofw_bus_find_string_index(node, "reg-names",
                    pname, &rid) != 0)
                        continue;
                
                sc->pmu[off] = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
                    RF_ACTIVE);
                if (sc->pmu[off] == NULL) {
                        device_printf(dev, "Cannot allocate resource\n");
                        return (ENXIO);
                }
        }

With what I had it was off==0 and off==1 but with
what the linux 4.14 draft material has it would
be off==1 and off=2 . Either way, exactly 2 of
the 3 phys have sc->pmu[off] assigned by the above
code, it just varies which ones.

It may have been very lucky for me that things
seemed to be working.

Of the two *.dsti files and the
sys/arm/allwinner/aw_usbphy.c file I have
no clue what should be different. I'd
expect to guess my a83t.dtsi edit --but
then why do things seem to be working?


Side note: There is also the difference
above:

			reg = <0x01c19400 0x2c>,
			      <0x01c1a800 0x4>,
			      <0x01c1b800 0x4>;

vs.
			reg = <0x01c19400 0x10>,
			      <0x01c1a800 0x14>,
			      <0x01c1b800 0x14>;

whatever that means.

> . . .



===
Mark Millard
markmi at dsl-only.net



More information about the freebsd-arm mailing list