Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3645000pxb; Mon, 24 Jan 2022 14:17:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJxTVa4UvojfFbFxBOI+5Y0q3NfHOSAY7bkQaeC3lTKtD4bpUqMHuLzx8JsKeceq3QTclaKJ X-Received: by 2002:a17:902:b213:b0:14b:17c1:edbe with SMTP id t19-20020a170902b21300b0014b17c1edbemr15939318plr.173.1643062641277; Mon, 24 Jan 2022 14:17:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643062641; cv=none; d=google.com; s=arc-20160816; b=kOExIfRH+WKATbBeL+gEZa0ZH6oPKaoHlIAEFqhxdhUG69nLINkdFwEtF3y9LTiTTy Hw6+mLhHzb3Mig+LKZyeuenVZUHINKADnJUXjAMUxLppt13W/u8pF3+JN68fOtZvMu1J XHTNezOazh55POdFAc5h8piUaVT+Nsb9qBKTwT/FNO1BWkb9phBuW2jZtzfB1A2Tanqj yvtxxyzBT+36zqjLsywzf6VUm1GK0q0IJUFuWrzjwwO0tDssnU/rYUJoUPaXWs4NMClV L0/uzQidu5XQz7/kWAF61CJtjHP/svZMQ6HND7MKkZM4qUQ90EE9BaHZlMGEeFgpeqsb AdWQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hsnajHmeWMxQypg10GbOPqzTbwUGc1/lC4lJvFzhJBU=; b=Xz6OQeTUeDHs1on/7t7rAPTx3+VsMVJcRfEjJEERuFoTYMJOSulgKgvmpJQyLvF7GD mvGrU9lN7NwuXgGgnBFf8PF5hxpjlC3jPXPIgtpg7U/RyZOXxjTGtBuTz7gqA1azJbKJ jdmZarV932ls5hstABVLahvX3Jp+n8X+B5mYXqatOi7HDRNHhmkrCQ9jt4hA9VxtVCeu 6w8beqrRjLhgnIKAK1CbYfA7Up9CB6/NepMoF6ydM/i5K1vxdhdFNJBjk2wH4wR1Lf9y PM+xUNf80cCFkJ0yirWo8ZJTmQRZHexgkDqNVimEMCLPAJl91cmWvcAiSsbdKg6jmO+j zlbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=n4r861l2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a15si7813307pgp.549.2022.01.24.14.17.09; Mon, 24 Jan 2022 14:17:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=n4r861l2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581665AbiAXWMI (ORCPT + 99 others); Mon, 24 Jan 2022 17:12:08 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42630 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452982AbiAXV1e (ORCPT ); Mon, 24 Jan 2022 16:27:34 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8864EB812A4; Mon, 24 Jan 2022 21:27:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD833C340E4; Mon, 24 Jan 2022 21:27:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059651; bh=xsfclcnth22emOhXnExQDbZEHeQPjA9k8JwPqBUjW/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n4r861l2MbFnMSWcVg9r9tzjUx8+7+9LIk8QYvKHuYcbfeE639m06Cm+EarP8SV78 iQhbk0PeuekaaqQ1amkkZy8BICGj+NzNLzBOoPyQVaBcx4P/U0tXkT/eyr4CJZIi9r AriZoxioNS523DF8MdXxsgwtN4uNXvc659WdVrws= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adrian Hunter , Hector Martin , Ulf Hansson , Sasha Levin Subject: [PATCH 5.16 0686/1039] mmc: sdhci-pci-gli: GL9755: Support for CD/WP inversion on OF platforms Date: Mon, 24 Jan 2022 19:41:15 +0100 Message-Id: <20220124184148.413659573@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hector Martin [ Upstream commit 189f1d9bc3a5ea3e442e119e4a5deda63da8c462 ] This is required on some Apple ARM64 laptops using this controller. As is typical on DT platforms, pull these quirks from the device tree using the standard mmc bindings. See Documentation/devicetree/bindings/mmc/mmc-controller.yaml Acked-by: Adrian Hunter Signed-off-by: Hector Martin Link: https://lore.kernel.org/r/20211215161045.38843-2-marcan@marcan.st Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/host/sdhci-pci-gli.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/mmc/host/sdhci-pci-gli.c b/drivers/mmc/host/sdhci-pci-gli.c index 4fd99c1e82ba3..ad50f16658fe2 100644 --- a/drivers/mmc/host/sdhci-pci-gli.c +++ b/drivers/mmc/host/sdhci-pci-gli.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "sdhci.h" #include "sdhci-pci.h" #include "cqhci.h" @@ -116,6 +117,8 @@ #define PCI_GLI_9755_PECONF 0x44 #define PCI_GLI_9755_LFCLK GENMASK(14, 12) #define PCI_GLI_9755_DMACLK BIT(29) +#define PCI_GLI_9755_INVERT_CD BIT(30) +#define PCI_GLI_9755_INVERT_WP BIT(31) #define PCI_GLI_9755_CFG2 0x48 #define PCI_GLI_9755_CFG2_L1DLY GENMASK(28, 24) @@ -570,6 +573,14 @@ static void gl9755_hw_setting(struct sdhci_pci_slot *slot) gl9755_wt_on(pdev); pci_read_config_dword(pdev, PCI_GLI_9755_PECONF, &value); + /* + * Apple ARM64 platforms using these chips may have + * inverted CD/WP detection. + */ + if (of_property_read_bool(pdev->dev.of_node, "cd-inverted")) + value |= PCI_GLI_9755_INVERT_CD; + if (of_property_read_bool(pdev->dev.of_node, "wp-inverted")) + value |= PCI_GLI_9755_INVERT_WP; value &= ~PCI_GLI_9755_LFCLK; value &= ~PCI_GLI_9755_DMACLK; pci_write_config_dword(pdev, PCI_GLI_9755_PECONF, value); -- 2.34.1