From patchwork Mon Aug 26 17:31:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu X-Patchwork-Id: 13778298 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 C4AA8C5472D for ; Mon, 26 Aug 2024 17:34:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=T6d3SxVVUntGvoi8mj5sPmGncnkMXFV/48WyNCD8DSU=; b=nCD2OAuV6Vic5qchKBFqZXnWNr IlpDRQz/9rv+3xg5PcUfPy/T64FocumQFXODNofS9vUaOrz/q91yg7GTn2In53o7h+e6u/kuZOIk4 p8sP3wfg6jhE76tq0zH1TThFAbFjBjm7/19zddIaacl6XB9/0kaf/WMHgVrdphognt3QVYDjds8Rt cD3/+4v1hLmrcI8i4EP3RSq2wEgDcyG5KAf2g3CmmDDNecv8KdFnQ3p/u+H/5/W6fHlKLYSM1Mn2Y OYnQE1DStuoCoiQQtAC7PxU0Q1gupAdEyVnrJ+ZUyjArgAV462Bm/BM5A7KPGBFakd0ARA7q78p27 v5ZzNPGA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sidbg-00000008FCV-3Boo; Mon, 26 Aug 2024 17:34:20 +0000 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sidYt-00000008EE9-0R2a for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2024 17:31:28 +0000 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-5bf009cf4c0so4840100a12.1 for ; Mon, 26 Aug 2024 10:31:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1724693485; x=1725298285; darn=lists.infradead.org; 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=T6d3SxVVUntGvoi8mj5sPmGncnkMXFV/48WyNCD8DSU=; b=ILAvFMNup/9Ym55E49njl/pQ+CAfWjazv/QERbT+vMjwbdkiMvch4bT6lz7vAysc3l CKFVWkwfkFWyd+UbfpHt2PgZ2GLqwgj82d/OMo4U9lG3tAIiuusI/UyxqUsf+gr0gSMf wIunki5l43H0HarxUQYSS/SPiEztPr8aSUxLMkn6vkNHgeSVIe2YgKcielV1OWiO1xRe d2YUAM9f9LiKPznOzWRJeUaUJvapos6P5sjyukRJHzABZc4e98zUexX/579nIRRKKq6u 4VycKTsEpv0tG+7DQV+kyRHWhICbHT1FEztAm/N5pZDfO7tUBJAyZiEKu9qRhxLCfqV3 tmbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724693485; x=1725298285; 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=T6d3SxVVUntGvoi8mj5sPmGncnkMXFV/48WyNCD8DSU=; b=H9OeHqsDIsJUu016G6F+TzIFiXhuGVr7OkI5CloTDWaVolN32j9QEOtyhrVY3+skDx Wets/OBsmtSLDxCLQdpSdrayb0FKZCTZZHFYkIsQYclOBeAd9iAv/cH2Qt/NtVHJQvdA iCtlHzeZtl+iHx2V80DH1R86RiBP20rPQK4vGaRWURotvec2tji8naZ0SLQcvLoCIBc+ 0bckxAvsA9ggn7d9pqtlSFqqACvXDfxiZ3SMIqmTRCUmufJ2w6BTjjxfhMSya2+lswQo su/51VjHkQtmkxhL3qkh5DiVaGnE2ZlXf18bUGMCQwjwp3vJeh+DktOX7BHPzx0laymB Oh7w== X-Gm-Message-State: AOJu0Yzz2CbDsJgWcq4Gindhb9c0eWrmkWIcgEF5cCV1QsMvm/idCRXN nRBPYKH+wbWnpxoQKl8me0x3wmxvLb74lGbHqZVpbuP+/4QzkOWQy5gtz1qYdyY= X-Google-Smtp-Source: AGHT+IHiI9MK7LwJswgkZ/FL0mpPIWeqZWfzXau9hCH4FnmMjNmUY2ZaDEh3Ipy7eVyECcjBOCqahA== X-Received: by 2002:a17:907:940b:b0:a86:8368:860a with SMTP id a640c23a62f3a-a86e3a4b1d1mr13656666b.35.1724693484699; Mon, 26 Aug 2024 10:31:24 -0700 (PDT) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.144]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a86e548781csm446566b.28.2024.08.26.10.31.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2024 10:31:24 -0700 (PDT) From: Claudiu Beznea To: nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, mturquette@baylibre.com, sboyd@kernel.org Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, Claudiu Beznea Subject: [PATCH 2/3] clk: at91: sckc: Use SCKC_{TD, MD}_SLCK IDs for clk32k clocks Date: Mon, 26 Aug 2024 20:31:15 +0300 Message-Id: <20240826173116.3628337-3-claudiu.beznea@tuxon.dev> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240826173116.3628337-1-claudiu.beznea@tuxon.dev> References: <20240826173116.3628337-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-20240826_103127_163883_BB11DC84 X-CRM114-Status: GOOD ( 14.92 ) 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 Use the newly introduced macros instead of raw numbers. With this the code is a bit easier to understand. Signed-off-by: Claudiu Beznea Reviewed-by: Alexander Dahl --- drivers/clk/at91/sckc.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/clk/at91/sckc.c b/drivers/clk/at91/sckc.c index 7741d8f3dbee..021d1b412af4 100644 --- a/drivers/clk/at91/sckc.c +++ b/drivers/clk/at91/sckc.c @@ -12,6 +12,8 @@ #include #include +#include + #define SLOW_CLOCK_FREQ 32768 #define SLOWCK_SW_CYCLES 5 #define SLOWCK_SW_TIME_USEC ((SLOWCK_SW_CYCLES * USEC_PER_SEC) / \ @@ -470,7 +472,7 @@ static void __init of_sam9x60_sckc_setup(struct device_node *np) { void __iomem *regbase = of_iomap(np, 0); struct clk_hw_onecell_data *clk_data; - struct clk_hw *slow_rc, *slow_osc; + struct clk_hw *slow_rc, *slow_osc, *hw; const char *xtal_name; const struct clk_hw *parent_hws[2]; static struct clk_parent_data parent_data = { @@ -506,19 +508,19 @@ static void __init of_sam9x60_sckc_setup(struct device_node *np) /* MD_SLCK and TD_SLCK. */ clk_data->num = 2; - clk_data->hws[0] = clk_hw_register_fixed_rate_parent_hw(NULL, "md_slck", - slow_rc, - 0, 32768); - if (IS_ERR(clk_data->hws[0])) + hw = clk_hw_register_fixed_rate_parent_hw(NULL, "md_slck", slow_rc, + 0, 32768); + if (IS_ERR(hw)) goto clk_data_free; + clk_data->hws[SCKC_MD_SLCK] = hw; parent_hws[0] = slow_rc; parent_hws[1] = slow_osc; - clk_data->hws[1] = at91_clk_register_sam9x5_slow(regbase, "td_slck", - parent_hws, 2, - &at91sam9x60_bits); - if (IS_ERR(clk_data->hws[1])) + hw = at91_clk_register_sam9x5_slow(regbase, "td_slck", parent_hws, + 2, &at91sam9x60_bits); + if (IS_ERR(hw)) goto unregister_md_slck; + clk_data->hws[SCKC_TD_SLCK] = hw; ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_data); if (WARN_ON(ret)) @@ -527,9 +529,9 @@ static void __init of_sam9x60_sckc_setup(struct device_node *np) return; unregister_td_slck: - at91_clk_unregister_sam9x5_slow(clk_data->hws[1]); + at91_clk_unregister_sam9x5_slow(clk_data->hws[SCKC_TD_SLCK]); unregister_md_slck: - clk_hw_unregister(clk_data->hws[0]); + clk_hw_unregister(clk_data->hws[SCKC_MD_SLCK]); clk_data_free: kfree(clk_data); unregister_slow_osc: