Skip to contentSkip to conversation

ARM: keystone: Add support for TI power processor

PATCH Superseded Nishanth Menon 1 participant 5 messages Aug 24, 2015

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Nishanth Menon

author maintainer
#0 lore raw

cover ARM: keystone: Add support for TI power processor

The last patch in this series depends on
http://lists.denx.de/pipermail/u-boot/2015-August/225085.html Initial set is a basic set of cleanups and a new function set to keep modules in reset while we do some setup on the module - for example a processor that is enabled, kept in reset while being loaded.

This eventually adds support for TI Power processor called pmmc with the start of the next generation of TI processors based on keystone architecture. These processor offloads power management functions to an embedded microcontroller with a firmware - similar in nature to what is currently available in AM335x/AM437x - except, the scope of functionality provided by these power proessors are much more enhanced from the purely "deep sleep support processor" that it used to be used for.

Infact, these functionality is so detailed that main processors A15 and High Level Operating Systems(HLOS) such as Linux, running on those processors are no longer expected to do low level register control for SoC architecture specific nit-gritties anymore. instead they request for services from this 'power processor'.

This series is primarily focussed on CM3 'power processor' on the K2G Keystone SoCs - other processors and SoCs can be entitled in the future as needed.

Nishanth Menon (4):
ARM: keystone: psc: redo doc in kernel-doc format
ARM: keystone: psc-defs: use adequate () for macros
ARM: keystone: psc: introduce function to hold and release module in
reset.
remoteproc: Add support for TI power processor

 arch/arm/mach-keystone/include/mach/psc_defs.h     |  10 +-
 arch/arm/mach-keystone/psc.c                       | 200 ++++++++++++++++-----
 drivers/remoteproc/Kconfig                         |   9 +
 drivers/remoteproc/Makefile                        |   1 +
 drivers/remoteproc/ti_power_proc.c                 | 131 ++++++++++++++
 .../dm/platform_data/remoteproc_ti_power_proc.h    |  15 ++
 6 files changed, 319 insertions(+), 47 deletions(-)
 create mode 100644 drivers/remoteproc/ti_power_proc.c
 create mode 100644 include/dm/platform_data/remoteproc_ti_power_proc.h
Signature · 1 line
2.1.4
author maintainer
#1 lore raw

PATCH 1/4 ARM: keystone: psc: redo doc in kernel-doc format

u-boot coding style guidance in
http://www.denx.de/wiki/U-Boot/CodingStyle clearly mentions that the kernel doc style shall be followed for documentation in u-boot.

Current PSC documentation standard does not, so fix that.

---
 arch/arm/mach-keystone/psc.c | 96 ++++++++++++++++++++++++--------------------
 1 file changed, 52 insertions(+), 44 deletions(-)
arch/arm/mach-keystone/psc.c +52 -44
index 237e776e8790..8991e237735e 100644
@@ -13,24 +13,27 @@
 #include <asm/processor.h>
 #include <asm/arch/psc_defs.h>
 
+/**
+ * psc_delay() - delay for psc
+ *
+ * Return: 10
+ */
 int psc_delay(void)
 {
 	udelay(10);
 	return 10;
 }
 
-/*
- * FUNCTION PURPOSE: Wait for end of transitional state
- *
- * DESCRIPTION: Polls pstat for the selected domain and waits for transitions
- *              to be complete.
+/**
+ * psc_wait() - Wait for end of transitional state
+ * @domain_num: GPSC domain number
  *
- *              Since this is boot loader code it is *ASSUMED* that interrupts
- *              are disabled and no other core is mucking around with the psc
- *              at the same time.
+ * Polls pstat for the selected domain and waits for transitions to be complete.
+ * Since this is boot loader code it is *ASSUMED* that interrupts are disabled
+ * and no other core is mucking around with the psc at the same time.
  *
- *              Returns 0 when the domain is free. Returns -1 if a timeout
- *              occurred waiting for the completion.
+ * Return: 0 when the domain is free. Returns -1 if a timeout occurred waiting
+ * for the completion.
  */
 int psc_wait(u32 domain_num)
 {
@@ -59,6 +62,10 @@ int psc_wait(u32 domain_num)
 	return 0;
 }
 
