public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] arm: am33xx: Initialize EMIF REG_PR_OLD_COUNT for BBB and am335x-evm
@ 2016-12-02  7:54 Jyri Sarha
  2016-12-02 13:01 ` Tom Rini
  0 siblings, 1 reply; 5+ messages in thread
From: Jyri Sarha @ 2016-12-02  7:54 UTC (permalink / raw)
  To: u-boot

Initialize EMIF OCP_CONFIG registers REG_COS_COUNT_1, REG_COS_COUNT_2,
and REG_PR_OLD_COUNT field for Beaglebone-Black and am335x-evm. With
the default values LCDC suffers from DMA FIFO underflows and frame
synchronization lost errors. The initialization values are the highest
that work flawlessly when heavy memory load is generated by CPU. 32bpp
colors were used in the test. On BBB the video mode used 110MHz pixel
clock. The mode supported by the panel of am335x-evm uses 30MHz pixel
clock.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
This patch have been part of TI's latest 2016LTS based release and
has gone trough our regular tesing as a part of that. There has been
no noticable side effects.

Cheers,
Jyri

 arch/arm/cpu/armv7/am33xx/ddr.c             | 4 ++++
 arch/arm/include/asm/arch-am33xx/ddr_defs.h | 8 ++++++++
 arch/arm/include/asm/emif.h                 | 1 +
 board/ti/am335x/board.c                     | 2 ++
 4 files changed, 15 insertions(+)

diff --git a/arch/arm/cpu/armv7/am33xx/ddr.c b/arch/arm/cpu/armv7/am33xx/ddr.c
index 6acf30c..690487e 100644
--- a/arch/arm/cpu/armv7/am33xx/ddr.c
+++ b/arch/arm/cpu/armv7/am33xx/ddr.c
@@ -180,6 +180,10 @@ void config_sdram(const struct emif_regs *regs, int nr)
 	writel(regs->ref_ctrl, &emif_reg[nr]->emif_sdram_ref_ctrl);
 	writel(regs->ref_ctrl, &emif_reg[nr]->emif_sdram_ref_ctrl_shdw);
 	writel(regs->sdram_config, &emif_reg[nr]->emif_sdram_config);
+
+	/* Write REG_COS_COUNT_1, REG_COS_COUNT_2, and REG_PR_OLD_COUNT. */
+	if (regs->ocp_config)
+		writel(regs->ocp_config, &emif_reg[nr]->emif_l3_config);
 }
 
 /**
diff --git a/arch/arm/include/asm/arch-am33xx/ddr_defs.h b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
index 43e122e..c71cfd0 100644
--- a/arch/arm/include/asm/arch-am33xx/ddr_defs.h
+++ b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
@@ -25,6 +25,14 @@
 #endif
 #define PHY_EN_DYN_PWRDN	(0x1 << 20)
 
+/**
+ * AM335X (EMIF_4D) EMIF REG_COS_COUNT_1, REG_COS_COUNT_2, and
+ * REG_PR_OLD_COUNT values to avoid LCDC DMA FIFO underflows and Frame
+ * Synchronization Lost errors.
+ */
+#define EMIF_OCP_CONFIG_BEAGLEBONE_BLACK	0x00141414
+#define EMIF_OCP_CONFIG_AM335X_EVM		0x003d3d3d
+
 /* Micron MT47H128M16RT-25E */
 #define MT47H128M16RT25E_EMIF_READ_LATENCY	0x100005
 #define MT47H128M16RT25E_EMIF_TIM1		0x0666B3C9
diff --git a/arch/arm/include/asm/emif.h b/arch/arm/include/asm/emif.h
index b00dece..9a46340 100644
--- a/arch/arm/include/asm/emif.h
+++ b/arch/arm/include/asm/emif.h
@@ -1171,6 +1171,7 @@ struct emif_regs {
 	u32 sdram_tim1;
 	u32 sdram_tim2;
 	u32 sdram_tim3;
+	u32 ocp_config;
 	u32 read_idle_ctrl;
 	u32 zq_config;
 	u32 temp_alert_config;
diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
index 16113b5..02e68a6 100644
--- a/board/ti/am335x/board.c
+++ b/board/ti/am335x/board.c
@@ -201,6 +201,7 @@ static struct emif_regs ddr3_beagleblack_emif_reg_data = {
 	.sdram_tim1 = MT41K256M16HA125E_EMIF_TIM1,
 	.sdram_tim2 = MT41K256M16HA125E_EMIF_TIM2,
 	.sdram_tim3 = MT41K256M16HA125E_EMIF_TIM3,
+	.ocp_config = EMIF_OCP_CONFIG_BEAGLEBONE_BLACK,
 	.zq_config = MT41K256M16HA125E_ZQ_CFG,
 	.emif_ddr_phy_ctlr_1 = MT41K256M16HA125E_EMIF_READ_LATENCY,
 };
@@ -211,6 +212,7 @@ static struct emif_regs ddr3_evm_emif_reg_data = {
 	.sdram_tim1 = MT41J512M8RH125_EMIF_TIM1,
 	.sdram_tim2 = MT41J512M8RH125_EMIF_TIM2,
 	.sdram_tim3 = MT41J512M8RH125_EMIF_TIM3,
+	.ocp_config = EMIF_OCP_CONFIG_AM335X_EVM,
 	.zq_config = MT41J512M8RH125_ZQ_CFG,
 	.emif_ddr_phy_ctlr_1 = MT41J512M8RH125_EMIF_READ_LATENCY |
 				PHY_EN_DYN_PWRDN,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] arm: am33xx: Initialize EMIF REG_PR_OLD_COUNT for BBB and am335x-evm
  2016-12-02  7:54 [U-Boot] [PATCH] arm: am33xx: Initialize EMIF REG_PR_OLD_COUNT for BBB and am335x-evm Jyri Sarha
@ 2016-12-02 13:01 ` Tom Rini
  2016-12-02 13:06   ` Jyri Sarha
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Rini @ 2016-12-02 13:01 UTC (permalink / raw)
  To: u-boot

On Fri, Dec 02, 2016 at 09:54:39AM +0200, Jyri Sarha wrote:

> Initialize EMIF OCP_CONFIG registers REG_COS_COUNT_1, REG_COS_COUNT_2,
> and REG_PR_OLD_COUNT field for Beaglebone-Black and am335x-evm. With
> the default values LCDC suffers from DMA FIFO underflows and frame
> synchronization lost errors. The initialization values are the highest
> that work flawlessly when heavy memory load is generated by CPU. 32bpp
> colors were used in the test. On BBB the video mode used 110MHz pixel
> clock. The mode supported by the panel of am335x-evm uses 30MHz pixel
> clock.
> 
> Signed-off-by: Jyri Sarha <jsarha@ti.com>
[snip]
> diff --git a/arch/arm/include/asm/arch-am33xx/ddr_defs.h b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
> index 43e122e..c71cfd0 100644
> --- a/arch/arm/include/asm/arch-am33xx/ddr_defs.h
> +++ b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
> @@ -25,6 +25,14 @@
>  #endif
>  #define PHY_EN_DYN_PWRDN	(0x1 << 20)
>  
> +/**
> + * AM335X (EMIF_4D) EMIF REG_COS_COUNT_1, REG_COS_COUNT_2, and
> + * REG_PR_OLD_COUNT values to avoid LCDC DMA FIFO underflows and Frame
> + * Synchronization Lost errors.
> + */
> +#define EMIF_OCP_CONFIG_BEAGLEBONE_BLACK	0x00141414
> +#define EMIF_OCP_CONFIG_AM335X_EVM		0x003d3d3d

OK, but the problems I see are that first we don't explain what these
values are tied to physically.  Is it the display? The DDR memory?
Second, since these are board specific they should be in
board/ti/am335x/board.h.  Thanks!

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] arm: am33xx: Initialize EMIF REG_PR_OLD_COUNT for BBB and am335x-evm
  2016-12-02 13:01 ` Tom Rini
@ 2016-12-02 13:06   ` Jyri Sarha
  2016-12-02 16:24     ` Jyri Sarha
  0 siblings, 1 reply; 5+ messages in thread
From: Jyri Sarha @ 2016-12-02 13:06 UTC (permalink / raw)
  To: u-boot

On 12/02/16 15:01, Tom Rini wrote:
> On Fri, Dec 02, 2016 at 09:54:39AM +0200, Jyri Sarha wrote:
> 
>> Initialize EMIF OCP_CONFIG registers REG_COS_COUNT_1, REG_COS_COUNT_2,
>> and REG_PR_OLD_COUNT field for Beaglebone-Black and am335x-evm. With
>> the default values LCDC suffers from DMA FIFO underflows and frame
>> synchronization lost errors. The initialization values are the highest
>> that work flawlessly when heavy memory load is generated by CPU. 32bpp
>> colors were used in the test. On BBB the video mode used 110MHz pixel
>> clock. The mode supported by the panel of am335x-evm uses 30MHz pixel
>> clock.
>>
>> Signed-off-by: Jyri Sarha <jsarha@ti.com>
> [snip]
>> diff --git a/arch/arm/include/asm/arch-am33xx/ddr_defs.h b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
>> index 43e122e..c71cfd0 100644
>> --- a/arch/arm/include/asm/arch-am33xx/ddr_defs.h
>> +++ b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
>> @@ -25,6 +25,14 @@
>>  #endif
>>  #define PHY_EN_DYN_PWRDN	(0x1 << 20)
>>  
>> +/**
>> + * AM335X (EMIF_4D) EMIF REG_COS_COUNT_1, REG_COS_COUNT_2, and
>> + * REG_PR_OLD_COUNT values to avoid LCDC DMA FIFO underflows and Frame
>> + * Synchronization Lost errors.
>> + */
>> +#define EMIF_OCP_CONFIG_BEAGLEBONE_BLACK	0x00141414
>> +#define EMIF_OCP_CONFIG_AM335X_EVM		0x003d3d3d
> 
> OK, but the problems I see are that first we don't explain what these
> values are tied to physically.  Is it the display? The DDR memory?

It is a combination of both. I'll add that to the comment.

> Second, since these are board specific they should be in
> board/ti/am335x/board.h.  Thanks!
> 

Ok, I'll move the defines there.

Thanks,
Jyri

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] arm: am33xx: Initialize EMIF REG_PR_OLD_COUNT for BBB and am335x-evm
  2016-12-02 13:06   ` Jyri Sarha
@ 2016-12-02 16:24     ` Jyri Sarha
  2016-12-02 20:17       ` Tom Rini
  0 siblings, 1 reply; 5+ messages in thread
From: Jyri Sarha @ 2016-12-02 16:24 UTC (permalink / raw)
  To: u-boot

On 12/02/16 15:06, Jyri Sarha wrote:
>>> diff --git a/arch/arm/include/asm/arch-am33xx/ddr_defs.h b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
>>> >> index 43e122e..c71cfd0 100644
>>> >> --- a/arch/arm/include/asm/arch-am33xx/ddr_defs.h
>>> >> +++ b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
>>> >> @@ -25,6 +25,14 @@
>>> >>  #endif
>>> >>  #define PHY_EN_DYN_PWRDN	(0x1 << 20)
>>> >>  
>>> >> +/**
>>> >> + * AM335X (EMIF_4D) EMIF REG_COS_COUNT_1, REG_COS_COUNT_2, and
>>> >> + * REG_PR_OLD_COUNT values to avoid LCDC DMA FIFO underflows and Frame
>>> >> + * Synchronization Lost errors.
>>> >> + */
>>> >> +#define EMIF_OCP_CONFIG_BEAGLEBONE_BLACK	0x00141414
>>> >> +#define EMIF_OCP_CONFIG_AM335X_EVM		0x003d3d3d
>> > 
>> > OK, but the problems I see are that first we don't explain what these
>> > values are tied to physically.  Is it the display? The DDR memory?
> It is a combination of both. I'll add that to the comment.
> 
>> > Second, since these are board specific they should be in
>> > board/ti/am335x/board.h.  Thanks!
>> > 
> Ok, I'll move the defines there.

Hmmmm, there there are no defined constants in board/ti/am335x/board.h.
Should I just put the constants above, with improved comment, somewhere
in that file?

Best regards,
Jyri

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] arm: am33xx: Initialize EMIF REG_PR_OLD_COUNT for BBB and am335x-evm
  2016-12-02 16:24     ` Jyri Sarha
@ 2016-12-02 20:17       ` Tom Rini
  0 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2016-12-02 20:17 UTC (permalink / raw)
  To: u-boot

On Fri, Dec 02, 2016 at 06:24:49PM +0200, Jyri Sarha wrote:
> On 12/02/16 15:06, Jyri Sarha wrote:
> >>> diff --git a/arch/arm/include/asm/arch-am33xx/ddr_defs.h b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
> >>> >> index 43e122e..c71cfd0 100644
> >>> >> --- a/arch/arm/include/asm/arch-am33xx/ddr_defs.h
> >>> >> +++ b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
> >>> >> @@ -25,6 +25,14 @@
> >>> >>  #endif
> >>> >>  #define PHY_EN_DYN_PWRDN	(0x1 << 20)
> >>> >>  
> >>> >> +/**
> >>> >> + * AM335X (EMIF_4D) EMIF REG_COS_COUNT_1, REG_COS_COUNT_2, and
> >>> >> + * REG_PR_OLD_COUNT values to avoid LCDC DMA FIFO underflows and Frame
> >>> >> + * Synchronization Lost errors.
> >>> >> + */
> >>> >> +#define EMIF_OCP_CONFIG_BEAGLEBONE_BLACK	0x00141414
> >>> >> +#define EMIF_OCP_CONFIG_AM335X_EVM		0x003d3d3d
> >> > 
> >> > OK, but the problems I see are that first we don't explain what these
> >> > values are tied to physically.  Is it the display? The DDR memory?
> > It is a combination of both. I'll add that to the comment.
> > 
> >> > Second, since these are board specific they should be in
> >> > board/ti/am335x/board.h.  Thanks!
> >> > 
> > Ok, I'll move the defines there.
> 
> Hmmmm, there there are no defined constants in board/ti/am335x/board.h.
> Should I just put the constants above, with improved comment, somewhere
> in that file?

Yes, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161202/2aafc97e/attachment.sig>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-12-02 20:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-02  7:54 [U-Boot] [PATCH] arm: am33xx: Initialize EMIF REG_PR_OLD_COUNT for BBB and am335x-evm Jyri Sarha
2016-12-02 13:01 ` Tom Rini
2016-12-02 13:06   ` Jyri Sarha
2016-12-02 16:24     ` Jyri Sarha
2016-12-02 20:17       ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox