diff options
author | Timur Tabi <timur@freescale.com> | 2007-12-03 16:17:58 -0500 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2007-12-13 23:59:27 -0500 |
commit | 174b0da23199c4ae1ed06263dafd9a2e85e97d34 (patch) | |
tree | ef7e30bbc2b22269e46a08ab17823e5d43e6974f | |
parent | 255b09eb26bc285be5aad5c5606e96093094c41a (diff) |
[POWERPC] qe: add function qe_clock_source()
Add function qe_clock_source() which takes a string containing the name of a
QE clock source (as is typically found in device trees) and returns the
matching enum qe_clock value.
Update booting-without-of.txt to indicate that the UCC properties rx-clock
and tx-clock are deprecated and replaced with rx-clock-name and tx-clock-name,
which use strings instead of numbers to indicate QE clock sources.
Signed-off-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
-rw-r--r-- | Documentation/powerpc/booting-without-of.txt | 13 | ||||
-rw-r--r-- | arch/powerpc/sysdev/qe_lib/qe.c | 32 | ||||
-rw-r--r-- | include/asm-powerpc/qe.h | 1 |
3 files changed, 46 insertions, 0 deletions
diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt index c3fc9d955030..ee0209a7de3e 100644 --- a/Documentation/powerpc/booting-without-of.txt +++ b/Documentation/powerpc/booting-without-of.txt | |||
@@ -1629,6 +1629,19 @@ platforms are moved over to use the flattened-device-tree model. | |||
1629 | - interrupt-parent : the phandle for the interrupt controller that | 1629 | - interrupt-parent : the phandle for the interrupt controller that |
1630 | services interrupts for this device. | 1630 | services interrupts for this device. |
1631 | - pio-handle : The phandle for the Parallel I/O port configuration. | 1631 | - pio-handle : The phandle for the Parallel I/O port configuration. |
1632 | - rx-clock-name: the UCC receive clock source | ||
1633 | "none": clock source is disabled | ||
1634 | "brg1" through "brg16": clock source is BRG1-BRG16, respectively | ||
1635 | "clk1" through "clk24": clock source is CLK1-CLK24, respectively | ||
1636 | - tx-clock-name: the UCC transmit clock source | ||
1637 | "none": clock source is disabled | ||
1638 | "brg1" through "brg16": clock source is BRG1-BRG16, respectively | ||
1639 | "clk1" through "clk24": clock source is CLK1-CLK24, respectively | ||
1640 | The following two properties are deprecated. rx-clock has been replaced | ||
1641 | with rx-clock-name, and tx-clock has been replaced with tx-clock-name. | ||
1642 | Drivers that currently use the deprecated properties should continue to | ||
1643 | do so, in order to support older device trees, but they should be updated | ||
1644 | to check for the new properties first. | ||
1632 | - rx-clock : represents the UCC receive clock source. | 1645 | - rx-clock : represents the UCC receive clock source. |
1633 | 0x00 : clock source is disabled; | 1646 | 0x00 : clock source is disabled; |
1634 | 0x1~0x10 : clock source is BRG1~BRG16 respectively; | 1647 | 0x1~0x10 : clock source is BRG1~BRG16 respectively; |
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c index 1df3b4a6832f..21e01061aca9 100644 --- a/arch/powerpc/sysdev/qe_lib/qe.c +++ b/arch/powerpc/sysdev/qe_lib/qe.c | |||
@@ -203,6 +203,38 @@ int qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int multiplier) | |||
203 | } | 203 | } |
204 | EXPORT_SYMBOL(qe_setbrg); | 204 | EXPORT_SYMBOL(qe_setbrg); |
205 | 205 | ||
206 | /* Convert a string to a QE clock source enum | ||
207 | * | ||
208 | * This function takes a string, typically from a property in the device | ||
209 | * tree, and returns the corresponding "enum qe_clock" value. | ||
210 | */ | ||
211 | enum qe_clock qe_clock_source(const char *source) | ||
212 | { | ||
213 | unsigned int i; | ||
214 | |||
215 | if (strcasecmp(source, "none") == 0) | ||
216 | return QE_CLK_NONE; | ||
217 | |||
218 | if (strncasecmp(source, "brg", 3) == 0) { | ||
219 | i = simple_strtoul(source + 3, NULL, 10); | ||
220 | if ((i >= 1) && (i <= 16)) | ||
221 | return (QE_BRG1 - 1) + i; | ||
222 | else | ||
223 | return QE_CLK_DUMMY; | ||
224 | } | ||
225 | |||
226 | if (strncasecmp(source, "clk", 3) == 0) { | ||
227 | i = simple_strtoul(source + 3, NULL, 10); | ||
228 | if ((i >= 1) && (i <= 24)) | ||
229 | return (QE_CLK1 - 1) + i; | ||
230 | else | ||
231 | return QE_CLK_DUMMY; | ||
232 | } | ||
233 | |||
234 | return QE_CLK_DUMMY; | ||
235 | } | ||
236 | EXPORT_SYMBOL(qe_clock_source); | ||
237 | |||
206 | /* Initialize SNUMs (thread serial numbers) according to | 238 | /* Initialize SNUMs (thread serial numbers) according to |
207 | * QE Module Control chapter, SNUM table | 239 | * QE Module Control chapter, SNUM table |
208 | */ | 240 | */ |
diff --git a/include/asm-powerpc/qe.h b/include/asm-powerpc/qe.h index bcf60bef6524..a24b7b14958f 100644 --- a/include/asm-powerpc/qe.h +++ b/include/asm-powerpc/qe.h | |||
@@ -84,6 +84,7 @@ extern int par_io_data_set(u8 port, u8 pin, u8 val); | |||
84 | 84 | ||
85 | /* QE internal API */ | 85 | /* QE internal API */ |
86 | int qe_issue_cmd(u32 cmd, u32 device, u8 mcn_protocol, u32 cmd_input); | 86 | int qe_issue_cmd(u32 cmd, u32 device, u8 mcn_protocol, u32 cmd_input); |
87 | enum qe_clock qe_clock_source(const char *source); | ||
87 | int qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int multiplier); | 88 | int qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int multiplier); |
88 | int qe_get_snum(void); | 89 | int qe_get_snum(void); |
89 | void qe_put_snum(u8 snum); | 90 | void qe_put_snum(u8 snum); |