* [PATCH v2 2/4] mmc: dw_mmc: fix the IDMAC sw reset
@ 2012-05-22 4:01 Seungwon Jeon
2012-05-23 17:33 ` Dmitry Shmidt
0 siblings, 1 reply; 3+ messages in thread
From: Seungwon Jeon @ 2012-05-22 4:01 UTC (permalink / raw)
To: linux-mmc
Cc: 'Chris Ball', 'Will Newton',
'James Hogan'
IDMAC may not be cleaned in driver probe if it has
been already used in boot time. So IDMAC needs sw
reset newly. And DMA interface reset precedes the
internal DMAC reset. Additionally SDMMC_IDMAC_SWRESET
is replaced with magic code.
Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
---
drivers/mmc/host/dw_mmc.c | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index b46faf0..98fe023 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -418,6 +418,8 @@ static int dw_mci_idmac_init(struct dw_mci *host)
p->des3 = host->sg_dma;
p->des0 = IDMAC_DES0_ER;
+ mci_writel(host, BMOD, SDMMC_IDMAC_SWRESET);
+
/* Mask out interrupts - get Tx & Rx complete only */
mci_writel(host, IDINTEN, SDMMC_IDMAC_INT_NI | SDMMC_IDMAC_INT_RI |
SDMMC_IDMAC_INT_TI);
@@ -1724,7 +1726,8 @@ static void dw_mci_work_routine_card(struct work_struct *work)
#ifdef CONFIG_MMC_DW_IDMAC
ctrl = mci_readl(host, BMOD);
- ctrl |= 0x01; /* Software reset of DMA */
+ /* Software reset of DMA */
+ ctrl |= SDMMC_IDMAC_SWRESET;
mci_writel(host, BMOD, ctrl);
#endif
@@ -1949,10 +1952,6 @@ int dw_mci_probe(struct dw_mci *host)
spin_lock_init(&host->lock);
INIT_LIST_HEAD(&host->queue);
-
- host->dma_ops = host->pdata->dma_ops;
- dw_mci_init_dma(host);
-
/*
* Get the host data width - this assumes that HCON has been set with
* the correct values.
@@ -1980,10 +1979,11 @@ int dw_mci_probe(struct dw_mci *host)
}
/* Reset all blocks */
- if (!mci_wait_reset(&host->dev, host)) {
- ret = -ENODEV;
- goto err_dmaunmap;
- }
+ if (!mci_wait_reset(&host->dev, host))
+ return -ENODEV;
+
+ host->dma_ops = host->pdata->dma_ops;
+ dw_mci_init_dma(host);
/* Clear the interrupts for the host controller */
mci_writel(host, RINTSTS, 0xFFFFFFFF);
@@ -2169,14 +2169,14 @@ int dw_mci_resume(struct dw_mci *host)
if (host->vmmc)
regulator_enable(host->vmmc);
- if (host->dma_ops->init)
- host->dma_ops->init(host);
-
if (!mci_wait_reset(&host->dev, host)) {
ret = -ENODEV;
return ret;
}
+ if (host->dma_ops->init)
+ host->dma_ops->init(host);
+
/* Restore the old value at FIFOTH register */
mci_writel(host, FIFOTH, host->fifoth_val);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2 2/4] mmc: dw_mmc: fix the IDMAC sw reset
2012-05-22 4:01 [PATCH v2 2/4] mmc: dw_mmc: fix the IDMAC sw reset Seungwon Jeon
@ 2012-05-23 17:33 ` Dmitry Shmidt
2012-05-28 3:32 ` Seungwon Jeon
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Shmidt @ 2012-05-23 17:33 UTC (permalink / raw)
To: Seungwon Jeon; +Cc: linux-mmc, Chris Ball, Will Newton, James Hogan
On Mon, May 21, 2012 at 9:01 PM, Seungwon Jeon <tgih.jun@samsung.com> wrote:
> IDMAC may not be cleaned in driver probe if it has
> been already used in boot time. So IDMAC needs sw
> reset newly. And DMA interface reset precedes the
> internal DMAC reset. Additionally SDMMC_IDMAC_SWRESET
> is replaced with magic code.
>
> Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
> ---
> drivers/mmc/host/dw_mmc.c | 24 ++++++++++++------------
> 1 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index b46faf0..98fe023 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -418,6 +418,8 @@ static int dw_mci_idmac_init(struct dw_mci *host)
> p->des3 = host->sg_dma;
> p->des0 = IDMAC_DES0_ER;
>
> + mci_writel(host, BMOD, SDMMC_IDMAC_SWRESET);
> +
> /* Mask out interrupts - get Tx & Rx complete only */
> mci_writel(host, IDINTEN, SDMMC_IDMAC_INT_NI | SDMMC_IDMAC_INT_RI |
> SDMMC_IDMAC_INT_TI);
> @@ -1724,7 +1726,8 @@ static void dw_mci_work_routine_card(struct work_struct *work)
>
> #ifdef CONFIG_MMC_DW_IDMAC
> ctrl = mci_readl(host, BMOD);
> - ctrl |= 0x01; /* Software reset of DMA */
> + /* Software reset of DMA */
> + ctrl |= SDMMC_IDMAC_SWRESET;
> mci_writel(host, BMOD, ctrl);
> #endif
>
> @@ -1949,10 +1952,6 @@ int dw_mci_probe(struct dw_mci *host)
> spin_lock_init(&host->lock);
> INIT_LIST_HEAD(&host->queue);
>
> -
> - host->dma_ops = host->pdata->dma_ops;
> - dw_mci_init_dma(host);
> -
> /*
> * Get the host data width - this assumes that HCON has been set with
> * the correct values.
> @@ -1980,10 +1979,11 @@ int dw_mci_probe(struct dw_mci *host)
> }
>
> /* Reset all blocks */
> - if (!mci_wait_reset(&host->dev, host)) {
> - ret = -ENODEV;
> - goto err_dmaunmap;
> - }
> + if (!mci_wait_reset(&host->dev, host))
> + return -ENODEV;
You would probably want something like this:
+ if (!mci_wait_reset(&host->dev, host)) {
+ ret = -ENODEV;
+ goto err_free_hclk;
+ }
> +
> + host->dma_ops = host->pdata->dma_ops;
> + dw_mci_init_dma(host);
>
> /* Clear the interrupts for the host controller */
> mci_writel(host, RINTSTS, 0xFFFFFFFF);
> @@ -2169,14 +2169,14 @@ int dw_mci_resume(struct dw_mci *host)
> if (host->vmmc)
> regulator_enable(host->vmmc);
>
> - if (host->dma_ops->init)
> - host->dma_ops->init(host);
> -
> if (!mci_wait_reset(&host->dev, host)) {
> ret = -ENODEV;
> return ret;
> }
>
> + if (host->dma_ops->init)
> + host->dma_ops->init(host);
> +
> /* Restore the old value at FIFOTH register */
> mci_writel(host, FIFOTH, host->fifoth_val);
>
> --
> 1.7.0.4
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread* RE: [PATCH v2 2/4] mmc: dw_mmc: fix the IDMAC sw reset
2012-05-23 17:33 ` Dmitry Shmidt
@ 2012-05-28 3:32 ` Seungwon Jeon
0 siblings, 0 replies; 3+ messages in thread
From: Seungwon Jeon @ 2012-05-28 3:32 UTC (permalink / raw)
To: 'Dmitry Shmidt'
Cc: linux-mmc, 'Chris Ball', 'Will Newton',
'James Hogan'
Dmitry Shmidt <dimitrysh@android.com>
> On Mon, May 21, 2012 at 9:01 PM, Seungwon Jeon <tgih.jun@samsung.com> wrote:
> > IDMAC may not be cleaned in driver probe if it has
> > been already used in boot time. So IDMAC needs sw
> > reset newly. And DMA interface reset precedes the
> > internal DMAC reset. Additionally SDMMC_IDMAC_SWRESET
> > is replaced with magic code.
> >
> > Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
> > ---
> > drivers/mmc/host/dw_mmc.c | 24 ++++++++++++------------
> > 1 files changed, 12 insertions(+), 12 deletions(-)
> >
> > diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> > index b46faf0..98fe023 100644
> > --- a/drivers/mmc/host/dw_mmc.c
> > +++ b/drivers/mmc/host/dw_mmc.c
> > @@ -418,6 +418,8 @@ static int dw_mci_idmac_init(struct dw_mci *host)
> > p->des3 = host->sg_dma;
> > p->des0 = IDMAC_DES0_ER;
> >
> > + mci_writel(host, BMOD, SDMMC_IDMAC_SWRESET);
> > +
> > /* Mask out interrupts - get Tx & Rx complete only */
> > mci_writel(host, IDINTEN, SDMMC_IDMAC_INT_NI | SDMMC_IDMAC_INT_RI |
> > SDMMC_IDMAC_INT_TI);
> > @@ -1724,7 +1726,8 @@ static void dw_mci_work_routine_card(struct work_struct *work)
> >
> > #ifdef CONFIG_MMC_DW_IDMAC
> > ctrl = mci_readl(host, BMOD);
> > - ctrl |= 0x01; /* Software reset of DMA */
> > + /* Software reset of DMA */
> > + ctrl |= SDMMC_IDMAC_SWRESET;
> > mci_writel(host, BMOD, ctrl);
> > #endif
> >
> > @@ -1949,10 +1952,6 @@ int dw_mci_probe(struct dw_mci *host)
> > spin_lock_init(&host->lock);
> > INIT_LIST_HEAD(&host->queue);
> >
> > -
> > - host->dma_ops = host->pdata->dma_ops;
> > - dw_mci_init_dma(host);
> > -
> > /*
> > * Get the host data width - this assumes that HCON has been set with
> > * the correct values.
> > @@ -1980,10 +1979,11 @@ int dw_mci_probe(struct dw_mci *host)
> > }
> >
> > /* Reset all blocks */
> > - if (!mci_wait_reset(&host->dev, host)) {
> > - ret = -ENODEV;
> > - goto err_dmaunmap;
> > - }
> > + if (!mci_wait_reset(&host->dev, host))
> > + return -ENODEV;
>
> You would probably want something like this:
> + if (!mci_wait_reset(&host->dev, host)) {
> + ret = -ENODEV;
> + goto err_free_hclk;
> + }
This is applicable to only our local branch.
>
> > +
> > + host->dma_ops = host->pdata->dma_ops;
> > + dw_mci_init_dma(host);
> >
> > /* Clear the interrupts for the host controller */
> > mci_writel(host, RINTSTS, 0xFFFFFFFF);
> > @@ -2169,14 +2169,14 @@ int dw_mci_resume(struct dw_mci *host)
> > if (host->vmmc)
> > regulator_enable(host->vmmc);
> >
> > - if (host->dma_ops->init)
> > - host->dma_ops->init(host);
> > -
> > if (!mci_wait_reset(&host->dev, host)) {
> > ret = -ENODEV;
> > return ret;
> > }
> >
> > + if (host->dma_ops->init)
> > + host->dma_ops->init(host);
> > +
> > /* Restore the old value at FIFOTH register */
> > mci_writel(host, FIFOTH, host->fifoth_val);
> >
> > --
> > 1.7.0.4
> >
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-05-28 3:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-22 4:01 [PATCH v2 2/4] mmc: dw_mmc: fix the IDMAC sw reset Seungwon Jeon
2012-05-23 17:33 ` Dmitry Shmidt
2012-05-28 3:32 ` Seungwon Jeon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox