Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'mmc-fixes-for-3.7-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc

Pull MMC fixes from Chris Ball:
- sdhci: fix a NULL dereference at resume-time, seen on OLPC XO-4
- sdhci: fix against 3.7-rc1 for UHS modes without a vqmmc regulator
- sdhci-of-esdhc: disable CMD23 on boards where it's broken
- sdhci-s3c: fix against 3.7-rc1 for card detection with runtime PM
- dw_mmc, omap_hsmmc: fix potential NULL derefs, compiler warnings

* tag 'mmc-fixes-for-3.7-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc:
mmc: sdhci-s3c: fix the card detection in runtime-pm
mmc: sdhci-s3c: use clk_prepare_enable and clk_disable_unprepare
mmc: dw_mmc: constify dw_mci_idmac_ops in exynos back-end
mmc: dw_mmc: fix modular build for exynos back-end
mmc: sdhci: fix NULL dereference in sdhci_request() tuning
mmc: sdhci: fix IS_ERR() checking of regulator_get()
mmc: fix sdhci-dove probe/removal
mmc: sh_mmcif: fix use after free
mmc: sdhci-pci: fix 'Invalid iomem size' error message condition
mmc: mxcmmc: Fix MODULE_ALIAS
mmc: omap_hsmmc: fix NULL pointer dereference for dt boot
mmc: omap_hsmmc: fix host reference after mmc_free_host
mmc: dw_mmc: fix multiple drv_data NULL dereferences
mmc: dw_mmc: enable controller interrupt before calling mmc_start_host
mmc: sdhci-of-esdhc: disable CMD23 for some Freescale SoCs
mmc: dw_mmc: remove _dev_info compile warning
mmc: dw_mmc: convert the variable type of irq

+143 -96
+4 -4
drivers/mmc/host/dw_mmc-exynos.c
··· 208 208 MMC_CAP_CMD23, 209 209 }; 210 210 211 - static struct dw_mci_drv_data exynos5250_drv_data = { 211 + static const struct dw_mci_drv_data exynos5250_drv_data = { 212 212 .caps = exynos5250_dwmmc_caps, 213 213 .init = dw_mci_exynos_priv_init, 214 214 .setup_clock = dw_mci_exynos_setup_clock, ··· 220 220 221 221 static const struct of_device_id dw_mci_exynos_match[] = { 222 222 { .compatible = "samsung,exynos5250-dw-mshc", 223 - .data = (void *)&exynos5250_drv_data, }, 223 + .data = &exynos5250_drv_data, }, 224 224 {}, 225 225 }; 226 - MODULE_DEVICE_TABLE(of, dw_mci_pltfm_match); 226 + MODULE_DEVICE_TABLE(of, dw_mci_exynos_match); 227 227 228 228 int dw_mci_exynos_probe(struct platform_device *pdev) 229 229 { 230 - struct dw_mci_drv_data *drv_data; 230 + const struct dw_mci_drv_data *drv_data; 231 231 const struct of_device_id *match; 232 232 233 233 match = of_match_node(dw_mci_exynos_match, pdev->dev.of_node);
+3 -3
drivers/mmc/host/dw_mmc-pltfm.c
··· 24 24 #include "dw_mmc.h" 25 25 26 26 int dw_mci_pltfm_register(struct platform_device *pdev, 27 - struct dw_mci_drv_data *drv_data) 27 + const struct dw_mci_drv_data *drv_data) 28 28 { 29 29 struct dw_mci *host; 30 30 struct resource *regs; ··· 50 50 if (!host->regs) 51 51 return -ENOMEM; 52 52 53 - if (host->drv_data->init) { 54 - ret = host->drv_data->init(host); 53 + if (drv_data && drv_data->init) { 54 + ret = drv_data->init(host); 55 55 if (ret) 56 56 return ret; 57 57 }
+1 -1
drivers/mmc/host/dw_mmc-pltfm.h
··· 13 13 #define _DW_MMC_PLTFM_H_ 14 14 15 15 extern int dw_mci_pltfm_register(struct platform_device *pdev, 16 - struct dw_mci_drv_data *drv_data); 16 + const struct dw_mci_drv_data *drv_data); 17 17 extern int __devexit dw_mci_pltfm_remove(struct platform_device *pdev); 18 18 extern const struct dev_pm_ops dw_mci_pltfm_pmops; 19 19
+34 -28
drivers/mmc/host/dw_mmc.c
··· 232 232 { 233 233 struct mmc_data *data; 234 234 struct dw_mci_slot *slot = mmc_priv(mmc); 235 + struct dw_mci_drv_data *drv_data = slot->host->drv_data; 235 236 u32 cmdr; 236 237 cmd->error = -EINPROGRESS; 237 238 ··· 262 261 cmdr |= SDMMC_CMD_DAT_WR; 263 262 } 264 263 265 - if (slot->host->drv_data->prepare_command) 266 - slot->host->drv_data->prepare_command(slot->host, &cmdr); 264 + if (drv_data && drv_data->prepare_command) 265 + drv_data->prepare_command(slot->host, &cmdr); 267 266 268 267 return cmdr; 269 268 } ··· 435 434 return 0; 436 435 } 437 436 438 - static struct dw_mci_dma_ops dw_mci_idmac_ops = { 437 + static const struct dw_mci_dma_ops dw_mci_idmac_ops = { 439 438 .init = dw_mci_idmac_init, 440 439 .start = dw_mci_idmac_start_dma, 441 440 .stop = dw_mci_idmac_stop_dma, ··· 773 772 static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) 774 773 { 775 774 struct dw_mci_slot *slot = mmc_priv(mmc); 775 + struct dw_mci_drv_data *drv_data = slot->host->drv_data; 776 776 u32 regs; 777 777 778 778 /* set default 1 bit mode */ ··· 809 807 slot->clock = ios->clock; 810 808 } 811 809 812 - if (slot->host->drv_data->set_ios) 813 - slot->host->drv_data->set_ios(slot->host, ios); 810 + if (drv_data && drv_data->set_ios) 811 + drv_data->set_ios(slot->host, ios); 814 812 815 813 switch (ios->power_mode) { 816 814 case MMC_POWER_UP: ··· 1817 1815 { 1818 1816 struct mmc_host *mmc; 1819 1817 struct dw_mci_slot *slot; 1818 + struct dw_mci_drv_data *drv_data = host->drv_data; 1820 1819 int ctrl_id, ret; 1821 1820 u8 bus_width; 1822 1821 ··· 1857 1854 } else { 1858 1855 ctrl_id = to_platform_device(host->dev)->id; 1859 1856 } 1860 - if (host->drv_data && host->drv_data->caps) 1861 - mmc->caps |= host->drv_data->caps[ctrl_id]; 1857 + if (drv_data && drv_data->caps) 1858 + mmc->caps |= drv_data->caps[ctrl_id]; 1862 1859 1863 1860 if (host->pdata->caps2) 1864 1861 mmc->caps2 = host->pdata->caps2; ··· 1870 1867 else 1871 1868 bus_width = 1; 1872 1869 1873 - if (host->drv_data->setup_bus) { 1870 + if (drv_data && drv_data->setup_bus) { 1874 1871 struct device_node *slot_np; 1875 1872 slot_np = dw_mci_of_find_slot_node(host->dev, slot->id); 1876 - ret = host->drv_data->setup_bus(host, slot_np, bus_width); 1873 + ret = drv_data->setup_bus(host, slot_np, bus_width); 1877 1874 if (ret) 1878 1875 goto err_setup_bus; 1879 1876 } ··· 1971 1968 /* Determine which DMA interface to use */ 1972 1969 #ifdef CONFIG_MMC_DW_IDMAC 1973 1970 host->dma_ops = &dw_mci_idmac_ops; 1974 - dev_info(&host->dev, "Using internal DMA controller.\n"); 1971 + dev_info(host->dev, "Using internal DMA controller.\n"); 1975 1972 #endif 1976 1973 1977 1974 if (!host->dma_ops) ··· 2038 2035 struct dw_mci_board *pdata; 2039 2036 struct device *dev = host->dev; 2040 2037 struct device_node *np = dev->of_node; 2038 + struct dw_mci_drv_data *drv_data = host->drv_data; 2041 2039 int idx, ret; 2042 2040 2043 2041 pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); ··· 2066 2062 2067 2063 of_property_read_u32(np, "card-detect-delay", &pdata->detect_delay_ms); 2068 2064 2069 - if (host->drv_data->parse_dt) { 2070 - ret = host->drv_data->parse_dt(host); 2065 + if (drv_data && drv_data->parse_dt) { 2066 + ret = drv_data->parse_dt(host); 2071 2067 if (ret) 2072 2068 return ERR_PTR(ret); 2073 2069 } ··· 2084 2080 2085 2081 int dw_mci_probe(struct dw_mci *host) 2086 2082 { 2083 + struct dw_mci_drv_data *drv_data = host->drv_data; 2087 2084 int width, i, ret = 0; 2088 2085 u32 fifo_size; 2089 2086 int init_slots = 0; ··· 2132 2127 else 2133 2128 host->bus_hz = clk_get_rate(host->ciu_clk); 2134 2129 2135 - if (host->drv_data->setup_clock) { 2136 - ret = host->drv_data->setup_clock(host); 2130 + if (drv_data && drv_data->setup_clock) { 2131 + ret = drv_data->setup_clock(host); 2137 2132 if (ret) { 2138 2133 dev_err(host->dev, 2139 2134 "implementation specific clock setup failed\n"); ··· 2233 2228 else 2234 2229 host->num_slots = ((mci_readl(host, HCON) >> 1) & 0x1F) + 1; 2235 2230 2231 + /* 2232 + * Enable interrupts for command done, data over, data empty, card det, 2233 + * receive ready and error such as transmit, receive timeout, crc error 2234 + */ 2235 + mci_writel(host, RINTSTS, 0xFFFFFFFF); 2236 + mci_writel(host, INTMASK, SDMMC_INT_CMD_DONE | SDMMC_INT_DATA_OVER | 2237 + SDMMC_INT_TXDR | SDMMC_INT_RXDR | 2238 + DW_MCI_ERROR_FLAGS | SDMMC_INT_CD); 2239 + mci_writel(host, CTRL, SDMMC_CTRL_INT_ENABLE); /* Enable mci interrupt */ 2240 + 2241 + dev_info(host->dev, "DW MMC controller at irq %d, " 2242 + "%d bit host data width, " 2243 + "%u deep fifo\n", 2244 + host->irq, width, fifo_size); 2245 + 2236 2246 /* We need at least one slot to succeed */ 2237 2247 for (i = 0; i < host->num_slots; i++) { 2238 2248 ret = dw_mci_init_slot(host, i); ··· 2277 2257 else 2278 2258 host->data_offset = DATA_240A_OFFSET; 2279 2259 2280 - /* 2281 - * Enable interrupts for command done, data over, data empty, card det, 2282 - * receive ready and error such as transmit, receive timeout, crc error 2283 - */ 2284 - mci_writel(host, RINTSTS, 0xFFFFFFFF); 2285 - mci_writel(host, INTMASK, SDMMC_INT_CMD_DONE | SDMMC_INT_DATA_OVER | 2286 - SDMMC_INT_TXDR | SDMMC_INT_RXDR | 2287 - DW_MCI_ERROR_FLAGS | SDMMC_INT_CD); 2288 - mci_writel(host, CTRL, SDMMC_CTRL_INT_ENABLE); /* Enable mci interrupt */ 2289 - 2290 - dev_info(host->dev, "DW MMC controller at irq %d, " 2291 - "%d bit host data width, " 2292 - "%u deep fifo\n", 2293 - host->irq, width, fifo_size); 2294 2260 if (host->quirks & DW_MCI_QUIRK_IDMAC_DTO) 2295 2261 dev_info(host->dev, "Internal DMAC interrupt fix enabled.\n"); 2296 2262
+1 -1
drivers/mmc/host/mxcmmc.c
··· 1134 1134 MODULE_DESCRIPTION("i.MX Multimedia Card Interface Driver"); 1135 1135 MODULE_AUTHOR("Sascha Hauer, Pengutronix"); 1136 1136 MODULE_LICENSE("GPL"); 1137 - MODULE_ALIAS("platform:imx-mmc"); 1137 + MODULE_ALIAS("platform:mxc-mmc");
+12 -7
drivers/mmc/host/omap_hsmmc.c
··· 178 178 179 179 static int omap_hsmmc_card_detect(struct device *dev, int slot) 180 180 { 181 - struct omap_mmc_platform_data *mmc = dev->platform_data; 181 + struct omap_hsmmc_host *host = dev_get_drvdata(dev); 182 + struct omap_mmc_platform_data *mmc = host->pdata; 182 183 183 184 /* NOTE: assumes card detect signal is active-low */ 184 185 return !gpio_get_value_cansleep(mmc->slots[0].switch_pin); ··· 187 186 188 187 static int omap_hsmmc_get_wp(struct device *dev, int slot) 189 188 { 190 - struct omap_mmc_platform_data *mmc = dev->platform_data; 189 + struct omap_hsmmc_host *host = dev_get_drvdata(dev); 190 + struct omap_mmc_platform_data *mmc = host->pdata; 191 191 192 192 /* NOTE: assumes write protect signal is active-high */ 193 193 return gpio_get_value_cansleep(mmc->slots[0].gpio_wp); ··· 196 194 197 195 static int omap_hsmmc_get_cover_state(struct device *dev, int slot) 198 196 { 199 - struct omap_mmc_platform_data *mmc = dev->platform_data; 197 + struct omap_hsmmc_host *host = dev_get_drvdata(dev); 198 + struct omap_mmc_platform_data *mmc = host->pdata; 200 199 201 200 /* NOTE: assumes card detect signal is active-low */ 202 201 return !gpio_get_value_cansleep(mmc->slots[0].switch_pin); ··· 207 204 208 205 static int omap_hsmmc_suspend_cdirq(struct device *dev, int slot) 209 206 { 210 - struct omap_mmc_platform_data *mmc = dev->platform_data; 207 + struct omap_hsmmc_host *host = dev_get_drvdata(dev); 208 + struct omap_mmc_platform_data *mmc = host->pdata; 211 209 212 210 disable_irq(mmc->slots[0].card_detect_irq); 213 211 return 0; ··· 216 212 217 213 static int omap_hsmmc_resume_cdirq(struct device *dev, int slot) 218 214 { 219 - struct omap_mmc_platform_data *mmc = dev->platform_data; 215 + struct omap_hsmmc_host *host = dev_get_drvdata(dev); 216 + struct omap_mmc_platform_data *mmc = host->pdata; 220 217 221 218 enable_irq(mmc->slots[0].card_detect_irq); 222 219 return 0; ··· 2014 2009 clk_put(host->dbclk); 2015 2010 } 2016 2011 2017 - mmc_free_host(host->mmc); 2012 + omap_hsmmc_gpio_free(host->pdata); 2018 2013 iounmap(host->base); 2019 - omap_hsmmc_gpio_free(pdev->dev.platform_data); 2014 + mmc_free_host(host->mmc); 2020 2015 2021 2016 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 2022 2017 if (res)
+20 -18
drivers/mmc/host/sdhci-dove.c
··· 19 19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 20 */ 21 21 22 + #include <linux/err.h> 22 23 #include <linux/io.h> 23 24 #include <linux/clk.h> 24 25 #include <linux/err.h> ··· 85 84 struct sdhci_dove_priv *priv; 86 85 int ret; 87 86 88 - ret = sdhci_pltfm_register(pdev, &sdhci_dove_pdata); 89 - if (ret) 90 - goto sdhci_dove_register_fail; 91 - 92 87 priv = devm_kzalloc(&pdev->dev, sizeof(struct sdhci_dove_priv), 93 88 GFP_KERNEL); 94 89 if (!priv) { 95 90 dev_err(&pdev->dev, "unable to allocate private data"); 96 - ret = -ENOMEM; 97 - goto sdhci_dove_allocate_fail; 91 + return -ENOMEM; 98 92 } 93 + 94 + priv->clk = clk_get(&pdev->dev, NULL); 95 + if (!IS_ERR(priv->clk)) 96 + clk_prepare_enable(priv->clk); 97 + 98 + ret = sdhci_pltfm_register(pdev, &sdhci_dove_pdata); 99 + if (ret) 100 + goto sdhci_dove_register_fail; 99 101 100 102 host = platform_get_drvdata(pdev); 101 103 pltfm_host = sdhci_priv(host); 102 104 pltfm_host->priv = priv; 103 105 104 - priv->clk = clk_get(&pdev->dev, NULL); 105 - if (!IS_ERR(priv->clk)) 106 - clk_prepare_enable(priv->clk); 107 106 return 0; 108 107 109 - sdhci_dove_allocate_fail: 110 - sdhci_pltfm_unregister(pdev); 111 108 sdhci_dove_register_fail: 109 + if (!IS_ERR(priv->clk)) { 110 + clk_disable_unprepare(priv->clk); 111 + clk_put(priv->clk); 112 + } 112 113 return ret; 113 114 } 114 115 ··· 120 117 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 121 118 struct sdhci_dove_priv *priv = pltfm_host->priv; 122 119 123 - if (priv->clk) { 124 - if (!IS_ERR(priv->clk)) { 125 - clk_disable_unprepare(priv->clk); 126 - clk_put(priv->clk); 127 - } 128 - devm_kfree(&pdev->dev, priv->clk); 120 + sdhci_pltfm_unregister(pdev); 121 + 122 + if (!IS_ERR(priv->clk)) { 123 + clk_disable_unprepare(priv->clk); 124 + clk_put(priv->clk); 129 125 } 130 - return sdhci_pltfm_unregister(pdev); 126 + return 0; 131 127 } 132 128 133 129 static const struct of_device_id sdhci_dove_of_match_table[] __devinitdata = {
+11
drivers/mmc/host/sdhci-of-esdhc.c
··· 169 169 } 170 170 #endif 171 171 172 + static void esdhc_of_platform_init(struct sdhci_host *host) 173 + { 174 + u32 vvn; 175 + 176 + vvn = in_be32(host->ioaddr + SDHCI_SLOT_INT_STATUS); 177 + vvn = (vvn & SDHCI_VENDOR_VER_MASK) >> SDHCI_VENDOR_VER_SHIFT; 178 + if (vvn == VENDOR_V_22) 179 + host->quirks2 |= SDHCI_QUIRK2_HOST_NO_CMD23; 180 + } 181 + 172 182 static struct sdhci_ops sdhci_esdhc_ops = { 173 183 .read_l = esdhc_readl, 174 184 .read_w = esdhc_readw, ··· 190 180 .enable_dma = esdhc_of_enable_dma, 191 181 .get_max_clock = esdhc_of_get_max_clock, 192 182 .get_min_clock = esdhc_of_get_min_clock, 183 + .platform_init = esdhc_of_platform_init, 193 184 #ifdef CONFIG_PM 194 185 .platform_suspend = esdhc_of_suspend, 195 186 .platform_resume = esdhc_of_resume,
+1 -1
drivers/mmc/host/sdhci-pci.c
··· 1196 1196 return ERR_PTR(-ENODEV); 1197 1197 } 1198 1198 1199 - if (pci_resource_len(pdev, bar) != 0x100) { 1199 + if (pci_resource_len(pdev, bar) < 0x100) { 1200 1200 dev_err(&pdev->dev, "Invalid iomem size. You may " 1201 1201 "experience problems.\n"); 1202 1202 }
+7
drivers/mmc/host/sdhci-pltfm.c
··· 150 150 goto err_remap; 151 151 } 152 152 153 + /* 154 + * Some platforms need to probe the controller to be able to 155 + * determine which caps should be used. 156 + */ 157 + if (host->ops && host->ops->platform_init) 158 + host->ops->platform_init(host); 159 + 153 160 platform_set_drvdata(pdev, host); 154 161 155 162 return host;
+16 -14
drivers/mmc/host/sdhci-s3c.c
··· 211 211 if (ourhost->cur_clk != best_src) { 212 212 struct clk *clk = ourhost->clk_bus[best_src]; 213 213 214 - clk_enable(clk); 215 - clk_disable(ourhost->clk_bus[ourhost->cur_clk]); 214 + clk_prepare_enable(clk); 215 + clk_disable_unprepare(ourhost->clk_bus[ourhost->cur_clk]); 216 216 217 217 /* turn clock off to card before changing clock source */ 218 218 writew(0, host->ioaddr + SDHCI_CLOCK_CONTROL); ··· 607 607 } 608 608 609 609 /* enable the local io clock and keep it running for the moment. */ 610 - clk_enable(sc->clk_io); 610 + clk_prepare_enable(sc->clk_io); 611 611 612 612 for (clks = 0, ptr = 0; ptr < MAX_BUS_CLK; ptr++) { 613 613 struct clk *clk; ··· 638 638 } 639 639 640 640 #ifndef CONFIG_PM_RUNTIME 641 - clk_enable(sc->clk_bus[sc->cur_clk]); 641 + clk_prepare_enable(sc->clk_bus[sc->cur_clk]); 642 642 #endif 643 643 644 644 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ··· 747 747 sdhci_s3c_setup_card_detect_gpio(sc); 748 748 749 749 #ifdef CONFIG_PM_RUNTIME 750 - clk_disable(sc->clk_io); 750 + if (pdata->cd_type != S3C_SDHCI_CD_INTERNAL) 751 + clk_disable_unprepare(sc->clk_io); 751 752 #endif 752 753 return 0; 753 754 754 755 err_req_regs: 755 756 #ifndef CONFIG_PM_RUNTIME 756 - clk_disable(sc->clk_bus[sc->cur_clk]); 757 + clk_disable_unprepare(sc->clk_bus[sc->cur_clk]); 757 758 #endif 758 759 for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) { 759 760 if (sc->clk_bus[ptr]) { ··· 763 762 } 764 763 765 764 err_no_busclks: 766 - clk_disable(sc->clk_io); 765 + clk_disable_unprepare(sc->clk_io); 767 766 clk_put(sc->clk_io); 768 767 769 768 err_io_clk: ··· 795 794 gpio_free(sc->ext_cd_gpio); 796 795 797 796 #ifdef CONFIG_PM_RUNTIME 798 - clk_enable(sc->clk_io); 797 + if (pdata->cd_type != S3C_SDHCI_CD_INTERNAL) 798 + clk_prepare_enable(sc->clk_io); 799 799 #endif 800 800 sdhci_remove_host(host, 1); 801 801 ··· 804 802 pm_runtime_disable(&pdev->dev); 805 803 806 804 #ifndef CONFIG_PM_RUNTIME 807 - clk_disable(sc->clk_bus[sc->cur_clk]); 805 + clk_disable_unprepare(sc->clk_bus[sc->cur_clk]); 808 806 #endif 809 807 for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) { 810 808 if (sc->clk_bus[ptr]) { 811 809 clk_put(sc->clk_bus[ptr]); 812 810 } 813 811 } 814 - clk_disable(sc->clk_io); 812 + clk_disable_unprepare(sc->clk_io); 815 813 clk_put(sc->clk_io); 816 814 817 815 if (pdev->dev.of_node) { ··· 851 849 852 850 ret = sdhci_runtime_suspend_host(host); 853 851 854 - clk_disable(ourhost->clk_bus[ourhost->cur_clk]); 855 - clk_disable(busclk); 852 + clk_disable_unprepare(ourhost->clk_bus[ourhost->cur_clk]); 853 + clk_disable_unprepare(busclk); 856 854 return ret; 857 855 } 858 856 ··· 863 861 struct clk *busclk = ourhost->clk_io; 864 862 int ret; 865 863 866 - clk_enable(busclk); 867 - clk_enable(ourhost->clk_bus[ourhost->cur_clk]); 864 + clk_prepare_enable(busclk); 865 + clk_prepare_enable(ourhost->clk_bus[ourhost->cur_clk]); 868 866 ret = sdhci_runtime_resume_host(host); 869 867 return ret; 870 868 }
+27 -15
drivers/mmc/host/sdhci.c
··· 1315 1315 */ 1316 1316 if ((host->flags & SDHCI_NEEDS_RETUNING) && 1317 1317 !(present_state & (SDHCI_DOING_WRITE | SDHCI_DOING_READ))) { 1318 - /* eMMC uses cmd21 while sd and sdio use cmd19 */ 1319 - tuning_opcode = mmc->card->type == MMC_TYPE_MMC ? 1320 - MMC_SEND_TUNING_BLOCK_HS200 : 1321 - MMC_SEND_TUNING_BLOCK; 1322 - spin_unlock_irqrestore(&host->lock, flags); 1323 - sdhci_execute_tuning(mmc, tuning_opcode); 1324 - spin_lock_irqsave(&host->lock, flags); 1318 + if (mmc->card) { 1319 + /* eMMC uses cmd21 but sd and sdio use cmd19 */ 1320 + tuning_opcode = 1321 + mmc->card->type == MMC_TYPE_MMC ? 1322 + MMC_SEND_TUNING_BLOCK_HS200 : 1323 + MMC_SEND_TUNING_BLOCK; 1324 + spin_unlock_irqrestore(&host->lock, flags); 1325 + sdhci_execute_tuning(mmc, tuning_opcode); 1326 + spin_lock_irqsave(&host->lock, flags); 1325 1327 1326 - /* Restore original mmc_request structure */ 1327 - host->mrq = mrq; 1328 + /* Restore original mmc_request structure */ 1329 + host->mrq = mrq; 1330 + } 1328 1331 } 1329 1332 1330 1333 if (mrq->sbc && !(host->flags & SDHCI_AUTO_CMD23)) ··· 2840 2837 if (!(host->quirks & SDHCI_QUIRK_FORCE_1_BIT_DATA)) 2841 2838 mmc->caps |= MMC_CAP_4_BIT_DATA; 2842 2839 2840 + if (host->quirks2 & SDHCI_QUIRK2_HOST_NO_CMD23) 2841 + mmc->caps &= ~MMC_CAP_CMD23; 2842 + 2843 2843 if (caps[0] & SDHCI_CAN_DO_HISPD) 2844 2844 mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED; 2845 2845 ··· 2852 2846 2853 2847 /* If vqmmc regulator and no 1.8V signalling, then there's no UHS */ 2854 2848 host->vqmmc = regulator_get(mmc_dev(mmc), "vqmmc"); 2855 - if (IS_ERR(host->vqmmc)) { 2856 - pr_info("%s: no vqmmc regulator found\n", mmc_hostname(mmc)); 2857 - host->vqmmc = NULL; 2849 + if (IS_ERR_OR_NULL(host->vqmmc)) { 2850 + if (PTR_ERR(host->vqmmc) < 0) { 2851 + pr_info("%s: no vqmmc regulator found\n", 2852 + mmc_hostname(mmc)); 2853 + host->vqmmc = NULL; 2854 + } 2858 2855 } 2859 2856 else if (regulator_is_supported_voltage(host->vqmmc, 1800000, 1800000)) 2860 2857 regulator_enable(host->vqmmc); ··· 2913 2904 ocr_avail = 0; 2914 2905 2915 2906 host->vmmc = regulator_get(mmc_dev(mmc), "vmmc"); 2916 - if (IS_ERR(host->vmmc)) { 2917 - pr_info("%s: no vmmc regulator found\n", mmc_hostname(mmc)); 2918 - host->vmmc = NULL; 2907 + if (IS_ERR_OR_NULL(host->vmmc)) { 2908 + if (PTR_ERR(host->vmmc) < 0) { 2909 + pr_info("%s: no vmmc regulator found\n", 2910 + mmc_hostname(mmc)); 2911 + host->vmmc = NULL; 2912 + } 2919 2913 } else 2920 2914 regulator_enable(host->vmmc); 2921 2915
+1
drivers/mmc/host/sdhci.h
··· 278 278 void (*hw_reset)(struct sdhci_host *host); 279 279 void (*platform_suspend)(struct sdhci_host *host); 280 280 void (*platform_resume)(struct sdhci_host *host); 281 + void (*platform_init)(struct sdhci_host *host); 281 282 }; 282 283 283 284 #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
+1 -1
drivers/mmc/host/sh_mmcif.c
··· 1466 1466 1467 1467 platform_set_drvdata(pdev, NULL); 1468 1468 1469 + clk_disable(host->hclk); 1469 1470 mmc_free_host(host->mmc); 1470 1471 pm_runtime_put_sync(&pdev->dev); 1471 - clk_disable(host->hclk); 1472 1472 pm_runtime_disable(&pdev->dev); 1473 1473 1474 1474 return 0;
+3 -3
include/linux/mmc/dw_mmc.h
··· 137 137 138 138 dma_addr_t sg_dma; 139 139 void *sg_cpu; 140 - struct dw_mci_dma_ops *dma_ops; 140 + const struct dw_mci_dma_ops *dma_ops; 141 141 #ifdef CONFIG_MMC_DW_IDMAC 142 142 unsigned int ring_size; 143 143 #else ··· 162 162 u16 data_offset; 163 163 struct device *dev; 164 164 struct dw_mci_board *pdata; 165 - struct dw_mci_drv_data *drv_data; 165 + const struct dw_mci_drv_data *drv_data; 166 166 void *priv; 167 167 struct clk *biu_clk; 168 168 struct clk *ciu_clk; ··· 186 186 187 187 struct regulator *vmmc; /* Power regulator */ 188 188 unsigned long irq_flags; /* IRQ flags */ 189 - unsigned int irq; 189 + int irq; 190 190 }; 191 191 192 192 /* DMA ops for Internal/External DMAC interface */
+1
include/linux/mmc/sdhci.h
··· 91 91 unsigned int quirks2; /* More deviations from spec. */ 92 92 93 93 #define SDHCI_QUIRK2_HOST_OFF_CARD_ON (1<<0) 94 + #define SDHCI_QUIRK2_HOST_NO_CMD23 (1<<1) 94 95 95 96 int irq; /* Device IRQ */ 96 97 void __iomem *ioaddr; /* Mapped address */