public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Peter Korsgaard <jacmet@sunsite•dk>
To: galak@kernel•crashing.org, linuxppc-dev@ozlabs•org
Subject: [PATCH] fsl_spi_init: Support non-QE processors
Date: Wed, 03 Oct 2007 17:43:50 +0200	[thread overview]
Message-ID: <87lkakxky1.fsf@macbook.be.48ers.dk> (raw)

On non-QE processors (mpc831x/mpc834x) the SPI clock is the SoC clock.

Signed-off-by: Peter Korsgaard <jacmet@sunsite•dk>
---
 arch/powerpc/sysdev/fsl_soc.c |   27 +++++++++++++++++++--------
 1 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index a57fe56..59e4188 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -1220,14 +1220,17 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,
 {
 	struct device_node *np;
 	unsigned int i;
-	const u32 *sysclk;
+	const u32 *qe_sysclk = 0, *soc_sysclk = 0;
 
 	np = of_find_node_by_type(NULL, "qe");
-	if (!np)
-		return -ENODEV;
+	if (np)
+		qe_sysclk = of_get_property(np, "bus-frequency", NULL);
+
+	np = of_find_node_by_type(NULL, "soc");
+	if (np)
+		soc_sysclk = of_get_property(np, "bus-frequency", NULL);
 
-	sysclk = of_get_property(np, "bus-frequency", NULL);
-	if (!sysclk)
+	if (!(qe_sysclk || soc_sysclk))
 		return -ENODEV;
 
 	for (np = NULL, i = 1;
@@ -1245,16 +1248,24 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,
 
 		memset(res, 0, sizeof(res));
 
-		pdata.sysclk = *sysclk;
-
 		prop = of_get_property(np, "reg", NULL);
 		if (!prop)
 			goto err;
 		pdata.bus_num = *(u32 *)prop;
 
 		prop = of_get_property(np, "mode", NULL);
-		if (prop && !strcmp(prop, "qe"))
+		if (prop && !strcmp(prop, "qe")) {
 			pdata.qe_mode = 1;
+			if (qe_sysclk)
+				pdata.sysclk = *qe_sysclk;
+			else
+				goto err;
+		} else {
+			if (soc_sysclk)
+				pdata.sysclk = *soc_sysclk;
+			else
+				goto err;
+		}
 
 		for (j = 0; j < num_board_infos; j++) {
 			if (board_infos[j].bus_num == pdata.bus_num)
-- 
1.5.3.2


-- 
Bye, Peter Korsgaard

             reply	other threads:[~2007-10-03 15:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-03 15:43 Peter Korsgaard [this message]
2007-10-03 15:56 ` [PATCH] fsl_spi_init: Support non-QE processors Grant Likely
2007-10-03 16:04   ` Peter Korsgaard
2007-10-03 18:17     ` Grant Likely
2007-10-03 22:11       ` Kumar Gala
2007-10-04  4:01 ` Stephen Rothwell
2007-10-05 14:11   ` Kumar Gala
2007-10-06 20:06     ` Peter Korsgaard
2007-10-08 14:09       ` 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=87lkakxky1.fsf@macbook.be.48ers.dk \
    --to=jacmet@sunsite$(echo .)dk \
    --cc=galak@kernel$(echo .)crashing.org \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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