* [U-Boot] [PATCH 1/3] DaVinci DA8xx: tidy up clock ID definition
@ 2012-07-30 16:30 Laurence Withers
2012-07-30 16:30 ` [U-Boot] [PATCH 2/3] DaVinci DA850: UART2 clock ID comes from ASYNC3 Laurence Withers
2012-07-30 16:30 ` [U-Boot] [PATCH 3/3] DaVinci DA8xx: replace magic number for DDR speed Laurence Withers
0 siblings, 2 replies; 5+ messages in thread
From: Laurence Withers @ 2012-07-30 16:30 UTC (permalink / raw)
To: u-boot
Tidy up the clock IDs defined for the DA8xx SOCs. With this new structure in
place, it is clear how to define new clock IDs, and how these map to the
numbers presented in the technical reference manual.
Signed-off-by: Laurence Withers <lwithers@guralp.com>
Cc: Prabhakar Lad <prabhakar.csengg@gmail.com>
---
arch/arm/include/asm/arch-davinci/hardware.h | 53 +++++++++++++++++++-------
1 files changed, 39 insertions(+), 14 deletions(-)
diff --git a/arch/arm/include/asm/arch-davinci/hardware.h b/arch/arm/include/asm/arch-davinci/hardware.h
index b145c6e..dac43bb 100644
--- a/arch/arm/include/asm/arch-davinci/hardware.h
+++ b/arch/arm/include/asm/arch-davinci/hardware.h
@@ -441,21 +441,46 @@ struct davinci_pllc_regs {
#define davinci_pllc1_regs ((struct davinci_pllc_regs *)DAVINCI_PLL_CNTRL1_BASE)
#define DAVINCI_PLLC_DIV_MASK 0x1f
-#define ASYNC3 get_async3_src()
-#define PLL1_SYSCLK2 ((1 << 16) | 0x2)
-#define DAVINCI_SPI1_CLKID (cpu_is_da830() ? 2 : ASYNC3)
-/* Clock IDs */
+/*
+ * A clock ID is a 32-bit number where bit 16 represents the PLL controller
+ * (clear is PLLC0, set is PLLC1) and the low 16 bits represent the divisor,
+ * counting from 1. Clock IDs may be passed to clk_get().
+ */
+
+/* flags to select PLL controller */
+#define DAVINCI_PLLC0_FLAG (0)
+#define DAVINCI_PLLC1_FLAG (1 << 16)
+
enum davinci_clk_ids {
- DAVINCI_SPI0_CLKID = 2,
- DAVINCI_UART2_CLKID = 2,
- DAVINCI_MMC_CLKID = 2,
- DAVINCI_MDIO_CLKID = 4,
- DAVINCI_ARM_CLKID = 6,
- DAVINCI_PLLM_CLKID = 0xff,
- DAVINCI_PLLC_CLKID = 0x100,
- DAVINCI_AUXCLK_CLKID = 0x101
+ /*
+ * Clock IDs for PLL outputs. Each may be switched on/off independently,
+ * and each may map to one or more peripherals.
+ */
+ DAVINCI_PLL0_SYSCLK2 = DAVINCI_PLLC0_FLAG | 2,
+ DAVINCI_PLL0_SYSCLK4 = DAVINCI_PLLC0_FLAG | 4,
+ DAVINCI_PLL0_SYSCLK6 = DAVINCI_PLLC0_FLAG | 6,
+ DAVINCI_PLL1_SYSCLK2 = DAVINCI_PLLC1_FLAG | 2,
+
+ /* map peripherals to clock IDs */
+ DAVINCI_ARM_CLKID = DAVINCI_PLL0_SYSCLK6,
+ DAVINCI_MDIO_CLKID = DAVINCI_PLL0_SYSCLK4,
+ DAVINCI_MMC_CLKID = DAVINCI_PLL0_SYSCLK2,
+ DAVINCI_SPI0_CLKID = DAVINCI_PLL0_SYSCLK2,
+ DAVINCI_UART2_CLKID = DAVINCI_PLL0_SYSCLK2,
+
+ /* special clock ID - output of PLL multiplier */
+ DAVINCI_PLLM_CLKID = 0x0FF,
+
+ /* special clock ID - output of PLL post divisor */
+ DAVINCI_PLLC_CLKID = 0x100,
+
+ /* special clock ID - PLL bypass */
+ DAVINCI_AUXCLK_CLKID = 0x101,
};
+#define DAVINCI_SPI1_CLKID (cpu_is_da830() ? DAVINCI_PLL0_SYSCLK2 \
+ : get_async3_src())
+
int clk_get(enum davinci_clk_ids id);
/* Boot config */
@@ -570,10 +595,10 @@ static inline int cpu_is_da850(void)
return ((part_no == 0xb7d1) ? 1 : 0);
}
-static inline int get_async3_src(void)
+static inline enum davinci_clk_ids get_async3_src(void)
{
return (REG(&davinci_syscfg_regs->cfgchip3) & 0x10) ?
- PLL1_SYSCLK2 : 2;
+ DAVINCI_PLL1_SYSCLK2 : DAVINCI_PLL0_SYSCLK2;
}
#endif /* CONFIG_SOC_DA8XX */
--
1.7.2.5
^ permalink raw reply related [flat|nested] 5+ messages in thread* [U-Boot] [PATCH 2/3] DaVinci DA850: UART2 clock ID comes from ASYNC3
2012-07-30 16:30 [U-Boot] [PATCH 1/3] DaVinci DA8xx: tidy up clock ID definition Laurence Withers
@ 2012-07-30 16:30 ` Laurence Withers
2012-07-30 16:30 ` [U-Boot] [PATCH 3/3] DaVinci DA8xx: replace magic number for DDR speed Laurence Withers
1 sibling, 0 replies; 5+ messages in thread
From: Laurence Withers @ 2012-07-30 16:30 UTC (permalink / raw)
To: u-boot
On the DA830, UART2's clock is derived from PLL controller 0 output 2.
On the DA850, it is in the ASYNC3 group, and may be switched between PLL
controller 0 or 1. Fix the definition of the ID to match.
Signed-off-by: Laurence Withers <lwithers@guralp.com>
Cc: Prabhakar Lad <prabhakar.csengg@gmail.com>
---
arch/arm/include/asm/arch-davinci/hardware.h | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/arch/arm/include/asm/arch-davinci/hardware.h b/arch/arm/include/asm/arch-davinci/hardware.h
index dac43bb..0fce940 100644
--- a/arch/arm/include/asm/arch-davinci/hardware.h
+++ b/arch/arm/include/asm/arch-davinci/hardware.h
@@ -466,7 +466,6 @@ enum davinci_clk_ids {
DAVINCI_MDIO_CLKID = DAVINCI_PLL0_SYSCLK4,
DAVINCI_MMC_CLKID = DAVINCI_PLL0_SYSCLK2,
DAVINCI_SPI0_CLKID = DAVINCI_PLL0_SYSCLK2,
- DAVINCI_UART2_CLKID = DAVINCI_PLL0_SYSCLK2,
/* special clock ID - output of PLL multiplier */
DAVINCI_PLLM_CLKID = 0x0FF,
@@ -478,6 +477,9 @@ enum davinci_clk_ids {
DAVINCI_AUXCLK_CLKID = 0x101,
};
+#define DAVINCI_UART2_CLKID (cpu_is_da830() ? DAVINCI_PLL0_SYSCLK2 \
+ : get_async3_src())
+
#define DAVINCI_SPI1_CLKID (cpu_is_da830() ? DAVINCI_PLL0_SYSCLK2 \
: get_async3_src())
--
1.7.2.5
^ permalink raw reply related [flat|nested] 5+ messages in thread* [U-Boot] [PATCH 3/3] DaVinci DA8xx: replace magic number for DDR speed
2012-07-30 16:30 [U-Boot] [PATCH 1/3] DaVinci DA8xx: tidy up clock ID definition Laurence Withers
2012-07-30 16:30 ` [U-Boot] [PATCH 2/3] DaVinci DA850: UART2 clock ID comes from ASYNC3 Laurence Withers
@ 2012-07-30 16:30 ` Laurence Withers
2012-07-30 16:34 ` Laurence Withers
1 sibling, 1 reply; 5+ messages in thread
From: Laurence Withers @ 2012-07-30 16:30 UTC (permalink / raw)
To: u-boot
Replace a magic number for the DDR2/mDDR PHY clock ID with a proper
definition. In addition, don't request this clock ID on DA830 hardware,
which does not have a DDR2/mDDR PHY (or associated PLL controller).
Signed-off-by: Laurence Withers <lwithers@guralp.com>
Cc: Prabhakar Lad <prabhakar.csengg@gmail.com>
---
arch/arm/cpu/arm926ejs/davinci/cpu.c | 3 ++-
arch/arm/include/asm/arch-davinci/hardware.h | 2 ++
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/arch/arm/cpu/arm926ejs/davinci/cpu.c b/arch/arm/cpu/arm926ejs/davinci/cpu.c
index 4bdb08b..b31add8 100644
--- a/arch/arm/cpu/arm926ejs/davinci/cpu.c
+++ b/arch/arm/cpu/arm926ejs/davinci/cpu.c
@@ -122,7 +122,8 @@ int set_cpu_clk_info(void)
{
gd->bd->bi_arm_freq = clk_get(DAVINCI_ARM_CLKID) / 1000000;
/* DDR PHY uses an x2 input clock */
- gd->bd->bi_ddr_freq = clk_get(0x10001) / 1000000;
+ gd->bd->bi_ddr_freq = cpu_is_da830() ? 0 :
+ (clk_get(DAVINCI_DDR_CLKID) / 1000000);
gd->bd->bi_dsp_freq = 0;
return 0;
}
diff --git a/arch/arm/include/asm/arch-davinci/hardware.h b/arch/arm/include/asm/arch-davinci/hardware.h
index 0fce940..7f3dcc2 100644
--- a/arch/arm/include/asm/arch-davinci/hardware.h
+++ b/arch/arm/include/asm/arch-davinci/hardware.h
@@ -459,10 +459,12 @@ enum davinci_clk_ids {
DAVINCI_PLL0_SYSCLK2 = DAVINCI_PLLC0_FLAG | 2,
DAVINCI_PLL0_SYSCLK4 = DAVINCI_PLLC0_FLAG | 4,
DAVINCI_PLL0_SYSCLK6 = DAVINCI_PLLC0_FLAG | 6,
+ DAVINCI_PLL1_SYSCLK1 = DAVINCI_PLLC1_FLAG | 1,
DAVINCI_PLL1_SYSCLK2 = DAVINCI_PLLC1_FLAG | 2,
/* map peripherals to clock IDs */
DAVINCI_ARM_CLKID = DAVINCI_PLL0_SYSCLK6,
+ DAVINCI_DDR_CLKID = DAVINCI_PLL1_SYSCLK1,
DAVINCI_MDIO_CLKID = DAVINCI_PLL0_SYSCLK4,
DAVINCI_MMC_CLKID = DAVINCI_PLL0_SYSCLK2,
DAVINCI_SPI0_CLKID = DAVINCI_PLL0_SYSCLK2,
--
1.7.2.5
^ permalink raw reply related [flat|nested] 5+ messages in thread* [U-Boot] [PATCH 3/3] DaVinci DA8xx: replace magic number for DDR speed
2012-07-30 16:30 ` [U-Boot] [PATCH 3/3] DaVinci DA8xx: replace magic number for DDR speed Laurence Withers
@ 2012-07-30 16:34 ` Laurence Withers
2012-07-30 17:25 ` Tom Rini
0 siblings, 1 reply; 5+ messages in thread
From: Laurence Withers @ 2012-07-30 16:34 UTC (permalink / raw)
To: u-boot
On Mon, Jul 30, 2012 at 04:30:15PM +0000, Laurence Withers wrote:
> Replace a magic number for the DDR2/mDDR PHY clock ID with a proper
> definition. In addition, don't request this clock ID on DA830 hardware,
> which does not have a DDR2/mDDR PHY (or associated PLL controller).
>
> Signed-off-by: Laurence Withers <lwithers@guralp.com>
> Cc: Prabhakar Lad <prabhakar.csengg@gmail.com>
> ---
> arch/arm/cpu/arm926ejs/davinci/cpu.c | 3 ++-
> arch/arm/include/asm/arch-davinci/hardware.h | 2 ++
> 2 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/cpu/arm926ejs/davinci/cpu.c b/arch/arm/cpu/arm926ejs/davinci/cpu.c
> index 4bdb08b..b31add8 100644
> --- a/arch/arm/cpu/arm926ejs/davinci/cpu.c
> +++ b/arch/arm/cpu/arm926ejs/davinci/cpu.c
> @@ -122,7 +122,8 @@ int set_cpu_clk_info(void)
> {
> gd->bd->bi_arm_freq = clk_get(DAVINCI_ARM_CLKID) / 1000000;
> /* DDR PHY uses an x2 input clock */
> - gd->bd->bi_ddr_freq = clk_get(0x10001) / 1000000;
> + gd->bd->bi_ddr_freq = cpu_is_da830() ? 0 :
> + (clk_get(DAVINCI_DDR_CLKID) / 1000000);
> gd->bd->bi_dsp_freq = 0;
> return 0;
> }
> diff --git a/arch/arm/include/asm/arch-davinci/hardware.h b/arch/arm/include/asm/arch-davinci/hardware.h
> index 0fce940..7f3dcc2 100644
> --- a/arch/arm/include/asm/arch-davinci/hardware.h
> +++ b/arch/arm/include/asm/arch-davinci/hardware.h
> @@ -459,10 +459,12 @@ enum davinci_clk_ids {
> DAVINCI_PLL0_SYSCLK2 = DAVINCI_PLLC0_FLAG | 2,
> DAVINCI_PLL0_SYSCLK4 = DAVINCI_PLLC0_FLAG | 4,
> DAVINCI_PLL0_SYSCLK6 = DAVINCI_PLLC0_FLAG | 6,
> + DAVINCI_PLL1_SYSCLK1 = DAVINCI_PLLC1_FLAG | 1,
> DAVINCI_PLL1_SYSCLK2 = DAVINCI_PLLC1_FLAG | 2,
>
> /* map peripherals to clock IDs */
> DAVINCI_ARM_CLKID = DAVINCI_PLL0_SYSCLK6,
> + DAVINCI_DDR_CLKID = DAVINCI_PLL1_SYSCLK1,
> DAVINCI_MDIO_CLKID = DAVINCI_PLL0_SYSCLK4,
> DAVINCI_MMC_CLKID = DAVINCI_PLL0_SYSCLK2,
> DAVINCI_SPI0_CLKID = DAVINCI_PLL0_SYSCLK2,
> --
> 1.7.2.5
>
Hi,
This patch does depend on my earlier patch to tidy up the definition of
set_cpu_clk_info() :
http://lists.denx.de/pipermail/u-boot/2012-July/129205.html
Bye for now,
--
Laurence Withers, <lwithers@guralp.com> http://www.guralp.com/
Direct tel:+447753988197 or tel:+443333408643 Software Engineer
General support queries: <support@guralp.com> CMG-DCM CMG-EAM CMG-NAM
^ permalink raw reply [flat|nested] 5+ messages in thread* [U-Boot] [PATCH 3/3] DaVinci DA8xx: replace magic number for DDR speed
2012-07-30 16:34 ` Laurence Withers
@ 2012-07-30 17:25 ` Tom Rini
0 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2012-07-30 17:25 UTC (permalink / raw)
To: u-boot
On Mon, Jul 30, 2012 at 04:34:39PM +0000, Laurence Withers wrote:
> On Mon, Jul 30, 2012 at 04:30:15PM +0000, Laurence Withers wrote:
> > Replace a magic number for the DDR2/mDDR PHY clock ID with a proper
> > definition. In addition, don't request this clock ID on DA830 hardware,
> > which does not have a DDR2/mDDR PHY (or associated PLL controller).
> >
> > Signed-off-by: Laurence Withers <lwithers@guralp.com>
> > Cc: Prabhakar Lad <prabhakar.csengg@gmail.com>
> > ---
> > arch/arm/cpu/arm926ejs/davinci/cpu.c | 3 ++-
> > arch/arm/include/asm/arch-davinci/hardware.h | 2 ++
> > 2 files changed, 4 insertions(+), 1 deletions(-)
> >
> > diff --git a/arch/arm/cpu/arm926ejs/davinci/cpu.c b/arch/arm/cpu/arm926ejs/davinci/cpu.c
> > index 4bdb08b..b31add8 100644
> > --- a/arch/arm/cpu/arm926ejs/davinci/cpu.c
> > +++ b/arch/arm/cpu/arm926ejs/davinci/cpu.c
> > @@ -122,7 +122,8 @@ int set_cpu_clk_info(void)
> > {
> > gd->bd->bi_arm_freq = clk_get(DAVINCI_ARM_CLKID) / 1000000;
> > /* DDR PHY uses an x2 input clock */
> > - gd->bd->bi_ddr_freq = clk_get(0x10001) / 1000000;
> > + gd->bd->bi_ddr_freq = cpu_is_da830() ? 0 :
> > + (clk_get(DAVINCI_DDR_CLKID) / 1000000);
> > gd->bd->bi_dsp_freq = 0;
> > return 0;
> > }
> > diff --git a/arch/arm/include/asm/arch-davinci/hardware.h b/arch/arm/include/asm/arch-davinci/hardware.h
> > index 0fce940..7f3dcc2 100644
> > --- a/arch/arm/include/asm/arch-davinci/hardware.h
> > +++ b/arch/arm/include/asm/arch-davinci/hardware.h
> > @@ -459,10 +459,12 @@ enum davinci_clk_ids {
> > DAVINCI_PLL0_SYSCLK2 = DAVINCI_PLLC0_FLAG | 2,
> > DAVINCI_PLL0_SYSCLK4 = DAVINCI_PLLC0_FLAG | 4,
> > DAVINCI_PLL0_SYSCLK6 = DAVINCI_PLLC0_FLAG | 6,
> > + DAVINCI_PLL1_SYSCLK1 = DAVINCI_PLLC1_FLAG | 1,
> > DAVINCI_PLL1_SYSCLK2 = DAVINCI_PLLC1_FLAG | 2,
> >
> > /* map peripherals to clock IDs */
> > DAVINCI_ARM_CLKID = DAVINCI_PLL0_SYSCLK6,
> > + DAVINCI_DDR_CLKID = DAVINCI_PLL1_SYSCLK1,
> > DAVINCI_MDIO_CLKID = DAVINCI_PLL0_SYSCLK4,
> > DAVINCI_MMC_CLKID = DAVINCI_PLL0_SYSCLK2,
> > DAVINCI_SPI0_CLKID = DAVINCI_PLL0_SYSCLK2,
> > --
> > 1.7.2.5
> >
>
> Hi,
>
> This patch does depend on my earlier patch to tidy up the definition of
> set_cpu_clk_info() :
>
> http://lists.denx.de/pipermail/u-boot/2012-July/129205.html
Can you please post everything as a series of 4 patches so that we don't
add and then replace the magic value with the enum? Other than that,
I'm happy with the series and will apply the updated series on Friday or
so, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120730/54b3bda6/attachment.pgp>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-07-30 17:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-30 16:30 [U-Boot] [PATCH 1/3] DaVinci DA8xx: tidy up clock ID definition Laurence Withers
2012-07-30 16:30 ` [U-Boot] [PATCH 2/3] DaVinci DA850: UART2 clock ID comes from ASYNC3 Laurence Withers
2012-07-30 16:30 ` [U-Boot] [PATCH 3/3] DaVinci DA8xx: replace magic number for DDR speed Laurence Withers
2012-07-30 16:34 ` Laurence Withers
2012-07-30 17:25 ` Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox