[PATCH v10 2/3] PCI: rockchip: Simplify reset control handling by using reset_control_bulk*() function
Manivannan Sadhasivam
manivannan.sadhasivam at linaro.org
Thu Nov 14 21:53:46 PST 2024
On Sat, Oct 19, 2024 at 11:31:34AM +0530, Anand Moon wrote:
> Currently, the driver acquires and asserts/deasserts the resets
> individually thereby making the driver complex to read. But 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.
>
> Following the recommendations in 'Rockchip RK3399 TRM v1.3 Part2':
>
> 1. Split the reset controls into two groups as per section '17.5.8.1.1 PCIe
> as Root Complex'.
>
> 2. Deassert the 'Pipe, MGMT Sticky, MGMT, Core' resets in groups as per
> section '17.5.8.1.1 PCIe as Root Complex'. This is accomplished using the
> reset_control_bulk APIs.
>
> Signed-off-by: Anand Moon <linux.amoon at gmail.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam at linaro.org>
One nitpick below. But don't need to respin as it can be fixed while applying.
> ---
> v10: Fix some typo
> v9: Improved the commit message and try to fix few review comments.
> v8: I tried to address reviews and comments from Mani.
> Follow the sequence of De-assert as per the driver code.
> Drop the comment in the driver.
> Improve the commit message with the description of the TMP section.
> Improve the reason for the core functional changes in the commit
> description.
> Improve the error handling messages of the code.
> v7: replace devm_reset_control_bulk_get_optional_exclusive()
> with devm_reset_control_bulk_get_exclusive()
> update the functional changes.
> V6: Add reason for the split of the RESET pins.
> v5: Fix the De-assert reset core as per the TRM
> De-assert the PIPE_RESET_N/MGMT_STICKY_RESET_N/MGMT_RESET_N/RESET_N
> simultaneously.
> v4: use dev_err_probe in error path.
> v3: Fix typo in commit message, dropped reported by.
> v2: Fix compilation error reported by Intel test robot
> fixed checkpatch warning.
> ---
> drivers/pci/controller/pcie-rockchip.c | 154 +++++--------------------
> drivers/pci/controller/pcie-rockchip.h | 26 +++--
> 2 files changed, 48 insertions(+), 132 deletions(-)
>
> diff --git a/drivers/pci/controller/pcie-rockchip.c b/drivers/pci/controller/pcie-rockchip.c
> index 2777ef0cb599..c17aa8ec80b9 100644
> --- a/drivers/pci/controller/pcie-rockchip.c
> +++ b/drivers/pci/controller/pcie-rockchip.c
[...]
> @@ -252,31 +177,10 @@ int rockchip_pcie_init_port(struct rockchip_pcie *rockchip)
> goto err_power_off_phy;
> }
>
> - /*
> - * Please don't reorder the deassert sequence of the following
> - * four reset pins.
> - */
> - err = reset_control_deassert(rockchip->mgmt_sticky_rst);
> - if (err) {
> - dev_err(dev, "deassert mgmt_sticky_rst err %d\n", err);
> - goto err_power_off_phy;
> - }
> -
> - err = reset_control_deassert(rockchip->core_rst);
> - if (err) {
> - dev_err(dev, "deassert core_rst err %d\n", err);
> - goto err_power_off_phy;
> - }
> -
> - err = reset_control_deassert(rockchip->mgmt_rst);
> - if (err) {
> - dev_err(dev, "deassert mgmt_rst err %d\n", err);
> - goto err_power_off_phy;
> - }
> -
> - err = reset_control_deassert(rockchip->pipe_rst);
> + err = reset_control_bulk_deassert(ROCKCHIP_NUM_CORE_RSTS,
> + rockchip->core_rsts);
> if (err) {
> - dev_err(dev, "deassert pipe_rst err %d\n", err);
> + dev_err(dev, "Couldn't deassert Core %d\n", err);
"Couldn't deassert Core resets %d"
- Mani
--
மணிவண்ணன் சதாசிவம்
More information about the Linux-rockchip
mailing list