mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Alexander Shiyan <shc_work@mail.ru>
To: barebox@lists.infradead.org
Subject: [PATCH] i.MX clko: Checking for clko-line properly
Date: Mon, 25 Jun 2012 12:54:58 +0400	[thread overview]
Message-ID: <1340614498-8596-1-git-send-email-shc_work@mail.ru> (raw)
In-Reply-To: <20120625072641.GB24458@pengutronix.de>

This patch adds a check for the correct number of CLKO-line.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 arch/arm/mach-imx/clko.c        |    6 ++++--
 arch/arm/mach-imx/speed-imx21.c |    3 ++-
 arch/arm/mach-imx/speed-imx25.c |    3 ++-
 arch/arm/mach-imx/speed-imx27.c |    3 ++-
 arch/arm/mach-imx/speed-imx35.c |    3 ++-
 arch/arm/mach-imx/speed-imx51.c |    3 ++-
 6 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-imx/clko.c b/arch/arm/mach-imx/clko.c
index 4c5df71..aeafaa9 100644
--- a/arch/arm/mach-imx/clko.c
+++ b/arch/arm/mach-imx/clko.c
@@ -35,8 +35,10 @@ static int do_clko(int argc, char *argv[])
 
 	if (div != 0) {
 		ret = imx_clko_set_div(num, div);
-		if (ret != div)
-			printf("limited divider to %d\n", ret);
+		if (ret < 0)
+			printf("CLKO-line %i not supported.\n", num);
+		else if (ret != div)
+			printf("Divider limited to %d.\n", ret);
 	}
 
 	return 0;
diff --git a/arch/arm/mach-imx/speed-imx21.c b/arch/arm/mach-imx/speed-imx21.c
index 6b44efa..4729583 100644
--- a/arch/arm/mach-imx/speed-imx21.c
+++ b/arch/arm/mach-imx/speed-imx21.c
@@ -16,6 +16,7 @@
  */
 
 #include <common.h>
+#include <asm-generic/errno.h>
 #include <mach/imx-regs.h>
 #include <mach/generic.h>
 #include <mach/clock.h>
@@ -167,7 +168,7 @@ int imx_clko_set_div(int num, int div)
 	ulong pcdr;
 
 	if (num != 1)
-		return;
+		return -ENODEV;
 
 	div--;
 	div &= 0x7;
diff --git a/arch/arm/mach-imx/speed-imx25.c b/arch/arm/mach-imx/speed-imx25.c
index b5c9822..ed14113 100644
--- a/arch/arm/mach-imx/speed-imx25.c
+++ b/arch/arm/mach-imx/speed-imx25.c
@@ -1,4 +1,5 @@
 #include <common.h>
+#include <asm-generic/errno.h>
 #include <mach/imx-regs.h>
 #include <io.h>
 #include <mach/clock.h>
@@ -116,7 +117,7 @@ int imx_clko_set_div(int num, int div)
 	unsigned long mcr = readl(IMX_CCM_BASE + 0x64);
 
 	if (num != 1)
-		return;
+		return -ENODEV;
 
 	div -= 1;
 	div &= 0x3f;
diff --git a/arch/arm/mach-imx/speed-imx27.c b/arch/arm/mach-imx/speed-imx27.c
index 6c66344..644fd04 100644
--- a/arch/arm/mach-imx/speed-imx27.c
+++ b/arch/arm/mach-imx/speed-imx27.c
@@ -16,6 +16,7 @@
  */
 
 #include <common.h>
+#include <asm-generic/errno.h>
 #include <mach/imx-regs.h>
 #include <mach/generic.h>
 #include <mach/clock.h>
@@ -194,7 +195,7 @@ int imx_clko_set_div(int num, int div)
 	ulong pcdr;
 
 	if (num != 1)
-		return;
+		return -ENODEV;
 
 	div--;
 	div &= 0x7;
diff --git a/arch/arm/mach-imx/speed-imx35.c b/arch/arm/mach-imx/speed-imx35.c
index 28cd1b1..2b707aa 100644
--- a/arch/arm/mach-imx/speed-imx35.c
+++ b/arch/arm/mach-imx/speed-imx35.c
@@ -16,6 +16,7 @@
  */
 
 #include <common.h>
+#include <asm-generic/errno.h>
 #include <mach/imx-regs.h>
 #include <io.h>
 #include <mach/clock.h>
@@ -208,7 +209,7 @@ int imx_clko_set_div(int num, int div)
 	unsigned long cosr = readl(IMX_CCM_BASE + CCM_COSR);
 
 	if (num != 1)
-		return;
+		return -ENODEV;
 
 	div -= 1;
 	div &= 0x3f;
diff --git a/arch/arm/mach-imx/speed-imx51.c b/arch/arm/mach-imx/speed-imx51.c
index f716346..63d4932 100644
--- a/arch/arm/mach-imx/speed-imx51.c
+++ b/arch/arm/mach-imx/speed-imx51.c
@@ -1,6 +1,7 @@
 #include <common.h>
 #include <io.h>
 #include <asm-generic/div64.h>
+#include <asm-generic/errno.h>
 #include <mach/imx51-regs.h>
 #include <mach/clock-imx51_53.h>
 
@@ -251,7 +252,7 @@ int imx_clko_set_div(int num, int div)
 		ccm_writel(ccosr, MX5_CCM_CCOSR);
 		break;
 	default:
-		break;
+		return -ENODEV;
 	}
 
 	return div + 1;
-- 
1.7.3.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2012-06-25  8:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-07 13:00 [PATCH 1/3] I.MX clko: Using strtol function instead strtoul for getting argument for clko source Alexander Shiyan
2012-06-07 13:00 ` [PATCH 2/3] i.MX clko: Added support for more than one CLKO outputs Alexander Shiyan
2012-06-25  7:26   ` Sascha Hauer
2012-06-25  8:54     ` Alexander Shiyan [this message]
2012-06-25 12:21       ` [PATCH] i.MX clko: Checking for clko-line properly Sascha Hauer
2012-06-07 13:00 ` [PATCH 3/3] i.MX51: Added support for "clko" command Alexander Shiyan
2012-06-07 17:35 ` [PATCH 1/3] I.MX clko: Using strtol function instead strtoul for getting argument for clko source Sascha Hauer
2012-06-08  6:29   ` Alexander Shiyan
2012-06-08  6:35     ` Sascha Hauer

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=1340614498-8596-1-git-send-email-shc_work@mail.ru \
    --to=shc_work@mail.ru \
    --cc=barebox@lists.infradead.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