Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Oct 2017 14:35:05 -0700
From:      Mark Millard <markmi@dsl-only.net>
To:        Emmanuel Vadot <manu@bidouilliste.com>, freebsd-arm <freebsd-arm@freebsd.org>
Subject:   Re: svn commit: r324822 - head/sys/modules/dtb/allwinner [removal of sinovoip-bpi-m3.dts from sys/modules/dtb/allwinner/Makefile DTS list]
Message-ID:  <BF09EA6D-6DE8-4138-AD92-8836DFF28620@dsl-only.net>
In-Reply-To: <8696CCFA-AE7D-4324-90A8-BB73402FA124@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>

next in thread | previous in thread | raw e-mail | index | archive | help
My attempt to adjust code failed
massively when tested. I've no clue what
I'm doing and my guesses were clearly
wrong.

Mostly this is usb stuff but pcpu_find also
reported "cpuid too large". (BPI-M3's have
8 cores, 2 clusters of 4, but FreeBSD only
classically enabled/used 4 of the 8: one
cluster.) Not stopping at 4 lead to a panic
via ofw_cpu_attach and dpcpu_alloc.

[The ubldr worked based on having supplied
UBLDR_LOADADDR=3D0x42000000 to buildworld.]

Unless an active committer is going to cover
the BPI-M3 it likely needs to be dropped,
sad to say for me. (I liked having the extra
memory compared to the other cortex-a7 board
that I've access to.)

Copyright (c) 1992-2017 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights =
reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 12.0-CURRENT  r324743M arm
FreeBSD clang version 5.0.0 (tags/RELEASE_500/final 312559) (based on =
LLVM 5.0.0svn)
VT: init without driver.
module_register: cannot register simplebus/ahci from kernel; already =
loaded from kernel
Module simplebus/ahci failed to register: 17
module_register: cannot register simplebus/ehci from kernel; already =
loaded from kernel
Module simplebus/ehci failed to register: 17
module_register: cannot register simplebus/pcib from kernel; already =
loaded from kernel
Module simplebus/pcib failed to register: 17
module_register: cannot register simplebus/ehci from kernel; already =
loaded from kernel
Module simplebus/ehci failed to register: 17
. . . (normal looking stuff) . . .
awusbphy0: <Allwinner USB PHY> mem =
0x1c19400-0x1c1942b,0x1c1a800-0x1c1a803,0x1c1b800-0x1c1b803 on =
simplebus0
awusbphy0: Cannot locate phy control resource
awusbphy0: failed to initialize USB PHY, error 6
device_attach: awusbphy0 attach returned 6
awusbphy0: <Allwinner USB PHY> mem =
0x1c19400-0x1c1942b,0x1c1a800-0x1c1a803,0x1c1b800-0x1c1b803 on =
simplebus0
awusbphy0: Cannot locate phy control resource
awusbphy0: failed to initialize USB PHY, error 6
device_attach: awusbphy0 attach returned 6
gic0: <ARM Generic Interrupt Controller> mem =
0x1c81000-0x1c81fff,0x1c82000-0x1c82fff,0x1c84000-0x1c85fff,0x1c86000-0x1c=
87fff irq 18 on simplebus0
gic0: pn 0x2, arch 0x2, rev 0x1, implementer 0x43b irqs 224
awusbphy0: <Allwinner USB PHY> mem =
0x1c19400-0x1c1942b,0x1c1a800-0x1c1a803,0x1c1b800-0x1c1b803 on =
simplebus0
awusbphy0: Cannot locate phy control resource
awusbphy0: failed to initialize USB PHY, error 6
device_attach: awusbphy0 attach returned 6
awusbphy0: <Allwinner USB PHY> mem =
0x1c19400-0x1c1942b,0x1c1a800-0x1c1a803,0x1c1b800-0x1c1b803 on =
simplebus0
awusbphy0: Cannot locate phy control resource
awusbphy0: failed to initialize USB PHY, error 6
device_attach: awusbphy0 attach returned 6
gpio0: <Allwinner GPIO/Pinmux controller> mem 0x1c20800-0x1c20bff irq =
11,12,13 on simplebus0
gpiobus0: <OFW GPIO bus> on gpio0
gpio1: <Allwinner GPIO/Pinmux controller> mem 0x1f02c00-0x1f02fff irq 19 =
on simplebus0
gpiobus1: <OFW GPIO bus> on gpio1
aw_nmi0: <Allwinner NMI Controller> mem 0x1f00c0c-0x1f00c43 irq 21 on =
simplebus0
awusbphy0: <Allwinner USB PHY> mem =
0x1c19400-0x1c1942b,0x1c1a800-0x1c1a803,0x1c1b800-0x1c1b803 on =
simplebus0
awusbphy0: Cannot locate phy control resource
awusbphy0: failed to initialize USB PHY, error 6
device_attach: awusbphy0 attach returned 6
axp81x_pmu0: <X-Powers AXP81x Power Management Unit> at addr 0x746 irq =
29 on iicbus3
gpiobus2: <OFW GPIO bus> on axp81x_pmu0
awusbphy0: <Allwinner USB PHY> mem =
0x1c19400-0x1c1942b,0x1c1a800-0x1c1a803,0x1c1b800-0x1c1b803 on =
simplebus0
awusbphy0: Cannot locate phy control resource
awusbphy0: failed to initialize USB PHY, error 6
device_attach: awusbphy0 attach returned 6
awusbphy0: <Allwinner USB PHY> mem =
0x1c19400-0x1c1942b,0x1c1a800-0x1c1a803,0x1c1b800-0x1c1b803 on =
simplebus0
awusbphy0: Cannot locate phy control resource
awusbphy0: failed to initialize USB PHY, error 6
device_attach: awusbphy0 attach returned 6
awusbphy0: <Allwinner USB PHY> mem =
0x1c19400-0x1c1942b,0x1c1a800-0x1c1a803,0x1c1b800-0x1c1b803 on =
simplebus0
awusbphy0: Cannot locate phy control resource
awusbphy0: failed to initialize USB PHY, error 6
device_attach: awusbphy0 attach returned 6
generic_timer0: <ARMv7 Generic Timer> irq 0,1,2,3 on ofwbus0
Timecounter "ARM MPCore Timecounter" frequency 24000000 Hz quality 1000
Event timer "ARM MPCore Eventtimer" frequency 24000000 Hz quality 1000
awusbphy0: <Allwinner USB PHY> mem =
0x1c19400-0x1c1942b,0x1c1a800-0x1c1a803,0x1c1b800-0x1c1b803 on =
simplebus0
awusbphy0: Cannot locate phy control resource
awusbphy0: failed to initialize USB PHY, error 6
device_attach: awusbphy0 attach returned 6
awusbphy0: <Allwinner USB PHY> mem =
0x1c19400-0x1c1942b,0x1c1a800-0x1c1a803,0x1c1b800-0x1c1b803 on =
simplebus0
awusbphy0: Cannot locate phy control resource
awusbphy0: failed to initialize USB PHY, error 6
device_attach: awusbphy0 attach returned 6
awusbphy0: <Allwinner USB PHY> mem =
0x1c19400-0x1c1942b,0x1c1a800-0x1c1a803,0x1c1b800-0x1c1b803 on =
simplebus0
awusbphy0: Cannot locate phy control resource
awusbphy0: failed to initialize USB PHY, error 6
device_attach: awusbphy0 attach returned 6
awusbphy0: <Allwinner USB PHY> mem =
0x1c19400-0x1c1942b,0x1c1a800-0x1c1a803,0x1c1b800-0x1c1b803 on =
simplebus0
awusbphy0: Cannot locate phy control resource
awusbphy0: failed to initialize USB PHY, error 6
device_attach: awusbphy0 attach returned 6
awusbphy0: <Allwinner USB PHY> mem =
0x1c19400-0x1c1942b,0x1c1a800-0x1c1a803,0x1c1b800-0x1c1b803 on =
simplebus0
awusbphy0: Cannot locate phy control resource
awusbphy0: failed to initialize USB PHY, error 6
device_attach: awusbphy0 attach returned 6
awusbphy0: <Allwinner USB PHY> mem =
0x1c19400-0x1c1942b,0x1c1a800-0x1c1a803,0x1c1b800-0x1c1b803 on =
simplebus0
awusbphy0: Cannot locate phy control resource
awusbphy0: failed to initialize USB PHY, error 6
device_attach: awusbphy0 attach returned 6
awusbphy0: <Allwinner USB PHY> mem =
0x1c19400-0x1c1942b,0x1c1a800-0x1c1a803,0x1c1b800-0x1c1b803 on =
simplebus0
awusbphy0: Cannot locate phy control resource
awusbphy0: failed to initialize USB PHY, error 6
device_attach: awusbphy0 attach returned 6
cpulist0: <Open Firmware CPU Group> on ofwbus0
cpu0: <Open Firmware CPU> on cpulist0
cpufreq_dt0: <Generic cpufreq driver> on cpu0
cpu1: <Open Firmware CPU> on cpulist0
cpu2: <Open Firmware CPU> on cpulist0
cpu3: <Open Firmware CPU> on cpulist0
cpu4: <Open Firmware CPU> on cpulist0
panic: pcpu_find: cpuid too large
cpuid =3D 0

Note the attempt to try cpu4 after
cpus 0-3. FreeBSD is no longer stopping
at its own self-imposed limit of 4
cores (one of the 2 clusters).

NOTE:
The BPI-M3 is not BIG-little: all the
cores are the same type: cortex-a7's.

It looks like having BPI-M3 supported
would be a notable effort by someone
the proper background.




The details for what I tried follow but
I know so little for this type of activity
that the material is likely of little or no
use. Nothing below is targeting stopping
at 4 cores: that was a surprise.

The later greps of the -r324743 based sorted .dts
produced from the .dtb shows references to:

usb0-vbus
usb1-vbus
usb2-vbus

I think that is the 2 USB ports and the SATA
that is via a USB bridge as I understand. (It
is known for not being fast because of this
structure.)

The clock-output-names list includes:

"bus_usb_otg", "bus_ehci0", "bus_ehci1", "bus_ohci0",

But there are only 2 or 3 usb resets?:

                fixup =3D "/soc/usb@01c1a000:resets:0";
. . .
                fixup =3D "/soc/usb@01c1b000:resets:0";
. . .
                        reset-names =3D "usb0_reset", "usb1_reset", =
"usb2_reset";

and 2 phys if I understand right (that show up various
ways):

                fixup =3D "/soc/usb@01c1a000:phys:0";
. . .
                fixup =3D "/soc/usb@01c1b000:phys:0";
. . .
                        clock-output-names =3D "usb_phy0", "usb_phy1", =
"usb_hsic_pll", "usb_hsic_12m", "usb_ohci0";
. . .
                        clock-names =3D "usb0_phy", "usb1_phy", =
"hsic_pll", "hsic_12m";
. . .
                usb@01c1a000 {
                        phy-names =3D "usb";
                usb@01c1b000 {
                        phy-names =3D "usb";

Although there is the following as well:

                fixup =3D "/soc/phy@01c19400:usb1_vbus-supply:0";
. . .
                usbphy =3D "/soc/phy@01c19400";

I have no clue for it.

As stands I'm testing based on my guesses for
.num_phys , .pmu_unk1 , and .phy0_route below.
I do not know how to confirm or find what the
values should be.

# svnlite diff /usr/src/sys/arm/allwinner/aw_usbphy.c
Index: /usr/src/sys/arm/allwinner/aw_usbphy.c
=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/arm/allwinner/aw_usbphy.c	(revision 324743)
+++ /usr/src/sys/arm/allwinner/aw_usbphy.c	(working copy)
@@ -58,6 +58,7 @@
 	AWUSBPHY_TYPE_A13,
 	AWUSBPHY_TYPE_A20,
 	AWUSBPHY_TYPE_A31,
+	AWUSBPHY_TYPE_A83T,
 	AWUSBPHY_TYPE_H3,
 	AWUSBPHY_TYPE_A64
 };
@@ -90,6 +91,13 @@
 	.phy0_route =3D false,
 };
=20
+static const struct aw_usbphy_conf a83t_usbphy_conf =3D {
+	.num_phys =3D 2, // ???? SATA via USB too? ????
+	.phy_type =3D AWUSBPHY_TYPE_A83T,
+	.pmu_unk1 =3D false, // ????
+	.phy0_route =3D false, // ????
+};
+
 static const struct aw_usbphy_conf a31_usbphy_conf =3D {
 	.num_phys =3D 3,
 	.phy_type =3D AWUSBPHY_TYPE_A31,
@@ -116,6 +124,7 @@
 	{ "allwinner,sun5i-a13-usb-phy",	=
(uintptr_t)&a13_usbphy_conf },
 	{ "allwinner,sun6i-a31-usb-phy",	=
(uintptr_t)&a31_usbphy_conf },
 	{ "allwinner,sun7i-a20-usb-phy",	=
(uintptr_t)&a20_usbphy_conf },
+	{ "allwinner,sun8i-a83t-usb-phy",       =
(uintptr_t)&a83t_usbphy_conf },
 	{ "allwinner,sun8i-h3-usb-phy",		=
(uintptr_t)&h3_usbphy_conf },
 	{ "allwinner,sun50i-a64-usb-phy",	=
(uintptr_t)&a64_usbphy_conf },
 	{ NULL,					0 }




The details for the greps:


# grep -i usb /root/bpi-m3-sorted-324743.dts | more
                fixup =3D "/soc/phy@01c19400:usb1_vbus-supply:0";
                fixup =3D "/soc/usb@01c1a000:clocks:0";
                fixup =3D "/soc/usb@01c1a000:resets:0";
                fixup =3D "/soc/usb@01c1a000:phys:0";
                fixup =3D "/soc/usb@01c1b000:clocks:0";
                fixup =3D "/soc/usb@01c1b000:resets:0";
                fixup =3D "/soc/usb@01c1b000:phys:0";
                fixup =3D "/usb0-vbus:pinctrl-0:0";
                fixup =3D "/usb0-vbus:gpio:0";
                fixup =3D "/usb1-vbus:pinctrl-0:0";
                fixup =3D "/usb1-vbus:gpio:0";
                fixup =3D "/usb2-vbus:pinctrl-0:0";
                fixup =3D "/usb2-vbus:gpio:0";
                ehci0 =3D "/soc/usb@01c1a000";
                ehci1 =3D "/soc/usb@01c1b000";
                reg_usb0_vbus =3D "/usb0-vbus";
                reg_usb1_vbus =3D "/usb1-vbus";
                reg_usb2_vbus =3D "/usb2-vbus";
                usb0_vbus_pin_a =3D =
"/soc/pinctrl@01c20800/usb0_vbus_pin@0";
                usb1_vbus_pin_a =3D =
"/soc/pinctrl@01c20800/usb1_vbus_pin@0";
                usb2_vbus_pin_a =3D =
"/soc/pinctrl@01c20800/usb2_vbus_pin@0";
                usb_clk =3D "/clocks/clk@01c200cc";
                usbphy =3D "/soc/phy@01c19400";
                        clock-output-names =3D "bus_mipidsi", "bus_ss", =
"bus_dma", "bus_mmc0", "bus_mmc1", "bus_mmc2", "bus_nand", "bus_sdram", =
"bus_emac", "bus_hstimer", "bus_spi0", "bus_spi1", "bus_usb_otg", =
"bus_ehci0", "bus_ehci1", "bus_ohci0", "bus_ve", "bus_lcd0", "bus_lcd1", =
"bus_csi", "bus_hdmi", "bus_de", "bus_gpu", "bus_msgbox", =
"bus_spinlock", "bus_spdif", "bus_pio", "bus_i2s0", "bus_i2s1", =
"bus_i2s2", "bus_tdm", "bus_i2c0", "bus_i2c1", "bus_i2c2", "bus_uart0", =
"bus_uart1", "bus_uart2", "bus_uart3", "bus_uart4";
                        clock-output-names =3D "usb_phy0", "usb_phy1", =
"usb_hsic_pll", "usb_hsic_12m", "usb_ohci0";
                        compatible =3D "allwinner,sun8i-a83t-usb-clk";
                        clock-names =3D "usb0_phy", "usb1_phy", =
"hsic_pll", "hsic_12m";
                        compatible =3D "allwinner,sun8i-a83t-usb-phy";
                        reset-names =3D "usb0_reset", "usb1_reset", =
"usb2_reset";
                        usb1_vbus-supply =3D <0x2c>;
                        usb0_vbus_pin@0 {
                        usb1_vbus_pin@0 {
                        usb2_vbus_pin@0 {
                usb@01c1a000 {
                        phy-names =3D "usb";
                usb@01c1b000 {
                        phy-names =3D "usb";
        usb0-vbus {
                regulator-name =3D "usb0-vbus";
        usb1-vbus {
                regulator-name =3D "usb1-vbus";
        usb2-vbus {
                regulator-name =3D "usb2-vbus";

# grep -i hci /root/bpi-m3-sorted-324743.dts | more
                fixup =3D "/ahci-5v:pinctrl-0:0";
                fixup =3D "/ahci-5v:gpio:0";
                ahci_pwr_pin_a =3D =
"/soc/pinctrl@01c20800/ahci_pwr_pin@0";
                ehci0 =3D "/soc/usb@01c1a000";
                ehci1 =3D "/soc/usb@01c1b000";
                reg_ahci_5v =3D "/ahci-5v";
        ahci-5v {
                regulator-name =3D "ahci-5v";
                        clock-output-names =3D "bus_mipidsi", "bus_ss", =
"bus_dma", "bus_mmc0", "bus_mmc1", "bus_mmc2", "bus_nand", "bus_sdram", =
"bus_emac", "bus_hstimer", "bus_spi0", "bus_spi1", "bus_usb_otg", =
"bus_ehci0", "bus_ehci1", "bus_ohci0", "bus_ve", "bus_lcd0", "bus_lcd1", =
"bus_csi", "bus_hdmi", "bus_de", "bus_gpu", "bus_msgbox", =
"bus_spinlock", "bus_spdif", "bus_pio", "bus_i2s0", "bus_i2s1", =
"bus_i2s2", "bus_tdm", "bus_i2c0", "bus_i2c1", "bus_i2c2", "bus_uart0", =
"bus_uart1", "bus_uart2", "bus_uart3", "bus_uart4";
                        clock-output-names =3D "usb_phy0", "usb_phy1", =
"usb_hsic_pll", "usb_hsic_12m", "usb_ohci0";
                        ahci_pwr_pin@0 {
                        compatible =3D "allwinner,sun8i-a83t-ehci", =
"generic-ehci";
                        compatible =3D "allwinner,sun8i-a83t-ehci", =
"generic-ehci";


=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?BF09EA6D-6DE8-4138-AD92-8836DFF28620>