Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp2599121pxb; Mon, 18 Apr 2022 04:29:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweSoDZMmGvzoVNAXOgKuD+PB05e8TQIVtEzI0bHiBzIdZsAj9+bN9xap1R2Ydat4A9kXLJ X-Received: by 2002:a65:418b:0:b0:382:250b:4dda with SMTP id a11-20020a65418b000000b00382250b4ddamr10041598pgq.428.1650281356973; Mon, 18 Apr 2022 04:29:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650281356; cv=none; d=google.com; s=arc-20160816; b=lW3CgfqfaE1PI0OUfV/2GndJDjn/JrGRhWoJnn+uWz3Ub80hfvl6pxpK68Bu7ULFz7 4GhXuyhOHuX6XPV08FmzOIL9Ezz0aUDoEY/4jsZKxdYwGK8BcfZ323uEY/048CZeT0GC COffDQdXAKp42cHx4HjxqikghjoUQLWve0rIrb8J0/nJgMfXkIPi5DYGkO7FRBnASon1 MsybZRINwH0HhfVS7zthwurIcV1utq461hE+Kd0tnyqzDfMiOLFW/gxB5OqLgiW3LRYH VytJPEYvtkxrZb92ZATirVHSWfVmyVOGDadzBoo3vBCGHg2cHg30VobgPuzLKiQSgCcS HyAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:mime-version:references:in-reply-to :message-id:date:subject:cc:from:dkim-signature; bh=5vlzWnykhMTqczae+yu/fb/SoPEuuYZhc9mFRVH1Lro=; b=ioThHWyy+3XzVMaJQj8gVzZCCnew7oEgIgNJEl71C0BaoZSepCPc9hCdotLY1+886m v+5zs3RS5OqKrox/ThIDFnDjSkkhu8WW6O9HDaHq/leZjA83OHqjegs3F0JnGE8lXHek dkrDwbgqrmDzBzbLldSnvc+gtRNTDm+HD1gXRe6AYLzu3XSJvEj2BCGUIvBBKQC0rfVd zvOkO83vEGS1KdFzD6rXP2Sx585Gd0kRC+33PnZHLYx7ypq+EL+F047vDJa+PlocPR5r lhw9ceAWA5Jn55R+u/+VNrqIYFHgpiL608RW9w2Mh6m5NVVbroiqc8+EVzI0kxp0x4DD gD5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ti.com header.s=ti-com-17Q1 header.b=u9tmqR2k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r6-20020a056a00216600b004fa3a8e00c0si8105825pff.375.2022.04.18.04.29.02; Mon, 18 Apr 2022 04:29:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@ti.com header.s=ti-com-17Q1 header.b=u9tmqR2k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237677AbiDRKXv (ORCPT + 99 others); Mon, 18 Apr 2022 06:23:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237660AbiDRKXm (ORCPT ); Mon, 18 Apr 2022 06:23:42 -0400 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F161913E2A; Mon, 18 Apr 2022 03:21:03 -0700 (PDT) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 23IAL01b036713; Mon, 18 Apr 2022 05:21:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1650277260; bh=5vlzWnykhMTqczae+yu/fb/SoPEuuYZhc9mFRVH1Lro=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=u9tmqR2ke8Q9Od47uSx9YIuT8wGMdf7a2yIr6Z5TEIN+n/8V/TUEwAyAwmCyuBk+t xOVkUu0V5H4JpFXxfPdoDPUbzucvOl9Wc+CE17smusDEYK7V7H4oVTgk3UlC8/R+6e BqGvTAfCs9tLlL54/bOEtbQ+eSeIL4Wh4S/t4ZCI= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 23IAL0Ol070574 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 18 Apr 2022 05:21:00 -0500 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Mon, 18 Apr 2022 05:21:00 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14 via Frontend Transport; Mon, 18 Apr 2022 05:21:00 -0500 Received: from gsaswath-HP-ProBook-640-G5.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 23IAKgTa021324; Mon, 18 Apr 2022 05:20:57 -0500 From: Aswath Govindraju CC: Vignesh Raghavendra , Kishon Vijay Abraham I , Aswath Govindraju , Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Adrian Hunter , , , Subject: [PATCH 2/2] drivers: mmc: sdhci_am654: Add the quirk to set TESTCD bit Date: Mon, 18 Apr 2022 15:50:40 +0530 Message-ID: <20220418102040.4993-3-a-govindraju@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220418102040.4993-1-a-govindraju@ti.com> References: <20220418102040.4993-1-a-govindraju@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vignesh Raghavendra 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 --- 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..c36b969ed1b6 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) } } +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.17.1