Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a1f311d4 authored by Rick Wertenbroek's avatar Rick Wertenbroek Committed by Greg Kroah-Hartman
Browse files

PCI: rockchip: Write PCI Device ID to correct register

commit 1f1c42ece18de365c976a060f3c8eb481b038e3a upstream.

Write PCI Device ID (DID) to the correct register. The Device ID was not
updated through the correct register. Device ID was written to a read-only
register and therefore did not work. The Device ID is now set through the
correct register. This is documented in the RK3399 TRM section 17.6.6.1.1

Link: https://lore.kernel.org/r/20230418074700.1083505-3-rick.wertenbroek@gmail.com


Fixes: cf590b07 ("PCI: rockchip: Add EP driver for Rockchip PCIe controller")
Tested-by: default avatarDamien Le Moal <dlemoal@kernel.org>
Signed-off-by: default avatarRick Wertenbroek <rick.wertenbroek@gmail.com>
Signed-off-by: default avatarLorenzo Pieralisi <lpieralisi@kernel.org>
Reviewed-by: default avatarDamien Le Moal <dlemoal@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 59279511
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -124,6 +124,7 @@ static void rockchip_pcie_prog_ep_ob_atu(struct rockchip_pcie *rockchip, u8 fn,
static int rockchip_pcie_ep_write_header(struct pci_epc *epc, u8 fn,
static int rockchip_pcie_ep_write_header(struct pci_epc *epc, u8 fn,
					 struct pci_epf_header *hdr)
					 struct pci_epf_header *hdr)
{
{
	u32 reg;
	struct rockchip_pcie_ep *ep = epc_get_drvdata(epc);
	struct rockchip_pcie_ep *ep = epc_get_drvdata(epc);
	struct rockchip_pcie *rockchip = &ep->rockchip;
	struct rockchip_pcie *rockchip = &ep->rockchip;


@@ -136,8 +137,9 @@ static int rockchip_pcie_ep_write_header(struct pci_epc *epc, u8 fn,
				    PCIE_CORE_CONFIG_VENDOR);
				    PCIE_CORE_CONFIG_VENDOR);
	}
	}


	rockchip_pcie_write(rockchip, hdr->deviceid << 16,
	reg = rockchip_pcie_read(rockchip, PCIE_EP_CONFIG_DID_VID);
			    ROCKCHIP_PCIE_EP_FUNC_BASE(fn) + PCI_VENDOR_ID);
	reg = (reg & 0xFFFF) | (hdr->deviceid << 16);
	rockchip_pcie_write(rockchip, reg, PCIE_EP_CONFIG_DID_VID);


	rockchip_pcie_write(rockchip,
	rockchip_pcie_write(rockchip,
			    hdr->revid |
			    hdr->revid |
+2 −0
Original line number Original line Diff line number Diff line
@@ -132,6 +132,8 @@
#define PCIE_RC_RP_ATS_BASE		0x400000
#define PCIE_RC_RP_ATS_BASE		0x400000
#define PCIE_RC_CONFIG_NORMAL_BASE	0x800000
#define PCIE_RC_CONFIG_NORMAL_BASE	0x800000
#define PCIE_RC_CONFIG_BASE		0xa00000
#define PCIE_RC_CONFIG_BASE		0xa00000
#define PCIE_EP_CONFIG_BASE		0xa00000
#define PCIE_EP_CONFIG_DID_VID		(PCIE_EP_CONFIG_BASE + 0x00)
#define PCIE_RC_CONFIG_RID_CCR		(PCIE_RC_CONFIG_BASE + 0x08)
#define PCIE_RC_CONFIG_RID_CCR		(PCIE_RC_CONFIG_BASE + 0x08)
#define   PCIE_RC_CONFIG_SCC_SHIFT		16
#define   PCIE_RC_CONFIG_SCC_SHIFT		16
#define PCIE_RC_CONFIG_DCR		(PCIE_RC_CONFIG_BASE + 0xc4)
#define PCIE_RC_CONFIG_DCR		(PCIE_RC_CONFIG_BASE + 0xc4)