public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] Possible MMC subsystem bug
@ 2013-01-27  4:32 Marek Vasut
  2013-01-27  4:44 ` Fleming Andy-AFLEMING
  0 siblings, 1 reply; 3+ messages in thread
From: Marek Vasut @ 2013-01-27  4:32 UTC (permalink / raw)
  To: u-boot

Hi Andy,

I was going through the MMC code, trying to get Phison 8007 SD-to-NAND bridge 
working (don't ask please, this chip's sole existence defies any logic).

So, I found the following code and I was wondering if the following patch is not 
needed. Maybe my brain is just giving up though. Give it some thought please and 
let me know, thanks!

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 72e8ce6..94926ca 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -475,8 +474,11 @@ static int sd_send_op_cond(struct mmc *mmc)
                if (err)
                        return err;
 
+               if (!(cmd.response[0] & OCR_BUSY))
+                       break;
+
                udelay(1000);
-       } while ((!(cmd.response[0] & OCR_BUSY)) && timeout--);
+       } while (timeout--);
 
        if (timeout <= 0)
                return UNUSABLE_ERR;

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

* [U-Boot] Possible MMC subsystem bug
  2013-01-27  4:32 [U-Boot] Possible MMC subsystem bug Marek Vasut
@ 2013-01-27  4:44 ` Fleming Andy-AFLEMING
  2013-01-27  4:49   ` Marek Vasut
  0 siblings, 1 reply; 3+ messages in thread
From: Fleming Andy-AFLEMING @ 2013-01-27  4:44 UTC (permalink / raw)
  To: u-boot

I'll need to double-check the spec, but I believe the BUSY bit has the opposite meaning of common sense.

On Jan 26, 2013, at 22:32, "Marek Vasut" <marex@denx.de> wrote:

> Hi Andy,
> 
> I was going through the MMC code, trying to get Phison 8007 SD-to-NAND bridge 
> working (don't ask please, this chip's sole existence defies any logic).
> 
> So, I found the following code and I was wondering if the following patch is not 
> needed. Maybe my brain is just giving up though. Give it some thought please and 
> let me know, thanks!
> 
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index 72e8ce6..94926ca 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -475,8 +474,11 @@ static int sd_send_op_cond(struct mmc *mmc)
>                if (err)
>                        return err;
> 
> +               if (!(cmd.response[0] & OCR_BUSY))
> +                       break;
> +
>                udelay(1000);
> -       } while ((!(cmd.response[0] & OCR_BUSY)) && timeout--);
> +       } while (timeout--);
> 
>        if (timeout <= 0)
>                return UNUSABLE_ERR;
> 

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

* [U-Boot] Possible MMC subsystem bug
  2013-01-27  4:44 ` Fleming Andy-AFLEMING
@ 2013-01-27  4:49   ` Marek Vasut
  0 siblings, 0 replies; 3+ messages in thread
From: Marek Vasut @ 2013-01-27  4:49 UTC (permalink / raw)
  To: u-boot

Dear Fleming Andy-AFLEMING,

> I'll need to double-check the spec, but I believe the BUSY bit has the
> opposite meaning of common sense.

I tihnk my brain is maybe just giving up really ... I think the code is right 
after some quick poking through the spec.

> On Jan 26, 2013, at 22:32, "Marek Vasut" <marex@denx.de> wrote:
> > Hi Andy,
> > 
> > I was going through the MMC code, trying to get Phison 8007 SD-to-NAND
> > bridge working (don't ask please, this chip's sole existence defies any
> > logic).
> > 
> > So, I found the following code and I was wondering if the following patch
> > is not needed. Maybe my brain is just giving up though. Give it some
> > thought please and let me know, thanks!
> > 
> > diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> > index 72e8ce6..94926ca 100644
> > --- a/drivers/mmc/mmc.c
> > +++ b/drivers/mmc/mmc.c
> > @@ -475,8 +474,11 @@ static int sd_send_op_cond(struct mmc *mmc)
> > 
> >                if (err)
> >                
> >                        return err;
> > 
> > +               if (!(cmd.response[0] & OCR_BUSY))
> > +                       break;
> > +
> > 
> >                udelay(1000);
> > 
> > -       } while ((!(cmd.response[0] & OCR_BUSY)) && timeout--);
> > +       } while (timeout--);
> > 
> >        if (timeout <= 0)
> >        
> >                return UNUSABLE_ERR;

Best regards,
Marek Vasut

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

end of thread, other threads:[~2013-01-27  4:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-27  4:32 [U-Boot] Possible MMC subsystem bug Marek Vasut
2013-01-27  4:44 ` Fleming Andy-AFLEMING
2013-01-27  4:49   ` Marek Vasut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox