From: Vivek Yadav <vivek.2311@samsung.com>
To: rcsekar@samsung.com, wg@grandegger.com, mkl@pengutronix.de,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, pankaj.dubey@samsung.com,
ravi.patel@samsung.com, alim.akhtar@samsung.com
Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
Vivek Yadav <vivek.2311@samsung.com>
Subject: [PATCH 4/7] can: mcan: enable peripheral clk to access mram
Date: Fri, 21 Oct 2022 15:28:30 +0530 [thread overview]
Message-ID: <20221021095833.62406-5-vivek.2311@samsung.com> (raw)
In-Reply-To: <20221021095833.62406-1-vivek.2311@samsung.com>
When we try to access the mcan message ram addresses, make sure hclk is
not gated by any other drivers or disabled. Enable the clock (hclk) before
accessing the mram and disable it after that.
This is required in case if by-default hclk is gated.
Signed-off-by: Ravi Patel <ravi.patel@samsung.com>
Signed-off-by: Vivek Yadav <vivek.2311@samsung.com>
---
drivers/net/can/m_can/m_can_platform.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/net/can/m_can/m_can_platform.c b/drivers/net/can/m_can/m_can_platform.c
index eee47bad0592..5aab025775f9 100644
--- a/drivers/net/can/m_can/m_can_platform.c
+++ b/drivers/net/can/m_can/m_can_platform.c
@@ -140,10 +140,17 @@ static int m_can_plat_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, mcan_class);
- ret = m_can_init_ram(mcan_class);
+ /* clock needs to be enabled to access mram block */
+ ret = clk_prepare_enable(mcan_class->hclk);
if (ret)
goto probe_fail;
+ ret = m_can_init_ram(mcan_class);
+ if (ret)
+ goto mram_fail;
+
+ clk_disable_unprepare(mcan_class->hclk);
+
pm_runtime_enable(mcan_class->dev);
ret = m_can_class_register(mcan_class);
if (ret)
@@ -153,6 +160,8 @@ static int m_can_plat_probe(struct platform_device *pdev)
out_runtime_disable:
pm_runtime_disable(mcan_class->dev);
+mram_fail:
+ clk_disable_unprepare(mcan_class->hclk);
probe_fail:
m_can_class_free_dev(mcan_class->net);
return ret;
--
2.17.1
next prev parent reply other threads:[~2022-10-21 12:39 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20221021102614epcas5p18bcb932e697a378a8244bd91065c5496@epcas5p1.samsung.com>
2022-10-21 9:58 ` [PATCH 0/7] can: mcan: Add MCAN support for FSD SoC Vivek Yadav
2022-10-21 9:58 ` [PATCH 1/7] dt-bindings: Document the SYSREG specific compatibles found on " Vivek Yadav
2022-10-21 9:58 ` [PATCH 2/7] dt-bindings: can: mcan: Add ECC functionality to message ram Vivek Yadav
2022-10-25 7:24 ` Marc Kleine-Budde
2022-11-09 8:47 ` Vivek Yadav
2022-10-25 7:31 ` Marc Kleine-Budde
2022-11-09 8:52 ` Vivek Yadav
2022-10-21 9:58 ` [PATCH 3/7] arm64: dts: fsd: add sysreg device node Vivek Yadav
2022-11-09 11:13 ` Krzysztof Kozlowski
2022-10-21 9:58 ` Vivek Yadav [this message]
2022-10-25 7:44 ` [PATCH 4/7] can: mcan: enable peripheral clk to access mram Marc Kleine-Budde
2022-11-09 9:55 ` Vivek Yadav
2022-10-21 9:58 ` [PATCH 5/7] arm64: dts: fsd: Add MCAN device node Vivek Yadav
2022-10-25 7:44 ` Marc Kleine-Budde
2022-11-09 9:16 ` Vivek Yadav
2022-10-21 9:58 ` [PATCH 6/7] can: m_can: Add ECC functionality for message RAM Vivek Yadav
2022-10-25 8:16 ` Marc Kleine-Budde
2022-11-09 9:59 ` Vivek Yadav
2022-10-21 9:58 ` [PATCH 7/7] arm64: dts: fsd: Add support for error correction code " Vivek Yadav
2022-10-25 7:32 ` [PATCH 0/7] can: mcan: Add MCAN support for FSD SoC Marc Kleine-Budde
2022-11-09 8:55 ` Vivek Yadav
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=20221021095833.62406-5-vivek.2311@samsung.com \
--to=vivek.2311@samsung.com \
--cc=alim.akhtar@samsung.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pankaj.dubey@samsung.com \
--cc=ravi.patel@samsung.com \
--cc=rcsekar@samsung.com \
--cc=wg@grandegger.com \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox