Skip to contentSkip to conversation

ARM: Add minimal support for TI Keystone SOCs

PATCH Superseded Santosh Shilimkar 4 participants 14 messages Jun 10, 2013 – Jun 12, 2013

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover ARM: Add minimal support for TI Keystone SOCs

Series adds minimal support to Texas Instruments Keystone 2 based SOCs. Basic SOC code and simple dt file describing SOC which is enough to get the device booting till shell against mainline v3.10-rcx release.

Texas Instruments Keystone family of multi-core devices are based on ARM Cortex A15. The TCI66xxK2H Communications Infrastructure Keystone SoCs are member of the C66x family based on TI's new KeyStone 2 multi-core SoC Architecture designed specifically for high performance wireless and networking infrastructure applications.

The SOCs contains many subsystems like Cortex A15 ARM CorePacs, C66XX DSP CorePacs, MSMC memory controller, Tera Net bus, IP Network, Navigator, Hyperlink, 1G/10G Ethernet, Radio layers and queue based communication systems.

The patchset is available on my git tree and details are end of the email [1]

The Keystone Linux port has been used internal and externally for quite some time and its based on slightly older kernels. I need to specially mention about Cyril Chemparathy who was integral part of many of the development for Keystone linux port along with Murali, Vitaly and rest of the team. We would like to take all the internal linux keystone work to mainline and this is the first step to get that process started.

There is public documentation available for these SOCs. Here is one of the link [2]

Santosh Shilimkar (3):
ARM: keystone: Add minimal TI Keystone platform support
ARM: keystone: Enable SMP support on Keystone machines
ARM: dts: keystone: Add minimal Keystone SOC device tree data

Cc Grant Likely <[email protected]>
Cc Olof Johansson <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc arm at kernel.org
 .../devicetree/bindings/arm/keystone/keystone.txt  |    9 ++
 arch/arm/Kconfig                                   |    3 +
 arch/arm/Kconfig.debug                             |   16 ++
 arch/arm/Makefile                                  |    1 +
 arch/arm/boot/dts/keystone.dts                     |   98 ++++++++++++
 arch/arm/configs/keystone_defconfig                |  157 ++++++++++++++++++++
 arch/arm/include/debug/keystone.S                  |   43 ++++++
 arch/arm/mach-keystone/Kconfig                     |   17 +++
 arch/arm/mach-keystone/Makefile                    |    2 +
 arch/arm/mach-keystone/Makefile.boot               |    1 +
 arch/arm/mach-keystone/include/mach/timex.h        |   15 ++
 arch/arm/mach-keystone/keystone.c                  |   78 ++++++++++
 arch/arm/mach-keystone/keystone.h                  |   17 +++
 arch/arm/mach-keystone/platsmp.c                   |   67 +++++++++
 14 files changed, 524 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/keystone/keystone.txt
 create mode 100644 arch/arm/boot/dts/keystone.dts
 create mode 100644 arch/arm/configs/keystone_defconfig
 create mode 100644 arch/arm/include/debug/keystone.S
 create mode 100644 arch/arm/mach-keystone/Kconfig
 create mode 100644 arch/arm/mach-keystone/Makefile
 create mode 100644 arch/arm/mach-keystone/Makefile.boot
 create mode 100644 arch/arm/mach-keystone/include/mach/timex.h
 create mode 100644 arch/arm/mach-keystone/keystone.c
 create mode 100644 arch/arm/mach-keystone/keystone.h
 create mode 100644 arch/arm/mach-keystone/platsmp.c

Regards,
Santosh

[1] Git tree details
git://git.kernel.org/pub/scm/linux/kernel/git/ssantosh/linux-keystone.git
keystone/dt
keystone/soc
keystone/master --> 'soc + dt'

[2] Device specs
http://www.ti.com/product/tci6636k2h

Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/3 ARM: keystone: Add minimal TI Keystone platform support

Texas Instruments Keystone family of multi-core devices are based on ARM Cortex A15. Patch adds basic definitions for a new Keystone sub-architecture in ARM.

The TCI66xxK2H Communications Infrastructure Keystone SoCs are member of the C66x family based on TI's new KeyStone 2 multi-core SoC Architecture designed specifically for high performance wireless and networking infrastructure applications. The SOCs contains many subsystems like Cortex A15 ARM CorePacs, C66XX DSP CorePacs, MSMC memory controller, Tera Net bus, IP Network, Navigator, Hyperlink, 1G/10G Ethernet, Radio layers and queue based communication systems.

Cc Olof Johansson <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc arm at kernel.org
---
 arch/arm/Kconfig                            |    3 +
 arch/arm/Kconfig.debug                      |   16 +++
 arch/arm/Makefile                           |    1 +
 arch/arm/configs/keystone_defconfig         |  157 +++++++++++++++++++++++++++
 arch/arm/include/debug/keystone.S           |   43 ++++++++
 arch/arm/mach-keystone/Kconfig              |   16 +++
 arch/arm/mach-keystone/Makefile             |    1 +
 arch/arm/mach-keystone/Makefile.boot        |    1 +
 arch/arm/mach-keystone/include/mach/timex.h |   15 +++
 arch/arm/mach-keystone/keystone.c           |   74 +++++++++++++
 10 files changed, 327 insertions(+)
 create mode 100644 arch/arm/configs/keystone_defconfig
 create mode 100644 arch/arm/include/debug/keystone.S
 create mode 100644 arch/arm/mach-keystone/Kconfig
 create mode 100644 arch/arm/mach-keystone/Makefile
 create mode 100644 arch/arm/mach-keystone/Makefile.boot
 create mode 100644 arch/arm/mach-keystone/include/mach/timex.h
 create mode 100644 arch/arm/mach-keystone/keystone.c
arch/arm/Kconfig +3 -0
index 49d993c..37fe64c 100644
@@ -948,6 +948,8 @@ source "arch/arm/mach-iop13xx/Kconfig"
 
 source "arch/arm/mach-ixp4xx/Kconfig"
 
+source "arch/arm/mach-keystone/Kconfig"
+
 source "arch/arm/mach-kirkwood/Kconfig"
 
 source "arch/arm/mach-ks8695/Kconfig"
@@ -1564,6 +1566,7 @@ config ARCH_NR_GPIO
 	default 352 if ARCH_VT8500
 	default 288 if ARCH_SUNXI
 	default 264 if MACH_H4700
+	default 512 if ARCH_KEYSTONE
 	default 0
 	help
 	  Maximum number of GPIOs in the system.
arch/arm/Kconfig.debug +16 -0
index 1d41908..62e7f95 100644
@@ -251,6 +251,20 @@ choice
 		  Say Y here if you want kernel low-level debugging support
 		  on i.MX6Q/DL.
 
+	config DEBUG_KEYSTONE_UART0
+		bool "Kernel low-level debugging on KEYSTONE2 using UART0"
+		depends on ARCH_KEYSTONE
+		help
+		  Say Y here if you want the debug print routines to direct
+		  their output to UART0 serial port on KEYSTONE2 devices.
+
+	config DEBUG_KEYSTONE_UART1
+		bool "Kernel low-level debugging on KEYSTONE2 using UART1"
+		depends on ARCH_KEYSTONE
+		help
+		  Say Y here if you want the debug print routines to direct
+		  their output to UART1 serial port on KEYSTONE2 devices.
+
 	config DEBUG_MMP_UART2
 		bool "Kernel low-level debugging message via MMP UART2"
 		depends on ARCH_MMP
@@ -632,6 +646,8 @@ config DEBUG_LL_INCLUDE
 				 DEBUG_IMX51_UART || \
 				 DEBUG_IMX53_UART ||\
 				 DEBUG_IMX6Q_UART
+	default "debug/keystone.S" if DEBUG_KEYSTONE_UART0 || \
+				      DEBUG_KEYSTONE_UART1
 	default "debug/mvebu.S" if DEBUG_MVEBU_UART
 	default "debug/mxs.S" if DEBUG_IMX23_UART || DEBUG_IMX28_UART
 	default "debug/nomadik.S" if DEBUG_NOMADIK_UART
arch/arm/Makefile +1 -0
index 1ba358b..a1c9a78 100644
@@ -194,6 +194,7 @@ machine-$(CONFIG_PLAT_SPEAR)		+= spear
 machine-$(CONFIG_ARCH_VIRT)		+= virt
 machine-$(CONFIG_ARCH_ZYNQ)		+= zynq
 machine-$(CONFIG_ARCH_SUNXI)		+= sunxi
+machine-$(CONFIG_ARCH_KEYSTONE)		+= keystone
 
 # Platform directory name.  This list is sorted alphanumerically
 # by CONFIG_* macro name.
arch/arm/configs/keystone_defconfig new file +157 -0

157 lines not on this page · raw message

arch/arm/include/debug/keystone.S new file +43 -0

43 lines not on this page · raw message

arch/arm/mach-keystone/Kconfig new file +16 -0
new file mode 100644
index 0000000..39fab74
@@ -0,0 +1,16 @@
+config ARCH_KEYSTONE
+	bool "Texas Instruments Keystone Devices"
+	select CPU_V7
+	select ARM_GIC
+	select HAVE_ARM_ARCH_TIMER
+	select USE_OF
+	select MULTI_IRQ_HANDLER
+	select CLKSRC_MMIO
+	select GENERIC_CLOCKEVENTS
+	select SPARSE_IRQ
+	select HAVE_SCHED_CLOCK
+	select ARCH_WANT_OPTIONAL_GPIOLIB
+	select ARM_ERRATA_798181
+	help
+	  Support for boards based on the Texas Instruments Keystone family of
+	  SoCs.
arch/arm/mach-keystone/Makefile new file +1 -0
new file mode 100644
index 0000000..d4671d5
@@ -0,0 +1 @@
+obj-y					:= keystone.o
arch/arm/mach-keystone/Makefile.boot new file +1 -0
new file mode 100644
index 0000000..f3835c4
@@ -0,0 +1 @@
+zreladdr-y	:= 0x80008000
arch/arm/mach-keystone/include/mach/timex.h new file +15 -0
new file mode 100644
index 0000000..e4c595a
@@ -0,0 +1,15 @@
+/*
+ * Copyright 2013 Texas Instruments, Inc.
+ *	Cyril Chemparathy <[email protected]>
+ *	Santosh Shilimkar <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ */
+#ifndef __MACH_TIMEX_H
+#define __MACH_TIMEX_H
+
+#define CLOCK_TICK_RATE		1000000
+
+#endif
arch/arm/mach-keystone/keystone.c new file +74 -0

74 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 1/3 ARM: keystone: Add minimal TI Keystone platform support

arch/arm/configs/keystone_defconfig line 4

Quoted 11 lines · On Monday 10 June 2013 15:55:21 Santosh Shilimkar wrote:
arch/arm/configs/keystone_defconfig new file +4 -0
new file mode 100644
index 0000000..62e968c
@@ -0,0 +1,157 @@
+# CONFIG_SWAP is not set
+CONFIG_POSIX_MQUEUE=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_IKCONFIG=y

How about adding the things you need to multi_v7_defconfig instead? We try not to have too many defconfigs.

Quoted 9 lines
arch/arm/mach-keystone/Kconfig new file +3 -0
new file mode 100644
index 0000000..39fab74
@@ -0,0 +1,16 @@
+config ARCH_KEYSTONE
+	bool "Texas Instruments Keystone Devices"
+	select CPU_V7

arch/arm/mach-keystone/Kconfig line 13

Quoted 10 lines
arch/arm/mach-keystone/Kconfig new file +10 -0
+	select ARM_GIC
+	select HAVE_ARM_ARCH_TIMER
+	select USE_OF
+	select MULTI_IRQ_HANDLER
+	select CLKSRC_MMIO
+	select GENERIC_CLOCKEVENTS
+	select SPARSE_IRQ
+	select HAVE_SCHED_CLOCK
+	select ARCH_WANT_OPTIONAL_GPIOLIB
+	select ARM_ERRATA_798181

You don't need to select any of the options that are already selected by CONFIG_ARCH_MULTIPLATFORM.

Please add a 'depends on ARCH_MULTI_V7' statement in there to prevent this option from showing up for incompatible platforms.

Quoted 11 lines
arch/arm/mach-keystone/include/mach/timex.h new file +5 -0
new file mode 100644
index 0000000..e4c595a
@@ -0,0 +1,15 @@
+/*
+ * Copyright 2013 Texas Instruments, Inc.
+ *	Cyril Chemparathy <[email protected]>
+ *	Santosh Shilimkar <[email protected]>
+ *

arch/arm/mach-keystone/include/mach/timex.h line 15

Quoted 10 lines
arch/arm/mach-keystone/include/mach/timex.h new file +10 -0
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ */
+#ifndef __MACH_TIMEX_H
+#define __MACH_TIMEX_H
+
+#define CLOCK_TICK_RATE		1000000
+
+#endif

Not needed any more

Quoted 37 lines
arch/arm/mach-keystone/keystone.c new file +31 -0
new file mode 100644
index 0000000..6c6fc42
 
+static void __iomem *keystone_rstctrl;
+
+static void __init keystone_init(void)
+{
+	struct device_node *node;
+
+	node = of_find_compatible_node(NULL, NULL, "ti,keystone-reset");
+	if (WARN_ON(!node)) {
+		pr_warn("ti, keystone-reset node undefined\n");
+		return;
+	}
+
+	keystone_rstctrl = of_iomap(node, 0);
+	if (WARN_ON(!keystone_rstctrl)) {
+		pr_warn("ti, keystone-reset iomap error\n");
+		return;
+	}
+
+	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}
+
+static const char *keystone_match[] __initconst = {
+	"ti,keystone-evm",
+	NULL,
+};
+
+void keystone_restart(char mode, const char *cmd)
+{
+	u32 val;
+
+	/* Enable write access to RSTCTRL */

arch/arm/mach-keystone/keystone.c line 67

Quoted 10 lines
arch/arm/mach-keystone/keystone.c new file +10 -0
+	val = __raw_readl(keystone_rstctrl);
+	val &= PLL_RESET_WRITE_KEY_MASK;
+	val |= PLL_RESET_WRITE_KEY;
+	__raw_writel(val, keystone_rstctrl);
+
+	/* Reset the SOC */
+	val = __raw_readl(keystone_rstctrl);
+	val &= ~PLL_RESET;
+	__raw_writel(val, keystone_rstctrl);
+}

Please use 'readl', not '__raw_readl' unless you are accessing memory.

arch/arm/mach-keystone/keystone.c line 74

Quoted 6 lines
arch/arm/mach-keystone/keystone.c new file +6 -0
+DT_MACHINE_START(KEYSTONE, "Keystone")
+	.map_io		= debug_ll_io_init,
+	.init_machine	= keystone_init,
+	.dt_compat	= keystone_match,
+	.restart	= keystone_restart,
+MACHINE_END

You can leave out the map_io line now.

Arnd

#3 lore raw

PATCH 1/3 ARM: keystone: Add minimal TI Keystone platform support

Quoted 16 lines · Arnd Bergmann

arch/arm/configs/keystone_defconfig line 4

Quoted 11 lines · On Monday 10 June 2013 15:55:21 Santosh Shilimkar wrote:
arch/arm/configs/keystone_defconfig new file +4 -0
new file mode 100644
index 0000000..62e968c
@@ -0,0 +1,157 @@
+# CONFIG_SWAP is not set
+CONFIG_POSIX_MQUEUE=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_IKCONFIG=y

How about adding the things you need to multi_v7_defconfig instead? We try not to have too many defconfigs.

I initially thought about it but after looking at various subsystems needed (from internal trees), we will need to 1 custom defoconfig and my plan is to limit to only one for all Keystone machines.

Quoted 14 lines
Quoted 14 lines
arch/arm/mach-keystone/Kconfig new file +8 -0
new file mode 100644
index 0000000..39fab74
@@ -0,0 +1,16 @@
+config ARCH_KEYSTONE
+	bool "Texas Instruments Keystone Devices"
+	select CPU_V7
+	select ARM_GIC
+	select HAVE_ARM_ARCH_TIMER
+	select USE_OF
+	select MULTI_IRQ_HANDLER
+	select CLKSRC_MMIO
Quoted 9 lines

arch/arm/mach-keystone/Kconfig line 13

Quoted 5 lines
arch/arm/mach-keystone/Kconfig new file +5 -0
+	select GENERIC_CLOCKEVENTS
+	select SPARSE_IRQ
+	select HAVE_SCHED_CLOCK
+	select ARCH_WANT_OPTIONAL_GPIOLIB
+	select ARM_ERRATA_798181

You don't need to select any of the options that are already selected by CONFIG_ARCH_MULTIPLATFORM.

Good to know.

Quoted 3 lines

Please add a 'depends on ARCH_MULTI_V7' statement in there to prevent this option from showing up for incompatible platforms.

Will do.

Quoted 15 lines
Quoted 15 lines
arch/arm/mach-keystone/include/mach/timex.h new file +9 -0
new file mode 100644
index 0000000..e4c595a
@@ -0,0 +1,15 @@
+/*
+ * Copyright 2013 Texas Instruments, Inc.
+ *	Cyril Chemparathy <[email protected]>
+ *	Santosh Shilimkar <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ */
Quoted 9 lines

arch/arm/mach-keystone/include/mach/timex.h line 15

Quoted 6 lines
arch/arm/mach-keystone/include/mach/timex.h new file +6 -0
+#ifndef __MACH_TIMEX_H
+#define __MACH_TIMEX_H
+
+#define CLOCK_TICK_RATE		1000000
+
+#endif

Not needed any more

ok

Quoted 41 lines
Quoted 41 lines
arch/arm/mach-keystone/keystone.c new file +35 -0
new file mode 100644
index 0000000..6c6fc42
 
+static void __iomem *keystone_rstctrl;
+
+static void __init keystone_init(void)
+{
+	struct device_node *node;
+
+	node = of_find_compatible_node(NULL, NULL, "ti,keystone-reset");
+	if (WARN_ON(!node)) {
+		pr_warn("ti, keystone-reset node undefined\n");
+		return;
+	}
+
+	keystone_rstctrl = of_iomap(node, 0);
+	if (WARN_ON(!keystone_rstctrl)) {
+		pr_warn("ti, keystone-reset iomap error\n");
+		return;
+	}
+
+	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}
+
+static const char *keystone_match[] __initconst = {
+	"ti,keystone-evm",
+	NULL,
+};
+
+void keystone_restart(char mode, const char *cmd)
+{
+	u32 val;
+
+	/* Enable write access to RSTCTRL */
+	val = __raw_readl(keystone_rstctrl);
+	val &= PLL_RESET_WRITE_KEY_MASK;
+	val |= PLL_RESET_WRITE_KEY;
+	__raw_writel(val, keystone_rstctrl);
Quoted 9 lines

arch/arm/mach-keystone/keystone.c line 67

Quoted 6 lines
arch/arm/mach-keystone/keystone.c new file +6 -0
+
+	/* Reset the SOC */
+	val = __raw_readl(keystone_rstctrl);
+	val &= ~PLL_RESET;
+	__raw_writel(val, keystone_rstctrl);
+}

Please use 'readl', not '__raw_readl' unless you are accessing memory.

Just oversight. Will fix that.

Quoted 9 lines

arch/arm/mach-keystone/keystone.c line 74

Quoted 6 lines
arch/arm/mach-keystone/keystone.c new file +6 -0
+DT_MACHINE_START(KEYSTONE, "Keystone")
+	.map_io		= debug_ll_io_init,
+	.init_machine	= keystone_init,
+	.dt_compat	= keystone_match,
+	.restart	= keystone_restart,
+MACHINE_END

You can leave out the map_io line now.

Cool. Will drop that.

#4 lore raw

PATCH 1/3 ARM: keystone: Add minimal TI Keystone platform support

Quoted 17 lines · On Tuesday 11 June 2013 16:10:32 Santosh Shilimkar wrote:
Quoted 16 lines · Arnd Bergmann

arch/arm/configs/keystone_defconfig line 4

Quoted 11 lines · On Monday 10 June 2013 15:55:21 Santosh Shilimkar wrote:
arch/arm/configs/keystone_defconfig new file +4 -0
new file mode 100644
index 0000000..62e968c
@@ -0,0 +1,157 @@
+# CONFIG_SWAP is not set
+CONFIG_POSIX_MQUEUE=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_IKCONFIG=y

How about adding the things you need to multi_v7_defconfig instead? We try not to have too many defconfigs.

Quoted 3 lines

I initially thought about it but after looking at various subsystems needed (from internal trees), we will need to 1 custom defoconfig and my plan is to limit to only one for all Keystone machines.

Ok, fair enough. Could you enable keystone in multi_v7_defconfig anyway and ensure that it is able to boot?

Arnd

#5 lore raw

PATCH 1/3 ARM: keystone: Add minimal TI Keystone platform support

Quoted 18 lines · Arnd Bergmann
Quoted 17 lines · On Tuesday 11 June 2013 16:10:32 Santosh Shilimkar wrote:
Quoted 16 lines · Arnd Bergmann

arch/arm/configs/keystone_defconfig line 4

Quoted 11 lines · On Monday 10 June 2013 15:55:21 Santosh Shilimkar wrote:
arch/arm/configs/keystone_defconfig new file +4 -0
new file mode 100644
index 0000000..62e968c
@@ -0,0 +1,157 @@
+# CONFIG_SWAP is not set
+CONFIG_POSIX_MQUEUE=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_IKCONFIG=y

How about adding the things you need to multi_v7_defconfig instead? We try not to have too many defconfigs.

Quoted 7 lines
Quoted 3 lines

I initially thought about it but after looking at various subsystems needed (from internal trees), we will need to 1 custom defoconfig and my plan is to limit to only one for all Keystone machines.

Ok, fair enough. Could you enable keystone in multi_v7_defconfig anyway and ensure that it is able to boot?

Thanks. Will make sure it boots with multi_v7_defconfig.

Regards,
Santosh

#6 lore raw

PATCH 1/3 ARM: keystone: Add minimal TI Keystone platform support

Arnd,

Quoted 2 lines · Santosh Shilimkar
Quoted 1 line · Arnd Bergmann

On Tuesday 11 June 2013 16:10:32 Santosh Shilimkar wrote:

[..]

Quoted 5 lines
Quoted 3 lines

Ok, fair enough. Could you enable keystone in multi_v7_defconfig anyway and ensure that it is able to boot?

Thanks. Will make sure it boots with multi_v7_defconfig.

I spent some time to get "multi_v7_defconfig" on OMAP and Keystone working. ARCH_SIRF machine code needs a fix and the multi_v7_defconfig needs few generic updates like enabling ramdisk and ext2 related support. With those two updates, OMAP5 and Keystone boots with multi_v7_defconfig. Will post those couple of patches for multi_v7_defconfig and also refresh the Keystone series.

Thanks for the feedback.

Regards,
Santosh
P.S: On Keystone I noticed a weired issue with local_flush_tlb_all() while booting with multi_v7_defconfig which I will debug it further. Its mostly looks like keystone specific issue since I don't see that issue on OMAP5.

#7 lore raw

PATCH 2/3 ARM: keystone: Enable SMP support on Keystone machines

In reply to Santosh Shilimkar

Add basic SMP support for Keystone machines. This does not include support for CPU hotplug for now.

Cc Olof Johansson <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc arm at kernel.org
---
 arch/arm/mach-keystone/Kconfig    |    1 +
 arch/arm/mach-keystone/Makefile   |    1 +
 arch/arm/mach-keystone/keystone.c |    4 +++
 arch/arm/mach-keystone/keystone.h |   17 ++++++++++
 arch/arm/mach-keystone/platsmp.c  |   67 +++++++++++++++++++++++++++++++++++++
 5 files changed, 90 insertions(+)
 create mode 100644 arch/arm/mach-keystone/keystone.h
 create mode 100644 arch/arm/mach-keystone/platsmp.c
arch/arm/mach-keystone/Kconfig +1 -0
index 39fab74..6054673 100644
@@ -3,6 +3,7 @@ config ARCH_KEYSTONE
 	select CPU_V7
 	select ARM_GIC
 	select HAVE_ARM_ARCH_TIMER
+	select HAVE_SMP
 	select USE_OF
 	select MULTI_IRQ_HANDLER
 	select CLKSRC_MMIO
arch/arm/mach-keystone/Makefile +1 -0
index d4671d5..3f6b8ab 100644
@@ -1 +1,2 @@
 obj-y					:= keystone.o
+obj-$(CONFIG_SMP)			+= platsmp.o
arch/arm/mach-keystone/keystone.c +4 -0
index 6c6fc42..5dd3b32 100644
@@ -19,6 +19,9 @@
 #include <asm/mach/map.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
+#include <asm/smp_plat.h>
+
+#include "keystone.h"
 
 #define PLL_RESET_WRITE_KEY_MASK		0xffff0000
 #define PLL_RESET_WRITE_KEY			0x5a69
@@ -67,6 +70,7 @@ void keystone_restart(char mode, const char *cmd)
 }
 
 DT_MACHINE_START(KEYSTONE, "Keystone")
+	.smp		= smp_ops(keystone_smp_ops),
 	.map_io		= debug_ll_io_init,
 	.init_machine	= keystone_init,
 	.dt_compat	= keystone_match,
arch/arm/mach-keystone/keystone.h new file +17 -0
new file mode 100644
index 0000000..43a1b47
@@ -0,0 +1,17 @@
+/*
+ * Copyright 2013 Texas Instruments, Inc.
+ *	Cyril Chemparathy <[email protected]>
+ *	Santosh Shilimkar <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ */
+
+#ifndef __KEYSTONE_H__
+#define __KEYSTONE_H__
+
+extern struct smp_operations keystone_smp_ops;
+extern void secondary_startup(void);
+
+#endif /* __KEYSTONE_H__ */
arch/arm/mach-keystone/platsmp.c new file +67 -0

67 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#8 lore raw

PATCH 2/3 ARM: keystone: Enable SMP support on Keystone machines

2013/6/11 Santosh Shilimkar <[email protected]>:

Quoted 105 lines

Add basic SMP support for Keystone machines. This does not include support for CPU hotplug for now.

Cc Olof Johansson <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc arm at kernel.org
---
 arch/arm/mach-keystone/Kconfig    |    1 +
 arch/arm/mach-keystone/Makefile   |    1 +
 arch/arm/mach-keystone/keystone.c |    4 +++
 arch/arm/mach-keystone/keystone.h |   17 ++++++++++
 arch/arm/mach-keystone/platsmp.c  |   67 +++++++++++++++++++++++++++++++++++++
 5 files changed, 90 insertions(+)
 create mode 100644 arch/arm/mach-keystone/keystone.h
 create mode 100644 arch/arm/mach-keystone/platsmp.c
arch/arm/mach-keystone/Kconfig +1 -0
index 39fab74..6054673 100644
@@ -3,6 +3,7 @@ config ARCH_KEYSTONE
        select CPU_V7
        select ARM_GIC
        select HAVE_ARM_ARCH_TIMER
+       select HAVE_SMP
        select USE_OF
        select MULTI_IRQ_HANDLER
        select CLKSRC_MMIO
arch/arm/mach-keystone/Makefile +1 -0
index d4671d5..3f6b8ab 100644
@@ -1 +1,2 @@
 obj-y                                  := keystone.o
+obj-$(CONFIG_SMP)                      += platsmp.o
arch/arm/mach-keystone/keystone.c +4 -0
index 6c6fc42..5dd3b32 100644
@@ -19,6 +19,9 @@
 #include <asm/mach/map.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
+#include <asm/smp_plat.h>
+
+#include "keystone.h"
 
 #define PLL_RESET_WRITE_KEY_MASK               0xffff0000
 #define PLL_RESET_WRITE_KEY                    0x5a69
@@ -67,6 +70,7 @@ void keystone_restart(char mode, const char *cmd)
 }
 
 DT_MACHINE_START(KEYSTONE, "Keystone")
+       .smp            = smp_ops(keystone_smp_ops),
        .map_io         = debug_ll_io_init,
        .init_machine   = keystone_init,
        .dt_compat      = keystone_match,
arch/arm/mach-keystone/keystone.h new file +17 -0
new file mode 100644
index 0000000..43a1b47
@@ -0,0 +1,17 @@
+/*
+ * Copyright 2013 Texas Instruments, Inc.
+ *     Cyril Chemparathy <[email protected]>
+ *     Santosh Shilimkar <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ */
+
+#ifndef __KEYSTONE_H__
+#define __KEYSTONE_H__
+
+extern struct smp_operations keystone_smp_ops;
+extern void secondary_startup(void);
+
+#endif /* __KEYSTONE_H__ */
arch/arm/mach-keystone/platsmp.c new file +17 -0
new file mode 100644
index 0000000..3071dda
@@ -0,0 +1,67 @@
+/*
+ * Keystone SOC SMP platform code
+ *
+ * Copyright 2013 Texas Instruments, Inc.
+ *     Cyril Chemparathy <[email protected]>
+ *     Santosh Shilimkar <[email protected]>
+ *
+ * Based on platsmp.c, Copyright (C) 2002 ARM Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ */
+
+#include <linux/init.h>
+#include <linux/smp.h>
+#include <linux/io.h>

arch/arm/mach-keystone/platsmp.c line 27

Quoted 10 lines
arch/arm/mach-keystone/platsmp.c new file +10 -0
+
+#include <asm/smp_plat.h>
+
+#include "keystone.h"
+
+static void __init keystone_smp_init_cpus(void)
+{
+       unsigned int i, ncores;
+
+       ncores = 4;

This hardcoding can be done away, if cpu nodes are passed through DT. Also set set_cpu_possible will be done by "arm_dt_init_cpu_maps" in devtree.c

Quoted 44 lines
arch/arm/mach-keystone/platsmp.c new file +40 -1
+
+       /* sanity check */
+       if (ncores > NR_CPUS) {
+               pr_warn("restricted to %d cpus\n", NR_CPUS);
+               ncores = NR_CPUS;
+       }
+
+       for (i = 0; i < ncores; i++)
+               set_cpu_possible(i, true);
+}
+
+static int __cpuinit keystone_smp_boot_secondary(unsigned int cpu,
+                                               struct task_struct *idle)
+{
+       unsigned long start = virt_to_phys(&secondary_startup);
+       int error;
+
+       pr_debug("keystone-smp: booting cpu %d, vector %08lx\n",
+                cpu, start);
+
+       asm volatile (
+               "mov    r0, #0\n"       /* power on cmd */
+               "mov    r1, %1\n"       /* cpu          */
+               "mov    r2, %2\n"       /* start        */
+               ".inst  0xe1600070\n"   /* smc #0       */
+               "mov    %0, r0\n"
+               : "=r" (error)
+               : "r"(cpu), "r"(start)
+               : "cc", "r0", "r1", "r2", "memory"
+       );
+
+       pr_debug("keystone-smp: monitor returned %d\n", error);
+
+       return error;
+}
+
+struct smp_operations keystone_smp_ops __initdata = {
+       .smp_init_cpus          = keystone_smp_init_cpus,
+       .smp_boot_secondary     = keystone_smp_boot_secondary,
+};
--

1.7.9.5

Quoted 4 lines

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

--
with warm regards,
Chander Kashyap

#9 lore raw

PATCH 2/3 ARM: keystone: Enable SMP support on Keystone machines

Quoted 10 lines · Chander Kashyap

2013/6/11 Santosh Shilimkar <[email protected]>:

Quoted 9 lines

Add basic SMP support for Keystone machines. This does not include support for CPU hotplug for now.

Cc Olof Johansson <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc arm at kernel.org

---

[..]

Quoted 27 lines
Quoted 27 lines
arch/arm/mach-keystone/platsmp.c new file +21 -0
new file mode 100644
index 0000000..3071dda
@@ -0,0 +1,67 @@
+/*
+ * Keystone SOC SMP platform code
+ *
+ * Copyright 2013 Texas Instruments, Inc.
+ *     Cyril Chemparathy <[email protected]>
+ *     Santosh Shilimkar <[email protected]>
+ *
+ * Based on platsmp.c, Copyright (C) 2002 ARM Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ */
+
+#include <linux/init.h>
+#include <linux/smp.h>
+#include <linux/io.h>
+
+#include <asm/smp_plat.h>
+
+#include "keystone.h"
Quoted 9 lines

arch/arm/mach-keystone/platsmp.c line 27

Quoted 6 lines
arch/arm/mach-keystone/platsmp.c new file +6 -0
+
+static void __init keystone_smp_init_cpus(void)
+{
+       unsigned int i, ncores;
+
+       ncores = 4;

This hardcoding can be done away, if cpu nodes are passed through DT. Also set set_cpu_possible will be done by "arm_dt_init_cpu_maps" in devtree.c

Thanks. Will have a look at it.

Regards,
Santosh

#10 lore raw

PATCH 2/3 ARM: keystone: Enable SMP support on Keystone machines

Quoted 50 lines · Santosh Shilimkar
Quoted 10 lines · Chander Kashyap

2013/6/11 Santosh Shilimkar <[email protected]>:

Quoted 9 lines

Add basic SMP support for Keystone machines. This does not include support for CPU hotplug for now.

Cc Olof Johansson <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc arm at kernel.org

---

[..]

Quoted 27 lines
Quoted 27 lines
arch/arm/mach-keystone/platsmp.c new file +21 -0
new file mode 100644
index 0000000..3071dda
@@ -0,0 +1,67 @@
+/*
+ * Keystone SOC SMP platform code
+ *
+ * Copyright 2013 Texas Instruments, Inc.
+ *     Cyril Chemparathy <[email protected]>
+ *     Santosh Shilimkar <[email protected]>
+ *
+ * Based on platsmp.c, Copyright (C) 2002 ARM Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ */
+
+#include <linux/init.h>
+#include <linux/smp.h>
+#include <linux/io.h>
+
+#include <asm/smp_plat.h>
+
+#include "keystone.h"
Quoted 9 lines

arch/arm/mach-keystone/platsmp.c line 27

Quoted 6 lines
arch/arm/mach-keystone/platsmp.c new file +6 -0
+
+static void __init keystone_smp_init_cpus(void)
+{
+       unsigned int i, ncores;
+
+       ncores = 4;

This hardcoding can be done away, if cpu nodes are passed through DT. Also set set_cpu_possible will be done by "arm_dt_init_cpu_maps" in devtree.c

Quoted 2 lines

Thanks. Will have a look at it.

For record, i have dropped keystone_smp_init_cpus() completely. arm_dt_init_cpu_maps() does everything what we need. Thanks for pointer.

Looks like other platforms can also do the same but was curious why its not being used yet. May be I missed some ongoing patches. Do you know ?

Regards,
Santosh

#11 lore raw

PATCH 3/3 ARM: dts: keystone: Add minimal Keystone SOC device tree data

In reply to Santosh Shilimkar

Add minimal device tree data for Keystone2 based SOCs. Patch contains mainly ARM related SOC data and nothing about EVM specific yet.

Cc Grant Likely <[email protected]>
Cc Olof Johansson <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc arm at kernel.org

---
I have seen some ongoing #include cleanups from Stephen Warren and cpu_node updates from Lorenzo, but since am unaware of the dependencies, dts file is aligned with the v3.10rcx ARM dts files. The changes are very trivial so I can fix them quickly when they show up in linux-next.

 .../devicetree/bindings/arm/keystone/keystone.txt  |    9 ++
 arch/arm/boot/dts/keystone.dts                     |   98 ++++++++++++++++++++
 2 files changed, 107 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/keystone/keystone.txt
 create mode 100644 arch/arm/boot/dts/keystone.dts
Documentation/devicetree/bindings/arm/keystone/keystone.txt new file +9 -0
new file mode 100644
index 0000000..b496d4c
@@ -0,0 +1,9 @@
+TI Kesytone Platforms Device Tree Bindings
+-----------------------------------------------
+
+Boards with Keystone2 based devices (TCI66xxK2H) SOC shall have the
+following properties.
+
+Required properties:
+ - compatible: Every devices present in Keystone SOC should be in
+   the form "ti,keystone-*";
arch/arm/boot/dts/keystone.dts new file +98 -0

98 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#12 lore raw

PATCH 3/3 ARM: dts: keystone: Add minimal Keystone SOC device tree data

Quoted 28 lines · Santosh Shilimkar

Add minimal device tree data for Keystone2 based SOCs. Patch contains mainly ARM related SOC data and nothing about EVM specific yet.

Cc Grant Likely <[email protected]>
Cc Olof Johansson <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc arm at kernel.org

---
I have seen some ongoing #include cleanups from Stephen Warren and cpu_node updates from Lorenzo, but since am unaware of the dependencies, dts file is aligned with the v3.10rcx ARM dts files. The changes are very trivial so I can fix them quickly when they show up in linux-next.

 .../devicetree/bindings/arm/keystone/keystone.txt  |    9 ++
 arch/arm/boot/dts/keystone.dts                     |   98 ++++++++++++++++++++
 2 files changed, 107 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/keystone/keystone.txt
 create mode 100644 arch/arm/boot/dts/keystone.dts
Documentation/devicetree/bindings/arm/keystone/keystone.txt new file +0 -0
new file mode 100644
index 0000000..b496d4c

Documentation/devicetree/bindings/arm/keystone/keystone.txt line 9

Quoted 9 lines
Documentation/devicetree/bindings/arm/keystone/keystone.txt new file +9 -0
@@ -0,0 +1,9 @@
+TI Kesytone Platforms Device Tree Bindings
+-----------------------------------------------
+
+Boards with Keystone2 based devices (TCI66xxK2H) SOC shall have the
+following properties.
+
+Required properties:
+ - compatible: Every devices present in Keystone SOC should be in
+   the form "ti,keystone-*";

I'm not sure that makes sense. The GIC for example isn't a "ti,keystone-gic", and the uarts in the soc node don't start with "ti,keystone-" either.

Quoted 41 lines
arch/arm/boot/dts/keystone.dts new file +35 -0
new file mode 100644
index 0000000..9ca7d25
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2013 Texas Instruments, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+/dts-v1/;
+/include/ "skeleton.dtsi"
+
+/ {
+	model = "Texas Instruments Keystone 2 SoC";
+	compatible =  "ti,keystone-evm";
+	#address-cells = <2>;
+	#size-cells = <2>;
+	interrupt-parent = <&gic>;
+
+	aliases {
+		serial0	= &uart0;
+	};
+
+	memory {
+		reg = <0x00000000 0x80000000 0x00000000 0x40000000>;
+	};
+
+	cpus {
+		interrupt-parent = <&gic>;
+
+		cpu at 0 {
+			compatible = "arm,cortex-a15";
+		};
+
+		cpu at 1 {
+			compatible = "arm,cortex-a15";

arch/arm/boot/dts/keystone.dts line 45

Quoted 10 lines
arch/arm/boot/dts/keystone.dts new file +10 -0
+		};
+
+		cpu at 2 {
+			compatible = "arm,cortex-a15";
+		};
+
+		cpu at 3 {
+			compatible = "arm,cortex-a15";
+		};
+	};

It would be nice if these matched up with what's *currently* specified in the cpu bindings (each cpu has it's reg and device_type set, cpus have the requisite #address-cells and #size cells as required by ePAPR).

All you should need is:

	cpus {
		#address-cells = <1>;
		#size-cells = <0>;

		interrupt-parent = <&gic>;

		cpu at 0 {
			compatible = "arm,cortex-a15";
			device_type = "cpu";
			reg = <0>;
		};

		cpu at 1 {
			compatible = "arm,cortex-a15";
			device_type = "cpu";
			reg = <1>;
		};

		cpu at 2 {
			compatible = "arm,cortex-a15";
			device_type = "cpu";
			reg = <2>;
		};

		cpu at 3 {
			compatible = "arm,cortex-a15";
			device_type = "cpu";
			reg = <3>;
		};
	};

Thanks,
Mark.

#13 lore raw

PATCH 3/3 ARM: dts: keystone: Add minimal Keystone SOC device tree data

Quoted 33 lines · Mark Rutland
Quoted 32 lines · Santosh Shilimkar

Add minimal device tree data for Keystone2 based SOCs. Patch contains mainly ARM related SOC data and nothing about EVM specific yet.

Cc Grant Likely <[email protected]>
Cc Olof Johansson <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc arm at kernel.org

---
I have seen some ongoing #include cleanups from Stephen Warren and cpu_node updates from Lorenzo, but since am unaware of the dependencies, dts file is aligned with the v3.10rcx ARM dts files. The changes are very trivial so I can fix them quickly when they show up in linux-next.

 .../devicetree/bindings/arm/keystone/keystone.txt  |    9 ++
 arch/arm/boot/dts/keystone.dts                     |   98 ++++++++++++++++++++
 2 files changed, 107 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/keystone/keystone.txt
 create mode 100644 arch/arm/boot/dts/keystone.dts
Documentation/devicetree/bindings/arm/keystone/keystone.txt new file +4 -0
new file mode 100644
index 0000000..b496d4c
@@ -0,0 +1,9 @@
+TI Kesytone Platforms Device Tree Bindings
+-----------------------------------------------
+
+Boards with Keystone2 based devices (TCI66xxK2H) SOC shall have the
Quoted 9 lines

Documentation/devicetree/bindings/arm/keystone/keystone.txt line 9

Quoted 5 lines
Documentation/devicetree/bindings/arm/keystone/keystone.txt new file +5 -0
+following properties.
+
+Required properties:
+ - compatible: Every devices present in Keystone SOC should be in
+   the form "ti,keystone-*";

I'm not sure that makes sense. The GIC for example isn't a "ti,keystone-gic", and the uarts in the soc node don't start with "ti,keystone-" either.

I shouldn't have generalized it. UART are compatible with ns16550 UARTs. Will update the documentation line in next version.

Quoted 80 lines
Quoted 41 lines
arch/arm/boot/dts/keystone.dts new file +35 -0
new file mode 100644
index 0000000..9ca7d25
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2013 Texas Instruments, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+/dts-v1/;
+/include/ "skeleton.dtsi"
+
+/ {
+	model = "Texas Instruments Keystone 2 SoC";
+	compatible =  "ti,keystone-evm";
+	#address-cells = <2>;
+	#size-cells = <2>;
+	interrupt-parent = <&gic>;
+
+	aliases {
+		serial0	= &uart0;
+	};
+
+	memory {
+		reg = <0x00000000 0x80000000 0x00000000 0x40000000>;
+	};
+
+	cpus {
+		interrupt-parent = <&gic>;
+
+		cpu at 0 {
+			compatible = "arm,cortex-a15";
+		};
+
+		cpu at 1 {
+			compatible = "arm,cortex-a15";

arch/arm/boot/dts/keystone.dts line 45

Quoted 10 lines
arch/arm/boot/dts/keystone.dts new file +10 -0
+		};
+
+		cpu at 2 {
+			compatible = "arm,cortex-a15";
+		};
+
+		cpu at 3 {
+			compatible = "arm,cortex-a15";
+		};
+	};

It would be nice if these matched up with what's *currently* specified in the cpu bindings (each cpu has it's reg and device_type set, cpus have the requisite #address-cells and #size cells as required by ePAPR).

All you should need is:

	cpus {
		#address-cells = <1>;
		#size-cells = <0>;

		interrupt-parent = <&gic>;

		cpu at 0 {
			compatible = "arm,cortex-a15";
			device_type = "cpu";
			reg = <0>;
		};

		cpu at 1 {
			compatible = "arm,cortex-a15";
			device_type = "cpu";
			reg = <1>;
		};

		cpu at 2 {
			compatible = "arm,cortex-a15";
			device_type = "cpu";
			reg = <2>;
Quoted 9 lines
		};

		cpu at 3 {
			compatible = "arm,cortex-a15";
			device_type = "cpu";
			reg = <3>;
		};
	};

I did notice this as mentioned in the comments but was not sure about the dependency. Now since you confirmed there is none, consider above updates taken care in next version.

Regards,
Santosh