2010-09-27 09:26:34 +00:00
|
|
|
/*
|
|
|
|
* arch/arm/mach-tegra/board-harmony-pcie.c
|
|
|
|
*
|
|
|
|
* Copyright (C) 2010 CompuLab, Ltd.
|
|
|
|
* Mike Rapoport <mike@compulab.co.il>
|
|
|
|
*
|
|
|
|
* 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/kernel.h>
|
|
|
|
#include <linux/gpio.h>
|
|
|
|
#include <linux/err.h>
|
|
|
|
#include <linux/regulator/consumer.h>
|
|
|
|
|
|
|
|
#include <asm/mach-types.h>
|
|
|
|
|
|
|
|
#include "board.h"
|
2011-09-22 17:16:04 +00:00
|
|
|
#include "board-harmony.h"
|
2010-09-27 09:26:34 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_TEGRA_PCI
|
|
|
|
|
2012-05-02 21:47:12 +00:00
|
|
|
int __init harmony_pcie_init(void)
|
2010-09-27 09:26:34 +00:00
|
|
|
{
|
2011-03-09 14:31:17 +00:00
|
|
|
struct regulator *regulator = NULL;
|
2010-09-27 09:26:34 +00:00
|
|
|
int err;
|
|
|
|
|
2011-09-22 17:16:04 +00:00
|
|
|
err = gpio_request(TEGRA_GPIO_EN_VDD_1V05_GPIO, "EN_VDD_1V05");
|
2011-03-09 14:31:17 +00:00
|
|
|
if (err)
|
|
|
|
return err;
|
|
|
|
|
2011-09-22 17:16:04 +00:00
|
|
|
gpio_direction_output(TEGRA_GPIO_EN_VDD_1V05_GPIO, 1);
|
2011-03-09 14:31:17 +00:00
|
|
|
|
|
|
|
regulator = regulator_get(NULL, "pex_clk");
|
|
|
|
if (IS_ERR_OR_NULL(regulator))
|
|
|
|
goto err_reg;
|
|
|
|
|
|
|
|
regulator_enable(regulator);
|
|
|
|
|
2010-09-27 09:26:34 +00:00
|
|
|
err = tegra_pcie_init(true, true);
|
|
|
|
if (err)
|
|
|
|
goto err_pcie;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
err_pcie:
|
2011-03-09 14:31:17 +00:00
|
|
|
regulator_disable(regulator);
|
|
|
|
regulator_put(regulator);
|
|
|
|
err_reg:
|
2011-09-22 17:16:04 +00:00
|
|
|
gpio_free(TEGRA_GPIO_EN_VDD_1V05_GPIO);
|
2011-03-09 14:31:17 +00:00
|
|
|
|
2010-09-27 09:26:34 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2012-05-02 21:47:12 +00:00
|
|
|
static int __init harmony_pcie_initcall(void)
|
|
|
|
{
|
|
|
|
if (!machine_is_harmony())
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return harmony_pcie_init();
|
|
|
|
}
|
|
|
|
|
2011-03-09 14:31:17 +00:00
|
|
|
/* PCI should be initialized after I2C, mfd and regulators */
|
2012-05-02 21:47:12 +00:00
|
|
|
subsys_initcall_sync(harmony_pcie_initcall);
|
2010-09-27 09:26:34 +00:00
|
|
|
|
|
|
|
#endif
|