soc: ti: pruss: Add pruss_get()/put() API

Add two new get and put API, pruss_get() and pruss_put() to the
PRUSS platform driver to allow client drivers to request a handle
to a PRUSS device. This handle will be used by client drivers to
request various operations of the PRUSS platform driver through
additional API that will be added in the following patches.

The pruss_get() function returns the pruss handle corresponding
to a PRUSS device referenced by a PRU remoteproc instance. The
pruss_put() is the complimentary function to pruss_get().

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

View File

@@ -9,7 +9,9 @@
#ifndef _PRUSS_DRIVER_H_
#define _PRUSS_DRIVER_H_
#include <linux/remoteproc/pruss.h>
#include <linux/types.h>
#include <linux/err.h>
/*
* enum pruss_mem - PRUSS memory range identifiers
@@ -51,4 +53,20 @@ struct pruss {
struct clk *iep_clk_mux;
};
#if IS_ENABLED(CONFIG_TI_PRUSS)
struct pruss *pruss_get(struct rproc *rproc);
void pruss_put(struct pruss *pruss);
#else
static inline struct pruss *pruss_get(struct rproc *rproc)
{
return ERR_PTR(-EOPNOTSUPP);
}
static inline void pruss_put(struct pruss *pruss) { }
#endif /* CONFIG_TI_PRUSS */
#endif /* _PRUSS_DRIVER_H_ */