Patch "can: flexcan: flexcan_chip_freeze(): fix chip freeze for missing bitrate" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    can: flexcan: flexcan_chip_freeze(): fix chip freeze for missing bitrate

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     can-flexcan-flexcan_chip_freeze-fix-chip-freeze-for-.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit fe910fb0f738d39af58f47ff59592effa58cea0a
Author: Angelo Dureghello <angelo@xxxxxxxxxxxxxxxx>
Date:   Tue Mar 16 00:15:10 2021 +0100

    can: flexcan: flexcan_chip_freeze(): fix chip freeze for missing bitrate
    
    [ Upstream commit 47c5e474bc1e1061fb037d13b5000b38967eb070 ]
    
    For cases when flexcan is built-in, bitrate is still not set at
    registering. So flexcan_chip_freeze() generates:
    
    [    1.860000] *** ZERO DIVIDE ***   FORMAT=4
    [    1.860000] Current process id is 1
    [    1.860000] BAD KERNEL TRAP: 00000000
    [    1.860000] PC: [<402e70c8>] flexcan_chip_freeze+0x1a/0xa8
    
    To allow chip freeze, using an hardcoded timeout when bitrate is still
    not set.
    
    Fixes: ec15e27cc890 ("can: flexcan: enable RX FIFO after FRZ/HALT valid")
    Link: https://lore.kernel.org/r/20210315231510.650593-1-angelo@xxxxxxxxxxxxxxxx
    Signed-off-by: Angelo Dureghello <angelo@xxxxxxxxxxxxxxxx>
    [mkl: use if instead of ? operator]
    Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index b6d00dfa8b8f..7ec15cb356c0 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -544,9 +544,15 @@ static int flexcan_chip_disable(struct flexcan_priv *priv)
 static int flexcan_chip_freeze(struct flexcan_priv *priv)
 {
 	struct flexcan_regs __iomem *regs = priv->regs;
-	unsigned int timeout = 1000 * 1000 * 10 / priv->can.bittiming.bitrate;
+	unsigned int timeout;
+	u32 bitrate = priv->can.bittiming.bitrate;
 	u32 reg;
 
+	if (bitrate)
+		timeout = 1000 * 1000 * 10 / bitrate;
+	else
+		timeout = FLEXCAN_TIMEOUT_US / 10;
+
 	reg = priv->read(&regs->mcr);
 	reg |= FLEXCAN_MCR_FRZ | FLEXCAN_MCR_HALT;
 	priv->write(reg, &regs->mcr);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux