From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Babic Date: Tue, 17 Feb 2015 10:45:58 +0100 Subject: [U-Boot] [PATCH 4/4] warp: Add initial WaRP Board support In-Reply-To: <1424122683-29357-4-git-send-email-otavio@ossystems.com.br> References: <1424122683-29357-1-git-send-email-otavio@ossystems.com.br> <1424122683-29357-4-git-send-email-otavio@ossystems.com.br> Message-ID: <54E30DD6.7020506@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Otavio, On 16/02/2015 22:38, Otavio Salvador wrote: > The WaRP Board is a Wearable Reference Plaform. The board features: > > - Freescale i.MX6 SoloLite processor with 512MB of RAM > - Freescale FXOS8700CQ 6-axis Xtrinsic sensor > - Freescale Kinetis KL16 MCU > - Freescale Xtrinsic MMA955xL intelligent motion sensing platform > > The board implements a hybrid architecture to address the evolving > needs of the wearables market. The platform consists of a main board > and an example daughtercard with the ability to add additional > daughtercards for different usage models. > > For more information about the project, visit: > > http://www.warpboard.org/ > > Signed-off-by: Otavio Salvador > --- > > arch/arm/Kconfig | 5 ++ > board/warp/Kconfig | 12 +++ > board/warp/MAINTAINERS | 6 ++ > board/warp/Makefile | 8 ++ > board/warp/warp.c | 113 ++++++++++++++++++++++++++++ > configs/warp_defconfig | 3 + > include/configs/warp.h | 198 +++++++++++++++++++++++++++++++++++++++++++++++++ > 7 files changed, 345 insertions(+) > create mode 100644 board/warp/Kconfig > create mode 100644 board/warp/MAINTAINERS > create mode 100644 board/warp/Makefile > create mode 100644 board/warp/warp.c > create mode 100644 configs/warp_defconfig > create mode 100644 include/configs/warp.h > > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig > index 1f1ccad..a3eb876 100644 > --- a/arch/arm/Kconfig > +++ b/arch/arm/Kconfig > @@ -608,6 +608,10 @@ config TARGET_WANDBOARD > bool "Support wandboard" > select CPU_V7 > > +config TARGET_WARP > + bool "Support WaRP" > + select CPU_V7 > + > config TARGET_TITANIUM > bool "Support titanium" > select CPU_V7 > @@ -1013,6 +1017,7 @@ source "board/ttcontrol/vision2/Kconfig" > source "board/udoo/Kconfig" > source "board/vpac270/Kconfig" > source "board/wandboard/Kconfig" > +source "board/warp/Kconfig" > source "board/woodburn/Kconfig" > source "board/xaeniax/Kconfig" > source "board/zipitz2/Kconfig" > diff --git a/board/warp/Kconfig b/board/warp/Kconfig > new file mode 100644 > index 0000000..7b569cc > --- /dev/null > +++ b/board/warp/Kconfig > @@ -0,0 +1,12 @@ > +if TARGET_WARP > + > +config SYS_BOARD > + default "warp" > + > +config SYS_SOC > + default "mx6" > + > +config SYS_CONFIG_NAME > + default "warp" > + > +endif > diff --git a/board/warp/MAINTAINERS b/board/warp/MAINTAINERS > new file mode 100644 > index 0000000..ee2114d > --- /dev/null > +++ b/board/warp/MAINTAINERS > @@ -0,0 +1,6 @@ > +WaRP BOARD > +M: Otavio Salvador > +S: Maintained > +F: board/warp/ > +F: include/configs/warp.h > +F: configs/warp_defconfig > diff --git a/board/warp/Makefile b/board/warp/Makefile > new file mode 100644 > index 0000000..c555f87 > --- /dev/null > +++ b/board/warp/Makefile > @@ -0,0 +1,8 @@ > +# Copyright (C) 2014 O.S. Systems Software LTDA. > +# Copyright (C) 2014 Kynetics LLC. > +# Copyright (C) 2014 Revolution Robotics, Inc. > +# > +# SPDX-License-Identifier: GPL-2.0+ > +# > + > +obj-y := warp.o > diff --git a/board/warp/warp.c b/board/warp/warp.c > new file mode 100644 > index 0000000..3b275c2 > --- /dev/null > +++ b/board/warp/warp.c > @@ -0,0 +1,113 @@ > +/* > + * Copyright (C) 2014, 2015 O.S. Systems Software LTDA. > + * Copyright (C) 2014 Kynetics LLC. > + * Copyright (C) 2014 Revolution Robotics, Inc. > + * > + * Author: Otavio Salvador > + * > + * SPDX-License-Identifier: GPL-2.0+ > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +DECLARE_GLOBAL_DATA_PTR; > + > +#define UART_PAD_CTRL (PAD_CTL_PUS_100K_UP | \ > + PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | \ > + PAD_CTL_SRE_FAST | PAD_CTL_HYS | \ > + PAD_CTL_LVE) > + > +#define USDHC_PAD_CTRL (PAD_CTL_PUS_22K_UP | \ > + PAD_CTL_SPEED_LOW | PAD_CTL_DSE_80ohm | \ > + PAD_CTL_SRE_FAST | PAD_CTL_HYS | \ > + PAD_CTL_LVE) > + > +int dram_init(void) > +{ > + gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE); > + > + return 0; > +} > + > +static void setup_iomux_uart(void) > +{ > + static iomux_v3_cfg_t const uart1_pads[] = { > + MX6_PAD_UART1_TXD__UART1_TXD | MUX_PAD_CTRL(UART_PAD_CTRL), > + MX6_PAD_UART1_RXD__UART1_RXD | MUX_PAD_CTRL(UART_PAD_CTRL), > + }; > + > + imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads)); > +} > + > +static struct fsl_esdhc_cfg usdhc_cfg[1] = { > + {USDHC2_BASE_ADDR}, > +}; > + > +int board_mmc_getcd(struct mmc *mmc) > +{ > + return 1; /* Assume boot SD always present */ > +} > + > +int board_mmc_init(bd_t *bis) > +{ > + static iomux_v3_cfg_t const usdhc2_pads[] = { > + MX6_PAD_SD2_CLK__USDHC2_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL), > + MX6_PAD_SD2_CMD__USDHC2_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL), > + MX6_PAD_SD2_RST__USDHC2_RST | MUX_PAD_CTRL(USDHC_PAD_CTRL), > + MX6_PAD_SD2_DAT0__USDHC2_DAT0 | MUX_PAD_CTRL(USDHC_PAD_CTRL), > + MX6_PAD_SD2_DAT1__USDHC2_DAT1 | MUX_PAD_CTRL(USDHC_PAD_CTRL), > + MX6_PAD_SD2_DAT2__USDHC2_DAT2 | MUX_PAD_CTRL(USDHC_PAD_CTRL), > + MX6_PAD_SD2_DAT3__USDHC2_DAT3 | MUX_PAD_CTRL(USDHC_PAD_CTRL), > + MX6_PAD_SD2_DAT4__USDHC2_DAT4 | MUX_PAD_CTRL(USDHC_PAD_CTRL), > + MX6_PAD_SD2_DAT5__USDHC2_DAT5 | MUX_PAD_CTRL(USDHC_PAD_CTRL), > + MX6_PAD_SD2_DAT6__USDHC2_DAT6 | MUX_PAD_CTRL(USDHC_PAD_CTRL), > + MX6_PAD_SD2_DAT7__USDHC2_DAT7 | MUX_PAD_CTRL(USDHC_PAD_CTRL), > + }; > + > + imx_iomux_v3_setup_multiple_pads(usdhc2_pads, ARRAY_SIZE(usdhc2_pads)); > + > + usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK); > + return fsl_esdhc_initialize(bis, &usdhc_cfg[0]); > +} > + > +int board_early_init_f(void) > +{ > + setup_iomux_uart(); > + return 0; > +} > + > +int board_init(void) > +{ > + /* address of boot parameters */ > + gd->bd->bi_boot_params = PHYS_SDRAM + 0x100; > + > + return 0; > +} > + > +int board_late_init(void) > +{ > +#ifdef CONFIG_HW_WATCHDOG > + hw_watchdog_init(); > +#endif > + > + return 0; > +} > + > +int checkboard(void) > +{ > + puts("Board: WaRP Board\n"); > + > + return 0; > +} > diff --git a/configs/warp_defconfig b/configs/warp_defconfig > new file mode 100644 > index 0000000..624a8af > --- /dev/null > +++ b/configs/warp_defconfig > @@ -0,0 +1,3 @@ > +CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6slevk/imximage.cfg,MX6SL" > +CONFIG_ARM=y > +CONFIG_TARGET_WARP=y > diff --git a/include/configs/warp.h b/include/configs/warp.h > new file mode 100644 > index 0000000..82036e4 > --- /dev/null > +++ b/include/configs/warp.h > @@ -0,0 +1,198 @@ > +/* > + * Copyright (C) 2014 O.S. Systems Software LTDA. > + * Copyright (C) 2014 Kynetics LLC. > + * Copyright (C) 2014 Revolution Robotics, Inc. > + * > + * Author: Otavio Salvador > + * > + * Configuration settings for the WaRP Board > + * > + * SPDX-License-Identifier: GPL-2.0+ > + */ > + > +#ifndef __CONFIG_H > +#define __CONFIG_H > + > +#include > +#include > +#include "mx6_common.h" > + > +#define CONFIG_MX6 > +#define CONFIG_DISPLAY_CPUINFO > +#define CONFIG_DISPLAY_BOARDINFO > +#define CONFIG_SYS_GENERIC_BOARD > + > +#define CONFIG_CMDLINE_TAG > +#define CONFIG_SETUP_MEMORY_TAGS > +#define CONFIG_INITRD_TAG > +#define CONFIG_REVISION_TAG > + > +/* Size of malloc() pool */ > +#define CONFIG_SYS_MALLOC_LEN (3 * SZ_1M) > + > +#define CONFIG_BOARD_EARLY_INIT_F > +#define CONFIG_BOARD_LATE_INIT > +#define CONFIG_MXC_GPIO > + > +#define CONFIG_MXC_UART > +#define CONFIG_MXC_UART_BASE UART1_IPS_BASE_ADDR > + > +/* MMC Configs */ > +#define CONFIG_FSL_ESDHC > +#define CONFIG_FSL_USDHC > +#define CONFIG_SYS_FSL_ESDHC_ADDR 0 > +#define CONFIG_SYS_FSL_ESDHC_FORCE_VSELECT > + > +#define CONFIG_MMC > +#define CONFIG_CMD_MMC > +#define CONFIG_GENERIC_MMC > +#define CONFIG_CMD_FAT > +#define CONFIG_DOS_PARTITION > + > +/* allow to overwrite serial and ethaddr */ > +#define CONFIG_ENV_OVERWRITE > +#define CONFIG_CONS_INDEX 1 > +#define CONFIG_BAUDRATE 115200 > + > +/* FLASH and environment organization */ > +#define CONFIG_SYS_NO_FLASH > + > +/* Command definition */ > +#include > +#undef CONFIG_CMD_NET > +#undef CONFIG_CMD_NFS > + > +#define CONFIG_BOOTDELAY 3 > + > +#define CONFIG_LOADADDR 0x82000000 > +#define CONFIG_SYS_TEXT_BASE 0x87800000 > + > +/* Miscellaneous configurable options */ > +#define CONFIG_SYS_LONGHELP > +#define CONFIG_SYS_HUSH_PARSER > +#define CONFIG_AUTO_COMPLETE > +#define CONFIG_SYS_CBSIZE 256 > + > +/* Watchdog */ > +#define CONFIG_HW_WATCHDOG > +#define CONFIG_IMX_WATCHDOG > +#define CONFIG_WATCHDOG_TIMEOUT_MSECS 30000 /* 30s */ > + > +/* Print Buffer Size */ > +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16) > +#define CONFIG_SYS_MAXARGS 16 > +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE > + > +#define CONFIG_SYS_MEMTEST_START 0x80000000 > +#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + SZ_256M) > + > +#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR > + > +#define CONFIG_CMDLINE_EDITING > +#define CONFIG_STACKSIZE SZ_128K > + > +/* Physical Memory Map */ > +#define CONFIG_NR_DRAM_BANKS 1 > +#define PHYS_SDRAM MMDC0_ARB_BASE_ADDR > +#define PHYS_SDRAM_SIZE SZ_512M > + > +#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM > +#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) > + > +#define CONFIG_ENV_OFFSET (6 * SZ_64K) > +#define CONFIG_ENV_SIZE SZ_8K > +#define CONFIG_ENV_IS_IN_MMC > +#define CONFIG_SYS_MMC_ENV_DEV 0 > + > +/* VDD voltage 1.65 - 1.95 */ > +#define CONFIG_SYS_SD_VOLTAGE 0x00000080 > + > +#define CONFIG_OF_LIBFDT > +#define CONFIG_CMD_BOOTZ > + > +#ifndef CONFIG_SYS_DCACHE_OFF > +#define CONFIG_CMD_CACHE > +#endif > + > +#define CONFIG_EXTRA_ENV_SETTINGS \ > + "script=boot.scr\0" \ > + "image=zImage\0" \ > + "console=ttymxc0\0" \ > + "fdt_high=0xffffffff\0" \ > + "initrd_high=0xffffffff\0" \ > + "fdt_file=imx6sl-warp.dtb\0" \ > + "fdt_addr=0x88000000\0" \ > + "initrd_addr=0x83800000\0" \ > + "boot_fdt=try\0" \ > + "ip_dyn=yes\0" \ > + "mmcdev=0\0" \ > + "mmcpart=1\0" \ > + "mmcroot=/dev/mmcblk0p2 rootwait rw\0" \ > + "mmcargs=setenv bootargs console=${console},${baudrate} " \ > + "root=${mmcroot}\0" \ > + "loadbootscript=" \ > + "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ > + "bootscript=echo Running bootscript from mmc ...; " \ > + "source\0" \ > + "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ > + "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ > + "mmcboot=echo Booting from mmc ...; " \ > + "run mmcargs; " \ > + "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ > + "if run loadfdt; then " \ > + "bootz ${loadaddr} - ${fdt_addr}; " \ > + "else " \ > + "if test ${boot_fdt} = try; then " \ > + "bootz; " \ > + "else " \ > + "echo WARN: Cannot load the DT; " \ > + "fi; " \ > + "fi; " \ > + "else " \ > + "bootz; " \ > + "fi;\0" \ > + "netargs=setenv bootargs console=${console},${baudrate} " \ > + "root=/dev/nfs " \ > + "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \ > + "netboot=echo Booting from net ...; " \ > + "run netargs; " \ > + "if test ${ip_dyn} = yes; then " \ > + "setenv get_cmd dhcp; " \ > + "else " \ > + "setenv get_cmd tftp; " \ > + "fi; " \ > + "${get_cmd} ${image}; " \ > + "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ > + "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \ > + "bootz ${loadaddr} - ${fdt_addr}; " \ > + "else " \ > + "if test ${boot_fdt} = try; then " \ > + "bootz; " \ > + "else " \ > + "echo WARN: Cannot load the DT; " \ > + "fi; " \ > + "fi; " \ > + "else " \ > + "bootz; " \ > + "fi;\0" > + > +#define CONFIG_BOOTCOMMAND \ > + "mmc dev ${mmcdev};" \ > + "mmc dev ${mmcdev}; if mmc rescan; then " \ > + "if run loadbootscript; then " \ > + "run bootscript; " \ > + "else " \ > + "if run loadimage; then " \ > + "run mmcboot; " \ > + "else run netboot; " \ > + "fi; " \ > + "fi; " \ > + "else run netboot; fi" > + > +#endif /* __CONFIG_H */ > Acked-by: Stefano Babic Best regards, Stefano Babic -- ===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================