[ARM] tegra: olympus: Add i2c to board olympus
authorColin Cross <ccross@android.com>
Mon, 22 Mar 2010 03:51:38 +0000 (20:51 -0700)
committerColin Cross <ccross@android.com>
Wed, 6 Oct 2010 23:32:51 +0000 (16:32 -0700)
Change-Id: I627eccac1a5557f5264946caad2384c7f2038ef5
Signed-off-by: Colin Cross <ccross@android.com>
arch/arm/mach-tegra/Makefile
arch/arm/mach-tegra/board-olympus-i2c.c [new file with mode: 0644]
arch/arm/mach-tegra/board-olympus-pinmux.c
arch/arm/mach-tegra/board-olympus.c

index f44b1567478b4b40262d494c3e06cbe1764a5469..e813c2bb622b93f01e06f3294b46c5a2ec0f09cc 100644 (file)
@@ -48,3 +48,4 @@ obj-${CONFIG_MACH_OLYMPUS}              += board-olympus.o
 obj-${CONFIG_MACH_OLYMPUS}              += board-olympus-pinmux.o
 obj-${CONFIG_MACH_OLYMPUS}              += board-olympus-panel.o
 obj-${CONFIG_MACH_OLYMPUS}              += board-olympus-sdhci.o
+obj-${CONFIG_MACH_OLYMPUS}              += board-olympus-i2c.o
diff --git a/arch/arm/mach-tegra/board-olympus-i2c.c b/arch/arm/mach-tegra/board-olympus-i2c.c
new file mode 100644 (file)
index 0000000..93b3bdb
--- /dev/null
@@ -0,0 +1,138 @@
+/*
+ * arch/arm/mach-tegra/board-olympus-i2c.c
+ *
+ * Copyright (C) 2010 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/resource.h>
+#include <linux/platform_device.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>
+#include <asm/mach-types.h>
+#include <mach/irqs.h>
+#include <mach/iomap.h>
+#include <mach/pinmux.h>
+
+#include "gpio-names.h"
+
+static struct resource i2c_resource1[] = {
+       [0] = {
+               .start  = INT_I2C,
+               .end    = INT_I2C,
+               .flags  = IORESOURCE_IRQ,
+       },
+       [1] = {
+               .start  = TEGRA_I2C_BASE,
+               .end    = TEGRA_I2C_BASE + TEGRA_I2C_SIZE-1,
+               .flags  = IORESOURCE_MEM,
+       },
+};
+
+static struct resource i2c_resource2[] = {
+       [0] = {
+               .start  = INT_I2C2,
+               .end    = INT_I2C2,
+               .flags  = IORESOURCE_IRQ,
+       },
+       [1] = {
+               .start  = TEGRA_I2C2_BASE,
+               .end    = TEGRA_I2C2_BASE + TEGRA_I2C2_SIZE-1,
+               .flags  = IORESOURCE_MEM,
+       },
+};
+
+static struct resource i2c_resource3[] = {
+       [0] = {
+               .start  = INT_I2C3,
+               .end    = INT_I2C3,
+               .flags  = IORESOURCE_IRQ,
+       },
+       [1] = {
+               .start  = TEGRA_I2C3_BASE,
+               .end    = TEGRA_I2C3_BASE + TEGRA_I2C3_SIZE-1,
+               .flags  = IORESOURCE_MEM,
+       },
+};
+
+static struct resource i2c_resource4[] = {
+       [0] = {
+               .start  = INT_DVC,
+               .end    = INT_DVC,
+               .flags  = IORESOURCE_IRQ,
+       },
+       [1] = {
+               .start  = TEGRA_DVC_BASE,
+               .end    = TEGRA_DVC_BASE + TEGRA_DVC_SIZE-1,
+               .flags  = IORESOURCE_MEM,
+       },
+};
+
+static struct platform_device tegra_i2c_device1 = {
+       .name           = "tegra-i2c",
+       .id             = 0,
+       .resource       = i2c_resource1,
+       .num_resources  = ARRAY_SIZE(i2c_resource1),
+       .dev = {
+               .platform_data = 0,
+       },
+};
+
+static struct platform_device tegra_i2c_device2 = {
+       .name           = "tegra-i2c",
+       .id             = 1,
+       .resource       = i2c_resource2,
+       .num_resources  = ARRAY_SIZE(i2c_resource2),
+       .dev = {
+               .platform_data = 0,
+       },
+};
+
+static struct platform_device tegra_i2c_device3 = {
+       .name           = "tegra-i2c",
+       .id             = 2,
+       .resource       = i2c_resource3,
+       .num_resources  = ARRAY_SIZE(i2c_resource3),
+       .dev = {
+               .platform_data = 0,
+       },
+};
+
+static struct platform_device tegra_i2c_device4 = {
+       .name           = "tegra-i2c",
+       .id             = 3,
+       .resource       = i2c_resource4,
+       .num_resources  = ARRAY_SIZE(i2c_resource4),
+       .dev = {
+               .platform_data = 0,
+       },
+};
+
+static int __init olympus_init_i2c(void)
+{
+       int ret;
+
+       if (!machine_is_olympus())
+               return 0;
+
+       ret = platform_device_register(&tegra_i2c_device1);
+       ret = platform_device_register(&tegra_i2c_device2);
+       ret = platform_device_register(&tegra_i2c_device3);
+       /*ret = platform_device_register(&tegra_i2c_device4);*/
+       if (ret != 0)
+               return ret;
+
+       return 0;
+}
+
+device_initcall(olympus_init_i2c);
+
index e8b639ab327d3fa7130011c52f6ff11fdc5b06e5..13698821b0d2892b00f36787bceaa6dd5119322e 100644 (file)
@@ -39,7 +39,7 @@ static struct tegra_pingroup_config olympus_pinmux[] = {
        {TEGRA_PINGROUP_DTC,   TEGRA_MUX_RSVD1,         TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE},
        {TEGRA_PINGROUP_DTD,   TEGRA_MUX_SDIO2,         TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE},
        {TEGRA_PINGROUP_DTE,   TEGRA_MUX_RSVD1,         TEGRA_PUPD_NORMAL,    TEGRA_TRI_TRISTATE},
-       {TEGRA_PINGROUP_DTF,   TEGRA_MUX_I2C3,          TEGRA_PUPD_PULL_UP,   TEGRA_TRI_TRISTATE},
+       {TEGRA_PINGROUP_DTF,   TEGRA_MUX_I2C3,          TEGRA_PUPD_PULL_UP,   TEGRA_TRI_NORMAL},
        {TEGRA_PINGROUP_GMA,   TEGRA_MUX_SDIO4,         TEGRA_PUPD_NORMAL,    TEGRA_TRI_NORMAL},
        {TEGRA_PINGROUP_GMB,   TEGRA_MUX_GMI,           TEGRA_PUPD_NORMAL,    TEGRA_TRI_NORMAL},
        {TEGRA_PINGROUP_GMC,   TEGRA_MUX_UARTD,         TEGRA_PUPD_NORMAL,    TEGRA_TRI_NORMAL},
@@ -140,5 +140,5 @@ static struct tegra_pingroup_config olympus_pinmux[] = {
 
 void olympus_pinmux_init(void)
 {
-       //tegra_pinmux_config_table(olympus_pinmux, ARRAY_SIZE(olympus_pinmux));
+       tegra_pinmux_config_table(olympus_pinmux, ARRAY_SIZE(olympus_pinmux));
 }
index 1cd924afbda87f27d6639200352d5250df3e9ce2..e824c8748a4aca87b7c0013cf03bf57d77eb5995 100644 (file)
@@ -200,6 +200,10 @@ static void __init tegra_olympus_init(void)
        clk_set_rate(clk, 216000000);
        clk_enable(clk);
 
+       clk = clk_get_sys(NULL, "pll_p_out3");
+       clk_set_rate(clk, 72000000);
+       clk_enable(clk);
+
        clk = clk_get_sys("uart.3", NULL);
        clk_set_rate(clk, 216000000);
        clk_enable(clk);