From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/4] mmc: Change board_mmc_getcd() signature.
Date: Mon, 05 Dec 2011 11:40:07 +0100 [thread overview]
Message-ID: <4EDC9F87.8050104@denx.de> (raw)
In-Reply-To: <1323073424-16656-1-git-send-email-thierry.reding@avionic-design.de>
On 05/12/2011 09:23, Thierry Reding wrote:
> The new API no longer uses the extra cd parameter that was used to store
> the card presence state. Instead, this information is returned via the
> function's return value. board_mmc_getcd() returns -1 to indicate that
> no card-detection mechanism is implemented; 0 indicates that no card is
> present and 1 is returned if it was detected that a card is present.
>
> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Hi Thierry,
it is not clear to me what you think with the new API, or better what
you think as new.
As I can see, in the current U-Boot TOT there is still :
drivers/mmc/mmc.c:int __board_mmc_getcd(u8 *cd, struct mmc *mmc)
It seems there is not (yet) a new API...
If it is true, which is the reason to change it ?
> ---
> board/efikamx/efikamx.c | 8 +++-----
> board/emk/top9000/top9000.c | 12 ++----------
> board/freescale/mx51evk/mx51evk.c | 8 +++-----
> board/freescale/mx53ard/mx53ard.c | 8 +++-----
> board/freescale/mx53evk/mx53evk.c | 8 +++-----
> board/freescale/mx53loco/mx53loco.c | 8 +++-----
> board/freescale/mx53smd/mx53smd.c | 6 ++----
> doc/README.atmel_mci | 12 ++----------
> drivers/mmc/fsl_esdhc.c | 8 +++++---
> drivers/mmc/mmc.c | 4 ++--
> include/mmc.h | 2 +-
> 11 files changed, 29 insertions(+), 55 deletions(-)
>
> 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 ?
> diff --git a/board/freescale/mx51evk/mx51evk.c b/board/freescale/mx51evk/mx51evk.c
> index 37e6e4d..bc03496 100644
> --- a/board/freescale/mx51evk/mx51evk.c
> +++ b/board/freescale/mx51evk/mx51evk.c
> @@ -261,16 +261,14 @@ static void power_init(void)
> }
>
> #ifdef CONFIG_FSL_ESDHC
> -int board_mmc_getcd(u8 *cd, struct mmc *mmc)
> +int board_mmc_getcd(struct mmc *mmc)
> {
> struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
>
> if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR)
> - *cd = gpio_get_value(0);
> - else
> - *cd = gpio_get_value(6);
> + return !gpio_get_value(0);
Ditto. gpio_get_value(0) returns not-zero if the pin is on logical level
high, telling that a card was inserted.
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index 37ce6e8..936259f 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -40,11 +40,11 @@
> static struct list_head mmc_devices;
> static int cur_dev_num = -1;
>
> -int __board_mmc_getcd(u8 *cd, struct mmc *mmc) {
> +int __board_mmc_getcd(struct mmc *mmc) {
> return -1;
> }
>
> -int board_mmc_getcd(u8 *cd, struct mmc *mmc)__attribute__((weak,
> +int board_mmc_getcd(struct mmc *mmc)__attribute__((weak,
> alias("__board_mmc_getcd")));
Why is it this better as before ?
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
next prev parent reply other threads:[~2011-12-05 10:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-05 8:23 [U-Boot] [PATCH 1/4] mmc: Change board_mmc_getcd() signature Thierry Reding
2011-12-05 8:23 ` [U-Boot] [PATCH 2/4] mmc: Implement card detection Thierry Reding
2011-12-05 8:23 ` [U-Boot] [PATCH 3/4] mmc: fsl_esdhc: Implement card-detect hook Thierry Reding
2011-12-05 10:47 ` Stefano Babic
2011-12-05 12:49 ` Thierry Reding
2011-12-05 8:23 ` [U-Boot] [PATCH 4/4] mmc: tegra2: " Thierry Reding
2011-12-05 9:53 ` [U-Boot] [PATCH 1/4] mmc: Change board_mmc_getcd() signature Marek Vasut
2011-12-05 10:00 ` Thierry Reding
2011-12-05 10:54 ` Stefano Babic
2011-12-05 11:02 ` Marek Vasut
2011-12-05 10:40 ` Stefano Babic [this message]
2011-12-05 12:53 ` Thierry Reding
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EDC9F87.8050104@denx.de \
--to=sbabic@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox