public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: Daniel Palmer <daniel@0x0f•com>
Cc: "Linus Walleij" <linus.walleij@linaro•org>,
	"Masahiro Yamada" <yamada.masahiro@socionext•com>,
	"Daniel Palmer" <daniel@thingy•jp>,
	"Benjamin Gaignard" <benjamin.gaignard@linaro•org>,
	"Sam Ravnborg" <sam@ravnborg•org>,
	"Ard Biesheuvel" <ardb@kernel•org>,
	"Stephan Gerhold" <stephan@gerhold•net>,
	"Jonathan Corbet" <corbet@lwn•net>,
	"Mauro Carvalho Chehab" <mchehab+huawei@kernel•org>,
	"Heiko Stuebner" <heiko.stuebner@theobroma-systems•com>,
	daniel@0x0f•com, "Russell King" <linux@armlinux•org.uk>,
	"Bartosz Golaszewski" <bgolaszewski@baylibre•com>,
	linux-arm-kernel@lists•infradead.org,
	"Nathan Huckleberry" <nhuck15@gmail•com>,
	devicetree@vger•kernel.org, "Arnd Bergmann" <arnd@arndb•de>,
	allen <allen.chen@ite•com.tw>,
	tim.bird@sony•com, "Maxime Ripard" <mripard@kernel•org>,
	"Lubomir Rintel" <lkundrak@v3•sk>,
	"Rob Herring" <robh+dt@kernel•org>,
	"Gregory Fong" <gregory.0xf0@gmail•com>,
	"Doug Anderson" <armlinux@m•disordat.com>,
	"Nathan Chancellor" <natechancellor@gmail•com>,
	k@japko•eu, "Christian Lamparter" <chunkeey@gmail•com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation•org>,
	"Nick Desaulniers" <ndesaulniers@google•com>,
	linux-kernel@vger•kernel.org, "Andreas Färber" <afaerber@suse•de>,
	"Mark Brown" <broonie@kernel•org>,
	"Marc Zyngier" <maz@kernel•org>,
	"Andrew Morton" <akpm@linux-foundation•org>,
	"David S. Miller" <davem@davemloft•net>,
	"Mike Rapoport" <rppt@kernel•org>
Subject: [PATCH v2 2/5] ARM: mstar: Add machine for MStar/Sigmastar infinity/mercury family ARMv7 SoCs
Date: Wed, 10 Jun 2020 18:04:00 +0900	[thread overview]
Message-ID: <20200610090421.3428945-3-daniel@0x0f.com> (raw)
In-Reply-To: <20191014061617.10296-2-daniel@0x0f.com>

Initial support for the MStar/Sigmastar infinity/mercury series of ARMv7
based IP camera and dashcam SoCs.

These chips are interesting in that they contain a Cortex A7,
peripherals and system memory in a single tiny QFN package that
can be hand soldered allowing almost anyone to embed Linux
in their projects.

Signed-off-by: Daniel Palmer <daniel@0x0f•com>
---
 MAINTAINERS                   |  1 +
 arch/arm/Kconfig              |  2 +
 arch/arm/Makefile             |  1 +
 arch/arm/mach-mstar/Kconfig   | 26 +++++++++++++
 arch/arm/mach-mstar/Makefile  |  1 +
 arch/arm/mach-mstar/mstarv7.c | 72 +++++++++++++++++++++++++++++++++++
 6 files changed, 103 insertions(+)
 create mode 100644 arch/arm/mach-mstar/Kconfig
 create mode 100644 arch/arm/mach-mstar/Makefile
 create mode 100644 arch/arm/mach-mstar/mstarv7.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 1ca77f97b8ee..754521938303 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2114,6 +2114,7 @@ ARM/MStar/Sigmastar ARMv7 SoC support
 M:	Daniel Palmer <daniel@thingy•jp>
 L:	linux-arm-kernel@lists•infradead.org (moderated for non-subscribers)
 S:	Maintained
+F:	arch/arm/mach-mstar/
 F:	Documentation/devicetree/bindings/arm/mstar.yaml
 
 ARM/NEC MOBILEPRO 900/c MACHINE SUPPORT
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index fb6c85c5d344..e466694f8486 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -669,6 +669,8 @@ source "arch/arm/mach-mmp/Kconfig"
 
 source "arch/arm/mach-moxart/Kconfig"
 
+source "arch/arm/mach-mstar/Kconfig"
+
 source "arch/arm/mach-mv78xx0/Kconfig"
 
 source "arch/arm/mach-mvebu/Kconfig"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 59fde2d598d8..e7f4ca060c0f 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -197,6 +197,7 @@ machine-$(CONFIG_ARCH_MXC)		+= imx
 machine-$(CONFIG_ARCH_MEDIATEK)		+= mediatek
 machine-$(CONFIG_ARCH_MILBEAUT)		+= milbeaut
 machine-$(CONFIG_ARCH_MXS)		+= mxs
+machine-$(CONFIG_ARCH_MSTARV7)		+= mstar
 machine-$(CONFIG_ARCH_NOMADIK)		+= nomadik
 machine-$(CONFIG_ARCH_NPCM)		+= npcm
 machine-$(CONFIG_ARCH_NSPIRE)		+= nspire
diff --git a/arch/arm/mach-mstar/Kconfig b/arch/arm/mach-mstar/Kconfig
new file mode 100644
index 000000000000..6235d0a7860a
--- /dev/null
+++ b/arch/arm/mach-mstar/Kconfig
@@ -0,0 +1,26 @@
+menuconfig ARCH_MSTARV7
+	bool "MStar/Sigmastar ARMv7 SoC Support"
+	depends on ARCH_MULTI_V7
+	select ARM_GIC
+	select ARM_HEAVY_MB
+	help
+	  Support for newer MStar/Sigmastar SoC families that are
+	  based on ARMv7 cores like the Cortex A7 and share the same
+	  basic hardware like the infinity and mercury series.
+
+if ARCH_MSTARV7
+
+config MACH_INFINITY
+	bool "MStar/Sigmastar infinity SoC support"
+	default ARCH_MSTARV7
+	help
+	  Support for MStar/Sigmastar infinity IP camera SoCs.
+
+config MACH_MERCURY
+	bool "MStar/Sigmastar mercury SoC support"
+	default ARCH_MSTARV7
+	help
+	  Support for MStar/Sigmastar mercury dash camera SoCs.
+	  Note that older Mercury2 SoCs are ARM9 based and not supported.
+
+endif
diff --git a/arch/arm/mach-mstar/Makefile b/arch/arm/mach-mstar/Makefile
new file mode 100644
index 000000000000..93b0391ede7e
--- /dev/null
+++ b/arch/arm/mach-mstar/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_ARCH_MSTARV7) += mstarv7.o
diff --git a/arch/arm/mach-mstar/mstarv7.c b/arch/arm/mach-mstar/mstarv7.c
new file mode 100644
index 000000000000..ee96ce46cbbc
--- /dev/null
+++ b/arch/arm/mach-mstar/mstarv7.c
@@ -0,0 +1,72 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree support for MStar/Sigmastar ARMv7 SoCs
+ *
+ * Copyright (c) 2019 thingy.jp
+ * Author: Daniel Palmer <daniel@thingy•jp>
+ */
+
+#include <linux/init.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <linux/of.h>
+#include <linux/io.h>
+
+/*
+ * In the u-boot code the area these registers are in is
+ * called "L3 bridge" and there are register descriptions
+ * for something in the same area called "AXI".
+ *
+ * It's not exactly known what this is but the vendor code
+ * for both u-boot and linux share calls to "flush the miu pipe".
+ * This seems to be to force pending CPU writes to memory so that
+ * the state is right before DMA capable devices try to read
+ * descriptors and data the CPU has prepared. Without doing this
+ * ethernet doesn't work reliably for example.
+ */
+
+#define MSTARV7_L3BRIDGE_FLUSH		0x1f204414
+#define MSTARV7_L3BRIDGE_STATUS		0x1f204440
+#define MSTARV7_L3BRIDGE_FLUSH_TRIGGER	BIT(0)
+#define MSTARV7_L3BRIDGE_STATUS_DONE	BIT(12)
+
+static u32 __iomem *miu_status;
+static u32 __iomem *miu_flush;
+
+static const char * const mstarv7_board_dt_compat[] __initconst = {
+	"mstar,infinity",
+	"mstar,infinity3",
+	"mstar,mercury5",
+	NULL,
+};
+
+/*
+ * This may need locking to deal with situations where an interrupt
+ * happens while we are in here and mb() gets called by the interrupt handler.
+ */
+static void mstarv7_mb(void)
+{
+	/* toggle the flush miu pipe fire bit */
+	writel_relaxed(0, miu_flush);
+	writel_relaxed(MSTARV7_L3BRIDGE_FLUSH_TRIGGER, miu_flush);
+	while (!(readl_relaxed(miu_status) & MSTARV7_L3BRIDGE_STATUS_DONE)) {
+		/* wait for flush to complete */
+	}
+}
+
+static void __init mstarv7_barriers_init(void)
+{
+	miu_flush = ioremap(MSTARV7_L3BRIDGE_FLUSH, sizeof(*miu_flush));
+	miu_status = ioremap(MSTARV7_L3BRIDGE_STATUS, sizeof(*miu_status));
+	soc_mb = mstarv7_mb;
+}
+
+static void __init mstarv7_init(void)
+{
+	mstarv7_barriers_init();
+}
+
+DT_MACHINE_START(MSTARV7_DT, "MStar/Sigmastar ARMv7 (Device Tree)")
+	.dt_compat	= mstarv7_board_dt_compat,
+	.init_machine	= mstarv7_init,
+MACHINE_END
-- 
2.27.0.rc0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists•infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-06-10  9:08 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-14  6:15 [PATCH 1/4] dt-bindings: arm: Initial MStar vendor prefixes and compatible strings Daniel Palmer
2019-10-14  6:15 ` [PATCH 2/4] ARM: mstar: Add machine for MStar infinity family SoCs Daniel Palmer
2019-10-14 11:19   ` Arnd Bergmann
2019-10-16 20:32     ` Daniel Palmer
2019-10-17 13:02       ` Arnd Bergmann
2019-10-17 21:15         ` Daniel Palmer
2020-06-10  9:03   ` [PATCH v2 0/5] Initial MStar/Sigmastar ARMv7 SoC support Daniel Palmer
2020-06-12 13:00     ` [PATCH v3 00/12] Initial MStar/Sigmastar Armv7 " Daniel Palmer
2020-06-12 13:00       ` [PATCH v3 01/12] dt-bindings: vendor-prefixes: Add mstar vendor prefix Daniel Palmer
2020-06-16 12:15         ` [PATCH v4 00/12] Initial MStar/Sigmastar ARMv7 SoC support Daniel Palmer
2020-06-16 12:15           ` [PATCH v4 01/12] dt-bindings: vendor-prefixes: Add mstar vendor prefix Daniel Palmer
2020-07-09 23:04             ` Rob Herring
2020-06-16 12:15           ` [PATCH v4 02/12] dt-bindings: vendor-prefixes: Add sstar " Daniel Palmer
2020-07-09 23:04             ` Rob Herring
2020-06-16 12:15           ` [PATCH v4 03/12] dt-bindings: vendor-prefixes: Add 70mai " Daniel Palmer
2020-07-09 23:05             ` Rob Herring
2020-06-16 12:15           ` [PATCH v4 04/12] dt-bindings: vendor-prefixes: Add thingy.jp prefix Daniel Palmer
2020-07-09 23:05             ` Rob Herring
2020-06-16 12:15           ` [PATCH v4 05/12] dt-bindings: arm: Add mstar YAML schema Daniel Palmer
2020-07-09 23:04             ` Rob Herring
2020-06-16 12:15           ` [PATCH v4 06/12] ARM: mstar: Add machine for MStar/Sigmastar Armv7 SoCs Daniel Palmer
2020-06-16 12:15           ` [PATCH v4 07/12] ARM: mstar: Add binding details for mstar,l3bridge Daniel Palmer
2020-07-09 23:06             ` Rob Herring
2020-06-16 12:15           ` [PATCH v4 08/12] ARM: mstar: Add Armv7 base dtsi Daniel Palmer
2020-06-16 12:15           ` [PATCH v4 09/12] ARM: mstar: Add infinity/infinity3 family dtsis Daniel Palmer
2020-06-16 12:15           ` [PATCH v4 10/12] ARM: mstar: Add mercury5 series dtsis Daniel Palmer
2020-06-16 12:15           ` [PATCH v4 11/12] ARM: mstar: Add dts for msc313(e) based BreadBee boards Daniel Palmer
2020-06-16 12:15           ` [PATCH v4 12/12] ARM: mstar: Add dts for 70mai midrive d08 Daniel Palmer
2020-06-12 13:00       ` [PATCH v3 02/12] dt-bindings: vendor-prefixes: Add sstar vendor prefix Daniel Palmer
2020-06-12 13:00       ` [PATCH v3 03/12] dt-bindings: vendor-prefixes: Add 70mai " Daniel Palmer
2020-06-12 13:00       ` [PATCH v3 04/12] dt-bindings: vendor-prefixes: Add thingy.jp prefix Daniel Palmer
2020-06-12 13:00       ` [PATCH v3 05/12] dt-bindings: dt-bindings: arm: Add mstar YAML schema Daniel Palmer
2020-06-12 22:07         ` Rob Herring
2020-06-12 13:00       ` [PATCH v3 06/12] ARM: mstar: Add machine for MStar/Sigmastar Armv7 SoCs Daniel Palmer
2020-06-12 13:00       ` [PATCH v3 07/12] ARM: mstar: Add binding details for mstar,l3bridge Daniel Palmer
2020-06-12 13:00       ` [PATCH v3 08/12] ARM: mstar: Add Armv7 base dtsi Daniel Palmer
2020-06-12 13:00       ` [PATCH v3 09/12] ARM: mstar: Add infinity/infinity3 family dtsis Daniel Palmer
2020-06-12 13:00       ` [PATCH v3 10/12] ARM: mstar: Add mercury5 series dtsis Daniel Palmer
2020-06-12 13:00       ` [PATCH v3 11/12] ARM: mstar: Add dts for msc313(e) based BreadBee boards Daniel Palmer
2020-06-12 13:00       ` [PATCH v3 12/12] ARM: mstar: Add dts for 70mai midrive d08 Daniel Palmer
2020-06-10  9:03   ` [PATCH v2 1/5] dt-bindings: arm: Initial MStar vendor prefixes and compatible strings Daniel Palmer
2020-06-10  9:35     ` Andreas Färber
2020-06-10 10:29       ` Daniel Palmer
2020-06-11 15:00     ` Andreas Färber
2020-06-10  9:04   ` Daniel Palmer [this message]
2020-06-10  9:43     ` [PATCH v2 2/5] ARM: mstar: Add machine for MStar/Sigmastar infinity/mercury family ARMv7 SoCs Arnd Bergmann
2020-06-11 12:49     ` Andreas Färber
2020-06-11 13:01       ` Daniel Palmer
2020-06-11 14:27         ` Andreas Färber
2020-06-11 14:58           ` Daniel Palmer
2020-06-11 12:58     ` Andreas Färber
2020-06-11 13:18       ` Daniel Palmer
2020-06-10  9:04   ` [PATCH v2 3/5] ARM: mstar: Add infinity/mercury series dtsi Daniel Palmer
2020-06-10  9:35     ` Marc Zyngier
2020-06-11 13:39     ` Andreas Färber
2020-06-11 14:19       ` Daniel Palmer
2020-06-11 14:39         ` Andreas Färber
2020-06-11 15:07           ` Daniel Palmer
2020-06-10  9:04   ` [PATCH v2 4/5] ARM: mstar: Add dts for msc313(e) based BreadBee boards Daniel Palmer
2020-06-11 13:45     ` Andreas Färber
2020-06-11 14:26       ` Daniel Palmer
2020-06-10  9:04   ` [PATCH v2 5/5] ARM: mstar: Add dts for 70mai midrive d08 Daniel Palmer
2020-06-11 13:54     ` Andreas Färber
2020-06-11 14:38       ` Daniel Palmer
2019-10-14  6:15 ` [PATCH 3/4] ARM: mstar: Add infinity series dtsi Daniel Palmer
2019-10-14  6:15 ` [PATCH 4/4] ARM: mstar: Add dts for msc313e based BreadBee board Daniel Palmer
2019-10-23 20:02 ` [PATCH 1/4] dt-bindings: arm: Initial MStar vendor prefixes and compatible strings Rob Herring
2019-10-23 22:43   ` Daniel Palmer
2019-10-23 23:45     ` Rob Herring
2019-10-24  1:47       ` Daniel Palmer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200610090421.3428945-3-daniel@0x0f.com \
    --to=daniel@0x0f$(echo .)com \
    --cc=afaerber@suse$(echo .)de \
    --cc=akpm@linux-foundation$(echo .)org \
    --cc=allen.chen@ite$(echo .)com.tw \
    --cc=ardb@kernel$(echo .)org \
    --cc=armlinux@m$(echo .)disordat.com \
    --cc=arnd@arndb$(echo .)de \
    --cc=benjamin.gaignard@linaro$(echo .)org \
    --cc=bgolaszewski@baylibre$(echo .)com \
    --cc=broonie@kernel$(echo .)org \
    --cc=chunkeey@gmail$(echo .)com \
    --cc=corbet@lwn$(echo .)net \
    --cc=daniel@thingy$(echo .)jp \
    --cc=davem@davemloft$(echo .)net \
    --cc=devicetree@vger$(echo .)kernel.org \
    --cc=gregkh@linuxfoundation$(echo .)org \
    --cc=gregory.0xf0@gmail$(echo .)com \
    --cc=heiko.stuebner@theobroma-systems$(echo .)com \
    --cc=k@japko$(echo .)eu \
    --cc=linus.walleij@linaro$(echo .)org \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux@armlinux$(echo .)org.uk \
    --cc=lkundrak@v3$(echo .)sk \
    --cc=maz@kernel$(echo .)org \
    --cc=mchehab+huawei@kernel$(echo .)org \
    --cc=mripard@kernel$(echo .)org \
    --cc=natechancellor@gmail$(echo .)com \
    --cc=ndesaulniers@google$(echo .)com \
    --cc=nhuck15@gmail$(echo .)com \
    --cc=robh+dt@kernel$(echo .)org \
    --cc=rppt@kernel$(echo .)org \
    --cc=sam@ravnborg$(echo .)org \
    --cc=stephan@gerhold$(echo .)net \
    --cc=tim.bird@sony$(echo .)com \
    --cc=yamada.masahiro@socionext$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox