Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

memory: tegra: Add API for retrieving carveout bounds

On Tegra234 NVDEC firmware is loaded from a secure carveout, where it
has been loaded by a bootloader. When booting NVDEC, we need to tell it
the address of this firmware, which we can determine by checking the
starting address of the carveout. As such, add an MC API to query the
bounds of carveouts, and add related information on Tegra234.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>

authored by

Mikko Perttunen and committed by
Thierry Reding
7946920d 17c29844

+41
+25
drivers/memory/tegra/mc.c
··· 107 107 } 108 108 EXPORT_SYMBOL_GPL(tegra_mc_probe_device); 109 109 110 + int tegra_mc_get_carveout_info(struct tegra_mc *mc, unsigned int id, 111 + phys_addr_t *base, u64 *size) 112 + { 113 + u32 offset; 114 + 115 + if (id < 1 || id >= mc->soc->num_carveouts) 116 + return -EINVAL; 117 + 118 + if (id < 6) 119 + offset = 0xc0c + 0x50 * (id - 1); 120 + else 121 + offset = 0x2004 + 0x50 * (id - 6); 122 + 123 + *base = mc_ch_readl(mc, MC_BROADCAST_CHANNEL, offset + 0x0); 124 + #ifdef CONFIG_PHYS_ADDR_T_64BIT 125 + *base |= (phys_addr_t)mc_ch_readl(mc, MC_BROADCAST_CHANNEL, offset + 0x4) << 32; 126 + #endif 127 + 128 + if (size) 129 + *size = mc_ch_readl(mc, MC_BROADCAST_CHANNEL, offset + 0x8) << 17; 130 + 131 + return 0; 132 + } 133 + EXPORT_SYMBOL_GPL(tegra_mc_get_carveout_info); 134 + 110 135 static int tegra_mc_block_dma_common(struct tegra_mc *mc, 111 136 const struct tegra_mc_reset *rst) 112 137 {
+5
drivers/memory/tegra/tegra234.c
··· 187 187 .ops = &tegra186_mc_ops, 188 188 .ch_intmask = 0x0000ff00, 189 189 .global_intstatus_channel_shift = 8, 190 + /* 191 + * Additionally, there are lite carveouts but those are not currently 192 + * supported. 193 + */ 194 + .num_carveouts = 32, 190 195 };
+11
include/soc/tegra/mc.h
··· 193 193 unsigned int num_address_bits; 194 194 unsigned int atom_size; 195 195 196 + unsigned int num_carveouts; 197 + 196 198 u16 client_id_mask; 197 199 u8 num_channels; 198 200 ··· 246 244 #ifdef CONFIG_TEGRA_MC 247 245 struct tegra_mc *devm_tegra_memory_controller_get(struct device *dev); 248 246 int tegra_mc_probe_device(struct tegra_mc *mc, struct device *dev); 247 + int tegra_mc_get_carveout_info(struct tegra_mc *mc, unsigned int id, 248 + phys_addr_t *base, u64 *size); 249 249 #else 250 250 static inline struct tegra_mc * 251 251 devm_tegra_memory_controller_get(struct device *dev) ··· 257 253 258 254 static inline int 259 255 tegra_mc_probe_device(struct tegra_mc *mc, struct device *dev) 256 + { 257 + return -ENODEV; 258 + } 259 + 260 + static inline int 261 + tegra_mc_get_carveout_info(struct tegra_mc *mc, unsigned int id, 262 + phys_addr_t *base, u64 *size) 260 263 { 261 264 return -ENODEV; 262 265 }