This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

am1808 rtc issue in kernel 3.17

Other Parts Discussed in Thread: AM1808

Dear all,

i am facing a strange issue on am1808 based board, very similar to da850-evm:

omap-rtc is not more shown as running.

Strangely, if i add this lines, as them was there in kernel 3.5.1, it starts to run:

diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index 7d91728..cf60c07 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -848,6 +848,19 @@ static struct platform_device da8xx_rtc_device = {
 
 int da8xx_register_rtc(void)
 {
+       int ret;
+       void __iomem *base;
+
+       base = ioremap(DA8XX_RTC_BASE, SZ_4K);
+       if (WARN_ON(!base))
+               return -ENOMEM;
+
+       /* Unlock the rtc's registers */
+       __raw_writel(0x83e70b13, base + 0x6c);
+       __raw_writel(0x95a4f1e0, base + 0x70);
+
+       iounmap(base);
+
        return platform_device_register(&da8xx_rtc_device);
 }

Could someone confirm this is a good fix ? Or what i am missing ? Thanks

angelo

  • Some guesses from looking at the source. I've never used the RTC myself. The RTC driver appears to have the kick register writes. Maybe the kick doesn't occur early enough. In drivers/rtc/rtc-omap.c, try moving the kick writes earlier in the code. Change this

    static int __init omap_rtc_probe(struct platform_device *pdev)
    {
      ...
      /* Enable the clock/module so that we can access the registers */
      pm_runtime_enable(&pdev->dev);
      pm_runtime_get_sync(&pdev->dev);
    
      if (id_entry->driver_data & OMAP_RTC_HAS_KICKER) {
        rtc_writel(KICK0_VALUE, OMAP_RTC_KICK0_REG);
        rtc_writel(KICK1_VALUE, OMAP_RTC_KICK1_REG);
      }
      ...
    }

    to

    static int __init omap_rtc_probe(struct platform_device *pdev)
    {
      ...
      if (id_entry->driver_data & OMAP_RTC_HAS_KICKER) {
        rtc_writel(KICK0_VALUE, OMAP_RTC_KICK0_REG);
        rtc_writel(KICK1_VALUE, OMAP_RTC_KICK1_REG);
      }
    
      /* Enable the clock/module so that we can access the registers */
      pm_runtime_enable(&pdev->dev);
      pm_runtime_get_sync(&pdev->dev);
      ...
    }
    

    I suspect the pm_runtime_get_sync() eventually calls something in the OMAP rtc module. Hopefully some TI guys can comment.

  • Hi Angelo,

    Have you compared this code with our latest SDK release source ?

    I hope, this code was there and I'm not able to check now.

    Will let you know ASAP.