0048-v6.1-clk-qcom-reset-Allow-specifying-custom-reset-delay.patch 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. From 72bc31aa621e21a7c36a7da8aa6f6a77bb234e0b Mon Sep 17 00:00:00 2001
  2. From: Stephan Gerhold <[email protected]>
  3. Date: Wed, 6 Jul 2022 15:41:29 +0200
  4. Subject: [PATCH] clk: qcom: reset: Allow specifying custom reset delay
  5. The amount of time required between asserting and deasserting the reset
  6. signal can vary depending on the involved hardware component. Sometimes
  7. 1 us might not be enough and a larger delay is necessary to conform to
  8. the specifications.
  9. Usually this is worked around in the consuming drivers, by replacing
  10. reset_control_reset() with a sequence of reset_control_assert(), waiting
  11. for a custom delay, followed by reset_control_deassert().
  12. However, in some cases the driver making use of the reset is generic and
  13. can be used with different reset controllers. In this case the reset
  14. time requirement is better handled directly by the reset controller
  15. driver.
  16. Make this possible by adding an "udelay" field to the qcom_reset_map
  17. that allows setting a different reset delay (in microseconds).
  18. Signed-off-by: Stephan Gerhold <[email protected]>
  19. Signed-off-by: Bjorn Andersson <[email protected]>
  20. Link: https://lore.kernel.org/r/[email protected]
  21. ---
  22. drivers/clk/qcom/reset.c | 4 +++-
  23. drivers/clk/qcom/reset.h | 1 +
  24. 2 files changed, 4 insertions(+), 1 deletion(-)
  25. --- a/drivers/clk/qcom/reset.c
  26. +++ b/drivers/clk/qcom/reset.c
  27. @@ -13,8 +13,10 @@
  28. static int qcom_reset(struct reset_controller_dev *rcdev, unsigned long id)
  29. {
  30. + struct qcom_reset_controller *rst = to_qcom_reset_controller(rcdev);
  31. +
  32. rcdev->ops->assert(rcdev, id);
  33. - udelay(1);
  34. + udelay(rst->reset_map[id].udelay ?: 1); /* use 1 us as default */
  35. rcdev->ops->deassert(rcdev, id);
  36. return 0;
  37. }
  38. --- a/drivers/clk/qcom/reset.h
  39. +++ b/drivers/clk/qcom/reset.h
  40. @@ -11,6 +11,7 @@
  41. struct qcom_reset_map {
  42. unsigned int reg;
  43. u8 bit;
  44. + u8 udelay;
  45. };
  46. struct regmap;