aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2014-12-04 11:21:49 -0500
committerArnd Bergmann <arnd@arndb.de>2014-12-04 11:21:49 -0500
commit1d5f497d87c7d960c27cdc40e7563b0ae88387d3 (patch)
treef143f41638278d7df4f902619b32a615e33f9613 /include
parent2f84411d9f3f93057e71d1480e8768ed7c5b3274 (diff)
parent5b605d4426e1dc38b6572bd42c151ad247359e3a (diff)
Merge tag 'tegra-for-3.19-dt' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux into next/dt2
Pull "ARM: tegra: Device tree changes for v3.19" from Thierry Reding: The bulk of these changes add memory controller nodes for Tegra30, Tegra114 and Tegra124. The memory controller implements an IOMMU that the display controllers are attached to. This allows them to scan out physically non-contiguous framebuffers and removes one of the primary users of CMA. The only other change adds a new MIPI pad control bank to the pin controller on Tegra124. The corresponding driver patch for this went into v3.18 as: 3ccc11f6b82c pinctrl: tegra: Add MIPI pad control * tag 'tegra-for-3.19-dt' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux: ARM: tegra: Enable IOMMU for display controllers on Tegra124 ARM: tegra: Enable IOMMU for display controllers on Tegra114 ARM: tegra: Enable IOMMU for display controllers on Tegra30 ARM: tegra: Add memory controller support for Tegra124 ARM: tegra: Add memory controller support for Tegra114 ARM: tegra: Add memory controller support for Tegra30 ARM: tegra: Add APB_MISC_GP as a MIPI pad control bank These additional commits are merged as dependencies: memory: Add NVIDIA Tegra memory controller support of: Add NVIDIA Tegra memory controller binding ARM: tegra: Move AHB Kconfig to drivers/amba amba: Add Kconfig file clk: tegra: Implement memory-controller clock powerpc/iommu: Rename iommu_[un]map_sg functions iommu: Improve error handling when setting bus iommu iommu: Do more input validation in iommu_map_sg() iommu: Add iommu_map_sg() function Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'include')
-rw-r--r--include/dt-bindings/clock/tegra114-car.h2
-rw-r--r--include/dt-bindings/clock/tegra124-car.h2
-rw-r--r--include/dt-bindings/clock/tegra20-car.h2
-rw-r--r--include/dt-bindings/memory/tegra114-mc.h25
-rw-r--r--include/dt-bindings/memory/tegra124-mc.h31
-rw-r--r--include/dt-bindings/memory/tegra30-mc.h24
-rw-r--r--include/linux/iommu.h22
-rw-r--r--include/soc/tegra/mc.h107
8 files changed, 212 insertions, 3 deletions
diff --git a/include/dt-bindings/clock/tegra114-car.h b/include/dt-bindings/clock/tegra114-car.h
index fc12621fb432..534c03f8ad72 100644
--- a/include/dt-bindings/clock/tegra114-car.h
+++ b/include/dt-bindings/clock/tegra114-car.h
@@ -49,7 +49,7 @@
49#define TEGRA114_CLK_I2S0 30 49#define TEGRA114_CLK_I2S0 30
50/* 31 */ 50/* 31 */
51 51
52/* 32 */ 52#define TEGRA114_CLK_MC 32
53/* 33 */ 53/* 33 */
54#define TEGRA114_CLK_APBDMA 34 54#define TEGRA114_CLK_APBDMA 34
55/* 35 */ 55/* 35 */
diff --git a/include/dt-bindings/clock/tegra124-car.h b/include/dt-bindings/clock/tegra124-car.h
index 6bac637fd635..af9bc9a3ddbc 100644
--- a/include/dt-bindings/clock/tegra124-car.h
+++ b/include/dt-bindings/clock/tegra124-car.h
@@ -48,7 +48,7 @@
48#define TEGRA124_CLK_I2S0 30 48#define TEGRA124_CLK_I2S0 30
49/* 31 */ 49/* 31 */
50 50
51/* 32 */ 51#define TEGRA124_CLK_MC 32
52/* 33 */ 52/* 33 */
53#define TEGRA124_CLK_APBDMA 34 53#define TEGRA124_CLK_APBDMA 34
54/* 35 */ 54/* 35 */
diff --git a/include/dt-bindings/clock/tegra20-car.h b/include/dt-bindings/clock/tegra20-car.h
index 9406207cfac8..04500b243a4d 100644
--- a/include/dt-bindings/clock/tegra20-car.h
+++ b/include/dt-bindings/clock/tegra20-car.h
@@ -49,7 +49,7 @@
49/* 30 */ 49/* 30 */
50#define TEGRA20_CLK_CACHE2 31 50#define TEGRA20_CLK_CACHE2 31
51 51
52#define TEGRA20_CLK_MEM 32 52#define TEGRA20_CLK_MC 32
53#define TEGRA20_CLK_AHBDMA 33 53#define TEGRA20_CLK_AHBDMA 33
54#define TEGRA20_CLK_APBDMA 34 54#define TEGRA20_CLK_APBDMA 34
55/* 35 */ 55/* 35 */
diff --git a/include/dt-bindings/memory/tegra114-mc.h b/include/dt-bindings/memory/tegra114-mc.h
new file mode 100644
index 000000000000..8f48985a3139
--- /dev/null
+++ b/include/dt-bindings/memory/tegra114-mc.h
@@ -0,0 +1,25 @@
1#ifndef DT_BINDINGS_MEMORY_TEGRA114_MC_H
2#define DT_BINDINGS_MEMORY_TEGRA114_MC_H
3
4#define TEGRA_SWGROUP_PTC 0
5#define TEGRA_SWGROUP_DC 1
6#define TEGRA_SWGROUP_DCB 2
7#define TEGRA_SWGROUP_EPP 3
8#define TEGRA_SWGROUP_G2 4
9#define TEGRA_SWGROUP_AVPC 5
10#define TEGRA_SWGROUP_NV 6
11#define TEGRA_SWGROUP_HDA 7
12#define TEGRA_SWGROUP_HC 8
13#define TEGRA_SWGROUP_MSENC 9
14#define TEGRA_SWGROUP_PPCS 10
15#define TEGRA_SWGROUP_VDE 11
16#define TEGRA_SWGROUP_MPCORELP 12
17#define TEGRA_SWGROUP_MPCORE 13
18#define TEGRA_SWGROUP_VI 14
19#define TEGRA_SWGROUP_ISP 15
20#define TEGRA_SWGROUP_XUSB_HOST 16
21#define TEGRA_SWGROUP_XUSB_DEV 17
22#define TEGRA_SWGROUP_EMUCIF 18
23#define TEGRA_SWGROUP_TSEC 19
24
25#endif
diff --git a/include/dt-bindings/memory/tegra124-mc.h b/include/dt-bindings/memory/tegra124-mc.h
new file mode 100644
index 000000000000..7d8ee798f34e
--- /dev/null
+++ b/include/dt-bindings/memory/tegra124-mc.h
@@ -0,0 +1,31 @@
1#ifndef DT_BINDINGS_MEMORY_TEGRA124_MC_H
2#define DT_BINDINGS_MEMORY_TEGRA124_MC_H
3
4#define TEGRA_SWGROUP_PTC 0
5#define TEGRA_SWGROUP_DC 1
6#define TEGRA_SWGROUP_DCB 2
7#define TEGRA_SWGROUP_AFI 3
8#define TEGRA_SWGROUP_AVPC 4
9#define TEGRA_SWGROUP_HDA 5
10#define TEGRA_SWGROUP_HC 6
11#define TEGRA_SWGROUP_MSENC 7
12#define TEGRA_SWGROUP_PPCS 8
13#define TEGRA_SWGROUP_SATA 9
14#define TEGRA_SWGROUP_VDE 10
15#define TEGRA_SWGROUP_MPCORELP 11
16#define TEGRA_SWGROUP_MPCORE 12
17#define TEGRA_SWGROUP_ISP2 13
18#define TEGRA_SWGROUP_XUSB_HOST 14
19#define TEGRA_SWGROUP_XUSB_DEV 15
20#define TEGRA_SWGROUP_ISP2B 16
21#define TEGRA_SWGROUP_TSEC 17
22#define TEGRA_SWGROUP_A9AVP 18
23#define TEGRA_SWGROUP_GPU 19
24#define TEGRA_SWGROUP_SDMMC1A 20
25#define TEGRA_SWGROUP_SDMMC2A 21
26#define TEGRA_SWGROUP_SDMMC3A 22
27#define TEGRA_SWGROUP_SDMMC4A 23
28#define TEGRA_SWGROUP_VIC 24
29#define TEGRA_SWGROUP_VI 25
30
31#endif
diff --git a/include/dt-bindings/memory/tegra30-mc.h b/include/dt-bindings/memory/tegra30-mc.h
new file mode 100644
index 000000000000..502beb03d777
--- /dev/null
+++ b/include/dt-bindings/memory/tegra30-mc.h
@@ -0,0 +1,24 @@
1#ifndef DT_BINDINGS_MEMORY_TEGRA30_MC_H
2#define DT_BINDINGS_MEMORY_TEGRA30_MC_H
3
4#define TEGRA_SWGROUP_PTC 0
5#define TEGRA_SWGROUP_DC 1
6#define TEGRA_SWGROUP_DCB 2
7#define TEGRA_SWGROUP_EPP 3
8#define TEGRA_SWGROUP_G2 4
9#define TEGRA_SWGROUP_MPE 5
10#define TEGRA_SWGROUP_VI 6
11#define TEGRA_SWGROUP_AFI 7
12#define TEGRA_SWGROUP_AVPC 8
13#define TEGRA_SWGROUP_NV 9
14#define TEGRA_SWGROUP_NV2 10
15#define TEGRA_SWGROUP_HDA 11
16#define TEGRA_SWGROUP_HC 12
17#define TEGRA_SWGROUP_PPCS 13
18#define TEGRA_SWGROUP_SATA 14
19#define TEGRA_SWGROUP_VDE 15
20#define TEGRA_SWGROUP_MPCORELP 16
21#define TEGRA_SWGROUP_MPCORE 17
22#define TEGRA_SWGROUP_ISP 18
23
24#endif
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index e6a7c9ff72f2..b29a5982e1c3 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -22,6 +22,7 @@
22#include <linux/errno.h> 22#include <linux/errno.h>
23#include <linux/err.h> 23#include <linux/err.h>
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/scatterlist.h>
25#include <trace/events/iommu.h> 26#include <trace/events/iommu.h>
26 27
27#define IOMMU_READ (1 << 0) 28#define IOMMU_READ (1 << 0)
@@ -97,6 +98,8 @@ enum iommu_attr {
97 * @detach_dev: detach device from an iommu domain 98 * @detach_dev: detach device from an iommu domain
98 * @map: map a physically contiguous memory region to an iommu domain 99 * @map: map a physically contiguous memory region to an iommu domain
99 * @unmap: unmap a physically contiguous memory region from an iommu domain 100 * @unmap: unmap a physically contiguous memory region from an iommu domain
101 * @map_sg: map a scatter-gather list of physically contiguous memory chunks
102 * to an iommu domain
100 * @iova_to_phys: translate iova to physical address 103 * @iova_to_phys: translate iova to physical address
101 * @add_device: add device to iommu grouping 104 * @add_device: add device to iommu grouping
102 * @remove_device: remove device from iommu grouping 105 * @remove_device: remove device from iommu grouping
@@ -114,6 +117,8 @@ struct iommu_ops {
114 phys_addr_t paddr, size_t size, int prot); 117 phys_addr_t paddr, size_t size, int prot);
115 size_t (*unmap)(struct iommu_domain *domain, unsigned long iova, 118 size_t (*unmap)(struct iommu_domain *domain, unsigned long iova,
116 size_t size); 119 size_t size);
120 size_t (*map_sg)(struct iommu_domain *domain, unsigned long iova,
121 struct scatterlist *sg, unsigned int nents, int prot);
117 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, dma_addr_t iova); 122 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, dma_addr_t iova);
118 int (*add_device)(struct device *dev); 123 int (*add_device)(struct device *dev);
119 void (*remove_device)(struct device *dev); 124 void (*remove_device)(struct device *dev);
@@ -156,6 +161,9 @@ extern int iommu_map(struct iommu_domain *domain, unsigned long iova,
156 phys_addr_t paddr, size_t size, int prot); 161 phys_addr_t paddr, size_t size, int prot);
157extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, 162extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova,
158 size_t size); 163 size_t size);
164extern size_t default_iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
165 struct scatterlist *sg,unsigned int nents,
166 int prot);
159extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova); 167extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova);
160extern void iommu_set_fault_handler(struct iommu_domain *domain, 168extern void iommu_set_fault_handler(struct iommu_domain *domain,
161 iommu_fault_handler_t handler, void *token); 169 iommu_fault_handler_t handler, void *token);
@@ -241,6 +249,13 @@ static inline int report_iommu_fault(struct iommu_domain *domain,
241 return ret; 249 return ret;
242} 250}
243 251
252static inline size_t iommu_map_sg(struct iommu_domain *domain,
253 unsigned long iova, struct scatterlist *sg,
254 unsigned int nents, int prot)
255{
256 return domain->ops->map_sg(domain, iova, sg, nents, prot);
257}
258
244#else /* CONFIG_IOMMU_API */ 259#else /* CONFIG_IOMMU_API */
245 260
246struct iommu_ops {}; 261struct iommu_ops {};
@@ -293,6 +308,13 @@ static inline int iommu_unmap(struct iommu_domain *domain, unsigned long iova,
293 return -ENODEV; 308 return -ENODEV;
294} 309}
295 310
311static inline size_t iommu_map_sg(struct iommu_domain *domain,
312 unsigned long iova, struct scatterlist *sg,
313 unsigned int nents, int prot)
314{
315 return -ENODEV;
316}
317
296static inline int iommu_domain_window_enable(struct iommu_domain *domain, 318static inline int iommu_domain_window_enable(struct iommu_domain *domain,
297 u32 wnd_nr, phys_addr_t paddr, 319 u32 wnd_nr, phys_addr_t paddr,
298 u64 size, int prot) 320 u64 size, int prot)
diff --git a/include/soc/tegra/mc.h b/include/soc/tegra/mc.h
new file mode 100644
index 000000000000..63deb8d9f82a
--- /dev/null
+++ b/include/soc/tegra/mc.h
@@ -0,0 +1,107 @@
1/*
2 * Copyright (C) 2014 NVIDIA Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __SOC_TEGRA_MC_H__
10#define __SOC_TEGRA_MC_H__
11
12#include <linux/types.h>
13
14struct clk;
15struct device;
16struct page;
17
18struct tegra_smmu_enable {
19 unsigned int reg;
20 unsigned int bit;
21};
22
23/* latency allowance */
24struct tegra_mc_la {
25 unsigned int reg;
26 unsigned int shift;
27 unsigned int mask;
28 unsigned int def;
29};
30
31struct tegra_mc_client {
32 unsigned int id;
33 const char *name;
34 unsigned int swgroup;
35
36 unsigned int fifo_size;
37
38 struct tegra_smmu_enable smmu;
39 struct tegra_mc_la la;
40};
41
42struct tegra_smmu_swgroup {
43 unsigned int swgroup;
44 unsigned int reg;
45};
46
47struct tegra_smmu_ops {
48 void (*flush_dcache)(struct page *page, unsigned long offset,
49 size_t size);
50};
51
52struct tegra_smmu_soc {
53 const struct tegra_mc_client *clients;
54 unsigned int num_clients;
55
56 const struct tegra_smmu_swgroup *swgroups;
57 unsigned int num_swgroups;
58
59 bool supports_round_robin_arbitration;
60 bool supports_request_limit;
61
62 unsigned int num_asids;
63
64 const struct tegra_smmu_ops *ops;
65};
66
67struct tegra_mc;
68struct tegra_smmu;
69
70#ifdef CONFIG_TEGRA_IOMMU_SMMU
71struct tegra_smmu *tegra_smmu_probe(struct device *dev,
72 const struct tegra_smmu_soc *soc,
73 struct tegra_mc *mc);
74#else
75static inline struct tegra_smmu *
76tegra_smmu_probe(struct device *dev, const struct tegra_smmu_soc *soc,
77 struct tegra_mc *mc)
78{
79 return NULL;
80}
81#endif
82
83struct tegra_mc_soc {
84 const struct tegra_mc_client *clients;
85 unsigned int num_clients;
86
87 const unsigned int *emem_regs;
88 unsigned int num_emem_regs;
89
90 unsigned int num_address_bits;
91 unsigned int atom_size;
92
93 const struct tegra_smmu_soc *smmu;
94};
95
96struct tegra_mc {
97 struct device *dev;
98 struct tegra_smmu *smmu;
99 void __iomem *regs;
100 struct clk *clk;
101 int irq;
102
103 const struct tegra_mc_soc *soc;
104 unsigned long tick;
105};
106
107#endif /* __SOC_TEGRA_MC_H__ */