diff options
author | Daniel Golle <daniel@makrotopia.org> | 2022-09-14 02:15:32 +0100 |
---|---|---|
committer | Daniel Golle <daniel@makrotopia.org> | 2022-09-30 13:29:58 +0100 |
commit | 243a2184f25b927685757962bb311c682bbfabc3 (patch) | |
tree | 4f77abafcbbd05bdf1d299e213d3d8e56c058587 /target | |
parent | c7c7905bceef8530c4f060ba5dc02f19dd54302d (diff) | |
download | upstream-243a2184f25b927685757962bb311c682bbfabc3.tar.gz upstream-243a2184f25b927685757962bb311c682bbfabc3.tar.bz2 upstream-243a2184f25b927685757962bb311c682bbfabc3.zip |
mediatek: add patch allowing 1-byte wide access to efuse
Allow byte-wise access to mtk-efuse as some drivers require that.
Patch imported from mtk-openwrt-feeds (MTK SDK).
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'target')
-rw-r--r-- | target/linux/mediatek/patches-5.15/815-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/target/linux/mediatek/patches-5.15/815-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch b/target/linux/mediatek/patches-5.15/815-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch new file mode 100644 index 0000000000..e57f742fc8 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/815-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch @@ -0,0 +1,46 @@ +From 44ae4ed142265a6d50a9d3e6f4c395f97b6849ab Mon Sep 17 00:00:00 2001 +From: Zhanyong Wang <zhanyong.wang@mediatek.com> +Date: Sat, 6 Nov 2021 20:06:30 +0800 +Subject: [PATCH 2/5] nvmem: mtk-efuse: support minimum one byte access stride + and granularity + +In order to support nvmem bits property, should support minimum 1 byte +read stride and minimum 1 byte read granularity at the same time. + +Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> +Signed-off-by: Zhanyong Wang <zhanyong.wang@mediatek.com> +Change-Id: Iafe1ebf195d58a3e9e3518913f795d14a01dfd3b +--- + drivers/nvmem/mtk-efuse.c | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +--- a/drivers/nvmem/mtk-efuse.c ++++ b/drivers/nvmem/mtk-efuse.c +@@ -19,11 +19,12 @@ static int mtk_reg_read(void *context, + unsigned int reg, void *_val, size_t bytes) + { + struct mtk_efuse_priv *priv = context; +- u32 *val = _val; +- int i = 0, words = bytes / 4; ++ void __iomem *addr = priv->base + reg; ++ u8 *val = _val; ++ int i; + +- while (words--) +- *val++ = readl(priv->base + reg + (i++ * 4)); ++ for (i = 0; i < bytes; i++, val++) ++ *val = readb(addr + i); + + return 0; + } +@@ -45,8 +46,8 @@ static int mtk_efuse_probe(struct platfo + if (IS_ERR(priv->base)) + return PTR_ERR(priv->base); + +- econfig.stride = 4; +- econfig.word_size = 4; ++ econfig.stride = 1; ++ econfig.word_size = 1; + econfig.reg_read = mtk_reg_read; + econfig.size = resource_size(res); + econfig.priv = priv; |