From patchwork Wed May 29 09:35:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 13678534 Received: from laurent.telenet-ops.be (laurent.telenet-ops.be [195.130.137.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E21E716A360 for ; Wed, 29 May 2024 09:35:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.130.137.89 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716975325; cv=none; b=r+1MbSyhJpxrkyhaL6Rbc773WO12ZbtlKP+3piw0P+mnzMzsPW9hiVq+fJLQE37qIzGtNyE6ZV6nMeVt4kmxNmA7FNmsiOhLeA6VYiGGZX8HmBpQ4XkPA7jSqAUx/pQ6cUSBB10xT4VGIR4jcsXa0JNNWQzxFO+U4dj4pXoI86M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716975325; c=relaxed/simple; bh=DnWpyF+PBCTslYaCokf6Ls34+nQ1E77Jp4U1kForVio=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ot7BhUDQkcyiMY29yN/1Ni9XWzjXRp4lExBus6OGyf2xCbhug3FneSOsfPJ+GF+Nnn8sKc3v1jOc+F5N6mWGD12G8L+mziDV59obxWFdxNkk8+h4+iqEmEw2sKrR4xXsUgUx7kRHL39qeZz91kD10gxkyUTfAOytLkTWb9oKvxQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be; spf=none smtp.mailfrom=linux-m68k.org; arc=none smtp.client-ip=195.130.137.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed80:1b01:1838:131c:4de4]) by laurent.telenet-ops.be with bizsmtp id UxbE2C00a3VPV9V01xbErS; Wed, 29 May 2024 11:35:15 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1sCFhI-00GI2W-8d; Wed, 29 May 2024 11:35:14 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1sCFiE-008wVq-GH; Wed, 29 May 2024 11:35:14 +0200 From: Geert Uytterhoeven To: Michael Turquette , Stephen Boyd Cc: Ye Bin , linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 1/3] clk: renesas: r8a77970: Use common cpg_lock Date: Wed, 29 May 2024 11:35:08 +0200 Message-Id: <0cd9b5ffbe986bd7dc4ffb3f13492123432ee2e1.1716975021.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-clk@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 R-Car Gen3 Socs use the common CPG/MSSR library functions in rcar-cpg-lib.c, so the R-Car V3M sub-driver can use the common cpg_lock instead of a driver-private lock. Signed-off-by: Geert Uytterhoeven Reviewed-by: Stephen Boyd --- drivers/clk/renesas/r8a77970-cpg-mssr.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/clk/renesas/r8a77970-cpg-mssr.c b/drivers/clk/renesas/r8a77970-cpg-mssr.c index 7e90e94c4b68821b..3cec0f501b947eae 100644 --- a/drivers/clk/renesas/r8a77970-cpg-mssr.c +++ b/drivers/clk/renesas/r8a77970-cpg-mssr.c @@ -18,6 +18,7 @@ #include #include "renesas-cpg-mssr.h" +#include "rcar-cpg-lib.h" #include "rcar-gen3-cpg.h" #define CPG_SD0CKCR 0x0074 @@ -47,8 +48,6 @@ enum clk_ids { MOD_CLK_BASE }; -static spinlock_t cpg_lock; - static const struct clk_div_table cpg_sd0h_div_table[] = { { 0, 2 }, { 1, 3 }, { 2, 4 }, { 3, 6 }, { 4, 8 }, { 5, 12 }, { 6, 16 }, { 7, 18 }, @@ -213,8 +212,6 @@ static int __init r8a77970_cpg_mssr_init(struct device *dev) if (error) return error; - spin_lock_init(&cpg_lock); - cpg_pll_config = &cpg_pll_configs[CPG_PLL_CONFIG_INDEX(cpg_mode)]; return rcar_gen3_cpg_init(cpg_pll_config, CLK_EXTALR, cpg_mode); From patchwork Wed May 29 09:35:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 13678533 Received: from albert.telenet-ops.be (albert.telenet-ops.be [195.130.137.90]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A35A169AE6 for ; Wed, 29 May 2024 09:35:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.130.137.90 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716975319; cv=none; b=n2jQcCgF52sMQ/WyWeAwChyhJsuaE0X4fLl+QlJ/ucQBQ7BROyt/x1qZm/Fsthp4j8cI4X1r/erhADBUeSp82S5YrE4Bb1D9DUvKWqc2w0ccb/VEhhuXW1iGLCstQhtOJYvxxqZsUKQTvq4TT/K5lvHCvxvpU8zpAMYLIT8eQpE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716975319; c=relaxed/simple; bh=p0GwIFvIuNoiDhrfwoSepgtW0f3uoqrFum+m62dhXNY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nG5H0QHcSe1yLGu9s7tU1v2Rp5MgwvyqZtBexKak5eLTk29sldLpFo/PuuDOwwuj7hcQGTdvdUcHb6nu/k1r0FFParOzVygHudwT2NXwT4ADy8JbPAA0fSRNuPAOsYG2Ijo+E+J9DgCOQKuqM0bXmAw9fL7onnFHGNvLM+RehK4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be; spf=none smtp.mailfrom=linux-m68k.org; arc=none smtp.client-ip=195.130.137.90 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed80:1b01:1838:131c:4de4]) by albert.telenet-ops.be with bizsmtp id UxbE2C00f3VPV9V06xbEpY; Wed, 29 May 2024 11:35:15 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1sCFhI-00GI2X-8c; Wed, 29 May 2024 11:35:14 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1sCFiE-008wVt-Gv; Wed, 29 May 2024 11:35:14 +0200 From: Geert Uytterhoeven To: Michael Turquette , Stephen Boyd Cc: Ye Bin , linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 2/3] clk: renesas: cpg-lib: Use DEFINE_SPINLOCK() for global spinlock Date: Wed, 29 May 2024 11:35:09 +0200 Message-Id: <9073a6bfb7791e492156331fa8a0ea87a7c7cef6.1716975021.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-clk@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 A global spinlock can be initialized automatically with DEFINE_SPINLOCK() rather than explicitly calling spin_lock_init(). Suggested-by: Ye Bin Signed-off-by: Geert Uytterhoeven Reviewed-by: Stephen Boyd --- drivers/clk/renesas/rcar-cpg-lib.c | 2 +- drivers/clk/renesas/rcar-gen3-cpg.c | 2 -- drivers/clk/renesas/rcar-gen4-cpg.c | 2 -- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/clk/renesas/rcar-cpg-lib.c b/drivers/clk/renesas/rcar-cpg-lib.c index 5a15f8788b9227d9..42b126ea3e1337c1 100644 --- a/drivers/clk/renesas/rcar-cpg-lib.c +++ b/drivers/clk/renesas/rcar-cpg-lib.c @@ -22,7 +22,7 @@ #include "rcar-cpg-lib.h" -spinlock_t cpg_lock; +DEFINE_SPINLOCK(cpg_lock); void cpg_reg_modify(void __iomem *reg, u32 clear, u32 set) { diff --git a/drivers/clk/renesas/rcar-gen3-cpg.c b/drivers/clk/renesas/rcar-gen3-cpg.c index d0129a6509411662..20b89eb6c35c1f07 100644 --- a/drivers/clk/renesas/rcar-gen3-cpg.c +++ b/drivers/clk/renesas/rcar-gen3-cpg.c @@ -551,7 +551,5 @@ int __init rcar_gen3_cpg_init(const struct rcar_gen3_cpg_pll_config *config, cpg_quirks = (uintptr_t)attr->data; pr_debug("%s: mode = 0x%x quirks = 0x%x\n", __func__, mode, cpg_quirks); - spin_lock_init(&cpg_lock); - return 0; } diff --git a/drivers/clk/renesas/rcar-gen4-cpg.c b/drivers/clk/renesas/rcar-gen4-cpg.c index 8e4559fbb0bc3352..0e2c27adcfe784a0 100644 --- a/drivers/clk/renesas/rcar-gen4-cpg.c +++ b/drivers/clk/renesas/rcar-gen4-cpg.c @@ -507,7 +507,5 @@ int __init rcar_gen4_cpg_init(const struct rcar_gen4_cpg_pll_config *config, cpg_clk_extalr = clk_extalr; cpg_mode = mode; - spin_lock_init(&cpg_lock); - return 0; } From patchwork Wed May 29 09:35:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 13678531 Received: from andre.telenet-ops.be (andre.telenet-ops.be [195.130.132.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E34AA175B1 for ; Wed, 29 May 2024 09:35:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.130.132.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716975318; cv=none; b=m49JOgAPRPpAREQjUHo5lX+O4g/gBU/yyjZtcUHUxqMVdREnomoeOTBkDjtD8P1ejxQKVVdZxEPEmy/bZEKqHJf4BsUnZ57hT3enx7fNQtMftD/n6GATY/kHmdJJiHulwqBPFpiWQYe81Qdk9XvwraTyLetJAnD25FTf6I/+i+c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716975318; c=relaxed/simple; bh=WFB0bI6r5CiypcJTxpq9dWxlGs/z1OBp3DMqkSgieUE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eLHOpy7qBVarXx5NlTiq1QqQLvIv90SX6euRgbXVX+43+dx3jbGTquYYmSr39N/dKxh/nyeCulMPsPX2dG6YzMiPeU2fCksJ5aAF1tV2b3u9XJkYcj70Sn6HGeuEae85Ow742TlSlEUKNXYA0syxNs2BJZssId6B1BXGoaXw5o8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be; spf=none smtp.mailfrom=linux-m68k.org; arc=none smtp.client-ip=195.130.132.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed80:1b01:1838:131c:4de4]) by andre.telenet-ops.be with bizsmtp id UxbE2C00Y3VPV9V01xbEvx; Wed, 29 May 2024 11:35:15 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1sCFhI-00GI2U-8c; Wed, 29 May 2024 11:35:14 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1sCFiE-008wVy-Hk; Wed, 29 May 2024 11:35:14 +0200 From: Geert Uytterhoeven To: Michael Turquette , Stephen Boyd Cc: Ye Bin , linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 3/3] clk: renesas: rcar-gen2: Use DEFINE_SPINLOCK() for static spinlock Date: Wed, 29 May 2024 11:35:10 +0200 Message-Id: <8da2c908f00043f05f7e26e3c26400aea0cfe8bc.1716975021.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-clk@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 A static spinlock can be initialized automatically with DEFINE_SPINLOCK() rather than explicitly calling spin_lock_init(). Suggested-by: Ye Bin Signed-off-by: Geert Uytterhoeven Reviewed-by: Stephen Boyd --- drivers/clk/renesas/rcar-gen2-cpg.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/clk/renesas/rcar-gen2-cpg.c b/drivers/clk/renesas/rcar-gen2-cpg.c index edae874fa2b63369..4c3764972bad905f 100644 --- a/drivers/clk/renesas/rcar-gen2-cpg.c +++ b/drivers/clk/renesas/rcar-gen2-cpg.c @@ -30,7 +30,7 @@ #define CPG_ADSPCKCR 0x025c #define CPG_RCANCKCR 0x0270 -static spinlock_t cpg_lock; +static DEFINE_SPINLOCK(cpg_lock); /* * Z Clock @@ -387,7 +387,5 @@ int __init rcar_gen2_cpg_init(const struct rcar_gen2_cpg_pll_config *config, cpg_quirks = (uintptr_t)attr->data; pr_debug("%s: mode = 0x%x quirks = 0x%x\n", __func__, mode, cpg_quirks); - spin_lock_init(&cpg_lock); - return 0; }