816-v6.7-0001-nvmem-qfprom-Mark-core-clk-as-optional.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. From 16724d6ea40a2c9315f5a0d81005dfa4d7a6da24 Mon Sep 17 00:00:00 2001
  2. From: Luca Weiss <[email protected]>
  3. Date: Fri, 20 Oct 2023 11:55:40 +0100
  4. Subject: [PATCH] nvmem: qfprom: Mark core clk as optional
  5. On some platforms like sc7280 on non-ChromeOS devices the core clock
  6. cannot be touched by Linux so we cannot provide it. Mark it as optional
  7. as accessing qfprom for reading works without it but we still prohibit
  8. writing if we cannot provide the clock.
  9. Signed-off-by: Luca Weiss <[email protected]>
  10. Reviewed-by: Douglas Anderson <[email protected]>
  11. Signed-off-by: Srinivas Kandagatla <[email protected]>
  12. Link: https://lore.kernel.org/r/[email protected]
  13. Signed-off-by: Greg Kroah-Hartman <[email protected]>
  14. ---
  15. drivers/nvmem/qfprom.c | 6 +++---
  16. 1 file changed, 3 insertions(+), 3 deletions(-)
  17. --- a/drivers/nvmem/qfprom.c
  18. +++ b/drivers/nvmem/qfprom.c
  19. @@ -423,12 +423,12 @@ static int qfprom_probe(struct platform_
  20. if (IS_ERR(priv->vcc))
  21. return PTR_ERR(priv->vcc);
  22. - priv->secclk = devm_clk_get(dev, "core");
  23. + priv->secclk = devm_clk_get_optional(dev, "core");
  24. if (IS_ERR(priv->secclk))
  25. return dev_err_probe(dev, PTR_ERR(priv->secclk), "Error getting clock\n");
  26. - /* Only enable writing if we have SoC data. */
  27. - if (priv->soc_data)
  28. + /* Only enable writing if we have SoC data and a valid clock */
  29. + if (priv->soc_data && priv->secclk)
  30. econfig.reg_write = qfprom_reg_write;
  31. }