kernel/0388-WIN2030-16891-fix-llc-drv-add-set-npu-default-voltag.patch
2025-02-27 20:57:56 -05:00

103 lines
3.8 KiB
Diff

From a94e1b73cfc1c71bff523ffe3cbb57f8f7cd81a6 Mon Sep 17 00:00:00 2001
From: donghuawei <donghuawei@eswincomputing.com>
Date: Fri, 27 Dec 2024 09:46:44 +0800
Subject: [PATCH 388/416] WIN2030-16891:fix:llc drv add set npu default voltage
Changelogs:
llc driver add set npu default voltage operation
Change-Id: Id0ce25876087cfbdeb79388731ef1b3fbe5c8ffe
Signed-off-by: donghuawei <donghuawei@eswincomputing.com>
---
drivers/memory/eswin/codacache/llc_spram.c | 22 ++++++++++++++++++++--
drivers/memory/eswin/codacache/llc_spram.h | 20 +++++++++++++++++++-
2 files changed, 39 insertions(+), 3 deletions(-)
diff --git a/drivers/memory/eswin/codacache/llc_spram.c b/drivers/memory/eswin/codacache/llc_spram.c
index 8ef878c0abef..101be38bbbfc 100644
--- a/drivers/memory/eswin/codacache/llc_spram.c
+++ b/drivers/memory/eswin/codacache/llc_spram.c
@@ -1,7 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* ESWIN LLC_SPRAM on-chip SRAM allocation driver
- * Copyright 2023, Beijing ESWIN Computing Technology Co., Ltd.. All rights reserved.
- * SPDX-License-Identifier: GPL-2.0-only
+ *
+ * Copyright 2024, Beijing ESWIN Computing Technology Co., Ltd.. All rights reserved.
+ * SPDX-License-Identifier: GPL-2.0
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -14,6 +16,10 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * Authors: Min Lin <linmin@eswincomputing.com>
+ * Huawei Dong <donghuawei@eswincomputing.com>
+ * Wei Yang <yangwei1@eswincomputing.com>
*/
#include <linux/clk.h>
@@ -784,14 +790,26 @@ static int llc_clk_set_parent(struct platform_device *pdev)
}
if (0 == spram->is_low_freq)
{
+ ret = regulator_set_voltage(spram->npu_regulator, NPU_1P5G_VOLTAGE, NPU_1P5G_VOLTAGE);
+ if (0 != ret) {
+ dev_err(dev, "set volt:%duV ret:%d.\n", NPU_1P5G_VOLTAGE, ret);
+ return -EINVAL;
+ }
+ mdelay(10);
ret = clk_set_parent(spram->mux_u_npu_core_3mux1_gfree,
spram->fixed_rate_clk_spll1_fout1);
}
else
{
+ if (((NULL != spram->npu_regulator)) && (!IS_ERR(spram->npu_regulator))) {
+ regulator_set_voltage(spram->npu_regulator, NPU_DEFAULT_VOLTAGE, NPU_DEFAULT_VOLTAGE);
+ dev_dbg(dev, "name:%s, volt:%d, ret:%d\n", pdev->name, NPU_DEFAULT_VOLTAGE, ret);
+ mdelay(10);
+ }
ret = clk_set_parent(spram->mux_u_npu_core_3mux1_gfree,
spram->fixed_rate_clk_spll2_fout2);
}
+
if (ret)
{
dev_err(&pdev->dev, "failed to set mux_u_npu_core_3mux1_gfree parent: %d\n",
diff --git a/drivers/memory/eswin/codacache/llc_spram.h b/drivers/memory/eswin/codacache/llc_spram.h
index 44863a70efbd..de54d3ba6a7f 100644
--- a/drivers/memory/eswin/codacache/llc_spram.h
+++ b/drivers/memory/eswin/codacache/llc_spram.h
@@ -1,6 +1,24 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
+// SPDX-License-Identifier: GPL-2.0
/*
* Defines for the LLC SPRAM driver
+ *
+ * Copyright 2024, Beijing ESWIN Computing Technology Co., Ltd.. All rights reserved.
+ * SPDX-License-Identifier: GPL-2.0
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * Authors: Min Lin <linmin@eswincomputing.com>
+ * Huawei Dong <donghuawei@eswincomputing.com>
*/
#ifndef __LLC_SPRAM_H
--
2.47.0