From: Haiying Wang <Haiying.Wang@freescale.com>
To: linuxppc-dev@ozlabs.org, galak@kernel.crashing.org
Cc: Haiying Wang <Haiying.Wang@freescale.com>
Subject: [PATCH 2/6] powerpc/qe: update risc allocation for QE
Date: Wed, 29 Apr 2009 14:14:34 -0400 [thread overview]
Message-ID: <12410288792524-git-send-email-Haiying.Wang@freescale.com> (raw)
In-Reply-To: <1241028878175-git-send-email-Haiying.Wang@freescale.com>
Change the RISC allocation to macros instead of enum, add function to read the
number of risc engines from the new property "num-riscs" under qe node in dts.
Add new property "num-riscs" description in qe.txt
Signed-off-by: Haiying Wang <Haiying.Wang@freescale.com>
---
.../powerpc/dts-bindings/fsl/cpm_qe/qe.txt | 1 +
arch/powerpc/include/asm/qe.h | 18 ++++++++----
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 78790d5..b6ea613 100644
--- a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe.txt
+++ b/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe.txt
@@ -21,6 +21,7 @@ Required properties:
Recommended properties
- brg-frequency : the internal clock source frequency for baud-rate
generators in Hz.
+- num-riscs: define how many RISC engines the QE has.
Example:
qe@e0100000 {
diff --git a/arch/powerpc/include/asm/qe.h b/arch/powerpc/include/asm/qe.h
index 2701753..60314ef 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);
int qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int multiplier);
int qe_get_snum(void);
void qe_put_snum(u8 snum);
+unsigned int qe_get_num_of_risc(void);
+
/* we actually use cpm_muram implementation, define this for convenience */
#define qe_muram_init cpm_muram_init
#define qe_muram_alloc cpm_muram_alloc
@@ -231,12 +233,16 @@ struct qe_bd {
#define QE_ALIGNMENT_OF_PRAM 64
/* RISC allocation */
-enum qe_risc_allocation {
- QE_RISC_ALLOCATION_RISC1 = 1, /* RISC 1 */
- QE_RISC_ALLOCATION_RISC2 = 2, /* RISC 2 */
- QE_RISC_ALLOCATION_RISC1_AND_RISC2 = 3 /* Dynamically choose
- RISC 1 or RISC 2 */
-};
+#define QE_RISC_ALLOCATION_RISC1 0x1 /* RISC 1 */
+#define QE_RISC_ALLOCATION_RISC2 0x2 /* RISC 2 */
+#define QE_RISC_ALLOCATION_RISC3 0x4 /* RISC 3 */
+#define QE_RISC_ALLOCATION_RISC4 0x8 /* RISC 4 */
+#define QE_RISC_ALLOCATION_RISC1_AND_RISC2 (QE_RISC_ALLOCATION_RISC1 | \
+ QE_RISC_ALLOCATION_RISC2)
+#define QE_RISC_ALLOCATION_FOUR_RISCS (QE_RISC_ALLOCATION_RISC1 | \
+ QE_RISC_ALLOCATION_RISC2 | \
+ QE_RISC_ALLOCATION_RISC3 | \
+ QE_RISC_ALLOCATION_RISC4)
/* QE extended filtering Table Lookup Key Size */
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 01bce37..31a3bb1 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)
}
EXPORT_SYMBOL(qe_get_firmware_info);
+unsigned int qe_get_num_of_risc(void)
+{
+ struct device_node *qe;
+ int size;
+ unsigned int num_of_risc = 0;
+ const u32 *prop;
+
+ qe = of_find_compatible_node(NULL, NULL, "fsl,qe");
+ if (!qe) {
+ /* Older devices trees did not have an "fsl,qe"
+ * compatible property, so we need to look for
+ * the QE node by name.
+ */
+ qe = of_find_node_by_type(NULL, "qe");
+ if (!qe)
+ return num_of_risc;
+ }
+
+ prop = of_get_property(qe, "num-riscs", &size);
+ if (prop && size == sizeof(*prop))
+ num_of_risc = *prop;
+
+ of_node_put(qe);
+
+ return num_of_risc;
+}
+EXPORT_SYMBOL(qe_get_num_of_risc);
+
--
1.6.0.2
next prev parent reply other threads:[~2009-04-29 18:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-29 18:14 [PATCH 1/6] powerpc/85xx: clean up for mpc8568_mds name Haiying Wang
2009-04-29 18:14 ` Haiying Wang [this message]
2009-04-29 18:14 ` [PATCH 3/6] net/ucc_geth: update riscTx and riscRx in ucc_geth Haiying Wang
2009-04-29 18:14 ` [PATCH 4/6] powerpc/qe: update QE Serial Number Haiying Wang
2009-04-29 18:14 ` [PATCH 5/6] net/ucc_geth: Assign six threads to Rx for UEC Haiying Wang
2009-04-29 18:14 ` [PATCH 6/6] powerpc/85xx: Add MPC8569MDS board support Haiying Wang
2009-04-29 20:25 ` [PATCH 5/6] net/ucc_geth: Assign six threads to Rx for UEC Kumar Gala
2009-04-30 4:35 ` [PATCH 4/6] powerpc/qe: update QE Serial Number Kumar Gala
2009-04-29 20:23 ` [PATCH 3/6] net/ucc_geth: update riscTx and riscRx in ucc_geth Kumar Gala
2009-04-29 21:51 ` David Miller
2009-04-30 4:34 ` [PATCH 2/6] powerpc/qe: update risc allocation for QE Kumar Gala
2009-04-30 11:48 ` Kumar Gala
2009-04-30 11:37 ` [PATCH 1/6] powerpc/85xx: clean up for mpc8568_mds name Kumar Gala
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=12410288792524-git-send-email-Haiying.Wang@freescale.com \
--to=haiying.wang@freescale.com \
--cc=galak@kernel.crashing.org \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).