void __iomem *mc;
void __iomem *mc_regs[MC_MAX_CHANNELS];
+u32 tegra_mc_readl(u32 reg)
+{
+ return mc_readl(reg);
+}
+EXPORT_SYMBOL(tegra_mc_readl);
+
+void tegra_mc_writel(u32 val, u32 reg)
+{
+ mc_writel(val, reg);
+}
+EXPORT_SYMBOL(tegra_mc_writel);
+
/*
* Return carveout info for @co in @inf. If @nr is non-NULL then the number of
* carveouts are also place in @*nr. If both @inf and @nr are NULL then the
/*
* Copyright (C) 2010-2012 Google, Inc.
- * Copyright (C) 2013-2014, NVIDIA Corporation. All rights reserved.
+ * Copyright (C) 2013-2016, NVIDIA Corporation. All rights reserved.
*
* Author:
* Erik Gilling <konkers@google.com>
#ifndef __MACH_TEGRA_MC_H
#define __MACH_TEGRA_MC_H
+#include <linux/platform/tegra/tegra_mc.h>
/* Pull in chip specific MC header - contains the regs for the platform. */
#if defined(CONFIG_ARCH_TEGRA_21x_SOC)
#include <linux/platform/tegra/mc-regs-t21x.h>
void tegra21_mc_latency_allowance_restore(u32 **pctx);
#endif
-/*
- * API for reading carveout info.
- */
-enum carveout_desc {
- MC_SECURITY_CARVEOUT1 = 0,
- MC_SECURITY_CARVEOUT2,
- MC_NR_CARVEOUTS
-};
-
-struct mc_carveout_info {
- enum carveout_desc desc;
-
- u64 base;
- u64 size;
-};
-
-int mc_get_carveout_info(struct mc_carveout_info *inf, int *nr,
- enum carveout_desc co);
-
/* API to get freqency switch latency at given MC freq.
* freq_khz: Frequncy in KHz.
* retruns latency in microseconds.
--- /dev/null
+/*
+ * Copyright (C) 2016, NVIDIA Corporation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __TEGRA_MC_H
+#define __TEGRA_MC_H
+
+/*
+ * API for reading carveout info.
+ */
+enum carveout_desc {
+ MC_SECURITY_CARVEOUT1 = 0,
+ MC_SECURITY_CARVEOUT2,
+ MC_NR_CARVEOUTS
+};
+
+struct mc_carveout_info {
+ enum carveout_desc desc;
+
+ u64 base;
+ u64 size;
+};
+
+#if defined(CONFIG_TEGRA_MC)
+
+/**
+ * Read from the MC.
+ *
+ * @idx The MC channel to read from.
+ * @reg The offset of the register to read.
+ *
+ * Read from the specified MC channel: 0 -> MC0, 1 -> MC1, etc. If @idx
+ * corresponds to a non-existent channel then 0 is returned.
+ */
+extern u32 tegra_mc_readl(u32 reg);
+
+/**
+ * Write to the MC.
+ *
+ * @idx The MC channel to write to.
+ * @val Value to write.
+ * @reg The offset of the register to write.
+ *
+ * Write to the specified MC channel: 0 -> MC0, 1 -> MC1, etc. For writes there
+ * is a special channel, %MC_BROADCAST_CHANNEL, which writes to all channels. If
+ * @idx corresponds to a non-existent channel then the write is dropped.
+ */
+extern void tegra_mc_writel(u32 val, u32 reg);
+
+extern int mc_get_carveout_info(struct mc_carveout_info *inf, int *nr,
+ enum carveout_desc co);
+
+#else
+
+static inline u32 tegra_mc_readl(u32 reg)
+{
+ return 0xffffffff;
+}
+
+static inline void tegra_mc_writel(u32 val, u32 reg)
+{
+}
+
+static inline int mc_get_carveout_info(struct mc_carveout_info *inf, int *nr,
+ enum carveout_desc co)
+{
+ return -ENODEV;
+}
+
+#endif
+
+#endif