2016-12-30 15:30 GMT+09:00 Jaehoon Chung <jh80.ch...@samsung.com>:
> This code is used for only pic32_sdhci controller.
> To remove the "#ifdef", moves to pic32_sdhci.c.
> And use the get_cd callback function.
>
> Signed-off-by: Jaehoon Chung <jh80.ch...@samsung.com>
> ---
>  drivers/mmc/pic32_sdhci.c | 13 +++++++++++++
>  drivers/mmc/sdhci.c       |  9 +++------
>  2 files changed, 16 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/mmc/pic32_sdhci.c b/drivers/mmc/pic32_sdhci.c
> index 2abf943..d8b6d8a 100644
> --- a/drivers/mmc/pic32_sdhci.c
> +++ b/drivers/mmc/pic32_sdhci.c
> @@ -15,6 +15,18 @@
>
>  DECLARE_GLOBAL_DATA_PTR;
>
> +static int pci32_sdhci_get_cd(struct sdhci_host)
> +{
> +       /* PIC32 SDHCI CD errata:
> +        * - set CD_TEST and clear CD_TEST_INS bit
> +        */
> +       sdhci_writeb(host, SDHCI_CTRL_CD_TEST, SDHCI_HOST_CONTROL);
> +}
> +
> +static const struct sdhci_ops pic32_sdhci_ops = {
> +       .get_cd = pci32_sdhci_get_cd,
> +};
> +
>  static int pic32_sdhci_probe(struct udevice *dev)
>  {
>         struct sdhci_host *host = dev_get_priv(dev);
> @@ -33,6 +45,7 @@ static int pic32_sdhci_probe(struct udevice *dev)
>         host->quirks    = SDHCI_QUIRK_NO_HISPD_BIT | SDHCI_QUIRK_NO_CD;
>         host->bus_width = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
>                                         "bus-width", 4);
> +       host->ops = &pci32_sdhci_ops;
>
>         ret = fdtdec_get_int_array(gd->fdt_blob, dev->of_offset,
>                                    "clock-freq-min-max", f_min_max, 2);
> diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
> index c512a4c..aeac805 100644
> --- a/drivers/mmc/sdhci.c
> +++ b/drivers/mmc/sdhci.c
> @@ -484,13 +484,10 @@ static int sdhci_init(struct mmc *mmc)
>
>         sdhci_set_power(host, fls(mmc->cfg->voltages) - 1);
>
> +
>         if (host->quirks & SDHCI_QUIRK_NO_CD) {
> -#if defined(CONFIG_PIC32_SDHCI)
> -               /* PIC32 SDHCI CD errata:
> -                * - set CD_TEST and clear CD_TEST_INS bit
> -                */
> -               sdhci_writeb(host, SDHCI_CTRL_CD_TEST, SDHCI_HOST_CONTROL);
> -#endif
> +               if (host->ops->get_cd)
> +                       host->ops->get_cd(host);

Question:

The name get_cd implies something (status of something?)
is returned and actually its return type is "int".

But, the return value of host->ops->get_cd is ignored, here.

What should this function do?

If the return value is unneeded, how about changing it into void type?


-- 
Best Regards
Masahiro Yamada
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to