From patchwork Thu Jul 27 05:31:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 13328745 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 C23D8EB64DD for ; Thu, 27 Jul 2023 05:33:51 +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=y8djzpwSNG5eFbp+YhKcGgt8beIriZrg31ALO0oi6q0=; b=3pBRX1NF4fmVE9 Jhn8+r8V/GYH/aBWTmF5EUImIsoHSndk/+GJuHdM//+9d01U+5nlLY2S9yqGfVBPNFzhssA5O2ruk AS0Te05XPQOAaxW3ncvQmTbf77fuAXlDtu/FKp6qz36t7kABaHHsODE9ZwL9AUErZcpxWsFiaj3pR SNVCX/agbxm64H484LBtENJTC6fQONTsq1RQaLC2XbuWp3DoWD3OxThq0Ju54e0lDtds5c9v7TBMn uJBayRtaTpT67W1L1HM6uOYnA1BTqHxb6r6HwgD8LnKfJG5wnE3Sis3GtUouoKMfZV8l2Pq8cybHj xRdsn0mNFG7X93P3IflQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qOtcw-00CBs3-24; Thu, 27 Jul 2023 05:33:30 +0000 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qOtco-00CBnJ-1X for linux-arm-kernel@lists.infradead.org; Thu, 27 Jul 2023 05:33:24 +0000 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1bba2318546so4669435ad.1 for ; Wed, 26 Jul 2023 22:33:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1690435999; x=1691040799; 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=tDrEaG1FrYIYPpIkYqTQ35Nb2gC0x77uQ2+oCiptl8Y=; b=TNmQRH6XD/IQqkFuUnbUYHKPbUJtpCP9ZTd7hOjPFstkK4GGw2cOrkEXSJrRdk77Ss qool2eiA9B4NNiEyhGjOTFBRKoV+sCN/vODbxNiO65s2r5MD7FDhRuvbVn0hkwT0puLs lZbMQxJkqD2q1EoeXCK6avn+rNgNfXEH2ESjaDJBIgmjyvv5wgG0cT/ARkKS7mGBLa/h RTsQtwAxUuFX//+UIV4yaPX2gi+awiwQoglYmG+eXfzf0bVPFPNZRG24JgQ6hREbbVvo caVyWLd3gtrnrBIBYu4east4Mz0rJM6fKjwUTVYDM4AJwYNeU85+D4G/Sav7a4b7g3DT RblQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690435999; x=1691040799; 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=tDrEaG1FrYIYPpIkYqTQ35Nb2gC0x77uQ2+oCiptl8Y=; b=fJKPW84dz6/R0xSmmgsn+hdxhhYwz8IDisie3tL1avaduB75ft8P4kEhGftEOo0Obc ehBSJwDwoeuSyvlAOwpBkJY0hzxJzqNQVDbz7SOpCJ3nTHyGpM1SWDMPXzxGWlaVEBwU zNcOX1583oB3uHJak2/DFRW4D6bBnCr7cG9g5T7J/7ptxgLA6KFaNe8DJELtH25xwKle LcDHAnSXHR9bWuVm98eWUifElgh21Y/fZb37TaVQfWTsR1nwXC+FBJBoCMbkPD9ikjRg Y3j02PuQnxmoGgVfn5ZU3yumb32PD76PwU5/9hWTxJtzWxhI5VN/Ou398f4yqr+TEe30 VxUw== X-Gm-Message-State: ABy/qLZY/5Cij/z1714Q9tvbISwIA+F6yNuyHyuRo4HWlnNNTA8mJX4E nRsXAzy0fRt8Z6nPZ0GGd7SYIA== X-Google-Smtp-Source: APBJJlEZZy7NFVfWXUN3El4Q2vpfEVNjq1UmwljSqneIebgGoed5M6gxjkSL5k6eFM37B6jaUMi+9Q== X-Received: by 2002:a17:902:728a:b0:1b8:a19e:a3d3 with SMTP id d10-20020a170902728a00b001b8a19ea3d3mr3388752pll.52.1690435999541; Wed, 26 Jul 2023 22:33:19 -0700 (PDT) Received: from localhost.localdomain ([82.78.167.79]) by smtp.gmail.com with ESMTPSA id 21-20020a170902c11500b001bb889530adsm319059pli.217.2023.07.26.22.33.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 22:33:19 -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 07/42] clk: at91: clk-plldiv: add support for parent_hw Date: Thu, 27 Jul 2023 08:31:21 +0300 Message-Id: <20230727053156.13587-8-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_223322_542450_BF96EAE8 X-CRM114-Status: GOOD ( 17.56 ) 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 plldiv 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-plldiv 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/at91sam9g45.c | 2 +- drivers/clk/at91/at91sam9n12.c | 2 +- drivers/clk/at91/at91sam9x5.c | 2 +- drivers/clk/at91/clk-plldiv.c | 13 +++++++++---- 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 +- 9 files changed, 17 insertions(+), 12 deletions(-) diff --git a/drivers/clk/at91/at91sam9g45.c b/drivers/clk/at91/at91sam9g45.c index 3436a09a6e8a..cb98d22c2e30 100644 --- a/drivers/clk/at91/at91sam9g45.c +++ b/drivers/clk/at91/at91sam9g45.c @@ -139,7 +139,7 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np) if (IS_ERR(hw)) goto err_free; - hw = at91_clk_register_plldiv(regmap, "plladivck", "pllack"); + hw = at91_clk_register_plldiv(regmap, "plladivck", "pllack", NULL); if (IS_ERR(hw)) goto err_free; diff --git a/drivers/clk/at91/at91sam9n12.c b/drivers/clk/at91/at91sam9n12.c index 80ccd4a49df3..34dd7645f964 100644 --- a/drivers/clk/at91/at91sam9n12.c +++ b/drivers/clk/at91/at91sam9n12.c @@ -165,7 +165,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np) if (IS_ERR(hw)) goto err_free; - hw = at91_clk_register_plldiv(regmap, "plladivck", "pllack"); + hw = at91_clk_register_plldiv(regmap, "plladivck", "pllack", NULL); if (IS_ERR(hw)) goto err_free; diff --git a/drivers/clk/at91/at91sam9x5.c b/drivers/clk/at91/at91sam9x5.c index 6b8c755fefdf..37280852f086 100644 --- a/drivers/clk/at91/at91sam9x5.c +++ b/drivers/clk/at91/at91sam9x5.c @@ -187,7 +187,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np, if (IS_ERR(hw)) goto err_free; - hw = at91_clk_register_plldiv(regmap, "plladivck", "pllack"); + hw = at91_clk_register_plldiv(regmap, "plladivck", "pllack", NULL); if (IS_ERR(hw)) goto err_free; diff --git a/drivers/clk/at91/clk-plldiv.c b/drivers/clk/at91/clk-plldiv.c index ba3a1839a96d..1d5a0a6d299d 100644 --- a/drivers/clk/at91/clk-plldiv.c +++ b/drivers/clk/at91/clk-plldiv.c @@ -72,11 +72,11 @@ static const struct clk_ops plldiv_ops = { struct clk_hw * __init at91_clk_register_plldiv(struct regmap *regmap, const char *name, - const char *parent_name) + const char *parent_name, struct clk_hw *parent_hw) { struct clk_plldiv *plldiv; struct clk_hw *hw; - struct clk_init_data init; + struct clk_init_data init = {}; int ret; plldiv = kzalloc(sizeof(*plldiv), GFP_KERNEL); @@ -85,8 +85,13 @@ at91_clk_register_plldiv(struct regmap *regmap, const char *name, init.name = name; init.ops = &plldiv_ops; - init.parent_names = parent_name ? &parent_name : NULL; - init.num_parents = parent_name ? 1 : 0; + if (parent_hw) { + init.parent_hws = (const struct clk_hw **)&parent_hw; + init.num_parents = 1; + } else { + init.parent_names = parent_name ? &parent_name : NULL; + init.num_parents = parent_name ? 1 : 0; + } init.flags = CLK_SET_RATE_GATE; plldiv->hw.init = &init; diff --git a/drivers/clk/at91/dt-compat.c b/drivers/clk/at91/dt-compat.c index 6698a770d45a..6e010b5cb435 100644 --- a/drivers/clk/at91/dt-compat.c +++ b/drivers/clk/at91/dt-compat.c @@ -723,7 +723,7 @@ of_at91sam9x5_clk_plldiv_setup(struct device_node *np) if (IS_ERR(regmap)) return; - hw = at91_clk_register_plldiv(regmap, name, parent_name); + hw = at91_clk_register_plldiv(regmap, name, parent_name, NULL); if (IS_ERR(hw)) return; diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h index 6d541b4d3f50..3f7ad79db4db 100644 --- a/drivers/clk/at91/pmc.h +++ b/drivers/clk/at91/pmc.h @@ -216,7 +216,7 @@ at91_clk_register_pll(struct regmap *regmap, const char *name, const struct clk_pll_characteristics *characteristics); struct clk_hw * __init at91_clk_register_plldiv(struct regmap *regmap, const char *name, - const char *parent_name); + const char *parent_name, struct clk_hw *parent_hw); struct clk_hw * __init sam9x60_clk_register_div_pll(struct regmap *regmap, spinlock_t *lock, diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c index d2af421abddc..7904f2122ed7 100644 --- a/drivers/clk/at91/sama5d2.c +++ b/drivers/clk/at91/sama5d2.c @@ -220,7 +220,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np) if (IS_ERR(hw)) goto err_free; - hw = at91_clk_register_plldiv(regmap, "plladivck", "pllack"); + hw = at91_clk_register_plldiv(regmap, "plladivck", "pllack", NULL); if (IS_ERR(hw)) goto err_free; diff --git a/drivers/clk/at91/sama5d3.c b/drivers/clk/at91/sama5d3.c index 9d86c350a1e7..7f2ac8f648dd 100644 --- a/drivers/clk/at91/sama5d3.c +++ b/drivers/clk/at91/sama5d3.c @@ -166,7 +166,7 @@ static void __init sama5d3_pmc_setup(struct device_node *np) if (IS_ERR(hw)) goto err_free; - hw = at91_clk_register_plldiv(regmap, "plladivck", "pllack"); + hw = at91_clk_register_plldiv(regmap, "plladivck", "pllack", NULL); if (IS_ERR(hw)) goto err_free; diff --git a/drivers/clk/at91/sama5d4.c b/drivers/clk/at91/sama5d4.c index 8491b1e0391d..7cda8032653e 100644 --- a/drivers/clk/at91/sama5d4.c +++ b/drivers/clk/at91/sama5d4.c @@ -181,7 +181,7 @@ static void __init sama5d4_pmc_setup(struct device_node *np) if (IS_ERR(hw)) goto err_free; - hw = at91_clk_register_plldiv(regmap, "plladivck", "pllack"); + hw = at91_clk_register_plldiv(regmap, "plladivck", "pllack", NULL); if (IS_ERR(hw)) goto err_free;