diff options
author | Stepan Moskovchenko <stepanm@codeaurora.org> | 2011-02-24 21:00:42 -0500 |
---|---|---|
committer | David Brown <davidb@codeaurora.org> | 2011-03-08 17:40:59 -0500 |
commit | a43d8c101eb71bf4527dd7f36a34a5a502894f38 (patch) | |
tree | a00145fb4f24eca3e90edacbd9f29335c53b9c3e /arch/arm/mach-msm/iommu_dev.c | |
parent | 2e8c8ba98376459e73d03a285f5d3406b630ea2d (diff) |
msm: iommu: Remove dependency on IDR
Remove the depencency on the IOMMU IDR register, as it may
not be accessible depending on the security configuraton.
This involves moving the NCB field of IDR into the platform
data.
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
Diffstat (limited to 'arch/arm/mach-msm/iommu_dev.c')
-rw-r--r-- | arch/arm/mach-msm/iommu_dev.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/arch/arm/mach-msm/iommu_dev.c b/arch/arm/mach-msm/iommu_dev.c index 0e240c9d6e71..8e8fb079852d 100644 --- a/arch/arm/mach-msm/iommu_dev.c +++ b/arch/arm/mach-msm/iommu_dev.c | |||
@@ -85,9 +85,9 @@ fail: | |||
85 | } | 85 | } |
86 | EXPORT_SYMBOL(msm_iommu_get_ctx); | 86 | EXPORT_SYMBOL(msm_iommu_get_ctx); |
87 | 87 | ||
88 | static void msm_iommu_reset(void __iomem *base) | 88 | static void msm_iommu_reset(void __iomem *base, int ncb) |
89 | { | 89 | { |
90 | int ctx, ncb; | 90 | int ctx; |
91 | 91 | ||
92 | SET_RPUE(base, 0); | 92 | SET_RPUE(base, 0); |
93 | SET_RPUEIE(base, 0); | 93 | SET_RPUEIE(base, 0); |
@@ -100,7 +100,6 @@ static void msm_iommu_reset(void __iomem *base) | |||
100 | SET_GLOBAL_TLBIALL(base, 0); | 100 | SET_GLOBAL_TLBIALL(base, 0); |
101 | SET_RPU_ACR(base, 0); | 101 | SET_RPU_ACR(base, 0); |
102 | SET_TLBLKCRWE(base, 1); | 102 | SET_TLBLKCRWE(base, 1); |
103 | ncb = GET_NCB(base)+1; | ||
104 | 103 | ||
105 | for (ctx = 0; ctx < ncb; ctx++) { | 104 | for (ctx = 0; ctx < ncb; ctx++) { |
106 | SET_BPRCOSH(base, ctx, 0); | 105 | SET_BPRCOSH(base, ctx, 0); |
@@ -136,7 +135,7 @@ static int msm_iommu_probe(struct platform_device *pdev) | |||
136 | struct msm_iommu_dev *iommu_dev = pdev->dev.platform_data; | 135 | struct msm_iommu_dev *iommu_dev = pdev->dev.platform_data; |
137 | void __iomem *regs_base; | 136 | void __iomem *regs_base; |
138 | resource_size_t len; | 137 | resource_size_t len; |
139 | int ret, ncb, nm2v, irq; | 138 | int ret, irq, par; |
140 | 139 | ||
141 | if (pdev->id == -1) { | 140 | if (pdev->id == -1) { |
142 | msm_iommu_root_dev = pdev; | 141 | msm_iommu_root_dev = pdev; |
@@ -211,10 +210,18 @@ static int msm_iommu_probe(struct platform_device *pdev) | |||
211 | goto fail_io; | 210 | goto fail_io; |
212 | } | 211 | } |
213 | 212 | ||
214 | mb(); | 213 | msm_iommu_reset(regs_base, iommu_dev->ncb); |
215 | 214 | ||
216 | if (GET_IDR(regs_base) == 0) { | 215 | SET_M(regs_base, 0, 1); |
217 | pr_err("Invalid IDR value detected\n"); | 216 | SET_PAR(regs_base, 0, 0); |
217 | SET_V2PCFG(regs_base, 0, 1); | ||
218 | SET_V2PPR(regs_base, 0, 0); | ||
219 | par = GET_PAR(regs_base, 0); | ||
220 | SET_V2PCFG(regs_base, 0, 0); | ||
221 | SET_M(regs_base, 0, 0); | ||
222 | |||
223 | if (!par) { | ||
224 | pr_err("%s: Invalid PAR value detected\n", iommu_dev->name); | ||
218 | ret = -ENODEV; | 225 | ret = -ENODEV; |
219 | goto fail_io; | 226 | goto fail_io; |
220 | } | 227 | } |
@@ -226,17 +233,15 @@ static int msm_iommu_probe(struct platform_device *pdev) | |||
226 | goto fail_io; | 233 | goto fail_io; |
227 | } | 234 | } |
228 | 235 | ||
229 | msm_iommu_reset(regs_base); | 236 | |
230 | drvdata->pclk = iommu_pclk; | 237 | drvdata->pclk = iommu_pclk; |
231 | drvdata->clk = iommu_clk; | 238 | drvdata->clk = iommu_clk; |
232 | drvdata->base = regs_base; | 239 | drvdata->base = regs_base; |
233 | drvdata->irq = irq; | 240 | drvdata->irq = irq; |
234 | 241 | drvdata->ncb = iommu_dev->ncb; | |
235 | nm2v = GET_NM2VCBMT((unsigned long) regs_base); | ||
236 | ncb = GET_NCB((unsigned long) regs_base); | ||
237 | 242 | ||
238 | pr_info("device %s mapped at %p, irq %d with %d ctx banks\n", | 243 | pr_info("device %s mapped at %p, irq %d with %d ctx banks\n", |
239 | iommu_dev->name, regs_base, irq, ncb+1); | 244 | iommu_dev->name, regs_base, irq, iommu_dev->ncb); |
240 | 245 | ||
241 | platform_set_drvdata(pdev, drvdata); | 246 | platform_set_drvdata(pdev, drvdata); |
242 | 247 | ||