[U-Boot] [PATCH v3 4/6] cgtqmx6eval: Add SPL support

Marek Vasut marex at denx.de
Wed Oct 28 21:30:49 CET 2015


On Wednesday, October 28, 2015 at 04:30:01 PM, Otavio Salvador wrote:
> Congatec has several MX6 boards based on quad, dual, dual-lite and solo.
> 
> Add SPL support so that all the variants can be supported.
> 
> Signed-off-by: Otavio Salvador <otavio at ossystems.com.br>
> ---
> 
>  arch/arm/cpu/armv7/mx6/Kconfig                     |   3 +
>  board/congatec/cgtqmx6eval/README                  |  78 ++-
>  board/congatec/cgtqmx6eval/cgtqmx6eval.c           | 580
> +++++++++++++++++---- board/congatec/cgtqmx6eval/imximage.cfg            |
> 143 -----
>  ...gtqmx6qeval_defconfig => cgtqmx6eval_defconfig} |   5 +-
>  include/configs/cgtqmx6eval.h                      |  21 +-
>  6 files changed, 569 insertions(+), 261 deletions(-)
>  delete mode 100644 board/congatec/cgtqmx6eval/imximage.cfg
>  rename configs/{cgtqmx6qeval_defconfig => cgtqmx6eval_defconfig} (57%)
> 
> diff --git a/arch/arm/cpu/armv7/mx6/Kconfig
> b/arch/arm/cpu/armv7/mx6/Kconfig index 0b02e9e..9ee509e 100644
> --- a/arch/arm/cpu/armv7/mx6/Kconfig
> +++ b/arch/arm/cpu/armv7/mx6/Kconfig
> @@ -44,6 +44,9 @@ config TARGET_ARISTAINETOS2B
> 
>  config TARGET_CGTQMX6EVAL
>  	bool "cgtqmx6eval"
> +	select SUPPORT_SPL
> +	select DM
> +	select DM_THERMAL
> 
>  config TARGET_CM_FX6
>  	bool "CM-FX6"
> diff --git a/board/congatec/cgtqmx6eval/README
> b/board/congatec/cgtqmx6eval/README index 5e76d2a..b339cd0 100644
> --- a/board/congatec/cgtqmx6eval/README
> +++ b/board/congatec/cgtqmx6eval/README
> @@ -1,28 +1,70 @@
> -U-Boot for the Congatec Conga-QEVAl Evaluation Carrier board with
> -qmx6 quad module.
> +U-Boot for the Congatec QMX6 boards
> 
>  This file contains information for the port of U-Boot to the Congatec
> -Conga-QEVAl Evaluation Carrier board with qmx6 quad module.
> +QMX6 boards.
> 
> -1. Boot source, boot from SD card
> +1. Building U-boot
> +------------------
> +
> +- Build U-boot for Congatec QMX6 boards:
> +
> +$ make mrproper
> +$ make cgtqmx6eval_defconfig
> +$ make
> +
> +This will generate the following binaries:
> +
> +- SPL
> +- u-boot.img
> +
> +2. Flashing U-boot in the SPI NOR
>  ---------------------------------
> 
> -By default, the Congatec board can boot only from the SPI-NOR.
> -But, with the u-boot version provided with the board you can write boot
> -registers to force the board to reboot and boot from the SD slot. If
> -"bmode" command is not available from your pre-installed u-boot, these
> -instruction will produce the same effect:
> +Copy SPL and u-boot.img to the exported TFTP directory of the
> +host PC (/tftpboot , for example).
> +
> +=> sf probe
> +
> +=> tftp SPL
> +
> +=> sf erase 0x0 0x10000
> +
> +=> sf write 0x12000000 0x400 0x10000

sf update would suffice.

> +=> tftp u-boot.img
> +
> +=> sf erase 0x10000 0x70000
> +
> +=> sf write 0x12000000 0x10000 0x70000

DTTO.

> +Reboot the board and the new U-boot should come up.
> +

[...]

> +static void conv_ascii(unsigned char *dst, unsigned char *src, int len)
> +{
> +	int remain = len;
> +	unsigned char *sptr = src;
> +	unsigned char *dptr = dst;
> +
> +	while (remain)
> +	{
> +		if (*sptr) {
> +			*dptr = *sptr;
> +			dptr++;
> +		}
> +		sptr++;
> +		remain--;
> +	}
> +	*dptr = 0x0;
> +}
> +
> +#define CFG_MFG_ADDR_OFFSET	(spi->size - SZ_16K)
> +static bool is_2gb(void)
> +{
> +	struct spi_flash *spi;
> +	int ret;
> +	char buf[sizeof(struct mfgdata)];
> +	struct mfgdata *data = (struct mfgdata *)buf;
> +	unsigned char outbuf[32];
> +
> +	spi = spi_flash_probe(CONFIG_ENV_SPI_BUS,
> +			      CONFIG_ENV_SPI_CS,
> +			      CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE);
> +	ret = spi_flash_read(spi, CFG_MFG_ADDR_OFFSET, sizeof(struct mfgdata),
> +			     buf);
> +	if (ret)
> +		return false;
> +
> +	/* Congatec Part Numbers 104 and 105 have 2GiB of RAM */
> +	conv_ascii(outbuf, data->pn, sizeof(data->pn));
> +	if (!strcmp((const char *)outbuf, "016104") ||
> +	    !strcmp((const char *)outbuf, "016105"))

So why exactly don't you use memcmp() here and drop the abomination above ?

> +		return true;
> +	else
> +		return false;
> +}

[...]


More information about the U-Boot mailing list