| .. | .. |
|---|
| 30 | 30 | #include <linux/clk.h> |
|---|
| 31 | 31 | #include <linux/of.h> |
|---|
| 32 | 32 | #include <linux/of_irq.h> |
|---|
| 33 | | -#include <linux/of_gpio.h> |
|---|
| 34 | 33 | #include <linux/of_device.h> |
|---|
| 35 | 34 | #include <linux/mmc/host.h> |
|---|
| 36 | 35 | #include <linux/mmc/core.h> |
|---|
| .. | .. |
|---|
| 38 | 37 | #include <linux/mmc/slot-gpio.h> |
|---|
| 39 | 38 | #include <linux/io.h> |
|---|
| 40 | 39 | #include <linux/irq.h> |
|---|
| 41 | | -#include <linux/gpio.h> |
|---|
| 42 | 40 | #include <linux/regulator/consumer.h> |
|---|
| 43 | 41 | #include <linux/pinctrl/consumer.h> |
|---|
| 44 | 42 | #include <linux/pm_runtime.h> |
|---|
| .. | .. |
|---|
| 198 | 196 | struct dma_chan *rx_chan; |
|---|
| 199 | 197 | int response_busy; |
|---|
| 200 | 198 | int context_loss; |
|---|
| 201 | | - int protect_card; |
|---|
| 202 | 199 | int reqs_blocked; |
|---|
| 203 | 200 | int req_in_progress; |
|---|
| 204 | 201 | unsigned long clk_rate; |
|---|
| .. | .. |
|---|
| 207 | 204 | #define HSMMC_SDIO_IRQ_ENABLED (1 << 1) /* SDIO irq enabled */ |
|---|
| 208 | 205 | struct omap_hsmmc_next next_data; |
|---|
| 209 | 206 | struct omap_hsmmc_platform_data *pdata; |
|---|
| 210 | | - |
|---|
| 211 | | - /* return MMC cover switch state, can be NULL if not supported. |
|---|
| 212 | | - * |
|---|
| 213 | | - * possible return values: |
|---|
| 214 | | - * 0 - closed |
|---|
| 215 | | - * 1 - open |
|---|
| 216 | | - */ |
|---|
| 217 | | - int (*get_cover_state)(struct device *dev); |
|---|
| 218 | | - |
|---|
| 219 | | - int (*card_detect)(struct device *dev); |
|---|
| 220 | 207 | }; |
|---|
| 221 | 208 | |
|---|
| 222 | 209 | struct omap_mmc_of_data { |
|---|
| .. | .. |
|---|
| 225 | 212 | }; |
|---|
| 226 | 213 | |
|---|
| 227 | 214 | static void omap_hsmmc_start_dma_transfer(struct omap_hsmmc_host *host); |
|---|
| 228 | | - |
|---|
| 229 | | -static int omap_hsmmc_card_detect(struct device *dev) |
|---|
| 230 | | -{ |
|---|
| 231 | | - struct omap_hsmmc_host *host = dev_get_drvdata(dev); |
|---|
| 232 | | - |
|---|
| 233 | | - return mmc_gpio_get_cd(host->mmc); |
|---|
| 234 | | -} |
|---|
| 235 | | - |
|---|
| 236 | | -static int omap_hsmmc_get_cover_state(struct device *dev) |
|---|
| 237 | | -{ |
|---|
| 238 | | - struct omap_hsmmc_host *host = dev_get_drvdata(dev); |
|---|
| 239 | | - |
|---|
| 240 | | - return mmc_gpio_get_cd(host->mmc); |
|---|
| 241 | | -} |
|---|
| 242 | 215 | |
|---|
| 243 | 216 | static int omap_hsmmc_enable_supply(struct mmc_host *mmc) |
|---|
| 244 | 217 | { |
|---|
| .. | .. |
|---|
| 480 | 453 | ret = omap_hsmmc_disable_boot_regulators(host); |
|---|
| 481 | 454 | if (ret) |
|---|
| 482 | 455 | return ret; |
|---|
| 483 | | - |
|---|
| 484 | | - return 0; |
|---|
| 485 | | -} |
|---|
| 486 | | - |
|---|
| 487 | | -static irqreturn_t omap_hsmmc_cover_irq(int irq, void *dev_id); |
|---|
| 488 | | - |
|---|
| 489 | | -static int omap_hsmmc_gpio_init(struct mmc_host *mmc, |
|---|
| 490 | | - struct omap_hsmmc_host *host, |
|---|
| 491 | | - struct omap_hsmmc_platform_data *pdata) |
|---|
| 492 | | -{ |
|---|
| 493 | | - int ret; |
|---|
| 494 | | - |
|---|
| 495 | | - if (gpio_is_valid(pdata->gpio_cod)) { |
|---|
| 496 | | - ret = mmc_gpio_request_cd(mmc, pdata->gpio_cod, 0); |
|---|
| 497 | | - if (ret) |
|---|
| 498 | | - return ret; |
|---|
| 499 | | - |
|---|
| 500 | | - host->get_cover_state = omap_hsmmc_get_cover_state; |
|---|
| 501 | | - mmc_gpio_set_cd_isr(mmc, omap_hsmmc_cover_irq); |
|---|
| 502 | | - } else if (gpio_is_valid(pdata->gpio_cd)) { |
|---|
| 503 | | - ret = mmc_gpio_request_cd(mmc, pdata->gpio_cd, 0); |
|---|
| 504 | | - if (ret) |
|---|
| 505 | | - return ret; |
|---|
| 506 | | - |
|---|
| 507 | | - host->card_detect = omap_hsmmc_card_detect; |
|---|
| 508 | | - } |
|---|
| 509 | | - |
|---|
| 510 | | - if (gpio_is_valid(pdata->gpio_wp)) { |
|---|
| 511 | | - ret = mmc_gpio_request_ro(mmc, pdata->gpio_wp); |
|---|
| 512 | | - if (ret) |
|---|
| 513 | | - return ret; |
|---|
| 514 | | - } |
|---|
| 515 | 456 | |
|---|
| 516 | 457 | return 0; |
|---|
| 517 | 458 | } |
|---|
| .. | .. |
|---|
| 781 | 722 | int reg = 0; |
|---|
| 782 | 723 | unsigned long timeout; |
|---|
| 783 | 724 | |
|---|
| 784 | | - if (host->protect_card) |
|---|
| 785 | | - return; |
|---|
| 786 | | - |
|---|
| 787 | 725 | disable_irq(host->irq); |
|---|
| 788 | 726 | |
|---|
| 789 | 727 | OMAP_HSMMC_WRITE(host->base, IE, INT_EN_MASK); |
|---|
| .. | .. |
|---|
| 803 | 741 | |
|---|
| 804 | 742 | enable_irq(host->irq); |
|---|
| 805 | 743 | } |
|---|
| 806 | | - |
|---|
| 807 | | -static inline |
|---|
| 808 | | -int omap_hsmmc_cover_is_closed(struct omap_hsmmc_host *host) |
|---|
| 809 | | -{ |
|---|
| 810 | | - int r = 1; |
|---|
| 811 | | - |
|---|
| 812 | | - if (host->get_cover_state) |
|---|
| 813 | | - r = host->get_cover_state(host->dev); |
|---|
| 814 | | - return r; |
|---|
| 815 | | -} |
|---|
| 816 | | - |
|---|
| 817 | | -static ssize_t |
|---|
| 818 | | -omap_hsmmc_show_cover_switch(struct device *dev, struct device_attribute *attr, |
|---|
| 819 | | - char *buf) |
|---|
| 820 | | -{ |
|---|
| 821 | | - struct mmc_host *mmc = container_of(dev, struct mmc_host, class_dev); |
|---|
| 822 | | - struct omap_hsmmc_host *host = mmc_priv(mmc); |
|---|
| 823 | | - |
|---|
| 824 | | - return sprintf(buf, "%s\n", |
|---|
| 825 | | - omap_hsmmc_cover_is_closed(host) ? "closed" : "open"); |
|---|
| 826 | | -} |
|---|
| 827 | | - |
|---|
| 828 | | -static DEVICE_ATTR(cover_switch, S_IRUGO, omap_hsmmc_show_cover_switch, NULL); |
|---|
| 829 | 744 | |
|---|
| 830 | 745 | static ssize_t |
|---|
| 831 | 746 | omap_hsmmc_show_slot_name(struct device *dev, struct device_attribute *attr, |
|---|
| .. | .. |
|---|
| 1199 | 1114 | int ret; |
|---|
| 1200 | 1115 | |
|---|
| 1201 | 1116 | /* Disable the clocks */ |
|---|
| 1202 | | - if (host->dbclk) |
|---|
| 1203 | | - clk_disable_unprepare(host->dbclk); |
|---|
| 1117 | + clk_disable_unprepare(host->dbclk); |
|---|
| 1204 | 1118 | |
|---|
| 1205 | 1119 | /* Turn the power off */ |
|---|
| 1206 | 1120 | ret = omap_hsmmc_set_power(host, 0); |
|---|
| .. | .. |
|---|
| 1208 | 1122 | /* Turn the power ON with given VDD 1.8 or 3.0v */ |
|---|
| 1209 | 1123 | if (!ret) |
|---|
| 1210 | 1124 | ret = omap_hsmmc_set_power(host, 1); |
|---|
| 1211 | | - if (host->dbclk) |
|---|
| 1212 | | - clk_prepare_enable(host->dbclk); |
|---|
| 1125 | + clk_prepare_enable(host->dbclk); |
|---|
| 1213 | 1126 | |
|---|
| 1214 | 1127 | if (ret != 0) |
|---|
| 1215 | 1128 | goto err; |
|---|
| .. | .. |
|---|
| 1245 | 1158 | err: |
|---|
| 1246 | 1159 | dev_err(mmc_dev(host->mmc), "Unable to switch operating voltage\n"); |
|---|
| 1247 | 1160 | return ret; |
|---|
| 1248 | | -} |
|---|
| 1249 | | - |
|---|
| 1250 | | -/* Protect the card while the cover is open */ |
|---|
| 1251 | | -static void omap_hsmmc_protect_card(struct omap_hsmmc_host *host) |
|---|
| 1252 | | -{ |
|---|
| 1253 | | - if (!host->get_cover_state) |
|---|
| 1254 | | - return; |
|---|
| 1255 | | - |
|---|
| 1256 | | - host->reqs_blocked = 0; |
|---|
| 1257 | | - if (host->get_cover_state(host->dev)) { |
|---|
| 1258 | | - if (host->protect_card) { |
|---|
| 1259 | | - dev_info(host->dev, "%s: cover is closed, " |
|---|
| 1260 | | - "card is now accessible\n", |
|---|
| 1261 | | - mmc_hostname(host->mmc)); |
|---|
| 1262 | | - host->protect_card = 0; |
|---|
| 1263 | | - } |
|---|
| 1264 | | - } else { |
|---|
| 1265 | | - if (!host->protect_card) { |
|---|
| 1266 | | - dev_info(host->dev, "%s: cover is open, " |
|---|
| 1267 | | - "card is now inaccessible\n", |
|---|
| 1268 | | - mmc_hostname(host->mmc)); |
|---|
| 1269 | | - host->protect_card = 1; |
|---|
| 1270 | | - } |
|---|
| 1271 | | - } |
|---|
| 1272 | | -} |
|---|
| 1273 | | - |
|---|
| 1274 | | -/* |
|---|
| 1275 | | - * irq handler when (cell-phone) cover is mounted/removed |
|---|
| 1276 | | - */ |
|---|
| 1277 | | -static irqreturn_t omap_hsmmc_cover_irq(int irq, void *dev_id) |
|---|
| 1278 | | -{ |
|---|
| 1279 | | - struct omap_hsmmc_host *host = dev_id; |
|---|
| 1280 | | - |
|---|
| 1281 | | - sysfs_notify(&host->mmc->class_dev.kobj, NULL, "cover_switch"); |
|---|
| 1282 | | - |
|---|
| 1283 | | - omap_hsmmc_protect_card(host); |
|---|
| 1284 | | - mmc_detect_change(host->mmc, (HZ * 200) / 1000); |
|---|
| 1285 | | - return IRQ_HANDLED; |
|---|
| 1286 | 1161 | } |
|---|
| 1287 | 1162 | |
|---|
| 1288 | 1163 | static void omap_hsmmc_dma_callback(void *param) |
|---|
| .. | .. |
|---|
| 1555 | 1430 | |
|---|
| 1556 | 1431 | BUG_ON(host->req_in_progress); |
|---|
| 1557 | 1432 | BUG_ON(host->dma_ch != -1); |
|---|
| 1558 | | - if (host->protect_card) { |
|---|
| 1559 | | - if (host->reqs_blocked < 3) { |
|---|
| 1560 | | - /* |
|---|
| 1561 | | - * Ensure the controller is left in a consistent |
|---|
| 1562 | | - * state by resetting the command and data state |
|---|
| 1563 | | - * machines. |
|---|
| 1564 | | - */ |
|---|
| 1565 | | - omap_hsmmc_reset_controller_fsm(host, SRD); |
|---|
| 1566 | | - omap_hsmmc_reset_controller_fsm(host, SRC); |
|---|
| 1567 | | - host->reqs_blocked += 1; |
|---|
| 1568 | | - } |
|---|
| 1569 | | - req->cmd->error = -EBADF; |
|---|
| 1570 | | - if (req->data) |
|---|
| 1571 | | - req->data->error = -EBADF; |
|---|
| 1572 | | - req->cmd->retries = 0; |
|---|
| 1573 | | - mmc_request_done(mmc, req); |
|---|
| 1574 | | - return; |
|---|
| 1575 | | - } else if (host->reqs_blocked) |
|---|
| 1433 | + if (host->reqs_blocked) |
|---|
| 1576 | 1434 | host->reqs_blocked = 0; |
|---|
| 1577 | 1435 | WARN_ON(host->mrq != NULL); |
|---|
| 1578 | 1436 | host->mrq = req; |
|---|
| .. | .. |
|---|
| 1646 | 1504 | omap_hsmmc_set_bus_mode(host); |
|---|
| 1647 | 1505 | } |
|---|
| 1648 | 1506 | |
|---|
| 1649 | | -static int omap_hsmmc_get_cd(struct mmc_host *mmc) |
|---|
| 1650 | | -{ |
|---|
| 1651 | | - struct omap_hsmmc_host *host = mmc_priv(mmc); |
|---|
| 1652 | | - |
|---|
| 1653 | | - if (!host->card_detect) |
|---|
| 1654 | | - return -ENOSYS; |
|---|
| 1655 | | - return host->card_detect(host->dev); |
|---|
| 1656 | | -} |
|---|
| 1657 | | - |
|---|
| 1658 | 1507 | static void omap_hsmmc_init_card(struct mmc_host *mmc, struct mmc_card *card) |
|---|
| 1659 | 1508 | { |
|---|
| 1660 | 1509 | struct omap_hsmmc_host *host = mmc_priv(mmc); |
|---|
| 1661 | 1510 | |
|---|
| 1662 | | - if (mmc_pdata(host)->init_card) |
|---|
| 1663 | | - mmc_pdata(host)->init_card(card); |
|---|
| 1664 | | - else if (card->type == MMC_TYPE_SDIO || |
|---|
| 1665 | | - card->type == MMC_TYPE_SD_COMBO) { |
|---|
| 1511 | + if (card->type == MMC_TYPE_SDIO || card->type == MMC_TYPE_SD_COMBO) { |
|---|
| 1666 | 1512 | struct device_node *np = mmc_dev(mmc)->of_node; |
|---|
| 1667 | 1513 | |
|---|
| 1668 | 1514 | /* |
|---|
| .. | .. |
|---|
| 1757 | 1603 | ret = PTR_ERR(p); |
|---|
| 1758 | 1604 | goto err_free_irq; |
|---|
| 1759 | 1605 | } |
|---|
| 1760 | | - if (IS_ERR(pinctrl_lookup_state(p, PINCTRL_STATE_DEFAULT))) { |
|---|
| 1761 | | - dev_info(host->dev, "missing default pinctrl state\n"); |
|---|
| 1762 | | - devm_pinctrl_put(p); |
|---|
| 1763 | | - ret = -EINVAL; |
|---|
| 1764 | | - goto err_free_irq; |
|---|
| 1765 | | - } |
|---|
| 1766 | 1606 | |
|---|
| 1767 | 1607 | if (IS_ERR(pinctrl_lookup_state(p, PINCTRL_STATE_IDLE))) { |
|---|
| 1768 | 1608 | dev_info(host->dev, "missing idle pinctrl state\n"); |
|---|
| .. | .. |
|---|
| 1823 | 1663 | .pre_req = omap_hsmmc_pre_req, |
|---|
| 1824 | 1664 | .request = omap_hsmmc_request, |
|---|
| 1825 | 1665 | .set_ios = omap_hsmmc_set_ios, |
|---|
| 1826 | | - .get_cd = omap_hsmmc_get_cd, |
|---|
| 1666 | + .get_cd = mmc_gpio_get_cd, |
|---|
| 1827 | 1667 | .get_ro = mmc_gpio_get_ro, |
|---|
| 1828 | 1668 | .init_card = omap_hsmmc_init_card, |
|---|
| 1829 | 1669 | .enable_sdio_irq = omap_hsmmc_enable_sdio_irq, |
|---|
| .. | .. |
|---|
| 1831 | 1671 | |
|---|
| 1832 | 1672 | #ifdef CONFIG_DEBUG_FS |
|---|
| 1833 | 1673 | |
|---|
| 1834 | | -static int omap_hsmmc_regs_show(struct seq_file *s, void *data) |
|---|
| 1674 | +static int mmc_regs_show(struct seq_file *s, void *data) |
|---|
| 1835 | 1675 | { |
|---|
| 1836 | 1676 | struct mmc_host *mmc = s->private; |
|---|
| 1837 | 1677 | struct omap_hsmmc_host *host = mmc_priv(mmc); |
|---|
| .. | .. |
|---|
| 1870 | 1710 | return 0; |
|---|
| 1871 | 1711 | } |
|---|
| 1872 | 1712 | |
|---|
| 1873 | | -static int omap_hsmmc_regs_open(struct inode *inode, struct file *file) |
|---|
| 1874 | | -{ |
|---|
| 1875 | | - return single_open(file, omap_hsmmc_regs_show, inode->i_private); |
|---|
| 1876 | | -} |
|---|
| 1877 | | - |
|---|
| 1878 | | -static const struct file_operations mmc_regs_fops = { |
|---|
| 1879 | | - .open = omap_hsmmc_regs_open, |
|---|
| 1880 | | - .read = seq_read, |
|---|
| 1881 | | - .llseek = seq_lseek, |
|---|
| 1882 | | - .release = single_release, |
|---|
| 1883 | | -}; |
|---|
| 1713 | +DEFINE_SHOW_ATTRIBUTE(mmc_regs); |
|---|
| 1884 | 1714 | |
|---|
| 1885 | 1715 | static void omap_hsmmc_debugfs(struct mmc_host *mmc) |
|---|
| 1886 | 1716 | { |
|---|
| .. | .. |
|---|
| 1949 | 1779 | |
|---|
| 1950 | 1780 | if (of_find_property(np, "ti,dual-volt", NULL)) |
|---|
| 1951 | 1781 | pdata->controller_flags |= OMAP_HSMMC_SUPPORTS_DUAL_VOLT; |
|---|
| 1952 | | - |
|---|
| 1953 | | - pdata->gpio_cd = -EINVAL; |
|---|
| 1954 | | - pdata->gpio_cod = -EINVAL; |
|---|
| 1955 | | - pdata->gpio_wp = -EINVAL; |
|---|
| 1956 | 1782 | |
|---|
| 1957 | 1783 | if (of_find_property(np, "ti,non-removable", NULL)) { |
|---|
| 1958 | 1784 | pdata->nonremovable = true; |
|---|
| .. | .. |
|---|
| 2038 | 1864 | host->pbias_enabled = 0; |
|---|
| 2039 | 1865 | host->vqmmc_enabled = 0; |
|---|
| 2040 | 1866 | |
|---|
| 2041 | | - ret = omap_hsmmc_gpio_init(mmc, host, pdata); |
|---|
| 2042 | | - if (ret) |
|---|
| 2043 | | - goto err_gpio; |
|---|
| 2044 | | - |
|---|
| 2045 | 1867 | platform_set_drvdata(pdev, host); |
|---|
| 2046 | 1868 | |
|---|
| 2047 | 1869 | if (pdev->dev.of_node) |
|---|
| .. | .. |
|---|
| 2098 | 1920 | mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count; |
|---|
| 2099 | 1921 | |
|---|
| 2100 | 1922 | mmc->caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | |
|---|
| 2101 | | - MMC_CAP_WAIT_WHILE_BUSY | MMC_CAP_ERASE | MMC_CAP_CMD23; |
|---|
| 1923 | + MMC_CAP_WAIT_WHILE_BUSY | MMC_CAP_CMD23; |
|---|
| 2102 | 1924 | |
|---|
| 2103 | 1925 | mmc->caps |= mmc_pdata(host)->caps; |
|---|
| 2104 | 1926 | if (mmc->caps & MMC_CAP_8_BIT_DATA) |
|---|
| .. | .. |
|---|
| 2165 | 1987 | if (!ret) |
|---|
| 2166 | 1988 | mmc->caps |= MMC_CAP_SDIO_IRQ; |
|---|
| 2167 | 1989 | |
|---|
| 2168 | | - omap_hsmmc_protect_card(host); |
|---|
| 2169 | | - |
|---|
| 2170 | 1990 | mmc_add_host(mmc); |
|---|
| 2171 | 1991 | |
|---|
| 2172 | 1992 | if (mmc_pdata(host)->name != NULL) { |
|---|
| 2173 | 1993 | ret = device_create_file(&mmc->class_dev, &dev_attr_slot_name); |
|---|
| 2174 | | - if (ret < 0) |
|---|
| 2175 | | - goto err_slot_name; |
|---|
| 2176 | | - } |
|---|
| 2177 | | - if (host->get_cover_state) { |
|---|
| 2178 | | - ret = device_create_file(&mmc->class_dev, |
|---|
| 2179 | | - &dev_attr_cover_switch); |
|---|
| 2180 | 1994 | if (ret < 0) |
|---|
| 2181 | 1995 | goto err_slot_name; |
|---|
| 2182 | 1996 | } |
|---|
| .. | .. |
|---|
| 2198 | 2012 | pm_runtime_dont_use_autosuspend(host->dev); |
|---|
| 2199 | 2013 | pm_runtime_put_sync(host->dev); |
|---|
| 2200 | 2014 | pm_runtime_disable(host->dev); |
|---|
| 2201 | | - if (host->dbclk) |
|---|
| 2202 | | - clk_disable_unprepare(host->dbclk); |
|---|
| 2015 | + clk_disable_unprepare(host->dbclk); |
|---|
| 2203 | 2016 | err1: |
|---|
| 2204 | | -err_gpio: |
|---|
| 2205 | 2017 | mmc_free_host(mmc); |
|---|
| 2206 | 2018 | err: |
|---|
| 2207 | 2019 | return ret; |
|---|
| .. | .. |
|---|
| 2222 | 2034 | pm_runtime_put_sync(host->dev); |
|---|
| 2223 | 2035 | pm_runtime_disable(host->dev); |
|---|
| 2224 | 2036 | device_init_wakeup(&pdev->dev, false); |
|---|
| 2225 | | - if (host->dbclk) |
|---|
| 2226 | | - clk_disable_unprepare(host->dbclk); |
|---|
| 2037 | + clk_disable_unprepare(host->dbclk); |
|---|
| 2227 | 2038 | |
|---|
| 2228 | 2039 | mmc_free_host(host->mmc); |
|---|
| 2229 | 2040 | |
|---|
| .. | .. |
|---|
| 2248 | 2059 | OMAP_HSMMC_READ(host->base, HCTL) & ~SDBP); |
|---|
| 2249 | 2060 | } |
|---|
| 2250 | 2061 | |
|---|
| 2251 | | - if (host->dbclk) |
|---|
| 2252 | | - clk_disable_unprepare(host->dbclk); |
|---|
| 2062 | + clk_disable_unprepare(host->dbclk); |
|---|
| 2253 | 2063 | |
|---|
| 2254 | 2064 | pm_runtime_put_sync(host->dev); |
|---|
| 2255 | 2065 | return 0; |
|---|
| .. | .. |
|---|
| 2265 | 2075 | |
|---|
| 2266 | 2076 | pm_runtime_get_sync(host->dev); |
|---|
| 2267 | 2077 | |
|---|
| 2268 | | - if (host->dbclk) |
|---|
| 2269 | | - clk_prepare_enable(host->dbclk); |
|---|
| 2078 | + clk_prepare_enable(host->dbclk); |
|---|
| 2270 | 2079 | |
|---|
| 2271 | 2080 | if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER)) |
|---|
| 2272 | 2081 | omap_hsmmc_conf_bus_power(host); |
|---|
| 2273 | 2082 | |
|---|
| 2274 | | - omap_hsmmc_protect_card(host); |
|---|
| 2275 | 2083 | pm_runtime_mark_last_busy(host->dev); |
|---|
| 2276 | 2084 | pm_runtime_put_autosuspend(host->dev); |
|---|
| 2277 | 2085 | return 0; |
|---|
| .. | .. |
|---|
| 2284 | 2092 | unsigned long flags; |
|---|
| 2285 | 2093 | int ret = 0; |
|---|
| 2286 | 2094 | |
|---|
| 2287 | | - host = platform_get_drvdata(to_platform_device(dev)); |
|---|
| 2095 | + host = dev_get_drvdata(dev); |
|---|
| 2288 | 2096 | omap_hsmmc_context_save(host); |
|---|
| 2289 | 2097 | dev_dbg(dev, "disabled\n"); |
|---|
| 2290 | 2098 | |
|---|
| .. | .. |
|---|
| 2325 | 2133 | struct omap_hsmmc_host *host; |
|---|
| 2326 | 2134 | unsigned long flags; |
|---|
| 2327 | 2135 | |
|---|
| 2328 | | - host = platform_get_drvdata(to_platform_device(dev)); |
|---|
| 2136 | + host = dev_get_drvdata(dev); |
|---|
| 2329 | 2137 | omap_hsmmc_context_restore(host); |
|---|
| 2330 | 2138 | dev_dbg(dev, "enabled\n"); |
|---|
| 2331 | 2139 | |
|---|
| .. | .. |
|---|
| 2333 | 2141 | if ((host->mmc->caps & MMC_CAP_SDIO_IRQ) && |
|---|
| 2334 | 2142 | (host->flags & HSMMC_SDIO_IRQ_ENABLED)) { |
|---|
| 2335 | 2143 | |
|---|
| 2336 | | - pinctrl_pm_select_default_state(host->dev); |
|---|
| 2144 | + pinctrl_select_default_state(host->dev); |
|---|
| 2337 | 2145 | |
|---|
| 2338 | 2146 | /* irq lost, if pinmux incorrect */ |
|---|
| 2339 | 2147 | OMAP_HSMMC_WRITE(host->base, STAT, STAT_CLEAR); |
|---|
| 2340 | 2148 | OMAP_HSMMC_WRITE(host->base, ISE, CIRQ_EN); |
|---|
| 2341 | 2149 | OMAP_HSMMC_WRITE(host->base, IE, CIRQ_EN); |
|---|
| 2342 | 2150 | } else { |
|---|
| 2343 | | - pinctrl_pm_select_default_state(host->dev); |
|---|
| 2151 | + pinctrl_select_default_state(host->dev); |
|---|
| 2344 | 2152 | } |
|---|
| 2345 | 2153 | spin_unlock_irqrestore(&host->irq_lock, flags); |
|---|
| 2346 | 2154 | return 0; |
|---|
| .. | .. |
|---|
| 2357 | 2165 | .remove = omap_hsmmc_remove, |
|---|
| 2358 | 2166 | .driver = { |
|---|
| 2359 | 2167 | .name = DRIVER_NAME, |
|---|
| 2168 | + .probe_type = PROBE_PREFER_ASYNCHRONOUS, |
|---|
| 2360 | 2169 | .pm = &omap_hsmmc_dev_pm_ops, |
|---|
| 2361 | 2170 | .of_match_table = of_match_ptr(omap_mmc_of_match), |
|---|
| 2362 | 2171 | }, |
|---|