From patchwork Wed Apr 15 05:57:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Zhong X-Patchwork-Id: 6218801 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 630B29F2EC for ; Wed, 15 Apr 2015 06:01:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 92E602035E for ; Wed, 15 Apr 2015 06:01:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A030F2034F for ; Wed, 15 Apr 2015 06:01:32 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YiGKh-00079H-KX; Wed, 15 Apr 2015 05:57:55 +0000 Received: from mail-pa0-f49.google.com ([209.85.220.49]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YiGKf-00077M-1a; Wed, 15 Apr 2015 05:57:53 +0000 Received: by paboj16 with SMTP id oj16so38535048pab.0; Tue, 14 Apr 2015 22:57:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=from:to:cc:subject:date:message-id; bh=fGa3tKLL453dWudnsS3u1ZmLBaThbUmgUGNDZyDXmto=; b=VIyGaD4DOsGTARlyL9+LzH/NbSlODSNs1zqt15Dibd5CDd5ODN+NA/4eQBhmIXR4Xo WaQzn+dicrJhR6kP5DHekeoKqoJ5rxyzdg+rSGfmSa312QGXsHVSaRqbLgU+MSRC0W5f mNvO3NzOH7cubNianOBR1vD4SSWJYWoEYfs7TLyLjQOc9gZmAe/bkpR9AaDWK1FcJnOI dqktof37lx58rr6rnJbLnk9Dftwm5JDo7YzKbzpWsOoeZRqYf+zNOwEW/CmDFCwvDtm1 y6psGFY8lfkTJg2lw6oSYMATrQeM8TO92S2uNisMEzuwAz4lqSacylYOQmCLD9VI4dKf LH0w== X-Received: by 10.70.63.1 with SMTP id c1mr15536583pds.90.1429077450537; Tue, 14 Apr 2015 22:57:30 -0700 (PDT) Received: from localhost.localdomain ([103.47.144.138]) by mx.google.com with ESMTPSA id fd5sm2860023pdb.67.2015.04.14.22.57.22 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Apr 2015 22:57:29 -0700 (PDT) From: Chris Zhong To: heiko@sntech.de, dianders@chromium.org, dtor@chromium.org, sonnyrao@chromium.org Subject: [PATCH] ARM: rockchip: disable dapswjdp during suspend Date: Wed, 15 Apr 2015 13:57:11 +0800 Message-Id: <1429077431-31326-1-git-send-email-zyw@rock-chips.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150414_225753_116552_DD58DD1A X-CRM114-Status: UNSURE ( 8.92 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) Cc: Chris Zhong , linux-rockchip@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Reset dapswjdp is controlled by JTAG_TRSTN, if the iomux of this pin is not "jtag_trstn". the AP would think this pin is always high, so it can not reset before resume. When system resume, but the dapswjdp is not in a default state, it may Access some illegal address, it cause system crash during resume. Let's disable this jtag function by clear the dapdeviceen bit, it prohibit the dapswjdp to access memory and registers. This bit would be enable in MASKROM, so we need clear it in suspend everytime. Signed-off-by: Chris Zhong Reviewed-by: Doug Anderson --- arch/arm/mach-rockchip/pm.c | 7 +++++++ arch/arm/mach-rockchip/pm.h | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/arch/arm/mach-rockchip/pm.c b/arch/arm/mach-rockchip/pm.c index b07d886..b0dcbe2 100644 --- a/arch/arm/mach-rockchip/pm.c +++ b/arch/arm/mach-rockchip/pm.c @@ -83,6 +83,13 @@ static void rk3288_slp_mode_set(int level) SGRF_PCLK_WDT_GATE | SGRF_FAST_BOOT_EN | SGRF_PCLK_WDT_GATE_WRITE | SGRF_FAST_BOOT_EN_WRITE); + /* + * The dapswjdp can not auto reset before resume, that cause it may + * access some illegal address during resume. Let's disable it before + * suspend, and the MASKROM will enable it back. + */ + regmap_write(sgrf_regmap, RK3288_SGRF_CPU_CON0, SGRF_DAPDEVICEEN_WRITE); + /* booting address of resuming system is from this register value */ regmap_write(sgrf_regmap, RK3288_SGRF_FAST_BOOT_ADDR, rk3288_bootram_phy); diff --git a/arch/arm/mach-rockchip/pm.h b/arch/arm/mach-rockchip/pm.h index 03ff31d..3e8d39c 100644 --- a/arch/arm/mach-rockchip/pm.h +++ b/arch/arm/mach-rockchip/pm.h @@ -55,6 +55,10 @@ static inline void rockchip_suspend_init(void) #define SGRF_FAST_BOOT_EN BIT(8) #define SGRF_FAST_BOOT_EN_WRITE BIT(24) +#define RK3288_SGRF_CPU_CON0 (0x40) +#define SGRF_DAPDEVICEEN BIT(0) +#define SGRF_DAPDEVICEEN_WRITE BIT(16) + #define RK3288_CRU_MODE_CON 0x50 #define RK3288_CRU_SEL0_CON 0x60 #define RK3288_CRU_SEL1_CON 0x64