On Mon, Jun 30, 2025 at 07:24:41PM -0300, Geraldo Nascimento wrote: > Current code uses custom-defined register offsets and bitfields for > standard PCIe registers. Change to using standard PCIe defines. Since > we are now using standard PCIe defines, drop unused custom-defined ones, > which are now referenced from offset at added Capabilities Register. > @@ -278,10 +278,10 @@ static void rockchip_pcie_set_power_limit(struct rockchip_pcie *rockchip) > power = power / 10; > } > > - status = rockchip_pcie_read(rockchip, PCIE_RC_CONFIG_DCR); > - status |= (power << PCIE_RC_CONFIG_DCR_CSPL_SHIFT) | > - (scale << PCIE_RC_CONFIG_DCR_CPLS_SHIFT); > - rockchip_pcie_write(rockchip, status, PCIE_RC_CONFIG_DCR); > + status = rockchip_pcie_read(rockchip, PCIE_RC_CONFIG_CR + PCI_EXP_DEVCAP); > + status |= FIELD_PREP(PCI_EXP_DEVCAP_PWR_VAL, power); > + status |= FIELD_PREP(PCI_EXP_DEVCAP_PWR_SCL, scale); Added #include <linux/bitfield.h> for this: CC drivers/pci/controller/pcie-rockchip-host.o drivers/pci/controller/pcie-rockchip-host.c: In function ‘rockchip_pcie_set_power_limit’: drivers/pci/controller/pcie-rockchip-host.c:272:24: error: implicit declaration of function ‘FIELD_MAX’ [-Werror=implicit-function-declaration] 272 | while (power > FIELD_MAX(PCI_EXP_DEVCAP_PWR_VAL)) { | ^~~~~~~~~ drivers/pci/controller/pcie-rockchip-host.c:282:19: error: implicit declaration of function ‘FIELD_PREP’ [-Werror=implicit-function-declaration] 282 | status |= FIELD_PREP(PCI_EXP_DEVCAP_PWR_VAL, power); | ^~~~~~~~~~