uboot-ramips: add support for MT7621, merge into uboot-mediatek
[openwrt/staging/aparcar.git] / package / boot / uboot-mediatek / patches / 001-mtk-0017-net-mediatek-remap-iobase-address.patch
1 From 391785398f61c85e6b55b1e9edbab94e3ba1b783 Mon Sep 17 00:00:00 2001
2 From: Weijie Gao <weijie.gao@mediatek.com>
3 Date: Fri, 20 May 2022 11:23:31 +0800
4 Subject: [PATCH 17/25] net: mediatek: remap iobase address
5
6 The iobase address from dts node is actually physical address. It's
7 identical to the virtual address in ARM platform. This is ok because this
8 driver was used only by ARM platforms (mt7622/mt7623 ...).
9
10 But now this driver will be used by mt7621 which is a MIPS SoC. For MIPS
11 platform the physical address space is mapped to KSEG0 and KSEG1 and this
12 makes the virtual address apparently not idential to its physical address.
13
14 To solve this issue, this patch replaces dev_read_addr with dev_remap_addr
15 to get the remapped iobase address.
16
17 Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
18 Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
19 ---
20 drivers/net/mtk_eth.c | 2 +-
21 1 file changed, 1 insertion(+), 1 deletion(-)
22
23 diff --git a/drivers/net/mtk_eth.c b/drivers/net/mtk_eth.c
24 index 666ddeb10d..caa83b7cec 100644
25 --- a/drivers/net/mtk_eth.c
26 +++ b/drivers/net/mtk_eth.c
27 @@ -1419,7 +1419,7 @@ static int mtk_eth_of_to_plat(struct udevice *dev)
28
29 priv->soc = dev_get_driver_data(dev);
30
31 - pdata->iobase = dev_read_addr(dev);
32 + pdata->iobase = (phys_addr_t)dev_remap_addr(dev);
33
34 /* get corresponding ethsys phandle */
35 ret = dev_read_phandle_with_args(dev, "mediatek,ethsys", NULL, 0, 0,
36 --
37 2.36.1
38