All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/2] Read default speed and mode values from DT
@ 2018-11-08 16:57 Patrick Delaunay
  2018-11-08 16:57 ` [U-Boot] [PATCH 1/2] spl_spi: " Patrick Delaunay
  2018-11-08 16:57 ` [U-Boot] [PATCH 2/2] splash: sf: " Patrick Delaunay
  0 siblings, 2 replies; 5+ messages in thread
From: Patrick Delaunay @ 2018-11-08 16:57 UTC (permalink / raw)
  To: u-boot


This serie generalize the commit 96907c0fe50a
("dm: spi: Read default speed and mode values from DT")

In case of DT boot, don't read default speed and mode for SPI from
CONFIG_*, instead read from DT node. This will make sure that boards
with multiple SPI/QSPI controllers can be probed at different
bus frequencies and SPI modes.

Today it is only done in the command sf; this patch do the same
for the other user of the spi_flash_probe(): spl and splash
to avoid probe issue.



Patrick Delaunay (2):
  spl_spi: Read default speed and mode values from DT
  splash: sf: Read default speed and mode values from DT

 common/spl/spl_spi.c   | 9 ++++++++-
 common/splash_source.c | 8 ++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH 1/2] spl_spi: Read default speed and mode values from DT
  2018-11-08 16:57 [U-Boot] [PATCH 0/2] Read default speed and mode values from DT Patrick Delaunay
@ 2018-11-08 16:57 ` Patrick Delaunay
  2018-11-09  6:44   ` Simon Goldschmidt
  2018-11-08 16:57 ` [U-Boot] [PATCH 2/2] splash: sf: " Patrick Delaunay
  1 sibling, 1 reply; 5+ messages in thread
From: Patrick Delaunay @ 2018-11-08 16:57 UTC (permalink / raw)
  To: u-boot

In case of DT boot, don't read default speed and mode for SPI from
CONFIG_*, instead read from DT node.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

 common/spl/spl_spi.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c
index 8cd4830..3cefc9a 100644
--- a/common/spl/spl_spi.c
+++ b/common/spl/spl_spi.c
@@ -78,11 +78,18 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
 	/*
 	 * Load U-Boot image from SPI flash into RAM
 	 */
-
+#ifdef CONFIG_DM_SPI_FLASH
+	/* In DM mode defaults will be taken from DT */
+	flash = spi_flash_probe(CONFIG_SF_DEFAULT_BUS,
+				CONFIG_SF_DEFAULT_CS,
+				0,
+				0);
+#else
 	flash = spi_flash_probe(CONFIG_SF_DEFAULT_BUS,
 				CONFIG_SF_DEFAULT_CS,
 				CONFIG_SF_DEFAULT_SPEED,
 				CONFIG_SF_DEFAULT_MODE);
+#endif
 	if (!flash) {
 		puts("SPI probe failed.\n");
 		return -ENODEV;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH 2/2] splash: sf: Read default speed and mode values from DT
  2018-11-08 16:57 [U-Boot] [PATCH 0/2] Read default speed and mode values from DT Patrick Delaunay
  2018-11-08 16:57 ` [U-Boot] [PATCH 1/2] spl_spi: " Patrick Delaunay
@ 2018-11-08 16:57 ` Patrick Delaunay
  1 sibling, 0 replies; 5+ messages in thread
From: Patrick Delaunay @ 2018-11-08 16:57 UTC (permalink / raw)
  To: u-boot

In case of DT boot, don't read default speed and mode for SPI from
CONFIG_*, instead read from DT node.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

 common/splash_source.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/common/splash_source.c b/common/splash_source.c
index 62763b9..f0b3407 100644
--- a/common/splash_source.c
+++ b/common/splash_source.c
@@ -25,10 +25,18 @@ static struct spi_flash *sf;
 static int splash_sf_read_raw(u32 bmp_load_addr, int offset, size_t read_size)
 {
 	if (!sf) {
+#ifdef CONFIG_DM_SPI_FLASH
+		/* In DM mode defaults will be taken from DT */
+		sf = spi_flash_probe(CONFIG_SF_DEFAULT_BUS,
+				     CONFIG_SF_DEFAULT_CS,
+				     0,
+				     0);
+#else
 		sf = spi_flash_probe(CONFIG_SF_DEFAULT_BUS,
 				     CONFIG_SF_DEFAULT_CS,
 				     CONFIG_SF_DEFAULT_SPEED,
 				     CONFIG_SF_DEFAULT_MODE);
+#endif
 		if (!sf)
 			return -ENODEV;
 	}
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH 1/2] spl_spi: Read default speed and mode values from DT
  2018-11-08 16:57 ` [U-Boot] [PATCH 1/2] spl_spi: " Patrick Delaunay
@ 2018-11-09  6:44   ` Simon Goldschmidt
  2018-11-12 12:32     ` Patrick DELAUNAY
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Goldschmidt @ 2018-11-09  6:44 UTC (permalink / raw)
  To: u-boot

On Thu, Nov 8, 2018 at 5:58 PM Patrick Delaunay <patrick.delaunay@st.com> wrote:
>
> In case of DT boot, don't read default speed and mode for SPI from
> CONFIG_*, instead read from DT node.
>
> Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> ---
>
>  common/spl/spl_spi.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c
> index 8cd4830..3cefc9a 100644
> --- a/common/spl/spl_spi.c
> +++ b/common/spl/spl_spi.c
> @@ -78,11 +78,18 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
>         /*
>          * Load U-Boot image from SPI flash into RAM
>          */
> -
> +#ifdef CONFIG_DM_SPI_FLASH
> +       /* In DM mode defaults will be taken from DT */
> +       flash = spi_flash_probe(CONFIG_SF_DEFAULT_BUS,
> +                               CONFIG_SF_DEFAULT_CS,
> +                               0,
> +                               0);

Code duplication is never good. Wouldn't it be nicer to only have an
#if for the two differing parameters (e.g. via local variables)
instead of duplicating the function call?

Simon

> +#else
>         flash = spi_flash_probe(CONFIG_SF_DEFAULT_BUS,
>                                 CONFIG_SF_DEFAULT_CS,
>                                 CONFIG_SF_DEFAULT_SPEED,
>                                 CONFIG_SF_DEFAULT_MODE);
> +#endif
>         if (!flash) {
>                 puts("SPI probe failed.\n");
>                 return -ENODEV;
> --
> 2.7.4
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH 1/2] spl_spi: Read default speed and mode values from DT
  2018-11-09  6:44   ` Simon Goldschmidt
@ 2018-11-12 12:32     ` Patrick DELAUNAY
  0 siblings, 0 replies; 5+ messages in thread
From: Patrick DELAUNAY @ 2018-11-12 12:32 UTC (permalink / raw)
  To: u-boot

Hi Simon,

> From: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> Sent: vendredi 9 novembre 2018 07:45
> Subject: Re: [PATCH 1/2] spl_spi: Read default speed and mode values from DT
> Importance: High
> 
> On Thu, Nov 8, 2018 at 5:58 PM Patrick Delaunay <patrick.delaunay@st.com>
> wrote:
> >
> > In case of DT boot, don't read default speed and mode for SPI from
> > CONFIG_*, instead read from DT node.
> >
> > Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
> > Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> > ---
> >
> >  common/spl/spl_spi.c | 9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c index
> > 8cd4830..3cefc9a 100644
> > --- a/common/spl/spl_spi.c
> > +++ b/common/spl/spl_spi.c
> > @@ -78,11 +78,18 @@ static int spl_spi_load_image(struct spl_image_info
> *spl_image,
> >         /*
> >          * Load U-Boot image from SPI flash into RAM
> >          */
> > -
> > +#ifdef CONFIG_DM_SPI_FLASH
> > +       /* In DM mode defaults will be taken from DT */
> > +       flash = spi_flash_probe(CONFIG_SF_DEFAULT_BUS,
> > +                               CONFIG_SF_DEFAULT_CS,
> > +                               0,
> > +                               0);
> 
> Code duplication is never good. Wouldn't it be nicer to only have an #if for the
> two differing parameters (e.g. via local variables) instead of duplicating the
> function call?

Ok. I take the point and I will update the patchset with local variable in v2.
I just wait few day to be sure it is the only remark.

> Simon
> 
> > +#else
> >         flash = spi_flash_probe(CONFIG_SF_DEFAULT_BUS,
> >                                 CONFIG_SF_DEFAULT_CS,
> >                                 CONFIG_SF_DEFAULT_SPEED,
> >                                 CONFIG_SF_DEFAULT_MODE);
> > +#endif
> >         if (!flash) {
> >                 puts("SPI probe failed.\n");
> >                 return -ENODEV;
> > --
> > 2.7.4
> >

Regards
Patrick

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-11-12 12:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-08 16:57 [U-Boot] [PATCH 0/2] Read default speed and mode values from DT Patrick Delaunay
2018-11-08 16:57 ` [U-Boot] [PATCH 1/2] spl_spi: " Patrick Delaunay
2018-11-09  6:44   ` Simon Goldschmidt
2018-11-12 12:32     ` Patrick DELAUNAY
2018-11-08 16:57 ` [U-Boot] [PATCH 2/2] splash: sf: " Patrick Delaunay

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.