Patch "clk: at91: clk-main: update key before writing AT91_CKGR_MOR" has been added to the 5.8-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: at91: clk-main: update key before writing AT91_CKGR_MOR

to the 5.8-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-at91-clk-main-update-key-before-writing-at91_ckg.patch
and it can be found in the queue-5.8 subdirectory.

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



commit 633dfe0062dbea195a9137b65dbf13b3229413eb
Author: Claudiu Beznea <claudiu.beznea@xxxxxxxxxxxxx>
Date:   Tue Aug 25 09:59:10 2020 +0300

    clk: at91: clk-main: update key before writing AT91_CKGR_MOR
    
    [ Upstream commit 85d071e7f19a6a9abf30476b90b3819642568756 ]
    
    SAMA5D2 datasheet specifies on chapter 33.22.8 (PMC Clock Generator
    Main Oscillator Register) that writing any value other than
    0x37 on KEY field aborts the write operation. Use the key when
    selecting main clock parent.
    
    Fixes: 27cb1c2083373 ("clk: at91: rework main clk implementation")
    Signed-off-by: Claudiu Beznea <claudiu.beznea@xxxxxxxxxxxxx>
    Reviewed-by: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>
    Link: https://lore.kernel.org/r/1598338751-20607-3-git-send-email-claudiu.beznea@xxxxxxxxxxxxx
    Signed-off-by: Stephen Boyd <sboyd@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/clk/at91/clk-main.c b/drivers/clk/at91/clk-main.c
index 37c22667e8319..4313ecb2af5b2 100644
--- a/drivers/clk/at91/clk-main.c
+++ b/drivers/clk/at91/clk-main.c
@@ -437,12 +437,17 @@ static int clk_sam9x5_main_set_parent(struct clk_hw *hw, u8 index)
 		return -EINVAL;
 
 	regmap_read(regmap, AT91_CKGR_MOR, &tmp);
-	tmp &= ~MOR_KEY_MASK;
 
 	if (index && !(tmp & AT91_PMC_MOSCSEL))
-		regmap_write(regmap, AT91_CKGR_MOR, tmp | AT91_PMC_MOSCSEL);
+		tmp = AT91_PMC_MOSCSEL;
 	else if (!index && (tmp & AT91_PMC_MOSCSEL))
-		regmap_write(regmap, AT91_CKGR_MOR, tmp & ~AT91_PMC_MOSCSEL);
+		tmp = 0;
+	else
+		return 0;
+
+	regmap_update_bits(regmap, AT91_CKGR_MOR,
+			   AT91_PMC_MOSCSEL | MOR_KEY_MASK,
+			   tmp | AT91_PMC_KEY);
 
 	while (!clk_sam9x5_main_ready(regmap))
 		cpu_relax();



[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