Merge branches 'release', 'asus', 'sony-laptop' and 'thinkpad' into release
[pandora-kernel.git] / arch / powerpc / platforms / 83xx / mpc832x_rdb.c
index 0909061..9f0fd88 100644 (file)
  */
 
 #include <linux/pci.h>
+#include <linux/interrupt.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/mmc_spi.h>
+#include <linux/mmc/host.h>
+#include <linux/of_platform.h>
 
-#include <asm/of_platform.h>
 #include <asm/time.h>
 #include <asm/ipic.h>
 #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 mmc_spi_platform_data mpc832x_mmc_pdata = {
+       .ocr_mask = MMC_VDD_33_34,
+};
+
+static struct spi_board_info mpc832x_spi_boardinfo = {
+       .bus_num = 0x4c0,
+       .chip_select = 0,
+       .max_speed_hz = 50000000,
+       .modalias = "mmc_spi",
+       .platform_data = &mpc832x_mmc_pdata,
+};
+
+static int __init mpc832x_spi_init(void)
+{
+       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);
+}
+
+machine_device_initcall(mpc832x_rdb, mpc832x_spi_init);
+
 /* ************************************************************************
  *
  * Setup the architecture
@@ -47,10 +94,8 @@ static void __init mpc832x_rdb_setup_arch(void)
                ppc_md.progress("mpc832x_rdb_setup_arch()", 0);
 
 #ifdef CONFIG_PCI
-       for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
+       for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
                mpc83xx_add_bridge(np);
-
-       ppc_md.pci_exclude_device = mpc83xx_exclude_device;
 #endif
 
 #ifdef CONFIG_QUICC_ENGINE
@@ -70,20 +115,18 @@ static struct of_device_id mpc832x_ids[] = {
        { .type = "soc", },
        { .compatible = "soc", },
        { .type = "qe", },
+       { .compatible = "fsl,qe", },
        {},
 };
 
 static int __init mpc832x_declare_of_platform_devices(void)
 {
-       if (!machine_is(mpc832x_rdb))
-               return 0;
-
        /* Publish the QE devices */
        of_platform_bus_probe(NULL, mpc832x_ids, NULL);
 
        return 0;
 }
-device_initcall(mpc832x_declare_of_platform_devices);
+machine_device_initcall(mpc832x_rdb, mpc832x_declare_of_platform_devices);
 
 void __init mpc832x_rdb_init_IRQ(void)
 {
@@ -103,11 +146,13 @@ void __init mpc832x_rdb_init_IRQ(void)
        of_node_put(np);
 
 #ifdef CONFIG_QUICC_ENGINE
-       np = of_find_node_by_type(NULL, "qeic");
-       if (!np)
-               return;
-
-       qe_ic_init(np, 0);
+       np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
+       if (!np) {
+               np = of_find_node_by_type(NULL, "qeic");
+               if (!np)
+                       return;
+       }
+       qe_ic_init(np, 0, qe_ic_cascade_low_ipic, qe_ic_cascade_high_ipic);
        of_node_put(np);
 #endif                         /* CONFIG_QUICC_ENGINE */
 }