[U-Boot] [PATCH V4 3/9] DWMMC: Initialise dwmci and resolve EMMC read write issues

Amarendra Reddy amar.lavanuru at gmail.com
Tue Jan 15 09:26:59 CET 2013


Hi Jaehoon,

On 11 January 2013 09:31, Jaehoon Chung <jh80.chung at samsung.com> wrote:

>  On 01/11/2013 12:26 AM, Simon Glass wrote:
> > Hi Amar,
> >
> > On Fri, Jan 4, 2013 at 1:34 AM, Amar <amarendra.xt at samsung.com> wrote:
> >> This patch enumerates dwmci and set auto stop command during
> >> dwmci initialisation.
> >> EMMC read/write is not happening in current implementation
> >> due to improper fifo size computation. Hence Modified the fifo size
> >> computation to resolve EMMC read write issues.
> >>
> >> Changes from V1:
> >>         1)Created the macros RX_WMARK_SHIFT and RX_WMARK_MASK in header
> file.
> >>
> >> Changes from V2:
> >>         1)Updation of commit message and resubmition of proper patch
> set.
> >>
> >> Changes from V3:
> >>         1)Updated to use the macro DWMCI_CTRL_SEND_AS_CCSD instead of
> >>         the hard coded value (1 << 10).
> >
> > I suggest you take a look at patman which might simplify your patch
> > sending and change logs - see tools/patman/README for details.
> >
> >>
> >> Signed-off-by: Amar <amarendra.xt at samsung.com>
> >> ---
> >>  drivers/mmc/dw_mmc.c | 14 ++++++++++++--
> >>  1 file changed, 12 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
> >> index 4070d4e..776fdb6 100644
> >> --- a/drivers/mmc/dw_mmc.c
> >> +++ b/drivers/mmc/dw_mmc.c
> >> @@ -136,6 +136,7 @@ static int dwmci_send_cmd(struct mmc *mmc, struct
> mmc_cmd *cmd,
> >>                         return TIMEOUT;
> >>                 }
> >>                 timeout--;
> >> +               mdelay(1);
> >
> > How long will this delay in total?
> i didn't sure why add the mdelay(1)..i think mdelay(1) is too long.
> Isn't there other approach to resolve read/write issue?
>

Other approach is
In the function dwmci_send_cmd(..), currently the variable "timeout =
100000".
If we change to "timeout = 200000", it works.

>
> Best Regards,
> Jaehoon Chung
>  >
> >>         }
> >>
> >>         dwmci_writel(host, DWMCI_RINTSTS, DWMCI_INTMSK_ALL);
> >> @@ -314,7 +315,7 @@ static void dwmci_set_ios(struct mmc *mmc)
> >>  static int dwmci_init(struct mmc *mmc)
> >>  {
> >>         struct dwmci_host *host = (struct dwmci_host *)mmc->priv;
> >> -       u32 fifo_size, fifoth_val;
> >> +       u32 fifo_size, fifoth_val, ier;
> >>
> >>         dwmci_writel(host, DWMCI_PWREN, 1);
> >>
> >> @@ -323,6 +324,14 @@ static int dwmci_init(struct mmc *mmc)
> >>                 return -1;
> >>         }
> >>
> >> +       /* Enumerate at 400KHz */
> >> +       dwmci_setup_bus(host, mmc->f_min);
> >> +
> >> +       /* Set auto stop command */
> >> +       ier = dwmci_readl(host, DWMCI_CTRL);
> >> +       ier |= DWMCI_CTRL_SEND_AS_CCSD;
> >> +       dwmci_writel(host, DWMCI_CTRL, ier);
> >> +
> >>         dwmci_writel(host, DWMCI_RINTSTS, 0xFFFFFFFF);
> >>         dwmci_writel(host, DWMCI_INTMASK, 0);
> >>
> >> @@ -332,10 +341,11 @@ static int dwmci_init(struct mmc *mmc)
> >>         dwmci_writel(host, DWMCI_BMOD, 1);
> >>
> >>         fifo_size = dwmci_readl(host, DWMCI_FIFOTH);
> >> +       fifo_size = ((fifo_size & RX_WMARK_MASK) >> RX_WMARK_SHIFT) + 1;
> >>         if (host->fifoth_val)
> >>                 fifoth_val = host->fifoth_val;
> >>         else
> >> -               fifoth_val = MSIZE(0x2) | RX_WMARK(fifo_size/2 -1) |
> >> +               fifoth_val = MSIZE(0x2) | RX_WMARK(fifo_size/2 - 1) |
> >>                         TX_WMARK(fifo_size/2);
> >
> > {} around this else I think. Also space around /
> >
> >>         dwmci_writel(host, DWMCI_FIFOTH, fifoth_val);
> >>
> >> --
> >> 1.8.0
> >>
> >
> > Regards,
> > Simon
> >
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>


More information about the U-Boot mailing list