From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752549AbcJFGnz (ORCPT ); Thu, 6 Oct 2016 02:43:55 -0400 Received: from mga03.intel.com ([134.134.136.65]:46711 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751772AbcJFGny (ORCPT ); Thu, 6 Oct 2016 02:43:54 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,452,1473145200"; d="scan'208";a="1061143159" Subject: Re: [RFC 2/2] sdhci: Prevent SD from doing highspeed timing when sd-broken-highspeed property is set To: Zach Brown , ulf.hansson@linaro.org References: <1474660869-15532-1-git-send-email-zach.brown@ni.com> <1474660869-15532-3-git-send-email-zach.brown@ni.com> Cc: robh+dt@kernel.org, mark.rutland@arm.com, linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <22930ee3-7de9-64b6-d133-283b87ff0eaf@intel.com> Date: Thu, 6 Oct 2016 09:39:05 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1474660869-15532-3-git-send-email-zach.brown@ni.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23/09/16 23:01, Zach Brown wrote: > From: Chen Yee Chew > > When the sd-broken-highspeed property is set the sdhci driver will not > go into highspeed mode even if the controller and card appear to > otherwise support highspeed mode. > > This is useful in cases where the controller and card support highspeed, > but the board configuration or some other issue make highspeed > impossible. > > Signed-off-by: Chen Yee Chew > Reviewed-by: Keng Soon Cheah > Reviewed-by: Joe Hershberger > Signed-off-by: Zach Brown > --- > drivers/mmc/host/sdhci-pltfm.c | 3 +++ > drivers/mmc/host/sdhci.c | 3 ++- > drivers/mmc/host/sdhci.h | 2 ++ > 3 files changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c > index ad49bfa..7482706 100644 > --- a/drivers/mmc/host/sdhci-pltfm.c > +++ b/drivers/mmc/host/sdhci-pltfm.c > @@ -87,6 +87,9 @@ void sdhci_get_of_property(struct platform_device *pdev) > if (of_get_property(np, "broken-cd", NULL)) > host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION; > > + if (of_get_property(np, "sd-broken-highspeed", NULL)) > + host->quirks2 |= SDHCI_QUIRK2_BROKEN_HISPD; > + We don't really want new quirks. > if (of_get_property(np, "no-1-8-v", NULL)) > host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V; > > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c > index 4805566..4b0969c 100644 > --- a/drivers/mmc/host/sdhci.c > +++ b/drivers/mmc/host/sdhci.c > @@ -3274,7 +3274,8 @@ int sdhci_setup_host(struct sdhci_host *host) > if (host->quirks2 & SDHCI_QUIRK2_HOST_NO_CMD23) > mmc->caps &= ~MMC_CAP_CMD23; > > - if (host->caps & SDHCI_CAN_DO_HISPD) > + if ((host->caps & SDHCI_CAN_DO_HISPD) && > + !(host->quirks2 & SDHCI_QUIRK2_BROKEN_HISPD)) Is there any reason this can't just be: if ((host->caps & SDHCI_CAN_DO_HISPD) && !(of_property_read_bool(mmc_dev(mmc)->of_node, "broken-highspeed"))) AFAICT it does the right thing whether or not OF is configured or of_node is null. > mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED; > > if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) && > diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h > index c722cd2..3d0fdda 100644 > --- a/drivers/mmc/host/sdhci.h > +++ b/drivers/mmc/host/sdhci.h > @@ -424,6 +424,8 @@ struct sdhci_host { > #define SDHCI_QUIRK2_ACMD23_BROKEN (1<<14) > /* Broken Clock divider zero in controller */ > #define SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN (1<<15) > +/* Highspeed is broken even if it appears otherwise */ > +#define SDHCI_QUIRK2_BROKEN_HISPD (1<<16) > > int irq; /* Device IRQ */ > void __iomem *ioaddr; /* Mapped address */ >