Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2176859iof; Tue, 7 Jun 2022 22:16:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhJtiW6t4ocCf1RdihFdBBtireG3hBzC5tZQ4C2LF16LqBBFF2kznfKE76lb+bC+67NRMz X-Received: by 2002:a05:6a00:1989:b0:519:133c:737e with SMTP id d9-20020a056a00198900b00519133c737emr33469295pfl.26.1654665363256; Tue, 07 Jun 2022 22:16:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654665363; cv=none; d=google.com; s=arc-20160816; b=IWcPNNTRYg943CHjP/5/oIXUZ5KwB1hS/C3CaWF7Qy1m/E3GIpUMbVvDpt6yMATT0f HwMkSKpu3qFKYHAqrTejen+pVWtthEZwOtXbNOw14DqP5nO9VbvYEpebhTWEfFb34/4K U4rlRQ0hjmCKBtlhsV4xWwOtPweNT/+wCMKi59kLXB+HmM1/3IkxP4YPQvSprw7/Aive RqYGAxJ+zYM6AA4+4b/Nd6WfHqmPn29wxpIapUoI9R6wW/Ec0NelYxmLhNx5UeN7FoQ2 a3/1SZbyeZt6DF5ehGYHx6UupiCHxV6PGjZ1FdystDJu3mrnGBZHyrHIi2Idukp6BEU8 Onkg== 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=i/awGKR7YFVLikfJQkiDsVqUbTsPwjGxH+uT6Cttivo=; b=IpBqKzqqmYAecFz4+xY+AgikeHaPL6n3x8MbrfSWMTTDgLczIDmlJR5KOtl5ZPQjOg 39dUsPatv8t7P7WVKVmn7AAmLqPD68acvxFnMongLz38MfAp3D0pKXHDPfL2OSk3lX8Y SPRosI87grB+aG+Scp3KAXWw+uw9uwwhiaovRvvmyiE16bS/57mFUjENIFl7JFFZT2bN IgdWyW1iu6P02PpxCXRu7Ppeeso2dFiboBMQ6enY04JTnHSUgdC9v5nuqHX/UgXCaJBs h7MSUbJPFvfYSYic4/FIRfirm6/IqsUJlwwo5IR0q0/Qej/j+5nKuHaLrA+PqnFALGO0 Dr5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0Noudqpd; 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 b8-20020a056a00114800b0051bf4952487si16705292pfm.101.2022.06.07.22.16.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:16:03 -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=0Noudqpd; 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 67DED4683B6; Tue, 7 Jun 2022 21:45:32 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346148AbiFGRWp (ORCPT + 99 others); Tue, 7 Jun 2022 13:22:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346062AbiFGRUQ (ORCPT ); Tue, 7 Jun 2022 13:20:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62EDF1059C9; Tue, 7 Jun 2022 10:20:14 -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 4B18D615D1; Tue, 7 Jun 2022 17:20:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F545C385A5; Tue, 7 Jun 2022 17:20:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654622411; bh=HNytHS3bxqCOXMxDzMBLrIaw03gY24xaeS8ZM9yxTB0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0NoudqpdSk439jqh55ZA5chh7EFNWy8bFT+frv6CIbXxpNgdbXPp1nlS281/z1LKr nF2D3j/6NthZPu9ALwPllt6c1ILs+J64Jy3Dc7oQcdyTK+fVjiiStke8CcmMUhFUXY CLC1odJfQKKuVtZgZvGWV2phvMWJA0Nc7mzwoKfI= 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.10 049/452] drivers: mmc: sdhci_am654: Add the quirk to set TESTCD bit Date: Tue, 7 Jun 2022 18:58:26 +0200 Message-Id: <20220607164910.011118838@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164908.521895282@linuxfoundation.org> References: <20220607164908.521895282@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 a64ea143d185..7cab9d831afb 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