Patchwork [U-Boot,2/6] mmc: ftsdc010_mci: fix build error if CONFIG_FTSDC010_SDIO is not defined

login
register
mail settings
Submitter Gabor Juhos
Date May 26, 2013, 10:11 a.m.
Message ID <1369563091-21640-3-git-send-email-juhosg@openwrt.org>
Download mbox | patch
Permalink /patch/246376/
State Accepted
Delegated to: Macpaul Lin
Headers show

Comments

Gabor Juhos - May 26, 2013, 10:11 a.m.
The FTSDC010_DCR_FIFO_RST symbol is conditionally
defined in <faraday/ftsdc010.h> and it is available
available when CONFIG_FTSDC010_SDIO is enabled.

However the actual driver code unconditionally uses
the FTSDC010_DCR_FIFO_RST constant and this causes
build error if CONFIG_FTSDC010_SDIO is not enabled.

The following error happens when compiling for the
adp-ag101 board:

  ftsdc010_mci.c: In function 'ftsdc010_request':
  ftsdc010_mci.c:178: error: 'FTSDC010_DCR_FIFO_RST' undeclared (first use in this function)
  ftsdc010_mci.c:178: error: (Each undeclared identifier is reported only once
  ftsdc010_mci.c:178: error: for each function it appears in.)

The patch ensures that the FTSDC010_DCR_FIFO_RST
symbol gets used only if CONFIG_FTSDC010_SDIO is
defined.

Compile tested only.

Cc: Kuo-Jung Su <dantesu@faraday-tech.com>
Cc: Macpaul Lin <macpaul@andestech.com>
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
 drivers/mmc/ftsdc010_mci.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Kuo-Jung Su - May 27, 2013, 8:05 a.m.
2013/5/26 Gabor Juhos <juhosg@openwrt.org>:
> The FTSDC010_DCR_FIFO_RST symbol is conditionally
> defined in <faraday/ftsdc010.h> and it is available
> available when CONFIG_FTSDC010_SDIO is enabled.
>
> However the actual driver code unconditionally uses
> the FTSDC010_DCR_FIFO_RST constant and this causes
> build error if CONFIG_FTSDC010_SDIO is not enabled.
>
> The following error happens when compiling for the
> adp-ag101 board:
>
>   ftsdc010_mci.c: In function 'ftsdc010_request':
>   ftsdc010_mci.c:178: error: 'FTSDC010_DCR_FIFO_RST' undeclared (first use in this function)
>   ftsdc010_mci.c:178: error: (Each undeclared identifier is reported only once
>   ftsdc010_mci.c:178: error: for each function it appears in.)
>
> The patch ensures that the FTSDC010_DCR_FIFO_RST
> symbol gets used only if CONFIG_FTSDC010_SDIO is
> defined.
>
> Compile tested only.
>

Sorry, it's my bad.
I don't have the NDS32 toolchain, so I didn't run the compiling test
for NDS32 platforms.

> Cc: Kuo-Jung Su <dantesu@faraday-tech.com>
> Cc: Macpaul Lin <macpaul@andestech.com>
> Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
> ---
>  drivers/mmc/ftsdc010_mci.c |    6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/ftsdc010_mci.c b/drivers/mmc/ftsdc010_mci.c
> index 562b14a..1fcb97c 100644
> --- a/drivers/mmc/ftsdc010_mci.c
> +++ b/drivers/mmc/ftsdc010_mci.c
> @@ -175,7 +175,11 @@ static int ftsdc010_request(struct mmc *mmc, struct mmc_cmd *cmd,
>                 len = data->blocksize * data->blocks;
>
>                 /* 1. data disable + fifo reset */
> -               writel(FTSDC010_DCR_FIFO_RST, &regs->dcr);
> +               dcr = 0;
> +#ifdef CONFIG_FTSDC010_SDIO
> +               dcr |= FTSDC010_DCR_FIFO_RST;
> +#endif
> +               writel(dcr, &regs->dcr);
>
>                 /* 2. clear status register */
>                 writel(FTSDC010_STATUS_DATA_MASK | FTSDC010_STATUS_FIFO_URUN
> --
> 1.7.10
>

Reviewed-by: Kuo-Jung Su <dantesu@faraday-tech.com>

--
Best wishes,
Kuo-Jung Su

Patch

diff --git a/drivers/mmc/ftsdc010_mci.c b/drivers/mmc/ftsdc010_mci.c
index 562b14a..1fcb97c 100644
--- a/drivers/mmc/ftsdc010_mci.c
+++ b/drivers/mmc/ftsdc010_mci.c
@@ -175,7 +175,11 @@  static int ftsdc010_request(struct mmc *mmc, struct mmc_cmd *cmd,
 		len = data->blocksize * data->blocks;
 
 		/* 1. data disable + fifo reset */
-		writel(FTSDC010_DCR_FIFO_RST, &regs->dcr);
+		dcr = 0;
+#ifdef CONFIG_FTSDC010_SDIO
+		dcr |= FTSDC010_DCR_FIFO_RST;
+#endif
+		writel(dcr, &regs->dcr);
 
 		/* 2. clear status register */
 		writel(FTSDC010_STATUS_DATA_MASK | FTSDC010_STATUS_FIFO_URUN