diff mbox series

[U-Boot,3/5] mtd: rawnand: denali: add reset handling

Message ID 20190125203051.10943-4-simon.k.r.goldschmidt@gmail.com
State Superseded
Delegated to: Marek Vasut
Headers show
Series arm: socfpga: implement proper peripheral reset handling | expand

Commit Message

Simon Goldschmidt Jan. 25, 2019, 8:30 p.m. UTC
This adds reset handling to the devicetree-enabled denalid nand driver.

For backwards compatibility, only a warning is printed when failing to
get reset handles.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
---

 drivers/mtd/nand/raw/denali_dt.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Marek Vasut Jan. 26, 2019, 8:58 a.m. UTC | #1
On 1/25/19 9:30 PM, Simon Goldschmidt wrote:
> This adds reset handling to the devicetree-enabled denalid nand driver.
> 
> For backwards compatibility, only a warning is printed when failing to
> get reset handles.
> 
> Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> ---
> 
>  drivers/mtd/nand/raw/denali_dt.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/mtd/nand/raw/denali_dt.c b/drivers/mtd/nand/raw/denali_dt.c
> index d384b974df..21c4540637 100644
> --- a/drivers/mtd/nand/raw/denali_dt.c
> +++ b/drivers/mtd/nand/raw/denali_dt.c
> @@ -9,6 +9,7 @@
>  #include <linux/io.h>
>  #include <linux/ioport.h>
>  #include <linux/printk.h>
> +#include <reset.h>
>  
>  #include "denali.h"
>  
> @@ -64,6 +65,7 @@ static int denali_dt_probe(struct udevice *dev)
>  	const struct denali_dt_data *data;
>  	struct clk clk, clk_x, clk_ecc;
>  	struct resource res;
> +	struct reset_ctl_bulk reset_bulk;
>  	int ret;
>  
>  	data = (void *)dev_get_driver_data(dev);
> @@ -131,6 +133,12 @@ static int denali_dt_probe(struct udevice *dev)
>  		denali->clk_x_rate = 200000000;
>  	}
>  
> +	ret = reset_get_bulk(bus, &reset_bulk);
> +	if (ret)
> +		dev_warn(bus, "Cant' get reset: %d\n", ret);

Can't , misplaced "'"

> +	else
> +		reset_deassert_bulk(&reset_bulk);
> +
>  	return denali_init(denali);
>  }
>  
>
Miquel Raynal Jan. 28, 2019, 9:08 a.m. UTC | #2
Hi Simon,

Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> wrote on Fri, 25
Jan 2019 21:30:49 +0100:

> This adds reset handling to the devicetree-enabled denalid nand driver.

"Denali NAND driver"

> 
> For backwards compatibility, only a warning is printed when failing to
> get reset handles.
> 
> Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> ---
> 
>  drivers/mtd/nand/raw/denali_dt.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/mtd/nand/raw/denali_dt.c b/drivers/mtd/nand/raw/denali_dt.c
> index d384b974df..21c4540637 100644
> --- a/drivers/mtd/nand/raw/denali_dt.c
> +++ b/drivers/mtd/nand/raw/denali_dt.c
> @@ -9,6 +9,7 @@
>  #include <linux/io.h>
>  #include <linux/ioport.h>
>  #include <linux/printk.h>
> +#include <reset.h>
>  
>  #include "denali.h"
>  
> @@ -64,6 +65,7 @@ static int denali_dt_probe(struct udevice *dev)
>  	const struct denali_dt_data *data;
>  	struct clk clk, clk_x, clk_ecc;
>  	struct resource res;
> +	struct reset_ctl_bulk reset_bulk;
>  	int ret;
>  
>  	data = (void *)dev_get_driver_data(dev);
> @@ -131,6 +133,12 @@ static int denali_dt_probe(struct udevice *dev)
>  		denali->clk_x_rate = 200000000;
>  	}
>  
> +	ret = reset_get_bulk(bus, &reset_bulk);
> +	if (ret)
> +		dev_warn(bus, "Cant' get reset: %d\n", ret);
> +	else
> +		reset_deassert_bulk(&reset_bulk);

Where are reset_get_bulk/reset_deassert_bulk() defined?

> +
>  	return denali_init(denali);
>  }
>  

Thanks,
Miquèl
Simon Goldschmidt Jan. 28, 2019, 9:16 a.m. UTC | #3
Hi Miquel,

On Mon, Jan 28, 2019 at 10:08 AM Miquel Raynal
<miquel.raynal@bootlin.com> wrote:
>
> Hi Simon,
>
> Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> wrote on Fri, 25
> Jan 2019 21:30:49 +0100:
>
> > This adds reset handling to the devicetree-enabled denalid nand driver.
>
> "Denali NAND driver"

Right.

>
> >
> > For backwards compatibility, only a warning is printed when failing to
> > get reset handles.
> >
> > Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> > ---
> >
> >  drivers/mtd/nand/raw/denali_dt.c | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> >
> > diff --git a/drivers/mtd/nand/raw/denali_dt.c b/drivers/mtd/nand/raw/denali_dt.c
> > index d384b974df..21c4540637 100644
> > --- a/drivers/mtd/nand/raw/denali_dt.c
> > +++ b/drivers/mtd/nand/raw/denali_dt.c
> > @@ -9,6 +9,7 @@
> >  #include <linux/io.h>
> >  #include <linux/ioport.h>
> >  #include <linux/printk.h>
> > +#include <reset.h>
> >
> >  #include "denali.h"
> >
> > @@ -64,6 +65,7 @@ static int denali_dt_probe(struct udevice *dev)
> >       const struct denali_dt_data *data;
> >       struct clk clk, clk_x, clk_ecc;
> >       struct resource res;
> > +     struct reset_ctl_bulk reset_bulk;
> >       int ret;
> >
> >       data = (void *)dev_get_driver_data(dev);
> > @@ -131,6 +133,12 @@ static int denali_dt_probe(struct udevice *dev)
> >               denali->clk_x_rate = 200000000;
> >       }
> >
> > +     ret = reset_get_bulk(bus, &reset_bulk);
> > +     if (ret)
> > +             dev_warn(bus, "Cant' get reset: %d\n", ret);
> > +     else
> > +             reset_deassert_bulk(&reset_bulk);
>
> Where are reset_get_bulk/reset_deassert_bulk() defined?

In reset.h. That's why I added this include (see above)...

Regards,
Simon

>
> > +
> >       return denali_init(denali);
> >  }
> >
>
> Thanks,
> Miquèl
Miquel Raynal Jan. 28, 2019, 9:22 a.m. UTC | #4
Hi Simon,

Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> wrote on Mon, 28
Jan 2019 10:16:28 +0100:

> Hi Miquel,
> 
> On Mon, Jan 28, 2019 at 10:08 AM Miquel Raynal
> <miquel.raynal@bootlin.com> wrote:
> >
> > Hi Simon,
> >
> > Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> wrote on Fri, 25
> > Jan 2019 21:30:49 +0100:
> >  
> > > This adds reset handling to the devicetree-enabled denalid nand driver.  
> >
> > "Denali NAND driver"  
> 
> Right.
> 
> >  
> > >
> > > For backwards compatibility, only a warning is printed when failing to
> > > get reset handles.
> > >
> > > Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> > > ---
> > >
> > >  drivers/mtd/nand/raw/denali_dt.c | 8 ++++++++
> > >  1 file changed, 8 insertions(+)
> > >
> > > diff --git a/drivers/mtd/nand/raw/denali_dt.c b/drivers/mtd/nand/raw/denali_dt.c
> > > index d384b974df..21c4540637 100644
> > > --- a/drivers/mtd/nand/raw/denali_dt.c
> > > +++ b/drivers/mtd/nand/raw/denali_dt.c
> > > @@ -9,6 +9,7 @@
> > >  #include <linux/io.h>
> > >  #include <linux/ioport.h>
> > >  #include <linux/printk.h>
> > > +#include <reset.h>
> > >
> > >  #include "denali.h"
> > >
> > > @@ -64,6 +65,7 @@ static int denali_dt_probe(struct udevice *dev)
> > >       const struct denali_dt_data *data;
> > >       struct clk clk, clk_x, clk_ecc;
> > >       struct resource res;
> > > +     struct reset_ctl_bulk reset_bulk;
> > >       int ret;
> > >
> > >       data = (void *)dev_get_driver_data(dev);
> > > @@ -131,6 +133,12 @@ static int denali_dt_probe(struct udevice *dev)
> > >               denali->clk_x_rate = 200000000;
> > >       }
> > >
> > > +     ret = reset_get_bulk(bus, &reset_bulk);
> > > +     if (ret)
> > > +             dev_warn(bus, "Cant' get reset: %d\n", ret);
> > > +     else
> > > +             reset_deassert_bulk(&reset_bulk);  
> >
> > Where are reset_get_bulk/reset_deassert_bulk() defined?  
> 
> In reset.h. That's why I added this include (see above)...

Yes but I guess it is something that will be merged in 5.1? Maybe I
will wait for the next release to take this one.


Thanks,
Miquèl
Simon Goldschmidt Jan. 28, 2019, 9:30 a.m. UTC | #5
Hi Miquel,

On Mon, Jan 28, 2019 at 10:22 AM Miquel Raynal
<miquel.raynal@bootlin.com> wrote:
>
> Hi Simon,
>
> Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> wrote on Mon, 28
> Jan 2019 10:16:28 +0100:
>
> > Hi Miquel,
> >
> > On Mon, Jan 28, 2019 at 10:08 AM Miquel Raynal
> > <miquel.raynal@bootlin.com> wrote:
> > >
> > > Hi Simon,
> > >
> > > Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> wrote on Fri, 25
> > > Jan 2019 21:30:49 +0100:
> > >
> > > > This adds reset handling to the devicetree-enabled denalid nand driver.
> > >
> > > "Denali NAND driver"
> >
> > Right.
> >
> > >
> > > >
> > > > For backwards compatibility, only a warning is printed when failing to
> > > > get reset handles.
> > > >
> > > > Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> > > > ---
> > > >
> > > >  drivers/mtd/nand/raw/denali_dt.c | 8 ++++++++
> > > >  1 file changed, 8 insertions(+)
> > > >
> > > > diff --git a/drivers/mtd/nand/raw/denali_dt.c b/drivers/mtd/nand/raw/denali_dt.c
> > > > index d384b974df..21c4540637 100644
> > > > --- a/drivers/mtd/nand/raw/denali_dt.c
> > > > +++ b/drivers/mtd/nand/raw/denali_dt.c
> > > > @@ -9,6 +9,7 @@
> > > >  #include <linux/io.h>
> > > >  #include <linux/ioport.h>
> > > >  #include <linux/printk.h>
> > > > +#include <reset.h>
> > > >
> > > >  #include "denali.h"
> > > >
> > > > @@ -64,6 +65,7 @@ static int denali_dt_probe(struct udevice *dev)
> > > >       const struct denali_dt_data *data;
> > > >       struct clk clk, clk_x, clk_ecc;
> > > >       struct resource res;
> > > > +     struct reset_ctl_bulk reset_bulk;
> > > >       int ret;
> > > >
> > > >       data = (void *)dev_get_driver_data(dev);
> > > > @@ -131,6 +133,12 @@ static int denali_dt_probe(struct udevice *dev)
> > > >               denali->clk_x_rate = 200000000;
> > > >       }
> > > >
> > > > +     ret = reset_get_bulk(bus, &reset_bulk);
> > > > +     if (ret)
> > > > +             dev_warn(bus, "Cant' get reset: %d\n", ret);
> > > > +     else
> > > > +             reset_deassert_bulk(&reset_bulk);
> > >
> > > Where are reset_get_bulk/reset_deassert_bulk() defined?
> >
> > In reset.h. That's why I added this include (see above)...
>
> Yes but I guess it is something that will be merged in 5.1? Maybe I
> will wait for the next release to take this one.

You mean Linux 5.1, right? This patch is for U-Boot, not Linux.

Regards,
Simon
Miquel Raynal Jan. 28, 2019, 9:33 a.m. UTC | #6
Hi Simon,

Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> wrote on Mon, 28
Jan 2019 10:30:12 +0100:

> Hi Miquel,
> 
> On Mon, Jan 28, 2019 at 10:22 AM Miquel Raynal
> <miquel.raynal@bootlin.com> wrote:
> >
> > Hi Simon,
> >
> > Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> wrote on Mon, 28
> > Jan 2019 10:16:28 +0100:
> >  
> > > Hi Miquel,
> > >
> > > On Mon, Jan 28, 2019 at 10:08 AM Miquel Raynal
> > > <miquel.raynal@bootlin.com> wrote:  
> > > >
> > > > Hi Simon,
> > > >
> > > > Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> wrote on Fri, 25
> > > > Jan 2019 21:30:49 +0100:
> > > >  
> > > > > This adds reset handling to the devicetree-enabled denalid nand driver.  
> > > >
> > > > "Denali NAND driver"  
> > >
> > > Right.
> > >  
> > > >  
> > > > >
> > > > > For backwards compatibility, only a warning is printed when failing to
> > > > > get reset handles.
> > > > >
> > > > > Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> > > > > ---
> > > > >
> > > > >  drivers/mtd/nand/raw/denali_dt.c | 8 ++++++++
> > > > >  1 file changed, 8 insertions(+)
> > > > >
> > > > > diff --git a/drivers/mtd/nand/raw/denali_dt.c b/drivers/mtd/nand/raw/denali_dt.c
> > > > > index d384b974df..21c4540637 100644
> > > > > --- a/drivers/mtd/nand/raw/denali_dt.c
> > > > > +++ b/drivers/mtd/nand/raw/denali_dt.c
> > > > > @@ -9,6 +9,7 @@
> > > > >  #include <linux/io.h>
> > > > >  #include <linux/ioport.h>
> > > > >  #include <linux/printk.h>
> > > > > +#include <reset.h>
> > > > >
> > > > >  #include "denali.h"
> > > > >
> > > > > @@ -64,6 +65,7 @@ static int denali_dt_probe(struct udevice *dev)
> > > > >       const struct denali_dt_data *data;
> > > > >       struct clk clk, clk_x, clk_ecc;
> > > > >       struct resource res;
> > > > > +     struct reset_ctl_bulk reset_bulk;
> > > > >       int ret;
> > > > >
> > > > >       data = (void *)dev_get_driver_data(dev);
> > > > > @@ -131,6 +133,12 @@ static int denali_dt_probe(struct udevice *dev)
> > > > >               denali->clk_x_rate = 200000000;
> > > > >       }
> > > > >
> > > > > +     ret = reset_get_bulk(bus, &reset_bulk);
> > > > > +     if (ret)
> > > > > +             dev_warn(bus, "Cant' get reset: %d\n", ret);
> > > > > +     else
> > > > > +             reset_deassert_bulk(&reset_bulk);  
> > > >
> > > > Where are reset_get_bulk/reset_deassert_bulk() defined?  
> > >
> > > In reset.h. That's why I added this include (see above)...  
> >
> > Yes but I guess it is something that will be merged in 5.1? Maybe I
> > will wait for the next release to take this one.  
> 
> You mean Linux 5.1, right? This patch is for U-Boot, not Linux.

My bad, I had SIEVE rules issues, the patch did not got flagged for
"U-Boot". Sorry for the misunderstanding.

Thanks,
Miquèl
diff mbox series

Patch

diff --git a/drivers/mtd/nand/raw/denali_dt.c b/drivers/mtd/nand/raw/denali_dt.c
index d384b974df..21c4540637 100644
--- a/drivers/mtd/nand/raw/denali_dt.c
+++ b/drivers/mtd/nand/raw/denali_dt.c
@@ -9,6 +9,7 @@ 
 #include <linux/io.h>
 #include <linux/ioport.h>
 #include <linux/printk.h>
+#include <reset.h>
 
 #include "denali.h"
 
@@ -64,6 +65,7 @@  static int denali_dt_probe(struct udevice *dev)
 	const struct denali_dt_data *data;
 	struct clk clk, clk_x, clk_ecc;
 	struct resource res;
+	struct reset_ctl_bulk reset_bulk;
 	int ret;
 
 	data = (void *)dev_get_driver_data(dev);
@@ -131,6 +133,12 @@  static int denali_dt_probe(struct udevice *dev)
 		denali->clk_x_rate = 200000000;
 	}
 
+	ret = reset_get_bulk(bus, &reset_bulk);
+	if (ret)
+		dev_warn(bus, "Cant' get reset: %d\n", ret);
+	else
+		reset_deassert_bulk(&reset_bulk);
+
 	return denali_init(denali);
 }