From: "Viorel Suman (OSS)" <viorel.suman@oss.nxp.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Shawn Guo" <shawnguo@kernel.org>,
"Sascha Hauer" <s.hauer@pengutronix.de>,
"Pengutronix Kernel Team" <kernel@pengutronix.de>,
"Fabio Estevam" <festevam@gmail.com>,
"NXP Linux Team" <linux-imx@nxp.com>,
linux-pwm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Cc: Viorel Suman <viorel.suman@oss.nxp.com>,
Viorel Suman <viorel.suman@nxp.com>
Subject: [PATCH] pwm: imx-tpm: reset module on probe
Date: Thu, 1 Feb 2024 14:22:42 +0200 [thread overview]
Message-ID: <20240201122242.1597601-1-viorel.suman@oss.nxp.com> (raw)
From: Viorel Suman <viorel.suman@nxp.com>
Reset Timer PWM module on probe so that the module
takes the default state after probe is finished.
Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Signed-off-by: Florin Leotescu <florin.leotescu@nxp.com>
---
drivers/pwm/pwm-imx-tpm.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/pwm/pwm-imx-tpm.c b/drivers/pwm/pwm-imx-tpm.c
index 9fc290e647e1..27e6a5342693 100644
--- a/drivers/pwm/pwm-imx-tpm.c
+++ b/drivers/pwm/pwm-imx-tpm.c
@@ -33,6 +33,7 @@
#define PWM_IMX_TPM_CnV(n) (0x24 + (n) * 0x8)
#define PWM_IMX_TPM_PARAM_CHAN GENMASK(7, 0)
+#define PWM_IMX_TPM_GLOBAL_RST BIT(1)
#define PWM_IMX_TPM_SC_PS GENMASK(2, 0)
#define PWM_IMX_TPM_SC_CMOD GENMASK(4, 3)
@@ -362,6 +363,10 @@ static int pwm_imx_tpm_probe(struct platform_device *pdev)
val = readl(tpm->base + PWM_IMX_TPM_PARAM);
tpm->chip.npwm = FIELD_GET(PWM_IMX_TPM_PARAM_CHAN, val);
+ /* Resets all internal logic and registers */
+ writel(PWM_IMX_TPM_GLOBAL_RST, tpm->base + PWM_IMX_TPM_GLOBAL);
+ writel(0, tpm->base + PWM_IMX_TPM_GLOBAL);
+
mutex_init(&tpm->lock);
ret = devm_pwmchip_add(&pdev->dev, &tpm->chip);
--
2.34.1
next reply other threads:[~2024-02-01 12:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-01 12:22 Viorel Suman (OSS) [this message]
2024-02-01 13:38 ` [PATCH] pwm: imx-tpm: reset module on probe Uwe Kleine-König
[not found] ` <3d866664-d2fd-4d36-9e8f-5242327e41b9@nxp.com>
2024-02-15 10:12 ` Uwe Kleine-König
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=20240201122242.1597601-1-viorel.suman@oss.nxp.com \
--to=viorel.suman@oss.nxp.com \
--cc=festevam@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=u.kleine-koenig@pengutronix.de \
--cc=viorel.suman@nxp.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).