Merge tag 'mfd-3.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6
[pandora-kernel.git] / arch / arm / mach-ux500 / board-mop500.c
index 833903e..8674a89 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/i2c.h>
+#include <linux/platform_data/i2c-nomadik.h>
 #include <linux/gpio.h>
 #include <linux/amba/bus.h>
 #include <linux/amba/pl022.h>
@@ -25,6 +26,7 @@
 #include <linux/mfd/tc3589x.h>
 #include <linux/mfd/tps6105x.h>
 #include <linux/mfd/abx500/ab8500-gpio.h>
+#include <linux/mfd/abx500/ab8500-codec.h>
 #include <linux/leds-lp5521.h>
 #include <linux/input.h>
 #include <linux/smsc911x.h>
@@ -39,7 +41,6 @@
 #include <asm/mach/arch.h>
 #include <asm/hardware/gic.h>
 
-#include <plat/i2c.h>
 #include <plat/ste_dma40.h>
 #include <plat/gpio-nomadik.h>
 
@@ -58,7 +59,7 @@
 static struct gpio_led snowball_led_array[] = {
        {
                .name = "user_led",
-               .default_trigger = "none",
+               .default_trigger = "heartbeat",
                .gpio = 142,
        },
 };
@@ -97,6 +98,18 @@ static struct ab8500_gpio_platform_data ab8500_gpio_pdata = {
                                        0x7A, 0x00, 0x00},
 };
 
+/* ab8500-codec */
+static struct ab8500_codec_platform_data ab8500_codec_pdata = {
+       .amics =  {
+               .mic1_type = AMIC_TYPE_DIFFERENTIAL,
+               .mic2_type = AMIC_TYPE_DIFFERENTIAL,
+               .mic1a_micbias = AMIC_MICBIAS_VAMIC1,
+               .mic1b_micbias = AMIC_MICBIAS_VAMIC1,
+               .mic2_micbias = AMIC_MICBIAS_VAMIC2
+       },
+       .ear_cmv = EAR_CMV_0_95V
+};
+
 static struct gpio_keys_button snowball_key_array[] = {
        {
                .gpio           = 32,
@@ -195,6 +208,7 @@ static struct ab8500_platform_data ab8500_platdata = {
        .regulator      = ab8500_regulators,
        .num_regulator  = ARRAY_SIZE(ab8500_regulators),
        .gpio           = &ab8500_gpio_pdata,
+       .codec          = &ab8500_codec_pdata,
 };
 
 /*
@@ -313,43 +327,12 @@ static struct i2c_board_info __initdata mop500_i2c2_devices[] = {
        },
 };
 
-#define U8500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, t_out, _sm)   \
-static struct nmk_i2c_controller u8500_i2c##id##_data = { \
-       /*                              \
-        * slave data setup time, which is      \
-        * 250 ns,100ns,10ns which is 14,6,2    \
-        * respectively for a 48 Mhz    \
-        * i2c clock                    \
-        */                             \
-       .slsu           = _slsu,        \
-       /* Tx FIFO threshold */         \
-       .tft            = _tft,         \
-       /* Rx FIFO threshold */         \
-       .rft            = _rft,         \
-       /* std. mode operation */       \
-       .clk_freq       = clk,          \
-       /* Slave response timeout(ms) */\
-       .timeout        = t_out,        \
-       .sm             = _sm,          \
-}
-
-/*
- * The board uses 4 i2c controllers, initialize all of
- * them with slave data setup time of 250 ns,
- * Tx & Rx FIFO threshold values as 8 and standard
- * mode of operation
- */
-U8500_I2C_CONTROLLER(0, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
-U8500_I2C_CONTROLLER(1, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
-U8500_I2C_CONTROLLER(2,        0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
-U8500_I2C_CONTROLLER(3,        0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
-
 static void __init mop500_i2c_init(struct device *parent)
 {
-       db8500_add_i2c0(parent, &u8500_i2c0_data);
-       db8500_add_i2c1(parent, &u8500_i2c1_data);
-       db8500_add_i2c2(parent, &u8500_i2c2_data);
-       db8500_add_i2c3(parent, &u8500_i2c3_data);
+       db8500_add_i2c0(parent, NULL);
+       db8500_add_i2c1(parent, NULL);
+       db8500_add_i2c2(parent, NULL);
+       db8500_add_i2c3(parent, NULL);
 }
 
 static struct gpio_keys_button mop500_gpio_keys[] = {
@@ -605,11 +588,6 @@ static struct platform_device *snowball_platform_devs[] __initdata = {
        &snowball_sbnet_dev,
 };
 
-static struct platform_device *snowball_of_platform_devs[] __initdata = {
-       &snowball_led_dev,
-       &snowball_key_dev,
-};
-
 static void __init mop500_init_machine(void)
 {
        struct device *parent = NULL;
@@ -748,6 +726,11 @@ MACHINE_END
 
 #ifdef CONFIG_MACH_UX500_DT
 
+static struct platform_device *snowball_of_platform_devs[] __initdata = {
+       &snowball_led_dev,
+       &snowball_key_dev,
+};
+
 struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
        /* Requires DMA and call-back bindings. */
        OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", &uart0_plat),
@@ -755,6 +738,8 @@ struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
        OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", &uart2_plat),
        /* Requires DMA bindings. */
        OF_DEV_AUXDATA("arm,pl022", 0x80002000, "ssp0",  &ssp0_plat),
+       OF_DEV_AUXDATA("arm,pl18x", 0x80126000, "sdi0",  &mop500_sdi0_data),
+       OF_DEV_AUXDATA("arm,pl18x", 0x80114000, "sdi4",  &mop500_sdi4_data),
        /* Requires clock name bindings. */
        OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e000, "gpio.0", NULL),
        OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e080, "gpio.1", NULL),
@@ -765,6 +750,13 @@ struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
        OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e000, "gpio.6", NULL),
        OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e080, "gpio.7", NULL),
        OF_DEV_AUXDATA("st,nomadik-gpio", 0xa03fe000, "gpio.8", NULL),
+       OF_DEV_AUXDATA("st,nomadik-i2c", 0x80004000, "nmk-i2c.0", NULL),
+       OF_DEV_AUXDATA("st,nomadik-i2c", 0x80122000, "nmk-i2c.1", NULL),
+       OF_DEV_AUXDATA("st,nomadik-i2c", 0x80128000, "nmk-i2c.2", NULL),
+       OF_DEV_AUXDATA("st,nomadik-i2c", 0x80110000, "nmk-i2c.3", NULL),
+       OF_DEV_AUXDATA("st,nomadik-i2c", 0x8012a000, "nmk-i2c.4", NULL),
+       /* Requires device name bindings. */
+       OF_DEV_AUXDATA("stericsson,nmk_pinctrl", 0, "pinctrl-db8500", NULL),
        {},
 };
 
@@ -794,8 +786,6 @@ static void __init u8500_init_machine(void)
 
        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_local_bus_nodes, u8500_auxdata_lookup, parent);
@@ -814,18 +804,6 @@ static void __init u8500_init_machine(void)
 
                mop500_uib_init();
 
-       } else if (of_machine_is_compatible("calaosystems,snowball-a9500")) {
-               /*
-                * Devices to be DT:ed:
-                *   snowball_led_dev   = todo
-                *   snowball_key_dev   = todo
-                *   snowball_sbnet_dev = done
-                *   ab8500_device      = done
-                */
-               platform_add_devices(snowball_of_platform_devs,
-                               ARRAY_SIZE(snowball_of_platform_devs));
-
-               snowball_sdi_init(parent);
        } else if (of_machine_is_compatible("st-ericsson,hrefv60+")) {
                /*
                 * The HREFv60 board removed a GPIO expander and routed
@@ -847,7 +825,6 @@ static void __init u8500_init_machine(void)
 
                mop500_uib_init();
        }
-       mop500_i2c_init(parent);
 
        /* This board has full regulator constraints */
        regulator_has_full_constraints();