Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1504713 > unrolled thread

[PATCH v2 3/6] ARM: at91: Add armv7m support

Started byAlexandre Belloni <alexandre.belloni@free-electrons.com>
First post2016-10-20 11:50 +0200
Last post2016-10-20 15:30 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 3/6] ARM: at91: Add armv7m support Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-10-20 11:50 +0200
    Re: [PATCH v2 3/6] ARM: at91: Add armv7m support Arnd Bergmann <arnd@arndb.de> - 2016-10-20 12:00 +0200
      Re: [PATCH v2 3/6] ARM: at91: Add armv7m support Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-10-20 12:30 +0200
        Re: [PATCH v2 3/6] ARM: at91: Add armv7m support Arnd Bergmann <arnd@arndb.de> - 2016-10-20 15:30 +0200

#1504713 — [PATCH v2 3/6] ARM: at91: Add armv7m support

FromAlexandre Belloni <alexandre.belloni@free-electrons.com>
Date2016-10-20 11:50 +0200
Subject[PATCH v2 3/6] ARM: at91: Add armv7m support
Message-ID<sui93-5JM-1@gated-at.bofh.it>
From: Szemző András <sza@esh.hu>

Add Atmel SAME70/SAMS70/SAMV71 SoC support and detection.

Signed-off-by: Szemző András <sza@esh.hu>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 arch/arm/mach-at91/Kconfig       |  9 +++++-
 arch/arm/mach-at91/Makefile      |  1 +
 arch/arm/mach-at91/Makefile.boot |  3 ++
 arch/arm/mach-at91/samx7.c       | 62 ++++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-at91/soc.h         | 21 ++++++++++++++
 5 files changed, 95 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-at91/Makefile.boot
 create mode 100644 arch/arm/mach-at91/samx7.c

diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 841e924143f9..bade64e0cb49 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -1,12 +1,19 @@
 menuconfig ARCH_AT91
 	bool "Atmel SoCs"
-	depends on ARCH_MULTI_V4T || ARCH_MULTI_V5 || ARCH_MULTI_V7
+	depends on ARCH_MULTI_V4T || ARCH_MULTI_V5 || ARCH_MULTI_V7 || ARM_SINGLE_ARMV7M
 	select COMMON_CLK_AT91
 	select GPIOLIB
 	select PINCTRL
 	select SOC_BUS
 
 if ARCH_AT91
+config SOC_SAMX7
+	bool "SAM Cortex-M7 family" if ARM_SINGLE_ARMV7M
+	select COMMON_CLK_AT91
+	select PINCTRL_AT91
+	help
+	  Select this if you are using one of Atmel's SAMx7 family SoC.
+
 config SOC_SAMA5D2
 	bool "SAMA5D2 family"
 	depends on ARCH_MULTI_V7
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index c5bbf8bb8c0f..84956a18d604 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -7,6 +7,7 @@ obj-y		:= soc.o
 obj-$(CONFIG_SOC_AT91RM9200)	+= at91rm9200.o
 obj-$(CONFIG_SOC_AT91SAM9)	+= at91sam9.o
 obj-$(CONFIG_SOC_SAMA5)		+= sama5.o
+obj-$(CONFIG_SOC_SAMX7)		+= samx7.o
 
 # Power Management
 obj-$(CONFIG_PM)		+= pm.o
diff --git a/arch/arm/mach-at91/Makefile.boot b/arch/arm/mach-at91/Makefile.boot
new file mode 100644
index 000000000000..eacfc3f5c33e
--- /dev/null
+++ b/arch/arm/mach-at91/Makefile.boot
@@ -0,0 +1,3 @@
+# Empty file waiting for deletion once Makefile.boot isn't needed any more.
+# Patch waits for application at
+# http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=7889/1 .
diff --git a/arch/arm/mach-at91/samx7.c b/arch/arm/mach-at91/samx7.c
new file mode 100644
index 000000000000..bd33bc56278e
--- /dev/null
+++ b/arch/arm/mach-at91/samx7.c
@@ -0,0 +1,62 @@
+/*
+ *  Setup code for SAMx7
+ *
+ *  Copyright (C) 2013 Atmel,
+ *                2016 Andras Szemzo <szemzo.andras@gmail.com>
+ *
+ * Licensed under GPLv2 or later.
+ */
+#include <linux/of.h>
+#include <linux/of_platform.h>
+#include <linux/of_address.h>
+#include <linux/slab.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/system_misc.h>
+#include "generic.h"
+#include "soc.h"
+
+static const struct at91_soc samx7_socs[] = {
+	AT91_SOC(SAME70Q21_CIDR_MATCH, SAME70Q21_EXID_MATCH,
+		 "same70q21", "samx7"),
+	AT91_SOC(SAME70Q20_CIDR_MATCH, SAME70Q20_EXID_MATCH,
+		 "same70q20", "samx7"),
+	AT91_SOC(SAME70Q19_CIDR_MATCH, SAME70Q19_EXID_MATCH,
+		 "same70q19", "samx7"),
+	AT91_SOC(SAMS70Q21_CIDR_MATCH, SAMS70Q21_EXID_MATCH,
+		 "sams70q21", "samx7"),
+	AT91_SOC(SAMS70Q20_CIDR_MATCH, SAMS70Q20_EXID_MATCH,
+		 "sams70q20", "samx7"),
+	AT91_SOC(SAMS70Q19_CIDR_MATCH, SAMS70Q19_EXID_MATCH,
+		 "sams70q19", "samx7"),
+	AT91_SOC(SAMV71Q21_CIDR_MATCH, SAMV71Q21_EXID_MATCH,
+		 "samv71q21", "samx7"),
+	AT91_SOC(SAMV71Q20_CIDR_MATCH, SAMV71Q20_EXID_MATCH,
+		 "samv71q20", "samx7"),
+	AT91_SOC(SAMV71Q19_CIDR_MATCH, SAMV71Q19_EXID_MATCH,
+		 "samv71q19", "samx7"),
+	{ /* sentinel */ },
+};
+
+static void __init samx7_dt_device_init(void)
+{
+	struct soc_device *soc;
+	struct device *soc_dev = NULL;
+
+	soc = at91_soc_init(samx7_socs);
+	if (soc)
+		soc_dev = soc_device_to_device(soc);
+
+	of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev);
+}
+
+static const char *const samx7_dt_board_compat[] __initconst = {
+	"atmel,samx7",
+	NULL
+};
+
+DT_MACHINE_START(samx7_dt, "Atmel SAMx7")
+	.init_machine	= samx7_dt_device_init,
+	.dt_compat	= samx7_dt_board_compat,
+MACHINE_END
+
diff --git a/arch/arm/mach-at91/soc.h b/arch/arm/mach-at91/soc.h
index 228efded5085..0f97e9c5da7e 100644
--- a/arch/arm/mach-at91/soc.h
+++ b/arch/arm/mach-at91/soc.h
@@ -88,4 +88,25 @@ at91_soc_init(const struct at91_soc *socs);
 #define SAMA5D43_EXID_MATCH		0x00000003
 #define SAMA5D44_EXID_MATCH		0x00000004
 
+#define SAME70Q21_CIDR_MATCH		0x21020e00
+#define SAME70Q21_EXID_MATCH		0x00000002
+#define SAME70Q20_CIDR_MATCH		0x21020c00
+#define SAME70Q20_EXID_MATCH		0x00000002
+#define SAME70Q19_CIDR_MATCH		0x210d0a00
+#define SAME70Q19_EXID_MATCH		0x00000002
+
+#define SAMS70Q21_CIDR_MATCH		0x21120e00
+#define SAMS70Q21_EXID_MATCH		0x00000002
+#define SAMS70Q20_CIDR_MATCH		0x21120c00
+#define SAMS70Q20_EXID_MATCH		0x00000002
+#define SAMS70Q19_CIDR_MATCH		0x211d0a00
+#define SAMS70Q19_EXID_MATCH		0x00000002
+
+#define SAMV71Q21_CIDR_MATCH		0x21220e00
+#define SAMV71Q21_EXID_MATCH		0x00000002
+#define SAMV71Q20_CIDR_MATCH		0x21220c00
+#define SAMV71Q20_EXID_MATCH		0x00000002
+#define SAMV71Q19_CIDR_MATCH		0x212d0a00
+#define SAMV71Q19_EXID_MATCH		0x00000002
+
 #endif /* __AT91_SOC_H */
-- 
2.9.3

[toc] | [next] | [standalone]


#1504734

FromArnd Bergmann <arnd@arndb.de>
Date2016-10-20 12:00 +0200
Message-ID<suiiJ-5No-25@gated-at.bofh.it>
In reply to#1504713
On Thursday, October 20, 2016 11:41:32 AM CEST Alexandre Belloni wrote:
> +
> +static void __init samx7_dt_device_init(void)
> +{
> +       struct soc_device *soc;
> +       struct device *soc_dev = NULL;
> +
> +       soc = at91_soc_init(samx7_socs);
> +       if (soc)
> +               soc_dev = soc_device_to_device(soc);
> +
> +       of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev);
> +}

This was initially the idea for the soc_device, but we've stopped
using it as the parent for the on-chip devices a while ago.

Just register the device for identification here, and use
of_platform_default_populate with a NULL parent as most others do.

We should also investigate whether we can convert the three other
at91 variants to do the same without breaking expectations in user space.

	Arnd

[toc] | [prev] | [next] | [standalone]


#1504746

FromAlexandre Belloni <alexandre.belloni@free-electrons.com>
Date2016-10-20 12:30 +0200
Message-ID<suiLM-6hM-3@gated-at.bofh.it>
In reply to#1504734
Hi,

On 20/10/2016 at 11:52:20 +0200, Arnd Bergmann wrote :
> On Thursday, October 20, 2016 11:41:32 AM CEST Alexandre Belloni wrote:
> > +
> > +static void __init samx7_dt_device_init(void)
> > +{
> > +       struct soc_device *soc;
> > +       struct device *soc_dev = NULL;
> > +
> > +       soc = at91_soc_init(samx7_socs);
> > +       if (soc)
> > +               soc_dev = soc_device_to_device(soc);
> > +
> > +       of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev);
> > +}
> 
> This was initially the idea for the soc_device, but we've stopped
> using it as the parent for the on-chip devices a while ago.
> 
> Just register the device for identification here, and use
> of_platform_default_populate with a NULL parent as most others do.
> 
> We should also investigate whether we can convert the three other
> at91 variants to do the same without breaking expectations in user space.
> 

My opinion is that we could just remove the whole at91_soc_init stuff
but I think Nicolas still wants the two info lines to be printed for
debugging/support purposes. I'm not sure how much this is used anyway
and I don't find the sysfs attributes to be particularly useful.

Also, removing soc.c is a 10% reduction of the code in mach-at91 ;)

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[toc] | [prev] | [next] | [standalone]


#1504886

FromArnd Bergmann <arnd@arndb.de>
Date2016-10-20 15:30 +0200
Message-ID<sulzX-84O-19@gated-at.bofh.it>
In reply to#1504746
On Thursday, October 20, 2016 12:26:21 PM CEST Alexandre Belloni wrote:
> 
> On 20/10/2016 at 11:52:20 +0200, Arnd Bergmann wrote :
> > On Thursday, October 20, 2016 11:41:32 AM CEST Alexandre Belloni wrote:
> > > +
> > > +static void __init samx7_dt_device_init(void)
> > > +{
> > > +       struct soc_device *soc;
> > > +       struct device *soc_dev = NULL;
> > > +
> > > +       soc = at91_soc_init(samx7_socs);
> > > +       if (soc)
> > > +               soc_dev = soc_device_to_device(soc);
> > > +
> > > +       of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev);
> > > +}
> > 
> > This was initially the idea for the soc_device, but we've stopped
> > using it as the parent for the on-chip devices a while ago.
> > 
> > Just register the device for identification here, and use
> > of_platform_default_populate with a NULL parent as most others do.
> > 
> > We should also investigate whether we can convert the three other
> > at91 variants to do the same without breaking expectations in user space.
> > 
> 
> My opinion is that we could just remove the whole at91_soc_init stuff
> but I think Nicolas still wants the two info lines to be printed for
> debugging/support purposes. I'm not sure how much this is used anyway
> and I don't find the sysfs attributes to be particularly useful.
> 
> Also, removing soc.c is a 10% reduction of the code in mach-at91 
> 

Having the soc_device driver is very valuable in order to have
an interface to be used from user space (and soon from the kernel)
to look up the exact SoC type in a generic way, so I'd definitely
want to keep that, though we may want to move that driver to
drivers/soc/.

	Arnd

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web