All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] spl_spi: Read default speed and mode values from DT
Date: Fri, 9 Nov 2018 07:44:40 +0100	[thread overview]
Message-ID: <CAAh8qsxFuhWWKtzjN5N6RjXm9_Y6rD3yYTCWHaqjnZD-=gW8Tg@mail.gmail.com> (raw)
In-Reply-To: <1541696240-11680-2-git-send-email-patrick.delaunay@st.com>

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
>

  reply	other threads:[~2018-11-09  6:44 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 [this message]
2018-11-12 12:32     ` Patrick DELAUNAY
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='CAAh8qsxFuhWWKtzjN5N6RjXm9_Y6rD3yYTCWHaqjnZD-=gW8Tg@mail.gmail.com' \
    --to=simon.k.r.goldschmidt@gmail.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.