[PATCH] PCI: dwc: imx6: use regmap_assign_bits() for conditional set/clear
Frank Li
Frank.li at oss.nxp.com
Thu Sep 24 10:04:04 PDT 2026
On Thu, Sep 24, 2026 at 04:34:28PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan at 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 at nxp.com>
> ---
Thanks for clean up this. It is much better.
Reviewed-by: Frank Li <Frank.Li at nxp.com>
> drivers/pci/controller/dwc/pci-imx6.c | 32 +++++++--------------------
> 1 file changed, 8 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/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
>
>
More information about the linux-arm-kernel
mailing list