mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] i.MX53 lowlevel work
@ 2013-04-03  7:09 Sascha Hauer
  2013-04-03  7:09 ` [PATCH 1/4] ARM: i.MX53: Fix pll216 setup Sascha Hauer
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Sascha Hauer @ 2013-04-03  7:09 UTC (permalink / raw)
  To: barebox

These are some early setup fixes for i.MX53. First PLL3 was initialized
to 432MHz instead of what the code claims (and what U-Boot does) to 216MHz.
We now really initialize it to 216MHz.
Second the imx53_init_lowlevel code was not really save for calling from
early code due to a call to clock_notifier_call_chain() inside. This fixes
this.

Sascha

----------------------------------------------------------------
Sascha Hauer (4):
      ARM: i.MX53: Fix pll216 setup
      ARM: i.MX53: split lowlevel function into early/nonearly version
      ARM: tx53: use early lowlevel function
      ARM: tqma53: call SoC lowlevel function early

 arch/arm/boards/karo-tx53/lowlevel.c  |  2 +-
 arch/arm/boards/tqma53/board.c        |  1 -
 arch/arm/boards/tqma53/lowlevel.c     |  2 ++
 arch/arm/mach-imx/imx51.c             |  2 +-
 arch/arm/mach-imx/imx53.c             | 14 +++++++++-----
 arch/arm/mach-imx/include/mach/imx5.h |  4 ++--
 6 files changed, 15 insertions(+), 10 deletions(-)

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

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

* [PATCH 1/4] ARM: i.MX53: Fix pll216 setup
  2013-04-03  7:09 [PATCH] i.MX53 lowlevel work Sascha Hauer
@ 2013-04-03  7:09 ` Sascha Hauer
  2013-04-03  7:09 ` [PATCH 2/4] ARM: i.MX53: split lowlevel function into early/nonearly version Sascha Hauer
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2013-04-03  7:09 UTC (permalink / raw)
  To: barebox

The value for i.MX53 216MHz is actually 432MHz. Use the same value
as for i.MX51 which really corresponds to 216MHz. These are the same
PLL216 values as U-Boot uses.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-imx/imx51.c             | 2 +-
 arch/arm/mach-imx/imx53.c             | 2 +-
 arch/arm/mach-imx/include/mach/imx5.h | 3 +--
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-imx/imx51.c b/arch/arm/mach-imx/imx51.c
index cffcca3..737ab9b 100644
--- a/arch/arm/mach-imx/imx51.c
+++ b/arch/arm/mach-imx/imx51.c
@@ -151,7 +151,7 @@ void imx51_init_lowlevel(unsigned int cpufreq_mhz)
 	writel(0x19239145, ccm + MX5_CCM_CBCDR);
 	writel(0x000020C0, ccm + MX5_CCM_CBCMR);
 
-	imx51_setup_pll_216((void __iomem *)MX51_PLL3_BASE_ADDR);
+	imx5_setup_pll_216((void __iomem *)MX51_PLL3_BASE_ADDR);
 
 	/* Set the platform clock dividers */
 	writel(0x00000124, MX51_ARM_BASE_ADDR + 0x14);
diff --git a/arch/arm/mach-imx/imx53.c b/arch/arm/mach-imx/imx53.c
index 3135ada..b06a5d0 100644
--- a/arch/arm/mach-imx/imx53.c
+++ b/arch/arm/mach-imx/imx53.c
@@ -146,7 +146,7 @@ void imx53_init_lowlevel(unsigned int cpufreq_mhz)
 	/* make sure change is effective */
 	while (readl(ccm + MX5_CCM_CDHIPR));
 
-	imx53_setup_pll_216((void __iomem *)MX53_PLL3_BASE_ADDR);
+	imx5_setup_pll_216((void __iomem *)MX53_PLL3_BASE_ADDR);
 	imx5_setup_pll_455((void __iomem *)MX53_PLL4_BASE_ADDR);
 
 	/* Set the platform clock dividers */
diff --git a/arch/arm/mach-imx/include/mach/imx5.h b/arch/arm/mach-imx/include/mach/imx5.h
index cd0a347..ff570c4 100644
--- a/arch/arm/mach-imx/include/mach/imx5.h
+++ b/arch/arm/mach-imx/include/mach/imx5.h
@@ -13,7 +13,6 @@ void imx5_setup_pll(void __iomem *base, int freq, u32 op, u32 mfd, u32 mfn);
 #define imx5_setup_pll_600(base)	imx5_setup_pll((base),  600, (( 6 << 4) + ((1 - 1) << 0)), ( 4 - 1),  1)
 #define imx5_setup_pll_455(base)	imx5_setup_pll((base),  455, (( 9 << 4) + ((2 - 1) << 0)), (48 - 1), 23)
 #define imx5_setup_pll_400(base)	imx5_setup_pll((base),  400, (( 8 << 4) + ((2 - 1) << 0)), (3 - 1), 1)
-#define imx53_setup_pll_216(base)	imx5_setup_pll((base),  216, (( 8 << 4) + ((2 - 1) << 0)), (1 - 1), 1)
-#define imx51_setup_pll_216(base)	imx5_setup_pll((base),  216, (( 6 << 4) + ((3 - 1) << 0)), (4 - 1), 3)
+#define imx5_setup_pll_216(base)	imx5_setup_pll((base),  216, (( 6 << 4) + ((3 - 1) << 0)), (4 - 1), 3)
 
 #endif /* __MACH_MX53_H */
-- 
1.8.2.rc2


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

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

* [PATCH 2/4] ARM: i.MX53: split lowlevel function into early/nonearly version
  2013-04-03  7:09 [PATCH] i.MX53 lowlevel work Sascha Hauer
  2013-04-03  7:09 ` [PATCH 1/4] ARM: i.MX53: Fix pll216 setup Sascha Hauer
