add the TS-4600 board support
cover add the TS-4600 board support
The following commits introduce the support of the TS-4600 board.
This board is a bit particular, the bootloader is based on a custom imx-bootlets from Freescale and its code and toolchain are included in the Linux code repository.
This bootloader combines the Linux image and the freescale bootstream into one blob.
The package ts4600-bootrom has been introduced to reflect this logic.
Also, and because of missing drivers support in Linux, a tool from Technologic System is required to access the FPGA registers and to configure the ethernet PHY controller and feed the watchdog. This tool has no repository or archive for the TS-4600 board family and the source has been taken from the Technologic System FTP. The package ts4600-tshwctl includes this source code so.
Best Regards,
Sebastien.
Sebastien Bourdelin (2):
configs: add defconfig for TS-4600
ts4600-tshwctl: add ts4600-tshwctl package
board/technologic/ts4600/genimage.cfg | 18 + board/technologic/ts4600/linux.fragment | 2 + board/technologic/ts4600/post-image.sh | 18 + board/technologic/ts4600/readme.txt | 57 + boot/Config.in | 1 + boot/ts4600-bootrom/Config.in | 6 + boot/ts4600-bootrom/ts4600-bootrom-sign | 124 ++ boot/ts4600-bootrom/ts4600-bootrom.mk | 33 + configs/ts4600_defconfig | 21 + package/Config.in | 1 + package/ts4600-tshwctl/Config.in | 8 + package/ts4600-tshwctl/S00watchdogd | 30 + package/ts4600-tshwctl/S01ethswitch | 21 + package/ts4600-tshwctl/src/Makefile | 16 + package/ts4600-tshwctl/src/i2c-dev.h | 335 +++ package/ts4600-tshwctl/src/ispspi.c | 132 ++ package/ts4600-tshwctl/src/ispvm.c | 3408 ++++++++++++++++++++++++++++++ package/ts4600-tshwctl/src/tshwctl.c | 2904 +++++++++++++++++++++++++ package/ts4600-tshwctl/src/vmopcode.h | 192 ++ package/ts4600-tshwctl/ts4600-tshwctl.mk | 23 + 20 files changed, 7350 insertions(+) create mode 100644 board/technologic/ts4600/genimage.cfg create mode 100644 board/technologic/ts4600/linux.fragment create mode 100755 board/technologic/ts4600/post-image.sh create mode 100644 board/technologic/ts4600/readme.txt create mode 100644 boot/ts4600-bootrom/Config.in create mode 100755 boot/ts4600-bootrom/ts4600-bootrom-sign create mode 100644 boot/ts4600-bootrom/ts4600-bootrom.mk create mode 100644 configs/ts4600_defconfig create mode 100644 package/ts4600-tshwctl/Config.in create mode 100644 package/ts4600-tshwctl/S00watchdogd create mode 100644 package/ts4600-tshwctl/S01ethswitch create mode 100644 package/ts4600-tshwctl/src/Makefile create mode 100644 package/ts4600-tshwctl/src/i2c-dev.h create mode 100644 package/ts4600-tshwctl/src/ispspi.c create mode 100644 package/ts4600-tshwctl/src/ispvm.c create mode 100644 package/ts4600-tshwctl/src/tshwctl.c create mode 100644 package/ts4600-tshwctl/src/vmopcode.h create mode 100644 package/ts4600-tshwctl/ts4600-tshwctl.mk
Signature · 1 line
2.10.0
PATCH 1/2 configs: add defconfig for TS-4600
The TS-4600 is a TS-SOCKET macrocontroller board based on the Freescale i.MX28 ARM CPU.
The TS-4600 uses a custom Linux 2.6.35 from Technologic Systems:
https://github.com/embeddedarm/linux-2.6.35.3-imx28.git
The i.MX28 internal ROM loader supports a special image data that Freescale calls "bootstream".
This bootstream contains a stream of boot commands and a boot image which here combines a TS custom version of Freescale imx-bootlets v10.12.01 and the Linux kernel.
The custom imx-bootlets and its toolchain comes as a part of the Linux repository and the package ts4600-bootrom has been introduced to handle the bootstream generation.
The ts4600-bootrom-sign tool has also been introduced to prepare the bootable partition image which prepends the TS Bootrom with a signature and the Boot Control Block required by the i.MX28 SoC when using the SD/MMC boot mode.
A post-image script is provided to generate an image that can be directly written to an SD card.
--- board/technologic/ts4600/genimage.cfg | 18 +++++ board/technologic/ts4600/linux.fragment | 2 + board/technologic/ts4600/post-image.sh | 18 +++++ board/technologic/ts4600/readme.txt | 57 +++++++++++++++ boot/Config.in | 1 + boot/ts4600-bootrom/Config.in | 6 ++ boot/ts4600-bootrom/ts4600-bootrom-sign | 124 ++++++++++++++++++++++++++++++++ boot/ts4600-bootrom/ts4600-bootrom.mk | 33 +++++++++ configs/ts4600_defconfig | 20 ++++++ 9 files changed, 279 insertions(+) create mode 100644 board/technologic/ts4600/genimage.cfg create mode 100644 board/technologic/ts4600/linux.fragment create mode 100755 board/technologic/ts4600/post-image.sh create mode 100644 board/technologic/ts4600/readme.txt create mode 100644 boot/ts4600-bootrom/Config.in create mode 100755 boot/ts4600-bootrom/ts4600-bootrom-sign create mode 100644 boot/ts4600-bootrom/ts4600-bootrom.mk create mode 100644 configs/ts4600_defconfig
board/technologic/ts4600/genimage.cfg new file +18 -0
@@ -0,0 +1,18 @@ +image sdcard.img { + hdimage { + } + + # Boot partition + partition ts4600-bootrom { + partition-type = 0x53 + image = "ts4600-bootrom.sign" + offset = 1M + size = 8M + } + + partition rootfs { + partition-type = 0x83 + image = "rootfs.ext2" + size = 256M + } +}
board/technologic/ts4600/linux.fragment new file +2 -0
@@ -0,0 +1,2 @@ +CONFIG_INITRAMFS_SOURCE="" +CONFIG_CMDLINE="console=ttyAM0,115200 root=/dev/mmcblk0p2 rootwait lpj=1130496"
board/technologic/ts4600/post-image.sh new file +18 -0
@@ -0,0 +1,18 @@ +#!/bin/bash +# +# Copyright (C) 2016 Savoir-Faire Linux +# Post image generation script. + +BOARD_DIR="$(dirname $0)" +GENIMAGE_CFG=$BOARD_DIR/genimage.cfg +GENIMAGE_TMP=$BUILD_DIR/.genimage_tmp + +rm -rf $GENIMAGE_TMP + +echo "* Generating sd-card image..." +${HOST_DIR}/usr/bin/genimage \ + --config ${GENIMAGE_CFG} \ + --rootpath $TARGET_DIR \ + --tmppath $GENIMAGE_TMP \ + --inputpath $BINARIES_DIR \ + --outputpath $BINARIES_DIR
board/technologic/ts4600/readme.txt new file +57 -0
57 lines not on this page · raw message
boot/Config.in +1 -0
@@ -14,6 +14,7 @@ source "boot/lpc32xxcdl/Config.in" source "boot/mxs-bootlets/Config.in" source "boot/s500-bootloader/Config.in" source "boot/syslinux/Config.in" +source "boot/ts4600-bootrom/Config.in" source "boot/ts4800-mbrboot/Config.in" source "boot/uboot/Config.in" source "boot/vexpress-firmware/Config.in"
boot/ts4600-bootrom/Config.in new file +6 -0
@@ -0,0 +1,6 @@ +config BR2_TARGET_TS4600_BOOTROM + bool "ts4600-bootrom" + depends on BR2_arm + depends on BR2_LINUX_KERNEL + help + Technologic System bootstream for TS4600 board
boot/ts4600-bootrom/ts4600-bootrom-sign new file +124 -0
124 lines not on this page · raw message
boot/ts4600-bootrom/ts4600-bootrom.mk new file +33 -0
@@ -0,0 +1,33 @@ +################################################################################ +# +# ts4600-bootrom +# +################################################################################ + +TS4600_BOOTROM_SITE = $(LINUX_DIR)/imx-bootlets-src-10.12.01 +TS4600_BOOTROM_SITE_METHOD = local +TS4600_BOOTROM_DEPENDENCIES = linux + +# The imx-bootlets source code and the toolchain to use to build it come as a +# part of the kernel directory +TS4600_BOOTROM_MAKE_OPTS = \ + CROSS_COMPILE="$(LINUX_DIR)/cross-toolchain/arm-fsl-linux-gnueabi/bin/arm-none-linux-gnueabi-" \ + +# The ts4600-bootrom pack the first stage of the bootloader and the linux image in +# one binary file. +# To do so, the linux zImage previously generated is required to build the +# ts4600-bootrom and then copy in the imx-bootlets source directory. +# The parallel building as also been disabled to make it works. +define TS4600_BOOTROM_BUILD_CMDS + cp $(LINUX_IMAGE_PATH) $(@D) + $(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) $(TS4600_BOOTROM_MAKE_OPTS) +endef + +# The final generated image should be signed and contain an i.MX28 BCB to work. +define TS4600_BOOTROM_INSTALL_TARGET_CMDS + boot/ts4600-bootrom/ts4600-bootrom-sign $(@D)/imx28_ivt_linux.sb \ + $(@D)/ts4600-bootrom.sign + $(INSTALL) -D -m 0644 $(@D)/ts4600-bootrom.sign output/images/ +endef + +$(eval $(generic-package))
configs/ts4600_defconfig new file +20 -0
@@ -0,0 +1,20 @@ +BR2_arm=y +BR2_TOOLCHAIN_EXTERNAL=y +BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y +BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y +BR2_TOOLCHAIN_EXTERNAL_URL="ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7600-linux/cross-toolchains/imx28-cross-glibc.tar.bz2" +BR2_TOOLCHAIN_EXTERNAL_GCC_4_4=y +BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y +BR2_TOOLCHAIN_EXTERNAL_CXX=y +BR2_TARGET_GENERIC_GETTY_PORT="ttyAM0" +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/technologic/ts4600/post-image.sh" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_GIT=y +BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/embeddedarm/linux-2.6.35.3-imx28.git" +BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="69fc5de7e234e6b2103b15a1e36d398cbf9584c4" +BR2_LINUX_KERNEL_DEFCONFIG="ts4600" +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/technologic/ts4600/linux.fragment" +BR2_LINUX_KERNEL_INSTALL_TARGET=y +BR2_TARGET_TS4600_BOOTROM=y +BR2_TARGET_ROOTFS_EXT2=y +BR2_PACKAGE_HOST_GENIMAGE=y
Signature · 1 line
2.10.0
PATCH 1/2 configs: add defconfig for TS-4600
Hello,
(Adding Fabio Estevam in Cc, since he has lots of experience with Freescale stuff, of course.)
Quoted 8 lines · Sebastien Bourdelin
board/technologic/ts4600/genimage.cfg | 18 +++++ board/technologic/ts4600/linux.fragment | 2 + board/technologic/ts4600/post-image.sh | 18 +++++ board/technologic/ts4600/readme.txt | 57 +++++++++++++++ boot/Config.in | 1 + boot/ts4600-bootrom/Config.in | 6 ++ boot/ts4600-bootrom/ts4600-bootrom-sign | 124 ++++++++++++++++++++++++++++++++ boot/ts4600-bootrom/ts4600-bootrom.mk | 33 +++++++++
Please separate the boot/ts4600-bootrom/ addition from the addition of the board configuration (i.e, separate patches).
Quoted 6 lines
boot/ts4600-bootrom/ts4600-bootrom-sign new file +0
-0
boot/ts4600-bootrom/ts4600-bootrom-sign line 10
Quoted 10 lines
boot/ts4600-bootrom/ts4600-bootrom-sign new file +10
-0@@ -0,0 +1,124 @@ +#!/bin/bash +# +# Copyright (C) 2016 Savoir-Faire Linux, Inc +# Copyright (C) 2013 Technologic System, Inc +# Author: ts-kris <https://github.com/ts-kris> +# Author: Sebastien Bourdelin <[email protected]> +# +# This tool signs a bootstream and add a BCB (Boot Control Block) to be used on i.MX28 SoC. +# It is based on the install_bootstream tool from Technologic System: +# https://github.com/embeddedarm/linux-2.6.35.3-imx28/blob/master/install_bootstream
Why don't we use this tool instead?
Is this tool really specific to the ts4600 platform, or is it generally useful on i.MX28 platforms?
boot/ts4600-bootrom/ts4600-bootrom.mk line 5
Quoted 11 lines
boot/ts4600-bootrom/ts4600-bootrom.mk new file +5
-0@@ -0,0 +1,33 @@ +################################################################################ +# +# ts4600-bootrom +# +################################################################################
I dislike this new package, because we already have a package for mxs-bootlets, in boot/mxs-bootlets/.
Could you instead ask embeddedarm people to have a separate repository for their version of mxs-bootlets, instead of mixing that in the kernel repository, which is really awful? That would allow you to re-use the existing mxs-bootlets package.
Quoted 6 lines
configs/ts4600_defconfig new file +0
-0
configs/ts4600_defconfig line 8
Quoted 8 lines
configs/ts4600_defconfig new file +8
-0@@ -0,0 +1,20 @@ +BR2_arm=y +BR2_TOOLCHAIN_EXTERNAL=y +BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y +BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y +BR2_TOOLCHAIN_EXTERNAL_URL="ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7600-linux/cross-toolchains/imx28-cross-glibc.tar.bz2" +BR2_TOOLCHAIN_EXTERNAL_GCC_4_4=y +BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y +BR2_TOOLCHAIN_EXTERNAL_CXX=y
Why are you using this toolchain rather than the default Buildroot toolchain?
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 1/2 configs: add defconfig for TS-4600
In reply to Sebastien BourdelinQuoted 1 line · Sebastien Bourdelin
The TS-4600 is a TS-SOCKET macrocontroller board based on the Freescale
microcontroller?
Quoted 4 lines
i.MX28 ARM CPU.
The TS-4600 uses a custom Linux 2.6.35 from Technologic Systems:
https://github.com/embeddedarm/linux-2.6.35.3-imx28.git
What about adding mainline kernel support for this board? mx28 support in mainline kernel is decent.
Quoted 5 lines
The i.MX28 internal ROM loader supports a special image data that Freescale calls "bootstream".
This bootstream contains a stream of boot commands and a boot image which here combines a TS custom version of Freescale imx-bootlets v10.12.01 and the Linux kernel.
Other option would be to use mainline U-Boot, which does not need the separate imx-bootlets package.
Quoted 11 lines
The custom imx-bootlets and its toolchain comes as a part of the Linux repository and the package ts4600-bootrom has been introduced to handle the bootstream generation.
The ts4600-bootrom-sign tool has also been introduced to prepare the bootable partition image which prepends the TS Bootrom with a signature and the Boot Control Block required by the i.MX28 SoC when using the SD/MMC boot mode.
A post-image script is provided to generate an image that can be directly written to an SD card.
I will give it a try on using your script on a mx28evk.
Thanks
PATCH 2/2 ts4600-tshwctl: add ts4600-tshwctl package
In reply to Sebastien BourdelinThis package is required to access the FPGA registers and configure some controllers of the TS-4600 board.
It comes with two init script to properly configure the watchdog and the ethernet PHY at boot time.
This tool has no repository for this board and the sources are taken from the Technologic System ftp in the TS-7600 subdirectory which are compatible with the TS-4600:
ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7600-linux/sources/
--- configs/ts4600_defconfig | 1 + package/Config.in | 1 + package/ts4600-tshwctl/Config.in | 8 + package/ts4600-tshwctl/S00watchdogd | 30 + package/ts4600-tshwctl/S01ethswitch | 21 + package/ts4600-tshwctl/src/Makefile | 16 + package/ts4600-tshwctl/src/i2c-dev.h | 335 +++ package/ts4600-tshwctl/src/ispspi.c | 132 ++ package/ts4600-tshwctl/src/ispvm.c | 3408 ++++++++++++++++++++++++++++++ package/ts4600-tshwctl/src/tshwctl.c | 2904 +++++++++++++++++++++++++ package/ts4600-tshwctl/src/vmopcode.h | 192 ++ package/ts4600-tshwctl/ts4600-tshwctl.mk | 23 + 12 files changed, 7071 insertions(+) create mode 100644 package/ts4600-tshwctl/Config.in create mode 100644 package/ts4600-tshwctl/S00watchdogd create mode 100644 package/ts4600-tshwctl/S01ethswitch create mode 100644 package/ts4600-tshwctl/src/Makefile create mode 100644 package/ts4600-tshwctl/src/i2c-dev.h create mode 100644 package/ts4600-tshwctl/src/ispspi.c create mode 100644 package/ts4600-tshwctl/src/ispvm.c create mode 100644 package/ts4600-tshwctl/src/tshwctl.c create mode 100644 package/ts4600-tshwctl/src/vmopcode.h create mode 100644 package/ts4600-tshwctl/ts4600-tshwctl.mk
configs/ts4600_defconfig +1 -0
@@ -18,3 +18,4 @@ BR2_LINUX_KERNEL_INSTALL_TARGET=y BR2_TARGET_TS4600_BOOTROM=y BR2_TARGET_ROOTFS_EXT2=y BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_TS4600_TSHWCTL=y
package/Config.in +1 -0
@@ -468,6 +468,7 @@ endmenu source "package/ti-uim/Config.in" source "package/ti-utils/Config.in" source "package/triggerhappy/Config.in" + source "package/ts4600-tshwctl/Config.in" source "package/uboot-tools/Config.in" source "package/ubus/Config.in" source "package/udev/Config.in"
package/ts4600-tshwctl/Config.in new file +8 -0
@@ -0,0 +1,8 @@ +config BR2_PACKAGE_TS4600_TSHWCTL + bool "ts4600-tshwctl" + depends on BR2_arm + help + Technologic System TS-4600 manipulation tool. + + This tool is mainly used to access the FPGA registers, daemonize the + watchdog, and configure the ethernet PHY of the TS-4600 board.
package/ts4600-tshwctl/S00watchdogd new file +30 -0
@@ -0,0 +1,30 @@ +#!/bin/sh +# +# This script activate the watchdog daemon which feed the watchdog +# in the TS4600 FPGA. +# +# Author: Sebastien Bourdelin <[email protected]> + +case "$1" in + start) + echo "Starting the watchdog daemon..." + # start the watchdog daemon + tshwctl -W + # autofeed the watchdog with 10 seconds timeout + echo a2 > /dev/watchdog + # clean led + tshwctl --greenledon --redledoff + ;; + stop) + echo "Stoping the watchdog daemon..." + killall -9 tshwctl + ;; + restart|reload) + "$0" stop + "$0" start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; +esac
package/ts4600-tshwctl/S01ethswitch new file +21 -0
@@ -0,0 +1,21 @@ +#!/bin/sh +# +# This script bring up the ethernet phy and set it in switch mode. +# +# Author: Sebastien Bourdelin <[email protected]> + +case "$1" in + start) + # wake up interface + ifconfig eth0 up + # set the ethernet port in switch mode + tshwctl --ethswitch + ;; + stop) + exit 0 + ;; + *) + echo "Usage: $0 {start}" + exit 1 + ;; +esac
package/ts4600-tshwctl/src/Makefile new file +16 -0
@@ -0,0 +1,16 @@ +CFLAGS=-Wall -O0 -fno-tree-cselim +SOURCES=$(shell ls *.c) +OBJECTS=$(SOURCES:.c=.o) + +.PHONY: all +all: tshwctl + +%.o: %.c + $(CROSS_COMPILE)$(CC) $(CFLAGS) $(INCLUDES) -c $< + +tshwctl: $(OBJECTS) + $(CROSS_COMPILE)$(CC) -o $@ $(OBJECTS) $(LDFLAGS) + +.PHONY: clean +clean: + rm -f *.o tshwctl
package/ts4600-tshwctl/src/i2c-dev.h new file +335 -0
335 lines not on this page · raw message
package/ts4600-tshwctl/src/ispspi.c new file +132 -0
132 lines not on this page · raw message
package/ts4600-tshwctl/src/ispvm.c new file +3408 -0
2,447 lines not on this page · raw message
package/ts4600-tshwctl/src/tshwctl.c new file +2904 -0
2,904 lines not on this page · raw message
package/ts4600-tshwctl/src/vmopcode.h new file +192 -0
192 lines not on this page · raw message
package/ts4600-tshwctl/ts4600-tshwctl.mk new file +23 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.10.0
Part of the diff is not shown here. View the raw message.
PATCH 2/2 ts4600-tshwctl: add ts4600-tshwctl package
Hello,
Quoted 10 lines · Sebastien Bourdelin
This package is required to access the FPGA registers and configure some controllers of the TS-4600 board.
It comes with two init script to properly configure the watchdog and the ethernet PHY at boot time.
This tool has no repository for this board and the sources are taken from the Technologic System ftp in the TS-7600 subdirectory which are compatible with the TS-4600:
ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7600-linux/sources/
Sorry, but we clearly don't want to have 7000 lines of source code in Buildroot, for a tool specific to just one board.
Please make the package download the source code from ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7600-linux/sources/. Of course, the fact that they only provide individual files and not a tarball makes the exercise a bit annoying, but it's doable using _SOURCE pointing to tshwctl, and _EXTRA_DOWNLOADS for the other .c and .h files.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com