Re: [PATCH v3 3/3] mfd: madera: Add support for requesting the supply clocks
From: Lee Jones
Date: Fri Oct 04 2019 - 10:34:17 EST
On Tue, 01 Oct 2019, Charles Keepax wrote:
> Add the ability to get the clock for each clock input pin of the chip
> and enable MCLK2 since that is expected to be a permanently enabled
> 32kHz clock.
>
> Signed-off-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>
> ---
>
> Changes since v2:
> - Use new devm_clk_bulk_get_optional API
>
> Thanks,
> Charles
>
> drivers/mfd/madera-core.c | 27 ++++++++++++++++++++++++++-
> include/linux/mfd/madera/core.h | 11 +++++++++++
> 2 files changed, 37 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mfd/madera-core.c b/drivers/mfd/madera-core.c
> index 29540cbf75934..88d904eb016ea 100644
> --- a/drivers/mfd/madera-core.c
> +++ b/drivers/mfd/madera-core.c
> @@ -450,6 +450,21 @@ int madera_dev_init(struct madera *madera)
> sizeof(madera->pdata));
> }
>
> + madera->mclk[MADERA_MCLK1].id = "mclk1";
> + madera->mclk[MADERA_MCLK2].id = "mclk2";
> + madera->mclk[MADERA_MCLK3].id = "mclk3";
> +
> + ret = devm_clk_bulk_get_optional(madera->dev, ARRAY_SIZE(madera->mclk),
> + madera->mclk);
> + if (ret) {
> + dev_err(madera->dev, "Failed to get clocks: %d\n", ret);
> + return ret;
> + }
> +
> + /* Not using devm_clk_get to prevent breakage of existing DTs */
> + if (!madera->mclk[MADERA_MCLK2].clk)
> + dev_warn(madera->dev, "Missing MCLK2, requires 32kHz clock\n");
> +
> ret = madera_get_reset_gpio(madera);
> if (ret)
> return ret;
> @@ -660,13 +675,19 @@ int madera_dev_init(struct madera *madera)
> }
>
> /* Init 32k clock sourced from MCLK2 */
> + ret = clk_prepare_enable(madera->mclk[MADERA_MCLK2].clk);
> + if (ret != 0) {
Nit: Why is this not 'if (ret)' like in the rest of the file?
--
Lee Jones [æçæ]
Linaro Services Technical Lead
Linaro.org â Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog