blob: e5ba518aaece545ad37fb0990c029c50342b3879 [file] [log] [blame]
Thierry Reding89184652014-04-16 09:24:44 +02001/*
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 {
Thierry Redinge660df02015-01-23 09:45:35 +010043 const char *name;
Thierry Reding89184652014-04-16 09:24:44 +020044 unsigned int swgroup;
45 unsigned int reg;
46};
47
48struct tegra_smmu_ops {
49 void (*flush_dcache)(struct page *page, unsigned long offset,
50 size_t size);
51};
52
53struct tegra_smmu_soc {
54 const struct tegra_mc_client *clients;
55 unsigned int num_clients;
56
57 const struct tegra_smmu_swgroup *swgroups;
58 unsigned int num_swgroups;
59
60 bool supports_round_robin_arbitration;
61 bool supports_request_limit;
62
63 unsigned int num_asids;
64
65 const struct tegra_smmu_ops *ops;
66};
67
68struct tegra_mc;
69struct tegra_smmu;
70
71#ifdef CONFIG_TEGRA_IOMMU_SMMU
72struct tegra_smmu *tegra_smmu_probe(struct device *dev,
73 const struct tegra_smmu_soc *soc,
74 struct tegra_mc *mc);
Thierry Redingd1313e72015-01-23 09:49:25 +010075void tegra_smmu_remove(struct tegra_smmu *smmu);
Thierry Reding89184652014-04-16 09:24:44 +020076#else
77static inline struct tegra_smmu *
78tegra_smmu_probe(struct device *dev, const struct tegra_smmu_soc *soc,
79 struct tegra_mc *mc)
80{
81 return NULL;
82}
Thierry Redingd1313e72015-01-23 09:49:25 +010083
84static inline void tegra_smmu_remove(struct tegra_smmu *smmu)
85{
86}
Thierry Reding89184652014-04-16 09:24:44 +020087#endif
88
89struct tegra_mc_soc {
90 const struct tegra_mc_client *clients;
91 unsigned int num_clients;
92
93 const unsigned int *emem_regs;
94 unsigned int num_emem_regs;
95
96 unsigned int num_address_bits;
97 unsigned int atom_size;
98
99 const struct tegra_smmu_soc *smmu;
100};
101
102struct tegra_mc {
103 struct device *dev;
104 struct tegra_smmu *smmu;
105 void __iomem *regs;
106 struct clk *clk;
107 int irq;
108
109 const struct tegra_mc_soc *soc;
110 unsigned long tick;
111};
112
113#endif /* __SOC_TEGRA_MC_H__ */