From 43e0dc775ef9709704831c01fbe88e212cd68b61 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E9=BB=84=E6=B6=9B?= Date: Mon, 6 May 2013 13:07:23 +0800 Subject: [PATCH] rk: efuse: efuse_readregs return the number of bytes read when success --- arch/arm/plat-rk/efuse.c | 13 ++++++++----- arch/arm/plat-rk/include/plat/efuse.h | 3 ++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/arch/arm/plat-rk/efuse.c b/arch/arm/plat-rk/efuse.c index a5ce5dbd91a2..57c24df0897d 100644 --- a/arch/arm/plat-rk/efuse.c +++ b/arch/arm/plat-rk/efuse.c @@ -30,11 +30,14 @@ #define efuse_writel(val, offset) writel_relaxed(val, RK30_EFUSE_BASE + offset) #endif -int efuse_readregs(u32 addr, u32 length, u8 *pData) +int efuse_readregs(u32 addr, u32 length, u8 *buf) { -#ifdef efuse_readl +#ifndef efuse_readl + return 0; +#else unsigned long flags; static DEFINE_SPINLOCK(efuse_lock); + int ret = length; if (!length) return 0; @@ -50,10 +53,10 @@ int efuse_readregs(u32 addr, u32 length, u8 *pData) udelay(2); efuse_writel(efuse_readl(REG_EFUSE_CTRL) | EFUSE_STROBE, REG_EFUSE_CTRL); udelay(2); - *pData = efuse_readl(REG_EFUSE_DOUT); + *buf = efuse_readl(REG_EFUSE_DOUT); efuse_writel(efuse_readl(REG_EFUSE_CTRL) & (~EFUSE_STROBE), REG_EFUSE_CTRL); udelay(2); - pData++; + buf++; addr++; } while(--length); udelay(2); @@ -61,6 +64,6 @@ int efuse_readregs(u32 addr, u32 length, u8 *pData) udelay(1); spin_unlock_irqrestore(&efuse_lock, flags); + return ret; #endif - return 0; } diff --git a/arch/arm/plat-rk/include/plat/efuse.h b/arch/arm/plat-rk/include/plat/efuse.h index 68f409b01bba..44056f846760 100644 --- a/arch/arm/plat-rk/include/plat/efuse.h +++ b/arch/arm/plat-rk/include/plat/efuse.h @@ -3,6 +3,7 @@ #include -int efuse_readregs(u32 addr, u32 length, u8 *pData); +/* On success, the number of bytes read is returned */ +int efuse_readregs(u32 addr, u32 length, u8 *buf); #endif -- 2.34.1