@@ -28,6 +28,10 @@ obj-y += pipe3-phy.o
obj-$(CONFIG_SCSI_AHCI_PLAT) += sata.o
endif
+ifneq ($(CONFIG_TI_SECURE_DEVICE),)
+obj-y += sec_bridge.o
+endif
+
ifeq ($(CONFIG_SYS_DCACHE_OFF),)
obj-y += omap-cache.o
endif
new file mode 100644
@@ -0,0 +1,47 @@
+/*
+ *
+ * Common bridge function to make OMAP secure ROM calls
+ *
+ * (C) Copyright 2016
+ * Texas Instruments, <www.ti.com>
+ *
+ * Daniel Allred <d-allred@ti.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <stdarg.h>
+
+#include <asm/arch/sys_proto.h>
+#include <asm/omap_common.h>
+
+static uint32_t secure_rom_call_args[5] __aligned(ARCH_DMA_MINALIGN);
+
+u32 secure_rom_call(u32 service, u32 proc_id, u32 flag, ...)
+{
+ int i;
+ u32 num_args;
+ va_list ap;
+
+ va_start(ap, flag);
+
+ num_args = va_arg(ap, u32);
+
+ /* Copy args to aligned args structure */
+ for (i = 0; i < num_args; i++)
+ secure_rom_call_args[i + 1] = va_arg(ap, u32);
+
+ secure_rom_call_args[0] = num_args;
+
+ va_end(ap);
+
+ /* if data cache is enabled, flush the aligned args structure */
+#ifndef CONFIG_SYS_DCACHE_OFF
+ flush_dcache_range(
+ (unsigned int)&secure_rom_call_args[0],
+ (unsigned int)&secure_rom_call_args[0] +
+ roundup(sizeof(secure_rom_call_args), ARCH_DMA_MINALIGN));
+#endif
+ return omap_smc_sec(service, proc_id, flag, secure_rom_call_args);
+}
@@ -629,6 +629,10 @@ void omap_smc1(u32 service, u32 val);
u32 omap_smc_sec(u32 service, u32 proc_id, u32 flag, u32 *params);
+#ifdef CONFIG_TI_SECURE_DEVICE
+u32 secure_rom_call(u32 service, u32 proc_id, u32 flag, ...);
+#endif
+
void enable_edma3_clocks(void);
void disable_edma3_clocks(void);