All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Kipisz <s-kipisz2@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V5 1/7] ARM: OMAP4/5: Centralize early clock initialization
Date: Wed, 24 Feb 2016 12:30:52 -0600	[thread overview]
Message-ID: <1456338658-5027-2-git-send-email-s-kipisz2@ti.com> (raw)
In-Reply-To: <1456338658-5027-1-git-send-email-s-kipisz2@ti.com>

Early clock initialization is currently done in two stages for OMAP4/5
SoCs. The first stage is the initialization of console clocks and
then we initialize basic clocks for functionality necessary for SoC
initialization and basic board functionality.

By splitting up prcm_init and centralizing this clock initialization,
we setup the code for follow on patches that can do board specific
initialization such as board detection which will depend on these
basic clocks.

As part of this change, since the early clock initialization
is centralized, we no longer need to expose the console clock
initialization.

NOTE: we change the sequence slightly by initializing console clocks
timer after the io settings are complete, but this is not expected
to have any functioanlity impact since we setup the basic IO drive
strength initialization as part of do_io_settings.

Signed-off-by: Steve Kipisz <s-kipisz2@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
---
V5: No changes
v4: https://patchwork.ozlabs.org/patch/540775/
v3:  https://patchwork.ozlabs.org/patch/540193/

v2:  http://marc.info/?t=144655363000001&r=1&w=2
      (mailing list squashed original submission)

v1:  Did not exist

 arch/arm/cpu/armv7/omap-common/clocks-common.c | 21 +++++++++++++++++++--
 arch/arm/cpu/armv7/omap-common/hwinit-common.c |  3 +--
 arch/arm/include/asm/arch-omap4/sys_proto.h    |  2 +-
 arch/arm/include/asm/arch-omap5/sys_proto.h    |  2 +-
 4 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap-common/clocks-common.c b/arch/arm/cpu/armv7/omap-common/clocks-common.c
index e28b79568d1d..367d224361be 100644
--- a/arch/arm/cpu/armv7/omap-common/clocks-common.c
+++ b/arch/arm/cpu/armv7/omap-common/clocks-common.c
@@ -769,7 +769,7 @@ void lock_dpll(u32 const base)
 	wait_for_lock(base);
 }
 
-void setup_clocks_for_console(void)
+static void setup_clocks_for_console(void)
 {
 	/* Do not add any spl_debug prints in this function */
 	clrsetbits_le32((*prcm)->cm_l4per_clkstctrl, CD_CLKCTRL_CLKTRCTRL_MASK,
@@ -853,14 +853,31 @@ void do_disable_clocks(u32 const *clk_domains,
 		disable_clock_domain(clk_domains[i]);
 }
 
-void prcm_init(void)
+/**
+ * setup_early_clocks() - Setup early clocks needed for SoC
+ *
+ * Setup clocks for console, SPL basic initialization clocks and initialize
+ * the timer. This is invoked prior prcm_init.
+ */
+void setup_early_clocks(void)
 {
 	switch (omap_hw_init_context()) {
 	case OMAP_INIT_CONTEXT_SPL:
 	case OMAP_INIT_CONTEXT_UBOOT_FROM_NOR:
 	case OMAP_INIT_CONTEXT_UBOOT_AFTER_CH:
+		setup_clocks_for_console();
 		enable_basic_clocks();
 		timer_init();
+		/* Fall through */
+	}
+}
+
+void prcm_init(void)
+{
+	switch (omap_hw_init_context()) {
+	case OMAP_INIT_CONTEXT_SPL:
+	case OMAP_INIT_CONTEXT_UBOOT_FROM_NOR:
+	case OMAP_INIT_CONTEXT_UBOOT_AFTER_CH:
 		scale_vcores(*omap_vcores);
 		setup_dplls();
 		setup_warmreset_time();
diff --git a/arch/arm/cpu/armv7/omap-common/hwinit-common.c b/arch/arm/cpu/armv7/omap-common/hwinit-common.c
index 80794f9c611a..91f2dead364b 100644
--- a/arch/arm/cpu/armv7/omap-common/hwinit-common.c
+++ b/arch/arm/cpu/armv7/omap-common/hwinit-common.c
@@ -125,10 +125,9 @@ void s_init(void)
 	set_mux_conf_regs();
 #ifdef CONFIG_SPL_BUILD
 	srcomp_enable();
-	setup_clocks_for_console();
-
 	do_io_settings();
 #endif
+	setup_early_clocks();
 	prcm_init();
 }
 
diff --git a/arch/arm/include/asm/arch-omap4/sys_proto.h b/arch/arm/include/asm/arch-omap4/sys_proto.h
index f30f86539130..71e3d776aa0d 100644
--- a/arch/arm/include/asm/arch-omap4/sys_proto.h
+++ b/arch/arm/include/asm/arch-omap4/sys_proto.h
@@ -37,7 +37,7 @@ void do_set_mux(u32 base, struct pad_conf_entry const *array, int size);
 void set_muxconf_regs_essential(void);
 u32 wait_on_value(u32, u32, void *, u32);
 void sdelay(unsigned long);
-void setup_clocks_for_console(void);
+void setup_early_clocks(void);
 void prcm_init(void);
 void bypass_dpll(u32 const base);
 void freq_update_core(void);
diff --git a/arch/arm/include/asm/arch-omap5/sys_proto.h b/arch/arm/include/asm/arch-omap5/sys_proto.h
index 7fcb78389403..b9e09e7c52a8 100644
--- a/arch/arm/include/asm/arch-omap5/sys_proto.h
+++ b/arch/arm/include/asm/arch-omap5/sys_proto.h
@@ -48,7 +48,7 @@ void do_set_mux32(u32 base, struct pad_conf_entry const *array, int size);
 void set_muxconf_regs_essential(void);
 u32 wait_on_value(u32, u32, void *, u32);
 void sdelay(unsigned long);
-void setup_clocks_for_console(void);
+void setup_early_clocks(void);
 void prcm_init(void);
 void bypass_dpll(u32 const base);
 void freq_update_core(void);
-- 
2.7.0

  reply	other threads:[~2016-02-24 18:30 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-24 18:30 [U-Boot] [PATCH V5 0/7] ARM: omap-common: Add board detection support for TI EVMs Steve Kipisz
2016-02-24 18:30 ` Steve Kipisz [this message]
2016-02-26 18:17   ` [U-Boot] [PATCH V5 1/7] ARM: OMAP4/5: Centralize early clock initialization Tom Rini
2016-03-15 11:55   ` [U-Boot] [U-Boot, V5, " Tom Rini
2016-02-24 18:30 ` [U-Boot] [PATCH V5 2/7] ARM: OMAP4/5: Centralize gpi2c_init Steve Kipisz
2016-02-26 18:17   ` Tom Rini
2016-03-15 11:55   ` [U-Boot] [U-Boot,V5,2/7] " Tom Rini
2016-02-24 18:30 ` [U-Boot] [PATCH V5 3/7] ARM: omap-common: Add standard access for board description EEPROM Steve Kipisz
2016-02-26 18:17   ` Tom Rini
2016-03-15 11:55   ` [U-Boot] [U-Boot, V5, " Tom Rini
2016-02-24 18:30 ` [U-Boot] [PATCH V5 4/7] ti: AM335x: Use generic EEPROM detection logic Steve Kipisz
2016-02-26 18:17   ` Tom Rini
2016-03-15 11:56   ` [U-Boot] [U-Boot, V5, " Tom Rini
2016-02-24 18:30 ` [U-Boot] [PATCH V5 5/7] ti: AM437x: " Steve Kipisz
2016-02-26 18:17   ` Tom Rini
2016-03-15 11:56   ` [U-Boot] [U-Boot, V5, " Tom Rini
2016-02-24 18:30 ` [U-Boot] [PATCH V5 6/7] ARM: OMAP4/5: Add generic board detection hook Steve Kipisz
2016-02-26 18:17   ` Tom Rini
2016-03-15 11:56   ` [U-Boot] [U-Boot, V5, " Tom Rini
2016-02-24 18:30 ` [U-Boot] [PATCH V5 7/7] board: ti: AM57xx: Add detection logic for AM57xx-evm Steve Kipisz
2016-02-25  7:06   ` Lokesh Vutla
2016-02-25 14:52     ` Nishanth Menon
2016-02-26 18:17   ` Tom Rini
2016-03-15 11:56   ` [U-Boot] [U-Boot, V5, " Tom Rini
2016-02-26 18:17 ` [U-Boot] [PATCH V5 0/7] ARM: omap-common: Add board detection support for TI EVMs Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1456338658-5027-2-git-send-email-s-kipisz2@ti.com \
    --to=s-kipisz2@ti.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.