merged.

Bruce

In message: [linux-yocto][v5.15/standard/nxp-sdk-5.15/nxp-soc & 
v5.15/standard/preempt-rt/nxp-sdk-5.15/nxp-soc][PATCH 1/1] arm: imx: Enable 
OCOTP clock before reading the register
on 05/12/2022 Xiaolei Wang wrote:

> OCOTP register access needs the  OCOTP clock to be
> running and this code peeks into this register region,
> so it needs to ensure the clock is active. Otherwise,
> this will affect the second kernel startup of kexec.
> 
> Signed-off-by: Xiaolei Wang <xiaolei.w...@windriver.com>
> ---
>  arch/arm/mach-imx/common.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/arch/arm/mach-imx/common.c b/arch/arm/mach-imx/common.c
> index 5368497ac0db..f04195982ef9 100644
> --- a/arch/arm/mach-imx/common.c
> +++ b/arch/arm/mach-imx/common.c
> @@ -13,6 +13,7 @@
>  #include <linux/of_address.h>
>  #include <linux/of_net.h>
>  #include <linux/slab.h>
> +#include <linux/clk.h>
>  
>  #include "hardware.h"
>  
> @@ -52,6 +53,7 @@ void __init imx6_enet_mac_init(const char *enet_compat, 
> const char *ocotp_compat
>       u32 macaddr1_high = 0;
>       u8 *macaddr;
>       int i, id;
> +     struct clk *clk;
>  
>       for (i = 0; i < 2; i++) {
>               enet_np = of_find_compatible_node(from, NULL, enet_compat);
> @@ -79,12 +81,21 @@ void __init imx6_enet_mac_init(const char *enet_compat, 
> const char *ocotp_compat
>                       goto put_ocotp_node;
>               }
>  
> +             clk = of_clk_get_by_name(ocotp_np, NULL);
> +             if (!clk)
> +                     goto put_ocotp_node;
> +
> +             clk_prepare_enable(clk);
> +
>               macaddr_low = readl_relaxed(base + OCOTP_MACn(1));
>               if (id)
>                       macaddr1_high = readl_relaxed(base + OCOTP_MACn(2));
>               else
>                       macaddr_high = readl_relaxed(base + OCOTP_MACn(0));
>  
> +             clk_disable_unprepare(clk);
> +             clk_put(clk);
> +
>               newmac = kzalloc(sizeof(*newmac) + 6, GFP_KERNEL);
>               if (!newmac)
>                       goto put_ocotp_node;
> -- 
> 2.25.1
> 
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#11995): 
https://lists.yoctoproject.org/g/linux-yocto/message/11995
Mute This Topic: https://lists.yoctoproject.org/mt/95461029/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to