Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nvmem: qfprom: Mark core clk as optional

On some platforms like sc7280 on non-ChromeOS devices the core clock
cannot be touched by Linux so we cannot provide it. Mark it as optional
as accessing qfprom for reading works without it but we still prohibit
writing if we cannot provide the clock.

Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20231020105545.216052-2-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Luca Weiss and committed by
Greg Kroah-Hartman
16724d6e 2399cde8

+3 -3
+3 -3
drivers/nvmem/qfprom.c
··· 423 423 if (IS_ERR(priv->vcc)) 424 424 return PTR_ERR(priv->vcc); 425 425 426 - priv->secclk = devm_clk_get(dev, "core"); 426 + priv->secclk = devm_clk_get_optional(dev, "core"); 427 427 if (IS_ERR(priv->secclk)) 428 428 return dev_err_probe(dev, PTR_ERR(priv->secclk), "Error getting clock\n"); 429 429 430 - /* Only enable writing if we have SoC data. */ 431 - if (priv->soc_data) 430 + /* Only enable writing if we have SoC data and a valid clock */ 431 + if (priv->soc_data && priv->secclk) 432 432 econfig.reg_write = qfprom_reg_write; 433 433 } 434 434