@@ -96,3 +96,10 @@ config MACH_OMAP_ZOOM2
config MACH_OMAP_4430SDP
bool "OMAP 4430 SDP board"
depends on ARCH_OMAP4
+
+config OMAP3_EMU
+ bool "OMAP3 debugging peripherals"
+ depends on ARCH_OMAP3 && OC_ETM
+ help
+ Say Y here to enable debugging hardware of omap3
+
@@ -44,6 +44,9 @@ obj-$(CONFIG_ARCH_OMAP4) += cm4xxx.o
obj-$(CONFIG_ARCH_OMAP2) += clock24xx.o
obj-$(CONFIG_ARCH_OMAP3) += clock34xx.o
+# EMU periferals
+obj-$(CONFIG_OMAP3_EMU) += emu.o
+
iommu-y += iommu2.o
iommu-$(CONFIG_ARCH_OMAP3) += omap3-iommu.o
new file mode 100644
@@ -0,0 +1,95 @@
+/*
+ * emu.c
+ *
+ * ETM and ETB CoreSight components' resources as found in OMAP3xxx.
+ *
+ * Copyright (C) 2009 Nokia Corporation.
+ * Alexander Shishkin
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/types.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+#include <linux/clk.h>
+#include <linux/err.h>
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Alexander Shishkin");
+
+/* Cortex CoreSight components within omap3xxx EMU */
+#define ETM_BASE (L4_EMU_34XX_PHYS + 0x10000)
+#define DBG_BASE (L4_EMU_34XX_PHYS + 0x11000)
+#define ETB_BASE (L4_EMU_34XX_PHYS + 0x1b000)
+#define DAPCTL (L4_EMU_34XX_PHYS + 0x1d000)
+
+static struct resource omap3_etb_resource = {
+ .start = ETB_BASE,
+ .end = ETB_BASE + SZ_4K - 1,
+ .flags = IORESOURCE_MEM,
+};
+
+static struct platform_device omap3_etb_device = {
+ .name = "etb",
+ .id = -1,
+ .num_resources = 1,
+ .resource = &omap3_etb_resource,
+};
+
+static struct resource omap3_etm_resource = {
+ .start = ETM_BASE,
+ .end = ETM_BASE + SZ_4K - 1,
+ .flags = IORESOURCE_MEM,
+};
+
+static struct platform_device omap3_etm_device = {
+ .name = "etm",
+ .id = -1,
+ .num_resources = 1,
+ .resource = &omap3_etm_resource,
+};
+
+static struct platform_device *omap3_trace_devices[] = {
+ &omap3_etm_device,
+ &omap3_etb_device,
+};
+
+static int __init emu_init(void)
+{
+ struct clk *emu_clk, *sys_clk;
+
+ platform_add_devices(omap3_trace_devices,
+ ARRAY_SIZE(omap3_trace_devices));
+
+ sys_clk = clk_get(&omap3_etb_device.dev, "sys_ck");
+ if (IS_ERR(sys_clk)) {
+ dev_dbg(&omap3_etb_device.dev, "Failed to obtain sys_ck.\n");
+ return -EFAULT;
+ }
+
+ emu_clk = clk_get(&omap3_etb_device.dev, "emu_src_ck");
+ if (IS_ERR(emu_clk)) {
+ dev_dbg(&omap3_etb_device.dev,
+ "Failed to obtain emu_src_ck.\n");
+ return -EFAULT;
+ }
+
+ if (clk_set_parent(emu_clk, sys_clk)) {
+ dev_dbg(&omap3_etb_device.dev, "clk_set_parent failed.\n");
+ return -EFAULT;
+ }
+
+ /* looks like we could use IORESOURCE_CLOCK */
+ platform_device_add_data(&omap3_etb_device, &emu_clk, sizeof(emu_clk));
+
+ return 0;
+}
+
+subsys_initcall(emu_init);
+