mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Trent Piepho <tpiepho@kymetacorp.com>
To: barebox <barebox@lists.infradead.org>
Subject: MCI bus-width host caps via device tree don't work properly for dw and imx
Date: Fri, 13 Nov 2015 00:36:22 +0000	[thread overview]
Message-ID: <1447374984.4553.133.camel@rtred1test09.kymeta.local> (raw)

I found my 4-bit connected eMMC chip wasn't working because barebox was
trying to run it in 8-bit mode.  I had the proper bus-width property in
the device tree, but this doesn't work.

The problem is that mci_of_parse() uses bus-width to _add_ 8-bit and/or
4-bit caps to the host.  It doesn't remove any host_caps the driver
already has set.  So if the driver supports 8-bit but the DT bus-width
is 4, you still get a driver that thinks 8-bit will work.

You can see this in dw_mmc.c, dw_mmc_probe() sets:
host->mci.host_caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA
then later
mci_of_parse(&host->mci);
return mci_register(&host->mci);

The mci_of_parse call will not remove the 4 and 8 bits caps.  There is
the same problem in imx-esdhc.c.  The other two users of mci_of_parse,
mxs.c and tegra-sdmmc.c, don't have this problem, since they don't set
any bus-width host_caps in the driver and depend on the DT or
platform_data to have this info.

With drivers split 50/50, which is the right way?  Don't have the driver
report what bits it supports and depend on the device tree to have that
information?  Or have of_mci_parse remove widths that aren't indicated
as supported in the DT, so that the DT can remove widths the hardware
indicates it supports.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2015-11-13  0:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-13  0:36 Trent Piepho [this message]
2015-11-13 10:28 ` Sascha Hauer
2015-11-13 18:54   ` Trent Piepho
2015-11-16  6:32     ` Sascha Hauer
2015-11-16 18:26       ` Trent Piepho
2015-11-17  8:09         ` Sascha Hauer

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=1447374984.4553.133.camel@rtred1test09.kymeta.local \
    --to=tpiepho@kymetacorp.com \
    --cc=barebox@lists.infradead.org \
    /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