ARM: ux500: Enable PL022 SSP Controller in Device Tree
[pandora-kernel.git] / arch / arm / mach-ux500 / board-mop500.c
index 0fb5dfd..d0799d5 100644 (file)
@@ -443,7 +443,7 @@ static struct stedma40_chan_cfg ssp0_dma_cfg_tx = {
 };
 #endif
 
-static struct pl022_ssp_controller ssp0_platform_data = {
+static struct pl022_ssp_controller ssp0_plat = {
        .bus_id = 0,
 #ifdef CONFIG_STE_DMA40
        .enable_dma = 1,
@@ -461,7 +461,7 @@ static struct pl022_ssp_controller ssp0_platform_data = {
 
 static void __init mop500_spi_init(struct device *parent)
 {
-       db8500_add_ssp0(parent, &ssp0_platform_data);
+       db8500_add_ssp0(parent, &ssp0_plat);
 }
 
 #ifdef CONFIG_STE_DMA40
@@ -621,6 +621,7 @@ static void __init mop500_init_machine(void)
 
        mop500_pins_init();
 
+       /* FIXME: parent of ab8500 should be prcmu */
        for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
                mop500_platform_devs[i]->dev.parent = parent;
 
@@ -743,14 +744,74 @@ MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
 MACHINE_END
 
 #ifdef CONFIG_MACH_UX500_DT
+
+struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
+       OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", &uart0_plat),
+       OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", &uart1_plat),
+       OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", &uart2_plat),
+       OF_DEV_AUXDATA("arm,pl022", 0x80002000, "ssp0",  &ssp0_plat),
+       {},
+};
+
+static const struct of_device_id u8500_soc_node[] = {
+       /* only create devices below soc node */
+       { .compatible = "stericsson,db8500", },
+       { },
+};
+
 static void __init u8500_init_machine(void)
 {
-       if (of_machine_is_compatible("calaosystems,snowball-a9500"))
-               return snowball_init_machine();
-       else if (of_machine_is_compatible("st-ericsson,hrefv60+"))
-               return hrefv60_init_machine();
-       else if (of_machine_is_compatible("st-ericsson,mop500"))
-               return mop500_init_machine();
+       struct device *parent = NULL;
+       int i2c0_devs;
+       int i;
+
+       parent = u8500_init_devices();
+       i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
+
+       for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
+               mop500_platform_devs[i]->dev.parent = parent;
+       for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
+               snowball_platform_devs[i]->dev.parent = parent;
+
+       /* automatically probe child nodes of db8500 device */
+       of_platform_populate(NULL, u8500_soc_node, u8500_auxdata_lookup, parent);
+
+       if (of_machine_is_compatible("st-ericsson,mop500")) {
+               mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
+               mop500_pins_init();
+
+               platform_add_devices(mop500_platform_devs,
+                               ARRAY_SIZE(mop500_platform_devs));
+
+               mop500_sdi_init(parent);
+       } else if (of_machine_is_compatible("calaosystems,snowball-a9500")) {
+               snowball_pins_init();
+               platform_add_devices(snowball_platform_devs,
+                               ARRAY_SIZE(snowball_platform_devs));
+
+               snowball_sdi_init(parent);
+       } else if (of_machine_is_compatible("st-ericsson,hrefv60+")) {
+               /*
+                * The HREFv60 board removed a GPIO expander and routed
+                * all these GPIO pins to the internal GPIO controller
+                * instead.
+                */
+               mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
+               i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
+               hrefv60_pins_init();
+               platform_add_devices(mop500_platform_devs,
+                               ARRAY_SIZE(mop500_platform_devs));
+
+               hrefv60_sdi_init(parent);
+       }
+       mop500_i2c_init(parent);
+
+       i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
+       i2c_register_board_info(2, mop500_i2c2_devices,
+                               ARRAY_SIZE(mop500_i2c2_devices));
+
+       /* This board has full regulator constraints */
+       regulator_has_full_constraints();
 }
 
 static const char * u8500_dt_board_compat[] = {