[PATCH 2/11] memory: tegra: add mc flush support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The flush operation of memory clients is needed for various IP blocks in
the Tegra SoCs to perform a clean reset.

Signed-off-by: Vince Hsu <vinceh@xxxxxxxxxx>
---
 drivers/memory/tegra/mc.c | 21 +++++++++++++++++++++
 include/soc/tegra/mc.h    | 23 ++++++++++++++++++++++-
 2 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c
index fe3c44e7e1d1..a2928b4b26fe 100644
--- a/drivers/memory/tegra/mc.c
+++ b/drivers/memory/tegra/mc.c
@@ -62,6 +62,27 @@ static const struct of_device_id tegra_mc_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, tegra_mc_of_match);
 
+int tegra_mc_flush(struct tegra_mc *mc, unsigned int swgroup, bool enable)
+{
+	int i;
+	const struct tegra_mc_hr *client;
+
+	if (!mc || !mc->soc->hr_clients ||
+			!mc->soc->ops || !mc->soc->ops->flush)
+		return -EINVAL;;
+
+	client = mc->soc->hr_clients;
+
+	for (i = 0; i < mc->soc->num_hr_clients; i++, client++) {
+		if (swgroup == client->swgroup) {
+			return mc->soc->ops->flush(mc, client, enable);
+		}
+	}
+
+	return -EINVAL;
+}
+EXPORT_SYMBOL(tegra_mc_flush);
+
 static int tegra_mc_setup_latency_allowance(struct tegra_mc *mc)
 {
 	unsigned long long tick;
diff --git a/include/soc/tegra/mc.h b/include/soc/tegra/mc.h
index 63deb8d9f82a..4894aec7d2a0 100644
--- a/include/soc/tegra/mc.h
+++ b/include/soc/tegra/mc.h
@@ -39,6 +39,21 @@ struct tegra_mc_client {
 	struct tegra_mc_la la;
 };
 
+/* hot reset */
+struct tegra_mc_hr {
+	unsigned int swgroup;
+	unsigned int ctrl;
+	unsigned int status;
+	unsigned int bit;
+};
+
+struct tegra_mc;
+
+struct tegra_mc_ops {
+	int (*flush)(struct tegra_mc *mc, const struct tegra_mc_hr *hr_client,
+				bool enable);
+};
+
 struct tegra_smmu_swgroup {
 	unsigned int swgroup;
 	unsigned int reg;
@@ -64,7 +79,6 @@ struct tegra_smmu_soc {
 	const struct tegra_smmu_ops *ops;
 };
 
-struct tegra_mc;
 struct tegra_smmu;
 
 #ifdef CONFIG_TEGRA_IOMMU_SMMU
@@ -84,6 +98,11 @@ struct tegra_mc_soc {
 	const struct tegra_mc_client *clients;
 	unsigned int num_clients;
 
+	const struct tegra_mc_hr *hr_clients;
+	unsigned int num_hr_clients;
+
+	const struct tegra_mc_ops *ops;
+
 	const unsigned int *emem_regs;
 	unsigned int num_emem_regs;
 
@@ -104,4 +123,6 @@ struct tegra_mc {
 	unsigned long tick;
 };
 
+int tegra_mc_flush(struct tegra_mc *mc, unsigned int swgroup, bool enable);
+
 #endif /* __SOC_TEGRA_MC_H__ */
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux