diff options
author | Haiying Wang <Haiying.Wang@freescale.com> | 2009-05-01 15:40:47 -0400 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2009-05-19 01:50:22 -0400 |
commit | 06c4435021f4856261edd01e2691071edeb8fa51 (patch) | |
tree | 54e0a8be20b73d328df5aeae874e725ea7bbc80e | |
parent | ea5130dcb438840d64a168b67dd221e4d46246b8 (diff) |
powerpc/qe: update risc allocation for QE
Change the RISC allocation to macros instead of enum, add function to read
the number of risc engines from the new property "fsl,qe-num-riscs" under
the qe node in dts. Add new property "fsl,qe-num-riscs" description in
qe.txt
Signed-off-by: Haiying Wang <Haiying.Wang@freescale.com>
Acked-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
-rw-r--r-- | Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe.txt | 1 | ||||
-rw-r--r-- | arch/powerpc/include/asm/qe.h | 18 | ||||
-rw-r--r-- | arch/powerpc/sysdev/qe_lib/qe.c | 28 |
3 files changed, 41 insertions, 6 deletions
diff --git a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe.txt b/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe.txt index 78790d58dc2c..39b5d1f0bbe0 100644 --- a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe.txt +++ b/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe.txt | |||
@@ -17,6 +17,7 @@ Required properties: | |||
17 | - model : precise model of the QE, Can be "QE", "CPM", or "CPM2" | 17 | - model : precise model of the QE, Can be "QE", "CPM", or "CPM2" |
18 | - reg : offset and length of the device registers. | 18 | - reg : offset and length of the device registers. |
19 | - bus-frequency : the clock frequency for QUICC Engine. | 19 | - bus-frequency : the clock frequency for QUICC Engine. |
20 | - fsl,qe-num-riscs: define how many RISC engines the QE has. | ||
20 | 21 | ||
21 | Recommended properties | 22 | Recommended properties |
22 | - brg-frequency : the internal clock source frequency for baud-rate | 23 | - brg-frequency : the internal clock source frequency for baud-rate |
diff --git a/arch/powerpc/include/asm/qe.h b/arch/powerpc/include/asm/qe.h index 2701753d9937..60314ef58d11 100644 --- a/arch/powerpc/include/asm/qe.h +++ b/arch/powerpc/include/asm/qe.h | |||
@@ -152,6 +152,8 @@ unsigned int qe_get_brg_clk(void); | |||
152 | int qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int multiplier); | 152 | int qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int multiplier); |
153 | int qe_get_snum(void); | 153 | int qe_get_snum(void); |
154 | void qe_put_snum(u8 snum); | 154 | void qe_put_snum(u8 snum); |
155 | unsigned int qe_get_num_of_risc(void); | ||
156 | |||
155 | /* we actually use cpm_muram implementation, define this for convenience */ | 157 | /* we actually use cpm_muram implementation, define this for convenience */ |
156 | #define qe_muram_init cpm_muram_init | 158 | #define qe_muram_init cpm_muram_init |
157 | #define qe_muram_alloc cpm_muram_alloc | 159 | #define qe_muram_alloc cpm_muram_alloc |
@@ -231,12 +233,16 @@ struct qe_bd { | |||
231 | #define QE_ALIGNMENT_OF_PRAM 64 | 233 | #define QE_ALIGNMENT_OF_PRAM 64 |
232 | 234 | ||
233 | /* RISC allocation */ | 235 | /* RISC allocation */ |
234 | enum qe_risc_allocation { | 236 | #define QE_RISC_ALLOCATION_RISC1 0x1 /* RISC 1 */ |
235 | QE_RISC_ALLOCATION_RISC1 = 1, /* RISC 1 */ | 237 | #define QE_RISC_ALLOCATION_RISC2 0x2 /* RISC 2 */ |
236 | QE_RISC_ALLOCATION_RISC2 = 2, /* RISC 2 */ | 238 | #define QE_RISC_ALLOCATION_RISC3 0x4 /* RISC 3 */ |
237 | QE_RISC_ALLOCATION_RISC1_AND_RISC2 = 3 /* Dynamically choose | 239 | #define QE_RISC_ALLOCATION_RISC4 0x8 /* RISC 4 */ |
238 | RISC 1 or RISC 2 */ | 240 | #define QE_RISC_ALLOCATION_RISC1_AND_RISC2 (QE_RISC_ALLOCATION_RISC1 | \ |
239 | }; | 241 | QE_RISC_ALLOCATION_RISC2) |
242 | #define QE_RISC_ALLOCATION_FOUR_RISCS (QE_RISC_ALLOCATION_RISC1 | \ | ||
243 | QE_RISC_ALLOCATION_RISC2 | \ | ||
244 | QE_RISC_ALLOCATION_RISC3 | \ | ||
245 | QE_RISC_ALLOCATION_RISC4) | ||
240 | 246 | ||
241 | /* QE extended filtering Table Lookup Key Size */ | 247 | /* QE extended filtering Table Lookup Key Size */ |
242 | enum qe_fltr_tbl_lookup_key_size { | 248 | enum qe_fltr_tbl_lookup_key_size { |
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c index 01bce3784b0a..2533677ae5eb 100644 --- a/arch/powerpc/sysdev/qe_lib/qe.c +++ b/arch/powerpc/sysdev/qe_lib/qe.c | |||
@@ -575,3 +575,31 @@ struct qe_firmware_info *qe_get_firmware_info(void) | |||
575 | } | 575 | } |
576 | EXPORT_SYMBOL(qe_get_firmware_info); | 576 | EXPORT_SYMBOL(qe_get_firmware_info); |
577 | 577 | ||
578 | unsigned int qe_get_num_of_risc(void) | ||
579 | { | ||
580 | struct device_node *qe; | ||
581 | int size; | ||
582 | unsigned int num_of_risc = 0; | ||
583 | const u32 *prop; | ||
584 | |||
585 | qe = of_find_compatible_node(NULL, NULL, "fsl,qe"); | ||
586 | if (!qe) { | ||
587 | /* Older devices trees did not have an "fsl,qe" | ||
588 | * compatible property, so we need to look for | ||
589 | * the QE node by name. | ||
590 | */ | ||
591 | qe = of_find_node_by_type(NULL, "qe"); | ||
592 | if (!qe) | ||
593 | return num_of_risc; | ||
594 | } | ||
595 | |||
596 | prop = of_get_property(qe, "fsl,qe-num-riscs", &size); | ||
597 | if (prop && size == sizeof(*prop)) | ||
598 | num_of_risc = *prop; | ||
599 | |||
600 | of_node_put(qe); | ||
601 | |||
602 | return num_of_risc; | ||
603 | } | ||
604 | EXPORT_SYMBOL(qe_get_num_of_risc); | ||
605 | |||