* Cumulative fixes and updates for MediaTek platform. [1] * Update mt7981 pinctrl driver based on upstream kernel. [2] [1] https://lore.kernel.org/u-boot/cover.1737104723.git.weijie.gao@mediatek.com/ [2] https://lore.kernel.org/u-boot/20250124033902.187796-1-weijie.gao@mediatek.com/ Signed-off-by: Shiji Yang <yangshiji66@qq.com>
62 lines
2.0 KiB
Diff
62 lines
2.0 KiB
Diff
From dfbadb86b3bc43c004671ab6eb46ee160a192e98 Mon Sep 17 00:00:00 2001
|
|
From: Weijie Gao <weijie.gao@mediatek.com>
|
|
Date: Fri, 17 Jan 2025 17:18:11 +0800
|
|
Subject: [PATCH 09/15] pci: mediatek: add support for multiple ports in
|
|
mediatek pcie gen3 driver
|
|
|
|
One MediaTek PCIe Gen3 controller has only one port, where PCI bus 0
|
|
on this port represents the controller itself and bus 1 represents
|
|
the external PCIe device.
|
|
|
|
If multiple PCIe controllers are probed in U-Boot, U-Boot will use
|
|
bus numbers greater than 2 as input parameters. Therefore, we should
|
|
convert the BDF bus number to either 0 or 1 by subtracting the
|
|
offset by controller->seq_.
|
|
|
|
Signed-off-by: Sam Shih <sam.shih@mediatek.com>
|
|
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
|
---
|
|
drivers/pci/pcie_mediatek_gen3.c | 24 ++++++++++++++++++++++++
|
|
1 file changed, 24 insertions(+)
|
|
|
|
--- a/drivers/pci/pcie_mediatek_gen3.c
|
|
+++ b/drivers/pci/pcie_mediatek_gen3.c
|
|
@@ -83,6 +83,28 @@ struct mtk_pcie {
|
|
struct phy phy;
|
|
};
|
|
|
|
+static pci_dev_t convert_bdf(const struct udevice *controller, pci_dev_t bdf)
|
|
+{
|
|
+ int bdfs[3];
|
|
+
|
|
+ bdfs[0] = PCI_BUS(bdf);
|
|
+ bdfs[1] = PCI_DEV(bdf);
|
|
+ bdfs[2] = PCI_FUNC(bdf);
|
|
+
|
|
+ /*
|
|
+ * One MediaTek PCIe Gen3 controller has only one port, where PCI bus 0 on
|
|
+ * this port represents the controller itself and bus 1 represents the
|
|
+ * external PCIe device. If multiple PCIe controllers are probed in U-Boot,
|
|
+ * U-Boot will use bus numbers greater than 2 as input parameters. Therefore,
|
|
+ * we should convert the BDF bus number to either 0 or 1 by subtracting the
|
|
+ * offset by controller->seq_
|
|
+ */
|
|
+
|
|
+ bdfs[0] = bdfs[0] - controller->seq_;
|
|
+
|
|
+ return PCI_BDF(bdfs[0], bdfs[1], bdfs[2]);
|
|
+}
|
|
+
|
|
static void mtk_pcie_config_tlp_header(const struct udevice *bus,
|
|
pci_dev_t devfn,
|
|
int where, int size)
|
|
@@ -91,6 +113,8 @@ static void mtk_pcie_config_tlp_header(c
|
|
int bytes;
|
|
u32 val;
|
|
|
|
+ devfn = convert_bdf(bus, devfn);
|
|
+
|
|
size = 1 << size;
|
|
bytes = (GENMASK(size - 1, 0) & 0xf) << (where & 0x3);
|
|
|