Skip to contentSkip to conversation

PATI: fix broken SPI access

PATCH In review David Müller 3 participants 10 messages Sep 30, 2014 – Oct 10, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PATI: fix broken SPI access

fix broken SPI access by adding/activating BOARD_EARLY_INIT_F functionality and calling spi_init_f() from there.

---
 board/mpl/pati/pati.c  | 5 +++++
 include/configs/PATI.h | 1 +
 2 files changed, 6 insertions(+)
board/mpl/pati/pati.c +5 -0
index 5d701a7..b9d88ee 100644
@@ -311,6 +311,11 @@ void user_led1(int led_on)
 	sysconf->sc_sgpiodt2=reg; /* Data register */
 }
 
+int board_early_init_f(void)
+{
+	spi_init_f();
+	return 0;
+}
 
 /****************************************************************
  * Last Stage Init
include/configs/PATI.h +1 -0
index 65ab65d..3ca204e 100644
@@ -98,6 +98,7 @@
 
 #define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200, 1250000 }
 
+#define CONFIG_BOARD_EARLY_INIT_F
 
 /***********************************************************************
  * Last Stage Init
Signature · 1 line
1.8.4
#1 lore raw

PATCH 1/1 PATI: fix broken SPI access

Quoted 14 lines · David M?ller

fix broken SPI access by adding/activating BOARD_EARLY_INIT_F functionality and calling spi_init_f() from there.

---
 board/mpl/pati/pati.c  | 5 +++++
 include/configs/PATI.h | 1 +
 2 files changed, 6 insertions(+)
board/mpl/pati/pati.c +0 -0
index 5d701a7..b9d88ee 100644

board/mpl/pati/pati.c void user_led1(int led_on) · line 316

Quoted 6 lines
board/mpl/pati/pati.c +3 -0
@@ -311,6 +311,11 @@ void user_led1(int led_on)
        sysconf->sc_sgpiodt2=reg; /* Data register */
 }
 
+int board_early_init_f(void)
+{
+       spi_init_f();

Why you need to do this, spi_init_f is trying to call from arch/powerpc/lib/board.c
any specific reason, I couldn't understand the fix you mentioned on the commit body.

Quoted 10 lines
board/mpl/pati/pati.c +2 -0
+       return 0;
+}
 
 /****************************************************************
  * Last Stage Init
include/configs/PATI.h +0 -0
index 65ab65d..3ca204e 100644

include/configs/PATI.h

Quoted 8 lines
include/configs/PATI.h +1 -1
@@ -98,6 +98,7 @@
 
 #define CONFIG_SYS_BAUDRATE_TABLE      { 9600, 19200, 38400, 57600, 115200, 1250000 }
 
+#define CONFIG_BOARD_EARLY_INIT_F
 
 /***********************************************************************
  * Last Stage Init
--

thanks!

Signature · 1 line
Jagan.
#2 lore raw

PATCH 1/1 PATI: fix broken SPI access

Quoted 9 lines · Jagan Teki

board/mpl/pati/pati.c void user_led1(int led_on) · line 316

Quoted 3 lines · David M?ller
board/mpl/pati/pati.c +3 -0
+int board_early_init_f(void)
+{
+       spi_init_f();

Why you need to do this, spi_init_f is trying to call from arch/powerpc/lib/board.c
any specific reason, I couldn't understand the fix you mentioned on the commit body.

There is an EEPROM attached to the SPI channel containing vital board data. Calling spi_init_f() from arch/powerpc/lib/board.c will be too late.

#3 lore raw

PATCH 1/1 PATI: fix broken SPI access

Quoted 11 lines · David M?ller (ELSOFT AG)
Quoted 9 lines · Jagan Teki

board/mpl/pati/pati.c void user_led1(int led_on) · line 316

Quoted 3 lines · David M?ller
board/mpl/pati/pati.c +3 -0
+int board_early_init_f(void)
+{
+       spi_init_f();

Why you need to do this, spi_init_f is trying to call from arch/powerpc/lib/board.c
any specific reason, I couldn't understand the fix you mentioned on the commit body.

Quoted 2 lines

There is an EEPROM attached to the SPI channel containing vital board data. Calling spi_init_f() from arch/powerpc/lib/board.c will be too late.

Sorry, this looks an other issue - but anyway we're trying to remove spi_init* stuff
from drivers/spi/* in future and I don't think it's a good idea to use that.

thanks!

Signature · 1 line
Jagan.
#4 lore raw

PATCH 1/1 PATI: fix broken SPI access

Quoted 13 lines · Jagan Teki
Quoted 11 lines · David M?ller (ELSOFT AG)
Quoted 9 lines · Jagan Teki

board/mpl/pati/pati.c void user_led1(int led_on) · line 316

Quoted 3 lines · David M?ller
board/mpl/pati/pati.c +3 -0
+int board_early_init_f(void)
+{
+       spi_init_f();

Why you need to do this, spi_init_f is trying to call from arch/powerpc/lib/board.c
any specific reason, I couldn't understand the fix you mentioned on the commit body.

Quoted 6 lines
Quoted 2 lines

There is an EEPROM attached to the SPI channel containing vital board data. Calling spi_init_f() from arch/powerpc/lib/board.c will be too late.

Sorry, this looks an other issue - but anyway we're trying to remove spi_init* stuff
from drivers/spi/* in future and I don't think it's a good idea to use that.

It's also not a good idea to say that we'll leave a board broken until something better comes along. There should be a comment added to the code here making it clear _why_ we need this done early.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140930/28549947/attachment.pgp>
#5 lore raw

PATCH 1/1 PATI: fix broken SPI access

Quoted 17 lines · Tom Rini
Quoted 16 lines · Jagan Teki
Quoted 13 lines · David M?ller (ELSOFT AG)
Quoted 9 lines · Jagan Teki

board/mpl/pati/pati.c void user_led1(int led_on) · line 316

Quoted 3 lines · David M?ller
board/mpl/pati/pati.c +3 -0
+int board_early_init_f(void)
+{
+       spi_init_f();

Why you need to do this, spi_init_f is trying to call from arch/powerpc/lib/board.c
any specific reason, I couldn't understand the fix you mentioned on the commit body.

There is an EEPROM attached to the SPI channel containing vital board data. Calling spi_init_f() from arch/powerpc/lib/board.c will be too late.

Quoted 7 lines
Quoted 3 lines

Sorry, this looks an other issue - but anyway we're trying to remove spi_init* stuff
from drivers/spi/* in future and I don't think it's a good idea to use that.

It's also not a good idea to say that we'll leave a board broken until something better comes along. There should be a comment added to the code here making it clear _why_ we need this done early.

And again, for the record, I wanted to _fix_ things today so we can clean them up tomorrow, rather than keep something broken so we can fix it later.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141010/cb2a5b66/attachment.pgp>
#6 lore raw

PATCH 1/1 PATI: fix broken SPI access

Quoted 22 lines · Tom Rini
Quoted 21 lines · Tom Rini
Quoted 19 lines · Jagan Teki
Quoted 11 lines · David M?ller (ELSOFT AG)
Quoted 9 lines · Jagan Teki

board/mpl/pati/pati.c void user_led1(int led_on) · line 316

Quoted 3 lines · David M?ller
board/mpl/pati/pati.c +3 -0
+int board_early_init_f(void)
+{
+       spi_init_f();

Why you need to do this, spi_init_f is trying to call from arch/powerpc/lib/board.c
any specific reason, I couldn't understand the fix you mentioned on the commit body.

Quoted 2 lines

There is an EEPROM attached to the SPI channel containing vital board data. Calling spi_init_f() from arch/powerpc/lib/board.c will be too late.

Sorry, this looks an other issue - but anyway we're trying to remove spi_init* stuff
from drivers/spi/* in future and I don't think it's a good idea to use that.

Quoted 7 lines
Quoted 3 lines

It's also not a good idea to say that we'll leave a board broken until something better comes along. There should be a comment added to the code here making it clear _why_ we need this done early.

And again, for the record, I wanted to _fix_ things today so we can clean them up tomorrow, rather than keep something broken so we can fix it later.

OK, got your point.

thanks!

Signature · 1 line
Jagan.
#7 lore raw

PATCH 1/1 PATI: fix broken SPI access

In reply to Jagan Teki
Quoted 13 lines · Jagan Teki
Quoted 11 lines · David M?ller (ELSOFT AG)
Quoted 9 lines · Jagan Teki

board/mpl/pati/pati.c void user_led1(int led_on) · line 316

Quoted 3 lines · David M?ller
board/mpl/pati/pati.c +3 -0
+int board_early_init_f(void)
+{
+       spi_init_f();

Why you need to do this, spi_init_f is trying to call from arch/powerpc/lib/board.c
any specific reason, I couldn't understand the fix you mentioned on the commit body.

Quoted 4 lines
Quoted 2 lines

There is an EEPROM attached to the SPI channel containing vital board data. Calling spi_init_f() from arch/powerpc/lib/board.c will be too late.

Sorry, this looks an other issue - but anyway we're trying to remove

What kind of "other issue" do you mean?

Quoted 2 lines

spi_init* stuff
from drivers/spi/* in future and I don't think it's a good idea to use that.

In this case what is the proposed way of initializing the SPI subsystem?

#8 lore raw

PATCH 1/1 PATI: fix broken SPI access

Quoted 17 lines · David M?ller (ELSOFT AG)
Quoted 16 lines · Jagan Teki
Quoted 13 lines · David M?ller (ELSOFT AG)
Quoted 9 lines · Jagan Teki

board/mpl/pati/pati.c void user_led1(int led_on) · line 316

Quoted 3 lines · David M?ller
board/mpl/pati/pati.c +3 -0
+int board_early_init_f(void)
+{
+       spi_init_f();

Why you need to do this, spi_init_f is trying to call from arch/powerpc/lib/board.c
any specific reason, I couldn't understand the fix you mentioned on the commit body.

There is an EEPROM attached to the SPI channel containing vital board data. Calling spi_init_f() from arch/powerpc/lib/board.c will be too late.

Quoted 9 lines
Quoted 1 line

Sorry, this looks an other issue - but anyway we're trying to remove

What kind of "other issue" do you mean?

Quoted 2 lines

spi_init* stuff
from drivers/spi/* in future and I don't think it's a good idea to use that.

In this case what is the proposed way of initializing the SPI subsystem?

Usually spi got initialized through setup_slave() from the cmd interface which is of
dynamic probe ie the reason most of drivers have spi_init() with no functionality code.

On the other hand few are using spi_init() or spi_init_f() from arch code or from
any other kind to initialize the spi.

Finally spi_init_f() from your case should use from arch(at least) as this call is more generic
and it shouldn't be a call from board.

And more over we're working on dm-spi where spi_init() calls stuff would disappear in future.

thanks!

Signature · 1 line
Jagan.
#9 lore raw
In reply to David Müller
Quoted 4 lines · David M?ller (ELSOFT AG)

fix broken SPI access by adding/activating BOARD_EARLY_INIT_F functionality and calling spi_init_f() from there.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141010/02b55947/attachment.pgp>