Skip to content

Commit 04239af

Browse files
RadxaMitchellCodeChenL
authored andcommitted
drivers: pci: Adds PCIe Switch support for rk3399
Solved the problem that the pcie driver of rk3399 platform reported an error when connecting to PCIe switch, which caused the system to fail to start normally. rockchip redmine issue: Defect #485025 Error Log: [ 15.385695] rockchip-pcie f8000000.pcie: PCI host bridge to bus 0000:00 [ 15.385763] pci_bus 0000:00: root bus resource [bus 00-1f] [ 15.385801] pci_bus 0000:00: root bus resource [mem 0xfa000000-0xfbdfffff] [ 15.385845] pci_bus 0000:00: root bus resource [io 0x0000-0xfffff] (bus address [0xfbe00000-0xfbefffff]) [ 15.385972] pci 0000:00:00.0: [1d87:0100] type 01 class 0x060400 [ 15.386146] pci 0000:00:00.0: supports D1 [ 15.386178] pci 0000:00:00.0: PME# supported from D0 D1 D3hot [ 15.397665] pci 0000:00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring [ 15.398111] pci 0000:01:00.0: [1b21:2806] type 01 class 0x060400 [ 15.398335] pci 0000:01:00.0: Max Payload Size set to 256 (was 128, max 512) [ 15.398382] pci 0000:01:00.0: enabling Extended Tags [ 15.398771] pci 0000:01:00.0: PME# supported from D0 D3hot D3cold [ 15.398944] pci 0000:01:00.0: 8.000 Gb/s available PCIe bandwidth, limited by 5.0 GT/s PCIe x2 link at 0000:00:00.0 (capable of 63.008 Gb/s with 8.0 GT/s PCIe x8 link) [ 15.416994] pci 0000:01:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring [ 15.417640] pci 0000:02:00.0: [1b21:2806] type 01 class 0x060400 [ 15.417872] pci 0000:02:00.0: Max Payload Size set to 256 (was 128, max 512) [ 15.417917] pci 0000:02:00.0: enabling Extended Tags [ 15.418322] pci 0000:02:00.0: PME# supported from D0 D3hot D3cold [ 15.419209] do_rockchip_pcie_serror [ 15.419275] Internal error: synchronous external abort: 96000210 [radxa#1] SMP [ 15.421510] Modules linked in: [ 15.421822] CPU: 2 PID: 83 Comm: kworker/u12:1 Not tainted 5.10.110-523-rockchip #523 [ 15.422540] Hardware name: Radxa ROCK Pi 4A+ (DT) [ 15.422993] Workqueue: events_unbound deferred_probe_work_func [ 15.423545] pstate: 60000085 (nZCv daIf -PAN -UAO -TCO BTYPE=--) [ 15.424107] pc : rockchip_pcie_rd_conf+0x160/0x1b4 [ 15.424560] lr : rockchip_pcie_rd_conf+0x150/0x1b4 [ 15.425007] sp : ffff8000123f3690 [ 15.425327] x29: ffff8000123f3690 x28: 0000000000000001 [ 15.425834] x27: 0000000000000000 x26: 0000000000000000 [ 15.426340] x25: ffff8000110de41a x24: 0000000000000008 [ 15.426846] x23: ffff000000426400 x22: 0000000000000000 [ 15.427351] x21: 0000000000000004 x20: ffff8000123f3714 [ 15.427857] x19: ffff800014208000 x18: 0000000000000000 [ 15.428362] x17: 0000000000000000 x16: 0000000000000000 [ 15.428868] x15: 000000000000000a x14: 0720072007200720 [ 15.429374] x13: 0720072007200720 x12: 0720072007200720 [ 15.429880] x11: 0720072007200720 x10: 0720072007200720 [ 15.430386] x9 : ffff8000105c146c x8 : 2d2d207473655420 [ 15.430892] x7 : 6c6c65686374694d x6 : ffff8000119cd510 [ 15.431397] x5 : ffff0000063a0000 x4 : 0000000000000000 [ 15.431903] x3 : 0000000000c00008 x2 : 000000000080000b [ 15.432408] x1 : ffff800017c00008 x0 : ffff800014000000 [ 15.432915] Call trace: [ 15.433159] rockchip_pcie_rd_conf+0x160/0x1b4 [ 15.433580] pci_bus_read_config_dword+0x84/0xdc [ 15.434012] pci_bus_generic_read_dev_vendor_id+0x48/0x174 [ 15.434524] pci_bus_read_dev_vendor_id+0xa4/0xac [ 15.434965] pci_scan_single_device+0x78/0xf0 [ 15.435372] pci_scan_slot+0x80/0xf4 [ 15.435709] pci_scan_child_bus_extend+0x74/0x300 [ 15.436151] pci_scan_bridge_extend+0x488/0x54c [ 15.436581] pci_scan_child_bus_extend+0x2c4/0x300 [ 15.437034] pci_scan_bridge_extend+0x488/0x54c [ 15.437464] pci_scan_child_bus_extend+0x2c4/0x300 [ 15.437917] pci_scan_child_bus+0x20/0x2c [ 15.438301] pci_scan_root_bus_bridge+0x9c/0xd4 [ 15.438730] pci_host_probe+0x28/0xb0 [ 15.439078] rockchip_pcie_really_probe+0x15c/0x170 [ 15.439531] rockchip_pcie_probe+0x304/0x360 [ 15.439937] platform_drv_probe+0x60/0xb0 [ 15.440321] really_probe+0x2dc/0x46c [ 15.440670] driver_probe_device+0x138/0x148 [ 15.441077] __device_attach_driver+0xd8/0x114 [ 15.441495] bus_for_each_drv+0xa4/0xcc [ 15.441855] __device_attach+0xdc/0x170 [ 15.442216] device_initial_probe+0x20/0x2c [ 15.442610] bus_probe_device+0x3c/0xa0 [ 15.442971] deferred_probe_work_func+0xe0/0xf4 [ 15.443402] process_one_work+0x1e0/0x298 [ 15.443784] process_scheduled_works+0x4c/0x50 [ 15.444202] worker_thread+0x1f8/0x27c [ 15.444563] kthread+0xf8/0x108 [ 15.444866] ret_from_fork+0x10/0x84 Signed-off-by: RadxaMitchell <[email protected]>
1 parent a407b1b commit 04239af

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

