linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND,v4,0/3] mmc: mediatek: add optional reset property
@ 2020-08-13  9:38 Wenbin Mei
  2020-08-13  9:38 ` [RESEND,v4,1/3] mmc: dt-bindings: Add resets/reset-names for Mediatek MMC bindings Wenbin Mei
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Wenbin Mei @ 2020-08-13  9:38 UTC (permalink / raw)
  To: Ulf Hansson, Rob Herring
  Cc: Chaotian Jing, Matthias Brugger, Philipp Zabel, linux-mmc,
	devicetree, linux-arm-kernel, linux-mediatek, linux-kernel,
	srv_heupstream

Wenbin Mei (3):
  mmc: dt-bindings: Add resets/reset-names for Mediatek MMC bindings
  arm64: dts: mt7622: add reset node for mmc device
  mmc: mediatek: add optional module reset property

 Documentation/devicetree/bindings/mmc/mtk-sd.txt |  2 ++
 arch/arm64/boot/dts/mediatek/mt7622.dtsi         |  2 ++
 drivers/mmc/host/mtk-sd.c                        | 13 +++++++++++++
 3 files changed, 17 insertions(+)

--
2.18.0

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [RESEND,v4,1/3] mmc: dt-bindings: Add resets/reset-names for Mediatek MMC bindings
  2020-08-13  9:38 [RESEND,v4,0/3] mmc: mediatek: add optional reset property Wenbin Mei
@ 2020-08-13  9:38 ` Wenbin Mei
  2020-08-13  9:38 ` [RESEND,v4,2/3] arm64: dts: mt7622: add reset node for mmc device Wenbin Mei
  2020-08-13  9:38 ` [RESEND,v4,3/3] mmc: mediatek: add optional module reset property Wenbin Mei
  2 siblings, 0 replies; 6+ messages in thread
From: Wenbin Mei @ 2020-08-13  9:38 UTC (permalink / raw)
  To: Ulf Hansson, Rob Herring
  Cc: Chaotian Jing, Matthias Brugger, Philipp Zabel, linux-mmc,
	devicetree, linux-arm-kernel, linux-mediatek, linux-kernel,
	srv_heupstream, Wenbin Mei, stable

Add description for resets/reset-names.

Cc: <stable@vger.kernel.org> # v5.4+
Fixes: 966580ad236e ("mmc: mediatek: add support for MT7622 SoC")
Signed-off-by: Wenbin Mei <wenbin.mei@mediatek.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de>
---
 Documentation/devicetree/bindings/mmc/mtk-sd.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/mmc/mtk-sd.txt b/Documentation/devicetree/bindings/mmc/mtk-sd.txt
index 8a532f4453f2..09aecec47003 100644
--- a/Documentation/devicetree/bindings/mmc/mtk-sd.txt
+++ b/Documentation/devicetree/bindings/mmc/mtk-sd.txt
@@ -49,6 +49,8 @@ Optional properties:
 		     error caused by stop clock(fifo full)
 		     Valid range = [0:0x7]. if not present, default value is 0.
 		     applied to compatible "mediatek,mt2701-mmc".
