diff mbox

[U-Boot,1/3] ARM: at91: clock: add PMC_PLLICPR init function

Message ID 1449635817-8416-2-git-send-email-wenyou.yang@atmel.com
State Superseded
Headers show

Commit Message

Wenyou Yang Dec. 9, 2015, 4:36 a.m. UTC
To avoid the duplicated code, add the PMC_PLLICPR init function.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
---

 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(+)

Comments

Heiko Schocher Dec. 9, 2015, 7:14 a.m. UTC | #1
Hello Wenyou,

Am 09.12.2015 um 05:36 schrieb Wenyou Yang:
> To avoid the duplicated code, add the PMC_PLLICPR init function.
>
> Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
> ---
>
>   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@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@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@pollux [ 8:08:54] ttbott >
2015-12-09 08:08:54,380:  hs@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@pollux [ 8:08:54] ttbott >

bye,
Heiko
[1] https://github.com/hsdenx/tbot
[2] http://xeidos.ddns.net/buildbot/builders/smartweb_dfu
Andreas Bießmann Dec. 9, 2015, 8:37 a.m. UTC | #2
Hi Heiko,

On 09.12.2015 08:14, Heiko Schocher wrote:
> Hello Wenyou,
> 
> Am 09.12.2015 um 05:36 schrieb Wenyou Yang:
>> To avoid the duplicated code, add the PMC_PLLICPR init function.
>>
>> Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
>> ---
>>
>>   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@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@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@pollux [ 8:08:54] ttbott >
> 2015-12-09 08:08:54,380:  hs@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@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

> bye,
> Heiko
> [1] https://github.com/hsdenx/tbot
> [2] http://xeidos.ddns.net/buildbot/builders/smartweb_dfu
Heiko Schocher Dec. 9, 2015, 9:59 a.m. UTC | #3
Hello Andreas,

Am 09.12.2015 um 09:37 schrieb Andreas Bießmann:
> Hi Heiko,
>
> On 09.12.2015 08:14, Heiko Schocher wrote:
>> Hello Wenyou,
>>
>> Am 09.12.2015 um 05:36 schrieb Wenyou Yang:
>>> To avoid the duplicated code, add the PMC_PLLICPR init function.
>>>
>>> Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
>>> ---
>>>
>>>    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@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@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@pollux [ 8:08:54] ttbott >
>> 2015-12-09 08:08:54,380:  hs@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@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.

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

bye,
Heiko
diff mbox

Patch

diff --git a/arch/arm/mach-at91/armv7/clock.c b/arch/arm/mach-at91/armv7/clock.c
index 81e9f69..b8143c5 100644
--- a/arch/arm/mach-at91/armv7/clock.c
+++ b/arch/arm/mach-at91/armv7/clock.c
@@ -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);
+}
diff --git a/arch/arm/mach-at91/include/mach/at91_pmc.h b/arch/arm/mach-at91/include/mach/at91_pmc.h
index eb40194..6955461 100644
--- a/arch/arm/mach-at91/include/mach/at91_pmc.h
+++ b/arch/arm/mach-at91/include/mach/at91_pmc.h
@@ -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
diff --git a/arch/arm/mach-at91/include/mach/clk.h b/arch/arm/mach-at91/include/mach/clk.h
index 64dec52..8577c74 100644
--- a/arch/arm/mach-at91/include/mach/clk.h
+++ b/arch/arm/mach-at91/include/mach/clk.h
@@ -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__ */