drivers/pci/controller/pcie-rockchip-host.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ static int rockchip_pcie_host_init_port(struct rockchip_pcie *rockchip)
366366
rockchip_pcie_write(rockchip, PCIE_CLIENT_LINK_TRAIN_ENABLE,
367367
PCIE_CLIENT_CONFIG);
368368

369+
msleep(500);
369370
gpiod_set_value_cansleep(rockchip->ep_gpio, 1);
370371

371372
if (rockchip->wait_ep)
@@ -447,6 +448,8 @@ static int rockchip_pcie_host_init_port(struct rockchip_pcie *rockchip)
447448
status |= PCIE_RC_CONFIG_DCSR_MPS_256;
448449
rockchip_pcie_write(rockchip, status, PCIE_RC_CONFIG_DCSR);
449450

451+
mdelay(500);
452+
450453
return 0;
451454
err_power_off_phy:
452455
while (i--)

drivers/pci/probe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2339,7 +2339,7 @@ bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l,
23392339
bridge->device == 0x80b5)
23402340
return pci_idt_bus_quirk(bus, devfn, l, timeout);
23412341
#endif
2342-
pci_bus_write_config_dword(bus, devfn, PCI_VENDOR_ID, 0x00240000);
2342+
23432343
return pci_bus_generic_read_dev_vendor_id(bus, devfn, l, timeout);
23442344
}
23452345
EXPORT_SYMBOL(pci_bus_read_dev_vendor_id);

0 commit comments

Comments
 (0)