From patchwork Thu Oct 12 12:07:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 824800 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="QPoPv2pt"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yCTyj752Pz9t2S for ; Thu, 12 Oct 2017 23:03:41 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id BB946C21F24; Thu, 12 Oct 2017 12:03:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 8A659C21D82; Thu, 12 Oct 2017 12:03:36 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D812CC21D99; Thu, 12 Oct 2017 12:03:34 +0000 (UTC) Received: from mail-qk0-f194.google.com (mail-qk0-f194.google.com [209.85.220.194]) by lists.denx.de (Postfix) with ESMTPS id 821A9C21D72 for ; Thu, 12 Oct 2017 12:03:33 +0000 (UTC) Received: by mail-qk0-f194.google.com with SMTP id m189so914107qke.4 for ; Thu, 12 Oct 2017 05:03:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=6xsz+ZFeZM3N13+HVOlQMABXU5CDrIcLpM0FEjO0lGs=; b=QPoPv2ptC6X9jioHI7husiAJPrHhZvTg53R6iouT/ZAKgOJWEZZMYypfQyA1F3sYau GmhuN1qLizy6hOcl331f6SPPjJDIvf/qr5bN1tFD6yYqURgmhFOZbFAkHkXWOhLhEnYL o5POvPfMYUB0C+Jxg1TLW+fuiGsBKB++WZZDWUjT1slbeQQ0Gxu6HBSX0AwV+T9cUsXr VPRjUOusdqKz2P2uDilg/0t8r9xwtMF1u9Yd0VVL/WkGXujiQMh+TyZfJn/vY2d7dx7V P9OCYc7d/VWpHhqvo5HpYSf0O/UTgRx/QwOVB0d+q0q70He3HKSAFv/Glr3ZyGJ1IVD1 j43w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=6xsz+ZFeZM3N13+HVOlQMABXU5CDrIcLpM0FEjO0lGs=; b=JOlkQ1FD4Gg9bFaEkcGeld7zcl3nPp3p4XtNLRGneY0KfHCX0bbcjqWScXfiJi9ean GZSal1nYdVBL4m4WCyQuy4Okt4qSRM9oVQuyA45xWICzpj8QxeAvz1hat9NYXZxyhaQ7 mvvCQiuyChFZf4/RAUeVYWHwZ296H28D+n2527XAmNpUJh1VMwfvckmLiycMBetU356H ySIeWcbIwBZ4Z25Lekflg3RBYAH25K87gWsal+2kS6eCXJ5NQ0SOEWf7M2umgjUadFpb 9YHJEwimU/1qe9MWdHIGpNIul1WSUjqnOfUfLuPeRabbeVAoS0XYSDi8/yZ7+l4drKU7 MtUQ== X-Gm-Message-State: AMCzsaVx5u7XjEck1/9o5NiPcH7BgzIDfTa1srtQxpMjMeQIS8fB7Ioi XU1+OnaGd/lwoxGt7Tn5GVhm4w== X-Google-Smtp-Source: ABhQp+Rn3nyo+A7b/AipVM2rWk4JiWE8LEZKNve2ZR5o7licgVnemBqE8UeSps2vOaRQ86Pc8uLvXQ== X-Received: by 10.55.140.68 with SMTP id o65mr52608qkd.293.1507809812275; Thu, 12 Oct 2017 05:03:32 -0700 (PDT) Received: from ala-d2121-lx1.wrs.com (unknown-156-139.windriver.com. [147.11.156.139]) by smtp.gmail.com with ESMTPSA id k11sm650230qtb.95.2017.10.12.05.03.30 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Oct 2017 05:03:31 -0700 (PDT) From: Bin Meng To: Simon Glass , U-Boot Mailing List Date: Thu, 12 Oct 2017 05:07:57 -0700 Message-Id: <1507810078-29955-1-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.9.5 Cc: Stefan Roese Subject: [U-Boot] [PATCH 1/2] x86: baytrail: Fix unstable ACPI S3 resume X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" It was observed that when booting a Ubuntu 16.04 kernel, doing ACPI S3 suspend/resume sometimes causes the Ubuntu kernel hang forever. The issue is however not reproduced with a kernel built from i386/ x86_64 defconfig configuration. The unstability is actually caused by unexpected interrupts being generated during the S3 resume. For some unknown reason, FSP (gold4) for BayTrail configures the GPIO DFX5 PAD to enable level interrupt (bit 24 and 25). As this pin keeps generating interrupts during an S3 resume, and there is no IRQ requester in the kernel to handle it, the kernel seems to hang and does not continue resuming. Clear the mysterious interrupt bits for this pin. Reported-by: Stefan Roese Signed-off-by: Bin Meng Tested-by: Stefan Roese Reviewed-by: Stefan Roese --- arch/x86/cpu/baytrail/valleyview.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/arch/x86/cpu/baytrail/valleyview.c b/arch/x86/cpu/baytrail/valleyview.c index c58f6a8..9af1bda 100644 --- a/arch/x86/cpu/baytrail/valleyview.c +++ b/arch/x86/cpu/baytrail/valleyview.c @@ -10,6 +10,13 @@ #include #include #include +#include + +/* GPIO SUS */ +#define GPIO_SUS_PAD_BASE (IO_BASE_ADDRESS + IO_BASE_OFFSET_GPSSUS) +#define GPIO_SUS_DFX5_CONF0 0x150 +#define BYT_TRIG_LVL BIT(24) +#define BYT_TRIG_POS BIT(25) #ifndef CONFIG_EFI_APP int arch_cpu_init(void) @@ -33,6 +40,21 @@ int arch_misc_init(void) mrccache_save(); #endif + /* + * For some unknown reason, FSP (gold4) for BayTrail configures + * the GPIO DFX5 PAD to enable level interrupt (bit 24 and 25). + * This does not cause any issue when Linux kernel runs w/ or w/o + * the pinctrl driver for BayTrail. However this causes unstable + * S3 resume if the pinctrl driver is included in the kernel build. + * As this pin keeps generating interrupts during an S3 resume, + * and there is no IRQ requester in the kernel to handle it, the + * kernel seems to hang and does not continue resuming. + * + * Clear the mysterious interrupt bits for this pin. + */ + clrbits_le32(GPIO_SUS_PAD_BASE + GPIO_SUS_DFX5_CONF0, + BYT_TRIG_LVL | BYT_TRIG_POS); + return 0; }