Patch "PCI: dwc: Add missing PCI_EXP_LNKCAP_MLW handling" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    PCI: dwc: Add missing PCI_EXP_LNKCAP_MLW handling

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     pci-dwc-add-missing-pci_exp_lnkcap_mlw-handling.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 2ac7626c1530b76de29c606326728f9c705acd2a
Author: Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx>
Date:   Wed Oct 18 17:56:19 2023 +0900

    PCI: dwc: Add missing PCI_EXP_LNKCAP_MLW handling
    
    [ Upstream commit 89db0793c9f2da265ecb6c1681f899d9af157f37 ]
    
    Update dw_pcie_link_set_max_link_width() to set PCI_EXP_LNKCAP_MLW.
    
    In accordance with the DW PCIe RC/EP HW manuals [1,2,3,...] aside with
    the PORT_LINK_CTRL_OFF.LINK_CAPABLE and GEN2_CTRL_OFF.NUM_OF_LANES[8:0]
    field there is another one which needs to be updated.
    
    It's LINK_CAPABILITIES_REG.PCIE_CAP_MAX_LINK_WIDTH. If it isn't done at
    the very least the maximum link-width capability CSR won't expose the
    actual maximum capability.
    
    [1] DesignWare Cores PCI Express Controller Databook - DWC PCIe Root Port,
        Version 4.60a, March 2015, p.1032
    [2] DesignWare Cores PCI Express Controller Databook - DWC PCIe Root Port,
        Version 4.70a, March 2016, p.1065
    [3] DesignWare Cores PCI Express Controller Databook - DWC PCIe Root Port,
        Version 4.90a, March 2016, p.1057
    ...
    [X] DesignWare Cores PCI Express Controller Databook - DWC PCIe Endpoint,
          Version 5.40a, March 2019, p.1396
    [X+1] DesignWare Cores PCI Express Controller Databook - DWC PCIe Root Port,
          Version 5.40a, March 2019, p.1266
    
    Suggested-by: Serge Semin <fancer.lancer@xxxxxxxxx>
    Link: https://lore.kernel.org/linux-pci/20231018085631.1121289-4-yoshihiro.shimoda.uh@xxxxxxxxxxx
    Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx>
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@xxxxxxxxxx>
    Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxx>
    Reviewed-by: Serge Semin <fancer.lancer@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c
index da4aba4aee623..2b60d20dfdf59 100644
--- a/drivers/pci/controller/dwc/pcie-designware.c
+++ b/drivers/pci/controller/dwc/pcie-designware.c
@@ -734,7 +734,8 @@ static void dw_pcie_link_set_max_speed(struct dw_pcie *pci, u32 link_gen)
 
 static void dw_pcie_link_set_max_link_width(struct dw_pcie *pci, u32 num_lanes)
 {
-	u32 lwsc, plc;
+	u32 lnkcap, lwsc, plc;
+	u8 cap;
 
 	if (!num_lanes)
 		return;
@@ -770,6 +771,12 @@ static void dw_pcie_link_set_max_link_width(struct dw_pcie *pci, u32 num_lanes)
 	}
 	dw_pcie_writel_dbi(pci, PCIE_PORT_LINK_CONTROL, plc);
 	dw_pcie_writel_dbi(pci, PCIE_LINK_WIDTH_SPEED_CONTROL, lwsc);
+
+	cap = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP);
+	lnkcap = dw_pcie_readl_dbi(pci, cap + PCI_EXP_LNKCAP);
+	lnkcap &= ~PCI_EXP_LNKCAP_MLW;
+	lnkcap |= FIELD_PREP(PCI_EXP_LNKCAP_MLW, num_lanes);
+	dw_pcie_writel_dbi(pci, cap + PCI_EXP_LNKCAP, lnkcap);
 }
 
 void dw_pcie_iatu_detect(struct dw_pcie *pci)



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux