70 lines
2.4 KiB
Diff
70 lines
2.4 KiB
Diff
From 998f0633773b3432829fe45d2cd2ffb842f3c78e Mon Sep 17 00:00:00 2001
|
|
From: William-tw Lin <william-tw.lin@mediatek.com>
|
|
Date: Sat, 24 Feb 2024 11:45:07 +0000
|
|
Subject: [PATCH] nvmem: mtk-efuse: Register MediaTek socinfo driver from efuse
|
|
|
|
The socinfo driver reads chip information from eFuses and does not need
|
|
any devicetree node. Register it from mtk-efuse.
|
|
|
|
While at it, also add the name for this driver's nvmem_config.
|
|
|
|
Signed-off-by: William-tw Lin <william-tw.lin@mediatek.com>
|
|
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
|
|
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
|
Link: https://lore.kernel.org/r/20240224114516.86365-3-srinivas.kandagatla@linaro.org
|
|
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
|
---
|
|
drivers/nvmem/mtk-efuse.c | 21 ++++++++++++++++++++-
|
|
1 file changed, 20 insertions(+), 1 deletion(-)
|
|
|
|
--- a/drivers/nvmem/mtk-efuse.c
|
|
+++ b/drivers/nvmem/mtk-efuse.c
|
|
@@ -68,6 +68,7 @@ static int mtk_efuse_probe(struct platfo
|
|
struct nvmem_config econfig = {};
|
|
struct mtk_efuse_priv *priv;
|
|
const struct mtk_efuse_pdata *pdata;
|
|
+ struct platform_device *socinfo;
|
|
|
|
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
|
if (!priv)
|
|
@@ -85,11 +86,20 @@ static int mtk_efuse_probe(struct platfo
|
|
econfig.size = resource_size(res);
|
|
econfig.priv = priv;
|
|
econfig.dev = dev;
|
|
+ econfig.name = "mtk-efuse";
|
|
if (pdata->uses_post_processing)
|
|
econfig.fixup_dt_cell_info = &mtk_efuse_fixup_dt_cell_info;
|
|
nvmem = devm_nvmem_register(dev, &econfig);
|
|
+ if (IS_ERR(nvmem))
|
|
+ return PTR_ERR(nvmem);
|
|
|
|
- return PTR_ERR_OR_ZERO(nvmem);
|
|
+ socinfo = platform_device_register_data(&pdev->dev, "mtk-socinfo",
|
|
+ PLATFORM_DEVID_AUTO, NULL, 0);
|
|
+ if (IS_ERR(socinfo))
|
|
+ dev_info(dev, "MediaTek SoC Information will be unavailable\n");
|
|
+
|
|
+ platform_set_drvdata(pdev, socinfo);
|
|
+ return 0;
|
|
}
|
|
|
|
static const struct mtk_efuse_pdata mtk_mt8186_efuse_pdata = {
|
|
@@ -108,8 +118,17 @@ static const struct of_device_id mtk_efu
|
|
};
|
|
MODULE_DEVICE_TABLE(of, mtk_efuse_of_match);
|
|
|
|
+static void mtk_efuse_remove(struct platform_device *pdev)
|
|
+{
|
|
+ struct platform_device *socinfo = platform_get_drvdata(pdev);
|
|
+
|
|
+ if (!IS_ERR_OR_NULL(socinfo))
|
|
+ platform_device_unregister(socinfo);
|
|
+}
|
|
+
|
|
static struct platform_driver mtk_efuse_driver = {
|
|
.probe = mtk_efuse_probe,
|
|
+ .remove_new = mtk_efuse_remove,
|
|
.driver = {
|
|
.name = "mediatek,efuse",
|
|
.of_match_table = mtk_efuse_of_match,
|