TQMa6 with preparations for integrating additional TQ boards
v2 cover TQMa6 with preparations for integrating additional TQ boards
This series introduces features for sharing across different TQ boards, simplifying maintenance by avoiding code duplication.
These changes are implemented for the TQMa6.
They will also be used by TQMa7 and TQMa6UL, whose mainlining is currently being prepared.
These changes also serve as preparation for further work on the TQMa6 (in following series).
Changes V2:
- Drop patches 1 and 2 from the series.
They cause CI errors and need to be revised.
- Drop patch 12 with planned SPL usage the values can be read from the device trees.
- Uptate commit log (Use imperative mood)
Markus Niebel (2):
env: tq: add shareable environment settings
board/tq: Add common baseboard API
Max Merchel (6):
[cleanup]configs: tqma6.h: remove unused define for PHYS_SDRAM_SIZE [cleanup]configs: tqma6.h: remove unused define for PFUZE100_I2C
board: tqma6: change to use shareable tq environment
configs: tqma6: change to include tqma6.h in baseboard headers board/tq: Add common mmc API
board: tqma6: use common TQ mmc function
Paul Gerber (2):
board: tqma6: use common TQ baseboard
board: tqma6: update eMMC DSR handling
board/tq/common/Kconfig | 13 ++ board/tq/common/Makefile | 9 ++ board/tq/common/tq_bb.c | 78 +++++++++ board/tq/common/tq_bb.h | 39 +++++ board/tq/common/tq_sdmmc.c | 46 ++++++ board/tq/tqma6/Kconfig | 8 +- board/tq/tqma6/Makefile | 1 + board/tq/tqma6/tqma6.c | 39 +++-- board/tq/tqma6/tqma6.env | 47 ++++++ board/tq/tqma6/tqma6_bb.h | 28 ---- board/tq/tqma6/tqma6_emmc.c | 88 ++++++++++ board/tq/tqma6/tqma6_emmc.h | 19 +++ board/tq/tqma6/tqma6_mba6.c | 26 +-- board/tq/tqma6/tqma6_wru4.c | 29 +--- include/configs/tqma6.h | 266 ++----------------------------- include/configs/tqma6_mba6.h | 3 +- include/configs/tqma6_wru4.h | 2 + include/env/tq/mmc.env | 82 ++++++++++ include/env/tq/nfs.env | 51 ++++++ include/env/tq/spi.env | 23 +++ include/env/tq/tq-imx-shared.env | 38 +++++ include/env/tq/ubi.env | 47 ++++++ 22 files changed, 641 insertions(+), 341 deletions(-) create mode 100644 board/tq/common/Kconfig create mode 100644 board/tq/common/Makefile create mode 100644 board/tq/common/tq_bb.c create mode 100644 board/tq/common/tq_bb.h create mode 100644 board/tq/common/tq_sdmmc.c create mode 100644 board/tq/tqma6/tqma6.env delete mode 100644 board/tq/tqma6/tqma6_bb.h create mode 100644 board/tq/tqma6/tqma6_emmc.c create mode 100644 board/tq/tqma6/tqma6_emmc.h create mode 100644 include/env/tq/mmc.env create mode 100644 include/env/tq/nfs.env create mode 100644 include/env/tq/spi.env create mode 100644 include/env/tq/tq-imx-shared.env create mode 100644 include/env/tq/ubi.env
base-commit: eb00c710508d09b2a3b9aca75dd18280f1304703
Signature · 1 line
2.43.0
PATCH v2 1/10 env: tq: add shareable environment settings
From: Markus Niebel <[email protected]>
Prepare moving boiler plate code out of board confguration header and prepare to share a lot of things between boards.
--- include/env/tq/mmc.env | 82 ++++++++++++++++++++++++++++++++ include/env/tq/nfs.env | 51 ++++++++++++++++++++ include/env/tq/spi.env | 23 +++++++++ include/env/tq/tq-imx-shared.env | 38 +++++++++++++++ include/env/tq/ubi.env | 47 ++++++++++++++++++ 5 files changed, 241 insertions(+) create mode 100644 include/env/tq/mmc.env create mode 100644 include/env/tq/nfs.env create mode 100644 include/env/tq/spi.env create mode 100644 include/env/tq/tq-imx-shared.env create mode 100644 include/env/tq/ubi.env
include/env/tq/mmc.env new file +82 -0
@@ -0,0 +1,82 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/* + * Copyright (c) 2024-2026 TQ-Systems GmbH <[email protected]>, + * D-82229 Seefeld, Germany. + * Author: Max Merchel + * + * shared mmc environment for TQ boards + */ + +addmmc= + setenv bootargs "${bootargs}" + root=/dev/mmcblk"${mmcblkdev}"p"${mmcrootpart}" "${rootfsmode}" rootwait; + +get_blockcount= + setexpr blkc "${filesize}" + 0x1ff; + setexpr blkc "${blkc}" / 0x200; + +load_mmc= + mmc dev "${mmcdev}"; mmc rescan; + load mmc "${mmcdev}":"${mmcpart}" "${kernel_addr_r}" /boot/"${image}"; + load mmc "${mmcdev}":"${mmcpart}" "${fdt_addr_r}" /boot/"${fdtfile}"; + fdt address "${fdt_addr_r}"; + fdt resize 0x100000; + for overlay in "${fdt_overlays}"; do + load mmc "${mmcdev}":"${mmcpart}" "${fdtoverlay_addr_r}" + /boot/"${overlay}" && fdt apply "${fdtoverlay_addr_r}"; + done; + +mmcargs=run addtty addmmc + +mmcboot= + echo "Booting from mmc ..."; + setenv bootargs && run mmcargs && + if run load_mmc; then + run boot_os; + else + echo "ERROR: loading from mmc"; + fi; + +mmcpart=2 + +mmc_finish_update_uboot= + mmc write "${loadaddr}" "${update_start_blk}" "${blkc}"; + mmc dev "${mmcdev}" 0; + setenv update_part; + setenv update_start_blk; + setenv blkc; + +mmc_prepare_update_uboot= + echo "Write U-Boot to mmc "${mmcdev}" ..."; + mmc dev "${mmcdev}"; mmc rescan; + run get_blockcount; + setenv update_start_blk "${uboot_mmc_start}"; + setenv update_part 0; + +mmc_switch_part= + mmc partconf "${mmcdev}" update_part; + mmc dev "${mmcdev}" "${update_part}"; + +mmcrootpart=2 + +update_uboot_mmc= + run check_ipaddr; + if tftp "${uboot}"; then + run mmc_prepare_update_uboot; + if itest "${blkc}" >= "${uboot_mmc_size}"; then + echo "ERROR: size to large ..."; + exit; + fi; + if itest "${mmcdev}" == "${emmc_dev}"; then + run mmc_switch_part; + if itest "${update_part}" > 0 ; then + if env exists emmc_bootp_start; then + setenv update_start_blk "${emmc_bootp_start}"; + else + echo "ERROR: eMMC boot partition block unset"; + exit; + fi; + fi; + fi; + run mmc_finish_update_uboot; + fi;
include/env/tq/nfs.env new file +51 -0
51 lines not on this page · raw message
include/env/tq/spi.env new file +23 -0
@@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/* + * Copyright (c) 2024-2026 TQ-Systems GmbH <[email protected]>, + * D-82229 Seefeld, Germany. + * Author: Max Merchel + * + * shared spi environment for TQ boards + */ + +update_uboot_spi= + run check_ipaddr; + if tftp ${uboot}; then + if itest "${filesize}" >= "${uboot_spi_size}"; then + echo "ERROR: size to large ..."; + exit; + fi; + echo "Write u-boot image to SPI NOR ..."; + if sf probe; then + run write_uboot_spi; + fi; + fi; + +write_uboot_spi=sf update "${loadaddr}" "${uboot_spi_start}" "${filesize}"
include/env/tq/tq-imx-shared.env new file +38 -0
@@ -0,0 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/* + * Copyright (c) 2024-2026 TQ-Systems GmbH <[email protected]>, + * D-82229 Seefeld, Germany. + * Author: Max Merchel + * + * shared environment for TQ imx boards + */ + +#ifdef CONFIG_CMD_SF +#include "spi.env" +#ifdef CONFIG_CMD_UBIFS +#include "ubi.env" +#endif /* CONFIG_CMD_UBIFS */ +#endif /* CONFIG_CMD_SF */ + +#ifdef CONFIG_CMD_MMC +#include "mmc.env" +#endif + +#ifdef CONFIG_CMD_NFS +#include "nfs.env" +#endif + +addip= + run check_ipaddr; + setenv bootargs "${bootargs}" + ip="${ipaddr}":"${serverip}":"${gatewayip}":"${netmask}":"${hostname}":"${netdev}":off + +addtty=setenv bootargs "${bootargs}" "${console}" + +check_ipaddr= + if test -z "${ipaddr}" || test -z "${serverip}"; then + echo "ipaddr or serverip unset, falling back to DHCP..."; + dhcp; + fi; + +rootfsmode=ro
include/env/tq/ubi.env new file +47 -0
47 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH v2 2/10 configs: tqma6.h: remove unused define for PHYS_SDRAM_SIZE
In reply to Max MerchelRemove the definition of PHYS_SDRAM_SIZE as it is not used.
--- include/configs/tqma6.h | 8 -------- 1 file changed, 8 deletions(-)
include/configs/tqma6.h +0 -8
@@ -16,14 +16,6 @@#include "mx6_common.h" -#if defined(CONFIG_TQMA6S ) -#define PHYS_SDRAM_SIZE (512u * SZ_1M) -#elif defined(CONFIG_TQMA6DL ) -#define PHYS_SDRAM_SIZE (SZ_1G) -#elif defined(CONFIG_TQMA6Q ) -#define PHYS_SDRAM_SIZE (SZ_1G) -#endif -/* SPI Flash */ #define TQMA6_SPI_FLASH_SECTOR_SIZE SZ_64K
Signature · 1 line
2.43.0
PATCH v2 3/10 configs: tqma6.h: remove unused define for PFUZE100_I2C
In reply to Max MerchelRemove the definition of CFG_POWER_PFUZE100_I2C_ADDR and TQMA6_PFUZE100_I2C_BUS as it is not used.
--- include/configs/tqma6.h | 5 ----- 1 file changed, 5 deletions(-)
include/configs/tqma6.h +0 -5
@@ -20,11 +20,6 @@#define TQMA6_SPI_FLASH_SECTOR_SIZE SZ_64K -#if !defined(CONFIG_DM_PMIC ) -#define CFG_POWER_PFUZE100_I2C_ADDR 0x08 -#define TQMA6_PFUZE100_I2C_BUS 2 -#endif -/* MMC Configs */ #define CFG_SYS_FSL_ESDHC_ADDR 0
Signature · 1 line
2.43.0
PATCH v2 4/10 board: tqma6: change to use shareable tq environment
In reply to Max MerchelCreate tqma6 environment file and remove CFG_FEC_MXC_PHYADDR as it comes from device tree.
--- board/tq/tqma6/tqma6.env | 47 +++++++ include/configs/tqma6.h | 244 ++--------------------------------- include/configs/tqma6_mba6.h | 3 - 3 files changed, 61 insertions(+), 233 deletions(-) create mode 100644 board/tq/tqma6/tqma6.env
board/tq/tqma6/tqma6.env new file +47 -0
@@ -0,0 +1,47 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/* + * Copyright (c) 2024-2026 TQ-Systems GmbH <[email protected]>, + * D-82229 Seefeld, Germany. + * Author: Max Merchel + * + * TQMa6 environment + */ + +#include <env/tq/tq-imx-shared.env> + +board=tqma6 +boot_os=bootz "${kernel_addr_r}" - "${fdt_addr_r}" +emmc_bootp_start=TQMA6_MMC_UBOOT_SECTOR_START +emmc_dev=0 +fdt_addr_r=TQMA6_FDT_ADDRESS +fdtoverlay_addr_r=TQMA6_FDT_OVERLAY_ADDR +image=zImage +kernel_addr_r=CONFIG_SYS_LOAD_ADDR +pxefile_addr_r=CONFIG_SYS_LOAD_ADDR +ramdisk_addr_r=TQMA6_INITRD_ADDRESS +mmcautodetect=yes +mmcblkdev=0 +mmcdev=CONFIG_ENV_MMC_DEVICE_INDEX +netdev=eth0 +sd_dev=1 +uboot=u-boot-with-spl.imx +uboot_mmc_start=TQMA6_MMC_UBOOT_SECTOR_START +uboot_mmc_size=TQMA6_MMC_UBOOT_SECTOR_COUNT +uboot_spi_sector_size=TQMA6_SPI_FLASH_SECTOR_SIZE +uboot_spi_start=TQMA6_SPI_UBOOT_START +uboot_spi_size=TQMA6_SPI_UBOOT_SIZE + +#ifdef CONFIG_USB_FUNCTION_FASTBOOT + +/* 0=user 1=boot1 2=boot2 */ +fastboot_mmc_boot_partition = 1 + +fastboot_partition_alias_all=CONFIG_FASTBOOT_FLASH_MMC_DEV :0 + +fastboot_raw_partition_bootloader= + TQMA6_MMC_UBOOT_SECTOR_START TQMA6_MMC_UBOOT_SECTOR_COUNT mmcpart + "${fastboot_mmc_boot_partition}" + +fastbootcmd=fastboot usb 0 + +#endif /* CONFIG_USB_FUNCTION_FASTBOOT */
include/configs/tqma6.h +14 -230
269 lines not on this page · raw message
include/configs/tqma6_mba6.h +0 -3
@@ -11,9 +11,6 @@#ifndef __CONFIG_TQMA6_MBA6_H#define __CONFIG_TQMA6_MBA6_H -#define CFG_FEC_MXC_PHYADDR 0x03 -#define CFG_MXC_UART_BASE UART2_BASE -#define CONSOLE_DEV "ttymxc1"#endif /* __CONFIG_TQMA6_MBA6_H */
Signature · 1 line
2.43.0
PATCH v2 5/10 configs: tqma6: change to include tqma6.h in baseboard headers
In reply to Max MerchelThe SoM (TQMa6) can be used on various baseboards. No modifications to the SoM files should be required to use the SoM on different baseboards. Therefore, include the SoM headers in the baseboard.
--- board/tq/tqma6/Kconfig | 3 ++- include/configs/tqma6.h | 13 ------------- include/configs/tqma6_mba6.h | 2 ++ include/configs/tqma6_wru4.h | 2 ++ 4 files changed, 6 insertions(+), 14 deletions(-)
board/tq/tqma6/Kconfig +2 -1
@@ -7,7 +7,8 @@ config SYS_VENDOR default "tq" config SYS_CONFIG_NAME - default "tqma6" + default "tqma6_mba6" if MBA6 + default "tqma6_wru4" if WRU4 choice prompt "TQMa6 SoC variant"
include/configs/tqma6.h +0 -13
@@ -38,17 +38,4 @@#define TQMA6_SPI_UBOOT_START 0x400#define TQMA6_SPI_UBOOT_SIZE 0xc0000 -/* -* All the defines above are for the TQMa6 SoM -* -* Now include the baseboard specific configuration -*/ -#ifdef CONFIG_MBA6 -#include "tqma6_mba6.h" -#elif CONFIG_WRU4 -#include "tqma6_wru4.h" -#else -#error "No baseboard for the TQMa6 defined!" -#endif -#endif /* __TQMA6_CONFIG_H */
include/configs/tqma6_mba6.h +2 -0
@@ -11,6 +11,8 @@#ifndef __CONFIG_TQMA6_MBA6_H#define __CONFIG_TQMA6_MBA6_H +#include "tqma6.h" +#define CFG_MXC_UART_BASE UART2_BASE#endif /* __CONFIG_TQMA6_MBA6_H */
include/configs/tqma6_wru4.h +2 -0
@@ -6,6 +6,8 @@#ifndef __CONFIG_TQMA6_WRU4_H#define __CONFIG_TQMA6_WRU4_H +#include "tqma6.h" +/* Ethernet */ #define CFG_FEC_MXC_PHYADDR 0x01
Signature · 1 line
2.43.0
PATCH v2 6/10 board/tq: Add common baseboard API
In reply to Max MerchelFrom: Markus Niebel <[email protected]>
TQMa6 and other SoMs from TQ-Systems GmbH need a baseboard. Therefore functionality of U-Boot board callbacks may be distributed between SoM and baseboard implementation.
To prevent code duplication and boilerplate implement a baseboard specific API for TQ boards with weak defaults that can be filled out for baseboard implementations as needed.
--- board/tq/common/Kconfig | 10 ++++++ board/tq/common/Makefile | 8 +++++ board/tq/common/tq_bb.c | 78 ++++++++++++++++++++++++++++++++++++++++ board/tq/common/tq_bb.h | 39 ++++++++++++++++++++ 4 files changed, 135 insertions(+) create mode 100644 board/tq/common/Kconfig create mode 100644 board/tq/common/Makefile create mode 100644 board/tq/common/tq_bb.c create mode 100644 board/tq/common/tq_bb.h
board/tq/common/Kconfig new file +10 -0
@@ -0,0 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (c) 2023-2026 TQ-Systems GmbH <[email protected]>, +# D-82229 Seefeld, Germany. +# Author: Markus Niebel, Max Merchel +# + +config TQ_COMMON_BB + bool + default y
board/tq/common/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (c) 2016-2026 TQ-Systems GmbH <[email protected]>, +# D-82229 Seefeld, Germany. +# Author: Markus Niebel +# + +obj-$(CONFIG_TQ_COMMON_BB) += tq_bb.o
board/tq/common/tq_bb.c new file +78 -0
78 lines not on this page · raw message
board/tq/common/tq_bb.h new file +39 -0
@@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* Copyright (c) 2013-2026 TQ-Systems GmbH <[email protected]>, +* D-82229 Seefeld, Germany. +* Author: Markus Niebel +*/ + +#ifndef __TQ_BB_H +#define __TQ_BB_H + +struct mmc ; +struct bd_info ; +struct node_info ; + +int tq_bb_board_mmc_getwp (struct mmc *mmc); +int tq_bb_board_mmc_getcd (struct mmc *mmc); +int tq_bb_board_mmc_init (struct bd_info *bis); + +int tq_bb_board_early_init_f (void ); +int tq_bb_board_init (void ); +int tq_bb_board_late_init (void ); +int tq_bb_checkboard (void ); +void tq_bb_board_quiesce_devices (void ); + +const char *tq_bb_get_boardname (void ); + +#if IS_ENABLED (CONFIG_SPL_BUILD ) +void tq_bb_board_init_f (ulong dummy); +void tq_bb_spl_board_init (void ); +#endif + +/* +* Device Tree Support +*/ +#if IS_ENABLED (CONFIG_OF_BOARD_SETUP ) &&IS_ENABLED (CONFIG_OF_LIBFDT ) +int tq_bb_ft_board_setup (void *blob,struct bd_info *bis); +#endif /* IS_ENABLED(CONFIG_OF_BOARD_SETUP) && IS_ENABLED(CONFIG_OF_LIBFDT) */ + +#endif /* __TQ_BB_H */
Signature · 1 line
2.43.0
PATCH v2 7/10 board: tqma6: use common TQ baseboard
In reply to Max MerchelFrom: Paul Gerber <[email protected]>
Update functions to use the common baseboard header and select TQ_COMMON_BB Kconfig option for MBa6 and WRU4.
While at it, remove empty implementations that are now covered by board/tq/common.
--- board/tq/tqma6/Kconfig | 4 ++++ board/tq/tqma6/tqma6.c | 17 +++++++++-------- board/tq/tqma6/tqma6_bb.h | 28 ---------------------------- board/tq/tqma6/tqma6_mba6.c | 26 +++----------------------- board/tq/tqma6/tqma6_wru4.c | 29 +++++++---------------------- 5 files changed, 23 insertions(+), 81 deletions(-) delete mode 100644 board/tq/tqma6/tqma6_bb.h
board/tq/tqma6/Kconfig +4 -0
@@ -72,6 +72,7 @@ choice config MBA6 bool "TQMa6 on MBa6 Starterkit" + select TQ_COMMON_BB select USB select CMD_USB select USB_STORAGE
@@ -92,6 +93,7 @@ config MBA6 config WRU4 bool "OHB WRU-IV" + select TQ_COMMON_BB help Select the OHB Systems AG WRU-IV baseboard.
@@ -107,4 +109,6 @@ config IMX_CONFIG default "board/tq/tqma6/tqma6dl.cfg" if TQMA6DL default "board/tq/tqma6/tqma6s.cfg" if TQMA6S +source "board/tq/common/Kconfig" + endif
board/tq/tqma6/tqma6.c +9 -8
@@ -26,7 +26,7 @@#include <power/pfuze100_pmic.h> #include <power/pmic.h> -#include "tqma6_bb.h" +#include "../common/tq_bb.h" DECLARE_GLOBAL_DATA_PTR ;
@@ -41,7 +41,7 @@ static const uint16_t tqma6_emmc_dsr = 0x0100;int board_early_init_f (void ) { -return tqma6_bb_board_early_init_f (); +return tq_bb_board_early_init_f (); }int board_init (void )
@@ -49,7 +49,7 @@ int board_init(void)/* address of boot parameters */ gd->bd->bi_boot_params =PHYS_SDRAM +0x100 ; -tqma6_bb_board_init (); +tq_bb_board_init ();return 0 ; }
@@ -96,11 +96,12 @@ int board_late_init(void) {env_set ("board_name" ,tqma6_get_boardname ()); -tqma6_bb_board_late_init (); +tq_bb_board_late_init ();printf ("Board: %s on a %s\n" ,tqma6_get_boardname (), -tqma6_bb_get_boardname ()); -return 0 ; +tq_bb_get_boardname ()); + +return tq_bb_checkboard (); }/*
@@ -113,14 +114,14 @@ int ft_board_setup(void *blob, struct bd_info *bd)char modelstr[MODELSTRLEN ];snprintf (modelstr,MODELSTRLEN ,"TQ %s on %s" ,tqma6_get_boardname (), -tqma6_bb_get_boardname ()); +tq_bb_get_boardname ());do_fixup_by_path_string (blob,"/" ,"model" , modelstr);fdt_fixup_memory (blob, (u64 )PHYS_SDRAM , (u64 )gd->ram_size);/* bring in eMMC dsr settings */ do_fixup_by_path_u32 (blob,"/soc/aips-bus@02100000/usdhc@02198000" ,"dsr" , tqma6_emmc_dsr,2 ); -tqma6_bb_ft_board_setup (blob, bd); +tq_bb_ft_board_setup (blob, bd);return 0 ; }
board/tq/tqma6/tqma6_bb.h deleted +0 -28
@@ -1,28 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* -* Copyright (c) 2013-2014 TQ-Systems GmbH <[email protected]>, -* D-82229 Seefeld, Germany. -* Author: Markus Niebel -*/ - -#ifndef __TQMA6_BB__ -#define __TQMA6_BB__ - -int tqma6_bb_board_mmc_getwp (struct mmc *mmc); -int tqma6_bb_board_mmc_getcd (struct mmc *mmc); -int tqma6_bb_board_mmc_init (struct bd_info *bis); - -int tqma6_bb_board_early_init_f (void ); -int tqma6_bb_board_init (void ); -int tqma6_bb_board_late_init (void ); -int tqma6_bb_checkboard (void ); - -const char *tqma6_bb_get_boardname (void ); -/* -* Device Tree Support -*/ -#if defined(CONFIG_OF_BOARD_SETUP ) && defined(CONFIG_OF_LIBFDT ) -void tqma6_bb_ft_board_setup (void *blob,struct bd_info *bd); -#endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */ - -#endif
board/tq/tqma6/tqma6_mba6.c +3 -23
@@ -31,7 +31,7 @@#include <mmc.h> #include <netdev.h> -#include "tqma6_bb.h" +#include "../common/tq_bb.h" #if defined(CONFIG_TQMA6Q )
@@ -126,34 +126,14 @@ int board_phy_config(struct phy_device *phydev)return 0 ; } -int tqma6_bb_board_early_init_f (void ) -{ -return 0 ; -} - -int tqma6_bb_board_init (void ) +int tq_bb_board_init (void ) {mba6_setup_iomuxc_enet ();return 0 ; } -int tqma6_bb_board_late_init (void ) -{ -return 0 ; -} - -const char *tqma6_bb_get_boardname (void ) +const char *tq_bb_get_boardname (void ) {return "MBa6x" ; } - -/* -* Device Tree Support -*/ -#if defined(CONFIG_OF_BOARD_SETUP ) && defined(CONFIG_OF_LIBFDT ) -void tqma6_bb_ft_board_setup (void *blob,struct bd_info *bd) -{ -/* TBD */ -} -#endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */
board/tq/tqma6/tqma6_wru4.c +7 -22
@@ -33,7 +33,7 @@#include <mmc.h> #include <netdev.h> -#include "tqma6_bb.h" +#include "../common/tq_bb.h" /* UART */ #define UART4_PAD_CTRL ( \
@@ -95,7 +95,7 @@ static struct fsl_esdhc_cfg usdhc2_cfg = { .max_bus_width = 4, }; -int tqma6_bb_board_mmc_getcd (struct mmc *mmc) +int tq_bb_board_mmc_getcd (struct mmc *mmc) {struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;int ret =0 ;
@@ -106,7 +106,7 @@ int tqma6_bb_board_mmc_getcd(struct mmc *mmc)return ret; } -int tqma6_bb_board_mmc_getwp (struct mmc *mmc) +int tq_bb_board_mmc_getwp (struct mmc *mmc) {struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;int ret =0 ;
@@ -117,7 +117,7 @@ int tqma6_bb_board_mmc_getwp(struct mmc *mmc)return ret; } -int tqma6_bb_board_mmc_init (struct bd_info *bis) +int tq_bb_board_mmc_init (struct bd_info *bis) {int ret;
@@ -256,14 +256,14 @@ static void gpio_init(void)gpio_direction_output (GPIO_UART3_PWRON ,0 ); } -int tqma6_bb_board_early_init_f (void ) +int tq_bb_board_early_init_f (void ) {setup_iomuxc_uart4 ();return 0 ; } -int tqma6_bb_board_init (void ) +int tq_bb_board_init (void ) {setup_iomuxc_enet ();
@@ -279,12 +279,7 @@ int tqma6_bb_board_init(void)return 0 ; } -int tqma6_bb_board_late_init (void ) -{ -return 0 ; -} - -const char *tqma6_bb_get_boardname (void ) +const char *tq_bb_get_boardname (void ) {return "WRU-IV" ; }
@@ -331,13 +326,3 @@ int board_ehci_power(int port, int on)return 0 ; } - -/* -* Device Tree Support -*/ -#if defined(CONFIG_OF_BOARD_SETUP ) && defined(CONFIG_OF_LIBFDT ) -void tqma6_bb_ft_board_setup (void *blob,struct bd_info *bd) -{ -/* TBD */ -} -#endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */
Signature · 1 line
2.43.0
PATCH v2 8/10 board/tq: Add common mmc API
In reply to Max MerchelReduce code duplication by adding a default implementation
--- board/tq/common/Kconfig | 3 +++ board/tq/common/Makefile | 1 + board/tq/common/tq_sdmmc.c | 46 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 board/tq/common/tq_sdmmc.c
board/tq/common/Kconfig +3 -0
@@ -8,3 +8,6 @@ config TQ_COMMON_BB bool default y + +config TQ_COMMON_SDMMC + bool
board/tq/common/Makefile +1 -0
@@ -6,3 +6,4 @@ # obj-$(CONFIG_TQ_COMMON_BB) += tq_bb.o +obj-$(CONFIG_TQ_COMMON_SDMMC) += tq_sdmmc.o
board/tq/common/tq_sdmmc.c new file +46 -0
46 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH v2 9/10 board: tqma6: use common TQ mmc function
In reply to Max MerchelAdd function from common mmc header and
select TQ_COMMON_SDMMC Kconfig option for MBa6
--- board/tq/tqma6/Kconfig | 1 + board/tq/tqma6/tqma6_mba6.c | 6 ++++++ 2 files changed, 7 insertions(+)
board/tq/tqma6/Kconfig +1 -0
@@ -73,6 +73,7 @@ choice config MBA6 bool "TQMa6 on MBa6 Starterkit" select TQ_COMMON_BB + select TQ_COMMON_SDMMC select USB select CMD_USB select USB_STORAGE
board/tq/tqma6/tqma6_mba6.c +6 -0
@@ -137,3 +137,9 @@ const char *tq_bb_get_boardname(void) {return "MBa6x" ; } + +int tq_bb_board_late_init (void ) +{ +board_late_mmc_env_init (); +return 0 ; +}
Signature · 1 line
2.43.0
PATCH v2 10/10 board: tqma6: update eMMC DSR handling
In reply to Max MerchelFrom: Paul Gerber <[email protected]>
New SoM revision use series termination for eMMC signals while older do not. To prevent signal overshot on older revisions, DSR must be set and limited. The eMMC type is used to differentiate between revisions. Keep a table with all types, that are known to require DSR.
--- board/tq/tqma6/Makefile | 1 + board/tq/tqma6/tqma6.c | 24 +++++++--- board/tq/tqma6/tqma6_emmc.c | 88 +++++++++++++++++++++++++++++++++++++ board/tq/tqma6/tqma6_emmc.h | 19 ++++++++ 4 files changed, 125 insertions(+), 7 deletions(-) create mode 100644 board/tq/tqma6/tqma6_emmc.c create mode 100644 board/tq/tqma6/tqma6_emmc.h
board/tq/tqma6/Makefile +1 -0
@@ -6,6 +6,7 @@ # obj-y := tqma6.o +obj-y += tqma6_emmc.o obj-$(CONFIG_MBA6) += tqma6_mba6.o obj-$(CONFIG_WRU4) += tqma6_wru4.o
board/tq/tqma6/tqma6.c +17 -7
@@ -26,6 +26,7 @@#include <power/pfuze100_pmic.h> #include <power/pmic.h> +#include "tqma6_emmc.h" #include "../common/tq_bb.h" DECLARE_GLOBAL_DATA_PTR ;
@@ -37,8 +38,6 @@ int dram_init(void)return 0 ; } -static const uint16_t tqma6_emmc_dsr =0x0100 ; -int board_early_init_f (void ) {return tq_bb_board_early_init_f ();
@@ -46,9 +45,13 @@ int board_early_init_f(void)int board_init (void ) { +struct mmc *mmc =find_mmc_device (0 ); +/* address of boot parameters */ gd->bd->bi_boot_params =PHYS_SDRAM +0x100 ; +tqma6_mmc_detect_card_type (mmc); +tq_bb_board_init ();return 0 ;
@@ -111,17 +114,24 @@ int board_late_init(void)#define MODELSTRLEN 32uint ft_board_setup (void *blob,struct bd_info *bd) { +struct mmc *mmc =find_mmc_device (0 );char modelstr[MODELSTRLEN ];snprintf (modelstr,MODELSTRLEN ,"TQ %s on %s" ,tqma6_get_boardname (),tq_bb_get_boardname ());do_fixup_by_path_string (blob,"/" ,"model" , modelstr);fdt_fixup_memory (blob, (u64 )PHYS_SDRAM , (u64 )gd->ram_size); -/* bring in eMMC dsr settings */ -do_fixup_by_path_u32 (blob, -"/soc/aips-bus@02100000/usdhc@02198000" , -"dsr" , tqma6_emmc_dsr,2 ); -tq_bb_ft_board_setup (blob, bd); + +/* bring in eMMC dsr settings if needed */ +if (mmc && (!mmc_init (mmc))) { +if (tqma6_emmc_need_dsr (mmc) >0 ) { +tqma6_ft_fixup_emmc_dsr (blob, +"/soc/bus@2100000/mmc@2198000" , +TQMA6_EMMC_DSR ); + } + }else { +puts ("eMMC: not present?\n" ); + }return 0 ; }
board/tq/tqma6/tqma6_emmc.c new file +88 -0
88 lines not on this page · raw message
board/tq/tqma6/tqma6_emmc.h new file +19 -0
@@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* Copyright (c) 2017-2026 TQ-Systems GmbH <[email protected]>, +* D-82229 Seefeld, Germany. +* Author: Markus Niebel +*/ + +#ifndef __TQMA6_EMMC_H__ +#define __TQMA6_EMMC_H__ + +#define TQMA6_EMMC_DSR 0x0100 + +struct mmc ; + +int tqma6_emmc_need_dsr (const struct mmc *mmc); +void tqma6_ft_fixup_emmc_dsr (void *blob,const char *path,u32 value); +void tqma6_mmc_detect_card_type (struct mmc *mmc); + +#endif /* __TQMA6_EMMC_H__ */
Signature · 1 line
2.43.0
Quoted 72 lines · Max Merchel
This series introduces features for sharing across different TQ boards, simplifying maintenance by avoiding code duplication.
These changes are implemented for the TQMa6.
They will also be used by TQMa7 and TQMa6UL, whose mainlining is currently being prepared.These changes also serve as preparation for further work on the TQMa6 (in following series).
Changes V2:
- Drop patches 1 and 2 from the series.
They cause CI errors and need to be revised.
- Drop patch 12 with planned SPL usage the values can be read from the device trees.
- Uptate commit log (Use imperative mood)Markus Niebel (2):
env: tq: add shareable environment settings
board/tq: Add common baseboard APIMax Merchel (6):
[cleanup]configs:tqma6.h: remove unused define forPHYS_SDRAM_SIZE[cleanup]configs:tqma6.h: remove unused define forPFUZE100_I2C
board: tqma6: change to use shareable tq environment
configs: tqma6: change to includetqma6.hin baseboard headers board/tq: Add common mmc API
board: tqma6: use common TQ mmc functionPaul Gerber (2):
board: tqma6: use common TQ baseboard
board: tqma6: update eMMC DSR handlingboard/tq/common/Kconfig | 13 ++ board/tq/common/Makefile | 9 ++ board/tq/common/tq_bb.c | 78 +++++++++ board/tq/common/tq_bb.h | 39 +++++ board/tq/common/tq_sdmmc.c | 46 ++++++ board/tq/tqma6/Kconfig | 8 +- board/tq/tqma6/Makefile | 1 + board/tq/tqma6/tqma6.c | 39 +++-- board/tq/tqma6/tqma6.env | 47 ++++++ board/tq/tqma6/tqma6_bb.h | 28 ---- board/tq/tqma6/tqma6_emmc.c | 88 ++++++++++ board/tq/tqma6/tqma6_emmc.h | 19 +++ board/tq/tqma6/tqma6_mba6.c | 26 +-- board/tq/tqma6/tqma6_wru4.c | 29 +--- include/configs/tqma6.h | 266 ++----------------------------- include/configs/tqma6_mba6.h | 3 +- include/configs/tqma6_wru4.h | 2 + include/env/tq/mmc.env | 82 ++++++++++ include/env/tq/nfs.env | 51 ++++++ include/env/tq/spi.env | 23 +++ include/env/tq/tq-imx-shared.env | 38 +++++ include/env/tq/ubi.env | 47 ++++++ 22 files changed, 641 insertions(+), 341 deletions(-)create mode 100644 board/tq/common/Kconfig create mode 100644 board/tq/common/Makefile create mode 100644
board/tq/common/tq_bb.ccreate mode 100644board/tq/common/tq_bb.hcreate mode 100644board/tq/common/tq_sdmmc.ccreate mode 100644 board/tq/tqma6/tqma6.env delete mode 100644board/tq/tqma6/tqma6_bb.hcreate mode 100644board/tq/tqma6/tqma6_emmc.ccreate mode 100644board/tq/tqma6/tqma6_emmc.hcreate mode 100644include/env/tq/mmc.envcreate mode 100644include/env/tq/nfs.envcreate mode 100644include/env/tq/spi.envcreate mode 100644include/env/tq/tq-imx-shared.envcreate mode 100644include/env/tq/ubi.env
Quoted 1 line
base-commit:
eb00c710508d09b2a3b9aca75dd18280f1304703
Any further feedback on this?
Signature · 7 lines
Best regards, Max TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht München, HRB 105018 Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider http://www.tq-group.com/