diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-09-23 12:04:58 +1000 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-10-11 16:48:45 +1100 |
commit | 46d319e5d8c8add09378a67e27237504d0132283 (patch) | |
tree | 19c307758b75983852534add2543e854879e0db4 | |
parent | c681b93c1fd016e94c8f3dd948dcc28a78790df7 (diff) | |
download | op-kernel-dev-46d319e5d8c8add09378a67e27237504d0132283.zip op-kernel-dev-46d319e5d8c8add09378a67e27237504d0132283.tar.gz |
powerpc/powernv: Fix endian issues in OPAL RTC driver
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | arch/powerpc/platforms/powernv/opal-rtc.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/powernv/opal-rtc.c b/arch/powerpc/platforms/powernv/opal-rtc.c index 2aa7641..dbfdba3 100644 --- a/arch/powerpc/platforms/powernv/opal-rtc.c +++ b/arch/powerpc/platforms/powernv/opal-rtc.c @@ -48,6 +48,8 @@ unsigned long __init opal_get_boot_time(void) } if (rc != OPAL_SUCCESS) return 0; + y_m_d = be32_to_cpu(y_m_d); + h_m_s_ms = be64_to_cpu(h_m_s_ms); opal_to_tm(y_m_d, h_m_s_ms, &tm); return mktime(tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); @@ -68,6 +70,8 @@ void opal_get_rtc_time(struct rtc_time *tm) } if (rc != OPAL_SUCCESS) return; + y_m_d = be32_to_cpu(y_m_d); + h_m_s_ms = be64_to_cpu(h_m_s_ms); opal_to_tm(y_m_d, h_m_s_ms, tm); } @@ -86,6 +90,9 @@ int opal_set_rtc_time(struct rtc_time *tm) h_m_s_ms |= ((u64)bin2bcd(tm->tm_min)) << 48; h_m_s_ms |= ((u64)bin2bcd(tm->tm_sec)) << 40; + y_m_d = cpu_to_be32(y_m_d); + h_m_s_ms = cpu_to_be64(h_m_s_ms); + while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) { rc = opal_rtc_write(y_m_d, h_m_s_ms); if (rc == OPAL_BUSY_EVENT) |