From b3d46473df89397263c6803ebed09cc832663b8a Mon Sep 17 00:00:00 2001 From: Arturo Buzarra Date: Fri, 7 Oct 2022 12:09:04 +0200 Subject: [PATCH] ccmp1: add support to DT overlays for ccmp1 platforms Signed-off-by: Arturo Buzarra --- meta-digi-arm/conf/machine/ccmp13-dvk.conf | 9 ++- meta-digi-arm/conf/machine/ccmp15-dvk.conf | 16 +++- .../u-boot/u-boot-dey/ccmp13-dvk/boot.txt | 80 ++++--------------- .../u-boot/u-boot-dey/ccmp15-dvk/boot.txt | 80 ++++--------------- 4 files changed, 54 insertions(+), 131 deletions(-) diff --git a/meta-digi-arm/conf/machine/ccmp13-dvk.conf b/meta-digi-arm/conf/machine/ccmp13-dvk.conf index b54653595..04c8d6ce6 100644 --- a/meta-digi-arm/conf/machine/ccmp13-dvk.conf +++ b/meta-digi-arm/conf/machine/ccmp13-dvk.conf @@ -45,7 +45,14 @@ FIP_UBOOT_CONFIG = "optee" # Define list of devicetree per board STM32MP_DEVICETREE ??= "ccmp13-dvk" # Extra DTB for board - need to specify it with .dtb ... -STM32MP_KERNEL_DEVICETREE:ccmp13-dvk += "ccmp133-dvk.dtb" +STM32MP_KERNEL_DEVICETREE:ccmp13-dvk += " \ + ccmp133-dvk.dtb \ + _ov_board_microe-accel2-click_ccmp13.dtbo \ + _ov_board_microe-gyro-click_ccmp13.dtbo \ + _ov_board_microe-i2c-2-spi_ccmp13.dtbo \ + _ov_som_bt_ccmp13.dtbo \ + _ov_som_wifi_ccmp13.dtbo \ +" # ========================================================================= # Machine features diff --git a/meta-digi-arm/conf/machine/ccmp15-dvk.conf b/meta-digi-arm/conf/machine/ccmp15-dvk.conf index b7b94099f..d0b3e63c4 100644 --- a/meta-digi-arm/conf/machine/ccmp15-dvk.conf +++ b/meta-digi-arm/conf/machine/ccmp15-dvk.conf @@ -45,8 +45,20 @@ FIP_UBOOT_CONFIG = "optee" # Define list of devicetree per board STM32MP_DEVICETREE ??= "ccmp15-dvk" # Extra DTB for board - need to specify it with .dtb ... -STM32MP_KERNEL_DEVICETREE:ccmp15-dvk += "ccmp157-dvk.dtb" -STM32MP_KERNEL_DEVICETREE:ccmp15-dvk += "ccmp151-dvk.dtb" +STM32MP_KERNEL_DEVICETREE:ccmp15-dvk += " \ + ccmp151-dvk.dtb \ + ccmp157-dvk.dtb \ + _ov_board_can2_ccmp15-dvk.dtbo \ + _ov_board_eth0-10-100_ccmp15-dvk.dtbo \ + _ov_board_fusion10-parallel_ccmp15-dvk.dtbo \ + _ov_board_fusion7-parallel_ccmp15-dvk.dtbo \ + _ov_board_g101evn010-lvds_ccmp15-dvk.dtbo \ + _ov_board_microe-accel2-click_ccmp15.dtbo \ + _ov_board_microe-gyro-click_ccmp15.dtbo \ + _ov_board_microe-i2c-2-spi_ccmp15.dtbo \ + _ov_som_bt_ccmp15.dtbo \ + _ov_som_wifi_ccmp15.dtbo \ +" # ========================================================================= # Machine features diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccmp13-dvk/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccmp13-dvk/boot.txt index 243cc9d4e..136b64444 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccmp13-dvk/boot.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccmp13-dvk/boot.txt @@ -2,74 +2,26 @@ # U-Boot bootscript for NAND images created by Yocto. # -# As the first step in the boot script, check if we are using DualBoot and -# if an upgrade is available. This requires the script to change some variables -# and save them, while the rest of the script changes variables only temporarily -# without saving them. - -# Dual boot update verification -if test "${dualboot}" = "yes"; then - if test "${upgrade_available}" = "1"; then - echo "Update detected; Booting new system in ${active_system} (try ${bootcount})" - else - if test "${active_system}" = "linux_a"; then - echo "Booting from system A" - setenv mtdbootpart ${active_system} - setenv mtdrootfspart ${rootfsvol_a} - setenv rootfsvol ${rootfsvol_a} - else - echo "Booting from system B" - setenv mtdbootpart ${active_system} - setenv mtdrootfspart ${rootfsvol_b} - setenv rootfsvol ${rootfsvol_b} - fi - fi -else - if test "${mtdbootpart}" = "recovery"; then - setenv boot_initrd true - setenv initrd_file uramdisk-recovery.img - else - true - fi -fi - - # Back up environment variables -setenv ORIG_extra_bootargs ${extra_bootargs} +setenv ORIG_overlays ${overlays} # -# Set device tree filename depending on the board ID (if defined) +# Determine overlays to apply depending on the hardware capabilities +# described by the HWID, SOM version, and carrier board version. # -if test -n "${board_id}"; then - setenv fdt_file imx6ul-ccimx6ulsbc-id${board_id}.dtb -else - # - # Set device tree filename depending on the hardware variant - # - if test "${module_variant}" = "0x02"; then - setenv fdt_file imx6ul-ccimx6ulsbc-wb.dtb - elif test "${module_variant}" = "0x03"; then - setenv fdt_file imx6ul-ccimx6ulsbc.dtb - elif test "${module_variant}" = "0x04"; then - setenv fdt_file imx6ul-ccimx6ulsbc-wb.dtb - elif test "${module_variant}" = "0x05"; then - setenv fdt_file imx6ul-ccimx6ulsbc.dtb - elif test "${module_variant}" = "0x06"; then - setenv fdt_file imx6ul-ccimx6ulsbc-wb.dtb - elif test "${module_variant}" = "0x07"; then - setenv fdt_file imx6ul-ccimx6ulsbc-wb.dtb - elif test "${module_variant}" = "0x08"; then - setenv fdt_file imx6ul-ccimx6ulsbc-wb.dtb - elif test "${module_variant}" = "0x09"; then - setenv fdt_file imx6ul-ccimx6ulsbc-wb.dtb - elif test "${module_variant}" = "0x0a"; then - setenv fdt_file imx6ul-ccimx6ulsbc.dtb - else - setenv fdt_file imx6ul-ccimx6ulsbc-wb.dtb - fi +setexpr module_has_wifi ${hwid_2} \& 20000 +setexpr module_has_wifi ${module_has_wifi} / 20000 +setexpr module_has_bt ${hwid_2} \& 40000 +setexpr module_has_bt ${module_has_bt} / 40000 + +if test "${module_has_bt}" = "1" && test -z "${disable_bt}"; then + setenv overlays _ov_som_bt_ccmp13.dtbo,${overlays} +fi + +if test "${module_has_wifi}" = "1" && test -z "${disable_wifi}"; then + setenv overlays _ov_som_wifi_ccmp13.dtbo,${overlays} fi -setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs} dboot linux nand ${mtdbootpart} @@ -77,5 +29,5 @@ dboot linux nand ${mtdbootpart} # We only get here in case of an error on the dboot command. # Undo changes to environment variables -setenv extra_bootargs ${ORIG_extra_bootargs} -setenv ORIG_extra_bootargs +setenv overlays ${ORIG_overlays} +setenv ORIG_overlays diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccmp15-dvk/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccmp15-dvk/boot.txt index 243cc9d4e..05462cb06 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccmp15-dvk/boot.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccmp15-dvk/boot.txt @@ -2,74 +2,26 @@ # U-Boot bootscript for NAND images created by Yocto. # -# As the first step in the boot script, check if we are using DualBoot and -# if an upgrade is available. This requires the script to change some variables -# and save them, while the rest of the script changes variables only temporarily -# without saving them. - -# Dual boot update verification -if test "${dualboot}" = "yes"; then - if test "${upgrade_available}" = "1"; then - echo "Update detected; Booting new system in ${active_system} (try ${bootcount})" - else - if test "${active_system}" = "linux_a"; then - echo "Booting from system A" - setenv mtdbootpart ${active_system} - setenv mtdrootfspart ${rootfsvol_a} - setenv rootfsvol ${rootfsvol_a} - else - echo "Booting from system B" - setenv mtdbootpart ${active_system} - setenv mtdrootfspart ${rootfsvol_b} - setenv rootfsvol ${rootfsvol_b} - fi - fi -else - if test "${mtdbootpart}" = "recovery"; then - setenv boot_initrd true - setenv initrd_file uramdisk-recovery.img - else - true - fi -fi - - # Back up environment variables -setenv ORIG_extra_bootargs ${extra_bootargs} +setenv ORIG_overlays ${overlays} # -# Set device tree filename depending on the board ID (if defined) +# Determine overlays to apply depending on the hardware capabilities +# described by the HWID, SOM version, and carrier board version. # -if test -n "${board_id}"; then - setenv fdt_file imx6ul-ccimx6ulsbc-id${board_id}.dtb -else - # - # Set device tree filename depending on the hardware variant - # - if test "${module_variant}" = "0x02"; then - setenv fdt_file imx6ul-ccimx6ulsbc-wb.dtb - elif test "${module_variant}" = "0x03"; then - setenv fdt_file imx6ul-ccimx6ulsbc.dtb - elif test "${module_variant}" = "0x04"; then - setenv fdt_file imx6ul-ccimx6ulsbc-wb.dtb - elif test "${module_variant}" = "0x05"; then - setenv fdt_file imx6ul-ccimx6ulsbc.dtb - elif test "${module_variant}" = "0x06"; then - setenv fdt_file imx6ul-ccimx6ulsbc-wb.dtb - elif test "${module_variant}" = "0x07"; then - setenv fdt_file imx6ul-ccimx6ulsbc-wb.dtb - elif test "${module_variant}" = "0x08"; then - setenv fdt_file imx6ul-ccimx6ulsbc-wb.dtb - elif test "${module_variant}" = "0x09"; then - setenv fdt_file imx6ul-ccimx6ulsbc-wb.dtb - elif test "${module_variant}" = "0x0a"; then - setenv fdt_file imx6ul-ccimx6ulsbc.dtb - else - setenv fdt_file imx6ul-ccimx6ulsbc-wb.dtb - fi +setexpr module_has_wifi ${hwid_2} \& 20000 +setexpr module_has_wifi ${module_has_wifi} / 20000 +setexpr module_has_bt ${hwid_2} \& 40000 +setexpr module_has_bt ${module_has_bt} / 40000 + +if test "${module_has_bt}" = "1" && test -z "${disable_bt}"; then + setenv overlays _ov_som_bt_ccmp15.dtbo,${overlays} +fi + +if test "${module_has_wifi}" = "1" && test -z "${disable_wifi}"; then + setenv overlays _ov_som_wifi_ccmp15.dtbo,${overlays} fi -setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs} dboot linux nand ${mtdbootpart} @@ -77,5 +29,5 @@ dboot linux nand ${mtdbootpart} # We only get here in case of an error on the dboot command. # Undo changes to environment variables -setenv extra_bootargs ${ORIG_extra_bootargs} -setenv ORIG_extra_bootargs +setenv overlays ${ORIG_overlays} +setenv ORIG_overlays