From patchwork Tue Oct 13 17:06:51 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Shishkin X-Patchwork-Id: 53458 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9DHBZaB015303 for ; Tue, 13 Oct 2009 17:11:36 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760619AbZJMRJC (ORCPT ); Tue, 13 Oct 2009 13:09:02 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1760618AbZJMRJC (ORCPT ); Tue, 13 Oct 2009 13:09:02 -0400 Received: from smtp.nokia.com ([192.100.122.233]:25465 "EHLO mgw-mx06.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760617AbZJMRJA (ORCPT ); Tue, 13 Oct 2009 13:09:00 -0400 Received: from vaebh105.NOE.Nokia.com (vaebh105.europe.nokia.com [10.160.244.31]) by mgw-mx06.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id n9DH75Ch018023; Tue, 13 Oct 2009 20:07:16 +0300 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by vaebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 13 Oct 2009 20:07:14 +0300 Received: from mgw-sa01.ext.nokia.com ([147.243.1.47]) by esebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Tue, 13 Oct 2009 20:07:14 +0300 Received: from esdhcp04087 (esdhcp041145.research.nokia.com [172.21.41.145]) by mgw-sa01.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id n9DH7CBd026340 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO); Tue, 13 Oct 2009 20:07:12 +0300 Received: from ash by esdhcp04087 with local (Exim 4.69) (envelope-from ) id 1Mxkq2-0004CV-OY; Tue, 13 Oct 2009 20:07:06 +0300 From: Alexander Shishkin To: Russell King Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Alexander Shishkin Subject: [PATCH v2 2/2] OMAP3: add platform devices for ETM and ETB Date: Tue, 13 Oct 2009 20:06:51 +0300 Message-Id: <1255453611-16119-2-git-send-email-virtuoso@slind.org> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1255453611-16119-1-git-send-email-virtuoso@slind.org> References: <1255453611-16119-1-git-send-email-virtuoso@slind.org> X-OriginalArrivalTime: 13 Oct 2009 17:07:14.0110 (UTC) FILETIME=[9C2CD5E0:01CA4C27] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index 15cb529..4fbbb39 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig @@ -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 + diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 9e63562..d1e172b 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -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 diff --git a/arch/arm/mach-omap2/emu.c b/arch/arm/mach-omap2/emu.c new file mode 100644 index 0000000..d2f03a9 --- /dev/null +++ b/arch/arm/mach-omap2/emu.c @@ -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 +#include +#include +#include +#include +#include +#include +#include + +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); +