Skip to contentSkip to conversation

Move conditional compilation of MPC8XXX SPI driver to Makefile

PATCH New Ben Warren 3 participants 3 messages Jun 9, 2008 – Jul 5, 2008 SPI

lore
Share & tools
lore

Ben Warren

author
#0 lore raw

PATCH v2 1/1 Move conditional compilation of MPC8XXX SPI driver to Makefile

---
 board/freescale/mpc8349emds/mpc8349emds.c |    2 +-
 drivers/spi/Makefile                      |    2 +-
 drivers/spi/mpc8xxx_spi.c                 |    2 --
 include/configs/MPC8349EMDS.h             |    1 -
 include/spi.h                             |    9 +++++++++
 lib_ppc/board.c                           |    2 --
 6 files changed, 11 insertions(+), 7 deletions(-)
board/freescale/mpc8349emds/mpc8349emds.c +1 -1
index e18e68e..0acc17e 100644
@@ -253,7 +253,7 @@ void sdram_init(void)
 /*
  * The following are used to control the SPI chip selects for the SPI command.
  */
-#ifdef CONFIG_HARD_SPI
+#ifdef CONFIG_MPC8XXX_SPI
 
 #define SPI_CS_MASK	0x80000000
 
drivers/spi/Makefile +1 -1
index e66e0ee..4f7b679 100644
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB	:= $(obj)libspi.a
 
-COBJS-y += mpc8xxx_spi.o
+COBJS-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
 COBJS-$(CONFIG_ATMEL_SPI) += atmel_spi.o
 COBJS-$(CONFIG_MXC_SPI) += mxc_spi.o
 
drivers/spi/mpc8xxx_spi.c +0 -2
index 136fb50..9eaf986 100644
@@ -22,7 +22,6 @@
  */
 
 #include <common.h>
-#if defined(CONFIG_MPC8XXX_SPI) && defined(CONFIG_HARD_SPI)
 
 #include <malloc.h>
 #include <spi.h>
@@ -180,4 +179,3 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
 
 	return 0;
 }
-#endif				/* CONFIG_HARD_SPI */
include/configs/MPC8349EMDS.h +0 -1
index bd77540..af72538 100644
@@ -355,7 +355,6 @@
 
 /* SPI */
 #define CONFIG_MPC8XXX_SPI
-#define CONFIG_HARD_SPI			/* SPI with hardware support */
 #undef CONFIG_SOFT_SPI			/* SPI bit-banged */
 
 /* GPIOs.  Used as SPI chip selects */
include/spi.h +9 -0
index 7744c2e..320e50e 100644
@@ -24,6 +24,15 @@
 #ifndef _SPI_H_
 #define _SPI_H_
 
+/* Controller-specific definitions: */
+
+/* CONFIG_HARD_SPI triggers SPI bus initialization in PowerPC */
+#ifdef CONFIG_MPC8XXX_SPI
+# ifndef CONFIG_HARD_SPI
+#  define CONFIG_HARD_SPI
+# endif
+#endif
+
 /* SPI mode flags */
 #define	SPI_CPHA	0x01			/* clock phase */
 #define	SPI_CPOL	0x02			/* clock polarity */
lib_ppc/board.c +0 -2
index a908831..afa0c74 100644
@@ -90,9 +90,7 @@ void doc_init (void);
     defined(CONFIG_SOFT_I2C)
 #include <i2c.h>
 #endif
-#if defined(CONFIG_HARD_SPI)
 #include <spi.h>
-#endif
 #include <nand.h>
 
 static char *failed = "*** failed ***\n";
Signature · 1 line
1.5.4.3
#1 lore raw

PATCH v2 1/1 Move conditional compilation of MPC8XXX SPI driver to Makefile

include/spi.h line 34

Quoted 8 lines · Ben Warren
include/spi.h +8 -0
+/* Controller-specific definitions: */
+
+/* CONFIG_HARD_SPI triggers SPI bus initialization in PowerPC */
+#ifdef CONFIG_MPC8XXX_SPI
+# ifndef CONFIG_HARD_SPI
+#  define CONFIG_HARD_SPI
+# endif
+#endif

Grumble. I'm really looking forward to that Kconfig system so we can get rid of crap like this...it won't exactly become prettier as more SPI drivers are added...

Btw, I wonder if the _real_ fix is to move the stuff in spi_init() into spi_claim_bus() and just kill spi_init() altogether. This will match the u-boot design requirement about not touching hardware you don't intend to use a bit more closely.

But I can certainly understand that you want to keep the existing code working before doing something like that.

Haavard

#2 lore raw

PATCH v2 1/1 Move conditional compilation of MPC8XXX SPI driver to Makefile

In reply to Ben Warren
Quoted 9 lines · In message <[email protected]> you…
---
 board/freescale/mpc8349emds/mpc8349emds.c |    2 +-
 drivers/spi/Makefile                      |    2 +-
 drivers/spi/mpc8xxx_spi.c                 |    2 --
 include/configs/MPC8349EMDS.h             |    1 -
 include/spi.h                             |    9 +++++++++
 lib_ppc/board.c                           |    2 --
 6 files changed, 11 insertions(+), 7 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 7 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
"I think they're going to take all this money that we  spend  now  on
war and death --"                   "And make them spend it on life."
	-- Edith Keeler and Kirk, "The City on the Edge of Forever",
	   stardate unknown.