diff mbox

[RFC,1/7] mmc: tmio: Add UHS-I mode support

Message ID 1430397051.5802.40.camel@xylophone.i.decadent.org.uk (mailing list archive)
State Superseded
Delegated to: Geert Uytterhoeven
Headers show

Commit Message

Ben Hutchings April 30, 2015, 12:30 p.m. UTC
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.

XXX The card_busy implementation is a bit of a guess.

Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
---
 drivers/mmc/host/tmio_mmc.h     |    3 +++
 drivers/mmc/host/tmio_mmc_pio.c |   31 +++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)

Comments

Kuninori Morimoto May 11, 2015, 3:38 a.m. UTC | #1
Hi Ben

Thank you for your patch

> 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.
> 
> XXX The card_busy implementation is a bit of a guess.
> 
> Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>

If original patch was created by Shinobu/Ben Dooks,
and you updated it, I prefer to add these guys on Signed-off-by line.

>  static const struct mmc_host_ops tmio_mmc_ops = {
>  	.request	= tmio_mmc_request,
>  	.set_ios	= tmio_mmc_set_ios,
>  	.get_ro         = tmio_mmc_get_ro,
>  	.get_cd		= mmc_gpio_get_cd,
>  	.enable_sdio_irq = tmio_mmc_enable_sdio_irq,
> +	.start_signal_voltage_switch
> +			= tmio_mmc_start_signal_voltage_switch,
> +	.card_busy	= tmio_mmc_card_busy,
>  	.multi_io_quirk	= tmio_multi_io_quirk,
>  };

I prefer to separate this patch for these 2 new callbacks if possible.

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ben Hutchings May 11, 2015, 2:04 p.m. UTC | #2
On Mon, 2015-05-11 at 03:38 +0000, Kuninori Morimoto wrote:
> Hi Ben
> 
> Thank you for your patch
> 
> > 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.
> > 
> > XXX The card_busy implementation is a bit of a guess.
> > 
> > Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
> 
> If original patch was created by Shinobu/Ben Dooks,
> and you updated it, I prefer to add these guys on Signed-off-by line.
> 
> >  static const struct mmc_host_ops tmio_mmc_ops = {
> >  	.request	= tmio_mmc_request,
> >  	.set_ios	= tmio_mmc_set_ios,
> >  	.get_ro         = tmio_mmc_get_ro,
> >  	.get_cd		= mmc_gpio_get_cd,
> >  	.enable_sdio_irq = tmio_mmc_enable_sdio_irq,
> > +	.start_signal_voltage_switch
> > +			= tmio_mmc_start_signal_voltage_switch,
> > +	.card_busy	= tmio_mmc_card_busy,
> >  	.multi_io_quirk	= tmio_multi_io_quirk,
> >  };
> 
> I prefer to separate this patch for these 2 new callbacks if possible.

They are both used only by mmc_set_signal_voltage(), which warns if only
start_signal_voltage_switch is implemented.  So it doesn't make sense to
add them separately.

Ben.


--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ben Hutchings May 11, 2015, 2:10 p.m. UTC | #3
On Mon, 2015-05-11 at 03:38 +0000, Kuninori Morimoto wrote:
> Hi Ben
> 
> Thank you for your patch
> 
> > 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.
> > 
> > XXX The card_busy implementation is a bit of a guess.
> > 
> > Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
> 
> If original patch was created by Shinobu/Ben Dooks,
> and you updated it, I prefer to add these guys on Signed-off-by line.
[...]

It's not correct to keep someone else's Signed-off-by when making
substantial changes.

Ben.


--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index fc3805ed69d1..a60380b94105 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -103,6 +103,9 @@  struct tmio_mmc_host {
 	void (*clk_disable)(struct platform_device *pdev);
 	int (*multi_io_quirk)(struct mmc_card *card,
 			      unsigned int direction, int blk_size);
+
+	int (*start_signal_voltage_switch)(struct tmio_mmc_host *host,
+					   unsigned char signal_voltage);
 };
 
 struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev);
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index e3dcf31a8bd6..3c1e0e53c0b1 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -1011,12 +1011,43 @@  static int tmio_multi_io_quirk(struct mmc_card *card,
 	return blk_size;
 }
 
+static int tmio_mmc_start_signal_voltage_switch(struct mmc_host *mmc,
+	struct mmc_ios *ios)
+{
+	struct tmio_mmc_host *host = mmc_priv(mmc);
+
+	if (!host->start_signal_voltage_switch)
+		return 0;
+
+	return host->start_signal_voltage_switch(host, ios->signal_voltage);
+}
+
+static int tmio_mmc_card_busy(struct mmc_host *mmc)
+{
+	struct tmio_mmc_host *host = mmc_priv(mmc);
+	u32 status;
+
+	pm_runtime_get_sync(mmc_dev(mmc));
+	status = sd_ctrl_read32(host, CTL_STATUS);
+	pm_runtime_mark_last_busy(mmc_dev(mmc));
+	pm_runtime_put_autosuspend(mmc_dev(mmc));
+
+	/*
+	 * Card signals busy by pulling down all of DAT[3:0].  This status
+	 * flag appears to reflect DAT3.
+	 */
+	return !(status & TMIO_STAT_SIGSTATE_A);
+}
+
 static const struct mmc_host_ops tmio_mmc_ops = {
 	.request	= tmio_mmc_request,
 	.set_ios	= tmio_mmc_set_ios,
 	.get_ro         = tmio_mmc_get_ro,
 	.get_cd		= mmc_gpio_get_cd,
 	.enable_sdio_irq = tmio_mmc_enable_sdio_irq,
+	.start_signal_voltage_switch
+			= tmio_mmc_start_signal_voltage_switch,
+	.card_busy	= tmio_mmc_card_busy,
 	.multi_io_quirk	= tmio_multi_io_quirk,
 };