efuse: tl1: add efuse burning support [1/1]
authorZhongfu Luo <zhongfu.luo@amlogic.com>
Tue, 20 Nov 2018 02:58:48 +0000 (10:58 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Mon, 26 Nov 2018 11:45:27 +0000 (03:45 -0800)
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>
arch/arm/boot/dts/amlogic/mesontl1.dtsi
arch/arm/boot/dts/amlogic/tl1_pxp.dts
arch/arm/boot/dts/amlogic/tl1_t962x2_skt.dts
arch/arm/boot/dts/amlogic/tl1_t962x2_x301.dts
drivers/amlogic/efuse/Makefile
drivers/amlogic/efuse/efuse.h
drivers/amlogic/efuse/efuse64.c
drivers/amlogic/efuse/efuse_hw64.c
include/linux/amlogic/efuse.h

index abd31eb..06fdbbf 100644 (file)
                reg_base = <0xff638800>;
                interrupts = <GIC_SPI 51 IRQ_TYPE_EDGE_RISING>;
        };
+
+       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 {
index 59576f7..b190a1d 100644 (file)
        status = "okay";
 };
 
+&efuse {
+       status = "okay";
+};
index c335071..7b5babf 100644 (file)
 &pwm_ab {
        status = "okay";
 };
+
+&efuse {
+       status = "okay";
+};
index d37d00c..05ddaa2 100644 (file)
 &pwm_ab {
        status = "okay";
 };
+
+&efuse {
+       status = "okay";
+};
index 05b5b7b..dc54b67 100644 (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
\ No newline at end of file
index 4642dc3..858d6a5 100644 (file)
@@ -89,20 +89,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
index 2aa02ff..2b913a4 100644 (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
 
index 6da11f4..c5953c9 100644 (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;
index 4e51fd6..b8f34f9 100644 (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;