[OpenWrt-Devel] [PATCH 2/2 v3] linux: add support of Synopsys ARC770-based boards
Alexey Brodkin
Alexey.Brodkin at synopsys.com
Mon Nov 2 18:27:42 EST 2015
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
diff --git a/include/kernel.mk b/include/kernel.mk
index 6a613fe..878a366 100644
--- a/include/kernel.mk
+++ b/include/kernel.mk
@@ -64,6 +64,8 @@ ifneq (,$(findstring uml,$(BOARD)))
LINUX_KARCH=um
else ifneq (,$(findstring $(ARCH) , aarch64 aarch64_be ))
LINUX_KARCH := arm64
+else ifneq (,$(findstring $(ARCH) , arceb ))
+ LINUX_KARCH := arc
else ifneq (,$(findstring $(ARCH) , armeb ))
LINUX_KARCH := arm
else ifneq (,$(findstring $(ARCH) , mipsel mips64 mips64el ))
diff --git a/target/Config.in b/target/Config.in
index baae8d6..571b06e 100644
--- a/target/Config.in
+++ b/target/Config.in
@@ -100,6 +100,13 @@ config aarch64_be
select BIG_ENDIAN
bool
+config arc
+ bool
+
+config arceb
+ select BIG_ENDIAN
+ bool
+
config arm
bool
@@ -179,6 +186,8 @@ config ARCH
string
default "aarch64" if aarch64
default "aarch64_be" if aarch64_be
+ default "arc" if arc
+ default "arceb" if arceb
default "arm" if arm
default "armeb" if armeb
default "i386" if i386
diff --git a/target/linux/arc770/Makefile b/target/linux/arc770/Makefile
new file mode 100644
index 0000000..f62bf0e
--- /dev/null
+++ b/target/linux/arc770/Makefile
@@ -0,0 +1,26 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+ARCH:=arc
+BOARD:=arc770
+BOARDNAME:=Synopsys DesignWare ARC 770D
+CFLAGS:=-Os -pipe -fno-caller-saves -matomic
+MAINTAINER:=Alexey Brodkin <abrodkin at synopsys.com>
+SUBTARGETS:=generic
+
+KERNEL_PATCHVER:=4.3
+
+DEVICE_TYPE:=developerboard
+
+include $(INCLUDE_DIR)/target.mk
+
+define Target/Description
+ Synopsys DesignWare boards
+endef
+
+$(eval $(call BuildTarget))
diff --git a/target/linux/arc770/base-files/etc/inittab b/target/linux/arc770/base-files/etc/inittab
new file mode 100644
index 0000000..1ceba8e
--- /dev/null
+++ b/target/linux/arc770/base-files/etc/inittab
@@ -0,0 +1,4 @@
+::sysinit:/etc/init.d/rcS S boot
+::shutdown:/etc/init.d/rcS K shutdown
+tts/0::askfirst:/bin/ash --login
+tty1::askfirst:/bin/ash --login
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"
+ ;;
+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
+ # 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"
+ ;;
+ esac
+
+ if [ "$tty_device" != "" ]; then
+ echo "$tty_device""::askfirst:/bin/ash --login" >> /etc/inittab
+ fi
+}
+
diff --git a/target/linux/arc770/base-files/lib/preinit/01_preinit_arc.sh b/target/linux/arc770/base-files/lib/preinit/01_preinit_arc.sh
new file mode 100644
index 0000000..8c019b9
--- /dev/null
+++ b/target/linux/arc770/base-files/lib/preinit/01_preinit_arc.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+do_arc() {
+ . /lib/arc.sh
+
+ arc_board_detect
+ arc_tty_setup
+}
+
+boot_hook_add preinit_main do_arc
diff --git a/target/linux/arc770/config-4.3 b/target/linux/arc770/config-4.3
new file mode 100644
index 0000000..aba6908
--- /dev/null
+++ b/target/linux/arc770/config-4.3
@@ -0,0 +1,142 @@
+#
+# ARC Architecture Configuration
+#
+CONFIG_ARC=y
+
+#
+# ARC Platform/SoC/Board
+#
+CONFIG_ARC_PLAT_SIM=y
+# CONFIG_ARC_PLAT_TB10X is not set
+CONFIG_ARC_PLAT_AXS10X=y
+CONFIG_AXS101=y
+CONFIG_ISA_ARCOMPACT=y
+# CONFIG_ISA_ARCV2 is not set
+
+#
+# ARC CPU Configuration
+#
+# CONFIG_ARC_CPU_750D is not set
+CONFIG_ARC_CPU_770=y
+# CONFIG_CPU_BIG_ENDIAN is not set
+# CONFIG_SMP is not set
+CONFIG_ARC_CACHE=y
+CONFIG_ARC_CACHE_LINE_SHIFT=5
+CONFIG_ARC_HAS_ICACHE=y
+CONFIG_ARC_HAS_DCACHE=y
+CONFIG_ARC_CACHE_PAGES=y
+# CONFIG_ARC_CACHE_VIPT_ALIASING is not set
+# CONFIG_ARC_HAS_ICCM is not set
+# CONFIG_ARC_HAS_DCCM is not set
+CONFIG_ARC_HAS_HW_MPY=y
+# CONFIG_ARC_MMU_V1 is not set
+# CONFIG_ARC_MMU_V2 is not set
+CONFIG_ARC_MMU_V3=y
+CONFIG_ARC_PAGE_SIZE_8K=y
+# CONFIG_ARC_PAGE_SIZE_16K is not set
+# CONFIG_ARC_PAGE_SIZE_4K is not set
+# CONFIG_ARC_COMPACT_IRQ_LEVELS is not set
+# CONFIG_ARC_FPU_SAVE_RESTORE is not set
+# CONFIG_ARC_CANT_LLSC is not set
+CONFIG_ARC_CPU_REL_4_10=y
+CONFIG_ARC_HAS_LLSC=y
+CONFIG_ARC_HAS_SWAPE=y
+CONFIG_LINUX_LINK_BASE=0x80000000
+CONFIG_ARC_CURR_IN_REG=y
+# CONFIG_ARC_EMUL_UNALIGNED is not set
+CONFIG_HZ=100
+# CONFIG_ARC_METAWARE_HLINK is not set
+CONFIG_ARC_DBG=y
+CONFIG_ARC_DW2_UNWIND=y
+# CONFIG_ARC_DBG_TLB_PARANOIA is not set
+# CONFIG_ARC_DBG_TLB_MISS_COUNT is not set
+CONFIG_ARC_BUILTIN_DTB_NAME=""
+# CONFIG_PREEMPT_NONE is not set
+# CONFIG_PREEMPT_VOLUNTARY is not set
+CONFIG_PREEMPT=y
+CONFIG_PREEMPT_COUNT=y
+# CONFIG_ARC_UBOOT_SUPPORT is not set
+
+#
+# Ethernet drivers
+#
+CONFIG_ETHERNET=y
+# CONFIG_NET_VENDOR_ARC is not set
+# CONFIG_NET_CADENCE is not set
+# CONFIG_NET_VENDOR_BROADCOM is not set
+# CONFIG_NET_VENDOR_INTEL is not set
+# CONFIG_NET_VENDOR_MARVELL is not set
+# CONFIG_NET_VENDOR_MICREL is not set
+# CONFIG_NET_VENDOR_NATSEMI is not set
+# CONFIG_NET_VENDOR_QUALCOMM is not set
+# CONFIG_NET_VENDOR_ROCKER is not set
+# CONFIG_NET_VENDOR_SAMSUNG is not set
+# CONFIG_NET_VENDOR_SEEQ is not set
+CONFIG_NET_VENDOR_STMICRO=y
+CONFIG_STMMAC_ETH=y
+CONFIG_STMMAC_PLATFORM=y
+CONFIG_DWMAC_GENERIC=y
+# CONFIG_DWMAC_IPQ806X is not set
+# CONFIG_DWMAC_LPC18XX is not set
+# CONFIG_DWMAC_MESON is not set
+# CONFIG_DWMAC_ROCKCHIP is not set
+# CONFIG_DWMAC_SOCFPGA is not set
+# CONFIG_DWMAC_STI is not set
+# CONFIG_DWMAC_SUNXI is not set
+# CONFIG_NET_VENDOR_VIA is not set
+# CONFIG_NET_VENDOR_WIZNET is not set
+
+#
+# MII PHY device drivers
+#
+CONFIG_PHYLIB=y
+CONFIG_NATIONAL_PHY=y
+
+#
+# Serial drivers
+#
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+CONFIG_SERIAL_OF_PLATFORM=y
+CONFIG_SERIAL_EARLYCON=y
+CONFIG_SERIAL_ARC=y
+CONFIG_SERIAL_ARC_CONSOLE=y
+CONFIG_SERIAL_ARC_NR_PORTS=1
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_NR_UARTS=4
+CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+# CONFIG_SERIAL_8250_EXTENDED is not set
+CONFIG_SERIAL_8250_DW=y
+
+#
+# Character devices
+#
+# CONFIG_RTC is not set
+# CONFIG_GEN_RTC is not set
+
+#
+# USB Host Controller Drivers
+#
+CONFIG_USB_SUPPORT=y
+
+#
+# MMC/SD/SDIO Host Controller Drivers
+#
+CONFIG_MMC=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_PLTFM=y
+CONFIG_MMC_DW=y
+CONFIG_MMC_DW_IDMAC=y
+CONFIG_MMC_DW_PLTFM=y
+# CONFIG_MMC_SDHCI_OF_AT91 is not set
+# CONFIG_MMC_DW_EXYNOS is not set
+# CONFIG_MMC_DW_K3 is not set
+
+#
+# Misc options to make OpenWRT buildsystem happy
+#
+# CONFIG_RCU_BOOST is not set
+# CONFIG_FS_DAX is not set
+# CONFIG_16KSTACKS is not set
diff --git a/target/linux/arc770/dts/axc001.dtsi b/target/linux/arc770/dts/axc001.dtsi
new file mode 100644
index 0000000..a5e2726
--- /dev/null
+++ b/target/linux/arc770/dts/axc001.dtsi
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2013-15 Synopsys, Inc. (www.synopsys.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+/*
+ * Device tree for AXC001 770D/EM6/AS221 CPU card
+ * Note that this file only supports the 770D CPU
+ */
+
+/ {
+ compatible = "snps,arc";
+ clock-frequency = <750000000>; /* 750 MHZ */
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ cpu_card {
+ compatible = "simple-bus";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ ranges = <0x00000000 0xf0000000 0x10000000>;
+
+ cpu_intc: arc700-intc at cpu {
+ compatible = "snps,arc700-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+
+ /*
+ * this GPIO block ORs all interrupts on CPU card (creg,..)
+ * to uplink only 1 IRQ to ARC core intc
+ */
+ dw-apb-gpio at 0x2000 {
+ compatible = "snps,dw-apb-gpio";
+ reg = < 0x2000 0x80 >;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ ictl_intc: gpio-controller at 0 {
+ compatible = "snps,dw-apb-gpio-port";
+ gpio-controller;
+ #gpio-cells = <2>;
+ snps,nr-gpios = <30>;
+ reg = <0>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ interrupt-parent = <&cpu_intc>;
+ interrupts = <15>;
+ };
+ };
+
+ debug_uart: dw-apb-uart at 0x5000 {
+ compatible = "snps,dw-apb-uart";
+ reg = <0x5000 0x100>;
+ clock-frequency = <33333000>;
+ interrupt-parent = <&ictl_intc>;
+ interrupts = <19 4>;
+ baud = <115200>;
+ reg-shift = <2>;
+ reg-io-width = <4>;
+ };
+
+ arcpmu0: pmu {
+ compatible = "snps,arc700-pct";
+ };
+ };
+
+ /*
+ * This INTC is actually connected to DW APB GPIO
+ * which acts as a wire between MB INTC and CPU INTC.
+ * GPIO INTC is configured in platform init code
+ * and here we mimic direct connection from MB INTC to
+ * CPU INTC, thus we set "interrupts = <7>" instead of
+ * "interrupts = <12>"
+ *
+ * This intc actually resides on MB, but we move it here to
+ * avoid duplicating the MB dtsi file given that IRQ from
+ * this intc to cpu intc are different for axs101 and axs103
+ */
+ mb_intc: dw-apb-ictl at 0xe0012000 {
+ #interrupt-cells = <1>;
+ compatible = "snps,dw-apb-ictl";
+ reg = < 0xe0012000 0x200 >;
+ interrupt-controller;
+ interrupt-parent = <&cpu_intc>;
+ interrupts = < 7 >;
+ };
+
+ memory {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ranges = <0x00000000 0x80000000 0x40000000>;
+ device_type = "memory";
+ reg = <0x00000000 0x20000000>; /* 512MiB */
+ };
+};
diff --git a/target/linux/arc770/dts/axs101.dts b/target/linux/arc770/dts/axs101.dts
new file mode 100644
index 0000000..3f9b058
--- /dev/null
+++ b/target/linux/arc770/dts/axs101.dts
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2013-15 Synopsys, Inc. (www.synopsys.com)
+ *
+ * ARC AXS101 S/W development platform
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+/dts-v1/;
+
+/include/ "axc001.dtsi"
+/include/ "axs10x_mb.dtsi"
+
+/ {
+ compatible = "snps,axs101", "snps,arc-sdp";
+
+ chosen {
+ bootargs = "earlycon=uart8250,mmio32,0xe0022000,115200n8 console=tty0 console=ttyS3,115200n8 consoleblank=0";
+ };
+};
diff --git a/target/linux/arc770/dts/axs10x_mb.dtsi b/target/linux/arc770/dts/axs10x_mb.dtsi
new file mode 100644
index 0000000..f3db321
--- /dev/null
+++ b/target/linux/arc770/dts/axs10x_mb.dtsi
@@ -0,0 +1,224 @@
+/*
+ * Support for peripherals on the AXS10x mainboard
+ *
+ * Copyright (C) 2013-15 Synopsys, Inc. (www.synopsys.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+/ {
+ axs10x_mb {
+ compatible = "simple-bus";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ranges = <0x00000000 0xe0000000 0x10000000>;
+ interrupt-parent = <&mb_intc>;
+
+ clocks {
+ i2cclk: i2cclk {
+ compatible = "fixed-clock";
+ clock-frequency = <50000000>;
+ #clock-cells = <0>;
+ };
+
+ apbclk: apbclk {
+ compatible = "fixed-clock";
+ clock-frequency = <50000000>;
+ #clock-cells = <0>;
+ };
+
+ mmcclk: mmcclk {
+ compatible = "fixed-clock";
+ clock-frequency = <50000000>;
+ #clock-cells = <0>;
+ };
+ };
+
+ ethernet at 0x18000 {
+ #interrupt-cells = <1>;
+ compatible = "snps,dwmac";
+ reg = < 0x18000 0x2000 >;
+ interrupts = < 4 >;
+ interrupt-names = "macirq";
+ phy-mode = "rgmii";
+ snps,pbl = < 32 >;
+ clocks = <&apbclk>;
+ clock-names = "stmmaceth";
+ };
+
+ ehci at 0x40000 {
+ compatible = "generic-ehci";
+ reg = < 0x40000 0x100 >;
+ interrupts = < 8 >;
+ };
+
+ ohci at 0x60000 {
+ compatible = "generic-ohci";
+ reg = < 0x60000 0x100 >;
+ interrupts = < 8 >;
+ };
+
+ /*
+ * According to DW Mobile Storage databook it is required
+ * to use "Hold Register" if card is enumerated in SDR12 or
+ * SDR25 modes.
+ *
+ * Utilization of "Hold Register" is already implemented via
+ * dw_mci_pltfm_prepare_command() which in its turn gets
+ * used through dw_mci_drv_data->prepare_command call-back.
+ * This call-back is used in Altera Socfpga platform and so
+ * we may reuse it saying that we're compatible with their
+ * "altr,socfpga-dw-mshc".
+ *
+ * Most probably "Hold Register" utilization is platform-
+ * independent requirement which means that single unified
+ * "snps,dw-mshc" should be enough for all users of DW MMC once
+ * dw_mci_pltfm_prepare_command() is used in generic platform
+ * code.
+ */
+ mmc at 0x15000 {
+ compatible = "altr,socfpga-dw-mshc";
+ reg = < 0x15000 0x400 >;
+ num-slots = < 1 >;
+ fifo-depth = < 16 >;
+ card-detect-delay = < 200 >;
+ clocks = <&apbclk>, <&mmcclk>;
+ clock-names = "biu", "ciu";
+ interrupts = < 7 >;
+ bus-width = < 4 >;
+ };
+
+ uart at 0x20000 {
+ compatible = "snps,dw-apb-uart";
+ reg = <0x20000 0x100>;
+ clock-frequency = <33333333>;
+ interrupts = <17>;
+ baud = <115200>;
+ reg-shift = <2>;
+ reg-io-width = <4>;
+ };
+
+ uart at 0x21000 {
+ compatible = "snps,dw-apb-uart";
+ reg = <0x21000 0x100>;
+ clock-frequency = <33333333>;
+ interrupts = <18>;
+ baud = <115200>;
+ reg-shift = <2>;
+ reg-io-width = <4>;
+ };
+
+ /* UART muxed with USB data port (ttyS3) */
+ uart at 0x22000 {
+ compatible = "snps,dw-apb-uart";
+ reg = <0x22000 0x100>;
+ clock-frequency = <33333333>;
+ interrupts = <19>;
+ baud = <115200>;
+ reg-shift = <2>;
+ reg-io-width = <4>;
+ };
+
+ i2c at 0x1d000 {
+ compatible = "snps,designware-i2c";
+ reg = <0x1d000 0x100>;
+ clock-frequency = <400000>;
+ clocks = <&i2cclk>;
+ interrupts = <14>;
+ };
+
+ i2c at 0x1e000 {
+ compatible = "snps,designware-i2c";
+ reg = <0x1e000 0x100>;
+ clock-frequency = <400000>;
+ clocks = <&i2cclk>;
+ interrupts = <15>;
+ };
+
+ i2c at 0x1f000 {
+ compatible = "snps,designware-i2c";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <0x1f000 0x100>;
+ clock-frequency = <400000>;
+ clocks = <&i2cclk>;
+ interrupts = <16>;
+
+ eeprom at 0x54{
+ compatible = "24c01";
+ reg = <0x54>;
+ pagesize = <0x8>;
+ };
+
+ eeprom at 0x57{
+ compatible = "24c04";
+ reg = <0x57>;
+ pagesize = <0x8>;
+ };
+ };
+
+ gpio0:gpio at 13000 {
+ compatible = "snps,dw-apb-gpio";
+ reg = <0x13000 0x1000>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ gpio0_banka: gpio-controller at 0 {
+ compatible = "snps,dw-apb-gpio-port";
+ gpio-controller;
+ #gpio-cells = <2>;
+ snps,nr-gpios = <32>;
+ reg = <0>;
+ };
+
+ gpio0_bankb: gpio-controller at 1 {
+ compatible = "snps,dw-apb-gpio-port";
+ gpio-controller;
+ #gpio-cells = <2>;
+ snps,nr-gpios = <8>;
+ reg = <1>;
+ };
+
+ gpio0_bankc: gpio-controller at 2 {
+ compatible = "snps,dw-apb-gpio-port";
+ gpio-controller;
+ #gpio-cells = <2>;
+ snps,nr-gpios = <8>;
+ reg = <2>;
+ };
+ };
+
+ gpio1:gpio at 14000 {
+ compatible = "snps,dw-apb-gpio";
+ reg = <0x14000 0x1000>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ gpio1_banka: gpio-controller at 0 {
+ compatible = "snps,dw-apb-gpio-port";
+ gpio-controller;
+ #gpio-cells = <2>;
+ snps,nr-gpios = <30>;
+ reg = <0>;
+ };
+
+ gpio1_bankb: gpio-controller at 1 {
+ compatible = "snps,dw-apb-gpio-port";
+ gpio-controller;
+ #gpio-cells = <2>;
+ snps,nr-gpios = <10>;
+ reg = <1>;
+ };
+
+ gpio1_bankc: gpio-controller at 2 {
+ compatible = "snps,dw-apb-gpio-port";
+ gpio-controller;
+ #gpio-cells = <2>;
+ snps,nr-gpios = <8>;
+ reg = <2>;
+ };
+ };
+ };
+};
diff --git a/target/linux/arc770/dts/nsim_700.dts b/target/linux/arc770/dts/nsim_700.dts
new file mode 100644
index 0000000..105a001
--- /dev/null
+++ b/target/linux/arc770/dts/nsim_700.dts
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2012 Synopsys, Inc. (www.synopsys.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+/dts-v1/;
+
+/include/ "skeleton.dtsi"
+
+/ {
+ compatible = "snps,nsim";
+ clock-frequency = <80000000>; /* 80 MHZ */
+ #address-cells = <1>;
+ #size-cells = <1>;
+ interrupt-parent = <&intc>;
+
+ chosen {
+ bootargs = "earlycon=arc_uart,mmio32,0xc0fc1000,115200n8 console=ttyARC0,115200n8";
+ };
+
+ aliases {
+ serial0 = &arcuart0;
+ };
+
+ fpga {
+ compatible = "simple-bus";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ /* child and parent address space 1:1 mapped */
+ ranges;
+
+ intc: interrupt-controller {
+ compatible = "snps,arc700-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+
+ arcuart0: serial at c0fc1000 {
+ compatible = "snps,arc-uart";
+ reg = <0xc0fc1000 0x100>;
+ interrupts = <5>;
+ clock-frequency = <80000000>;
+ current-speed = <115200>;
+ status = "okay";
+ };
+
+ ethernet at c0fc2000 {
+ compatible = "snps,arc-emac";
+ reg = <0xc0fc2000 0x3c>;
+ interrupts = <6>;
+ mac-address = [ 00 11 22 33 44 55 ];
+ clock-frequency = <80000000>;
+ max-speed = <100>;
+ phy = <&phy0>;
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+ phy0: ethernet-phy at 0 {
+ reg = <1>;
+ };
+ };
+
+ arcpmu0: pmu {
+ compatible = "snps,arc700-pct";
+ };
+ };
+};
diff --git a/target/linux/arc770/dts/skeleton.dtsi b/target/linux/arc770/dts/skeleton.dtsi
new file mode 100644
index 0000000..a870bdd
--- /dev/null
+++ b/target/linux/arc770/dts/skeleton.dtsi
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2012 Synopsys, Inc. (www.synopsys.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+/*
+ * Skeleton device tree; the bare minimum needed to boot; just include and
+ * add a compatible value.
+ */
+
+/ {
+ compatible = "snps,arc";
+ clock-frequency = <80000000>; /* 80 MHZ */
+ #address-cells = <1>;
+ #size-cells = <1>;
+ chosen { };
+ aliases { };
+
+ cpus {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ cpu at 0 {
+ device_type = "cpu";
+ compatible = "snps,arc770d";
+ reg = <0>;
+ };
+ };
+
+ memory {
+ device_type = "memory";
+ reg = <0x00000000 0x10000000>; /* 256M */
+ };
+};
diff --git a/target/linux/arc770/generic/profiles/00-default.mk b/target/linux/arc770/generic/profiles/00-default.mk
new file mode 100644
index 0000000..b12ceb1
--- /dev/null
+++ b/target/linux/arc770/generic/profiles/00-default.mk
@@ -0,0 +1,16 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profile/Default
+ NAME:=Default Profile (all drivers)
+ PACKAGES:= kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-mmc kmod-sdhci
+endef
+
+define Profile/Default/Description
+ Default package set compatible with most boards.
+endef
+$(eval $(call Profile,Default))
diff --git a/target/linux/arc770/generic/profiles/01-minimal.mk b/target/linux/arc770/generic/profiles/01-minimal.mk
new file mode 100644
index 0000000..c8968da
--- /dev/null
+++ b/target/linux/arc770/generic/profiles/01-minimal.mk
@@ -0,0 +1,15 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profile/Minimal
+ NAME:=Minimal Profile (no drivers)
+endef
+
+define Profile/Minimal/Description
+ Minimal package set compatible with most boards.
+endef
+$(eval $(call Profile,Minimal))
diff --git a/target/linux/arc770/generic/profiles/02-axs101.mk b/target/linux/arc770/generic/profiles/02-axs101.mk
new file mode 100644
index 0000000..42effd2
--- /dev/null
+++ b/target/linux/arc770/generic/profiles/02-axs101.mk
@@ -0,0 +1,17 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profile/axs101
+ NAME:=Synopsys DesignWare AXS101
+ PACKAGES:= kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-mmc kmod-sdhci
+ DTS := axs101
+endef
+
+define Profile/axs101/Description
+ Package set compatible with hardware using Synopsys DesignWare AXS101 boards.
+endef
+$(eval $(call Profile,axs101))
diff --git a/target/linux/arc770/generic/profiles/03-nsim_700.mk b/target/linux/arc770/generic/profiles/03-nsim_700.mk
new file mode 100644
index 0000000..c1ba459
--- /dev/null
+++ b/target/linux/arc770/generic/profiles/03-nsim_700.mk
@@ -0,0 +1,16 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profile/nsim_700
+ NAME:=Synopsys nSIM
+ DTS := nsim_700
+endef
+
+define Profile/nsim_700/Description
+ Package set compatible with hardware using Synopsys nSIM 700 boards.
+endef
+$(eval $(call Profile,nsim_700))
diff --git a/target/linux/arc770/generic/target.mk b/target/linux/arc770/generic/target.mk
new file mode 100644
index 0000000..eba5c3c
--- /dev/null
+++ b/target/linux/arc770/generic/target.mk
@@ -0,0 +1,8 @@
+BOARDNAME:=Generic
+FEATURES += ramdisk usb
+
+define Target/Description
+ Build firmware images for generic ARC 770D based boards.
+endef
+
+
diff --git a/target/linux/arc770/image/Makefile b/target/linux/arc770/image/Makefile
new file mode 100644
index 0000000..1034bad
--- /dev/null
+++ b/target/linux/arc770/image/Makefile
@@ -0,0 +1,42 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/image.mk
+
+Image/Build/Initramfs=$(call Image/Build/Profile/$(PROFILE),initramfs)
+
+# $(1), lowercase board name like "axs101"
+# $(2), DTS filename without .dts extension
+# $(3), optional filename suffix, e.g. "-initramfs"
+define PatchKernelDtb
+ cp $(KDIR)/vmlinux$(3).elf $(KDIR)/vmlinux-$(1)$(3).elf
+ $(LINUX_DIR)/scripts/dtc/dtc -O dtb -o $(KDIR)/$(2).dtb ../dts/$(2).dts
+ $(STAGING_DIR_HOST)/bin/patch-dtb $(KDIR)/vmlinux-$(1)$(3).elf $(KDIR)/$(2).dtb
+endef
+
+# $(1), lowercase board name
+# $(2), DTS filename without .dts extension
+# $(3), optional filename suffix, e.g. "-initramfs"
+MkImageDtb=$(call PatchKernelDtb,$(1),$(2),$(3))
+
+# $(1), squashfs/initramfs
+# $(2), lowercase board name
+# $(3), DTS filename without .dts extension
+BuildFirmware/OF/initramfs=$(call MkImageDtb,$(2),$(3),-initramfs)
+
+BuildFirmware/axs101/initramfs=$(call BuildFirmware/OF/initramfs,$(1),axs101,axs101)
+BuildFirmware/nsim_700/initramfs=$(call BuildFirmware/OF/initramfs,$(1),nsim_700,nsim_700)
+
+Image/Build/Profile/axs101=$(call BuildFirmware/axs101/$(1),$(1))
+Image/Build/Profile/nsim_700=$(call BuildFirmware/nsim_700/$(1),$(1))
+
+define Image/Build/Profile/Default
+ $(call Image/Build/Profile/axs101,$(1))
+ $(call Image/Build/Profile/nsim_700,$(1))
+endef
+
+$(eval $(call BuildImage))
diff --git a/target/linux/arc770/patches-4.3/0001-openwrt-arc-remove-dependency-on-DEVTMPFS.patch b/target/linux/arc770/patches-4.3/0001-openwrt-arc-remove-dependency-on-DEVTMPFS.patch
new file mode 100644
index 0000000..53f8074
--- /dev/null
+++ b/target/linux/arc770/patches-4.3/0001-openwrt-arc-remove-dependency-on-DEVTMPFS.patch
@@ -0,0 +1,36 @@
+From 271777096a31e76b2ffd750bc44efde9656de857 Mon Sep 17 00:00:00 2001
+From: Alexey Brodkin <abrodkin at synopsys.com>
+Date: Thu, 13 Aug 2015 01:56:02 +0300
+Subject: [PATCH] openwrt: arc - remove dependency on DEVTMPFS
+
+OpenWRT builds initramfs so that it doesn't require DEVTMPFS so dropping
+this dependency. That helps to escape 2 separate kernel rebuilds with
+and without initramfs.
+
+2 builds happen because OpenWRT first builds kernel and later modules.
+When building entire kernel with simple "make" INITRAMFS sets to a real
+value and so was triggering DEVTMPFS selection. Then when building only
+modules with "make modules" command INITRAMFS is zeroed and so kernel
+config was changing that lead to full kernel rebuild.
+
+Signed-off-by: Alexey Brodkin <abrodkin at synopsys.com>
+---
+ arch/arc/Kconfig | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
+index cf96ef2..f0c6d4c 100644
+--- a/arch/arc/Kconfig
++++ b/arch/arc/Kconfig
+@@ -11,8 +11,6 @@ config ARC
+ select BUILDTIME_EXTABLE_SORT
+ select COMMON_CLK
+ select CLONE_BACKWARDS
+- # ARC Busybox based initramfs absolutely relies on DEVTMPFS for /dev
+- select DEVTMPFS if !INITRAMFS_SOURCE=""
+ select GENERIC_ATOMIC64
+ select GENERIC_CLOCKEVENTS
+ select GENERIC_FIND_FIRST_BIT
+--
+2.4.3
+
diff --git a/target/linux/arc770/patches-4.3/0002-openwrt-arc-add-OWRTDTB-section.patch b/target/linux/arc770/patches-4.3/0002-openwrt-arc-add-OWRTDTB-section.patch
new file mode 100644
index 0000000..ddb426f
--- /dev/null
+++ b/target/linux/arc770/patches-4.3/0002-openwrt-arc-add-OWRTDTB-section.patch
@@ -0,0 +1,91 @@
+From 142abc9f7b8860638e39cf3850cf7ba328c26b42 Mon Sep 17 00:00:00 2001
+From: Alexey Brodkin <abrodkin at synopsys.com>
+Date: Sat, 31 Oct 2015 15:58:20 +0300
+Subject: [PATCH] openwrt: arc - add OWRTDTB section
+
+This change allows OpenWRT to patch resulting kernel binary with
+external .dtb.
+
+That allows us to re-use exactky the same vmlinux on different boards
+given its ARC core configurations match (at least cache line sizes etc).
+
+""patch-dtb" searches for ASCII "OWRTDTB:" strign and copies external
+.dtb right after it, keeping the string in place.
+
+Signed-off-by: Alexey Brodkin <abrodkin at synopsys.com>
+---
+ arch/arc/kernel/head.S | 10 ++++++++++
+ arch/arc/kernel/setup.c | 4 +++-
+ arch/arc/kernel/vmlinux.lds.S | 13 +++++++++++++
+ 3 files changed, 26 insertions(+), 1 deletion(-)
+
+diff --git a/arch/arc/kernel/head.S b/arch/arc/kernel/head.S
+index 689dd86..51154ae 100644
+--- a/arch/arc/kernel/head.S
++++ b/arch/arc/kernel/head.S
+@@ -49,6 +49,16 @@
+ 1:
+ .endm
+
++; Here "patch-dtb" will embed external .dtb
++; Note "patch-dtb" searches for ASCII "OWRTDTB:" string
++; and pastes .dtb right after it, hense the string precedes
++; __image_dtb symbol.
++ .section .owrt, "aw", at progbits
++ .ascii "OWRTDTB:"
++ENTRY(__image_dtb)
++ .fill 0x4000
++END(__image_dtb)
++
+ .section .init.text, "ax", at progbits
+
+ ;----------------------------------------------------------------
+diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
+index c33e77c..96fbfd0 100644
+--- a/arch/arc/kernel/setup.c
++++ b/arch/arc/kernel/setup.c
+@@ -370,6 +370,8 @@ static inline int is_kernel(unsigned long addr)
+ return 0;
+ }
+
++extern struct boot_param_header __image_dtb;
++
+ void __init setup_arch(char **cmdline_p)
+ {
+ #ifdef CONFIG_ARC_UBOOT_SUPPORT
+@@ -383,7 +385,7 @@ void __init setup_arch(char **cmdline_p)
+ #endif
+ {
+ /* No, so try the embedded one */
+- machine_desc = setup_machine_fdt(__dtb_start);
++ machine_desc = setup_machine_fdt(&__image_dtb);
+ if (!machine_desc)
+ panic("Embedded DT invalid\n");
+
+diff --git a/arch/arc/kernel/vmlinux.lds.S b/arch/arc/kernel/vmlinux.lds.S
+index dd35bde..f309104 100644
+--- a/arch/arc/kernel/vmlinux.lds.S
++++ b/arch/arc/kernel/vmlinux.lds.S
+@@ -30,6 +30,19 @@ SECTIONS
+
+ . = CONFIG_LINUX_LINK_BASE;
+
++ /*
++ * In OpenWRT we want to patch built binary embedding .dtb of choice.
++ * This is implemented with "patch-dtb" utility which searches for
++ * "OWRTDTB:" string in first 16k of image and if it is found
++ * copies .dtb right after mentioned string.
++ *
++ * Note: "OWRTDTB:" won't be overwritten with .dtb, .dtb will follow it.
++ */
++ .owrt : {
++ *(.owrt)
++ . = ALIGN(PAGE_SIZE);
++ }
++
+ _int_vec_base_lds = .;
+ .vector : {
+ *(.vector)
+--
+2.4.3
+
--
2.4.3
_______________________________________________
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