AnsweredAssumed Answered

Linux kernel hangs on i.MX6UL after early read of OTP registers

Question asked by Hector Palacios on Nov 9, 2016
Latest reply on Dec 2, 2016 by Hector Palacios

Hello,

 

I need to read the values of some OTP registers early during kernel initialization.

I'm reading them at the end of the probe() function of the fsl_opt.c driver.

static int fsl_otp_probe(struct platform_device *pdev)
{
     u32 reg;
     ...

     mutex_init(&otp_mutex);

     fsl_otp_read(0x22, &reg);
     printk("MAC0: 0x%08x\n", reg);
     return 0;
}

 

When I do this, the system hangs.

I tracked it down to the point where the OTP clock is disabled in the fsl_otp_read() function:

out:
     mutex_unlock(&otp_mutex);
       clk_disable_unprepare(otp_clk);

       return ret;
}

If I comment the clk_disable_unprepare(), the kernel goes on normally.

The function is basically writing a b00 to CCM_CCGR2[CG6], thus disabling the OTP clock.

If I don't do the early access, everything works fine, and even the sysfs access to OTP registers works without problems.

A similar code on the i.MX6 works ok, but not on the i.MX6UL.

I don't understand why disabling the OTP clock causes the kernel to hang.

 

I'm using kernel version: 4.1.15

 

+CC Fabio Estevam


Regards,

--

Héctor Palacios

Outcomes