[OpenWrt-Devel] [PATCH 2/2 v3] linux: add support of Synopsys ARC770-based boards
Jonas Gorski
jogo at openwrt.org
Wed Nov 4 07:06:26 EST 2015
Hi,
On Tue, Nov 3, 2015 at 12:27 AM, Alexey Brodkin
<Alexey.Brodkin at synopsys.com> wrote:
> This patch introduces support of new boards with ARC cores.
>
> [1] Synopsys SDP board
> This is a new-generation development board from Synopsys that
> consists of base-board and CPU tile-board (which might have a real
> ASIC or FPGA with CPU image).
> It sports a lot of DesignWare peripherals like GMAC, USB, SPI, I2C
> etc and is intended to be used for early development of ARC-based
> products.
>
> [2] nSIM
> This is a virtual board implemented in Synopsys proprietary
> software simulator (even though available for free for open source
> community). This board has only serial port as a peripheral and so
> it is meant to be used for runtime testing which is especially
> useful during bring-up of new tools and platforms.
> What's also important ARC cores are very configurable so there're
> many variations of options like cache sizes, their line lengths,
> additional hardware blocks like multipliers, dividers etc. And this
> board could be used to make sure built software still runs on
> different HW configurations.
>
> Cc: Felix Fietkau <nbd at openwrt.org>
> Cc: Jo-Philipp Wich <jow at openwrt.org>
> Signed-off-by: Alexey Brodkin <abrodkin at synopsys.com>
> ---
>
> Changes compared to v2:
> * Fixed copyright dates
> * Cleaned-up init scripts
>
> Changes compared to v1:
> * Switched to SoC-centered design. Now instead of common ARC700
> support we claim support of boards based on ARC770D.
> This allows to use the same one build of kernel binary for both
> boards.
>
> * Implemented run-time scripts that parse Device Tree compatible
> tag and according to it do configuration of serial port and network.
>
> * Implemented ability to patch in built Linux kernel external .dtb
>
> * Linux kernel switched from 4.1 to 4.3
>
> * Rebased on current master
>
> include/kernel.mk | 2 +
> target/Config.in | 9 +
> target/linux/arc770/Makefile | 26 +++
> target/linux/arc770/base-files/etc/inittab | 4 +
> .../arc770/base-files/etc/uci-defaults/02_network | 23 +++
> target/linux/arc770/base-files/lib/arc.sh | 76 +++++++
> .../base-files/lib/preinit/01_preinit_arc.sh | 10 +
> target/linux/arc770/config-4.3 | 142 +++++++++++++
> target/linux/arc770/dts/axc001.dtsi | 100 +++++++++
> target/linux/arc770/dts/axs101.dts | 21 ++
> target/linux/arc770/dts/axs10x_mb.dtsi | 224 +++++++++++++++++++++
> target/linux/arc770/dts/nsim_700.dts | 70 +++++++
> target/linux/arc770/dts/skeleton.dtsi | 37 ++++
> target/linux/arc770/generic/profiles/00-default.mk | 16 ++
> target/linux/arc770/generic/profiles/01-minimal.mk | 15 ++
> target/linux/arc770/generic/profiles/02-axs101.mk | 17 ++
> .../linux/arc770/generic/profiles/03-nsim_700.mk | 16 ++
> target/linux/arc770/generic/target.mk | 8 +
> target/linux/arc770/image/Makefile | 42 ++++
> ...openwrt-arc-remove-dependency-on-DEVTMPFS.patch | 36 ++++
> .../0002-openwrt-arc-add-OWRTDTB-section.patch | 91 +++++++++
> 21 files changed, 985 insertions(+)
> create mode 100644 target/linux/arc770/Makefile
> create mode 100644 target/linux/arc770/base-files/etc/inittab
> create mode 100644 target/linux/arc770/base-files/etc/uci-defaults/02_network
> create mode 100644 target/linux/arc770/base-files/lib/arc.sh
> create mode 100644 target/linux/arc770/base-files/lib/preinit/01_preinit_arc.sh
> create mode 100644 target/linux/arc770/config-4.3
> create mode 100644 target/linux/arc770/dts/axc001.dtsi
> create mode 100644 target/linux/arc770/dts/axs101.dts
> create mode 100644 target/linux/arc770/dts/axs10x_mb.dtsi
> create mode 100644 target/linux/arc770/dts/nsim_700.dts
> create mode 100644 target/linux/arc770/dts/skeleton.dtsi
> create mode 100644 target/linux/arc770/generic/profiles/00-default.mk
> create mode 100644 target/linux/arc770/generic/profiles/01-minimal.mk
> create mode 100644 target/linux/arc770/generic/profiles/02-axs101.mk
> create mode 100644 target/linux/arc770/generic/profiles/03-nsim_700.mk
> create mode 100644 target/linux/arc770/generic/target.mk
> create mode 100644 target/linux/arc770/image/Makefile
> create mode 100644 target/linux/arc770/patches-4.3/0001-openwrt-arc-remove-dependency-on-DEVTMPFS.patch
> create mode 100644 target/linux/arc770/patches-4.3/0002-openwrt-arc-add-OWRTDTB-section.patch
>
(snip)
> diff --git a/target/linux/arc770/base-files/etc/uci-defaults/02_network b/target/linux/arc770/base-files/etc/uci-defaults/02_network
> new file mode 100644
> index 0000000..7db8451
> --- /dev/null
> +++ b/target/linux/arc770/base-files/etc/uci-defaults/02_network
> @@ -0,0 +1,23 @@
> +#!/bin/sh
> +#
> +# Copyright (C) 2015 OpenWrt.org
> +#
> +
> +[ -e /etc/config/network ] && exit 0
> +
> +touch /etc/config/network
> +
> +. /lib/arc.sh
> +. /lib/functions/uci-defaults.sh
> +
> +ucidef_set_interface_loopback
> +
> +case "$( arc_board_name )" in
> +"arc-sdp"*)
> + ucidef_set_interface_wan "eth0"
If you only have one interface at all, it is usually better to make it
lan/dhcp, else default firewall rules will prevent you from logging in
through http/ssh. You can either borrow kirkwoods set_lan_dhcp (and
maybe move that with a better name to base-files), or use
ucidef_set_interface_raw to configure it appropriately.
> + ;;
> +esac
> +
> +uci commit network
> +
> +exit 0
> diff --git a/target/linux/arc770/base-files/lib/arc.sh b/target/linux/arc770/base-files/lib/arc.sh
> new file mode 100644
> index 0000000..b15e94b
> --- /dev/null
> +++ b/target/linux/arc770/base-files/lib/arc.sh
> @@ -0,0 +1,76 @@
> +#!/bin/sh
> +#
> +# Copyright (C) 2015 OpenWrt.org
> +#
> +
> +# defaults
> +ARC_BOARD_NAME="generic"
> +ARC_BOARD_MODEL="Generic arc board"
> +
> +arc_board_detect() {
> + local board
> + local model
> +
> + [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
> +
> + model="$( cat /proc/device-tree/compatible )"
> +
> + # We cannot just use "model" as it is because in case of SDP board
ePAPR says your dts root nodes must have a "model" property that
uniquely identifies the board. I see that is currently missing even in
upstream, so please fix your dts files. Then you won't need to grep in
the compatible. On a side node, ePAPR also says that the recommended
format is the same as compatible but .. *looks at arm* .. apparently
nobody does that.
> + # it will be wet with "snps,axs101snps,arc-sdp" which is
> + # concatenation of "snps,axs101" and "snps,arc-sdp".
> + if cat /proc/device-tree/compatible | grep -q "snps,arc-sdp"; then
> + board="arc-sdp";
> + fi
> +
> + if cat /proc/device-tree/compatible | grep -q "snps,axs101"; then
> + model="axs101";
> + fi
> +
> + if cat /proc/device-tree/compatible | grep -q "snps,nsim"; then
> + board="nsim";
> + fi
> +
> + if [ "$board" != "" ]; then
> + ARC_BOARD_NAME="$board"
> + fi
> +
> + if [ "$model" != "" ]; then
> + ARC_BOARD_MODEL="$model"
> + fi
> +
> + echo "$ARC_BOARD_NAME" > /tmp/sysinfo/board_name
> + echo "$ARC_BOARD_MODEL" > /tmp/sysinfo/model
> + echo "Detected $ARC_BOARD_NAME // $ARC_BOARD_MODEL"
> +}
> +
> +arc_board_name() {
> + local name
> +
> + [ -f /tmp/sysinfo/board_name ] && name="$(cat /tmp/sysinfo/board_name)"
> + [ -z "$name" ] && name="unknown"
> +
> + echo "$name"
> +}
> +
> +arc_tty_setup() {
> + local name
> + local tty_device
> +
> + [ -f /tmp/sysinfo/board_name ] && name="$(cat /tmp/sysinfo/board_name)"
> + [ -z "$name" ] && name="unknown"
> +
> + case "$name" in
> + "nsim")
> + tty_device="ttyARC0"
> + ;;
> +
> + "arc-sdp")
> + tty_device="ttyS3"
Why not parse this out of the cmdline?
> + ;;
> + esac
> +
> + if [ "$tty_device" != "" ]; then
> + echo "$tty_device""::askfirst:/bin/ash --login" >> /etc/inittab
> + fi
> +}
> +
(snip the rest)
Regards
Jonas
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list