From patchwork Thu Jul 27 05:31:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu X-Patchwork-Id: 13328747 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 6DB55EB64DD for ; Thu, 27 Jul 2023 05:33:56 +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=FD5tMTBWy/4q0V6WqdebRsTXFSCCfnt0+aRIM86zBac=; b=SRQovSkshepdI5 WrZQyfFzPZf/L+3d5NxHEMpy+5Aiueo8Ptyk1vW0PpdWhisYl6EZ9KstOrdr/+qHpLKGTQaQ9fj68 AqLFxJ2zLdINGkf97xA/friV8rrOmv3+keTSq+S7HBMbtJ9tmHY2i2/bA7/xfXm6tEN0Cx2IhA2bv yPjMvUrr4E46Y52iUrFKytJ4z9Dk9oQprJUJ+px+vtIG5ZmnKG/l6FIVc8BxPyDj+U6yguuSPJ54E vGEYlcMcvRvLXd5xg/inL+XGb5/ordzjHAo5zWG4mFLfwtMMB7u2ry5nfUgyv/ZwSwHGci9mAg0Kq LrfqdxyUzXz+X3TGn3zQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qOtcx-00CBsW-0x; Thu, 27 Jul 2023 05:33:31 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qOtct-00CBqv-1Z for linux-arm-kernel@lists.infradead.org; Thu, 27 Jul 2023 05:33:29 +0000 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1bb7b8390e8so3285545ad.2 for ; Wed, 26 Jul 2023 22:33:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1690436007; x=1691040807; 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=ET3auG+YOLxA4Kz/fjW90vjtO8YNjKzJmKaIU71PEwg=; b=Qky0ouzrEazF7OV6EacrIQAM3rX40oemivrHJMql2tdK1nPdQkUqW3UsotdaVdtp1O utQ/MHsxc2TDqlW3sNgwqjIBhxQu5qqeKeY26RZ53DY6jPwCHs0W3F1/4EDiUpEAJDdk lU2WWR6bDv5AFIvQ4U1eoprq93jq87qlJ0v/PSGYsgOpYWz5W6W3om4khGaePa48odAp KVCwwcG0OXprw/mPnCjw3X0EylLgiRU6usjob8l8R1O+/WAX5Y2eg4Z3tBdN6zz7RV42 iDSIAbqpMLiPWekaaUPDt3ktUQvfxwzAUxuTg1GYsVsZVIQgx4NMk2WGg1vs90+DjJpk OroA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690436007; x=1691040807; 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=ET3auG+YOLxA4Kz/fjW90vjtO8YNjKzJmKaIU71PEwg=; b=fn3RREnsJCd3Fr7s74P1VHk/e3sj+mHg/jzsEGhGEnYXN5YfxK00dVIu7MtE86V8Ml UJ8TbJ49oi9oM1yNWHSh1EPtTidcNe8x9H/RrbBQLh37GKYWgR6/PDrVY5rzWJ1xZY4d FNBaGkKeRKAufdxgIB2RABeWlZH1zfOX/gF60e7gALf7V6BE0G4JXfXv3uxa9+o93SNO hcMbgg78/GdSox4DVvgKGUlZSJqHLxMHUS17Z21VE1ffqApyaC8TrEscJ1gfdsJ6Qdw+ us0Jq9+WvqasQgeWxOt+/a+S5dCXNy1ysEbkQ0C39pxGtsKotfbbqpVNlihW8DGD4Cx7 4OoQ== X-Gm-Message-State: ABy/qLbrlhaKfHo7WktFmNRAM2WLXIWUKHfWBuRJddkDhPXrdLjLDrt9 jKGxzv434RbLKmODAamGf3CZoA== X-Google-Smtp-Source: APBJJlF5djb+zVDVYWi+jQX6mFMN3qj/+EXFOyxmNMw6sHbNTiuDfY+nvggI6LNZBReVZGkB9Hq9xQ== X-Received: by 2002:a17:903:22c9:b0:1b8:30d8:bc45 with SMTP id y9-20020a17090322c900b001b830d8bc45mr3989756plg.47.1690436006998; Wed, 26 Jul 2023 22:33:26 -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.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 22:33:26 -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 08/42] clk: at91: clk-h32mx: add support for parent_hw Date: Thu, 27 Jul 2023 08:31:22 +0300 Message-Id: <20230727053156.13587-9-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_223327_533257_2652A110 X-CRM114-Status: GOOD ( 17.16 ) 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 h32mx 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-h32mx 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/clk-h32mx.c | 13 +++++++++---- drivers/clk/at91/dt-compat.c | 2 +- drivers/clk/at91/pmc.h | 2 +- drivers/clk/at91/sama5d2.c | 2 +- drivers/clk/at91/sama5d4.c | 2 +- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/clk/at91/clk-h32mx.c b/drivers/clk/at91/clk-h32mx.c index 1e6c12eeda10..d7cdade56454 100644 --- a/drivers/clk/at91/clk-h32mx.c +++ b/drivers/clk/at91/clk-h32mx.c @@ -83,10 +83,10 @@ static const struct clk_ops h32mx_ops = { struct clk_hw * __init at91_clk_register_h32mx(struct regmap *regmap, const char *name, - const char *parent_name) + const char *parent_name, struct clk_hw *parent_hw) { struct clk_sama5d4_h32mx *h32mxclk; - struct clk_init_data init; + struct clk_init_data init = {}; int ret; h32mxclk = kzalloc(sizeof(*h32mxclk), GFP_KERNEL); @@ -95,8 +95,13 @@ at91_clk_register_h32mx(struct regmap *regmap, const char *name, init.name = name; init.ops = &h32mx_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; h32mxclk->hw.init = &init; diff --git a/drivers/clk/at91/dt-compat.c b/drivers/clk/at91/dt-compat.c index 6e010b5cb435..8540234e9d89 100644 --- a/drivers/clk/at91/dt-compat.c +++ b/drivers/clk/at91/dt-compat.c @@ -201,7 +201,7 @@ static void __init of_sama5d4_clk_h32mx_setup(struct device_node *np) parent_name = of_clk_get_parent_name(np, 0); - hw = at91_clk_register_h32mx(regmap, name, parent_name); + hw = at91_clk_register_h32mx(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 3f7ad79db4db..1604b44f2945 100644 --- a/drivers/clk/at91/pmc.h +++ b/drivers/clk/at91/pmc.h @@ -150,7 +150,7 @@ at91_clk_register_generated(struct regmap *regmap, spinlock_t *lock, struct clk_hw * __init at91_clk_register_h32mx(struct regmap *regmap, const char *name, - const char *parent_name); + const char *parent_name, struct clk_hw *parent_hw); struct clk_hw * __init at91_clk_i2s_mux_register(struct regmap *regmap, const char *name, diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c index 7904f2122ed7..8c7ff0108b41 100644 --- a/drivers/clk/at91/sama5d2.c +++ b/drivers/clk/at91/sama5d2.c @@ -276,7 +276,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np) sama5d2_pmc->chws[PMC_MCK] = hw; - hw = at91_clk_register_h32mx(regmap, "h32mxck", "masterck_div"); + hw = at91_clk_register_h32mx(regmap, "h32mxck", "masterck_div", NULL); if (IS_ERR(hw)) goto err_free; diff --git a/drivers/clk/at91/sama5d4.c b/drivers/clk/at91/sama5d4.c index 7cda8032653e..04c848cd7001 100644 --- a/drivers/clk/at91/sama5d4.c +++ b/drivers/clk/at91/sama5d4.c @@ -214,7 +214,7 @@ static void __init sama5d4_pmc_setup(struct device_node *np) sama5d4_pmc->chws[PMC_MCK] = hw; - hw = at91_clk_register_h32mx(regmap, "h32mxck", "masterck_div"); + hw = at91_clk_register_h32mx(regmap, "h32mxck", "masterck_div", NULL); if (IS_ERR(hw)) goto err_free;