Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 191815
b: refs/heads/master
c: 232eaf7
h: refs/heads/master
i:
  191813: 4369d9d
  191811: 35d463a
  191807: d9fbd95
v: v3
  • Loading branch information
Russell King committed May 2, 2010
1 parent 06107de commit 5ba55a7
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 15 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: e73a46a3d3df22b379d8adcb59999eafea1d60d5
refs/heads/master: 232eaf7f268f765b52170bec42bfa0c5825aa239
18 changes: 11 additions & 7 deletions trunk/arch/arm/common/icst307.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,23 @@
/*
* Divisors for each OD setting.
*/
static unsigned char s2div[8] = { 10, 2, 8, 4, 5, 7, 3, 6 };
const unsigned char icst307_s2div[8] = { 10, 2, 8, 4, 5, 7, 3, 6 };

EXPORT_SYMBOL(icst307_s2div);

unsigned long icst307_hz(const struct icst_params *p, struct icst_vco vco)
{
return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * s2div[vco.s]);
return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * p->s2div[vco.s]);
}

EXPORT_SYMBOL(icst307_hz);

/*
* Ascending divisor S values.
*/
static unsigned char idx2s[8] = { 1, 6, 3, 4, 7, 5, 2, 0 };
const unsigned char icst307_idx2s[8] = { 1, 6, 3, 4, 7, 5, 2, 0 };

EXPORT_SYMBOL(icst307_idx2s);

struct icst_vco
icst307_hz_to_vco(const struct icst_params *p, unsigned long freq)
Expand All @@ -48,19 +52,19 @@ icst307_hz_to_vco(const struct icst_params *p, unsigned long freq)
* that the PLL output is within spec.
*/
do {
f = freq * s2div[idx2s[i]];
f = freq * p->s2div[p->idx2s[i]];

/*
* f must be between 6MHz and 200MHz (3.3 or 5V)
*/
if (f > p->vco_min && f <= p->vco_max)
break;
} while (i < ARRAY_SIZE(idx2s));
} while (i < 8);

if (i >= ARRAY_SIZE(idx2s))
if (i >= 8)
return vco;

vco.s = idx2s[i];
vco.s = p->idx2s[i];

/*
* Now find the closest divisor combination
Expand Down
18 changes: 11 additions & 7 deletions trunk/arch/arm/common/icst525.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,23 @@
/*
* Divisors for each OD setting.
*/
static unsigned char s2div[8] = { 10, 2, 8, 4, 5, 7, 9, 6 };
const unsigned char icst525_s2div[8] = { 10, 2, 8, 4, 5, 7, 9, 6 };

EXPORT_SYMBOL(icst525_s2div);

unsigned long icst525_hz(const struct icst_params *p, struct icst_vco vco)
{
return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * s2div[vco.s]);
return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * p->s2div[vco.s]);
}

EXPORT_SYMBOL(icst525_hz);

/*
* Ascending divisor S values.
*/
static unsigned char idx2s[] = { 1, 3, 4, 7, 5, 2, 6, 0 };
const unsigned char icst525_idx2s[8] = { 1, 3, 4, 7, 5, 2, 6, 0 };

EXPORT_SYMBOL(icst525_idx2s);

struct icst_vco
icst525_hz_to_vco(const struct icst_params *p, unsigned long freq)
Expand All @@ -45,20 +49,20 @@ icst525_hz_to_vco(const struct icst_params *p, unsigned long freq)
* that the PLL output is within spec.
*/
do {
f = freq * s2div[idx2s[i]];
f = freq * p->s2div[p->idx2s[i]];

/*
* f must be between 10MHz and
* 320MHz (5V) or 200MHz (3V)
*/
if (f > p->vco_min && f <= p->vco_max)
break;
} while (i < ARRAY_SIZE(idx2s));
} while (i < 8);

if (i >= ARRAY_SIZE(idx2s))
if (i >= 8)
return vco;

vco.s = idx2s[i];
vco.s = p->idx2s[i];

/*
* Now find the closest divisor combination
Expand Down
2 changes: 2 additions & 0 deletions trunk/arch/arm/include/asm/hardware/icst.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ struct icst_params {
unsigned short vd_max; /* inclusive */
unsigned char rd_min; /* inclusive */
unsigned char rd_max; /* inclusive */
const unsigned char *s2div; /* chip specific s2div array */
const unsigned char *idx2s; /* chip specific idx2s array */
};

struct icst_vco {
Expand Down
3 changes: 3 additions & 0 deletions trunk/arch/arm/include/asm/hardware/icst307.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,7 @@ struct icst_vco icst307_hz_to_vco(const struct icst_params *p, unsigned long fre
#define ICST307_VCO_MIN 6000000
#define ICST307_VCO_MAX 200000000

extern const unsigned char icst307_s2div[];
extern const unsigned char icst307_idx2s[];

#endif
3 changes: 3 additions & 0 deletions trunk/arch/arm/include/asm/hardware/icst525.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@ struct icst_vco icst525_hz_to_vco(const struct icst_params *p, unsigned long fre
#define ICST525_VCO_MAX_3V 200000000
#define ICST525_VCO_MAX_5V 320000000

extern const unsigned char icst525_s2div[];
extern const unsigned char icst525_idx2s[];

#endif
4 changes: 4 additions & 0 deletions trunk/arch/arm/mach-integrator/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ static const struct icst_params lclk_params = {
.vd_max = 132,
.rd_min = 24,
.rd_max = 24,
.s2div = icst525_s2div,
.idx2s = icst525_idx2s,
};

static const struct icst_params cclk_params = {
Expand All @@ -49,6 +51,8 @@ static const struct icst_params cclk_params = {
.vd_max = 160,
.rd_min = 24,
.rd_max = 24,
.s2div = icst525_s2div,
.idx2s = icst525_idx2s,
};

/*
Expand Down
2 changes: 2 additions & 0 deletions trunk/arch/arm/mach-integrator/impd1.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ static const struct icst_params impd1_vco_params = {
.vd_max = 519,
.rd_min = 3,
.rd_max = 120,
.s2div = icst525_s2div,
.idx2s = icst525_idx2s,
};

static void impd1_setvco(struct clk *clk, struct icst_vco vco)
Expand Down
2 changes: 2 additions & 0 deletions trunk/arch/arm/mach-integrator/integrator_cp.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ static const struct icst_params cp_auxvco_params = {
.vd_max = 263,
.rd_min = 3,
.rd_max = 65,
.s2div = icst525_s2div,
.idx2s = icst525_idx2s,
};

static void cp_auxvco_set(struct clk *clk, struct icst_vco vco)
Expand Down
2 changes: 2 additions & 0 deletions trunk/arch/arm/mach-realview/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ static const struct icst_params realview_oscvco_params = {
.vd_max = 511 + 8,
.rd_min = 1 + 2,
.rd_max = 127 + 2,
.s2div = icst307_s2div,
.idx2s = icst307_idx2s,
};

static void realview_oscvco_set(struct clk *clk, struct icst_vco vco)
Expand Down
2 changes: 2 additions & 0 deletions trunk/arch/arm/mach-versatile/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,8 @@ static const struct icst_params versatile_oscvco_params = {
.vd_max = 511 + 8,
.rd_min = 1 + 2,
.rd_max = 127 + 2,
.s2div = icst307_s2div,
.idx2s = icst307_idx2s,
};

static void versatile_oscvco_set(struct clk *clk, struct icst_vco vco)
Expand Down

0 comments on commit 5ba55a7

Please sign in to comment.