From patchwork Fri Jan 13 11:00:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 643060 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26C07C54EBD for ; Fri, 13 Jan 2023 11:10:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240879AbjAMLKx (ORCPT ); Fri, 13 Jan 2023 06:10:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241317AbjAMLKG (ORCPT ); Fri, 13 Jan 2023 06:10:06 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D69AF77AEE for ; Fri, 13 Jan 2023 03:00:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673607637; x=1705143637; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=u7icSX8co7YNefhoq2bVjeWRjx7aROHk+WySj5qOh/Q=; b=InNsNfyPQMqSa7CH0ZGdno+gsigBcRqsfW70izMXzyzb6c+zF45pxts2 nJwY8yYWzvMJiBbS3r89Hcxg9cHlzn0KjdVcVmWLmo1Hx3mPaAKH93c2M JoYlolcUZxs8LEgI65wlz1W92VI04ATSfSoBFztkSiL9R68RgppnM6wZb kBTZf99ba2+N4LWOSlN+P+MHdls5dvq7CljuiWFVd5INTGLOqzU/JIeKp b/ze+K6t24D6aWu142RUBROfjKluc0wiI57gcVJ2Y116eTV+UzVqnza/Z kk7+8RFMCkNtnndJNivQwhk5sf4azcQXg+oAAHZVH7OzbvKmOfteyqE4h Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="322668299" X-IronPort-AV: E=Sophos;i="5.97,213,1669104000"; d="scan'208";a="322668299" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2023 03:00:37 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="690471787" X-IronPort-AV: E=Sophos;i="5.97,213,1669104000"; d="scan'208";a="690471787" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.38.178]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2023 03:00:33 -0800 From: Adrian Hunter To: Ulf Hansson Cc: Kamal Dasu , Al Cooper , Florian Fainelli , Orson Zhai , Baolin Wang , Chunyan Zhang , Ray Jui , Scott Branden , Jisheng Zhang , Marek Vasut , linux-mmc@vger.kernel.org Subject: [PATCH 1/6] mmc: sdhci-pci: Replace SDHCI_QUIRK_MISSING_CAPS for Ricoh controller Date: Fri, 13 Jan 2023 13:00:06 +0200 Message-Id: <20230113110011.129835-2-adrian.hunter@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230113110011.129835-1-adrian.hunter@intel.com> References: <20230113110011.129835-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org SDHCI_QUIRK_MISSING_CAPS is not needed because __sdhci_read_caps() can be called instead. In preparation to get rid of SDHCI_QUIRK_MISSING_CAPS, replace SDHCI_QUIRK_MISSING_CAPS with __sdhci_read_caps() for Ricoh SDHCI controller. __sdhci_read_caps() is also called from sdhci_setup_host() via sdhci_read_caps(), however only the first call to __sdhci_read_caps() does anything because after that host->read_caps has been set to true. Note, __sdhci_read_caps() does more than just set host->caps, such as do a reset, so calling __sdhci_read_caps() earlier could have unforeseen side-effects. However the code flow has been reviewed with that in mind. Signed-off-by: Adrian Hunter --- drivers/mmc/host/sdhci-pci-core.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c index c359f867df0a..01975d145200 100644 --- a/drivers/mmc/host/sdhci-pci-core.c +++ b/drivers/mmc/host/sdhci-pci-core.c @@ -251,13 +251,16 @@ static int ricoh_probe(struct sdhci_pci_chip *chip) static int ricoh_mmc_probe_slot(struct sdhci_pci_slot *slot) { - slot->host->caps = + u32 caps = FIELD_PREP(SDHCI_TIMEOUT_CLK_MASK, 0x21) | FIELD_PREP(SDHCI_CLOCK_BASE_MASK, 0x21) | SDHCI_TIMEOUT_CLK_UNIT | SDHCI_CAN_VDD_330 | SDHCI_CAN_DO_HISPD | SDHCI_CAN_DO_SDMA; + u32 caps1 = 0; + + __sdhci_read_caps(slot->host, NULL, &caps, &caps1); return 0; } @@ -286,8 +289,7 @@ static const struct sdhci_pci_fixes sdhci_ricoh_mmc = { #endif .quirks = SDHCI_QUIRK_32BIT_DMA_ADDR | SDHCI_QUIRK_CLOCK_BEFORE_RESET | - SDHCI_QUIRK_NO_CARD_NO_RESET | - SDHCI_QUIRK_MISSING_CAPS + SDHCI_QUIRK_NO_CARD_NO_RESET, }; static void ene_714_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) From patchwork Fri Jan 13 11:00:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 642388 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C107C61DB3 for ; Fri, 13 Jan 2023 11:10:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241293AbjAMLKy (ORCPT ); Fri, 13 Jan 2023 06:10:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241313AbjAMLKH (ORCPT ); Fri, 13 Jan 2023 06:10:07 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F36BC7CDFE for ; Fri, 13 Jan 2023 03:00:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673607641; x=1705143641; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8Fhnj7G/UOKooAX4JYNOGdm+eaoJypN+V+gbWvMEyUE=; b=PlrBMwBT2ApWgu0nZANc0HihCddqjhHuFoL2dduPYi4ewj/p8U3C6rIg 55UL6bBFMrCSy8RtbmY+LdQbbCEwEtleXSVYiDv4oI/WgGk/GhXkPVne1 ZynRWWFdZs1QxWjvdGmLNTRb9BNAlF9oNoJ/LFVum1dcH4WI8Z14ZFdfV eRnIefxN5Ur4qsLfX1z+sr2KEu9ZdYLb6EKrBxukU5MVLEH8oZ5s8p6Fz BLeaK34G9+3KdpkuzSSCZW/kEAqAaS9oZuCxhw3r/J5tPOyRU7mTA/PmB CP6CWMsaWyB5V97OG+PtnJCiXGvjuIe8gdA2D0bfG7YPm/PFu3A7P5LW4 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="322668319" X-IronPort-AV: E=Sophos;i="5.97,213,1669104000"; d="scan'208";a="322668319" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2023 03:00:40 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="690471933" X-IronPort-AV: E=Sophos;i="5.97,213,1669104000"; d="scan'208";a="690471933" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.38.178]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2023 03:00:36 -0800 From: Adrian Hunter To: Ulf Hansson Cc: Kamal Dasu , Al Cooper , Florian Fainelli , Orson Zhai , Baolin Wang , Chunyan Zhang , Ray Jui , Scott Branden , Jisheng Zhang , Marek Vasut , linux-mmc@vger.kernel.org Subject: [PATCH 2/6] mmc: sdhci-brcmstb: Replace SDHCI_QUIRK_MISSING_CAPS Date: Fri, 13 Jan 2023 13:00:07 +0200 Message-Id: <20230113110011.129835-3-adrian.hunter@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230113110011.129835-1-adrian.hunter@intel.com> References: <20230113110011.129835-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org SDHCI_QUIRK_MISSING_CAPS is not needed because sdhci_read_caps() can be called instead. In preparation to get rid of SDHCI_QUIRK_MISSING_CAPS, replace SDHCI_QUIRK_MISSING_CAPS with sdhci_read_caps(). __sdhci_read_caps() is also called from sdhci_setup_host() via sdhci_read_caps(), however only the first call to __sdhci_read_caps() does anything because after that host->read_caps has been set to true. Note, __sdhci_read_caps() does more than just set host->caps, such as do a reset, so calling __sdhci_read_caps() earlier could have unforeseen side-effects. However the code flow has been reviewed with that in mind. Signed-off-by: Adrian Hunter --- drivers/mmc/host/sdhci-brcmstb.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c index f2cf3d70db79..0a19b7af1d41 100644 --- a/drivers/mmc/host/sdhci-brcmstb.c +++ b/drivers/mmc/host/sdhci-brcmstb.c @@ -324,13 +324,11 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev) * will allow these modes to be specified by device tree * properties through mmc_of_parse(). */ - host->caps = sdhci_readl(host, SDHCI_CAPABILITIES); + sdhci_read_caps(host); if (match_priv->flags & BRCMSTB_MATCH_FLAGS_NO_64BIT) host->caps &= ~SDHCI_CAN_64BIT; - host->caps1 = sdhci_readl(host, SDHCI_CAPABILITIES_1); host->caps1 &= ~(SDHCI_SUPPORT_SDR50 | SDHCI_SUPPORT_SDR104 | SDHCI_SUPPORT_DDR50); - host->quirks |= SDHCI_QUIRK_MISSING_CAPS; if (match_priv->flags & BRCMSTB_MATCH_FLAGS_BROKEN_TIMEOUT) host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; From patchwork Fri Jan 13 11:00:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 643059 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3E25C678D6 for ; Fri, 13 Jan 2023 11:10:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241313AbjAMLKz (ORCPT ); Fri, 13 Jan 2023 06:10:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241253AbjAMLKI (ORCPT ); Fri, 13 Jan 2023 06:10:08 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 650D77D1C1 for ; Fri, 13 Jan 2023 03:00:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673607644; x=1705143644; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=D3SqguNzX+3VW6pOioMW7TUyxk3Lp+po6nRGspEnfxQ=; b=l/4/rLNcLU4/auVXYvsftEA0ohX9jXGu/wEA0tw3w/pT804v6vr0YT9m Zruxf0+VVGNDHjUzgcnhe5zaw5WVysW9GYN2GYc7GLMWOEKB46XsJYblI F3dTggUa+Y+fY8TpRTcRwAavQmA1Jzm9jsKj0daaMgG3Ni4PwW30qKlwh K0Ly4OZdOIYUB7xGarpgDdoZAtQ6DVfxBGbSCO9t4JUEzwgDS1UcK8yRJ AwoXpWxmEQXghLoevZdZ/SR4tKvZfzbW/Q66pMWwQaBn4UQ4j6iiOCINY baIELwmdlLat3G7b2gbEF+eOK/2UCoYzyPzpAcZcYKZRndCtjQQx+CAIg g==; X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="322668348" X-IronPort-AV: E=Sophos;i="5.97,213,1669104000"; d="scan'208";a="322668348" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2023 03:00:44 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="690472114" X-IronPort-AV: E=Sophos;i="5.97,213,1669104000"; d="scan'208";a="690472114" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.38.178]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2023 03:00:40 -0800 From: Adrian Hunter To: Ulf Hansson Cc: Kamal Dasu , Al Cooper , Florian Fainelli , Orson Zhai , Baolin Wang , Chunyan Zhang , Ray Jui , Scott Branden , Jisheng Zhang , Marek Vasut , linux-mmc@vger.kernel.org Subject: [PATCH 3/6] mmc: sdhci-sprd: Replace SDHCI_QUIRK_MISSING_CAPS Date: Fri, 13 Jan 2023 13:00:08 +0200 Message-Id: <20230113110011.129835-4-adrian.hunter@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230113110011.129835-1-adrian.hunter@intel.com> References: <20230113110011.129835-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org SDHCI_QUIRK_MISSING_CAPS is not needed because sdhci_read_caps() can be called instead. In preparation to get rid of SDHCI_QUIRK_MISSING_CAPS, replace SDHCI_QUIRK_MISSING_CAPS with sdhci_read_caps(). __sdhci_read_caps() is also called from sdhci_setup_host() via sdhci_read_caps(), however only the first call to __sdhci_read_caps() does anything because after that host->read_caps has been set to true. Note, __sdhci_read_caps() does more than just set host->caps, such as do a reset, so calling __sdhci_read_caps() earlier could have unforeseen side-effects. However the code flow has been reviewed with that in mind. Signed-off-by: Adrian Hunter Acked-by: Chunyan Zhang --- drivers/mmc/host/sdhci-sprd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/host/sdhci-sprd.c b/drivers/mmc/host/sdhci-sprd.c index 525f979e2a97..7f4ee2e12735 100644 --- a/drivers/mmc/host/sdhci-sprd.c +++ b/drivers/mmc/host/sdhci-sprd.c @@ -553,8 +553,7 @@ static void sdhci_sprd_phy_param_parse(struct sdhci_sprd_host *sprd_host, static const struct sdhci_pltfm_data sdhci_sprd_pdata = { .quirks = SDHCI_QUIRK_BROKEN_CARD_DETECTION | - SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | - SDHCI_QUIRK_MISSING_CAPS, + SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK, .quirks2 = SDHCI_QUIRK2_BROKEN_HS200 | SDHCI_QUIRK2_USE_32BIT_BLK_CNT | SDHCI_QUIRK2_PRESET_VALUE_BROKEN, @@ -671,8 +670,7 @@ static int sdhci_sprd_probe(struct platform_device *pdev) * will allow these modes to be specified only by device * tree properties through mmc_of_parse(). */ - host->caps = sdhci_readl(host, SDHCI_CAPABILITIES); - host->caps1 = sdhci_readl(host, SDHCI_CAPABILITIES_1); + sdhci_read_caps(host); host->caps1 &= ~(SDHCI_SUPPORT_SDR50 | SDHCI_SUPPORT_SDR104 | SDHCI_SUPPORT_DDR50); From patchwork Fri Jan 13 11:00:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 642387 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF877C54EBD for ; Fri, 13 Jan 2023 11:11:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241328AbjAMLK7 (ORCPT ); Fri, 13 Jan 2023 06:10:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233011AbjAMLKP (ORCPT ); Fri, 13 Jan 2023 06:10:15 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEDFF7D1D4 for ; Fri, 13 Jan 2023 03:00:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673607647; x=1705143647; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3XlDg7FdYzlLZCC+U+RKk2mb2sZwZnoSQsmG9K6Q4wI=; b=O6Y4Lja1gVrWHh/MdO3HqWjFEHpWO1y8PcR1A1xYtosKsXZIslZXo/3+ EPy4G5dTTEHGdNLGbEBp0K2N9QGoDGlGDXxRd4Qm3oeujFvCbDOi5uXMJ 3nzxVBlQ0pqDOcoLoXoVpSbmBLpteXgC9tqlTYFTR+XK0JGQOV7q673H4 33Oo5bMIIeySIhI7QbQVPZfx0t5N+DQSYWxKhuF0n5M9aXXLVTVpwOsjT 8aWmG5E0QTz5e+oDmUArPXjBUpqLvGCP2xQP0r10ebkWQ27UBXUShucI5 RHUBaVVenI3+G2l91irzBOWO8IbiIA0HDSB/2SpIvL6H1n4Z+b9QkW/Ln Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="322668361" X-IronPort-AV: E=Sophos;i="5.97,213,1669104000"; d="scan'208";a="322668361" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2023 03:00:47 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="690472289" X-IronPort-AV: E=Sophos;i="5.97,213,1669104000"; d="scan'208";a="690472289" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.38.178]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2023 03:00:44 -0800 From: Adrian Hunter To: Ulf Hansson Cc: Kamal Dasu , Al Cooper , Florian Fainelli , Orson Zhai , Baolin Wang , Chunyan Zhang , Ray Jui , Scott Branden , Jisheng Zhang , Marek Vasut , linux-mmc@vger.kernel.org Subject: [PATCH 4/6] mmc: sdhci-pxav3: Replace SDHCI_QUIRK_MISSING_CAPS Date: Fri, 13 Jan 2023 13:00:09 +0200 Message-Id: <20230113110011.129835-5-adrian.hunter@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230113110011.129835-1-adrian.hunter@intel.com> References: <20230113110011.129835-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org SDHCI_QUIRK_MISSING_CAPS is not needed because sdhci_read_caps() can be called instead. In preparation to get rid of SDHCI_QUIRK_MISSING_CAPS, replace SDHCI_QUIRK_MISSING_CAPS with sdhci_read_caps(). __sdhci_read_caps() is also called from sdhci_setup_host() via sdhci_read_caps(), however only the first call to __sdhci_read_caps() does anything because after that host->read_caps has been set to true. Note, __sdhci_read_caps() does more than just set host->caps, such as do a reset, so calling __sdhci_read_caps() earlier could have unforeseen side-effects. However the code flow has been reviewed with that in mind. Signed-off-by: Adrian Hunter Reviewed-by: Jisheng Zhang --- drivers/mmc/host/sdhci-pxav3.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c index a6d89a3f1946..e39dcc998772 100644 --- a/drivers/mmc/host/sdhci-pxav3.c +++ b/drivers/mmc/host/sdhci-pxav3.c @@ -124,10 +124,8 @@ static int armada_38x_quirks(struct platform_device *pdev, struct resource *res; host->quirks &= ~SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN; - host->quirks |= SDHCI_QUIRK_MISSING_CAPS; - host->caps = sdhci_readl(host, SDHCI_CAPABILITIES); - host->caps1 = sdhci_readl(host, SDHCI_CAPABILITIES_1); + sdhci_read_caps(host); res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "conf-sdio3"); From patchwork Fri Jan 13 11:00:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 643058 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 404FBC54EBE for ; Fri, 13 Jan 2023 11:11:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241343AbjAMLLA (ORCPT ); Fri, 13 Jan 2023 06:11:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239755AbjAMLKQ (ORCPT ); Fri, 13 Jan 2023 06:10:16 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A2027D1D5 for ; Fri, 13 Jan 2023 03:00:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673607651; x=1705143651; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Si8c+66kN4FiqyfNlQp5C3RRW/EGmd1cUu6ShfurEDU=; b=IUn2h2QcfQ4rrXqS+QNaI3iMv+yUAdqsDk9ATiqwsGScI1+Pb/yc8aY+ 7Evm+ra+QXHuwpwWngXd8Rx3/nLgducO4y7Otc1G6rfn1C5Wxz9FFcCV8 SWirvds6DJE1BYq9Ps43l4VjqWpPoeNG+GmtXCvFQt/btFVlNYeHb+3/J sF32N0oTDZCo1SzgMItymxn1iNE7m4L+knOULS5HGUF0z/YxVHU/BfDVW 1x6P2mU1XZBV+q11WVWHX0KqGAJ8PDLWExQ6thLMx6CEjB0NZw37gTeZr d8YeoMSTpqRFt2JWamqiHw5Y3w+H13K9CJfVX/5CCNFZUd5ES6Rauyj1h A==; X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="322668380" X-IronPort-AV: E=Sophos;i="5.97,213,1669104000"; d="scan'208";a="322668380" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2023 03:00:51 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="690472492" X-IronPort-AV: E=Sophos;i="5.97,213,1669104000"; d="scan'208";a="690472492" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.38.178]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2023 03:00:47 -0800 From: Adrian Hunter To: Ulf Hansson Cc: Kamal Dasu , Al Cooper , Florian Fainelli , Orson Zhai , Baolin Wang , Chunyan Zhang , Ray Jui , Scott Branden , Jisheng Zhang , Marek Vasut , linux-mmc@vger.kernel.org Subject: [PATCH 5/6] mmc: sdhci-iproc: Replace SDHCI_QUIRK_MISSING_CAPS Date: Fri, 13 Jan 2023 13:00:10 +0200 Message-Id: <20230113110011.129835-6-adrian.hunter@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230113110011.129835-1-adrian.hunter@intel.com> References: <20230113110011.129835-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org SDHCI_QUIRK_MISSING_CAPS is not needed because __sdhci_read_caps() can be called instead. In preparation to get rid of SDHCI_QUIRK_MISSING_CAPS, replace SDHCI_QUIRK_MISSING_CAPS with __sdhci_read_caps(). __sdhci_read_caps() is also called from sdhci_setup_host() via sdhci_read_caps(), however only the first call to __sdhci_read_caps() does anything because after that host->read_caps has been set to true. Note, __sdhci_read_caps() does more than just set host->caps, such as do a reset, so calling __sdhci_read_caps() earlier could have unforeseen side-effects. However the code flow has been reviewed with that in mind. Signed-off-by: Adrian Hunter --- drivers/mmc/host/sdhci-iproc.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c index 6db35b1b8557..86eb0045515e 100644 --- a/drivers/mmc/host/sdhci-iproc.c +++ b/drivers/mmc/host/sdhci-iproc.c @@ -18,6 +18,7 @@ struct sdhci_iproc_data { u32 caps; u32 caps1; u32 mmc_caps; + bool missing_caps; }; struct sdhci_iproc_host { @@ -251,7 +252,6 @@ static const struct sdhci_iproc_data iproc_data = { static const struct sdhci_pltfm_data sdhci_bcm2835_pltfm_data = { .quirks = SDHCI_QUIRK_BROKEN_CARD_DETECTION | SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | - SDHCI_QUIRK_MISSING_CAPS | SDHCI_QUIRK_NO_HISPD_BIT, .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN, .ops = &sdhci_iproc_32only_ops, @@ -266,6 +266,7 @@ static const struct sdhci_iproc_data bcm2835_data = { .caps1 = SDHCI_DRIVER_TYPE_A | SDHCI_DRIVER_TYPE_C, .mmc_caps = 0x00000000, + .missing_caps = true, }; static const struct sdhci_ops sdhci_iproc_bcm2711_ops = { @@ -295,8 +296,7 @@ static const struct sdhci_iproc_data bcm2711_data = { }; static const struct sdhci_pltfm_data sdhci_bcm7211a0_pltfm_data = { - .quirks = SDHCI_QUIRK_MISSING_CAPS | - SDHCI_QUIRK_BROKEN_TIMEOUT_VAL | + .quirks = SDHCI_QUIRK_BROKEN_TIMEOUT_VAL | SDHCI_QUIRK_BROKEN_DMA | SDHCI_QUIRK_BROKEN_ADMA, .ops = &sdhci_iproc_ops, @@ -315,6 +315,7 @@ static const struct sdhci_iproc_data bcm7211a0_data = { SDHCI_CAN_DO_HISPD, .caps1 = SDHCI_DRIVER_TYPE_C | SDHCI_DRIVER_TYPE_D, + .missing_caps = true, }; static const struct of_device_id sdhci_iproc_of_match[] = { @@ -397,9 +398,10 @@ static int sdhci_iproc_probe(struct platform_device *pdev) } } - if (iproc_host->data->pdata->quirks & SDHCI_QUIRK_MISSING_CAPS) { - host->caps = iproc_host->data->caps; - host->caps1 = iproc_host->data->caps1; + if (iproc_host->data->missing_caps) { + __sdhci_read_caps(host, NULL, + &iproc_host->data->caps, + &iproc_host->data->caps1); } ret = sdhci_add_host(host); From patchwork Fri Jan 13 11:00:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 642386 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 670E2C54EBD for ; Fri, 13 Jan 2023 11:11:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240500AbjAMLLG (ORCPT ); Fri, 13 Jan 2023 06:11:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240890AbjAMLKR (ORCPT ); Fri, 13 Jan 2023 06:10:17 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6A18F6E for ; Fri, 13 Jan 2023 03:00:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673607656; x=1705143656; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zaHociYB0QKxVlKBlSd1bKhqV0y1GCdavM8LWIOx4eU=; b=W1w499pJ6Hu99CG6Tvqfdi0EpzY760pD6hGnVJINw3D1ttVr20VpvCbH Tg7MWcJc3xBOP9HKt44BmJipSfS4AFGZW8yXZbrL27G3wj+xBmOlJhR3o hF/DK/SASzb/qhgvaZBQWHCuwpEjejjjTi41JyewuwvY9PtvXBd5YfslY 9NJXsZKMSOpf3nXxc2AMFhZIDrNqxFq3XA5WIMJ8ljaZEWz7iYuw6XOAr SYNxcTmsBvIp2TcQaIUbOIUju+Q+umZTzzhd+U0HTc22B5aV/W/dcl5UB YYIRZsjf1sufDmWVkR9ZD6D4krPEKAuehPhSJehPuHEUAZWC6dkkhW/Y6 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="322668412" X-IronPort-AV: E=Sophos;i="5.97,213,1669104000"; d="scan'208";a="322668412" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2023 03:00:55 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="690472696" X-IronPort-AV: E=Sophos;i="5.97,213,1669104000"; d="scan'208";a="690472696" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.38.178]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2023 03:00:51 -0800 From: Adrian Hunter To: Ulf Hansson Cc: Kamal Dasu , Al Cooper , Florian Fainelli , Orson Zhai , Baolin Wang , Chunyan Zhang , Ray Jui , Scott Branden , Jisheng Zhang , Marek Vasut , linux-mmc@vger.kernel.org Subject: [PATCH 6/6] mmc: sdhci: Remove SDHCI_QUIRK_MISSING_CAPS Date: Fri, 13 Jan 2023 13:00:11 +0200 Message-Id: <20230113110011.129835-7-adrian.hunter@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230113110011.129835-1-adrian.hunter@intel.com> References: <20230113110011.129835-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Now that it is no longer used, remove SDHCI_QUIRK_MISSING_CAPS. Note, from now on, __sdhci_read_caps() should be used to provide missing capability flags. Signed-off-by: Adrian Hunter --- drivers/mmc/host/sdhci.c | 3 --- drivers/mmc/host/sdhci.h | 2 -- 2 files changed, 5 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index f3af1bd0f7b9..3241916141d7 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -4121,9 +4121,6 @@ void __sdhci_read_caps(struct sdhci_host *host, const u16 *ver, v = ver ? *ver : sdhci_readw(host, SDHCI_HOST_VERSION); host->version = (v & SDHCI_SPEC_VER_MASK) >> SDHCI_SPEC_VER_SHIFT; - if (host->quirks & SDHCI_QUIRK_MISSING_CAPS) - return; - if (caps) { host->caps = *caps; } else { diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 605eaee805f7..f4f2085c274c 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -423,8 +423,6 @@ struct sdhci_host { #define SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN (1<<25) /* Controller cannot support End Attribute in NOP ADMA descriptor */ #define SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC (1<<26) -/* Controller is missing device caps. Use caps provided by host */ -#define SDHCI_QUIRK_MISSING_CAPS (1<<27) /* Controller uses Auto CMD12 command to stop the transfer */ #define SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 (1<<28) /* Controller doesn't have HISPD bit field in HI-SPEED SD card */