efuse: tl1: add efuse burning support [1/1]

PD#172587

Problem:
efuse: tl1: need to add efuse burning support

Solution:
efuse: tl1: add efuse burning support

Verify:
TL1 skt board verify pass

Change-Id: Id65f182c71fc6f3f2b2536bbb6b859ad2f558360
Signed-off-by: Zhongfu Luo <zhongfu.luo@amlogic.com>
This commit is contained in:
Zhongfu Luo
2018-11-20 10:58:48 +08:00
committed by Luke Go
parent 3b0c4a5026
commit fc11723850
8 changed files with 73 additions and 20 deletions

View File

@@ -1663,7 +1663,46 @@
cpu_ver_name {
compatible = "amlogic, cpu-major-id-sm1";
};
};/* end of / */
efuse: efuse{
compatible = "amlogic, efuse";
read_cmd = <0x82000030>;
write_cmd = <0x82000031>;
get_max_cmd = <0x82000033>;
key = <&efusekey>;
clocks = <&clkc CLKID_EFUSE>;
clock-names = "efuse_clk";
status = "disabled";
};
efusekey:efusekey{
keynum = <4>;
key0 = <&key_0>;
key1 = <&key_1>;
key2 = <&key_2>;
key3 = <&key_3>;
key_0:key_0{
keyname = "mac";
offset = <0>;
size = <6>;
};
key_1:key_1{
keyname = "mac_bt";
offset = <6>;
size = <6>;
};
key_2:key_2{
keyname = "mac_wifi";
offset = <12>;
size = <6>;
};
key_3:key_3{
keyname = "usid";
offset = <18>;
size = <16>;
};
};
}; /* end of / */
&pinctrl_aobus {
sd_to_ao_uart_clr_pins:sd_to_ao_uart_clr_pins {

View File

@@ -887,3 +887,11 @@
mem_alloc = <1>;
pxp_mode = <1>; /** 0:normal mode 1:pxp mode */
};
&pwm_AO_cd {
status = "okay";
};
&efuse {
status = "okay";
};

View File

@@ -1514,3 +1514,7 @@
&efuse {
status = "okay";
};
&efuse {
status = "okay";
};

View File

@@ -3,7 +3,11 @@
#
ifneq ($(CONFIG_ARM64),y)
obj-$(CONFIG_AMLOGIC_EFUSE) += efuse_version.o efuse_hw.o efuse.o
ifneq ($(CONFIG_ARM64_A32),y)
obj-$(CONFIG_AMLOGIC_EFUSE) += efuse_version.o efuse_hw.o efuse.o
else
obj-$(CONFIG_AMLOGIC_EFUSE) += efuse_hw64.o efuse64.o
endif
else
obj-$(CONFIG_AMLOGIC_EFUSE) += efuse_hw64.o efuse64.o
endif

View File

@@ -103,20 +103,18 @@ struct efuse_hal_api_arg {
};
extern struct efuseinfo_t efuseinfo[];
#ifndef CONFIG_ARM64
#if defined(CONFIG_ARM64) || defined(CONFIG_ARM64_A32)
ssize_t efuse_get_max(void);
ssize_t efuse_read_usr(char *buf, size_t count, loff_t *ppos);
ssize_t efuse_write_usr(char *buf, size_t count, loff_t *ppos);
unsigned long efuse_amlogic_set(char *buf, size_t count);
#else
int efuse_getinfo_byTitle(unsigned char *name, struct efuseinfo_item_t *info);
int check_if_efused(loff_t pos, size_t count);
int efuse_read_item(char *buf, size_t count, loff_t *ppos);
int efuse_write_item(char *buf, size_t count, loff_t *ppos);
extern int efuse_active_version;
extern struct clk *efuse_clk;
#else
ssize_t efuse_get_max(void);
ssize_t efuse_read_usr(char *buf, size_t count, loff_t *ppos);
ssize_t efuse_write_usr(char *buf, size_t count, loff_t *ppos);
unsigned long efuse_amlogic_set(char *buf, size_t count);
#endif
#endif

View File

@@ -30,7 +30,7 @@
#include <linux/amlogic/secmon.h>
#include "efuse.h"
#ifdef CONFIG_ARM64
#if defined(CONFIG_ARM64) || defined(CONFIG_ARM64_A32)
#include <linux/amlogic/efuse.h>
#endif

View File

@@ -33,7 +33,7 @@
#include <linux/arm-smccc.h>
#include <asm/cacheflush.h>
static long meson_efuse_fn_smc(struct efuse_hal_api_arg *arg)
static long meson64_efuse_fn_smc(struct efuse_hal_api_arg *arg)
{
long ret;
unsigned int cmd, offset, size;
@@ -71,7 +71,7 @@ static long meson_efuse_fn_smc(struct efuse_hal_api_arg *arg)
return 0;
}
int meson_trustzone_efuse(struct efuse_hal_api_arg *arg)
int meson64_trustzone_efuse(struct efuse_hal_api_arg *arg)
{
int ret;
@@ -79,7 +79,7 @@ int meson_trustzone_efuse(struct efuse_hal_api_arg *arg)
return -1;
set_cpus_allowed_ptr(current, cpumask_of(0));
ret = meson_efuse_fn_smc(arg);
ret = meson64_efuse_fn_smc(arg);
set_cpus_allowed_ptr(current, cpu_all_mask);
return ret;
}
@@ -101,7 +101,7 @@ unsigned long efuse_aml_sec_boot_check(unsigned long nType,
memcpy((void *)sharemem_input_base,
(const void *)pBuffer, nLength);
__flush_dcache_area(sharemem_input_base, nLength);
//__flush_dcache_area(sharemem_input_base, nLength);
asm __volatile__("" : : : "memory");
@@ -133,7 +133,7 @@ unsigned long efuse_amlogic_set(char *buf, size_t count)
return ret;
}
ssize_t meson_trustzone_efuse_get_max(struct efuse_hal_api_arg *arg)
ssize_t meson64_trustzone_efuse_get_max(struct efuse_hal_api_arg *arg)
{
ssize_t ret;
unsigned int cmd;
@@ -164,7 +164,7 @@ ssize_t efuse_get_max(void)
arg.cmd = EFUSE_HAL_API_USER_MAX;
set_cpus_allowed_ptr(current, cpumask_of(0));
ret = meson_trustzone_efuse_get_max(&arg);
ret = meson64_trustzone_efuse_get_max(&arg);
set_cpus_allowed_ptr(current, cpu_all_mask);
if (ret == 0) {
@@ -187,7 +187,7 @@ ssize_t _efuse_read(char *buf, size_t count, loff_t *ppos)
arg.size = count;
arg.buffer = (unsigned long)buf;
arg.retcnt = (unsigned long)&retcnt;
ret = meson_trustzone_efuse(&arg);
ret = meson64_trustzone_efuse(&arg);
if (ret == 0) {
*ppos += retcnt;
return retcnt;
@@ -211,7 +211,7 @@ ssize_t _efuse_write(const char *buf, size_t count, loff_t *ppos)
arg.buffer = (unsigned long)buf;
arg.retcnt = (unsigned long)&retcnt;
ret = meson_trustzone_efuse(&arg);
ret = meson64_trustzone_efuse(&arg);
if (ret == 0) {
*ppos = retcnt;
return retcnt;

View File

@@ -18,7 +18,7 @@
#ifndef __EFUSE_AMLOGIC_H
#define __EFUSE_AMLOGIC_H
#ifdef CONFIG_ARM64
#if defined(CONFIG_ARM64) || defined(CONFIG_ARM64_A32)
struct efusekey_info {
char keyname[32];
unsigned int offset;