On Thu, Jan 13, 2022 at 09:18:15AM +0000, Klemens Nanni wrote:
> 
> On Thu, Jan 13, 2022 at 05:02:05PM +0800, Kevin Lo wrote:
> > The PINE H64 ver. B is a minor revision of the original H64.
> > I copied the device tree from the Linux kernel.
> > 
> > dmesg: http://ix.io/3M3r
> > 
> > ok?
> 
> With one fix.
> 
> > Index: sysutils/arm-trusted-firmware/Makefile
> > ===================================================================
> > RCS file: /cvs/ports/sysutils/arm-trusted-firmware/Makefile,v
> > retrieving revision 1.16
> > diff -u -p -u -p -r1.16 Makefile
> > --- sysutils/arm-trusted-firmware/Makefile  18 Jun 2021 09:17:28 -0000      
> > 1.16
> > +++ sysutils/arm-trusted-firmware/Makefile  13 Jan 2022 08:54:30 -0000
> > @@ -9,6 +9,7 @@ GH_PROJECT= arm-trusted-firmware
> >  GH_TAGNAME=        v2.5
> >  
> >  EPOCH=             0
> > +REVISION=  0
> >  
> >  CATEGORIES=        sysutils
> >  
> > @@ -32,7 +33,8 @@ CFLAGS=
> >  PLATFORMS=\
> >     rk3328 \
> >     rk3399 \
> > -   sun50i_a64
> > +   sun50i_a64 \
> > +   sun50i_h6
> >  
> >  do-build:
> >  .for P in ${PLATFORMS}
> > @@ -49,5 +51,7 @@ do-install:
> >         ${PREFIX}/share/arm-trusted-firmware/rk3399-bl31.elf
> >     ${INSTALL_DATA} ${WRKBUILD}/build/sun50i_a64/debug/bl31.bin \
> >         ${PREFIX}/share/arm-trusted-firmware/sun50i_a64-bl31.bin
> > +   ${INSTALL_DATA} ${WRKBUILD}/build/sun50i_h6/debug/bl31.bin \
> > +       ${PREFIX}/share/arm-trusted-firmware/sun50i_h6-bl31.bin
> >  
> >  .include <bsd.port.mk>
> > Index: sysutils/arm-trusted-firmware/pkg/PLIST
> > ===================================================================
> > RCS file: /cvs/ports/sysutils/arm-trusted-firmware/pkg/PLIST,v
> > retrieving revision 1.4
> > diff -u -p -u -p -r1.4 PLIST
> > --- sysutils/arm-trusted-firmware/pkg/PLIST 27 Sep 2019 15:43:29 -0000      
> > 1.4
> > +++ sysutils/arm-trusted-firmware/pkg/PLIST 13 Jan 2022 08:54:30 -0000
> > @@ -4,3 +4,4 @@ share/arm-trusted-firmware/
> >  share/arm-trusted-firmware/rk3328-bl31.elf
> >  share/arm-trusted-firmware/rk3399-bl31.elf
> >  share/arm-trusted-firmware/sun50i_a64-bl31.bin
> > +share/arm-trusted-firmware/sun50i_h6-bl31.bin
> > Index: sysutils/u-boot/Makefile
> > ===================================================================
> > RCS file: /cvs/ports/sysutils/u-boot/Makefile,v
> > retrieving revision 1.89
> > diff -u -p -u -p -r1.89 Makefile
> > --- sysutils/u-boot/Makefile        17 Dec 2021 23:00:41 -0000      1.89
> > +++ sysutils/u-boot/Makefile        13 Jan 2022 08:54:31 -0000
> > @@ -8,7 +8,7 @@ FLAVOR?=    arm
> >  
> >  COMMENT=   U-Boot firmware
> >  VERSION=   2021.10
> > -REVISION=  2
> > +REVISION=  3
> 
> You also need to bump the build dependency to
>       sysutils/arm-trusted-firmware>=2.2p0v0
> 
> Otherwise new u-boot old atf will fail.

Fixed, thanks.

> >  DISTNAME=  u-boot-${VERSION}
> >  PKGNAME=   u-boot-${FLAVOR}-${VERSION:S/-//}
> >  FULLPKGNAME=       ${PKGNAME}
> > @@ -44,6 +44,7 @@ MAKE_ENV+=        CROSS_COMPILE="aarch64-none-e
> >  RK3328_BL31=       
> > "${LOCALBASE}/share/arm-trusted-firmware/rk3328-bl31.elf"
> >  RK3399_BL31=       
> > "${LOCALBASE}/share/arm-trusted-firmware/rk3399-bl31.elf"
> >  SUNXI_BL31=        
> > "${LOCALBASE}/share/arm-trusted-firmware/sun50i_a64-bl31.bin"
> > +SUNXI_H6_BL31=     
> > "${LOCALBASE}/share/arm-trusted-firmware/sun50i_h6-bl31.bin"
> >  .elif "${FLAVOR}" == "arm"
> >  BUILD_DEPENDS+=    devel/arm-none-eabi/gcc-linaro>=7.4.2019.02
> >  MAKE_ENV+= CROSS_COMPILE="arm-none-eabi-"
> > @@ -69,6 +70,7 @@ SUNXI64=\
> >     orangepi_zero_plus \
> >     pine64-lts \
> >     pine64_plus \
> > +   pine_h64-model-b \
> >     pinebook \
> >     sopine_baseboard
> >  BOARDS=\
> > @@ -203,6 +205,16 @@ do-build:
> >  .endif
> >  .endfor
> >  .for BOARD in ${SUNXI64}
> > +.if "${BOARD:M*_h64*}"
> > +   cd ${WRKSRC} && \
> > +       mkdir -p build/${BOARD} && \
> > +       ${SETENV} ${MAKE_ENV} BL31=${SUNXI_H6_BL31} ${MAKE_PROGRAM} \
> > +           ${MAKE_FLAGS} O="build/${BOARD}" \
> > +           -f ${MAKE_FILE} "${BOARD}"_defconfig && \
> > +       ${SETENV} ${MAKE_ENV} BL31=${SUNXI_H6_BL31} ${MAKE_PROGRAM} \
> > +           ${MAKE_FLAGS} O="build/${BOARD}" \
> > +           -f ${MAKE_FILE} ${ALL_TARGET}
> > +.else
> >     cd ${WRKSRC} && \
> >         mkdir -p build/${BOARD} && \
> >         ${SETENV} ${MAKE_ENV} BL31=${SUNXI_BL31} ${MAKE_PROGRAM} \
> > @@ -211,6 +223,7 @@ do-build:
> >         ${SETENV} ${MAKE_ENV} BL31=${SUNXI_BL31} ${MAKE_PROGRAM} \
> >             ${MAKE_FLAGS} O="build/${BOARD}" \
> >             -f ${MAKE_FILE} ${ALL_TARGET}
> > +.endif
> >     if [[ -f ${WRKSRC}/build/${BOARD}/spl/sunxi-spl.bin && \
> >           -f ${WRKSRC}/build/${BOARD}/u-boot.itb ]]; then \
> >             cd ${WRKSRC}/build/${BOARD} && \
> > Index: sysutils/u-boot/patches/patch-arch_arm_dts_Makefile
> > ===================================================================
> > RCS file: sysutils/u-boot/patches/patch-arch_arm_dts_Makefile
> > diff -N sysutils/u-boot/patches/patch-arch_arm_dts_Makefile
> > --- /dev/null       1 Jan 1970 00:00:00 -0000
> > +++ sysutils/u-boot/patches/patch-arch_arm_dts_Makefile     13 Jan 2022 
> > 08:54:31 -0000
> > @@ -0,0 +1,13 @@
> > +$OpenBSD$
> 
> I always like to see descriptive comments in our patch files so fellow
> porters can quickly reason about them without searching (old) logs or
> digging into the code yet again to understand their intent.
> 
> These patches are trivial, but the general point stands and one has to
> read patches first before coming to such a conclusion... and that alone
> can waste time.

Fair enough.  Compared to patch files, comments are more direct, descriptive
and easy to understand.  Here's the revised diff:

Index: sysutils/arm-trusted-firmware/Makefile
===================================================================
RCS file: /cvs/ports/sysutils/arm-trusted-firmware/Makefile,v
retrieving revision 1.16
diff -u -p -u -p -r1.16 Makefile
--- sysutils/arm-trusted-firmware/Makefile      18 Jun 2021 09:17:28 -0000      
1.16
+++ sysutils/arm-trusted-firmware/Makefile      14 Jan 2022 03:15:33 -0000
@@ -9,6 +9,7 @@ GH_PROJECT=     arm-trusted-firmware
 GH_TAGNAME=    v2.5
 
 EPOCH=         0
+REVISION=      0
 
 CATEGORIES=    sysutils
 
@@ -32,7 +33,8 @@ CFLAGS=
 PLATFORMS=\
        rk3328 \
        rk3399 \
-       sun50i_a64
+       sun50i_a64 \
+       sun50i_h6
 
 do-build:
 .for P in ${PLATFORMS}
@@ -49,5 +51,7 @@ do-install:
            ${PREFIX}/share/arm-trusted-firmware/rk3399-bl31.elf
        ${INSTALL_DATA} ${WRKBUILD}/build/sun50i_a64/debug/bl31.bin \
            ${PREFIX}/share/arm-trusted-firmware/sun50i_a64-bl31.bin
+       ${INSTALL_DATA} ${WRKBUILD}/build/sun50i_h6/debug/bl31.bin \
+           ${PREFIX}/share/arm-trusted-firmware/sun50i_h6-bl31.bin
 
 .include <bsd.port.mk>
Index: sysutils/arm-trusted-firmware/pkg/PLIST
===================================================================
RCS file: /cvs/ports/sysutils/arm-trusted-firmware/pkg/PLIST,v
retrieving revision 1.4
diff -u -p -u -p -r1.4 PLIST
--- sysutils/arm-trusted-firmware/pkg/PLIST     27 Sep 2019 15:43:29 -0000      
1.4
+++ sysutils/arm-trusted-firmware/pkg/PLIST     14 Jan 2022 03:15:33 -0000
@@ -4,3 +4,4 @@ share/arm-trusted-firmware/
 share/arm-trusted-firmware/rk3328-bl31.elf
 share/arm-trusted-firmware/rk3399-bl31.elf
 share/arm-trusted-firmware/sun50i_a64-bl31.bin
+share/arm-trusted-firmware/sun50i_h6-bl31.bin
Index: sysutils/u-boot/Makefile
===================================================================
RCS file: /cvs/ports/sysutils/u-boot/Makefile,v
retrieving revision 1.89
diff -u -p -u -p -r1.89 Makefile
--- sysutils/u-boot/Makefile    17 Dec 2021 23:00:41 -0000      1.89
+++ sysutils/u-boot/Makefile    14 Jan 2022 03:15:34 -0000
@@ -8,7 +8,7 @@ FLAVOR?=        arm
 
 COMMENT=       U-Boot firmware
 VERSION=       2021.10
-REVISION=      2
+REVISION=      3
 DISTNAME=      u-boot-${VERSION}
 PKGNAME=       u-boot-${FLAVOR}-${VERSION:S/-//}
 FULLPKGNAME=   ${PKGNAME}
@@ -39,11 +39,12 @@ MAKE_ENV=   KBUILD_VERBOSE=1 \
 .if "${FLAVOR}" == "aarch64"
 BUILD_DEPENDS+=        devel/arm-none-eabi/gcc-linaro,aarch64 \
                devel/py-elftools \
-               sysutils/arm-trusted-firmware>=2.2v0
+               sysutils/arm-trusted-firmware>=2.2p0v0
 MAKE_ENV+=     CROSS_COMPILE="aarch64-none-elf-"
 RK3328_BL31=   "${LOCALBASE}/share/arm-trusted-firmware/rk3328-bl31.elf"
 RK3399_BL31=   "${LOCALBASE}/share/arm-trusted-firmware/rk3399-bl31.elf"
 SUNXI_BL31=    "${LOCALBASE}/share/arm-trusted-firmware/sun50i_a64-bl31.bin"
+SUNXI_H6_BL31= "${LOCALBASE}/share/arm-trusted-firmware/sun50i_h6-bl31.bin"
 .elif "${FLAVOR}" == "arm"
 BUILD_DEPENDS+=        devel/arm-none-eabi/gcc-linaro>=7.4.2019.02
 MAKE_ENV+=     CROSS_COMPILE="arm-none-eabi-"
@@ -69,6 +70,7 @@ SUNXI64=\
        orangepi_zero_plus \
        pine64-lts \
        pine64_plus \
+       pine_h64-model-b \
        pinebook \
        sopine_baseboard
 BOARDS=\
@@ -203,6 +205,16 @@ do-build:
 .endif
 .endfor
 .for BOARD in ${SUNXI64}
+.if "${BOARD:M*_h64*}"
+       cd ${WRKSRC} && \
+           mkdir -p build/${BOARD} && \
+           ${SETENV} ${MAKE_ENV} BL31=${SUNXI_H6_BL31} ${MAKE_PROGRAM} \
+               ${MAKE_FLAGS} O="build/${BOARD}" \
+               -f ${MAKE_FILE} "${BOARD}"_defconfig && \
+           ${SETENV} ${MAKE_ENV} BL31=${SUNXI_H6_BL31} ${MAKE_PROGRAM} \
+               ${MAKE_FLAGS} O="build/${BOARD}" \
+               -f ${MAKE_FILE} ${ALL_TARGET}
+.else
        cd ${WRKSRC} && \
            mkdir -p build/${BOARD} && \
            ${SETENV} ${MAKE_ENV} BL31=${SUNXI_BL31} ${MAKE_PROGRAM} \
@@ -211,6 +223,7 @@ do-build:
            ${SETENV} ${MAKE_ENV} BL31=${SUNXI_BL31} ${MAKE_PROGRAM} \
                ${MAKE_FLAGS} O="build/${BOARD}" \
                -f ${MAKE_FILE} ${ALL_TARGET}
+.endif
        if [[ -f ${WRKSRC}/build/${BOARD}/spl/sunxi-spl.bin && \
              -f ${WRKSRC}/build/${BOARD}/u-boot.itb ]]; then \
                cd ${WRKSRC}/build/${BOARD} && \
Index: sysutils/u-boot/patches/patch-arch_arm_dts_Makefile
===================================================================
RCS file: sysutils/u-boot/patches/patch-arch_arm_dts_Makefile
diff -N sysutils/u-boot/patches/patch-arch_arm_dts_Makefile
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ sysutils/u-boot/patches/patch-arch_arm_dts_Makefile 14 Jan 2022 03:15:34 
-0000
@@ -0,0 +1,15 @@
+$OpenBSD$
+
+Hook up the dtb to the build for PINE H64 model B.
+
+Index: arch/arm/dts/Makefile
+--- arch/arm/dts/Makefile.orig
++++ arch/arm/dts/Makefile
+@@ -642,6 +642,7 @@ dtb-$(CONFIG_MACH_SUN50I_H6) += \
+       sun50i-h6-orangepi-lite2.dtb \
+       sun50i-h6-orangepi-one-plus.dtb \
+       sun50i-h6-pine-h64.dtb \
++      sun50i-h6-pine-h64-model-b.dtb \
+       sun50i-h6-tanix-tx6.dtb
+ dtb-$(CONFIG_MACH_SUN50I_H616) += \
+       sun50i-h616-orangepi-zero2.dtb
Index: sysutils/u-boot/patches/patch-arch_arm_dts_sun50i-h6-pine-h64-model-b_dts
===================================================================
RCS file: 
sysutils/u-boot/patches/patch-arch_arm_dts_sun50i-h6-pine-h64-model-b_dts
diff -N 
sysutils/u-boot/patches/patch-arch_arm_dts_sun50i-h6-pine-h64-model-b_dts
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ sysutils/u-boot/patches/patch-arch_arm_dts_sun50i-h6-pine-h64-model-b_dts   
14 Jan 2022 03:15:34 -0000
@@ -0,0 +1,60 @@
+$OpenBSD$
+
+Copy the device tree file for PINE H64 model B from Linux kernel:
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64-model-b.dts?h=v5.14
+
+Index: arch/arm/dts/sun50i-h6-pine-h64-model-b.dts
+--- arch/arm/dts/sun50i-h6-pine-h64-model-b.dts.orig
++++ arch/arm/dts/sun50i-h6-pine-h64-model-b.dts
+@@ -0,0 +1,51 @@
++// SPDX-License-Identifier: (GPL-2.0+ or MIT)
++/*
++ * Copyright (C) 2019 Corentin LABBE <cla...@baylibre.com>
++ */
++
++#include "sun50i-h6-pine-h64.dts"
++
++/ {
++      model = "Pine H64 model B";
++      compatible = "pine64,pine-h64-model-b", "allwinner,sun50i-h6";
++
++      /delete-node/ reg_gmac_3v3;
++
++      wifi_pwrseq: wifi_pwrseq {
++              compatible = "mmc-pwrseq-simple";
++              reset-gpios = <&r_pio 1 3 GPIO_ACTIVE_LOW>; /* PM3 */
++              post-power-on-delay-ms = <200>;
++      };
++};
++
++&hdmi_connector {
++      /delete-property/ ddc-en-gpios;
++};
++
++&emac {
++      phy-supply = <&reg_aldo2>;
++};
++
++&mmc1 {
++      vmmc-supply = <&reg_cldo3>;
++      vqmmc-supply = <&reg_aldo1>;
++      mmc-pwrseq = <&wifi_pwrseq>;
++      bus-width = <4>;
++      non-removable;
++      status = "okay";
++};
++
++&uart1 {
++      pinctrl-names = "default";
++      pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
++      uart-has-rtscts;
++      status = "okay";
++
++      bluetooth {
++              compatible = "realtek,rtl8723bs-bt";
++              device-wake-gpios = <&r_pio 1 2 GPIO_ACTIVE_HIGH>; /* PM2 */
++              host-wake-gpios = <&r_pio 1 1 GPIO_ACTIVE_HIGH>; /* PM1 */
++              enable-gpios = <&r_pio 1 4 GPIO_ACTIVE_HIGH>; /* PM4 */
++              max-speed = <1500000>;
++      };
++};
Index: sysutils/u-boot/patches/patch-configs_pine_h64-model-b_defconfig
===================================================================
RCS file: sysutils/u-boot/patches/patch-configs_pine_h64-model-b_defconfig
diff -N sysutils/u-boot/patches/patch-configs_pine_h64-model-b_defconfig
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ sysutils/u-boot/patches/patch-configs_pine_h64-model-b_defconfig    14 Jan 
2022 03:15:34 -0000
@@ -0,0 +1,29 @@
+$OpenBSD$
+
+Add defconfig for PINE H64 model B.
+
+Index: configs/pine_h64-model-b_defconfig
+--- configs/pine_h64-model-b_defconfig.orig
++++ configs/pine_h64-model-b_defconfig
+@@ -0,0 +1,21 @@
++CONFIG_ARM=y
++CONFIG_ARCH_SUNXI=y
++CONFIG_DEFAULT_DEVICE_TREE="sun50i-h6-pine-h64-model-b"
++CONFIG_SPL=y
++CONFIG_MACH_SUN50I_H6=y
++CONFIG_SUNXI_DRAM_H6_LPDDR3=y
++CONFIG_MACPWR="PC16"
++CONFIG_MMC0_CD_PIN="PF6"
++CONFIG_MMC_SUNXI_SLOT_EXTRA=2
++CONFIG_USB3_VBUS_PIN="PL5"
++CONFIG_SPL_SPI_SUNXI=y
++# CONFIG_PSCI_RESET is not set
++# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
++CONFIG_SUN8I_EMAC=y
++CONFIG_PHY_SUN50I_USB3=y
++CONFIG_USB_XHCI_HCD=y
++CONFIG_USB_XHCI_DWC3=y
++CONFIG_USB_EHCI_HCD=y
++CONFIG_USB_OHCI_HCD=y
++CONFIG_USB_DWC3=y
++# CONFIG_USB_DWC3_GADGET is not set
Index: sysutils/u-boot/pkg/PFRAG.aarch64
===================================================================
RCS file: /cvs/ports/sysutils/u-boot/pkg/PFRAG.aarch64,v
retrieving revision 1.26
diff -u -p -u -p -r1.26 PFRAG.aarch64
--- sysutils/u-boot/pkg/PFRAG.aarch64   29 Oct 2021 11:14:46 -0000      1.26
+++ sysutils/u-boot/pkg/PFRAG.aarch64   14 Jan 2022 03:15:34 -0000
@@ -117,6 +117,13 @@ share/u-boot/pine64_plus/sunxi-spl.bin
 share/u-boot/pine64_plus/u-boot-sunxi-with-spl.bin
 @comment share/u-boot/pine64_plus/u-boot.bin
 @comment share/u-boot/pine64_plus/u-boot.img
+share/u-boot/pine_h64-model-b/
+share/u-boot/pine_h64-model-b/sunxi-spl.bin
+@comment share/u-boot/pine_h64-model-b/u-boot
+@comment share/u-boot/pine_h64-model-b/u-boot-spl.bin
+share/u-boot/pine_h64-model-b/u-boot-sunxi-with-spl.bin
+@comment share/u-boot/pine_h64-model-b/u-boot.bin
+@comment share/u-boot/pine_h64-model-b/u-boot.img
 share/u-boot/pinebook-pro-rk3399/
 share/u-boot/pinebook-pro-rk3399/idbloader.img
 @comment share/u-boot/pinebook-pro-rk3399/u-boot

Reply via email to