Re: [RFC] mmc: add OMAP driver

From: Russell King
Date: Thu Feb 16 2006 - 11:58:26 EST


One additional comment on the patch which I missed, and has shown to
be a related cause of problems on a different host controller...

On Thu, Feb 16, 2006 at 10:27:22AM -0400, Carlos Aguiar wrote:
> +static inline void set_data_timeout(struct mmc_omap_host *host, struct mmc_request *req)
> +{
> + int timeout;
> + u16 reg;
> +
> + /* Convert ns to clock cycles by assuming 20MHz frequency
> + * 1 cycle at 20MHz = 500 ns
> + */
> + timeout = req->data->timeout_clks + req->data->timeout_ns / 500;
> +
> + /* Some cards require more time to do at least the first read operation */
> + timeout = timeout << 4;

This is a hack because you got your calculation above wrong. If you
assume a fast clock, the timeout will be too slow for a slower clock.
If you do the calculation correctly and you won't need such hacks.

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/