[OpenWrt-Devel] [PATCH 2/2 v4] linux: add support of Synopsys ARC770-based boards

Alexey Brodkin Alexey.Brodkin at synopsys.com
Sat Nov 7 08:25:22 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>
Cc: Jonas Gorski <jogo at openwrt.org>
Signed-off-by: Alexey Brodkin <abrodkin at synopsys.com>
---

Changes compared to v3:
 * Accomodate new KERNEL_INITRAMFS_NAME variable for building .elfs
 * Add and use "model" property in device tree description
 * Remove extra console from kernel command line
 * Use new buildsystem for resulting images
 * Nuked ARC-specific inittab, use default one instead
 * Linux kernel config is passed through "make kernel_oldconfig"
 * eth0 is now LAN instead of WAN

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/linux/arc770/Makefile                       |  26 +++
 target/linux/arc770/base-files.mk                  |   3 +
 .../arc770/base-files/etc/uci-defaults/02_network  |  23 +++
 target/linux/arc770/base-files/lib/arc.sh          |  49 +++++
 .../base-files/lib/preinit/01_preinit_arc.sh       |   9 +
 target/linux/arc770/config-4.3                     | 179 ++++++++++++++++
 target/linux/arc770/dts/axc001.dtsi                | 100 +++++++++
 target/linux/arc770/dts/axs101.dts                 |  22 ++
 target/linux/arc770/dts/axs10x_mb.dtsi             | 224 +++++++++++++++++++++
 target/linux/arc770/dts/nsim_700.dts               |  71 +++++++
 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                 |  40 ++++
 ...openwrt-arc-remove-dependency-on-DEVTMPFS.patch |  36 ++++
 .../0002-openwrt-arc-add-OWRTDTB-section.patch     |  91 +++++++++
 20 files changed, 984 insertions(+)
 create mode 100644 target/linux/arc770/Makefile
 create mode 100644 target/linux/arc770/base-files.mk
 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/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.mk b/target/linux/arc770/base-files.mk
new file mode 100644
index 0000000..fdd2c71
--- /dev/null
+++ b/target/linux/arc770/base-files.mk
@@ -0,0 +1,3 @@
+define Package/base-files/install-target
+	rm -f $(1)/etc/config/network
+endef
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..87cfe81
--- /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_raw "lan" "eth0" "dhcp"
+	;;
+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..17ce657
--- /dev/null
+++ b/target/linux/arc770/base-files/lib/arc.sh
@@ -0,0 +1,49 @@
+#!/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/model )"
+
+	# Extract just one "compatible" value out of "snps,axs101snps,arc-sdp"
+	# which is a 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,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"
+}
+
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..192c91b
--- /dev/null
+++ b/target/linux/arc770/base-files/lib/preinit/01_preinit_arc.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+do_arc() {
+        . /lib/arc.sh
+
+        arc_board_detect
+}
+
+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..7a13480
--- /dev/null
+++ b/target/linux/arc770/config-4.3
@@ -0,0 +1,179 @@
+# CONFIG_16KSTACKS is not set
+CONFIG_ARC=y
+CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
+# CONFIG_ARCH_HAS_GCOV_PROFILE_ALL is not set
+# CONFIG_ARCH_HAS_SG_CHAIN is not set
+CONFIG_ARCH_REQUIRE_GPIOLIB=y
+CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y
+CONFIG_ARC_BUILTIN_DTB_NAME=""
+CONFIG_ARC_CACHE=y
+CONFIG_ARC_CACHE_LINE_SHIFT=5
+CONFIG_ARC_CACHE_PAGES=y
+# CONFIG_ARC_CACHE_VIPT_ALIASING is not set
+# CONFIG_ARC_CANT_LLSC is not set
+# CONFIG_ARC_COMPACT_IRQ_LEVELS is not set
+# CONFIG_ARC_CPU_750D is not set
+CONFIG_ARC_CPU_770=y
+CONFIG_ARC_CURR_IN_REG=y
+CONFIG_ARC_DBG=y
+# CONFIG_ARC_DBG_TLB_MISS_COUNT is not set
+# CONFIG_ARC_DBG_TLB_PARANOIA is not set
+CONFIG_ARC_DW2_UNWIND=y
+# CONFIG_ARC_EMUL_UNALIGNED is not set
+# CONFIG_ARC_FPU_SAVE_RESTORE is not set
+CONFIG_ARC_HAS_DCACHE=y
+# CONFIG_ARC_HAS_DCCM is not set
+CONFIG_ARC_HAS_HW_MPY=y
+CONFIG_ARC_HAS_ICACHE=y
+# CONFIG_ARC_HAS_ICCM is not set
+CONFIG_ARC_HAS_LLSC=y
+CONFIG_ARC_HAS_SWAPE=y
+# CONFIG_ARC_METAWARE_HLINK is not set
+# CONFIG_ARC_MMU_V1 is not set
+# CONFIG_ARC_MMU_V2 is not set
+CONFIG_ARC_MMU_V3=y
+# CONFIG_ARC_PAGE_SIZE_16K is not set
+# CONFIG_ARC_PAGE_SIZE_4K is not set
+CONFIG_ARC_PAGE_SIZE_8K=y
+CONFIG_ARC_PLAT_AXS10X=y
+CONFIG_ARC_PLAT_SIM=y
+# CONFIG_ARC_PLAT_TB10X is not set
+# CONFIG_ARC_UBOOT_SUPPORT is not set
+CONFIG_AXS101=y
+CONFIG_CLKDEV_LOOKUP=y
+CONFIG_CLONE_BACKWARDS=y
+CONFIG_COMMON_CLK=y
+# CONFIG_CPU_BIG_ENDIAN is not set
+CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_WORKQUEUE=y
+CONFIG_DTC=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_DW_APB_ICTL=y
+CONFIG_GENERIC_ATOMIC64=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_CSUM=y
+CONFIG_GENERIC_FIND_FIRST_BIT=y
+CONFIG_GENERIC_IO=y
+CONFIG_GENERIC_IRQ_CHIP=y
+CONFIG_GENERIC_IRQ_SHOW=y
+CONFIG_GENERIC_SMP_IDLE_THREAD=y
+# CONFIG_GEN_RTC is not set
+CONFIG_GPIOLIB=y
+CONFIG_GPIO_DEVRES=y
+CONFIG_GPIO_DWAPB=y
+CONFIG_GPIO_GENERIC=y
+CONFIG_HAS_DMA=y
+CONFIG_HAS_IOMEM=y
+# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
+# CONFIG_HAVE_ARCH_BITREVERSE is not set
+CONFIG_HAVE_ARCH_KGDB=y
+CONFIG_HAVE_ARCH_TRACEHOOK=y
+# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
+CONFIG_HAVE_CLK=y
+CONFIG_HAVE_CLK_PREPARE=y
+CONFIG_HAVE_DEBUG_STACKOVERFLOW=y
+CONFIG_HAVE_FUTEX_CMPXCHG=y
+# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
+CONFIG_HAVE_IOREMAP_PROT=y
+CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_HAVE_MEMBLOCK=y
+CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
+CONFIG_HAVE_NET_DSA=y
+CONFIG_HAVE_OPROFILE=y
+CONFIG_HAVE_PERF_EVENTS=y
+CONFIG_HZ_PERIODIC=y
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_IRQCHIP=y
+CONFIG_IRQ_DOMAIN=y
+CONFIG_IRQ_WORK=y
+CONFIG_ISA_ARCOMPACT=y
+# CONFIG_ISA_ARCV2 is not set
+CONFIG_KALLSYMS=y
+CONFIG_LIBFDT=y
+CONFIG_LINUX_LINK_BASE=0x80000000
+CONFIG_LZO_COMPRESS=y
+CONFIG_LZO_DECOMPRESS=y
+CONFIG_MAC80211_STA_HASH_MAX_SIZE=0
+CONFIG_MDIO_BOARDINFO=y
+CONFIG_MFD_SYSCON=y
+CONFIG_MMC=y
+CONFIG_MMC_DW=y
+# CONFIG_MMC_DW_EXYNOS is not set
+CONFIG_MMC_DW_IDMAC=y
+# CONFIG_MMC_DW_K3 is not set
+CONFIG_MMC_DW_PLTFM=y
+CONFIG_MMC_SDHCI=y
+# CONFIG_MMC_SDHCI_OF_AT91 is not set
+CONFIG_MMC_SDHCI_PLTFM=y
+CONFIG_MODULES_USE_ELF_RELA=y
+CONFIG_NATIONAL_PHY=y
+CONFIG_NEED_PER_CPU_KM=y
+# CONFIG_NET_CADENCE is not set
+CONFIG_NET_PTP_CLASSIFY=y
+# CONFIG_NET_VENDOR_ARC 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_VIA is not set
+# CONFIG_NET_VENDOR_WIZNET is not set
+CONFIG_NO_BOOTMEM=y
+CONFIG_NO_IOPORT_MAP=y
+CONFIG_OF=y
+CONFIG_OF_ADDRESS=y
+CONFIG_OF_EARLY_FLATTREE=y
+CONFIG_OF_FLATTREE=y
+CONFIG_OF_GPIO=y
+CONFIG_OF_IRQ=y
+CONFIG_OF_MDIO=y
+CONFIG_OF_MTD=y
+CONFIG_OF_NET=y
+CONFIG_PAGEFLAGS_EXTENDED=y
+CONFIG_PERF_USE_VMALLOC=y
+CONFIG_PGTABLE_LEVELS=2
+CONFIG_PHYLIB=y
+CONFIG_PPS=y
+CONFIG_PREEMPT=y
+CONFIG_PREEMPT_COUNT=y
+# CONFIG_PREEMPT_NONE is not set
+CONFIG_PREEMPT_RCU=y
+CONFIG_PTP_1588_CLOCK=y
+# CONFIG_RCU_BOOST is not set
+CONFIG_RCU_STALL_COMMON=y
+CONFIG_REGMAP=y
+CONFIG_REGMAP_MMIO=y
+CONFIG_RESET_CONTROLLER=y
+# CONFIG_RTC is not set
+# CONFIG_SCHED_INFO is not set
+# CONFIG_SCSI_DMA is not set
+CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y
+CONFIG_SERIAL_8250_DW=y
+CONFIG_SERIAL_8250_NR_UARTS=4
+CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+CONFIG_SERIAL_ARC=y
+CONFIG_SERIAL_ARC_CONSOLE=y
+CONFIG_SERIAL_ARC_NR_PORTS=1
+CONFIG_SERIAL_OF_PLATFORM=y
+# CONFIG_SG_SPLIT is not set
+CONFIG_SRCU=y
+CONFIG_STACKTRACE=y
+CONFIG_STMMAC_ETH=y
+CONFIG_STMMAC_PLATFORM=y
+# CONFIG_SUNXI_SRAM is not set
+# CONFIG_SYSTEM_DATA_VERIFICATION is not set
+CONFIG_TICK_CPU_ACCOUNTING=y
+CONFIG_UNINLINE_SPIN_UNLOCK=y
+CONFIG_USB_SUPPORT=y
+CONFIG_ZONE_DMA_FLAG=0
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..8718eb4
--- /dev/null
+++ b/target/linux/arc770/dts/axs101.dts
@@ -0,0 +1,22 @@
+/*
+ * 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"
+
+/ {
+	model = "Synopsys AXS101 Development Board";
+	compatible = "snps,axs101", "snps,arc-sdp";
+
+	chosen {
+		bootargs = "earlycon=uart8250,mmio32,0xe0022000,115200n8 console=ttyS3,115200n8";
+	};
+};
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..d152646
--- /dev/null
+++ b/target/linux/arc770/dts/nsim_700.dts
@@ -0,0 +1,71 @@
+/*
+ * 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"
+
+/ {
+	model = "Synopsys ARC770 nSIM simulator";
+	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..c033102
--- /dev/null
+++ b/target/linux/arc770/image/Makefile
@@ -0,0 +1,40 @@
+#
+# 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
+
+define Build/patch-dtb
+	$(call Image/BuildDTB,../dts/$(DEVICE_DTS).dts,$@.dtb)
+	$(STAGING_DIR_HOST)/bin/patch-dtb $@ $@.dtb
+endef
+
+# Shared device definition: applies to every defined device
+define Device/Default
+  PROFILES = Default $$(DEVICE_PROFILE)
+  KERNEL_SUFFIX := .elf
+  KERNEL_INITRAMFS := kernel-bin | patch-dtb
+  KERNEL_INITRAMFS_NAME = $$(KERNEL_NAME)-initramfs.elf
+  DEVICE_PROFILE :=
+  DEVICE_DTS :=
+endef
+DEVICE_VARS += DEVICE_PROFILE DEVICE_DTS
+
+define add_arc770
+  define Device/$(1)
+    DEVICE_PROFILE := $(1)
+    DEVICE_DTS := $(1)
+  endef
+  TARGET_DEVICES += $(1)
+endef
+
+# DesignWare AXS101
+$(eval $(call add_arc770,axs101))
+
+# nSIM with ARC770
+$(eval $(call add_arc770,nsim_700))
+
+$(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