diff options
author | Thierry Reding <treding@nvidia.com> | 2014-04-16 03:24:44 -0400 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2014-12-04 10:11:47 -0500 |
commit | 8918465163171322c77a19d5258a95f56d89d2e4 (patch) | |
tree | 4d818b6d61af15bffc6c60316c7b5d64efb01bde /include/soc/tegra | |
parent | 4bc567dd60a1cfa9abd8484cff2de31cdf51649d (diff) |
memory: Add NVIDIA Tegra memory controller support
The memory controller on NVIDIA Tegra exposes various knobs that can be
used to tune the behaviour of the clients attached to it.
Currently this driver sets up the latency allowance registers to the HW
defaults. Eventually an API should be exported by this driver (via a
custom API or a generic subsystem) to allow clients to register latency
requirements.
This driver also registers an IOMMU (SMMU) that's implemented by the
memory controller. It is supported on Tegra30, Tegra114 and Tegra124
currently. Tegra20 has a GART instead.
The Tegra SMMU operates on memory clients and SWGROUPs. A memory client
is a unidirectional, special-purpose DMA master. A SWGROUP represents a
set of memory clients that form a logical functional unit corresponding
to a single device. Typically a device has two clients: one client for
read transactions and one client for write transactions, but there are
also devices that have only read clients, but many of them (such as the
display controllers).
Because there is no 1:1 relationship between memory clients and devices
the driver keeps a table of memory clients and the SWGROUPs that they
belong to per SoC. Note that this is an exception and due to the fact
that the SMMU is tightly integrated with the rest of the Tegra SoC. The
use of these tables is discouraged in drivers for generic IOMMU devices
such as the ARM SMMU because the same IOMMU could be used in any number
of SoCs and keeping such tables for each SoC would not scale.
Acked-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'include/soc/tegra')
-rw-r--r-- | include/soc/tegra/mc.h | 107 |
1 files changed, 107 insertions, 0 deletions
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 | |||
14 | struct clk; | ||
15 | struct device; | ||
16 | struct page; | ||
17 | |||
18 | struct tegra_smmu_enable { | ||
19 | unsigned int reg; | ||
20 | unsigned int bit; | ||
21 | }; | ||
22 | |||
23 | /* latency allowance */ | ||
24 | struct tegra_mc_la { | ||
25 | unsigned int reg; | ||
26 | unsigned int shift; | ||
27 | unsigned int mask; | ||
28 | unsigned int def; | ||
29 | }; | ||
30 | |||
31 | struct 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 | |||
42 | struct tegra_smmu_swgroup { | ||
43 | unsigned int swgroup; | ||
44 | unsigned int reg; | ||
45 | }; | ||
46 | |||
47 | struct tegra_smmu_ops { | ||
48 | void (*flush_dcache)(struct page *page, unsigned long offset, | ||
49 | size_t size); | ||
50 | }; | ||
51 | |||
52 | struct 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 | |||
67 | struct tegra_mc; | ||
68 | struct tegra_smmu; | ||
69 | |||
70 | #ifdef CONFIG_TEGRA_IOMMU_SMMU | ||
71 | struct tegra_smmu *tegra_smmu_probe(struct device *dev, | ||
72 | const struct tegra_smmu_soc *soc, | ||
73 | struct tegra_mc *mc); | ||
74 | #else | ||
75 | static inline struct tegra_smmu * | ||
76 | tegra_smmu_probe(struct device *dev, const struct tegra_smmu_soc *soc, | ||
77 | struct tegra_mc *mc) | ||
78 | { | ||
79 | return NULL; | ||
80 | } | ||
81 | #endif | ||
82 | |||
83 | struct 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 | |||
96 | struct 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__ */ | ||