@@ -115,6 +115,10 @@ static void k3_dsp_rproc_mbox_callback(struct mbox_client *client, void *data)
115
115
const char * name = kproc -> rproc -> name ;
116
116
u32 msg = omap_mbox_message (data );
117
117
118
+ /* Do not forward messages from a detached core */
119
+ if (kproc -> rproc -> state == RPROC_DETACHED )
120
+ return ;
121
+
118
122
dev_dbg (dev , "mbox msg: 0x%x\n" , msg );
119
123
120
124
switch (msg ) {
@@ -155,6 +159,10 @@ static void k3_dsp_rproc_kick(struct rproc *rproc, int vqid)
155
159
mbox_msg_t msg = (mbox_msg_t )vqid ;
156
160
int ret ;
157
161
162
+ /* Do not forward messages to a detached core */
163
+ if (kproc -> rproc -> state == RPROC_DETACHED )
164
+ return ;
165
+
158
166
/* send the index of the triggered virtqueue in the mailbox payload */
159
167
ret = mbox_send_message (kproc -> mbox , (void * )msg );
160
168
if (ret < 0 )
@@ -230,12 +238,9 @@ static int k3_dsp_rproc_request_mbox(struct rproc *rproc)
230
238
client -> knows_txdone = false;
231
239
232
240
kproc -> mbox = mbox_request_channel (client , 0 );
233
- if (IS_ERR (kproc -> mbox )) {
234
- ret = - EBUSY ;
235
- dev_err (dev , "mbox_request_channel failed: %ld\n" ,
236
- PTR_ERR (kproc -> mbox ));
237
- return ret ;
238
- }
241
+ if (IS_ERR (kproc -> mbox ))
242
+ return dev_err_probe (dev , PTR_ERR (kproc -> mbox ),
243
+ "mbox_request_channel failed\n" );
239
244
240
245
/*
241
246
* Ping the remote processor, this is only for sanity-sake for now;
@@ -315,32 +320,23 @@ static int k3_dsp_rproc_start(struct rproc *rproc)
315
320
u32 boot_addr ;
316
321
int ret ;
317
322
318
- ret = k3_dsp_rproc_request_mbox (rproc );
319
- if (ret )
320
- return ret ;
321
-
322
323
boot_addr = rproc -> bootaddr ;
323
324
if (boot_addr & (kproc -> data -> boot_align_addr - 1 )) {
324
325
dev_err (dev , "invalid boot address 0x%x, must be aligned on a 0x%x boundary\n" ,
325
326
boot_addr , kproc -> data -> boot_align_addr );
326
- ret = - EINVAL ;
327
- goto put_mbox ;
327
+ return - EINVAL ;
328
328
}
329
329
330
330
dev_dbg (dev , "booting DSP core using boot addr = 0x%x\n" , boot_addr );
331
331
ret = ti_sci_proc_set_config (kproc -> tsp , boot_addr , 0 , 0 );
332
332
if (ret )
333
- goto put_mbox ;
333
+ return ret ;
334
334
335
335
ret = k3_dsp_rproc_release (kproc );
336
336
if (ret )
337
- goto put_mbox ;
337
+ return ret ;
338
338
339
339
return 0 ;
340
-
341
- put_mbox :
342
- mbox_free_channel (kproc -> mbox );
343
- return ret ;
344
340
}
345
341
346
342
/*
@@ -353,8 +349,6 @@ static int k3_dsp_rproc_stop(struct rproc *rproc)
353
349
{
354
350
struct k3_dsp_rproc * kproc = rproc -> priv ;
355
351
356
- mbox_free_channel (kproc -> mbox );
357
-
358
352
k3_dsp_rproc_reset (kproc );
359
353
360
354
return 0 ;
@@ -363,42 +357,22 @@ static int k3_dsp_rproc_stop(struct rproc *rproc)
363
357
/*
364
358
* Attach to a running DSP remote processor (IPC-only mode)
365
359
*
366
- * This rproc attach callback only needs to request the mailbox, the remote
367
- * processor is already booted, so there is no need to issue any TI-SCI
368
- * commands to boot the DSP core. This callback is invoked only in IPC-only
369
- * mode.
360
+ * This rproc attach callback is a NOP. The remote processor is already booted,
361
+ * and all required resources have been acquired during probe routine, so there
362
+ * is no need to issue any TI-SCI commands to boot the DSP core. This callback
363
+ * is invoked only in IPC-only mode and exists because rproc_validate() checks
364
+ * for its existence.
370
365
*/
371
- static int k3_dsp_rproc_attach (struct rproc * rproc )
372
- {
373
- struct k3_dsp_rproc * kproc = rproc -> priv ;
374
- struct device * dev = kproc -> dev ;
375
- int ret ;
376
-
377
- ret = k3_dsp_rproc_request_mbox (rproc );
378
- if (ret )
379
- return ret ;
380
-
381
- dev_info (dev , "DSP initialized in IPC-only mode\n" );
382
- return 0 ;
383
- }
366
+ static int k3_dsp_rproc_attach (struct rproc * rproc ) { return 0 ; }
384
367
385
368
/*
386
369
* Detach from a running DSP remote processor (IPC-only mode)
387
370
*
388
- * This rproc detach callback performs the opposite operation to attach callback
389
- * and only needs to release the mailbox, the DSP core is not stopped and will
390
- * be left to continue to run its booted firmware. This callback is invoked only
391
- * in IPC-only mode.
371
+ * This rproc detach callback is a NOP. The DSP core is not stopped and will be
372
+ * left to continue to run its booted firmware. This callback is invoked only in
373
+ * IPC-only mode and exists for sanity sake.
392
374
*/
393
- static int k3_dsp_rproc_detach (struct rproc * rproc )
394
- {
395
- struct k3_dsp_rproc * kproc = rproc -> priv ;
396
- struct device * dev = kproc -> dev ;
397
-
398
- mbox_free_channel (kproc -> mbox );
399
- dev_info (dev , "DSP deinitialized in IPC-only mode\n" );
400
- return 0 ;
401
- }
375
+ static int k3_dsp_rproc_detach (struct rproc * rproc ) { return 0 ; }
402
376
403
377
/*
404
378
* This function implements the .get_loaded_rsc_table() callback and is used
@@ -697,6 +671,10 @@ static int k3_dsp_rproc_probe(struct platform_device *pdev)
697
671
kproc -> dev = dev ;
698
672
kproc -> data = data ;
699
673
674
+ ret = k3_dsp_rproc_request_mbox (rproc );
675
+ if (ret )
676
+ return ret ;
677
+
700
678
kproc -> ti_sci = devm_ti_sci_get_by_phandle (dev , "ti,sci" );
701
679
if (IS_ERR (kproc -> ti_sci ))
702
680
return dev_err_probe (dev , PTR_ERR (kproc -> ti_sci ),
@@ -789,6 +767,8 @@ static void k3_dsp_rproc_remove(struct platform_device *pdev)
789
767
if (ret )
790
768
dev_err (dev , "failed to detach proc (%pe)\n" , ERR_PTR (ret ));
791
769
}
770
+
771
+ mbox_free_channel (kproc -> mbox );
792
772
}
793
773
794
774
static const struct k3_dsp_mem_data c66_mems [] = {
0 commit comments