diff options
author | Timur Tabi <timur@freescale.com> | 2007-11-29 18:26:30 -0500 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2007-12-11 14:57:18 -0500 |
commit | 7264ec4454e3a18d06a8949ecbe9e1b55e4f4685 (patch) | |
tree | 3e9c4f86cfa5143ecab5634958d557a731733277 /arch/powerpc/sysdev/qe_lib | |
parent | c5eeb5599938acb9cda8ff1ef846a26cf70d46e0 (diff) |
[POWERPC] QE: change qe_setbrg() to take an enum qe_clock instead of an integer
qe_setbrg() currently takes an integer to indicate the BRG number. Change that
to take an enum qe_clock instead, since this enum is intended to represent
clock sources.
Signed-off-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/sysdev/qe_lib')
-rw-r--r-- | arch/powerpc/sysdev/qe_lib/qe.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c index 3d57d3835b04..1df3b4a6832f 100644 --- a/arch/powerpc/sysdev/qe_lib/qe.c +++ b/arch/powerpc/sysdev/qe_lib/qe.c | |||
@@ -167,19 +167,20 @@ unsigned int get_brg_clk(void) | |||
167 | 167 | ||
168 | /* Program the BRG to the given sampling rate and multiplier | 168 | /* Program the BRG to the given sampling rate and multiplier |
169 | * | 169 | * |
170 | * @brg: the BRG, 1-16 | 170 | * @brg: the BRG, QE_BRG1 - QE_BRG16 |
171 | * @rate: the desired sampling rate | 171 | * @rate: the desired sampling rate |
172 | * @multiplier: corresponds to the value programmed in GUMR_L[RDCR] or | 172 | * @multiplier: corresponds to the value programmed in GUMR_L[RDCR] or |
173 | * GUMR_L[TDCR]. E.g., if this BRG is the RX clock, and GUMR_L[RDCR]=01, | 173 | * GUMR_L[TDCR]. E.g., if this BRG is the RX clock, and GUMR_L[RDCR]=01, |
174 | * then 'multiplier' should be 8. | 174 | * then 'multiplier' should be 8. |
175 | * | ||
176 | * Also note that the value programmed into the BRGC register must be even. | ||
177 | */ | 175 | */ |
178 | void qe_setbrg(unsigned int brg, unsigned int rate, unsigned int multiplier) | 176 | int qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int multiplier) |
179 | { | 177 | { |
180 | u32 divisor, tempval; | 178 | u32 divisor, tempval; |
181 | u32 div16 = 0; | 179 | u32 div16 = 0; |
182 | 180 | ||
181 | if ((brg < QE_BRG1) || (brg > QE_BRG16)) | ||
182 | return -EINVAL; | ||
183 | |||
183 | divisor = get_brg_clk() / (rate * multiplier); | 184 | divisor = get_brg_clk() / (rate * multiplier); |
184 | 185 | ||
185 | if (divisor > QE_BRGC_DIVISOR_MAX + 1) { | 186 | if (divisor > QE_BRGC_DIVISOR_MAX + 1) { |
@@ -196,8 +197,11 @@ void qe_setbrg(unsigned int brg, unsigned int rate, unsigned int multiplier) | |||
196 | tempval = ((divisor - 1) << QE_BRGC_DIVISOR_SHIFT) | | 197 | tempval = ((divisor - 1) << QE_BRGC_DIVISOR_SHIFT) | |
197 | QE_BRGC_ENABLE | div16; | 198 | QE_BRGC_ENABLE | div16; |
198 | 199 | ||
199 | out_be32(&qe_immr->brg.brgc[brg - 1], tempval); | 200 | out_be32(&qe_immr->brg.brgc[brg - QE_BRG1], tempval); |
201 | |||
202 | return 0; | ||
200 | } | 203 | } |
204 | EXPORT_SYMBOL(qe_setbrg); | ||
201 | 205 | ||
202 | /* Initialize SNUMs (thread serial numbers) according to | 206 | /* Initialize SNUMs (thread serial numbers) according to |
203 | * QE Module Control chapter, SNUM table | 207 | * QE Module Control chapter, SNUM table |