Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 53592
b: refs/heads/master
c: d3af5ab
h: refs/heads/master
v: v3
  • Loading branch information
Tony Lindgren authored and Pierre Ossman committed May 1, 2007
1 parent b810948 commit c260fd3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 46a6730e3ff9add5089ddd007f998b97fb4e8571
refs/heads/master: d3af5abe9a809becbe4b413144b607844560d445
47 changes: 26 additions & 21 deletions trunk/drivers/mmc/host/omap.c
Original file line number Diff line number Diff line change
Expand Up @@ -936,33 +936,41 @@ static void mmc_omap_power(struct mmc_omap_host *host, int on)
}
}

static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
static int mmc_omap_calc_divisor(struct mmc_host *mmc, struct mmc_ios *ios)
{
struct mmc_omap_host *host = mmc_priv(mmc);
int func_clk_rate = clk_get_rate(host->fclk);
int dsor;
int realclock, i;

realclock = ios->clock;

if (ios->clock == 0)
dsor = 0;
else {
int func_clk_rate = clk_get_rate(host->fclk);

dsor = func_clk_rate / realclock;
if (dsor < 1)
dsor = 1;
return 0;

if (func_clk_rate / dsor > realclock)
dsor++;
dsor = func_clk_rate / ios->clock;
if (dsor < 1)
dsor = 1;

if (dsor > 250)
dsor = 250;
if (func_clk_rate / dsor > ios->clock)
dsor++;

if (ios->bus_width == MMC_BUS_WIDTH_4)
dsor |= 1 << 15;
}
if (dsor > 250)
dsor = 250;
dsor++;

if (ios->bus_width == MMC_BUS_WIDTH_4)
dsor |= 1 << 15;

return dsor;
}

static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
{
struct mmc_omap_host *host = mmc_priv(mmc);
int dsor;
int i;

dsor = mmc_omap_calc_divisor(mmc, ios);
host->bus_mode = ios->bus_mode;
host->hw_bus_mode = host->bus_mode;

switch (ios->power_mode) {
case MMC_POWER_OFF:
Expand All @@ -977,9 +985,6 @@ static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
break;
}

host->bus_mode = ios->bus_mode;
host->hw_bus_mode = host->bus_mode;

clk_enable(host->fclk);

/* On insanely high arm_per frequencies something sometimes
Expand Down

0 comments on commit c260fd3

Please sign in to comment.