public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3 2/2] ppc4xx: Add PPC4xx SPI helpers to Sequoia
@ 2008-12-09 16:26 Steven A. Falco
  2008-12-09 16:51 ` Wolfgang Denk
  2008-12-09 17:18 ` Ben Warren
  0 siblings, 2 replies; 11+ messages in thread
From: Steven A. Falco @ 2008-12-09 16:26 UTC (permalink / raw)
  To: u-boot

This patch adds helper routines needed in support of the PPC4xx SPI driver.

Signed-off-by: Steven A. Falco <sfalco@harris.com>
---

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(-)

diff --git a/board/amcc/sequoia/sequoia.c b/board/amcc/sequoia/sequoia.c
index d6668e2..080ee1e 100644
--- a/board/amcc/sequoia/sequoia.c
+++ b/board/amcc/sequoia/sequoia.c
@@ -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 */
+
diff --git a/include/configs/sequoia.h b/include/configs/sequoia.h
index 9321bdc..417fda1 100644
--- a/include/configs/sequoia.h
+++ b/include/configs/sequoia.h
@@ -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
  */
-- 
1.6.0.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-12-09 20:38 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-09 16:26 [U-Boot] [PATCH v3 2/2] ppc4xx: Add PPC4xx SPI helpers to Sequoia Steven A. Falco
2008-12-09 16:51 ` Wolfgang Denk
2008-12-09 17:18 ` Ben Warren
2008-12-09 17:28   ` Steven A. Falco
2008-12-09 18:53   ` Wolfgang Denk
2008-12-09 19:07     ` Steven A. Falco
2008-12-09 19:12       ` Stefan Roese
2008-12-09 19:52         ` Wolfgang Denk
2008-12-09 19:47       ` Wolfgang Denk
2008-12-09 19:11     ` Ben Warren
2008-12-09 20:38       ` Steven A. Falco

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox