From patchwork Fri Jan 11 08:30:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 1023441 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.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="OCe1sb23"; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43bbfL4CPcz9sLw; Fri, 11 Jan 2019 19:30:34 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1ghsCz-00055U-5z; Fri, 11 Jan 2019 08:30:29 +0000 Received: from mail-pl1-f193.google.com ([209.85.214.193]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1ghsCw-00054D-NJ for kernel-team@lists.ubuntu.com; Fri, 11 Jan 2019 08:30:26 +0000 Received: by mail-pl1-f193.google.com with SMTP id 101so6462815pld.6 for ; Fri, 11 Jan 2019 00:30:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=n1isssIuG7fkO4Nmjk90qoMQJDjVJApyuG7KBcpNRJU=; b=OCe1sb2334rNPWAhVYQp4OEq6NXDjzO1cYxfPkulZC0fJiIpYygC46HhTxmWpQxso+ GO0S29X6eib5GkfO5+/yZmRjZ7OdfFzJvvZqj+imRhHkToly8Bkf2Yz8ppj8miFwugp5 59l5/di8IkU7OS524pz1zggwkusFhQGu1qSk9w3CbDntk8Mb0a3apXRkI8kmLe4C2fJY ak6qwZ17VY2UcjlG6Iz1BqP0U16HQsNV13JHfZJ/YPVJtgjMEy1CfqNw4ug2NgMAr/My WDuvaqpb6JdPZrCyBn7xjDuqT2tMENI8i5iZF2Snc/aC9KsQfBKYwzY9PUtoyG9Uepzs CkBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=n1isssIuG7fkO4Nmjk90qoMQJDjVJApyuG7KBcpNRJU=; b=Xqp1qSAJ/lDbp3HGtKCR4W6mEcyS4TN9HKJxQWpgFy1OaHkUFjVQ8gNVx5gPncBHrL Z/96jXRrDsQwBYIIM/ZlYw399FP36Vke+ka2ILQyPbg78FNDowxHLu6HxgvhStXO4iQm 9wuOIOW7u6EaAMWA7WJIw5zLbEQOFuW3Kc/WV5RLMbhNNbU6LyNSX4f8eETSOifoi9SL NedKwqsqmKEWUXYN8DumZZ8zRrNguP/Vi/qttpJjbQlaKFVo9AXDoRX2uSmnRQuYft3w oN0cASc8R0VGcScFcA1OmYIvXPOje60lNraocPH/FQpz2vs53JwYThT+MiCuiztAUyVt 7nmQ== X-Gm-Message-State: AJcUukfEV8UvqOHEvn1Vav8DpnJCueCoRf8M2RkrRucSwYBpqYZEYEWf l1ALEYiac3cgGEEnH9Tgzrhn1KBydh8= X-Google-Smtp-Source: ALg8bN6aJ/6qL971X6duM/clMiahxb9i17Pq124246tkRPMX7LI6c2VslgbYQgrUmtyEojN5pYMt/w== X-Received: by 2002:a17:902:4225:: with SMTP id g34mr14033602pld.152.1547195424783; Fri, 11 Jan 2019 00:30:24 -0800 (PST) Received: from localhost (61-220-137-37.HINET-IP.hinet.net. [61.220.137.37]) by smtp.gmail.com with ESMTPSA id h15sm97119855pgl.43.2019.01.11.00.30.23 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 Jan 2019 00:30:24 -0800 (PST) From: AceLan Kao To: kernel-team@lists.ubuntu.com Subject: [PATCH 01/12][SRU][B][C][D][OEM-B] mmc: sdhci: Disable 1.8v modes (HS200/HS400/UHS) if controller can't support 1.8v Date: Fri, 11 Jan 2019 16:30:08 +0800 Message-Id: <20190111083019.32135-2-acelan.kao@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190111083019.32135-1-acelan.kao@canonical.com> References: <20190111083019.32135-1-acelan.kao@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Kishon Vijay Abraham I BugLink: https://bugs.launchpad.net/bugs/1811337 The SDHCI controller in a SoC might support HS200/HS400 (indicated using mmc-hs200-1_8v/mmc-hs400-1_8v dt property), but if the board is modeled such that the IO lines are not connected to 1.8v then HS200/HS400 cannot be supported. Disable HS200/HS400 if the board does not have 1.8v connected to the IO lines. Also Disable DDR/UHS in 1.8v if the IO lines are not connected to 1.8v. Signed-off-by: Kishon Vijay Abraham I Acked-by: Tony Lindgren Signed-off-by: Ulf Hansson (cherry picked from commit c16bc9a7678a27ece028dcbfea8df2049a65dbec) Signed-off-by: AceLan Kao --- drivers/mmc/host/sdhci.c | 10 ++++++++++ include/linux/mmc/host.h | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 3a5f305fd442..3f2fd9f466bf 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -3649,6 +3649,16 @@ int sdhci_setup_host(struct sdhci_host *host) if (host->quirks2 & SDHCI_QUIRK2_NO_1_8_V) { host->caps1 &= ~(SDHCI_SUPPORT_SDR104 | SDHCI_SUPPORT_SDR50 | SDHCI_SUPPORT_DDR50); + /* + * The SDHCI controller in a SoC might support HS200/HS400 + * (indicated using mmc-hs200-1_8v/mmc-hs400-1_8v dt property), + * but if the board is modeled such that the IO lines are not + * connected to 1.8v then HS200/HS400 cannot be supported. + * Disable HS200/HS400 if the board does not have 1.8v connected + * to the IO lines. (Applicable for other modes in 1.8v) + */ + mmc->caps2 &= ~(MMC_CAP2_HSX00_1_8V | MMC_CAP2_HS400_ES); + mmc->caps &= ~(MMC_CAP_1_8V_DDR | MMC_CAP_UHS); } /* Any UHS-I mode in caps implies SDR12 and SDR25 support. */ diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index e7743eca1021..b36723e8e99b 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -320,6 +320,9 @@ struct mmc_host { #define MMC_CAP_UHS_SDR50 (1 << 18) /* Host supports UHS SDR50 mode */ #define MMC_CAP_UHS_SDR104 (1 << 19) /* Host supports UHS SDR104 mode */ #define MMC_CAP_UHS_DDR50 (1 << 20) /* Host supports UHS DDR50 mode */ +#define MMC_CAP_UHS (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | \ + MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 | \ + MMC_CAP_UHS_DDR50) /* (1 << 21) is free for reuse */ #define MMC_CAP_DRIVER_TYPE_A (1 << 23) /* Host supports Driver Type A */ #define MMC_CAP_DRIVER_TYPE_C (1 << 24) /* Host supports Driver Type C */ @@ -344,6 +347,7 @@ struct mmc_host { #define MMC_CAP2_HS400_1_2V (1 << 16) /* Can support HS400 1.2V */ #define MMC_CAP2_HS400 (MMC_CAP2_HS400_1_8V | \ MMC_CAP2_HS400_1_2V) +#define MMC_CAP2_HSX00_1_8V (MMC_CAP2_HS200_1_8V_SDR | MMC_CAP2_HS400_1_8V) #define MMC_CAP2_HSX00_1_2V (MMC_CAP2_HS200_1_2V_SDR | MMC_CAP2_HS400_1_2V) #define MMC_CAP2_SDIO_IRQ_NOTHREAD (1 << 17) #define MMC_CAP2_NO_WRITE_PROTECT (1 << 18) /* No physical write protect pin, assume that card is always read-write */