git: fe822a6fd660 - stable/13 - arm ti_mbox_attach: Write sysconfig to TI_MBOX_SYSCONFIG to request reset.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Fri, 13 May 2022 22:54:57 UTC
The branch stable/13 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=fe822a6fd660d0077f1198e38125dbcb6e2a3102

commit fe822a6fd660d0077f1198e38125dbcb6e2a3102
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-04-18 21:09:20 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-05-13 22:35:43 +0000

    arm ti_mbox_attach: Write sysconfig to TI_MBOX_SYSCONFIG to request reset.
    
    This variable was flagged as a set but unused warning as its value was
    read from a register and then modified to set a bit
    (TI_MBOX_SYSCONFIG_SOFTRST).  After the variable is modified, the code
    then loops waiting for the SOFTRST bit to go clear in the
    TI_MBOX_SYSCONFIG register.  Presumably merely reading from the
    register does not request a reset as other places in the driver read
    this register, so most likely the updated value of sysconfig setting
    the reset bit is supposed to be written to the register to request a
    reset before the polling loop that waits for the reset to finish.
    
    Reviewed by:    emaste
    Differential Revision:  https://reviews.freebsd.org/D34856
    
    (cherry picked from commit ecbe50447d04d7e9e042a20d88e7773d03b4f68e)
---
 sys/arm/ti/ti_mbox.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/arm/ti/ti_mbox.c b/sys/arm/ti/ti_mbox.c
index f77f2d9eafbf..abd3e5ad25ac 100644
--- a/sys/arm/ti/ti_mbox.c
+++ b/sys/arm/ti/ti_mbox.c
@@ -174,6 +174,7 @@ ti_mbox_attach(device_t dev)
 	sysconfig = ti_mbox_reg_read(sc, TI_MBOX_SYSCONFIG);
 	DPRINTF("initial sysconfig %d\n", sysconfig);
 	sysconfig |= TI_MBOX_SYSCONFIG_SOFTRST;
+	ti_mbox_reg_write(sc, TI_MBOX_SYSCONFIG, sysconfig);
 	delay = 100;
 	while (ti_mbox_reg_read(sc, TI_MBOX_SYSCONFIG) & 
 	    TI_MBOX_SYSCONFIG_SOFTRST) {