Skip to content

Commit 18cf4fc

Browse files
Tero Kristomathieupoirier
authored andcommitted
remoteproc: pru: add support for configuring GPMUX based on client setup
The GPMUX config value for a PRU device can now be configured by client by specifying it in the device node ti,pruss-gp-mux-sel. Signed-off-by: Tero Kristo <t-kristo@ti.com> Signed-off-by: Suman Anna <s-anna@ti.com> Signed-off-by: MD Danish Anwar <danishanwar@ti.com> Link: https://lore.kernel.org/r/20230802064925.1895750-1-danishanwar@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
1 parent fb2bdd3 commit 18cf4fc

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

drivers/remoteproc/pru_rproc.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ struct pru_private_data {
110110
* @dbg_single_step: debug state variable to set PRU into single step mode
111111
* @dbg_continuous: debug state variable to restore PRU execution mode
112112
* @evt_count: number of mapped events
113+
* @gpmux_save: saved value for gpmux config
113114
*/
114115
struct pru_rproc {
115116
int id;
@@ -128,6 +129,7 @@ struct pru_rproc {
128129
u32 dbg_single_step;
129130
u32 dbg_continuous;
130131
u8 evt_count;
132+
u8 gpmux_save;
131133
};
132134

133135
static inline u32 pru_control_read_reg(struct pru_rproc *pru, unsigned int reg)
@@ -229,6 +231,7 @@ struct rproc *pru_rproc_get(struct device_node *np, int index,
229231
struct device *dev;
230232
const char *fw_name;
231233
int ret;
234+
u32 mux;
232235

233236
rproc = __pru_rproc_get(np, index);
234237
if (IS_ERR(rproc))
@@ -253,6 +256,23 @@ struct rproc *pru_rproc_get(struct device_node *np, int index,
253256
if (pru_id)
254257
*pru_id = pru->id;
255258

259+
ret = pruss_cfg_get_gpmux(pru->pruss, pru->id, &pru->gpmux_save);
260+
if (ret) {
261+
dev_err(dev, "failed to get cfg gpmux: %d\n", ret);
262+
goto err;
263+
}
264+
265+
/* An error here is acceptable for backward compatibility */
266+
ret = of_property_read_u32_index(np, "ti,pruss-gp-mux-sel", index,
267+
&mux);
268+
if (!ret) {
269+
ret = pruss_cfg_set_gpmux(pru->pruss, pru->id, mux);
270+
if (ret) {
271+
dev_err(dev, "failed to set cfg gpmux: %d\n", ret);
272+
goto err;
273+
}
274+
}
275+
256276
ret = of_property_read_string_index(np, "firmware-name", index,
257277
&fw_name);
258278
if (!ret) {
@@ -291,6 +311,8 @@ void pru_rproc_put(struct rproc *rproc)
291311

292312
pru = rproc->priv;
293313

314+
pruss_cfg_set_gpmux(pru->pruss, pru->id, pru->gpmux_save);
315+
294316
pru_rproc_set_firmware(rproc, NULL);
295317

296318
mutex_lock(&pru->lock);

0 commit comments

Comments
 (0)