From: Thierry Reding Date: Mon, 5 Dec 2011 13:53:37 +0100 Subject: [U-Boot] [PATCH 1/4] mmc: Change board_mmc_getcd() signature. In-Reply-To: <4EDC9F87.8050104@denx.de> References: <1323073424-16656-1-git-send-email-thierry.reding@avionic-design.de> <4EDC9F87.8050104@denx.de> Message-ID: <20111205125337.GB10147@avionic-0098.adnet.avionic-design.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de * Stefano Babic wrote: > On 05/12/2011 09:23, Thierry Reding wrote: [...] > > diff --git a/board/efikamx/efikamx.c b/board/efikamx/efikamx.c > > index b78bf6c..451d709 100644 > > --- a/board/efikamx/efikamx.c > > +++ b/board/efikamx/efikamx.c > > @@ -309,17 +309,15 @@ static inline uint32_t efika_mmc_cd(void) > > return MX51_PIN_EIM_CS2; > > } > > > > -int board_mmc_getcd(u8 *absent, struct mmc *mmc) > > +int board_mmc_getcd(struct mmc *mmc) > > { > > struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv; > > uint32_t cd = efika_mmc_cd(); > > > > if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR) > > - *absent = gpio_get_value(IOMUX_TO_GPIO(cd)); > > - else > > - *absent = gpio_get_value(IOMUX_TO_GPIO(MX51_PIN_GPIO1_8)); > > + return !gpio_get_value(IOMUX_TO_GPIO(cd)); > > It seems to me you are inverting the logic. In you commit message, "1" > means that a card is detected, exactly as it is done now. Am I wrong ? The reason is that the fsl_esdhc driver actually calls the "cd" parameter "absent", so the logic is inverted in that driver. This change merely brings the board implementation in line with the new API. Perhaps it would help if the meaning of the return value should be documented explicitly in mmc.h? Thierry -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: