mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-19 05:38:00 +00:00
8a9273d51e
Copy backport, hack, pending patch and config from 6.1 to 6.6. Signed-off-by: Weijie Gao <hackpascal@gmail.com>
72 lines
2.3 KiB
Diff
72 lines
2.3 KiB
Diff
From: Lorenzo Bianconi <lorenzo@kernel.org>
|
|
Date: Mon, 18 Sep 2023 12:29:10 +0200
|
|
Subject: [PATCH] net: ethernet: mtk_wed: make memory region optional
|
|
|
|
Make mtk_wed_wo_memory_region optionals.
|
|
This is a preliminary patch to introduce Wireless Ethernet Dispatcher
|
|
support for MT7988 SoC since MT7988 WED fw image will have a different
|
|
layout.
|
|
|
|
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
|
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
|
---
|
|
|
|
--- a/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
|
|
+++ b/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
|
|
@@ -234,19 +234,13 @@ int mtk_wed_mcu_msg_update(struct mtk_we
|
|
}
|
|
|
|
static int
|
|
-mtk_wed_get_memory_region(struct mtk_wed_wo *wo,
|
|
+mtk_wed_get_memory_region(struct mtk_wed_hw *hw, int index,
|
|
struct mtk_wed_wo_memory_region *region)
|
|
{
|
|
struct reserved_mem *rmem;
|
|
struct device_node *np;
|
|
- int index;
|
|
|
|
- index = of_property_match_string(wo->hw->node, "memory-region-names",
|
|
- region->name);
|
|
- if (index < 0)
|
|
- return index;
|
|
-
|
|
- np = of_parse_phandle(wo->hw->node, "memory-region", index);
|
|
+ np = of_parse_phandle(hw->node, "memory-region", index);
|
|
if (!np)
|
|
return -ENODEV;
|
|
|
|
@@ -258,7 +252,7 @@ mtk_wed_get_memory_region(struct mtk_wed
|
|
|
|
region->phy_addr = rmem->base;
|
|
region->size = rmem->size;
|
|
- region->addr = devm_ioremap(wo->hw->dev, region->phy_addr, region->size);
|
|
+ region->addr = devm_ioremap(hw->dev, region->phy_addr, region->size);
|
|
|
|
return !region->addr ? -EINVAL : 0;
|
|
}
|
|
@@ -271,6 +265,9 @@ mtk_wed_mcu_run_firmware(struct mtk_wed_
|
|
const struct mtk_wed_fw_trailer *trailer;
|
|
const struct mtk_wed_fw_region *fw_region;
|
|
|
|
+ if (!region->phy_addr || !region->size)
|
|
+ return 0;
|
|
+
|
|
trailer_ptr = fw->data + fw->size - sizeof(*trailer);
|
|
trailer = (const struct mtk_wed_fw_trailer *)trailer_ptr;
|
|
region_ptr = trailer_ptr - trailer->num_region * sizeof(*fw_region);
|
|
@@ -318,7 +315,13 @@ mtk_wed_mcu_load_firmware(struct mtk_wed
|
|
|
|
/* load firmware region metadata */
|
|
for (i = 0; i < ARRAY_SIZE(mem_region); i++) {
|
|
- ret = mtk_wed_get_memory_region(wo, &mem_region[i]);
|
|
+ int index = of_property_match_string(wo->hw->node,
|
|
+ "memory-region-names",
|
|
+ mem_region[i].name);
|
|
+ if (index < 0)
|
|
+ continue;
|
|
+
|
|
+ ret = mtk_wed_get_memory_region(wo->hw, index, &mem_region[i]);
|
|
if (ret)
|
|
return ret;
|
|
}
|