[U-Boot] [PATCH 1/7] spi: update management of default speed and mode
Simon Goldschmidt
simon.k.r.goldschmidt at gmail.com
Mon Dec 10 20:57:31 UTC 2018
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 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>
> Reviewed-by: Petr Vorel <petr.vorel at 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 at gmail.com>
>
>> Regards,
>> Simon
>> _______________________________________________
>> U-Boot mailing list
>> U-Boot at lists.denx.de
>> https://lists.denx.de/listinfo/u-boot
More information about the U-Boot
mailing list