All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tobias Jakobi <liquid.acid-hi6Y0CQ0nG0@public.gmane.org>
To: Jaehoon Chung
	<jh80.chung-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Marek Szyprowski
	<m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Kukjin Kim <kgene-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Daniel Drake <drake-6IF/jdPJHihWk0Htik3J/w@public.gmane.org>,
	Sebastian Reichel <sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Seungwon Jeon <tgih.jun-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Ulf Hansson <ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Joonyoung Shim
	<jy0922.shim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Subject: Re: [PATCH 1/2] mmc: dw_mmc-exynos: add support for controlling emmc reset pin
Date: Wed, 28 Jan 2015 13:41:07 +0100	[thread overview]
Message-ID: <54C8D8E3.9060609@gmx.net> (raw)
In-Reply-To: <54C74C33.5050305-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>

Hello!

Jaehoon Chung wrote:
> mmc core supported to hw_reset function.
> So i think we can use it. It's called at only initial time to clear the previous status.
> But i think it can be called at reboot time. (it needs to implement codes.)
> how about?
I don't think that's going the work. The problem here is that depending
on the board configuration, the eMMC might carry the bootloader. If the
eMMC subsystem is not properly reset _during_ reboot, the board won't
even start since no bootloader is found. So we don't even reach the
point where the kernel does anything.


With best wishes,
Tobias



> 
> Best Regards,
> Jaehoon Chung
> 
>>
>> Signed-off-by: Marek Szyprowski <m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
>> ---
>>  .../devicetree/bindings/mmc/exynos-dw-mshc.txt     |  6 +++
>>  drivers/mmc/host/dw_mmc-exynos.c                   | 43 +++++++++++++++++++++-
>>  2 files changed, 48 insertions(+), 1 deletion(-)
>>
>> diff --git a/Documentation/devicetree/bindings/mmc/exynos-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/exynos-dw-mshc.txt
>> index ee4fc0576c7d..fc53d335e7db 100644
>> --- a/Documentation/devicetree/bindings/mmc/exynos-dw-mshc.txt
>> +++ b/Documentation/devicetree/bindings/mmc/exynos-dw-mshc.txt
>> @@ -50,6 +50,12 @@ Required Properties:
>>        - if CIU clock divider value is 0 (that is divide by 1), both tx and rx
>>          phase shift clocks should be 0.
>>  
>> +Optional properties:
>> +
>> +* dw-mshc-reset-gpios: optional property specifying gpio for the eMMC nreset
>> +  line, it will be triggered on system reboot to properly reset eMMC card for
>> +  next system boot.
>> +
>>  Required properties for a slot (Deprecated - Recommend to use one slot per host):
>>  
>>  * gpios: specifies a list of gpios used for command, clock and data bus. The
>> diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c
>> index 509365cb22c6..2add5a93859d 100644
>> --- a/drivers/mmc/host/dw_mmc-exynos.c
>> +++ b/drivers/mmc/host/dw_mmc-exynos.c
>> @@ -12,12 +12,14 @@
>>  #include <linux/module.h>
>>  #include <linux/platform_device.h>
>>  #include <linux/clk.h>
>> +#include <linux/delay.h>
>>  #include <linux/mmc/host.h>
>>  #include <linux/mmc/dw_mmc.h>
>>  #include <linux/mmc/mmc.h>
>>  #include <linux/of.h>
>>  #include <linux/of_gpio.h>
>>  #include <linux/slab.h>
>> +#include <linux/reboot.h>
>>  
>>  #include "dw_mmc.h"
>>  #include "dw_mmc-pltfm.h"
>> @@ -77,8 +79,23 @@ struct dw_mci_exynos_priv_data {
>>  	u32				sdr_timing;
>>  	u32				ddr_timing;
>>  	u32				cur_speed;
>> +	struct gpio_desc 		*reset_gpio;
>> +	struct notifier_block		reset_nb;
>>  };
>>  
>> +static int dw_mci_restart_handler(struct notifier_block *this,
>> +				  unsigned long mode, void *cmd)
>> +{
>> +	struct dw_mci_exynos_priv_data *data;
>> +	data = container_of(this, struct dw_mci_exynos_priv_data, reset_nb);
>> +
>> +	gpiod_direction_output(data->reset_gpio, 0);
>> +	mdelay(150);
>> +	gpiod_direction_output(data->reset_gpio, 1);
>> +
>> +	return NOTIFY_DONE;
>> +}
>> +
>>  static struct dw_mci_exynos_compatible {
>>  	char				*compatible;
>>  	enum dw_mci_exynos_type		ctrl_type;
>> @@ -295,7 +312,20 @@ static int dw_mci_exynos_parse_dt(struct dw_mci *host)
>>  		return ret;
>>  
>>  	priv->ddr_timing = SDMMC_CLKSEL_TIMING(timing[0], timing[1], div);
>> +
>> +	priv->reset_gpio = devm_gpiod_get_optional(host->dev,
>> +						   "samsung,dw-mshc-reset",
>> +						   GPIOD_OUT_HIGH);
>> +	if (!IS_ERR_OR_NULL(priv->reset_gpio)) {
>> +		priv->reset_nb.notifier_call = dw_mci_restart_handler;
>> +		priv->reset_nb.priority = 255;
>> +		ret = register_restart_handler(&priv->reset_nb);
>> +		if (ret)
>> +			dev_err(host->dev, "cannot register restart handler\n");
>> +	}
>> +
>>  	host->priv = priv;
>> +
>>  	return 0;
>>  }
>>  
>> @@ -490,6 +520,17 @@ static int dw_mci_exynos_probe(struct platform_device *pdev)
>>  	return dw_mci_pltfm_register(pdev, drv_data);
>>  }
>>  
>> +static int dw_mci_exynos_remove(struct platform_device *pdev)
>> +{
>> +	struct dw_mci *host = platform_get_drvdata(pdev);
>> +	struct dw_mci_exynos_priv_data *priv = host->priv;
>> +
>> +	if (priv->reset_gpio)
>> +		unregister_restart_handler(&priv->reset_nb);
>> +
>> +	return dw_mci_pltfm_remove(pdev);
>> +}
>> +
>>  static const struct dev_pm_ops dw_mci_exynos_pmops = {
>>  	SET_SYSTEM_SLEEP_PM_OPS(dw_mci_exynos_suspend, dw_mci_exynos_resume)
>>  	.resume_noirq = dw_mci_exynos_resume_noirq,
>> @@ -499,7 +540,7 @@ static const struct dev_pm_ops dw_mci_exynos_pmops = {
>>  
>>  static struct platform_driver dw_mci_exynos_pltfm_driver = {
>>  	.probe		= dw_mci_exynos_probe,
>> -	.remove		= __exit_p(dw_mci_pltfm_remove),
>> +	.remove		= dw_mci_exynos_remove,
>>  	.driver		= {
>>  		.name		= "dwmmc_exynos",
>>  		.of_match_table	= dw_mci_exynos_match,
>>
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-01-28 12:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-27  8:11 [PATCH 0/2] Fix reboot issue on Odroid boards with eMMC card Marek Szyprowski
2015-01-27  8:11 ` [PATCH 1/2] mmc: dw_mmc-exynos: add support for controlling emmc reset pin Marek Szyprowski
2015-01-27  8:28   ` Jaehoon Chung
     [not found]     ` <54C74C33.5050305-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-01-28 12:41       ` Tobias Jakobi [this message]
     [not found]         ` <54C8D8E3.9060609-hi6Y0CQ0nG0@public.gmane.org>
2015-01-28 14:54           ` Ulf Hansson
     [not found]             ` <CAPDyKFr9fQ5ny=Foi4x_-wEQA9K0wRqqEfLxmxtBn5tmPwS-Nw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-28 15:23               ` Tobias Jakobi
2015-01-28 15:40                 ` Ulf Hansson
     [not found] ` <1422346289-9348-1-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-01-27  8:11   ` [PATCH 2/2] ARM: dts: exynos*-odroid*: add eMMC reset line Marek Szyprowski
2015-01-27  8:56 ` [PATCH 0/2] Fix reboot issue on Odroid boards with eMMC card Sjoerd Simons
     [not found]   ` <1422348967.10070.26.camel-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org>
2015-01-27 13:29     ` Marek Szyprowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54C8D8E3.9060609@gmx.net \
    --to=liquid.acid-hi6y0cq0ng0@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=drake-6IF/jdPJHihWk0Htik3J/w@public.gmane.org \
    --cc=jh80.chung-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=jy0922.shim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=kgene-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=tgih.jun-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.