mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Bo Shen <voice.shen@atmel.com>
To: s.hauer@pengutronix.de
Cc: barebox@lists.infradead.org
Subject: [PATCH 3/9] ARM: at91: clock: use cpu_has_pcr for pcr1 checking
Date: Wed, 17 Sep 2014 18:21:29 +0800	[thread overview]
Message-ID: <1410949295-30296-4-git-send-email-voice.shen@atmel.com> (raw)
In-Reply-To: <1410949295-30296-1-git-send-email-voice.shen@atmel.com>

Signed-off-by: Bo Shen <voice.shen@atmel.com>
---

 arch/arm/mach-at91/clock.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
index 9d2a846..50450f5 100644
--- a/arch/arm/mach-at91/clock.c
+++ b/arch/arm/mach-at91/clock.c
@@ -94,6 +94,8 @@
 				|| cpu_is_at91sam9n12() \
 				|| cpu_is_sama5d3())
 
+#define cpu_has_pcr()		(cpu_is_sama5d3())
+
 static LIST_HEAD(clocks);
 
 static u32 at91_pllb_usb_init;
@@ -221,7 +223,7 @@ static void pmc_periph_mode(struct clk *clk, int is_on)
 	 * register is not enough to manage their clocks. A peripheral
 	 * control register has been introduced to solve this issue.
 	 */
-	if (cpu_is_sama5d3()) {
+	if (cpu_has_pcr()) {
 		regval |= AT91_PMC_PCR_CMD; /* write command */
 		regval |= clk->pid & AT91_PMC_PCR_PID; /* peripheral selection */
 		regval |= AT91_PMC_PCR_DIV(clk->div);
@@ -455,7 +457,7 @@ int clk_register(struct clk *clk)
 	if (clk_is_peripheral(clk)) {
 		if (!clk->parent)
 			clk->parent = &mck;
-		if (cpu_is_sama5d3())
+		if (cpu_has_pcr())
 			clk->rate_hz = DIV_ROUND_UP(clk->parent->rate_hz, 1 << clk->div);
 		clk->mode = pmc_periph_mode;
 	}
@@ -787,7 +789,7 @@ static int at91_clock_reset(void)
 			continue;
 
 		if (clk->mode == pmc_periph_mode) {
-			if (cpu_is_sama5d3()) {
+			if (cpu_has_pcr()) {
 				u32 pmc_mask = 1 << (clk->pid % 32);
 
 				if (clk->pid > 31)
@@ -805,7 +807,7 @@ static int at91_clock_reset(void)
 	}
 
 	at91_pmc_write(AT91_PMC_PCDR, pcdr);
-	if (cpu_is_sama5d3())
+	if (cpu_has_pcr())
 		at91_pmc_write(AT91_PMC_PCDR1, pcdr1);
 	at91_pmc_write(AT91_PMC_SCDR, scdr);
 
@@ -821,12 +823,12 @@ static int do_at91clk(int argc, char *argv[])
 
 	scsr = at91_pmc_read(AT91_PMC_SCSR);
 	pcsr = at91_pmc_read(AT91_PMC_PCSR);
-	if (cpu_is_sama5d3())
+	if (cpu_has_pcr())
 		pcsr1 = at91_pmc_read(AT91_PMC_PCSR1);
 	sr = at91_pmc_read(AT91_PMC_SR);
 	printf("SCSR = %8x\n", scsr);
 	printf("PCSR = %8x\n", pcsr);
-	if (cpu_is_sama5d3())
+	if (cpu_has_pcr())
 		printf("PCSR1 = %8x\n", pcsr1);
 	printf("MOR  = %8x\n", at91_pmc_read(AT91_CKGR_MOR));
 	printf("MCFR = %8x\n", at91_pmc_read(AT91_CKGR_MCFR));
@@ -852,7 +854,7 @@ static int do_at91clk(int argc, char *argv[])
 			state = (scsr & clk->pmc_mask) ? "on" : "off";
 			mode = "sys";
 		} else if (clk->mode == pmc_periph_mode) {
-			if (cpu_is_sama5d3()) {
+			if (cpu_has_pcr()) {
 				u32 pmc_mask = 1 << (clk->pid % 32);
 
 				if (clk->pid > 31)
-- 
2.1.0.24.g4109c28


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

  parent reply	other threads:[~2014-09-17 10:22 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-17 10:21 [PATCH 0/9] ARM: at91: add sama5d4ek board support Bo Shen
2014-09-17 10:21 ` [PATCH 1/9] ARM: at91: move pmc base address into soc header Bo Shen
2014-09-17 10:21 ` [PATCH 2/9] ARM: atmel: sama5d3 is a family member of sama5 Bo Shen
2014-09-17 10:21 ` Bo Shen [this message]
2014-09-17 10:21 ` [PATCH 4/9] nand: atmel: runtime to generate galois table Bo Shen
2014-09-17 10:21 ` [PATCH 5/9] net: macb: using default value for FBLDO Bo Shen
2014-09-22  4:59   ` Sascha Hauer
2014-09-22  5:08     ` Bo Shen
2014-09-17 10:21 ` [PATCH 6/9] mci: atmel: add new ip version 0x600 support Bo Shen
2014-09-17 10:21 ` [PATCH 7/9] ARM: at91: add sama5d4 soc support #1 Bo Shen
2014-09-18  6:10   ` Sascha Hauer
2014-09-23  3:02     ` Bo Shen
2014-09-23  7:54       ` Sascha Hauer
2014-09-17 10:21 ` [PATCH 8/9] ARM: at91: add sama5d4 soc support #2 Bo Shen
2014-09-13 20:12   ` Raphaël Poggi
2014-09-18  1:43     ` Bo Shen
2014-09-17 10:21 ` [PATCH 9/9] ARM: at91: add sama5d4ek board support Bo Shen
2014-09-22  5:02 ` [PATCH 0/9] " 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=1410949295-30296-4-git-send-email-voice.shen@atmel.com \
    --to=voice.shen@atmel.com \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /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