linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: shc_work@mail.ru (Alexander Shiyan)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 11/22] ARM: clps711x: Add basic DT support
Date: Sat,  4 Jun 2016 10:10:03 +0300	[thread overview]
Message-ID: <1465024214-22120-12-git-send-email-shc_work@mail.ru> (raw)
In-Reply-To: <1465024214-22120-1-git-send-email-shc_work@mail.ru>

This patch adds basic support to run Cirrus Logic ARMv4T CPUs
with device-tree support.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 arch/arm/mach-clps711x/Kconfig    |  9 +++++
 arch/arm/mach-clps711x/Makefile   |  1 +
 arch/arm/mach-clps711x/board-dt.c | 82 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 92 insertions(+)
 create mode 100644 arch/arm/mach-clps711x/board-dt.c

diff --git a/arch/arm/mach-clps711x/Kconfig b/arch/arm/mach-clps711x/Kconfig
index f711498..f21700c 100644
--- a/arch/arm/mach-clps711x/Kconfig
+++ b/arch/arm/mach-clps711x/Kconfig
@@ -2,6 +2,15 @@ if ARCH_CLPS711X
 
 menu "CLPS711X/EP721X/EP731X Implementations"
 
+config MACH_CLPS711X_DT
+	bool "Device-tree support"
+	select CLKSRC_OF
+	select OF_IRQ
+	select USE_OF
+	help
+	  Select this if you want to experiment device-tree with
+	  ARMv4T Cirrus Logic chips.
+
 config ARCH_AUTCPU12
 	bool "AUTCPU12"
 	help
diff --git a/arch/arm/mach-clps711x/Makefile b/arch/arm/mach-clps711x/Makefile
index f04151e..ef6df40 100644
--- a/arch/arm/mach-clps711x/Makefile
+++ b/arch/arm/mach-clps711x/Makefile
@@ -6,6 +6,7 @@
 
 obj-y				:= common.o devices.o
 
+obj-$(CONFIG_MACH_CLPS711X_DT)	+= board-dt.o
 obj-$(CONFIG_ARCH_AUTCPU12)	+= board-autcpu12.o
 obj-$(CONFIG_ARCH_CDB89712)	+= board-cdb89712.o
 obj-$(CONFIG_ARCH_CLEP7312)	+= board-clep7312.o
diff --git a/arch/arm/mach-clps711x/board-dt.c b/arch/arm/mach-clps711x/board-dt.c
new file mode 100644
index 0000000..ee1f83b
--- /dev/null
+++ b/arch/arm/mach-clps711x/board-dt.c
@@ -0,0 +1,82 @@
+/*
+ *  Author: Alexander Shiyan <shc_work@mail.ru>, 2016
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/io.h>
+#include <linux/of_fdt.h>
+#include <linux/platform_device.h>
+#include <linux/random.h>
+#include <linux/sizes.h>
+
+#include <linux/mfd/syscon/clps711x.h>
+
+#include <asm/system_info.h>
+#include <asm/system_misc.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+
+#define CLPS711X_VIRT_BASE	IOMEM(0xfeff4000)
+#define CLPS711X_PHYS_BASE	(0x80000000)
+# define SYSFLG1		(0x0140)
+# define HALT			(0x0800)
+# define UNIQID			(0x2440)
+# define RANDID0		(0x2700)
+# define RANDID1		(0x2704)
+# define RANDID2		(0x2708)
+# define RANDID3		(0x270c)
+
+static struct map_desc clps711x_io_desc __initdata = {
+	.virtual	= (unsigned long)CLPS711X_VIRT_BASE,
+	.pfn		= __phys_to_pfn(CLPS711X_PHYS_BASE),
+	.length		= 48 * SZ_1K,
+	.type		= MT_DEVICE,
+};
+
+static void __init clps711x_map_io(void)
+{
+	iotable_init(&clps711x_io_desc, 1);
+}
+
+static const struct resource clps711x_cpuidle_res =
+	DEFINE_RES_MEM(CLPS711X_PHYS_BASE + HALT, SZ_128);
+
+static void __init clps711x_init(void)
+{
+	u32 id[5];
+
+	id[0] = readl(CLPS711X_VIRT_BASE + UNIQID);
+	id[1] = readl(CLPS711X_VIRT_BASE + RANDID0);
+	id[2] = readl(CLPS711X_VIRT_BASE + RANDID1);
+	id[3] = readl(CLPS711X_VIRT_BASE + RANDID2);
+	id[4] = readl(CLPS711X_VIRT_BASE + RANDID3);
+	system_rev = SYSFLG1_VERID(readl(CLPS711X_VIRT_BASE + SYSFLG1));
+
+	add_device_randomness(id, sizeof(id));
+
+	system_serial_low = id[0];
+
+	platform_device_register_simple("clps711x-cpuidle", PLATFORM_DEVID_NONE,
+					&clps711x_cpuidle_res, 1);
+}
+
+static void clps711x_restart(enum reboot_mode mode, const char *cmd)
+{
+	soft_restart(0);
+}
+
+static const char *clps711x_compat[] __initconst = {
+	"cirrus,ep7209",
+	NULL
+};
+
+DT_MACHINE_START(CLPS711X_DT, "Cirrus Logic CLPS711X (Device Tree Support)")
+	.dt_compat	= clps711x_compat,
+	.map_io		= clps711x_map_io,
+	.init_late	= clps711x_init,
+	.restart	= clps711x_restart,
+MACHINE_END
-- 
2.4.9

  parent reply	other threads:[~2016-06-04  7:10 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-04  7:09 [PATCH 00/22] ARM: clps711x: Switch to DT and Multiplatform Alexander Shiyan
2016-06-04  7:09 ` [PATCH 01/22] ARM: clps711x: Reduce static map size Alexander Shiyan
2016-06-04  7:09 ` [PATCH 02/22] clk: clps711x: Changing the compatibility string to match with the smallest supported chip Alexander Shiyan
2016-06-04  7:09 ` [PATCH 03/22] clocksource: " Alexander Shiyan
2016-06-13 12:15   ` Daniel Lezcano
2016-06-04  7:09 ` [PATCH 04/22] irqchip: " Alexander Shiyan
2016-06-04  7:09 ` [PATCH 05/22] serial: " Alexander Shiyan
2016-06-04  7:09 ` [PATCH 06/22] pwm: " Alexander Shiyan
2016-06-04  7:09 ` [PATCH 07/22] gpio: " Alexander Shiyan
2016-06-08  8:44   ` Linus Walleij
2016-06-04  7:10 ` [PATCH 08/22] gpio: syscon: " Alexander Shiyan
2016-06-08  8:48   ` Linus Walleij
2016-06-04  7:10 ` [PATCH 09/22] input: clps711x-keypad: " Alexander Shiyan
2016-06-04  7:10 ` [PATCH 10/22] video: clps711x-fb: " Alexander Shiyan
2016-06-04  7:10 ` Alexander Shiyan [this message]
2016-06-04  7:10 ` [PATCH 12/22] ARM: dts: clps711x: Add DT Cirrus Logic EDB7211 Development board Alexander Shiyan
2016-06-04  7:10 ` [PATCH 13/22] spi: clps711x: Driver refactor Alexander Shiyan
2016-06-06 17:36   ` Mark Brown
2016-07-06 14:56     ` Arnd Bergmann
2016-06-04  7:10 ` [PATCH 14/22] ARM: clps711x: Remove boards support Alexander Shiyan
2016-06-04  7:10 ` [PATCH 15/22] video: clps711x: Remove old driver Alexander Shiyan
2016-06-04  7:10 ` [PATCH 16/22] clk: clps711x: Remove board support Alexander Shiyan
2016-08-19  0:13   ` Stephen Boyd
2016-06-04  7:10 ` [PATCH 17/22] clocksource: " Alexander Shiyan
2016-06-13 12:27   ` Daniel Lezcano
2016-06-04  7:10 ` [PATCH 18/22] irqchip: " Alexander Shiyan
2016-06-04  7:10 ` [PATCH 19/22] serial: " Alexander Shiyan
2016-06-04  7:10 ` [PATCH 20/22] gpio: " Alexander Shiyan
2016-06-08  8:51   ` Linus Walleij
2016-06-09  7:29     ` Arnd Bergmann
2016-06-04  7:10 ` [PATCH 21/22] ARM: clps711x: Switch to MULTIPLATFORM Alexander Shiyan
2016-06-04  7:10 ` [PATCH 22/22] ARM: config: Add a multi_v4t_defconfig Alexander Shiyan
2016-07-06 19:59 ` [PATCH 00/22] ARM: clps711x: Switch to DT and Multiplatform Arnd Bergmann

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=1465024214-22120-12-git-send-email-shc_work@mail.ru \
    --to=shc_work@mail.ru \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).