Lines Matching refs:mmc
163 static inline struct omap_hsmmc_data *omap_hsmmc_get_data(struct mmc *mmc) in omap_hsmmc_get_data() argument
166 return dev_get_priv(mmc->dev); in omap_hsmmc_get_data()
168 return (struct omap_hsmmc_data *)mmc->priv; in omap_hsmmc_get_data()
171 static inline struct mmc_config *omap_hsmmc_get_cfg(struct mmc *mmc) in omap_hsmmc_get_cfg() argument
174 struct omap_hsmmc_plat *plat = dev_get_platdata(mmc->dev); in omap_hsmmc_get_cfg()
177 return &((struct omap_hsmmc_data *)mmc->priv)->cfg; in omap_hsmmc_get_cfg()
202 static unsigned char mmc_board_init(struct mmc *mmc) in mmc_board_init() argument
205 struct mmc_config *cfg = omap_hsmmc_get_cfg(mmc); in mmc_board_init()
262 if (mmc_get_blk_desc(mmc)->devnum == 0) in mmc_board_init()
299 static void omap_hsmmc_io_recalibrate(struct mmc *mmc) in omap_hsmmc_io_recalibrate() argument
301 struct omap_hsmmc_data *priv = omap_hsmmc_get_data(mmc); in omap_hsmmc_io_recalibrate()
351 static void omap_hsmmc_set_timing(struct mmc *mmc) in omap_hsmmc_set_timing() argument
355 struct omap_hsmmc_data *priv = omap_hsmmc_get_data(mmc); in omap_hsmmc_set_timing()
362 priv->mode = mmc->selected_mode; in omap_hsmmc_set_timing()
399 omap_hsmmc_io_recalibrate(mmc); in omap_hsmmc_set_timing()
404 static void omap_hsmmc_conf_bus_power(struct mmc *mmc, uint signal_voltage) in omap_hsmmc_conf_bus_power() argument
407 struct omap_hsmmc_data *priv = omap_hsmmc_get_data(mmc); in omap_hsmmc_conf_bus_power()
459 static int omap_hsmmc_set_io_regulator(struct mmc *mmc, int mV) in omap_hsmmc_set_io_regulator() argument
464 struct omap_hsmmc_data *priv = omap_hsmmc_get_data(mmc); in omap_hsmmc_set_io_regulator()
466 if (!mmc->vqmmc_supply) in omap_hsmmc_set_io_regulator()
475 ret = regulator_set_enable(mmc->vqmmc_supply, false); in omap_hsmmc_set_io_regulator()
479 ret = regulator_set_value(mmc->vqmmc_supply, uV); in omap_hsmmc_set_io_regulator()
483 ret = regulator_set_enable(mmc->vqmmc_supply, true); in omap_hsmmc_set_io_regulator()
500 static int omap_hsmmc_set_signal_voltage(struct mmc *mmc) in omap_hsmmc_set_signal_voltage() argument
502 struct omap_hsmmc_data *priv = omap_hsmmc_get_data(mmc); in omap_hsmmc_set_signal_voltage()
504 int mv = mmc_voltage_to_mv(mmc->signal_voltage); in omap_hsmmc_set_signal_voltage()
512 if (mmc->signal_voltage == MMC_SIGNAL_VOLTAGE_330) { in omap_hsmmc_set_signal_voltage()
517 } else if (mmc->signal_voltage == MMC_SIGNAL_VOLTAGE_180) { in omap_hsmmc_set_signal_voltage()
528 priv->signal_voltage = mmc->signal_voltage; in omap_hsmmc_set_signal_voltage()
530 omap_hsmmc_conf_bus_power(mmc, mmc->signal_voltage); in omap_hsmmc_set_signal_voltage()
533 return omap_hsmmc_set_io_regulator(mmc, mv); in omap_hsmmc_set_signal_voltage()
536 if (mmc_get_blk_desc(mmc)->devnum == 0) in omap_hsmmc_set_signal_voltage()
545 static uint32_t omap_hsmmc_set_capabilities(struct mmc *mmc) in omap_hsmmc_set_capabilities() argument
548 struct omap_hsmmc_data *priv = omap_hsmmc_get_data(mmc); in omap_hsmmc_set_capabilities()
570 static void omap_hsmmc_disable_tuning(struct mmc *mmc) in omap_hsmmc_disable_tuning() argument
573 struct omap_hsmmc_data *priv = omap_hsmmc_get_data(mmc); in omap_hsmmc_disable_tuning()
586 static void omap_hsmmc_set_dll(struct mmc *mmc, int count) in omap_hsmmc_set_dll() argument
590 struct omap_hsmmc_data *priv = omap_hsmmc_get_data(mmc); in omap_hsmmc_set_dll()
614 struct mmc *mmc = upriv->mmc; in omap_hsmmc_execute_tuning() local
627 if (!((mmc->selected_mode == MMC_HS_200) || in omap_hsmmc_execute_tuning()
628 (mmc->selected_mode == UHS_SDR104) || in omap_hsmmc_execute_tuning()
629 ((mmc->selected_mode == UHS_SDR50) && (val & CAPA2_TSDR50)))) in omap_hsmmc_execute_tuning()
636 omap_hsmmc_set_dll(mmc, phase_delay); in omap_hsmmc_execute_tuning()
638 cur_match = !mmc_send_tuning(mmc, opcode, NULL); in omap_hsmmc_execute_tuning()
670 omap_hsmmc_set_dll(mmc, phase_delay); in omap_hsmmc_execute_tuning()
679 omap_hsmmc_disable_tuning(mmc); in omap_hsmmc_execute_tuning()
696 static void mmc_enable_irq(struct mmc *mmc, struct mmc_cmd *cmd) in mmc_enable_irq() argument
698 struct omap_hsmmc_data *priv = omap_hsmmc_get_data(mmc); in mmc_enable_irq()
715 static int omap_hsmmc_init_setup(struct mmc *mmc) in omap_hsmmc_init_setup() argument
717 struct omap_hsmmc_data *priv = omap_hsmmc_get_data(mmc); in omap_hsmmc_init_setup()
724 mmc_board_init(mmc); in omap_hsmmc_init_setup()
751 reg_val = omap_hsmmc_set_capabilities(mmc); in omap_hsmmc_init_setup()
752 omap_hsmmc_conf_bus_power(mmc, (reg_val & VS30_3V0SUP) ? in omap_hsmmc_init_setup()
782 mmc_enable_irq(mmc, NULL); in omap_hsmmc_init_setup()
838 static void omap_hsmmc_adma_desc(struct mmc *mmc, char *buf, u16 len, bool end) in omap_hsmmc_adma_desc() argument
840 struct omap_hsmmc_data *priv = omap_hsmmc_get_data(mmc); in omap_hsmmc_adma_desc()
858 static void omap_hsmmc_prepare_adma_table(struct mmc *mmc, in omap_hsmmc_prepare_adma_table() argument
863 struct omap_hsmmc_data *priv = omap_hsmmc_get_data(mmc); in omap_hsmmc_prepare_adma_table()
878 omap_hsmmc_adma_desc(mmc, buf, ADMA_MAX_LEN, false); in omap_hsmmc_prepare_adma_table()
883 omap_hsmmc_adma_desc(mmc, buf, total_len, true); in omap_hsmmc_prepare_adma_table()
892 static void omap_hsmmc_prepare_data(struct mmc *mmc, struct mmc_data *data) in omap_hsmmc_prepare_data() argument
895 struct omap_hsmmc_data *priv = omap_hsmmc_get_data(mmc); in omap_hsmmc_prepare_data()
900 omap_hsmmc_prepare_adma_table(mmc, data); in omap_hsmmc_prepare_data()
923 static void omap_hsmmc_dma_cleanup(struct mmc *mmc) in omap_hsmmc_dma_cleanup() argument
926 struct omap_hsmmc_data *priv = omap_hsmmc_get_data(mmc); in omap_hsmmc_dma_cleanup()
949 static int omap_hsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, argument
952 struct omap_hsmmc_data *priv = omap_hsmmc_get_data(mmc);
959 struct mmc *mmc = upriv->mmc;
1043 omap_hsmmc_prepare_data(mmc, data);
1049 mmc_enable_irq(mmc, cmd);
1091 omap_hsmmc_dma_cleanup(mmc);
1115 omap_hsmmc_dma_cleanup(mmc);
1256 static void omap_hsmmc_set_clock(struct mmc *mmc) argument
1258 struct omap_hsmmc_data *priv = omap_hsmmc_get_data(mmc);
1270 if (mmc->clock != 0) {
1271 dsor = DIV_ROUND_UP(MMC_CLOCK_REFERENCE * 1000000, mmc->clock);
1290 mmc->clock = priv->clock;
1294 static void omap_hsmmc_set_bus_width(struct mmc *mmc) argument
1296 struct omap_hsmmc_data *priv = omap_hsmmc_get_data(mmc);
1301 switch (mmc->bus_width) {
1323 priv->bus_width = mmc->bus_width;
1327 static int omap_hsmmc_set_ios(struct mmc *mmc) argument
1329 struct omap_hsmmc_data *priv = omap_hsmmc_get_data(mmc);
1335 struct mmc *mmc = upriv->mmc;
1340 if (priv->bus_width != mmc->bus_width)
1341 omap_hsmmc_set_bus_width(mmc);
1343 if (priv->clock != mmc->clock)
1344 omap_hsmmc_set_clock(mmc);
1346 if (mmc->clk_disable)
1352 if (priv->mode != mmc->selected_mode)
1353 omap_hsmmc_set_timing(mmc);
1356 if (priv->signal_voltage != mmc->signal_voltage)
1357 ret = omap_hsmmc_set_signal_voltage(mmc);
1392 static int omap_hsmmc_getcd(struct mmc *mmc) argument
1394 struct omap_hsmmc_data *priv = omap_hsmmc_get_data(mmc);
1406 static int omap_hsmmc_getwp(struct mmc *mmc) argument
1408 struct omap_hsmmc_data *priv = omap_hsmmc_get_data(mmc);
1454 struct mmc *mmc; local
1532 mmc = mmc_create(cfg, priv);
1533 if (mmc == NULL)
1607 static uint32_t omap_hsmmc_get_pad_conf_phandle(struct mmc *mmc, argument
1612 int node = dev_of_offset(mmc->dev);
1623 static uint32_t omap_hsmmc_get_iodelay_phandle(struct mmc *mmc, argument
1630 int node = dev_of_offset(mmc->dev);
1647 omap_hsmmc_get_pad_conf(struct mmc *mmc, char *prop_name, int *npads) argument
1655 phandle = omap_hsmmc_get_pad_conf_phandle(mmc, prop_name);
1675 omap_hsmmc_get_iodelay(struct mmc *mmc, char *prop_name, int *niodelay) argument
1683 phandle = omap_hsmmc_get_iodelay_phandle(mmc, prop_name);
1704 omap_hsmmc_get_pinctrl_by_mode(struct mmc *mmc, char *mode) argument
1710 int node = dev_of_offset(mmc->dev);
1729 pinctrl_state->padconf = omap_hsmmc_get_pad_conf(mmc, prop_name,
1735 pinctrl_state->iodelay = omap_hsmmc_get_iodelay(mmc, prop_name,
1760 s = omap_hsmmc_get_pinctrl_by_mode(mmc, str); \
1764 s = omap_hsmmc_get_pinctrl_by_mode(mmc, #mode); \
1768 mmc->dev->name, #mode); \
1775 static int omap_hsmmc_get_pinctrl_state(struct mmc *mmc) argument
1777 struct omap_hsmmc_data *priv = omap_hsmmc_get_data(mmc);
1778 struct mmc_config *cfg = omap_hsmmc_get_cfg(mmc);
1784 default_pinctrl = omap_hsmmc_get_pinctrl_by_mode(mmc, "default");
1870 plat->mmc = calloc(1, sizeof(struct mmc));
1871 return mmc_bind(dev, plat->mmc, &plat->cfg);
1880 struct mmc *mmc; local
1894 mmc = plat->mmc;
1896 mmc = mmc_create(cfg, priv);
1897 if (mmc == NULL)
1909 mmc->dev = dev;
1910 upriv->mmc = mmc;
1913 ret = omap_hsmmc_get_pinctrl_state(mmc);
1926 return omap_hsmmc_init_setup(mmc);