+/**
+ * psc_get_domain_num() - Get the domain number
+ * @mod_num:	LPSC module number
+ */
 u32 psc_get_domain_num(u32 mod_num)
 {
 	u32 domain_num;
@@ -70,20 +77,19 @@ u32 psc_get_domain_num(u32 mod_num)
 	return domain_num;
 }
 
-/*
- * FUNCTION PURPOSE: Power up/down a module
+/**
+ * psc_set_state() - powers up/down a module
+ * @mod_num:	LPSC module number
+ * @state:	1 to enable, 0 to disable.
  *
- * DESCRIPTION: Powers up/down the requested module and the associated power
- *		domain if required. No action is taken it the module is
- *		already powered up/down.
+ * Powers up/down the requested module and the associated power domain if
+ * required. No action is taken it the module is already powered up/down.
+ * This only controls modules. The domain in which the module resides will
+ * be left in the power on state. Multiple modules can exist in a power
+ * domain, so powering down the domain based on a single module is not done.
  *
- *              This only controls modules. The domain in which the module
- *              resides will be left in the power on state. Multiple modules
- *              can exist in a power domain, so powering down the domain based
- *              on a single module is not done.
- *
- *              Returns 0 on success, -1 if the module can't be powered up, or
- *              if there is a timeout waiting for the transition.
+ * Return: 0 on success, -1 if the module can't be powered up, or if there is a
+ * timeout waiting for the transition.
  */
 int psc_set_state(u32 mod_num, u32 state)
 {
@@ -136,15 +142,16 @@ int psc_set_state(u32 mod_num, u32 state)
 	return psc_wait(domain_num);
 }
 
-/*
- * FUNCTION PURPOSE: Power up a module
+/**
+ * psc_enable_module() - power up a module
+ * @mod_num:	LPSC module number
  *
- * DESCRIPTION: Powers up the requested module and the associated power domain
- *              if required. No action is taken it the module is already
- *              powered up.
+ * Powers up the requested module and the associated power domain
+ * if required. No action is taken it the module is already powered up.
+ *
+ * Return: 0 on success, -1 if the module can't be powered up, or
+ * if there is a timeout waiting for the transition.
  *
- *              Returns 0 on success, -1 if the module can't be powered up, or
- *              if there is a timeout waiting for the transition.
  */
 int psc_enable_module(u32 mod_num)
 {
@@ -158,12 +165,11 @@ int psc_enable_module(u32 mod_num)
 	return psc_set_state(mod_num, PSC_REG_VAL_MDCTL_NEXT_ON);
 }
 
-/*
- * FUNCTION PURPOSE: Power down a module
+/**
+ * psc_disable_module() - Power down a module
+ * @mod_num:	LPSC module number
  *
- * DESCRIPTION: Powers down the requested module.
- *
- *              Returns 0 on success, -1 on failure or timeout.
+ * Return: 0 on success, -1 on failure or timeout.
  */
 int psc_disable_module(u32 mod_num)
 {
@@ -179,13 +185,16 @@ int psc_disable_module(u32 mod_num)
 	return psc_set_state(mod_num, PSC_REG_VAL_MDCTL_NEXT_SWRSTDISABLE);
 }
 
-/*
- * FUNCTION PURPOSE: Set the reset isolation bit in mdctl
+/**
+ * psc_set_reset_iso() - Set the reset isolation bit in mdctl
+ * @mod_num:	LPSC module number
  *
- * DESCRIPTION: The reset isolation enable bit is set. The state of the module
- *              is not changed. Returns 0 if the module config showed that
- *              reset isolation is supported. Returns 1 otherwise. This is not
- *              an error, but setting the bit in mdctl has no effect.
+ * The reset isolation enable bit is set. The state of the module is not
+ * changed.
+ *
+ * Return: 0 if the module config showed that reset isolation is supported.
+ * Returns 1 otherwise. This is not an error, but setting the bit in mdctl
+ * has no effect.
  */
 int psc_set_reset_iso(u32 mod_num)
 {
@@ -204,10 +213,9 @@ int psc_set_reset_iso(u32 mod_num)
 	return 1;
 }
 
-/*
- * FUNCTION PURPOSE: Disable a power domain
- *
- * DESCRIPTION: The power domain is disabled
+/**
+ * psc_disable_domain() - Disable a power domain
+ * @domain_num: GPSC domain number
  */
 int psc_disable_domain(u32 domain_num)
 {
Signature · 1 line
2.1.4
author maintainer
#2 lore raw

PATCH 2/4 ARM: keystone: psc-defs: use adequate () for macros

In reply to Nishanth Menon

'#define X a | b' is better defined as '#define X (a | b)' for obvious reasons.

---
 arch/arm/mach-keystone/include/mach/psc_defs.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-keystone/include/mach/psc_defs.h +3 -3
index 70d22cf21787..2202946be5ea 100644
@@ -30,9 +30,9 @@
 #define BOOTBITMASK(x, y)     ((((((u32)1 << (((u32)x) - ((u32)y) + (u32)1)) - \
 				  (u32)1)) << ((u32)y)))
 
-#define BOOT_READ_BITFIELD(z, x, y)    (((u32)z) & BOOTBITMASK(x, y)) >> (y)
-#define BOOT_SET_BITFIELD(z, f, x, y)  (((u32)z) & ~BOOTBITMASK(x, y)) | \
-					 ((((u32)f) << (y)) & BOOTBITMASK(x, y))
+#define BOOT_READ_BITFIELD(z, x, y)    ((((u32)z) & BOOTBITMASK(x, y)) >> (y))
+#define BOOT_SET_BITFIELD(z, f, x, y)  ((((u32)z) & ~BOOTBITMASK(x, y)) | \
+					((((u32)f) << (y)) & BOOTBITMASK(x, y)))
 
 /* PDCTL */
 #define PSC_REG_PDCTL_SET_NEXT(x, y)        BOOT_SET_BITFIELD((x), (y), 0, 0)
Signature · 1 line
2.1.4
author maintainer
#3 lore raw

PATCH 3/4 ARM: keystone: psc: introduce function to hold and release module in reset.

In reply to Nishanth Menon

These are useful for modules that need to be held in reset and are enabled for data to be loaded on to them. Typically these are microcontrollers or other processing entities in the system.

---
 arch/arm/mach-keystone/include/mach/psc_defs.h |   4 +
 arch/arm/mach-keystone/psc.c                   | 104 +++++++++++++++++++++++++
 2 files changed, 108 insertions(+)
arch/arm/mach-keystone/include/mach/psc_defs.h +4 -0
index 2202946be5ea..6e6e7fd433a1 100644
@@ -56,6 +56,8 @@
 #define PSC_REG_MDSTAT_GET_STATUS(x)        BOOT_READ_BITFIELD((x), 5, 0)
 #define PSC_REG_MDSTAT_GET_LRSTZ(x)         BOOT_READ_BITFIELD((x), 8, 8)
 #define PSC_REG_MDSTAT_GET_LRSTDONE(x)      BOOT_READ_BITFIELD((x), 9, 9)
+#define PSC_REG_MDSTAT_GET_MRSTZ(x)         BOOT_READ_BITFIELD((x), 10, 10)
+#define PSC_REG_MDSTAT_GET_MRSTDONE(x)      BOOT_READ_BITFIELD((x), 11, 11)
 
 /* PDCTL states */
 #define PSC_REG_VAL_PDCTL_NEXT_ON           1
@@ -86,5 +88,7 @@ u32 psc_get_domain_num(u32 mod_num);
 int psc_enable_module(u32 mod_num);
 int psc_disable_module(u32 mod_num);
 int psc_disable_domain(u32 domain_num);
+int psc_module_keep_in_reset_enabled(u32 mod_num, bool gate_clocks);
+int psc_module_release_from_reset(u32 mod_num);
 
 #endif /* _PSC_DEFS_H_ */
arch/arm/mach-keystone/psc.c +104 -0

107 lines not on this page · raw message

Signature · 1 line
2.1.4
author maintainer
#4 lore raw

PATCH 4/4 remoteproc: Add support for TI power processor

In reply to Nishanth Menon

Many TI System on Chip (SoC) solutions do have a dedicated microcontroller for doing power management functionality. These include the AM335x, AM437x, Keystone K2G SoCs. The functionality provided by these microcontrollers and the communication mechanisms vary very widely. However, we are able to consolidate some basic functionality to be generic enough starting with K2G SoC family. Introduce a basic remote proc driver to support these microcontrollers. In fact, on SoCs starting with K2G, basic power management functions are primarily accessible for the High Level Operating Systems(HLOS) via these microcontroller solutions.

Hence, having these started at a bootloader level is pretty much mandatory.

NOTE: DT conversion is not done at this point in time.

---

Depends on http://lists.denx.de/pipermail/u-boot/2015-August/225085.html

 drivers/remoteproc/Kconfig                         |   9 ++
 drivers/remoteproc/Makefile                        |   1 +
 drivers/remoteproc/ti_power_proc.c                 | 131 +++++++++++++++++++++
 .../dm/platform_data/remoteproc_ti_power_proc.h    |  15 +++
 4 files changed, 156 insertions(+)
 create mode 100644 drivers/remoteproc/ti_power_proc.c
 create mode 100644 include/dm/platform_data/remoteproc_ti_power_proc.h
drivers/remoteproc/Kconfig +9 -0
index 61cc506d6baa..75fb9340f47d 100644
@@ -21,4 +21,13 @@ config DM_TESTPROC_SANDBOX
 	help
 	  Say 'y' here to add support for test processor which does dummy
 	  operations for sandbox platform.
+
+config DM_POWER_PROC_TI
+	bool "Support for TI Power processor"
+	select DM_REMOTEPROC
+	depends on DM
+	depends on ARCH_KEYSTONE
+	help
+	  Say 'y' here to add support for TI power processors such as those
+	  found on certain TI keystone and OMAP generation SoCs
 endmenu
drivers/remoteproc/Makefile +1 -0
index 57c04d0e024a..ea79f193cb02 100644
@@ -8,3 +8,4 @@ obj-$(CONFIG_DM_REMOTEPROC) += rproc-uclass.o
 
 # Remote proc drivers - Please keep this list alphabetically sorted.
 obj-$(CONFIG_DM_TESTPROC_SANDBOX) += sandbox_testproc.o
+obj-$(CONFIG_DM_POWER_PROC_TI) += ti_power_proc.o
drivers/remoteproc/ti_power_proc.c new file +131 -0

131 lines not on this page · raw message

include/dm/platform_data/remoteproc_ti_power_proc.h new file +15 -0
new file mode 100644
index 000000000000..c09243b4b713
@@ -0,0 +1,15 @@
+/*
+ * (C) Copyright 2015
+ * Texas Instruments Incorporated - http://www.ti.com/
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __REMOTEPROC_POWER_PROC_TI_H__
+#define __REMOTEPROC_POWER_PROC_TI_H__
+
+struct ti_powerproc_platdata {
+	ulong slave_base;
+	u32 module;
+};
+
+#endif /* __REMOTEPROC_POWER_PROC_TI_H__ */
Signature · 1 line
2.1.4