soc: ti: pruss: Add pruss_{request,release}_mem_region() API

Add two new API - pruss_request_mem_region() & pruss_release_mem_region(),
to the PRUSS platform driver to allow client drivers to acquire and release
the common memory resources present within a PRU-ICSS subsystem. This
allows the client drivers to directly manipulate the respective memories,
as per their design contract with the associated firmware.

Co-developed-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
Co-developed-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
Reviewed-by: Roger Quadros <rogerq@kernel.org>
Acked-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
Link: https://lore.kernel.org/r/20230414045542.3249939-3-danishanwar@ti.com
Signed-off-by: Nishanth Menon <nm@ti.com>
This commit is contained in:
Andrew F. Davis
2023-04-14 10:25:40 +05:30
committed by Nishanth Menon
parent 67d1b0a103
commit b789ca1e33
2 changed files with 99 additions and 0 deletions

View File

@@ -9,6 +9,7 @@
#ifndef _PRUSS_DRIVER_H_
#define _PRUSS_DRIVER_H_
#include <linux/mutex.h>
#include <linux/remoteproc/pruss.h>
#include <linux/types.h>
#include <linux/err.h>
@@ -41,6 +42,8 @@ struct pruss_mem_region {
* @cfg_base: base iomap for CFG region
* @cfg_regmap: regmap for config region
* @mem_regions: data for each of the PRUSS memory regions
* @mem_in_use: to indicate if memory resource is in use
* @lock: mutex to serialize access to resources
* @core_clk_mux: clk handle for PRUSS CORE_CLK_MUX
* @iep_clk_mux: clk handle for PRUSS IEP_CLK_MUX
*/
@@ -49,6 +52,8 @@ struct pruss {
void __iomem *cfg_base;
struct regmap *cfg_regmap;
struct pruss_mem_region mem_regions[PRUSS_MEM_MAX];
struct pruss_mem_region *mem_in_use[PRUSS_MEM_MAX];
struct mutex lock; /* PRU resource lock */
struct clk *core_clk_mux;
struct clk *iep_clk_mux;
};
@@ -57,6 +62,10 @@ struct pruss {
struct pruss *pruss_get(struct rproc *rproc);
void pruss_put(struct pruss *pruss);
int pruss_request_mem_region(struct pruss *pruss, enum pruss_mem mem_id,
struct pruss_mem_region *region);
int pruss_release_mem_region(struct pruss *pruss,
struct pruss_mem_region *region);
#else
@@ -67,6 +76,19 @@ static inline struct pruss *pruss_get(struct rproc *rproc)
static inline void pruss_put(struct pruss *pruss) { }
static inline int pruss_request_mem_region(struct pruss *pruss,
enum pruss_mem mem_id,
struct pruss_mem_region *region)
{
return -EOPNOTSUPP;
}
static inline int pruss_release_mem_region(struct pruss *pruss,
struct pruss_mem_region *region)
{
return -EOPNOTSUPP;
}
#endif /* CONFIG_TI_PRUSS */
#endif /* _PRUSS_DRIVER_H_ */