]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
PCI: rockchip-ep: Remove wrong mask on subsys_vendor_id
authorRick Wertenbroek <rick.wertenbroek@gmail.com>
Wed, 3 Apr 2024 14:45:08 +0000 (16:45 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 5 Jul 2024 07:08:18 +0000 (09:08 +0200)
commit 2dba285caba53f309d6060fca911b43d63f41697 upstream.

Remove wrong mask on subsys_vendor_id. Both the Vendor ID and Subsystem
Vendor ID are u16 variables and are written to a u32 register of the
controller. The Subsystem Vendor ID was always 0 because the u16 value
was masked incorrectly with GENMASK(31,16) resulting in all lower 16
bits being set to 0 prior to the shift.

Remove both masks as they are unnecessary and set the register correctly
i.e., the lower 16-bits are the Vendor ID and the upper 16-bits are the
Subsystem Vendor ID.

This is documented in the RK3399 TRM section 17.6.7.1.17

[kwilczynski: removed unnecesary newline]
Fixes: cf590b078391 ("PCI: rockchip: Add EP driver for Rockchip PCIe controller")
Link: https://lore.kernel.org/linux-pci/20240403144508.489835-1-rick.wertenbroek@gmail.com
Signed-off-by: Rick Wertenbroek <rick.wertenbroek@gmail.com>
Signed-off-by: Krzysztof WilczyƄski <kwilczynski@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/pci/controller/pcie-rockchip-ep.c

index d7ab669b1b0d07036f2eb954df9d538a140c0a96..8f2886ed89d1213b46c4a05468e477a3cd22a54e 100644 (file)
@@ -130,10 +130,8 @@ static int rockchip_pcie_ep_write_header(struct pci_epc *epc, u8 fn,
 
        /* All functions share the same vendor ID with function 0 */
        if (fn == 0) {
-               u32 vid_regs = (hdr->vendorid & GENMASK(15, 0)) |
-                              (hdr->subsys_vendor_id & GENMASK(31, 16)) << 16;
-
-               rockchip_pcie_write(rockchip, vid_regs,
+               rockchip_pcie_write(rockchip,
+                                   hdr->vendorid | hdr->subsys_vendor_id << 16,
                                    PCIE_CORE_CONFIG_VENDOR);
        }