[U-Boot] [PATCH V3 12/18] arm: mx6: add support for Compulab cm-fx6 CoM

Simon Glass
2014-08-12T14:48:36Z

Hi Nikita,

On 11 August 2014 10:22, Nikita Kiryanov <nikita@compulab.co.il> wrote:
> Add initial support for Compulab CM-FX6 CoM.
> Support includes MMC, SPI flash, and SPL with dynamic DRAM detection.
>
> Cc: Igor Grinberg <grinberg@compulab.co.il>
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Tom Rini <trini@ti.com>
> Cc: Marek Vasut <marex@denx.de>
> Acked-by: Marek Vasut <marex@denx.de>
> Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
> ---
> Changes in V3:
> - Remove CONFIG_SYS_TEXT_BASE from config file to not clash with the
> one supplied by imx6_spl.h
>
> Changes in V2:
> - Remove unnecessary line removal from arch/arm/cpu/armv7/mx6/ddr.c
> - Move probe_mmdc_config() code straight to dram_init()
> - Use imx6_spl.h
> - Use imx_ddr_size()
> NOTE: the correctness of this patch now depends on https://patchwork.ozlabs.org/patch/376095/
>
> board/compulab/cm_fx6/Makefile | 12 ++
> board/compulab/cm_fx6/cm_fx6.c | 98 +++++++++
> board/compulab/cm_fx6/common.c | 83 ++++++++
> board/compulab/cm_fx6/common.h | 36 ++++
> board/compulab/cm_fx6/imximage.cfg | 8 +
> board/compulab/cm_fx6/spl.c | 400 +++++++++++++++++++++++++++++++++++++
> boards.cfg | 2 +
> include/configs/cm_fx6.h | 211 +++++++++++++++++++

I think you need Kconfig etc. here? Also we don't use boards.cfg
anymore. I pushed a tree to u-boot-x86.git branch cm_fx6 which hacks
in a few of these things as an example (enough to make it build
anyway).

> 8 files changed, 850 insertions(+)
> create mode 100644 board/compulab/cm_fx6/Makefile
> create mode 100644 board/compulab/cm_fx6/cm_fx6.c
> create mode 100644 board/compulab/cm_fx6/common.c
> create mode 100644 board/compulab/cm_fx6/common.h
> create mode 100644 board/compulab/cm_fx6/imximage.cfg
> create mode 100644 board/compulab/cm_fx6/spl.c
> create mode 100644 include/configs/cm_fx6.h
>
> diff --git a/board/compulab/cm_fx6/Makefile b/board/compulab/cm_fx6/Makefile
> new file mode 100644
> index 0000000..3e5c903
> --- /dev/null
> +++ b/board/compulab/cm_fx6/Makefile
> @@ -0,0 +1,12 @@
> +#
> +# (C) Copyright 2014 CompuLab, Ltd. <www.compulab.co.il>
> +#
> +# Authors: Nikita Kiryanov <nikita@compulab.co.il>
> +#
> +# SPDX-License-Identifier: GPL-2.0+
> +#
> +ifdef CONFIG_SPL_BUILD
> +obj-y = common.o spl.o
> +else
> +obj-y = common.o cm_fx6.o
> +endif

Note this doesn't apply or build for me on mainline due to missing
Kconfig stuff. I might be missing a patch.

> diff --git a/boards.cfg b/boards.cfg
> index e3a0726..308b94e 100644
> --- a/boards.cfg
> +++ b/boards.cfg
> @@ -334,6 +334,8 @@ Active arm armv7 mx6 freescale mx6sabresd
> Active arm armv7 mx6 freescale mx6slevk mx6slevk mx6slevk:IMX_CONFIG=board/freescale/mx6slevk/imximage.cfg,MX6SL Fabio Estevam <fabio.estevam@freescale.com>
> Active arm armv7 mx6 gateworks gw_ventana gwventana gw_ventana:IMX_CONFIG=board/gateworks/gw_ventana/gw_ventana.cfg,MX6QDL,SPL Tim Harvey <tharvey@gateworks.com>
> Active arm armv7 mx6 solidrun hummingboard hummingboard_solo hummingboard:IMX_CONFIG=board/solidrun/hummingboard/solo.cfg,MX6S,DDR_MB=512 Jon Nettleton <jon.nettleton@gmail.com>
> +Active arm armv7 mx6 compulab cm_fx6 cm_fx6
> +- Nikita Kiryanov <nikita@compulab.co.il>
> Active arm armv7 omap3 - overo omap3_overo - Steve Sakoman <sakoman@gmail.com>
> Active arm armv7 omap3 - pandora omap3_pandora - Grazvydas Ignotas <notasas@gmail.com>
> Active arm armv7 omap3 8dtech eco5pk eco5pk - Raphael Assenat <raph@8d.com>

We don't use this file anymore.

> diff --git a/include/configs/cm_fx6.h b/include/configs/cm_fx6.h
> new file mode 100644
> index 0000000..b877b65
> --- /dev/null
> +++ b/include/configs/cm_fx6.h
> @@ -0,0 +1,211 @@
> +/*
> + * Config file for Compulab CM-FX6 board
> + *
> + * Copyright (C) 2014, Compulab Ltd - http://compulab.co.il/
> + *
> + * Author: Nikita Kiryanov <nikita@compulab.co.il>
> + *
> + * SPDX-License-Identifier: GPL-2.0+
> + */
> +
> +#ifndef __CONFIG_CM_FX6_H
> +#define __CONFIG_CM_FX6_H
> +
> +#include <asm/arch/imx-regs.h>
> +#include <config_distro_defaults.h>
> +
> +#define CONFIG_SYS_L2CACHE_OFF
> +#include "mx6_common.h"
> +
> +/* Machine config */
> +#define CONFIG_MX6
> +#define CONFIG_MX6QDL
> +#define CONFIG_CM_FX6

Should these three be defined in the Kconfig file instead? What does
CONFIG_CM_FX6 represent? There might be a CONFIG_TARGET_CM_FX6 defined
by Kconfig.

> +#define CONFIG_SYS_LITTLE_ENDIAN
> +#define CONFIG_MACH_TYPE 4273
> +#define CONFIG_SYS_HZ 1000
> +
> +/* Display information on boot */
> +#define CONFIG_DISPLAY_CPUINFO
> +#define CONFIG_DISPLAY_BOARDINFO
> +#define CONFIG_TIMESTAMP
> +
> +/* CMD */
> +#include <config_cmd_default.h>
> +#define CONFIG_CMD_GREPENV
> +#undef CONFIG_CMD_FLASH
> +#undef CONFIG_CMD_LOADB
> +#undef CONFIG_CMD_LOADS
> +#undef CONFIG_CMD_XIMG
> +#undef CONFIG_CMD_FPGA
> +#undef CONFIG_CMD_IMLS
> +#undef CONFIG_CMD_NET
> +#undef CONFIG_CMD_NFS
> +
> +/* MMC */
> +#define CONFIG_MMC
> +#define CONFIG_CMD_MMC
> +#define CONFIG_GENERIC_MMC
> +#define CONFIG_FSL_ESDHC
> +#define CONFIG_FSL_USDHC
> +#define CONFIG_SYS_FSL_USDHC_NUM 3
> +#define CONFIG_SYS_FSL_ESDHC_ADDR USDHC2_BASE_ADDR
> +
> +/* RAM */
> +#define PHYS_SDRAM_1 MMDC0_ARB_BASE_ADDR
> +#define PHYS_SDRAM_2 MMDC1_ARB_BASE_ADDR
> +#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1
> +#define CONFIG_NR_DRAM_BANKS 2
> +#define CONFIG_SYS_MEMTEST_START 0x10000000
> +#define CONFIG_SYS_MEMTEST_END 0x10010000
> +#define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
> +#define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
> +#define CONFIG_SYS_INIT_SP_OFFSET \
> + (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
> +#define CONFIG_SYS_INIT_SP_ADDR \
> + (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
> +
> +/* Serial console */
> +#define CONFIG_MXC_UART
> +#define CONFIG_MXC_UART_BASE UART4_BASE
> +#define CONFIG_BAUDRATE 115200
> +#define CONFIG_SYS_BAUDRATE_TABLE {9600, 19200, 38400, 57600, 115200}
> +
> +/* Shell */
> +#define CONFIG_SYS_PROMPT "CM-FX6 # "
> +#define CONFIG_SYS_CBSIZE 1024
> +#define CONFIG_SYS_MAXARGS 16
> +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
> +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \
> + sizeof(CONFIG_SYS_PROMPT) + 16)
> +
> +/* SPI flash */
> +#define CONFIG_SYS_NO_FLASH
> +#define CONFIG_CMD_SF
> +#define CONFIG_SF_DEFAULT_BUS 0
> +#define CONFIG_SF_DEFAULT_CS 0
> +#define CONFIG_SF_DEFAULT_SPEED 25000000
> +#define CONFIG_SF_DEFAULT_MODE (SPI_MODE_0)
> +
> +/* Environment */
> +#define CONFIG_ENV_OVERWRITE
> +#define CONFIG_ENV_IS_IN_SPI_FLASH
> +#define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED
> +#define CONFIG_ENV_SPI_MODE CONFIG_SF_DEFAULT_MODE
> +#define CONFIG_ENV_SPI_BUS CONFIG_SF_DEFAULT_BUS
> +#define CONFIG_ENV_SPI_CS CONFIG_SF_DEFAULT_CS
> +#define CONFIG_ENV_SECT_SIZE (64 * 1024)
> +#define CONFIG_ENV_SIZE (8 * 1024)
> +#define CONFIG_ENV_OFFSET (768 * 1024)
> +
> +#define CONFIG_EXTRA_ENV_SETTINGS \
> + "kernel=uImage-cm-fx6\0" \
> + "autoload=no\0" \
> + "loadaddr=0x10800000\0" \
> + "fdtaddr=0x11000000\0" \
> + "console=ttymxc3,115200\0" \
> + "ethprime=FEC0\0" \
> + "bootscr=boot.scr\0" \
> + "bootm_low=18000000\0" \
> + "video_hdmi=mxcfb0:dev=hdmi,1920x1080M-32 at 50,if=RGB32\0" \
> + "video_dvi=mxcfb0:dev=dvi,1280x800M-32 at 50,if=RGB32\0" \
> + "fdtfile=cm-fx6.dtb\0" \
> + "doboot=bootm ${loadaddr}\0" \
> + "loadfdt=false\0" \
> + "setboottypez=setenv kernel zImage-cm-fx6;" \
> + "setenv doboot bootz ${loadaddr} - ${fdtaddr};" \
> + "setenv loadfdt true;\0" \
> + "setboottypem=setenv kernel uImage-cm-fx6;" \
> + "setenv doboot bootm ${loadaddr};" \
> + "setenv loadfdt false;\0"\
> + "run_eboot=echo Starting EBOOT ...; "\
> + "mmc dev ${mmcdev} && " \
> + "mmc rescan && mmc read 10042000 a 400 && go 10042000\0" \
> + "mmcdev=2\0" \
> + "mmcroot=/dev/mmcblk0p2 rw rootwait\0" \
> + "loadmmcbootscript=fatload mmc ${mmcdev} ${loadaddr} ${bootscr}\0" \
> + "mmcbootscript=echo Running bootscript from mmc ...; "\
> + "source ${loadaddr}\0" \
> + "mmcargs=setenv bootargs console=${console} " \
> + "root=${mmcroot} " \
> + "${video}\0" \
> + "mmcloadkernel=fatload mmc ${mmcdev} ${loadaddr} ${kernel}\0" \
> + "mmcloadfdt=fatload mmc ${mmcdev} ${fdtaddr} ${fdtfile}\0" \
> + "mmcboot=echo Booting from mmc ...; " \
> + "run mmcargs; " \
> + "run doboot\0" \
> + "nandroot=/dev/mtdblock4 rw\0" \
> + "nandrootfstype=ubifs\0" \
> + "nandargs=setenv bootargs console=${console} " \
> + "root=${nandroot} " \
> + "rootfstype=${nandrootfstype} " \
> + "${video}\0" \
> + "nandloadfdt=nand read ${fdtaddr} 780000 80000;\0" \
> + "nandboot=echo Booting from nand ...; " \
> + "run nandargs; " \
> + "nand read ${loadaddr} 0 780000; " \
> + "if ${loadfdt}; then " \
> + "run nandloadfdt;" \
> + "fi; " \
> + "run doboot\0" \
> + "boot=mmc dev ${mmcdev}; " \
> + "if mmc rescan; then " \
> + "if run loadmmcbootscript; then " \
> + "run mmcbootscript;" \
> + "else " \
> + "if run mmcloadkernel; then " \
> + "if ${loadfdt}; then " \
> + "run mmcloadfdt;" \
> + "fi;" \
> + "run mmcboot;" \
> + "fi;" \
> + "fi;" \
> + "fi;"
> +
> +#define CONFIG_BOOTCOMMAND \
> + "run setboottypem; run boot"
> +
> +/* SPI */
> +#define CONFIG_SPI
> +#define CONFIG_MXC_SPI
> +#define CONFIG_SPI_FLASH
> +#define CONFIG_SPI_FLASH_ATMEL
> +#define CONFIG_SPI_FLASH_EON
> +#define CONFIG_SPI_FLASH_GIGADEVICE
> +#define CONFIG_SPI_FLASH_MACRONIX
> +#define CONFIG_SPI_FLASH_SPANSION
> +#define CONFIG_SPI_FLASH_STMICRO
> +#define CONFIG_SPI_FLASH_SST
> +#define CONFIG_SPI_FLASH_WINBOND
> +
> +/* GPIO */
> +#define CONFIG_MXC_GPIO
> +
> +/* Boot */
> +#define CONFIG_ZERO_BOOTDELAY_CHECK
> +#define CONFIG_LOADADDR 0x10800000
> +#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
> +#define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */
> +#define CONFIG_SYS_BOOTMAPSZ (8 << 20)
> +#define CONFIG_SETUP_MEMORY_TAGS
> +#define CONFIG_INITRD_TAG
> +
> +/* misc */
> +#define CONFIG_SYS_GENERIC_BOARD
> +#define CONFIG_STACKSIZE (128 * 1024)
> +#define CONFIG_SYS_MALLOC_LEN (2 * 1024 * 1024)
> +#define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS 800 /* 400 KB */
> +
> +/* SPL */
> +#define CONFIG_SPL
> +#include "imx6_spl.h"
> +#define CONFIG_SPL_BOARD_INIT
> +#define CONFIG_SPL_MMC_SUPPORT
> +#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 0x80 /* offset 64 kb */
> +#define CONFIG_SYS_MONITOR_LEN (CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS / 2 * 1024)
> +#define CONFIG_SPL_SPI_SUPPORT
> +#define CONFIG_SPL_SPI_FLASH_SUPPORT
> +#define CONFIG_SYS_SPI_U_BOOT_OFFS (64 * 1024)
> +#define CONFIG_SPL_SPI_LOAD
> +
> +#endif /* __CONFIG_CM_FX6_H */
> --
> 1.9.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

Regards,
Simon