From: Fabrice Gasnier <fabrice.gasnier@foss.st.com> To: <lee.jones@linaro.org> Cc: <vilhelm.gray@gmail.com>, <alexandre.torgue@foss.st.com>, <mcoquelin.stm32@gmail.com>, <olivier.moysan@foss.st.com>, <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org>, <linux-stm32@st-md-mailman.stormreply.com> Subject: Re: [PATCH] mfd: stm32-timers: avoid clearing auto reload register Date: Mon, 22 Mar 2021 11:59:16 +0100 [thread overview] Message-ID: <ce30adb7-fe58-6b56-9cc9-3f19692b56c2@foss.st.com> (raw) In-Reply-To: <1614793895-10504-1-git-send-email-fabrice.gasnier@foss.st.com> On 3/3/21 6:51 PM, Fabrice Gasnier wrote: > The ARR register is cleared unconditionally upon probing, after the maximum > value has been read. This initial condition is rather not intuitive, when > considering the counter child driver. It rather expects the maximum value > by default: > - The counter interface shows a zero value by default for 'ceiling' > attribute. > - Enabling the counter without any prior configuration makes it doesn't > count. > > The reset value of ARR register is the maximum. So Choice here > is to backup it, and restore it then, instead of clearing its value. > It also fixes the initial condition seen by the counter driver. > > Fixes: d0f949e220fd ("mfd: Add STM32 Timers driver") > > Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com> > --- > drivers/mfd/stm32-timers.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) Hi, It's just a gentle reminder to review this patch. Best Regards, Fabrice > > diff --git a/drivers/mfd/stm32-timers.c b/drivers/mfd/stm32-timers.c > index add6033..44ed2fc 100644 > --- a/drivers/mfd/stm32-timers.c > +++ b/drivers/mfd/stm32-timers.c > @@ -158,13 +158,18 @@ static const struct regmap_config stm32_timers_regmap_cfg = { > > static void stm32_timers_get_arr_size(struct stm32_timers *ddata) > { > + u32 arr; > + > + /* Backup ARR to restore it after getting the maximum value */ > + regmap_read(ddata->regmap, TIM_ARR, &arr); > + > /* > * Only the available bits will be written so when readback > * we get the maximum value of auto reload register > */ > regmap_write(ddata->regmap, TIM_ARR, ~0L); > regmap_read(ddata->regmap, TIM_ARR, &ddata->max_arr); > - regmap_write(ddata->regmap, TIM_ARR, 0x0); > + regmap_write(ddata->regmap, TIM_ARR, arr); > } > > static int stm32_timers_dma_probe(struct device *dev, >
WARNING: multiple messages have this Message-ID (diff)
From: Fabrice Gasnier <fabrice.gasnier@foss.st.com> To: <lee.jones@linaro.org> Cc: <vilhelm.gray@gmail.com>, <alexandre.torgue@foss.st.com>, <mcoquelin.stm32@gmail.com>, <olivier.moysan@foss.st.com>, <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org>, <linux-stm32@st-md-mailman.stormreply.com> Subject: Re: [PATCH] mfd: stm32-timers: avoid clearing auto reload register Date: Mon, 22 Mar 2021 11:59:16 +0100 [thread overview] Message-ID: <ce30adb7-fe58-6b56-9cc9-3f19692b56c2@foss.st.com> (raw) In-Reply-To: <1614793895-10504-1-git-send-email-fabrice.gasnier@foss.st.com> On 3/3/21 6:51 PM, Fabrice Gasnier wrote: > The ARR register is cleared unconditionally upon probing, after the maximum > value has been read. This initial condition is rather not intuitive, when > considering the counter child driver. It rather expects the maximum value > by default: > - The counter interface shows a zero value by default for 'ceiling' > attribute. > - Enabling the counter without any prior configuration makes it doesn't > count. > > The reset value of ARR register is the maximum. So Choice here > is to backup it, and restore it then, instead of clearing its value. > It also fixes the initial condition seen by the counter driver. > > Fixes: d0f949e220fd ("mfd: Add STM32 Timers driver") > > Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com> > --- > drivers/mfd/stm32-timers.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) Hi, It's just a gentle reminder to review this patch. Best Regards, Fabrice > > diff --git a/drivers/mfd/stm32-timers.c b/drivers/mfd/stm32-timers.c > index add6033..44ed2fc 100644 > --- a/drivers/mfd/stm32-timers.c > +++ b/drivers/mfd/stm32-timers.c > @@ -158,13 +158,18 @@ static const struct regmap_config stm32_timers_regmap_cfg = { > > static void stm32_timers_get_arr_size(struct stm32_timers *ddata) > { > + u32 arr; > + > + /* Backup ARR to restore it after getting the maximum value */ > + regmap_read(ddata->regmap, TIM_ARR, &arr); > + > /* > * Only the available bits will be written so when readback > * we get the maximum value of auto reload register > */ > regmap_write(ddata->regmap, TIM_ARR, ~0L); > regmap_read(ddata->regmap, TIM_ARR, &ddata->max_arr); > - regmap_write(ddata->regmap, TIM_ARR, 0x0); > + regmap_write(ddata->regmap, TIM_ARR, arr); > } > > static int stm32_timers_dma_probe(struct device *dev, > _______________________________________________ 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-03-22 11:00 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-03-03 17:51 [PATCH] mfd: stm32-timers: avoid clearing auto reload register Fabrice Gasnier 2021-03-03 17:51 ` Fabrice Gasnier 2021-03-03 23:45 ` William Breathitt Gray 2021-03-03 23:45 ` William Breathitt Gray 2021-03-22 10:59 ` Fabrice Gasnier [this message] 2021-03-22 10:59 ` Fabrice Gasnier 2021-03-22 12:56 ` Lee Jones 2021-03-22 12:56 ` Lee Jones 2021-03-23 9:39 ` Lee Jones 2021-03-23 9:39 ` Lee Jones
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=ce30adb7-fe58-6b56-9cc9-3f19692b56c2@foss.st.com \ --to=fabrice.gasnier@foss.st.com \ --cc=alexandre.torgue@foss.st.com \ --cc=lee.jones@linaro.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-stm32@st-md-mailman.stormreply.com \ --cc=mcoquelin.stm32@gmail.com \ --cc=olivier.moysan@foss.st.com \ --cc=vilhelm.gray@gmail.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: 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.