summaryrefslogtreecommitdiff
path: root/include/linux/remoteproc
diff options
context:
space:
mode:
authorRoger Quadros <rogerq@ti.com>2023-01-06 15:10:45 +0300
committerMathieu Poirier <mathieu.poirier@linaro.org>2023-01-06 19:16:16 +0300
commit102853400321baea2527917e6e89be33508c3e18 (patch)
treeebed239a4b8790bead45f5e391909235fad656e3 /include/linux/remoteproc
parent2da812ffcd11c31ef897615798a8a66041a5b73b (diff)
downloadlinux-102853400321baea2527917e6e89be33508c3e18.tar.xz
remoteproc: pru: Add pru_rproc_set_ctable() function
Some firmwares expect the OS drivers to configure the CTABLE entries publishing dynamically allocated memory regions. For example, the PRU Ethernet firmwares use the C28 and C30 entries for retrieving the Shared RAM and System SRAM (OCMC) areas allocated by the PRU Ethernet client driver. Provide a way for users to do that through a new API, pru_rproc_set_ctable(). The API returns 0 on success and a negative value on error. NOTE: The programmable CTABLE entries are typically re-programmed by the PRU firmwares when dealing with a certain block of memory during block processing. This API provides an interface to the PRU client drivers to publish a dynamically allocated memory block with the PRU firmware using a CTABLE entry instead of a negotiated address in shared memory. Additional synchronization may be needed between the PRU client drivers and firmwares if different addresses needs to be published at run-time reusing the same CTABLE entry. CTABLE for stands for "constant table". Each CTable entry just holds the upper address bits so PRU can reference to external memory with larger address bits. For use case please see prueth_sw_emac_config() in "drivers/net/ethernet/ti/prueth_switch.c" /* Set in constant table C28 of PRUn to ICSS Shared memory */ pru_rproc_set_ctable(prueth->pru0, PRU_C28, sharedramaddr); pru_rproc_set_ctable(prueth->pru1, PRU_C28, sharedramaddr); /* Set in constant table C30 of PRUn to OCMC memory */ pru_rproc_set_ctable(prueth->pru0, PRU_C30, ocmcaddr); pru_rproc_set_ctable(prueth->pru1, PRU_C30, ocmcaddr); Signed-off-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Suman Anna <s-anna@ti.com> Signed-off-by: Roger Quadros <rogerq@ti.com> Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org> Signed-off-by: MD Danish Anwar <danishanwar@ti.com> Link: https://lore.kernel.org/r/20230106121046.886863-6-danishanwar@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Diffstat (limited to 'include/linux/remoteproc')
-rw-r--r--include/linux/remoteproc/pruss.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/linux/remoteproc/pruss.h b/include/linux/remoteproc/pruss.h
index 579dafbbaccf..039b50d58df2 100644
--- a/include/linux/remoteproc/pruss.h
+++ b/include/linux/remoteproc/pruss.h
@@ -28,13 +28,29 @@ enum pruss_pru_id {
PRUSS_NUM_PRUS,
};
+/*
+ * enum pru_ctable_idx - Configurable Constant table index identifiers
+ */
+enum pru_ctable_idx {
+ PRU_C24 = 0,
+ PRU_C25,
+ PRU_C26,
+ PRU_C27,
+ PRU_C28,
+ PRU_C29,
+ PRU_C30,
+ PRU_C31,
+};
+
struct device_node;
+struct rproc;
#if IS_ENABLED(CONFIG_PRU_REMOTEPROC)
struct rproc *pru_rproc_get(struct device_node *np, int index,
enum pruss_pru_id *pru_id);
void pru_rproc_put(struct rproc *rproc);
+int pru_rproc_set_ctable(struct rproc *rproc, enum pru_ctable_idx c, u32 addr);
#else
@@ -46,6 +62,12 @@ pru_rproc_get(struct device_node *np, int index, enum pruss_pru_id *pru_id)
static inline void pru_rproc_put(struct rproc *rproc) { }
+static inline int pru_rproc_set_ctable(struct rproc *rproc,
+ enum pru_ctable_idx c, u32 addr)
+{
+ return -EOPNOTSUPP;
+}
+
#endif /* CONFIG_PRU_REMOTEPROC */
static inline bool is_pru_rproc(struct device *dev)