Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Oct 2017 21:44:10 -0700
From:      Mark Millard <markmi@dsl-only.net>
To:        Emmanuel Vadot <manu@bidouilliste.com>, freebsd-arm <freebsd-arm@freebsd.org>, freebsd-hackers <freebsd-hackers@freebsd.org>
Subject:   Re: 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?]
Message-ID:  <E6839E37-AE96-4038-AF14-4AC45336F6BC@dsl-only.net>
In-Reply-To: <17D6B79E-F7AF-4395-B8A2-2CE9A5157ABF@dsl-only.net>
References:  <3AD6B1F8-512C-43BB-AC76-7721454AD02F@dsl-only.net> <20171021195812.5bdb902401b8e756b6abfe40@bidouilliste.com> <C9F6BF5E-28DB-4569-B71E-EDE2A042FC78@dsl-only.net> <20171021204356.47e3cd6066144bcd07f46699@bidouilliste.com> <50728566-11C2-45EB-8367-00CAF38D4548@dsl-only.net> <B3F39A7C-339B-4072-9E41-A3F9DA1F590B@dsl-only.net> <8696CCFA-AE7D-4324-90A8-BB73402FA124@dsl-only.net> <BF09EA6D-6DE8-4138-AD92-8836DFF28620@dsl-only.net> <06B9A4AD-EA28-41A8-91B9-FE368EF622FE@dsl-only.net> <68CB464E-6FC6-4CB9-963B-9E7A683041EB@dsl-only.net> <EC0D967B-B466-4CE2-83E6-4BAA7724A07D@dsl-only.net> <17D6B79E-F7AF-4395-B8A2-2CE9A5157ABF@dsl-only.net>

next in thread | previous in thread | raw e-mail | index | archive | help
[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:
>=20
> # svnlite diff /usr/src/sys/boot/fdt/dts/arm/a83t.dtsi
> Index: /usr/src/sys/boot/fdt/dts/arm/a83t.dtsi
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- /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 =3D <0x01c19400 0x2c>,
> 			      <0x01c1a800 0x4>,
> 			      <0x01c1b800 0x4>;
> +			reg-names =3D "phy_ctrl",
> +				    "pmu0",
> +				    "pmu1";
> 			clocks =3D <&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@1c19400 {
			compatible =3D "allwinner,sun8i-a83t-usb-phy";
			reg =3D <0x01c19400 0x10>,
			      <0x01c1a800 0x14>,
			      <0x01c1b800 0x14>;
			reg-names =3D "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 =3D 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) =
=3D=3D 0)
                        sc->reg[off] =3D reg;
        =20
                snprintf(pname, sizeof(pname), "pmu%d", off);
                if (ofw_bus_find_string_index(node, "reg-names",
                    pname, &rid) !=3D 0)
                        continue;
               =20
                sc->pmu[off] =3D bus_alloc_resource_any(dev, =
SYS_RES_MEMORY, &rid,
                    RF_ACTIVE);
                if (sc->pmu[off] =3D=3D NULL) {
                        device_printf(dev, "Cannot allocate =
resource\n");
                        return (ENXIO);
                }
        }

With what I had it was off=3D=3D0 and off=3D=3D1 but with
what the linux 4.14 draft material has it would
be off=3D=3D1 and off=3D2 . 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 =3D <0x01c19400 0x2c>,
			      <0x01c1a800 0x4>,
			      <0x01c1b800 0x4>;

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

whatever that means.

> . . .



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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E6839E37-AE96-4038-AF14-4AC45336F6BC>