diff options
author | Robert Jarzmik <robert.jarzmik@free.fr> | 2011-12-19 22:03:05 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-01-02 12:44:02 +0100 |
commit | 6449b9cff5f330de3ce0d2ebeda9aafb40877ac7 (patch) | |
tree | e9084196a9c615fe684ff028969cc4af3d6c8cf0 /drivers/mci/pxamci.c | |
parent | 6bef2778f1350cc8ebe40edb205d949990b33077 (diff) | |
download | barebox-6449b9cff5f330de3ce0d2ebeda9aafb40877ac7.tar.gz barebox-6449b9cff5f330de3ce0d2ebeda9aafb40877ac7.tar.xz |
drivers/mci: pxa fix clockrate
The clock rate was incorrectly calculated, leading to a
frequency of 19.5MHz / 64 instead of 19.5Mz for the host
controller.
with the fix applied, a copy of a file of 230 kB shrinks
from 6000ms to 123ms.
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mci/pxamci.c')
-rw-r--r-- | drivers/mci/pxamci.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/mci/pxamci.c b/drivers/mci/pxamci.c index 1634a1d775..75b61f07b8 100644 --- a/drivers/mci/pxamci.c +++ b/drivers/mci/pxamci.c @@ -161,7 +161,8 @@ static int pxamci_transfer_data(struct pxamci_host *host, static void pxamci_start_cmd(struct pxamci_host *host, struct mci_cmd *cmd, unsigned int cmdat) { - mci_dbg("cmd=(idx=%d,type=%d)\n", cmd->cmdidx, cmd->resp_type); + mci_dbg("cmd=(idx=%d,type=%d,clkrt=%d)\n", cmd->cmdidx, cmd->resp_type, + host->clkrt); if (cmd->resp_type & MMC_RSP_BUSY) cmdat |= CMDAT_BUSY; @@ -277,11 +278,14 @@ static void pxamci_set_ios(struct mci_host *mci, struct device_d *dev, { struct pxamci_host *host = to_pxamci(mci); unsigned int clk_in = pxa_get_mmcclk(); - unsigned long fact; + int fact; - mci_dbg("bus_width=%d, clock=%ud\n", bus_width, clock); - fact = min_t(int, clock / clk_in, 1); - fact = max_t(int, fact, 1 << 6); + mci_dbg("bus_width=%d, clock=%u\n", bus_width, clock); + if (clock) + fact = min_t(int, clk_in / clock, 1 << 6); + else + fact = 1 << 6; + fact = max_t(int, fact, 1); /* * We calculate clkrt here, and will write it on the next command |