[ARM] tegra: move olympus to use generic devices.c for i2c and sdhci
authorErik Gilling <konkers@android.com>
Wed, 31 Mar 2010 20:48:13 +0000 (13:48 -0700)
committerColin Cross <ccross@android.com>
Wed, 6 Oct 2010 23:32:53 +0000 (16:32 -0700)
Signed-off-by: Erik Gilling <konkers@android.com>
arch/arm/mach-tegra/Makefile
arch/arm/mach-tegra/board-olympus-i2c.c
arch/arm/mach-tegra/board-olympus-sdhci.c [deleted file]
arch/arm/mach-tegra/board-olympus.c

index ca7c7b87e90b18e14f5d203feb1bc1747cac63d0..00955988776aafc9165c4a667eb4e79f957b62f1 100644 (file)
@@ -47,6 +47,5 @@ obj-${CONFIG_MACH_VENTANA}              += board-ventana-power.o
 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
 obj-${CONFIG_MACH_OLYMPUS}              += board-olympus-keypad.o
index 36b1b19b951ead5d52304bf68d3beecccedb4f67..e43c0b3ce8c28c249c8bb3e089bb04df4386e79b 100644 (file)
@@ -202,110 +202,11 @@ static struct i2c_board_info __initdata olympus_i2c_bus4_board_info[] = {
         },
 };
 
-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);
-
        tegra_gpio_enable(OLYMPUS_TOUCH_IRQ_GPIO);
        gpio_request(OLYMPUS_TOUCH_IRQ_GPIO, "touch_irq");
        gpio_direction_input(OLYMPUS_TOUCH_IRQ_GPIO);
@@ -313,8 +214,6 @@ static int __init olympus_init_i2c(void)
        i2c_register_board_info(0, sholes_i2c_bus1_board_info, 1);
 
        i2c_register_board_info(3, olympus_i2c_bus4_board_info, 1);
-       if (ret != 0)
-               return ret;
 
        return 0;
 }
diff --git a/arch/arm/mach-tegra/board-olympus-sdhci.c b/arch/arm/mach-tegra/board-olympus-sdhci.c
deleted file mode 100644 (file)
index 2dbe68e..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * arch/arm/mach-tegra/board-olympus-sdhci.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/sdhci.h>
-#include <mach/pinmux.h>
-
-#include "gpio-names.h"
-
-static struct resource sdhci_resource1[] = {
-       [0] = {
-               .start  = INT_SDMMC1,
-               .end    = INT_SDMMC1,
-               .flags  = IORESOURCE_IRQ,
-       },
-       [1] = {
-               .start  = TEGRA_SDMMC1_BASE,
-               .end    = TEGRA_SDMMC1_BASE + TEGRA_SDMMC1_SIZE-1,
-               .flags  = IORESOURCE_MEM,
-       },
-};
-
-static struct resource sdhci_resource2[] = {
-       [0] = {
-               .start  = INT_SDMMC2,
-               .end    = INT_SDMMC2,
-               .flags  = IORESOURCE_IRQ,
-       },
-       [1] = {
-               .start  = TEGRA_SDMMC2_BASE,
-               .end    = TEGRA_SDMMC2_BASE + TEGRA_SDMMC2_SIZE-1,
-               .flags  = IORESOURCE_MEM,
-       },
-};
-
-static struct resource sdhci_resource3[] = {
-       [0] = {
-               .start  = INT_SDMMC3,
-               .end    = INT_SDMMC3,
-               .flags  = IORESOURCE_IRQ,
-       },
-       [1] = {
-               .start  = TEGRA_SDMMC3_BASE,
-               .end    = TEGRA_SDMMC3_BASE + TEGRA_SDMMC3_SIZE-1,
-               .flags  = IORESOURCE_MEM,
-       },
-};
-
-static struct resource sdhci_resource4[] = {
-       [0] = {
-               .start  = INT_SDMMC4,
-               .end    = INT_SDMMC4,
-               .flags  = IORESOURCE_IRQ,
-       },
-       [1] = {
-               .start  = TEGRA_SDMMC4_BASE,
-               .end    = TEGRA_SDMMC4_BASE + TEGRA_SDMMC4_SIZE-1,
-               .flags  = IORESOURCE_MEM,
-       },
-};
-
-static struct tegra_sdhci_platform_data tegra_sdhci_platform_data1 = {
-       .clk_id = NULL,
-       .force_hs = 0,
-       .cd_gpio = TEGRA_GPIO_PI5,
-       .wp_gpio = TEGRA_GPIO_PH1,
-       .power_gpio = TEGRA_GPIO_PT3,
-};
-
-static struct tegra_sdhci_platform_data tegra_sdhci_platform_data2 = {
-       .clk_id = NULL,
-       .force_hs = 0,
-};
-
-static struct tegra_sdhci_platform_data tegra_sdhci_platform_data3 = {
-       .clk_id = NULL,
-       .force_hs = 0,
-};
-
-static struct tegra_sdhci_platform_data tegra_sdhci_platform_data4 = {
-       .clk_id = NULL,
-       .force_hs = 0,
-};
-
-static struct platform_device tegra_sdhci_device1 = {
-       .name           = "sdhci-tegra",
-       .id             = 0,
-       .resource       = sdhci_resource1,
-       .num_resources  = ARRAY_SIZE(sdhci_resource1),
-       .dev = {
-               .platform_data = &tegra_sdhci_platform_data1,
-       },
-};
-
-static struct platform_device tegra_sdhci_device2 = {
-       .name           = "sdhci-tegra",
-       .id             = 1,
-       .resource       = sdhci_resource2,
-       .num_resources  = ARRAY_SIZE(sdhci_resource2),
-       .dev = {
-               .platform_data = &tegra_sdhci_platform_data2,
-       },
-};
-
-static struct platform_device tegra_sdhci_device3 = {
-       .name           = "sdhci-tegra",
-       .id             = 2,
-       .resource       = sdhci_resource3,
-       .num_resources  = ARRAY_SIZE(sdhci_resource3),
-       .dev = {
-               .platform_data = &tegra_sdhci_platform_data3,
-       },
-};
-
-static struct platform_device tegra_sdhci_device4 = {
-       .name           = "sdhci-tegra",
-       .id             = 3,
-       .resource       = sdhci_resource4,
-       .num_resources  = ARRAY_SIZE(sdhci_resource4),
-       .dev = {
-               .platform_data = &tegra_sdhci_platform_data4,
-       },
-};
-
-static int __init olympus_init_sdhci(void)
-{
-       int ret;
-
-       if (!machine_is_olympus())
-               return 0;
-
-       ret = platform_device_register(&tegra_sdhci_device1);
-       ret = platform_device_register(&tegra_sdhci_device2);
-       ret = platform_device_register(&tegra_sdhci_device3);
-       ret = platform_device_register(&tegra_sdhci_device4);
-       if (ret != 0)
-               return ret;
-
-       return 0;
-}
-
-device_initcall(olympus_init_sdhci);
-
index 57b04aab282dc2da6191bd9b29b6776485ed2607..f5ef0e7fab2a75634f52fb689d1474f9d7de53aa 100644 (file)
 #include <mach/iomap.h>
 #include <mach/irqs.h>
 #include <mach/iomap.h>
+#include <mach/sdhci.h>
+#include <mach/gpio.h>
 
 #include <linux/usb/android_composite.h>
 
 #include "board.h"
 #include "board-olympus.h"
 #include "gpio-names.h"
+#include "devices.h"
 
 /* NVidia bootloader tags */
 #define ATAG_NVIDIA            0x41000801
@@ -200,6 +203,32 @@ static struct platform_device *olympus_devices[] __initdata = {
        &hsuart,
 };
 
+static struct tegra_sdhci_platform_data olympus_sdhci_platform_data3 = {
+       .clk_id = NULL,
+       .force_hs = 0,
+};
+
+static struct tegra_sdhci_platform_data olympus_sdhci_platform_data4 = {
+       .clk_id = NULL,
+       .force_hs = 0,
+       .cd_gpio = TEGRA_GPIO_PH2,
+       .wp_gpio = TEGRA_GPIO_PH3,
+       .power_gpio = TEGRA_GPIO_PI6,
+};
+
+
+static void olympus_sdhci_init(void)
+{
+       /* TODO: setup GPIOs for cd, wd, and power */
+       tegra_sdhci_device3.dev.platform_data = &olympus_sdhci_platform_data3;
+       tegra_sdhci_device4.dev.platform_data = &olympus_sdhci_platform_data4;
+
+
+       platform_device_register(&tegra_sdhci_device3);
+       platform_device_register(&tegra_sdhci_device4);
+}
+
+
 static void __init tegra_olympus_fixup(struct machine_desc *desc, struct tag *tags,
                                 char **cmdline, struct meminfo *mi)
 {
@@ -236,6 +265,8 @@ static void __init tegra_olympus_init(void)
 
        olympus_pinmux_init();
 
+       olympus_sdhci_init();
+
        platform_add_devices(olympus_devices, ARRAY_SIZE(olympus_devices));
 }