[U-Boot] [PATCH 1/7] spi: update management of default speed and mode

Jagan Teki jagan at amarulasolutions.com
Wed Dec 12 19:58:25 UTC 2018


On Mon, Dec 10, 2018 at 4:23 PM Patrick Delaunay
<patrick.delaunay at 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 at 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.


More information about the U-Boot mailing list