<div dir="ltr"><div dir="ltr">Hi Jonathan,<div><br></div><div>Thanks for the clarification,</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, 2 Feb 2020 at 13:28, Jonathan Cameron <<a href="mailto:jic23@kernel.org">jic23@kernel.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Thu, 30 Jan 2020 10:20:30 +0200<br>
Tomer Maimon <<a href="mailto:tmaimon77@gmail.com" target="_blank">tmaimon77@gmail.com</a>> wrote:<br>
<br>
> Hi Jonathan,<br>
> <br>
> The patch replace reset ADC method from direct register access to using<br>
> reset driver (will applied next Linux version).<br>
> <a href="https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next-history.git/commit/?h=next-20200130&id=9c81b2ccf82da6e995b63e945afa882cfaa03ca9" rel="noreferrer" target="_blank">https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next-history.git/commit/?h=next-20200130&id=9c81b2ccf82da6e995b63e945afa882cfaa03ca9</a><br>
> <br>
> <br>
> The ADC dt-binding modified as well to use the new reset method (approved<br>
> by Rob Herring)<br>
> <a href="https://www.spinics.net/lists/devicetree/msg331327.html" rel="noreferrer" target="_blank">https://www.spinics.net/lists/devicetree/msg331327.html</a><br>
> <br>
> Indeed the this modification require DT modification as it described in the<br>
> ADC dt-binding commit, is it an issue? Do you thnk I should describe it in<br>
> the commit?<br>
<br>
Whether it is an issue depends on nuvoton business model. Can they ensure<br>
that all places the kernel is changed will also have appropriate dt updates?</blockquote><div>Yes, we can ensure it in this development stage. </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">If not, you need to make the code continue to function without the change<br>
(fall back to old methods). If they do have enough control to ensure it won't<br>
break any systems out in the wild, then just add a note to say that is the<br>
case to the commit message.<br></blockquote><div>I will modify the commit message as you suggested. </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Reasons this sort of thing is sometimes safe include:<br>
* preproduction part so no users outside of people who will expect<br>
potential breakage<br>
* dt and new kernel images only distributed in a firmware package, or<br>
where build script used to build the firmware package will ensure they<br>
match (this is a bmc chip I think, so I guess not many people build their own<br>
kernels except via scripting to package everything up as a firmware image<br>
of some type?)<br></blockquote><div>As far as I know only the server developers are creating new firmwares and they are aware to our modifications. </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Thanks,<br>
<br>
Jonathan </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> <br>
> Thanks,<br>
> <br>
> Tomer<br>
> <br>
> <br>
> <br>
> On Wed, 29 Jan 2020 at 22:01, Jonathan Cameron <<a href="mailto:jic23@kernel.org" target="_blank">jic23@kernel.org</a>> wrote:<br>
> <br>
> > On Sun, 19 Jan 2020 13:00:32 +0200<br>
> > Tomer Maimon <<a href="mailto:tmaimon77@gmail.com" target="_blank">tmaimon77@gmail.com</a>> wrote:<br>
> > <br>
> > > Modify NPCM ADC reset support from<br>
> > > direct register access to reset controller support.<br>
> > ><br>
> > > Signed-off-by: Tomer Maimon <<a href="mailto:tmaimon77@gmail.com" target="_blank">tmaimon77@gmail.com</a>> <br>
> ><br>
> > Hmm. This presumably breaks all old DT.<br>
> ><br>
> > If that's not a problem please say why.<br>
> ><br>
> > Jonathan<br>
> > <br>
> > > ---<br>
> > > drivers/iio/adc/npcm_adc.c | 30 +++++++++---------------------<br>
> > > 1 file changed, 9 insertions(+), 21 deletions(-)<br>
> > ><br>
> > > diff --git a/drivers/iio/adc/npcm_adc.c b/drivers/iio/adc/npcm_adc.c<br>
> > > index a6170a37ebe8..83bad2d5575d 100644<br>
> > > --- a/drivers/iio/adc/npcm_adc.c<br>
> > > +++ b/drivers/iio/adc/npcm_adc.c<br>
> > > @@ -14,6 +14,7 @@<br>
> > > #include <linux/regulator/consumer.h><br>
> > > #include <linux/spinlock.h><br>
> > > #include <linux/uaccess.h><br>
> > > +#include <linux/reset.h><br>
> > ><br>
> > > struct npcm_adc {<br>
> > > bool int_status;<br>
> > > @@ -23,13 +24,9 @@ struct npcm_adc {<br>
> > > struct clk *adc_clk;<br>
> > > wait_queue_head_t wq;<br>
> > > struct regulator *vref;<br>
> > > - struct regmap *rst_regmap;<br>
> > > + struct reset_control *reset;<br>
> > > };<br>
> > ><br>
> > > -/* NPCM7xx reset module */<br>
> > > -#define NPCM7XX_IPSRST1_OFFSET 0x020<br>
> > > -#define NPCM7XX_IPSRST1_ADC_RST BIT(27)<br>
> > > -<br>
> > > /* ADC registers */<br>
> > > #define NPCM_ADCCON 0x00<br>
> > > #define NPCM_ADCDATA 0x04<br>
> > > @@ -106,13 +103,11 @@ static int npcm_adc_read(struct npcm_adc *info, <br>
> > int *val, u8 channel) <br>
> > > msecs_to_jiffies(10));<br>
> > > if (ret == 0) {<br>
> > > regtemp = ioread32(info->regs + NPCM_ADCCON);<br>
> > > - if ((regtemp & NPCM_ADCCON_ADC_CONV) && info->rst_regmap) {<br>
> > > + if (regtemp & NPCM_ADCCON_ADC_CONV) {<br>
> > > /* if conversion failed - reset ADC module */<br>
> > > - regmap_write(info->rst_regmap, <br>
> > NPCM7XX_IPSRST1_OFFSET, <br>
> > > - NPCM7XX_IPSRST1_ADC_RST);<br>
> > > + reset_control_assert(info->reset);<br>
> > > msleep(100);<br>
> > > - regmap_write(info->rst_regmap, <br>
> > NPCM7XX_IPSRST1_OFFSET, <br>
> > > - 0x0);<br>
> > > + reset_control_deassert(info->reset);<br>
> > > msleep(100);<br>
> > ><br>
> > > /* Enable ADC and start conversion module */<br>
> > > @@ -186,7 +181,6 @@ static int npcm_adc_probe(struct platform_device <br>
> > *pdev) <br>
> > > struct npcm_adc *info;<br>
> > > struct iio_dev *indio_dev;<br>
> > > struct device *dev = &pdev->dev;<br>
> > > - struct device_node *np = pdev->dev.of_node;<br>
> > ><br>
> > > indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*info));<br>
> > > if (!indio_dev)<br>
> > > @@ -199,6 +193,10 @@ static int npcm_adc_probe(struct platform_device <br>
> > *pdev) <br>
> > > if (IS_ERR(info->regs))<br>
> > > return PTR_ERR(info->regs);<br>
> > ><br>
> > > + info->reset = devm_reset_control_get(&pdev->dev, NULL);<br>
> > > + if (IS_ERR(info->reset))<br>
> > > + return PTR_ERR(info->reset);<br>
> > > +<br>
> > > info->adc_clk = devm_clk_get(&pdev->dev, NULL);<br>
> > > if (IS_ERR(info->adc_clk)) {<br>
> > > dev_warn(&pdev->dev, "ADC clock failed: can't read clk\n");<br>
> > > @@ -211,16 +209,6 @@ static int npcm_adc_probe(struct platform_device <br>
> > *pdev) <br>
> > > div = div >> NPCM_ADCCON_DIV_SHIFT;<br>
> > > info->adc_sample_hz = clk_get_rate(info->adc_clk) / ((div + 1) * <br>
> > 2); <br>
> > ><br>
> > > - if (of_device_is_compatible(np, "nuvoton,npcm750-adc")) {<br>
> > > - info->rst_regmap = syscon_regmap_lookup_by_compatible<br>
> > > - ("nuvoton,npcm750-rst");<br>
> > > - if (IS_ERR(info->rst_regmap)) {<br>
> > > - dev_err(&pdev->dev, "Failed to find <br>
> > nuvoton,npcm750-rst\n"); <br>
> > > - ret = PTR_ERR(info->rst_regmap);<br>
> > > - goto err_disable_clk;<br>
> > > - }<br>
> > > - }<br>
> > > -<br>
> > > irq = platform_get_irq(pdev, 0);<br>
> > > if (irq <= 0) {<br>
> > > ret = -EINVAL; <br>
> ><br>
> > <br>
<br></blockquote><div><br></div><div>Thanks a lot,</div><div><br></div><div>Tomer </div></div></div>