mmc: change the set_ios return type from void to int

To maintain consistency, set_ios type of legacy mmc_ops changed to int.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
This commit is contained in:
Jaehoon Chung 2016-12-30 15:30:16 +09:00
parent 6f88a3a5d9
commit 07b0b9c00c
20 changed files with 60 additions and 30 deletions

View file

@ -275,7 +275,7 @@ static int mmc_host_reset(struct mmc *dev)
return 0; return 0;
} }
static void host_set_ios(struct mmc *dev) static int host_set_ios(struct mmc *dev)
{ {
struct pl180_mmc_host *host = dev->priv; struct pl180_mmc_host *host = dev->priv;
u32 sdi_clkcr; u32 sdi_clkcr;
@ -333,6 +333,8 @@ static void host_set_ios(struct mmc *dev)
writel(sdi_clkcr, &host->base->clock); writel(sdi_clkcr, &host->base->clock);
udelay(CLK_CHANGE_DELAY); udelay(CLK_CHANGE_DELAY);
return 0;
} }
static const struct mmc_ops arm_pl180_mmci_ops = { static const struct mmc_ops arm_pl180_mmci_ops = {

View file

@ -234,7 +234,7 @@ static void sdh_set_clk(unsigned long clk)
bfin_write_SDH_CLK_CTL(clk_ctl & ~CLK_E); bfin_write_SDH_CLK_CTL(clk_ctl & ~CLK_E);
} }
static void bfin_sdh_set_ios(struct mmc *mmc) static int bfin_sdh_set_ios(struct mmc *mmc)
{ {
u16 cfg = 0; u16 cfg = 0;
u16 clk_ctl = 0; u16 clk_ctl = 0;
@ -250,6 +250,8 @@ static void bfin_sdh_set_ios(struct mmc *mmc)
} }
bfin_write_SDH_CLK_CTL(clk_ctl); bfin_write_SDH_CLK_CTL(clk_ctl);
sdh_set_clk(mmc->clock); sdh_set_clk(mmc->clock);
return 0;
} }
static int bfin_sdh_init(struct mmc *mmc) static int bfin_sdh_init(struct mmc *mmc)

View file

@ -348,7 +348,7 @@ static int dmmc_init(struct mmc *mmc)
} }
/* Set buswidth or clock as indicated by the GENERIC_MMC framework */ /* Set buswidth or clock as indicated by the GENERIC_MMC framework */
static void dmmc_set_ios(struct mmc *mmc) static int dmmc_set_ios(struct mmc *mmc)
{ {
struct davinci_mmc *host = mmc->priv; struct davinci_mmc *host = mmc->priv;
struct davinci_mmc_regs *regs = host->reg_base; struct davinci_mmc_regs *regs = host->reg_base;
@ -362,6 +362,8 @@ static void dmmc_set_ios(struct mmc *mmc)
/* Set clock speed */ /* Set clock speed */
if (mmc->clock) if (mmc->clock)
dmmc_set_clock(mmc, mmc->clock); dmmc_set_clock(mmc, mmc->clock);
return 0;
} }
static const struct mmc_ops dmmc_ops = { static const struct mmc_ops dmmc_ops = {

View file

@ -388,7 +388,7 @@ static int dwmci_set_ios(struct udevice *dev)
{ {
struct mmc *mmc = mmc_get_mmc_dev(dev); struct mmc *mmc = mmc_get_mmc_dev(dev);
#else #else
static void dwmci_set_ios(struct mmc *mmc) static int dwmci_set_ios(struct mmc *mmc)
{ {
#endif #endif
struct dwmci_host *host = (struct dwmci_host *)mmc->priv; struct dwmci_host *host = (struct dwmci_host *)mmc->priv;
@ -421,9 +421,8 @@ static void dwmci_set_ios(struct mmc *mmc)
if (host->clksel) if (host->clksel)
host->clksel(host); host->clksel(host);
#ifdef CONFIG_DM_MMC_OPS
return 0; return 0;
#endif
} }
static int dwmci_init(struct mmc *mmc) static int dwmci_init(struct mmc *mmc)

View file

@ -592,7 +592,7 @@ static void esdhc_clock_control(struct mmc *mmc, bool enable)
} }
#endif #endif
static void esdhc_set_ios(struct mmc *mmc) static int esdhc_set_ios(struct mmc *mmc)
{ {
struct fsl_esdhc_priv *priv = mmc->priv; struct fsl_esdhc_priv *priv = mmc->priv;
struct fsl_esdhc *regs = priv->esdhc_regs; struct fsl_esdhc *regs = priv->esdhc_regs;
@ -614,6 +614,7 @@ static void esdhc_set_ios(struct mmc *mmc)
else if (mmc->bus_width == 8) else if (mmc->bus_width == 8)
esdhc_setbits32(&regs->proctl, PROCTL_DTW_8); esdhc_setbits32(&regs->proctl, PROCTL_DTW_8);
return 0;
} }
static int esdhc_init(struct mmc *mmc) static int esdhc_init(struct mmc *mmc)

View file

@ -251,7 +251,7 @@ static int ftsdc010_request(struct mmc *mmc, struct mmc_cmd *cmd,
return ret; return ret;
} }
static void ftsdc010_set_ios(struct mmc *mmc) static int ftsdc010_set_ios(struct mmc *mmc)
{ {
struct ftsdc010_chip *chip = mmc->priv; struct ftsdc010_chip *chip = mmc->priv;
struct ftsdc010_mmc __iomem *regs = chip->regs; struct ftsdc010_mmc __iomem *regs = chip->regs;
@ -270,6 +270,8 @@ static void ftsdc010_set_ios(struct mmc *mmc)
setbits_le32(&regs->bwr, FTSDC010_BWR_MODE_1BIT); setbits_le32(&regs->bwr, FTSDC010_BWR_MODE_1BIT);
break; break;
} }
return 0;
} }
static int ftsdc010_init(struct mmc *mmc) static int ftsdc010_init(struct mmc *mmc)

View file

@ -336,7 +336,7 @@ mci_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
} }
/* Entered into mmc structure during driver init */ /* Entered into mmc structure during driver init */
static void mci_set_ios(struct mmc *mmc) static int mci_set_ios(struct mmc *mmc)
{ {
struct atmel_mci_priv *priv = mmc->priv; struct atmel_mci_priv *priv = mmc->priv;
atmel_mci_t *mci = priv->mci; atmel_mci_t *mci = priv->mci;
@ -370,6 +370,8 @@ static void mci_set_ios(struct mmc *mmc)
writel(busw << 7 | MMCI_BF(SCDSEL, MCI_BUS), &mci->sdcr); writel(busw << 7 | MMCI_BF(SCDSEL, MCI_BUS), &mci->sdcr);
} }
return 0;
} }
/* Entered into mmc structure during driver init */ /* Entered into mmc structure during driver init */

View file

@ -236,13 +236,14 @@ done:
return ret; return ret;
} }
static void mmc_spi_set_ios(struct mmc *mmc) static int mmc_spi_set_ios(struct mmc *mmc)
{ {
struct spi_slave *spi = mmc->priv; struct spi_slave *spi = mmc->priv;
debug("%s: clock %u\n", __func__, mmc->clock); debug("%s: clock %u\n", __func__, mmc->clock);
if (mmc->clock) if (mmc->clock)
spi_set_speed(spi, mmc->clock); spi_set_speed(spi, mmc->clock);
return 0;
} }
static int mmc_spi_init_p(struct mmc *mmc) static int mmc_spi_init_p(struct mmc *mmc)

View file

@ -316,12 +316,14 @@ static void mvebu_mmc_set_bus(unsigned int bus)
mvebu_mmc_write(SDIO_HOST_CTRL, ctrl_reg); mvebu_mmc_write(SDIO_HOST_CTRL, ctrl_reg);
} }
static void mvebu_mmc_set_ios(struct mmc *mmc) static int mvebu_mmc_set_ios(struct mmc *mmc)
{ {
debug("%s: bus[%d] clock[%d]\n", DRIVER_NAME, debug("%s: bus[%d] clock[%d]\n", DRIVER_NAME,
mmc->bus_width, mmc->clock); mmc->bus_width, mmc->clock);
mvebu_mmc_set_bus(mmc->bus_width); mvebu_mmc_set_bus(mmc->bus_width);
mvebu_mmc_set_clk(mmc->clock); mvebu_mmc_set_clk(mmc->clock);
return 0;
} }
/* /*

View file

@ -448,7 +448,7 @@ static void mxcmci_set_clk_rate(struct mxcmci_host *host, unsigned int clk_ios)
writel((prescaler << 4) | divider, &host->base->clk_rate); writel((prescaler << 4) | divider, &host->base->clk_rate);
} }
static void mxcmci_set_ios(struct mmc *mmc) static int mxcmci_set_ios(struct mmc *mmc)
{ {
struct mxcmci_host *host = mmc->priv; struct mxcmci_host *host = mmc->priv;
if (mmc->bus_width == 4) if (mmc->bus_width == 4)
@ -464,6 +464,8 @@ static void mxcmci_set_ios(struct mmc *mmc)
} }
host->clock = mmc->clock; host->clock = mmc->clock;
return 0;
} }
static int mxcmci_init(struct mmc *mmc) static int mxcmci_init(struct mmc *mmc)

View file

@ -304,7 +304,7 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
return 0; return 0;
} }
static void mxsmmc_set_ios(struct mmc *mmc) static int mxsmmc_set_ios(struct mmc *mmc)
{ {
struct mxsmmc_priv *priv = mmc->priv; struct mxsmmc_priv *priv = mmc->priv;
struct mxs_ssp_regs *ssp_regs = priv->regs; struct mxs_ssp_regs *ssp_regs = priv->regs;
@ -331,6 +331,8 @@ static void mxsmmc_set_ios(struct mmc *mmc)
debug("MMC%d: Set %d bits bus width\n", debug("MMC%d: Set %d bits bus width\n",
mmc->block_dev.devnum, mmc->bus_width); mmc->block_dev.devnum, mmc->bus_width);
return 0;
} }
static int mxsmmc_init(struct mmc *mmc) static int mxsmmc_init(struct mmc *mmc)

View file

@ -511,7 +511,7 @@ static int mmc_write_data(struct hsmmc *mmc_base, const char *buf,
return 0; return 0;
} }
static void omap_hsmmc_set_ios(struct mmc *mmc) static int omap_hsmmc_set_ios(struct mmc *mmc)
{ {
struct hsmmc *mmc_base; struct hsmmc *mmc_base;
unsigned int dsor = 0; unsigned int dsor = 0;
@ -559,10 +559,12 @@ static void omap_hsmmc_set_ios(struct mmc *mmc)
while ((readl(&mmc_base->sysctl) & ICS_MASK) == ICS_NOTREADY) { while ((readl(&mmc_base->sysctl) & ICS_MASK) == ICS_NOTREADY) {
if (get_timer(0) - start > MAX_RETRY_MS) { if (get_timer(0) - start > MAX_RETRY_MS) {
printf("%s: timedout waiting for ics!\n", __func__); printf("%s: timedout waiting for ics!\n", __func__);
return; return -ETIMEDOUT;
} }
} }
writel(readl(&mmc_base->sysctl) | CEN_ENABLE, &mmc_base->sysctl); writel(readl(&mmc_base->sysctl) | CEN_ENABLE, &mmc_base->sysctl);
return 0;
} }
#ifdef OMAP_HSMMC_USE_GPIO #ifdef OMAP_HSMMC_USE_GPIO

View file

@ -313,7 +313,7 @@ static int pxa_mmc_request(struct mmc *mmc, struct mmc_cmd *cmd,
return 0; return 0;
} }
static void pxa_mmc_set_ios(struct mmc *mmc) static int pxa_mmc_set_ios(struct mmc *mmc)
{ {
struct pxa_mmc_priv *priv = mmc->priv; struct pxa_mmc_priv *priv = mmc->priv;
struct pxa_mmc_regs *regs = priv->regs; struct pxa_mmc_regs *regs = priv->regs;
@ -322,13 +322,13 @@ static void pxa_mmc_set_ios(struct mmc *mmc)
if (!mmc->clock) { if (!mmc->clock) {
pxa_mmc_stop_clock(mmc); pxa_mmc_stop_clock(mmc);
return; return 0;
} }
/* PXA3xx can do 26MHz with special settings. */ /* PXA3xx can do 26MHz with special settings. */
if (mmc->clock == 26000000) { if (mmc->clock == 26000000) {
writel(0x7, &regs->clkrt); writel(0x7, &regs->clkrt);
return; return 0;
} }
/* Set clock to the card the usual way. */ /* Set clock to the card the usual way. */
@ -342,6 +342,8 @@ static void pxa_mmc_set_ios(struct mmc *mmc)
} }
writel(pxa_mmc_clock, &regs->clkrt); writel(pxa_mmc_clock, &regs->clkrt);
return 0;
} }
static int pxa_mmc_init(struct mmc *mmc) static int pxa_mmc_init(struct mmc *mmc)

View file

@ -207,7 +207,7 @@ error:
return ret; return ret;
} }
static void s3cmmc_set_ios(struct mmc *mmc) static int s3cmmc_set_ios(struct mmc *mmc)
{ {
struct s3c24x0_sdi *sdi_regs = s3c24x0_get_base_sdi(); struct s3c24x0_sdi *sdi_regs = s3c24x0_get_base_sdi();
uint32_t divider = 0; uint32_t divider = 0;
@ -215,7 +215,7 @@ static void s3cmmc_set_ios(struct mmc *mmc)
wide_bus = (mmc->bus_width == 4); wide_bus = (mmc->bus_width == 4);
if (!mmc->clock) if (!mmc->clock)
return; return 0;
divider = DIV_ROUND_UP(get_PCLK(), mmc->clock); divider = DIV_ROUND_UP(get_PCLK(), mmc->clock);
if (divider) if (divider)
@ -223,6 +223,8 @@ static void s3cmmc_set_ios(struct mmc *mmc)
writel(divider, &sdi_regs->sdipre); writel(divider, &sdi_regs->sdipre);
mdelay(125); mdelay(125);
return 0;
} }
static int s3cmmc_init(struct mmc *mmc) static int s3cmmc_init(struct mmc *mmc)

View file

@ -424,7 +424,7 @@ static int sdhci_set_ios(struct udevice *dev)
{ {
struct mmc *mmc = mmc_get_mmc_dev(dev); struct mmc *mmc = mmc_get_mmc_dev(dev);
#else #else
static void sdhci_set_ios(struct mmc *mmc) static int sdhci_set_ios(struct mmc *mmc)
{ {
#endif #endif
u32 ctrl; u32 ctrl;
@ -462,9 +462,8 @@ static void sdhci_set_ios(struct mmc *mmc)
ctrl &= ~SDHCI_CTRL_HISPD; ctrl &= ~SDHCI_CTRL_HISPD;
sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL); sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
#ifdef CONFIG_DM_MMC_OPS
return 0; return 0;
#endif
} }
static int sdhci_init(struct mmc *mmc) static int sdhci_init(struct mmc *mmc)

View file

@ -539,7 +539,7 @@ static int sh_mmcif_request(struct mmc *mmc, struct mmc_cmd *cmd,
return ret; return ret;
} }
static void sh_mmcif_set_ios(struct mmc *mmc) static int sh_mmcif_set_ios(struct mmc *mmc)
{ {
struct sh_mmcif_host *host = mmc->priv; struct sh_mmcif_host *host = mmc->priv;
@ -554,6 +554,8 @@ static void sh_mmcif_set_ios(struct mmc *mmc)
host->bus_width = MMC_BUS_WIDTH_1; host->bus_width = MMC_BUS_WIDTH_1;
debug("clock = %d, buswidth = %d\n", mmc->clock, mmc->bus_width); debug("clock = %d, buswidth = %d\n", mmc->clock, mmc->bus_width);
return 0;
} }
static int sh_mmcif_init(struct mmc *mmc) static int sh_mmcif_init(struct mmc *mmc)

View file

@ -608,14 +608,14 @@ static int sh_sdhi_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
return ret; return ret;
} }
static void sh_sdhi_set_ios(struct mmc *mmc) static int sh_sdhi_set_ios(struct mmc *mmc)
{ {
int ret; int ret;
struct sh_sdhi_host *host = mmc_priv(mmc); struct sh_sdhi_host *host = mmc_priv(mmc);
ret = sh_sdhi_clock_control(host, mmc->clock); ret = sh_sdhi_clock_control(host, mmc->clock);
if (ret) if (ret)
return; return -EINVAL;
if (mmc->bus_width == 4) if (mmc->bus_width == 4)
sh_sdhi_writew(host, SDHI_OPTION, ~OPT_BUS_WIDTH_1 & sh_sdhi_writew(host, SDHI_OPTION, ~OPT_BUS_WIDTH_1 &
@ -625,6 +625,8 @@ static void sh_sdhi_set_ios(struct mmc *mmc)
sh_sdhi_readw(host, SDHI_OPTION)); sh_sdhi_readw(host, SDHI_OPTION));
debug("clock = %d, buswidth = %d\n", mmc->clock, mmc->bus_width); debug("clock = %d, buswidth = %d\n", mmc->clock, mmc->bus_width);
return 0;
} }
static int sh_sdhi_initialize(struct mmc *mmc) static int sh_sdhi_initialize(struct mmc *mmc)

View file

@ -227,7 +227,7 @@ static int mmc_config_clock(struct mmc *mmc)
return 0; return 0;
} }
static void sunxi_mmc_set_ios(struct mmc *mmc) static int sunxi_mmc_set_ios(struct mmc *mmc)
{ {
struct sunxi_mmc_host *mmchost = mmc->priv; struct sunxi_mmc_host *mmchost = mmc->priv;
@ -237,7 +237,7 @@ static void sunxi_mmc_set_ios(struct mmc *mmc)
/* Change clock first */ /* Change clock first */
if (mmc->clock && mmc_config_clock(mmc) != 0) { if (mmc->clock && mmc_config_clock(mmc) != 0) {
mmchost->fatal_err = 1; mmchost->fatal_err = 1;
return; return -EINVAL;
} }
/* Change bus width */ /* Change bus width */
@ -247,6 +247,8 @@ static void sunxi_mmc_set_ios(struct mmc *mmc)
writel(0x1, &mmchost->reg->width); writel(0x1, &mmchost->reg->width);
else else
writel(0x0, &mmchost->reg->width); writel(0x0, &mmchost->reg->width);
return 0;
} }
static int sunxi_mmc_core_init(struct mmc *mmc) static int sunxi_mmc_core_init(struct mmc *mmc)

View file

@ -408,7 +408,7 @@ out:
priv->clock = clock; priv->clock = clock;
} }
static void tegra_mmc_set_ios(struct mmc *mmc) static int tegra_mmc_set_ios(struct mmc *mmc)
{ {
struct tegra_mmc_priv *priv = mmc->priv; struct tegra_mmc_priv *priv = mmc->priv;
unsigned char ctrl; unsigned char ctrl;
@ -438,6 +438,8 @@ static void tegra_mmc_set_ios(struct mmc *mmc)
writeb(ctrl, &priv->reg->hostctl); writeb(ctrl, &priv->reg->hostctl);
debug("mmc_set_ios: hostctl = %08X\n", ctrl); debug("mmc_set_ios: hostctl = %08X\n", ctrl);
return 0;
} }
static void tegra_mmc_pad_init(struct tegra_mmc_priv *priv) static void tegra_mmc_pad_init(struct tegra_mmc_priv *priv)

View file

@ -376,7 +376,7 @@ int mmc_getwp(struct mmc *mmc);
struct mmc_ops { struct mmc_ops {
int (*send_cmd)(struct mmc *mmc, int (*send_cmd)(struct mmc *mmc,
struct mmc_cmd *cmd, struct mmc_data *data); struct mmc_cmd *cmd, struct mmc_data *data);
void (*set_ios)(struct mmc *mmc); int (*set_ios)(struct mmc *mmc);
int (*init)(struct mmc *mmc); int (*init)(struct mmc *mmc);
int (*getcd)(struct mmc *mmc); int (*getcd)(struct mmc *mmc);
int (*getwp)(struct mmc *mmc); int (*getwp)(struct mmc *mmc);