~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/arm/mach-tegra/board-harmony-pcie.c

Version: ~ [ linux-5.6-rc1 ] ~ [ linux-5.5.2 ] ~ [ linux-5.4.17 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.102 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.170 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.213 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.213 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.81 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * arch/arm/mach-tegra/board-harmony-pcie.c
  3  *
  4  * Copyright (C) 2010 CompuLab, Ltd.
  5  * Mike Rapoport <mike@compulab.co.il>
  6  *
  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.
 10  *
 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.
 15  *
 16  */
 17 
 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>
 23 
 24 #include <asm/mach-types.h>
 25 
 26 #include "board.h"
 27 
 28 #ifdef CONFIG_TEGRA_PCI
 29 
 30 int __init harmony_pcie_init(void)
 31 {
 32         struct device_node *np;
 33         int en_vdd_1v05;
 34         struct regulator *regulator = NULL;
 35         int err;
 36 
 37         np = of_find_node_by_path("/regulators/regulator@3");
 38         if (!np) {
 39                 pr_err("%s: of_find_node_by_path failed\n", __func__);
 40                 return -ENODEV;
 41         }
 42 
 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__,
 46                        en_vdd_1v05);
 47                 return en_vdd_1v05;
 48         }
 49 
 50         err = gpio_request(en_vdd_1v05, "EN_VDD_1V05");
 51         if (err) {
 52                 pr_err("%s: gpio_request failed: %d\n", __func__, err);
 53                 return err;
 54         }
 55 
 56         gpio_direction_output(en_vdd_1v05, 1);
 57 
 58         regulator = regulator_get(NULL, "vdd_ldo0,vddio_pex_clk");
 59         if (IS_ERR_OR_NULL(regulator)) {
 60                 pr_err("%s: regulator_get failed: %d\n", __func__,
 61                        (int)PTR_ERR(regulator));
 62                 goto err_reg;
 63         }
 64 
 65         regulator_enable(regulator);
 66 
 67         err = tegra_pcie_init(true, true);
 68         if (err) {
 69                 pr_err("%s: tegra_pcie_init failed: %d\n", __func__, err);
 70                 goto err_pcie;
 71         }
 72 
 73         return 0;
 74 
 75 err_pcie:
 76         regulator_disable(regulator);
 77         regulator_put(regulator);
 78 err_reg:
 79         gpio_free(en_vdd_1v05);
 80 
 81         return err;
 82 }
 83 
 84 #endif
 85 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp