Commit 245904a4 authored by Ville Syrjala's avatar Ville Syrjala Committed by Linus Torvalds

sm501: remove a duplicated table

misc_div is a subset of px_div so eliminate the smaller table.
Signed-off-by: default avatarVille Syrjala <syrjala@sci.fi>
Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 7e533705
...@@ -53,26 +53,7 @@ struct sm501_devdata { ...@@ -53,26 +53,7 @@ struct sm501_devdata {
#define MHZ (1000 * 1000) #define MHZ (1000 * 1000)
#ifdef DEBUG #ifdef DEBUG
static const unsigned int misc_div[] = { static const unsigned int div_tab[] = {
[0] = 1,
[1] = 2,
[2] = 4,
[3] = 8,
[4] = 16,
[5] = 32,
[6] = 64,
[7] = 128,
[8] = 3,
[9] = 6,
[10] = 12,
[11] = 24,
[12] = 48,
[13] = 96,
[14] = 192,
[15] = 384,
};
static const unsigned int px_div[] = {
[0] = 1, [0] = 1,
[1] = 2, [1] = 2,
[2] = 4, [2] = 4,
...@@ -101,12 +82,12 @@ static const unsigned int px_div[] = { ...@@ -101,12 +82,12 @@ static const unsigned int px_div[] = {
static unsigned long decode_div(unsigned long pll2, unsigned long val, static unsigned long decode_div(unsigned long pll2, unsigned long val,
unsigned int lshft, unsigned int selbit, unsigned int lshft, unsigned int selbit,
unsigned long mask, const unsigned int *dtab) unsigned long mask)
{ {
if (val & selbit) if (val & selbit)
pll2 = 288 * MHZ; pll2 = 288 * MHZ;
return pll2 / dtab[(val >> lshft) & mask]; return pll2 / div_tab[(val >> lshft) & mask];
} }
#define fmt_freq(x) ((x) / MHZ), ((x) % MHZ), (x) #define fmt_freq(x) ((x) / MHZ), ((x) % MHZ), (x)
...@@ -141,10 +122,10 @@ static void sm501_dump_clk(struct sm501_devdata *sm) ...@@ -141,10 +122,10 @@ static void sm501_dump_clk(struct sm501_devdata *sm)
} }
sdclk0 = (misct & (1<<12)) ? pll2 : 288 * MHZ; sdclk0 = (misct & (1<<12)) ? pll2 : 288 * MHZ;
sdclk0 /= misc_div[((misct >> 8) & 0xf)]; sdclk0 /= div_tab[((misct >> 8) & 0xf)];
sdclk1 = (misct & (1<<20)) ? pll2 : 288 * MHZ; sdclk1 = (misct & (1<<20)) ? pll2 : 288 * MHZ;
sdclk1 /= misc_div[((misct >> 16) & 0xf)]; sdclk1 /= div_tab[((misct >> 16) & 0xf)];
dev_dbg(sm->dev, "MISCT=%08lx, PM0=%08lx, PM1=%08lx\n", dev_dbg(sm->dev, "MISCT=%08lx, PM0=%08lx, PM1=%08lx\n",
misct, pm0, pm1); misct, pm0, pm1);
...@@ -158,19 +139,19 @@ static void sm501_dump_clk(struct sm501_devdata *sm) ...@@ -158,19 +139,19 @@ static void sm501_dump_clk(struct sm501_devdata *sm)
"P2 %ld.%ld MHz (%ld), V2 %ld.%ld (%ld), " "P2 %ld.%ld MHz (%ld), V2 %ld.%ld (%ld), "
"M %ld.%ld (%ld), MX1 %ld.%ld (%ld)\n", "M %ld.%ld (%ld), MX1 %ld.%ld (%ld)\n",
(pmc & 3 ) == 0 ? '*' : '-', (pmc & 3 ) == 0 ? '*' : '-',
fmt_freq(decode_div(pll2, pm0, 24, 1<<29, 31, px_div)), fmt_freq(decode_div(pll2, pm0, 24, 1<<29, 31)),
fmt_freq(decode_div(pll2, pm0, 16, 1<<20, 15, misc_div)), fmt_freq(decode_div(pll2, pm0, 16, 1<<20, 15)),
fmt_freq(decode_div(pll2, pm0, 8, 1<<12, 15, misc_div)), fmt_freq(decode_div(pll2, pm0, 8, 1<<12, 15)),
fmt_freq(decode_div(pll2, pm0, 0, 1<<4, 15, misc_div))); fmt_freq(decode_div(pll2, pm0, 0, 1<<4, 15)));
dev_dbg(sm->dev, "PM1[%c]: " dev_dbg(sm->dev, "PM1[%c]: "
"P2 %ld.%ld MHz (%ld), V2 %ld.%ld (%ld), " "P2 %ld.%ld MHz (%ld), V2 %ld.%ld (%ld), "
"M %ld.%ld (%ld), MX1 %ld.%ld (%ld)\n", "M %ld.%ld (%ld), MX1 %ld.%ld (%ld)\n",
(pmc & 3 ) == 1 ? '*' : '-', (pmc & 3 ) == 1 ? '*' : '-',
fmt_freq(decode_div(pll2, pm1, 24, 1<<29, 31, px_div)), fmt_freq(decode_div(pll2, pm1, 24, 1<<29, 31)),
fmt_freq(decode_div(pll2, pm1, 16, 1<<20, 15, misc_div)), fmt_freq(decode_div(pll2, pm1, 16, 1<<20, 15)),
fmt_freq(decode_div(pll2, pm1, 8, 1<<12, 15, misc_div)), fmt_freq(decode_div(pll2, pm1, 8, 1<<12, 15)),
fmt_freq(decode_div(pll2, pm1, 0, 1<<4, 15, misc_div))); fmt_freq(decode_div(pll2, pm1, 0, 1<<4, 15)));
} }
static void sm501_dump_regs(struct sm501_devdata *sm) static void sm501_dump_regs(struct sm501_devdata *sm)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment