Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3390673pxb; Mon, 17 Jan 2022 19:25:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJxIs2ILPIafdsI5AqVpa3+KqPh21vxH4bu/5iZTIqOsoe2j1p1xPerrgel9EzcAKJhOIsVL X-Received: by 2002:a05:6a00:1a8f:b0:4bd:118:8071 with SMTP id e15-20020a056a001a8f00b004bd01188071mr12427276pfv.28.1642476247231; Mon, 17 Jan 2022 19:24:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642476247; cv=none; d=google.com; s=arc-20160816; b=ByHK/3PGwuqAu5PCXoMBUc4sWVw58DUEolvTuK2zMT/Nbk+PSE9VgIaqlD1DqGid7K jLngc53PbCYfSr3t3l/Rm1sJbKZzWrjnqdX5ai1eMiopgM+y8cDDmGg9kRX5BDO5Xl5J EbDtNeB35P5HNmCqiLDtKyrd7L47cdjTDlKDm/7/KlWdAIZ1m2S4Hchj5/oweFFJEZFX duk8gBfg/JICGvK1pJmWJNgPaLsIHh6Ucw5IuHmY0nI2HtEU1svFBnAIshAOZjuiTbKp mLho+SsYlhCe+WZUlw3e+nu/L98Qo07x4zAGpB5zuEgQxmK9L0NkcnicUHaAETLu1mnX l8SA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hsnajHmeWMxQypg10GbOPqzTbwUGc1/lC4lJvFzhJBU=; b=NujDPHDrEFlvXsHzkAUq+TxF/JIKiNMUmo5/HzVZOT/PUnp5hG1ktYrtiH69zPGYZT GhuUNOS/B4sQHITbAQvNY9UxXQXQo26GdXtrrBgCoYeDHuX3sW2n92jPvvgvLZT3wFcB gMbKSnW910pksA7DOcj1f74D2hg4C2jPjLZdg9hymK5BmCKAcx0ru0MMmeTeL1rSa1I8 4pD1Lqng1YKDrGFr6IuFbH3N0JEY4mYfEYW3LAyi4JjI+KhPCVtDvLtUMhr+wajybiaU oYrexsG4p5u5VVQXPCSqAgTfccE81gwC7Qco+cplkQqOnmADD9fWlqQW/D4ucp+8cx5j y2nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=b2oh9ayR; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l7si1234718pjt.110.2022.01.17.19.23.55; Mon, 17 Jan 2022 19:24:07 -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=@kernel.org header.s=k20201202 header.b=b2oh9ayR; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346132AbiARCf0 (ORCPT + 99 others); Mon, 17 Jan 2022 21:35:26 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:40436 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245655AbiARC3D (ORCPT ); Mon, 17 Jan 2022 21:29:03 -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 91BB9B81253; Tue, 18 Jan 2022 02:29:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83365C36AF4; Tue, 18 Jan 2022 02:29:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642472941; bh=xsfclcnth22emOhXnExQDbZEHeQPjA9k8JwPqBUjW/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b2oh9ayRpf4MxDWfq/+vVzR1aR64v2/7EqWF0oN6f+SPg6qkP4xhs+Mypm1m2iWwJ 9ETgpG9XETKJN8/cDlhS528FLQBpVkxlb52zg8OygbEs4goRJ7zC72OTrUg+ovnbLC LpwGkl+jRQI1EOaBDBFgN53/6WQUGrwXpw65lWJf0yh9A5RFZO4uE70YnJbeHMaj8g /0KI9tfwEMPPFUOY+ia5n4aw8Ag1BMX0/8sXRwZKqTjSVkKrLtU5oTl4Yco7MGWbUv lh2SyjoIGH7kLRviFMcnVSRS4QKVXZL0fz3i8fhzztMxwg8J1dlOP8euX2LluJ6uuG rgitUb6cqOX0Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hector Martin , Adrian Hunter , Ulf Hansson , Sasha Levin , linux-mmc@vger.kernel.org Subject: [PATCH AUTOSEL 5.16 169/217] mmc: sdhci-pci-gli: GL9755: Support for CD/WP inversion on OF platforms Date: Mon, 17 Jan 2022 21:18:52 -0500 Message-Id: <20220118021940.1942199-169-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220118021940.1942199-1-sashal@kernel.org> References: <20220118021940.1942199-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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