Message ID | 1544439166-5749-2-git-send-email-patrick.delaunay@st.com |
---|---|
State | Changes Requested |
Delegated to: | Jagannadha Sutradharudu Teki |
Headers | show |
Series | Remove defines for SPI default speed and mode | expand |
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> > --- > > cmd/sf.c | 10 ++++++---- > common/spl/spl_spi.c | 11 ++++++----- > common/splash_source.c | 11 ++++++----- > 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
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@lists.denx.de > https://lists.denx.de/listinfo/u-boot
Am 10.12.2018 um 21:49 schrieb Petr Vorel: > 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? I have applied http://patchwork.ozlabs.org/project/uboot/list/?series=76834 before applying this series (as Patrick wrote in his cover letter) and it worked with current master. Regards, Simon > > > 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@lists.denx.de >> https://lists.denx.de/listinfo/u-boot
On Mon, Dec 10, 2018 at 4:23 PM 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> > --- > > cmd/sf.c | 10 ++++++---- > common/spl/spl_spi.c | 11 ++++++----- > common/splash_source.c | 11 ++++++----- > 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; Better define globally with in spi includes or some common include instead of making ifdef changes all over.
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) {
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> --- cmd/sf.c | 10 ++++++---- common/spl/spl_spi.c | 11 ++++++----- common/splash_source.c | 11 ++++++----- 3 files changed, 18 insertions(+), 14 deletions(-)