]> git.sur5r.net Git - u-boot/blobdiff - board/sacsng/sacsng.c
Fix some more print() format errors.
[u-boot] / board / sacsng / sacsng.c
index 25209e0546404c6a097691db9fbb52dbf31bcec9..c00f14ee604a4b318b3df09a111743d82f1c61c3 100644 (file)
@@ -22,8 +22,8 @@
  * MA 02111-1307 USA
  */
 
-#include <asm/u-boot.h>
 #include <common.h>
+#include <asm/u-boot.h>
 #include <ioports.h>
 #include <mpc8260.h>
 #include <i2c.h>
@@ -159,7 +159,7 @@ int checkboard(void)
 
 /* ------------------------------------------------------------------------- */
 
-long int initdram(int board_type)
+phys_size_t initdram(int board_type)
 {
     volatile immap_t *immap  = (immap_t *)CFG_IMMR;
     volatile memctl8260_t *memctl = &immap->im_memctl;
@@ -842,37 +842,30 @@ void show_boot_progress (int status)
 #define SPI_ADC_CS_MASK        0x00000800
 #define SPI_DAC_CS_MASK        0x00001000
 
-void spi_adc_chipsel(int cs)
+static const u32 cs_mask[] = {
+    SPI_ADC_CS_MASK,
+    SPI_DAC_CS_MASK,
+};
+
+int spi_cs_is_valid(unsigned int bus, unsigned int cs)
+{
+    return bus == 0 && cs < sizeof(cs_mask) / sizeof(cs_mask[0]);
+}
+
+void spi_cs_activate(struct spi_slave *slave)
 {
     volatile ioport_t *iopd = ioport_addr((immap_t *)CFG_IMMR, 3 /* port D */);
 
-    if(cs)
-       iopd->pdat &= ~SPI_ADC_CS_MASK; /* activate the chip select */
-    else
-       iopd->pdat |=  SPI_ADC_CS_MASK; /* deactivate the chip select */
+    iopd->pdat &= ~cs_mask[slave->cs];
 }
 
-void spi_dac_chipsel(int cs)
+void spi_cs_deactivate(struct spi_slave *slave)
 {
     volatile ioport_t *iopd = ioport_addr((immap_t *)CFG_IMMR, 3 /* port D */);
 
-    if(cs)
-       iopd->pdat &= ~SPI_DAC_CS_MASK; /* activate the chip select */
-    else
-       iopd->pdat |=  SPI_DAC_CS_MASK; /* deactivate the chip select */
+    iopd->pdat |= cs_mask[slave->cs];
 }
 
-/*
- * The SPI command uses this table of functions for controlling the SPI
- * chip selects: it calls the appropriate function to control the SPI
- * chip selects.
- */
-spi_chipsel_type spi_chipsel[] = {
-       spi_adc_chipsel,
-       spi_dac_chipsel
-};
-int spi_chipsel_cnt = sizeof(spi_chipsel) / sizeof(spi_chipsel[0]);
-
 #endif
 
 #endif /* CONFIG_MISC_INIT_R */