[RFC 2/2] mci: add Marvell Dove SDHCI driver

Michael Grzeschik mgr at pengutronix.de
Thu Feb 19 03:59:18 PST 2015


On Wed, Feb 18, 2015 at 08:34:45PM +0100, Sebastian Hesselbarth wrote:
> On 18.02.2015 00:43, Michael Grzeschik wrote:
> >On Fri, Jul 05, 2013 at 11:22:19PM +0200, Sebastian Hesselbarth wrote:
> 
> Nice! It just bumped up the RFC from 1.5yrs back to top in my barebox
> mail folder ;)

:)

> >>This adds a driver for the SDHCI controller found on Marvell Dove SoCs.
> >>Despite a missing pinctrl driver, corresponding MPP config has to be
> >>set on a per board basis.
> [...]
> >>diff --git a/drivers/mci/dove-sdhci.c b/drivers/mci/dove-sdhci.c
> >>new file mode 100644
> >>index 0000000..91ef8b0
> >>--- /dev/null
> >>+++ b/drivers/mci/dove-sdhci.c
> [...]
> >>+static int dove_sdhci_mci_send_cmd(struct mci_host *mci, struct mci_cmd *cmd,
> >>+				struct mci_data *data)
> >>+{
> >>+	u16 val;
> >>+	u64 start;
> >>+	int ret;
> >>+	struct dove_sdhci *host = priv_from_mci_host(mci);
> >>+
> >>+	dove_sdhci_writel(host, SDHCI_INT_STATUS, ~0);
> >>+
> >>+	/* Do not wait for CMD_INHIBIT_DAT on stop commands */
> >>+	if (cmd->cmdidx == MMC_CMD_STOP_TRANSMISSION)
> >>+		val = SDHCI_CMD_INHIBIT_CMD;
> >>+	else
> >>+		val = SDHCI_CMD_INHIBIT_CMD | SDHCI_CMD_INHIBIT_DATA;
> >>+
> >>+	/* Wait for bus idle */
> >>+	start = get_time_ns();
> >>+	while (1) {
> >>+		if (!(dove_sdhci_readw(host, SDHCI_PRESENT_STATE0) & val))
> >>+			break;
> >>+		if (is_timeout(start, 10 * MSECOND)) {
> >
> >I had to set something higher than 10 milliseconds to make this driver
> >work with solidrun cubox. Otherwise it was always running into the
> >timeout.
> 
> Can you tell to what value you had to increase the timeout?
> 
> I have no problem increasing the timeout, we shouldn't run into
> any of them anyway at this point.

I checked this code again without my changes. Just to do some
approximation how small this timeout could get.

This time I have been using another SD-Card.

With that card it was even working without changing the timeout.
But when I started to copy data from the card to ram (which I did not
check so far), it was barking the following error:

dove-sdhci f1092000.sdio-host: SDHCI timeout while waiting for done
dove-sdhci f1092000.sdio-host: error while transfering data for command 18
dove-sdhci f1092000.sdio-host: state = 0206 01ef, interrupt = 0009 0000

This came from the function dove_sdhci_wait_for_done which also has
timeout issues. I had no luck with changing this timeout barrier. It was
giving this error even with an timeout of one second.

I see in the kernel that the dove-sdhci is using the quirk
SDHCI_QUIRK_BROKEN_TIMEOUT_VAL which probably needs some
investigation.

Thanks,
Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list