How do I enable the use of external 32KHz oscillator for RTC functionality?

There are 3 use case scenarios for RTC functionality. They are the RTC-only mode which allows all the power supplies except for the RTC to be turned off to save power, RTC timer functionality mode in which the Real Time clocking features are used and RTC disabled mode in which RTC features are not used. Use of RTC requires both software and hardware setups. The hardware requirements of various RTC configurations are shown below and described in detail in the AM335x schematic checklist. Note that RTC-Only mode is not supported by the OSD335x family of devices because of the version of the PMIC (TPS65217C) used to power AM335x.

Pin Function RTC timer functionality but no RTC-only mode RTC feature disabled
CAP_VDD_RTC RTC core voltage input No Connect VDD_CORE
RTC_KALDO_ENn Internal LDO enable input Pulled down to VSS Pulled up to SYS_RTC_1P8V
RTC_PWRONRSTn RTC Power On Reset input PMIC_OUT_LDO_PGOOD VSS
PMIC_POWER_EN PMIC power enable output PMIC_IN_PWR_EN No Connect
EXT_WAKEUP External wakeup input PMIC_OUT_NWAKEUP VSS

While there are Linux drivers available for the RTC, the following steps describe the low-level software procedure to enable use of an external 32Khz oscillator for RTC clock input.

Begin with writing the KICK registers to disable write protect to RTC registers.

  1. Write the value 0x83E70B13 to KICK0R (0x44E3E06C) register.
  2. Write the value 0x95A4F1E0 to KICK1R (0x44E3E070) register.

RTC_OSC_REG (0x44E3E054) register needs to be modified to enable external oscillator clock input. Set RTC_OSC_REG[4] to 1 to select external 32KHz oscillator as clock source and RTC_OSC_REG[6] to enable clock mux of RTC. Note that 0 at RTC_OSC_REG[2] enables the use of internal feedback resistor instead of an external one.

  1. Write the value 0x48 to RTC_OSC_REG (0x44E3E054).

The procedure can be verified by either probing the output of the 32KHz (OSC1) oscillator or probing the XDMA_EVENT_INTR1 signal selecting OSC1 as its clock source.