RE: [PATCH] PCI: dwc: imx6: use regmap_assign_bits() for conditional set/clear
flat view
From: Hongxing Zhu <hongxing.zhu@nxp.com>
Date: 2026-09-24 08:50:24
Also in:
imx, linux-pci, lkml
-----Original Message----- From: Peng Fan (OSS) <redacted> Sent: Thursday, September 24, 2026 4:34 PM To: Hongxing Zhu <hongxing.zhu@nxp.com>; Lucas Stach [off-list ref]; Lorenzo Pieralisi [off-list ref]; Krzysztof Wilczyński [off-list ref]; Manivannan Sadhasivam [off-list ref]; Rob Herring [off-list ref]; Bjorn Helgaas [off-list ref]; Frank Li [off-list ref]; Sascha Hauer [off-list ref]; Pengutronix Kernel Team [off-list ref]; Fabio Estevam [off-list ref] Cc: linux-kernel@vger.kernel.org; Peng Fan <peng.fan@nxp.com>; linux- pci@vger.kernel.org; linux-arm-kernel@lists.infradead.org; imx@lists.linux.dev Subject: [PATCH] PCI: dwc: imx6: use regmap_assign_bits() for conditional set/clear From: Peng Fan <peng.fan@nxp.com> Replace multiple if/else blocks using regmap_set_bits()/regmap_clear_bits() with the simpler regmap_assign_bits() calls. Signed-off-by: Peng Fan <peng.fan@nxp.com>
Thanks. Acked-by: Richard Zhu <hongxing.zhu@nxp.com> Best Regards Richard Zhu
quoted hunk ↗ jump to hunk
--- drivers/pci/controller/dwc/pci-imx6.c | 32 +++++++-------------------- 1 file changed, 8 insertions(+), 24 deletions(-)diff --git a/drivers/pci/controller/dwc/pci-imx6.cb/drivers/pci/controller/dwc/pci-imx6.c index 28fed010b503f..e2e55a88e0132 100644--- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c@@ -747,12 +747,8 @@ static int imx_pcie_attach_pd(struct device *dev) static int imx6q_pcie_enable_ref_clk(struct imx_pcie *imx_pcie, bool enable){ - if (enable) - regmap_set_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_REF_CLK_EN); - else - regmap_clear_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_REF_CLK_EN); + regmap_assign_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, + IMX6Q_GPR1_PCIE_REF_CLK_EN, enable); return 0; }@@ -868,12 +864,8 @@ static void imx_pcie_clk_disable(struct imx_pcie*imx_pcie) static int imx6sx_pcie_core_reset(struct imx_pcie *imx_pcie, bool assert) { - if (assert) - regmap_set_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, - IMX6SX_GPR12_PCIE_TEST_POWERDOWN); - else - regmap_clear_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, - IMX6SX_GPR12_PCIE_TEST_POWERDOWN); + regmap_assign_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, + IMX6SX_GPR12_PCIE_TEST_POWERDOWN, assert); /* Force PCIe PHY reset */ regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR5, IMX6SX_GPR5_PCIE_BTNRST_RESET, @@ -883,12 +875,8 @@ static int imx6sx_pcie_core_reset(struct imx_pcie *imx_pcie, bool assert) static int imx6qp_pcie_core_reset(struct imx_pcie *imx_pcie, bool assert) { - if (assert) - regmap_set_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_TEST_PD); - else - regmap_clear_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_TEST_PD); + regmap_assign_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, + IMX6Q_GPR1_PCIE_TEST_PD, assert); regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_SW_RST, assert ? IMX6Q_GPR1_PCIE_SW_RST : 0); @@ - 901,12 +889,8 @@ static int imx6qp_pcie_core_reset(struct imx_pcie *imx_pcie, bool assert) static int imx6q_pcie_core_reset(struct imx_pcie *imx_pcie, bool assert) { - if (assert) - regmap_set_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_TEST_PD); - else - regmap_clear_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_TEST_PD); + regmap_assign_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, + IMX6Q_GPR1_PCIE_TEST_PD, assert); if (!assert) usleep_range(200, 500); -- 2.50.1