Просмотр исходного кода

mmc: tmio: Add UHS-I mode support

Based on work by Shinobu Uehara and Ben Dooks. This adds the voltage
switch operation needed for all UHS-I modes, but not the tuning needed
for SDR-104 which will come later.

Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Wolfram Sang 9 лет назад
Родитель
Сommit
452e5eef6d
3 измененных файлов с 15 добавлено и 1 удалено
  1. 2 0
      drivers/mmc/host/tmio_mmc.h
  2. 11 1
      drivers/mmc/host/tmio_mmc_pio.c
  3. 2 0
      include/linux/mmc/tmio.h

+ 2 - 0
drivers/mmc/host/tmio_mmc.h

@@ -101,6 +101,8 @@ struct tmio_mmc_host {
 	void (*clk_disable)(struct tmio_mmc_host *host);
 	void (*clk_disable)(struct tmio_mmc_host *host);
 	int (*multi_io_quirk)(struct mmc_card *card,
 	int (*multi_io_quirk)(struct mmc_card *card,
 			      unsigned int direction, int blk_size);
 			      unsigned int direction, int blk_size);
+	int (*start_signal_voltage_switch)(struct mmc_host *mmc,
+					   struct mmc_ios *ios);
 };
 };
 
 
 struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev);
 struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev);

+ 11 - 1
drivers/mmc/host/tmio_mmc_pio.c

@@ -1012,12 +1012,20 @@ static int tmio_multi_io_quirk(struct mmc_card *card,
 	return blk_size;
 	return blk_size;
 }
 }
 
 
-static const struct mmc_host_ops tmio_mmc_ops = {
+static int tmio_mmc_card_busy(struct mmc_host *mmc)
+{
+	struct tmio_mmc_host *host = mmc_priv(mmc);
+
+	return !(sd_ctrl_read32(host, CTL_STATUS2) & TMIO_STATUS2_DAT0);
+}
+
+static struct mmc_host_ops tmio_mmc_ops = {
 	.request	= tmio_mmc_request,
 	.request	= tmio_mmc_request,
 	.set_ios	= tmio_mmc_set_ios,
 	.set_ios	= tmio_mmc_set_ios,
 	.get_ro         = tmio_mmc_get_ro,
 	.get_ro         = tmio_mmc_get_ro,
 	.get_cd		= mmc_gpio_get_cd,
 	.get_cd		= mmc_gpio_get_cd,
 	.enable_sdio_irq = tmio_mmc_enable_sdio_irq,
 	.enable_sdio_irq = tmio_mmc_enable_sdio_irq,
+	.card_busy	= tmio_mmc_card_busy,
 	.multi_io_quirk	= tmio_multi_io_quirk,
 	.multi_io_quirk	= tmio_multi_io_quirk,
 };
 };
 
 
@@ -1116,7 +1124,9 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
 		goto host_free;
 		goto host_free;
 	}
 	}
 
 
+	tmio_mmc_ops.start_signal_voltage_switch = _host->start_signal_voltage_switch;
 	mmc->ops = &tmio_mmc_ops;
 	mmc->ops = &tmio_mmc_ops;
+
 	mmc->caps |= MMC_CAP_4_BIT_DATA | pdata->capabilities;
 	mmc->caps |= MMC_CAP_4_BIT_DATA | pdata->capabilities;
 	mmc->caps2 |= pdata->capabilities2;
 	mmc->caps2 |= pdata->capabilities2;
 	mmc->max_segs = 32;
 	mmc->max_segs = 32;

+ 2 - 0
include/linux/mmc/tmio.h

@@ -63,6 +63,8 @@
 #define TMIO_STAT_CMD_BUSY      0x40000000
 #define TMIO_STAT_CMD_BUSY      0x40000000
 #define TMIO_STAT_ILL_ACCESS    0x80000000
 #define TMIO_STAT_ILL_ACCESS    0x80000000
 
 
+#define TMIO_STATUS2_DAT0	BIT(7)
+
 #define	CLK_CTL_DIV_MASK	0xff
 #define	CLK_CTL_DIV_MASK	0xff
 #define	CLK_CTL_SCLKEN		BIT(8)
 #define	CLK_CTL_SCLKEN		BIT(8)