Accessing ls1021a-twr SNVS RTC in linux

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Accessing ls1021a-twr SNVS RTC in linux

2,106 Views
jasonhendrix
Contributor V

Hi,  our custom board will use the on-board battery backed RTC on the LS1020a processor.  In the meantime, I'm trying to use that (on-chip) RTC on the LS1021ATWR dev board.  Eventually I would like to configure it as RTC0 and link it to hwclock.  I can't seem to get my system to link the driver and the device (if the device is even recognized).

Can anyone help me configure Linux to use the on-chip LP RTC as RTC0?

Here is what I've done:

  • I enabled the snvs_rtc in the config file (using menuconfig)
  • I added data to the device tree files ls1021a.dtsi and ls1021atwr.dts
  • Build, load, run

To ls1021a.dtsi I added the following node under "soc":

sec_mon: sec_mon@1e90000 {

     compatible = "fsl,sec-v4.0-mon";

     #address-cells = <1>;

     #size_cells = <1>;

     ranges = <0 0x01e90000 0x10000>;

     interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;

     snvs_rtc: snvc_rtc_lp@34 {

          compatible = "fsl, sec-v4.0-mon-rtc-lp";

          reg = <0x34 0x58>;

     };

};

To ls1021atwr.dts I added the following node at the end of the file:

&svns_rtc {

     status = "okay";

};

--------------------------------------------------------------------------------

Now, when I load and run, I see:

  • /proc/device-tree/soc/sec_mon@1e90000/snvs_rtc_lp@34
  • /sys/bus/platform/drivers/snvs_rtc (containing only bind, unbind, uevent)
  • /sys/bus/platfrom/devices/sec_mon.3
  • /sys/devices/soc.2/sec_mon.3

But, the driver doesn't seem to be bound to the device.  I actually tried:

echo -n "sec_mon.3" > /sys/bus/platform/drivers/snvs_rtc/bind

but the OS returned "No such device"

Some things I think might be wrong:

  • device tree configuration not correct - should I put it under soc, as I did?
  • In some support posts for this RTC on the imx6 platform, there is some discussion of having to blow a fuse.  Is that required on this chip?

Thanks in advance.

Labels (1)
0 Kudos
Reply
4 Replies

1,439 Views
jasonhendrix
Contributor V

I've made more progress, getting the driver bound to the device (it even shows up as RTC0!).  The required change from my previous post was to move the "interrupts = ..." line from the sec_mon parent node into the snvs_rtc child node.

Now the problem is that the system crashes, I assume when the alarm interrupt fires or is supposed to fire.  The interrupts I've configured are mapped to the SEC_MON, without a real SEC_MON driver, we may not be able to handle interrupts properly.  Does anyone have any suggestions for SVNS_RTC interrupt values for the LS1021A?  Thanks.

0 Kudos
Reply

1,439 Views
jasonhendrix
Contributor V

Or, the problem could be stalls due to the fact that there is no 32KHz clock on the BB_RTC pin on this LS1021aTWR dev board. 

0 Kudos
Reply

1,439 Views
jasonhendrix
Contributor V

I've made some progress - I now see "1e90034.snvs_rtc_lp " in /sys/bus/platform/devices.  It's still not bound to the snvs_rtc driver, but it's progress.  Here's the .dts tree entry:

                sec_mon: sec_mon@1e90000 {

                        compatible = "fsl,sec-v4.0-mon", "simple-bus";

                        #address-cells = <1>;

                        #size-cells = <1>;

                        ranges = <0 0 0x01e90000 0x10000>;

                        interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;

                        snvs_rtc: snvs_rtc_lp@34 {

                                compatible = "fsl,sec-v4.0-mon-rtc-lp";

                                reg = <0x34 0x58>;

                        };

                };

0 Kudos
Reply

1,439 Views
bpe
NXP Employee
NXP Employee

The feature you are trying to use is not officially supported by the SDK. You can try following the instructions given

in Chapter 27 of i.MX Linux Reference Manual.  There is, however, no guarantee that it will work as you expect.

If it does not, debug your kernel.


Have a great day,
Platon

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------


Have a great day,
Platon

0 Kudos
Reply