Skip to contentSkip to conversation

ARM: at91: add PMC_PLLICPR init function

PATCH Superseded Wenyou Yang 4 participants 9 messages Dec 9, 2015

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover ARM: at91: add PMC_PLLICPR init function

To reduce the duplicated code, add PLLICPR init function, use the function to clean up the PMC_PLLICPR directly writing code.

It is based on the following patch set.
[PATCH 0/5] ARM: at91: improve peripheral and system clock handle functions [PATCH 0/4] ARM: at91: add UTMI PLL handle functions
[PATCH 0/3] ARM: at91: add PLLB handle functions

Wenyou Yang (3):
ARM: at91: clock: add PMC_PLLICPR init function
ARM: at91: clean up the PMC_PLLICPR init code
board: atmel: clean up the PMC_PLLICPR init code

 arch/arm/mach-at91/armv7/clock.c                |    7 +++++++
 arch/arm/mach-at91/include/mach/at91_pmc.h      |    7 +++++++
 arch/arm/mach-at91/include/mach/clk.h           |    1 +
 arch/arm/mach-at91/spl_at91.c                   |    5 +----
 board/atmel/sama5d3_xplained/sama5d3_xplained.c |    4 +---
 board/atmel/sama5d3xek/sama5d3xek.c             |    4 +---
 board/atmel/sama5d4_xplained/sama5d4_xplained.c |    4 +---
 board/atmel/sama5d4ek/sama5d4ek.c               |    4 +---
 8 files changed, 20 insertions(+), 16 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/3 ARM: at91: clock: add PMC_PLLICPR init function

To avoid the duplicated code, add the PMC_PLLICPR init function.

---

 arch/arm/mach-at91/armv7/clock.c           |    7 +++++++
 arch/arm/mach-at91/include/mach/at91_pmc.h |    7 +++++++
 arch/arm/mach-at91/include/mach/clk.h      |    1 +
 3 files changed, 15 insertions(+)
arch/arm/mach-at91/armv7/clock.c +7 -0
index 81e9f69..b8143c5 100644
@@ -242,3 +242,10 @@ u32 at91_get_periph_generated_clk(u32 id)
 
 	return freq / div;
 }
