2023-03-14 11:04:53 +00:00
|
|
|
From f292d1bf83ec160bef2532b58aa08f5b71041923 Mon Sep 17 00:00:00 2001
|
|
|
|
Message-Id: <f292d1bf83ec160bef2532b58aa08f5b71041923.1678716918.git.lorenzo@kernel.org>
|
|
|
|
In-Reply-To: <3cf212c4ce6cd72c09bc47f35f539ba0afd4d106.1678716918.git.lorenzo@kernel.org>
|
|
|
|
References: <3cf212c4ce6cd72c09bc47f35f539ba0afd4d106.1678716918.git.lorenzo@kernel.org>
|
|
|
|
From: Lorenzo Bianconi <lorenzo@kernel.org>
|
|
|
|
Date: Sat, 11 Mar 2023 18:13:04 +0100
|
|
|
|
Subject: [PATCH net-next 2/2] net: ethernet: mtk_wed: move cpuboot in a
|
|
|
|
dedicated dts node
|
|
|
|
|
|
|
|
Since the cpuboot memory region is not part of the RAM SoC, move cpuboot
|
|
|
|
in a deidicated syscon node.
|
|
|
|
This patch helps to keep backward-compatibility with older version of
|
|
|
|
uboot codebase where we have a limit of 8 reserved-memory dts child
|
|
|
|
nodes.
|
|
|
|
Keep backward-compatibility with older dts version where cpuboot was
|
|
|
|
defined as reserved-memory child node.
|
|
|
|
|
|
|
|
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
|
|
|
---
|
|
|
|
drivers/net/ethernet/mediatek/mtk_wed_mcu.c | 34 +++++++++++++++++----
|
|
|
|
drivers/net/ethernet/mediatek/mtk_wed_wo.h | 3 +-
|
|
|
|
2 files changed, 30 insertions(+), 7 deletions(-)
|
|
|
|
|
|
|
|
--- a/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
|
|
|
|
+++ b/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
|
2024-03-29 21:21:51 +00:00
|
|
|
@@ -34,12 +34,23 @@ static struct mtk_wed_wo_memory_region m
|
2023-03-14 11:04:53 +00:00
|
|
|
|
|
|
|
static u32 wo_r32(struct mtk_wed_wo *wo, u32 reg)
|
|
|
|
{
|
2024-03-29 21:21:51 +00:00
|
|
|
- return readl(mem_region[MTK_WED_WO_REGION_BOOT].addr + reg);
|
2023-03-14 11:04:53 +00:00
|
|
|
+ u32 val;
|
|
|
|
+
|
|
|
|
+ if (!wo->boot_regmap)
|
2024-03-29 21:21:51 +00:00
|
|
|
+ return readl(mem_region[MTK_WED_WO_REGION_BOOT].addr + reg);
|
2023-03-14 11:04:53 +00:00
|
|
|
+
|
|
|
|
+ if (regmap_read(wo->boot_regmap, reg, &val))
|
|
|
|
+ val = ~0;
|
|
|
|
+
|
|
|
|
+ return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void wo_w32(struct mtk_wed_wo *wo, u32 reg, u32 val)
|
|
|
|
{
|
2024-03-29 21:21:51 +00:00
|
|
|
- writel(val, mem_region[MTK_WED_WO_REGION_BOOT].addr + reg);
|
2023-03-14 11:04:53 +00:00
|
|
|
+ if (wo->boot_regmap)
|
|
|
|
+ regmap_write(wo->boot_regmap, reg, val);
|
|
|
|
+ else
|
2024-03-29 21:21:51 +00:00
|
|
|
+ writel(val, mem_region[MTK_WED_WO_REGION_BOOT].addr + reg);
|
2023-03-14 11:04:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct sk_buff *
|
2024-03-29 21:21:51 +00:00
|
|
|
@@ -313,6 +324,9 @@ mtk_wed_mcu_load_firmware(struct mtk_wed
|
|
|
|
u32 val, boot_cr;
|
|
|
|
int ret, i;
|
2023-03-14 11:04:53 +00:00
|
|
|
|
|
|
|
+ wo->boot_regmap = syscon_regmap_lookup_by_phandle(wo->hw->node,
|
|
|
|
+ "mediatek,wo-cpuboot");
|
|
|
|
+
|
2024-03-29 21:21:51 +00:00
|
|
|
/* load firmware region metadata */
|
|
|
|
for (i = 0; i < ARRAY_SIZE(mem_region); i++) {
|
|
|
|
int index = of_property_match_string(wo->hw->node,
|
|
|
|
@@ -321,6 +335,9 @@ mtk_wed_mcu_load_firmware(struct mtk_wed
|
|
|
|
if (index < 0)
|
|
|
|
continue;
|
2023-03-14 11:04:53 +00:00
|
|
|
|
2024-03-29 21:21:51 +00:00
|
|
|
+ if (index == MTK_WED_WO_REGION_BOOT && !IS_ERR(wo->boot_regmap))
|
|
|
|
+ continue;
|
|
|
|
+
|
|
|
|
ret = mtk_wed_get_reserved_memory_region(wo->hw, index, &mem_region[i]);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
2023-03-14 11:04:53 +00:00
|
|
|
--- a/drivers/net/ethernet/mediatek/mtk_wed_wo.h
|
|
|
|
+++ b/drivers/net/ethernet/mediatek/mtk_wed_wo.h
|
2024-03-29 21:21:51 +00:00
|
|
|
@@ -231,6 +231,7 @@ struct mtk_wed_wo_queue {
|
2023-03-14 11:04:53 +00:00
|
|
|
struct mtk_wed_wo {
|
|
|
|
struct mtk_wed_hw *hw;
|
|
|
|
|
2024-03-29 21:21:51 +00:00
|
|
|
+ struct regmap *boot_regmap;
|
2023-03-14 11:04:53 +00:00
|
|
|
struct mtk_wed_wo_queue q_tx;
|
|
|
|
struct mtk_wed_wo_queue q_rx;
|
2024-03-29 21:21:51 +00:00
|
|
|
|