Skip to contentSkip to conversation

Add STM32 Cortex-M4 remoteproc driver

PATCH Superseded Fabien Dessenne 4 participants 21 messages May 31, 2019 – Jul 22, 2019

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

v3 cover Add STM32 Cortex-M4 remoteproc driver

This patchset adds an STM32 remoteproc driver.

Patch 1 adds the xxx_translate_dma_address() API which is the equivalent of the xxx_translate_address() relying on the "dma-ranges" property instead of the "ranges" property.

Patch 2 fixes and completes function headers of remoteproc.h.

Patch 3 & 4 add the support of the ELF image loading (the current implementation supports only binary image loading).

Patch 5 is about the driver, and patches 6 & 7 are about MAINTAINERS and configs update.

Changes since v2:
-Moved helpers to rproc-elf-loader.c
-Rename *elf* functions in *elf32*, preparing future support for elf64 Changes since v1:
-Added tests for rproc_elf*() and *_translate_dma_address() -Changed memory translation ops from da_to_pa() to device_to_virt() : the name
is updated and the translation now converts to virtual instead of physical.
-Merged rproc_elf_is_valid() in rproc_elf_sanity_check()
-Used explicit error values in rproc_elf_sanity_check()
-Added and fix comments in various headers
-Misc minor changes

Fabien Dessenne (7):
dm: core: Introduce xxx_translate_dma_address()
remoteproc: fix function headers
remoteproc: add device_to_virt ops
remoteproc: add elf file load support
remoteproc: Introduce STM32 Cortex-M4 remoteproc driver
MAINTAINERS: Add stm32 remoteproc driver
configs: stm32mp15: enable stm32 remoteproc

 MAINTAINERS                           |   1 +
 arch/sandbox/dts/test.dts             |   4 +
 common/fdt_support.c                  |   6 +
 configs/stm32mp15_basic_defconfig     |   2 +
 configs/stm32mp15_trusted_defconfig   |   2 +
 drivers/core/of_addr.c                |   4 +
 drivers/core/ofnode.c                 |   8 ++
 drivers/core/read.c                   |   5 +
 drivers/remoteproc/Kconfig            |  10 ++
 drivers/remoteproc/Makefile           |   3 +-
 drivers/remoteproc/rproc-elf-loader.c | 106 ++++++++++++++
 drivers/remoteproc/sandbox_testproc.c |  19 +++
 drivers/remoteproc/stm32_copro.c      | 257 ++++++++++++++++++++++++++++++++++
 include/dm/of_addr.h                  |  18 +++
 include/dm/ofnode.h                   |  16 ++-
 include/dm/read.h                     |  20 ++-
 include/fdt_support.h                 |  24 ++++
 include/remoteproc.h                  | 146 +++++++++++++------
 test/dm/remoteproc.c                  | 122 ++++++++++++++++
 test/dm/test-fdt.c                    |  12 ++
 20 files changed, 743 insertions(+), 42 deletions(-)
 create mode 100644 drivers/remoteproc/rproc-elf-loader.c
 create mode 100644 drivers/remoteproc/stm32_copro.c
Signature · 1 line
2.7.4
#1 lore raw

PATCH v3 1/7 dm: core: Introduce xxx_translate_dma_address()

Add the following functions to translate DMA address to CPU address:
- dev_translate_dma_address()
- ofnode_translate_dma_address()
- of_translate_dma_address()
- fdt_translate_dma_address()
These functions work the same way as xxx_translate_address(), with the difference that the translation relies on the "dma-ranges" property instead of the "ranges" property.

Add related test. Test report:
=> ut dm fdt_translation
Test: dm_test_fdt_translation: test-fdt.c
Test: dm_test_fdt_translation: test-fdt.c (flat tree)
Failures: 0

---
 arch/sandbox/dts/test.dts |  4 ++++
 common/fdt_support.c      |  6 ++++++
 drivers/core/of_addr.c    |  4 ++++
 drivers/core/ofnode.c     |  8 ++++++++
 drivers/core/read.c       |  5 +++++
 include/dm/of_addr.h      | 18 ++++++++++++++++++
 include/dm/ofnode.h       | 16 +++++++++++++++-
 include/dm/read.h         | 20 +++++++++++++++++++-
 include/fdt_support.h     | 24 ++++++++++++++++++++++++
 test/dm/test-fdt.c        | 12 ++++++++++++
 10 files changed, 115 insertions(+), 2 deletions(-)
arch/sandbox/dts/test.dts +4 -0
index 8b2d645..a37e10c 100644
@@ -732,6 +732,10 @@
 			  3 0x300 0xB000 0x1000
 			 >;
 
+		dma-ranges = <0 0x000 0x10000000 0x1000
+			      1 0x100 0x20000000 0x1000
+			     >;
+
 		dev at 0,0 {
 			compatible = "denx,u-boot-fdt-dummy";
 			reg = <0 0x0 0x1000>;
common/fdt_support.c +6 -0
index 4e7cf6e..6ec0742 100644
@@ -1279,6 +1279,12 @@ u64 fdt_translate_address(const void *blob, int node_offset,
 	return __of_translate_address(blob, node_offset, in_addr, "ranges");
 }
 
+u64 fdt_translate_dma_address(const void *blob, int node_offset,
+			      const fdt32_t *in_addr)
+{
+	return __of_translate_address(blob, node_offset, in_addr, "dma-ranges");
+}
+
 /**
  * fdt_node_offset_by_compat_reg: Find a node that matches compatiable and
  * who's reg property matches a physical cpu address
drivers/core/of_addr.c +4 -0
index 1bfaaee..4e256d9 100644
@@ -318,6 +318,10 @@ u64 of_translate_address(const struct device_node *dev, const __be32 *in_addr)
 	return __of_translate_address(dev, in_addr, "ranges");
 }
 
+u64 of_translate_dma_address(const struct device_node *dev, const __be32 *in_addr)
+{
+	return __of_translate_address(dev, in_addr, "dma-ranges");
+}
 
 static int __of_address_to_resource(const struct device_node *dev,
 		const __be32 *addrp, u64 size, unsigned int flags,
drivers/core/ofnode.c +8 -0
index cc0c031..e68a735 100644
@@ -763,6 +763,14 @@ u64 ofnode_translate_address(ofnode node, const fdt32_t *in_addr)
 		return fdt_translate_address(gd->fdt_blob, ofnode_to_offset(node), in_addr);
 }
 
+u64 ofnode_translate_dma_address(ofnode node, const fdt32_t *in_addr)
+{
+	if (ofnode_is_np(node))
+		return of_translate_dma_address(ofnode_to_np(node), in_addr);
+	else
+		return fdt_translate_dma_address(gd->fdt_blob, ofnode_to_offset(node), in_addr);
+}
+
 int ofnode_device_is_compatible(ofnode node, const char *compat)
 {
 	if (ofnode_is_np(node))
drivers/core/read.c +5 -0
index 6bda077..1a044b0 100644
@@ -265,6 +265,11 @@ u64 dev_translate_address(struct udevice *dev, const fdt32_t *in_addr)
 	return ofnode_translate_address(dev_ofnode(dev), in_addr);
 }
 
+u64 dev_translate_dma_address(struct udevice *dev, const fdt32_t *in_addr)
+{
+	return ofnode_translate_dma_address(dev_ofnode(dev), in_addr);
+}
+
 int dev_read_alias_highest_id(const char *stem)
 {
 	if (of_live_active())
include/dm/of_addr.h +18 -0
index 12b1a99..3fa1ffc 100644
@@ -27,6 +27,24 @@
 u64 of_translate_address(const struct device_node *no, const __be32 *in_addr);
 
 /**
+ * of_translate_dma_address() - translate a device-tree DMA address to a CPU
+ *				address
+ *
+ * Translate a DMA address from the device-tree into a CPU physical address,
+ * this walks up the tree and applies the various bus mappings on the way.
+ *
+ * Note: We consider that crossing any level with #size-cells == 0 to mean
+ * that translation is impossible (that is we are not dealing with a value
+ * that can be mapped to a cpu physical address). This is not really specified
+ * that way, but this is traditionally the way IBM at least do things
+ *
+ * @np: node to check
+ * @in_addr: pointer to input DMA address
+ * @return translated DMA address or OF_BAD_ADDR on error
+ */
+u64 of_translate_dma_address(const struct device_node *no, const __be32 *in_addr);
+
+/**
  * of_get_address() - obtain an address from a node
  *
  * Extract an address from a node, returns the region size and the address
include/dm/ofnode.h +15 -1
index d206ee2..07a3f93 100644
@@ -751,7 +751,7 @@ ofnode ofnode_by_prop_value(ofnode from, const char *propname,
 	     node = ofnode_next_subnode(node))
 
 /**
- * ofnode_translate_address() - Tranlate a device-tree address
+ * ofnode_translate_address() - Translate a device-tree address
  *
  * Translate an address from the device-tree into a CPU physical address. This
  * function walks up the tree and applies the various bus mappings along the
@@ -765,6 +765,20 @@ ofnode ofnode_by_prop_value(ofnode from, const char *propname,
 u64 ofnode_translate_address(ofnode node, const fdt32_t *in_addr);
 
 /**
+ * ofnode_translate_dma_address() - Translate a device-tree DMA address
+ *
+ * Translate a DMA address from the device-tree into a CPU physical address.
+ * This function walks up the tree and applies the various bus mappings along
+ * the way.
+ *
+ * @ofnode: Device tree node giving the context in which to translate the
+ *          DMA address
+ * @in_addr: pointer to the DMA address to translate
+ * @return the translated DMA address; OF_BAD_ADDR on error
+ */
+u64 ofnode_translate_dma_address(ofnode node, const fdt32_t *in_addr);
+
+/**
  * ofnode_device_is_compatible() - check if the node is compatible with compat
  *
  * This allows to check whether the node is comaptible with the compat.
include/dm/read.h +19 -1
index 60b727c..62d4be6 100644
@@ -499,7 +499,7 @@ int dev_read_resource_byname(struct udevice *dev, const char *name,
 			     struct resource *res);
 
 /**
- * dev_translate_address() - Tranlate a device-tree address
+ * dev_translate_address() - Translate a device-tree address
  *
  * Translate an address from the device-tree into a CPU physical address.  This
  * function walks up the tree and applies the various bus mappings along the
@@ -512,6 +512,19 @@ int dev_read_resource_byname(struct udevice *dev, const char *name,
 u64 dev_translate_address(struct udevice *dev, const fdt32_t *in_addr);
 
 /**
+ * dev_translate_dma_address() - Translate a device-tree DMA address
+ *
+ * Translate a DMA address from the device-tree into a CPU physical address.
+ * This function walks up the tree and applies the various bus mappings along
+ * the way.
+ *
+ * @dev: device giving the context in which to translate the DMA address
+ * @in_addr: pointer to the DMA address to translate
+ * @return the translated DMA address; OF_BAD_ADDR on error
+ */
+u64 dev_translate_dma_address(struct udevice *dev, const fdt32_t *in_addr);
+
+/**
  * dev_read_alias_highest_id - Get highest alias id for the given stem
  * @stem:	Alias stem to be examined
  *
@@ -751,6 +764,11 @@ static inline u64 dev_translate_address(struct udevice *dev, const fdt32_t *in_a
 	return ofnode_translate_address(dev_ofnode(dev), in_addr);
 }
 
+static inline u64 dev_translate_dma_address(struct udevice *dev, const fdt32_t *in_addr)
+{
+	return ofnode_translate_dma_address(dev_ofnode(dev), in_addr);
+}
+
 static inline int dev_read_alias_highest_id(const char *stem)
 {
 	return fdtdec_get_alias_highest_id(gd->fdt_blob, stem);
include/fdt_support.h +24 -0
index 27fe564..cefb2b2 100644
@@ -218,8 +218,32 @@ static inline void fdt_fixup_mtdparts(void *fdt,
 #endif
 
 void fdt_del_node_and_alias(void *blob, const char *alias);
+
+/**
+ * Translate an address from the DT into a CPU physical address
+ *
+ * The translation relies on the "ranges" property.
+ *
+ * @param blob		Pointer to device tree blob
+ * @param node_offset	Node DT offset
+ * @param in_addr	Pointer to the address to translate
+ * @return translated address or OF_BAD_ADDR on error
+ */
 u64 fdt_translate_address(const void *blob, int node_offset,
 			  const __be32 *in_addr);
+/**
+ * Translate a DMA address from the DT into a CPU physical address
+ *
+ * The translation relies on the "dma-ranges" property.
+ *
+ * @param blob		Pointer to device tree blob
+ * @param node_offset	Node DT offset
+ * @param in_addr	Pointer to the DMA address to translate
+ * @return translated DMA address or OF_BAD_ADDR on error
+ */
+u64 fdt_translate_dma_address(const void *blob, int node_offset,
+			      const __be32 *in_addr);
+
 int fdt_node_offset_by_compat_reg(void *blob, const char *compat,
 					phys_addr_t compat_off);
 int fdt_alloc_phandle(void *blob);
test/dm/test-fdt.c +12 -0
index be16c99..ad85916 100644
@@ -490,6 +490,7 @@ U_BOOT_DRIVER(fdt_dummy_drv) = {
 static int dm_test_fdt_translation(struct unit_test_state *uts)
 {
 	struct udevice *dev;
+	fdt32_t dma_addr[2];
 
 	/* Some simple translations */
 	ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev));
@@ -509,6 +510,17 @@ static int dm_test_fdt_translation(struct unit_test_state *uts)
 	ut_asserteq_str("dev at 42", dev->name);
 	ut_asserteq(0x42, dev_read_addr(dev));
 
+	/* dma address translation */
+	ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev));
+	dma_addr[0] = cpu_to_be32(0);
+	dma_addr[1] = cpu_to_be32(0);
+	ut_asserteq(0x10000000, dev_translate_dma_address(dev, dma_addr));
+
+	ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 1, true, &dev));
+	dma_addr[0] = cpu_to_be32(1);
+	dma_addr[1] = cpu_to_be32(0x100);
+	ut_asserteq(0x20000000, dev_translate_dma_address(dev, dma_addr));
+
 	return 0;
 }
 DM_TEST(dm_test_fdt_translation, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
Signature · 1 line
2.7.4
#2 lore raw

PATCH v3 1/7 dm: core: Introduce xxx_translate_dma_address()

Hi,

Quoted 19 lines

From: Fabien DESSENNE <[email protected]>
Sent: vendredi 31 mai 2019 15:12

Add the following functions to translate DMA address to CPU address:
- dev_translate_dma_address()
- ofnode_translate_dma_address()
- of_translate_dma_address()
- fdt_translate_dma_address()
These functions work the same way as xxx_translate_address(), with the difference that the translation relies on the "dma-ranges" property instead of the "ranges" property.

Add related test. Test report:
=> ut dm fdt_translation
Test: dm_test_fdt_translation: test-fdt.c
Test: dm_test_fdt_translation: test-fdt.c (flat tree)
Failures: 0

Quoted 13 lines
---
 arch/sandbox/dts/test.dts |  4 ++++
 common/fdt_support.c      |  6 ++++++
 drivers/core/of_addr.c    |  4 ++++
 drivers/core/ofnode.c     |  8 ++++++++
 drivers/core/read.c       |  5 +++++
 include/dm/of_addr.h      | 18 ++++++++++++++++++
 include/dm/ofnode.h       | 16 +++++++++++++++-
 include/dm/read.h         | 20 +++++++++++++++++++-
 include/fdt_support.h     | 24 ++++++++++++++++++++++++
 test/dm/test-fdt.c        | 12 ++++++++++++
 10 files changed, 115 insertions(+), 2 deletions(-)

Applied to u-boot-stm32/master, thanks!

Patrick

#3 lore raw

PATCH v3 2/7 remoteproc: fix function headers

In reply to Fabien Dessenne

Add full function comment headers.
Fix rproc_is_initialized() return value description.

---
 include/remoteproc.h | 104 +++++++++++++++++++++++++++++++++------------------
 1 file changed, 68 insertions(+), 36 deletions(-)
include/remoteproc.h +68 -36
index a59dba8..aa90a67 100644
@@ -45,32 +45,73 @@ struct dm_rproc_uclass_pdata {
 };
 
 /**
- * struct dm_rproc_ops - Operations that are provided by remote proc driver
- * @init:	Initialize the remoteproc device invoked after probe (optional)
- *		Return 0 on success, -ve error on fail
- * @load:	Load the remoteproc device using data provided(mandatory)
- *		This takes the following additional arguments.
- *			addr- Address of the binary image to be loaded
- *			size- Size of the binary image to be loaded
- *		Return 0 on success, -ve error on fail
- * @start:	Start the remoteproc device (mandatory)
- *		Return 0 on success, -ve error on fail
- * @stop:	Stop the remoteproc device (optional)
- *		Return 0 on success, -ve error on fail
- * @reset:	Reset the remote proc device (optional)
- *		Return 0 on success, -ve error on fail
- * @is_running:	Check if the remote processor is running(optional)
- *		Return 0 on success, 1 if not running, -ve on others errors
- * @ping:	Ping the remote device for basic communication check(optional)
- *		Return 0 on success, 1 if not responding, -ve on other errors
+ * struct dm_rproc_ops - Driver model remote proc operations.
+ *
+ * This defines the operations provided by remote proc driver.
  */
 struct dm_rproc_ops {
+	/**
+	 * init() - Initialize the remoteproc device (optional)
+	 *
+	 * This is called after the probe is completed allowing the remote
+	 * processor drivers to split up the initializations between probe and
+	 * init if needed.
+	 *
+	 * @dev:	Remote proc device
+	 * @return 0 if all ok, else appropriate error value.
+	 */
 	int (*init)(struct udevice *dev);
+
+	/**
+	 * load() - Load the remoteproc device using data provided (mandatory)
+	 *
+	 * Load the remoteproc device with an image, do not start the device.
+	 *
+	 * @dev:	Remote proc device
+	 * @addr:	Address of the image to be loaded
+	 * @size:	Size of the image to be loaded
+	 * @return 0 if all ok, else appropriate error value.
+	 */
 	int (*load)(struct udevice *dev, ulong addr, ulong size);
+
+	/**
+	 * start() - Start the remoteproc device (mandatory)
+	 *
+	 * @dev:	Remote proc device
+	 * @return 0 if all ok, else appropriate error value.
+	 */
 	int (*start)(struct udevice *dev);
+
+	/**
+	 * stop() - Stop the remoteproc device (optional)
+	 *
+	 * @dev:	Remote proc device
+	 * @return 0 if all ok, else appropriate error value.
+	 */
 	int (*stop)(struct udevice *dev);
+
+	/**
+	 * reset() - Reset the remoteproc device (optional)
+	 *
+	 * @dev:	Remote proc device
+	 * @return 0 if all ok, else appropriate error value.
+	 */
 	int (*reset)(struct udevice *dev);
+
+	/**
+	 * is_running() - Check if the remote processor is running (optional)
+	 *
+	 * @dev:	Remote proc device
+	 * @return 0 if running, 1 if not running, -ve on error.
+	 */
 	int (*is_running)(struct udevice *dev);
+
+	/**
+	 * ping() - Ping the remote device for basic communication (optional)
+	 *
+	 * @dev:	Remote proc device
+	 * @return 0 on success, 1 if not responding, -ve on other errors.
+	 */
 	int (*ping)(struct udevice *dev);
 };
 
@@ -80,23 +121,20 @@ struct dm_rproc_ops {
 #ifdef CONFIG_REMOTEPROC
 /**
  * rproc_init() - Initialize all bound remote proc devices
- *
- * Return: 0 if all ok, else appropriate error value.
+ * @return 0 if all ok, else appropriate error value.
  */
 int rproc_init(void);
 
 /**
  * rproc_dev_init() - Initialize a remote proc device based on id
  * @id:		id of the remote processor
- *
- * Return: 0 if all ok, else appropriate error value.
+ * @return 0 if all ok, else appropriate error value.
  */
 int rproc_dev_init(int id);
 
 /**
  * rproc_is_initialized() - check to see if remoteproc devices are initialized
- *
- * Return: 0 if all devices are initialized, else appropriate error value.
+ * @return true if all devices are initialized, false otherwise.
  */
 bool rproc_is_initialized(void);
 
@@ -105,55 +143,49 @@ bool rproc_is_initialized(void);
  * @id:		id of the remote processor
  * @addr:	address in memory where the binary image is located
  * @size:	size of the binary image
- *
- * Return: 0 if all ok, else appropriate error value.
+ * @return 0 if all ok, else appropriate error value.
  */
 int rproc_load(int id, ulong addr, ulong size);
 
 /**
  * rproc_start() - Start a remote processor
  * @id:		id of the remote processor
- *
- * Return: 0 if all ok, else appropriate error value.
+ * @return 0 if all ok, else appropriate error value.
  */
 int rproc_start(int id);
 
 /**
  * rproc_stop() - Stop a remote processor
  * @id:		id of the remote processor
- *
- * Return: 0 if all ok, else appropriate error value.
+ * @return 0 if all ok, else appropriate error value.
  */
 int rproc_stop(int id);
 
 /**
  * rproc_reset() - reset a remote processor
  * @id:		id of the remote processor
- *
- * Return: 0 if all ok, else appropriate error value.
+ * @return 0 if all ok, else appropriate error value.
  */
 int rproc_reset(int id);
 
 /**
  * rproc_ping() - ping a remote processor to check if it can communicate
  * @id:		id of the remote processor
+ * @return 0 if all ok, else appropriate error value.
  *
  * NOTE: this might need communication path available, which is not implemented
  * as part of remoteproc framework - hook on to appropriate bus architecture to
  * do the same
- *
- * Return: 0 if all ok, else appropriate error value.
  */
 int rproc_ping(int id);
 
 /**
  * rproc_is_running() - check to see if remote processor is running
  * @id:		id of the remote processor
+ * @return 0 if running, 1 if not running, -ve on error.
  *
  * NOTE: this may not involve actual communication capability of the remote
  * processor, but just ensures that it is out of reset and executing code.
- *
- * Return: 0 if all ok, else appropriate error value.
  */
 int rproc_is_running(int id);
 #else
Signature · 1 line
2.7.4
#4 lore raw

PATCH v3 2/7 remoteproc: fix function headers

Quoted 4 lines · Fabien Dessenne

Add full function comment headers.
Fix rproc_is_initialized() return value description.

Thanks and regards,
Lokesh

Quoted 190 lines
---
 include/remoteproc.h | 104 +++++++++++++++++++++++++++++++++------------------
 1 file changed, 68 insertions(+), 36 deletions(-)
include/remoteproc.h +68 -36
index a59dba8..aa90a67 100644
@@ -45,32 +45,73 @@ struct dm_rproc_uclass_pdata {
 };
 
 /**
- * struct dm_rproc_ops - Operations that are provided by remote proc driver
- * @init:	Initialize the remoteproc device invoked after probe (optional)
- *		Return 0 on success, -ve error on fail
- * @load:	Load the remoteproc device using data provided(mandatory)
- *		This takes the following additional arguments.
- *			addr- Address of the binary image to be loaded
- *			size- Size of the binary image to be loaded
- *		Return 0 on success, -ve error on fail
- * @start:	Start the remoteproc device (mandatory)
- *		Return 0 on success, -ve error on fail
- * @stop:	Stop the remoteproc device (optional)
- *		Return 0 on success, -ve error on fail
- * @reset:	Reset the remote proc device (optional)
- *		Return 0 on success, -ve error on fail
- * @is_running:	Check if the remote processor is running(optional)
- *		Return 0 on success, 1 if not running, -ve on others errors
- * @ping:	Ping the remote device for basic communication check(optional)
- *		Return 0 on success, 1 if not responding, -ve on other errors
+ * struct dm_rproc_ops - Driver model remote proc operations.
+ *
+ * This defines the operations provided by remote proc driver.
  */
 struct dm_rproc_ops {
+	/**
+	 * init() - Initialize the remoteproc device (optional)
+	 *
+	 * This is called after the probe is completed allowing the remote
+	 * processor drivers to split up the initializations between probe and
+	 * init if needed.
+	 *
+	 * @dev:	Remote proc device
+	 * @return 0 if all ok, else appropriate error value.
+	 */
 	int (*init)(struct udevice *dev);
+
+	/**
+	 * load() - Load the remoteproc device using data provided (mandatory)
+	 *
+	 * Load the remoteproc device with an image, do not start the device.
+	 *
+	 * @dev:	Remote proc device
+	 * @addr:	Address of the image to be loaded
+	 * @size:	Size of the image to be loaded
+	 * @return 0 if all ok, else appropriate error value.
+	 */
 	int (*load)(struct udevice *dev, ulong addr, ulong size);
+
+	/**
+	 * start() - Start the remoteproc device (mandatory)
+	 *
+	 * @dev:	Remote proc device
+	 * @return 0 if all ok, else appropriate error value.
+	 */
 	int (*start)(struct udevice *dev);
+
+	/**
+	 * stop() - Stop the remoteproc device (optional)
+	 *
+	 * @dev:	Remote proc device
+	 * @return 0 if all ok, else appropriate error value.
+	 */
 	int (*stop)(struct udevice *dev);
+
+	/**
+	 * reset() - Reset the remoteproc device (optional)
+	 *
+	 * @dev:	Remote proc device
+	 * @return 0 if all ok, else appropriate error value.
+	 */
 	int (*reset)(struct udevice *dev);
+
+	/**
+	 * is_running() - Check if the remote processor is running (optional)
+	 *
+	 * @dev:	Remote proc device
+	 * @return 0 if running, 1 if not running, -ve on error.
+	 */
 	int (*is_running)(struct udevice *dev);
+
+	/**
+	 * ping() - Ping the remote device for basic communication (optional)
+	 *
+	 * @dev:	Remote proc device
+	 * @return 0 on success, 1 if not responding, -ve on other errors.
+	 */
 	int (*ping)(struct udevice *dev);
 };
 
@@ -80,23 +121,20 @@ struct dm_rproc_ops {
 #ifdef CONFIG_REMOTEPROC
 /**
  * rproc_init() - Initialize all bound remote proc devices
- *
- * Return: 0 if all ok, else appropriate error value.
+ * @return 0 if all ok, else appropriate error value.
  */
 int rproc_init(void);
 
 /**
  * rproc_dev_init() - Initialize a remote proc device based on id
  * @id:		id of the remote processor
- *
- * Return: 0 if all ok, else appropriate error value.
+ * @return 0 if all ok, else appropriate error value.
  */
 int rproc_dev_init(int id);
 
 /**
  * rproc_is_initialized() - check to see if remoteproc devices are initialized
- *
- * Return: 0 if all devices are initialized, else appropriate error value.
+ * @return true if all devices are initialized, false otherwise.
  */
 bool rproc_is_initialized(void);
 
@@ -105,55 +143,49 @@ bool rproc_is_initialized(void);
  * @id:		id of the remote processor
  * @addr:	address in memory where the binary image is located
  * @size:	size of the binary image
- *
- * Return: 0 if all ok, else appropriate error value.
+ * @return 0 if all ok, else appropriate error value.
  */
 int rproc_load(int id, ulong addr, ulong size);
 
 /**
  * rproc_start() - Start a remote processor
  * @id:		id of the remote processor
- *
- * Return: 0 if all ok, else appropriate error value.
+ * @return 0 if all ok, else appropriate error value.
  */
 int rproc_start(int id);
 
 /**
  * rproc_stop() - Stop a remote processor
  * @id:		id of the remote processor
- *
- * Return: 0 if all ok, else appropriate error value.
+ * @return 0 if all ok, else appropriate error value.
  */
 int rproc_stop(int id);
 
 /**
  * rproc_reset() - reset a remote processor
  * @id:		id of the remote processor
- *
- * Return: 0 if all ok, else appropriate error value.
+ * @return 0 if all ok, else appropriate error value.
  */
 int rproc_reset(int id);
 
 /**
  * rproc_ping() - ping a remote processor to check if it can communicate
  * @id:		id of the remote processor
+ * @return 0 if all ok, else appropriate error value.
  *
  * NOTE: this might need communication path available, which is not implemented
  * as part of remoteproc framework - hook on to appropriate bus architecture to
  * do the same
- *
- * Return: 0 if all ok, else appropriate error value.
  */
 int rproc_ping(int id);
 
 /**
  * rproc_is_running() - check to see if remote processor is running
  * @id:		id of the remote processor
+ * @return 0 if running, 1 if not running, -ve on error.
  *
  * NOTE: this may not involve actual communication capability of the remote
  * processor, but just ensures that it is out of reset and executing code.
- *
- * Return: 0 if all ok, else appropriate error value.
  */
 int rproc_is_running(int id);
 #else
#5 lore raw

PATCH v3 2/7 remoteproc: fix function headers

In reply to Fabien Dessenne

Hi,

Quoted 12 lines

From: Fabien DESSENNE <[email protected]>
Sent: vendredi 31 mai 2019 15:12

Add full function comment headers.
Fix rproc_is_initialized() return value description.

---
 include/remoteproc.h | 104 +++++++++++++++++++++++++++++++++-------------
-----
 1 file changed, 68 insertions(+), 36 deletions(-)

Applied to u-boot-stm32/master, thanks!

Patrick

#6 lore raw

PATCH v3 3/7 remoteproc: add device_to_virt ops

In reply to Fabien Dessenne

Introduce the device_to_virt function to allow translation between device address (remote processor view) and virtual address (main processor view).

---
 include/remoteproc.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)
include/remoteproc.h +12 -0
index aa90a67..aef6ff2 100644
@@ -113,6 +113,18 @@ struct dm_rproc_ops {
 	 * @return 0 on success, 1 if not responding, -ve on other errors.
 	 */
 	int (*ping)(struct udevice *dev);
+
+	/**
+	 * device_to_virt() - Return translated virtual address (optional)
+	 *
+	 * Translate a device address (remote processor view) to virtual
+	 * address (main processor view).
+	 *
+	 * @dev:	Remote proc device
+	 * @da:		Device address
+	 * @return virtual address.
+	 */
+	void * (*device_to_virt)(struct udevice *dev, ulong da);
 };
 
 /* Accessor */
Signature · 1 line
2.7.4
#7 lore raw

PATCH v3 3/7 remoteproc: add device_to_virt ops

Quoted 6 lines · Fabien Dessenne

Introduce the device_to_virt function to allow translation between device address (remote processor view) and virtual address (main processor view).

Thanks and regards,
Lokesh

Quoted 28 lines
---
 include/remoteproc.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)
include/remoteproc.h +12 -0
index aa90a67..aef6ff2 100644
@@ -113,6 +113,18 @@ struct dm_rproc_ops {
 	 * @return 0 on success, 1 if not responding, -ve on other errors.
 	 */
 	int (*ping)(struct udevice *dev);
+
+	/**
+	 * device_to_virt() - Return translated virtual address (optional)
+	 *
+	 * Translate a device address (remote processor view) to virtual
+	 * address (main processor view).
+	 *
+	 * @dev:	Remote proc device
+	 * @da:		Device address
+	 * @return virtual address.
+	 */
+	void * (*device_to_virt)(struct udevice *dev, ulong da);
 };
 
 /* Accessor */
#8 lore raw

PATCH v3 3/7 remoteproc: add device_to_virt ops

In reply to Fabien Dessenne

Hi,

Quoted 12 lines

From: Fabien DESSENNE <[email protected]>
Sent: vendredi 31 mai 2019 15:12

Introduce the device_to_virt function to allow translation between device address (remote processor view) and virtual address (main processor view).

---
 include/remoteproc.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Applied to u-boot-stm32/master, thanks!

Patrick

#9 lore raw

PATCH v3 4/7 remoteproc: add elf file load support

In reply to Fabien Dessenne

The current implementation supports only binary file load. Add helpers to support ELF32 format (sanity check, and load). Note that since an ELF32 image is built for the remote processor, the load function uses the device_to_virt ops to translate the addresses. Implement a basic translation for sandbox_testproc.

Add related tests. Test result:
=> ut dm remoteproc_elf
Test: dm_test_remoteproc_elf: remoteproc.c
Test: dm_test_remoteproc_elf: remoteproc.c (flat tree)
Failures: 0

---
 drivers/remoteproc/Makefile           |   2 +-
 drivers/remoteproc/rproc-elf-loader.c | 106 +++++++++++++++++++++++++++++
 drivers/remoteproc/sandbox_testproc.c |  19 ++++++
 include/remoteproc.h                  |  30 ++++++++-
 test/dm/remoteproc.c                  | 122 ++++++++++++++++++++++++++++++++++
 5 files changed, 275 insertions(+), 4 deletions(-)
 create mode 100644 drivers/remoteproc/rproc-elf-loader.c
drivers/remoteproc/Makefile +1 -1
index 77eb708..7517947 100644
@@ -4,7 +4,7 @@
 # Texas Instruments Incorporated - http://www.ti.com/
 #
 
-obj-$(CONFIG_$(SPL_)REMOTEPROC) += rproc-uclass.o
+obj-$(CONFIG_$(SPL_)REMOTEPROC) += rproc-uclass.o rproc-elf-loader.o
 
 # Remote proc drivers - Please keep this list alphabetically sorted.
 obj-$(CONFIG_K3_SYSTEM_CONTROLLER) += k3_system_controller.o
drivers/remoteproc/rproc-elf-loader.c new file +106 -0

106 lines not on this page · raw message

drivers/remoteproc/sandbox_testproc.c +19 -0
index 51a67e6..5f35119 100644
@@ -8,6 +8,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <remoteproc.h>
+#include <asm/io.h>
 
 /**
  * enum sandbox_state - different device states
@@ -300,6 +301,23 @@ static int sandbox_testproc_ping(struct udevice *dev)
 	return ret;
 }
 
+#define SANDBOX_RPROC_DEV_TO_PHY_OFFSET	0x1000
+/**
+ * sandbox_testproc_device_to_virt() - Convert device address to virtual address
+ * @dev:	device to operate upon
+ * @da:		device address
+ * @return converted virtual address
+ */
+static void *sandbox_testproc_device_to_virt(struct udevice *dev, ulong da)
+{
+	u64 paddr;
+
+	/* Use a simple offset conversion */
+	paddr = da + SANDBOX_RPROC_DEV_TO_PHY_OFFSET;
+
+	return phys_to_virt(paddr);
+}
+
 static const struct dm_rproc_ops sandbox_testproc_ops = {
 	.init = sandbox_testproc_init,
 	.reset = sandbox_testproc_reset,
@@ -308,6 +326,7 @@ static const struct dm_rproc_ops sandbox_testproc_ops = {
 	.stop = sandbox_testproc_stop,
 	.is_running = sandbox_testproc_is_running,
 	.ping = sandbox_testproc_ping,
+	.device_to_virt = sandbox_testproc_device_to_virt,
 };
 
 static const struct udevice_id sandbox_ids[] = {
include/remoteproc.h +27 -3
index aef6ff2..c29c086 100644
@@ -151,10 +151,10 @@ int rproc_dev_init(int id);
 bool rproc_is_initialized(void);
 
 /**
- * rproc_load() - load binary to a remote processor
+ * rproc_load() - load binary or elf to a remote processor
  * @id:		id of the remote processor
- * @addr:	address in memory where the binary image is located
- * @size:	size of the binary image
+ * @addr:	address in memory where the image is located
+ * @size:	size of the image
  * @return 0 if all ok, else appropriate error value.
  */
 int rproc_load(int id, ulong addr, ulong size);
@@ -200,6 +200,26 @@ int rproc_ping(int id);
  * processor, but just ensures that it is out of reset and executing code.
  */
 int rproc_is_running(int id);
+
+/**
+ * rproc_elf32_sanity_check() - Verify if an image is a valid ELF32 one
+ *
+ * Check if a valid ELF32 image exists at the given memory location. Verify
+ * basic ELF32 format requirements like magic number and sections size.
+ *
+ * @addr:	address of the image to verify
+ * @size:	size of the image
+ * @return 0 if the image looks good, else appropriate error value.
+ */
+int rproc_elf32_sanity_check(ulong addr, ulong size);
+
+/**
+ * rproc_elf32_load_image() - load an ELF32 image
+ * @dev:	device loading the ELF32 image
+ * @addr:	valid ELF32 image address
+ * @return 0 if the image is successfully loaded, else appropriate error value.
+ */
+int rproc_elf32_load_image(struct udevice *dev, unsigned long addr);
 #else
 static inline int rproc_init(void) { return -ENOSYS; }
 static inline int rproc_dev_init(int id) { return -ENOSYS; }
@@ -210,6 +230,10 @@ static inline int rproc_stop(int id) { return -ENOSYS; }
 static inline int rproc_reset(int id) { return -ENOSYS; }
 static inline int rproc_ping(int id) { return -ENOSYS; }
 static inline int rproc_is_running(int id) { return -ENOSYS; }
+static inline int rproc_elf32_sanity_check(ulong addr,
+					   ulong size) { return -ENOSYS; }
+static inline int rproc_elf32_load_image(struct udevice *dev,
+					 unsigned long addr) { return -ENOSYS; }
 #endif
 
 #endif	/* _RPROC_H_ */
test/dm/remoteproc.c +122 -0

133 lines not on this page · raw message

Signature · 1 line
2.7.4
#10 lore raw

PATCH v3 4/7 remoteproc: add elf file load support

Quoted 15 lines · Fabien Dessenne

The current implementation supports only binary file load. Add helpers to support ELF32 format (sanity check, and load). Note that since an ELF32 image is built for the remote processor, the load function uses the device_to_virt ops to translate the addresses. Implement a basic translation for sandbox_testproc.

Add related tests. Test result:
=> ut dm remoteproc_elf
Test: dm_test_remoteproc_elf: remoteproc.c
Test: dm_test_remoteproc_elf: remoteproc.c (flat tree)
Failures: 0

---

[...snip...]

Quoted 55 lines
drivers/remoteproc/rproc-elf-loader.c new file +55 -0
+/* Basic function to verify ELF32 image format */
+int rproc_elf32_sanity_check(ulong addr, ulong size)
+{
+	Elf32_Ehdr *ehdr;
+	char class;
+
+	if (!addr) {
+		pr_debug("Invalid fw address?\n");
+		return -EFAULT;
+	}
+
+	if (size < sizeof(Elf32_Ehdr)) {
+		pr_debug("Image is too small\n");
+		return -ENOSPC;
+	}
+
+	ehdr = (Elf32_Ehdr *)addr;
+	class = ehdr->e_ident[EI_CLASS];
+
+	if (!IS_ELF(*ehdr) || ehdr->e_type != ET_EXEC || class != ELFCLASS32) {
+		pr_debug("Not an executable ELF32 image\n");
+		return -EPROTONOSUPPORT;
+	}
+
+	/* We assume the firmware has the same endianness as the host */
+# ifdef __LITTLE_ENDIAN
+	if (ehdr->e_ident[EI_DATA] != ELFDATA2LSB) {
+# else /* BIG ENDIAN */
+	if (ehdr->e_ident[EI_DATA] != ELFDATA2MSB) {
+# endif
+		pr_debug("Unsupported firmware endianness\n");
+		return -EILSEQ;
+	}
+
+	if (size < ehdr->e_shoff + sizeof(Elf32_Shdr)) {
+		pr_debug("Image is too small\n");
+		return -ENOSPC;
+	}
+
+	if (memcmp(ehdr->e_ident, ELFMAG, SELFMAG)) {
+		pr_debug("Image is corrupted (bad magic)\n");
+		return -EBADF;
+	}
+
+	if (ehdr->e_phnum == 0) {
+		pr_debug("No loadable segments\n");
+		return -ENOEXEC;
+	}
+
+	if (ehdr->e_phoff > size) {
+		pr_debug("Firmware size is too small\n");
+		return -ENOSPC;
+	}
+
+	return 0;

drivers/remoteproc/rproc-elf-loader.c line 74

Quoted 10 lines
drivers/remoteproc/rproc-elf-loader.c new file +10 -0
+}
+
+/* A very simple elf loader, assumes the image is valid */
+int rproc_elf32_load_image(struct udevice *dev, unsigned long addr)
+{
+	Elf32_Ehdr *ehdr; /* Elf header structure pointer */
+	Elf32_Phdr *phdr; /* Program header structure pointer */
+	const struct dm_rproc_ops *ops;
+	unsigned int i;
+

I would prefer to call rproc_elf32_sanity_check() here and reduce the burden on user. It's my preference and no strong objections.

Other than that:

Thanks and regards,
Lokesh

#11 lore raw

PATCH v3 4/7 remoteproc: add elf file load support

Hi Lokesh,

Thanks for the review.
Fabien is in vacation and I will integrate this serie in my next stm32 pull request.

Quoted 80 lines

From: Lokesh Vutla <[email protected]>
Sent: lundi 3 juin 2019 07:31

Quoted 15 lines · Fabien Dessenne

The current implementation supports only binary file load. Add helpers to support ELF32 format (sanity check, and load). Note that since an ELF32 image is built for the remote processor, the load function uses the device_to_virt ops to translate the addresses. Implement a basic translation for sandbox_testproc.

Add related tests. Test result:
=> ut dm remoteproc_elf
Test: dm_test_remoteproc_elf: remoteproc.c
Test: dm_test_remoteproc_elf: remoteproc.c (flat tree)
Failures: 0

---

[...snip...]

Quoted 56 lines
drivers/remoteproc/rproc-elf-loader.c new file +56 -0
+/* Basic function to verify ELF32 image format */ int
+rproc_elf32_sanity_check(ulong addr, ulong size) {
+	Elf32_Ehdr *ehdr;
+	char class;
+
+	if (!addr) {
+		pr_debug("Invalid fw address?\n");
+		return -EFAULT;
+	}
+
+	if (size < sizeof(Elf32_Ehdr)) {
+		pr_debug("Image is too small\n");
+		return -ENOSPC;
+	}
+
+	ehdr = (Elf32_Ehdr *)addr;
+	class = ehdr->e_ident[EI_CLASS];
+
+	if (!IS_ELF(*ehdr) || ehdr->e_type != ET_EXEC || class != ELFCLASS32) {
+		pr_debug("Not an executable ELF32 image\n");
+		return -EPROTONOSUPPORT;
+	}
+
+	/* We assume the firmware has the same endianness as the host */ #
+ifdef __LITTLE_ENDIAN
+	if (ehdr->e_ident[EI_DATA] != ELFDATA2LSB) { # else /* BIG ENDIAN */
+	if (ehdr->e_ident[EI_DATA] != ELFDATA2MSB) { # endif
+		pr_debug("Unsupported firmware endianness\n");
+		return -EILSEQ;
+	}
+
+	if (size < ehdr->e_shoff + sizeof(Elf32_Shdr)) {
+		pr_debug("Image is too small\n");
+		return -ENOSPC;
+	}
+
+	if (memcmp(ehdr->e_ident, ELFMAG, SELFMAG)) {
+		pr_debug("Image is corrupted (bad magic)\n");
+		return -EBADF;
+	}
+
+	if (ehdr->e_phnum == 0) {
+		pr_debug("No loadable segments\n");
+		return -ENOEXEC;
+	}
+
+	if (ehdr->e_phoff > size) {
+		pr_debug("Firmware size is too small\n");
+		return -ENOSPC;
+	}
+
+	return 0;
+}
+
+/* A very simple elf loader, assumes the image is valid */ int
+rproc_elf32_load_image(struct udevice *dev, unsigned long addr) {
Quoted 8 lines

drivers/remoteproc/rproc-elf-loader.c line 74

Quoted 5 lines
drivers/remoteproc/rproc-elf-loader.c new file +5 -0
+	Elf32_Ehdr *ehdr; /* Elf header structure pointer */
+	Elf32_Phdr *phdr; /* Program header structure pointer */
+	const struct dm_rproc_ops *ops;
+	unsigned int i;
+

I would prefer to call rproc_elf32_sanity_check() here and reduce the burden on user. It's my preference and no strong objections.

Yes it is a possibility, but for my side I prefer the Fabien proposition. (we can perhaps reuse the check of ELF for other use case).

I will merge the patch with this version (to have the patch in v2019.10) . But I let Fabien conclude and potentially sent a minor update.

Quoted 6 lines

Other than that:

Thanks and regards,
Lokesh

Thanks
Patrick

#12 lore raw

PATCH v3 4/7 remoteproc: add elf file load support

In reply to Fabien Dessenne

Hi,

Quoted 25 lines

From: Fabien DESSENNE <[email protected]>
Sent: vendredi 31 mai 2019 15:12

The current implementation supports only binary file load.
Add helpers to support ELF32 format (sanity check, and load).
Note that since an ELF32 image is built for the remote processor, the load function uses the device_to_virt ops to translate the addresses.
Implement a basic translation for sandbox_testproc.

Add related tests. Test result:
=> ut dm remoteproc_elf
Test: dm_test_remoteproc_elf: remoteproc.c
Test: dm_test_remoteproc_elf: remoteproc.c (flat tree)
Failures: 0

---
 drivers/remoteproc/Makefile           |   2 +-
 drivers/remoteproc/rproc-elf-loader.c | 106 +++++++++++++++++++++++++++++
drivers/remoteproc/sandbox_testproc.c |  19 ++++++
 include/remoteproc.h                  |  30 ++++++++-
 test/dm/remoteproc.c                  | 122
++++++++++++++++++++++++++++++++++
 5 files changed, 275 insertions(+), 4 deletions(-)  create mode 100644
Quoted 2 lines

drivers/remoteproc/rproc-elf-loader.c

Applied to u-boot-stm32/master, thanks!

Patrick

#13 lore raw

PATCH v3 5/7 remoteproc: Introduce STM32 Cortex-M4 remoteproc driver

In reply to Fabien Dessenne

This patch introduces support of Cortex-M4 remote processor for STM32 MCU and MPU families.

---
 drivers/remoteproc/Kconfig       |  10 ++
 drivers/remoteproc/Makefile      |   1 +
 drivers/remoteproc/stm32_copro.c | 257 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 268 insertions(+)
 create mode 100644 drivers/remoteproc/stm32_copro.c
drivers/remoteproc/Kconfig +10 -0
index 9eb532b..fa6f111 100644
@@ -40,6 +40,16 @@ config REMOTEPROC_SANDBOX
 	  Say 'y' here to add support for test processor which does dummy
 	  operations for sandbox platform.
 
+config REMOTEPROC_STM32_COPRO
+	bool "Support for STM32 coprocessor"
+	select REMOTEPROC
+	depends on DM
+	depends on ARCH_STM32MP
+	depends on OF_CONTROL
+	help
+	  Say 'y' here to add support for STM32 Cortex-M4 coprocessors via the
+	  remoteproc framework.
+
 config REMOTEPROC_TI_POWER
 	bool "Support for TI Power processor"
 	select REMOTEPROC
drivers/remoteproc/Makefile +1 -0
index 7517947..b9a06ac 100644
@@ -10,4 +10,5 @@ obj-$(CONFIG_$(SPL_)REMOTEPROC) += rproc-uclass.o rproc-elf-loader.o
 obj-$(CONFIG_K3_SYSTEM_CONTROLLER) += k3_system_controller.o
 obj-$(CONFIG_REMOTEPROC_K3) += k3_rproc.o
 obj-$(CONFIG_REMOTEPROC_SANDBOX) += sandbox_testproc.o
+obj-$(CONFIG_REMOTEPROC_STM32_COPRO) += stm32_copro.o
 obj-$(CONFIG_REMOTEPROC_TI_POWER) += ti_power_proc.o
drivers/remoteproc/stm32_copro.c new file +257 -0

257 lines not on this page · raw message

Signature · 1 line
2.7.4
#14 lore raw

PATCH v3 5/7 remoteproc: Introduce STM32 Cortex-M4 remoteproc driver

Hi,

Quoted 8 lines

From: Fabien DESSENNE <[email protected]>
Sent: vendredi 31 mai 2019 15:12

This patch introduces support of Cortex-M4 remote processor for STM32 MCU and MPU families.

Quoted 8 lines
---
 drivers/remoteproc/Kconfig       |  10 ++
 drivers/remoteproc/Makefile      |   1 +
 drivers/remoteproc/stm32_copro.c | 257
+++++++++++++++++++++++++++++++++++++++
 3 files changed, 268 insertions(+)
 create mode 100644 drivers/remoteproc/stm32_copro.c

Applied to u-boot-stm32/master, thanks!

Patrick

#15 lore raw

PATCH v3 6/7 MAINTAINERS: Add stm32 remoteproc driver

In reply to Fabien Dessenne
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index 33fd465..5c505d9 100644
@@ -309,6 +309,7 @@ F:	drivers/power/pmic/stpmic1.c
 F:	drivers/power/regulator/stm32-vrefbuf.c
 F:	drivers/power/regulator/stpmic1.c
 F:	drivers/ram/stm32mp1/
+F:	drivers/remoteproc/stm32_copro.c
 F:	drivers/misc/stm32_rcc.c
 F:	drivers/reset/stm32-reset.c
 F:	drivers/spi/stm32_qspi.c
Signature · 1 line
2.7.4
#17 lore raw

PATCH v3 7/7 configs: stm32mp15: enable stm32 remoteproc

In reply to Fabien Dessenne

Activate the remote processor support for stm32mp15 configs.

---
 configs/stm32mp15_basic_defconfig   | 2 ++
 configs/stm32mp15_trusted_defconfig | 2 ++
 2 files changed, 4 insertions(+)
configs/stm32mp15_basic_defconfig +2 -0
index 0ea9dff..5185072 100644
@@ -67,6 +67,8 @@ CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_GPIO=y
 CONFIG_DM_REGULATOR_STM32_VREFBUF=y
 CONFIG_DM_REGULATOR_STPMIC1=y
+CONFIG_REMOTEPROC=y
+CONFIG_REMOTEPROC_STM32_COPRO=y
 CONFIG_SERIAL_RX_BUFFER=y
 CONFIG_STM32_SERIAL=y
 CONFIG_USB=y
configs/stm32mp15_trusted_defconfig +2 -0
index 3c2bb75..037d7e8 100644
@@ -57,6 +57,8 @@ CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_GPIO=y
 CONFIG_DM_REGULATOR_STM32_VREFBUF=y
 CONFIG_DM_REGULATOR_STPMIC1=y
+CONFIG_REMOTEPROC=y
+CONFIG_REMOTEPROC_STM32_COPRO=y
 CONFIG_SERIAL_RX_BUFFER=y
 CONFIG_STM32_SERIAL=y
 CONFIG_USB=y
Signature · 1 line
2.7.4
#18 lore raw

PATCH v3 7/7 configs: stm32mp15: enable stm32 remoteproc

Hi,

Quoted 11 lines

From: Fabien DESSENNE <[email protected]>
Sent: vendredi 31 mai 2019 15:12

Activate the remote processor support for stm32mp15 configs.

---
 configs/stm32mp15_basic_defconfig   | 2 ++
 configs/stm32mp15_trusted_defconfig | 2 ++
 2 files changed, 4 insertions(+)

Applied to u-boot-stm32/master, thanks!

Patrick

#19 lore raw

v3 cover Add STM32 Cortex-M4 remoteproc driver

In reply to Fabien Dessenne

Hi Fabien,

Quoted 6 lines

This patchset adds an STM32 remoteproc driver.

Patch 1 adds the xxx_translate_dma_address() API which is the equivalent of the xxx_translate_address() relying on the "dma-ranges" property instead of the "ranges" property.

Quoted 8 lines

Patch 2 fixes and completes function headers of remoteproc.h.

Patch 3 & 4 add the support of the ELF image loading (the current implementation supports only binary image loading).

Patch 5 is about the driver, and patches 6 & 7 are about MAINTAINERS and configs update.

Thank you for your work - the Vybrid VF610 also has Cortex-M4/M3 embedded and (probably) in some future somebody will want to setup it in U-Boot. Those changes looks generic and shall be easily re-usable.

Thanks one more time.

Quoted 42 lines

Changes since v2:

(quoted diff) +0 -2
-Moved helpers to rproc-elf-loader.c
-Rename *elf* functions in *elf32*, preparing future support for elf64

Changes since v1:

(quoted diff) +0 -2
-Added tests for rproc_elf*() and *_translate_dma_address()
-Changed memory translation ops from da_to_pa() to device_to_virt() :

the name is updated and the translation now converts to virtual instead of physical. -Merged rproc_elf_is_valid() in rproc_elf_sanity_check() -Used explicit error values in rproc_elf_sanity_check() -Added and fix comments in various headers -Misc minor changes

Fabien Dessenne (7):
dm: core: Introduce xxx_translate_dma_address()
remoteproc: fix function headers
remoteproc: add device_to_virt ops
remoteproc: add elf file load support
remoteproc: Introduce STM32 Cortex-M4 remoteproc driver
MAINTAINERS: Add stm32 remoteproc driver
configs: stm32mp15: enable stm32 remoteproc

 MAINTAINERS                           |   1 +
 arch/sandbox/dts/test.dts             |   4 +
 common/fdt_support.c                  |   6 +
 configs/stm32mp15_basic_defconfig     |   2 +
 configs/stm32mp15_trusted_defconfig   |   2 +
 drivers/core/of_addr.c                |   4 +
 drivers/core/ofnode.c                 |   8 ++
 drivers/core/read.c                   |   5 +
 drivers/remoteproc/Kconfig            |  10 ++
 drivers/remoteproc/Makefile           |   3 +-
 drivers/remoteproc/rproc-elf-loader.c | 106 ++++++++++++++
 drivers/remoteproc/sandbox_testproc.c |  19 +++
 drivers/remoteproc/stm32_copro.c      | 257
++++++++++++++++++++++++++++++++++
include/dm/of_addr.h                  |  18 +++
include/dm/ofnode.h                   |  16 ++-
include/dm/read.h                     |  20 ++-
include/fdt_support.h                 |  24 ++++
include/remoteproc.h                  | 146 +++++++++++++------
test/dm/remoteproc.c                  | 122 ++++++++++++++++
test/dm/test-fdt.c                    |  12 ++ 20 files changed, 743
Quoted 4 lines

insertions(+), 42 deletions(-) create mode 100644 drivers/remoteproc/rproc-elf-loader.c create mode 100644 drivers/remoteproc/stm32_copro.c

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190604/71d0d02d/attachment.sig>

#20 lore raw

v3 cover Add STM32 Cortex-M4 remoteproc driver

In reply to Fabien Dessenne

Hi

Are there any further comments?

BR

Fabien

Quoted 59 lines · Fabien Dessenne

This patchset adds an STM32 remoteproc driver.

Patch 1 adds the xxx_translate_dma_address() API which is the equivalent of the xxx_translate_address() relying on the "dma-ranges" property instead of the "ranges" property.

Patch 2 fixes and completes function headers of remoteproc.h.

Patch 3 & 4 add the support of the ELF image loading (the current implementation supports only binary image loading).

Patch 5 is about the driver, and patches 6 & 7 are about MAINTAINERS and configs update.

Changes since v2:

(quoted diff) +0 -2
-Moved helpers to rproc-elf-loader.c
-Rename *elf* functions in *elf32*, preparing future support for elf64

Changes since v1:

(quoted diff) +0 -6
-Added tests for rproc_elf*() and *_translate_dma_address()
-Changed memory translation ops from da_to_pa() to device_to_virt() : the name
  is updated and the translation now converts to virtual instead of physical.
-Merged rproc_elf_is_valid() in rproc_elf_sanity_check()
-Used explicit error values in rproc_elf_sanity_check()
-Added and fix comments in various headers
-Misc minor changes

Fabien Dessenne (7):
dm: core: Introduce xxx_translate_dma_address()
remoteproc: fix function headers
remoteproc: add device_to_virt ops
remoteproc: add elf file load support
remoteproc: Introduce STM32 Cortex-M4 remoteproc driver
MAINTAINERS: Add stm32 remoteproc driver
configs: stm32mp15: enable stm32 remoteproc

  MAINTAINERS                           |   1 +
  arch/sandbox/dts/test.dts             |   4 +
  common/fdt_support.c                  |   6 +
  configs/stm32mp15_basic_defconfig     |   2 +
  configs/stm32mp15_trusted_defconfig   |   2 +
  drivers/core/of_addr.c                |   4 +
  drivers/core/ofnode.c                 |   8 ++
  drivers/core/read.c                   |   5 +
  drivers/remoteproc/Kconfig            |  10 ++
  drivers/remoteproc/Makefile           |   3 +-
  drivers/remoteproc/rproc-elf-loader.c | 106 ++++++++++++++
  drivers/remoteproc/sandbox_testproc.c |  19 +++
  drivers/remoteproc/stm32_copro.c      | 257 ++++++++++++++++++++++++++++++++++
  include/dm/of_addr.h                  |  18 +++
  include/dm/ofnode.h                   |  16 ++-
  include/dm/read.h                     |  20 ++-
  include/fdt_support.h                 |  24 ++++
  include/remoteproc.h                  | 146 +++++++++++++------
  test/dm/remoteproc.c                  | 122 ++++++++++++++++
  test/dm/test-fdt.c                    |  12 ++
  20 files changed, 743 insertions(+), 42 deletions(-)

create mode 100644 drivers/remoteproc/rproc-elf-loader.c create mode 100644 drivers/remoteproc/stm32_copro.c