Move conditional compilation of MPC8XXX SPI driver to Makefile
[platform/kernel/u-boot.git] / board / freescale / mpc8349emds / mpc8349emds.c
index 3d72eb7..9a312c3 100644 (file)
 #include <mpc83xx.h>
 #include <asm/mpc8349_pci.h>
 #include <i2c.h>
-#include <spd.h>
+#include <spi.h>
 #include <miiphy.h>
-#if defined(CONFIG_SPD_EEPROM)
 #include <spd_sdram.h>
-#endif
+
 #if defined(CONFIG_OF_LIBFDT)
 #include <libfdt.h>
 #endif
@@ -60,7 +59,7 @@ int board_early_init_f (void)
 
 #define ns2clk(ns) (ns / (1000000000 / CONFIG_8349_CLKIN) + 1)
 
-long int initdram (int board_type)
+phys_size_t initdram (int board_type)
 {
        volatile immap_t *im = (immap_t *)CFG_IMMR;
        u32 msize = 0;
@@ -251,6 +250,33 @@ void sdram_init(void)
 }
 #endif
 
+/*
+ * The following are used to control the SPI chip selects for the SPI command.
+ */
+#ifdef CONFIG_MPC8XXX_SPI
+
+#define SPI_CS_MASK    0x80000000
+
+int spi_cs_is_valid(unsigned int bus, unsigned int cs)
+{
+       return bus == 0 && cs == 0;
+}
+
+void spi_cs_activate(struct spi_slave *slave)
+{
+       volatile gpio83xx_t *iopd = &((immap_t *)CFG_IMMR)->gpio[0];
+
+       iopd->dat &= ~SPI_CS_MASK;
+}
+
+void spi_cs_deactivate(struct spi_slave *slave)
+{
+       volatile gpio83xx_t *iopd = &((immap_t *)CFG_IMMR)->gpio[0];
+
+       iopd->dat |=  SPI_CS_MASK;
+}
+#endif /* CONFIG_HARD_SPI */
+
 #if defined(CONFIG_OF_BOARD_SETUP)
 void ft_board_setup(void *blob, bd_t *bd)
 {