From 392e8802486cb573b916e746010e141a75f507e6 Mon Sep 17 00:00:00 2001 From: Kevin Date: Sat, 15 Nov 2014 09:58:27 +0800 Subject: init android origin source code --- .../arch/arm/mach-tegra/board-harmony-pcie.c | 68 ++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 ANDROID_3.4.5/arch/arm/mach-tegra/board-harmony-pcie.c (limited to 'ANDROID_3.4.5/arch/arm/mach-tegra/board-harmony-pcie.c') diff --git a/ANDROID_3.4.5/arch/arm/mach-tegra/board-harmony-pcie.c b/ANDROID_3.4.5/arch/arm/mach-tegra/board-harmony-pcie.c new file mode 100644 index 00000000..33c4feda --- /dev/null +++ b/ANDROID_3.4.5/arch/arm/mach-tegra/board-harmony-pcie.c @@ -0,0 +1,68 @@ +/* + * arch/arm/mach-tegra/board-harmony-pcie.c + * + * Copyright (C) 2010 CompuLab, Ltd. + * Mike Rapoport + * + * 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 "board.h" +#include "board-harmony.h" + +#ifdef CONFIG_TEGRA_PCI + +static int __init harmony_pcie_init(void) +{ + struct regulator *regulator = NULL; + int err; + + if (!machine_is_harmony()) + return 0; + + err = gpio_request(TEGRA_GPIO_EN_VDD_1V05_GPIO, "EN_VDD_1V05"); + if (err) + return err; + + gpio_direction_output(TEGRA_GPIO_EN_VDD_1V05_GPIO, 1); + + regulator = regulator_get(NULL, "pex_clk"); + if (IS_ERR_OR_NULL(regulator)) + goto err_reg; + + regulator_enable(regulator); + + err = tegra_pcie_init(true, true); + if (err) + goto err_pcie; + + return 0; + +err_pcie: + regulator_disable(regulator); + regulator_put(regulator); +err_reg: + gpio_free(TEGRA_GPIO_EN_VDD_1V05_GPIO); + + return err; +} + +/* PCI should be initialized after I2C, mfd and regulators */ +subsys_initcall_sync(harmony_pcie_init); + +#endif -- cgit