Skip to contentSkip to conversation

remoteproc: Introduce wkup_m3_rproc driver

RFC PATCH In review Dave Gerlach 2 participants 12 messages Nov 26, 2014 – Dec 12, 2014

Subsystems (8)
lore
Share & tools
lore
#0 lore raw

cover remoteproc: Introduce wkup_m3_rproc driver

Hi,
This patch series adds a wkup_m3_rproc driver for TI AM335x SoCs. This family of SoCs contains an ARM Cortex M3 coprocessor that is responsible for low-level power tasks that cannot be handled by the main ARM Cortex A8 so firmware running from the CM3 can be used instead. This driver handles loading of the firmware and reset of the CM3 once it is booted.

This patch was split off from v4 of the am335x suspend series, found here [1]. Because of this it is a dependency for v5 of that series. I have pushed a branch based on v3.18-rc6 containing all dependencies here [2] for am33xx suspend for a higher level view of the entire series of patch sets.

This patch set depends on series "couple of generic remoteproc enhancements" by Suman Anna found here [3] (Included already in previously mentioned branch)

Regards,
Dave

[1] http://www.spinics.net/lists/linux-omap/msg109331.html
[2] https://github.com/dgerlach/linux-pm/tree/rfc-pm-am335x-v3.18-rc6
[3] http://www.spinics.net/lists/arm-kernel/msg362961.html

Dave Gerlach (3):
ARM: OMAP2+: Use pdata-quirks for wkup_m3 deassert_hardreset
Documentation: dt: add ti,am3353-wkup-m3 bindings
remoteproc: wkup_m3: Add wkup_m3 remote proc driver

 .../bindings/remoteproc/wkup_m3_rproc.txt          |  32 ++++
 arch/arm/mach-omap2/pdata-quirks.c                 |  13 ++
 drivers/remoteproc/Kconfig                         |  12 ++
 drivers/remoteproc/Makefile                        |   1 +
 drivers/remoteproc/wkup_m3_rproc.c                 | 175 +++++++++++++++++++++
 include/linux/platform_data/wkup_m3.h              |  23 +++
 6 files changed, 256 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/remoteproc/wkup_m3_rproc.txt
 create mode 100644 drivers/remoteproc/wkup_m3_rproc.c
 create mode 100644 include/linux/platform_data/wkup_m3.h
Signature · 1 line
2.1.0
#1 lore raw

RFC PATCH 1/3 ARM: OMAP2+: Use pdata-quirks for wkup_m3 deassert_hardreset

Use pdata-quirks to provide platform data required for reset of the wkup_m3 during boot.

---
 arch/arm/mach-omap2/pdata-quirks.c    | 13 +++++++++++++
 include/linux/platform_data/wkup_m3.h | 23 +++++++++++++++++++++++
 2 files changed, 36 insertions(+)
 create mode 100644 include/linux/platform_data/wkup_m3.h
arch/arm/mach-omap2/pdata-quirks.c +13 -0
index cec9d6c..1c0bcdb 100644
@@ -17,6 +17,7 @@
 
 #include <linux/platform_data/pinctrl-single.h>
 #include <linux/platform_data/iommu-omap.h>
+#include <linux/platform_data/wkup_m3.h>
 
 #include "am35xx.h"
 #include "common.h"
@@ -260,6 +261,14 @@ static void __init omap3_tao3530_legacy_init(void)
 }
 #endif /* CONFIG_ARCH_OMAP3 */
 
+#ifdef CONFIG_SOC_AM33XX
+static struct wkup_m3_platform_data wkup_m3_data = {
+	.reset_name = "wkup_m3",
+	.assert_reset = omap_device_assert_hardreset,
+	.deassert_reset = omap_device_deassert_hardreset,
+};
+#endif
+
 #ifdef CONFIG_ARCH_OMAP4
 static void __init omap4_sdp_legacy_init(void)
 {
@@ -355,6 +364,10 @@ struct of_dev_auxdata omap_auxdata_lookup[] __initdata = {
 	OF_DEV_AUXDATA("ti,am3517-emac", 0x5c000000, "davinci_emac.0",
 		       &am35xx_emac_pdata),
 #endif
+#ifdef CONFIG_SOC_AM33XX
+	OF_DEV_AUXDATA("ti,am3353-wkup-m3", 0x44d00000, "44d00000.wkup_m3",
+		       &wkup_m3_data),
+#endif
 #ifdef CONFIG_ARCH_OMAP4
 	OF_DEV_AUXDATA("ti,omap4-padconf", 0x4a100040, "4a100040.pinmux", &pcs_pdata),
 	OF_DEV_AUXDATA("ti,omap4-padconf", 0x4a31e040, "4a31e040.pinmux", &pcs_pdata),
include/linux/platform_data/wkup_m3.h new file +23 -0
new file mode 100644
index 0000000..6ee33d7
@@ -0,0 +1,23 @@
+/*
+ * omap wkup_m3: platform data
+ *
+ * Copyright (C) 2014 Texas Instruments, Inc.
+ *
+ * Dave Gerlach <[email protected]>
+ *
+ * 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.
+ */
+
+#ifndef _LINUX_PLATFORM_DATA_WKUP_M3_H
+#define _LINUX_PLATFORM_DATA_WKUP_M3_H
+
+struct wkup_m3_platform_data {
+	const char *reset_name;
+
+	int (*assert_reset)(struct platform_device *pdev, const char *name);
+	int (*deassert_reset)(struct platform_device *pdev, const char *name);
+};
+
+#endif /* _LINUX_PLATFORM_DATA_WKUP_M3_H */
Signature · 1 line
2.1.0
#2 lore raw

RFC PATCH 1/3 Documentation: dt: add ti,am3353-wkup-m3-ipc bindings

In reply to Dave Gerlach

Add the device tree bindings document for ti,am3353-wkup-m3-ipc which is used by the wkup_m3_ipc driver.

---
 .../devicetree/bindings/soc/ti/wkup_m3_ipc.txt     | 41 ++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt
Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt new file +41 -0
new file mode 100644
index 0000000..ceb6acf
@@ -0,0 +1,41 @@
+Wakeup M3 IPC Driver
+=====================
+
+TI AMx3 family of devices use a Cortex M3 co-processor to help with various
+low power tasks that cannot be controlled from the MPU like suspend/resume
+and certain deep C-states for CPU Idle. Once the wkup_m3_ipc driver uses the
+wkup_m3_rproc driver to boot the wkup_m3, it handles communication with the
+CM3 using IPC registers present in the SoC's control module and a mailbox.
+The wkup_m3_ipc exposes an API to allow the SoC PM code to execute specific
+PM tasks.
+
+Wkup M3 Device Node:
+====================
+A wkup_m3_ipc device node is used to represent a wakeup M3 IP instance within
+an SoC. The sub-mailboxes are represented as child node of this parent node.
+
+Required properties:
+--------------------
+- compatible:		Should be "ti,am3353-wkup-m3-ipc" for AM33xx SoCs
+- reg:			Contains the wkup_m3 register address ranges for
+			ipc-regs.
+- reg-names:		Name for ipc-regs given above
+- interrupts:		Contains the interrupt information for the wkup_m3
+			interrupt that signals the MPU.
+- ti,rproc:		Phandle to the wkup_m3 rproc node so the IPC driver
+			can boot it.
+- mboxes:		Phandles used by IPC framework to get correct mbox
+			channel for communication. Must point to appropriate
+			mbox_wkupm3 child node.
+
+Example:
+--------
+/* AM33xx */
+wkup_m3_ipc: wkup_m3_ipc at 44e11324 {
+	compatible = "ti,am3353-wkup-m3-ipc";
+	reg = <0x44e11324 0x0024>;
+	reg-names = "ipc_regs";
+	interrupts = <78>;
+	ti,rproc = <&wkup_m3>;
+	mboxes = <&mailbox &mbox_wkupm3>;
+};
Signature · 1 line
2.1.0
#3 lore raw

RFC PATCH 1/3 Documentation: dt: add ti,am3352-emif bindings

In reply to Dave Gerlach

Add the device tree bindings document for ti,am3352-emif which is used by the ti-emif-sram driver to provide low-level PM functionality.

---
 .../bindings/memory-controllers/ti/emif-sram.txt   | 31 ++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/memory-controllers/ti/emif-sram.txt
Documentation/devicetree/bindings/memory-controllers/ti/emif-sram.txt new file +31 -0
new file mode 100644
index 0000000..72d6db0
@@ -0,0 +1,31 @@
+EMIF SRAM Driver
+=====================
+
+TI AMx3 family of devices use a similar EMIF to other TI SoCs but have
+different PM requirements. Late suspend code runs from SRAM and requires
+save and restore of EMIF context and placing the SDRAM in and out of
+self-refresh. Because of this, the ti-emif-sram driver introduces
+relocatable PM function that can run from SRAM and place the EMIF in
+the proper state for low-power mode transition.
+
+EMIF Device Node:
+====================
+A emif node is used to represent an EMIF IP instance within an SoC. The node
+must contain a phandle to an sram node so the ti-emif-sram driver can allocate
+space within the sram and copy the relocatable PM functions.
+
+Required properties:
+--------------------
+- compatible:		Should be "ti,am3352-emif" for AM33xx SoCs
+- reg:			Contains the emif register address ranges.
+- sram:			Phandle for generic sram node for the driver
+			to use to copy PM functions to.
+
+Example:
+--------
+/* AM33xx */
+emif: emif at 4c000000 {
+	compatible = "ti,am3352-emif";
+	reg =	<0x4C000000 0x1000>;
+	sram = <&ocmcram>;
+};
Signature · 1 line
2.1.0
#4 lore raw

RFC PATCH 2/3 Documentation: dt: add ti,am3353-wkup-m3 bindings

In reply to Dave Gerlach

Add the device tree bindings document for ti,am3353-wkup-m3 which is used by the wkup_m3_rproc driver.

---
 .../bindings/remoteproc/wkup_m3_rproc.txt          | 32 ++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/remoteproc/wkup_m3_rproc.txt
Documentation/devicetree/bindings/remoteproc/wkup_m3_rproc.txt new file +32 -0
new file mode 100644
index 0000000..4d64a23
@@ -0,0 +1,32 @@
+Wakeup M3 Remote Proc Driver
+=====================
+
+TI AMx3 family of devices use a Cortex M3 co-processor to help with various
+low power tasks that cannot be controlled from the MPU. The CM3 requires
+a firmware binary to accomplish this. The wkup_m3 remoteproc driver handles
+the loading of the firmware and booting of the CM3.
+
+Wkup M3 Device Node:
+====================
+A wkup_m3 device node is used to represent a wakeup M3 IP instance within
+a SoC.
+
+Required properties:
+--------------------
+- compatible:		Should be "ti,am3353-wkup-m3" for AM33xx SoCs
+- reg:			Contains the wkup_m3 register address ranges for
+			umem and dmem.
+- ti,hwmods:		Name of the hwmod associated with the mailbox
+- ti,no-reset-on-init:	Reset is handled after fw has been loaded, not at
+			init of hwmod.
+
+Example:
+--------
+/* AM33xx */
+wkup_m3: wkup_m3 at 44d00000 {
+	compatible = "ti,am3353-wkup-m3";
+	reg = <0x44d00000 0x4000	/* M3 UMEM */
+	       0x44d80000 0x2000>;	/* M3 DMEM */
+	ti,hwmods = "wkup_m3";
+	ti,no-reset-on-init;
+};
Signature · 1 line
2.1.0
#5 lore raw

RFC PATCH 2/3 soc: ti: Add wkup_m3_ipc driver

In reply to Dave Gerlach

Introduce a wkup_m3_ipc driver to handle communication between the MPU and Cortex M3 wkup_m3 present on am335x.

This driver is responsible for actually booting the wkup_m3_rproc and also handling all IPC which is done using the IPC registers in the control module, a mailbox, and a separate interrupt back from the wkup_m3. A small API is exposed for executing specific power commands, which include configuring for low power mode, request a transition to a low power mode, and status info on a previous transition.

---
 drivers/soc/ti/Kconfig       |  11 +
 drivers/soc/ti/Makefile      |   1 +
 drivers/soc/ti/wkup_m3_ipc.c | 503 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/wkup_m3_ipc.h  |  33 +++
 4 files changed, 548 insertions(+)
 create mode 100644 drivers/soc/ti/wkup_m3_ipc.c
 create mode 100644 include/linux/wkup_m3_ipc.h
drivers/soc/ti/Kconfig +11 -0
index 7266b21..61cda85 100644
@@ -28,4 +28,15 @@ config KEYSTONE_NAVIGATOR_DMA
 
 	  If unsure, say N.
 
+config WKUP_M3_IPC
+	bool "TI AM33XX Wkup-M3 IPC Driver"
+	depends on WKUP_M3_RPROC
+	select MAILBOX
+	select OMAP2PLUS_MBOX
+	help
+	  TI AM33XX has a Cortex M3 to handle low power transitions. This IPC
+	  driver provides the necessary API to communicate and use the wkup m3
+	  for PM features like Suspend/Resume and boots the wkup_m3 using
+	  wkup_m3_rproc driver.
+
 endif # SOC_TI
drivers/soc/ti/Makefile +1 -0
index 6bed611..b6b8c8b 100644
@@ -3,3 +3,4 @@
 #
 obj-$(CONFIG_KEYSTONE_NAVIGATOR_QMSS)	+= knav_qmss_queue.o knav_qmss_acc.o
 obj-$(CONFIG_KEYSTONE_NAVIGATOR_DMA)	+= knav_dma.o
+obj-$(CONFIG_WKUP_M3_IPC)		+= wkup_m3_ipc.o
drivers/soc/ti/wkup_m3_ipc.c new file +503 -0

503 lines not on this page · raw message

include/linux/wkup_m3_ipc.h new file +33 -0
new file mode 100644
index 0000000..a0c2722
@@ -0,0 +1,33 @@
+/*
+ * TI Wakeup M3 for AMx3 SoCs Power Management Routines
+ *
+ * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
+ * Dave Gerlach <[email protected]>
+ *
+ * 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 version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _LINUX_WKUP_M3_H
+#define _LINUX_WKUP_M3_H
+
+#ifdef CONFIG_WKUP_M3_IPC
+void wkup_m3_set_mem_type(int mem_type);
+void wkup_m3_set_resume_address(void *addr);
+int wkup_m3_prepare_low_power(int state);
+int wkup_m3_finish_low_power(void);
+int wkup_m3_request_pm_status(void);
+#else
+static inline void wkup_m3_set_mem_type(int mem_type) { }
+static inline void wkup_m3_set_resume_address(void *addr) { }
+static inline int wkup_m3_prepare_low_power(int state) { return -1; }
+static inline int wkup_m3_finish_low_power(void) { return -1; }
+static inline int wkup_m3_request_pm_status(void) { return -1; }
+#endif /* CONFIG_WKUP_M3_IPC */
+#endif /* _LINUX_WKUP_M3_H */
Signature · 1 line
2.1.0
#6 lore raw

Re: [RFC PATCH 2/3] soc: ti: Add wkup_m3_ipc driver

Quoted 8 lines · On Wednesday 26 November 2014 15:38:09 Dave Gerlach wrote:
drivers/soc/ti/wkup_m3_ipc.c new file +7 -0
+
+static const struct wkup_m3_wakeup_src wakeups[] = {
+       {.irq_nr = 35,  .src = "USB0_PHY"},
+       {.irq_nr = 36,  .src = "USB1_PHY"},
+       {.irq_nr = 40,  .src = "I2C0"},
+       {.irq_nr = 41,  .src = "RTC Timer"},
+       {.irq_nr = 42,  .src = "RTC Alarm"},

drivers/soc/ti/wkup_m3_ipc.c line 95

Quoted 10 lines
drivers/soc/ti/wkup_m3_ipc.c new file +10 -0
+       {.irq_nr = 43,  .src = "Timer0"},
+       {.irq_nr = 44,  .src = "Timer1"},
+       {.irq_nr = 45,  .src = "UART"},
+       {.irq_nr = 46,  .src = "GPIO0"},
+       {.irq_nr = 48,  .src = "MPU_WAKE"},
+       {.irq_nr = 49,  .src = "WDT0"},
+       {.irq_nr = 50,  .src = "WDT1"},
+       {.irq_nr = 51,  .src = "ADC_TSC"},
+       {.irq_nr = 0,   .src = "Unknown"},
+};

This seems awfully specific to some SoC version, and not aware of IRQ domains. It also seems to be only used in a dev_dbg statement, so I guess you could just kill this off entirely.

Quoted 5 lines
drivers/soc/ti/wkup_m3_ipc.c new file +5 -0
+static struct rproc *wkup_m3_get_rproc(struct device *dev)
+{
+       struct device_node *node;
+       struct rproc *rp;
+

drivers/soc/ti/wkup_m3_ipc.c line 388

Quoted 10 lines
drivers/soc/ti/wkup_m3_ipc.c new file +10 -0
+       node = of_parse_phandle(dev->of_node, "ti,rproc", 0);
+       if (!node)
+               return NULL;
+
+       dev = bus_find_device(&platform_bus_type, NULL, node, match);
+       if (!dev)
+               return NULL;
+
+       rp = dev_get_drvdata(dev);
+       return rp;

This is wrong on a number of levels. I suspect what you really want is an interface exported from drivers/remoteproc that looks up a 'struct rproc' and performs the necessary reference counting.

That one can just use of_find_node_by_phandle() to get to a device_node and use that to look up the rproc device in a linked list it maintains.

Arnd

#7 lore raw

Re: [RFC PATCH 2/3] soc: ti: Add wkup_m3_ipc driver

Quoted 15 lines · Arnd Bergmann
Quoted 14 lines · On Wednesday 26 November 2014 15:38:09 Dave Gerlach wrote:
drivers/soc/ti/wkup_m3_ipc.c new file +14 -0
+
+static const struct wkup_m3_wakeup_src wakeups[] = {
+       {.irq_nr = 35,  .src = "USB0_PHY"},
+       {.irq_nr = 36,  .src = "USB1_PHY"},
+       {.irq_nr = 40,  .src = "I2C0"},
+       {.irq_nr = 41,  .src = "RTC Timer"},
+       {.irq_nr = 42,  .src = "RTC Alarm"},
+       {.irq_nr = 43,  .src = "Timer0"},
+       {.irq_nr = 44,  .src = "Timer1"},
+       {.irq_nr = 45,  .src = "UART"},
+       {.irq_nr = 46,  .src = "GPIO0"},
+       {.irq_nr = 48,  .src = "MPU_WAKE"},
+       {.irq_nr = 49,  .src = "WDT0"},
+       {.irq_nr = 50,  .src = "WDT1"},
Quoted 8 lines

drivers/soc/ti/wkup_m3_ipc.c line 95

Quoted 4 lines
drivers/soc/ti/wkup_m3_ipc.c new file +3 -0
+       {.irq_nr = 51,  .src = "ADC_TSC"},
+       {.irq_nr = 0,   .src = "Unknown"},
+};

This seems awfully specific to some SoC version, and not aware of IRQ domains. It also seems to be only used in a dev_dbg statement, so I guess you could just kill this off entirely.

This is determined by the firmware in use on the remote processor and works for both am335x and am437x. However it is not required information and I'd be fine with taking it out.

Quoted 21 lines
Quoted 6 lines
drivers/soc/ti/wkup_m3_ipc.c new file +5 -0
+static struct rproc *wkup_m3_get_rproc(struct device *dev)
+{
+       struct device_node *node;
+       struct rproc *rp;
+

drivers/soc/ti/wkup_m3_ipc.c line 388

Quoted 10 lines
drivers/soc/ti/wkup_m3_ipc.c new file +10 -0
+       node = of_parse_phandle(dev->of_node, "ti,rproc", 0);
+       if (!node)
+               return NULL;
+
+       dev = bus_find_device(&platform_bus_type, NULL, node, match);
+       if (!dev)
+               return NULL;
+
+       rp = dev_get_drvdata(dev);
+       return rp;

This is wrong on a number of levels. I suspect what you really want is an interface exported from drivers/remoteproc that looks up a 'struct rproc' and performs the necessary reference counting.

Quoted 3 lines

That one can just use of_find_node_by_phandle() to get to a device_node and use that to look up the rproc device in a linked list it maintains.

Added Ohad as I should have cc'd him in the first place..

Yes I agree that it's not the best solution. There used to be an rproc_get/rproc_put api but that was removed, I'll look into adding rproc_get_by_phandle into drivers/remoteproc as that would be ideal for this situation and a cleaner way of doing it. Thanks for the comments.

Regards,
Dave

Quoted 3 lines

Arnd

#8 lore raw

RFC PATCH 2/3 memory: ti-emif-sram: introduce relocatable suspend/resume handlers

In reply to Dave Gerlach

Certain SoCs like Texas Instruments AM335x and AM437x require parts of the EMIF PM code to run late in the suspend sequence from SRAM, such as saving and restoring the EMIF context and placing the memory into self-refresh.

One requirement for these SoC's to suspend and enter it's lowest power mode, called DeepSleep0, is that the PER power domain must be shut off. Because the EMIF (DDR Controller) resides within this power domain, it will lose context during a suspend operation, so we must save it to restore once we resume. However, we cannot execute this code from external memory, as it is not available at this point, so the code must be executed late in the suspend path from SRAM.

This patch introduces a ti-emif-sram driver that includes several functions written in ARM ASM that are relocatable so the PM SRAM code can use them. It can export a table containing the absolute addresses of the available PM functions so that other SRAM code can branch to them. This code is required for suspend/resume on AM335x and AM437x to work.

---
 drivers/memory/Kconfig           |  10 ++
 drivers/memory/Makefile          |   3 +
 drivers/memory/emif.h            |   8 ++
 drivers/memory/ti-emif-sram-pm.S | 233 +++++++++++++++++++++++++++++++++++++++
 drivers/memory/ti-emif-sram.c    | 195 ++++++++++++++++++++++++++++++++
 include/linux/ti-emif-sram.h     |  26 +++++
 6 files changed, 475 insertions(+)
 create mode 100644 drivers/memory/ti-emif-sram-pm.S
 create mode 100644 drivers/memory/ti-emif-sram.c
 create mode 100644 include/linux/ti-emif-sram.h
drivers/memory/Kconfig +10 -0
index 6d91c27..02b778e 100644
@@ -41,6 +41,16 @@ config TI_EMIF
 	  parameters and other settings during frequency, voltage and
 	  temperature changes
 
+config TI_EMIF_SRAM
+	bool "Texas Instruments EMIF SRAM driver"
+	depends on SOC_AM33XX
+	help
+	  This driver is for the EMIF module available on Texas Instruments
+	  AM33XX SoCs and is required for PM. Certain parts of the EMIF PM
+	  code must run from on-chip SRAM late in the suspend sequence so
+	  this driver provides several relocatable PM functions for the SoC
+	  PM code to use.
+
 config MVEBU_DEVBUS
 	bool "Marvell EBU Device Bus Controller"
 	default y
drivers/memory/Makefile +3 -0
index c32d319..42888c2 100644
@@ -13,3 +13,6 @@ obj-$(CONFIG_FSL_IFC)		+= fsl_ifc.o
 obj-$(CONFIG_MVEBU_DEVBUS)	+= mvebu-devbus.o
 obj-$(CONFIG_TEGRA20_MC)	+= tegra20-mc.o
 obj-$(CONFIG_TEGRA30_MC)	+= tegra30-mc.o
+obj-$(CONFIG_TI_EMIF_SRAM)	+= ti-emif-sram.o ti-emif-sram-pm.o
+
+AFLAGS_ti-emif-sram-pm.o	:=-Wa,-march=armv7-a
drivers/memory/emif.h +8 -0
index bfe08ba..8e86eb2 100644
@@ -585,5 +585,13 @@ struct emif_regs {
 	u32 ext_phy_ctrl_3_shdw;
 	u32 ext_phy_ctrl_4_shdw;
 };
+
+struct ti_emif_pm_functions;
+
+extern unsigned int ti_emif_sram;
+extern unsigned int ti_emif_sram_sz;
+extern void __iomem *ti_emif_base_addr_virt;
+extern void __iomem *ti_emif_base_addr_phys;
+extern struct ti_emif_pm_functions ti_emif_pm;
 #endif /* __ASSEMBLY__ */
 #endif /* __EMIF_H */
drivers/memory/ti-emif-sram-pm.S new file +233 -0

233 lines not on this page · raw message

drivers/memory/ti-emif-sram.c new file +195 -0

195 lines not on this page · raw message

include/linux/ti-emif-sram.h new file +26 -0
new file mode 100644
index 0000000..e0ec7fa
@@ -0,0 +1,26 @@
+/*
+ * TI AM33XX EMIF Routines
+ *
+ * Copyright (C) 2014 Texas Instruments Inc.
+ *          Dave Gerlach <[email protected]>
+ *
+ * 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 version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+#ifndef __LINUX_TI_EMIF_H
+#define __LINUX_TI_EMIF_H
+
+#ifdef CONFIG_TI_EMIF_SRAM
+int ti_emif_copy_pm_function_table(void *dst);
+int ti_emif_get_mem_type(void);
+#else
+static inline int ti_emif_copy_pm_function_table(void *dst) { return -ENODEV; }
+static inline int ti_emif_get_mem_type(void) { return -ENODEV; }
+#endif /* CONFIG_TI_EMIF_SRAM */
+#endif /* __LINUX_TI_EMIF_H */
Signature · 1 line
2.1.0
#9 lore raw

RFC PATCH 3/3 remoteproc: wkup_m3: Add wkup_m3 remote proc driver

In reply to Dave Gerlach

Add a remoteproc driver to load the firmware for and boot the wkup_m3 present on am33xx. The wkup_m3 is an integrated Cortex M3 that allows the SoC to enter the lowest possible power state by taking control from the MPU after it has gone into its own low power state and shutting off any additional peripherals.

The driver expects a resource table to be present in the wkup_m3 firmware to define the required memory resources needed by the wkup_m3, at least the data memory so that the firmware can be copied to the proper place for execution.

---
 drivers/remoteproc/Kconfig         |  12 +++
 drivers/remoteproc/Makefile        |   1 +
 drivers/remoteproc/wkup_m3_rproc.c | 175 +++++++++++++++++++++++++++++++++++++
 3 files changed, 188 insertions(+)
 create mode 100644 drivers/remoteproc/wkup_m3_rproc.c
drivers/remoteproc/Kconfig +12 -0
index 5e343ba..7fbdb53 100644
@@ -41,6 +41,18 @@ config STE_MODEM_RPROC
 	  This can be either built-in or a loadable module.
 	  If unsure say N.
 
+config WKUP_M3_RPROC
+	bool "AM33xx wkup-m3 remoteproc support"
+	depends on SOC_AM33XX
+	select REMOTEPROC
+	help
+	  Say y here to support AM33xx wkup-m3.
+
+	  Required for Suspend-to-ram and CPUIdle on AM33xx. Allows for
+	  loading of firmware of CM3 PM coprocessor that is present
+	  on AM33xx family of SoCs
+	  If unsure say N.
+
 config DA8XX_REMOTEPROC
 	tristate "DA8xx/OMAP-L13x remoteproc support"
 	depends on ARCH_DAVINCI_DA8XX
drivers/remoteproc/Makefile +1 -0
index ac2ff75..81b04d1 100644
@@ -9,4 +9,5 @@ remoteproc-y				+= remoteproc_virtio.o
 remoteproc-y				+= remoteproc_elf_loader.o
 obj-$(CONFIG_OMAP_REMOTEPROC)		+= omap_remoteproc.o
 obj-$(CONFIG_STE_MODEM_RPROC)	 	+= ste_modem_rproc.o
+obj-$(CONFIG_WKUP_M3_RPROC)		+= wkup_m3_rproc.o
 obj-$(CONFIG_DA8XX_REMOTEPROC)		+= da8xx_remoteproc.o
drivers/remoteproc/wkup_m3_rproc.c new file +175 -0

175 lines not on this page · raw message

Signature · 1 line
2.1.0
#10 lore raw

RFC PATCH 3/3 ARM: dts: am33xx: Add wkup_m3_ipc node

In reply to Dave Gerlach

Add wkup_m3_ipc node for wkup_m3_ipc driver.

---
 arch/arm/boot/dts/am33xx.dtsi | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm/boot/dts/am33xx.dtsi +9 -0
index 41659df..b86d8c0 100644
@@ -848,6 +848,15 @@
 			reg = <0x48310000 0x2000>;
 			interrupts = <111>;
 		};
+
+		wkup_m3_ipc: wkup_m3_ipc at 44e11324 {
+			compatible = "ti,am3353-wkup-m3-ipc";
+			reg = <0x44e11324 0x0024>;
+			reg-names = "ipc_regs";
+			interrupts = <78>;
+			ti,rproc = <&wkup_m3>;
+			mboxes = <&mailbox &mbox_wkupm3>;
+		};
 	};
 };
 
Signature · 1 line
2.1.0
#11 lore raw

RFC PATCH 3/3 ARM: dts: am33xx: Add emif node

In reply to Dave Gerlach

Add node for Texas Instruments AM335x EMIF to make use of the ti-emif-sram driver.

---
 arch/arm/boot/dts/am33xx.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/boot/dts/am33xx.dtsi +6 -0
index b86d8c0..b432499 100644
@@ -153,6 +153,12 @@
 			#dma-cells = <1>;
 		};
 
+		emif: emif at 4c000000 {
+			compatible = "ti,am3352-emif";
+			reg =	<0x4C000000 0x1000>;
+			sram = <&ocmcram>;
+		};
+
 		gpio0: gpio at 44e07000 {
 			compatible = "ti,omap4-gpio";
 			ti,hwmods = "gpio1";
Signature · 1 line
2.1.0