From: Philipp Zabel <p.zabel@pengutronix.de>
To: "Anand Moon" <linux.amoon@gmail.com>,
"Shawn Guo" <shawn.guo@linaro.org>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"open list:PCIE DRIVER FOR HISILICON STB"
<linux-pci@vger.kernel.org>,
"open list" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1 2/2] PCI: dwc: histb: Simplify reset control handling by using reset_control_bulk*() function
Date: Tue, 26 Aug 2025 14:46:00 +0200 [thread overview]
Message-ID: <b3a9e4aa400cc03bcdc0e8d5dcd4ae82cacada86.camel@pengutronix.de> (raw)
In-Reply-To: <20250826114245.112472-3-linux.amoon@gmail.com>
On Di, 2025-08-26 at 17:12 +0530, Anand Moon wrote:
> Currently, the driver acquires and asserts/deasserts the resets
> individually thereby making the driver complex to read.
>
> This can be simplified by using the reset_control_bulk() APIs.
>
> Use devm_reset_control_bulk_get_exclusive() API to acquire all the resets
> and use reset_control_bulk_{assert/deassert}() APIs to assert/deassert them
> in bulk.
>
> Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> ---
> drivers/pci/controller/dwc/pcie-histb.c | 57 ++++++++++++-------------
> 1 file changed, 28 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-histb.c b/drivers/pci/controller/dwc/pcie-histb.c
> index 4022349e85d2..4ba5c9af63a0 100644
> --- a/drivers/pci/controller/dwc/pcie-histb.c
> +++ b/drivers/pci/controller/dwc/pcie-histb.c
> @@ -49,14 +49,20 @@
> #define PCIE_LTSSM_STATE_MASK GENMASK(5, 0)
> #define PCIE_LTSSM_STATE_ACTIVE 0x11
>
> +#define PCIE_HISTB_NUM_RESETS ARRAY_SIZE(histb_pci_rsts)
> +
> +static const char * const histb_pci_rsts[] = {
> + "soft",
> + "sys",
> + "bus",
> +};
> +
[...]
> @@ -236,14 +241,19 @@ static int histb_pcie_host_enable(struct dw_pcie_rp *pp)
> goto reg_dis;
> }
>
> - reset_control_assert(hipcie->soft_reset);
> - reset_control_deassert(hipcie->soft_reset);
> -
> - reset_control_assert(hipcie->sys_reset);
> - reset_control_deassert(hipcie->sys_reset);
> + ret = reset_control_bulk_assert(PCIE_HISTB_NUM_RESETS,
> + hipcie->reset);
> + if (ret) {
> + dev_err(dev, "Couldn't assert reset %d\n", ret);
> + goto reg_dis;
> + }
>
> - reset_control_assert(hipcie->bus_reset);
> - reset_control_deassert(hipcie->bus_reset);
> + ret = reset_control_bulk_deassert(PCIE_HISTB_NUM_RESETS,
Note that this changes the order of assertion/deassertion, not only
because resets lines are now switched in bulk, but also because
reset_control_bulk_deassert() deasserts the reset lines in reverse
order. So this does
If the three resets are independent and order doesn't matter,
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
regards
Philipp
next prev parent reply other threads:[~2025-08-26 12:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-26 11:42 [PATCH v1 0/2] HiSilicon STB PCIe host use bulk API for clock Anand Moon
2025-08-26 11:42 ` [PATCH v1 1/2] PCI: dwc: histb: Simplify clock handling by using clk_bulk*() functions Anand Moon
2025-08-26 16:25 ` Bjorn Helgaas
2025-08-26 18:02 ` Anand Moon
2025-08-26 19:02 ` Bjorn Helgaas
2025-08-27 9:59 ` Anand Moon
2025-08-26 11:42 ` [PATCH v1 2/2] PCI: dwc: histb: Simplify reset control handling by using reset_control_bulk*() function Anand Moon
2025-08-26 12:46 ` Philipp Zabel [this message]
2025-08-26 15:57 ` Anand Moon
2025-08-26 16:25 ` Bjorn Helgaas
2025-08-26 18:03 ` Anand Moon
2025-08-26 19:06 ` Bjorn Helgaas
2025-09-08 6:36 ` [PATCH v1 0/2] HiSilicon STB PCIe host use bulk API for clock Manivannan Sadhasivam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b3a9e4aa400cc03bcdc0e8d5dcd4ae82cacada86.camel@pengutronix.de \
--to=p.zabel@pengutronix.de \
--cc=bhelgaas@google.com \
--cc=kwilczynski@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux.amoon@gmail.com \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=robh@kernel.org \
--cc=shawn.guo@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®