mirror of
https://github.com/torvalds/linux.git
synced 2024-12-16 16:12:52 +00:00
a12c0efc7a
There currently aren't bindings for the Tegra PCIe controller. Work on this is in progress, but not yet complete. Manually initialize PCIe when booting from device tree, in order to bring DT support to the same feature level as board files, which will in turn allow board files to be deprecated. PCIe on Harmony requires various regulators to be registered and enabled before initializing the PCIe controller. Note that since the I2C controllers are instantiated from DT, we must use i2c_new_device() to register the PMU rather than i2c_register_board_info(). Signed-off-by: Stephen Warren <swarren@nvidia.com>
74 lines
1.6 KiB
C
74 lines
1.6 KiB
C
/*
|
|
* 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"
|
|
#include "board-harmony.h"
|
|
|
|
#ifdef CONFIG_TEGRA_PCI
|
|
|
|
int __init harmony_pcie_init(void)
|
|
{
|
|
struct regulator *regulator = NULL;
|
|
int err;
|
|
|
|
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;
|
|
}
|
|
|
|
static int __init harmony_pcie_initcall(void)
|
|
{
|
|
if (!machine_is_harmony())
|
|
return 0;
|
|
|
|
return harmony_pcie_init();
|
|
}
|
|
|
|
/* PCI should be initialized after I2C, mfd and regulators */
|
|
subsys_initcall_sync(harmony_pcie_initcall);
|
|
|
|
#endif
|