summaryrefslogtreecommitdiff
path: root/drivers/rtc
diff options
context:
space:
mode:
authorƁukasz Majewski <l.majewski@samsung.com>2012-11-13 03:21:55 +0000
committerAnatolij Gustschin <agust@denx.de>2012-11-14 11:21:09 +0100
commitc7336815078ff3745e3130aeff35991e3e98e61e (patch)
tree8ace1a85705cbd5b6484a45fefd093161a7a5b05 /drivers/rtc
parent452329f1d57fe7cbc54e65617e84d5bb1f93f631 (diff)
downloadu-boot-imx-c7336815078ff3745e3130aeff35991e3e98e61e.zip
u-boot-imx-c7336815078ff3745e3130aeff35991e3e98e61e.tar.gz
u-boot-imx-c7336815078ff3745e3130aeff35991e3e98e61e.tar.bz2
pmic: Extend PMIC framework to support multiple instances of PMIC devices
The PMIC framework has been extended to support multiple instances of the variety of devices responsible for power management. This change allows supporting of e.g. fuel gauge, charger, MUIC (Micro USB Interface Circuit). Power related includes have been moved to ./include/power directory. This is a first of a series of patches - in the future "pmic" will be replaced with "power". Two important issues: 1. The PMIC needs to be initialized just after malloc is configured 2. It uses list to hold information about available PMIC devices Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Cc: Stefano Babic <sbabic@denx.de>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/mc13xxx-rtc.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/rtc/mc13xxx-rtc.c b/drivers/rtc/mc13xxx-rtc.c
index 70ea8a1..e79f462 100644
--- a/drivers/rtc/mc13xxx-rtc.c
+++ b/drivers/rtc/mc13xxx-rtc.c
@@ -23,16 +23,18 @@
#include <common.h>
#include <rtc.h>
#include <spi.h>
-#include <pmic.h>
+#include <power/pmic.h>
#include <fsl_pmic.h>
int rtc_get(struct rtc_time *rtc)
{
u32 day1, day2, time;
int tim, i = 0;
- struct pmic *p = get_pmic();
+ struct pmic *p = pmic_get("FSL_PMIC");
int ret;
+ if (!p)
+ return -1;
do {
ret = pmic_reg_read(p, REG_RTC_DAY, &day1);
if (ret < 0)
@@ -61,7 +63,9 @@ int rtc_get(struct rtc_time *rtc)
int rtc_set(struct rtc_time *rtc)
{
u32 time, day;
- struct pmic *p = get_pmic();
+ struct pmic *p = pmic_get("FSL_PMIC");
+ if (!p)
+ return -1;
time = mktime(rtc->tm_year, rtc->tm_mon, rtc->tm_mday,
rtc->tm_hour, rtc->tm_min, rtc->tm_sec);