mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Robin van der Gracht <robin@protonic.nl>
To: Barebox <barebox@lists.infradead.org>
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Subject: Boot hangs during sdhci_transfer_data_dma
Date: Mon, 20 Jun 2022 16:33:02 +0200	[thread overview]
Message-ID: <28eba28ad8f42919edb1aee4e4303a96@protonic.nl> (raw)

Hi,

Today I tried to run barebox with CONFIG_KEYBOARD_GPIO=y added to my config.
and noticed my board hangs during boot. When I modify the probe function to
run without registering the poller[1] it boots as expected.

I started digging into the code to see how far the boot gets when I do
register the poller. I found that Barebox hangs in a do/while loop in
sdhci_transfer_data_dma[2].

The contents of the interrupt status (SDHCI_INT_STATUS) is 0 and stays that
way forever trapping the process in the loop.

Call stack:

initcall -> barebox_of_populate
   state_probe                                          drivers/misc/state.c
     state_new_from_node                                common/state/state.c
       of_find_path_by_node                             drivers/of/of_path.c
         __of_find_path                                 drivers/of/of_path.c
           device_detect                                drivers/base/driver.c
             mci_detect_card                            drivers/mci/mci-core.c
               mci_card_probe                           drivers/mci/mci-core.c
                 mci_startup                            drivers/mci/mci-core.c
                   mci_startup_mmc                      drivers/mci/mci-core.c
                     mmc_compare_ext_csds               drivers/mci/mci-core.c
                       mci_send_ext_csd                 drivers/mci/mci-core.c
                         mci_send_cmd                   drivers/mci/mci-core.c
                           esdhc_send_cmd               
drivers/mci/imx-esdhc.c
                             __esdhc_send_cmd    
drivers/mci/imx-esdhc-common.c
                               sdhci_transfer_data_dma  drivers/mci/sdhci.c


I'm not sure how this happens. It's not the first transfer taking place. I
figured that mayby the poller[1] just adds some cpu load that opens up a
window for this to occur.

Maybe something else cleared the status register right before we entered the
loop. Thats when I spotted this read/write construction[3]. It's executed
right before we enter the do/while loop and (over)writes to the irq status
register.

I removed the line with the write command[3] and my board boots as expected.
Why are we (over)writing the status register right after reading it?

Other theories on how this could occur are also very welcome :)

- Robin


1: 
https://git.pengutronix.de/cgit/barebox/tree/drivers/input/gpio_keys.c#n168
2: https://git.pengutronix.de/cgit/barebox/tree/drivers/mci/sdhci.c#n167
3: 
https://git.pengutronix.de/cgit/barebox/tree/drivers/mci/imx-esdhc-common.c#n179



             reply	other threads:[~2022-06-20 14:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-20 14:33 Robin van der Gracht [this message]
2022-06-21  7:46 ` Sascha Hauer
2022-06-21  9:32   ` Robin van der Gracht
2022-06-21 10:07   ` Robin van der Gracht

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=28eba28ad8f42919edb1aee4e4303a96@protonic.nl \
    --to=robin@protonic.nl \
    --cc=andrew.smirnov@gmail.com \
    --cc=barebox@lists.infradead.org \
    --subject='Re: Boot hangs during sdhci_transfer_data_dma' \
    /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

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