Skip to contentSkip to conversation

Read default speed and mode values from DT

PATCH Superseded Patrick Delaunay 3 participants 13 messages Nov 19, 2018 – Dec 13, 2018

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover Read default speed and mode values from DT

This serie generalize the commit 96907c0fe50a ("dm: spi: Read default speed and mode values from DT")

In case of DT boot, don't read default speed and mode for SPI from CONFIG_*, instead read from DT node. This will make sure that boards with multiple SPI/QSPI controllers can be probed at different bus frequencies and SPI modes.

Today it is only done in the command sf; this patch do the same for the other user of the spi_flash_probe(): spl and splash to avoid probe issue.

Changes in v2:
- use variables to avoid duplicated code
- use variables to avoid duplicated code

Patrick Delaunay (2):
spl_spi: Read default speed and mode values from DT
splash: sf: Read default speed and mode values from DT

 common/spl/spl_spi.c   | 10 ++++++++--
 common/splash_source.c | 12 ++++++++++--
 2 files changed, 18 insertions(+), 4 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/2 spl_spi: Read default speed and mode values from DT

In case of DT boot, don't read default speed and mode for SPI from CONFIG_*, instead read from DT node.

---

Changes in v2:
- use variables to avoid duplicated code

 common/spl/spl_spi.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
common/spl/spl_spi.c +8 -2
index 8cd4830..b348b45 100644
@@ -74,15 +74,21 @@ 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;
 
+#ifdef CONFIG_DM_SPI_FLASH
+	/* In DM mode defaults will be taken from DT */
+	max_hz = 0, spi_mode = 0;
+#endif
 	/*
 	 * Load U-Boot image from SPI flash into RAM
 	 */
 
 	flash = spi_flash_probe(CONFIG_SF_DEFAULT_BUS,
 				CONFIG_SF_DEFAULT_CS,
-				CONFIG_SF_DEFAULT_SPEED,
-				CONFIG_SF_DEFAULT_MODE);
+				max_hz,
+				spi_mode);
 	if (!flash) {
 		puts("SPI probe failed.\n");
 		return -ENODEV;
Signature · 1 line
2.7.4
#2 lore raw

PATCH v2 1/2 spl_spi: Read default speed and mode values from DT

Quoted 5 lines · Patrick Delaunay

In case of DT boot, don't read default speed and mode for SPI from CONFIG_*, instead read from DT node.

I was commenting about code duplication, which is better now, so:

I do think it would be nice to invert the logic. That way, we could get completely rid of those two CONFIG_SF_DEFAULT settings for DM_SPI_FLASH boards (and eventually for all boards - when's the deadline for that?). But there are other places that still do it like you do here, so it's probably better to change them all at once...

Simon

Quoted 36 lines

---

Changes in v2:
- use variables to avoid duplicated code

  common/spl/spl_spi.c | 10 ++++++++--
  1 file changed, 8 insertions(+), 2 deletions(-)
common/spl/spl_spi.c +8 -2
index 8cd4830..b348b45 100644
@@ -74,15 +74,21 @@ 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;
 
+#ifdef CONFIG_DM_SPI_FLASH
+	/* In DM mode defaults will be taken from DT */
+	max_hz = 0, spi_mode = 0;
+#endif
  	/*
  	 * Load U-Boot image from SPI flash into RAM
  	 */
 
  	flash = spi_flash_probe(CONFIG_SF_DEFAULT_BUS,
  				CONFIG_SF_DEFAULT_CS,
-				CONFIG_SF_DEFAULT_SPEED,
-				CONFIG_SF_DEFAULT_MODE);
+				max_hz,
+				spi_mode);
  	if (!flash) {
  		puts("SPI probe failed.\n");
  		return -ENODEV;
#3 lore raw

PATCH v2 1/2 spl_spi: Read default speed and mode values from DT

Hi Simon,

Quoted 13 lines

-----Original Message-----
From: Simon Goldschmidt <[email protected]>
Sent: lundi 19 novembre 2018 20:09

Quoted 5 lines · Patrick Delaunay

In case of DT boot, don't read default speed and mode for SPI from CONFIG_*, instead read from DT node.

I was commenting about code duplication, which is better now, so:

Quoted 7 lines

I do think it would be nice to invert the logic. That way, we could get completely rid of those two CONFIG_SF_DEFAULT settings for DM_SPI_FLASH boards (and eventually for all boards - when's the deadline for that?).
But there are other places that still do it like you do here, so it's probably better to change them all at once...

Agree with you.

In fact I hesitate with directly change the header file

#ifdef CONFIG_DM_SPI_FLASH
	/* In DM mode defaults will be taken from DT */ 
	#define CONFIG_SF_DEFAULT_SPEED 0
	#define CONFIG_SF_DEFAULT_MODE 0

#endif

But I am afraid of the potential impacts (define is used in many boards), but I think it sould be more cleaner way to force the expected behavior.

Patrick

Quoted 2 lines

Simon

#4 lore raw

PATCH v2 1/2 spl_spi: Read default speed and mode values from DT

Quoted 26 lines · Patrick DELAUNAY

Hi Simon,

Quoted 13 lines

-----Original Message-----
From: Simon Goldschmidt <[email protected]>
Sent: lundi 19 novembre 2018 20:09

Quoted 5 lines · Patrick Delaunay

In case of DT boot, don't read default speed and mode for SPI from CONFIG_*, instead read from DT node.

I was commenting about code duplication, which is better now, so:

Quoted 7 lines

I do think it would be nice to invert the logic. That way, we could get completely rid of those two CONFIG_SF_DEFAULT settings for DM_SPI_FLASH boards (and eventually for all boards - when's the deadline for that?).
But there are other places that still do it like you do here, so it's probably better to change them all at once...

Agree with you.

Quoted 7 lines

In fact I hesitate with directly change the header file

#ifdef CONFIG_DM_SPI_FLASH
        /* In DM mode defaults will be taken from DT */
        #define CONFIG_SF_DEFAULT_SPEED 0
        #define CONFIG_SF_DEFAULT_MODE 0

#endif

This looks correct to me.

Quoted 2 lines

But I am afraid of the potential impacts (define is used in many boards), but I think it sould be more cleaner way to force the expected behavior.

Can't we just push this and fix whatever it breaks?

Regards,
Simon

#5 lore raw

PATCH v2 1/2 spl_spi: Read default speed and mode values from DT

Hi Simon,

Quoted 40 lines

From: Simon Goldschmidt <[email protected]>
Sent: mardi 27 novembre 2018 09:11

Quoted 21 lines · Patrick DELAUNAY

Hi Simon,

Quoted 18 lines

-----Original Message-----
From: Simon Goldschmidt <[email protected]>
Sent: lundi 19 novembre 2018 20:09

Quoted 5 lines · Patrick Delaunay

In case of DT boot, don't read default speed and mode for SPI from CONFIG_*, instead read from DT node.

I was commenting about code duplication, which is better now, so:

I do think it would be nice to invert the logic. That way, we could get completely rid of those two CONFIG_SF_DEFAULT settings for DM_SPI_FLASH boards (and eventually for all boards - when's the deadline

for that?).

Quoted 11 lines
Quoted 2 lines

But there are other places that still do it like you do here, so it's probably better to change them all at once...

Agree with you.

In fact I hesitate with directly change the header file

#ifdef CONFIG_DM_SPI_FLASH
        /* In DM mode defaults will be taken from DT */
        #define CONFIG_SF_DEFAULT_SPEED 0
        #define CONFIG_SF_DEFAULT_MODE 0 #endif
Quoted 7 lines

This looks correct to me.

Quoted 2 lines

But I am afraid of the potential impacts (define is used in many boards), but I think it sould be more cleaner way to force the expected

behavior.

Can't we just push this and fix whatever it breaks?

Yes I can push it, what is the correct patch strategy.

1/ accept this patch (for short term solution) and propose a update after (I can do it next week).

2/ sent a v3 of this patchset (it can make more time to solve the potential issue)

Quoted 3 lines

Regards,
Simon

Reagrds
Patrick

#6 lore raw

PATCH v2 1/2 spl_spi: Read default speed and mode values from DT

Quoted 47 lines · Patrick DELAUNAY

Hi Simon,

Quoted 44 lines

From: Simon Goldschmidt <[email protected]>
Sent: mardi 27 novembre 2018 09:11

Quoted 21 lines · Patrick DELAUNAY

Hi Simon,

Quoted 18 lines

-----Original Message-----
From: Simon Goldschmidt <[email protected]>
Sent: lundi 19 novembre 2018 20:09

Quoted 5 lines · Patrick Delaunay

In case of DT boot, don't read default speed and mode for SPI from CONFIG_*, instead read from DT node.

I was commenting about code duplication, which is better now, so:

I do think it would be nice to invert the logic. That way, we could get completely rid of those two CONFIG_SF_DEFAULT settings for DM_SPI_FLASH boards (and eventually for all boards - when's the deadline

for that?).

Quoted 11 lines
Quoted 2 lines

But there are other places that still do it like you do here, so it's probably better to change them all at once...

Agree with you.

In fact I hesitate with directly change the header file

#ifdef CONFIG_DM_SPI_FLASH
        /* In DM mode defaults will be taken from DT */
        #define CONFIG_SF_DEFAULT_SPEED 0
        #define CONFIG_SF_DEFAULT_MODE 0 #endif

This looks correct to me.

Quoted 2 lines

But I am afraid of the potential impacts (define is used in many boards), but I think it sould be more cleaner way to force the expected

Quoted 7 lines
Quoted 3 lines

behavior.

Can't we just push this and fix whatever it breaks?

Yes I can push it, what is the correct patch strategy.

1/ accept this patch (for short term solution) and propose a update after (I can do it next week).

I'm totally OK with 1, yes. That's why I've already sent my reviewed-by. But I would really appreciate a later update, this got me confused already... ;-)

Regards,
Simon

Quoted 9 lines

2/ sent a v3 of this patchset (it can make more time to solve the potential issue)

Quoted 3 lines

Regards,
Simon

Reagrds
Patrick

#7 lore raw

PATCH v2 1/2 spl_spi: Read default speed and mode values from DT

Hi Simon,

Quoted 50 lines

From: Simon Goldschmidt <[email protected]>
Sent: mardi 27 novembre 2018 13:55
Subject: Re: [PATCH v2 1/2] spl_spi: Read default speed and mode values from DT

Quoted 44 lines · Patrick DELAUNAY

Hi Simon,

Quoted 40 lines

From: Simon Goldschmidt <[email protected]>
Sent: mardi 27 novembre 2018 09:11

Quoted 13 lines · Patrick DELAUNAY

Hi Simon,

Quoted 10 lines

-----Original Message-----
From: Simon Goldschmidt <[email protected]>
Sent: lundi 19 novembre 2018 20:09

On 19.11.2018 18:33, Patrick Delaunay wrote:

I do think it would be nice to invert the logic. That way, we could get completely rid of those two CONFIG_SF_DEFAULT settings for DM_SPI_FLASH boards (and eventually for all boards - when's the deadline

for that?).

Quoted 11 lines
Quoted 2 lines

But there are other places that still do it like you do here, so it's probably better to change them all at once...

Agree with you.

In fact I hesitate with directly change the header file

#ifdef CONFIG_DM_SPI_FLASH
        /* In DM mode defaults will be taken from DT */
        #define CONFIG_SF_DEFAULT_SPEED 0
        #define CONFIG_SF_DEFAULT_MODE 0 #endif

This looks correct to me.

Quoted 3 lines

But I am afraid of the potential impacts (define is used in many boards), but I think it sould be more cleaner way to force the expected

behavior.

Can't we just push this and fix whatever it breaks?

Quoted 7 lines
Quoted 3 lines

Yes I can push it, what is the correct patch strategy.

1/ accept this patch (for short term solution) and propose a update after (I can

do it next week).

I'm totally OK with 1, yes. That's why I've already sent my reviewed-by. But I would really appreciate a later update, this got me confused already... ;-)

For information I send the new serie today named "[PATCH 0/7] Remove defines for SPI default speed and mode"

http://patchwork.ozlabs.org/project/uboot/list/?series=80769

Finally I propose to remove the 2 defines when the SPI DM migration will be completed.

Quoted 2 lines

Regards,
Simon

Regards Patrick.

#8 lore raw

PATCH v2 1/2 spl_spi: Read default speed and mode values from DT

In reply to Patrick Delaunay
Quoted 19 lines · Patrick Delaunay

In case of DT boot, don't read default speed and mode for SPI from CONFIG_*, instead read from DT node.

---

Changes in v2:
- use variables to avoid duplicated code

 common/spl/spl_spi.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
common/spl/spl_spi.c +0 -0
index 8cd4830..b348b45 100644

common/spl/spl_spi.c static int spl_spi_load_image(struct spl_image_info *spl_image, · line 79

Quoted 6 lines
common/spl/spl_spi.c +2 -0
@@ -74,15 +74,21 @@ 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;
 

Instead of

common/spl/spl_spi.c static int spl_spi_load_image(struct spl_image_info *spl_image, · line 80

Quoted 1 line
common/spl/spl_spi.c +1 -0
+#ifdef CONFIG_DM_SPI_FLASH

What about using:

#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)

common/spl/spl_spi.c static int spl_spi_load_image(struct spl_image_info *spl_image, · line 83

Quoted 3 lines
common/spl/spl_spi.c +3 -0
+       /* In DM mode defaults will be taken from DT */
+       max_hz = 0, spi_mode = 0;
+#endif

This one-line change 'should' give you what you want, the settings of 0 for boards using the device tree. If board that uses OF_PLATDATA cannot load the device tree, it'll default back to the configs set above. You could probably combine all if statements into one, and I'd be fine with that too.

This one-line change made my board boot with this series. I haven't applied the follow-up series yet but if a v3 was posted with this change, I'd mark it as 'tested-by.

adam

Quoted 20 lines
common/spl/spl_spi.c +2 -3
        /*
         * Load U-Boot image from SPI flash into RAM
         */
 
        flash = spi_flash_probe(CONFIG_SF_DEFAULT_BUS,
                                CONFIG_SF_DEFAULT_CS,
-                               CONFIG_SF_DEFAULT_SPEED,
-                               CONFIG_SF_DEFAULT_MODE);
+                               max_hz,
+                               spi_mode);
        if (!flash) {
                puts("SPI probe failed.\n");
                return -ENODEV;
--

2.7.4

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

#9 lore raw

PATCH v2 1/2 spl_spi: Read default speed and mode values from DT

Hi Adam,

Thanks for the tests,
And sorry for the regression on your board.

Quoted 49 lines

From: Adam Ford <[email protected]>
Sent: lundi 10 décembre 2018 23:48

common/spl/spl_spi.c static int spl_spi_load_image(struct spl_image_info

Quoted 19 lines · Patrick Delaunay

In case of DT boot, don't read default speed and mode for SPI from CONFIG_*, instead read from DT node.

---

Changes in v2:
- use variables to avoid duplicated code

 common/spl/spl_spi.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
common/spl/spl_spi.c index renamed from common/spl/spl_spi.c +0 -0

8cd4830..b348b45 100644

common/spl/spl_spi.c +0 -0
@@ -74,15 +74,21 @@ static int spl_spi_load_image(struct spl_image_info

*spl_image,

common/spl/spl_spi.c static int spl_spi_load_image(struct spl_image_info *spl_image, · line 79

Quoted 6 lines
common/spl/spl_spi.c +2 -0
        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;
 

Instead of

common/spl/spl_spi.c static int spl_spi_load_image(struct spl_image_info *spl_image, · line 80

Quoted 1 line
common/spl/spl_spi.c +1 -0
+#ifdef CONFIG_DM_SPI_FLASH

What about using:

#if CONFIG_IS_ENABLED(OF_CONTROL) &&
!CONFIG_IS_ENABLED(OF_PLATDATA)

common/spl/spl_spi.c static int spl_spi_load_image(struct spl_image_info *spl_image, · line 83

Quoted 3 lines
common/spl/spl_spi.c +3 -0
+       /* In DM mode defaults will be taken from DT */
+       max_hz = 0, spi_mode = 0;
+#endif

This one-line change 'should' give you what you want, the settings of 0 for boards using the device tree. If board that uses OF_PLATDATA cannot load the device tree, it'll default back to the configs set above. You could probably combine all if statements into one, and I'd be fine with that too.

Quoted 5 lines

This one-line change made my board boot with this series. I haven't applied the follow-up series yet but if a v3 was posted with this change, I'd mark it as 'tested-by.

adam

I am not familiar with platdata (my platform use only device tree). So I take some time to check and answer.

I clearly no anticipate the issue for OF_PLATDATA, mainly caused by code in drivers/spi/spi-uclass.c

In function spi_get_bus_and_cs
The parameter speed expect 0 to load parameter from device tree / with parent platdata

	if (!speed) {
		speed = plat->max_hz;
		mode = plat->mode;
	}

=> it should the default behavior when parent is correctly initialized for ALL the user (SPL/ENV/Commands).

But for some case, when driver is automatically created (no device tree node or platform data)

Speed is ALSO used as max_hz entry for platdata.
It is a bad idea when speed = 0

Simon already make a patch to avoid the issue

=> "dm: spi: prevent setting a speed of 0 Hz"
SHA1 = 12bfb2e05fc29bfbec7eb76ea8cc02e130268801

But in your case , it is not enough .....
I don't known why,

I try to understood how the platdata for parent (SPI_UCLASS) can be configurated... I need to go deeper.

A solution can to change the code introduce by Simon :

+ if (speed) {
+ plat->max_hz = speed;
+ } else {
+ printf("Warning: SPI speed fallback to %u kHz\n",
+ SPI_DEFAULT_SPEED_HZ / 1000);
+ plat->max_hz = SPI_DEFAULT_SPEED_HZ;
+ }

some update can work in your case

	if (speed) {
		plat->max_hz = speed; 
	} else {
#ifdef CONFIG_SF_DEFAULT_SPEED
		plat->max_hz = CONFIG_SF_DEFAULT_SPEED; 
#else
		printf("Warning: SPI speed fallback to %u kHz\n",
			       SPI_DEFAULT_SPEED_HZ / 1000);
			plat->max_hz = SPI_DEFAULT_SPEED_HZ;
#endif
	}
	If (mode)
		plat->mode = mode;
	else
#ifdef CONFIG_SF_DEFAULT_MODE
		plat->mode = CONFIG_SF_DEFAULT_MODE
#else
		plat->mode = SPI_MODE_3

#endif

In thise case the CONFIG_DEFAULT value are defined, they are used....

So the 2 series are not enough mature today, we need some work. But I start my holiday today, I will come back only in 3 weeks....

I will check this point when I will come back.

NB: for short term solution, for plaform with DT only flash descrition (as my platform), we can use

CONFIG_SF_DEFAULT_SPEED=0
CONFIG_SF_DEFAULT_MODE=0

That should be solved the current issue in my board without need to merge the 2 series (not yet tested).

Quoted 16 lines
Quoted 16 lines
common/spl/spl_spi.c +2 -3
        /*
         * Load U-Boot image from SPI flash into RAM
         */
 
        flash = spi_flash_probe(CONFIG_SF_DEFAULT_BUS,
                                CONFIG_SF_DEFAULT_CS,
-                               CONFIG_SF_DEFAULT_SPEED,
-                               CONFIG_SF_DEFAULT_MODE);
+                               max_hz,
+                               spi_mode);
        if (!flash) {
                puts("SPI probe failed.\n");
                return -ENODEV;
--

2.7.4

Quoted 4 lines
Quoted 4 lines

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

Regards

Patrick

#10 lore raw

PATCH v2 2/2 splash: sf: Read default speed and mode values from DT

In reply to Patrick Delaunay

In case of DT boot, don't read default speed and mode for SPI from CONFIG_*, instead read from DT node.

---

Changes in v2:
- use variables to avoid duplicated code

 common/splash_source.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
common/splash_source.c +10 -2
index 62763b9..427196c 100644
@@ -24,11 +24,19 @@ 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;
+
+#ifdef CONFIG_DM_SPI_FLASH
+	/* In DM mode defaults will be taken from DT */
+	max_hz = 0, spi_mode = 0;
+#endif
+
 	if (!sf) {
 		sf = spi_flash_probe(CONFIG_SF_DEFAULT_BUS,
 				     CONFIG_SF_DEFAULT_CS,
-				     CONFIG_SF_DEFAULT_SPEED,
-				     CONFIG_SF_DEFAULT_MODE);
+				     max_hz,
+				     spi_mode);
 		if (!sf)
 			return -ENODEV;
 	}
Signature · 1 line
2.7.4
#11 lore raw

v2 cover Read default speed and mode values from DT

In reply to Patrick Delaunay
Quoted 19 lines · Patrick Delaunay

This serie generalize the commit 96907c0fe50a ("dm: spi: Read default speed and mode values from DT")

In case of DT boot, don't read default speed and mode for SPI from CONFIG_*, instead read from DT node. This will make sure that boards with multiple SPI/QSPI controllers can be probed at different bus frequencies and SPI modes.

Today it is only done in the command sf; this patch do the same for the other user of the spi_flash_probe(): spl and splash to avoid probe issue.

Changes in v2:
- use variables to avoid duplicated code
- use variables to avoid duplicated code

Quoted 8 lines

Patrick Delaunay (2):
spl_spi: Read default speed and mode values from DT
splash: sf: Read default speed and mode values from DT

 common/spl/spl_spi.c   | 10 ++++++++--
 common/splash_source.c | 12 ++++++++++--
 2 files changed, 18 insertions(+), 4 deletions(-)

I replied to another thread, but to prevent a hasty decision, I thought I'd mention that this patch series breaks the da850evm.

U-Boot SPL 2019.01-rc1-00747-g1a3453efed (Dec 10 2018 - 09:07:08 -0600) Trying to boot from SPI
Warning: SPI speed fallback to 100 kHz

(And repeat the above forever)

I know Jagan just re-did some of the da850 SPI driver and I wonder if the updated driver just needs mode and speed entries added to platdata then extracted from platdata when the driver is initialized.

adam

Quoted 7 lines

--
2.7.4

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

#12 lore raw

v2 cover Read default speed and mode values from DT

Hi Adam,

Quoted 41 lines

-----Original Message-----
From: Adam Ford <[email protected]>
Sent: lundi 10 décembre 2018 16:50

Quoted 19 lines · Patrick Delaunay

This serie generalize the commit 96907c0fe50a ("dm: spi: Read default speed and mode values from DT")

In case of DT boot, don't read default speed and mode for SPI from CONFIG_*, instead read from DT node. This will make sure that boards with multiple SPI/QSPI controllers can be probed at different bus frequencies and SPI modes.

Today it is only done in the command sf; this patch do the same for the other user of the spi_flash_probe(): spl and splash to avoid probe issue.

Changes in v2:
- use variables to avoid duplicated code
- use variables to avoid duplicated code

Quoted 8 lines

Patrick Delaunay (2):
spl_spi: Read default speed and mode values from DT
splash: sf: Read default speed and mode values from DT

 common/spl/spl_spi.c   | 10 ++++++++--
 common/splash_source.c | 12 ++++++++++--
 2 files changed, 18 insertions(+), 4 deletions(-)

I replied to another thread, but to prevent a hasty decision, I thought I'd mention that this patch series breaks the da850evm.

U-Boot SPL 2019.01-rc1-00747-g1a3453efed (Dec 10 2018 - 09:07:08 -0600) Trying to boot from SPI
Warning: SPI speed fallback to 100 kHz

Quoted 7 lines

(And repeat the above forever)

I know Jagan just re-did some of the da850 SPI driver and I wonder if the updated driver just needs mode and speed entries added to platdata then extracted from platdata when the driver is initialized.

adam

Thanks for the tests, I agree the serie can't be merged in this state.

I will come back only in 3 weeks....
and I will check this point when I will come back. That should avoid many issue as already solved for the 2 series

http://patchwork.ozlabs.org/patch/1010363/
http://patchwork.ozlabs.org/patch/995030/

That should be avoid revert in the next daysas :
http://git.denx.de/?p=u-boot.git;a=commit;h=25a17652c9c2cc4d88098121fc6a2b8f90020531

NB: for short term solution without patch,
for platform with DT only flash description (as my platform stm32mp1), we can use

CONFIG_SF_DEFAULT_SPEED=0
CONFIG_SF_DEFAULT_MODE=0

That should be solved the current issue in my board without need to merge the 2 series (not yet tested).

Quoted 7 lines
Quoted 7 lines

--
2.7.4

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