From e9e632a177249ee21389281d1b0a634472e98358 Mon Sep 17 00:00:00 2001 From: Meena Pasumarthi Date: Fri, 8 Mar 2024 17:58:13 +0530 Subject: [PATCH] nvmem: qfprom: Add keepout regions and Enable qfprom support 1. Add void memory spaces from qfprom registers of niobe. 2. Enable qfprom sysfs for pitti to access nvmen-cells from userspace. Change-Id: Ib16d49bfd749c368d4b10bd185bdbe5e7c97952f Signed-off-by: Meena Pasumarthi --- arch/arm64/configs/vendor/niobe_GKI.config | 2 +- drivers/nvmem/qfprom.c | 32 ++++++++++++++++++++-- niobe.bzl | 1 + 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/arch/arm64/configs/vendor/niobe_GKI.config b/arch/arm64/configs/vendor/niobe_GKI.config index ea4bfe906ac3..3f87e36fcb4b 100644 --- a/arch/arm64/configs/vendor/niobe_GKI.config +++ b/arch/arm64/configs/vendor/niobe_GKI.config @@ -140,7 +140,7 @@ CONFIG_QCOM_PIL_INFO=m CONFIG_QCOM_PMU_LIB=m CONFIG_QCOM_Q6V5_COMMON=m CONFIG_QCOM_Q6V5_PAS=m -# CONFIG_QCOM_QFPROM_SYS is not set +CONFIG_QCOM_QFPROM_SYS=m CONFIG_QCOM_QMI_HELPERS=m CONFIG_QCOM_RAMDUMP=m CONFIG_QCOM_RPMH=m diff --git a/drivers/nvmem/qfprom.c b/drivers/nvmem/qfprom.c index b1d3e9a1a245..260f18b56593 100644 --- a/drivers/nvmem/qfprom.c +++ b/drivers/nvmem/qfprom.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (C) 2015 Srinivas Kandagatla - * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -175,6 +175,34 @@ static const struct qfprom_soc_compatible_data pitti_qfprom = { .nkeepout = ARRAY_SIZE(pitti_qfprom_keepout) }; +static const struct nvmem_keepout niobe_qfprom_keepout[] = { + {.start = 0x20, .end = 0x24}, + {.start = 0x28, .end = 0x30}, + {.start = 0x34, .end = 0x40}, + {.start = 0x58, .end = 0x60}, + {.start = 0x68, .end = 0x70}, + {.start = 0x78, .end = 0x80}, + {.start = 0x90, .end = 0x100}, + {.start = 0x150, .end = 0x200}, + {.start = 0x238, .end = 0x300}, + {.start = 0x328, .end = 0x400}, + {.start = 0x4a8, .end = 0x500}, + {.start = 0x550, .end = 0x600}, + {.start = 0x608, .end = 0x610}, + {.start = 0x618, .end = 0x630}, + {.start = 0x638, .end = 0x700}, + {.start = 0x738, .end = 0x73c}, + {.start = 0x748, .end = 0x770}, + {.start = 0x898, .end = 0xa00}, + {.start = 0xa50, .end = 0xb00}, + {.start = 0xb04, .end = 0xb10}, + {.start = 0xcc0, .end = 0x1000}, +}; + +static const struct qfprom_soc_compatible_data niobe_qfprom = { + .keepout = niobe_qfprom_keepout, + .nkeepout = ARRAY_SIZE(niobe_qfprom_keepout) +}; /** * qfprom_disable_fuse_blowing() - Undo enabling of fuse blowing. @@ -432,7 +460,6 @@ static int qfprom_probe(struct platform_device *pdev) const struct qfprom_soc_compatible_data *soc_data; struct qfprom_priv *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; @@ -519,6 +546,7 @@ static const struct of_device_id qfprom_of_match[] = { { .compatible = "qcom,sc7280-qfprom", .data = &sc7280_qfprom}, { .compatible = "qcom,cliffs-qfprom", .data = &cliffs_qfprom}, { .compatible = "qcom,pitti-qfprom", .data = &pitti_qfprom}, + { .compatible = "qcom,niobe-qfprom", .data = &niobe_qfprom}, {/* sentinel */}, }; MODULE_DEVICE_TABLE(of, qfprom_of_match); diff --git a/niobe.bzl b/niobe.bzl index 0f005a24cc18..10dc96e5db45 100644 --- a/niobe.bzl +++ b/niobe.bzl @@ -147,6 +147,7 @@ def define_niobe(): "drivers/soc/qcom/qcom_ramdump.ko", "drivers/soc/qcom/qcom_rpmh.ko", "drivers/soc/qcom/qcom_wdt_core.ko", + "drivers/soc/qcom/qfprom-sys.ko", "drivers/soc/qcom/qmi_helpers.ko", "drivers/soc/qcom/qti_battery_debug.ko", "drivers/soc/qcom/secure_buffer.ko",