default RK3399 PCIe to 1.x. sometime in mid-2019, rockchip disabled PCIe 2.x referrencing a non-public errata in linux and the dts. we haven't observed any specific problems, but we've also tested far fewer cards than linux. there are other issues such as what happens for a PCI abort depending on which CPU triggers it we do not currently handle either. tested on rockpro64 with nvme & ahcisata, and pinebook pro nvme. still allows DT to set back to '2' if the user so desires. Index: sys/arch/arm/rockchip/rk3399_pcie.c =================================================================== RCS file: /cvsroot/src/sys/arch/arm/rockchip/rk3399_pcie.c,v retrieving revision 1.15 diff -p -u -r1.15 rk3399_pcie.c --- sys/arch/arm/rockchip/rk3399_pcie.c 27 Jan 2021 03:10:19 -0000 1.15 +++ sys/arch/arm/rockchip/rk3399_pcie.c 14 Aug 2021 21:10:27 -0000 @@ -253,8 +253,17 @@ rkpcie_attach(device_t parent, device_t ep_gpio = fdtbus_gpio_acquire(phandle, "ep-gpios", GPIO_PIN_OUTPUT); + /* + * Let board-specific properties override the default, which is set + * to PCIe 1.x, due to errata in the RK3399 CPU. We don't know exactly + * what these errata involved (not public), but posts from the + * @rock-chips.com domain to u-boot and linux-kernel lists indicate + * that there is a errata related to this, and indeed, the Datasheet + * since at least Rev 1.6 and inluding the latest Rev 1.8 say that the + * PCIe can handle 2.5GT/s (ie, PCIe 1.x). + */ if (of_getprop_uint32(phandle, "max-link-speed", &max_link_speed) != 0) - max_link_speed = 2; + max_link_speed = 1; if (of_getprop_uint32(phandle, "num-lanes", &num_lanes) != 0) num_lanes = 1; Index: sys/arch/arm/dts/rk3399-pinebook-pro.dts =================================================================== RCS file: /cvsroot/src/sys/arch/arm/dts/rk3399-pinebook-pro.dts,v retrieving revision 1.3 diff -p -u -r1.3 rk3399-pinebook-pro.dts --- sys/arch/arm/dts/rk3399-pinebook-pro.dts 17 May 2020 19:57:25 -0000 1.3 +++ sys/arch/arm/dts/rk3399-pinebook-pro.dts 14 Aug 2021 21:10:27 -0000 @@ -766,7 +766,7 @@ &pcie0 { ep-gpios = <&gpio2 RK_PD4 GPIO_ACTIVE_HIGH>; num-lanes = <4>; - max-link-speed = <2>; + max-link-speed = <1>; pinctrl-names = "default"; pinctrl-0 = <&pcie_clkreqn_cpm>; vpcie3v3-supply = <&vcc3v3_pcie>; Index: sys/arch/arm/dts/rk3399-rockpro64.dts =================================================================== RCS file: /cvsroot/src/sys/arch/arm/dts/rk3399-rockpro64.dts,v retrieving revision 1.11 diff -p -u -r1.11 rk3399-rockpro64.dts --- sys/arch/arm/dts/rk3399-rockpro64.dts 17 May 2020 19:57:25 -0000 1.11 +++ sys/arch/arm/dts/rk3399-rockpro64.dts 14 Aug 2021 21:10:27 -0000 @@ -181,7 +181,7 @@ &pcie0 { ep-gpios = <&gpio2 RK_PD4 GPIO_ACTIVE_HIGH>; num-lanes = <4>; - max-link-speed = <2>; + max-link-speed = <1>; pinctrl-names = "default"; pinctrl-0 = <&pcie_clkreqn>; vpcie3v3-supply = <&vcc3v3_pcie>;