head -r325700 booting BPI-M3 (currently unsupported officially): some notes for how it can be set up

Mark Millard markmi at dsl-only.net
Sun Nov 12 05:56:18 UTC 2017


[A later point will be: Is the loader or kernel
having problems picking up material from the
long-standing u-boot for the BPI-M3?]

Overall the things I'm now doing to keep the BPI-M3
going in my local environment are:

In /boot/loader.conf :

fdt_file="/boot/dtb/sinovoip-bpi-m3.dtb"

(The above is new and previously nothing
like it was needed.)

I use:

WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x42000000"

during builds and the BPI-M3 boots via ubldr .
(sysutils/u-boot-sinovoip-bpi-m3 is old, not modern,
although I've not tried to force ubldr.bin use to
see if it would work.)

# svnlite diff /usr/src/sys/modules/dtb/allwinner/Makefile /usr/src/sys/boot/fdt/dts/arm/a83t.dtsi /usr/src/sys/arm/allwinner/aw_usbphy.c
Index: /usr/src/sys/modules/dtb/allwinner/Makefile
===================================================================
--- /usr/src/sys/modules/dtb/allwinner/Makefile	(revision 325700)
+++ /usr/src/sys/modules/dtb/allwinner/Makefile	(working copy)
@@ -3,6 +3,7 @@
 DTS=	\
 	nanopi-neo.dts \
 	orangepi-plus-2e.dts \
+	sinovoip-bpi-m3.dts \
 	sun4i-a10-cubieboard.dts \
 	sun4i-a10-olinuxino-lime.dts \
 	sun6i-a31s-sinovoip-bpi-m2.dts \
Index: /usr/src/sys/boot/fdt/dts/arm/a83t.dtsi
===================================================================
--- /usr/src/sys/boot/fdt/dts/arm/a83t.dtsi	(revision 325700)
+++ /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",
+				    "pmu1",
+				    "pmu2";
 			clocks = <&usb_clk 8>,
 				 <&usb_clk 9>,
 				 <&usb_clk 10>,
Index: /usr/src/sys/arm/allwinner/aw_usbphy.c
===================================================================
--- /usr/src/sys/arm/allwinner/aw_usbphy.c	(revision 325700)
+++ /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 = false,
 };
 
+static const struct aw_usbphy_conf a83t_usbphy_conf = {
+	.num_phys = 3, // USB-DRD/OTG and 2 USB hosts
+	.phy_type = AWUSBPHY_TYPE_A83T,
+	.pmu_unk1 = false,
+	.phy0_route = false,
+};
+
 static const struct aw_usbphy_conf a31_usbphy_conf = {
 	.num_phys = 3,
 	.phy_type = 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 }




Notes on the parts of the above recently
added:

As of -r324822 the BPI-M3 is unsupported: its
.dts file was removed from:

sys/modules/dtb/allwinner/Makefile

Things are progressing towards use of Linux
.dts files but are not there yet.

I'd been able to keep going with a few
local changes (a83t.dtsi and aw_usbphy.c
and UBLDR_LOADADDR above) but the jump
from -r324743 to -r325700 got:

Hit [Enter] to boot immediately, or any other key for command prompt.
Booting [/boot/kernel/kernel]...               
No valid device tree blob found!

unlike before.

To my prior local changes (a83t.dtsi and
aw_usbphy.c and UBLDR_LOADADDR above) I
ended up adding:

fdt_file="/boot/dtb/sinovoip-bpi-m3.dtb"

to /boot/loader.conf in order for the .dtb to
be found the file. I also reverted the removal
that was in sys/modules/dtb/allwinner/Makefile .
These took care of the problem.

I've not found what made the difference in
the file lookup from -r324743, -r324743 did not
need anything like that fdt_file line.

sysutils/u-boot-sinovoip-bpi-m3 has not changed
in 10 months and that was for Makefile issues.
Its core material is unchanged from when it was
created. And I'd not updated and, so, was using
the same version as before.

Is the loader or kernel having problems picking
up material from the long-standing u-boot? (I do
not know at this point.)

I also learned that apparently Linux has progressed
its naming from:

sun8i-a83t-sinovoip-bpi-m3.dt*

to:

sun8i-a83t-bananapi-m3.dt*

(Hard linking those names to sinovoip-bpi-m3.dtb
did not help prior to the loader.conf addition.)


Other details for my amd64 -> BPI-M3 cross
build environment:

# more ~/sys_build_scripts.amd64-host/make_bpim3_nodebug_clang_bootstrap-amd64-host.sh 
kldload -n filemon && \
script ~/sys_typescripts/typescript_make_bpim3_nodebug_clang_bootstrap-amd64-host-$(date +%Y-%m-%d:%H:%M:%S) \
env __MAKE_CONF="/root/src.configs/make.conf" SRCCONF="/dev/null" SRC_ENV_CONF="/root/src.configs/src.conf.armv7-clang-bootstrap.amd64-host" \
WITH_META_MODE=yes \
WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x42000000" \
MAKEOBJDIRPREFIX="/usr/obj/bpim3_clang/arm.armv7" \
make $*

# more ~/src.configs/make.conf
CFLAGS.gcc+= -v


# more ~/src.configs/src.conf.armv7-clang-bootstrap.amd64-host
TO_TYPE=armv7
#
KERNCONF=GENERIC-NODBG
TARGET=arm
.if ${.MAKE.LEVEL} == 0
TARGET_ARCH=${TO_TYPE}
.export TARGET_ARCH
.endif
#
WITH_CROSS_COMPILER=
WITHOUT_SYSTEM_COMPILER=
#
#CPUTYPE=soft
WITH_LIBCPLUSPLUS=
WITH_BINUTILS_BOOTSTRAP=
WITH_ELFTOOLCHAIN_BOOTSTRAP=
WITH_CLANG_BOOTSTRAP=
WITH_CLANG=
WITH_CLANG_IS_CC=
WITH_CLANG_FULL=
WITH_CLANG_EXTRAS=
WITH_LLD=
#
# Linking lldb fails for armv7
WITHOUT_LLDB=
#
WITH_BOOT=
WITHOUT_LIB32=
WITHOUT_LIBSOFT=
#
WITHOUT_GCC_BOOTSTRAP=
WITHOUT_GCC=
WITHOUT_GCC_IS_CC=
WITHOUT_GNUCXX=
#
NO_WERROR=
#WERROR=
MALLOC_PRODUCTION=
#
WITH_REPRODUCIBLE_BUILD=
WITH_DEBUG_FILES=
#
XCFLAGS+= -mcpu=cortex-a7
XCXXFLAGS+= -mcpu=cortex-a7
# There is no XCPPFLAGS but XCPP gets XCFLAGS content.


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



More information about the freebsd-arm mailing list