All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <petr.vorel@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/7] spi: update management of default speed and mode
Date: Mon, 10 Dec 2018 21:49:44 +0100	[thread overview]
Message-ID: <20181210204943.GA6010@x230> (raw)
In-Reply-To: <CAAh8qszZFJCdcF2kP+pc3Wb9fF2QYTr7pBXXErAGMfAQSsoXBA@mail.gmail.com>

Hi Patrick,

> On Mon, Dec 10, 2018 at 11:53 AM Patrick Delaunay
> <patrick.delaunay@st.com> wrote:

> > The 2 default values for SPI mode and speed are
> > only if CONFIG_DM_SPI_FLASH is not defined
> > - CONFIG_SF_DEFAULT_SPEED
> > - CONFIG_SF_DEFAULT_MODE

> > Inverse the logic of the test to remove these two defines.

> > Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Petr Vorel <petr.vorel@gmail.com>

> > ---

> >  cmd/sf.c               | 10 ++++++----
> >  common/spl/spl_spi.c   | 11 ++++++-----
> >  common/splash_source.c | 11 ++++++-----
Patch only applies to cmd/sf.c, the other once do not apply (original patch was
too old).
Or am I missing something?


Kind regards,
Petr


> >  3 files changed, 18 insertions(+), 14 deletions(-)

> > diff --git a/cmd/sf.c b/cmd/sf.c
> > index 84bb057..cfea545 100644
> > --- a/cmd/sf.c
> > +++ b/cmd/sf.c
> > @@ -81,16 +81,18 @@ static int do_spi_flash_probe(int argc, char * const argv[])
> >  {
> >         unsigned int bus = CONFIG_SF_DEFAULT_BUS;
> >         unsigned int cs = CONFIG_SF_DEFAULT_CS;
> > -       unsigned int speed = CONFIG_SF_DEFAULT_SPEED;
> > -       unsigned int mode = CONFIG_SF_DEFAULT_MODE;
> > +       /* In DM mode, defaults will be taken from DT */
> > +       unsigned int speed = 0;
> > +       unsigned int mode = 0;
> >         char *endp;
> >  #ifdef CONFIG_DM_SPI_FLASH
> >         struct udevice *new, *bus_dev;
> >         int ret;
> > -       /* In DM mode defaults will be taken from DT */
> > -       speed = 0, mode = 0;
> >  #else
> >         struct spi_flash *new;
> > +
> > +       speed = CONFIG_SF_DEFAULT_SPEED;
> > +       mode = CONFIG_SF_DEFAULT_MODE;
> >  #endif

> >         if (argc >= 2) {
> > diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c
> > index b348b45..c1c1fcb 100644
> > --- a/common/spl/spl_spi.c
> > +++ b/common/spl/spl_spi.c
> > @@ -74,12 +74,13 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
> >         unsigned payload_offs = CONFIG_SYS_SPI_U_BOOT_OFFS;
> >         struct spi_flash *flash;
> >         struct image_header *header;
> > -       unsigned int max_hz = CONFIG_SF_DEFAULT_SPEED;
> > -       unsigned int spi_mode = CONFIG_SF_DEFAULT_MODE;
> > +       /* In DM mode, defaults will be taken from DT */
> > +       unsigned int max_hz = 0;
> > +       unsigned int spi_mode = 0;

> > -#ifdef CONFIG_DM_SPI_FLASH
> > -       /* In DM mode defaults will be taken from DT */
> > -       max_hz = 0, spi_mode = 0;
> > +#ifndef CONFIG_DM_SPI_FLASH
> > +       max_hz = CONFIG_SF_DEFAULT_SPEED;
> > +       spi_mode = CONFIG_SF_DEFAULT_MODE;
> >  #endif
> >         /*
> >          * Load U-Boot image from SPI flash into RAM
> > diff --git a/common/splash_source.c b/common/splash_source.c
> > index 427196c..d5d5550 100644
> > --- a/common/splash_source.c
> > +++ b/common/splash_source.c
> > @@ -24,12 +24,13 @@ DECLARE_GLOBAL_DATA_PTR;
> >  static struct spi_flash *sf;
> >  static int splash_sf_read_raw(u32 bmp_load_addr, int offset, size_t read_size)
> >  {
> > -       unsigned int max_hz = CONFIG_SF_DEFAULT_SPEED;
> > -       unsigned int spi_mode = CONFIG_SF_DEFAULT_MODE;
> > +       /* In DM mode, defaults will be taken from DT */
> > +       unsigned int max_hz = 0;
> > +       unsigned int spi_mode = 0;

> > -#ifdef CONFIG_DM_SPI_FLASH
> > -       /* In DM mode defaults will be taken from DT */
> > -       max_hz = 0, spi_mode = 0;
> > +#ifndef CONFIG_DM_SPI_FLASH
> > +       max_hz = CONFIG_SF_DEFAULT_SPEED;
> > +       spi_mode = CONFIG_SF_DEFAULT_MODE;
> >  #endif

> >         if (!sf) {

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

> Regards,
> Simon
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot

  reply	other threads:[~2018-12-10 20:49 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-10 10:52 [U-Boot] [PATCH 0/7] Remove defines for SPI default speed and mode Patrick Delaunay
2018-12-10 10:52 ` [U-Boot] [PATCH 1/7] spi: update management of " Patrick Delaunay
2018-12-10 11:24   ` Simon Goldschmidt
2018-12-10 20:49     ` Petr Vorel [this message]
2018-12-10 20:57       ` Simon Goldschmidt
2018-12-12 19:58   ` Jagan Teki
2018-12-10 10:52 ` [U-Boot] [PATCH 2/7] spi: add comment for spi_flash_probe_bus_cs function Patrick Delaunay
2018-12-10 11:25   ` Simon Goldschmidt
2018-12-10 20:54     ` Petr Vorel
2018-12-10 10:52 ` [U-Boot] [PATCH 3/7] da850evm: sf: Read default speed and mode values from DT Patrick Delaunay
2018-12-10 20:57   ` Petr Vorel
2018-12-12 20:02   ` Jagan Teki
2018-12-13 14:54     ` Patrick DELAUNAY
2018-12-10 10:52 ` [U-Boot] [PATCH 4/7] dfu: " Patrick Delaunay
2018-12-10 11:22   ` Lukasz Majewski
2018-12-10 21:00   ` Petr Vorel
2018-12-10 10:52 ` [U-Boot] [PATCH 5/7] mips: mt76xx: gardena-smart-gateway: " Patrick Delaunay
2018-12-10 11:47   ` Stefan Roese
2018-12-10 21:01   ` Petr Vorel
2018-12-10 10:52 ` [U-Boot] [PATCH 6/7] env: " Patrick Delaunay
2018-12-10 11:23   ` Lukasz Majewski
2018-12-10 11:27   ` Simon Goldschmidt
2018-12-10 21:08   ` Petr Vorel
2018-12-12 20:07   ` Jagan Teki
2018-12-10 10:52 ` [U-Boot] [PATCH 7/7] spi: remove define for SPI default SPEED and MODE Patrick Delaunay
2018-12-10 11:26   ` Simon Goldschmidt
2018-12-10 21:10     ` Petr Vorel
2018-12-10 15:42 ` [U-Boot] [PATCH 0/7] Remove defines for SPI default speed and mode Adam Ford
2018-12-10 19:20   ` Simon Goldschmidt
2018-12-10 20:17     ` Adam Ford
2018-12-10 21:08       ` Simon Goldschmidt
2018-12-12  7:51         ` Petr Vorel
2018-12-12  9:54           ` Simon Goldschmidt
2018-12-13 14:46             ` 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=20181210204943.GA6010@x230 \
    --to=petr.vorel@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.