Re: [PATCH 5/6] PCI: spacemit: introduce SpacemiT PCIe host driver

From: Alex Elder

Date: Tue Sep 30 2025 - 22:40:20 EST


On 9/19/25 5:10 PM, Alex Elder wrote:
+static int k1_pcie_init(struct dw_pcie_rp *pp)
+{
+    struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
+    struct k1_pcie *k1 = to_k1_pcie(pci);
+    u32 offset;
+    u32 mask;
+    int ret;
+
+    ret = k1_pcie_toggle_soft_reset(k1);
+    if (ret)
+        goto err_app_disable;
+
+    ret = k1_pcie_app_enable(k1);
+    if (ret)
+        return ret;
+
+    ret = phy_init(k1->phy);
+    if (ret)
+        goto err_app_disable;
+
+    /* Set the PCI vendor and device ID */
+    dw_pcie_dbi_ro_wr_en(pci);
+    dw_pcie_writew_dbi(pci, PCI_VENDOR_ID, K1_PCIE_VENDOR_ID);
+    dw_pcie_writew_dbi(pci, PCI_DEVICE_ID, K1_PCIE_DEVICE_ID);
+    dw_pcie_dbi_ro_wr_dis(pci);
+
+    /*
+     * Put the port in root complex mode, record that Vaux is present.

There is no 3.3Vaux supply present in the binding. So the supply is guaranteed
to be present and enabled always by the platform?

Actually, I don't know, I'll ask.  Thank you for pointing this out.

On the Banana Pi BPI-F3 platform, this supply is always on.

There do exist other (SpacemiT K1-based) platforms that enable
this supply using a GPIO. I am not able to test that now.

However I will add a property in the DT binding to indicate the
3.3v supply. I see "vpcie3v3-supply" used as a property name
and unless someone suggests doing something else, that's what
I'll use.

-Alex