Re: [PATCH v2 2/4] ARC: ARCv2: support loop buffer (LPB) disabling

2020-06-18 Thread Eugeniy Paltsev
Hi Vineet,

could you also peek this patch to for-curr as we don't have any disagreement 
about it?

I'll respin the rest of the patches later. Thanks.
---
 Eugeniy Paltsev



From: Eugeniy Paltsev 
Sent: Thursday, June 4, 2020 20:39
To: linux-snps-arc@lists.infradead.org; Vineet Gupta
Cc: linux-ker...@vger.kernel.org; Alexey Brodkin; Eugeniy Paltsev
Subject: [PATCH v2 2/4] ARC: ARCv2: support loop buffer (LPB) disabling

On HS cores, loop buffer (LPB) is programmable in runtime and can
be optionally disabled.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/Kconfig   | 6 ++
 arch/arc/kernel/head.S | 8 
 2 files changed, 14 insertions(+)

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 7034c217708f..2dc142c8e1f5 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -473,6 +473,12 @@ config ARC_IRQ_NO_AUTOSAVE
  This is programmable and can be optionally disabled in which case
  software INTERRUPT_PROLOGUE/EPILGUE do the needed work

+config ARC_LPB_DISABLE
+   bool "Disable loop buffer (LPB)"
+   help
+ On HS cores, loop buffer (LPB) is programmable in runtime and can
+ be optionally disabled.
+
 endif # ISA_ARCV2

 endmenu   # "ARC CPU Configuration"
diff --git a/arch/arc/kernel/head.S b/arch/arc/kernel/head.S
index 6eb23f1545ee..17fd1ed700cc 100644
--- a/arch/arc/kernel/head.S
+++ b/arch/arc/kernel/head.S
@@ -59,6 +59,14 @@
bclrr5, r5, STATUS_AD_BIT
 #endif
kflag   r5
+
+#ifdef CONFIG_ARC_LPB_DISABLE
+   lr  r5, [ARC_REG_LPB_BUILD]
+   breqr5, 0, 1f   ; LPB doesn't exist
+   mov r5, 1
+   sr  r5, [ARC_REG_LPB_CTRL]
+1:
+#endif /* CONFIG_ARC_LPB_DISABLE */
 #endif
; Config DSP_CTRL properly, so kernel may use integer multiply,
; multiply-accumulate, and divide operations
--
2.21.3


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v2 2/4] ARC: ARCv2: support loop buffer (LPB) disabling

2020-06-04 Thread Eugeniy Paltsev
On HS cores, loop buffer (LPB) is programmable in runtime and can
be optionally disabled.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/Kconfig   | 6 ++
 arch/arc/kernel/head.S | 8 
 2 files changed, 14 insertions(+)

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 7034c217708f..2dc142c8e1f5 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -473,6 +473,12 @@ config ARC_IRQ_NO_AUTOSAVE
  This is programmable and can be optionally disabled in which case
  software INTERRUPT_PROLOGUE/EPILGUE do the needed work
 
+config ARC_LPB_DISABLE
+   bool "Disable loop buffer (LPB)"
+   help
+ On HS cores, loop buffer (LPB) is programmable in runtime and can
+ be optionally disabled.
+
 endif # ISA_ARCV2
 
 endmenu   # "ARC CPU Configuration"
diff --git a/arch/arc/kernel/head.S b/arch/arc/kernel/head.S
index 6eb23f1545ee..17fd1ed700cc 100644
--- a/arch/arc/kernel/head.S
+++ b/arch/arc/kernel/head.S
@@ -59,6 +59,14 @@
bclrr5, r5, STATUS_AD_BIT
 #endif
kflag   r5
+
+#ifdef CONFIG_ARC_LPB_DISABLE
+   lr  r5, [ARC_REG_LPB_BUILD]
+   breqr5, 0, 1f   ; LPB doesn't exist
+   mov r5, 1
+   sr  r5, [ARC_REG_LPB_CTRL]
+1:
+#endif /* CONFIG_ARC_LPB_DISABLE */
 #endif
; Config DSP_CTRL properly, so kernel may use integer multiply,
; multiply-accumulate, and divide operations
-- 
2.21.3


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v2 0/4] ARC: [plat-hsdk-4xd] initial port for HSDK-4xD board

2020-06-04 Thread Eugeniy Paltsev
Changes v1->v2:
 * Fallback to ISA default mcpu flag if custom one isn't supported by
   compiler.
 * Drop HSDK custom Kconfig options (choose between HSDK and HSDK-4xD) as
   we don't need it (at least for now). Instead we select ARC_LPB_DISABLE
   for both boards but it's totally OK as HSDK doesn't have LPB so
   disabling will be skipped by BCR check in runtime.
 * Add missing HSDK-4xD device tree bindings. Convert HSDK device tree
   bindings to json-schema.

Eugeniy Paltsev (4):
  ARC: allow to override default mcpu compiler flag
  ARC: ARCv2: support loop buffer (LPB) disabling
  ARC: [plat-hsdk-4xd] initial port for HSDK-4xD board
  ARC: [plat-hsdk*] document HSDK-4xD board/SoC bindings

 .../devicetree/bindings/arc/hsdk.txt  |   7 -
 .../devicetree/bindings/arc/hsdk.yaml |  26 ++
 arch/arc/Kconfig  |  15 +
 arch/arc/Makefile |  21 +-
 arch/arc/boot/dts/hsdk-4xd.dts| 322 ++
 arch/arc/configs/hsdk_4xd_defconfig   |  98 ++
 arch/arc/kernel/devtree.c |   1 +
 arch/arc/kernel/head.S|   8 +
 arch/arc/plat-hsdk/Kconfig|   3 +-
 arch/arc/plat-hsdk/platform.c |   1 +
 10 files changed, 492 insertions(+), 10 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/arc/hsdk.txt
 create mode 100644 Documentation/devicetree/bindings/arc/hsdk.yaml
 create mode 100644 arch/arc/boot/dts/hsdk-4xd.dts
 create mode 100644 arch/arc/configs/hsdk_4xd_defconfig

-- 
2.21.3


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v2 1/4] ARC: allow to override default mcpu compiler flag

2020-06-04 Thread Eugeniy Paltsev
Kernel builds set their own default -mcpu for a given ISA build.
But that gets in the way of "custom" -mcpu flags from propagating
into kernel build.

This will also be used in next patches for HSDK-4xD board support which
uses a different -mcpu to effect dual issue scheduling.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/Kconfig  |  9 +
 arch/arc/Makefile | 21 +++--
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index ff306246d0f8..7034c217708f 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -377,6 +377,15 @@ config ARC_HAS_SWAPE
bool "Insn: SWAPE (endian-swap)"
default y
 
+config ARC_TUNE_MCPU
+   string "Override default -mcpu compiler flag"
+   default ""
+   help
+ Override default -mcpu=xxx compiler flag (which is set depending on
+ the ISA version) with the specified value.
+ NOTE: If specified flag isn't supported by current compiler the
+ ISA default value will be used as a fallback.
+
 if ISA_ARCV2
 
 config ARC_USE_UNALIGNED_MEM_ACCESS
diff --git a/arch/arc/Makefile b/arch/arc/Makefile
index 20e9ab6cc521..2b66e8264174 100644
--- a/arch/arc/Makefile
+++ b/arch/arc/Makefile
@@ -10,8 +10,25 @@ CROSS_COMPILE := $(call cc-cross-prefix, arc-linux- 
arceb-linux-)
 endif
 
 cflags-y   += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__
-cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7
-cflags-$(CONFIG_ISA_ARCV2) += -mcpu=hs38
+
+tune-mcpu-def-$(CONFIG_ISA_ARCOMPACT)  := -mA7
+tune-mcpu-def-$(CONFIG_ISA_ARCV2)  := -mcpu=hs38
+
+ifeq ($(CONFIG_ARC_TUNE_MCPU),"")
+cflags-y   += $(tune-mcpu-def-y)
+else
+tune-mcpu  := $(shell echo $(CONFIG_ARC_TUNE_MCPU))
+tune-mcpu-ok   := $(call cc-option-yn, $(tune-mcpu))
+ifeq ($(tune-mcpu-ok),y)
+cflags-y   += $(tune-mcpu)
+else
+# The flag provided by 'CONFIG_ARC_TUNE_MCPU' option isn't known by this 
compiler
+# (probably the compiler is too old). Use ISA default mcpu flag instead as a 
safe option.
+$(warning ** WARNING ** CONFIG_ARC_TUNE_MCPU flag '$(tune-mcpu)' is unknown, 
fallback to '$(tune-mcpu-def-y)')
+cflags-y   += $(tune-mcpu-def-y)
+endif
+endif
+
 
 ifdef CONFIG_ARC_CURR_IN_REG
 # For a global register defintion, make sure it gets passed to every file
-- 
2.21.3


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v2 4/4] ARC: [plat-hsdk*] document HSDK-4xD board/SoC bindings

2020-06-04 Thread Eugeniy Paltsev
Add documentation for HSDK-4xD board/SoC bindings. While I'm at it
convert HSDK board/SoC bindings to DT schema format using
json-schema.

Cc: Rob Herring 
Signed-off-by: Eugeniy Paltsev 
---
 .../devicetree/bindings/arc/hsdk.txt  |  7 -
 .../devicetree/bindings/arc/hsdk.yaml | 26 +++
 2 files changed, 26 insertions(+), 7 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/arc/hsdk.txt
 create mode 100644 Documentation/devicetree/bindings/arc/hsdk.yaml

diff --git a/Documentation/devicetree/bindings/arc/hsdk.txt 
b/Documentation/devicetree/bindings/arc/hsdk.txt
deleted file mode 100644
index be50654bbf61..
--- a/Documentation/devicetree/bindings/arc/hsdk.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-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";
diff --git a/Documentation/devicetree/bindings/arc/hsdk.yaml 
b/Documentation/devicetree/bindings/arc/hsdk.yaml
new file mode 100644
index ..3a269423b3d3
--- /dev/null
+++ b/Documentation/devicetree/bindings/arc/hsdk.yaml
@@ -0,0 +1,26 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/arc/hsdk.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Synopsys DesignWare ARC HS Development Kits device tree bindings.
+
+maintainers:
+  - Eugeniy Paltsev 
+
+properties:
+  $nodename:
+const: '/'
+  compatible:
+oneOf:
+  - description: ARC HS Development Kit based on quad core ARC HS38
+  processor in silicon
+items:
+  - const: snps,hsdk
+  - description: ARC HS4x/HS4xD Development Kit based on quad core
+  ARC HS48/HS47D processor in silicon
+items:
+  - const: snps,hsdk-4xd
+
+...
-- 
2.21.3


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v2 3/4] ARC: [plat-hsdk-4xd] initial port for HSDK-4xD board

2020-06-04 Thread Eugeniy Paltsev
This initial port adds support of ARC HS4x/HS4xD Development Kit board
with some basic features such serial port, USB, SD/MMC, SPI flash,
Ethernet and others.

The HSDK-4xD board has much in common with its predecessor - HSDK board.
However HSDK-4xD has some differences in comparison with its predecessor:
 * based on quad core ARC HS48/HS47D processor (instead of quad core
   ARC HS38)
 * has ThinkSilicon GPU (instead of Vivante GPU)
 * has ARC PGU and HDMI output
 * has separate SDIO controller for WiFi module
 * has additional timers with clocksource independent from CPU clocksource
   (required for DVFS)
 * has performance counters interrupt
 * other minor stuff

NOTE:
HSDK-4xD and HSDK may share part of DTS so we can move this common part
to one .dtsi file (as we have done it in U-boot). However we have quite
enough out of the tree patches for tweaking HSDK DTS (patches in out
Linux kernel verification flow, patches for run in simulation, etc...),
so I'd prefer to keep HSDK DTS untouched. That's why HSDK-4xD DTS is
created as an separate file.

Cc: Rob Herring 
Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/boot/dts/hsdk-4xd.dts  | 322 
 arch/arc/configs/hsdk_4xd_defconfig |  98 +
 arch/arc/kernel/devtree.c   |   1 +
 arch/arc/plat-hsdk/Kconfig  |   3 +-
 arch/arc/plat-hsdk/platform.c   |   1 +
 5 files changed, 424 insertions(+), 1 deletion(-)
 create mode 100644 arch/arc/boot/dts/hsdk-4xd.dts
 create mode 100644 arch/arc/configs/hsdk_4xd_defconfig

diff --git a/arch/arc/boot/dts/hsdk-4xd.dts b/arch/arc/boot/dts/hsdk-4xd.dts
new file mode 100644
index ..2b7f76a01e3e
--- /dev/null
+++ b/arch/arc/boot/dts/hsdk-4xd.dts
@@ -0,0 +1,322 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2020 Synopsys, Inc. (www.synopsys.com)
+ */
+
+/*
+ * Device Tree for ARC HS4x/HS4xD Development Kit
+ */
+/dts-v1/;
+
+#include 
+#include 
+
+/ {
+   model = "snps,hsdk-4xd";
+   compatible = "snps,hsdk-4xd";
+
+   #address-cells = <2>;
+   #size-cells = <2>;
+
+   chosen {
+   bootargs = "earlycon=uart8250,mmio32,0xf0005000,115200n8 
console=ttyS0,115200n8 debug print-fatal-signals=1";
+   };
+
+   aliases {
+   ethernet = 
+   };
+
+   cpus {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   cpu@0 {
+   device_type = "cpu";
+   compatible = "snps,archs48";
+   reg = <0>;
+   clocks = <_clk>;
+   };
+
+   cpu@1 {
+   device_type = "cpu";
+   compatible = "snps,archs48";
+   reg = <1>;
+   clocks = <_clk>;
+   };
+
+   cpu@2 {
+   device_type = "cpu";
+   compatible = "snps,archs48";
+   reg = <2>;
+   clocks = <_clk>;
+   };
+
+   cpu@3 {
+   device_type = "cpu";
+   compatible = "snps,archs48";
+   reg = <3>;
+   clocks = <_clk>;
+   };
+   };
+
+   input_clk: input-clk {
+   #clock-cells = <0>;
+   compatible = "fixed-clock";
+   clock-frequency = <>;
+   };
+
+   reg_5v0: regulator-5v0 {
+   compatible = "regulator-fixed";
+
+   regulator-name = "5v0-supply";
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   };
+
+   cpu_intc: cpu-interrupt-controller {
+   compatible = "snps,archs-intc";
+   interrupt-controller;
+   #interrupt-cells = <1>;
+   };
+
+   idu_intc: idu-interrupt-controller {
+   compatible = "snps,archs-idu-intc";
+   interrupt-controller;
+   #interrupt-cells = <1>;
+   interrupt-parent = <_intc>;
+   };
+
+   arcpct: pct {
+   compatible = "snps,archs-pct";
+   interrupt-parent = <_intc>;
+   interrupts = <20>;
+   };
+
+   /* TIMER0 with interrupt for clockevent */
+   timer {
+   compatible = "snps,arc-timer";
+   interrupts = <16>;
+   interrupt-parent = <_intc>;
+   clocks = <_clk>;
+   };
+
+   /* 64-bit Global Free Running Counter */
+   gfrc {
+   compatible = "snps,archs-timer-gfrc";

Re: [PATCH private 1/3] ARC: allow to overwrite default mcpu compiler flag

2020-05-29 Thread Eugeniy Paltsev
Oooops, this one is duplicate and should be dropped.

---
 Eugeniy Paltsev



From: Eugeniy Paltsev 
Sent: Friday, May 29, 2020 14:55
To: linux-snps-arc@lists.infradead.org; Vineet Gupta
Cc: linux-ker...@vger.kernel.org; Alexey Brodkin; Eugeniy Paltsev
Subject: [PATCH private 1/3] ARC: allow to overwrite default mcpu compiler flag

By default we set -mcpu=xxx compiler flag depending on the CPU ISA
version. It's good starting point, however that may be not enough
as for some platforms we may want to use some specific 'mcpu'
options for better optimization or to workaround HW issues.

We are going to use this option for HSDK-4xD board support.
In addition it also allows to awoid patching 'mcpu' in ARC Makefile
when we building Linux for some non-standard simulation or FPGA-based
platforms.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/Kconfig  | 7 +++
 arch/arc/Makefile | 4 
 2 files changed, 11 insertions(+)

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index ff306246d0f8..e7805db10f7a 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -377,6 +377,13 @@ config ARC_HAS_SWAPE
bool "Insn: SWAPE (endian-swap)"
default y

+config ARC_MCPU_OVERWRITE
+   string "Overwrite default -mcpu compiler flag"
+   default ""
+   help
+ Overwrite default -mcpu=xxx compiler flag (which is set depending on
+ the ISA version) with the specified value.
+
 if ISA_ARCV2

 config ARC_USE_UNALIGNED_MEM_ACCESS
diff --git a/arch/arc/Makefile b/arch/arc/Makefile
index 20e9ab6cc521..1b37e44d9b57 100644
--- a/arch/arc/Makefile
+++ b/arch/arc/Makefile
@@ -10,8 +10,12 @@ CROSS_COMPILE := $(call cc-cross-prefix, arc-linux- 
arceb-linux-)
 endif

 cflags-y   += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__
+ifeq ($(CONFIG_ARC_MCPU_OVERWRITE),"")
 cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7
 cflags-$(CONFIG_ISA_ARCV2) += -mcpu=hs38
+else
+cflags-y   += $(shell echo $(CONFIG_ARC_MCPU_OVERWRITE))
+endif

 ifdef CONFIG_ARC_CURR_IN_REG
 # For a global register defintion, make sure it gets passed to every file
--
2.21.3


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 1/3] ARC: allow to overide default mcpu compiler flag

2020-05-29 Thread Eugeniy Paltsev
By default we set -mcpu=xxx compiler flag depending on the CPU ISA
version. It's good starting point, however that may be not enough
as for some platforms we may want to use some specific 'mcpu'
options for better optimization or to workaround HW issues.

We are going to use this option for HSDK-4xD board support.
In addition it also allows to awoid patching 'mcpu' in ARC Makefile
when we building Linux for some non-standard simulation or FPGA-based
platforms.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/Kconfig  | 7 +++
 arch/arc/Makefile | 4 
 2 files changed, 11 insertions(+)

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index ff306246d0f8..2d4f85dc914e 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -377,6 +377,13 @@ config ARC_HAS_SWAPE
bool "Insn: SWAPE (endian-swap)"
default y
 
+config ARC_TUNE_MCPU
+   string "Overide default -mcpu compiler flag"
+   default ""
+   help
+ Overide default -mcpu=xxx compiler flag (which is set depending on
+ the ISA version) with the specified value.
+
 if ISA_ARCV2
 
 config ARC_USE_UNALIGNED_MEM_ACCESS
diff --git a/arch/arc/Makefile b/arch/arc/Makefile
index 20e9ab6cc521..eb88ba5b1573 100644
--- a/arch/arc/Makefile
+++ b/arch/arc/Makefile
@@ -10,8 +10,12 @@ CROSS_COMPILE := $(call cc-cross-prefix, arc-linux- 
arceb-linux-)
 endif
 
 cflags-y   += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__
+ifeq ($(CONFIG_ARC_TUNE_MCPU),"")
 cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7
 cflags-$(CONFIG_ISA_ARCV2) += -mcpu=hs38
+else
+cflags-y   += $(shell echo $(CONFIG_ARC_TUNE_MCPU))
+endif
 
 ifdef CONFIG_ARC_CURR_IN_REG
 # For a global register defintion, make sure it gets passed to every file
-- 
2.21.3


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 0/3] ARC: [plat-hsdk-4xd] initial port for HSDK-4xD board

2020-05-29 Thread Eugeniy Paltsev
Eugeniy Paltsev (3):
  ARC: allow to overide default mcpu compiler flag
  ARC: ARCv2: support loop buffer (LPB) disabling
  ARC: [plat-hsdk-4xd] initial port for HSDK-4xD board

 arch/arc/Kconfig|  13 ++
 arch/arc/Makefile   |   4 +
 arch/arc/boot/dts/hsdk-4xd.dts  | 322 
 arch/arc/configs/hsdk_4xd_defconfig |  99 +
 arch/arc/kernel/devtree.c   |   1 +
 arch/arc/kernel/head.S  |   8 +
 arch/arc/plat-hsdk/Kconfig  |  24 ++-
 arch/arc/plat-hsdk/platform.c   |   6 +
 8 files changed, 476 insertions(+), 1 deletion(-)
 create mode 100644 arch/arc/boot/dts/hsdk-4xd.dts
 create mode 100644 arch/arc/configs/hsdk_4xd_defconfig

-- 
2.21.3


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH private 1/3] ARC: allow to overwrite default mcpu compiler flag

2020-05-29 Thread Eugeniy Paltsev
By default we set -mcpu=xxx compiler flag depending on the CPU ISA
version. It's good starting point, however that may be not enough
as for some platforms we may want to use some specific 'mcpu'
options for better optimization or to workaround HW issues.

We are going to use this option for HSDK-4xD board support.
In addition it also allows to awoid patching 'mcpu' in ARC Makefile
when we building Linux for some non-standard simulation or FPGA-based
platforms.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/Kconfig  | 7 +++
 arch/arc/Makefile | 4 
 2 files changed, 11 insertions(+)

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index ff306246d0f8..e7805db10f7a 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -377,6 +377,13 @@ config ARC_HAS_SWAPE
bool "Insn: SWAPE (endian-swap)"
default y
 
+config ARC_MCPU_OVERWRITE
+   string "Overwrite default -mcpu compiler flag"
+   default ""
+   help
+ Overwrite default -mcpu=xxx compiler flag (which is set depending on
+ the ISA version) with the specified value.
+
 if ISA_ARCV2
 
 config ARC_USE_UNALIGNED_MEM_ACCESS
diff --git a/arch/arc/Makefile b/arch/arc/Makefile
index 20e9ab6cc521..1b37e44d9b57 100644
--- a/arch/arc/Makefile
+++ b/arch/arc/Makefile
@@ -10,8 +10,12 @@ CROSS_COMPILE := $(call cc-cross-prefix, arc-linux- 
arceb-linux-)
 endif
 
 cflags-y   += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__
+ifeq ($(CONFIG_ARC_MCPU_OVERWRITE),"")
 cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7
 cflags-$(CONFIG_ISA_ARCV2) += -mcpu=hs38
+else
+cflags-y   += $(shell echo $(CONFIG_ARC_MCPU_OVERWRITE))
+endif
 
 ifdef CONFIG_ARC_CURR_IN_REG
 # For a global register defintion, make sure it gets passed to every file
-- 
2.21.3


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 2/3] ARC: ARCv2: support loop buffer (LPB) disabling

2020-05-29 Thread Eugeniy Paltsev
On HS cores, loop buffer (LPB) is programmable in runtime and can
be optionally disabled.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/Kconfig   | 6 ++
 arch/arc/kernel/head.S | 8 
 2 files changed, 14 insertions(+)

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 2d4f85dc914e..270504d4fdf5 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -471,6 +471,12 @@ config ARC_IRQ_NO_AUTOSAVE
  This is programmable and can be optionally disabled in which case
  software INTERRUPT_PROLOGUE/EPILGUE do the needed work
 
+config ARC_LPB_DISABLE
+   bool "Disable loop buffer (LPB)"
+   help
+ On HS cores, loop buffer (LPB) is programmable in runtime and can
+ be optionally disabled.
+
 endif # ISA_ARCV2
 
 endmenu   # "ARC CPU Configuration"
diff --git a/arch/arc/kernel/head.S b/arch/arc/kernel/head.S
index 6eb23f1545ee..17fd1ed700cc 100644
--- a/arch/arc/kernel/head.S
+++ b/arch/arc/kernel/head.S
@@ -59,6 +59,14 @@
bclrr5, r5, STATUS_AD_BIT
 #endif
kflag   r5
+
+#ifdef CONFIG_ARC_LPB_DISABLE
+   lr  r5, [ARC_REG_LPB_BUILD]
+   breqr5, 0, 1f   ; LPB doesn't exist
+   mov r5, 1
+   sr  r5, [ARC_REG_LPB_CTRL]
+1:
+#endif /* CONFIG_ARC_LPB_DISABLE */
 #endif
; Config DSP_CTRL properly, so kernel may use integer multiply,
; multiply-accumulate, and divide operations
-- 
2.21.3


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 3/3] ARC: [plat-hsdk-4xd] initial port for HSDK-4xD board

2020-05-29 Thread Eugeniy Paltsev
This initial port adds support of ARC HS4x/HS4xD Development Kit board with some
basic features such serial port, USB, SD/MMC, SPI flash, Ethernet and others.

The HSDK-4xD board has much in common with its predecessor - HSDK board.
However HSDK-4xD has some differences in comparison with its predecessor:
 * based on quad core ARC HS48/HS47D processor (instead of quad core ARC HS38)
 * has ThinkSilicon GPU (instead of Vivante GPU)
 * has ARC PGU and HDMI output
 * has separate SDIO controller for WiFi module
 * has additional timers with clocksource independent from CPU clocksource
   (required for DVFS)
 * has performance counters interrupt
 * other minor stuff

NOTE:
HSDK-4xD and HSDK may share significant part of DTS so we can move this common
part to one .dtsi file (as we have done it in U-boot). However we have quite
enough out of the tree patches for tweaking HSDK DTS (patches in out
verification flow, patches for run in simulation, etc...), so I'd prefer to
keep HSDK DTS untouched. That's why HSDK-4xD DTS is created as an separate file.

Cc: Rob Herring 
Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/boot/dts/hsdk-4xd.dts  | 322 
 arch/arc/configs/hsdk_4xd_defconfig |  99 +
 arch/arc/kernel/devtree.c   |   1 +
 arch/arc/plat-hsdk/Kconfig  |  24 ++-
 arch/arc/plat-hsdk/platform.c   |   6 +
 5 files changed, 451 insertions(+), 1 deletion(-)
 create mode 100644 arch/arc/boot/dts/hsdk-4xd.dts
 create mode 100644 arch/arc/configs/hsdk_4xd_defconfig

diff --git a/arch/arc/boot/dts/hsdk-4xd.dts b/arch/arc/boot/dts/hsdk-4xd.dts
new file mode 100644
index ..2b7f76a01e3e
--- /dev/null
+++ b/arch/arc/boot/dts/hsdk-4xd.dts
@@ -0,0 +1,322 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2020 Synopsys, Inc. (www.synopsys.com)
+ */
+
+/*
+ * Device Tree for ARC HS4x/HS4xD Development Kit
+ */
+/dts-v1/;
+
+#include 
+#include 
+
+/ {
+   model = "snps,hsdk-4xd";
+   compatible = "snps,hsdk-4xd";
+
+   #address-cells = <2>;
+   #size-cells = <2>;
+
+   chosen {
+   bootargs = "earlycon=uart8250,mmio32,0xf0005000,115200n8 
console=ttyS0,115200n8 debug print-fatal-signals=1";
+   };
+
+   aliases {
+   ethernet = 
+   };
+
+   cpus {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   cpu@0 {
+   device_type = "cpu";
+   compatible = "snps,archs48";
+   reg = <0>;
+   clocks = <_clk>;
+   };
+
+   cpu@1 {
+   device_type = "cpu";
+   compatible = "snps,archs48";
+   reg = <1>;
+   clocks = <_clk>;
+   };
+
+   cpu@2 {
+   device_type = "cpu";
+   compatible = "snps,archs48";
+   reg = <2>;
+   clocks = <_clk>;
+   };
+
+   cpu@3 {
+   device_type = "cpu";
+   compatible = "snps,archs48";
+   reg = <3>;
+   clocks = <_clk>;
+   };
+   };
+
+   input_clk: input-clk {
+   #clock-cells = <0>;
+   compatible = "fixed-clock";
+   clock-frequency = <>;
+   };
+
+   reg_5v0: regulator-5v0 {
+   compatible = "regulator-fixed";
+
+   regulator-name = "5v0-supply";
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   };
+
+   cpu_intc: cpu-interrupt-controller {
+   compatible = "snps,archs-intc";
+   interrupt-controller;
+   #interrupt-cells = <1>;
+   };
+
+   idu_intc: idu-interrupt-controller {
+   compatible = "snps,archs-idu-intc";
+   interrupt-controller;
+   #interrupt-cells = <1>;
+   interrupt-parent = <_intc>;
+   };
+
+   arcpct: pct {
+   compatible = "snps,archs-pct";
+   interrupt-parent = <_intc>;
+   interrupts = <20>;
+   };
+
+   /* TIMER0 with interrupt for clockevent */
+   timer {
+   compatible = "snps,arc-timer";
+   interrupts = <16>;
+   interrupt-parent = <_intc>;
+   clocks = <_clk>;
+   };
+
+   /* 64-bit Global Free Running Counter */
+   gfrc {
+   compatible = "snps,archs-timer-gfrc";
+   clocks = <_clk>

Re: [PATCH 53/59] drm/arc: Move to drm/tiny

2020-05-25 Thread Eugeniy Paltsev
So, I've smoke tested it. Though it is working, it's really unstable and causes 
kernel crash in many cases.

I.e:
This kernel crash (due to invalid read in kernel mode by 0x007c address) 
happens
on HDMI cable disconnection:
--->8---
Oops
Path: (null)
CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.7.0-rc6-03007-g4ceda91a4176 #5
Workqueue: events adv7511_hpd_work
Invalid Read @ 0x007c by insn @ drm_gem_fb_get_obj+0xa/0x10
ECR: 0x00050100 EFA: 0x007c ERET: 0x813b954a
STAT32: 0x80080442 [IE K DE   ]  BTA: 0x813eef62
BLK: arc_pgu_update+0x1a/0x30
 SP: 0x9f055dd0  FP: 0x
LPS: 0x8135603c LPE: 0x81356044 LPC: 0x
r00: 0x r01: 0x r02: 0x9f6bc000
r03: 0x9f0d8000 r04: 0x9f0d8388 r05: 0x
r06: 0x r07: 0x r08: 0x
r09: 0x r10: 0x r11: 0x
r12: 0x813eef62

Stack Trace:
  drm_gem_fb_get_obj+0xa/0x10
  arc_pgu_update+0x1a/0x30
  drm_atomic_helper_commit_planes.constprop.35+0xc8/0x23c
  commit_tail+0x164/0x274
  drm_atomic_helper_commit+0x36a/0x398
  drm_client_modeset_commit_atomic+0x136/0x1a4
  drm_client_modeset_commit_locked+0x3a/0x118
  drm_client_modeset_commit+0x18/0x34
  drm_fb_helper_set_par+0x54/0xb0
  drm_fb_helper_hotplug_event.part.16+0x70/0x8c
  drm_client_dev_hotplug+0x4a/0x74
  adv7511_hpd_work+0x6c/0x124
  process_one_work+0x19a/0x358
  worker_thread+0x108/0x494
  kthread+0xec/0x100
  ret_from_fork+0x18/0x1c
--->8---


This kernel crash (due to invalid read in kernel mode by 0x0 address) happens
on weston stop:
--->8---
Oops
Path: (null)
CPU: 0 PID: 158 Comm: weston Not tainted 5.7.0-rc6-03007-g4ceda91a4176 #5
Invalid Read @ 0x by insn @ drm_gem_fb_destroy+0x32/0x130
ECR: 0x00050100 EFA: 0x ERET: 0x813b9a76
STAT32: 0x80080002 [IE K ]  BTA: 0x81345c66
BLK: drm_fb_release+0x66/0xb0
 SP: 0x9f5c7db8  FP: 0x5fa4fa7c
LPS: 0x813560ec LPE: 0x813560f0 LPC: 0x
r00: 0x r01: 0x9e864392 r02: 0x0002
r03: 0x0001 r04: 0x0026 r05: 0x
r06: 0x0114 r07: 0x0001 r08: 0x9f0d8140
r09: 0xfe20 r10: 0x30405c00 r11: 0x0039
r12: 0x813d6c16 r13: 0x00022cc8 r14: 0x
r15: 0x00023ef0 r16: 0x5fa4f874 r17: 0x00022c58
r18: 0x5fa4fde4 r19: 0x r20: 0x000203c0
r21: 0x r22: 0x00022d40 r23: 0x
r24: 0x5fa4fa80 r25: 0x2000b808



Stack Trace:
  drm_gem_fb_destroy+0x32/0x130
  drm_fb_release+0x66/0xb0
  drm_file_free.part.11+0x112/0x1bc
  drm_release+0x80/0x120
  __fput+0x98/0x1bc
  task_work_run+0x6e/0xa8
  do_exit+0x2b4/0x7fc
  do_group_exit+0x2a/0x8c
  get_signal+0x9a/0x5f0
  do_signal+0x86/0x23c
  resume_user_mode_begin+0x88/0xd0

--->8---

It was tested on AXS103 board with ARC PGU + adv7511 HDMI bridge.

Probably you have some ideas about how to fix it?
Thanks.



> From: Daniel Vetter 
> Sent: Monday, May 25, 2020 20:26
> To: Eugeniy Paltsev
> Cc: dri-devel
> Subject: Re: [PATCH 53/59] drm/arc: Move to drm/tiny
> 
> On Mon, May 25, 2020 at 6:36 PM Eugeniy Paltsev
>  wrote:
> >
> > Hi Daniel,
> >
> > looks like I'll finally have some time for review of "drm/arc: Move to 
> > drm/tiny".
> > So, is it possible to find all these changes in any public git repo?
> 
> I have a horrible pile with everything here:
> 
> https://urldefense.com/v3/__https://cgit.freedesktop.org/*danvet/drm/log/__;fg!!A4F2R9G_pg!KUgdCRZoVj_85WhtTr0NUhsLhDgVTN_7s2aNdS4mMmRDfstvp4JbIYdip4J0P3Hg1NQLG2E$
> 
> I can also give you a cherry-picked branch with just the arc patches,
> on drm-tip (maybe also linux-next, not sure everything is there
> because of the merge window freeze we're in already).
> -Daniel
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - 
> https://urldefense.com/v3/__http://blog.ffwll.ch__;!!A4F2R9G_pg!KUgdCRZoVj_85WhtTr0NUhsLhDgVTN_7s2aNdS4mMmRDfstvp4JbIYdip4J0P3HgteJOwjA$
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [RFC] ARC: initial ftrace support

2020-05-14 Thread Eugeniy Paltsev
Hi Claudiu,
ping!

Is is possible to switch between mcount modes (Linux-style <-> baremetal-style) 
via command-line options for ARC GCC?

>From: Alexey Brodkin 
>Sent: Thursday, April 2, 2020 17:15
>To: Claudiu Zissulescu Ianculescu
>Cc: linux-ker...@vger.kernel.org; Steven Rostedt; Ingo Molnar; 
>linux-snps-arc@lists.infradead.org; Eugeniy Paltsev; Vineet Gupta
>Subject: RE: [RFC] ARC: initial ftrace support
>
> Hi Claus,
>
>> -Original Message-
>> From: linux-snps-arc  On Behalf 
>> Of Claudiu Zissulescu
>> Ianculescu
>> Sent: Thursday, April 2, 2020 11:10 AM
>> To: Vineet Gupta 
>> Cc: Alexey Brodkin ; linux-ker...@vger.kernel.org; 
>> Steven Rostedt
>> ; Ingo Molnar ; 
>> linux-snps-arc@lists.infradead.org; Eugeniy
>> Paltsev 
>> Subject: Re: [RFC] ARC: initial ftrace support
>>
>> Hi,
>>
>> ARC-gcc has two modes to call the mcount routines. When using elf32
>> configuration, the toolchain is set to use newlib mcount. When
>> configured for linux, gcc toolchain is using a library call to _mcall
>> (single underscore)  having blink as input argument.
>> So, using the proper linux toolchain, your patch should work.
>
>
> Is there a chance to switch to Linux-style mcount in Elf32 toolchain with a 
> command-line
> option?
>
> Otherwise I guess we'll need to implement some warning which explicitly says 
> why Elf32
> toolchain is not usable for building the Linux kernel... at least in case 
> with ftrace enabled.
>
>-Alexey

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH] ARC: guard dsp early init against non ARCv2

2020-04-29 Thread Eugeniy Paltsev
Hi Vineet, 

> From: Vineet Gupta 
> Sent: Tuesday, April 28, 2020 22:46
> To: Eugeniy Paltsev; linux-snps-arc@lists.infradead.org
> Cc: Alexey Brodkin; linux-ker...@vger.kernel.org
> Subject: Re: [PATCH] ARC: guard dsp early init against non ARCv2
> 
> On 4/28/20 11:50 AM, Eugeniy Paltsev wrote:
> > As of today we guard early DSP init code with
> > ARC_AUX_DSP_BUILD (0x7A) BCR check to verify that we have
> > CPU with DSP configured. However that's not enough as in
> > ARCv1 CPU the same BCR (0x7A) is used for checking MUL/MAC
> > instructions presence.
> >
> > So, let's guard DSP early init against non ARCv2.
> >
> > Signed-off-by: Eugeniy Paltsev 
> > ---
> >  arch/arc/include/asm/dsp-impl.h | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/arch/arc/include/asm/dsp-impl.h 
> > b/arch/arc/include/asm/dsp-impl.h
> > index e1aa212ca6eb..e64d945ae7df 100644
> > --- a/arch/arc/include/asm/dsp-impl.h
> > +++ b/arch/arc/include/asm/dsp-impl.h
> > @@ -15,12 +15,14 @@
> >
> >  /* clobbers r5 register */
> >  .macro DSP_EARLY_INIT
> > +#if defined(CONFIG_ISA_ARCV2)
> 
> ifdef is the canonical way for a single macro to check.
> 
> Also, this needs to be finer grained, i.e. CONFIG_ARC_DSP_KERNEL which is 
> already
> tied to ARCV2 only configs.

We shouldn't limit the scope of this code part [dsp early init] to the cases
were DSP support is enabled in kconfig - and that is the reason why this code
initially was guarded with BCR check only.

So, I change the check to

#if defined(CONFIG_ARC_DSP_HANDLED) || defined(CONFIG_ARC_DSP_NONE)

which is actually the equivalent to

#if defined(CONFIG_ISA_ARCV2)

but I don't think it's worth thing to do.

> 
> >   lr  r5, [ARC_AUX_DSP_BUILD]
> >   bmskr5, r5, 7
> >   breq    r5, 0, 1f
> >   mov r5, DSP_CTRL_DISABLED_ALL
> >   sr  r5, [ARC_AUX_DSP_CTRL]
> >  1:
> > +#endif
> >  .endm
> >
> >  /* clobbers r10, r11 registers pair */

---
 Eugeniy Paltsev
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH] ARC: guard dsp early init against non ARCv2

2020-04-28 Thread Eugeniy Paltsev
As of today we guard early DSP init code with
ARC_AUX_DSP_BUILD (0x7A) BCR check to verify that we have
CPU with DSP configured. However that's not enough as in
ARCv1 CPU the same BCR (0x7A) is used for checking MUL/MAC
instructions presence.

So, let's guard DSP early init against non ARCv2.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/include/asm/dsp-impl.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arc/include/asm/dsp-impl.h b/arch/arc/include/asm/dsp-impl.h
index e1aa212ca6eb..e64d945ae7df 100644
--- a/arch/arc/include/asm/dsp-impl.h
+++ b/arch/arc/include/asm/dsp-impl.h
@@ -15,12 +15,14 @@
 
 /* clobbers r5 register */
 .macro DSP_EARLY_INIT
+#if defined(CONFIG_ISA_ARCV2)
lr  r5, [ARC_AUX_DSP_BUILD]
bmskr5, r5, 7
breqr5, 0, 1f
mov r5, DSP_CTRL_DISABLED_ALL
sr  r5, [ARC_AUX_DSP_CTRL]
 1:
+#endif
 .endm
 
 /* clobbers r10, r11 registers pair */
-- 
2.21.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH] CMD: random: fix return code

2020-04-24 Thread Eugeniy Paltsev
Hi Simon, Tom,

I guess it's perfect time to apply this patch. Thanks!

---
 Eugeniy Paltsev



From: Simon Glass 
Sent: Monday, March 23, 2020 18:37
To: Eugeniy Paltsev
Cc: Tom Rini; U-Boot Mailing List; uboot-snps-...@synopsys.com; Alexey Brodkin; 
linux-snps-arc@lists.infradead.org
Subject: Re: [PATCH] CMD: random: fix return code

On Fri, 20 Mar 2020 at 10:38, Eugeniy Paltsev
 wrote:
>
> As of today 'random' command return 1 (CMD_RET_FAILURE) in case
> of successful execution and 0 (CMD_RET_SUCCESS) in case of bad
> arguments. Fix that.
>
> NOTE: we remove printing usage information from command body
> so it won't print twice.
>
> Signed-off-by: Eugeniy Paltsev 
> ---
>  cmd/mem.c | 9 -
>  1 file changed, 4 insertions(+), 5 deletions(-)
>

Reviewed-by: Simon Glass 

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v3 0/2] DRM: ARC: add HDMI 2.0 TX encoder support

2020-04-14 Thread Eugeniy Paltsev
Changes v1->v2:
 * use DT Schema format please (.yaml files) for DT bindings

Changes v2->v3:
 * Add missing 'interrupts' property in DT bindings
 * Drop dummy 'dw_hdmi_bridge_mode_valid'
 * Change bracing format of 'of_device_id' structure
 * Change compatible string to "snps,arc-dw-hdmi-hsdk"
   Now DT binding file is snps,arc-dw-hdmi.yaml and compatible is
   "snps,arc-dw-hdmi-"
 * Minor fixes

Eugeniy Paltsev (2):
  DRM: ARC: add HDMI 2.0 TX encoder support
  dt-bindings: Document the Synopsys ARC HDMI TX bindings

 .../display/bridge/snps,arc-dw-hdmi.yaml  | 136 ++
 MAINTAINERS   |   6 +
 drivers/gpu/drm/Makefile  |   2 +-
 drivers/gpu/drm/arc/Kconfig   |   7 +
 drivers/gpu/drm/arc/Makefile  |   1 +
 drivers/gpu/drm/arc/arc-dw-hdmi.c | 116 +++
 6 files changed, 267 insertions(+), 1 deletion(-)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/snps,arc-dw-hdmi.yaml
 create mode 100644 drivers/gpu/drm/arc/arc-dw-hdmi.c

-- 
2.21.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v3 2/2] dt-bindings: Document the Synopsys ARC HDMI TX bindings

2020-04-14 Thread Eugeniy Paltsev
This patch adds documentation of device tree bindings for the Synopsys
HDMI 2.0 TX encoder driver for ARC SoCs.

Acked-by: Sam Ravnborg 
Signed-off-by: Eugeniy Paltsev 
---
 .../display/bridge/snps,arc-dw-hdmi.yaml  | 136 ++
 1 file changed, 136 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/snps,arc-dw-hdmi.yaml

diff --git 
a/Documentation/devicetree/bindings/display/bridge/snps,arc-dw-hdmi.yaml 
b/Documentation/devicetree/bindings/display/bridge/snps,arc-dw-hdmi.yaml
new file mode 100644
index ..9b2fdfecd5b3
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/snps,arc-dw-hdmi.yaml
@@ -0,0 +1,136 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/snps,arc-dw-hdmi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Synopsys DesignWare HDMI 2.0 TX encoder driver
+
+maintainers:
+  - Eugeniy Paltsev 
+
+description: |
+  The HDMI transmitter is a Synopsys DesignWare HDMI 2.0 TX controller IP
+  with a companion of Synopsys DesignWare HDMI 2.0 TX PHY IP.
+
+  These DT bindings follow the Synopsys DWC HDMI TX bindings defined in
+  Documentation/devicetree/bindings/display/bridge/dw_hdmi.txt
+  with the following device-specific properties.
+
+properties:
+  compatible:
+const: snps,arc-dw-hdmi-hsdk
+
+  reg:
+maxItems: 1
+description: |
+  Memory mapped base address and length of the DWC HDMI TX registers.
+
+  clocks:
+items:
+  - description: The bus clock for AHB / APB
+  - description: The internal register configuration clock
+
+  clock-names:
+items:
+  - const: iahb
+  - const: isfr
+
+  interrupts:
+maxItems: 1
+description: Reference to the DWC HDMI TX interrupt
+
+  reg-io-width:
+allOf:
+  - $ref: /schemas/types.yaml#/definitions/uint32
+  - enum: [1, 4]
+description: |
+  Width of the registers specified by the reg property. The
+  value is expressed in bytes and must be equal to 1 or 4 if specified.
+  The register width defaults to 1 if the property is not present.
+
+  ports:
+type: object
+description: |
+  A ports node with endpoint definitions as defined in
+  Documentation/devicetree/bindings/media/video-interfaces.txt
+
+properties:
+  "#address-cells":
+const: 1
+
+  "#size-cells":
+const: 0
+
+  port@0:
+type: object
+description: |
+  Video input endpoints of the controller.
+  Usually it is associated with ARC PGU.
+
+  port@1:
+type: object
+description: |
+  Output endpoints of the controller. HDMI connector.
+
+required:
+  - "#address-cells"
+  - "#size-cells"
+  - port@0
+  - port@1
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - interrupts
+  - ports
+
+additionalProperties: false
+
+examples:
+  - |
+hdmi@1 {
+compatible = "snps,arc-dw-hdmi-hsdk";
+reg = <0x1 0x1>;
+reg-io-width = <4>;
+interrupts = <14>;
+clocks = <>, <_pix_clk>;
+clock-names = "iahb", "isfr";
+
+ports {
+#address-cells = <1>;
+#size-cells = <0>;
+
+port@0 {
+reg = <0>;
+hdmi_enc_input: endpoint {
+remote-endpoint = <_output>;
+};
+};
+
+port@1 {
+reg = <1>;
+hdmi_enc_out: endpoint {
+remote-endpoint = <_con>;
+};
+};
+};
+};
+
+hdmi-out {
+port {
+hdmi_con: endpoint {
+remote-endpoint = <_enc_out>;
+};
+};
+};
+
+pgu {
+port_o: port {
+pgu_output: endpoint {
+remote-endpoint = <_enc_input>;
+};
+};
+};
-- 
2.21.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v3 1/2] DRM: ARC: add HDMI 2.0 TX encoder support

2020-04-14 Thread Eugeniy Paltsev
The Synopsys ARC SoCs (like HSDK4xD) include on-chip DesignWare HDMI
encoders. Support them with a platform driver to provide platform glue
data to the dw-hdmi driver.

Acked-by: Sam Ravnborg 
Signed-off-by: Eugeniy Paltsev 
---
 MAINTAINERS   |   6 ++
 drivers/gpu/drm/Makefile  |   2 +-
 drivers/gpu/drm/arc/Kconfig   |   7 ++
 drivers/gpu/drm/arc/Makefile  |   1 +
 drivers/gpu/drm/arc/arc-dw-hdmi.c | 116 ++
 5 files changed, 131 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/arc/arc-dw-hdmi.c

diff --git a/MAINTAINERS b/MAINTAINERS
index a6fbdf354d34..2aaed1190370 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1258,6 +1258,12 @@ S:   Supported
 F: drivers/gpu/drm/arc/
 F: Documentation/devicetree/bindings/display/snps,arcpgu.txt
 
+ARC DW HDMI DRIVER
+M: Eugeniy Paltsev 
+S: Supported
+F: drivers/gpu/drm/arc/arc-dw-hdmi.c
+F: Documentation/devicetree/bindings/display/bridge/snps,arc-dw-hdmi.yaml
+
 ARCNET NETWORK LAYER
 M: Michael Grzeschik 
 L: net...@vger.kernel.org
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 6493088a0fdd..5b0bcf7f45cd 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -109,7 +109,7 @@ obj-y   += panel/
 obj-y  += bridge/
 obj-$(CONFIG_DRM_FSL_DCU) += fsl-dcu/
 obj-$(CONFIG_DRM_ETNAVIV) += etnaviv/
-obj-$(CONFIG_DRM_ARCPGU)+= arc/
+obj-y  += arc/
 obj-y  += hisilicon/
 obj-$(CONFIG_DRM_ZTE)  += zte/
 obj-$(CONFIG_DRM_MXSFB)+= mxsfb/
diff --git a/drivers/gpu/drm/arc/Kconfig b/drivers/gpu/drm/arc/Kconfig
index e8f3d63e0b91..baec9d2a4fba 100644
--- a/drivers/gpu/drm/arc/Kconfig
+++ b/drivers/gpu/drm/arc/Kconfig
@@ -8,3 +8,10 @@ config DRM_ARCPGU
  Choose this option if you have an ARC PGU controller.
 
  If M is selected the module will be called arcpgu.
+
+config DRM_ARC_DW_HDMI
+   tristate "ARC DW HDMI"
+   depends on DRM && OF
+   select DRM_DW_HDMI
+   help
+ Synopsys DW HDMI driver for various ARC development boards
diff --git a/drivers/gpu/drm/arc/Makefile b/drivers/gpu/drm/arc/Makefile
index c7028b7427b3..7a156d8c2c3c 100644
--- a/drivers/gpu/drm/arc/Makefile
+++ b/drivers/gpu/drm/arc/Makefile
@@ -1,3 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0-only
 arcpgu-y := arcpgu_crtc.o arcpgu_hdmi.o arcpgu_sim.o arcpgu_drv.o
 obj-$(CONFIG_DRM_ARCPGU) += arcpgu.o
+obj-$(CONFIG_DRM_ARC_DW_HDMI) += arc-dw-hdmi.o
diff --git a/drivers/gpu/drm/arc/arc-dw-hdmi.c 
b/drivers/gpu/drm/arc/arc-dw-hdmi.c
new file mode 100644
index ..46a6ee09b302
--- /dev/null
+++ b/drivers/gpu/drm/arc/arc-dw-hdmi.c
@@ -0,0 +1,116 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Synopsys DW HDMI driver for various ARC development boards
+//
+// Copyright (C) 2020 Synopsys
+// Author: Eugeniy Paltsev 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static const struct dw_hdmi_mpll_config snps_hdmi_mpll_cfg[] = {
+   {
+   2700, {
+   { 0x00B3, 0x },
+   { 0x00B3, 0x },
+   { 0x00B3, 0x }
+   },
+   }, {
+   7425, {
+   { 0x0072, 0x0001},
+   { 0x0072, 0x0001},
+   { 0x0072, 0x0001}
+   },
+   }, {
+   14850, {
+   { 0x0051, 0x0002},
+   { 0x0051, 0x0002},
+   { 0x0051, 0x0002}
+   },
+   }, {
+   ~0UL, {
+   { 0x00B3, 0x },
+   { 0x00B3, 0x },
+   { 0x00B3, 0x },
+   },
+   }
+};
+
+static const struct dw_hdmi_curr_ctrl snps_hdmi_cur_ctr[] = {
+   /* pixelclkbpp8bpp10   bpp12 */
+   { 2700,  { 0x, 0x, 0x }, },
+   { 7425,  { 0x0008, 0x0008, 0x0008 }, },
+   { 14850, { 0x001b, 0x001b, 0x001b }, },
+   { ~0UL,  { 0x, 0x, 0x }, }
+};
+
+
+static const struct dw_hdmi_phy_config snps_hdmi_phy_config[] = {
+   /* pixelclk   symbol  termvlev */
+   { 2700,   0x8009, 0x0004, 0x0232},
+   { 7425,   0x8009, 0x0004, 0x0232},
+   { 14850,  0x8009, 0x0004, 0x0232},
+   { ~0UL,   0x8009, 0x0004, 0x0232}
+};
+
+static struct dw_hdmi_plat_data snps_dw_hdmi_drv_data = {
+   .mpll_cfg   = snps_hdmi_mpll_cfg,
+   .cur_ctr= snps_hdmi_cur_ctr,
+   .phy_config = snps_hdmi_phy_config,
+};
+
+static const struct of_device_id snps_dw_hdmi_dt_ids[] = {
+   { .compatible = "snps,arc-dw-hdmi-hsdk", .data = _dw_hdmi_drv_data 
},
+   { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, snps_dw_hdmi_dt_ids);
+
+static int snps_dw_hdmi_probe(struct platform_device *pdev)
+{
+   co

[PATCH v2 0/2] DRM: ARC: add HDMI 2.0 TX encoder support

2020-04-14 Thread Eugeniy Paltsev
Changes v1->v2:
 * use DT Schema format please (.yaml files) for DT bindings

Eugeniy Paltsev (2):
  DRM: ARC: add HDMI 2.0 TX encoder support
  dt-bindings: Document the Synopsys ARC HDMI TX bindings

 .../display/bridge/snps,arc-dw-hdmi.yaml  | 131 ++
 MAINTAINERS   |   6 +
 drivers/gpu/drm/Makefile  |   2 +-
 drivers/gpu/drm/arc/Kconfig   |   7 +
 drivers/gpu/drm/arc/Makefile  |   1 +
 drivers/gpu/drm/arc/arc-dw-hdmi.c | 126 +
 6 files changed, 272 insertions(+), 1 deletion(-)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/snps,arc-dw-hdmi.yaml
 create mode 100644 drivers/gpu/drm/arc/arc-dw-hdmi.c

-- 
2.21.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v2 1/2] DRM: ARC: add HDMI 2.0 TX encoder support

2020-04-14 Thread Eugeniy Paltsev
The Synopsys ARC SoCs (like HSDK4xD) include on-chip DesignWare HDMI
encoders. Support them with a platform driver to provide platform glue
data to the dw-hdmi driver.

Signed-off-by: Eugeniy Paltsev 
---
 MAINTAINERS   |   6 ++
 drivers/gpu/drm/Makefile  |   2 +-
 drivers/gpu/drm/arc/Kconfig   |   7 ++
 drivers/gpu/drm/arc/Makefile  |   1 +
 drivers/gpu/drm/arc/arc-dw-hdmi.c | 126 ++
 5 files changed, 141 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/arc/arc-dw-hdmi.c

diff --git a/MAINTAINERS b/MAINTAINERS
index a6fbdf354d34..2aaed1190370 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1258,6 +1258,12 @@ S:   Supported
 F: drivers/gpu/drm/arc/
 F: Documentation/devicetree/bindings/display/snps,arcpgu.txt
 
+ARC DW HDMI DRIVER
+M: Eugeniy Paltsev 
+S: Supported
+F: drivers/gpu/drm/arc/arc-dw-hdmi.c
+F: Documentation/devicetree/bindings/display/bridge/snps,arc-dw-hdmi.yaml
+
 ARCNET NETWORK LAYER
 M: Michael Grzeschik 
 L: net...@vger.kernel.org
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 6493088a0fdd..5b0bcf7f45cd 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -109,7 +109,7 @@ obj-y   += panel/
 obj-y  += bridge/
 obj-$(CONFIG_DRM_FSL_DCU) += fsl-dcu/
 obj-$(CONFIG_DRM_ETNAVIV) += etnaviv/
-obj-$(CONFIG_DRM_ARCPGU)+= arc/
+obj-y  += arc/
 obj-y  += hisilicon/
 obj-$(CONFIG_DRM_ZTE)  += zte/
 obj-$(CONFIG_DRM_MXSFB)+= mxsfb/
diff --git a/drivers/gpu/drm/arc/Kconfig b/drivers/gpu/drm/arc/Kconfig
index e8f3d63e0b91..baec9d2a4fba 100644
--- a/drivers/gpu/drm/arc/Kconfig
+++ b/drivers/gpu/drm/arc/Kconfig
@@ -8,3 +8,10 @@ config DRM_ARCPGU
  Choose this option if you have an ARC PGU controller.
 
  If M is selected the module will be called arcpgu.
+
+config DRM_ARC_DW_HDMI
+   tristate "ARC DW HDMI"
+   depends on DRM && OF
+   select DRM_DW_HDMI
+   help
+ Synopsys DW HDMI driver for various ARC development boards
diff --git a/drivers/gpu/drm/arc/Makefile b/drivers/gpu/drm/arc/Makefile
index c7028b7427b3..7a156d8c2c3c 100644
--- a/drivers/gpu/drm/arc/Makefile
+++ b/drivers/gpu/drm/arc/Makefile
@@ -1,3 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0-only
 arcpgu-y := arcpgu_crtc.o arcpgu_hdmi.o arcpgu_sim.o arcpgu_drv.o
 obj-$(CONFIG_DRM_ARCPGU) += arcpgu.o
+obj-$(CONFIG_DRM_ARC_DW_HDMI) += arc-dw-hdmi.o
diff --git a/drivers/gpu/drm/arc/arc-dw-hdmi.c 
b/drivers/gpu/drm/arc/arc-dw-hdmi.c
new file mode 100644
index ..4869dd668a51
--- /dev/null
+++ b/drivers/gpu/drm/arc/arc-dw-hdmi.c
@@ -0,0 +1,126 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Synopsys DW HDMI driver for various ARC development boards
+//
+// Copyright (C) 2020 Synopsys
+// Author: Eugeniy Paltsev 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static const struct dw_hdmi_mpll_config snps_hdmi_mpll_cfg[] = {
+   {
+   2700, {
+   { 0x00B3, 0x },
+   { 0x00B3, 0x },
+   { 0x00B3, 0x }
+   },
+   }, {
+   7425, {
+   { 0x0072, 0x0001},
+   { 0x0072, 0x0001},
+   { 0x0072, 0x0001}
+   },
+   }, {
+   14850, {
+   { 0x0051, 0x0002},
+   { 0x0051, 0x0002},
+   { 0x0051, 0x0002}
+   },
+   }, {
+   ~0UL, {
+   { 0x00B3, 0x },
+   { 0x00B3, 0x },
+   { 0x00B3, 0x },
+   },
+   }
+};
+
+static const struct dw_hdmi_curr_ctrl snps_hdmi_cur_ctr[] = {
+   /* pixelclkbpp8bpp10   bpp12 */
+   { 2700,  { 0x, 0x, 0x }, },
+   { 7425,  { 0x0008, 0x0008, 0x0008 }, },
+   { 14850, { 0x001b, 0x001b, 0x001b }, },
+   { ~0UL,  { 0x, 0x, 0x }, }
+};
+
+
+static const struct dw_hdmi_phy_config snps_hdmi_phy_config[] = {
+   /* pixelclk   symbol  termvlev */
+   { 2700,   0x8009, 0x0004, 0x0232},
+   { 7425,   0x8009, 0x0004, 0x0232},
+   { 14850,  0x8009, 0x0004, 0x0232},
+   { ~0UL,   0x8009, 0x0004, 0x0232}
+};
+
+static enum drm_mode_status snps_dw_hdmi_mode_valid(struct drm_connector *con,
+   const struct 
drm_display_mode *mode)
+{
+   return MODE_OK;
+}
+
+static struct dw_hdmi_plat_data snps_dw_hdmi_drv_data = {
+   .mpll_cfg   = snps_hdmi_mpll_cfg,
+   .cur_ctr= snps_hdmi_cur_ctr,
+   .phy_config = snps_hdmi_phy_config,
+   .mode_valid = snps_dw_hdmi_mode_valid,
+};
+
+static const struct of_device_id s

[PATCH v2 2/2] dt-bindings: Document the Synopsys ARC HDMI TX bindings

2020-04-14 Thread Eugeniy Paltsev
This patch adds documentation of device tree bindings for the Synopsys
HDMI 2.0 TX encoder driver for ARC SoCs.

Signed-off-by: Eugeniy Paltsev 
---
 .../display/bridge/snps,arc-dw-hdmi.yaml  | 131 ++
 1 file changed, 131 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/snps,arc-dw-hdmi.yaml

diff --git 
a/Documentation/devicetree/bindings/display/bridge/snps,arc-dw-hdmi.yaml 
b/Documentation/devicetree/bindings/display/bridge/snps,arc-dw-hdmi.yaml
new file mode 100644
index ..f52fc3b114b0
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/snps,arc-dw-hdmi.yaml
@@ -0,0 +1,131 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/snps,arc-dw-hdmi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Synopsys DesignWare HDMI 2.0 TX encoder driver
+
+maintainers:
+  - Eugeniy Paltsev 
+
+description: |
+  The HDMI transmitter is a Synopsys DesignWare HDMI 2.0 TX controller IP
+  with a companion of Synopsys DesignWare HDMI 2.0 TX PHY IP.
+
+  These DT bindings follow the Synopsys DWC HDMI TX bindings defined in
+  Documentation/devicetree/bindings/display/bridge/dw_hdmi.txt
+  with the following device-specific properties.
+
+properties:
+  compatible:
+const: snps,dw-hdmi-hsdk
+
+  reg:
+maxItems: 1
+description: |
+  Memory mapped base address and length of the DWC HDMI TX registers.
+
+  clocks:
+items:
+  - description: The bus clock for AHB / APB
+  - description: The internal register configuration clock
+
+  clock-names:
+items:
+  - const: iahb
+  - const: isfr
+
+  reg-io-width:
+allOf:
+  - $ref: /schemas/types.yaml#/definitions/uint32
+  - enum: [1, 4]
+description:
+  Width of the registers specified by the reg property. The
+  value is expressed in bytes and must be equal to 1 or 4 if specified.
+  The register width defaults to 1 if the property is not present.
+
+  ports:
+type: object
+description: |
+  A ports node with endpoint definitions as defined in
+  Documentation/devicetree/bindings/media/video-interfaces.txt
+
+properties:
+  "#address-cells":
+const: 1
+
+  "#size-cells":
+const: 0
+
+  port@0:
+type: object
+description: |
+  Video input endpoints of the controller.
+  Usually the associated with PGU.
+
+  port@1:
+type: object
+description: |
+  Output endpoints of the controller. HDMI connector.
+
+required:
+  - "#address-cells"
+  - "#size-cells"
+  - port@0
+  - port@1
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - ports
+
+additionalProperties: false
+
+examples:
+  - |
+hdmi: hdmi@0x1 {
+compatible = "snps,dw-hdmi-hsdk";
+reg = <0x1 0x1>;
+reg-io-width = <4>;
+interrupts = <14>;
+clocks = <>, <_pix_clk>;
+clock-names = "iahb", "isfr";
+
+ports {
+#address-cells = <1>;
+#size-cells = <0>;
+
+port@0 {
+reg = <0>;
+hdmi_enc_input: endpoint {
+remote-endpoint = <_output>;
+};
+};
+
+port@1 {
+reg = <1>;
+hdmi_enc_out: endpoint {
+remote-endpoint = <_con>;
+};
+};
+};
+};
+
+hdmi-out {
+port {
+hdmi_con: endpoint {
+remote-endpoint = <_enc_out>;
+};
+};
+};
+
+pgu {
+port_o: port {
+pgu_output: endpoint {
+remote-endpoint = <_enc_input>;
+};
+};
+};
-- 
2.21.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v2] ARC: [plat-hsdk]: fix USB regression

2020-04-07 Thread Eugeniy Paltsev
As of today the CONFIG_USB isn't explicitly present in HSDK defconfig
as it is implicitly forcibly enabled by UDL driver which selects CONFIG_USB
in its kconfig.
The commit 5d50bd440bc2 ("drm/udl: Make udl driver depend on CONFIG_USB")
reverse the dependencies between UDL and USB so UDL now depends on
CONFIG_USB and not selects it. This introduces regression for ARC HSDK
board as HSDK defconfig wasn't adjusted and now it misses USB support
due to lack of CONFIG_USB enabled.

Fix that.

Cc:  # 5.6.x
Fixes: 5d50bd440bc2 ("drm/udl: Make udl driver depend on CONFIG_USB")
Signed-off-by: Eugeniy Paltsev 
---
Changes v1->v2:
 * fix typo, add tag for stable

 arch/arc/configs/hsdk_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arc/configs/hsdk_defconfig b/arch/arc/configs/hsdk_defconfig
index 0974226fab55..aa75a575 100644
--- a/arch/arc/configs/hsdk_defconfig
+++ b/arch/arc/configs/hsdk_defconfig
@@ -65,6 +65,7 @@ CONFIG_DRM_UDL=y
 CONFIG_DRM_ETNAVIV=y
 CONFIG_FB=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
+CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_HCD_PLATFORM=y
 CONFIG_USB_OHCI_HCD=y
-- 
2.21.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH] ARC: [plat-hsdk]: fix USB regression

2020-04-07 Thread Eugeniy Paltsev
Hi Masahiro,

I'm wondering what is proper way to deal with such type of regressions?
Is is responsibility of person who change kconfig to check (and possibly 
adjust) affected defconfigs?

A question for you as a kconfig expert :)

---
 Eugeniy Paltsev



From: Eugeniy Paltsev 
Sent: Tuesday, April 7, 2020 19:19
To: linux-snps-arc@lists.infradead.org; Vineet Gupta
Cc: linux-ker...@vger.kernel.org; Alexey Brodkin; Masahiro Yamada; Thomas 
Zimmermann; Eugeniy Paltsev
Subject: [PATCH] ARC: [plat-hsdk]: fix USB regression

As of today the CONFIG_USB isn't explicitly present in HSDK defconfig
as it is implicitly forcibly enabled by UDL driver which selects CONFIG_USB
in its kconfig.
The commit 5d50bd440bc2 ("drm/udl: Make udl driver depend on CONFIG_USB")
reverse the dependencies between UDL and USB so UDL now depends on
CONFIG_USB and not selects it. This introduces regression for ARC HSDK
board as HSDK defconfig wasn't adjusted and now it misses USB support
due to lack of CONFIG_USB enabled.

Fix that.

Fixes: 5d50bd440bc2 ("drm/udl: Make udl driver depend on CONFIG_USB")
Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/configs/hsdk_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arc/configs/hsdk_defconfig b/arch/arc/configs/hsdk_defconfig
index 0974226fab55..f79c15892704 100644
--- a/arch/arc/configs/hsdk_defconfig
+++ b/arch/arc/configs/hsdk_defconfig
@@ -65,6 +65,7 @@ CONFIG_DRM_UDL=y
 CONFIG_DRM_ETNAVIV=y
 CONFIG_FB=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
+CONFIG_USB
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_HCD_PLATFORM=y
 CONFIG_USB_OHCI_HCD=y
--
2.21.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH] ARC: [plat-hsdk]: fix USB regression

2020-04-07 Thread Eugeniy Paltsev
As of today the CONFIG_USB isn't explicitly present in HSDK defconfig
as it is implicitly forcibly enabled by UDL driver which selects CONFIG_USB
in its kconfig.
The commit 5d50bd440bc2 ("drm/udl: Make udl driver depend on CONFIG_USB")
reverse the dependencies between UDL and USB so UDL now depends on
CONFIG_USB and not selects it. This introduces regression for ARC HSDK
board as HSDK defconfig wasn't adjusted and now it misses USB support
due to lack of CONFIG_USB enabled.

Fix that.

Fixes: 5d50bd440bc2 ("drm/udl: Make udl driver depend on CONFIG_USB")
Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/configs/hsdk_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arc/configs/hsdk_defconfig b/arch/arc/configs/hsdk_defconfig
index 0974226fab55..f79c15892704 100644
--- a/arch/arc/configs/hsdk_defconfig
+++ b/arch/arc/configs/hsdk_defconfig
@@ -65,6 +65,7 @@ CONFIG_DRM_UDL=y
 CONFIG_DRM_ETNAVIV=y
 CONFIG_FB=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
+CONFIG_USB
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_HCD_PLATFORM=y
 CONFIG_USB_OHCI_HCD=y
-- 
2.21.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH] ARC: Fix ICCM & DCCM runtime size checks

2020-04-02 Thread Eugeniy Paltsev
As of today the ICCM and DCCM size checks are incorrectly using
mismatched units (KiB checked against bytes). The CONFIG_ARC_DCCM_SZ
and CONFIG_ARC_ICCM_SZ are in KiB, but the size calculated in
runtime and stored in cpu->dccm.sz and cpu->iccm.sz is in bytes.

Fix that.

Reported-by: Paul Greco 
Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/kernel/setup.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index aa41af6ef4ac..efdedf83b954 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -409,12 +410,12 @@ static void arc_chk_core_config(void)
if ((unsigned int)__arc_dccm_base != cpu->dccm.base_addr)
panic("Linux built with incorrect DCCM Base address\n");
 
-   if (CONFIG_ARC_DCCM_SZ != cpu->dccm.sz)
+   if (CONFIG_ARC_DCCM_SZ * SZ_1K != cpu->dccm.sz)
panic("Linux built with incorrect DCCM Size\n");
 #endif
 
 #ifdef CONFIG_ARC_HAS_ICCM
-   if (CONFIG_ARC_ICCM_SZ != cpu->iccm.sz)
+   if (CONFIG_ARC_ICCM_SZ * SZ_1K != cpu->iccm.sz)
panic("Linux built with incorrect ICCM Size\n");
 #endif
 
-- 
2.21.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[RFC] ARC: initial ftrace support

2020-03-27 Thread Eugeniy Paltsev
Add initial ftrace support for ARCv2. We add support only for
function tracer (the simplest, not dynamic one), however it is
prerequisite for dynamic function tracer and other complex
ones.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/Kconfig  |  1 +
 arch/arc/include/asm/Kbuild   |  1 -
 arch/arc/include/asm/ftrace.h | 16 
 arch/arc/kernel/Makefile  | 10 ++
 arch/arc/kernel/ftrace.c  | 27 +++
 5 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100644 arch/arc/include/asm/ftrace.h
 create mode 100644 arch/arc/kernel/ftrace.c

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index ff2a393b635c..4b8f750bd32b 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -48,6 +48,7 @@ config ARC
select PCI_SYSCALL if PCI
select PERF_USE_VMALLOC if ARC_CACHE_VIPT_ALIASING
select HAVE_ARCH_JUMP_LABEL if ISA_ARCV2 && !CPU_ENDIAN_BE32
+   select HAVE_FUNCTION_TRACER if ISA_ARCV2
 
 config ARCH_HAS_CACHE_LINE_SIZE
def_bool y
diff --git a/arch/arc/include/asm/Kbuild b/arch/arc/include/asm/Kbuild
index 1b505694691e..4e2f55bdf2ff 100644
--- a/arch/arc/include/asm/Kbuild
+++ b/arch/arc/include/asm/Kbuild
@@ -6,7 +6,6 @@ generic-y += div64.h
 generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += extable.h
-generic-y += ftrace.h
 generic-y += hardirq.h
 generic-y += hw_irq.h
 generic-y += irq_regs.h
diff --git a/arch/arc/include/asm/ftrace.h b/arch/arc/include/asm/ftrace.h
new file mode 100644
index ..92303e506edf
--- /dev/null
+++ b/arch/arc/include/asm/ftrace.h
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2020 Synopsys, Inc. (www.synopsys.com)
+ *
+ * Author: Eugeniy Paltsev 
+ */
+
+#ifndef __ASM_ARC_FTRACE_H
+#define __ASM_ARC_FTRACE_H
+
+extern void _mcount(unsigned long parent_ip);
+
+/* 3 instructions 1x 16 bit + 1x 32 bit */
+#define MCOUNT_INSN_SIZE   6
+
+#endif /* __ASM_ARC_FTRACE_H */
diff --git a/arch/arc/kernel/Makefile b/arch/arc/kernel/Makefile
index 75539670431a..42c9c4b1cabd 100644
--- a/arch/arc/kernel/Makefile
+++ b/arch/arc/kernel/Makefile
@@ -22,12 +22,22 @@ obj-$(CONFIG_ARC_METAWARE_HLINK)+= arc_hostlink.o
 obj-$(CONFIG_PERF_EVENTS)  += perf_event.o
 obj-$(CONFIG_JUMP_LABEL)   += jump_label.o
 
+
+obj-$(CONFIG_FUNCTION_TRACER)  += ftrace.o
+
+ifdef CONFIG_FUNCTION_TRACER
+CFLAGS_REMOVE_ftrace.o = $(CC_FLAGS_FTRACE)
+endif
+
 obj-$(CONFIG_ARC_FPU_SAVE_RESTORE) += fpu.o
 ifdef CONFIG_ISA_ARCOMPACT
 CFLAGS_fpu.o   += -mdpfp
 endif
 
 ifdef CONFIG_ARC_DW2_UNWIND
+ifdef CONFIG_FUNCTION_TRACER
+CFLAGS_REMOVE_ctx_sw.o = $(CC_FLAGS_FTRACE)
+endif
 CFLAGS_ctx_sw.o += -fno-omit-frame-pointer
 obj-y += ctx_sw.o
 else
diff --git a/arch/arc/kernel/ftrace.c b/arch/arc/kernel/ftrace.c
new file mode 100644
index ..a61edf52bfe2
--- /dev/null
+++ b/arch/arc/kernel/ftrace.c
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2020 Synopsys, Inc. (www.synopsys.com)
+ *
+ * Author: Eugeniy Paltsev 
+ */
+
+#include 
+
+noinline void ftrace_stub(unsigned long ip, unsigned long parent_ip,
+ struct ftrace_ops *op, struct pt_regs *regs)
+{
+   /* do notning */
+}
+
+extern void (*ftrace_trace_function)(unsigned long, unsigned long,
+struct ftrace_ops*, struct pt_regs*);
+
+noinline void _mcount(unsigned long parent_ip)
+{
+   unsigned long ip = (unsigned long)__builtin_return_address(0);
+
+   if (unlikely(ftrace_trace_function != ftrace_stub))
+   ftrace_trace_function(ip - MCOUNT_INSN_SIZE, parent_ip,
+ NULL, NULL);
+}
+EXPORT_SYMBOL(_mcount);
-- 
2.21.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH] CMD: random: fix return code

2020-03-20 Thread Eugeniy Paltsev
As of today 'random' command return 1 (CMD_RET_FAILURE) in case
of successful execution and 0 (CMD_RET_SUCCESS) in case of bad
arguments. Fix that.

NOTE: we remove printing usage information from command body
so it won't print twice.

Signed-off-by: Eugeniy Paltsev 
---
 cmd/mem.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/cmd/mem.c b/cmd/mem.c
index 6d54f195272..6b4897dfd94 100644
--- a/cmd/mem.c
+++ b/cmd/mem.c
@@ -1102,10 +1102,8 @@ static int do_random(cmd_tbl_t *cmdtp, int flag, int 
argc, char * const argv[])
unsigned char *buf8;
unsigned int i;
 
-   if (argc < 3 || argc > 4) {
-   printf("usage: %s   []\n", argv[0]);
-   return 0;
-   }
+   if (argc < 3 || argc > 4)
+   return CMD_RET_USAGE;
 
len = simple_strtoul(argv[2], NULL, 16);
addr = simple_strtoul(argv[1], NULL, 16);
@@ -1132,7 +1130,8 @@ static int do_random(cmd_tbl_t *cmdtp, int flag, int 
argc, char * const argv[])
 
unmap_sysmem(start);
printf("%lu bytes filled with random data\n", len);
-   return 1;
+
+   return CMD_RET_SUCCESS;
 }
 #endif
 
-- 
2.21.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 2/2] dt-bindings: Document the Synopsys ARC HDMI TX bindings

2020-03-16 Thread Eugeniy Paltsev
This patch adds documentation of device tree bindings for the Synopsys
HDMI 2.0 TX encoder driver for ARC SoCs.

Signed-off-by: Eugeniy Paltsev 
---
 .../display/bridge/snps,arc-dw-hdmi.txt   | 73 +++
 1 file changed, 73 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/snps,arc-dw-hdmi.txt

diff --git 
a/Documentation/devicetree/bindings/display/bridge/snps,arc-dw-hdmi.txt 
b/Documentation/devicetree/bindings/display/bridge/snps,arc-dw-hdmi.txt
new file mode 100644
index ..d5e006b392cc
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/snps,arc-dw-hdmi.txt
@@ -0,0 +1,73 @@
+Synopsys DesignWare HDMI 2.0 TX encoder driver for ARC SoCs
+
+
+The HDMI transmitter is a Synopsys DesignWare HDMI 2.0 TX controller IP
+with a companion of Synopsys DesignWare HDMI 2.0 TX PHY IP.
+
+These DT bindings follow the Synopsys DWC HDMI TX bindings defined in
+Documentation/devicetree/bindings/display/bridge/dw_hdmi.txt
+with the following device-specific properties.
+
+
+Required properties:
+
+- compatible : Shall contain
+  - "snps,dw-hdmi-hsdk" for HSDK4xD compatible HDMI TX
+
+- reg: See dw_hdmi.txt.
+- interrupts: HDMI interrupt number.
+- clocks: See dw_hdmi.txt.
+- clock-names: Must contain "iahb" and "isfr" as defined in dw_hdmi.txt.
+- ports: See dw_hdmi.txt. The DWC HDMI shall have one port numbered 0
+  corresponding to the video input of the controller and one port numbered 1
+  corresponding to its HDMI output.
+
+Example:
+
+hdmi: hdmi@0x1 {
+   compatible = "snps,dw-hdmi-hsdk";
+   reg = <0x1 0x1>;
+   reg-io-width = <4>;
+   interrupts = <14>;
+   clocks = <>, <_pix_clk>;
+   clock-names = "iahb", "isfr";
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+   hdmi_enc_input: endpoint {
+   remote-endpoint = <_output>;
+   };
+   };
+
+   port@1 {
+   reg = <1>;
+   hdmi_enc_out: endpoint {
+   remote-endpoint = <_con>;
+   };
+   };
+   };
+};
+
+hdmi-out {
+   ...
+
+   port {
+   hdmi_con: endpoint {
+   remote-endpoint = <_enc_out>;
+   };
+   };
+};
+
+pgu {
+   ...
+
+   port_o: port {
+   pgu_output: endpoint {
+   remote-endpoint = <_enc_input>;
+   };
+   };
+};
-- 
2.21.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 1/2] DRM: ARC: add HDMI 2.0 TX encoder support

2020-03-16 Thread Eugeniy Paltsev
The Synopsys ARC SoCs (like HSDK4xD) include on-chip DesignWare HDMI
encoders. Support them with a platform driver to provide platform glue
data to the dw-hdmi driver.

Signed-off-by: Eugeniy Paltsev 
---
 MAINTAINERS   |   6 ++
 drivers/gpu/drm/Makefile  |   2 +-
 drivers/gpu/drm/arc/Kconfig   |   7 ++
 drivers/gpu/drm/arc/Makefile  |   1 +
 drivers/gpu/drm/arc/arc-dw-hdmi.c | 126 ++
 5 files changed, 141 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/arc/arc-dw-hdmi.c

diff --git a/MAINTAINERS b/MAINTAINERS
index a6fbdf354d34..a6dd992c5f95 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1258,6 +1258,12 @@ S:   Supported
 F: drivers/gpu/drm/arc/
 F: Documentation/devicetree/bindings/display/snps,arcpgu.txt
 
+ARC DW HDMI DRIVER
+M: Eugeniy Paltsev 
+S: Supported
+F: drivers/gpu/drm/arc/arc-dw-hdmi.c
+F: Documentation/devicetree/bindings/display/bridge/snps,arc-dw-hdmi.txt
+
 ARCNET NETWORK LAYER
 M: Michael Grzeschik 
 L: net...@vger.kernel.org
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 6493088a0fdd..5b0bcf7f45cd 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -109,7 +109,7 @@ obj-y   += panel/
 obj-y  += bridge/
 obj-$(CONFIG_DRM_FSL_DCU) += fsl-dcu/
 obj-$(CONFIG_DRM_ETNAVIV) += etnaviv/
-obj-$(CONFIG_DRM_ARCPGU)+= arc/
+obj-y  += arc/
 obj-y  += hisilicon/
 obj-$(CONFIG_DRM_ZTE)  += zte/
 obj-$(CONFIG_DRM_MXSFB)+= mxsfb/
diff --git a/drivers/gpu/drm/arc/Kconfig b/drivers/gpu/drm/arc/Kconfig
index e8f3d63e0b91..baec9d2a4fba 100644
--- a/drivers/gpu/drm/arc/Kconfig
+++ b/drivers/gpu/drm/arc/Kconfig
@@ -8,3 +8,10 @@ config DRM_ARCPGU
  Choose this option if you have an ARC PGU controller.
 
  If M is selected the module will be called arcpgu.
+
+config DRM_ARC_DW_HDMI
+   tristate "ARC DW HDMI"
+   depends on DRM && OF
+   select DRM_DW_HDMI
+   help
+ Synopsys DW HDMI driver for various ARC development boards
diff --git a/drivers/gpu/drm/arc/Makefile b/drivers/gpu/drm/arc/Makefile
index c7028b7427b3..7a156d8c2c3c 100644
--- a/drivers/gpu/drm/arc/Makefile
+++ b/drivers/gpu/drm/arc/Makefile
@@ -1,3 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0-only
 arcpgu-y := arcpgu_crtc.o arcpgu_hdmi.o arcpgu_sim.o arcpgu_drv.o
 obj-$(CONFIG_DRM_ARCPGU) += arcpgu.o
+obj-$(CONFIG_DRM_ARC_DW_HDMI) += arc-dw-hdmi.o
diff --git a/drivers/gpu/drm/arc/arc-dw-hdmi.c 
b/drivers/gpu/drm/arc/arc-dw-hdmi.c
new file mode 100644
index ..4869dd668a51
--- /dev/null
+++ b/drivers/gpu/drm/arc/arc-dw-hdmi.c
@@ -0,0 +1,126 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Synopsys DW HDMI driver for various ARC development boards
+//
+// Copyright (C) 2020 Synopsys
+// Author: Eugeniy Paltsev 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static const struct dw_hdmi_mpll_config snps_hdmi_mpll_cfg[] = {
+   {
+   2700, {
+   { 0x00B3, 0x },
+   { 0x00B3, 0x },
+   { 0x00B3, 0x }
+   },
+   }, {
+   7425, {
+   { 0x0072, 0x0001},
+   { 0x0072, 0x0001},
+   { 0x0072, 0x0001}
+   },
+   }, {
+   14850, {
+   { 0x0051, 0x0002},
+   { 0x0051, 0x0002},
+   { 0x0051, 0x0002}
+   },
+   }, {
+   ~0UL, {
+   { 0x00B3, 0x },
+   { 0x00B3, 0x },
+   { 0x00B3, 0x },
+   },
+   }
+};
+
+static const struct dw_hdmi_curr_ctrl snps_hdmi_cur_ctr[] = {
+   /* pixelclkbpp8bpp10   bpp12 */
+   { 2700,  { 0x, 0x, 0x }, },
+   { 7425,  { 0x0008, 0x0008, 0x0008 }, },
+   { 14850, { 0x001b, 0x001b, 0x001b }, },
+   { ~0UL,  { 0x, 0x, 0x }, }
+};
+
+
+static const struct dw_hdmi_phy_config snps_hdmi_phy_config[] = {
+   /* pixelclk   symbol  termvlev */
+   { 2700,   0x8009, 0x0004, 0x0232},
+   { 7425,   0x8009, 0x0004, 0x0232},
+   { 14850,  0x8009, 0x0004, 0x0232},
+   { ~0UL,   0x8009, 0x0004, 0x0232}
+};
+
+static enum drm_mode_status snps_dw_hdmi_mode_valid(struct drm_connector *con,
+   const struct 
drm_display_mode *mode)
+{
+   return MODE_OK;
+}
+
+static struct dw_hdmi_plat_data snps_dw_hdmi_drv_data = {
+   .mpll_cfg   = snps_hdmi_mpll_cfg,
+   .cur_ctr= snps_hdmi_cur_ctr,
+   .phy_config = snps_hdmi_phy_config,
+   .mode_valid = snps_dw_hdmi_mode_valid,
+};
+
+static const struct of_device_id s

[PATCH 0/2] DRM: ARC: add HDMI 2.0 TX encoder support

2020-03-16 Thread Eugeniy Paltsev
Eugeniy Paltsev (2):
  DRM: ARC: add HDMI 2.0 TX encoder support
  dt-bindings: Document the Synopsys ARC HDMI TX bindings

 .../display/bridge/snps,arc-dw-hdmi.txt   |  73 ++
 MAINTAINERS   |   6 +
 drivers/gpu/drm/Makefile  |   2 +-
 drivers/gpu/drm/arc/Kconfig   |   7 +
 drivers/gpu/drm/arc/Makefile  |   1 +
 drivers/gpu/drm/arc/arc-dw-hdmi.c | 126 ++
 6 files changed, 214 insertions(+), 1 deletion(-)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/snps,arc-dw-hdmi.txt
 create mode 100644 drivers/gpu/drm/arc/arc-dw-hdmi.c

-- 
2.21.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v2] initramfs: restore default compression behavior

2020-03-16 Thread Eugeniy Paltsev
Even though INITRAMFS_SOURCE kconfig option isn't set in most of
defconfigs it is used (set) extensively by various build systems.
Commit f26661e12765 ("initramfs: make initramfs compression choice
non-optional") has changed default compression mode. Previously we
compress initramfs using available compression algorithm. Now
we don't use any compression at all by default.
It significantly increases the image size in case of build system
chooses embedded initramfs. Initially I faced with this issue while
using buildroot.

As of today it's not possible to set preferred compression mode
in target defconfig as this option depends on INITRAMFS_SOURCE
being set. Modification of all build systems either doesn't look
like good option.

Let's instead rewrite initramfs compression mode choices list
the way that "INITRAMFS_COMPRESSION_NONE" will be the last option
in the list. In that case it will be chosen only if all other
options (which implements any compression) are not available.

Signed-off-by: Eugeniy Paltsev 
---
 usr/Kconfig | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/usr/Kconfig b/usr/Kconfig
index bdf5bbd40727..96afb03b65f9 100644
--- a/usr/Kconfig
+++ b/usr/Kconfig
@@ -124,17 +124,6 @@ choice
 
  If in doubt, select 'None'
 
-config INITRAMFS_COMPRESSION_NONE
-   bool "None"
-   help
- Do not compress the built-in initramfs at all. This may sound wasteful
- in space, but, you should be aware that the built-in initramfs will be
- compressed at a later stage anyways along with the rest of the kernel,
- on those architectures that support this. However, not compressing the
- initramfs may lead to slightly higher memory consumption during a
- short time at boot, while both the cpio image and the unpacked
- filesystem image will be present in memory simultaneously
-
 config INITRAMFS_COMPRESSION_GZIP
bool "Gzip"
depends on RD_GZIP
@@ -207,4 +196,15 @@ config INITRAMFS_COMPRESSION_LZ4
  If you choose this, keep in mind that most distros don't provide lz4
  by default which could cause a build failure.
 
+config INITRAMFS_COMPRESSION_NONE
+   bool "None"
+   help
+ Do not compress the built-in initramfs at all. This may sound wasteful
+ in space, but, you should be aware that the built-in initramfs will be
+ compressed at a later stage anyways along with the rest of the kernel,
+ on those architectures that support this. However, not compressing the
+ initramfs may lead to slightly higher memory consumption during a
+ short time at boot, while both the cpio image and the unpacked
+ filesystem image will be present in memory simultaneously
+
 endchoice
-- 
2.21.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH] initramfs: restore default compression behaviour

2020-03-16 Thread Eugeniy Paltsev
Hi Masahiro,

>From: Masahiro Yamada 
>Sent: Wednesday, March 11, 2020 23:12
>To: Eugeniy Paltsev
>Cc: Linux Kernel Mailing List; arcml; Vineet Gupta; Alexey Brodkin
>Subject: Re: [PATCH] initramfs: restore default compression behaviour
>
>Hi Eugeniy.
>
>On Wed, Mar 11, 2020 at 7:22 PM Eugeniy Paltsev
> wrote:
>>
>> Even though INITRAMFS_SOURCE kconfig option isn't set in most of
>> defconfigs it is used (set) extensively by various build systems.
>> Commit f26661e12765 ("initramfs: make initramfs compression choice
>> non-optional") has changed default compression mode. Previously we
>> compress initramfs using available compression algorithm. Now
>> we don't use any compression at all by default.
>> It significantly increases the image size in case of build system
>> chooses embedded initramfs. Initially I faced with this issue while
>> using buildroot.
>>
>> As of today it's not possible to set preferred compression mode
>> in target defconfig as this option depends on INITRAMFS_SOURCE
>> being set.
>> Modification of build systems doesn't look like good option in this
>> case as it requires to check against kernel version when setting
>> compression mode. The reason for this is that kconfig options
>> describing compression mode was renamed (in same patch series)
>
>Which commit?
>
>I do not remember the renaming of kconfig options
>with this regard.

Ok, I've checked it again - looks like I was confused a bit by
"CONFIG_INITRAMFS_COMPRESSION" option
as in v5.5 kernel I have in ".config":
CONFIG_INITRAMFS_COMPRESSION=".gz"

And for v5.6-rc1 I have in ".config":
CONFIG_INITRAMFS_COMPRESSION_GZIP=y

But they are different options actually...

>
>> so
>> we are not able to simply enable one option for old and new kernels.
>>
>> Given that I propose to use GZIP as default here instead of NO
>> compression. It should be used only when available but given that
>> gzip is enabled by default it looks like good enough choice.
>
>
>Another solution would be to move
>INITRAMFS_COMPRESSION_NONE to the end of the choice menu.
>
>The default of the choice menu is the first visible entry.
>
>GZIP if RD_GZIP is defined, BZIP2 if RD_BZIP2 is defined ...

Thanks for advice. It looks like an excellent option here, I'll send a patch.

>
>> Signed-off-by: Eugeniy Paltsev 
>> ---
>>  usr/Kconfig | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/usr/Kconfig b/usr/Kconfig
>> index bdf5bbd40727..690ef9020819 100644
>> --- a/usr/Kconfig
>> +++ b/usr/Kconfig
>> @@ -102,6 +102,7 @@ config RD_LZ4
>>
>>  choice
>> prompt "Built-in initramfs compression mode"
>> +   default INITRAMFS_COMPRESSION_GZIP if RD_GZIP
>> depends on INITRAMFS_SOURCE != ""
>> help
>>   This option allows you to decide by which algorithm the builtin
>> --
>> 2.21.1
>>
>--
>Best Regards
>Masahiro Yamada
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 2/2] ARC: don't align ret_from_exception function

2020-03-11 Thread Eugeniy Paltsev
>From: Vineet Gupta 
>Sent: Thursday, March 12, 2020 00:10
>To: Eugeniy Paltsev; linux-snps-arc@lists.infradead.org
>Cc: linux-ker...@vger.kernel.org; Alexey Brodkin
>Subject: Re: [PATCH 2/2] ARC: don't align ret_from_exception function
>
>On 3/11/20 1:58 PM, Eugeniy Paltsev wrote:
>>>
>>> I would like to keep it aligned.
>>>
>>> ARC700 definitely has penalty for unaligned branch targets, so it will 
>>> definitely
>>> suffer there.
>>
>> Do you know some exact numbers? I'm not an expert in ARC700 (fortunately =)
>
>I don't remember the exact numbers either.
>
>>> For HS, unaligned branch targets have no penalty (for the general case 
>>> atleast),
>>> but if it does get unaligned, the entire entry prologue code will be - i.e. 
>>> each
>>> one of the subsequent 130 or so instructions. That doesn't seem like a good 
>>> idea
>>> in general to me.
>>
>> I really don't insist about applying this patch but I don't understand your
>> argumentation about ARC HS like at all.
>
>I knew you would argue hence I already copy/pasted the start and end of the
>epilogue already in my prev reply which you didn't care to read thru.

Well, I beg to differ :)

>If you start counting instructions from  all the way to 
>end of
> there are over 130 instructions all of which can be rendered
>unaligned by your patch. What is worse is that this would be unpredictable: the
>unaligned case will mostly NOT happen, but a new compiler or some subtle code
>change could causing potentially side-effects we won't even know where to look.

I'm definitely missing something. Let's forget for a moment about our code
written in ASM and check the the binaries compiled from C sources.
The function is aligned by 4 bytes. However the function body contain the mix of
16 bit, 32 bit, 48 bit and 64 bit instructions. So we have huge amount of
instructions with size > 16 bit which are aligned by 16 bit.

I briefly checked our RPM but I don't see any note that it is OK to have
dozen of unaligned instructions but it is NOT OK to have a hundred of them.

So, what are your concerns based on?

>>> I faked it using a nop_s and the SYM_FUNC_START_NOALIGN( ) annotation and 
>>> can see
>>> all instructions getting unaligned.
>>
>> What is the problem with it? It's totally valid and fine for ARC HS to have 
>> instructions
>> aligned by 2 byte. Or are you talking about ARC700 again?
>
>Yes I know that already. It is fine in general as I explained earlier, but can
>potentially NOT when 130 instructions are unaligned.
>
>>> Before;
>>>
>>> 921238e4 :
>>> 921238e4:ldr8,[sp,124]
>>> 921238e8:bbit0.ntr8,0x7,212
>>> ...
>>> 92123ac8:rtie
>>> 92123acc :
>>> 92123acc:ldr2,[0x927d81d8]
>>> 92123ad4:addr2,r2,0x1
>>> 92123ad8:str2,[0x927d81d8]
>>> 92123ae0:bmsknr11,r10,0xf
>>> 92123ae4:srr11,[aux_irq_act]
>>> 92123ae8:b-140;92123a5c
>>>
>>> After:
>>>
>>> 9212393c:nop_s
>>> 9212393e :
>>> 9212393e:ldr8,[sp,124]
>>> 92123942:bbit0.ntr8,0x7,214
>>> ...
>>> 92123b22:rtie
>>> 92123b26 :
>>> 92123b26:ldr2,[0x927d81d8]
>>> 92123b2e:addr2,r2,0x1
>>> 92123b32:str2,[0x927d81d8]
>>> 92123b3a:bmsknr11,r10,0xf
>>> 92123b3e:srr11,[aux_irq_act]
>>> 92123b42:b-138;92123ab6 
>>> 92123b46:nop_s
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 2/2] ARC: don't align ret_from_exception function

2020-03-11 Thread Eugeniy Paltsev
>From: Vineet Gupta 
>Sent: Wednesday, March 11, 2020 20:38
>To: Eugeniy Paltsev; linux-snps-arc@lists.infradead.org
>Cc: linux-ker...@vger.kernel.org; Alexey Brodkin
>Subject: Re: [PATCH 2/2] ARC: don't align ret_from_exception function
>
>On 3/11/20 9:26 AM, Eugeniy Paltsev wrote:
>> ARC have a tricky implemented ret_from_exception function.
>> It is written on ASM and can be called like regular function.
>> However it has another 'entry point' as it can be called as a
>> continuation of EV_Trap function.
>
>It is not really intended / needed to be called form outside ASM - but has to 
>be
>spread across 2 asm files as it is mostly target isa independent, while the
>callers are in separate target isa specific files.
>The ENTRY/END annotations are simply for the dwarf unwinder to stop gracefully.
>
>> As we declare "ret_from_exception" using ENTRY macro it may align
>> "ret_from_exception" by 4 bytes by adding padding before it.
>> "ret_from_exception" doesn't require alignment by 4 bytes
>> (as it doesn't go to vector table, etc...) so let's avoid aligning
>> it by switch from ENTRY (which is alias for SYM_FUNC_START) to
>> SYM_FUNC_START_NOALIGN macro.
>
>I would like to keep it aligned.
>
>ARC700 definitely has penalty for unaligned branch targets, so it will 
>definitely
>suffer there.

Do you know some exact numbers? I'm not an expert in ARC700 (fortunately =)

>
>For HS, unaligned branch targets have no penalty (for the general case 
>atleast),
>but if it does get unaligned, the entire entry prologue code will be - i.e. 
>each
>one of the subsequent 130 or so instructions. That doesn't seem like a good 
>idea
>in general to me.

I really don't insist about applying this patch but I don't understand your
argumentation about ARC HS like at all. Could you please explain in more detail 
what
130 instructions you are talking about?

>What's weird is I never hit the original problem you ran into - are you using a
>toolchain with the branch relaxation stuff  ?

Looks like we just were lucky enough and didn't change this code a lot.
I faced with this issue when I was developing DSP-related stuff. Initially I
triggered it when I replaced 'mov r10, 0' instruction with 'mov_s r10, 0' and 
got
weird kernel crush.

It can be reproduced with any toolchain (it's not related to branch relaxation 
stuff).

>I faked it using a nop_s and the SYM_FUNC_START_NOALIGN( ) annotation and can 
>see
>all instructions getting unaligned.

What is the problem with it? It's totally valid and fine for ARC HS to have 
instructions
aligned by 2 byte. Or are you talking about ARC700 again?

>Before;
>
>921238e4 :
>921238e4:ldr8,[sp,124]
>921238e8:bbit0.ntr8,0x7,212
>...
>92123ac8:rtie
>92123acc :
>92123acc:ldr2,[0x927d81d8]
>92123ad4:addr2,r2,0x1
>92123ad8:str2,[0x927d81d8]
>92123ae0:bmsknr11,r10,0xf
>92123ae4:srr11,[aux_irq_act]
>92123ae8:b-140;92123a5c
>
>After:
>
>9212393c:nop_s
>9212393e :
>9212393e:ldr8,[sp,124]
>92123942:bbit0.ntr8,0x7,214
>...
>92123b22:rtie
>92123b26 :
>92123b26:ldr2,[0x927d81d8]
>92123b2e:addr2,r2,0x1
>92123b32:str2,[0x927d81d8]
>92123b3a:bmsknr11,r10,0xf
>92123b3e:srr11,[aux_irq_act]
>92123b42:b-138;92123ab6 
>92123b46:nop_s
>
>> Signed-off-by: Eugeniy Paltsev 
>> ---
>>  arch/arc/kernel/entry-arcv2.S | 2 +-
>>  arch/arc/kernel/entry.S   | 3 +--
>>  2 files changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/arc/kernel/entry-arcv2.S b/arch/arc/kernel/entry-arcv2.S
>> index 12d5f12d10d2..d482e1507f56 100644
>> --- a/arch/arc/kernel/entry-arcv2.S
>> +++ b/arch/arc/kernel/entry-arcv2.S
>> @@ -260,4 +260,4 @@ debug_marker_ds:
>>   sr  r11, [AUX_IRQ_ACT]
>>   b   .Lexcept_ret
>>
>> -END(ret_from_exception)
>> +SYM_FUNC_END(ret_from_exception)
>> diff --git a/arch/arc/kernel/entry.S b/arch/arc/kernel/entry.S
>> index 60406ec62eb8..79409b518a09 100644
>> --- a/arch/arc/kernel/entry.S
>> +++ b/arch/arc/kernel/entry.S
>> @@ -280,7 +280,7 @@ END(EV_Trap)
>>  ;
>>  ; If ret to user mode do we need to handle signals, schedule() et al.
>>
>> -ENTRY(ret_from_exception)
>> +SYM_FUNC_START_NOALIGN(ret_from_exception)
>>
>>   ; Pre-{IRQ,Trap,Exception} K/U mode from pt_regs->status32
>>   ld  r8, [sp, PT_status32]   ; returning to User/Kernel Mode
>> @@ -373,4 +373,3 @@ resume_kernel_mode:
>>   b   .Lrestore_regs
>>
>>  # DONT ADD CODE HERE - .Lrestore_regs actually follows in entry-.S
>> -
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 1/2] ARC: define __ALIGN_STR and __ALIGN symbols for ARC

2020-03-11 Thread Eugeniy Paltsev
As of today ARC uses generic __ALIGN_STR and __ALIGN symbol
definitions from "include/linux/linkage.h"
They are defined to ".align 4,0x90" which instructed the assembler
to use `0x90` as a fill byte when aligning functions declared with
ENTRY or similar macroses. This leads to generated weird instructions
in code (when alignment is used) like "ldh_s r12,[r0,0x20]" which is
encoded as 0x9090 for ARCv2.

Let's use ".align 4" which insert a "nop_s" instruction instead.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/include/asm/linkage.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arc/include/asm/linkage.h b/arch/arc/include/asm/linkage.h
index d9ee43c6b7db..fe19f1d412e7 100644
--- a/arch/arc/include/asm/linkage.h
+++ b/arch/arc/include/asm/linkage.h
@@ -29,6 +29,8 @@
 .endm
 
 #define ASM_NL  `  /* use '`' to mark new line in macro */
+#define __ALIGN.align 4
+#define __ALIGN_STR__stringify(__ALIGN)
 
 /* annotation for data we want in DCCM - if enabled in .config */
 .macro ARCFP_DATA nm
-- 
2.21.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 2/2] ARC: don't align ret_from_exception function

2020-03-11 Thread Eugeniy Paltsev
ARC have a tricky implemented ret_from_exception function.
It is written on ASM and can be called like regular function.
However it has another 'entry point' as it can be called as a
continuation of EV_Trap function.

As we declare "ret_from_exception" using ENTRY macro it may align
"ret_from_exception" by 4 bytes by adding padding before it.
"ret_from_exception" doesn't require alignment by 4 bytes
(as it doesn't go to vector table, etc...) so let's avoid aligning
it by switch from ENTRY (which is alias for SYM_FUNC_START) to
SYM_FUNC_START_NOALIGN macro.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/kernel/entry-arcv2.S | 2 +-
 arch/arc/kernel/entry.S   | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/arc/kernel/entry-arcv2.S b/arch/arc/kernel/entry-arcv2.S
index 12d5f12d10d2..d482e1507f56 100644
--- a/arch/arc/kernel/entry-arcv2.S
+++ b/arch/arc/kernel/entry-arcv2.S
@@ -260,4 +260,4 @@ debug_marker_ds:
sr  r11, [AUX_IRQ_ACT]
b   .Lexcept_ret
 
-END(ret_from_exception)
+SYM_FUNC_END(ret_from_exception)
diff --git a/arch/arc/kernel/entry.S b/arch/arc/kernel/entry.S
index 60406ec62eb8..79409b518a09 100644
--- a/arch/arc/kernel/entry.S
+++ b/arch/arc/kernel/entry.S
@@ -280,7 +280,7 @@ END(EV_Trap)
 ;
 ; If ret to user mode do we need to handle signals, schedule() et al.
 
-ENTRY(ret_from_exception)
+SYM_FUNC_START_NOALIGN(ret_from_exception)
 
; Pre-{IRQ,Trap,Exception} K/U mode from pt_regs->status32
ld  r8, [sp, PT_status32]   ; returning to User/Kernel Mode
@@ -373,4 +373,3 @@ resume_kernel_mode:
b   .Lrestore_regs
 
 # DONT ADD CODE HERE - .Lrestore_regs actually follows in entry-.S
-
-- 
2.21.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH] ARC: [plat-axs10x]: PGU: remove unused encoder-slave property

2020-03-11 Thread Eugeniy Paltsev
ARC PGU is looking for encoder via endpoint mechanism and doesn't
use "encoder-slave" property for a long time. Let's drop unused
"encoder-slave" property from ARC PGU node in axs10x.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/boot/dts/axs10x_mb.dtsi | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arc/boot/dts/axs10x_mb.dtsi b/arch/arc/boot/dts/axs10x_mb.dtsi
index 1d109b06e7d8..99d3e7175bf7 100644
--- a/arch/arc/boot/dts/axs10x_mb.dtsi
+++ b/arch/arc/boot/dts/axs10x_mb.dtsi
@@ -305,7 +305,6 @@
pgu@17000 {
compatible = "snps,arcpgu";
reg = <0x17000 0x400>;
-   encoder-slave = <>;
clocks = <>;
clock-names = "pxlclk";
memory-region = <_buffer>;
-- 
2.21.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 2/3] CLK: HSDK: CGU: support PLL bypassing

2020-03-11 Thread Eugeniy Paltsev
Support setting PLL to bypass mode to support output frequency
equal to input one.

Signed-off-by: Eugeniy Paltsev 
---
 drivers/clk/clk-hsdk-pll.c | 61 +-
 1 file changed, 34 insertions(+), 27 deletions(-)

diff --git a/drivers/clk/clk-hsdk-pll.c b/drivers/clk/clk-hsdk-pll.c
index b47a559f3528..0ea7af57a5b1 100644
--- a/drivers/clk/clk-hsdk-pll.c
+++ b/drivers/clk/clk-hsdk-pll.c
@@ -53,35 +53,37 @@ struct hsdk_pll_cfg {
u32 fbdiv;
u32 odiv;
u32 band;
+   u32 bypass;
 };
 
 static const struct hsdk_pll_cfg asdt_pll_cfg[] = {
-   { 1,  0, 11, 3, 0 },
-   { 13300,  0, 15, 3, 0 },
-   { 2,  1, 47, 3, 0 },
-   { 23300,  1, 27, 2, 0 },
-   { 3,  1, 35, 2, 0 },
-   { 33300,  1, 39, 2, 0 },
-   { 4,  1, 47, 2, 0 },
-   { 5,  0, 14, 1, 0 },
-   { 6,  0, 17, 1, 0 },
-   { 7,  0, 20, 1, 0 },
-   { 8,  0, 23, 1, 0 },
-   { 9,  1, 26, 0, 0 },
-   { 10, 1, 29, 0, 0 },
-   { 11, 1, 32, 0, 0 },
-   { 12, 1, 35, 0, 0 },
-   { 13, 1, 38, 0, 0 },
-   { 14, 1, 41, 0, 0 },
-   { 15, 1, 44, 0, 0 },
-   { 16, 1, 47, 0, 0 },
+   { 1,  0, 11, 3, 0, 0 },
+   { 13300,  0, 15, 3, 0, 0 },
+   { 2,  1, 47, 3, 0, 0 },
+   { 23300,  1, 27, 2, 0, 0 },
+   { 3,  1, 35, 2, 0, 0 },
+   { 33300,  1, 39, 2, 0, 0 },
+   { 4,  1, 47, 2, 0, 0 },
+   { 5,  0, 14, 1, 0, 0 },
+   { 6,  0, 17, 1, 0, 0 },
+   { 7,  0, 20, 1, 0, 0 },
+   { 8,  0, 23, 1, 0, 0 },
+   { 9,  1, 26, 0, 0, 0 },
+   { 10, 1, 29, 0, 0, 0 },
+   { 11, 1, 32, 0, 0, 0 },
+   { 12, 1, 35, 0, 0, 0 },
+   { 13, 1, 38, 0, 0, 0 },
+   { 14, 1, 41, 0, 0, 0 },
+   { 15, 1, 44, 0, 0, 0 },
+   { 16, 1, 47, 0, 0, 0 },
{}
 };
 
 static const struct hsdk_pll_cfg hdmi_pll_cfg[] = {
-   { 29700,  0, 21, 2, 0 },
-   { 54000,  0, 19, 1, 0 },
-   { 59400,  0, 21, 1, 0 },
+   { 2700,   0, 0,  0, 0, 1 },
+   { 29700,  0, 21, 2, 0, 0 },
+   { 54000,  0, 19, 1, 0, 0 },
+   { 59400,  0, 21, 1, 0, 0 },
{}
 };
 
@@ -134,11 +136,16 @@ static inline void hsdk_pll_set_cfg(struct hsdk_pll_clk 
*clk,
 {
u32 val = 0;
 
-   /* Powerdown and Bypass bits should be cleared */
-   val |= cfg->idiv << CGU_PLL_CTRL_IDIV_SHIFT;
-   val |= cfg->fbdiv << CGU_PLL_CTRL_FBDIV_SHIFT;
-   val |= cfg->odiv << CGU_PLL_CTRL_ODIV_SHIFT;
-   val |= cfg->band << CGU_PLL_CTRL_BAND_SHIFT;
+   if (cfg->bypass) {
+   val = hsdk_pll_read(clk, CGU_PLL_CTRL);
+   val |= CGU_PLL_CTRL_BYPASS;
+   } else {
+   /* Powerdown and Bypass bits should be cleared */
+   val |= cfg->idiv << CGU_PLL_CTRL_IDIV_SHIFT;
+   val |= cfg->fbdiv << CGU_PLL_CTRL_FBDIV_SHIFT;
+   val |= cfg->odiv << CGU_PLL_CTRL_ODIV_SHIFT;
+   val |= cfg->band << CGU_PLL_CTRL_BAND_SHIFT;
+   }
 
dev_dbg(clk->dev, "write configuration: %#x\n", val);
 
-- 
2.21.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 3/3] CLK: HSDK: CGU: add support for 148.5MHz clock

2020-03-11 Thread Eugeniy Paltsev
Add support for 148.5MHz clock for HDMI PLL

Signed-off-by: Eugeniy Paltsev 
---
 drivers/clk/clk-hsdk-pll.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/clk-hsdk-pll.c b/drivers/clk/clk-hsdk-pll.c
index 0ea7af57a5b1..b4f8852201cb 100644
--- a/drivers/clk/clk-hsdk-pll.c
+++ b/drivers/clk/clk-hsdk-pll.c
@@ -81,6 +81,7 @@ static const struct hsdk_pll_cfg asdt_pll_cfg[] = {
 
 static const struct hsdk_pll_cfg hdmi_pll_cfg[] = {
{ 2700,   0, 0,  0, 0, 1 },
+   { 14850,  0, 21, 3, 0, 0 },
{ 29700,  0, 21, 2, 0, 0 },
{ 54000,  0, 19, 1, 0, 0 },
{ 59400,  0, 21, 1, 0, 0 },
-- 
2.21.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 0/3] CLK: HSDK: CGU: updates for HSDK clock management

2020-03-11 Thread Eugeniy Paltsev
Bunch of updates for HSDK clock generation unit (CGU) driver.

Eugeniy Paltsev (3):
  CLK: HSDK: CGU: check if PLL is bypassed first
  CLK: HSDK: CGU: support PLL bypassing
  CLK: HSDK: CGU: add support for 148.5MHz clock

 drivers/clk/clk-hsdk-pll.c | 70 +-
 1 file changed, 39 insertions(+), 31 deletions(-)

-- 
2.21.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 1/3] CLK: HSDK: CGU: check if PLL is bypassed first

2020-03-11 Thread Eugeniy Paltsev
If PLL is bypassed the EN (enable) bit has no effect on
output clock.

Signed-off-by: Eugeniy Paltsev 
---
 drivers/clk/clk-hsdk-pll.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/clk-hsdk-pll.c b/drivers/clk/clk-hsdk-pll.c
index 97d1e8c35b71..b47a559f3528 100644
--- a/drivers/clk/clk-hsdk-pll.c
+++ b/drivers/clk/clk-hsdk-pll.c
@@ -172,14 +172,14 @@ static unsigned long hsdk_pll_recalc_rate(struct clk_hw 
*hw,
 
dev_dbg(clk->dev, "current configuration: %#x\n", val);
 
-   /* Check if PLL is disabled */
-   if (val & CGU_PLL_CTRL_PD)
-   return 0;
-
/* Check if PLL is bypassed */
if (val & CGU_PLL_CTRL_BYPASS)
return parent_rate;
 
+   /* Check if PLL is disabled */
+   if (val & CGU_PLL_CTRL_PD)
+   return 0;
+
/* input divider = reg.idiv + 1 */
idiv = 1 + ((val & CGU_PLL_CTRL_IDIV_MASK) >> CGU_PLL_CTRL_IDIV_SHIFT);
/* fb divider = 2*(reg.fbdiv + 1) */
-- 
2.21.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH] DRM: ARC: PGU: interlaced mode not supported

2020-03-11 Thread Eugeniy Paltsev
Filter out interlaced modes as they are not supported by ARC PGU
hardware.

Signed-off-by: Eugeniy Paltsev 
---
 drivers/gpu/drm/arc/arcpgu_crtc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/arc/arcpgu_crtc.c 
b/drivers/gpu/drm/arc/arcpgu_crtc.c
index 8ae1e1f97a73..c854066d4c75 100644
--- a/drivers/gpu/drm/arc/arcpgu_crtc.c
+++ b/drivers/gpu/drm/arc/arcpgu_crtc.c
@@ -67,6 +67,9 @@ static enum drm_mode_status arc_pgu_crtc_mode_valid(struct 
drm_crtc *crtc,
long rate, clk_rate = mode->clock * 1000;
long diff = clk_rate / 200; /* +-0.5% allowed by HDMI spec */
 
+   if (mode->flags & DRM_MODE_FLAG_INTERLACE)
+   return MODE_NO_INTERLACE;
+
rate = clk_round_rate(arcpgu->clk, clk_rate);
if ((max(rate, clk_rate) - min(rate, clk_rate) < diff) && (rate > 0))
return MODE_OK;
-- 
2.21.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH] ARC: HSDK: Enable on-chip reset controller

2020-03-11 Thread Eugeniy Paltsev
As the driver of on-chip reset controller became available
we are ready to enable it.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/dts/hsdk.dts  | 7 +++
 configs/hsdk_defconfig | 1 +
 2 files changed, 8 insertions(+)

diff --git a/arch/arc/dts/hsdk.dts b/arch/arc/dts/hsdk.dts
index 34ef3a620a3..cf2ce8a1f6c 100644
--- a/arch/arc/dts/hsdk.dts
+++ b/arch/arc/dts/hsdk.dts
@@ -6,6 +6,7 @@
 
 #include "skeleton.dtsi"
 #include "dt-bindings/clock/snps,hsdk-cgu.h"
+#include "dt-bindings/reset/snps,hsdk-reset.h"
 
 / {
model = "snps,hsdk";
@@ -62,6 +63,12 @@
#clock-cells = <1>;
};
 
+   cgu_rst: reset-controller@f8a0 {
+   compatible = "snps,hsdk-reset";
+   #reset-cells = <1>;
+   reg = <0xf8a0 0x4>, <0xfff0 0x4>;
+   };
+
uart0: serial0@f0005000 {
compatible = "snps,dw-apb-uart";
reg = <0xf0005000 0x1000>;
diff --git a/configs/hsdk_defconfig b/configs/hsdk_defconfig
index 4830158d55a..84b22ed7c04 100644
--- a/configs/hsdk_defconfig
+++ b/configs/hsdk_defconfig
@@ -47,6 +47,7 @@ CONFIG_SPI_FLASH_SST=y
 CONFIG_DM_ETH=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_MII=y
+CONFIG_DM_RESET=y
 CONFIG_DM_SERIAL=y
 CONFIG_DEBUG_UART_SHIFT=2
 CONFIG_DEBUG_UART_ANNOUNCE=y
-- 
2.21.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 2/2] ARC: CACHE: mark IOC helper functions as inlined_cachefunc

2020-03-11 Thread Eugeniy Paltsev
Force inlining of IOC related functions used in other cache
functions. This is preventive change.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/lib/cache.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arc/lib/cache.c b/arch/arc/lib/cache.c
index c42723daeb2..8a1d67870a8 100644
--- a/arch/arc/lib/cache.c
+++ b/arch/arc/lib/cache.c
@@ -179,7 +179,7 @@ DECLARE_GLOBAL_DATA_PTR;
 static inlined_cachefunc void __ic_entire_invalidate(void);
 static inlined_cachefunc void __dc_entire_op(const int cacheop);
 static inlined_cachefunc void __slc_entire_op(const int op);
-static inline bool ioc_enabled(void);
+static inlined_cachefunc bool ioc_enabled(void);
 
 static inline bool pae_exists(void)
 {
@@ -346,7 +346,7 @@ void slc_disable(void)
__slc_disable();
 }
 
-static inline bool ioc_exists(void)
+static inlined_cachefunc bool ioc_exists(void)
 {
if (is_isa_arcv2()) {
union bcr_clust_cfg cbcr;
@@ -358,7 +358,7 @@ static inline bool ioc_exists(void)
return false;
 }
 
-static inline bool ioc_enabled(void)
+static inlined_cachefunc bool ioc_enabled(void)
 {
/*
 * We check only CONFIG option instead of IOC HW state check as IOC
-- 
2.21.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 1/2] ARC: CACHE: add support for SL$ disable

2020-03-11 Thread Eugeniy Paltsev
Since version 3.0 ARC HS supports SL$ (L2 system level cache)
disable. So add support for SL$ disable/enable to code.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/include/asm/cache.h |   7 +++
 arch/arc/lib/cache.c | 114 ---
 2 files changed, 114 insertions(+), 7 deletions(-)

diff --git a/arch/arc/include/asm/cache.h b/arch/arc/include/asm/cache.h
index 0fdcf2d2dd5..ab61846b5ab 100644
--- a/arch/arc/include/asm/cache.h
+++ b/arch/arc/include/asm/cache.h
@@ -40,6 +40,13 @@ static const inline int is_ioc_enabled(void)
return IS_ENABLED(CONFIG_ARC_DBG_IOC_ENABLE);
 }
 
+/*
+ * We export SLC control functions to use them in platform configuration code.
+ * They maust not be used in any generic code!
+ */
+void slc_enable(void);
+void slc_disable(void);
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __ASM_ARC_CACHE_H */
diff --git a/arch/arc/lib/cache.c b/arch/arc/lib/cache.c
index 1340776c669..c42723daeb2 100644
--- a/arch/arc/lib/cache.c
+++ b/arch/arc/lib/cache.c
@@ -89,8 +89,7 @@
  *
  * [ NOTE 2 ]:
  * As of today we only support the following cache configurations on ARC.
- * Other configurations may exist in HW (for example, since version 3.0 HS
- * supports SL$ (L2 system level cache) disable) but we don't support it in SW.
+ * Other configurations may exist in HW but we don't support it in SW.
  * Configuration 1:
  *__
  *   |  |
@@ -120,7 +119,8 @@
  *   |  |
  *   |   L2 (SL$)   |
  *   |__|
- *  always must be on
+ *  always on (ARCv2, HS <  3.0)
+ *  on/off(ARCv2, HS >= 3.0)
  *___|__|
  *   |  |
  *   |   main memory|
@@ -178,6 +178,8 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static inlined_cachefunc void __ic_entire_invalidate(void);
 static inlined_cachefunc void __dc_entire_op(const int cacheop);
+static inlined_cachefunc void __slc_entire_op(const int op);
+static inline bool ioc_enabled(void);
 
 static inline bool pae_exists(void)
 {
@@ -238,6 +240,70 @@ static inlined_cachefunc bool slc_exists(void)
return false;
 }
 
+enum slc_dis_status {
+   ST_SLC_MISSING = 0,
+   ST_SLC_NO_DISABLE_CTRL,
+   ST_SLC_DISABLE_CTRL
+};
+
+/*
+ * ARCv1 -> ST_SLC_MISSING
+ * ARCv2 && SLC absent   -> ST_SLC_MISSING
+ * ARCv2 && SLC exists && SLC version <= 2   -> ST_SLC_NO_DISABLE_CTRL
+ * ARCv2 && SLC exists && SLC version > 2-> ST_SLC_DISABLE_CTRL
+ */
+static inlined_cachefunc enum slc_dis_status slc_disable_supported(void)
+{
+   if (is_isa_arcv2()) {
+   union bcr_generic sbcr;
+
+   sbcr.word = read_aux_reg(ARC_BCR_SLC);
+   if (sbcr.fields.ver == 0)
+   return ST_SLC_MISSING;
+   else if (sbcr.fields.ver <= 2)
+   return ST_SLC_NO_DISABLE_CTRL;
+   else
+   return ST_SLC_DISABLE_CTRL;
+   }
+
+   return ST_SLC_MISSING;
+}
+
+static inlined_cachefunc bool __slc_enabled(void)
+{
+   return !(read_aux_reg(ARC_AUX_SLC_CTRL) & SLC_CTRL_DIS);
+}
+
+static inlined_cachefunc void __slc_enable(void)
+{
+   unsigned int ctrl;
+
+   ctrl = read_aux_reg(ARC_AUX_SLC_CTRL);
+   ctrl &= ~SLC_CTRL_DIS;
+   write_aux_reg(ARC_AUX_SLC_CTRL, ctrl);
+}
+
+static inlined_cachefunc void __slc_disable(void)
+{
+   unsigned int ctrl;
+
+   ctrl = read_aux_reg(ARC_AUX_SLC_CTRL);
+   ctrl |= SLC_CTRL_DIS;
+   write_aux_reg(ARC_AUX_SLC_CTRL, ctrl);
+}
+
+static inlined_cachefunc bool slc_enabled(void)
+{
+   enum slc_dis_status slc_status = slc_disable_supported();
+
+   if (slc_status == ST_SLC_MISSING)
+   return false;
+   else if (slc_status == ST_SLC_NO_DISABLE_CTRL)
+   return true;
+   else
+   return __slc_enabled();
+}
+
 static inlined_cachefunc bool slc_data_bypass(void)
 {
/*
@@ -247,6 +313,39 @@ static inlined_cachefunc bool slc_data_bypass(void)
return !dcache_enabled();
 }
 
+void slc_enable(void)
+{
+   if (slc_disable_supported() != ST_SLC_DISABLE_CTRL)
+   return;
+
+   if (__slc_enabled())
+   return;
+
+   __slc_enable();
+}
+
+/* TODO: warn if we are not able to disable SLC */
+void slc_disable(void)
+{
+   if (slc_disable_supported() != ST_SLC_DISABLE_CTRL)
+   return;
+
+   /* we don't support SLC disabling if we use IOC */
+   if (ioc_enabled())
+   return;
+
+   if (!__slc_enabled())
+   return;
+
+   /*
+* We need to flush L1D$ to guarantee that we won't have any
+* writeback operations during SLC disabling.
+*/
+   __dc_entire_op(OP_FLUSH);
+   __slc_entire_op(OP_FLUS

[PATCH 0/2] ARC cache subsystem updates

2020-03-11 Thread Eugeniy Paltsev
Eugeniy Paltsev (2):
  ARC: CACHE: add support for SL$ disable
  ARC: CACHE: mark IOC helper functions as inlined_cachefunc

 arch/arc/include/asm/cache.h |   7 +++
 arch/arc/lib/cache.c | 118 ---
 2 files changed, 116 insertions(+), 9 deletions(-)

-- 
2.21.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH] initramfs: restore default compression behaviour

2020-03-11 Thread Eugeniy Paltsev
Even though INITRAMFS_SOURCE kconfig option isn't set in most of
defconfigs it is used (set) extensively by various build systems.
Commit f26661e12765 ("initramfs: make initramfs compression choice
non-optional") has changed default compression mode. Previously we
compress initramfs using available compression algorithm. Now
we don't use any compression at all by default.
It significantly increases the image size in case of build system
chooses embedded initramfs. Initially I faced with this issue while
using buildroot.

As of today it's not possible to set preferred compression mode
in target defconfig as this option depends on INITRAMFS_SOURCE
being set.
Modification of build systems doesn't look like good option in this
case as it requires to check against kernel version when setting
compression mode. The reason for this is that kconfig options
describing compression mode was renamed (in same patch series) so
we are not able to simply enable one option for old and new kernels.

Given that I propose to use GZIP as default here instead of NO
compression. It should be used only when available but given that
gzip is enabled by default it looks like good enough choice.

Signed-off-by: Eugeniy Paltsev 
---
 usr/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/usr/Kconfig b/usr/Kconfig
index bdf5bbd40727..690ef9020819 100644
--- a/usr/Kconfig
+++ b/usr/Kconfig
@@ -102,6 +102,7 @@ config RD_LZ4
 
 choice
prompt "Built-in initramfs compression mode"
+   default INITRAMFS_COMPRESSION_GZIP if RD_GZIP
depends on INITRAMFS_SOURCE != ""
help
  This option allows you to decide by which algorithm the builtin
-- 
2.21.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH v2 2/4] ARC: handle DSP presence in HW

2020-03-10 Thread Eugeniy Paltsev
>From: Vineet Gupta 
>Sent: Saturday, March 7, 2020 03:12
>To: Eugeniy Paltsev; linux-snps-arc@lists.infradead.org
>Cc: Alexey Brodkin; linux-ker...@vger.kernel.org
>Subject: Re: [PATCH v2 2/4] ARC: handle DSP presence in HW
>
>On 3/5/20 12:02 PM, Eugeniy Paltsev wrote:
>> In case of DSP extension presence in HW some instructions
>> (related to integer multiply, multiply-accumulate, and divide
>> operation) executes on this DSP execution unit. So their
>> execution will depend on dsp configuration register (DSP_CTRL)
>>
>> As we want these instructions to execute the same way regardless
>> of DSP presence we need to set DSP_CTRL properly. However this
>> register can be modified bu any usersace app therefore any
>> usersace may break kernel execution.
>>
>> Fix that by configure DSP_CTRL in CPU early code and in IRQs
>> entries.
>
> How about below 

Good description, ACK.

> "When DSP extensions are present, some of the regular integer instructions 
> such as
> DIV, MACD etc are executed in the DSP unit with semantics alterable by flags 
> in
> DSP_CTRL aux register. This register is writable by userspace and thus can
> potentially affect corresponding instructions in kernel code, intentionally or
> otherwise. So safegaurd kernel by effectively disabling DSP_CTRL upon bootup 
> and
> every entry to kernel.
> 
> Do note that for this config we simply zero out the DSP_CTRL reg assuming
> userspace doesn't really care about DSP. The next patch caters to the DSP 
> aware
> userspace which this actually saved/restored upon kernel entry."
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH v2 2/4] ARC: handle DSP presence in HW

2020-03-10 Thread Eugeniy Paltsev
>From: Vineet Gupta 
>Sent: Saturday, March 7, 2020 03:12
>To: Eugeniy Paltsev; linux-snps-arc@lists.infradead.org
>Cc: Alexey Brodkin; linux-ker...@vger.kernel.org
>Subject: Re: [PATCH v2 2/4] ARC: handle DSP presence in HW
>
>On 3/5/20 12:02 PM, Eugeniy Paltsev wrote:
>> In case of DSP extension presence in HW some instructions
>> (related to integer multiply, multiply-accumulate, and divide
>> operation) executes on this DSP execution unit. So their
>> execution will depend on dsp configuration register (DSP_CTRL)
>>
>> As we want these instructions to execute the same way regardless
>> of DSP presence we need to set DSP_CTRL properly. However this
>> register can be modified bu any usersace app therefore any
>> usersace may break kernel execution.
>>
>> Fix that by configure DSP_CTRL in CPU early code and in IRQs
>> entries.
>
> How about below 
> 
> "When DSP extensions are present, some of the regular integer instructions 
> such as
> DIV, MACD etc are executed in the DSP unit with semantics alterable by flags 
> in
> DSP_CTRL aux register. This register is writable by userspace and thus can
> potentially affect corresponding instructions in kernel code, intentionally or
> otherwise. So safegaurd kernel by effectively disabling DSP_CTRL upon bootup 
> and
> every entry to kernel.
> 
> Do note that for this config we simply zero out the DSP_CTRL reg assuming
> userspace doesn't really care about DSP. The next patch caters to the DSP 
> aware
> userspace which this actually saved/restored upon kernel entry."
>From: Vineet Gupta 
>Sent: Saturday, March 7, 2020 03:12
>To: Eugeniy Paltsev; linux-snps-arc@lists.infradead.org
>Cc: Alexey Brodkin; linux-ker...@vger.kernel.org
>Subject: Re: [PATCH v2 2/4] ARC: handle DSP presence in HW
>
>On 3/5/20 12:02 PM, Eugeniy Paltsev wrote:
>> In case of DSP extension presence in HW some instructions
>> (related to integer multiply, multiply-accumulate, and divide
>> operation) executes on this DSP execution unit. So their
>> execution will depend on dsp configuration register (DSP_CTRL)
>>
>> As we want these instructions to execute the same way regardless
>> of DSP presence we need to set DSP_CTRL properly. However this
>> register can be modified bu any usersace app therefore any
>> usersace may break kernel execution.
>>
>> Fix that by configure DSP_CTRL in CPU early code and in IRQs
>> entries.
>
> How about below 

> 
> "When DSP extensions are present, some of the regular integer instructions 
> such as
> DIV, MACD etc are executed in the DSP unit with semantics alterable by flags 
> in
> DSP_CTRL aux register. This register is writable by userspace and thus can
> potentially affect corresponding instructions in kernel code, intentionally or
> otherwise. So safegaurd kernel by effectively disabling DSP_CTRL upon bootup 
> and
> every entry to kernel.
> 
> Do note that for this config we simply zero out the DSP_CTRL reg assuming
> userspace doesn't really care about DSP. The next patch caters to the DSP 
> aware
> userspace which this actually saved/restored upon kernel entry."
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v2 0/4] ARC: handle DSP presence in HW

2020-03-05 Thread Eugeniy Paltsev
Arc processors may have DSP extension which is optional.
In this patch series we:
* Handle issues caused by DSP extension presence in HW
* Add optional support for DSP-enabled applications in
  userspace (with optional AGU extension support)

Changes v1->v2:
 * use r10:r11 register pair as a scratch for ASM code instead of
   r58:r59
 * reset DSP_CTRL to value suitable for kernel also in case of
   DSP for userspcae enabled
 * Use "Ir" instead of "I" parameter modifier to inline ASM
   to give compiler wiggle room.
 * Save / restore ACC0_GLO, ACC0_GHI only in case of context
   switch
 * Don't define additional options in headers to not introduce
   explicit include dependencies
 * Mode DSP config check to DSP code itself
 * Minor fixes

Eugeniy Paltsev (4):
  ARC: add helpers to sanitize config options
  ARC: handle DSP presence in HW
  ARC: add support for DSP-enabled userspace applications
  ARC: allow userspace DSP applications to use AGU extensions

 arch/arc/Kconfig   |  50 +-
 arch/arc/include/asm/arcregs.h |  26 +
 arch/arc/include/asm/asserts.h |  34 +++
 arch/arc/include/asm/dsp-impl.h| 150 +
 arch/arc/include/asm/dsp.h |  29 ++
 arch/arc/include/asm/entry-arcv2.h |   6 ++
 arch/arc/include/asm/processor.h   |   4 +
 arch/arc/include/asm/ptrace.h  |   3 +
 arch/arc/include/asm/switch_to.h   |   2 +
 arch/arc/kernel/asm-offsets.c  |   4 +
 arch/arc/kernel/head.S |   4 +
 arch/arc/kernel/setup.c|  34 ---
 12 files changed, 332 insertions(+), 14 deletions(-)
 create mode 100644 arch/arc/include/asm/asserts.h
 create mode 100644 arch/arc/include/asm/dsp-impl.h
 create mode 100644 arch/arc/include/asm/dsp.h

-- 
2.21.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v2 1/4] ARC: add helpers to sanitize config options

2020-03-05 Thread Eugeniy Paltsev
We'll use this macro in coming patches extensively.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/include/asm/asserts.h | 24 
 arch/arc/kernel/setup.c| 25 -
 2 files changed, 36 insertions(+), 13 deletions(-)
 create mode 100644 arch/arc/include/asm/asserts.h

diff --git a/arch/arc/include/asm/asserts.h b/arch/arc/include/asm/asserts.h
new file mode 100644
index ..3314efbeb528
--- /dev/null
+++ b/arch/arc/include/asm/asserts.h
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2020 Synopsys, Inc. (www.synopsys.com)
+ *
+ * Author: Eugeniy Paltsev 
+ */
+#ifndef __ASM_ARC_ASSERTS_H
+#define __ASM_ARC_ASSERTS_H
+
+/* Helpers to sanitize config options. */
+
+void chk_opt_strict(char *opt_name, bool hw_exists, bool opt_ena);
+
+/*
+ * Check required config option:
+ *  - panic in case of OPT enabled but corresponding HW absent.
+ *  - warn in case of OPT disabled but corresponding HW exists.
+*/
+#define CHK_OPT_STRICT(opt_name, hw_exists)\
+({ \
+   chk_opt_strict(#opt_name, hw_exists, IS_ENABLED(opt_name)); \
+})
+
+#endif /* __ASM_ARC_ASSERTS_H */
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index aa41af6ef4ac..820c0cfb0702 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -389,11 +390,18 @@ static char *arc_extn_mumbojumbo(int cpu_id, char *buf, 
int len)
return buf;
 }
 
+void chk_opt_strict(char *opt_name, bool hw_exists, bool opt_ena)
+{
+   if (hw_exists && !opt_ena)
+   pr_warn(" ! Enable %s for working apps\n", opt_name);
+   else if (!hw_exists && opt_ena)
+   panic("Disable %s, hardware NOT present\n", opt_name);
+}
+
 static void arc_chk_core_config(void)
 {
struct cpuinfo_arc *cpu = _arc700[smp_processor_id()];
-   int saved = 0, present = 0;
-   char *opt_nm = NULL;
+   int present = 0;
 
if (!cpu->extn.timer0)
panic("Timer0 is not present!\n");
@@ -425,23 +433,14 @@ static void arc_chk_core_config(void)
 */
 
if (is_isa_arcompact()) {
-   opt_nm = "CONFIG_ARC_FPU_SAVE_RESTORE";
-   saved = IS_ENABLED(CONFIG_ARC_FPU_SAVE_RESTORE);
-
/* only DPDP checked since SP has no arch visible regs */
present = cpu->extn.fpu_dp;
+   CHK_OPT_STRICT(CONFIG_ARC_FPU_SAVE_RESTORE, present);
} else {
-   opt_nm = "CONFIG_ARC_HAS_ACCL_REGS";
-   saved = IS_ENABLED(CONFIG_ARC_HAS_ACCL_REGS);
-
/* Accumulator Low:High pair (r58:59) present if DSP MPY or FPU 
*/
present = cpu->extn_mpy.dsp | cpu->extn.fpu_sp | 
cpu->extn.fpu_dp;
+   CHK_OPT_STRICT(CONFIG_ARC_HAS_ACCL_REGS, present);
}
-
-   if (present && !saved)
-   pr_warn("Enable %s for working apps\n", opt_nm);
-   else if (!present && saved)
-   panic("Disable %s, hardware NOT present\n", opt_nm);
 }
 
 /*
-- 
2.21.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v2 4/4] ARC: allow userspace DSP applications to use AGU extensions

2020-03-05 Thread Eugeniy Paltsev
To be able to run DSP-enabled userspace applications with AGU
(address generation unit) extensions we additionally need to
save and restore following registers at context switch:
 * AGU_AP*
 * AGU_OS*
 * AGU_MOD*

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/Kconfig|  9 +
 arch/arc/include/asm/arcregs.h  | 12 
 arch/arc/include/asm/asserts.h  | 10 ++
 arch/arc/include/asm/dsp-impl.h | 24 
 arch/arc/include/asm/dsp.h  |  5 +
 arch/arc/kernel/setup.c |  6 ++
 6 files changed, 66 insertions(+)

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index eb3bcb206882..ff306246d0f8 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -445,6 +445,15 @@ config ARC_DSP_USERSPACE
help
  DSP extension presence in HW, support save / restore DSP registers to
  run DSP-enabled userspace applications
+
+config ARC_DSP_AGU_USERSPACE
+   bool "Support DSP with AGU for userspace apps"
+   select ARC_HAS_ACCL_REGS
+   select ARC_DSP_HANDLED
+   select ARC_DSP_SAVE_RESTORE_REGS
+   help
+ DSP and AGU extensions presence in HW, support save / restore DSP
+ and AGU registers to run DSP-enabled userspace applications
 endchoice
 
 config ARC_IRQ_NO_AUTOSAVE
diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h
index aee1ee263065..2162023195c5 100644
--- a/arch/arc/include/asm/arcregs.h
+++ b/arch/arc/include/asm/arcregs.h
@@ -132,6 +132,18 @@
 #define ARC_AUX_DSP_CTRL   0x59F
 #define ARC_AUX_DSP_FFT_CTRL   0x59E
 
+#define ARC_AUX_AGU_BUILD  0xCC
+#define ARC_AUX_AGU_AP00x5C0
+#define ARC_AUX_AGU_AP10x5C1
+#define ARC_AUX_AGU_AP20x5C2
+#define ARC_AUX_AGU_AP30x5C3
+#define ARC_AUX_AGU_OS00x5D0
+#define ARC_AUX_AGU_OS10x5D1
+#define ARC_AUX_AGU_MOD0   0x5E0
+#define ARC_AUX_AGU_MOD1   0x5E1
+#define ARC_AUX_AGU_MOD2   0x5E2
+#define ARC_AUX_AGU_MOD3   0x5E3
+
 #ifndef __ASSEMBLY__
 
 #include 
diff --git a/arch/arc/include/asm/asserts.h b/arch/arc/include/asm/asserts.h
index 3314efbeb528..108f33be6aa5 100644
--- a/arch/arc/include/asm/asserts.h
+++ b/arch/arc/include/asm/asserts.h
@@ -10,6 +10,7 @@
 /* Helpers to sanitize config options. */
 
 void chk_opt_strict(char *opt_name, bool hw_exists, bool opt_ena);
+void chk_opt_weak(char *opt_name, bool hw_exists, bool opt_ena);
 
 /*
  * Check required config option:
@@ -21,4 +22,13 @@ void chk_opt_strict(char *opt_name, bool hw_exists, bool 
opt_ena);
chk_opt_strict(#opt_name, hw_exists, IS_ENABLED(opt_name)); \
 })
 
+/*
+ * Check optional config option:
+ *  - panic in case of OPT enabled but corresponding HW absent.
+*/
+#define CHK_OPT_WEAK(opt_name, hw_exists)  \
+({ \
+   chk_opt_weak(#opt_name, hw_exists, IS_ENABLED(opt_name));   \
+})
+
 #endif /* __ASM_ARC_ASSERTS_H */
diff --git a/arch/arc/include/asm/dsp-impl.h b/arch/arc/include/asm/dsp-impl.h
index 8380f7bede81..e1aa212ca6eb 100644
--- a/arch/arc/include/asm/dsp-impl.h
+++ b/arch/arc/include/asm/dsp-impl.h
@@ -103,6 +103,21 @@ static inline void dsp_save_restore(struct task_struct 
*prev,
 
DSP_AUX_SAVE_RESTORE(saveto, readfrom, DSP_BFLY0);
DSP_AUX_SAVE_RESTORE(saveto, readfrom, DSP_FFT_CTRL);
+
+#ifdef CONFIG_ARC_DSP_AGU_USERSPACE
+   DSP_AUX_SAVE_RESTORE(saveto, readfrom, AGU_AP0);
+   DSP_AUX_SAVE_RESTORE(saveto, readfrom, AGU_AP1);
+   DSP_AUX_SAVE_RESTORE(saveto, readfrom, AGU_AP2);
+   DSP_AUX_SAVE_RESTORE(saveto, readfrom, AGU_AP3);
+
+   DSP_AUX_SAVE_RESTORE(saveto, readfrom, AGU_OS0);
+   DSP_AUX_SAVE_RESTORE(saveto, readfrom, AGU_OS1);
+
+   DSP_AUX_SAVE_RESTORE(saveto, readfrom, AGU_MOD0);
+   DSP_AUX_SAVE_RESTORE(saveto, readfrom, AGU_MOD1);
+   DSP_AUX_SAVE_RESTORE(saveto, readfrom, AGU_MOD2);
+   DSP_AUX_SAVE_RESTORE(saveto, readfrom, AGU_MOD3);
+#endif /* CONFIG_ARC_DSP_AGU_USERSPACE */
 }
 
 #else /* !CONFIG_ARC_DSP_SAVE_RESTORE_REGS */
@@ -117,9 +132,18 @@ static inline bool dsp_exist(void)
return !!bcr.ver;
 }
 
+static inline bool agu_exist(void)
+{
+   struct bcr_generic bcr;
+
+   READ_BCR(ARC_AUX_AGU_BUILD, bcr);
+   return !!bcr.ver;
+}
+
 static inline void dsp_config_check(void)
 {
CHK_OPT_STRICT(CONFIG_ARC_DSP_HANDLED, dsp_exist());
+   CHK_OPT_WEAK(CONFIG_ARC_DSP_AGU_USERSPACE, agu_exist());
 }
 
 #endif /* __ASEMBLY__ */
diff --git a/arch/arc/include/asm/dsp.h b/arch/arc/include/asm/dsp.h
index b016f4d2a09f..202c78e56704 100644
--- a/arch/arc/include/asm/dsp.h
+++ b/arch/arc/include/asm/dsp.h
@@ -17,6 +17,11 @@
  */
 struct dsp_callee_regs {
unsigned long ACC0_GLO, ACC0_GHI, DSP_BFLY0, DSP_FFT_CTRL;
+#ifdef CONFIG_ARC_DSP_AGU_USERSPACE
+   unsigned long AGU_AP0, AGU_AP1, AGU_AP

[PATCH v2 2/4] ARC: handle DSP presence in HW

2020-03-05 Thread Eugeniy Paltsev
In case of DSP extension presence in HW some instructions
(related to integer multiply, multiply-accumulate, and divide
operation) executes on this DSP execution unit. So their
execution will depend on dsp configuration register (DSP_CTRL)

As we want these instructions to execute the same way regardless
of DSP presence we need to set DSP_CTRL properly. However this
register can be modified bu any usersace app therefore any
usersace may break kernel execution.

Fix that by configure DSP_CTRL in CPU early code and in IRQs
entries.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/Kconfig   | 29 +++-
 arch/arc/include/asm/arcregs.h | 12 +++
 arch/arc/include/asm/dsp-impl.h| 54 ++
 arch/arc/include/asm/entry-arcv2.h |  3 ++
 arch/arc/kernel/head.S |  4 +++
 arch/arc/kernel/setup.c|  3 ++
 6 files changed, 104 insertions(+), 1 deletion(-)
 create mode 100644 arch/arc/include/asm/dsp-impl.h

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 7124ab82dfa3..55432a8fc20d 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -401,13 +401,40 @@ config ARC_HAS_DIV_REM
default y
 
 config ARC_HAS_ACCL_REGS
-   bool "Reg Pair ACCL:ACCH (FPU and/or MPY > 6)"
+   bool "Reg Pair ACCL:ACCH (FPU and/or MPY > 6 and/or DSP)"
default y
help
  Depending on the configuration, CPU can contain accumulator reg-pair
  (also referred to as r58:r59). These can also be used by gcc as GPR so
  kernel needs to save/restore per process
 
+config ARC_DSP_HANDLED
+   def_bool n
+
+choice
+   prompt "DSP support"
+   default ARC_DSP_NONE
+   help
+ Depending on the configuration, CPU can contain DSP registers
+ (ACC0_GLO, ACC0_GHI, DSP_BFLY0, DSP_CTRL, DSP_FFT_CTRL).
+ Bellow is options describing how to handle these registers in
+ interrupt entry / exit and in context switch.
+
+config ARC_DSP_NONE
+   bool "No DSP extension presence in HW"
+   help
+ No DSP extension presence in HW
+
+config ARC_DSP_KERNEL
+   bool "DSP extension in HW, no support for userspace"
+   select ARC_HAS_ACCL_REGS
+   select ARC_DSP_HANDLED
+   help
+ DSP extension presence in HW, no support for DSP-enabled userspace
+ applications. We don't save / restore DSP registers and only do
+ some minimal preparations so userspace won't be able to break kernel
+endchoice
+
 config ARC_IRQ_NO_AUTOSAVE
bool "Disable hardware autosave regfile on interrupts"
default n
diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h
index f7e432448e4b..135f6ec08a69 100644
--- a/arch/arc/include/asm/arcregs.h
+++ b/arch/arc/include/asm/arcregs.h
@@ -118,6 +118,18 @@
 #define ARC_AUX_DPFP_2H 0x304
 #define ARC_AUX_DPFP_STAT   0x305
 
+/*
+ * DSP-related registers
+ */
+#define ARC_AUX_DSP_BUILD  0x7A
+#define ARC_AUX_ACC0_LO0x580
+#define ARC_AUX_ACC0_GLO   0x581
+#define ARC_AUX_ACC0_HI0x582
+#define ARC_AUX_ACC0_GHI   0x583
+#define ARC_AUX_DSP_BFLY0  0x598
+#define ARC_AUX_DSP_CTRL   0x59F
+#define ARC_AUX_DSP_FFT_CTRL   0x59E
+
 #ifndef __ASSEMBLY__
 
 #include 
diff --git a/arch/arc/include/asm/dsp-impl.h b/arch/arc/include/asm/dsp-impl.h
new file mode 100644
index ..606620383eca
--- /dev/null
+++ b/arch/arc/include/asm/dsp-impl.h
@@ -0,0 +1,54 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2020 Synopsys, Inc. (www.synopsys.com)
+ *
+ * Author: Eugeniy Paltsev 
+ */
+#ifndef __ASM_ARC_DSP_IMPL_H
+#define __ASM_ARC_DSP_IMPL_H
+
+#define DSP_CTRL_DISABLED_ALL  0
+
+#ifdef __ASSEMBLY__
+
+/* clobbers r5 register */
+.macro DSP_EARLY_INIT
+   lr  r5, [ARC_AUX_DSP_BUILD]
+   bmskr5, r5, 7
+   breqr5, 0, 1f
+   mov r5, DSP_CTRL_DISABLED_ALL
+   sr  r5, [ARC_AUX_DSP_CTRL]
+1:
+.endm
+
+/* clobbers r10, r11 registers pair */
+.macro DSP_SAVE_REGFILE_IRQ
+#if defined(CONFIG_ARC_DSP_KERNEL)
+   /*
+* Drop any changes to DSP_CTRL made by userspace so userspace won't be
+* able to break kernel - reset it to DSP_CTRL_DISABLED_ALL value
+*/
+   mov r10, DSP_CTRL_DISABLED_ALL
+   sr  r10, [ARC_AUX_DSP_CTRL]
+#endif /* ARC_DSP_KERNEL */
+.endm
+
+#else /* __ASEMBLY__ */
+
+#include 
+
+static inline bool dsp_exist(void)
+{
+   struct bcr_generic bcr;
+
+   READ_BCR(ARC_AUX_DSP_BUILD, bcr);
+   return !!bcr.ver;
+}
+
+static inline void dsp_config_check(void)
+{
+   CHK_OPT_STRICT(CONFIG_ARC_DSP_HANDLED, dsp_exist());
+}
+
+#endif /* __ASEMBLY__ */
+#endif /* __ASM_ARC_DSP_IMPL_H */
diff --git a/arch/arc/include/asm/entry-arcv2.h 
b/arch/arc/include/asm/entry-arcv2.h
index 0b8b63d0bec1..dd6aa18b51ca 100644
--- a/arch/arc/include/asm/e

[PATCH v2 3/4] ARC: add support for DSP-enabled userspace applications

2020-03-05 Thread Eugeniy Paltsev
To be able to run DSP-enabled userspace applications we need to
save and restore following DSP-related registers:
At IRQ/exception entry/exit:
 * DSP_CTRL (save it and reset to value suitable for kernel)
 * ACC0_LO, ACC0_HI (we already save them as r58, r59 pair)
At context switch:
 * ACC0_GLO, ACC0_GHI
 * DSP_BFLY0, DSP_FFT_CTRL

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/Kconfig   | 12 +
 arch/arc/include/asm/arcregs.h |  2 +
 arch/arc/include/asm/dsp-impl.h| 74 +-
 arch/arc/include/asm/dsp.h | 24 ++
 arch/arc/include/asm/entry-arcv2.h |  3 ++
 arch/arc/include/asm/processor.h   |  4 ++
 arch/arc/include/asm/ptrace.h  |  3 ++
 arch/arc/include/asm/switch_to.h   |  2 +
 arch/arc/kernel/asm-offsets.c  |  4 ++
 9 files changed, 127 insertions(+), 1 deletion(-)
 create mode 100644 arch/arc/include/asm/dsp.h

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 55432a8fc20d..eb3bcb206882 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -411,6 +411,9 @@ config ARC_HAS_ACCL_REGS
 config ARC_DSP_HANDLED
def_bool n
 
+config ARC_DSP_SAVE_RESTORE_REGS
+   def_bool n
+
 choice
prompt "DSP support"
default ARC_DSP_NONE
@@ -433,6 +436,15 @@ config ARC_DSP_KERNEL
  DSP extension presence in HW, no support for DSP-enabled userspace
  applications. We don't save / restore DSP registers and only do
  some minimal preparations so userspace won't be able to break kernel
+
+config ARC_DSP_USERSPACE
+   bool "Support DSP for userspace apps"
+   select ARC_HAS_ACCL_REGS
+   select ARC_DSP_HANDLED
+   select ARC_DSP_SAVE_RESTORE_REGS
+   help
+ DSP extension presence in HW, support save / restore DSP registers to
+ run DSP-enabled userspace applications
 endchoice
 
 config ARC_IRQ_NO_AUTOSAVE
diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h
index 135f6ec08a69..aee1ee263065 100644
--- a/arch/arc/include/asm/arcregs.h
+++ b/arch/arc/include/asm/arcregs.h
@@ -120,6 +120,8 @@
 
 /*
  * DSP-related registers
+ * Registers names must correspond to dsp_callee_regs structure fields names
+ * for automatic offset calculation in DSP_AUX_SAVE_RESTORE macros.
  */
 #define ARC_AUX_DSP_BUILD  0x7A
 #define ARC_AUX_ACC0_LO0x580
diff --git a/arch/arc/include/asm/dsp-impl.h b/arch/arc/include/asm/dsp-impl.h
index 606620383eca..8380f7bede81 100644
--- a/arch/arc/include/asm/dsp-impl.h
+++ b/arch/arc/include/asm/dsp-impl.h
@@ -7,6 +7,8 @@
 #ifndef __ASM_ARC_DSP_IMPL_H
 #define __ASM_ARC_DSP_IMPL_H
 
+#include 
+
 #define DSP_CTRL_DISABLED_ALL  0
 
 #ifdef __ASSEMBLY__
@@ -30,12 +32,82 @@
 */
mov r10, DSP_CTRL_DISABLED_ALL
sr  r10, [ARC_AUX_DSP_CTRL]
-#endif /* ARC_DSP_KERNEL */
+
+#elif defined(CONFIG_ARC_DSP_SAVE_RESTORE_REGS)
+   /*
+* Save DSP_CTRL register and reset it to value suitable for kernel
+* (DSP_CTRL_DISABLED_ALL)
+*/
+   mov r10, DSP_CTRL_DISABLED_ALL
+   aex r10, [ARC_AUX_DSP_CTRL]
+   st  r10, [sp, PT_DSP_CTRL]
+
+#endif
+.endm
+
+/* clobbers r10, r11 registers pair */
+.macro DSP_RESTORE_REGFILE_IRQ
+#if defined(CONFIG_ARC_DSP_SAVE_RESTORE_REGS)
+   ld  r10, [sp, PT_DSP_CTRL]
+   sr  r10, [ARC_AUX_DSP_CTRL]
+
+#endif
 .endm
 
 #else /* __ASEMBLY__ */
 
+#include 
 #include 
+#include 
+
+#ifdef CONFIG_ARC_DSP_SAVE_RESTORE_REGS
+
+/*
+ * As we save new and restore old AUX register value in the same place we
+ * can optimize a bit and use AEX instruction (swap contents of an auxiliary
+ * register with a core register) instead of LR + SR pair.
+ */
+#define AUX_SAVE_RESTORE(_saveto, _readfrom, _offt, _aux)  \
+do {   \
+   long unsigned int _scratch; \
+   \
+   __asm__ __volatile__(   \
+   "ld %0, [%2, %4]\n" \
+   "aex%0, [%3]\n" \
+   "st %0, [%1, %4]\n" \
+   :   \
+ "=" (_scratch)  /* must be early clobber */ \
+   :   \
+  "r" (_saveto),   \
+  "r" (_readfrom), \
+  "Ir" (_aux), \
+  "Ir" (_offt) \

Re: [PATCH 4/5] ARC: add support for DSP-enabled userspace applications

2020-03-04 Thread Eugeniy Paltsev
Hi Vineet,

>From: Vineet Gupta 
>Sent: Tuesday, January 7, 2020 21:25
>To: Eugeniy Paltsev; linux-snps-arc@lists.infradead.org
>Cc: linux-ker...@vger.kernel.org; Alexey Brodkin
>Subject: Re: [PATCH 4/5] ARC: add support for DSP-enabled userspace 
>applications
>> +/*
>> + * As we save new and restore old AUX register value in the same place we
>> + * can optimize a bit and use AEX instruction (swap contents of an auxiliary
>> + * register with a core register) instead of LR + SR pair.
>> + */
>> +#define AUX_SAVE_RESTORE(_saveto, _readfrom, _offt, _aux, _scratch)  \
>> +do { \
>> + __asm__ __volatile__(   \
>> + "ld %0, [%2, %4]\n" \
>> + "aex%0, [%3]\n" \
>> + "st %0, [%1, %4]\n" \
>> + :   \
>> +   "=" (_scratch)  /* must be early clobber */ \
>> + :   \
>> +"r" (_saveto),   \
>> +"r" (_readfrom), \
>> +"I" (_aux),  \
>> +"I" (_offt)  \
>> + :   \
>
>AEX with "I" constraint will likely be an 8 byte instructions always. Best to 
>give
>compiler wiggle room with "Ir"

Could you please explain how "Ir" will work in this case?
Does this mean that compiler can pass the value either as constant ('I') or
via register ('r')?

Note that in this case both _aux and _offt are compile-time constants -
_aux comes from define and _offt comes from offsetof().

>> +   "memory"  \
>> + );  \
>> +} while (0)
>> +
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH] ARC: rework setting of ARC CPU specific compiler options

2020-02-12 Thread Eugeniy Paltsev
It's a very rare if at all existing occasion when ARC CPU template
is used as is w/o any changes - in the end it's a beauty and competitive
advantage of ARC cores to be tailored for a particular use-case - and
so it doesn't make a lot of sense to offer template-based "-mcpu" selection.
Given for each and every platform we end-up adding quite a few more flags
it's logical to move "-mcpu" selection to platform's definition as well
which we exactly do here.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/config.mk  | 20 
 board/abilis/tb100/config.mk|  5 +
 board/synopsys/axs10x/config.mk |  6 ++
 board/synopsys/emsdp/config.mk  |  2 +-
 board/synopsys/hsdk/config.mk   |  4 
 board/synopsys/iot_devkit/config.mk |  3 ++-
 board/synopsys/nsim/Kconfig |  9 +
 board/synopsys/nsim/config.mk   |  8 
 configs/nsim_700_defconfig  |  1 +
 configs/nsim_700be_defconfig|  1 +
 configs/nsim_hs38_defconfig |  1 +
 configs/nsim_hs38be_defconfig   |  1 +
 12 files changed, 39 insertions(+), 22 deletions(-)
 create mode 100644 board/abilis/tb100/config.mk
 create mode 100644 board/synopsys/nsim/config.mk

diff --git a/arch/arc/config.mk b/arch/arc/config.mk
index 18005d99930..6fa29adae81 100644
--- a/arch/arc/config.mk
+++ b/arch/arc/config.mk
@@ -22,26 +22,6 @@ ifdef CONFIG_ARC_MMU_VER
 CONFIG_MMU = 1
 endif
 
-ifdef CONFIG_CPU_ARC750D
-PLATFORM_CPPFLAGS += -mcpu=arc700
-endif
-
-ifdef CONFIG_CPU_ARC770D
-PLATFORM_CPPFLAGS += -mcpu=arc700 -mlock -mswape
-endif
-
-ifdef CONFIG_CPU_ARCEM6
-PLATFORM_CPPFLAGS += -mcpu=arcem
-endif
-
-ifdef CONFIG_CPU_ARCHS34
-PLATFORM_CPPFLAGS += -mcpu=archs
-endif
-
-ifdef CONFIG_CPU_ARCHS38
-PLATFORM_CPPFLAGS += -mcpu=archs
-endif
-
 PLATFORM_CPPFLAGS += -ffixed-r25 -D__ARC__ -gdwarf-2 -mno-sdata
 PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections -fno-common
 
diff --git a/board/abilis/tb100/config.mk b/board/abilis/tb100/config.mk
new file mode 100644
index 000..9e8dee49bd3
--- /dev/null
+++ b/board/abilis/tb100/config.mk
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2020 Synopsys, Inc. All rights reserved.
+
+PLATFORM_CPPFLAGS += -mcpu=arc700 -mlock -mswape
diff --git a/board/synopsys/axs10x/config.mk b/board/synopsys/axs10x/config.mk
index 81ff498f818..ccac5442908 100644
--- a/board/synopsys/axs10x/config.mk
+++ b/board/synopsys/axs10x/config.mk
@@ -2,6 +2,12 @@
 #
 # Copyright (C) 2018 Synopsys, Inc. All rights reserved.
 
+ifdef CONFIG_TARGET_AXS103
+  PLATFORM_CPPFLAGS += -mcpu=archs
+else
+  PLATFORM_CPPFLAGS += -mcpu=arc700 -mlock -mswape
+endif
+
 bsp-generate: u-boot u-boot.bin
 ifdef CONFIG_ISA_ARCV2
$(Q)python3 $(srctree)/board/$(BOARDDIR)/headerize-axs.py \
diff --git a/board/synopsys/emsdp/config.mk b/board/synopsys/emsdp/config.mk
index 67fd7bf82a3..5bd10442aff 100644
--- a/board/synopsys/emsdp/config.mk
+++ b/board/synopsys/emsdp/config.mk
@@ -1,2 +1,2 @@
-PLATFORM_CPPFLAGS += -mlittle-endian -mnorm -mswap -mmpy-option=3 \
+PLATFORM_CPPFLAGS += -mcpu=arcem -mlittle-endian -mnorm -mswap -mmpy-option=3 \
  -mbarrel-shifter -mfpu=fpuda_all -mcode-density
diff --git a/board/synopsys/hsdk/config.mk b/board/synopsys/hsdk/config.mk
index 9e280f921a1..5ae22fa2b75 100644
--- a/board/synopsys/hsdk/config.mk
+++ b/board/synopsys/hsdk/config.mk
@@ -2,6 +2,10 @@
 #
 # Copyright (C) 2018 Synopsys, Inc. All rights reserved.
 
+PLATFORM_CPPFLAGS += -mcpu=hs38_linux -mlittle-endian -matomic -mll64 \
+ -mdiv-rem -mswap -mnorm -mmpy-option=9 -mbarrel-shifter \
+ -mfpu=fpud_all
+
 bsp-generate: u-boot u-boot.bin
$(Q)python3 $(srctree)/board/$(BOARDDIR)/headerize-hsdk.py \
--arc-id 0x52 --image $(srctree)/u-boot.bin \
diff --git a/board/synopsys/iot_devkit/config.mk 
b/board/synopsys/iot_devkit/config.mk
index 120733538a4..e1e546a3d04 100644
--- a/board/synopsys/iot_devkit/config.mk
+++ b/board/synopsys/iot_devkit/config.mk
@@ -1,2 +1,3 @@
-PLATFORM_CPPFLAGS += -mlittle-endian -mcode-density -mdiv-rem -mswap -mnorm 
-mmpy-option=6 -mbarrel-shifter
+PLATFORM_CPPFLAGS += -mcpu=em4_fpuda -mlittle-endian -mcode-density -mdiv-rem \
+ -mswap -mnorm -mmpy-option=6 -mbarrel-shifter
 LDSCRIPT = $(srctree)/board/synopsys/iot_devkit/u-boot.lds
diff --git a/board/synopsys/nsim/Kconfig b/board/synopsys/nsim/Kconfig
index 22287032bf5..b6966b2991e 100644
--- a/board/synopsys/nsim/Kconfig
+++ b/board/synopsys/nsim/Kconfig
@@ -9,4 +9,13 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "nsim"
 
+config NSIM_BOARD_CPPFLAGS
+   string "board arc-specific compiler options"
+   help
+ For nSIM we allow to set custom arc-specific compiler options
+ (like -mcpu=) instead of hardcoding them in its makefile as nSIM
+ target is used for representing targets without fix

[PATCH 2/2] CLK: HSDK: fix HDMI clock calculation

2020-01-29 Thread Eugeniy Paltsev
HDMI PLL has its own xtal with 27 MHz output but we treat it the same
way as other PLLs with 33.33 MHz input.
Fix that.

Signed-off-by: Eugeniy Paltsev 
---
 drivers/clk/clk-hsdk-cgu.c | 31 +--
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/drivers/clk/clk-hsdk-cgu.c b/drivers/clk/clk-hsdk-cgu.c
index 69e6b24b66c..4637b9fdf15 100644
--- a/drivers/clk/clk-hsdk-cgu.c
+++ b/drivers/clk/clk-hsdk-cgu.c
@@ -46,17 +46,21 @@
  *||-->|CGU_TUN_IDIV_ROM|--->
  *||-->|CGU_TUN_IDIV_PWM|--->
  *|
- *|   
- *|-->| HDMI PLL |
- *|   
- *||
- *||-->|CGU_HDMI_IDIV_APB|-->
- *|
  *|   ---
  *|-->| DDR PLL |
  *---
  * |
  * |>
+ *
+ *   --
+ *   | 27.00 MHz xtal |
+ *   --
+ *|
+ *|   
+ *|-->| HDMI PLL |
+ *
+ * |
+ * |-->|CGU_HDMI_IDIV_APB|-->
  */
 
 #define CGU_ARC_IDIV   0x080
@@ -117,7 +121,8 @@
 #define CREG_CORE_IF_CLK_DIV_2 0x1
 
 #define MIN_PLL_RATE   1 /* 100 MHz */
-#define PARENT_RATE /* fixed clock - xtal */
+#define PARENT_RATE_33  /* fixed clock - xtal */
+#define PARENT_RATE_27 2700 /* fixed clock - xtal */
 #define CGU_MAX_CLOCKS 26
 
 #define CGU_SYS_CLOCKS 16
@@ -237,6 +242,7 @@ struct hsdk_cgu_clk {
 };
 
 struct hsdk_pll_devdata {
+   const u32 parent_rate;
const struct hsdk_pll_cfg *pll_cfg;
int (*update_rate)(struct hsdk_cgu_clk *clk, unsigned long rate,
   const struct hsdk_pll_cfg *cfg);
@@ -248,16 +254,19 @@ static int hsdk_pll_comm_update_rate(struct hsdk_cgu_clk 
*, unsigned long,
 const struct hsdk_pll_cfg *);
 
 static const struct hsdk_pll_devdata core_pll_dat = {
+   .parent_rate = PARENT_RATE_33,
.pll_cfg = asdt_pll_cfg,
.update_rate = hsdk_pll_core_update_rate,
 };
 
 static const struct hsdk_pll_devdata sdt_pll_dat = {
+   .parent_rate = PARENT_RATE_33,
.pll_cfg = asdt_pll_cfg,
.update_rate = hsdk_pll_comm_update_rate,
 };
 
 static const struct hsdk_pll_devdata hdmi_pll_dat = {
+   .parent_rate = PARENT_RATE_27,
.pll_cfg = hdmi_pll_cfg,
.update_rate = hsdk_pll_comm_update_rate,
 };
@@ -372,6 +381,7 @@ static ulong pll_get(struct clk *sclk)
u64 rate;
u32 idiv, fbdiv, odiv;
struct hsdk_cgu_clk *clk = dev_get_priv(sclk->dev);
+   u32 parent_rate = clk->pll_devdata->parent_rate;
 
val = hsdk_pll_read(clk, CGU_PLL_CTRL);
 
@@ -379,7 +389,7 @@ static ulong pll_get(struct clk *sclk)
 
/* Check if PLL is bypassed */
if (val & CGU_PLL_CTRL_BYPASS)
-   return PARENT_RATE;
+   return parent_rate;
 
/* Check if PLL is disabled */
if (val & CGU_PLL_CTRL_PD)
@@ -392,7 +402,7 @@ static ulong pll_get(struct clk *sclk)
/* output divider = 2^(reg.odiv) */
odiv = 1 << ((val & CGU_PLL_CTRL_ODIV_MASK) >> CGU_PLL_CTRL_ODIV_SHIFT);
 
-   rate = (u64)PARENT_RATE * fbdiv;
+   rate = (u64)parent_rate * fbdiv;
do_div(rate, idiv * odiv);
 
return rate;
@@ -490,7 +500,8 @@ static ulong pll_set(struct clk *sclk, ulong rate)
}
}
 
-   pr_err("invalid rate=%ld Hz, parent_rate=%d Hz\n", best_rate, 
PARENT_RATE);
+   pr_err("invalid rate=%ld Hz, parent_rate=%d Hz\n", best_rate,
+  clk->pll_devdata->parent_rate);
 
return -EINVAL;
 }
-- 
2.21.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 1/2] CLK: HSDK: Check for PLL bypass firstly

2020-01-29 Thread Eugeniy Paltsev
Pll bypass has priority over enable/disable.

Signed-off-by: Eugeniy Paltsev 
---
 drivers/clk/clk-hsdk-cgu.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/clk-hsdk-cgu.c b/drivers/clk/clk-hsdk-cgu.c
index 56ef08c032b..69e6b24b66c 100644
--- a/drivers/clk/clk-hsdk-cgu.c
+++ b/drivers/clk/clk-hsdk-cgu.c
@@ -377,14 +377,14 @@ static ulong pll_get(struct clk *sclk)
 
pr_debug("current configurarion: %#x\n", val);
 
-   /* Check if PLL is disabled */
-   if (val & CGU_PLL_CTRL_PD)
-   return 0;
-
/* Check if PLL is bypassed */
if (val & CGU_PLL_CTRL_BYPASS)
return PARENT_RATE;
 
+   /* Check if PLL is disabled */
+   if (val & CGU_PLL_CTRL_PD)
+   return 0;
+
/* input divider = reg.idiv + 1 */
idiv = 1 + ((val & CGU_PLL_CTRL_IDIV_MASK) >> CGU_PLL_CTRL_IDIV_SHIFT);
/* fb divider = 2*(reg.fbdiv + 1) */
-- 
2.21.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 3/5] ARC: handle DSP presence in HW

2020-01-10 Thread Eugeniy Paltsev
Hi Vineet,

>From: Vineet Gupta 
>Sent: Tuesday, January 7, 2020 04:03
>To: Eugeniy Paltsev; linux-snps-arc@lists.infradead.org
>Cc: linux-ker...@vger.kernel.org; Alexey Brodkin
>Subject: Re: [PATCH 3/5] ARC: handle DSP presence in HW
>[snip]
>> +static inline bool dsp_exist(void)
>> +{
>> + struct bcr_generic bcr;
>> +
>> + READ_BCR(ARC_AUX_DSP_BUILD, bcr);
>> + return !!bcr.ver;
>
>open code these use once / one liners in the call site itself.
>
>>
>> @@ -444,6 +445,9 @@ static void arc_chk_core_config(void)
>>   /* Accumulator Low:High pair (r58:59) present if DSP MPY or 
>> FPU */
>>   present = cpu->extn_mpy.dsp | cpu->extn.fpu_sp | 
>> cpu->extn.fpu_dp;
>>   CHK_OPT_STRICT(CONFIG_ARC_HAS_ACCL_REGS, present);
>> +
>> + present = dsp_exist();
>
>Open code as suggested above.
>
>> + CHK_OPT_STRICT(CONFIG_ARC_DSP_KERNEL, present);
>>   }

My idea here is to encapsulate implementation of everything dsp-related in the
file with dsp code. So I'm even thinking about moving the config check itself
to some function like
'arc_chk_dsp_config' which will be located in dsp.x file
and call it from arc_chk_core_config in setup.c

This requires to move config check helpers to separate file/header from the 
setup.c
However this allows encapsulate all DSP code (and some new subsystems code 
later on) in its files instead of spread it across the arc code.

What do you think about it? If you really dislike this idea I can drop it.
---
 Eugeniy Paltsev

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 4/5] ARC: add support for DSP-enabled userspace applications

2020-01-09 Thread Eugeniy Paltsev
Hi Vineet,

>From: Vineet Gupta 
>On 12/27/19 10:03 AM, Eugeniy Paltsev wrote:
>> To be able to run DSP-enabled userspace applications we need to
>> save and restore following DSP-related registers:
>> At IRQ/exception entry/exit:
>>  * ACC0_GLO, ACC0_GHI, DSP_CTRL
>>  * ACC0_LO, ACC0_HI (we already save them as r58, r59 pair)
>> At context switch:
>>  * DSP_BFLY0, DSP_FFT_CTRL
[snip]
>> +
>> +#ifndef __ASSEMBLY__
>> +
>> +/* some defines to simplify config sanitize in kernel/setup.c */
>> +#if defined(CONFIG_ARC_DSP_KERNEL)|| \
>> +defined(CONFIG_ARC_DSP_USERSPACE)
>> +#define ARC_DSP_HANDLED  1
>> +#else
>> +#define ARC_DSP_HANDLED  0
>> +#endif
>
>This is a really bad idea - u r introducing explicit include dependencies which
>can change even outside of arch changes !
>We've dealt with enough of these problems with current.h, so best to avoid, 
>even
>if there is some code clutter.

Hmm, would it be OK if I add this option as a private kconfig option?
I.E (for ARC_DSP_HANDLED):

>8--
config ARC_DSP_HANDLED
def_bool n

choice
prompt "DSP support"
default ARC_DSP_NONE
help
  Depending on the configuration, CPU can contain DSP registers
  (ACC0_GLO, ACC0_GHI, DSP_BFLY0, DSP_CTRL, DSP_FFT_CTRL).
  Bellow is options describing how to handle these registers in
  interrupt entry / exit and in context switch.

config ARC_DSP_NONE
bool "No DSP extension presence in HW"
help
  No DSP extension presence in HW

config ARC_DSP_KERNEL
bool "DSP extension in HW, no support for userspace"
select ARC_HAS_ACCL_REGS
select ARC_DSP_HANDLED
help
  DSP extension presence in HW, no support for DSP-enabled userspace
  applications. We don't save / restore DSP registers and only do
  some minimal preparations so userspace won't be able to break kernel

config ARC_DSP_USERSPACE
bool "Support DSP for userspace apps"
select ARC_HAS_ACCL_REGS
select ARC_DSP_HANDLED
help
  DSP extension presence in HW, support save / restore DSP registers to
  run DSP-enabled userspace applications
endchoice
>8--

---
 Eugeniy Paltsev
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 5/5] ARC: allow userspace DSP applications to use AGU extensions

2019-12-27 Thread Eugeniy Paltsev
To be able to run DSP-enabled userspace applications with AGU
(address generation unit) extensions we additionally need to
save and restore following registers at context switch:
 * AGU_AP*
 * AGU_OS*
 * AGU_MOD*

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/Kconfig|  7 +++
 arch/arc/include/asm/arcregs.h  | 12 
 arch/arc/include/asm/dsp-impl.h | 23 +++
 arch/arc/include/asm/dsp.h  | 12 ++--
 arch/arc/kernel/setup.c | 14 ++
 5 files changed, 66 insertions(+), 2 deletions(-)

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index c3210754a3d2..c27bb7900ebd 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -439,6 +439,13 @@ config ARC_DSP_USERSPACE
help
  DSP extension presence in HW, support save / restore DSP registers to
  run DSP-enabled userspace applications
+
+config ARC_DSP_AGU_USERSPACE
+   bool "Support DSP with AGU for userspace apps"
+   select ARC_HAS_ACCL_REGS
+   help
+ DSP and AGU extensions presence in HW, support save / restore DSP
+ and AGU registers to run DSP-enabled userspace applications
 endchoice
 
 config ARC_IRQ_NO_AUTOSAVE
diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h
index a713819cab3c..9f6abed8a336 100644
--- a/arch/arc/include/asm/arcregs.h
+++ b/arch/arc/include/asm/arcregs.h
@@ -130,6 +130,18 @@
 #define ARC_AUX_DSP_CTRL   0x59F
 #define ARC_AUX_DSP_FFT_CTRL   0x59E
 
+#define ARC_AUX_AGU_BUILD  0xCC
+#define ARC_AUX_AGU_AP00x5C0
+#define ARC_AUX_AGU_AP10x5C1
+#define ARC_AUX_AGU_AP20x5C2
+#define ARC_AUX_AGU_AP30x5C3
+#define ARC_AUX_AGU_OS00x5D0
+#define ARC_AUX_AGU_OS10x5D1
+#define ARC_AUX_AGU_MOD0   0x5E0
+#define ARC_AUX_AGU_MOD1   0x5E1
+#define ARC_AUX_AGU_MOD2   0x5E2
+#define ARC_AUX_AGU_MOD3   0x5E3
+
 #ifndef __ASSEMBLY__
 
 #include 
diff --git a/arch/arc/include/asm/dsp-impl.h b/arch/arc/include/asm/dsp-impl.h
index 7b640a680dfc..d352be2d9f07 100644
--- a/arch/arc/include/asm/dsp-impl.h
+++ b/arch/arc/include/asm/dsp-impl.h
@@ -100,6 +100,21 @@ static inline void arc_dsp_save_restore(struct task_struct 
*prev,
 
DSP_AUX_SAVE_RESTORE(saveto, readfrom, DSP_BFLY0, zero);
DSP_AUX_SAVE_RESTORE(saveto, readfrom, DSP_FFT_CTRL, zero);
+
+#ifdef CONFIG_ARC_DSP_AGU_USERSPACE
+   DSP_AUX_SAVE_RESTORE(saveto, readfrom, AGU_AP0, zero);
+   DSP_AUX_SAVE_RESTORE(saveto, readfrom, AGU_AP1, zero);
+   DSP_AUX_SAVE_RESTORE(saveto, readfrom, AGU_AP2, zero);
+   DSP_AUX_SAVE_RESTORE(saveto, readfrom, AGU_AP3, zero);
+
+   DSP_AUX_SAVE_RESTORE(saveto, readfrom, AGU_OS0, zero);
+   DSP_AUX_SAVE_RESTORE(saveto, readfrom, AGU_OS1, zero);
+
+   DSP_AUX_SAVE_RESTORE(saveto, readfrom, AGU_MOD0, zero);
+   DSP_AUX_SAVE_RESTORE(saveto, readfrom, AGU_MOD1, zero);
+   DSP_AUX_SAVE_RESTORE(saveto, readfrom, AGU_MOD2, zero);
+   DSP_AUX_SAVE_RESTORE(saveto, readfrom, AGU_MOD3, zero);
+#endif /* CONFIG_ARC_DSP_AGU_USERSPACE */
 }
 
 #else /* !ARC_DSP_SAVE_RESTORE_REGS */
@@ -114,5 +129,13 @@ static inline bool dsp_exist(void)
return !!bcr.ver;
 }
 
+static inline bool agu_exist(void)
+{
+   struct bcr_generic bcr;
+
+   READ_BCR(ARC_AUX_AGU_BUILD, bcr);
+   return !!bcr.ver;
+}
+
 #endif /* __ASEMBLY__ */
 #endif /* __ASM_ARC_DSP_IMPL_H */
diff --git a/arch/arc/include/asm/dsp.h b/arch/arc/include/asm/dsp.h
index 68507f04dea4..1619cf9c6d28 100644
--- a/arch/arc/include/asm/dsp.h
+++ b/arch/arc/include/asm/dsp.h
@@ -7,7 +7,7 @@
 #ifndef __ASM_ARC_DSP_H
 #define __ASM_ARC_DSP_H
 
-#if defined(CONFIG_ARC_DSP_USERSPACE)
+#if defined(CONFIG_ARC_DSP_USERSPACE) || defined(CONFIG_ARC_DSP_AGU_USERSPACE)
 #define ARC_DSP_SAVE_RESTORE_REGS  1
 #endif
 
@@ -15,7 +15,8 @@
 
 /* some defines to simplify config sanitize in kernel/setup.c */
 #if defined(CONFIG_ARC_DSP_KERNEL) || \
-defined(CONFIG_ARC_DSP_USERSPACE)
+defined(CONFIG_ARC_DSP_USERSPACE)  || \
+defined(CONFIG_ARC_DSP_AGU_USERSPACE)
 #define ARC_DSP_HANDLED1
 #else
 #define ARC_DSP_HANDLED0
@@ -23,6 +24,8 @@
 
 #if defined(CONFIG_ARC_DSP_USERSPACE)
 #define ARC_DSP_OPT_NAME   "CONFIG_ARC_DSP_USERSPACE"
+#elif defined(CONFIG_ARC_DSP_AGU_USERSPACE)
+#define ARC_DSP_OPT_NAME   "CONFIG_ARC_DSP_AGU_USERSPACE"
 #else
 #define ARC_DSP_OPT_NAME   "CONFIG_ARC_DSP_KERNEL"
 #endif
@@ -35,6 +38,11 @@
  */
 struct dsp_callee_regs {
unsigned long DSP_BFLY0, DSP_FFT_CTRL;
+#ifdef CONFIG_ARC_DSP_AGU_USERSPACE
+   unsigned long AGU_AP0, AGU_AP1, AGU_AP2, AGU_AP3;
+   unsigned long AGU_OS0, AGU_OS1;
+   unsigned long AGU_MOD0, AGU_MOD1, AGU_MOD2, AGU_MOD3;
+#endif
 };
 
 #endif /* !__ASSEMBLY__ */
diff --git a/arch/arc/kernel/setup.c b/ar

[RFC 0/5] ARC: handle DSP presence in HW

2019-12-27 Thread Eugeniy Paltsev
Arc processors may have DSP extension which is optional.
In this patch series we:
* Handle issues caused by DSP extension presence in HW
* Add optional support for DSP-enabled applications in
  userspace (with optional AGU extension support)
* Do minor cleanups

Eugeniy Paltsev (5):
  ARC: pt_regs: remove hardcoded registers offset
  ARC: add helpers to sanitize config options
  ARC: handle DSP presence in HW
  ARC: add support for DSP-enabled userspace applications
  ARC: allow userspace DSP applications to use AGU extensions

 arch/arc/Kconfig   |  39 +++-
 arch/arc/include/asm/arcregs.h |  26 ++
 arch/arc/include/asm/dsp-impl.h| 141 +
 arch/arc/include/asm/dsp.h |  50 ++
 arch/arc/include/asm/entry-arcv2.h |  14 ++-
 arch/arc/include/asm/processor.h   |   4 +
 arch/arc/include/asm/ptrace.h  |   4 +
 arch/arc/include/asm/switch_to.h   |   2 +
 arch/arc/kernel/asm-offsets.c  |  16 
 arch/arc/kernel/head.S |   4 +
 arch/arc/kernel/setup.c|  47 +++---
 11 files changed, 329 insertions(+), 18 deletions(-)
 create mode 100644 arch/arc/include/asm/dsp-impl.h
 create mode 100644 arch/arc/include/asm/dsp.h

-- 
2.21.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 4/5] ARC: add support for DSP-enabled userspace applications

2019-12-27 Thread Eugeniy Paltsev
To be able to run DSP-enabled userspace applications we need to
save and restore following DSP-related registers:
At IRQ/exception entry/exit:
 * ACC0_GLO, ACC0_GHI, DSP_CTRL
 * ACC0_LO, ACC0_HI (we already save them as r58, r59 pair)
At context switch:
 * DSP_BFLY0, DSP_FFT_CTRL

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/Kconfig   |  7 +++
 arch/arc/include/asm/arcregs.h |  2 +
 arch/arc/include/asm/dsp-impl.h| 75 +-
 arch/arc/include/asm/dsp.h | 42 +
 arch/arc/include/asm/entry-arcv2.h |  3 ++
 arch/arc/include/asm/processor.h   |  4 ++
 arch/arc/include/asm/ptrace.h  |  4 ++
 arch/arc/include/asm/switch_to.h   |  2 +
 arch/arc/kernel/asm-offsets.c  |  7 +++
 arch/arc/kernel/setup.c|  2 +-
 10 files changed, 146 insertions(+), 2 deletions(-)
 create mode 100644 arch/arc/include/asm/dsp.h

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index b9cd7ce3f878..c3210754a3d2 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -432,6 +432,13 @@ config ARC_DSP_KERNEL
  DSP extension presence in HW, no support for DSP-enabled userspace
  applications. We don't save / restore DSP registers and only do
  some minimal preparations so userspace won't be able to break kernel
+
+config ARC_DSP_USERSPACE
+   bool "Support DSP for userspace apps"
+   select ARC_HAS_ACCL_REGS
+   help
+ DSP extension presence in HW, support save / restore DSP registers to
+ run DSP-enabled userspace applications
 endchoice
 
 config ARC_IRQ_NO_AUTOSAVE
diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h
index 0004b1e9b325..a713819cab3c 100644
--- a/arch/arc/include/asm/arcregs.h
+++ b/arch/arc/include/asm/arcregs.h
@@ -118,6 +118,8 @@
 
 /*
  * DSP-related registers
+ * Registers names must correspond to dsp_callee_regs structure fields names
+ * for automatic offset calculation in DSP_AUX_SAVE_RESTORE macros.
  */
 #define ARC_AUX_DSP_BUILD  0x7A
 #define ARC_AUX_ACC0_LO0x580
diff --git a/arch/arc/include/asm/dsp-impl.h b/arch/arc/include/asm/dsp-impl.h
index 788093cbe689..7b640a680dfc 100644
--- a/arch/arc/include/asm/dsp-impl.h
+++ b/arch/arc/include/asm/dsp-impl.h
@@ -7,6 +7,8 @@
 #ifndef __ASM_ARC_DSP_IMPL_H
 #define __ASM_ARC_DSP_IMPL_H
 
+#include 
+
 #define DSP_CTRL_DISABLED_ALL  0
 
 #ifdef __ASSEMBLY__
@@ -28,11 +30,82 @@
 * able to break kernel */
mov r58, DSP_CTRL_DISABLED_ALL
sr  r58, [ARC_AUX_DSP_CTRL]
-#endif /* ARC_DSP_KERNEL */
+
+#elif defined(ARC_DSP_SAVE_RESTORE_REGS)
+   lr  r58, [ARC_AUX_ACC0_GLO]
+   lr  r59, [ARC_AUX_ACC0_GHI]
+   ST2 r58, r59, PT_ACC0_GLO
+
+   lr  r58, [ARC_AUX_DSP_CTRL]
+   st  r58, [sp, PT_DSP_CTRL]
+
+#endif
+.endm
+
+/* clobbers r58, r59 registers pair */
+.macro DSP_RESTORE_REGFILE_IRQ
+#if defined(ARC_DSP_SAVE_RESTORE_REGS)
+   LD2 r58, r59, PT_ACC0_GLO
+   sr  r58, [ARC_AUX_ACC0_GLO]
+   sr  r59, [ARC_AUX_ACC0_GHI]
+
+   ld  r58, [sp, PT_DSP_CTRL]
+   sr  r58, [ARC_AUX_DSP_CTRL]
+
+#endif
 .endm
 
 #else /* __ASEMBLY__ */
 
+#include 
+#include 
+
+#ifdef ARC_DSP_SAVE_RESTORE_REGS
+
+/*
+ * As we save new and restore old AUX register value in the same place we
+ * can optimize a bit and use AEX instruction (swap contents of an auxiliary
+ * register with a core register) instead of LR + SR pair.
+ */
+#define AUX_SAVE_RESTORE(_saveto, _readfrom, _offt, _aux, _scratch)\
+do {   \
+   __asm__ __volatile__(   \
+   "ld %0, [%2, %4]\n" \
+   "aex%0, [%3]\n" \
+   "st %0, [%1, %4]\n" \
+   :   \
+ "=" (_scratch)  /* must be early clobber */ \
+   :   \
+  "r" (_saveto),   \
+  "r" (_readfrom), \
+  "I" (_aux),  \
+  "I" (_offt)  \
+   :   \
+ "memory"  \
+   );  \
+} while (0)
+
+#define DSP_AUX_SAVE_RESTORE(_saveto, _readfrom, _aux, _scratch)   \
+   AUX_SAVE_RESTORE(_saveto, _readfrom,\
+   offsetof(struct dsp_c

[PATCH 3/5] ARC: handle DSP presence in HW

2019-12-27 Thread Eugeniy Paltsev
In case of DSP extension presence in HW some instructions
(related to integer multiply, multiply-accumulate, and divide
operation) executes on this DSP execution unit. So their
execution will depend on dsp configuration register (DSP_CTRL)

As we want these instructions to execute the same way regardless
of DSP presence we need to set DSP_CTRL properly. However this
register can be modified bu any usersace app therefore any
usersace may break kernel execution.

Fix that by configure DSP_CTRL in CPU early code and in IRQs
entries.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/Kconfig   | 25 -
 arch/arc/include/asm/arcregs.h | 12 
 arch/arc/include/asm/dsp-impl.h| 45 ++
 arch/arc/include/asm/entry-arcv2.h |  3 ++
 arch/arc/kernel/head.S |  4 +++
 arch/arc/kernel/setup.c|  4 +++
 6 files changed, 92 insertions(+), 1 deletion(-)
 create mode 100644 arch/arc/include/asm/dsp-impl.h

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 8383155c8c82..b9cd7ce3f878 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -404,13 +404,36 @@ config ARC_HAS_DIV_REM
default y
 
 config ARC_HAS_ACCL_REGS
-   bool "Reg Pair ACCL:ACCH (FPU and/or MPY > 6)"
+   bool "Reg Pair ACCL:ACCH (FPU and/or MPY > 6 and/or DSP)"
default y
help
  Depending on the configuration, CPU can contain accumulator reg-pair
  (also referred to as r58:r59). These can also be used by gcc as GPR so
  kernel needs to save/restore per process
 
+choice
+   prompt "DSP support"
+   default ARC_NO_DSP
+   help
+ Depending on the configuration, CPU can contain DSP registers
+ (ACC0_GLO, ACC0_GHI, DSP_BFLY0, DSP_CTRL, DSP_FFT_CTRL).
+ Bellow is options describing how to handle these registers in
+ interrupt entry / exit and in context switch.
+
+config ARC_NO_DSP
+   bool "No DSP extension presence in HW"
+   help
+ No DSP extension presence in HW
+
+config ARC_DSP_KERNEL
+   bool "DSP extension in HW, no support for userspace"
+   select ARC_HAS_ACCL_REGS
+   help
+ DSP extension presence in HW, no support for DSP-enabled userspace
+ applications. We don't save / restore DSP registers and only do
+ some minimal preparations so userspace won't be able to break kernel
+endchoice
+
 config ARC_IRQ_NO_AUTOSAVE
bool "Disable hardware autosave regfile on interrupts"
default n
diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h
index 5134f0baf33c..0004b1e9b325 100644
--- a/arch/arc/include/asm/arcregs.h
+++ b/arch/arc/include/asm/arcregs.h
@@ -116,6 +116,18 @@
 #define ARC_AUX_DPFP_2H 0x304
 #define ARC_AUX_DPFP_STAT   0x305
 
+/*
+ * DSP-related registers
+ */
+#define ARC_AUX_DSP_BUILD  0x7A
+#define ARC_AUX_ACC0_LO0x580
+#define ARC_AUX_ACC0_GLO   0x581
+#define ARC_AUX_ACC0_HI0x582
+#define ARC_AUX_ACC0_GHI   0x583
+#define ARC_AUX_DSP_BFLY0  0x598
+#define ARC_AUX_DSP_CTRL   0x59F
+#define ARC_AUX_DSP_FFT_CTRL   0x59E
+
 #ifndef __ASSEMBLY__
 
 #include 
diff --git a/arch/arc/include/asm/dsp-impl.h b/arch/arc/include/asm/dsp-impl.h
new file mode 100644
index ..788093cbe689
--- /dev/null
+++ b/arch/arc/include/asm/dsp-impl.h
@@ -0,0 +1,45 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2020 Synopsys, Inc. (www.synopsys.com)
+ *
+ * Author: Eugeniy Paltsev 
+ */
+#ifndef __ASM_ARC_DSP_IMPL_H
+#define __ASM_ARC_DSP_IMPL_H
+
+#define DSP_CTRL_DISABLED_ALL  0
+
+#ifdef __ASSEMBLY__
+
+/* clobbers r5 register */
+.macro DSP_EARLY_INIT
+   lr  r5, [ARC_AUX_DSP_BUILD]
+   bmskr5, r5, 7
+   breqr5, 0, 1f
+   mov r5, DSP_CTRL_DISABLED_ALL
+   sr  r5, [ARC_AUX_DSP_CTRL]
+1:
+.endm
+
+/* clobbers r58, r59 registers pair */
+.macro DSP_SAVE_REGFILE_IRQ
+#if defined(CONFIG_ARC_DSP_KERNEL)
+   /* Drop any changes to DSP_CTRL made by userspace so userspace won't be
+* able to break kernel */
+   mov r58, DSP_CTRL_DISABLED_ALL
+   sr  r58, [ARC_AUX_DSP_CTRL]
+#endif /* ARC_DSP_KERNEL */
+.endm
+
+#else /* __ASEMBLY__ */
+
+static inline bool dsp_exist(void)
+{
+   struct bcr_generic bcr;
+
+   READ_BCR(ARC_AUX_DSP_BUILD, bcr);
+   return !!bcr.ver;
+}
+
+#endif /* __ASEMBLY__ */
+#endif /* __ASM_ARC_DSP_IMPL_H */
diff --git a/arch/arc/include/asm/entry-arcv2.h 
b/arch/arc/include/asm/entry-arcv2.h
index 0b8b63d0bec1..e3f8bd3e2eba 100644
--- a/arch/arc/include/asm/entry-arcv2.h
+++ b/arch/arc/include/asm/entry-arcv2.h
@@ -4,6 +4,7 @@
 #define __ASM_ARC_ENTRY_ARCV2_H
 
 #include 
+#include 
 #include 
 #include/* For THREAD_SIZE */
 
@@ -165,6 +166,8 @@
ST2 r58, r59, PT_r58
 #endif
 
+   /

[PATCH 2/5] ARC: add helpers to sanitize config options

2019-12-27 Thread Eugeniy Paltsev
We'll use this macro in coming patches extensively.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/kernel/setup.c | 29 -
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index 7ee89dc61f6e..edb55b6ee278 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -389,11 +389,23 @@ static char *arc_extn_mumbojumbo(int cpu_id, char *buf, 
int len)
return buf;
 }
 
+static void chk_opt_strict(char *opt_name, bool hw_exists, bool opt_ena)
+{
+   if (hw_exists && !opt_ena)
+   pr_warn(" ! Enable %s for working apps\n", opt_name);
+   else if (!hw_exists && opt_ena)
+   panic("Disable %s, hardware NOT present\n", opt_name);
+}
+
+#define CHK_OPT_STRICT(opt_name, hw_exists)\
+({ \
+   chk_opt_strict(#opt_name, hw_exists, IS_ENABLED(opt_name)); \
+})
+
 static void arc_chk_core_config(void)
 {
struct cpuinfo_arc *cpu = _arc700[smp_processor_id()];
-   int saved = 0, present = 0;
-   char *opt_nm = NULL;
+   int present = 0;
 
if (!cpu->extn.timer0)
panic("Timer0 is not present!\n");
@@ -425,23 +437,14 @@ static void arc_chk_core_config(void)
 */
 
if (is_isa_arcompact()) {
-   opt_nm = "CONFIG_ARC_FPU_SAVE_RESTORE";
-   saved = IS_ENABLED(CONFIG_ARC_FPU_SAVE_RESTORE);
-
/* only DPDP checked since SP has no arch visible regs */
present = cpu->extn.fpu_dp;
+   CHK_OPT_STRICT(CONFIG_ARC_FPU_SAVE_RESTORE, present);
} else {
-   opt_nm = "CONFIG_ARC_HAS_ACCL_REGS";
-   saved = IS_ENABLED(CONFIG_ARC_HAS_ACCL_REGS);
-
/* Accumulator Low:High pair (r58:59) present if DSP MPY or FPU 
*/
present = cpu->extn_mpy.dsp | cpu->extn.fpu_sp | 
cpu->extn.fpu_dp;
+   CHK_OPT_STRICT(CONFIG_ARC_HAS_ACCL_REGS, present);
}
-
-   if (present && !saved)
-   pr_warn("Enable %s for working apps\n", opt_nm);
-   else if (!present && saved)
-   panic("Disable %s, hardware NOT present\n", opt_nm);
 }
 
 /*
-- 
2.21.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 1/5] ARC: pt_regs: remove hardcoded registers offset

2019-12-27 Thread Eugeniy Paltsev
Replace hardcoded registers offset numbers by calculated via
offsetof.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/include/asm/entry-arcv2.h | 8 
 arch/arc/kernel/asm-offsets.c  | 9 +
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/arch/arc/include/asm/entry-arcv2.h 
b/arch/arc/include/asm/entry-arcv2.h
index 41b16f21beec..0b8b63d0bec1 100644
--- a/arch/arc/include/asm/entry-arcv2.h
+++ b/arch/arc/include/asm/entry-arcv2.h
@@ -162,7 +162,7 @@
 #endif
 
 #ifdef CONFIG_ARC_HAS_ACCL_REGS
-   ST2 r58, r59, PT_sp + 12
+   ST2 r58, r59, PT_r58
 #endif
 
 .endm
@@ -172,8 +172,8 @@
 
LD2 gp, fp, PT_r26  ; gp (r26), fp (r27)
 
-   ld  r12, [sp, PT_sp + 4]
-   ld  r30, [sp, PT_sp + 8]
+   ld  r12, [sp, PT_r12]
+   ld  r30, [sp, PT_r30]
 
; Restore SP (into AUX_USER_SP) only if returning to U mode
;  - for K mode, it will be implicitly restored as stack is unwound
@@ -190,7 +190,7 @@
 #endif
 
 #ifdef CONFIG_ARC_HAS_ACCL_REGS
-   LD2 r58, r59, PT_sp + 12
+   LD2 r58, r59, PT_r58
 #endif
 .endm
 
diff --git a/arch/arc/kernel/asm-offsets.c b/arch/arc/kernel/asm-offsets.c
index 631ebb5d3458..c783bcd35eb8 100644
--- a/arch/arc/kernel/asm-offsets.c
+++ b/arch/arc/kernel/asm-offsets.c
@@ -67,5 +67,14 @@ int main(void)
DEFINE(SZ_CALLEE_REGS, sizeof(struct callee_regs));
DEFINE(SZ_PT_REGS, sizeof(struct pt_regs));
 
+#ifdef CONFIG_ISA_ARCV2
+   OFFSET(PT_r12, pt_regs, r12);
+   OFFSET(PT_r30, pt_regs, r30);
+#endif
+#ifdef CONFIG_ARC_HAS_ACCL_REGS
+   OFFSET(PT_r58, pt_regs, r58);
+   OFFSET(PT_r59, pt_regs, r59);
+#endif
+
return 0;
 }
-- 
2.21.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [RFC/RFT WIP PATCH] arc: add sparsemem support

2019-12-19 Thread Eugeniy Paltsev
Hi Mike,

Sorry for late respond.
I've tested this patches but the kernel crashes in the memory initialization 
code.
Here is bootlog:

->8-
Linux version 5.1.0+ (paltsev@paltsev-e7480) (gcc version 8.2.1 20180814 (ARCv2 
ISA Linux uClibc toolchain 2018.09)) #1 PREEMPT Thu Oct 31 02:25:55 MSK 2019
Memory @ 8000 [512M] 
Memory @ 1 [1024M] 
OF: fdt: Machine model: snps,nsim_hs
earlycon: arc_uart0 at MMIO32 0xc0fc1000 (options '115200n8')
printk: bootconsole [arc_uart0] enabled
archs-intc  : 15 priority levels (default 1)

IDENTITY: ARCVER [0x51] ARCNUM [0xff] CHIPID [ 0x0]
processor [0]   : HS38 R2.0 (ARCv2 ISA) 
Timers  : Timer0 Timer1 RTC [UP 64-bit] 
ISA Extn: atomic ll64 unalign mpy[opt 9] div_rem 
BPU : partial match, cache:2048, Predict Table:16384 Return stk: 8
MMU [v4]: 8k PAGE, 2M Super Page (not used) JTLB 512 (128x4), uDTLB 8, 
uITLB 4
I-Cache : 16K, 2way/set, 64B Line, VIPT
D-Cache : 16K, 4way/set, 64B Line, PIPT
Peripherals : 0xc000
Vector Table: 0x8000
DEBUG   : ActionPoint 4/full
Built 1 zonelists, mobility grouping on.  Total pages: 196320
Kernel command line: earlycon=arc_uart,mmio32,0xc0fc1000,115200n8 
console=ttyARC0,115200n8 print-fatal-signals=1
Dentry cache hash table entries: 65536 (order: 5, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 4, 131072 bytes)

Oops
Path: (null)
CPU: 0 PID: 0 Comm: swapper Not tainted 5.1.0+ #1

[ECR   ]: 0x00050100 => Invalid Read @ 0x0120 by insn @ 0x800a8bc6
[EFA   ]: 0x0120
[BLINK ]: mem_init+0x40/0x58
[ERET  ]: free_highmem_page+0x6/0x88
[STAT32]: 0x00080002 :   K 
BTA: 0x800a8bc0  SP: 0x803ebfd8  FP: 0x
LPS: 0x802fbd3c LPE: 0x802fbd44 LPC: 0x
r00: 0x0120 r01: 0x000a r02: 0x 
r03: 0x000a r04: 0x0021 r05: 0x 
r06: 0x646f6e49 r07: 0x61632d65 r08: 0x20656863 
r09: 0x68736168 r10: 0x0016 r11: 0x6520656c 
r12: 0x800066e4 

Stack Trace:
  free_highmem_page+0x6/0x88
  mem_init+0x40/0x58
->8-

So we have invalid memory access here:
->8-
void __init mem_init(void)
{
#ifdef CONFIG_HIGHMEM
unsigned long tmp;

reset_all_zones_managed_pages();
for (tmp = min_high_pfn; tmp < max_high_pfn; tmp++)
free_highmem_page(pfn_to_page(tmp));   // <<<<<<<<--
#endif

memblock_free_all();
mem_init_print_info(NULL);
}
->8-


BTW, you can also test your future changes by yourself. For that you can use 
nSIM free simulator which provides an instruction accurate processor model for
the ARC processors. To download nSIM free you need request it via this form:
https://www.synopsys.com/cgi-bin/dwarcnsim/req1.cgi
You will be able to download it after the from will be approved.

You can find instructions describing how to run Linux with nSIM free here:
https://github.com/foss-for-synopsys-dwc-arc-processors/linux/wiki/How-to-run-ARC-Linux-kernel-and-debug-(with-MetaWare-Debugger)#standalone-nsim-also-free-nsim

If you are going to rebase you patches on v5.5 kernel (or newer) please also 
read this note:
https://github.com/foss-for-synopsys-dwc-arc-processors/linux/wiki/How-to-run-ARC-Linux-kernel-and-debug-(with-MetaWare-Debugger)#v55-linux-kernel-note

Thanks.
---
 Eugeniy Paltsev



From: linux-snps-arc  on behalf of 
Mike Rapoport 
Sent: Sunday, May 26, 2019 18:38
To: Vineet Gupta
Cc: linux-snps-arc@lists.infradead.org; Mike Rapoport
Subject: [RFC/RFT WIP PATCH] arc: add sparsemem support

Add support for initialization of SPARSE memory model along with Kconfig
options that will allow its selection during the kernel configuration.

Certain configurations of ARC require that the memory that is not directly
mapped by the kernel (ZONE_HIGHMEM) will be below the memory that is always
mapped into the kernel page tables (ZONE_NORMAL).

For such configurations ZONE_NORMAL and ZONE_HIGHMEM were present on
different nodes.

With SPARSEMEM, there is a single node containing all the memory, but it is
initialized using dedicated free_area_init_node_exact_zones() routing that
takes the exact zone extents rather then their sizes.

Signed-off-by: Mike Rapoport 
---
 arch/arc/Kconfig |  9 +
 arch/arc/include/asm/sparsemem.h | 13 +++
 arch/arc/mm/init.c   | 84 
 include/linux/mm.h   |  3 ++
 mm/page_alloc.c  | 37 ++
 5 files changed, 121 insertions(+), 25 deletions(-)
 create mode 100644 arch/arc/include/asm/sparsemem.h

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 23e063d..9b6c31d 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@

[PATCH] ARC: asm-offsets: remove duplicate entry

2019-12-19 Thread Eugeniy Paltsev
We define 'PT_user_r25' twice in asm-offsets.c
It's not a big issue as we define it to the same value, however
let's fix it.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/kernel/asm-offsets.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arc/kernel/asm-offsets.c b/arch/arc/kernel/asm-offsets.c
index 1f621e416521..631ebb5d3458 100644
--- a/arch/arc/kernel/asm-offsets.c
+++ b/arch/arc/kernel/asm-offsets.c
@@ -66,7 +66,6 @@ int main(void)
 
DEFINE(SZ_CALLEE_REGS, sizeof(struct callee_regs));
DEFINE(SZ_PT_REGS, sizeof(struct pt_regs));
-   DEFINE(PT_user_r25, offsetof(struct pt_regs, user_r25));
 
return 0;
 }
-- 
2.21.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v2 1/2] ARC: [plat-axs10x]: use pgu pll instead of fixed clock

2019-11-20 Thread Eugeniy Paltsev
Use PLL driver instead of fixed-clock for PGU pixel clock.
That allows us to support wider range of graphic modes.

Signed-off-by: Eugeniy Paltsev 
---
Changes v1->v2:
 * add missing input_clk node to AXS101. No changes for AXS103 /
   AXS103 SMP.

 arch/arc/boot/dts/axc001.dtsi|  6 ++
 arch/arc/boot/dts/axs10x_mb.dtsi | 11 ++-
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/arch/arc/boot/dts/axc001.dtsi b/arch/arc/boot/dts/axc001.dtsi
index 6ec1fcdfc0d7..79ec27c043c1 100644
--- a/arch/arc/boot/dts/axc001.dtsi
+++ b/arch/arc/boot/dts/axc001.dtsi
@@ -28,6 +28,12 @@
clock-frequency = <75000>;
};
 
+   input_clk: input-clk {
+   #clock-cells = <0>;
+   compatible = "fixed-clock";
+   clock-frequency = <>;
+   };
+
core_intc: arc700-intc@cpu {
compatible = "snps,arc700-intc";
interrupt-controller;
diff --git a/arch/arc/boot/dts/axs10x_mb.dtsi b/arch/arc/boot/dts/axs10x_mb.dtsi
index 08bcfed6b80f..f9a5c9ddcae7 100644
--- a/arch/arc/boot/dts/axs10x_mb.dtsi
+++ b/arch/arc/boot/dts/axs10x_mb.dtsi
@@ -61,12 +61,13 @@
clock-frequency = <2500>;
#clock-cells = <0>;
};
+   };
 
-   pguclk: pguclk {
-   #clock-cells = <0>;
-   compatible = "fixed-clock";
-   clock-frequency = <7425>;
-   };
+   pguclk: pguclk@10080 {
+   compatible = "snps,axs10x-pgu-pll-clock";
+   reg = <0x10080 0x10>, <0x110 0x10>;
+   #clock-cells = <0>;
+   clocks = <_clk>;
};
 
gmac: ethernet@18000 {
-- 
2.21.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v2 2/2] ARC: [plat-axs10x]: remove hardcoded video mode from bootargs

2019-11-20 Thread Eugeniy Paltsev
Now have pixel clock PLL driver and we can change pixel clock rate
so we don't need to enforce one exact video mode. Moreover enforcing
video mode is harmful in case of we enforce mode which isn't
supported by the monitor we are using.

Signed-off-by: Eugeniy Paltsev 
---
Changes v1->v2:
 * None.

 arch/arc/boot/dts/axs101.dts | 2 +-
 arch/arc/boot/dts/axs103_idu.dts | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arc/boot/dts/axs101.dts b/arch/arc/boot/dts/axs101.dts
index 305a7f9658e0..c4cfc5f4f427 100644
--- a/arch/arc/boot/dts/axs101.dts
+++ b/arch/arc/boot/dts/axs101.dts
@@ -14,6 +14,6 @@
compatible = "snps,axs101", "snps,arc-sdp";
 
chosen {
-   bootargs = "earlycon=uart8250,mmio32,0xe0022000,115200n8 
console=tty0 console=ttyS3,115200n8 consoleblank=0 video=1280x720@60 
print-fatal-signals=1";
+   bootargs = "earlycon=uart8250,mmio32,0xe0022000,115200n8 
console=tty0 console=ttyS3,115200n8 consoleblank=0 print-fatal-signals=1";
};
 };
diff --git a/arch/arc/boot/dts/axs103_idu.dts b/arch/arc/boot/dts/axs103_idu.dts
index 46c9136cbf2b..a934b92a8c30 100644
--- a/arch/arc/boot/dts/axs103_idu.dts
+++ b/arch/arc/boot/dts/axs103_idu.dts
@@ -17,6 +17,6 @@
compatible = "snps,axs103", "snps,arc-sdp";
 
chosen {
-   bootargs = "earlycon=uart8250,mmio32,0xe0022000,115200n8 
console=tty0 console=ttyS3,115200n8 print-fatal-signals=1 consoleblank=0 
video=1280x720@60";
+   bootargs = "earlycon=uart8250,mmio32,0xe0022000,115200n8 
console=tty0 console=ttyS3,115200n8 print-fatal-signals=1 consoleblank=0";
};
 };
-- 
2.21.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH] ARC: add kmemleak support

2019-11-19 Thread Eugeniy Paltsev
kmemleak is used internally for a long time and as there isn't
any issue with it we can finally enable it in upstream.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 8383155c8c82..c147ebe51b65 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -30,6 +30,7 @@ config ARC
select HAVE_ARCH_KGDB
select HAVE_ARCH_TRACEHOOK
select HAVE_DEBUG_STACKOVERFLOW
+   select HAVE_DEBUG_KMEMLEAK
select HAVE_FUTEX_CMPXCHG if FUTEX
select HAVE_IOREMAP_PROT
select HAVE_KERNEL_GZIP
-- 
2.21.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 4/4] DRM: ARC: PGU: add ARGB8888 format to supported format list

2019-11-19 Thread Eugeniy Paltsev
As we ignore first 8 bit of 32 bit pixel value we can add ARGB
format as alias of XRGB.

Signed-off-by: Eugeniy Paltsev 
---
 drivers/gpu/drm/arc/arcpgu_crtc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/arc/arcpgu_crtc.c 
b/drivers/gpu/drm/arc/arcpgu_crtc.c
index 980e00180e6f..8ae1e1f97a73 100644
--- a/drivers/gpu/drm/arc/arcpgu_crtc.c
+++ b/drivers/gpu/drm/arc/arcpgu_crtc.c
@@ -23,6 +23,7 @@
 static const u32 arc_pgu_supported_formats[] = {
DRM_FORMAT_RGB565,
DRM_FORMAT_XRGB,
+   DRM_FORMAT_ARGB,
 };
 
 static void arc_pgu_set_pxl_fmt(struct drm_crtc *crtc)
-- 
2.21.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 3/4] DRM: ARC: PGU: replace unsupported by HW RGB888 format by XRGB888

2019-11-19 Thread Eugeniy Paltsev
ARC PGU doesn't support RGB888 (24 bit) format but supports
XRGB888 (32 bit) format. Fix incorrect format list in a driver.

Signed-off-by: Eugeniy Paltsev 
---
 drivers/gpu/drm/arc/arcpgu_crtc.c | 6 +++---
 drivers/gpu/drm/arc/arcpgu_regs.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/arc/arcpgu_crtc.c 
b/drivers/gpu/drm/arc/arcpgu_crtc.c
index 5473b19a52ee..980e00180e6f 100644
--- a/drivers/gpu/drm/arc/arcpgu_crtc.c
+++ b/drivers/gpu/drm/arc/arcpgu_crtc.c
@@ -22,7 +22,7 @@
 
 static const u32 arc_pgu_supported_formats[] = {
DRM_FORMAT_RGB565,
-   DRM_FORMAT_RGB888,
+   DRM_FORMAT_XRGB,
 };
 
 static void arc_pgu_set_pxl_fmt(struct drm_crtc *crtc)
@@ -44,9 +44,9 @@ static void arc_pgu_set_pxl_fmt(struct drm_crtc *crtc)
 
reg_ctrl = arc_pgu_read(arcpgu, ARCPGU_REG_CTRL);
if (format == DRM_FORMAT_RGB565)
-   reg_ctrl &= ~ARCPGU_MODE_RGB888_MASK;
+   reg_ctrl &= ~ARCPGU_MODE_XRGB;
else
-   reg_ctrl |= ARCPGU_MODE_RGB888_MASK;
+   reg_ctrl |= ARCPGU_MODE_XRGB;
arc_pgu_write(arcpgu, ARCPGU_REG_CTRL, reg_ctrl);
 }
 
diff --git a/drivers/gpu/drm/arc/arcpgu_regs.h 
b/drivers/gpu/drm/arc/arcpgu_regs.h
index dab2c380f7f3..b689a382d556 100644
--- a/drivers/gpu/drm/arc/arcpgu_regs.h
+++ b/drivers/gpu/drm/arc/arcpgu_regs.h
@@ -25,7 +25,7 @@
 #define ARCPGU_CTRL_VS_POL_OFST0x3
 #define ARCPGU_CTRL_HS_POL_MASK0x1
 #define ARCPGU_CTRL_HS_POL_OFST0x4
-#define ARCPGU_MODE_RGB888_MASK0x04
+#define ARCPGU_MODE_XRGB   BIT(2)
 #define ARCPGU_STAT_BUSY_MASK  0x02
 
 #endif
-- 
2.21.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 0/4] DRM: PGU: ARC: fixies related to framebuffer format

2019-11-19 Thread Eugeniy Paltsev
Eugeniy Paltsev (4):
  DRM: ARC: PGU: fix framebuffer format switching
  DRM: ARC: PGU: cleanup supported format list code
  DRM: ARC: PGU: replace unsupported by HW RGB888 format by XRGB888
  DRM: ARC: PGU: add ARGB format to supported format list

 drivers/gpu/drm/arc/arcpgu_crtc.c | 36 +++
 drivers/gpu/drm/arc/arcpgu_regs.h |  2 +-
 2 files changed, 19 insertions(+), 19 deletions(-)

-- 
2.21.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 1/4] DRM: ARC: PGU: fix framebuffer format switching

2019-11-19 Thread Eugeniy Paltsev
Current implementation don't switch to RGB565 format if BGR888 was
previously used. Fix that.

Signed-off-by: Eugeniy Paltsev 
---
 drivers/gpu/drm/arc/arcpgu_crtc.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/arc/arcpgu_crtc.c 
b/drivers/gpu/drm/arc/arcpgu_crtc.c
index dfaddbb7da0d..31d9824c46cc 100644
--- a/drivers/gpu/drm/arc/arcpgu_crtc.c
+++ b/drivers/gpu/drm/arc/arcpgu_crtc.c
@@ -32,6 +32,7 @@ static void arc_pgu_set_pxl_fmt(struct drm_crtc *crtc)
uint32_t pixel_format = fb->format->format;
struct simplefb_format *format = NULL;
int i;
+   u32 reg_ctrl;
 
for (i = 0; i < ARRAY_SIZE(supported_formats); i++) {
if (supported_formats[i].fourcc == pixel_format)
@@ -41,11 +42,12 @@ static void arc_pgu_set_pxl_fmt(struct drm_crtc *crtc)
if (WARN_ON(!format))
return;
 
-   if (format->fourcc == DRM_FORMAT_RGB888)
-   arc_pgu_write(arcpgu, ARCPGU_REG_CTRL,
- arc_pgu_read(arcpgu, ARCPGU_REG_CTRL) |
-  ARCPGU_MODE_RGB888_MASK);
-
+   reg_ctrl = arc_pgu_read(arcpgu, ARCPGU_REG_CTRL);
+   if (format->fourcc == DRM_FORMAT_RGB565)
+   reg_ctrl &= ~ARCPGU_MODE_RGB888_MASK;
+   else
+   reg_ctrl |= ARCPGU_MODE_RGB888_MASK;
+   arc_pgu_write(arcpgu, ARCPGU_REG_CTRL, reg_ctrl);
 }
 
 static const struct drm_crtc_funcs arc_pgu_crtc_funcs = {
-- 
2.21.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 2/8] ARC: HAPS: cleanup defconfigs from unused IO-related options

2019-10-23 Thread Eugeniy Paltsev
We don't have any peripherals on HAPS which may require FB or
input_devices support. So get rid of them.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/configs/haps_hs_defconfig | 9 +++--
 arch/arc/configs/haps_hs_smp_defconfig | 9 +++--
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/arch/arc/configs/haps_hs_defconfig 
b/arch/arc/configs/haps_hs_defconfig
index e22f40612089..33b7a402b6bd 100644
--- a/arch/arc/configs/haps_hs_defconfig
+++ b/arch/arc/configs/haps_hs_defconfig
@@ -48,9 +48,9 @@ CONFIG_VIRTIO_NET=y
 # CONFIG_NET_VENDOR_WIZNET is not set
 # CONFIG_WLAN is not set
 CONFIG_INPUT_EVDEV=y
-CONFIG_MOUSE_PS2_TOUCHKIT=y
-# CONFIG_SERIO_SERPORT is not set
-CONFIG_SERIO_ARC_PS2=y
+# CONFIG_INPUT_KEYBOARD is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_SERIO is not set
 # CONFIG_LEGACY_PTYS is not set
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
@@ -60,9 +60,6 @@ CONFIG_SERIAL_8250_DW=y
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_HW_RANDOM is not set
 # CONFIG_HWMON is not set
-CONFIG_FB=y
-CONFIG_FRAMEBUFFER_CONSOLE=y
-CONFIG_LOGO=y
 # CONFIG_HID is not set
 # CONFIG_USB_SUPPORT is not set
 CONFIG_VIRTIO_MMIO=y
diff --git a/arch/arc/configs/haps_hs_smp_defconfig 
b/arch/arc/configs/haps_hs_smp_defconfig
index ff4fcd7640a4..5586511a00bf 100644
--- a/arch/arc/configs/haps_hs_smp_defconfig
+++ b/arch/arc/configs/haps_hs_smp_defconfig
@@ -49,9 +49,9 @@ CONFIG_NETDEVICES=y
 # CONFIG_NET_VENDOR_WIZNET is not set
 # CONFIG_WLAN is not set
 CONFIG_INPUT_EVDEV=y
-CONFIG_MOUSE_PS2_TOUCHKIT=y
-# CONFIG_SERIO_SERPORT is not set
-CONFIG_SERIO_ARC_PS2=y
+# CONFIG_INPUT_KEYBOARD is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_SERIO is not set
 # CONFIG_LEGACY_PTYS is not set
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
@@ -61,9 +61,6 @@ CONFIG_SERIAL_8250_DW=y
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_HW_RANDOM is not set
 # CONFIG_HWMON is not set
-CONFIG_FB=y
-CONFIG_FRAMEBUFFER_CONSOLE=y
-CONFIG_LOGO=y
 # CONFIG_HID is not set
 # CONFIG_USB_SUPPORT is not set
 # CONFIG_IOMMU_SUPPORT is not set
-- 
2.21.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 0/8] ARC: merge HAPS-HS with nSIM-HS configs

2019-10-23 Thread Eugeniy Paltsev
Starting from nSIM 2019.06 is possible to use DW UART
instead of ARC UART. That allows us to merge
"nsim_hs" with "haps_hs" and "nsim_hs_smp" with "haps_hs_smp"
with some minor changes.

We eliminate nsim_hs_defconfig and nsim_hs_smp_defconfig
and leave haps_hs_defconfig and haps_hs_smp_defconfig
which can be used on HAPS / nSIM / ZEBU / QEMU platforms
without additional changes in Linux kernel.

Also while I'm at it cleanup both HAPS and nSIM configurations
from obsolete/unused options.

Changes:
RFC -> v1:
 * update KBUILD_DEFCONFIG to use the haps defconfig instead of
   nSIM one
 * switch nsim_700 to dwuart

Eugeniy Paltsev (8):
  ARC: regenerate nSIM and HAPS defconfigs
  ARC: HAPS: cleanup defconfigs from unused IO-related options
  ARC: HAPS: use same UART configuration everywhere
  ARC: HAPS: add HIGHMEM memory zone to DTS
  ARC: HAPS: cleanup defconfigs from unused ETH drivers
  ARC: merge HAPS-HS with nSIM-HS configs
  ARC: nSIM_700: switch to DW UART usage
  ARC: nSIM_700: remove unused network options

 arch/arc/Makefile  |  2 +-
 arch/arc/boot/dts/haps_hs.dts  | 15 +++---
 arch/arc/boot/dts/haps_hs_idu.dts  |  1 -
 arch/arc/boot/dts/nsim_700.dts | 36 +-
 arch/arc/boot/dts/nsim_hs.dts  | 67 --
 arch/arc/boot/dts/nsim_hs_idu.dts  | 65 -
 arch/arc/configs/haps_hs_defconfig | 30 +++-
 arch/arc/configs/haps_hs_smp_defconfig | 32 +++-
 arch/arc/configs/nsim_700_defconfig| 19 
 arch/arc/configs/nsim_hs_defconfig | 60 ---
 arch/arc/configs/nsim_hs_smp_defconfig | 58 --
 arch/arc/plat-sim/platform.c   |  1 -
 12 files changed, 44 insertions(+), 342 deletions(-)
 delete mode 100644 arch/arc/boot/dts/nsim_hs.dts
 delete mode 100644 arch/arc/boot/dts/nsim_hs_idu.dts
 delete mode 100644 arch/arc/configs/nsim_hs_defconfig
 delete mode 100644 arch/arc/configs/nsim_hs_smp_defconfig

-- 
2.21.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 1/8] ARC: regenerate nSIM and HAPS defconfigs

2019-10-23 Thread Eugeniy Paltsev
No functional change intended.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/configs/haps_hs_defconfig | 10 ++
 arch/arc/configs/haps_hs_smp_defconfig | 12 +++-
 arch/arc/configs/nsim_700_defconfig|  7 ++-
 arch/arc/configs/nsim_hs_defconfig |  8 ++--
 arch/arc/configs/nsim_hs_smp_defconfig | 10 +++---
 5 files changed, 12 insertions(+), 35 deletions(-)

diff --git a/arch/arc/configs/haps_hs_defconfig 
b/arch/arc/configs/haps_hs_defconfig
index 47ff8a97e42d..e22f40612089 100644
--- a/arch/arc/configs/haps_hs_defconfig
+++ b/arch/arc/configs/haps_hs_defconfig
@@ -4,6 +4,7 @@ CONFIG_POSIX_MQUEUE=y
 # CONFIG_CROSS_MEMORY_ATTACH is not set
 CONFIG_NO_HZ_IDLE=y
 CONFIG_HIGH_RES_TIMERS=y
+CONFIG_PREEMPT=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_NAMESPACES=y
@@ -15,13 +16,9 @@ CONFIG_EXPERT=y
 CONFIG_PERF_EVENTS=y
 # CONFIG_COMPAT_BRK is not set
 CONFIG_SLAB=y
+CONFIG_ARC_BUILTIN_DTB_NAME="haps_hs"
 CONFIG_MODULES=y
 # CONFIG_BLK_DEV_BSG is not set
-# CONFIG_IOSCHED_DEADLINE is not set
-# CONFIG_IOSCHED_CFQ is not set
-CONFIG_ISA_ARCV2=y
-CONFIG_ARC_BUILTIN_DTB_NAME="haps_hs"
-CONFIG_PREEMPT=y
 # CONFIG_COMPACTION is not set
 CONFIG_NET=y
 CONFIG_PACKET=y
@@ -30,9 +27,6 @@ CONFIG_UNIX=y
 CONFIG_UNIX_DIAG=y
 CONFIG_NET_KEY=y
 CONFIG_INET=y
-# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
-# CONFIG_INET_XFRM_MODE_TUNNEL is not set
-# CONFIG_INET_XFRM_MODE_BEET is not set
 # CONFIG_IPV6 is not set
 # CONFIG_WIRELESS is not set
 CONFIG_DEVTMPFS=y
diff --git a/arch/arc/configs/haps_hs_smp_defconfig 
b/arch/arc/configs/haps_hs_smp_defconfig
index 9685fd5f57a4..ff4fcd7640a4 100644
--- a/arch/arc/configs/haps_hs_smp_defconfig
+++ b/arch/arc/configs/haps_hs_smp_defconfig
@@ -4,6 +4,7 @@ CONFIG_POSIX_MQUEUE=y
 # CONFIG_CROSS_MEMORY_ATTACH is not set
 CONFIG_NO_HZ_IDLE=y
 CONFIG_HIGH_RES_TIMERS=y
+CONFIG_PREEMPT=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_NAMESPACES=y
@@ -16,15 +17,11 @@ CONFIG_PERF_EVENTS=y
 # CONFIG_VM_EVENT_COUNTERS is not set
 # CONFIG_COMPAT_BRK is not set
 CONFIG_SLAB=y
+CONFIG_SMP=y
+CONFIG_ARC_BUILTIN_DTB_NAME="haps_hs_idu"
 CONFIG_KPROBES=y
 CONFIG_MODULES=y
 # CONFIG_BLK_DEV_BSG is not set
-# CONFIG_IOSCHED_DEADLINE is not set
-# CONFIG_IOSCHED_CFQ is not set
-CONFIG_ISA_ARCV2=y
-CONFIG_SMP=y
-CONFIG_ARC_BUILTIN_DTB_NAME="haps_hs_idu"
-CONFIG_PREEMPT=y
 # CONFIG_COMPACTION is not set
 CONFIG_NET=y
 CONFIG_PACKET=y
@@ -33,9 +30,6 @@ CONFIG_UNIX=y
 CONFIG_UNIX_DIAG=y
 CONFIG_NET_KEY=y
 CONFIG_INET=y
-# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
-# CONFIG_INET_XFRM_MODE_TUNNEL is not set
-# CONFIG_INET_XFRM_MODE_BEET is not set
 # CONFIG_IPV6 is not set
 # CONFIG_WIRELESS is not set
 CONFIG_DEVTMPFS=y
diff --git a/arch/arc/configs/nsim_700_defconfig 
b/arch/arc/configs/nsim_700_defconfig
index 2b9b11474640..9b2653b0b349 100644
--- a/arch/arc/configs/nsim_700_defconfig
+++ b/arch/arc/configs/nsim_700_defconfig
@@ -4,6 +4,7 @@ CONFIG_SYSVIPC=y
 CONFIG_POSIX_MQUEUE=y
 # CONFIG_CROSS_MEMORY_ATTACH is not set
 CONFIG_HIGH_RES_TIMERS=y
+CONFIG_PREEMPT=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_NAMESPACES=y
@@ -17,13 +18,10 @@ CONFIG_PERF_EVENTS=y
 # CONFIG_SLUB_DEBUG is not set
 # CONFIG_COMPAT_BRK is not set
 CONFIG_ISA_ARCOMPACT=y
+CONFIG_ARC_BUILTIN_DTB_NAME="nsim_700"
 CONFIG_KPROBES=y
 CONFIG_MODULES=y
 # CONFIG_BLK_DEV_BSG is not set
-# CONFIG_IOSCHED_DEADLINE is not set
-# CONFIG_IOSCHED_CFQ is not set
-CONFIG_ARC_BUILTIN_DTB_NAME="nsim_700"
-CONFIG_PREEMPT=y
 # CONFIG_COMPACTION is not set
 CONFIG_NET=y
 CONFIG_PACKET=y
@@ -39,7 +37,6 @@ CONFIG_DEVTMPFS=y
 CONFIG_NETDEVICES=y
 CONFIG_ARC_EMAC=y
 CONFIG_LXT_PHY=y
-# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_SERIO is not set
diff --git a/arch/arc/configs/nsim_hs_defconfig 
b/arch/arc/configs/nsim_hs_defconfig
index bab3dd255841..60ad81769565 100644
--- a/arch/arc/configs/nsim_hs_defconfig
+++ b/arch/arc/configs/nsim_hs_defconfig
@@ -4,6 +4,7 @@ CONFIG_SYSVIPC=y
 CONFIG_POSIX_MQUEUE=y
 # CONFIG_CROSS_MEMORY_ATTACH is not set
 CONFIG_HIGH_RES_TIMERS=y
+CONFIG_PREEMPT=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_NAMESPACES=y
@@ -16,17 +17,13 @@ CONFIG_EMBEDDED=y
 CONFIG_PERF_EVENTS=y
 # CONFIG_SLUB_DEBUG is not set
 # CONFIG_COMPAT_BRK is not set
+CONFIG_ARC_BUILTIN_DTB_NAME="nsim_hs"
 CONFIG_KPROBES=y
 CONFIG_MODULES=y
 CONFIG_MODULE_FORCE_LOAD=y
 CONFIG_MODULE_UNLOAD=y
 CONFIG_MODULE_FORCE_UNLOAD=y
 # CONFIG_BLK_DEV_BSG is not set
-# CONFIG_IOSCHED_DEADLINE is not set
-# CONFIG_IOSCHED_CFQ is not set
-CONFIG_ISA_ARCV2=y
-CONFIG_ARC_BUILTIN_DTB_NAME="nsim_hs"
-CONFIG_PREEMPT=y
 # CONFIG_COMPACTION is not set
 CONFIG_NET=y
 CONFIG_PACKET=y
@@ -39,7 +36,6 @@ CONFIG_DEVTMPFS=y
 # CONFIG_STANDALONE is not set
 # CONFIG_PREVENT_FIRMWARE_BUILD is not set
 # CONFIG_BLK_DEV is not set
-# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
 # C

[PATCH 7/8] ARC: nSIM_700: switch to DW UART usage

2019-10-23 Thread Eugeniy Paltsev
Switch nsim_700_defconfig to dwuart for consistent uart settings
for all nSIM configurations.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/boot/dts/nsim_700.dts  | 20 +++-
 arch/arc/configs/nsim_700_defconfig |  8 ++--
 2 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/arch/arc/boot/dts/nsim_700.dts b/arch/arc/boot/dts/nsim_700.dts
index 63dbaab1247d..ae9bc21fe11b 100644
--- a/arch/arc/boot/dts/nsim_700.dts
+++ b/arch/arc/boot/dts/nsim_700.dts
@@ -14,11 +14,11 @@
interrupt-parent = <_intc>;
 
chosen {
-   bootargs = "earlycon=arc_uart,mmio32,0xc0fc1000,115200n8 
console=ttyARC0,115200n8 print-fatal-signals=1";
+   bootargs = "earlycon=uart8250,mmio32,0xf000,115200n8 
console=ttyS0,115200n8 print-fatal-signals=1";
};
 
aliases {
-   serial0 = 
+   serial0 = 
};
 
fpga {
@@ -41,13 +41,15 @@
#interrupt-cells = <1>;
};
 
-   arcuart0: serial@c0fc1000 {
-   compatible = "snps,arc-uart";
-   reg = <0xc0fc1000 0x100>;
-   interrupts = <5>;
-   clock-frequency = <8000>;
-   current-speed = <115200>;
-   status = "okay";
+   uart0: serial@f000 {
+   compatible = "ns16550a";
+   reg = <0xf000 0x2000>;
+   interrupts = <24>;
+   clock-frequency = <5000>;
+   baud = <115200>;
+   reg-shift = <2>;
+   reg-io-width = <4>;
+   no-loopback-test = <1>;
};
 
ethernet@c0fc2000 {
diff --git a/arch/arc/configs/nsim_700_defconfig 
b/arch/arc/configs/nsim_700_defconfig
index 9b2653b0b349..5c488140f537 100644
--- a/arch/arc/configs/nsim_700_defconfig
+++ b/arch/arc/configs/nsim_700_defconfig
@@ -41,8 +41,12 @@ CONFIG_LXT_PHY=y
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_SERIO is not set
 # CONFIG_LEGACY_PTYS is not set
-CONFIG_SERIAL_ARC=y
-CONFIG_SERIAL_ARC_CONSOLE=y
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_NR_UARTS=1
+CONFIG_SERIAL_8250_RUNTIME_UARTS=1
+CONFIG_SERIAL_8250_DW=y
+CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_HW_RANDOM is not set
 # CONFIG_HWMON is not set
 # CONFIG_HID is not set
-- 
2.21.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 6/8] ARC: merge HAPS-HS with nSIM-HS configs

2019-10-23 Thread Eugeniy Paltsev
Starting from nSIM 2019.06 is possible to use DW UART
instead of ARC UART. That allows us to merge
"nsim_hs" with "haps_hs" and "nsim_hs_smp" with "haps_hs_smp"
with minor changes which were done in previous commits.

We eliminate nsim_hs_defconfig and nsim_hs_smp_defconfig
and leave haps_hs_defconfig and haps_hs_smp_defconfig
which can be used on HAPS / nSIM / ZEBU / QEMU platforms
without additional changes in Linux kernel.

For nSIM we should now use UART property values
"-prop=nsim_mem-dev=uart0,kind=dwuart,base=0xf000"
instead of previously used
"-prop=nsim_mem-dev=uart0,base=0xc0fc1000"
"use_connect" and "irq" values of UART property remains untouched.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/Makefile  |  2 +-
 arch/arc/boot/dts/nsim_hs.dts  | 67 --
 arch/arc/boot/dts/nsim_hs_idu.dts  | 65 -
 arch/arc/configs/nsim_hs_defconfig | 56 -
 arch/arc/configs/nsim_hs_smp_defconfig | 54 -
 arch/arc/plat-sim/platform.c   |  1 -
 6 files changed, 1 insertion(+), 244 deletions(-)
 delete mode 100644 arch/arc/boot/dts/nsim_hs.dts
 delete mode 100644 arch/arc/boot/dts/nsim_hs_idu.dts
 delete mode 100644 arch/arc/configs/nsim_hs_defconfig
 delete mode 100644 arch/arc/configs/nsim_hs_smp_defconfig

diff --git a/arch/arc/Makefile b/arch/arc/Makefile
index f1c44cccf8d6..20e9ab6cc521 100644
--- a/arch/arc/Makefile
+++ b/arch/arc/Makefile
@@ -3,7 +3,7 @@
 # Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
 #
 
-KBUILD_DEFCONFIG := nsim_hs_defconfig
+KBUILD_DEFCONFIG := haps_hs_smp_defconfig
 
 ifeq ($(CROSS_COMPILE),)
 CROSS_COMPILE := $(call cc-cross-prefix, arc-linux- arceb-linux-)
diff --git a/arch/arc/boot/dts/nsim_hs.dts b/arch/arc/boot/dts/nsim_hs.dts
deleted file mode 100644
index 851798a5f4e3..
--- a/arch/arc/boot/dts/nsim_hs.dts
+++ /dev/null
@@ -1,67 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com)
- */
-/dts-v1/;
-
-/include/ "skeleton_hs.dtsi"
-
-/ {
-   model = "snps,nsim_hs";
-   compatible = "snps,nsim_hs";
-   #address-cells = <2>;
-   #size-cells = <2>;
-   interrupt-parent = <_intc>;
-
-   memory {
-   device_type = "memory";
-   /* CONFIG_LINUX_RAM_BASE needs to match low mem start */
-   reg = <0x0 0x8000 0x0 0x2000/* 512 MB low mem */
-  0x1 0x 0x0 0x4000>;  /* 1 GB highmem */
-   };
-
-   chosen {
-   bootargs = "earlycon=arc_uart,mmio32,0xc0fc1000,115200n8 
console=ttyARC0,115200n8 print-fatal-signals=1";
-   };
-
-   aliases {
-   serial0 = 
-   };
-
-   fpga {
-   compatible = "simple-bus";
-   #address-cells = <1>;
-   #size-cells = <1>;
-
-   /* only perip space at end of low mem accessible
-bus addr,   parent bus addr, size */
-   ranges = <0x8000 0x0 0x8000 0x8000>;
-
-   core_clk: core_clk {
-   #clock-cells = <0>;
-   compatible = "fixed-clock";
-   clock-frequency = <8000>;
-   };
-
-   core_intc: core-interrupt-controller {
-   compatible = "snps,archs-intc";
-   interrupt-controller;
-   #interrupt-cells = <1>;
-   };
-
-   arcuart0: serial@c0fc1000 {
-   compatible = "snps,arc-uart";
-   reg = <0xc0fc1000 0x100>;
-   interrupts = <24>;
-   clock-frequency = <8000>;
-   current-speed = <115200>;
-   status = "okay";
-   };
-
-   arcpct0: pct {
-   compatible = "snps,archs-pct";
-   #interrupt-cells = <1>;
-   interrupts = <20>;
-   };
-   };
-};
diff --git a/arch/arc/boot/dts/nsim_hs_idu.dts 
b/arch/arc/boot/dts/nsim_hs_idu.dts
deleted file mode 100644
index 6c559a0bd1f5..
--- a/arch/arc/boot/dts/nsim_hs_idu.dts
+++ /dev/null
@@ -1,65 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com)
- */
-/dts-v1/;
-
-/include/ "skeleton_hs_idu.dtsi"
-
-/ {
-   model = "snps,nsim_hs-smp";
-   compatible = "snps,nsim_hs";
-   interrupt-parent = <_intc>;
-
-   chosen {
-   bootargs = "earlyco

[PATCH 8/8] ARC: nSIM_700: remove unused network options

2019-10-23 Thread Eugeniy Paltsev
We have snps,arc-emac enabled in nSIM_700. It's obsolete and it's
not used anymore so remove its device tree node and disable
unused network options in defconfig.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/boot/dts/nsim_700.dts  | 16 
 arch/arc/configs/nsim_700_defconfig |  4 ++--
 2 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/arch/arc/boot/dts/nsim_700.dts b/arch/arc/boot/dts/nsim_700.dts
index ae9bc21fe11b..f8832a15e174 100644
--- a/arch/arc/boot/dts/nsim_700.dts
+++ b/arch/arc/boot/dts/nsim_700.dts
@@ -52,22 +52,6 @@
no-loopback-test = <1>;
};
 
-   ethernet@c0fc2000 {
-   compatible = "snps,arc-emac";
-   reg = <0xc0fc2000 0x3c>;
-   interrupts = <6>;
-   mac-address = [ 00 11 22 33 44 55 ];
-   clock-frequency = <8000>;
-   max-speed = <100>;
-   phy = <>;
-
-   #address-cells = <1>;
-   #size-cells = <0>;
-   phy0: ethernet-phy@0 {
-   reg = <1>;
-   };
-   };
-
arcpct0: pct {
compatible = "snps,arc700-pct";
};
diff --git a/arch/arc/configs/nsim_700_defconfig 
b/arch/arc/configs/nsim_700_defconfig
index 5c488140f537..326f6cde7826 100644
--- a/arch/arc/configs/nsim_700_defconfig
+++ b/arch/arc/configs/nsim_700_defconfig
@@ -35,8 +35,8 @@ CONFIG_DEVTMPFS=y
 # CONFIG_PREVENT_FIRMWARE_BUILD is not set
 # CONFIG_BLK_DEV is not set
 CONFIG_NETDEVICES=y
-CONFIG_ARC_EMAC=y
-CONFIG_LXT_PHY=y
+# CONFIG_ETHERNET is not set
+# CONFIG_WLAN is not set
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_SERIO is not set
-- 
2.21.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 5/8] ARC: HAPS: cleanup defconfigs from unused ETH drivers

2019-10-23 Thread Eugeniy Paltsev
We have multiple vendors ethernet drivers enabled in haps_hs and
haps_hs_smp defconfig. The only one we possibly require is
VIRTIO_NET. So disable unused ones via disabling entire
CONFIG_ETHERNET which controls all vendor-specific ethernet
drivers.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/configs/haps_hs_defconfig | 11 +--
 arch/arc/configs/haps_hs_smp_defconfig | 11 +--
 2 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/arch/arc/configs/haps_hs_defconfig 
b/arch/arc/configs/haps_hs_defconfig
index 33b7a402b6bd..7337cdf4ffdd 100644
--- a/arch/arc/configs/haps_hs_defconfig
+++ b/arch/arc/configs/haps_hs_defconfig
@@ -36,16 +36,7 @@ CONFIG_DEVTMPFS_MOUNT=y
 CONFIG_VIRTIO_BLK=y
 CONFIG_NETDEVICES=y
 CONFIG_VIRTIO_NET=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_SEEQ is not set
-# CONFIG_NET_VENDOR_STMICRO is not set
-# CONFIG_NET_VENDOR_VIA is not set
-# CONFIG_NET_VENDOR_WIZNET is not set
+# CONFIG_ETHERNET is not set
 # CONFIG_WLAN is not set
 CONFIG_INPUT_EVDEV=y
 # CONFIG_INPUT_KEYBOARD is not set
diff --git a/arch/arc/configs/haps_hs_smp_defconfig 
b/arch/arc/configs/haps_hs_smp_defconfig
index 5586511a00bf..bc927221afc0 100644
--- a/arch/arc/configs/haps_hs_smp_defconfig
+++ b/arch/arc/configs/haps_hs_smp_defconfig
@@ -37,16 +37,7 @@ CONFIG_DEVTMPFS=y
 # CONFIG_PREVENT_FIRMWARE_BUILD is not set
 # CONFIG_BLK_DEV is not set
 CONFIG_NETDEVICES=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_SEEQ is not set
-# CONFIG_NET_VENDOR_STMICRO is not set
-# CONFIG_NET_VENDOR_VIA is not set
-# CONFIG_NET_VENDOR_WIZNET is not set
+# CONFIG_ETHERNET is not set
 # CONFIG_WLAN is not set
 CONFIG_INPUT_EVDEV=y
 # CONFIG_INPUT_KEYBOARD is not set
-- 
2.21.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 3/8] ARC: HAPS: use same UART configuration everywhere

2019-10-23 Thread Eugeniy Paltsev
For some reason we use ns8250 UART compatible on UP HAPS
configuration and ns16550a (which is ns8250 with FIFO support)
on SMP HAPS configuration.
Given that we have same UART IP with same IP configuration
on both HAPS configuration use ns16550a compatible everywhere.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/boot/dts/haps_hs.dts | 2 +-
 arch/arc/boot/dts/haps_hs_idu.dts | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arc/boot/dts/haps_hs.dts b/arch/arc/boot/dts/haps_hs.dts
index 44bc522fdec8..11fad2f79056 100644
--- a/arch/arc/boot/dts/haps_hs.dts
+++ b/arch/arc/boot/dts/haps_hs.dts
@@ -47,7 +47,7 @@
};
 
uart0: serial@f000 {
-   compatible = "ns8250";
+   compatible = "ns16550a";
reg = <0xf000 0x2000>;
interrupts = <24>;
clock-frequency = <5000>;
diff --git a/arch/arc/boot/dts/haps_hs_idu.dts 
b/arch/arc/boot/dts/haps_hs_idu.dts
index 4d6971cf5f9f..738c76cd07b3 100644
--- a/arch/arc/boot/dts/haps_hs_idu.dts
+++ b/arch/arc/boot/dts/haps_hs_idu.dts
@@ -54,7 +54,6 @@
};
 
uart0: serial@f000 {
-   /* compatible = "ns8250"; Doesn't use FIFOs */
compatible = "ns16550a";
reg = <0xf000 0x2000>;
interrupt-parent = <_intc>;
-- 
2.21.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 4/8] ARC: HAPS: add HIGHMEM memory zone to DTS

2019-10-23 Thread Eugeniy Paltsev
This is required as a preparation of merging nSIM and HASP
defonfig and device tree.

As we have HIGHMEM disabled in both HAPS and nSIM defconfigs
this doesn't lead to any functional change.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/boot/dts/haps_hs.dts | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/arch/arc/boot/dts/haps_hs.dts b/arch/arc/boot/dts/haps_hs.dts
index 11fad2f79056..60d578e2781f 100644
--- a/arch/arc/boot/dts/haps_hs.dts
+++ b/arch/arc/boot/dts/haps_hs.dts
@@ -9,13 +9,15 @@
 / {
model = "snps,zebu_hs";
compatible = "snps,zebu_hs";
-   #address-cells = <1>;
-   #size-cells = <1>;
+   #address-cells = <2>;
+   #size-cells = <2>;
interrupt-parent = <_intc>;
 
memory {
device_type = "memory";
-   reg = <0x8000 0x2000>;  /* 512 */
+   /* CONFIG_LINUX_RAM_BASE needs to match low mem start */
+   reg = <0x0 0x8000 0x0 0x2000/* 512 MB low mem */
+  0x1 0x 0x0 0x4000>;  /* 1 GB highmem */
};
 
chosen {
@@ -31,8 +33,9 @@
#address-cells = <1>;
#size-cells = <1>;
 
-   /* child and parent address space 1:1 mapped */
-   ranges;
+   /* only perip space at end of low mem accessible
+ bus addr,  parent bus addr, size*/
+   ranges = <0x8000 0x0 0x8000 0x8000>;
 
core_clk: core_clk {
#clock-cells = <0>;
-- 
2.21.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [RFC 0/6] ARC: merge HAPS-HS with nSIM-HS configs

2019-10-22 Thread Eugeniy Paltsev
Btw, about nSIM regression runs:
We are using UP configuration for all nSIM runs and I propose to use pseudo-SMP 
 configuration (SMP configuration with only one CPU online) instead as our main 
target are SMP systems.

So -
run our verification jobs on both UP and pseudo-SMP nSIM
run uClibc-ng regression on pseudo-SMP only

 Any objections / thoughts?
---
 Eugeniy Paltsev



From: Vineet Gupta 
Sent: Friday, October 18, 2019 21:48
To: Eugeniy Paltsev; linux-snps-arc@lists.infradead.org; Vineet Gupta
Cc: Alexey Brodkin; linux-ker...@vger.kernel.org
Subject: Re: [RFC 0/6] ARC: merge HAPS-HS with nSIM-HS configs

On 10/18/19 5:15 AM, Eugeniy Paltsev wrote:
> Starting from nSIM 2019.06 is possible to use DW UART
> instead of ARC UART. That allows us to merge
> "nsim_hs" with "haps_hs" and "nsim_hs_smp" with "haps_hs_smp"
> mith some minor changes.
>
> We eliminate nsim_hs_defconfig and nsim_hs_smp_defconfig
> and leave haps_hs_defconfig and haps_hs_smp_defconfig
> which can be used on HAPS / nSIM / ZEBU / QEMU platforms
> without additionall changes in Linux kernel.

Thx for doing this, I was planning to do this myself.

But remember that doing this will disturb existing nsim setups
- Our internal linux/gnu regression jobs one of which tracks my for-curr and 
will
  fail immediately
- uClibc-ng maintainer who also seems to use nsim AFAIK for regression runs

So we need to notify parties involves (and it would be best that we align this 
to
a kernel release which anyways will be next one.

Also go thru the github wiki pages and wherever applicable please add the config
info for nsim (keep the old settings there for reference as well)

Thx,
-Vineet

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[RFC 1/6] ARC: regenerate nSIM and HAPS defconfigs

2019-10-18 Thread Eugeniy Paltsev
No functional change intended.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/configs/haps_hs_defconfig | 10 ++
 arch/arc/configs/haps_hs_smp_defconfig | 12 +++-
 arch/arc/configs/nsim_hs_defconfig |  8 ++--
 arch/arc/configs/nsim_hs_smp_defconfig | 10 +++---
 4 files changed, 10 insertions(+), 30 deletions(-)

diff --git a/arch/arc/configs/haps_hs_defconfig 
b/arch/arc/configs/haps_hs_defconfig
index 47ff8a97e42d..e22f40612089 100644
--- a/arch/arc/configs/haps_hs_defconfig
+++ b/arch/arc/configs/haps_hs_defconfig
@@ -4,6 +4,7 @@ CONFIG_POSIX_MQUEUE=y
 # CONFIG_CROSS_MEMORY_ATTACH is not set
 CONFIG_NO_HZ_IDLE=y
 CONFIG_HIGH_RES_TIMERS=y
+CONFIG_PREEMPT=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_NAMESPACES=y
@@ -15,13 +16,9 @@ CONFIG_EXPERT=y
 CONFIG_PERF_EVENTS=y
 # CONFIG_COMPAT_BRK is not set
 CONFIG_SLAB=y
+CONFIG_ARC_BUILTIN_DTB_NAME="haps_hs"
 CONFIG_MODULES=y
 # CONFIG_BLK_DEV_BSG is not set
-# CONFIG_IOSCHED_DEADLINE is not set
-# CONFIG_IOSCHED_CFQ is not set
-CONFIG_ISA_ARCV2=y
-CONFIG_ARC_BUILTIN_DTB_NAME="haps_hs"
-CONFIG_PREEMPT=y
 # CONFIG_COMPACTION is not set
 CONFIG_NET=y
 CONFIG_PACKET=y
@@ -30,9 +27,6 @@ CONFIG_UNIX=y
 CONFIG_UNIX_DIAG=y
 CONFIG_NET_KEY=y
 CONFIG_INET=y
-# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
-# CONFIG_INET_XFRM_MODE_TUNNEL is not set
-# CONFIG_INET_XFRM_MODE_BEET is not set
 # CONFIG_IPV6 is not set
 # CONFIG_WIRELESS is not set
 CONFIG_DEVTMPFS=y
diff --git a/arch/arc/configs/haps_hs_smp_defconfig 
b/arch/arc/configs/haps_hs_smp_defconfig
index 9685fd5f57a4..ff4fcd7640a4 100644
--- a/arch/arc/configs/haps_hs_smp_defconfig
+++ b/arch/arc/configs/haps_hs_smp_defconfig
@@ -4,6 +4,7 @@ CONFIG_POSIX_MQUEUE=y
 # CONFIG_CROSS_MEMORY_ATTACH is not set
 CONFIG_NO_HZ_IDLE=y
 CONFIG_HIGH_RES_TIMERS=y
+CONFIG_PREEMPT=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_NAMESPACES=y
@@ -16,15 +17,11 @@ CONFIG_PERF_EVENTS=y
 # CONFIG_VM_EVENT_COUNTERS is not set
 # CONFIG_COMPAT_BRK is not set
 CONFIG_SLAB=y
+CONFIG_SMP=y
+CONFIG_ARC_BUILTIN_DTB_NAME="haps_hs_idu"
 CONFIG_KPROBES=y
 CONFIG_MODULES=y
 # CONFIG_BLK_DEV_BSG is not set
-# CONFIG_IOSCHED_DEADLINE is not set
-# CONFIG_IOSCHED_CFQ is not set
-CONFIG_ISA_ARCV2=y
-CONFIG_SMP=y
-CONFIG_ARC_BUILTIN_DTB_NAME="haps_hs_idu"
-CONFIG_PREEMPT=y
 # CONFIG_COMPACTION is not set
 CONFIG_NET=y
 CONFIG_PACKET=y
@@ -33,9 +30,6 @@ CONFIG_UNIX=y
 CONFIG_UNIX_DIAG=y
 CONFIG_NET_KEY=y
 CONFIG_INET=y
-# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
-# CONFIG_INET_XFRM_MODE_TUNNEL is not set
-# CONFIG_INET_XFRM_MODE_BEET is not set
 # CONFIG_IPV6 is not set
 # CONFIG_WIRELESS is not set
 CONFIG_DEVTMPFS=y
diff --git a/arch/arc/configs/nsim_hs_defconfig 
b/arch/arc/configs/nsim_hs_defconfig
index bab3dd255841..60ad81769565 100644
--- a/arch/arc/configs/nsim_hs_defconfig
+++ b/arch/arc/configs/nsim_hs_defconfig
@@ -4,6 +4,7 @@ CONFIG_SYSVIPC=y
 CONFIG_POSIX_MQUEUE=y
 # CONFIG_CROSS_MEMORY_ATTACH is not set
 CONFIG_HIGH_RES_TIMERS=y
+CONFIG_PREEMPT=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_NAMESPACES=y
@@ -16,17 +17,13 @@ CONFIG_EMBEDDED=y
 CONFIG_PERF_EVENTS=y
 # CONFIG_SLUB_DEBUG is not set
 # CONFIG_COMPAT_BRK is not set
+CONFIG_ARC_BUILTIN_DTB_NAME="nsim_hs"
 CONFIG_KPROBES=y
 CONFIG_MODULES=y
 CONFIG_MODULE_FORCE_LOAD=y
 CONFIG_MODULE_UNLOAD=y
 CONFIG_MODULE_FORCE_UNLOAD=y
 # CONFIG_BLK_DEV_BSG is not set
-# CONFIG_IOSCHED_DEADLINE is not set
-# CONFIG_IOSCHED_CFQ is not set
-CONFIG_ISA_ARCV2=y
-CONFIG_ARC_BUILTIN_DTB_NAME="nsim_hs"
-CONFIG_PREEMPT=y
 # CONFIG_COMPACTION is not set
 CONFIG_NET=y
 CONFIG_PACKET=y
@@ -39,7 +36,6 @@ CONFIG_DEVTMPFS=y
 # CONFIG_STANDALONE is not set
 # CONFIG_PREVENT_FIRMWARE_BUILD is not set
 # CONFIG_BLK_DEV is not set
-# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_SERIO is not set
diff --git a/arch/arc/configs/nsim_hs_smp_defconfig 
b/arch/arc/configs/nsim_hs_smp_defconfig
index 90d2d50fb8dc..c7a29adfc147 100644
--- a/arch/arc/configs/nsim_hs_smp_defconfig
+++ b/arch/arc/configs/nsim_hs_smp_defconfig
@@ -2,6 +2,7 @@
 # CONFIG_SWAP is not set
 # CONFIG_CROSS_MEMORY_ATTACH is not set
 CONFIG_HIGH_RES_TIMERS=y
+CONFIG_PREEMPT=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_NAMESPACES=y
@@ -14,18 +15,14 @@ CONFIG_EMBEDDED=y
 CONFIG_PERF_EVENTS=y
 # CONFIG_SLUB_DEBUG is not set
 # CONFIG_COMPAT_BRK is not set
+CONFIG_SMP=y
+CONFIG_ARC_BUILTIN_DTB_NAME="nsim_hs_idu"
 CONFIG_KPROBES=y
 CONFIG_MODULES=y
 CONFIG_MODULE_FORCE_LOAD=y
 CONFIG_MODULE_UNLOAD=y
 CONFIG_MODULE_FORCE_UNLOAD=y
 # CONFIG_BLK_DEV_BSG is not set
-# CONFIG_IOSCHED_DEADLINE is not set
-# CONFIG_IOSCHED_CFQ is not set
-CONFIG_ISA_ARCV2=y
-CONFIG_SMP=y
-CONFIG_ARC_BUILTIN_DTB_NAME="nsim_hs_idu"
-CONFIG_PREEMPT=y
 # CONFIG_COMPACTION is not set
 CONFIG_NET=y
 CONFIG_PACKET=y
@@ -38,7 +35,6 @@ CONFIG_DEVTMPFS=y
 # CONFIG_STANDALONE is 

[RFC 4/6] ARC: HAPS: add HIGHMEM memory zone to DTS

2019-10-18 Thread Eugeniy Paltsev
This is required as a preparation of merging nSIM and HASP
defonfig and device tree.

As we have HIGHMEM disabled in both HAPS and nSIM defconfigs
this doesn't lead to any functional change.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/boot/dts/haps_hs.dts | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/arch/arc/boot/dts/haps_hs.dts b/arch/arc/boot/dts/haps_hs.dts
index 11fad2f79056..60d578e2781f 100644
--- a/arch/arc/boot/dts/haps_hs.dts
+++ b/arch/arc/boot/dts/haps_hs.dts
@@ -9,13 +9,15 @@
 / {
model = "snps,zebu_hs";
compatible = "snps,zebu_hs";
-   #address-cells = <1>;
-   #size-cells = <1>;
+   #address-cells = <2>;
+   #size-cells = <2>;
interrupt-parent = <_intc>;
 
memory {
device_type = "memory";
-   reg = <0x8000 0x2000>;  /* 512 */
+   /* CONFIG_LINUX_RAM_BASE needs to match low mem start */
+   reg = <0x0 0x8000 0x0 0x2000/* 512 MB low mem */
+  0x1 0x 0x0 0x4000>;  /* 1 GB highmem */
};
 
chosen {
@@ -31,8 +33,9 @@
#address-cells = <1>;
#size-cells = <1>;
 
-   /* child and parent address space 1:1 mapped */
-   ranges;
+   /* only perip space at end of low mem accessible
+ bus addr,  parent bus addr, size*/
+   ranges = <0x8000 0x0 0x8000 0x8000>;
 
core_clk: core_clk {
#clock-cells = <0>;
-- 
2.21.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[RFC 3/6] ARC: HAPS: use same UART configuration everywhere

2019-10-18 Thread Eugeniy Paltsev
For some reason we use ns8250 UART compatible on UP HAPS
configuration and ns16550a (which is ns8250 with FIFO support)
on SMP HAPS configuration.
Given that we have same UART IP with same IP configuration
on both HAPS configuration use ns16550a compatible everywhere.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/boot/dts/haps_hs.dts | 2 +-
 arch/arc/boot/dts/haps_hs_idu.dts | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arc/boot/dts/haps_hs.dts b/arch/arc/boot/dts/haps_hs.dts
index 44bc522fdec8..11fad2f79056 100644
--- a/arch/arc/boot/dts/haps_hs.dts
+++ b/arch/arc/boot/dts/haps_hs.dts
@@ -47,7 +47,7 @@
};
 
uart0: serial@f000 {
-   compatible = "ns8250";
+   compatible = "ns16550a";
reg = <0xf000 0x2000>;
interrupts = <24>;
clock-frequency = <5000>;
diff --git a/arch/arc/boot/dts/haps_hs_idu.dts 
b/arch/arc/boot/dts/haps_hs_idu.dts
index 4d6971cf5f9f..738c76cd07b3 100644
--- a/arch/arc/boot/dts/haps_hs_idu.dts
+++ b/arch/arc/boot/dts/haps_hs_idu.dts
@@ -54,7 +54,6 @@
};
 
uart0: serial@f000 {
-   /* compatible = "ns8250"; Doesn't use FIFOs */
compatible = "ns16550a";
reg = <0xf000 0x2000>;
interrupt-parent = <_intc>;
-- 
2.21.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[RFC 5/6] ARC: HAPS: cleanup defconfigs from unused ETH drivers

2019-10-18 Thread Eugeniy Paltsev
We have multiple vendors ethernet drivers enabled in haps_hs and
haps_hs_smp defconfig. The only one we possibly require is
VIRTIO_NET. So disable unused ones via disabling entire
CONFIG_ETHERNET which controls all vendor-specific ethernet
drivers.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/configs/haps_hs_defconfig | 11 +--
 arch/arc/configs/haps_hs_smp_defconfig | 11 +--
 2 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/arch/arc/configs/haps_hs_defconfig 
b/arch/arc/configs/haps_hs_defconfig
index 33b7a402b6bd..7337cdf4ffdd 100644
--- a/arch/arc/configs/haps_hs_defconfig
+++ b/arch/arc/configs/haps_hs_defconfig
@@ -36,16 +36,7 @@ CONFIG_DEVTMPFS_MOUNT=y
 CONFIG_VIRTIO_BLK=y
 CONFIG_NETDEVICES=y
 CONFIG_VIRTIO_NET=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_SEEQ is not set
-# CONFIG_NET_VENDOR_STMICRO is not set
-# CONFIG_NET_VENDOR_VIA is not set
-# CONFIG_NET_VENDOR_WIZNET is not set
+# CONFIG_ETHERNET is not set
 # CONFIG_WLAN is not set
 CONFIG_INPUT_EVDEV=y
 # CONFIG_INPUT_KEYBOARD is not set
diff --git a/arch/arc/configs/haps_hs_smp_defconfig 
b/arch/arc/configs/haps_hs_smp_defconfig
index 5586511a00bf..bc927221afc0 100644
--- a/arch/arc/configs/haps_hs_smp_defconfig
+++ b/arch/arc/configs/haps_hs_smp_defconfig
@@ -37,16 +37,7 @@ CONFIG_DEVTMPFS=y
 # CONFIG_PREVENT_FIRMWARE_BUILD is not set
 # CONFIG_BLK_DEV is not set
 CONFIG_NETDEVICES=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_SEEQ is not set
-# CONFIG_NET_VENDOR_STMICRO is not set
-# CONFIG_NET_VENDOR_VIA is not set
-# CONFIG_NET_VENDOR_WIZNET is not set
+# CONFIG_ETHERNET is not set
 # CONFIG_WLAN is not set
 CONFIG_INPUT_EVDEV=y
 # CONFIG_INPUT_KEYBOARD is not set
-- 
2.21.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[RFC 2/6] ARC: HAPS: cleanup defconfigs from unused IO-related options

2019-10-18 Thread Eugeniy Paltsev
We don't have any peripherals on HAPS which may require FB or
input_devices support. So get rid of them.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/configs/haps_hs_defconfig | 9 +++--
 arch/arc/configs/haps_hs_smp_defconfig | 9 +++--
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/arch/arc/configs/haps_hs_defconfig 
b/arch/arc/configs/haps_hs_defconfig
index e22f40612089..33b7a402b6bd 100644
--- a/arch/arc/configs/haps_hs_defconfig
+++ b/arch/arc/configs/haps_hs_defconfig
@@ -48,9 +48,9 @@ CONFIG_VIRTIO_NET=y
 # CONFIG_NET_VENDOR_WIZNET is not set
 # CONFIG_WLAN is not set
 CONFIG_INPUT_EVDEV=y
-CONFIG_MOUSE_PS2_TOUCHKIT=y
-# CONFIG_SERIO_SERPORT is not set
-CONFIG_SERIO_ARC_PS2=y
+# CONFIG_INPUT_KEYBOARD is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_SERIO is not set
 # CONFIG_LEGACY_PTYS is not set
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
@@ -60,9 +60,6 @@ CONFIG_SERIAL_8250_DW=y
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_HW_RANDOM is not set
 # CONFIG_HWMON is not set
-CONFIG_FB=y
-CONFIG_FRAMEBUFFER_CONSOLE=y
-CONFIG_LOGO=y
 # CONFIG_HID is not set
 # CONFIG_USB_SUPPORT is not set
 CONFIG_VIRTIO_MMIO=y
diff --git a/arch/arc/configs/haps_hs_smp_defconfig 
b/arch/arc/configs/haps_hs_smp_defconfig
index ff4fcd7640a4..5586511a00bf 100644
--- a/arch/arc/configs/haps_hs_smp_defconfig
+++ b/arch/arc/configs/haps_hs_smp_defconfig
@@ -49,9 +49,9 @@ CONFIG_NETDEVICES=y
 # CONFIG_NET_VENDOR_WIZNET is not set
 # CONFIG_WLAN is not set
 CONFIG_INPUT_EVDEV=y
-CONFIG_MOUSE_PS2_TOUCHKIT=y
-# CONFIG_SERIO_SERPORT is not set
-CONFIG_SERIO_ARC_PS2=y
+# CONFIG_INPUT_KEYBOARD is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_SERIO is not set
 # CONFIG_LEGACY_PTYS is not set
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
@@ -61,9 +61,6 @@ CONFIG_SERIAL_8250_DW=y
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_HW_RANDOM is not set
 # CONFIG_HWMON is not set
-CONFIG_FB=y
-CONFIG_FRAMEBUFFER_CONSOLE=y
-CONFIG_LOGO=y
 # CONFIG_HID is not set
 # CONFIG_USB_SUPPORT is not set
 # CONFIG_IOMMU_SUPPORT is not set
-- 
2.21.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[RFC 0/6] ARC: merge HAPS-HS with nSIM-HS configs

2019-10-18 Thread Eugeniy Paltsev
Starting from nSIM 2019.06 is possible to use DW UART
instead of ARC UART. That allows us to merge
"nsim_hs" with "haps_hs" and "nsim_hs_smp" with "haps_hs_smp"
mith some minor changes.

We eliminate nsim_hs_defconfig and nsim_hs_smp_defconfig
and leave haps_hs_defconfig and haps_hs_smp_defconfig
which can be used on HAPS / nSIM / ZEBU / QEMU platforms
without additionall changes in Linux kernel.

Eugeniy Paltsev (6):
  ARC: regenerate nSIM and HAPS defconfigs
  ARC: HAPS: cleanup defconfigs from unused IO-related options
  ARC: HAPS: use same UART configuration everywhere
  ARC: HAPS: add HIGHMEM memory zone to DTS
  ARC: HAPS: cleanup defconfigs from unused ETH drivers
  ARC: merge HAPS-HS with nSIM-HS configs

 arch/arc/boot/dts/haps_hs.dts  | 15 +++---
 arch/arc/boot/dts/haps_hs_idu.dts  |  1 -
 arch/arc/boot/dts/nsim_hs.dts  | 67 --
 arch/arc/boot/dts/nsim_hs_idu.dts  | 65 -
 arch/arc/configs/haps_hs_defconfig | 30 +++-
 arch/arc/configs/haps_hs_smp_defconfig | 32 +++-
 arch/arc/configs/nsim_hs_defconfig | 60 ---
 arch/arc/configs/nsim_hs_smp_defconfig | 58 --
 arch/arc/plat-sim/platform.c   |  1 -
 9 files changed, 22 insertions(+), 307 deletions(-)
 delete mode 100644 arch/arc/boot/dts/nsim_hs.dts
 delete mode 100644 arch/arc/boot/dts/nsim_hs_idu.dts
 delete mode 100644 arch/arc/configs/nsim_hs_defconfig
 delete mode 100644 arch/arc/configs/nsim_hs_smp_defconfig

-- 
2.21.0

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[RFC 6/6] ARC: merge HAPS-HS with nSIM-HS configs

2019-10-18 Thread Eugeniy Paltsev
Starting from nSIM 2019.06 is possible to use DW UART
instead of ARC UART. That allows us to merge
"nsim_hs" with "haps_hs" and "nsim_hs_smp" with "haps_hs_smp"
mith minor changes which were done in previous commits.

We eliminate nsim_hs_defconfig and nsim_hs_smp_defconfig
and leave haps_hs_defconfig and haps_hs_smp_defconfig
which can be used on HAPS / nSIM / ZEBU / QEMU platforms
without additionall changes in Linux kernel.

For nSIM we should now use UART property values
"-prop=nsim_mem-dev=uart0,kind=dwuart,base=0xf000"
instead of previously used
"-prop=nsim_mem-dev=uart0,base=0xc0fc1000"
"use_connect" and "irq" values of UART property remains untouched.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/boot/dts/nsim_hs.dts  | 67 --
 arch/arc/boot/dts/nsim_hs_idu.dts  | 65 -
 arch/arc/configs/nsim_hs_defconfig | 56 -
 arch/arc/configs/nsim_hs_smp_defconfig | 54 -
 arch/arc/plat-sim/platform.c   |  1 -
 5 files changed, 243 deletions(-)
 delete mode 100644 arch/arc/boot/dts/nsim_hs.dts
 delete mode 100644 arch/arc/boot/dts/nsim_hs_idu.dts
 delete mode 100644 arch/arc/configs/nsim_hs_defconfig
 delete mode 100644 arch/arc/configs/nsim_hs_smp_defconfig

diff --git a/arch/arc/boot/dts/nsim_hs.dts b/arch/arc/boot/dts/nsim_hs.dts
deleted file mode 100644
index 851798a5f4e3..
--- a/arch/arc/boot/dts/nsim_hs.dts
+++ /dev/null
@@ -1,67 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com)
- */
-/dts-v1/;
-
-/include/ "skeleton_hs.dtsi"
-
-/ {
-   model = "snps,nsim_hs";
-   compatible = "snps,nsim_hs";
-   #address-cells = <2>;
-   #size-cells = <2>;
-   interrupt-parent = <_intc>;
-
-   memory {
-   device_type = "memory";
-   /* CONFIG_LINUX_RAM_BASE needs to match low mem start */
-   reg = <0x0 0x8000 0x0 0x2000/* 512 MB low mem */
-  0x1 0x 0x0 0x4000>;  /* 1 GB highmem */
-   };
-
-   chosen {
-   bootargs = "earlycon=arc_uart,mmio32,0xc0fc1000,115200n8 
console=ttyARC0,115200n8 print-fatal-signals=1";
-   };
-
-   aliases {
-   serial0 = 
-   };
-
-   fpga {
-   compatible = "simple-bus";
-   #address-cells = <1>;
-   #size-cells = <1>;
-
-   /* only perip space at end of low mem accessible
-bus addr,   parent bus addr, size */
-   ranges = <0x8000 0x0 0x8000 0x8000>;
-
-   core_clk: core_clk {
-   #clock-cells = <0>;
-   compatible = "fixed-clock";
-   clock-frequency = <8000>;
-   };
-
-   core_intc: core-interrupt-controller {
-   compatible = "snps,archs-intc";
-   interrupt-controller;
-   #interrupt-cells = <1>;
-   };
-
-   arcuart0: serial@c0fc1000 {
-   compatible = "snps,arc-uart";
-   reg = <0xc0fc1000 0x100>;
-   interrupts = <24>;
-   clock-frequency = <8000>;
-   current-speed = <115200>;
-   status = "okay";
-   };
-
-   arcpct0: pct {
-   compatible = "snps,archs-pct";
-   #interrupt-cells = <1>;
-   interrupts = <20>;
-   };
-   };
-};
diff --git a/arch/arc/boot/dts/nsim_hs_idu.dts 
b/arch/arc/boot/dts/nsim_hs_idu.dts
deleted file mode 100644
index 6c559a0bd1f5..
--- a/arch/arc/boot/dts/nsim_hs_idu.dts
+++ /dev/null
@@ -1,65 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com)
- */
-/dts-v1/;
-
-/include/ "skeleton_hs_idu.dtsi"
-
-/ {
-   model = "snps,nsim_hs-smp";
-   compatible = "snps,nsim_hs";
-   interrupt-parent = <_intc>;
-
-   chosen {
-   bootargs = "earlycon=arc_uart,mmio32,0xc0fc1000,115200n8 
console=ttyARC0,115200n8 print-fatal-signals=1";
-   };
-
-   aliases {
-   serial0 = 
-   };
-
-   fpga {
-   compatible = "simple-bus";
-   #address-cells = <1>;
-   #size-cells = <1>;
-
-   /* child and parent address space 1:1 mapped */
-   ranges;
-
-   core_clk: core_clk {
-  

[PATCH 1/2] ARC: [plat-hsdk]: Enable on-board SPI NOR flash IC

2019-10-18 Thread Eugeniy Paltsev
HSDK board has sst26wf016b SPI NOR flash IC installed, enable it.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/boot/dts/hsdk.dts  | 8 
 arch/arc/configs/hsdk_defconfig | 2 ++
 2 files changed, 10 insertions(+)

diff --git a/arch/arc/boot/dts/hsdk.dts b/arch/arc/boot/dts/hsdk.dts
index bfc7f5f5d6f2..9bea5daadd23 100644
--- a/arch/arc/boot/dts/hsdk.dts
+++ b/arch/arc/boot/dts/hsdk.dts
@@ -264,6 +264,14 @@
clocks = <_clk>;
cs-gpios = <_gpio 0 GPIO_ACTIVE_LOW>,
   <_gpio 1 GPIO_ACTIVE_LOW>;
+
+   spi-flash@0 {
+   compatible = "sst26wf016b", "jedec,spi-nor";
+   reg = <0>;
+   #address-cells = <1>;
+   #size-cells = <1>;
+   spi-max-frequency = <400>;
+   };
};
 
creg_gpio: gpio@14b0 {
diff --git a/arch/arc/configs/hsdk_defconfig b/arch/arc/configs/hsdk_defconfig
index 9b9a7ce2..22fc70396a3b 100644
--- a/arch/arc/configs/hsdk_defconfig
+++ b/arch/arc/configs/hsdk_defconfig
@@ -32,6 +32,8 @@ CONFIG_INET=y
 CONFIG_DEVTMPFS=y
 # CONFIG_STANDALONE is not set
 # CONFIG_PREVENT_FIRMWARE_BUILD is not set
+CONFIG_MTD=y
+CONFIG_MTD_SPI_NOR=y
 CONFIG_SCSI=y
 CONFIG_BLK_DEV_SD=y
 CONFIG_NETDEVICES=y
-- 
2.21.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 0/2] ARC: [plat-hsdk]: enable on-board SPI peripherals

2019-10-18 Thread Eugeniy Paltsev
HSDK board has SPI flash IC and SPI ADC IC. As all SPI-related
blocking changes/fixes are finally applied we can enable them.

Eugeniy Paltsev (2):
  ARC: [plat-hsdk]: Enable on-board SPI NOR flash IC
  ARC: [plat-hsdk]: Enable on-boardi SPI ADC IC

 arch/arc/boot/dts/hsdk.dts  | 23 +++
 arch/arc/configs/hsdk_defconfig |  6 ++
 2 files changed, 29 insertions(+)

-- 
2.21.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 2/2] ARC: [plat-hsdk]: Enable on-boardi SPI ADC IC

2019-10-18 Thread Eugeniy Paltsev
HSDK board has adc108s102 SPI ADC IC installed, enable it.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/boot/dts/hsdk.dts  | 15 +++
 arch/arc/configs/hsdk_defconfig |  4 
 2 files changed, 19 insertions(+)

diff --git a/arch/arc/boot/dts/hsdk.dts b/arch/arc/boot/dts/hsdk.dts
index 9bea5daadd23..9acbeba832c0 100644
--- a/arch/arc/boot/dts/hsdk.dts
+++ b/arch/arc/boot/dts/hsdk.dts
@@ -65,6 +65,14 @@
clock-frequency = <>;
};
 
+   reg_5v0: regulator-5v0 {
+   compatible = "regulator-fixed";
+
+   regulator-name = "5v0-supply";
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   };
+
cpu_intc: cpu-interrupt-controller {
compatible = "snps,archs-intc";
interrupt-controller;
@@ -272,6 +280,13 @@
#size-cells = <1>;
spi-max-frequency = <400>;
};
+
+   adc@1 {
+   compatible = "ti,adc108s102";
+   reg = <1>;
+   vref-supply = <_5v0>;
+   spi-max-frequency = <100>;
+   };
};
 
creg_gpio: gpio@14b0 {
diff --git a/arch/arc/configs/hsdk_defconfig b/arch/arc/configs/hsdk_defconfig
index 22fc70396a3b..0974226fab55 100644
--- a/arch/arc/configs/hsdk_defconfig
+++ b/arch/arc/configs/hsdk_defconfig
@@ -57,6 +57,8 @@ CONFIG_GPIO_SYSFS=y
 CONFIG_GPIO_DWAPB=y
 CONFIG_GPIO_SNPS_CREG=y
 # CONFIG_HWMON is not set
+CONFIG_REGULATOR=y
+CONFIG_REGULATOR_FIXED_VOLTAGE=y
 CONFIG_DRM=y
 # CONFIG_DRM_FBDEV_EMULATION is not set
 CONFIG_DRM_UDL=y
@@ -74,6 +76,8 @@ CONFIG_MMC_SDHCI_PLTFM=y
 CONFIG_MMC_DW=y
 CONFIG_DMADEVICES=y
 CONFIG_DW_AXI_DMAC=y
+CONFIG_IIO=y
+CONFIG_TI_ADC108S102=y
 CONFIG_EXT3_FS=y
 CONFIG_VFAT_FS=y
 CONFIG_TMPFS=y
-- 
2.21.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH] ARC: unwind: Mark expected switch fall-through

2019-08-29 Thread Eugeniy Paltsev
Hi Gustavo,

I guess this patch is already sent as a pull request to 'v5.3-rc7' by Vineet:
https://www.mail-archive.com/linux-snps-arc@lists.infradead.org/msg05854.html

---
 Eugeniy Paltsev



From: linux-snps-arc  on behalf of 
Gustavo A. R. Silva 
Sent: Thursday, August 29, 2019 04:47
To: Vineet Gupta
Cc: linux-snps-arc@lists.infradead.org; linux-ker...@vger.kernel.org
Subject: Re: [PATCH] ARC: unwind: Mark expected switch fall-through

Hi,

Friendly ping:

Who can take this, please?

Thanks
--
Gustavo

On 8/20/19 8:29 PM, Gustavo A. R. Silva wrote:
> Mark switch cases where we are expecting to fall through.
>
> This patch fixes the following warnings (Building: haps_hs_defconfig arc):
>
> arch/arc/kernel/unwind.c: In function ‘read_pointer’:
> ./include/linux/compiler.h:328:5: warning: this statement may fall through 
> [-Wimplicit-fallthrough=]
>   do {\
>  ^
> ./include/linux/compiler.h:338:2: note: in expansion of macro 
> ‘__compiletime_assert’
>   __compiletime_assert(condition, msg, prefix, suffix)
>   ^~~~
> ./include/linux/compiler.h:350:2: note: in expansion of macro 
> ‘_compiletime_assert’
>   _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
>   ^~~
> ./include/linux/build_bug.h:39:37: note: in expansion of macro 
> ‘compiletime_assert’
>  #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
>  ^~
> ./include/linux/build_bug.h:50:2: note: in expansion of macro 
> ‘BUILD_BUG_ON_MSG’
>   BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
>   ^~~~
> arch/arc/kernel/unwind.c:573:3: note: in expansion of macro ‘BUILD_BUG_ON’
>BUILD_BUG_ON(sizeof(u32) != sizeof(value));
>^~~~
> arch/arc/kernel/unwind.c:575:2: note: here
>   case DW_EH_PE_native:
>   ^~~~
>
> Signed-off-by: Gustavo A. R. Silva 
> ---
>  arch/arc/kernel/unwind.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/arc/kernel/unwind.c b/arch/arc/kernel/unwind.c
> index 445e4d702f43..dc05a63516f5 100644
> --- a/arch/arc/kernel/unwind.c
> +++ b/arch/arc/kernel/unwind.c
> @@ -572,6 +572,7 @@ static unsigned long read_pointer(const u8 **pLoc, const 
> void *end,
>  #else
>   BUILD_BUG_ON(sizeof(u32) != sizeof(value));
>  #endif
> + /* Fall through */
>   case DW_EH_PE_native:
>   if (end < (const void *)(ptr.pul + 1))
>   return 0;
>

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.infradead.org_mailman_listinfo_linux-2Dsnps-2Darc=DwIGaQ=DPL6_X_6JkXFx7AXWqB0tg=ZlJN1MriPUTkBKCrPSx67GmaplEUGcAEk9yPtCLdUXI=GJ6OJTL5qRgb-RdlLBhiFzZH5ZmLXf2lxjuQgwbw7n8=1TapZixYsKQRFCCPkofjhki-eZ34KmyqojUdAxceNNA=

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v2] ARC: [plat-hsdk]: allow to switch between AXI DMAC port configurations

2019-07-22 Thread Eugeniy Paltsev
We want to use DW AXI DMAC on HSDK board in our automated verification
to test cache & dma kernel code changes. This is perfect candidate
as we don't depend on any external peripherals like MMC card / USB
storage / etc.
To increase test coverage we want to test both options:
 * DW AXI DMAC is connected through IOC port & dma direct ops used
 * DW AXI DMAC is connected to DDR port & dma noncoherent ops used

Introduce 'arc_hsdk_axi_dmac_coherent' global variable which can be
modified by debugger (same way as we patch 'ioc_enable') to switch
between these options without recompiling the kernel.
Depend on this value we tweak memory bridge configuration and
"dma-coherent" DTS property of DW AXI DMAC.

Signed-off-by: Eugeniy Paltsev 
---
Changes v1->v2:
 * Force putting arc_hsdk_axi_dmac_coherent to data section
 * Add missed __init to hsdk_tweak_node_coherency

 arch/arc/boot/dts/Makefile|  3 ++
 arch/arc/plat-hsdk/platform.c | 87 ++-
 2 files changed, 78 insertions(+), 12 deletions(-)

diff --git a/arch/arc/boot/dts/Makefile b/arch/arc/boot/dts/Makefile
index a83c4f5e928b..8483a86c743d 100644
--- a/arch/arc/boot/dts/Makefile
+++ b/arch/arc/boot/dts/Makefile
@@ -12,3 +12,6 @@ dtb-y := $(builtindtb-y).dtb
 # for CONFIG_OF_ALL_DTBS test
 dtstree:= $(srctree)/$(src)
 dtb-   := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard $(dtstree)/*.dts))
+
+# board-specific dtc flags
+DTC_FLAGS_hsdk += --pad 20
diff --git a/arch/arc/plat-hsdk/platform.c b/arch/arc/plat-hsdk/platform.c
index 7dd2dd335cf6..0b961a2a10b8 100644
--- a/arch/arc/plat-hsdk/platform.c
+++ b/arch/arc/plat-hsdk/platform.c
@@ -6,11 +6,15 @@
  */
 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
 #include 
 
+int arc_hsdk_axi_dmac_coherent __section(.data) = 0;
+
 #define ARC_CCM_UNUSED_ADDR0x6000
 
 static void __init hsdk_init_per_cpu(unsigned int cpu)
@@ -97,6 +101,42 @@ static void __init hsdk_enable_gpio_intc_wire(void)
iowrite32(GPIO_INT_CONNECTED_MASK, (void __iomem *) GPIO_INTEN);
 }
 
+static int __init hsdk_tweak_node_coherency(const char *path, bool coherent)
+{
+   void *fdt = initial_boot_params;
+   const void *prop;
+   int node, ret;
+   bool dt_coh_set;
+
+   node = fdt_path_offset(fdt, path);
+   if (node < 0)
+   goto tweak_fail;
+
+   prop = fdt_getprop(fdt, node, "dma-coherent", );
+   if (!prop && ret != -FDT_ERR_NOTFOUND)
+   goto tweak_fail;
+
+   dt_coh_set = ret != -FDT_ERR_NOTFOUND;
+   ret = 0;
+
+   /* need to remove "dma-coherent" property */
+   if (dt_coh_set && !coherent)
+   ret = fdt_delprop(fdt, node, "dma-coherent");
+
+   /* need to set "dma-coherent" property */
+   if (!dt_coh_set && coherent)
+   ret = fdt_setprop(fdt, node, "dma-coherent", NULL, 0);
+
+   if (ret < 0)
+   goto tweak_fail;
+
+   return 0;
+
+tweak_fail:
+   pr_err("failed to tweak %s to %scoherent\n", path, coherent ? "" : 
"non");
+   return -EFAULT;
+}
+
 enum hsdk_axi_masters {
M_HS_CORE = 0,
M_HS_RTT,
@@ -162,6 +202,39 @@ enum hsdk_axi_masters {
 #define CREG_PAE   ((void __iomem *)(CREG_BASE + 0x180))
 #define CREG_PAE_UPDT  ((void __iomem *)(CREG_BASE + 0x194))
 
+static void __init hsdk_init_memory_bridge_axi_dmac(void)
+{
+   bool coherent = !!arc_hsdk_axi_dmac_coherent;
+   u32 axi_m_slv1, axi_m_oft1;
+
+   /*
+* Don't tweak memory bridge configuration if we failed to tweak DTB
+* as we will end up in a inconsistent state.
+*/
+   if (hsdk_tweak_node_coherency("/soc/dmac@8", coherent))
+   return;
+
+   if (coherent) {
+   axi_m_slv1 = 0x7799;
+   axi_m_oft1 = 0x76DCBA98;
+   } else {
+   axi_m_slv1 = 0x;
+   axi_m_oft1 = 0x76543210;
+   }
+
+   writel(0x, CREG_AXI_M_SLV0(M_DMAC_0));
+   writel(0xFEDCBA98, CREG_AXI_M_OFT0(M_DMAC_0));
+   writel(axi_m_slv1, CREG_AXI_M_SLV1(M_DMAC_0));
+   writel(axi_m_oft1, CREG_AXI_M_OFT1(M_DMAC_0));
+   writel(UPDATE_VAL, CREG_AXI_M_UPDT(M_DMAC_0));
+
+   writel(0x, CREG_AXI_M_SLV0(M_DMAC_1));
+   writel(0xFEDCBA98, CREG_AXI_M_OFT0(M_DMAC_1));
+   writel(axi_m_slv1, CREG_AXI_M_SLV1(M_DMAC_1));
+   writel(axi_m_oft1, CREG_AXI_M_OFT1(M_DMAC_1));
+   writel(UPDATE_VAL, CREG_AXI_M_UPDT(M_DMAC_1));
+}
+
 static void __init hsdk_init_memory_bridge(void)
 {
u32 reg;
@@ -227,24 +300,14 @@ static void __init hsdk_init_memory_bridge(void)
writel(0x76543210, CREG_AXI_M_OFT1(M_GPU));
writel(UPDATE_VAL, CREG_AXI_M_UPDT(M_GPU));
 
-   writel(0x, CREG_AXI_M_SLV0(M_DMAC_0));
-   writel(0x, CREG_AXI_M_SLV1(M_

Re: [TRIVIAL PATCH] of: per-file dtc preprocessor flags

2019-07-20 Thread Eugeniy Paltsev
Hi Masahiro,

On Sat, 2019-07-20 at 11:40 +0900, Masahiro Yamada wrote:
> On Sat, Jul 20, 2019 at 4:28 AM Eugeniy Paltsev
>  wrote:
> > As of today we are able to pass custom flags to dtc compiler but not
> > to dtc preprocessor.
> > This ability is required for including some board-specific header files.
> > It allows us to pass defined constants to dts without their duplication
> > in several places.
> 
> How to use this option in a useful way?
> 
> I see a bunch of defined constants under include/dt-bindings/.
> 
> If you are talking about code duplication across architectures,
> you can include arm dtsi from arm64 dts, or vice versa.
> This was made possible by the symbolic links
> in scripts/dtc/include-prefixes/.
> 
> Could you please elaborate your issues if you cannot solve them
> by the current strategy?
> 

Here is the example:

We have several FPGA-based boards (haps_hs, haps_hs_idu,...) which are involved
in SW and HW automated verification. For some tests we randomize physical memory
location so we patch 'CONFIG_LINUX_RAM_BASE' kconfig variable and 'memory' node 
in
device tree. We want to keep number of patches as less as possible (to avoid
conflicts on their applying) so we want to avoid duplication and pass
'CONFIG_LINUX_RAM_BASE' directly to dts by including it from
'include/generated/autoconf.h':

->8
memory {
device_type = "memory";
-   /* CONFIG_LINUX_RAM_BASE needs to match low mem start */
-   reg = <0x8000 0x2000>;  /* 512 */
+   reg = ;  /* 512 */
};
->8

This patch allows us to extend the search path of include files to
include 'include/generated/autoconf.h'.

> 
> > Signed-off-by: Eugeniy Paltsev 
> > ---
> >  scripts/Makefile.lib | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> > index f1f38c8cdc74..f2595a608dce 100644
> > --- a/scripts/Makefile.lib
> > +++ b/scripts/Makefile.lib
> > @@ -166,6 +166,8 @@ dtc_cpp_flags  = -Wp,-MD,$(depfile).pre.tmp -nostdinc   
> >  \
> >  $(addprefix -I,$(DTC_INCLUDE))  \
> >  -undef -D__DTS__
> > 
> > +dtc_cpp_flags  += $(DTC_CPP_FLAGS_$(basetarget))
> > +
> >  # Useful for describing the dependency of composite objects
> >  # Usage:
> >  #   $(call multi_depend, multi_used_targets, suffix_to_remove, 
> > suffix_to_add)
> > --
> > 2.21.0
> > 
> 
> 
-- 
 Eugeniy Paltsev
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


  1   2   3   4   5   >