From 4800ca8c69b9a89651a74235054c9e07d3ab4042 Mon Sep 17 00:00:00 2001 From: Erik Gilling Date: Wed, 31 Mar 2010 13:48:13 -0700 Subject: [PATCH] [ARM] tegra: move olympus to use generic devices.c for i2c and sdhci Signed-off-by: Erik Gilling --- arch/arm/mach-tegra/Makefile | 1 - arch/arm/mach-tegra/board-olympus-i2c.c | 101 -------------- arch/arm/mach-tegra/board-olympus-sdhci.c | 162 ---------------------- arch/arm/mach-tegra/board-olympus.c | 31 +++++ 4 files changed, 31 insertions(+), 264 deletions(-) delete mode 100644 arch/arm/mach-tegra/board-olympus-sdhci.c diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile index ca7c7b87e90b..00955988776a 100644 --- a/arch/arm/mach-tegra/Makefile +++ b/arch/arm/mach-tegra/Makefile @@ -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 diff --git a/arch/arm/mach-tegra/board-olympus-i2c.c b/arch/arm/mach-tegra/board-olympus-i2c.c index 36b1b19b951e..e43c0b3ce8c2 100644 --- a/arch/arm/mach-tegra/board-olympus-i2c.c +++ b/arch/arm/mach-tegra/board-olympus-i2c.c @@ -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 index 2dbe68e2ee09..000000000000 --- a/arch/arm/mach-tegra/board-olympus-sdhci.c +++ /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 -#include -#include -#include -#include -#include -#include -#include -#include - -#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); - diff --git a/arch/arm/mach-tegra/board-olympus.c b/arch/arm/mach-tegra/board-olympus.c index 57b04aab282d..f5ef0e7fab2a 100644 --- a/arch/arm/mach-tegra/board-olympus.c +++ b/arch/arm/mach-tegra/board-olympus.c @@ -35,12 +35,15 @@ #include #include #include +#include +#include #include #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)); } -- 2.34.1