From patchwork Mon Mar 4 11:35:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Hiremath X-Patchwork-Id: 2212111 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 6409B4006E for ; Mon, 4 Mar 2013 11:41:00 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UCThH-0007Xa-U2; Mon, 04 Mar 2013 11:36:47 +0000 Received: from bear.ext.ti.com ([192.94.94.41]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UCTgq-0007Rr-2Z for linux-arm-kernel@lists.infradead.org; Mon, 04 Mar 2013 11:36:39 +0000 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id r24Ba6Q7011654; Mon, 4 Mar 2013 05:36:06 -0600 Received: from DBDE70.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id r24Ba2g4004779; Mon, 4 Mar 2013 17:06:05 +0530 (IST) Received: from dbdp32.itg.ti.com (172.24.170.251) by dbde70.ent.ti.com (172.24.170.148) with Microsoft SMTP Server id 14.1.323.3; Mon, 4 Mar 2013 17:06:02 +0530 Received: from localhost.localdomain (dbdp20.itg.ti.com [172.24.170.38]) by dbdp32.itg.ti.com (8.13.8/8.13.8) with ESMTP id r24BZwRW026037; Mon, 4 Mar 2013 17:06:02 +0530 From: To: Subject: [RFC PATCH 3/3] ARM: OMAP2+: Add command line parameter for debugSS module control Date: Mon, 4 Mar 2013 17:05:57 +0530 Message-ID: <1362396957-30113-4-git-send-email-hvaibhav@ti.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130304_063620_260440_43774A32 X-CRM114-Status: GOOD ( 20.48 ) X-Spam-Score: -7.5 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [192.94.94.41 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.6 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: paul@pwsan.com, khilman@linaro.org, tony@atomide.com, rnayak@ti.com, Vaibhav Hiremath , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Vaibhav Hiremath Currently there is no clean mechanism to control debugSS module and you have to always keep clocks enabled, either, - By enabling it during boot as part of clk_init function. Or - By having HWMOD_INIT_NO_IDLE flag in hwmod data. Based on the discussion, http://www.mail-archive.com/linux-omap@vger.kernel.org/msg81771.html This patch introduces new kernel parameter "omap_debugss_en", which will allow user to control debugSS module enable/disable part during boot-time. Signed-off-by: Vaibhav Hiremath Cc: Kevin Hilman Cc: Paul Walmsley Cc: Tony Lindgren --- Tested on - AM335x based EVM and BeagleBone platforms Documentation/kernel-parameters.txt | 3 + arch/arm/mach-omap2/Makefile | 2 +- arch/arm/mach-omap2/debugss.c | 80 +++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-omap2/debugss.c -- 1.7.0.4 diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 6c72381..bf1c822 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -2051,6 +2051,9 @@ bytes respectively. Such letter suffixes can also be entirely omitted. For example, to override I2C bus2: omap_mux=i2c2_scl.i2c2_scl=0x100,i2c2_sda.i2c2_sda=0x100 + omap_debugss_en [OMAP] Enable Debug Sub-System module required + for JTAG debugging. + oprofile.timer= [HW] Use timer interrupt instead of performance counters diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index d1156cf..aaf5cc2 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -5,7 +5,7 @@ # Common support obj-y := id.o io.o control.o mux.o devices.o fb.o serial.o gpmc.o timer.o pm.o \ common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \ - omap_device.o sram.o + omap_device.o sram.o debugss.o omap-2-3-common = irq.o hwmod-common = omap_hwmod.o \ diff --git a/arch/arm/mach-omap2/debugss.c b/arch/arm/mach-omap2/debugss.c new file mode 100644 index 0000000..b45bf2c --- /dev/null +++ b/arch/arm/mach-omap2/debugss.c @@ -0,0 +1,80 @@ +/* + * debugss.c: Debug Sus-System related code goes in here + * + * Copyright (C) {2013} Texas Instruments Incorporated - http://www.ti.com/ + * + * This file is automatically generated from the AM33XX hardware databases. + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation version 2. + * + * This program is distributed "as is" WITHOUT ANY WARRANTY of any + * kind, whether express or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include + +#include "omap_hwmod.h" + +static bool is_debugss_en; + +/** + * omap_debugss_en - Enable debugss clock/module based on user config + * + * During kernel bootup, omap2 hwmod framework will disable all the + * unused/unclaimed modules, which in turn also disables debugss module. + * This breaks any further debugging capability provided by HW. + * + * + * Introduce early param which allows user to enable clock/module - + * + * omap_debugss_en (For all OMAP2 architectures) + * + * Please note that, with this command-line param, module always remain + * enabled. + */ +static int __init omap_debugss_en(char *str) +{ + is_debugss_en = true; + return 0; +} +early_param("omap_debugss_en", omap_debugss_en); + +static int __init _omap2_debugss_enable(void) +{ + const char oh_name[10] = "debugss"; + struct omap_hwmod *oh; + int ret; + + if (is_debugss_en) { + struct omap_hwmod_opt_clk *oc; + int i; + + oh = omap_hwmod_lookup(oh_name); + if (!oh) { + pr_err("debugss device not found\n"); + return 0; + } + + /* Make sure that hwmod internal data structures are setup */ + ret = omap_hwmod_setup_one(oh_name); + if (ret) { + pr_err("failed to setup hwmod for %s\n", oh_name); + return 0; + } + /* Enable optional clocks */ + for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++) { + if (oc->_clk) + clk_prepare_enable(oc->_clk); + } + /* Enable debugss clock/module */ + omap_hwmod_enable(oh); + } + + return 0; +} +device_initcall(_omap2_debugss_enable);