From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753536AbcA0HUy (ORCPT ); Wed, 27 Jan 2016 02:20:54 -0500 Received: from lucky1.263xmail.com ([211.157.147.132]:40166 "EHLO lucky1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752873AbcA0HUu (ORCPT ); Wed, 27 Jan 2016 02:20:50 -0500 X-263anti-spam: KSV:0; X-MAIL-GRAY: 1 X-MAIL-DELIVERY: 0 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-ADDR-CHECKED: 0 X-RL-SENDER: shawn.lin@rock-chips.com X-FST-TO: linux-kernel@vger.kernel.org X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: shawn.lin@rock-chips.com X-UNIQUE-TAG: <6b6909ef5f103b30937fd7efa42b528c> X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 Subject: Re: [RFC PATCH 10/21] mmc: sdhci: remove SDHCI_QUIRK_BROKEN_CARD_DETECTION To: Haibo Chen , Ulf Hansson References: <1453871155-3283-1-git-send-email-shawn.lin@rock-chips.com> <1453871283-3724-1-git-send-email-shawn.lin@rock-chips.com> Cc: shawn.lin@rock-chips.com, "bcm-kernel-feedback-list@broadcom.com" , "linux-rpi-kernel@lists.infradead.org" , "linux-mmc@vger.kernel.org" , "linux-kernel@vger.kernel.org" From: Shawn Lin Message-ID: <56A86FB8.5030006@rock-chips.com> Date: Wed, 27 Jan 2016 15:20:24 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016/1/27 15:11, Haibo Chen wrote: > > > Hi Shawn, > > [...] >> @@ -1618,7 +1618,8 @@ static int sdhci_do_get_cd(struct sdhci_host *host) >> return 0; >> >> /* If nonremovable, assume that the card is always present. */ >> - if (host->mmc->caps & MMC_CAP_NONREMOVABLE) >> + if (host->mmc->caps & MMC_CAP_NONREMOVABLE || >> + host->mmc->caps & MMC_CAP_NEEDS_POLL) >> return 1; >> >> /* >> @@ -1628,10 +1629,6 @@ static int sdhci_do_get_cd(struct sdhci_host *host) >> if (!IS_ERR_VALUE(gpio_cd)) >> return !!gpio_cd; >> >> - /* If polling, assume that the card is always present. */ >> - if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) >> - return 1; > > Why simply remove these code rather than use this: > If(host->mmc->caps & MMC_CAP_NEEDS_POLL) > Return 1; > > According to the comment, if polling, need to return 1, > But if you just simply remove this code, it will read the sdhci register SDHCI_PRESENT_STATE Hi Haibo I have combine this check with "host->mmc->caps & MMC_CAP_NONREMOVABLE" above. :) Thanks > > > Best Regards > > Haibo Chen > >> - >> /* Host native card detect */ >> return !!(sdhci_readl(host, SDHCI_PRESENT_STATE) & >> SDHCI_CARD_PRESENT); } @@ -2658,7 +2655,7 @@ void >> sdhci_enable_irq_wakeups(struct sdhci_host *host) >> val = sdhci_readb(host, SDHCI_WAKE_UP_CONTROL); >> val |= mask ; >> /* Avoid fake wake up */ >> - if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) >> + if (host->mmc->caps & MMC_CAP_NEEDS_POLL) >> val &= ~(SDHCI_WAKE_ON_INSERT | >> SDHCI_WAKE_ON_REMOVE); >> sdhci_writeb(host, val, SDHCI_WAKE_UP_CONTROL); } @@ -3112,8 >> +3109,7 @@ int sdhci_add_host(struct sdhci_host *host) >> if (caps[0] & SDHCI_CAN_DO_HISPD) >> mmc->caps |= MMC_CAP_SD_HIGHSPEED | >> MMC_CAP_MMC_HIGHSPEED; >> >> - if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) && >> - !(mmc->caps & MMC_CAP_NONREMOVABLE) && >> + if (!(mmc->caps & MMC_CAP_NONREMOVABLE) && >> IS_ERR_VALUE(mmc_gpio_get_cd(host->mmc))) >> mmc->caps |= MMC_CAP_NEEDS_POLL; >> >> -- >> 2.3.7 >> >> >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html > > > -- Best Regards Shawn Lin