+- resets: Phandle and reset specifier pair to softreset line of MSDC IP.
+- reset-names: Should be "hrst".
 
 Examples:
 mmc0: mmc@11230000 {
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [RESEND,v4,2/3] arm64: dts: mt7622: add reset node for mmc device
  2020-08-13  9:38 [RESEND,v4,0/3] mmc: mediatek: add optional reset property Wenbin Mei
  2020-08-13  9:38 ` [RESEND,v4,1/3] mmc: dt-bindings: Add resets/reset-names for Mediatek MMC bindings Wenbin Mei
@ 2020-08-13  9:38 ` Wenbin Mei
  2020-08-13  9:38 ` [RESEND,v4,3/3] mmc: mediatek: add optional module reset property Wenbin Mei
  2 siblings, 0 replies; 6+ messages in thread
From: Wenbin Mei @ 2020-08-13  9:38 UTC (permalink / raw)
  To: Ulf Hansson, Rob Herring
  Cc: Chaotian Jing, Matthias Brugger, Philipp Zabel, linux-mmc,
	devicetree, linux-arm-kernel, linux-mediatek, linux-kernel,
	srv_heupstream, Wenbin Mei, stable

This commit adds reset node for mmc device.

Cc: <stable@vger.kernel.org> # v5.4+
Fixes: 966580ad236e ("mmc: mediatek: add support for MT7622 SoC")
Signed-off-by: Wenbin Mei <wenbin.mei@mediatek.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de>
---
 arch/arm64/boot/dts/mediatek/mt7622.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt7622.dtsi b/arch/arm64/boot/dts/mediatek/mt7622.dtsi
index 1a39e0ef776b..5b9ec032ce8d 100644
--- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi
@@ -686,6 +686,8 @@
 		clocks = <&pericfg CLK_PERI_MSDC30_0_PD>,
 			 <&topckgen CLK_TOP_MSDC50_0_SEL>;
 		clock-names = "source", "hclk";
+		resets = <&pericfg MT7622_PERI_MSDC0_SW_RST>;
+		reset-names = "hrst";
 		status = "disabled";
 	};
 
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [RESEND,v4,3/3] mmc: mediatek: add optional module reset property
  2020-08-13  9:38 [RESEND,v4,0/3] mmc: mediatek: add optional reset property Wenbin Mei
  2020-08-13  9:38 ` [RESEND,v4,1/3] mmc: dt-bindings: Add resets/reset-names for Mediatek MMC bindings Wenbin Mei
  2020-08-13  9:38 ` [RESEND,v4,2/3] arm64: dts: mt7622: add reset node for mmc device Wenbin Mei
@ 2020-08-13  9:38 ` Wenbin Mei
  2020-08-13 13:57   ` Matthias Brugger
  2 siblings, 1 reply; 6+ messages in thread
From: Wenbin Mei @ 2020-08-13  9:38 UTC (permalink / raw)
  To: Ulf Hansson, Rob Herring
  Cc: Chaotian Jing, Matthias Brugger, Philipp Zabel, linux-mmc,
	devicetree, linux-arm-kernel, linux-mediatek, linux-kernel,
	srv_heupstream, Wenbin Mei, stable

This patch fixs eMMC-Access on mt7622/Bpi-64.
Before we got these Errors on mounting eMMC ion R64:
[   48.664925] blk_update_request: I/O error, dev mmcblk0, sector 204800 op 0x1:(WRITE)
flags 0x800 phys_seg 1 prio class 0
[   48.676019] Buffer I/O error on dev mmcblk0p1, logical block 0, lost sync page write

This patch adds a optional reset management for msdc.
Sometimes the bootloader does not bring msdc register
to default state, so need reset the msdc controller.

Cc: <stable@vger.kernel.org> # v5.4+
Fixes: 966580ad236e ("mmc: mediatek: add support for MT7622 SoC")
Signed-off-by: Wenbin Mei <wenbin.mei@mediatek.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de>
---
 drivers/mmc/host/mtk-sd.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
index 39e7fc54c438..fc97d5bf3a20 100644
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -22,6 +22,7 @@
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/interrupt.h>
+#include <linux/reset.h>
 
 #include <linux/mmc/card.h>
 #include <linux/mmc/core.h>
@@ -434,6 +435,7 @@ struct msdc_host {
 	struct msdc_save_para save_para; /* used when gate HCLK */
 	struct msdc_tune_para def_tune_para; /* default tune setting */
 	struct msdc_tune_para saved_tune_para; /* tune result of CMD21/CMD19 */
+	struct reset_control *reset;
 };
 
 static const struct mtk_mmc_compatible mt8135_compat = {
@@ -1516,6 +1518,12 @@ static void msdc_init_hw(struct msdc_host *host)
 	u32 val;
 	u32 tune_reg = host->dev_comp->pad_tune_reg;
 
+	if (host->reset) {
+		reset_control_assert(host->reset);
+		usleep_range(10, 50);
+		reset_control_deassert(host->reset);
+	}
+
 	/* Configure to MMC/SD mode, clock free running */
 	sdr_set_bits(host->base + MSDC_CFG, MSDC_CFG_MODE | MSDC_CFG_CKPDN);
 
@@ -2273,6 +2281,11 @@ static int msdc_drv_probe(struct platform_device *pdev)
 	if (IS_ERR(host->src_clk_cg))
 		host->src_clk_cg = NULL;
 
+	host->reset = devm_reset_control_get_optional_exclusive(&pdev->dev,
+								"hrst");
+	if (IS_ERR(host->reset))
+		return PTR_ERR(host->reset);
+
 	host->irq = platform_get_irq(pdev, 0);
 	if (host->irq < 0) {
 		ret = -EINVAL;
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [RESEND,v4,3/3] mmc: mediatek: add optional module reset property
  2020-08-13  9:38 ` [RESEND,v4,3/3] mmc: mediatek: add optional module reset property Wenbin Mei
@ 2020-08-13 13:57   ` Matthias Brugger
  2020-08-14  1:08     ` Wenbin Mei
  0 siblings, 1 reply; 6+ messages in thread
From: Matthias Brugger @ 2020-08-13 13:57 UTC (permalink / raw)
  To: Wenbin Mei, Ulf Hansson, Rob Herring
  Cc: Chaotian Jing, Philipp Zabel, linux-mmc, devicetree,
	linux-arm-kernel, linux-mediatek, linux-kernel, srv_heupstream,
	stable



On 13/08/2020 11:38, Wenbin Mei wrote:
> This patch fixs eMMC-Access on mt7622/Bpi-64.
> Before we got these Errors on mounting eMMC ion R64:
> [   48.664925] blk_update_request: I/O error, dev mmcblk0, sector 204800 op 0x1:(WRITE)
> flags 0x800 phys_seg 1 prio class 0
> [   48.676019] Buffer I/O error on dev mmcblk0p1, logical block 0, lost sync page write
> 
> This patch adds a optional reset management for msdc.
> Sometimes the bootloader does not bring msdc register
> to default state, so need reset the msdc controller.
> 
> Cc: <stable@vger.kernel.org> # v5.4+
> Fixes: 966580ad236e ("mmc: mediatek: add support for MT7622 SoC")
> Signed-off-by: Wenbin Mei <wenbin.mei@mediatek.com>
> Tested-by: Frank Wunderlich <frank-w@public-files.de>

I think you missed to add Philipp Zabels Reviewed-by tag.

Regards,
Matthias


> ---
>   drivers/mmc/host/mtk-sd.c | 13 +++++++++++++
>   1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
> index 39e7fc54c438..fc97d5bf3a20 100644
> --- a/drivers/mmc/host/mtk-sd.c
> +++ b/drivers/mmc/host/mtk-sd.c
> @@ -22,6 +22,7 @@
>   #include <linux/slab.h>
>   #include <linux/spinlock.h>
>   #include <linux/interrupt.h>
> +#include <linux/reset.h>
>   
>   #include <linux/mmc/card.h>
>   #include <linux/mmc/core.h>
> @@ -434,6 +435,7 @@ struct msdc_host {
>   	struct msdc_save_para save_para; /* used when gate HCLK */
>   	struct msdc_tune_para def_tune_para; /* default tune setting */
>   	struct msdc_tune_para saved_tune_para; /* tune result of CMD21/CMD19 */
> +	struct reset_control *reset;
>   };
>   
>   static const struct mtk_mmc_compatible mt8135_compat = {
> @@ -1516,6 +1518,12 @@ static void msdc_init_hw(struct msdc_host *host)
>   	u32 val;
>   	u32 tune_reg = host->dev_comp->pad_tune_reg;
>   
> +	if (host->reset) {
> +		reset_control_assert(host->reset);
> +		usleep_range(10, 50);
> +		reset_control_deassert(host->reset);
> +	}
> +
>   	/* Configure to MMC/SD mode, clock free running */
>   	sdr_set_bits(host->base + MSDC_CFG, MSDC_CFG_MODE | MSDC_CFG_CKPDN);
>   
> @@ -2273,6 +2281,11 @@ static int msdc_drv_probe(struct platform_device *pdev)
>   	if (IS_ERR(host->src_clk_cg))
>   		host->src_clk_cg = NULL;
>   
> +	host->reset = devm_reset_control_get_optional_exclusive(&pdev->dev,
> +								"hrst");
> +	if (IS_ERR(host->reset))
> +		return PTR_ERR(host->reset);
> +
>   	host->irq = platform_get_irq(pdev, 0);
>   	if (host->irq < 0) {
>   		ret = -EINVAL;
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RESEND,v4,3/3] mmc: mediatek: add optional module reset property
  2020-08-13 13:57   ` Matthias Brugger
@ 2020-08-14  1:08     ` Wenbin Mei
  0 siblings, 0 replies; 6+ messages in thread
From: Wenbin Mei @ 2020-08-14  1:08 UTC (permalink / raw)
  To: Matthias Brugger
  Cc: Ulf Hansson, Rob Herring, Chaotian Jing, Philipp Zabel,
	linux-mmc, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, srv_heupstream, stable

Yes, I will add Philipp Zabels Reviewed-by tag in the next version.
On Thu, 2020-08-13 at 15:57 +0200, Matthias Brugger wrote:
> 
> On 13/08/2020 11:38, Wenbin Mei wrote:
> > This patch fixs eMMC-Access on mt7622/Bpi-64.
> > Before we got these Errors on mounting eMMC ion R64:
> > [   48.664925] blk_update_request: I/O error, dev mmcblk0, sector 204800 op 0x1:(WRITE)
> > flags 0x800 phys_seg 1 prio class 0
> > [   48.676019] Buffer I/O error on dev mmcblk0p1, logical block 0, lost sync page write
> > 
> > This patch adds a optional reset management for msdc.
> > Sometimes the bootloader does not bring msdc register
> > to default state, so need reset the msdc controller.
> > 
> > Cc: <stable@vger.kernel.org> # v5.4+
> > Fixes: 966580ad236e ("mmc: mediatek: add support for MT7622 SoC")
> > Signed-off-by: Wenbin Mei <wenbin.mei@mediatek.com>
> > Tested-by: Frank Wunderlich <frank-w@public-files.de>
> 
> I think you missed to add Philipp Zabels Reviewed-by tag.
> 
> Regards,
> Matthias
> 
> 
> > ---
> >   drivers/mmc/host/mtk-sd.c | 13 +++++++++++++
> >   1 file changed, 13 insertions(+)
> > 
> > diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
> > index 39e7fc54c438..fc97d5bf3a20 100644
> > --- a/drivers/mmc/host/mtk-sd.c
> > +++ b/drivers/mmc/host/mtk-sd.c
> > @@ -22,6 +22,7 @@
> >   #include <linux/slab.h>
> >   #include <linux/spinlock.h>
> >   #include <linux/interrupt.h>
> > +#include <linux/reset.h>
> >   
> >   #include <linux/mmc/card.h>
> >   #include <linux/mmc/core.h>
> > @@ -434,6 +435,7 @@ struct msdc_host {
> >   	struct msdc_save_para save_para; /* used when gate HCLK */
> >   	struct msdc_tune_para def_tune_para; /* default tune setting */
> >   	struct msdc_tune_para saved_tune_para; /* tune result of CMD21/CMD19 */
> > +	struct reset_control *reset;
> >   };
> >   
> >   static const struct mtk_mmc_compatible mt8135_compat = {
> > @@ -1516,6 +1518,12 @@ static void msdc_init_hw(struct msdc_host *host)
> >   	u32 val;
> >   	u32 tune_reg = host->dev_comp->pad_tune_reg;
> >   
> > +	if (host->reset) {
> > +		reset_control_assert(host->reset);
> > +		usleep_range(10, 50);
> > +		reset_control_deassert(host->reset);
> > +	}
> > +
> >   	/* Configure to MMC/SD mode, clock free running */
> >   	sdr_set_bits(host->base + MSDC_CFG, MSDC_CFG_MODE | MSDC_CFG_CKPDN);
> >   
> > @@ -2273,6 +2281,11 @@ static int msdc_drv_probe(struct platform_device *pdev)
> >   	if (IS_ERR(host->src_clk_cg))
> >   		host->src_clk_cg = NULL;
> >   
> > +	host->reset = devm_reset_control_get_optional_exclusive(&pdev->dev,
> > +								"hrst");
> > +	if (IS_ERR(host->reset))
> > +		return PTR_ERR(host->reset);
> > +
> >   	host->irq = platform_get_irq(pdev, 0);
> >   	if (host->irq < 0) {
> >   		ret = -EINVAL;
> > 


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-08-14  1:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-13  9:38 [RESEND,v4,0/3] mmc: mediatek: add optional reset property Wenbin Mei
2020-08-13  9:38 ` [RESEND,v4,1/3] mmc: dt-bindings: Add resets/reset-names for Mediatek MMC bindings Wenbin Mei
2020-08-13  9:38 ` [RESEND,v4,2/3] arm64: dts: mt7622: add reset node for mmc device Wenbin Mei
2020-08-13  9:38 ` [RESEND,v4,3/3] mmc: mediatek: add optional module reset property Wenbin Mei
2020-08-13 13:57   ` Matthias Brugger
2020-08-14  1:08     ` Wenbin Mei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).