public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime.ripard@free-electrons.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [bug report] sunxi: booting from eMMC
Date: Wed, 21 Sep 2016 16:32:28 +0300	[thread overview]
Message-ID: <20160921133228.GF8719@lukather> (raw)
In-Reply-To: <d7aaf4fc-8a08-61e2-d6d7-a8e7da3a603e@samsung.com>

Hi Jaehoon,

On Tue, Sep 20, 2016 at 08:10:52AM +0900, Jaehoon Chung wrote:
> On 09/19/2016 10:17 PM, Maxime Ripard wrote:
> > On Wed, Sep 14, 2016 at 12:05:19PM +0200, Hans de Goede wrote:
> >> Hi,
> >>
> >> On 13-09-16 13:50, Maxime Ripard wrote:
> >>> Hi,
> >>>
> >>> On Mon, Sep 12, 2016 at 04:47:49PM +0200, Hans de Goede wrote:
> >>>> On 12-09-16 15:56, Maxime Ripard wrote:
> >>>>> Hi,
> >>>>>
> >>>>> On Mon, Sep 12, 2016 at 01:53:24PM +0200, Ciprian Manea wrote:
> >>>>>> I'm using a SinA33 dev board (Allwinner a33 SoC) and at the moment
> >>>>>> I'm trying to boot from the eMMC.
> >>>>>>
> >>>>>> But it fails in the following way:
> >>>>>>
> >>>>>>
> >>>>>> *Got the following error at boot time:*
> >>>>>> *U-Boot SPL 2016.09-rc2-00125-g6e8b42f (Sep 08 2016 - 11:00:46) DRAM: 1024
> >>>>>> MiB Trying to boot from MMC2 MMC Device 1 not found spl: could not find mmc
> >>>>>> device. error: -19 SPL: failed to boot from all boot devices ### ERROR ###
> >>>>>> Please RESET the board ###*
> >>>>>
> >>>>> So I've been on the same issue for the last couple of days.
> >>>>>
> >>>>> Since that board is already supported, adding support for the eMMC
> >>>>> basically came down to that patch on top of 2016.09-rc2.
> >>>>>
> >>>>> http://code.bulix.org/kcgxri-106037?raw
> >>>>>
> >>>>> (Quite hackish, the 8-Bits part being a separate issue that would need
> >>>>> to be addressed somehow).
> >>>>>
> >>>>> However, it doesn't work, neither when flashing u-boot on the eMMC
> >>>>> itself (where there's a timeout error in the SPL) nor when trying to
> >>>>> access the eMMC from a U-Boot loaded from the (external) SD.
> >>>>>
> >>>>> In the latter case, even mmc dev 1 fails silently.
> >>>>>
> >>>>> I traced that down to the mmc_switch here:
> >>>>> http://git.denx.de/?p=u-boot.git;a=blob;f=drivers/mmc/mmc.c#l530
> >>>>>
> >>>>> Which fails with ETIMEDOUT, and more specifically, it's the call to
> >>>>> mmc_rint_wait here
> >>>>> http://git.denx.de/?p=u-boot.git;a=blob;f=drivers/mmc/sunxi_mmc.c#l383
> >>>>> that times out.
> >>>>>
> >>>>> Increasing the timeout value (to 10000) doesn't really change
> >>>>> anything. I guess this is also the reason why we had a timeout error
> >>>>> in the SPL.
> 
> timeout_msecs is expired or hit SUNXI_MMC_RINT_INTERRUPT_ERROR_BIT?
> If hit ERROR_BIT, did you check which bit is set?

I haven't check, I'll look (next week though, I'm at a conference and
away from that board).

> If error is occurred when mmc_change_freq() is running, cid/ext_csd
> register have already read.
>
> It means the controller read the something from eMMC card.

It really is the next command right after the switch that fails, it
really feels like that switch changes the timings of the card without
changing the one from the host.

> 
> >>>>>
> >>>>> This eMMC works fine in Linux, with the same muxing (and I guess the
> >>>>> earlier commands wouldn't be successful if the muxing or power was not
> >>>>> set up appropriately). So I'm kind of running out of ideas on what
> >>>>> could be the root cause of this.
> >>>>>
> >>>>> Hans, any ideas?
> >>>>
> >>>> Maybe the emmc needs external pull-ups ? I don't remember if u-boot
> >>>> always enables those or not ...
> >>>
> >>> So I pushed this a bit more, and it seems like commenting the call to
> >>> mmc_change_freq makes everything just work.
> >>>
> >>> Reading the JEDEC spec, it looks like when you switch to high speed,
> >>> you also need to change the controller clock rate, that u-boot doesn't
> >>> seem to do at the moment, which obviously will fail, since the
> >>> controller will be stuck at the former rate, while the eMMC would be
> >>> switched.
> >>>
> >>> If I comment mmc_change_freq, everything works.
> >>
> >> Hmm, I'm pretty sure the u-boot sunxi mmc code
> >> does properly change the clock, see mmc_set_mod_clk() in
> >> drivers/mmc/sunxi_mmc.c
> >>
> >> This will switch to the right PLL, etc. So there likely is
> >> something else going on making things not work at higher
> >> speeds.
> > 
> > Yep, I noticed that. However, what confuses me more is that the
> > command seems to be sent here:
> > http://git.denx.de/?p=u-boot.git;a=blob;f=drivers/mmc/mmc.c#l530
> 
> If then..i guess that it's possible to set the initial clock as
> higher clock than 400KHz.  Did you check this?

I'll try. But wouldn't that introduce some compatibility issues of its
own?

Thanks,
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160921/b98cf0f1/attachment.sig>

  reply	other threads:[~2016-09-21 13:32 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-12 11:53 [U-Boot] [bug report] sunxi: booting from eMMC Ciprian Manea
2016-09-12 13:56 ` Maxime Ripard
2016-09-12 14:47   ` Hans de Goede
2016-09-13 11:50     ` Maxime Ripard
2016-09-14 10:05       ` Hans de Goede
2016-09-15 13:32         ` Maxime Ripard
2016-09-19 13:17         ` Maxime Ripard
2016-09-19 21:42           ` Hans de Goede
2016-09-19 23:10           ` Jaehoon Chung
2016-09-21 13:32             ` Maxime Ripard [this message]
2016-10-03  8:21             ` Maxime Ripard
  -- strict thread matches above, loose matches on Subject: below --
2016-10-02  7:37 Alexandr Bochkarev
2016-10-02 13:38 ` Jagan Teki
2016-10-02 13:43   ` Alexandr Bochkarev
2016-10-02 17:08     ` Jagan Teki
     [not found]       ` <CAC2Q4vbD0Eh++cfvKfbSxK_m0KLqUh5GGJ4ur6K6AFSp2so39w@mail.gmail.com>
     [not found]         ` <CAC2Q4vY8vnaM5XrZKNp84J0AmYKWSGQKK_DQOKLERUCQyGM=nA@mail.gmail.com>
2016-10-02 17:15           ` AneoX
2016-10-02 17:28             ` Jagan Teki
     [not found]               ` <CAC2Q4vY0mpHLO82qN=xecvy9gjKESWd_FzP-esaC9zcyH0dqcg@mail.gmail.com>
2016-10-02 17:39                 ` AneoX
2016-10-06 23:48                   ` Jaehoon Chung
2016-10-07  8:44                     ` Alexandr Bochkarev
2016-10-12 10:52                       ` Alexandr Bochkarev
2016-10-12 11:09                         ` Jaehoon Chung
2016-10-12 11:25                           ` Alexandr Bochkarev
2016-10-12 12:05                             ` Jaehoon Chung
2016-10-12 12:11                               ` Alexandr Bochkarev
2016-10-12 12:21                                 ` Jaehoon Chung
2016-10-12 12:42                                   ` Alexandr Bochkarev
2016-10-12 12:57                                     ` Alexandr Bochkarev
2016-10-12 13:11                                       ` Alexandr Bochkarev
2016-10-12 13:30                                         ` Jaehoon Chung
2016-10-12 14:03                                           ` Alexandr Bochkarev
2016-10-12 17:49                                             ` Alexandr Bochkarev
2016-10-13  1:11                                               ` Jaehoon Chung
2016-11-03 21:23                                               ` Alexandr Bochkarev
2016-11-03 21:39                                                 ` Alexandr Bochkarev
2016-11-04 22:57                                                   ` Alexandr Bochkarev
2016-11-05  8:18                                                     ` Hans de Goede
2016-11-05 10:58                                                       ` Alexandr Bochkarev
2016-10-13  1:12                                             ` Jaehoon Chung
2016-10-13  8:18                                               ` Alexandr Bochkarev
     [not found]                                                 ` <03f26ecf-c130-88d3-b3df-d7c6ed90ed48@samsung.com>
     [not found]                                                   ` <CB1DA1DA-F8C8-4F21-8201-F008E306FA72@gmail.com>
     [not found]                                                     ` <4b856cc3-68e4-371e-9f9e-df0264769843@samsung.com>
     [not found]                                                       ` <5191BB28-1F97-4B43-8048-85EDFCD52E64@gmail.com>
     [not found]                                                         ` <CGME20161102111524epcas3p1a851f9aeb4b21316065be54bb52b15d4@epcas3p1.samsung.com>
     [not found]                                                           ` <4A365F64-DFAF-477A-B844-6FE397773553@gmail.com>
     [not found]                                                             ` <b1ca97e7-9094-d7f7-d7a8-db3d5b8e9c75@samsung.com>
     [not found]                                                               ` <CAC2Q4vZM7_yhgtR0sd3N-w0ZeeOUQG5RgToz+oNhK5jnKSmcyw@mail.gmail.com>
     [not found]                                                                 ` <073f966f-29be-a35e-8f1c-9ef1c1f2bef7@samsung.com>
2016-11-03 10:10                                                                   ` Alexandr Bochkarev
2016-11-03 19:57                                                                     ` Alexandr Bochkarev

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=20160921133228.GF8719@lukather \
    --to=maxime.ripard@free-electrons.com \
    --cc=u-boot@lists.denx.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox