Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2097776iof; Tue, 7 Jun 2022 19:39:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAmE5YPQy6jLAgoFYyaJT19GFGFOKoDG7VvxyfcV87L51a0m+AE5OpoGhXYZSWesJ80hlw X-Received: by 2002:a63:6c06:0:b0:3fd:ae53:387f with SMTP id h6-20020a636c06000000b003fdae53387fmr12917710pgc.536.1654655947641; Tue, 07 Jun 2022 19:39:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654655947; cv=none; d=google.com; s=arc-20160816; b=dj6oELkwwTeRlVroD+mQ0nKRNgr6raVz6PFy2z7c9esm4ZDmm82646+KyZJIX127f1 IzI55aA4n7mUgF7JLpEwQe1njWoVVU3D+n8a5JL+5Be8ZYT6vjD+TDEx5ArGVYC+Ipg2 OV9/SvY7wA13qFil4+Qq008CBNPhaMy7Dg3BhFV6ZMHok1vaUPhEnnjtxglaWDJJHg21 Egns3UoS+WzybBa1hL/AC9/H9gXLXqTUNdVVOTFsZbTRNWDWfiQyRgA5pBeDBTMHFRbe 3uJMnMKNFIyWZYTmlMeYx9ys1m14LMP7UWjYhy+sicbgLVg+peSC1zipvc62O20WDJ2H 1qLw== 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=d/8GSfEWInsnhKbv9Txr8x/SJsA8HK4lYfmm9XZcKaY=; b=yHW1SUUAcyzKBhf3JpM3LhYfJznvq594+UrHPIipGeNs3v3A0h1RMOPHwSthbM6eHP C4AmqmlQFa0r+qsOmL0EDXxjRy7lHlD/5K77pLm25b8gHu+lteZAE1FezjG3EylQS2Je FhGc4jWCKTPo8Kszo8p4fhz7s/pvpmhYW/6vg9Ot1wQ8FFBgeNTFKFvmT8LcUWvFjYMh lJk/K/hGLzNv7HgLFkpUG5I4/rTeDJ0EG+mayaCw07GxUHBCNk5g2rOt7sxJukKJHhbl LfrrH1HEmPqwhQ0GVb0QVZKNp91UQgYGVaXWQdqFACUyDj5V4O/32DtAkzuDqWF8X2jk 7kFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="WAOT9/Xr"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id b2-20020a170903228200b001676128d04bsi17436856plh.413.2022.06.07.19.39.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 19:39:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="WAOT9/Xr"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2670C3F2FAF; Tue, 7 Jun 2022 19:28:46 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384390AbiFGWLM (ORCPT + 99 others); Tue, 7 Jun 2022 18:11:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235181AbiFGVIB (ORCPT ); Tue, 7 Jun 2022 17:08:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18B75212C9F; Tue, 7 Jun 2022 11:50:50 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id ED63D616B6; Tue, 7 Jun 2022 18:50:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3FFBC385A2; Tue, 7 Jun 2022 18:50:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627849; bh=Dif+QLRgomHeNwIGglbOydkrFgua16Gw8/jn/i5m3BU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WAOT9/XrZfUK4iqHJhOWHafgZnxVRHBr+Ck55+DdkMwcz2H3RfrLZBZ8zWN7jDcgk /+C2K7E/4rYbqFqexHAZehArOe+1U004Pak3nC6k3Uo6SLIucuhakXtxvAgyM4U/Cy H3eJcdM+4EiA53nVMB+b3Q0a9rIhgLx9n7QMxOxI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vignesh Raghavendra , Aswath Govindraju , Ulf Hansson , Sasha Levin Subject: [PATCH 5.18 108/879] drivers: mmc: sdhci_am654: Add the quirk to set TESTCD bit Date: Tue, 7 Jun 2022 18:53:46 +0200 Message-Id: <20220607165005.832701868@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vignesh Raghavendra [ Upstream commit c7666240ec76422cb7546bd07cc8ae80dc0ccdd2 ] The ARASAN MMC controller on Keystone 3 class of devices need the SDCD line to be connected for proper functioning. Similar to the issue pointed out in sdhci-of-arasan.c driver, commit 3794c542641f ("mmc: sdhci-of-arasan: Set controller to test mode when no CD bit"). In cases where this can't be connected, add a quirk to force the controller into test mode and set the TESTCD bit. Use the flag "ti,fails-without-test-cd", to implement this above quirk when required. Signed-off-by: Vignesh Raghavendra Signed-off-by: Aswath Govindraju Link: https://lore.kernel.org/r/20220425063120.10135-3-a-govindraju@ti.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/host/sdhci_am654.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c index e54fe24d47e7..e7ced1496a07 100644 --- a/drivers/mmc/host/sdhci_am654.c +++ b/drivers/mmc/host/sdhci_am654.c @@ -147,6 +147,9 @@ struct sdhci_am654_data { int drv_strength; int strb_sel; u32 flags; + u32 quirks; + +#define SDHCI_AM654_QUIRK_FORCE_CDTEST BIT(0) }; struct sdhci_am654_driver_data { @@ -369,6 +372,21 @@ static void sdhci_am654_write_b(struct sdhci_host *host, u8 val, int reg) } } +static void sdhci_am654_reset(struct sdhci_host *host, u8 mask) +{ + u8 ctrl; + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + struct sdhci_am654_data *sdhci_am654 = sdhci_pltfm_priv(pltfm_host); + + sdhci_reset(host, mask); + + if (sdhci_am654->quirks & SDHCI_AM654_QUIRK_FORCE_CDTEST) { + ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL); + ctrl |= SDHCI_CTRL_CDTEST_INS | SDHCI_CTRL_CDTEST_EN; + sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL); + } +} + static int sdhci_am654_execute_tuning(struct mmc_host *mmc, u32 opcode) { struct sdhci_host *host = mmc_priv(mmc); @@ -500,7 +518,7 @@ static struct sdhci_ops sdhci_j721e_4bit_ops = { .set_clock = sdhci_j721e_4bit_set_clock, .write_b = sdhci_am654_write_b, .irq = sdhci_am654_cqhci_irq, - .reset = sdhci_reset, + .reset = sdhci_am654_reset, }; static const struct sdhci_pltfm_data sdhci_j721e_4bit_pdata = { @@ -719,6 +737,9 @@ static int sdhci_am654_get_of_property(struct platform_device *pdev, device_property_read_u32(dev, "ti,clkbuf-sel", &sdhci_am654->clkbuf_sel); + if (device_property_read_bool(dev, "ti,fails-without-test-cd")) + sdhci_am654->quirks |= SDHCI_AM654_QUIRK_FORCE_CDTEST; + sdhci_get_of_property(pdev); return 0; -- 2.35.1