From: Samuel Holland <samuel@sholland.org> To: Maxime Ripard <mripard@kernel.org>, Chen-Yu Tsai <wens@csie.org>, Jernej Skrabec <jernej.skrabec@gmail.com>, Michael Turquette <mturquette@baylibre.com>, Stephen Boyd <sboyd@kernel.org> Cc: linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Samuel Holland <samuel@sholland.org> Subject: [PATCH 3/8] clk: sunxi-ng: Use a separate lock for each CCU instance Date: Wed, 1 Sep 2021 00:05:21 -0500 [thread overview] Message-ID: <20210901050526.45673-4-samuel@sholland.org> (raw) In-Reply-To: <20210901050526.45673-1-samuel@sholland.org> Some platforms have more than one CCU driver loaded: the main CCU, the PRCM, the display engine, and possibly others. All of these hardware blocks have separate MMIO spaces, so there is no need to synchronize between them. Signed-off-by: Samuel Holland <samuel@sholland.org> --- drivers/clk/sunxi-ng/ccu_common.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/clk/sunxi-ng/ccu_common.c b/drivers/clk/sunxi-ng/ccu_common.c index 88cb569e5835..31af8b6b5286 100644 --- a/drivers/clk/sunxi-ng/ccu_common.c +++ b/drivers/clk/sunxi-ng/ccu_common.c @@ -17,11 +17,10 @@ struct sunxi_ccu { const struct sunxi_ccu_desc *desc; + spinlock_t lock; struct ccu_reset reset; }; -static DEFINE_SPINLOCK(ccu_lock); - void ccu_helper_wait_for_lock(struct ccu_common *common, u32 lock) { void __iomem *addr; @@ -94,6 +93,8 @@ static int sunxi_ccu_probe(struct sunxi_ccu *ccu, struct device *dev, ccu->desc = desc; + spin_lock_init(&ccu->lock); + for (i = 0; i < desc->num_ccu_clks; i++) { struct ccu_common *cclk = desc->ccu_clks[i]; @@ -101,7 +102,7 @@ static int sunxi_ccu_probe(struct sunxi_ccu *ccu, struct device *dev, continue; cclk->base = reg; - cclk->lock = &ccu_lock; + cclk->lock = &ccu->lock; } for (i = 0; i < desc->hw_clks->num ; i++) { @@ -133,7 +134,7 @@ static int sunxi_ccu_probe(struct sunxi_ccu *ccu, struct device *dev, reset->rcdev.owner = dev ? dev->driver->owner : THIS_MODULE; reset->rcdev.nr_resets = desc->num_resets; reset->base = reg; - reset->lock = &ccu_lock; + reset->lock = &ccu->lock; reset->reset_map = desc->resets; ret = reset_controller_register(&reset->rcdev); -- 2.31.1
WARNING: multiple messages have this Message-ID (diff)
From: Samuel Holland <samuel@sholland.org> To: Maxime Ripard <mripard@kernel.org>, Chen-Yu Tsai <wens@csie.org>, Jernej Skrabec <jernej.skrabec@gmail.com>, Michael Turquette <mturquette@baylibre.com>, Stephen Boyd <sboyd@kernel.org> Cc: linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Samuel Holland <samuel@sholland.org> Subject: [PATCH 3/8] clk: sunxi-ng: Use a separate lock for each CCU instance Date: Wed, 1 Sep 2021 00:05:21 -0500 [thread overview] Message-ID: <20210901050526.45673-4-samuel@sholland.org> (raw) In-Reply-To: <20210901050526.45673-1-samuel@sholland.org> Some platforms have more than one CCU driver loaded: the main CCU, the PRCM, the display engine, and possibly others. All of these hardware blocks have separate MMIO spaces, so there is no need to synchronize between them. Signed-off-by: Samuel Holland <samuel@sholland.org> --- drivers/clk/sunxi-ng/ccu_common.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/clk/sunxi-ng/ccu_common.c b/drivers/clk/sunxi-ng/ccu_common.c index 88cb569e5835..31af8b6b5286 100644 --- a/drivers/clk/sunxi-ng/ccu_common.c +++ b/drivers/clk/sunxi-ng/ccu_common.c @@ -17,11 +17,10 @@ struct sunxi_ccu { const struct sunxi_ccu_desc *desc; + spinlock_t lock; struct ccu_reset reset; }; -static DEFINE_SPINLOCK(ccu_lock); - void ccu_helper_wait_for_lock(struct ccu_common *common, u32 lock) { void __iomem *addr; @@ -94,6 +93,8 @@ static int sunxi_ccu_probe(struct sunxi_ccu *ccu, struct device *dev, ccu->desc = desc; + spin_lock_init(&ccu->lock); + for (i = 0; i < desc->num_ccu_clks; i++) { struct ccu_common *cclk = desc->ccu_clks[i]; @@ -101,7 +102,7 @@ static int sunxi_ccu_probe(struct sunxi_ccu *ccu, struct device *dev, continue; cclk->base = reg; - cclk->lock = &ccu_lock; + cclk->lock = &ccu->lock; } for (i = 0; i < desc->hw_clks->num ; i++) { @@ -133,7 +134,7 @@ static int sunxi_ccu_probe(struct sunxi_ccu *ccu, struct device *dev, reset->rcdev.owner = dev ? dev->driver->owner : THIS_MODULE; reset->rcdev.nr_resets = desc->num_resets; reset->base = reg; - reset->lock = &ccu_lock; + reset->lock = &ccu->lock; reset->reset_map = desc->resets; ret = reset_controller_register(&reset->rcdev); -- 2.31.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-09-01 5:05 UTC|newest] Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-09-01 5:05 [PATCH 0/8] clk: sunxi-ng: Lifetime fixes and module support Samuel Holland 2021-09-01 5:05 ` Samuel Holland 2021-09-01 5:05 ` [PATCH 1/8] clk: sunxi-ng: Unregister clocks/resets when unbinding Samuel Holland 2021-09-01 5:05 ` Samuel Holland 2021-09-01 5:05 ` [PATCH 2/8] clk: sunxi-ng: Prevent unbinding CCUs via sysfs Samuel Holland 2021-09-01 5:05 ` Samuel Holland 2021-09-01 5:05 ` Samuel Holland [this message] 2021-09-01 5:05 ` [PATCH 3/8] clk: sunxi-ng: Use a separate lock for each CCU instance Samuel Holland 2021-09-03 9:09 ` Maxime Ripard 2021-09-03 9:09 ` Maxime Ripard 2021-09-01 5:05 ` [PATCH 4/8] clk: sunxi-ng: Rename files to match Kconfig and drivers Samuel Holland 2021-09-01 5:05 ` Samuel Holland 2021-09-03 9:10 ` Maxime Ripard 2021-09-03 9:10 ` Maxime Ripard 2021-09-03 20:57 ` Samuel Holland 2021-09-03 20:57 ` Samuel Holland 2021-09-05 20:51 ` Stephen Boyd 2021-09-05 20:51 ` Stephen Boyd 2021-09-07 17:43 ` Maxime Ripard 2021-09-07 17:43 ` Maxime Ripard 2021-09-01 5:05 ` [PATCH 5/8] clk: sunxi-ng: Export symbols used by CCU drivers Samuel Holland 2021-09-01 5:05 ` Samuel Holland 2021-09-01 13:54 ` Chen-Yu Tsai 2021-09-01 13:54 ` Chen-Yu Tsai 2021-09-01 13:54 ` Chen-Yu Tsai 2021-09-01 5:05 ` [PATCH 6/8] clk: sunxi-ng: Allow drivers to be built as modules Samuel Holland 2021-09-01 5:05 ` Samuel Holland 2021-09-01 5:05 ` [PATCH 7/8] clk: sunxi-ng: Convert early providers to platform drivers Samuel Holland 2021-09-01 5:05 ` Samuel Holland 2021-09-03 9:19 ` Maxime Ripard 2021-09-03 9:19 ` Maxime Ripard 2021-09-01 5:05 ` [PATCH 8/8] clk: sunxi-ng: Allow the CCU core to be built as a module Samuel Holland 2021-09-01 5:05 ` Samuel Holland
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210901050526.45673-4-samuel@sholland.org \ --to=samuel@sholland.org \ --cc=jernej.skrabec@gmail.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-clk@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-sunxi@lists.linux.dev \ --cc=mripard@kernel.org \ --cc=mturquette@baylibre.com \ --cc=sboyd@kernel.org \ --cc=wens@csie.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.