coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
tps65913rtc.c File Reference
#include <commonlib/bsd/bcd.h>
#include <console/console.h>
#include <device/i2c_simple.h>
#include <rtc.h>
#include <stdint.h>
Include dependency graph for tps65913rtc.c:

Go to the source code of this file.

Enumerations

enum  TPS65913_RTC_REG {
  TPS65913_SECONDS_REG = 0x00 , TPS65913_MINUTES_REG = 0x01 , TPS65913_HOURS_REG = 0x02 , TPS65913_DAYS_REG = 0x03 ,
  TPS65913_MONTHS_REG = 0x04 , TPS65913_YEARS_REG = 0x05 , TPS65913_WEEKS_REG = 0x06 , TPS65913_RTC_CTRL_REG = 0x10 ,
  TPS65913_RTC_STATUS_REG = 0x11 , TPS65913_RTC_INTERRUPTS_REG = 0x12
}
 
enum  {
  TPS65913_RTC_CTRL_STOP = (1 << 0) , TPS65913_RTC_CTRL_GET_TIME = (1 << 6) , TPS65913_RTC_STATUS_RUN = (1 << 1) , TPS65913_RTC_RUNNING = (1 << 1) ,
  TPS65913_RTC_FROZEN = (0 << 1)
}
 

Functions

static uint8_t tps65913_read (enum TPS65913_RTC_REG reg)
 
static void tps65913_write (enum TPS65913_RTC_REG reg, uint8_t val)
 
static void tps65913_rtc_ctrl_clear (uint8_t bit)
 
static void tps65913_rtc_ctrl_set (uint8_t bit)
 
static int tps65913_is_rtc_running (void)
 
static void tps65913_rtc_shadow (void)
 
static int tps65913_rtc_stop (void)
 
static int tps65913_rtc_start (void)
 
int rtc_set (const struct rtc_time *time)
 
int rtc_get (struct rtc_time *time)
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
TPS65913_RTC_CTRL_STOP 
TPS65913_RTC_CTRL_GET_TIME 
TPS65913_RTC_STATUS_RUN 
TPS65913_RTC_RUNNING 
TPS65913_RTC_FROZEN 

Definition at line 22 of file tps65913rtc.c.

◆ TPS65913_RTC_REG

Enumerator
TPS65913_SECONDS_REG 
TPS65913_MINUTES_REG 
TPS65913_HOURS_REG 
TPS65913_DAYS_REG 
TPS65913_MONTHS_REG 
TPS65913_YEARS_REG 
TPS65913_WEEKS_REG 
TPS65913_RTC_CTRL_REG 
TPS65913_RTC_STATUS_REG 
TPS65913_RTC_INTERRUPTS_REG 

Definition at line 9 of file tps65913rtc.c.

Function Documentation

◆ rtc_get()

◆ rtc_set()

◆ tps65913_is_rtc_running()

static int tps65913_is_rtc_running ( void  )
static

Definition at line 61 of file tps65913rtc.c.

References tps65913_read(), TPS65913_RTC_RUNNING, TPS65913_RTC_STATUS_REG, and TPS65913_RTC_STATUS_RUN.

Referenced by tps65913_rtc_start(), and tps65913_rtc_stop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tps65913_read()

static uint8_t tps65913_read ( enum TPS65913_RTC_REG  reg)
inlinestatic

Definition at line 31 of file tps65913rtc.c.

References i2c_readb(), and val.

Referenced by rtc_get(), tps65913_is_rtc_running(), tps65913_rtc_ctrl_clear(), and tps65913_rtc_ctrl_set().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tps65913_rtc_ctrl_clear()

static void tps65913_rtc_ctrl_clear ( uint8_t  bit)
static

Definition at line 45 of file tps65913rtc.c.

References tps65913_read(), TPS65913_RTC_CTRL_REG, and tps65913_write().

Referenced by tps65913_rtc_shadow(), and tps65913_rtc_stop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tps65913_rtc_ctrl_set()

static void tps65913_rtc_ctrl_set ( uint8_t  bit)
static

Definition at line 53 of file tps65913rtc.c.

References tps65913_read(), TPS65913_RTC_CTRL_GET_TIME, TPS65913_RTC_CTRL_REG, and tps65913_write().

Referenced by tps65913_rtc_shadow(), and tps65913_rtc_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tps65913_rtc_shadow()

static void tps65913_rtc_shadow ( void  )
static

Definition at line 74 of file tps65913rtc.c.

References tps65913_rtc_ctrl_clear(), TPS65913_RTC_CTRL_GET_TIME, and tps65913_rtc_ctrl_set().

Referenced by rtc_get().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tps65913_rtc_start()

static int tps65913_rtc_start ( void  )
static

Definition at line 93 of file tps65913rtc.c.

References BIOS_ERR, printk, tps65913_is_rtc_running(), tps65913_rtc_ctrl_set(), and TPS65913_RTC_CTRL_STOP.

Referenced by rtc_set().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tps65913_rtc_stop()

static int tps65913_rtc_stop ( void  )
static

Definition at line 80 of file tps65913rtc.c.

References BIOS_ERR, printk, tps65913_is_rtc_running(), tps65913_rtc_ctrl_clear(), and TPS65913_RTC_CTRL_STOP.

Referenced by rtc_set().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tps65913_write()

static void tps65913_write ( enum TPS65913_RTC_REG  reg,
uint8_t  val 
)
inlinestatic

Definition at line 39 of file tps65913rtc.c.

References i2c_writeb(), and val.

Referenced by rtc_set(), tps65913_rtc_ctrl_clear(), and tps65913_rtc_ctrl_set().

Here is the call graph for this function:
Here is the caller graph for this function: