#include <mach/sram.h>
#include <mach/ddr.h>
+#include <plat/efuse.h>
+
typedef uint32_t uint32;
//#define ENABLE_DDR_CLCOK_GPLL_PATH //for RK3188
static bool ddr_dpll_status = true;
#if defined(CONFIG_ARCH_RK3188)
-extern int efuse_readregs(u32 addr, u32 length, u8 *pData);
void ddr_get_dpll_status(void) //DPLL fial rerurn 0;DPLL good return 1;
{
- uint8_t data_buf[32 + 1];
- efuse_readregs(0, 32, data_buf);
-
- if (data_buf[22] & 0x2)
+ if (rk_pll_flag() & 0x2)
ddr_dpll_status = false;
else
ddr_dpll_status = true;
clock_set_max_div(&clk_saradc);
}
-/************************************for cpll runing checking****************************************/
static u8 pll_flag = 0;
-static int pll_get_flag(void)
-{
- u8 data_buf[32 + 1];
- efuse_readregs(0, 32, data_buf);
-
- printk("pll_flag = 0x%02x\n", data_buf[22]);
- return data_buf[22] & 0x3;
-}
static void __init rk30_clock_common_init(unsigned long gpll_rate, unsigned long cpll_rate)
{
general_pll_clk.set_rate = plus_gpll_clk_set_rate;
}
- pll_flag = pll_get_flag();
+ rk_efuse_init();
+ pll_flag = rk_pll_flag();
+ printk("CLKDATA_MSG: pll_flag = 0x%02x\n", pll_flag);
+
if (0 != pll_flag) {
CLKDATA_DBG("CPLL=%lu, GPLL=%lu;CPLL CAN NOT LOCK, SET CPLL BY PASS, USE GPLL REPLACE CPLL\n",
cpll, gpll);
#include <linux/spinlock.h>
#include <plat/efuse.h>
-/* eFuse controller register */
-#define EFUSE_A_SHIFT (6)
-#define EFUSE_A_MASK (0xFF)
-//#define EFUSE_PD (1 << 5)
-//#define EFUSE_PS (1 << 4)
-#define EFUSE_PGENB (1 << 3) //active low
-#define EFUSE_LOAD (1 << 2)
-#define EFUSE_STROBE (1 << 1)
-#define EFUSE_CSB (1 << 0) //active low
-
-#define REG_EFUSE_CTRL (0x0000)
-#define REG_EFUSE_DOUT (0x0004)
-
#if defined(CONFIG_ARCH_RK3188)
#define efuse_readl(offset) readl_relaxed(RK30_EFUSE_BASE + offset)
#define efuse_writel(val, offset) writel_relaxed(val, RK30_EFUSE_BASE + offset)
#endif
-int efuse_readregs(u32 addr, u32 length, u8 *buf)
+u8 efuse_buf[32 + 1] = {0, 0};
+
+static int efuse_readregs(u32 addr, u32 length, u8 *buf)
{
#ifndef efuse_readl
return 0;
return ret;
#endif
}
+
+void rk_efuse_init(void)
+{
+ efuse_readregs(0x0, 32, efuse_buf);
+}
+
+int rk_pll_flag(void)
+{
+ return efuse_buf[22] & 0x3;
+}
+
+int rk_leakage_val(void)
+{
+ return (efuse_buf[22] >> 4) & 0x0f;
+}
#include <asm/types.h>
-/* On success, the number of bytes read is returned */
-int efuse_readregs(u32 addr, u32 length, u8 *buf);
+/* eFuse controller register */
+#define EFUSE_A_SHIFT (6)
+#define EFUSE_A_MASK (0xFF)
+//#define EFUSE_PD (1 << 5)
+//#define EFUSE_PS (1 << 4)
+#define EFUSE_PGENB (1 << 3) //active low
+#define EFUSE_LOAD (1 << 2)
+#define EFUSE_STROBE (1 << 1)
+#define EFUSE_CSB (1 << 0) //active low
+
+#define REG_EFUSE_CTRL (0x0000)
+#define REG_EFUSE_DOUT (0x0004)
+
+/* Interfaces to get efuse informations */
+void rk_efuse_init(void);
+int rk_pll_flag(void);
+int rk_leakage_val(void);
#endif