@ 2013-04-03  7:09 ` Sascha Hauer
  2013-04-03  7:09 ` [PATCH 3/4] ARM: tx53: use early lowlevel function Sascha Hauer
  2013-04-03  7:09 ` [PATCH 4/4] ARM: tqma53: call SoC lowlevel function early Sascha Hauer
  3 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2013-04-03  7:09 UTC (permalink / raw)
  To: barebox

clock_notifier_call_chain() can't be called before init time. Protecting
it with IS_ENABLED(__PBL__) is not enough. This patch splits out a new
imx53_init_lowlevel_early which can be called before init time and does
not have the call to clock_notifier_call_chain() in it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-imx/imx53.c             | 12 ++++++++----
 arch/arm/mach-imx/include/mach/imx5.h |  1 +
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-imx/imx53.c b/arch/arm/mach-imx/imx53.c
index b06a5d0..193406f 100644
--- a/arch/arm/mach-imx/imx53.c
+++ b/arch/arm/mach-imx/imx53.c
@@ -75,7 +75,7 @@ static int imx53_init(void)
 }
 postcore_initcall(imx53_init);
 
-void imx53_init_lowlevel(unsigned int cpufreq_mhz)
+void imx53_init_lowlevel_early(unsigned int cpufreq_mhz)
 {
 	void __iomem *ccm = (void __iomem *)MX53_CCM_BASE_ADDR;
 	u32 r;
@@ -188,8 +188,12 @@ void imx53_init_lowlevel(unsigned int cpufreq_mhz)
 	writel(0xffffffff, ccm + MX5_CCM_CCGR6);
 	writel(0xffffffff, ccm + MX53_CCM_CCGR7);
 
-	if (!IS_ENABLED(__PBL__))
-		clock_notifier_call_chain();
-
 	writel(0, ccm + MX5_CCM_CCDR);
 }
+
+void imx53_init_lowlevel(unsigned int cpufreq_mhz)
+{
+	imx53_init_lowlevel_early(cpufreq_mhz);
+
+	clock_notifier_call_chain();
+}
diff --git a/arch/arm/mach-imx/include/mach/imx5.h b/arch/arm/mach-imx/include/mach/imx5.h
index ff570c4..7f5c2ef 100644
--- a/arch/arm/mach-imx/include/mach/imx5.h
+++ b/arch/arm/mach-imx/include/mach/imx5.h
@@ -3,6 +3,7 @@
 
 void imx51_init_lowlevel(unsigned int cpufreq_mhz);
 void imx53_init_lowlevel(unsigned int cpufreq_mhz);
+void imx53_init_lowlevel_early(unsigned int cpufreq_mhz);
 void imx5_init_lowlevel(void);
 
 void imx5_setup_pll(void __iomem *base, int freq, u32 op, u32 mfd, u32 mfn);
-- 
1.8.2.rc2


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

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

* [PATCH 3/4] ARM: tx53: use early lowlevel function
  2013-04-03  7:09 [PATCH] i.MX53 lowlevel work Sascha Hauer
  2013-04-03  7:09 ` [PATCH 1/4] ARM: i.MX53: Fix pll216 setup Sascha Hauer
  2013-04-03  7:09 ` [PATCH 2/4] ARM: i.MX53: split lowlevel function into early/nonearly version Sascha Hauer
@ 2013-04-03  7:09 ` Sascha Hauer
  2013-04-03  7:09 ` [PATCH 4/4] ARM: tqma53: call SoC lowlevel function early Sascha Hauer
  3 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2013-04-03  7:09 UTC (permalink / raw)
  To: barebox

The tx53 calls imx53_init_lowlevel from early code, so use
imx53_init_lowlevel_early instead.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/karo-tx53/lowlevel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boards/karo-tx53/lowlevel.c b/arch/arm/boards/karo-tx53/lowlevel.c
index 32d2c8f..f47f260 100644
--- a/arch/arm/boards/karo-tx53/lowlevel.c
+++ b/arch/arm/boards/karo-tx53/lowlevel.c
@@ -14,7 +14,7 @@ void __naked barebox_arm_reset_vector(void)
 	 * so do the PLL setup here.
 	 */
 	if (IS_ENABLED(CONFIG_TX53_REV_XX30))
-		imx53_init_lowlevel(800);
+		imx53_init_lowlevel_early(800);
 
 	imx53_barebox_entry(0);
 }
-- 
1.8.2.rc2


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

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

* [PATCH 4/4] ARM: tqma53: call SoC lowlevel function early
  2013-04-03  7:09 [PATCH] i.MX53 lowlevel work Sascha Hauer
                   ` (2 preceding siblings ...)
  2013-04-03  7:09 ` [PATCH 3/4] ARM: tx53: use early lowlevel function Sascha Hauer
@ 2013-04-03  7:09 ` Sascha Hauer
  2013-04-10 19:37   ` Eric Bénard
  3 siblings, 1 reply; 6+ messages in thread
From: Sascha Hauer @ 2013-04-03  7:09 UTC (permalink / raw)
  To: barebox

With CONFIG_MMU_EARLY enabled the board does not survive the call
to imx53_init_lowlevel(). This should not happen, but the reasons
are currently unknown. This works on other boards like the i.MX53
QSB.
This patch moves the call to imx53_init_lowlevel to
barebox_arm_reset_vector() which is executed with MMU disabled.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/tqma53/board.c    | 1 -
 arch/arm/boards/tqma53/lowlevel.c | 2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boards/tqma53/board.c b/arch/arm/boards/tqma53/board.c
index 03cb8ea..432f29f 100644
--- a/arch/arm/boards/tqma53/board.c
+++ b/arch/arm/boards/tqma53/board.c
@@ -253,7 +253,6 @@ late_initcall(tqma53_part_init);
 static int tqma53_console_init(void)
 {
 	mxc_iomux_v3_setup_multiple_pads(tqma53_pads, ARRAY_SIZE(tqma53_pads));
-	imx53_init_lowlevel(800);
 	imx53_add_uart0();
 
 	return 0;
diff --git a/arch/arm/boards/tqma53/lowlevel.c b/arch/arm/boards/tqma53/lowlevel.c
index 60c28f7..a6eaa46 100644
--- a/arch/arm/boards/tqma53/lowlevel.c
+++ b/arch/arm/boards/tqma53/lowlevel.c
@@ -1,9 +1,11 @@
 #include <common.h>
 #include <mach/esdctl.h>
 #include <asm/barebox-arm-head.h>
+#include <mach/imx5.h>
 
 void __naked barebox_arm_reset_vector(void)
 {
 	arm_cpu_lowlevel_init();
+	imx53_init_lowlevel_early(800);
 	imx53_barebox_entry(0);
 }
-- 
1.8.2.rc2


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

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

* Re: [PATCH 4/4] ARM: tqma53: call SoC lowlevel function early
  2013-04-03  7:09 ` [PATCH 4/4] ARM: tqma53: call SoC lowlevel function early Sascha Hauer
@ 2013-04-10 19:37   ` Eric Bénard
  0 siblings, 0 replies; 6+ messages in thread
From: Eric Bénard @ 2013-04-10 19:37 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Hi Sacha,

Le Wed,  3 Apr 2013 09:09:40 +0200,
Sascha Hauer <s.hauer@pengutronix.de> a écrit :

> With CONFIG_MMU_EARLY enabled the board does not survive the call
> to imx53_init_lowlevel(). This should not happen, but the reasons
> are currently unknown. This works on other boards like the i.MX53
> QSB.
> This patch moves the call to imx53_init_lowlevel to
> barebox_arm_reset_vector() which is executed with MMU disabled.
> 
FWIW : on the QSB I also met this kind of problem :
- when the board is configured for serial download boot (bootmode 0
  & 1 = 1) : barebox fails to execute if MMU is enabled
- when the board is configured for usual SDCard boot and the SDCard is
  not inserted, the bootrom falls back to serial download mode and
  then barebox runs fine even with MMU enabled.

Best regards,
Eric

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

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

end of thread, other threads:[~2013-04-10 19:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-03  7:09 [PATCH] i.MX53 lowlevel work Sascha Hauer
2013-04-03  7:09 ` [PATCH 1/4] ARM: i.MX53: Fix pll216 setup Sascha Hauer
2013-04-03  7:09 ` [PATCH 2/4] ARM: i.MX53: split lowlevel function into early/nonearly version Sascha Hauer
2013-04-03  7:09 ` [PATCH 3/4] ARM: tx53: use early lowlevel function Sascha Hauer
2013-04-03  7:09 ` [PATCH 4/4] ARM: tqma53: call SoC lowlevel function early Sascha Hauer
2013-04-10 19:37   ` Eric Bénard

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