+
+void at91_pllicpr_init(u32 icpr)
+{
+	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
+
+	writel(icpr, &pmc->pllicpr);
+}
arch/arm/mach-at91/include/mach/at91_pmc.h +7 -0
index eb40194..6955461 100644
@@ -246,4 +246,11 @@ typedef struct at91_pmc {
 #define		AT91_PMC_GCKRDY		(1 << 24)
 
 #define		AT91_PMC_PROTKEY	0x504d4301	/* Activation Code */
+
+/* PLL Charge Pump Current Register (PMC_PLLICPR) */
+#define AT91_PMC_ICP_PLLA(x)	(((x) & 0x3) << 0)	/* Charge Pump Current PLLA */
+#define AT91_PMC_IPLL_PLLA(x)	(((x) & 0x7) << 8)	/* Engineering Configuration PLLA */
+#define AT91_PMC_ICP_PLLU(x)	(((x) & 0x3) << 16)	/* Charge Pump Current PLL UTMI */
+#define AT91_PMC_IVCO_PLLU(x)	(((x) & 0x3) << 24)	/* Voltage Control Output Current PLL UTMI */
+
 #endif
arch/arm/mach-at91/include/mach/clk.h +1 -0
index 64dec52..8577c74 100644
@@ -135,5 +135,6 @@ int at91_upll_clk_disable(void);
 void at91_usb_clk_init(u32 value);
 int at91_pllb_clk_enable(u32 pllbr);
 int at91_pllb_clk_disable(void);
+void at91_pllicpr_init(u32 icpr);
 
 #endif /* __ASM_ARM_ARCH_CLK_H__ */
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 1/3 ARM: at91: clock: add PMC_PLLICPR init function

Hello Wenyou,

Am 09.12.2015 um 05:36 schrieb Wenyou Yang:

Quoted 9 lines

To avoid the duplicated code, add the PMC_PLLICPR init function.

---

  arch/arm/mach-at91/armv7/clock.c           |    7 +++++++
  arch/arm/mach-at91/include/mach/at91_pmc.h |    7 +++++++
  arch/arm/mach-at91/include/mach/clk.h      |    1 +
  3 files changed, 15 insertions(+)

Sorry for nitpicking, but I just try to applying patches from patchwork to u-boot source, compile it and test it automated with tbot [1] on the smartweb board [2]

This patch has also checkpatch errors:

2015-12-09 08:08:49,780:  wget http://patchwork.ozlabs.org/patch/554232/mbox
2015-12-09 08:08:49,781:  --2015-12-09 08:08:49--  http://patchwork.ozlabs.org/patch/554232/mbox
2015-12-09 08:08:49,781:  Resolving patchwork.ozlabs.org (patchwork.ozlabs.org)... 103.22.144.67, 
2401:3900:2:1::2
2015-12-09 08:08:50,095:  Connecting to patchwork.ozlabs.org 
(patchwork.ozlabs.org)|103.22.144.67|:80... connected.
2015-12-09 08:08:50,410:  HTTP request sent, awaiting response... 301 MOVED PERMANENTLY
2015-12-09 08:08:50,411:  Location: http://patchwork.ozlabs.org/patch/554232/mbox/ [following]
2015-12-09 08:08:50,411:  --2015-12-09 08:08:50--  http://patchwork.ozlabs.org/patch/554232/mbox/
2015-12-09 08:08:50,411:  Reusing existing connection to patchwork.ozlabs.org:80.
2015-12-09 08:08:50,726:  HTTP request sent, awaiting response... 200 OK
2015-12-09 08:08:50,726:  Length: unspecified [text/plain]
2015-12-09 08:08:50,726:  Saving to: ?mbox?
2015-12-09 08:08:50,726:
2015-12-09 08:08:50,726:
2015-12-09 08:08:50,726:  mbox                    [<=>                   ]       0  --.-KB/s
2015-12-09 08:08:50,726:  mbox                    [ <=>                  ]   2.34K  --.-KB/s   in 0.001s
2015-12-09 08:08:50,727:
2015-12-09 08:08:50,727:  2015-12-09 08:08:50 (2.66 MB/s) - ?mbox? saved [2397]
2015-12-09 08:08:50,727:
2015-12-09 08:08:50,727:  hs at pollux [ 8:08:50] ttbott >
2015-12-09 08:08:51,940:  if [ $? -ne 0 ]; then echo 'FAILED'; fi
2015-12-09 08:08:51,940:  hs at pollux [ 8:08:51] ttbott >
2015-12-09 08:08:53,037:  scripts/checkpatch.pl mbox
2015-12-09 08:08:53,151:  WARNING: line over 80 characters
2015-12-09 08:08:53,152:  #47: FILE: arch/arm/mach-at91/include/mach/at91_pmc.h:251:
2015-12-09 08:08:53,152:  +#define AT91_PMC_ICP_PLLA(x) (((x) & 0x3) << 0)      /* Charge Pump 
Current PLLA */
2015-12-09 08:08:53,152:
2015-12-09 08:08:53,152:  WARNING: line over 80 characters
2015-12-09 08:08:53,152:  #48: FILE: arch/arm/mach-at91/include/mach/at91_pmc.h:252:
2015-12-09 08:08:53,152:  +#define AT91_PMC_IPLL_PLLA(x)        (((x) & 0x7) << 8)      /* 
Engineering Configuration PLLA */
2015-12-09 08:08:53,152:
2015-12-09 08:08:53,152:  WARNING: line over 80 characters
2015-12-09 08:08:53,153:  #49: FILE: arch/arm/mach-at91/include/mach/at91_pmc.h:253:
2015-12-09 08:08:53,153:  +#define AT91_PMC_ICP_PLLU(x) (((x) & 0x3) << 16)     /* Charge Pump 
Current PLL UTMI */
2015-12-09 08:08:53,153:
2015-12-09 08:08:53,153:  WARNING: line over 80 characters
2015-12-09 08:08:53,153:  #50: FILE: arch/arm/mach-at91/include/mach/at91_pmc.h:254:
2015-12-09 08:08:53,153:  +#define AT91_PMC_IVCO_PLLU(x)        (((x) & 0x3) << 24)     /* Voltage 
Control Output Current PLL UTMI */
2015-12-09 08:08:53,153:
2015-12-09 08:08:53,153:  total: 0 errors, 4 warnings, 0 checks, 27 lines checked
2015-12-09 08:08:53,153:
2015-12-09 08:08:53,153:  NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX 
MULTISTATEMENT_MACRO_USE_DO_WHILE NETWORKING_BLOCK_COMMENT_STYLE USLEEP_RANGE
2015-12-09 08:08:53,153:
2015-12-09 08:08:53,154:  mbox has style problems, please review.
2015-12-09 08:08:53,154:
2015-12-09 08:08:53,154:  If any of these errors are false positives, please report
2015-12-09 08:08:53,154:  them to the maintainer, see CHECKPATCH in MAINTAINERS.
2015-12-09 08:08:53,154:  hs@pollux [ 8:08:53] ttbott >
2015-12-09 08:08:54,283:  if [ $? -ne 0 ]; then echo 'FAILED'; fi
2015-12-09 08:08:54,283:  FAILED
2015-12-09 08:08:54,284:  hs at pollux [ 8:08:54] ttbott >
2015-12-09 08:08:54,380:  hs at pollux [ 8:08:54] ttbott >cat mbox | grep Subject
2015-12-09 08:08:54,380:  ^[[01;31m^[[KSubject^[[m^[[K: [U-Boot,1/3] ARM: at91: clock: add 
PMC_PLLICPR init function
2015-12-09 08:08:54,381:  hs at pollux [ 8:08:54] ttbott >

bye,
Heiko
[1] https://github.com/hsdenx/tbot
[2] http://xeidos.ddns.net/buildbot/builders/smartweb_dfu

Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#3 lore raw

PATCH 1/3 ARM: at91: clock: add PMC_PLLICPR init function

Hi Heiko,

Quoted 90 lines · Heiko Schocher

Hello Wenyou,

Am 09.12.2015 um 05:36 schrieb Wenyou Yang:

Quoted 9 lines

To avoid the duplicated code, add the PMC_PLLICPR init function.

---

  arch/arm/mach-at91/armv7/clock.c           |    7 +++++++
  arch/arm/mach-at91/include/mach/at91_pmc.h |    7 +++++++
  arch/arm/mach-at91/include/mach/clk.h      |    1 +
  3 files changed, 15 insertions(+)

Sorry for nitpicking, but I just try to applying patches from patchwork to u-boot source, compile it and test it automated with tbot [1] on the smartweb board [2]

This patch has also checkpatch errors:

2015-12-09 08:08:49,780:  wget
http://patchwork.ozlabs.org/patch/554232/mbox
2015-12-09 08:08:49,781:  --2015-12-09 08:08:49-- 
http://patchwork.ozlabs.org/patch/554232/mbox
2015-12-09 08:08:49,781:  Resolving patchwork.ozlabs.org
(patchwork.ozlabs.org)... 103.22.144.67, 2401:3900:2:1::2
2015-12-09 08:08:50,095:  Connecting to patchwork.ozlabs.org
(patchwork.ozlabs.org)|103.22.144.67|:80... connected.
2015-12-09 08:08:50,410:  HTTP request sent, awaiting response... 301
MOVED PERMANENTLY
2015-12-09 08:08:50,411:  Location:
http://patchwork.ozlabs.org/patch/554232/mbox/ [following]
2015-12-09 08:08:50,411:  --2015-12-09 08:08:50-- 
http://patchwork.ozlabs.org/patch/554232/mbox/
2015-12-09 08:08:50,411:  Reusing existing connection to
patchwork.ozlabs.org:80.
2015-12-09 08:08:50,726:  HTTP request sent, awaiting response... 200 OK
2015-12-09 08:08:50,726:  Length: unspecified [text/plain]
2015-12-09 08:08:50,726:  Saving to: ?mbox?
2015-12-09 08:08:50,726:
2015-12-09 08:08:50,726:
2015-12-09 08:08:50,726:  mbox                    [<=>                  
]       0  --.-KB/s
2015-12-09 08:08:50,726:  mbox                    [ <=>                 
]   2.34K  --.-KB/s   in 0.001s
2015-12-09 08:08:50,727:
2015-12-09 08:08:50,727:  2015-12-09 08:08:50 (2.66 MB/s) - ?mbox? saved
[2397]
2015-12-09 08:08:50,727:
2015-12-09 08:08:50,727:  hs at pollux [ 8:08:50] ttbott >
2015-12-09 08:08:51,940:  if [ $? -ne 0 ]; then echo 'FAILED'; fi
2015-12-09 08:08:51,940:  hs at pollux [ 8:08:51] ttbott >
2015-12-09 08:08:53,037:  scripts/checkpatch.pl mbox
2015-12-09 08:08:53,151:  WARNING: line over 80 characters
2015-12-09 08:08:53,152:  #47: FILE:
arch/arm/mach-at91/include/mach/at91_pmc.h:251:
2015-12-09 08:08:53,152:  +#define AT91_PMC_ICP_PLLA(x) (((x) & 0x3) <<
0)      /* Charge Pump Current PLLA */
2015-12-09 08:08:53,152:
2015-12-09 08:08:53,152:  WARNING: line over 80 characters
2015-12-09 08:08:53,152:  #48: FILE:
arch/arm/mach-at91/include/mach/at91_pmc.h:252:
2015-12-09 08:08:53,152:  +#define AT91_PMC_IPLL_PLLA(x)        (((x) &
0x7) << 8)      /* Engineering Configuration PLLA */
2015-12-09 08:08:53,152:
2015-12-09 08:08:53,152:  WARNING: line over 80 characters
2015-12-09 08:08:53,153:  #49: FILE:
arch/arm/mach-at91/include/mach/at91_pmc.h:253:
2015-12-09 08:08:53,153:  +#define AT91_PMC_ICP_PLLU(x) (((x) & 0x3) <<
16)     /* Charge Pump Current PLL UTMI */
2015-12-09 08:08:53,153:
2015-12-09 08:08:53,153:  WARNING: line over 80 characters
2015-12-09 08:08:53,153:  #50: FILE:
arch/arm/mach-at91/include/mach/at91_pmc.h:254:
2015-12-09 08:08:53,153:  +#define AT91_PMC_IVCO_PLLU(x)        (((x) &
0x3) << 24)     /* Voltage Control Output Current PLL UTMI */
2015-12-09 08:08:53,153:
2015-12-09 08:08:53,153:  total: 0 errors, 4 warnings, 0 checks, 27
lines checked
2015-12-09 08:08:53,153:
2015-12-09 08:08:53,153:  NOTE: Ignored message types: COMPLEX_MACRO
CONSIDER_KSTRTO MINMAX MULTISTATEMENT_MACRO_USE_DO_WHILE
NETWORKING_BLOCK_COMMENT_STYLE USLEEP_RANGE
2015-12-09 08:08:53,153:
2015-12-09 08:08:53,154:  mbox has style problems, please review.
2015-12-09 08:08:53,154:
2015-12-09 08:08:53,154:  If any of these errors are false positives,
please report
2015-12-09 08:08:53,154:  them to the maintainer, see CHECKPATCH in
MAINTAINERS.
2015-12-09 08:08:53,154:  hs at pollux [ 8:08:53] ttbott >
Quoted 9 lines
2015-12-09 08:08:54,283:  if [ $? -ne 0 ]; then echo 'FAILED'; fi
2015-12-09 08:08:54,283:  FAILED
2015-12-09 08:08:54,284:  hs at pollux [ 8:08:54] ttbott >
2015-12-09 08:08:54,380:  hs at pollux [ 8:08:54] ttbott >cat mbox | grep
Subject
2015-12-09 08:08:54,380:  ^[[01;31m^[[KSubject^[[m^[[K: [U-Boot,1/3]
ARM: at91: clock: add PMC_PLLICPR init function
2015-12-09 08:08:54,381:  hs at pollux [ 8:08:54] ttbott >

do we really insist on the 'line over 80' rule? Especially when one describes bit fields which I appreciate. I think it is often hard to sustain this rule for these cases.

Andreas

Quoted 4 lines

bye,
Heiko
[1] https://github.com/hsdenx/tbot
[2] http://xeidos.ddns.net/buildbot/builders/smartweb_dfu

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151209/db6859fa/attachment.sig>

#4 lore raw

PATCH 1/3 ARM: at91: clock: add PMC_PLLICPR init function

Hello Andreas,

Am 09.12.2015 um 09:37 schrieb Andreas Bie?mann:

Quoted 103 lines

Hi Heiko,

Quoted 90 lines · Heiko Schocher

Hello Wenyou,

Am 09.12.2015 um 05:36 schrieb Wenyou Yang:

Quoted 9 lines

To avoid the duplicated code, add the PMC_PLLICPR init function.

---

   arch/arm/mach-at91/armv7/clock.c           |    7 +++++++
   arch/arm/mach-at91/include/mach/at91_pmc.h |    7 +++++++
   arch/arm/mach-at91/include/mach/clk.h      |    1 +
   3 files changed, 15 insertions(+)

Sorry for nitpicking, but I just try to applying patches from patchwork to u-boot source, compile it and test it automated with tbot [1] on the smartweb board [2]

This patch has also checkpatch errors:

2015-12-09 08:08:49,780:  wget
http://patchwork.ozlabs.org/patch/554232/mbox
2015-12-09 08:08:49,781:  --2015-12-09 08:08:49--
http://patchwork.ozlabs.org/patch/554232/mbox
2015-12-09 08:08:49,781:  Resolving patchwork.ozlabs.org
(patchwork.ozlabs.org)... 103.22.144.67, 2401:3900:2:1::2
2015-12-09 08:08:50,095:  Connecting to patchwork.ozlabs.org
(patchwork.ozlabs.org)|103.22.144.67|:80... connected.
2015-12-09 08:08:50,410:  HTTP request sent, awaiting response... 301
MOVED PERMANENTLY
2015-12-09 08:08:50,411:  Location:
http://patchwork.ozlabs.org/patch/554232/mbox/ [following]
2015-12-09 08:08:50,411:  --2015-12-09 08:08:50--
http://patchwork.ozlabs.org/patch/554232/mbox/
2015-12-09 08:08:50,411:  Reusing existing connection to
patchwork.ozlabs.org:80.
2015-12-09 08:08:50,726:  HTTP request sent, awaiting response... 200 OK
2015-12-09 08:08:50,726:  Length: unspecified [text/plain]
2015-12-09 08:08:50,726:  Saving to: ?mbox?
2015-12-09 08:08:50,726:
2015-12-09 08:08:50,726:
2015-12-09 08:08:50,726:  mbox                    [<=>
]       0  --.-KB/s
2015-12-09 08:08:50,726:  mbox                    [ <=>
]   2.34K  --.-KB/s   in 0.001s
2015-12-09 08:08:50,727:
2015-12-09 08:08:50,727:  2015-12-09 08:08:50 (2.66 MB/s) - ?mbox? saved
[2397]
2015-12-09 08:08:50,727:
2015-12-09 08:08:50,727:  hs at pollux [ 8:08:50] ttbott >
2015-12-09 08:08:51,940:  if [ $? -ne 0 ]; then echo 'FAILED'; fi
2015-12-09 08:08:51,940:  hs at pollux [ 8:08:51] ttbott >
2015-12-09 08:08:53,037:  scripts/checkpatch.pl mbox
2015-12-09 08:08:53,151:  WARNING: line over 80 characters
2015-12-09 08:08:53,152:  #47: FILE:
arch/arm/mach-at91/include/mach/at91_pmc.h:251:
2015-12-09 08:08:53,152:  +#define AT91_PMC_ICP_PLLA(x) (((x) & 0x3) <<
0)      /* Charge Pump Current PLLA */
2015-12-09 08:08:53,152:
2015-12-09 08:08:53,152:  WARNING: line over 80 characters
2015-12-09 08:08:53,152:  #48: FILE:
arch/arm/mach-at91/include/mach/at91_pmc.h:252:
2015-12-09 08:08:53,152:  +#define AT91_PMC_IPLL_PLLA(x)        (((x) &
0x7) << 8)      /* Engineering Configuration PLLA */
2015-12-09 08:08:53,152:
2015-12-09 08:08:53,152:  WARNING: line over 80 characters
2015-12-09 08:08:53,153:  #49: FILE:
arch/arm/mach-at91/include/mach/at91_pmc.h:253:
2015-12-09 08:08:53,153:  +#define AT91_PMC_ICP_PLLU(x) (((x) & 0x3) <<
16)     /* Charge Pump Current PLL UTMI */
2015-12-09 08:08:53,153:
2015-12-09 08:08:53,153:  WARNING: line over 80 characters
2015-12-09 08:08:53,153:  #50: FILE:
arch/arm/mach-at91/include/mach/at91_pmc.h:254:
2015-12-09 08:08:53,153:  +#define AT91_PMC_IVCO_PLLU(x)        (((x) &
0x3) << 24)     /* Voltage Control Output Current PLL UTMI */
2015-12-09 08:08:53,153:
2015-12-09 08:08:53,153:  total: 0 errors, 4 warnings, 0 checks, 27
lines checked
2015-12-09 08:08:53,153:
2015-12-09 08:08:53,153:  NOTE: Ignored message types: COMPLEX_MACRO
CONSIDER_KSTRTO MINMAX MULTISTATEMENT_MACRO_USE_DO_WHILE
NETWORKING_BLOCK_COMMENT_STYLE USLEEP_RANGE
2015-12-09 08:08:53,153:
2015-12-09 08:08:53,154:  mbox has style problems, please review.
2015-12-09 08:08:53,154:
2015-12-09 08:08:53,154:  If any of these errors are false positives,
please report
2015-12-09 08:08:53,154:  them to the maintainer, see CHECKPATCH in
MAINTAINERS.
2015-12-09 08:08:53,154:  hs at pollux [ 8:08:53] ttbott >
Quoted 9 lines
2015-12-09 08:08:54,283:  if [ $? -ne 0 ]; then echo 'FAILED'; fi
2015-12-09 08:08:54,283:  FAILED
2015-12-09 08:08:54,284:  hs at pollux [ 8:08:54] ttbott >
2015-12-09 08:08:54,380:  hs at pollux [ 8:08:54] ttbott >cat mbox | grep
Subject
2015-12-09 08:08:54,380:  ^[[01;31m^[[KSubject^[[m^[[K: [U-Boot,1/3]
ARM: at91: clock: add PMC_PLLICPR init function
2015-12-09 08:08:54,381:  hs at pollux [ 8:08:54] ttbott >
Quoted 3 lines

do we really insist on the 'line over 80' rule? Especially when one describes bit fields which I appreciate. I think it is often hard to sustain this rule for these cases.

I think so, yes, but maybe I am wrong?

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#5 lore raw

PATCH 2/3 ARM: at91: clean up the PMC_PLLICPR init code

In reply to Wenyou Yang

Due to introducing the PMC_PLLICPR init function, use this function to clean up the code.

---

 arch/arm/mach-at91/spl_at91.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
arch/arm/mach-at91/spl_at91.c +1 -4
index b19f95b..cc3341a 100644
@@ -14,7 +14,6 @@
 #include <asm/arch/at91_common.h>
 #include <asm/arch/at91sam9_matrix.h>
 #include <asm/arch/at91_pit.h>
-#include <asm/arch/at91_pmc.h>
 #include <asm/arch/at91_rstc.h>
 #include <asm/arch/at91_wdt.h>
 #include <asm/arch/clk.h>
@@ -77,8 +76,6 @@ void __weak spl_board_init(void)
 
 void board_init_f(ulong dummy)
 {
-	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
-
 	lowlevel_clock_init();
 	at91_disable_wdt();
 
@@ -86,7 +83,7 @@ void board_init_f(ulong dummy)
 	 * At this stage the main oscillator is supposed to be enabled
 	 * PCK = MCK = MOSC
 	 */
-	writel(0x00, &pmc->pllicpr);
+	at91_pllicpr_init(0x00);
 
 	/* Configure PLLA = MOSC * (PLL_MULA + 1) / PLL_DIVA */
 	at91_plla_init(CONFIG_SYS_AT91_PLLA);
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH 3/3 board: atmel: clean up the PMC_PLLICPR init code

In reply to Wenyou Yang

Due to introducing the PMC_PLLICPR init function, use this function to clean up the code.

---

 board/atmel/sama5d3_xplained/sama5d3_xplained.c |    4 +---
 board/atmel/sama5d3xek/sama5d3xek.c             |    4 +---
 board/atmel/sama5d4_xplained/sama5d4_xplained.c |    4 +---
 board/atmel/sama5d4ek/sama5d4ek.c               |    4 +---
 4 files changed, 4 insertions(+), 12 deletions(-)
board/atmel/sama5d3_xplained/sama5d3_xplained.c +1 -3
index d180b41..6532970 100644
@@ -10,7 +10,6 @@
 #include <asm/io.h>
 #include <asm/arch/sama5d3_smc.h>
 #include <asm/arch/at91_common.h>
-#include <asm/arch/at91_pmc.h>
 #include <asm/arch/at91_rstc.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/clk.h>
@@ -198,7 +197,6 @@ void mem_init(void)
 
 void at91_pmc_init(void)
 {
-	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
 	u32 tmp;
 
 	tmp = AT91_PMC_PLLAR_29 |
@@ -207,7 +205,7 @@ void at91_pmc_init(void)
 	      AT91_PMC_PLLXR_DIV(1);
 	at91_plla_init(tmp);
 
-	writel(0x3 << 8, &pmc->pllicpr);
+	at91_pllicpr_init(AT91_PMC_IPLL_PLLA(0x3));
 
 	tmp = AT91_PMC_MCKR_MDIV_4 |
 	      AT91_PMC_MCKR_CSS_PLLA;
board/atmel/sama5d3xek/sama5d3xek.c +1 -3
index 777e57e..7a804e8 100644
@@ -10,7 +10,6 @@
 #include <asm/io.h>
 #include <asm/arch/sama5d3_smc.h>
 #include <asm/arch/at91_common.h>
-#include <asm/arch/at91_pmc.h>
 #include <asm/arch/at91_rstc.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/clk.h>
@@ -457,7 +456,6 @@ void mem_init(void)
 
 void at91_pmc_init(void)
 {
-	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
 	u32 tmp;
 
 	tmp = AT91_PMC_PLLAR_29 |
@@ -466,7 +464,7 @@ void at91_pmc_init(void)
 	      AT91_PMC_PLLXR_DIV(1);
 	at91_plla_init(tmp);
 
-	writel(0x3 << 8, &pmc->pllicpr);
+	at91_pllicpr_init(AT91_PMC_IPLL_PLLA(0x3));
 
 	tmp = AT91_PMC_MCKR_MDIV_4 |
 	      AT91_PMC_MCKR_CSS_PLLA;
board/atmel/sama5d4_xplained/sama5d4_xplained.c +1 -3
index e95310c..3fec662 100644
@@ -8,7 +8,6 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/arch/at91_common.h>
-#include <asm/arch/at91_pmc.h>
 #include <asm/arch/at91_rstc.h>
 #include <asm/arch/atmel_mpddrc.h>
 #include <asm/arch/atmel_usba_udc.h>
@@ -397,7 +396,6 @@ void mem_init(void)
 
 void at91_pmc_init(void)
 {
-	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
 	u32 tmp;
 
 	tmp = AT91_PMC_PLLAR_29 |
@@ -406,7 +404,7 @@ void at91_pmc_init(void)
 	      AT91_PMC_PLLXR_DIV(1);
 	at91_plla_init(tmp);
 
-	writel(0x0 << 8, &pmc->pllicpr);
+	at91_pllicpr_init(AT91_PMC_IPLL_PLLA(0x0));
 
 	tmp = AT91_PMC_MCKR_H32MXDIV |
 	      AT91_PMC_MCKR_PLLADIV_2 |
board/atmel/sama5d4ek/sama5d4ek.c +1 -3
index c92e2588..6ccbc64 100644
@@ -8,7 +8,6 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/arch/at91_common.h>
-#include <asm/arch/at91_pmc.h>
 #include <asm/arch/at91_rstc.h>
 #include <asm/arch/atmel_mpddrc.h>
 #include <asm/arch/atmel_usba_udc.h>
@@ -393,7 +392,6 @@ void mem_init(void)
 
 void at91_pmc_init(void)
 {
-	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
 	u32 tmp;
 
 	tmp = AT91_PMC_PLLAR_29 |
@@ -402,7 +400,7 @@ void at91_pmc_init(void)
 	      AT91_PMC_PLLXR_DIV(1);
 	at91_plla_init(tmp);
 
-	writel(0x0 << 8, &pmc->pllicpr);
+	at91_pllicpr_init(AT91_PMC_IPLL_PLLA(0x0));
 
 	tmp = AT91_PMC_MCKR_H32MXDIV |
 	      AT91_PMC_MCKR_PLLADIV_2 |
Signature · 1 line
1.7.9.5
#7 lore raw

cover ARM: at91: add PMC_PLLICPR init function

In reply to Wenyou Yang

Hello Wenyou,

Am 09.12.2015 um 05:36 schrieb Wenyou Yang:

Quoted 14 lines

To reduce the duplicated code, add PLLICPR init function, use the function to clean up the PMC_PLLICPR directly writing code.

It is based on the following patch set.
[PATCH 0/5] ARM: at91: improve peripheral and system clock handle functions [PATCH 0/4] ARM: at91: add UTMI PLL handle functions
[PATCH 0/3] ARM: at91: add PLLB handle functions

Wenyou Yang (3):
ARM: at91: clock: add PMC_PLLICPR init function
ARM: at91: clean up the PMC_PLLICPR init code
board: atmel: clean up the PMC_PLLICPR init code

Quoted 9 lines
  arch/arm/mach-at91/armv7/clock.c                |    7 +++++++
  arch/arm/mach-at91/include/mach/at91_pmc.h      |    7 +++++++
  arch/arm/mach-at91/include/mach/clk.h           |    1 +
  arch/arm/mach-at91/spl_at91.c                   |    5 +----
  board/atmel/sama5d3_xplained/sama5d3_xplained.c |    4 +---
  board/atmel/sama5d3xek/sama5d3xek.c             |    4 +---
  board/atmel/sama5d4_xplained/sama5d4_xplained.c |    4 +---
  board/atmel/sama5d4ek/sama5d4ek.c               |    4 +---
  8 files changed, 20 insertions(+), 16 deletions(-)

I applied all your at91 patches from:

It is based on the following patch set.
[PATCH 0/5] ARM: at91: improve peripheral and system clock handle functions [PATCH 0/4] ARM: at91: add UTMI PLL handle functions
[PATCH 0/3] ARM: at91: add PLLB handle functions

also this series, and compiled it for the smartweb board. This build fails:

LD spl/u-boot-spl
arch/arm/mach-at91/built-in.o: In function `board_init_f':
/home/hs/zug/u-boot/arch/arm/mach-at91/spl_at91.c:86: undefined reference to `at91_pllicpr_init' /home/hs/zug/u-boot/scripts/Makefile.spl:244: recipe for target 'spl/u-boot-spl' failed make[2]: *** [spl/u-boot-spl] Error 1
/home/hs/zug/u-boot/Makefile:1330: recipe for target 'spl/u-boot-spl' failed make[1]: *** [spl/u-boot-spl] Error 2
make[1]: Leaving directory '/work/hs/compile/u-boot/zug/smartweb'
Makefile:150: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2
make failed
pollux:u-boot hs [20151209] $

Please do a build for all at91 boards, before posting your patches again. Also try to have a look at the codesize ... the smartweb board have only 4k for the SPL image...

Thanks!

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#8 lore raw

cover ARM: at91: add PMC_PLLICPR init function

Hi Heiko,

Thank you very much for your review.

Quoted 37 lines

-----Original Message-----
From: Heiko Schocher [mailto:hs at denx.de]
Sent: 2015?12?9? 13:32
To: Yang, Wenyou <[email protected]>
Cc: U-Boot Mailing List <[email protected]>
Subject: Re: [U-Boot] [PATCH 0/3] ARM: at91: add PMC_PLLICPR init function

Hello Wenyou,

Am 09.12.2015 um 05:36 schrieb Wenyou Yang:

Quoted 5 lines

To reduce the duplicated code, add PLLICPR init function, use the function to clean up the PMC_PLLICPR directly writing code.

It is based on the following patch set.
[PATCH 0/5] ARM: at91: improve peripheral and system clock handle

functions

Quoted 9 lines

[PATCH 0/4] ARM: at91: add UTMI PLL handle functions [PATCH 0/3] ARM: at91: add PLLB handle functions

Wenyou Yang (3):
ARM: at91: clock: add PMC_PLLICPR init function
ARM: at91: clean up the PMC_PLLICPR init code
board: atmel: clean up the PMC_PLLICPR init code

Quoted 9 lines
  arch/arm/mach-at91/armv7/clock.c                |    7 +++++++
  arch/arm/mach-at91/include/mach/at91_pmc.h      |    7 +++++++
  arch/arm/mach-at91/include/mach/clk.h           |    1 +
  arch/arm/mach-at91/spl_at91.c                   |    5 +----
  board/atmel/sama5d3_xplained/sama5d3_xplained.c |    4 +---
  board/atmel/sama5d3xek/sama5d3xek.c             |    4 +---
  board/atmel/sama5d4_xplained/sama5d4_xplained.c |    4 +---
  board/atmel/sama5d4ek/sama5d4ek.c               |    4 +---
  8 files changed, 20 insertions(+), 16 deletions(-)

I applied all your at91 patches from:

Quoted 7 lines

It is based on the following patch set.
[PATCH 0/5] ARM: at91: improve peripheral and system clock handle
functions
[PATCH 0/4] ARM: at91: add UTMI PLL handle functions [PATCH 0/3] ARM: at91: add PLLB handle functions

also this series, and compiled it for the smartweb board. This build fails:

It is my fault, the build is not covered all Atmel boards.

I will fix it in next version, thanks.

Quoted 20 lines

LD spl/u-boot-spl
arch/arm/mach-at91/built-in.o: In function `board_init_f':
/home/hs/zug/u-boot/arch/arm/mach-at91/spl_at91.c:86: undefined reference to `at91_pllicpr_init'
/home/hs/zug/u-boot/scripts/Makefile.spl:244: recipe for target 'spl/u-boot-spl' failed
make[2]: *** [spl/u-boot-spl] Error 1 /home/hs/zug/u-boot/Makefile:1330: recipe for target 'spl/u-boot-spl' failed make[1]: *** [spl/u-boot-spl] Error 2
make[1]: Leaving directory '/work/hs/compile/u-boot/zug/smartweb' Makefile:150: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2
make failed
pollux:u-boot hs [20151209] $

Please do a build for all at91 boards, before posting your patches again. Also try to have a look at the codesize ... the smartweb board have only 4k for the SPL image...

Quoted 7 lines

Thanks!

bye,
Heiko
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

Best Regards,
Wenyou Yang