2 * arch/arm/mach-tegra/board-harmony-pcie.c
4 * Copyright (C) 2010 CompuLab, Ltd.
5 * Mike Rapoport <mike@compulab.co.il>
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
18 #include <linux/kernel.h>
19 #include <linux/gpio.h>
20 #include <linux/err.h>
21 #include <linux/of_gpio.h>
22 #include <linux/regulator/consumer.h>
24 #include <asm/mach-types.h>
28 #ifdef CONFIG_TEGRA_PCI
30 int __init
harmony_pcie_init(void)
32 struct device_node
*np
;
34 struct regulator
*regulator
= NULL
;
37 np
= of_find_node_by_path("/regulators/regulator@3");
39 pr_err("%s: of_find_node_by_path failed\n", __func__
);
43 en_vdd_1v05
= of_get_named_gpio(np
, "gpio", 0);
44 if (en_vdd_1v05
< 0) {
45 pr_err("%s: of_get_named_gpio failed: %d\n", __func__
,
50 err
= gpio_request(en_vdd_1v05
, "EN_VDD_1V05");
52 pr_err("%s: gpio_request failed: %d\n", __func__
, err
);
56 gpio_direction_output(en_vdd_1v05
, 1);
58 regulator
= regulator_get(NULL
, "vdd_ldo0,vddio_pex_clk");
59 if (IS_ERR(regulator
)) {
60 err
= PTR_ERR(regulator
);
61 pr_err("%s: regulator_get failed: %d\n", __func__
, err
);
65 err
= regulator_enable(regulator
);
67 pr_err("%s: regulator_enable failed: %d\n", __func__
, err
);
71 err
= tegra_pcie_init(true, true);
73 pr_err("%s: tegra_pcie_init failed: %d\n", __func__
, err
);
80 regulator_disable(regulator
);
82 regulator_put(regulator
);
84 gpio_free(en_vdd_1v05
);