2 * Copyright (C) 2014 NVIDIA Corporation
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.
9 #ifndef __SOC_TEGRA_MC_H__
10 #define __SOC_TEGRA_MC_H__
12 #include <linux/err.h>
13 #include <linux/reset-controller.h>
14 #include <linux/types.h>
20 struct tegra_smmu_enable
{
25 struct tegra_mc_timing
{
31 /* latency allowance */
39 struct tegra_mc_client
{
44 unsigned int fifo_size
;
46 struct tegra_smmu_enable smmu
;
47 struct tegra_mc_la la
;
50 struct tegra_smmu_swgroup
{
56 struct tegra_smmu_group_soc
{
58 const unsigned int *swgroups
;
59 unsigned int num_swgroups
;
62 struct tegra_smmu_soc
{
63 const struct tegra_mc_client
*clients
;
64 unsigned int num_clients
;
66 const struct tegra_smmu_swgroup
*swgroups
;
67 unsigned int num_swgroups
;
69 const struct tegra_smmu_group_soc
*groups
;
70 unsigned int num_groups
;
72 bool supports_round_robin_arbitration
;
73 bool supports_request_limit
;
75 unsigned int num_tlb_lines
;
76 unsigned int num_asids
;
83 #ifdef CONFIG_TEGRA_IOMMU_SMMU
84 struct tegra_smmu
*tegra_smmu_probe(struct device
*dev
,
85 const struct tegra_smmu_soc
*soc
,
87 void tegra_smmu_remove(struct tegra_smmu
*smmu
);
89 static inline struct tegra_smmu
*
90 tegra_smmu_probe(struct device
*dev
, const struct tegra_smmu_soc
*soc
,
96 static inline void tegra_smmu_remove(struct tegra_smmu
*smmu
)
101 #ifdef CONFIG_TEGRA_IOMMU_GART
102 struct gart_device
*tegra_gart_probe(struct device
*dev
, struct tegra_mc
*mc
);
103 int tegra_gart_suspend(struct gart_device
*gart
);
104 int tegra_gart_resume(struct gart_device
*gart
);
106 static inline struct gart_device
*
107 tegra_gart_probe(struct device
*dev
, struct tegra_mc
*mc
)
109 return ERR_PTR(-ENODEV
);
112 static inline int tegra_gart_suspend(struct gart_device
*gart
)
117 static inline int tegra_gart_resume(struct gart_device
*gart
)
123 struct tegra_mc_reset
{
126 unsigned int control
;
132 struct tegra_mc_reset_ops
{
133 int (*hotreset_assert
)(struct tegra_mc
*mc
,
134 const struct tegra_mc_reset
*rst
);
135 int (*hotreset_deassert
)(struct tegra_mc
*mc
,
136 const struct tegra_mc_reset
*rst
);
137 int (*block_dma
)(struct tegra_mc
*mc
,
138 const struct tegra_mc_reset
*rst
);
139 bool (*dma_idling
)(struct tegra_mc
*mc
,
140 const struct tegra_mc_reset
*rst
);
141 int (*unblock_dma
)(struct tegra_mc
*mc
,
142 const struct tegra_mc_reset
*rst
);
143 int (*reset_status
)(struct tegra_mc
*mc
,
144 const struct tegra_mc_reset
*rst
);
147 struct tegra_mc_soc
{
148 const struct tegra_mc_client
*clients
;
149 unsigned int num_clients
;
151 const unsigned long *emem_regs
;
152 unsigned int num_emem_regs
;
154 unsigned int num_address_bits
;
155 unsigned int atom_size
;
159 const struct tegra_smmu_soc
*smmu
;
163 const struct tegra_mc_reset_ops
*reset_ops
;
164 const struct tegra_mc_reset
*resets
;
165 unsigned int num_resets
;
170 struct tegra_smmu
*smmu
;
171 struct gart_device
*gart
;
176 const struct tegra_mc_soc
*soc
;
179 struct tegra_mc_timing
*timings
;
180 unsigned int num_timings
;
182 struct reset_controller_dev reset
;
187 void tegra_mc_write_emem_configuration(struct tegra_mc
*mc
, unsigned long rate
);
188 unsigned int tegra_mc_get_emem_device_count(struct tegra_mc
*mc
);
190 #endif /* __SOC_TEGRA_MC_H__ */