[POWERPC] MPC832x_RDB: Update dts to use SPI1 in QE, register mmc_spi stub
authorAnton Vorontsov <avorontsov@ru.mvista.com>
Thu, 23 Aug 2007 11:36:00 +0000 (15:36 +0400)
committerKumar Gala <galak@kernel.crashing.org>
Fri, 14 Sep 2007 13:54:13 +0000 (08:54 -0500)
Enabled using SPI controller on the MPC832x RDB board.  We currently use
a modalias of "spidev" as a place holder (replace with "mmc_spie") until
the mmc_spi driver support is merged in.

This gets us the ability to test SPI until then.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
arch/powerpc/boot/dts/mpc832x_rdb.dts
arch/powerpc/platforms/83xx/mpc832x_rdb.c

index cdc4a94e9c289ca3eea40d91739ada833e894936..388c8a7012e138910626babe9675bbe26b05abb6 100644 (file)
                        reg = <4c0 40>;
                        interrupts = <2>;
                        interrupt-parent = <&qeic>;
-                       mode = "cpu";
+                       mode = "cpu-qe";
                };
 
                spi@500 {
index e6c1760f36ef675e62d5c8eba8b55d7cb39e5b03..24a790c79ec085a04e7afe36795babad592420d7 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 #include <linux/pci.h>
+#include <linux/spi/spi.h>
 
 #include <asm/of_platform.h>
 #include <asm/time.h>
@@ -22,6 +23,7 @@
 #include <asm/udbg.h>
 #include <asm/qe.h>
 #include <asm/qe_ic.h>
+#include <sysdev/fsl_soc.h>
 
 #include "mpc83xx.h"
 
 #define DBG(fmt...)
 #endif
 
+static void mpc83xx_spi_activate_cs(u8 cs, u8 polarity)
+{
+       pr_debug("%s %d %d\n", __func__, cs, polarity);
+       par_io_data_set(3, 13, polarity);
+}
+
+static void mpc83xx_spi_deactivate_cs(u8 cs, u8 polarity)
+{
+       pr_debug("%s %d %d\n", __func__, cs, polarity);
+       par_io_data_set(3, 13, !polarity);
+}
+
+static struct spi_board_info mpc832x_spi_boardinfo = {
+       .bus_num = 0x4c0,
+       .chip_select = 0,
+       .max_speed_hz = 50000000,
+       /*
+        * XXX: This is spidev (spi in userspace) stub, should
+        * be replaced by "mmc_spi" when mmc_spi will hit mainline.
+        */
+       .modalias = "spidev",
+};
+
+static int __init mpc832x_spi_init(void)
+{
+       if (!machine_is(mpc832x_rdb))
+               return 0;
+
+       par_io_config_pin(3,  0, 3, 0, 1, 0); /* SPI1 MOSI, I/O */
+       par_io_config_pin(3,  1, 3, 0, 1, 0); /* SPI1 MISO, I/O */
+       par_io_config_pin(3,  2, 3, 0, 1, 0); /* SPI1 CLK,  I/O */
+       par_io_config_pin(3,  3, 2, 0, 1, 0); /* SPI1 SEL,  I   */
+
+       par_io_config_pin(3, 13, 1, 0, 0, 0); /* !SD_CS,    O */
+       par_io_config_pin(3, 14, 2, 0, 0, 0); /* SD_INSERT, I */
+       par_io_config_pin(3, 15, 2, 0, 0, 0); /* SD_PROTECT,I */
+
+       return fsl_spi_init(&mpc832x_spi_boardinfo, 1,
+                           mpc83xx_spi_activate_cs,
+                           mpc83xx_spi_deactivate_cs);
+}
+
+device_initcall(mpc832x_spi_init);
+
 /* ************************************************************************
  *
  * Setup the architecture