Patch "clk: renesas: rcar-gen3: Extend SDnH divider table" has been added to the 6.1-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

    clk: renesas: rcar-gen3: Extend SDnH divider table

to the 6.1-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:
     clk-renesas-rcar-gen3-extend-sdnh-divider-table.patch
and it can be found in the queue-6.1 subdirectory.

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



commit b18f5b915347d5fadb4b404287620a57ea39fbc0
Author: Dirk Behme <dirk.behme@xxxxxxxxxxxx>
Date:   Thu Sep 28 10:03:17 2023 +0200

    clk: renesas: rcar-gen3: Extend SDnH divider table
    
    [ Upstream commit d5252d9697a3e7007c741e9c103073868955a304 ]
    
    The clock dividers might be used with clock stop bit enabled or not.
    Current tables only support recommended values from the datasheet.  This
    might result in warnings like below because no valid clock divider is
    found. Resulting in a 0 divider.
    
    There are Renesas ARM Trusted Firmware version out there which e.g.
    configure 0x201 (shifted logical right by 2: 0x80) and with this match
    the added { STPnHCK | 0, 1 }:
    
    https://github.com/renesas-rcar/arm-trusted-firmware/blob/rcar_gen3_v2.3/drivers/renesas/rcar/emmc/emmc_init.c#L108
    
    ------------[ cut here ]------------
    sd1h: Zero divisor and CLK_DIVIDER_ALLOW_ZERO not set
    WARNING: CPU: 1 PID: 1 at drivers/clk/clk-divider.c:141 divider_recalc_rate+0x48/0x70
    Modules linked in:
    CPU: 1 PID: 1 Comm: swapper/0 Not tainted 6.1.52 #1
    Hardware name: Custom board based on r8a7796 (DT)
    pstate: 40000005 (nZcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    pc : divider_recalc_rate+0x48/0x70
    ...
    ------------[ cut here ]------------
    
    Fixes: bb6d3fa98a41 ("clk: renesas: rcar-gen3: Switch to new SD clock handling")
    Signed-off-by: Dirk Behme <dirk.behme@xxxxxxxxxxxx>
    [wsa: extended the table to 5 entries, added comments, reword commit message a little]
    Signed-off-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>
    Tested-by: Dirk Behme <dirk.behme@xxxxxxxxxxxx>
    Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20230928080317.28224-1-wsa+renesas@xxxxxxxxxxxxxxxxxxxx
    Signed-off-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/clk/renesas/rcar-cpg-lib.c b/drivers/clk/renesas/rcar-cpg-lib.c
index e2e0447de1901..5a15f8788b922 100644
--- a/drivers/clk/renesas/rcar-cpg-lib.c
+++ b/drivers/clk/renesas/rcar-cpg-lib.c
@@ -70,8 +70,21 @@ void cpg_simple_notifier_register(struct raw_notifier_head *notifiers,
 #define STPnHCK	BIT(9 - SDnSRCFC_SHIFT)
 
 static const struct clk_div_table cpg_sdh_div_table[] = {
+	/*
+	 * These values are recommended by the datasheet.  Because they come
+	 * first, Linux will only use these.
+	 */
 	{ 0, 1 }, { 1, 2 }, { STPnHCK | 2, 4 }, { STPnHCK | 3, 8 },
-	{ STPnHCK | 4, 16 }, { 0, 0 },
+	{ STPnHCK | 4, 16 },
+	/*
+	 * These values are not recommended because STPnHCK is wrong.  But they
+	 * have been seen because of broken firmware.  So, we support reading
+	 * them but Linux will sanitize them when initializing through
+	 * recalc_rate.
+	 */
+	{ STPnHCK | 0, 1 }, { STPnHCK | 1, 2 },  { 2, 4 }, { 3, 8 }, { 4, 16 },
+	/* Sentinel */
+	{ 0, 0 }
 };
 
 struct clk * __init cpg_sdh_clk_register(const char *name,



[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