aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/host
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-01-23 21:36:55 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-23 21:36:55 -0500
commitf2c73464d7b399cf4e0c601c1c7d7b079080fa52 (patch)
tree902decd0c280757075bce5068fee679e0ccc261e /drivers/pci/host
parent93abdb7785503c269e73e811f3c7fd23a9243b14 (diff)
parent273c2279ca502267fac40bcaecb35942380c429c (diff)
Merge tag 'cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC cleanups from Olof Johansson: "This is the branch where we usually queue up cleanup efforts, moving drivers out of the architecture directory, header file restructuring, etc. Sometimes they tangle with new development so it's hard to keep it strictly to cleanups. Some of the things included in this branch are: * Atmel SAMA5 conversion to common clock * Reset framework conversion for tegra platforms - Some of this depends on tegra clock driver reworks that are shared with Mike Turquette's clk tree. * Tegra DMA refactoring, which are shared branches with the DMA tree. * Removal of some header files on exynos to prepare for multiplatform" * tag 'cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (169 commits) ARM: mvebu: move Armada 370/XP specific definitions to armada-370-xp.h ARM: mvebu: remove prototypes of non-existing functions from common.h ARM: mvebu: move ARMADA_XP_MAX_CPUS to armada-370-xp.h serial: sh-sci: Rework baud rate calculation serial: sh-sci: Compute overrun_bit without using baud rate algo serial: sh-sci: Remove unused GPIO request code serial: sh-sci: Move overrun_bit and error_mask fields out of pdata serial: sh-sci: Support resources passed through platform resources serial: sh-sci: Don't check IRQ in verify port operation serial: sh-sci: Set the UPF_FIXED_PORT flag serial: sh-sci: Remove duplicate interrupt check in verify port op serial: sh-sci: Simplify baud rate calculation algorithms serial: sh-sci: Remove baud rate calculation algorithm 5 serial: sh-sci: Sort headers alphabetically ARM: EXYNOS: Kill exynos_pm_late_initcall() ARM: EXYNOS: Consolidate selection of PM_GENERIC_DOMAINS for Exynos4 ARM: at91: switch Calao QIL-A9260 board to DT clk: at91: fix pmc_clk_ids data type attriubte PM / devfreq: use inclusion <mach/map.h> instead of <plat/map-s5p.h> ARM: EXYNOS: remove <mach/regs-clock.h> for exynos ...
Diffstat (limited to 'drivers/pci/host')
-rw-r--r--drivers/pci/host/pci-tegra.c53
1 files changed, 38 insertions, 15 deletions
diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index b8ba2f794559..330f7e3a32dd 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -25,7 +25,6 @@
25 */ 25 */
26 26
27#include <linux/clk.h> 27#include <linux/clk.h>
28#include <linux/clk/tegra.h>
29#include <linux/delay.h> 28#include <linux/delay.h>
30#include <linux/export.h> 29#include <linux/export.h>
31#include <linux/interrupt.h> 30#include <linux/interrupt.h>
@@ -39,6 +38,7 @@
39#include <linux/of_platform.h> 38#include <linux/of_platform.h>
40#include <linux/pci.h> 39#include <linux/pci.h>
41#include <linux/platform_device.h> 40#include <linux/platform_device.h>
41#include <linux/reset.h>
42#include <linux/sizes.h> 42#include <linux/sizes.h>
43#include <linux/slab.h> 43#include <linux/slab.h>
44#include <linux/tegra-cpuidle.h> 44#include <linux/tegra-cpuidle.h>
@@ -259,10 +259,13 @@ struct tegra_pcie {
259 259
260 struct clk *pex_clk; 260 struct clk *pex_clk;
261 struct clk *afi_clk; 261 struct clk *afi_clk;
262 struct clk *pcie_xclk;
263 struct clk *pll_e; 262 struct clk *pll_e;
264 struct clk *cml_clk; 263 struct clk *cml_clk;
265 264
265 struct reset_control *pex_rst;
266 struct reset_control *afi_rst;
267 struct reset_control *pcie_xrst;
268
266 struct tegra_msi msi; 269 struct tegra_msi msi;
267 270
268 struct list_head ports; 271 struct list_head ports;
@@ -858,7 +861,7 @@ static int tegra_pcie_enable_controller(struct tegra_pcie *pcie)
858 pads_writel(pcie, value, PADS_CTL); 861 pads_writel(pcie, value, PADS_CTL);
859 862
860 /* take the PCIe interface module out of reset */ 863 /* take the PCIe interface module out of reset */
861 tegra_periph_reset_deassert(pcie->pcie_xclk); 864 reset_control_deassert(pcie->pcie_xrst);
862 865
863 /* finally enable PCIe */ 866 /* finally enable PCIe */
864 value = afi_readl(pcie, AFI_CONFIGURATION); 867 value = afi_readl(pcie, AFI_CONFIGURATION);
@@ -891,9 +894,9 @@ static void tegra_pcie_power_off(struct tegra_pcie *pcie)
891 894
892 /* TODO: disable and unprepare clocks? */ 895 /* TODO: disable and unprepare clocks? */
893 896
894 tegra_periph_reset_assert(pcie->pcie_xclk); 897 reset_control_assert(pcie->pcie_xrst);
895 tegra_periph_reset_assert(pcie->afi_clk); 898 reset_control_assert(pcie->afi_rst);
896 tegra_periph_reset_assert(pcie->pex_clk); 899 reset_control_assert(pcie->pex_rst);
897 900
898 tegra_powergate_power_off(TEGRA_POWERGATE_PCIE); 901 tegra_powergate_power_off(TEGRA_POWERGATE_PCIE);
899 902
@@ -921,9 +924,9 @@ static int tegra_pcie_power_on(struct tegra_pcie *pcie)
921 const struct tegra_pcie_soc_data *soc = pcie->soc_data; 924 const struct tegra_pcie_soc_data *soc = pcie->soc_data;
922 int err; 925 int err;
923 926
924 tegra_periph_reset_assert(pcie->pcie_xclk); 927 reset_control_assert(pcie->pcie_xrst);
925 tegra_periph_reset_assert(pcie->afi_clk); 928 reset_control_assert(pcie->afi_rst);
926 tegra_periph_reset_assert(pcie->pex_clk); 929 reset_control_assert(pcie->pex_rst);
927 930
928 tegra_powergate_power_off(TEGRA_POWERGATE_PCIE); 931 tegra_powergate_power_off(TEGRA_POWERGATE_PCIE);
929 932
@@ -952,13 +955,14 @@ static int tegra_pcie_power_on(struct tegra_pcie *pcie)
952 } 955 }
953 956
954 err = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_PCIE, 957 err = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_PCIE,
955 pcie->pex_clk); 958 pcie->pex_clk,
959 pcie->pex_rst);
956 if (err) { 960 if (err) {
957 dev_err(pcie->dev, "powerup sequence failed: %d\n", err); 961 dev_err(pcie->dev, "powerup sequence failed: %d\n", err);
958 return err; 962 return err;
959 } 963 }
960 964
961 tegra_periph_reset_deassert(pcie->afi_clk); 965 reset_control_deassert(pcie->afi_rst);
962 966
963 err = clk_prepare_enable(pcie->afi_clk); 967 err = clk_prepare_enable(pcie->afi_clk);
964 if (err < 0) { 968 if (err < 0) {
@@ -996,10 +1000,6 @@ static int tegra_pcie_clocks_get(struct tegra_pcie *pcie)
996 if (IS_ERR(pcie->afi_clk)) 1000 if (IS_ERR(pcie->afi_clk))
997 return PTR_ERR(pcie->afi_clk); 1001 return PTR_ERR(pcie->afi_clk);
998 1002
999 pcie->pcie_xclk = devm_clk_get(pcie->dev, "pcie_xclk");
1000 if (IS_ERR(pcie->pcie_xclk))
1001 return PTR_ERR(pcie->pcie_xclk);
1002
1003 pcie->pll_e = devm_clk_get(pcie->dev, "pll_e"); 1003 pcie->pll_e = devm_clk_get(pcie->dev, "pll_e");
1004 if (IS_ERR(pcie->pll_e)) 1004 if (IS_ERR(pcie->pll_e))
1005 return PTR_ERR(pcie->pll_e); 1005 return PTR_ERR(pcie->pll_e);
@@ -1013,6 +1013,23 @@ static int tegra_pcie_clocks_get(struct tegra_pcie *pcie)
1013 return 0; 1013 return 0;
1014} 1014}
1015 1015
1016static int tegra_pcie_resets_get(struct tegra_pcie *pcie)
1017{
1018 pcie->pex_rst = devm_reset_control_get(pcie->dev, "pex");
1019 if (IS_ERR(pcie->pex_rst))
1020 return PTR_ERR(pcie->pex_rst);
1021
1022 pcie->afi_rst = devm_reset_control_get(pcie->dev, "afi");
1023 if (IS_ERR(pcie->afi_rst))
1024 return PTR_ERR(pcie->afi_rst);
1025
1026 pcie->pcie_xrst = devm_reset_control_get(pcie->dev, "pcie_x");
1027 if (IS_ERR(pcie->pcie_xrst))
1028 return PTR_ERR(pcie->pcie_xrst);
1029
1030 return 0;
1031}
1032
1016static int tegra_pcie_get_resources(struct tegra_pcie *pcie) 1033static int tegra_pcie_get_resources(struct tegra_pcie *pcie)
1017{ 1034{
1018 struct platform_device *pdev = to_platform_device(pcie->dev); 1035 struct platform_device *pdev = to_platform_device(pcie->dev);
@@ -1025,6 +1042,12 @@ static int tegra_pcie_get_resources(struct tegra_pcie *pcie)
1025 return err; 1042 return err;
1026 } 1043 }
1027 1044
1045 err = tegra_pcie_resets_get(pcie);
1046 if (err) {
1047 dev_err(&pdev->dev, "failed to get resets: %d\n", err);
1048 return err;
1049 }
1050
1028 err = tegra_pcie_power_on(pcie); 1051 err = tegra_pcie_power_on(pcie);
1029 if (err) { 1052 if (err) {
1030 dev_err(&pdev->dev, "failed to power up: %d\n", err); 1053 dev_err(&pdev->dev, "failed to power up: %d\n", err);