Mainline:Broadcom Kona/BCM590xx/RTC
Appearance
The RTC is located at register 0xe0 on the BCM59054/BCM59056.
Time data
The RTC stores the time in the following format:
| Offset | Purpose | Value |
|---|---|---|
| 0 | Second | Current second, from 0 to 59. |
| 1 | Minute | Current minute of the hour, from 0 to 59. |
| 2 | Hour | Current hour of the day, from 0 to 23. |
| 3 | Day of month | Day of month, starting from 0. |
| 4 | Month | Number of the month. Sets itself to 0 on reset; 1 to 12 represent January-December. ...or does it? The downstream driver would suggest so, but it seems weird. Investigate. |
| 5 | Year | Amount of years since 2000 (0 = 2000, 1 = 2001, etc.) |
Calibration
Downstream driver: drivers/char/broadcom/rtc_cal/bcm_rtc_cal.c
There are three calibration registers: CALIB1, CALIB2 and CALIB3.
| TODO | TODO: Figure out how the calibration process works, this is just my initial idea |
Calibration appears to be triggered based on a CP (communications processor) event; it receives a message from the CP and uses a value from it as the "ratio". The ratio value is then compared against RTCCAL_Ratio (taken from rtccal_data.nom_ratio, 8666667); if ratio > RTCCAL_Ratio, then direction is 1, otherwise it's 0.
The clk_val value is then calculated based on the difference between the new and old ratio (diff = abs(ratio - RTCCAL_Ratio)): clk_val = RTCCAL_Ratio / diff.
TODO - what is the ratio value?
CALIB1 (0xF4)
| Name | Bit | Description |
|---|---|---|
clk_val (1)
|
7:0 | Lower 8 bits of the calibration offset. |
CALIB2 (0xF5)
| Name | Bit | Description |
|---|---|---|
clk_val (2)
|
7:0 | Upper 8 bits of the calibration offset. |
CALIB3 (0xF6)
| Name | Bit | Description |
|---|---|---|
???
|
7 | Set to 1 during calibration. |
direction
|
6 | |
| Unknown/reserved | 5:0 | Unknown/reserved. |