From patchwork Mon Sep 18 10:30:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Victor Shih X-Patchwork-Id: 141567 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp2938415vqi; Mon, 18 Sep 2023 13:37:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG1wm/SCay96P4lIjjoQXhHE1LuWX/+Pun9FQcvkfSKkr+ZMBFe6gtc86yrQtezhjwMmL0z X-Received: by 2002:a17:902:e54c:b0:1bf:2e5c:7367 with SMTP id n12-20020a170902e54c00b001bf2e5c7367mr12368572plf.42.1695069478298; Mon, 18 Sep 2023 13:37:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695069478; cv=none; d=google.com; s=arc-20160816; b=F/dupv6JOalfml0FWagAqG4q43wdVQGo3xn9uAC3pdIJ1DqQb4gyCyMxcGYLbq/tyd 3uUMnU+BXOcnZ4D0cCi+4LJoPBqo8FYrRpLX5UHQirHb2ZxsrAK6tEFY4E2q0eeJ+0xF jS8yvL/TUjoCs5ZbaVqDzNqs11HEue6DKoPmTAIms2SvnICzjq9uF37rXbtwiZaE4Wnm DLUocxsGZZXZ+f1+i8Vr1OOAiGDJaOYbu41mIbj1uc1dCsahd2sTE1lbwh99qWNZFDdK m9dW+k64vW8S/EQt5GRgEtDuyXj1naSl1pFN1NqdC2CG7HWTCDwQ9p9hlyYb5MzEo1Cv ZSJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=QLJZOub4/BAt+7IdwydIQJYY2CoSBI6D30tEHY6X3RQ=; fh=OTUrbQP0s3S/kW502z6Ti3fUHA4zpHu/VcYFaJiaIP8=; b=rXa8LHvQ7R6LjDi65FZLq5qmuIBKVduUzpc8lVI7DF+njfT+fbOiL5OpGZhTVuhedx aRg5NYjqvwA2rlCw9IhfGaYk+78QXOToRA78adi4ZcHHKBHADx8DiBLiOz6DTuv5bwiL DTzJ5OQivHfGZE0UiK95Ga1u+uOlr42vzGjkVtiOIUjYOlZFXdktDnksPiPwL2L/zW/Q QgEzxeuXPa4R0lwxBcVBAzWlnRSJe63D7/32xNhPEQxhLcNxQVh32HiXjjIb0++JgK+P nMcn85CeDKTHUWm+wG2BP3SKa97hItoh1nC7IDj6BNxIMz4Oz0wWiDzqrBoerBGEeKQA DvEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=h+eH0bWo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id b11-20020a170902d50b00b001c1e1fe16cbsi4371950plg.255.2023.09.18.13.37.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 13:37:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=h+eH0bWo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 46845804C4A0; Mon, 18 Sep 2023 03:32:04 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241013AbjIRKbY (ORCPT + 27 others); Mon, 18 Sep 2023 06:31:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241354AbjIRKbO (ORCPT ); Mon, 18 Sep 2023 06:31:14 -0400 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64F33D8; Mon, 18 Sep 2023 03:31:05 -0700 (PDT) Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-68fb6fd2836so4017759b3a.0; Mon, 18 Sep 2023 03:31:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695033065; x=1695637865; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=QLJZOub4/BAt+7IdwydIQJYY2CoSBI6D30tEHY6X3RQ=; b=h+eH0bWoHTaoVPU6K6DN3xfxwyjiDF/Ea/f/NoeGPSlCf77uz4OF7CmxA0C/Np9D/m tGTu9zQjinJN7BjHrEm+BxY8zPhG9hKPJc621cWKWhua/JA2kPM4Qr+zMGr4T3Dbbjnp LA+Cljb8nqKPiKVvrP2tWMMjRv9dZXmqrNU12f3flRuMvPnrb0s/2rLHoVHJ5BvFBaq0 FgbEjjFr37fbwteR42vkK05S/SkThHFJlpyWSw3qJ8TZsu8wuTaSW1q1nXQoCjFCsFN+ 5KsbZ7nrlOAlp3aZe3w0I6YOZqo75em+jtb6zwC/WHRfzleKs3y5tDr9XJNCcPZBcUuf Pseg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695033065; x=1695637865; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QLJZOub4/BAt+7IdwydIQJYY2CoSBI6D30tEHY6X3RQ=; b=pENKH6qmPDviYdDgKOZdwSZDqsZzZB6ViPhv9ukQnyXpHw2Bc2y8kKTOifmHyCZDvf lWgedWMHk13p6oLdjq/acDb6ZpYfIR7rPHFuEIaPCbLkUvMMtxSRrScEeZ5hbujL6UP1 KColWCViP4+S/hLzw4TDRMbhpu5W8a5PMt/Z7oX1Uid9JIC7n7H69nfk3x0TgRxLqG3v Mo15AqcLZV4iHds8mqx7Qd8K+3ttnjjcc9SzD1plyjdHtM0EqUud212XdSPyAegeV7l5 ed9dS7P4juMwGPOYwwIGP6UR2MdbJvzoW2sNAP8M5/1+fOvh+fnowqy8O52Di7uzGrY6 cEgw== X-Gm-Message-State: AOJu0Yxn86ALdMhOPXLdSjZrV+sCUppPjnb4JCGvjWN9veTK+UqEm/pn Yx7oY35XJry5g5fU3YrCB1M= X-Received: by 2002:a05:6a00:3994:b0:690:2ecd:a593 with SMTP id fi20-20020a056a00399400b006902ecda593mr10089185pfb.26.1695033064750; Mon, 18 Sep 2023 03:31:04 -0700 (PDT) Received: from localhost.localdomain (2001-b400-e2a7-a325-4595-6688-c34c-2ae9.emome-ip6.hinet.net. [2001:b400:e2a7:a325:4595:6688:c34c:2ae9]) by smtp.gmail.com with ESMTPSA id o17-20020a639211000000b0056c3a4a3ca5sm6616292pgd.36.2023.09.18.03.31.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 03:31:04 -0700 (PDT) From: Victor Shih To: ulf.hansson@linaro.org, adrian.hunter@intel.com Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, benchuanggli@gmail.com, HL.Liu@genesyslogic.com.tw, Greg.tu@genesyslogic.com.tw, kangzhen.lou@dell.com, kai.heng.feng@canonical.com, Victor Shih , Victor Shih Subject: [PATCH V1] mmc: sdhci-pci-gli: GL975[05]: Mask the replay timer timeout of AER Date: Mon, 18 Sep 2023 18:30:55 +0800 Message-Id: <20230918103055.5471-1-victorshihgli@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 18 Sep 2023 03:32:04 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777409173167141406 X-GMAIL-MSGID: 1777409173167141406 From: Victor Shih Due to a flaw in the hardware design, the GL975x replay timer frequently times out when ASPM is enabled. As a result, the system will resume immediately when it enters suspend. Therefore, the replay timer timeout must be masked. Signed-off-by: Victor Shih --- drivers/mmc/host/sdhci-pci-gli.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/mmc/host/sdhci-pci-gli.c b/drivers/mmc/host/sdhci-pci-gli.c index d83261e857a5..d8a991b349a8 100644 --- a/drivers/mmc/host/sdhci-pci-gli.c +++ b/drivers/mmc/host/sdhci-pci-gli.c @@ -28,6 +28,9 @@ #define PCI_GLI_9750_PM_CTRL 0xFC #define PCI_GLI_9750_PM_STATE GENMASK(1, 0) +#define PCI_GLI_9750_CORRERR_MASK 0x214 +#define PCI_GLI_9750_CORRERR_MASK_REPLAY_TIMER_TIMEOUT BIT(12) + #define SDHCI_GLI_9750_CFG2 0x848 #define SDHCI_GLI_9750_CFG2_L1DLY GENMASK(28, 24) #define GLI_9750_CFG2_L1DLY_VALUE 0x1F @@ -152,6 +155,9 @@ #define PCI_GLI_9755_PM_CTRL 0xFC #define PCI_GLI_9755_PM_STATE GENMASK(1, 0) +#define PCI_GLI_9755_CORRERR_MASK 0x214 +#define PCI_GLI_9755_CORRERR_MASK_REPLAY_TIMER_TIMEOUT BIT(12) + #define SDHCI_GLI_9767_GM_BURST_SIZE 0x510 #define SDHCI_GLI_9767_GM_BURST_SIZE_AXI_ALWAYS_SET BIT(8) @@ -561,6 +567,11 @@ static void gl9750_hw_setting(struct sdhci_host *host) value &= ~PCI_GLI_9750_PM_STATE; pci_write_config_dword(pdev, PCI_GLI_9750_PM_CTRL, value); + /* mask the replay timer timeout of AER */ + pci_read_config_dword(pdev, PCI_GLI_9750_CORRERR_MASK, &value); + value |= PCI_GLI_9750_CORRERR_MASK_REPLAY_TIMER_TIMEOUT; + pci_write_config_dword(pdev, PCI_GLI_9750_CORRERR_MASK, value); + gl9750_wt_off(host); } @@ -770,6 +781,11 @@ static void gl9755_hw_setting(struct sdhci_pci_slot *slot) value &= ~PCI_GLI_9755_PM_STATE; pci_write_config_dword(pdev, PCI_GLI_9755_PM_CTRL, value); + /* mask the replay timer timeout of AER */ + pci_read_config_dword(pdev, PCI_GLI_9755_CORRERR_MASK, &value); + value |= PCI_GLI_9755_CORRERR_MASK_REPLAY_TIMER_TIMEOUT; + pci_write_config_dword(pdev, PCI_GLI_9755_CORRERR_MASK, value); + gl9755_wt_off(pdev); }