Skip to contentSkip to conversation

drivers/sandbox: Introduce a simplified remoteproc framework

PATCH New Nishanth Menon 3 participants 16 messages Sep 17, 2015 – Oct 22, 2015 Remote processor (remoteproc)

lore
Share & tools
lore
#0 lore raw

v3 cover drivers/sandbox: Introduce a simplified remoteproc framework

Many System on Chip(SoC) solutions are complex with multiple processors on the same die dedicated to either general purpose of specialized functions. Many examples do exist in today's SoCs from various vendors. Typical examples are micro controllers such as an ARM M3/M0 doing a offload of specific function such as event integration or power management or controlling camera etc.

Traditionally, the responsibility of loading up such a processor with a firmware and communication has been with a High Level Operating System(HLOS) such as Linux. However, there exists classes of products where Linux would need to expect services from such a processor or the delay of Linux and operating system being able to load up such a firmware is unacceptable.

The intent here is to introduce a simplified remoteproc framework which can then be used to provide basic services to these remote processors.

Special thanks to Simon in helping cleaning up the series to a much more better implementation.

The series is based on:
master fa43ce842c30 Merge git://git.denx.de/u-boot-fdt

Changes since V2:
- Minor comment updates from V2
- Review and tested tag picked up from V2

V2: http://marc.info/?l=u-boot&m=144073487701030&w=2
V1: http://lists.denx.de/pipermail/u-boot/2015-August/225085.html

Test Log: http://pastebin.ubuntu.com/12432507/

Nishanth Menon (4):
drivers: Introduce a simplified remoteproc framework
remoteproc: Introduce a sandbox dummy driver
sandbox: Introduce dummy remoteproc nodes
test: Add basic tests for remoteproc

 arch/sandbox/dts/test.dts                          |  13 +
 common/Kconfig                                     |   5 +
 common/Makefile                                    |   1 +
 common/cmd_remoteproc.c                            | 281 ++++++++++++++
 configs/sandbox_defconfig                          |   2 +
 doc/device-tree-bindings/remoteproc/remoteproc.txt |  14 +
 doc/driver-model/remoteproc-framework.txt          | 168 +++++++++
 drivers/Kconfig                                    |   2 +
 drivers/Makefile                                   |   1 +
 drivers/remoteproc/Kconfig                         |  24 ++
 drivers/remoteproc/Makefile                        |  10 +
 drivers/remoteproc/rproc-uclass.c                  | 417 +++++++++++++++++++++
 drivers/remoteproc/sandbox_testproc.c              | 336 +++++++++++++++++
 include/dm/uclass-id.h                             |   1 +
 include/remoteproc.h                               | 162 ++++++++
 test/dm/Makefile                                   |   1 +
 test/dm/remoteproc.c                               |  67 ++++
 17 files changed, 1505 insertions(+)
 create mode 100644 common/cmd_remoteproc.c
 create mode 100644 doc/device-tree-bindings/remoteproc/remoteproc.txt
 create mode 100644 doc/driver-model/remoteproc-framework.txt
 create mode 100644 drivers/remoteproc/Kconfig
 create mode 100644 drivers/remoteproc/Makefile
 create mode 100644 drivers/remoteproc/rproc-uclass.c
 create mode 100644 drivers/remoteproc/sandbox_testproc.c
 create mode 100644 include/remoteproc.h
 create mode 100644 test/dm/remoteproc.c
Signature · 1 line
2.1.4
#1 lore raw

PATCH v3 1/4 drivers: Introduce a simplified remoteproc framework

Many System on Chip(SoC) solutions are complex with multiple processors on the same die dedicated to either general purpose of specialized functions. Many examples do exist in today's SoCs from various vendors. Typical examples are micro controllers such as an ARM M3/M0 doing a offload of specific function such as event integration or power management or controlling camera etc.

Traditionally, the responsibility of loading up such a processor with a firmware and communication has been with a High Level Operating System(HLOS) such as Linux. However, there exists classes of products where Linux would need to expect services from such a processor or the delay of Linux and operating system being able to load up such a firmware is unacceptable.

To address these needs, we need some minimal capability to load such a system and ensure it is started prior to an Operating System(Linux or any other) is started up.

NOTE: This is NOT meant to be a solve-all solution, instead, it tries to address certain class of SoCs and products that need such a solution.

A very simple model is introduced here as part of the initial support that supports microcontrollers with internal memory (no MMU, no execution from external memory, or specific image format needs). This basic framework can then (hopefully) be extensible to other complex SoC processor support as need be.

---

Changes since V2:(review comment updates)
- Changes to warning for "non-dt" users - lowercase, remove XXX
- Move function documentation to header for exported functions
- Picked up Simon's reviewed tag from V2

V2: https://patchwork.ozlabs.org/patch/511748/
V1: https://patchwork.ozlabs.org/patch/510198/

 common/Kconfig                                     |   5 +
 common/Makefile                                    |   1 +
 common/cmd_remoteproc.c                            | 281 ++++++++++++++
 doc/device-tree-bindings/remoteproc/remoteproc.txt |  14 +
 doc/driver-model/remoteproc-framework.txt          | 168 +++++++++
 drivers/Kconfig                                    |   2 +
 drivers/Makefile                                   |   1 +
 drivers/remoteproc/Kconfig                         |  15 +
 drivers/remoteproc/Makefile                        |   7 +
 drivers/remoteproc/rproc-uclass.c                  | 417 +++++++++++++++++++++
 include/dm/uclass-id.h                             |   1 +
 include/remoteproc.h                               | 162 ++++++++
 12 files changed, 1074 insertions(+)
 create mode 100644 common/cmd_remoteproc.c
 create mode 100644 doc/device-tree-bindings/remoteproc/remoteproc.txt
 create mode 100644 doc/driver-model/remoteproc-framework.txt
 create mode 100644 drivers/remoteproc/Kconfig
 create mode 100644 drivers/remoteproc/Makefile
 create mode 100644 drivers/remoteproc/rproc-uclass.c
 create mode 100644 include/remoteproc.h
common/Kconfig +5 -0
index 2c42b8e4d034..da68f494b626 100644
@@ -344,6 +344,11 @@ config CMD_FPGA
 	help
 	  FPGA support.
 
+config CMD_REMOTEPROC
+	bool "remoteproc"
+	depends on REMOTEPROC
+	help
+	  Support for Remote Processor control
 endmenu
 
 
common/Makefile +1 -0
index 556fb0759292..6a5d33a90bd0 100644
@@ -154,6 +154,7 @@ obj-$(CONFIG_CMD_PXE) += cmd_pxe.o
 obj-$(CONFIG_CMD_READ) += cmd_read.o
 obj-$(CONFIG_CMD_REGINFO) += cmd_reginfo.o
 obj-$(CONFIG_CMD_REISER) += cmd_reiser.o
+obj-$(CONFIG_CMD_REMOTEPROC) += cmd_remoteproc.o
 obj-$(CONFIG_SANDBOX) += cmd_host.o
 obj-$(CONFIG_CMD_SATA) += cmd_sata.o
 obj-$(CONFIG_CMD_SF) += cmd_sf.o
common/cmd_remoteproc.c new file +281 -0

281 lines not on this page · raw message

doc/device-tree-bindings/remoteproc/remoteproc.txt new file +14 -0
new file mode 100644
index 000000000000..031764f515a3
@@ -0,0 +1,14 @@
+Remote Processor uclass
+
+Binding:
+
+Remoteproc devices shall have compatible corresponding to thier
+drivers. However the following generic properties will be supported
+
+Optional Properties:
+- remoteproc-name: a string, used if provided to describe the processor.
+  This must be unique in an operational system.
+- remoteproc-internal-memory-mapped: a bool, indicates that the remote
+  processor has internal memory that it uses to execute code and store
+  data. Such a device is not expected to have a MMU. If no type property
+  is provided, the device is assumed to map to such a model.
doc/driver-model/remoteproc-framework.txt new file +168 -0

168 lines not on this page · raw message

drivers/Kconfig +2 -0
index 63c92c594a7d..c02f3231e07f 100644
@@ -46,6 +46,8 @@ source "drivers/power/Kconfig"
 
 source "drivers/ram/Kconfig"
 
+source "drivers/remoteproc/Kconfig"
+
 source "drivers/rtc/Kconfig"
 
 source "drivers/serial/Kconfig"
drivers/Makefile +1 -0
index 9d0a5959a8ef..1a30ad1d147b 100644
@@ -59,6 +59,7 @@ obj-y += pwm/
 obj-y += input/
 # SOC specific infrastructure drivers.
 obj-y += soc/
+obj-$(CONFIG_REMOTEPROC) += remoteproc/
 obj-y += thermal/
 
 endif
drivers/remoteproc/Kconfig new file +15 -0
new file mode 100644
index 000000000000..444682624ace
@@ -0,0 +1,15 @@
+#
+# (C) Copyright 2015
+# Texas Instruments Incorporated - http://www.ti.com/
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+menu "Remote Processor drivers"
+
+# REMOTEPROC gets selected by drivers as needed
+# All users should depend on DM
+config REMOTEPROC
+	bool
+	depends on DM
+
+endmenu
drivers/remoteproc/Makefile new file +7 -0
new file mode 100644
index 000000000000..14c27929b63e
@@ -0,0 +1,7 @@
+#
+# (C) Copyright 2015
+# Texas Instruments Incorporated - http://www.ti.com/
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-$(CONFIG_REMOTEPROC) += rproc-uclass.o
drivers/remoteproc/rproc-uclass.c new file +417 -0

417 lines not on this page · raw message

include/dm/uclass-id.h +1 -0
index 1eeec7496435..da4149987248 100644
@@ -49,6 +49,7 @@ enum uclass_id {
 	UCLASS_PMIC,		/* PMIC I/O device */
 	UCLASS_REGULATOR,	/* Regulator device */
 	UCLASS_RESET,		/* Reset device */
+	UCLASS_REMOTEPROC,	/* Remote Processor device */
 	UCLASS_RTC,		/* Real time clock device */
 	UCLASS_SERIAL,		/* Serial UART */
 	UCLASS_SPI,		/* SPI bus */
include/remoteproc.h new file +162 -0

162 lines not on this page · raw message

Signature · 1 line
2.1.4
#2 lore raw

PATCH v3 1/4 drivers: Introduce a simplified remoteproc framework

Quoted 52 lines · Nishanth Menon

Many System on Chip(SoC) solutions are complex with multiple processors on the same die dedicated to either general purpose of specialized functions. Many examples do exist in today's SoCs from various vendors. Typical examples are micro controllers such as an ARM M3/M0 doing a offload of specific function such as event integration or power management or controlling camera etc.

Traditionally, the responsibility of loading up such a processor with a firmware and communication has been with a High Level Operating System(HLOS) such as Linux. However, there exists classes of products where Linux would need to expect services from such a processor or the delay of Linux and operating system being able to load up such a firmware is unacceptable.

To address these needs, we need some minimal capability to load such a system and ensure it is started prior to an Operating System(Linux or any other) is started up.

NOTE: This is NOT meant to be a solve-all solution, instead, it tries to address certain class of SoCs and products that need such a solution.

A very simple model is introduced here as part of the initial support that supports microcontrollers with internal memory (no MMU, no execution from external memory, or specific image format needs). This basic framework can then (hopefully) be extensible to other complex SoC processor support as need be.

---

Changes since V2:(review comment updates)
- Changes to warning for "non-dt" users - lowercase, remove XXX
- Move function documentation to header for exported functions
- Picked up Simon's reviewed tag from V2

V2: https://patchwork.ozlabs.org/patch/511748/
V1: https://patchwork.ozlabs.org/patch/510198/

 common/Kconfig                                     |   5 +
 common/Makefile                                    |   1 +
 common/cmd_remoteproc.c                            | 281 ++++++++++++++
 doc/device-tree-bindings/remoteproc/remoteproc.txt |  14 +
 doc/driver-model/remoteproc-framework.txt          | 168 +++++++++
 drivers/Kconfig                                    |   2 +
 drivers/Makefile                                   |   1 +
 drivers/remoteproc/Kconfig                         |  15 +
 drivers/remoteproc/Makefile                        |   7 +
 drivers/remoteproc/rproc-uclass.c                  | 417 +++++++++++++++++++++
 include/dm/uclass-id.h                             |   1 +
 include/remoteproc.h                               | 162 ++++++++
Quoted 10 lines
 12 files changed, 1074 insertions(+)
 create mode 100644 common/cmd_remoteproc.c
 create mode 100644 doc/device-tree-bindings/remoteproc/remoteproc.txt
 create mode 100644 doc/driver-model/remoteproc-framework.txt
 create mode 100644 drivers/remoteproc/Kconfig
 create mode 100644 drivers/remoteproc/Makefile
 create mode 100644 drivers/remoteproc/rproc-uclass.c
 create mode 100644 include/remoteproc.h
#4 lore raw

PATCH v3 1/4 drivers: Introduce a simplified remoteproc framework

In reply to Nishanth Menon
Quoted 27 lines · Nishanth Menon

Many System on Chip(SoC) solutions are complex with multiple processors on the same die dedicated to either general purpose of specialized functions. Many examples do exist in today's SoCs from various vendors. Typical examples are micro controllers such as an ARM M3/M0 doing a offload of specific function such as event integration or power management or controlling camera etc.

Traditionally, the responsibility of loading up such a processor with a firmware and communication has been with a High Level Operating System(HLOS) such as Linux. However, there exists classes of products where Linux would need to expect services from such a processor or the delay of Linux and operating system being able to load up such a firmware is unacceptable.

To address these needs, we need some minimal capability to load such a system and ensure it is started prior to an Operating System(Linux or any other) is started up.

NOTE: This is NOT meant to be a solve-all solution, instead, it tries to address certain class of SoCs and products that need such a solution.

A very simple model is introduced here as part of the initial support that supports microcontrollers with internal memory (no MMU, no execution from external memory, or specific image format needs). This basic framework can then (hopefully) be extensible to other complex SoC processor support as need be.

Quoted 3 lines

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151022/098133c6/attachment.sig>
#5 lore raw

PATCH v3 2/4 remoteproc: Introduce a sandbox dummy driver

In reply to Nishanth Menon

Introduce a dummy driver for sandbox that allows us to verify basic functionality. This is not meant to do anything functional - but is more or less meant as a framework plumbing debug helper.

The sandbox remoteproc driver maintains absolutey no states and is a simple driver which just is filled with empty hooks. Idea being to give an approximate idea to implement own remoteproc driver using this as a template.

---

Changes Since V2:
- Fixed TODO message for removal of non-DT pdata entry
- Picked up Simon's reviewed-by from V2

V2: https://patchwork.ozlabs.org/patch/511747/
V1: https://patchwork.ozlabs.org/patch/510197/

 drivers/remoteproc/Kconfig            |   9 +
 drivers/remoteproc/Makefile           |   3 +
 drivers/remoteproc/sandbox_testproc.c | 336 ++++++++++++++++++++++++++++++++++
 3 files changed, 348 insertions(+)
 create mode 100644 drivers/remoteproc/sandbox_testproc.c
drivers/remoteproc/Kconfig +9 -0
index 444682624ace..437224b5491f 100644
@@ -12,4 +12,13 @@ config REMOTEPROC
 	bool
 	depends on DM
 
+# Please keep the configuration alphabetically sorted.
+config REMOTEPROC_SANDBOX
+	bool "Support for Test processor for Sandbox"
+	select REMOTEPROC
+	depends on DM
+	depends on SANDBOX
+	help
+	  Say 'y' here to add support for test processor which does dummy
+	  operations for sandbox platform.
 endmenu
drivers/remoteproc/Makefile +3 -0
index 14c27929b63e..720aa6e64701 100644
@@ -5,3 +5,6 @@
 #
 
 obj-$(CONFIG_REMOTEPROC) += rproc-uclass.o
+
+# Remote proc drivers - Please keep this list alphabetically sorted.
+obj-$(CONFIG_REMOTEPROC_SANDBOX) += sandbox_testproc.o
drivers/remoteproc/sandbox_testproc.c new file +336 -0

336 lines not on this page · raw message

Signature · 1 line
2.1.4
#6 lore raw

PATCH v3 2/4 remoteproc: Introduce a sandbox dummy driver

Quoted 18 lines · Nishanth Menon

Introduce a dummy driver for sandbox that allows us to verify basic functionality. This is not meant to do anything functional - but is more or less meant as a framework plumbing debug helper.

The sandbox remoteproc driver maintains absolutey no states and is a simple driver which just is filled with empty hooks. Idea being to give an approximate idea to implement own remoteproc driver using this as a template.

---

Changes Since V2:
- Fixed TODO message for removal of non-DT pdata entry
- Picked up Simon's reviewed-by from V2

Quoted 8 lines

V2: https://patchwork.ozlabs.org/patch/511747/
V1: https://patchwork.ozlabs.org/patch/510197/

 drivers/remoteproc/Kconfig            |   9 +
 drivers/remoteproc/Makefile           |   3 +
 drivers/remoteproc/sandbox_testproc.c | 336 ++++++++++++++++++++++++++++++++++
 3 files changed, 348 insertions(+)
 create mode 100644 drivers/remoteproc/sandbox_testproc.c
Quoted 2 lines
#8 lore raw

PATCH v3 2/4 remoteproc: Introduce a sandbox dummy driver

In reply to Nishanth Menon
Quoted 4 lines · Nishanth Menon

Introduce a dummy driver for sandbox that allows us to verify basic functionality. This is not meant to do anything functional - but is more or less meant as a framework plumbing debug helper.

Quoted 8 lines

The sandbox remoteproc driver maintains absolutey no states and is a simple driver which just is filled with empty hooks. Idea being to give an approximate idea to implement own remoteproc driver using this as a template.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151022/fec9d500/attachment.sig>
#9 lore raw

PATCH v3 3/4 sandbox: Introduce dummy remoteproc nodes

In reply to Nishanth Menon

Introduce dummy devices for sandbox remoteproc device and enable it by default

---

Changes since V2:
- Picked up Simon's reviewed-by from V2.

V2: https://patchwork.ozlabs.org/patch/511750/
V1: https://patchwork.ozlabs.org/patch/510196/

 arch/sandbox/dts/test.dts | 13 +++++++++++++
 configs/sandbox_defconfig |  2 ++
 2 files changed, 15 insertions(+)
arch/sandbox/dts/test.dts +13 -0
index f5217fb87778..730de8a57ffc 100644
@@ -13,6 +13,8 @@
 		eth5 = &eth_5;
 		i2c0 = "/i2c at 0";
 		pci0 = &pci;
+		remoteproc1 = &rproc_1;
+		remoteproc2 = &rproc_2;
 		rtc0 = &rtc_0;
 		rtc1 = &rtc_1;
 		spi0 = "/spi at 0";
@@ -233,6 +235,17 @@
 		compatible = "sandbox,reset";
 	};
 
+	rproc_1: rproc at 1 {
+		compatible = "sandbox,test-processor";
+		remoteproc-name = "remoteproc-test-dev1";
+	};
+
+	rproc_2: rproc at 2 {
+		compatible = "sandbox,test-processor";
+		internal-memory-mapped;
+		remoteproc-name = "remoteproc-test-dev2";
+	};
+
 	spi at 0 {
 		#address-cells = <1>;
 		#size-cells = <0>;
configs/sandbox_defconfig +2 -0
index e9e1597f9acf..b9ba04acebe5 100644
@@ -61,3 +61,5 @@ CONFIG_UNIT_TEST=y
 CONFIG_UT_TIME=y
 CONFIG_UT_DM=y
 CONFIG_UT_ENV=y
+CONFIG_REMOTEPROC_SANDBOX=y
+CONFIG_CMD_REMOTEPROC=y
Signature · 1 line
2.1.4
#10 lore raw

PATCH v3 3/4 sandbox: Introduce dummy remoteproc nodes

Quoted 11 lines · Nishanth Menon

Introduce dummy devices for sandbox remoteproc device and enable it by default

---

Changes since V2:
- Picked up Simon's reviewed-by from V2.

Quoted 6 lines

V2: https://patchwork.ozlabs.org/patch/511750/
V1: https://patchwork.ozlabs.org/patch/510196/

 arch/sandbox/dts/test.dts | 13 +++++++++++++
 configs/sandbox_defconfig |  2 ++
 2 files changed, 15 insertions(+)
#12 lore raw

PATCH v3 3/4 sandbox: Introduce dummy remoteproc nodes

In reply to Nishanth Menon
Quoted 6 lines · Nishanth Menon

Introduce dummy devices for sandbox remoteproc device and enable it by default

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151022/7c11b285/attachment.sig>
#13 lore raw

PATCH v3 4/4 test: Add basic tests for remoteproc

In reply to Nishanth Menon

Use the sandbox environment for the basic tests.

---

Changes since V1:
- Comment cleanup (dropped '..')
- Picked up Simon's Tested and Reviewed tags from V2

V2: https://patchwork.ozlabs.org/patch/511749/
V1: did not exist

 test/dm/Makefile     |  1 +
 test/dm/remoteproc.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+)
 create mode 100644 test/dm/remoteproc.c
test/dm/Makefile +1 -0
index eda964318593..7b3626cb3294 100644
@@ -24,6 +24,7 @@ obj-$(CONFIG_DM_MMC) += mmc.o
 obj-$(CONFIG_DM_PCI) += pci.o
 obj-$(CONFIG_RAM) += ram.o
 obj-y += regmap.o
+obj-$(CONFIG_REMOTEPROC) += remoteproc.o
 obj-$(CONFIG_RESET) += reset.o
 obj-$(CONFIG_DM_RTC) += rtc.o
 obj-$(CONFIG_DM_SPI_FLASH) += sf.o
test/dm/remoteproc.c new file +67 -0

67 lines not on this page · raw message

Signature · 1 line
2.1.4
#14 lore raw

PATCH v3 4/4 test: Add basic tests for remoteproc

Quoted 12 lines · Nishanth Menon

Use the sandbox environment for the basic tests.

---

Changes since V1:
- Comment cleanup (dropped '..')
- Picked up Simon's Tested and Reviewed tags from V2

Quoted 7 lines

V2: https://patchwork.ozlabs.org/patch/511749/
V1: did not exist

 test/dm/Makefile     |  1 +
 test/dm/remoteproc.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+)
 create mode 100644 test/dm/remoteproc.c
Quoted 2 lines
#15 lore raw

PATCH v3 4/4 test: Add basic tests for remoteproc

In reply to Nishanth Menon
Quoted 6 lines · Nishanth Menon

Use the sandbox environment for the basic tests.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151022/56fc9a5b/attachment.sig>