All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick DELAUNAY <patrick.delaunay@st.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] spl_spi: Read default speed and mode values from DT
Date: Mon, 12 Nov 2018 12:32:26 +0000	[thread overview]
Message-ID: <8ec00a2791f341078840b46d79960359@SFHDAG6NODE3.st.com> (raw)
In-Reply-To: <CAAh8qsxFuhWWKtzjN5N6RjXm9_Y6rD3yYTCWHaqjnZD-=gW8Tg@mail.gmail.com>

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

  reply	other threads:[~2018-11-12 12:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2018-11-08 16:57 ` [U-Boot] [PATCH 2/2] splash: sf: " Patrick Delaunay

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=8ec00a2791f341078840b46d79960359@SFHDAG6NODE3.st.com \
    --to=patrick.delaunay@st.com \
    --cc=u-boot@lists.denx.de \
    /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 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.