diff options
| -rw-r--r-- | arch/arm/mach-tegra/include/mach/tegra-ahb.h | 19 | ||||
| -rw-r--r-- | drivers/amba/tegra-ahb.c | 32 |
2 files changed, 51 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/include/mach/tegra-ahb.h b/arch/arm/mach-tegra/include/mach/tegra-ahb.h new file mode 100644 index 000000000000..e0f8c84b1d8c --- /dev/null +++ b/arch/arm/mach-tegra/include/mach/tegra-ahb.h | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. | ||
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or modify it | ||
| 5 | * under the terms and conditions of the GNU General Public License, | ||
| 6 | * version 2, as published by the Free Software Foundation. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
| 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 11 | * more details. | ||
| 12 | */ | ||
| 13 | |||
| 14 | #ifndef __MACH_TEGRA_AHB_H__ | ||
| 15 | #define __MACH_TEGRA_AHB_H__ | ||
| 16 | |||
| 17 | extern int tegra_ahb_enable_smmu(struct device_node *ahb); | ||
| 18 | |||
| 19 | #endif /* __MACH_TEGRA_AHB_H__ */ | ||
diff --git a/drivers/amba/tegra-ahb.c b/drivers/amba/tegra-ahb.c index 106a780d29a0..aa0b1f160528 100644 --- a/drivers/amba/tegra-ahb.c +++ b/drivers/amba/tegra-ahb.c | |||
| @@ -76,6 +76,10 @@ | |||
| 76 | 76 | ||
| 77 | #define AHB_ARBITRATION_AHB_MEM_WRQUE_MST_ID 0xf8 | 77 | #define AHB_ARBITRATION_AHB_MEM_WRQUE_MST_ID 0xf8 |
| 78 | 78 | ||
| 79 | #define AHB_ARBITRATION_XBAR_CTRL_SMMU_INIT_DONE BIT(17) | ||
| 80 | |||
| 81 | static struct platform_driver tegra_ahb_driver; | ||
| 82 | |||
| 79 | static const u32 tegra_ahb_gizmo[] = { | 83 | static const u32 tegra_ahb_gizmo[] = { |
| 80 | AHB_ARBITRATION_DISABLE, | 84 | AHB_ARBITRATION_DISABLE, |
| 81 | AHB_ARBITRATION_PRIORITY_CTRL, | 85 | AHB_ARBITRATION_PRIORITY_CTRL, |
| @@ -124,6 +128,34 @@ static inline void gizmo_writel(struct tegra_ahb *ahb, u32 value, u32 offset) | |||
| 124 | writel(value, ahb->regs + offset); | 128 | writel(value, ahb->regs + offset); |
| 125 | } | 129 | } |
| 126 | 130 | ||
| 131 | #ifdef CONFIG_ARCH_TEGRA_3x_SOC | ||
| 132 | static int tegra_ahb_match_by_smmu(struct device *dev, void *data) | ||
| 133 | { | ||
| 134 | struct tegra_ahb *ahb = dev_get_drvdata(dev); | ||
| 135 | struct device_node *dn = data; | ||
| 136 | |||
| 137 | return (ahb->dev->of_node == dn) ? 1 : 0; | ||
| 138 | } | ||
| 139 | |||
| 140 | int tegra_ahb_enable_smmu(struct device_node *dn) | ||
| 141 | { | ||
| 142 | struct device *dev; | ||
| 143 | u32 val; | ||
| 144 | struct tegra_ahb *ahb; | ||
| 145 | |||
| 146 | dev = driver_find_device(&tegra_ahb_driver.driver, NULL, dn, | ||
| 147 | tegra_ahb_match_by_smmu); | ||
| 148 | if (!dev) | ||
| 149 | return -EPROBE_DEFER; | ||
| 150 | ahb = dev_get_drvdata(dev); | ||
| 151 | val = gizmo_readl(ahb, AHB_ARBITRATION_XBAR_CTRL); | ||
| 152 | val |= AHB_ARBITRATION_XBAR_CTRL_SMMU_INIT_DONE; | ||
| 153 | gizmo_writel(ahb, val, AHB_ARBITRATION_XBAR_CTRL); | ||
| 154 | return 0; | ||
| 155 | } | ||
| 156 | EXPORT_SYMBOL(tegra_ahb_enable_smmu); | ||
| 157 | #endif | ||
| 158 | |||
| 127 | static int tegra_ahb_suspend(struct device *dev) | 159 | static int tegra_ahb_suspend(struct device *dev) |
| 128 | { | 160 | { |
| 129 | int i; | 161 | int i; |
