![]() |
coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
|
#include <assert.h>
#include <commonlib/bsd/bcd.h>
#include <console/console.h>
#include <delay.h>
#include <device/i2c_simple.h>
#include <rtc.h>
#include <soc/rk808.h>
#include <stdint.h>
Go to the source code of this file.
Macros | |
#define | RK808_ADDR 0x1b |
#define | DCDC_EN 0x23 |
#define | LDO_EN 0x24 |
#define | BUCK1SEL 0x2f |
#define | BUCK4SEL 0x38 |
#define | LDO_ONSEL(i) (0x39 + 2 * i) |
#define | LDO_SLPSEL(i) (0x3a + 2 * i) |
#define | RTC_SECOND 0x00 |
#define | RTC_MINUTE 0x01 |
#define | RTC_HOUR 0x02 |
#define | RTC_DAY 0x03 |
#define | RTC_MONTH 0x04 |
#define | RTC_YEAR 0x05 |
#define | RTC_WEEKS 0x06 |
#define | RTC_CTRL 0x10 |
#define | RTC_STATUS 0x11 |
#define | RTC_CTRL_STOP_RTC (1 << 0) |
#define | RTC_CTRL_GET_TIME (1 << 6) |
#define | RTC_CTRL_RTC_READSEL (1 << 7) |
#define | DCDC_UV_ACT 0x28 |
#define | DCDC_ILMAX 0x90 |
Functions | |
static int | rk808_read (uint8_t reg, uint8_t *value) |
static int | rk808_write (uint8_t reg, uint8_t value) |
static void | rk808_clrsetbits (uint8_t reg, uint8_t clr, uint8_t set) |
void | rk808_configure_switch (int sw, int enabled) |
void | rk808_configure_ldo (int ldo, int millivolts) |
void | rk808_configure_buck (int buck, int millivolts) |
static void | rk808rtc_stop (void) |
static void | rk808rtc_start (void) |
int | rtc_set (const struct rtc_time *time) |
int | rtc_get (struct rtc_time *time) |
Definition at line 52 of file rk808.c.
References BIOS_ERR, printk, rk808_read(), rk808_write(), and value.
Referenced by rk808_configure_buck(), rk808_configure_ldo(), rk808_configure_switch(), rk808rtc_start(), rk808rtc_stop(), and rtc_get().
void rk808_configure_buck | ( | int | buck, |
int | millivolts | ||
) |
Definition at line 98 of file rk808.c.
References assert, BUCK1SEL, BUCK4SEL, DCDC_EN, DCDC_ILMAX, DCDC_UV_ACT, die(), DIV_ROUND_UP, and rk808_clrsetbits().
Referenced by bootblock_mainboard_init(), and mainboard_init().
void rk808_configure_ldo | ( | int | ldo, |
int | millivolts | ||
) |
Definition at line 66 of file rk808.c.
References assert, die(), DIV_ROUND_UP, LDO_EN, LDO_ONSEL, and rk808_clrsetbits().
Referenced by configure_codec(), configure_sdmmc(), configure_vop(), and sdmmc_power_off().
void rk808_configure_switch | ( | int | sw, |
int | enabled | ||
) |
Definition at line 60 of file rk808.c.
References assert, DCDC_EN, and rk808_clrsetbits().
Referenced by configure_vop().
Definition at line 42 of file rk808.c.
References i2c_readb(), RK808_ADDR, and value.
Referenced by rk808_clrsetbits(), and rtc_get().
Definition at line 47 of file rk808.c.
References i2c_writeb(), RK808_ADDR, and value.
Referenced by rk808_clrsetbits(), and rtc_set().
Definition at line 133 of file rk808.c.
References rk808_clrsetbits(), RTC_CTRL, and RTC_CTRL_STOP_RTC.
Referenced by rtc_set().
Definition at line 128 of file rk808.c.
References rk808_clrsetbits(), RTC_CTRL, and RTC_CTRL_STOP_RTC.
Referenced by rtc_set().
int rtc_get | ( | struct rtc_time * | time | ) |
Definition at line 156 of file rk808.c.
References bcd2bin(), rtc_time::hour, rtc_time::mday, rtc_time::min, rtc_time::mon, rk808_clrsetbits(), rk808_read(), RTC_CTRL, RTC_CTRL_GET_TIME, RTC_CTRL_RTC_READSEL, RTC_DAY, RTC_HOUR, RTC_MINUTE, RTC_MONTH, RTC_SECOND, RTC_YEAR, rtc_time::sec, udelay(), value, rtc_time::wday, and rtc_time::year.
int rtc_set | ( | const struct rtc_time * | time | ) |
Definition at line 138 of file rk808.c.
References bin2bcd(), rtc_time::hour, rtc_time::mday, rtc_time::min, rtc_time::mon, rk808_write(), rk808rtc_start(), rk808rtc_stop(), RTC_DAY, RTC_HOUR, RTC_MINUTE, RTC_MONTH, RTC_SECOND, RTC_YEAR, rtc_time::sec, and rtc_time::year.