Skip to contentSkip to conversation

hsdk: initial port for HSDK board

PATCH Superseded Alexey Brodkin 2 participants 2 messages Jun 1, 2017 – Jun 2, 2017

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 hsdk: initial port for HSDK board

This initial port adds support of ARC HS Development Kit board with some basic features such serial port, USB, SD/MMC and Ethernet.

Essentially we run Linux kernel on all 4 cores (i.e. utilize SMP) and heavily use IO Coherency for speeding-up DMA-aware peripherals.

Note as opposed to other ARC boards we link Linux kernel to 0x9000_0000 intentionally because cores 1 and 3 configured with DCCM situated at our more usual link base 0x8000_0000.

Signed-off-by Eugeniy Paltsev <paltsev at synopsys.com>
Signed-off-by Alexey Brodkin <abrodkin at synopsys.com>
Cc Vineet Gupta <vgupta at synopsys.com>
Cc Rob Herring <robh+dt at kernel.org>

---

Changes v2 -> v3:
* Added Rob to Cc-list for DT binding approval
* Removed mention of prerequsite patch from commit message
* Removed hsdk_early_init() as hsdk_init_per_cpu() is executed on all cores anyways including master
* Cleaned-up board's .dts a little bit
* Removed CONFIG_DP83867_PHY from defconfig as it was only used on FPGA prototype, on real board we use MICREL PHY which is still selected

Changes v1 -> v2:
* Update copyright year from 2016 to more up to date 2017
* Merge early UART clock with AXS10x as in both cases that's 33.3 MHz
* Bump memory to 1Gb, we don't use more for now because it requires trickier IOC setup and usage
* Update early platform init code:
- Added missing fixup_pae_regs() to per-cpu init
- Mark most of functions as "static __init"
- Use writel_relaxed() for setting CREG_PAE, CREG_PAE_UPDATE is still written with stronger writel() since we don't want reordering to happen, otherwise value written to CREG_PAE won't be applied

 Documentation/devicetree/bindings/arc/hsdk.txt |   7 ++
 arch/arc/Kconfig                               |   1 +
 arch/arc/Makefile                              |   1 +
 arch/arc/boot/dts/hsdk.dts                     | 151 +++++++++++++++++++++++++
 arch/arc/configs/hsdk_defconfig                |  71 ++++++++++++
 arch/arc/kernel/devtree.c                      |   5 +-
 arch/arc/plat-hsdk/Kconfig                     |  12 ++
 arch/arc/plat-hsdk/Makefile                    |   9 ++
 arch/arc/plat-hsdk/platform.c                  |  59 ++++++++++
 9 files changed, 314 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arc/hsdk.txt
 create mode 100644 arch/arc/boot/dts/hsdk.dts
 create mode 100644 arch/arc/configs/hsdk_defconfig
 create mode 100644 arch/arc/plat-hsdk/Kconfig
 create mode 100644 arch/arc/plat-hsdk/Makefile
 create mode 100644 arch/arc/plat-hsdk/platform.c
Documentation/devicetree/bindings/arc/hsdk.txt new file +7 -0
new file mode 100644
index 000000000000..be50654bbf61
@@ -0,0 +1,7 @@
+Synopsys DesignWare ARC HS Development Kit Device Tree Bindings
+---------------------------------------------------------------------------
+
+ARC HSDK Board with quad-core ARC HS38x4 in silicon.
+
+Required root node properties:
+    - compatible = "snps,hsdk";
arch/arc/Kconfig +1 -0
index a5459698f0ee..92c912819613 100644
@@ -101,6 +101,7 @@ source "arch/arc/plat-tb10x/Kconfig"
 source "arch/arc/plat-axs10x/Kconfig"
 #New platform adds here
 source "arch/arc/plat-eznps/Kconfig"
+source "arch/arc/plat-hsdk/Kconfig"
 
 endmenu
 
arch/arc/Makefile +1 -0
index 44ef35d33956..55ca925edf65 100644
@@ -111,6 +111,7 @@ core-$(CONFIG_ARC_PLAT_SIM)	+= arch/arc/plat-sim/
 core-$(CONFIG_ARC_PLAT_TB10X)	+= arch/arc/plat-tb10x/
 core-$(CONFIG_ARC_PLAT_AXS10X)	+= arch/arc/plat-axs10x/
 core-$(CONFIG_ARC_PLAT_EZNPS)	+= arch/arc/plat-eznps/
+core-$(CONFIG_ARC_PLAT_HSDK)	+= arch/arc/plat-hsdk/
 
 ifdef CONFIG_ARC_PLAT_EZNPS
 KBUILD_CPPFLAGS += -I$(srctree)/arch/arc/plat-eznps/include
arch/arc/boot/dts/hsdk.dts new file +151 -0

151 lines not on this page · raw message

arch/arc/configs/hsdk_defconfig new file +71 -0

71 lines not on this page · raw message

arch/arc/kernel/devtree.c +3 -2
index 3b67f538f142..521ef3521a1c 100644
@@ -29,8 +29,9 @@ static void __init arc_set_early_base_baud(unsigned long dt_root)
 {
 	if (of_flat_dt_is_compatible(dt_root, "abilis,arc-tb10x"))
 		arc_base_baud = 166666666;	/* Fixed 166.6MHz clk (TB10x) */
-	else if (of_flat_dt_is_compatible(dt_root, "snps,arc-sdp"))
-		arc_base_baud = 33333333;	/* Fixed 33MHz clk (AXS10x) */
+	else if (of_flat_dt_is_compatible(dt_root, "snps,arc-sdp") ||
+		 of_flat_dt_is_compatible(dt_root, "snps,hsdk"))
+		arc_base_baud = 33333333;	/* Fixed 33MHz clk (AXS10x & HSDK) */
 	else if (of_flat_dt_is_compatible(dt_root, "ezchip,arc-nps"))
 		arc_base_baud = 800000000;      /* Fixed 800MHz clk (NPS) */
 	else
arch/arc/plat-hsdk/Kconfig new file +12 -0
new file mode 100644
index 000000000000..21ec7623d16c
@@ -0,0 +1,12 @@
+#
+# Copyright (C) 2017 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.
+#
+
+menuconfig ARC_PLAT_HSDK
+	bool "ARC HS Development Kit board"
+	help
+	  Support for ARC HS Development Kit board
arch/arc/plat-hsdk/Makefile new file +9 -0
new file mode 100644
index 000000000000..9a50c511a672
@@ -0,0 +1,9 @@
+#
+# Copyright (C) 2017 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.
+#
+
+obj-y := platform.o
arch/arc/plat-hsdk/platform.c new file +59 -0

59 lines not on this page · raw message

Signature · 1 line
2.7.5
#1 lore raw
Quoted 62 lines · Alexey Brodkin

This initial port adds support of ARC HS Development Kit board with some basic features such serial port, USB, SD/MMC and Ethernet.

Essentially we run Linux kernel on all 4 cores (i.e. utilize SMP) and heavily use IO Coherency for speeding-up DMA-aware peripherals.

Note as opposed to other ARC boards we link Linux kernel to 0x9000_0000 intentionally because cores 1 and 3 configured with DCCM situated at our more usual link base 0x8000_0000.

Signed-off-by Eugeniy Paltsev <paltsev at synopsys.com>
Signed-off-by Alexey Brodkin <abrodkin at synopsys.com>
Cc Vineet Gupta <vgupta at synopsys.com>
Cc Rob Herring <robh+dt at kernel.org>

---

Changes v2 -> v3:
* Added Rob to Cc-list for DT binding approval
* Removed mention of prerequsite patch from commit message
* Removed hsdk_early_init() as hsdk_init_per_cpu() is executed on all cores anyways including master
* Cleaned-up board's .dts a little bit
* Removed CONFIG_DP83867_PHY from defconfig as it was only used on FPGA prototype, on real board we use MICREL PHY which is still selected

Changes v1 -> v2:
* Update copyright year from 2016 to more up to date 2017
* Merge early UART clock with AXS10x as in both cases that's 33.3 MHz
* Bump memory to 1Gb, we don't use more for now because it requires trickier IOC setup and usage
* Update early platform init code:
- Added missing fixup_pae_regs() to per-cpu init
- Mark most of functions as "static __init"
- Use writel_relaxed() for setting CREG_PAE, CREG_PAE_UPDATE is still written with stronger writel() since we don't want reordering to happen, otherwise value written to CREG_PAE won't be applied

arch/arc/plat-hsdk/platform.c new file +24 -0
+/*
+ * By default ICCM is mapped to 0x7z while this area is used for
+ * Virtual kernel mappings, so move it to currently unused area.
+ */
+static void __init relocate_iccm(void)
+{
+	if (cpuinfo_arc700[smp_processor_id()].iccm.sz)
+		write_aux_reg(ARC_REG_AUX_ICCM, 0x60000000);
+}
+
+/*
+ * Default configuration of PAE regs doesn't work for us causing
+ * problems with DMA to/from peripherals even if PAE40 is not used.
+ */
+static void __init fixup_pae_regs(void)
+{
+#define ARC_PERIPHERAL_BASE	0xf0000000
+#define	CREG_BASE		(ARC_PERIPHERAL_BASE + 0x1000)
+#define	CREG_PAE		(CREG_BASE + 0x180)
+#define	CREG_PAE_UPDATE		(CREG_BASE + 0x194)
+
+	/* Default is 1, which means "PAE offset = 4GByte" */
+	writel_relaxed(0, (void __iomem *) CREG_PAE);
+

arch/arc/plat-hsdk/platform.c line 50

Quoted 10 lines
arch/arc/plat-hsdk/platform.c new file +10 -0
+	/* Really apply settings made above */
+	writel(1, (void __iomem *) CREG_PAE_UPDATE);
+}
+
+static void __init hsdk_init_per_cpu(unsigned int cpu)
+{
+	relocate_iccm();
+	fixup_pae_regs();
+}
+

A couple of things.

Is the PAE register banked/replicated for each CPU. If not it only needs to be done once by the master.

Now anything master does (iccm relocation specially) preferably needs to be done really early. For master, machine_desc->init_per_cpu is called pretty late in the game so better do it in init_eary.

P.S. You don't need to respin, I can fix up the patch here if you agree !

Quoted 5 lines
arch/arc/plat-hsdk/platform.c new file +4 -0
+MACHINE_START(SIMULATION, "hsdk")
+	.dt_compat	= hsdk_compat,
+	.init_per_cpu	= hsdk_init_per_cpu,
+MACHINE_END