ppc4xx: Add PPC4xx SPI helpers to Sequoia
PATCH v3 2/2 ppc4xx: Add PPC4xx SPI helpers to Sequoia
This patch adds helper routines needed in support of the PPC4xx SPI driver.
---
Changed CONFIG constant to CONFIG_PPC4xx_SPI.
board/amcc/sequoia/sequoia.c | 20 ++++++++++++++++++++ include/configs/sequoia.h | 4 ++++ 2 files changed, 24 insertions(+), 0 deletions(-)
board/amcc/sequoia/sequoia.c +20 -0
@@ -26,6 +26,7 @@#include <libfdt.h> #include <fdt_support.h> #include <ppc4xx.h> +#include <spi.h> #include <asm/gpio.h> #include <asm/processor.h> #include <asm/io.h>
@@ -513,3 +514,22 @@ int post_hotkeys_pressed(void) return 0; /* No hotkeys supported */ }#endif /* CONFIG_POST */ + +#if defined(CONFIG_PPC4xx_SPI) +int spi_cs_is_valid (unsigned int bus,unsigned int cs) +{ +return bus ==0 && cs >=0 && cs <64 ; +} + +void spi_cs_activate (struct spi_slave *slave) +{ +/* Assumes chip-selects are active-low. */ +gpio_write_bit (slave->cs,0 ); +} + +void spi_cs_deactivate (struct spi_slave *slave) +{ +gpio_write_bit (slave->cs,1 ); +} +#endif /* CONFIG_PPC4xx_SPI */ +
include/configs/sequoia.h +4 -0
@@ -236,6 +236,10 @@#define CONFIG_SYS_DTT_LOW_TEMP -30#define CONFIG_SYS_DTT_HYSTERESIS 3 +/* Define these if you are using the SPI port. */ +#undef CONFIG_HARD_SPI +#undef CONFIG_PPC4xx_SPI +/* * Default environment variables */
Signature · 1 line
1.6.0.2
PATCH v3 2/2 ppc4xx: Add PPC4xx SPI helpers to Sequoia
Dear "Steven A. Falco",
Quoted 10 lines · In message <[email protected]> you wrote:
This patch adds helper routines needed in support of the PPC4xx SPI driver.
Signed-off-by Steven A. Falco <[email protected]>---
Changed CONFIG constant to
CONFIG_PPC4xx_SPI.board/amcc/sequoia/sequoia.c | 20 ++++++++++++++++++++ include/configs/sequoia.h | 4 ++++ 2 files changed, 24 insertions(+), 0 deletions(-)
Stefan, same as for the SPI driver itself: I vote to put this on hold until there are any actual users of that code.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de If ignorance is bliss, why aren't there more happy people?
PATCH v3 2/2 ppc4xx: Add PPC4xx SPI helpers to Sequoia
In reply to Steven A. FalcoHi Steven,
Quoted 51 lines · Steven A. Falco
This patch adds helper routines needed in support of the PPC4xx SPI driver.
Signed-off-by Steven A. Falco <[email protected]>---
Changed CONFIG constant to
CONFIG_PPC4xx_SPI.board/amcc/sequoia/sequoia.c | 20 ++++++++++++++++++++ include/configs/sequoia.h | 4 ++++ 2 files changed, 24 insertions(+), 0 deletions(-)board/amcc/sequoia/sequoia.c +20
-0@@ -26,6 +26,7 @@#include <libfdt.h> #include <fdt_support.h> #include <ppc4xx.h> +#include <spi.h> #include <asm/gpio.h> #include <asm/processor.h> #include <asm/io.h> @@ -513,3 +514,22 @@ int post_hotkeys_pressed(void) return 0; /* No hotkeys supported */ }#endif /* CONFIG_POST */ + +#if defined(CONFIG_PPC4xx_SPI) +int spi_cs_is_valid (unsigned int bus,unsigned int cs) +{ +return bus ==0 && cs >=0 && cs <64 ; +} + +void spi_cs_activate (struct spi_slave *slave) +{ +/* Assumes chip-selects are active-low. */ +gpio_write_bit (slave->cs,0 ); +} + +void spi_cs_deactivate (struct spi_slave *slave) +{ +gpio_write_bit (slave->cs,1 ); +} +#endif /* CONFIG_PPC4xx_SPI */ +include/configs/sequoia.h +0
-0
include/configs/sequoia.h line 243
Quoted 8 lines
include/configs/sequoia.h +4
-0@@ -236,6 +236,10 @@#define CONFIG_SYS_DTT_LOW_TEMP -30#define CONFIG_SYS_DTT_HYSTERESIS 3 +/* Define these if you are using the SPI port. */ +#undef CONFIG_HARD_SPI +#undef CONFIG_PPC4xx_SPI +
Why not enable this feature on Sequoia? Wolfgang's argument for keeping the patch out then goes away. IMHO, eval boards should have as many options enabled by default as possible, and the user then has the option to opt out.
Quoted 4 lines
include/configs/sequoia.h +0
-0/* * Default environment variables */
regards,
Ben
PATCH v3 2/2 ppc4xx: Add PPC4xx SPI helpers to Sequoia
Quoted 1 line · Ben Warren
... snip ...
Quoted 5 lines
Quoted 1 line
Why not enable this feature on Sequoia? Wolfgang's argument for keeping the patch out then goes away. IMHO, eval boards should have as many options enabled by default as possible, and the user then has the option to opt out.
I can do that if Stefan and Wolfgang find it acceptable. Just let me know.
Quoted 7 lines
Quoted 4 lines
/*
* Default environment variables
*/regards,
Ben
PATCH v3 2/2 ppc4xx: Add PPC4xx SPI helpers to Sequoia
In reply to Ben WarrenDear Ben Warren,
Quoted 5 lines · In message <[email protected]> you wrote:
Why not enable this feature on Sequoia? Wolfgang's argument for keeping the patch out then goes away. IMHO, eval boards should have as many options enabled by default as possible, and the user then has the option to opt out.
But there is not a single SPI device on the Sequoia board, and if you attach one, you have to write driver code for it that implements the chip select handling and the specific device protocol. We would have a driver included, without any "users" (code that actually calls these functions).
In other words, this driver is a prerequisite for other SPI device drivers that might follow later, but as is, it's just a waste of memory.
It would just waste memory to enable it.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Women are more easily and more deeply terrified ... generating more sheer horror than the male of the species. -- Spock, "Wolf in the Fold", stardate 3615.4
PATCH v3 2/2 ppc4xx: Add PPC4xx SPI helpers to Sequoia
Quoted 14 lines · Wolfgang Denk
Dear Ben Warren,
Quoted 4 lines · In message <[email protected]> you wrote:
Why not enable this feature on Sequoia? Wolfgang's argument for keeping the patch out then goes away. IMHO, eval boards should have as many options enabled by default as possible, and the user then has the option to opt out.
But there is not a single SPI device on the Sequoia board, and if you attach one, you have to write driver code for it that implements the chip select handling and the specific device protocol. We would have a driver included, without any "users" (code that actually calls these functions).
Quoted 5 lines
In other words, this driver is a prerequisite for other SPI device drivers that might follow later, but as is, it's just a waste of memory.
It would just waste memory to enable it.
Makes sense.
Quoted 5 lines
Best regards,
Wolfgang Denk
The problem is that if it isn't accepted now, nobody is likely to remember that it is available, and so they will have to re-write it. Also, it will suffer from bit-rot, if just left as a loose patch.
Steve
PATCH v3 2/2 ppc4xx: Add PPC4xx SPI helpers to Sequoia
In reply to Wolfgang DenkHi Wolfgang,
Quoted 10 lines · Wolfgang Denk
Dear Ben Warren,
Quoted 5 lines · In message <[email protected]> you wrote:
Why not enable this feature on Sequoia? Wolfgang's argument for keeping the patch out then goes away. IMHO, eval boards should have as many options enabled by default as possible, and the user then has the option to opt out.
Quoted 7 lines
But there is not a single SPI device on the Sequoia board, and if you attach one, you have to write driver code for it that implements the chip select handling and the specific device protocol. We would have a driver included, without any "users" (code that actually calls these functions).
Sure. Ignorant assumption on my part that the eval board had something like a SPI EEPROM, but it looks like there's just a header. In that case, the only advantage to including it is to ensure the driver keeps up with any API changes.
Quoted 7 lines
In other words, this driver is a prerequisite for other SPI device drivers that might follow later, but as is, it's just a waste of memory.
It would just waste memory to enable it.
OK, but who cares about memory on an evaluation board? Their entire raison-d'etre is to serve as a starting point for custom boards. I know if I was building a board with this CPU and planned on using SPI, it would be much nicer if the driver was included than having to search the message boards. Just my 2c.
Quoted 5 lines
Best regards,
Wolfgang Denk
regards,
Ben
PATCH v3 2/2 ppc4xx: Add PPC4xx SPI helpers to Sequoia
In reply to Steven A. FalcoQuoted 3 lines · Steven A. Falco
The problem is that if it isn't accepted now, nobody is likely to remember that it is available, and so they will have to re-write it. Also, it will suffer from bit-rot, if just left as a loose patch.
Full ack from me on this.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
PATCH v3 2/2 ppc4xx: Add PPC4xx SPI helpers to Sequoia
In reply to Steven A. FalcoDear "Steven A. Falco",
Quoted 4 lines · In message <[email protected]> you wrote:
The problem is that if it isn't accepted now, nobody is likely to remember that it is available, and so they will have to re-write it. Also, it will suffer from bit-rot, if just left as a loose patch.
It will bit-rot as well if it's added - if no configuration enables it it will not even be compiled.
I recommend you keep it in your queue, and submit it again with the board that will actually use it.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Every program has at least one bug and can be shortened by at least one instruction - from which, by induction, one can deduce that every program can be reduced to one instruction which doesn't work.
PATCH v3 2/2 ppc4xx: Add PPC4xx SPI helpers to Sequoia
In reply to Stefan RoeseDear Stefan,
Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 3 lines · Steven A. Falco
The problem is that if it isn't accepted now, nobody is likely to remember that it is available, and so they will have to re-write it. Also, it will suffer from bit-rot, if just left as a loose patch.
Full ack from me on this.
I agree - but what is a dead driver without users good for?
What was it written for? ... obviously for some specific application on some real board. I recommend to submit this driver as part of the patch series that adds this board support to U-Boot. Then we will also have at least one real user of that code, i. e. we can make sure that it at least compiles.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "The value of marriage is not that adults produce children, but that children produce adults." - Peter De Vries
PATCH v3 2/2 ppc4xx: Add PPC4xx SPI helpers to Sequoia
In reply to Ben WarrenQuoted 29 lines · Ben Warren
Hi Wolfgang,
Quoted 10 lines · Wolfgang Denk
Dear Ben Warren,
Quoted 5 lines · In message <[email protected]> you wrote:
Why not enable this feature on Sequoia? Wolfgang's argument for keeping the patch out then goes away. IMHO, eval boards should have as many options enabled by default as possible, and the user then has the option to opt out.
Quoted 7 lines
But there is not a single SPI device on the Sequoia board, and if you attach one, you have to write driver code for it that implements the chip select handling and the specific device protocol. We would have a driver included, without any "users" (code that actually calls these functions).
Sure. Ignorant assumption on my part that the eval board had something like a SPI EEPROM, but it looks like there's just a header. In that case, the only advantage to including it is to ensure the driver keeps up with any API changes.
Quoted 4 lines
In other words, this driver is a prerequisite for other SPI device drivers that might follow later, but as is, it's just a waste of memory.
Quoted 8 lines
Quoted 3 lines
It would just waste memory to enable it.
OK, but who cares about memory on an evaluation board? Their entire raison-d'etre is to serve as a starting point for custom boards. I know if I was building a board with this CPU and planned on using SPI, it would be much nicer if the driver was included than having to search the message boards. Just my 2c.
I agree with this position. I use U-Boot for two purposes - booting a kernel, and experimenting with hardware. Given that I am currently in the design phase of a project, I am prototyping things on an evaluation board, to see what works and what doesn't. Having U-Boot support all the interfaces of a SOC like the PPC440EPx is very useful to me. Much easier and quicker to do prototyping in U-Boot than in Linux.
But again, you guys can decide the philosophical issues. I'm just the code monkey...
Steve
Quoted 8 lines
Quoted 5 lines
Best regards,
Wolfgang Denk
regards,
Ben