From patchwork Thu Jul 27 05:31:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu X-Patchwork-Id: 13328743 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 56276C001DC for ; Thu, 27 Jul 2023 05:33:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OzH46GX4urNBvVBYuTGLXuoU1W1QAcv3U8VZkYJaYfg=; b=IkxI+1FWQUgPoJ mQ2+wkNql8a6K1DFa6L4J34BqAYlstSVGWAAYsDzs2RBptjj4EFBv43/+wIHWbqFcdPU0kfRW3TDP MRAPrXIyfxeTnOAmFTCAcZg9HBfYjEF8IPhOL08WD3v7cfKv+5bSP5lz833rXMcN4E9inLHeThjBJ Wci6kUxGfC9tPjd8mZl9kxCJUn1cuxhE1nZ4lazHgCE01wU3IVre0LYQisdKoXZ/lTCXaApwD2P4C yApBRqgjU0XjM582S+r6A72pqIGuSKVEKscC2U9PH3zg8CIZMtcdI44RHN03O/5Iv7buu89PH1T6p 4OmNIqsvUyS2jiHkQuVw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qOtcf-00CBkn-2g; Thu, 27 Jul 2023 05:33:13 +0000 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qOtca-00CBi5-1R for linux-arm-kernel@lists.infradead.org; Thu, 27 Jul 2023 05:33:10 +0000 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1b89d47ffb6so3414115ad.2 for ; Wed, 26 Jul 2023 22:33:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1690435985; x=1691040785; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mS51ZmJrNJRKzR5R8YYwfuBh1xwTctc46iViNhup/Iw=; b=a+aBIZxHWndgPLFmvXqnrfV1/Zes4TfvXi4F37flkt+iHpLt30VDFM1cmtuhTCRYX3 ojMASInkq4m53QK+3xPQudB5jfolz4FVZ5gXcx8OpRGHihcCvLLjt8uWIiOL4jOUsCbD s7oUsu6C0SYG792EAErxf+JpOlzCYo9N0KtZp6TW4QrtIvwerXgzkRmf93XPgPs74zNK DOOEViCfoA4irCztQRKncoa/z0w5zVIBHkPp7T3cwmfQeFI+bTSJREc4ZfYe+HPrePfw 7o+Wv2UUTl8YmGormBtv8f1WVFv84sMbQ8n7ODaJ4SOjFcWcOREvXX17Sm84g4XSRm1W pO/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690435985; x=1691040785; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mS51ZmJrNJRKzR5R8YYwfuBh1xwTctc46iViNhup/Iw=; b=DKIv+NXTDvMOvaxR3t7zel7nkFbeuQLQXqrI+VGWrNiFI+rOAMjA6Xfxas2sTOFxke KsRVOImZ3ZUpQAQoHK2EhMMxqQYb3ZVfpbl3P6Cudiiy4nNo5969S01NhADfQgfIE7mr m3dhvrv3VFCFaZtKbiG5hb0i7soeDzO3yNNNuRIYwPzCzfPBlzwPIUzXPF/VspeKlmUl MIDfBPdEC5xM1IOwfFyJHARa+2YpeAazpdwlEJlXNXiZPiTiq3eOf061imACVuIQcGa2 2xmiA9VbIKLxTZjzBM31A8L704++YnzNSMm8ivJDqBedlR1GduGc79CyDXI8yfDL7kjv FH6w== X-Gm-Message-State: ABy/qLaQVOfwD5W62lY7yw0DX0l2hiZVsp+ZVQUt/eDHmo9WnCNPzjZj T1lGBxXu5An3BuxBTueczpxk4w== X-Google-Smtp-Source: APBJJlHQDI/g7NUGzywOkdGH97lX4hE++O1875qEi81EkWhkKvN55oF3sEhivdPFuNR8aQY2Cu38Mg== X-Received: by 2002:a17:902:e80f:b0:1b8:b436:bef3 with SMTP id u15-20020a170902e80f00b001b8b436bef3mr4111821plg.24.1690435985384; Wed, 26 Jul 2023 22:33:05 -0700 (PDT) Received: from localhost.localdomain ([82.78.167.79]) by smtp.gmail.com with ESMTPSA id 21-20020a170902c11500b001bb889530adsm319059pli.217.2023.07.26.22.32.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 22:33:05 -0700 (PDT) From: Claudiu Beznea To: mturquette@baylibre.com, sboyd@kernel.org, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, mripard@kernel.org Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, varshini.rajendran@microchip.com, Claudiu Beznea Subject: [PATCH 05/42] clk: at91: clk-pll: add support for parent_hw Date: Thu, 27 Jul 2023 08:31:19 +0300 Message-Id: <20230727053156.13587-6-claudiu.beznea@tuxon.dev> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230727053156.13587-1-claudiu.beznea@tuxon.dev> References: <20230727053156.13587-1-claudiu.beznea@tuxon.dev> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230726_223308_486495_D3C590F5 X-CRM114-Status: GOOD ( 17.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add support for parent_hw in pll clock driver. With this parent-child relation is described with pointers rather than strings making registration a bit faster. All the SoC based drivers that rely on clk-pll were adapted to the new API change. The switch itself for SoCs will be done in subsequent patches. Signed-off-by: Claudiu Beznea --- drivers/clk/at91/at91rm9200.c | 4 ++-- drivers/clk/at91/at91sam9260.c | 4 ++-- drivers/clk/at91/at91sam9g45.c | 2 +- drivers/clk/at91/at91sam9n12.c | 4 ++-- drivers/clk/at91/at91sam9rl.c | 2 +- drivers/clk/at91/at91sam9x5.c | 2 +- drivers/clk/at91/clk-pll.c | 9 ++++++--- drivers/clk/at91/dt-compat.c | 2 +- drivers/clk/at91/pmc.h | 2 +- drivers/clk/at91/sama5d2.c | 2 +- drivers/clk/at91/sama5d3.c | 2 +- drivers/clk/at91/sama5d4.c | 2 +- 12 files changed, 20 insertions(+), 17 deletions(-) diff --git a/drivers/clk/at91/at91rm9200.c b/drivers/clk/at91/at91rm9200.c index e5a034f208d8..623e232ec9c6 100644 --- a/drivers/clk/at91/at91rm9200.c +++ b/drivers/clk/at91/at91rm9200.c @@ -119,7 +119,7 @@ static void __init at91rm9200_pmc_setup(struct device_node *np) at91rm9200_pmc->chws[PMC_MAIN] = hw; - hw = at91_clk_register_pll(regmap, "pllack", "mainck", 0, + hw = at91_clk_register_pll(regmap, "pllack", "mainck", NULL, 0, &at91rm9200_pll_layout, &rm9200_pll_characteristics); if (IS_ERR(hw)) @@ -127,7 +127,7 @@ static void __init at91rm9200_pmc_setup(struct device_node *np) at91rm9200_pmc->chws[PMC_PLLACK] = hw; - hw = at91_clk_register_pll(regmap, "pllbck", "mainck", 1, + hw = at91_clk_register_pll(regmap, "pllbck", "mainck", NULL, 1, &at91rm9200_pll_layout, &rm9200_pll_characteristics); if (IS_ERR(hw)) diff --git a/drivers/clk/at91/at91sam9260.c b/drivers/clk/at91/at91sam9260.c index ae6f126f204a..f39deb3ec00a 100644 --- a/drivers/clk/at91/at91sam9260.c +++ b/drivers/clk/at91/at91sam9260.c @@ -395,7 +395,7 @@ static void __init at91sam926x_pmc_setup(struct device_node *np, slck_name = slowxtal_name; } - hw = at91_clk_register_pll(regmap, "pllack", "mainck", 0, + hw = at91_clk_register_pll(regmap, "pllack", "mainck", NULL, 0, data->plla_layout, data->plla_characteristics); if (IS_ERR(hw)) @@ -403,7 +403,7 @@ static void __init at91sam926x_pmc_setup(struct device_node *np, at91sam9260_pmc->chws[PMC_PLLACK] = hw; - hw = at91_clk_register_pll(regmap, "pllbck", "mainck", 1, + hw = at91_clk_register_pll(regmap, "pllbck", "mainck", NULL, 1, data->pllb_layout, data->pllb_characteristics); if (IS_ERR(hw)) diff --git a/drivers/clk/at91/at91sam9g45.c b/drivers/clk/at91/at91sam9g45.c index 684d2bcb36e8..3436a09a6e8a 100644 --- a/drivers/clk/at91/at91sam9g45.c +++ b/drivers/clk/at91/at91sam9g45.c @@ -134,7 +134,7 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np) at91sam9g45_pmc->chws[PMC_MAIN] = hw; - hw = at91_clk_register_pll(regmap, "pllack", "mainck", 0, + hw = at91_clk_register_pll(regmap, "pllack", "mainck", NULL, 0, &at91rm9200_pll_layout, &plla_characteristics); if (IS_ERR(hw)) goto err_free; diff --git a/drivers/clk/at91/at91sam9n12.c b/drivers/clk/at91/at91sam9n12.c index 9fc20b177b13..80ccd4a49df3 100644 --- a/drivers/clk/at91/at91sam9n12.c +++ b/drivers/clk/at91/at91sam9n12.c @@ -160,7 +160,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np) at91sam9n12_pmc->chws[PMC_MAIN] = hw; - hw = at91_clk_register_pll(regmap, "pllack", "mainck", 0, + hw = at91_clk_register_pll(regmap, "pllack", "mainck", NULL, 0, &at91rm9200_pll_layout, &plla_characteristics); if (IS_ERR(hw)) goto err_free; @@ -171,7 +171,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np) at91sam9n12_pmc->chws[PMC_PLLACK] = hw; - hw = at91_clk_register_pll(regmap, "pllbck", "mainck", 1, + hw = at91_clk_register_pll(regmap, "pllbck", "mainck", NULL, 1, &at91rm9200_pll_layout, &pllb_characteristics); if (IS_ERR(hw)) goto err_free; diff --git a/drivers/clk/at91/at91sam9rl.c b/drivers/clk/at91/at91sam9rl.c index 969f809e7d65..0e8657aac491 100644 --- a/drivers/clk/at91/at91sam9rl.c +++ b/drivers/clk/at91/at91sam9rl.c @@ -101,7 +101,7 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np) at91sam9rl_pmc->chws[PMC_MAIN] = hw; - hw = at91_clk_register_pll(regmap, "pllack", "mainck", 0, + hw = at91_clk_register_pll(regmap, "pllack", "mainck", NULL, 0, &at91rm9200_pll_layout, &sam9rl_plla_characteristics); if (IS_ERR(hw)) diff --git a/drivers/clk/at91/at91sam9x5.c b/drivers/clk/at91/at91sam9x5.c index 5728cfb9036f..6b8c755fefdf 100644 --- a/drivers/clk/at91/at91sam9x5.c +++ b/drivers/clk/at91/at91sam9x5.c @@ -182,7 +182,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np, at91sam9x5_pmc->chws[PMC_MAIN] = hw; - hw = at91_clk_register_pll(regmap, "pllack", "mainck", 0, + hw = at91_clk_register_pll(regmap, "pllack", "mainck", NULL, 0, &at91rm9200_pll_layout, &plla_characteristics); if (IS_ERR(hw)) goto err_free; diff --git a/drivers/clk/at91/clk-pll.c b/drivers/clk/at91/clk-pll.c index 249d6a53cedf..afd48cbaa6db 100644 --- a/drivers/clk/at91/clk-pll.c +++ b/drivers/clk/at91/clk-pll.c @@ -310,13 +310,13 @@ static const struct clk_ops pll_ops = { struct clk_hw * __init at91_clk_register_pll(struct regmap *regmap, const char *name, - const char *parent_name, u8 id, + const char *parent_name, struct clk_hw *parent_hw, u8 id, const struct clk_pll_layout *layout, const struct clk_pll_characteristics *characteristics) { struct clk_pll *pll; struct clk_hw *hw; - struct clk_init_data init; + struct clk_init_data init = {}; int offset = PLL_REG(id); unsigned int pllr; int ret; @@ -330,7 +330,10 @@ at91_clk_register_pll(struct regmap *regmap, const char *name, init.name = name; init.ops = &pll_ops; - init.parent_names = &parent_name; + if (parent_hw) + init.parent_hws = (const struct clk_hw **)&parent_hw; + else + init.parent_names = &parent_name; init.num_parents = 1; init.flags = CLK_SET_RATE_GATE; diff --git a/drivers/clk/at91/dt-compat.c b/drivers/clk/at91/dt-compat.c index ead99948375b..d8e520e509d8 100644 --- a/drivers/clk/at91/dt-compat.c +++ b/drivers/clk/at91/dt-compat.c @@ -664,7 +664,7 @@ of_at91_clk_pll_setup(struct device_node *np, if (!characteristics) return; - hw = at91_clk_register_pll(regmap, name, parent_name, id, layout, + hw = at91_clk_register_pll(regmap, name, parent_name, NULL, id, layout, characteristics); if (IS_ERR(hw)) goto out_free_characteristics; diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h index 515a3c5595b7..ce68c1b1fb70 100644 --- a/drivers/clk/at91/pmc.h +++ b/drivers/clk/at91/pmc.h @@ -211,7 +211,7 @@ at91_clk_register_sam9x5_peripheral(struct regmap *regmap, spinlock_t *lock, struct clk_hw * __init at91_clk_register_pll(struct regmap *regmap, const char *name, - const char *parent_name, u8 id, + const char *parent_name, struct clk_hw *parent_hw, u8 id, const struct clk_pll_layout *layout, const struct clk_pll_characteristics *characteristics); struct clk_hw * __init diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c index 8bbc34e22cda..bc62b9ed4ea0 100644 --- a/drivers/clk/at91/sama5d2.c +++ b/drivers/clk/at91/sama5d2.c @@ -215,7 +215,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np) sama5d2_pmc->chws[PMC_MAIN] = hw; - hw = at91_clk_register_pll(regmap, "pllack", "mainck", 0, + hw = at91_clk_register_pll(regmap, "pllack", "mainck", NULL, 0, &sama5d3_pll_layout, &plla_characteristics); if (IS_ERR(hw)) goto err_free; diff --git a/drivers/clk/at91/sama5d3.c b/drivers/clk/at91/sama5d3.c index 05d0cdd22bc4..9d86c350a1e7 100644 --- a/drivers/clk/at91/sama5d3.c +++ b/drivers/clk/at91/sama5d3.c @@ -161,7 +161,7 @@ static void __init sama5d3_pmc_setup(struct device_node *np) if (IS_ERR(hw)) goto err_free; - hw = at91_clk_register_pll(regmap, "pllack", "mainck", 0, + hw = at91_clk_register_pll(regmap, "pllack", "mainck", NULL, 0, &sama5d3_pll_layout, &plla_characteristics); if (IS_ERR(hw)) goto err_free; diff --git a/drivers/clk/at91/sama5d4.c b/drivers/clk/at91/sama5d4.c index da84b4cef827..8491b1e0391d 100644 --- a/drivers/clk/at91/sama5d4.c +++ b/drivers/clk/at91/sama5d4.c @@ -176,7 +176,7 @@ static void __init sama5d4_pmc_setup(struct device_node *np) if (IS_ERR(hw)) goto err_free; - hw = at91_clk_register_pll(regmap, "pllack", "mainck", 0, + hw = at91_clk_register_pll(regmap, "pllack", "mainck", NULL, 0, &sama5d3_pll_layout, &plla_characteristics); if (IS_ERR(hw)) goto err_free;