ARM: AM33xx: Cleanup clocks and hwinit
Subsystems (2)
cover ARM: AM33xx: Cleanup clocks and hwinit
This series tries to cleanup code for AM33xx, inorder to ensure code reusabilty by moving the duplicated code to common place.
This also helps in addition of new Soc with minimal changes.
Testing:
Boot tested on BeagleBone White/Black, AM35xx EVM, TI814x. Verified MAKEALL for armv7 and am33xx boards.
This series is on top of u-boot merged with u-boot-arm.
Heiko Schocher (1):
ARM: AM33xx: Move s_init to a common place
Lokesh Vutla (3):
ARM: AM33xx: Cleanup dplls data
ARM: AM33xx: Cleanup clocks layer
musb: Disable extra prints
arch/arm/cpu/armv7/am33xx/Makefile | 1 + arch/arm/cpu/armv7/am33xx/board.c | 52 ++- arch/arm/cpu/armv7/am33xx/clock.c | 176 ++++++++ arch/arm/cpu/armv7/am33xx/clock_am33xx.c | 497 +++++----------------- arch/arm/cpu/armv7/am33xx/clock_ti814x.c | 25 +- arch/arm/cpu/armv7/am33xx/emif4.c | 11 +- arch/arm/include/asm/arch-am33xx/clock.h | 92 ++++ arch/arm/include/asm/arch-am33xx/clocks_am33xx.h | 6 +- arch/arm/include/asm/arch-am33xx/sys_proto.h | 6 +- board/isee/igep0033/board.c | 48 +-- board/phytec/pcm051/board.c | 48 +-- board/ti/am335x/board.c | 50 +-- board/ti/ti814x/evm.c | 65 +-- drivers/usb/musb-new/musb_core.c | 18 +- 14 files changed, 498 insertions(+), 597 deletions(-) create mode 100644 arch/arm/cpu/armv7/am33xx/clock.c
Signature · 1 line
1.7.9.5
PATCH 1/4 ARM: AM33xx: Cleanup dplls data
Locking sequence for all the dplls is same. In the current code same sequence is done repeatedly for each dpll. Instead have a generic function for locking dplls and pass dpll data to that function.
This is derived from OMAP4 boards.
--- arch/arm/cpu/armv7/am33xx/Makefile | 1 + arch/arm/cpu/armv7/am33xx/clock.c | 116 ++++++++++++++ arch/arm/cpu/armv7/am33xx/clock_am33xx.c | 222 +++++--------------------- arch/arm/cpu/armv7/am33xx/emif4.c | 4 + arch/arm/include/asm/arch-am33xx/clock.h | 68 ++++++++ arch/arm/include/asm/arch-am33xx/ddr_defs.h | 2 + arch/arm/include/asm/arch-am33xx/sys_proto.h | 1 + 7 files changed, 232 insertions(+), 182 deletions(-) create mode 100644 arch/arm/cpu/armv7/am33xx/clock.c
arch/arm/cpu/armv7/am33xx/Makefile +1 -0
@@ -18,6 +18,7 @@ LIB = $(obj)lib$(SOC).o COBJS-$(CONFIG_AM33XX) += clock_am33xx.o COBJS-$(CONFIG_TI814X) += clock_ti814x.o +COBJS-$(CONFIG_AM33XX) += clock.o COBJS += sys_info.o COBJS += mem.o COBJS += ddr.o
arch/arm/cpu/armv7/am33xx/clock.c new file +116 -0
116 lines not on this page · raw message
arch/arm/cpu/armv7/am33xx/clock_am33xx.c +40 -182
248 lines not on this page · raw message
arch/arm/cpu/armv7/am33xx/emif4.c +4 -0
@@ -83,6 +83,10 @@ static void config_vtp(int nr) ; } +void __weak ddr_pll_config (unsigned int ddrpll_m) +{ +} +void config_ddr (unsigned int pll,unsigned int ioctrl,const struct ddr_data *data,const struct cmd_control *ctrl,const struct emif_regs *regs,int nr)
arch/arm/include/asm/arch-am33xx/clock.h +68 -0
72 lines not on this page · raw message
arch/arm/include/asm/arch-am33xx/ddr_defs.h +2 -0
@@ -154,6 +154,8 @@ void set_sdram_timings(const struct emif_regs *regs, int nr);*/ void config_ddr_phy (const struct emif_regs *regs,int nr); +void ddr_pll_config (unsigned int ddrpll_m); +struct ddr_cmd_regs {unsigned int resv0[7 ];unsigned int cm0csratio;/* offset 0x01C */
arch/arm/include/asm/arch-am33xx/sys_proto.h +1 -0
@@ -45,4 +45,5 @@ void omap_nand_switch_ecc(uint32_t, uint32_t);void rtc32k_enable (void );void uart_soft_reset (void ); +u32 wait_on_value (u32 ,u32 ,void *,u32 );#endif
Signature · 1 line
1.7.9.5
PATCH 1/4 ARM: AM33xx: Cleanup dplls data
Hello Lokesh,
Am 24.06.2013 15:15, schrieb Lokesh Vutla:
Quoted 19 lines
Locking sequence for all the dplls is same. In the current code same sequence is done repeatedly for each dpll. Instead have a generic function for locking dplls and pass dpll data to that function.
This is derived from OMAP4 boards.
Signed-off-by Lokesh Vutla <[email protected]>--- arch/arm/cpu/armv7/am33xx/Makefile | 1 + arch/arm/cpu/armv7/am33xx/clock.c | 116 ++++++++++++++ arch/arm/cpu/armv7/am33xx/clock_am33xx.c | 222 +++++--------------------- arch/arm/cpu/armv7/am33xx/emif4.c | 4 + arch/arm/include/asm/arch-am33xx/clock.h | 68 ++++++++ arch/arm/include/asm/arch-am33xx/ddr_defs.h | 2 + arch/arm/include/asm/arch-am33xx/sys_proto.h | 1 + 7 files changed, 232 insertions(+), 182 deletions(-) create mode 100644 arch/arm/cpu/armv7/am33xx/clock.c
[...]
Quoted 6 lines
arch/arm/cpu/armv7/am33xx/clock.c new file +0
-0@@ -0,0 +1,116 @@
[...]
arch/arm/cpu/armv7/am33xx/clock.c line 83
Quoted 3 lines
arch/arm/cpu/armv7/am33xx/clock.c new file +3
-0+static void do_setup_dpll (const struct dpll_regs *dpll_regs, +const struct dpll_params *params) +{
Could we have this function not only static? I posted a patch:
[U-Boot] arm, am335x: make mpu pll config configurable
http://patchwork.ozlabs.org/patch/248509/
which uses mpu_pll_config() for switching mpu pll clock from board code ... you delete this function later in this patch, so I think, I can switch to do_setup_pll() ... if this is not static code ...
[...]
Quoted 15 lines
arch/arm/cpu/armv7/am33xx/clock_am33xx.c +0
-7@@ -26,56 +26,53 @@#define PRCM_FORCE_WAKEUP 0x2#define PRCM_FUNCTL 0x0 -#define PRCM_EMIF_CLK_ACTIVITY BIT(2) -#define PRCM_L3_GCLK_ACTIVITY BIT(4) - -#define PLL_BYPASS_MODE 0x4 -#define ST_MN_BYPASS 0x00000100 -#define ST_DPLL_CLK 0x00000001 -#define CLK_SEL_MASK 0x7ffff
arch/arm/cpu/armv7/am33xx/clock_am33xx.c line 30
Quoted 10 lines
arch/arm/cpu/armv7/am33xx/clock_am33xx.c +0
-8-#define CLK_DIV_MASK 0x1f -#define CLK_DIV2_MASK 0x7f -#define CLK_SEL_SHIFT 0x8 -#define CLK_MODE_SEL 0x7 -#define CLK_MODE_MASK 0xfffffff8 -#define CLK_DIV_SEL 0xFFFFFFE0#define CPGMAC0_IDLE 0x30000 -#define DPLL_CLKDCOLDO_GATE_CTRL 0x300 -#define OSC (V_OSCK/1000000)
and could we move this define then toarch/arm/include/asm/arch-am33xx/clock.h
too?
Thnaks!
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 1/4 ARM: AM33xx: Cleanup dplls data
Hi Heiko,
Quoted 36 lines · Heiko Schocher
Hello Lokesh,
Am 24.06.2013 15:15, schrieb Lokesh Vutla:
Quoted 19 lines
Locking sequence for all the dplls is same. In the current code same sequence is done repeatedly for each dpll. Instead have a generic function for locking dplls and pass dpll data to that function.
This is derived from OMAP4 boards.
Signed-off-by Lokesh Vutla <[email protected]>--- arch/arm/cpu/armv7/am33xx/Makefile | 1 + arch/arm/cpu/armv7/am33xx/clock.c | 116 ++++++++++++++ arch/arm/cpu/armv7/am33xx/clock_am33xx.c | 222 +++++--------------------- arch/arm/cpu/armv7/am33xx/emif4.c | 4 + arch/arm/include/asm/arch-am33xx/clock.h | 68 ++++++++ arch/arm/include/asm/arch-am33xx/ddr_defs.h | 2 + arch/arm/include/asm/arch-am33xx/sys_proto.h | 1 + 7 files changed, 232 insertions(+), 182 deletions(-)create mode 100644
arch/arm/cpu/armv7/am33xx/clock.c[...]
Quoted 6 lines
arch/arm/cpu/armv7/am33xx/clock.c new file +0
-0@@ -0,0 +1,116 @@[...]
arch/arm/cpu/armv7/am33xx/clock.c line 83
Quoted 3 lines
arch/arm/cpu/armv7/am33xx/clock.c new file +3
-0+static void do_setup_dpll (const struct dpll_regs *dpll_regs, +const struct dpll_params *params) +{Could we have this function not only static? I posted a patch:
Quoted 7 lines
[U-Boot] arm, am335x: make mpu pll config configurable
http://patchwork.ozlabs.org/patch/248509/which uses
mpu_pll_config()for switching mpu pll clock from board code ... you delete this function later in this patch, so I think, I can switch todo_setup_pll()... if this is not static code ...
Yes I saw that patch. No need to make this non-static. Please have your own struct "const struct dpll_params dpll_mpu" and update your values accordingly.
Thanks and regards,
Lokesh
Quoted 37 lines
[...]
Quoted 15 lines
arch/arm/cpu/armv7/am33xx/clock_am33xx.c +0
-7@@ -26,56 +26,53 @@#define PRCM_FORCE_WAKEUP 0x2#define PRCM_FUNCTL 0x0 -#define PRCM_EMIF_CLK_ACTIVITY BIT(2) -#define PRCM_L3_GCLK_ACTIVITY BIT(4) - -#define PLL_BYPASS_MODE 0x4 -#define ST_MN_BYPASS 0x00000100 -#define ST_DPLL_CLK 0x00000001 -#define CLK_SEL_MASK 0x7ffffarch/arm/cpu/armv7/am33xx/clock_am33xx.c line 30
Quoted 10 lines
arch/arm/cpu/armv7/am33xx/clock_am33xx.c +0
-8-#define CLK_DIV_MASK 0x1f -#define CLK_DIV2_MASK 0x7f -#define CLK_SEL_SHIFT 0x8 -#define CLK_MODE_SEL 0x7 -#define CLK_MODE_MASK 0xfffffff8 -#define CLK_DIV_SEL 0xFFFFFFE0#define CPGMAC0_IDLE 0x30000 -#define DPLL_CLKDCOLDO_GATE_CTRL 0x300 -#define OSC (V_OSCK/1000000)and could we move this define then to
arch/arm/include/asm/arch-am33xx/clock.h
too?Thnaks!
bye,
Heiko
PATCH 1/4 ARM: AM33xx: Cleanup dplls data
Hello Lokesh,
Am 25.06.2013 05:48, schrieb Lokesh Vutla:
Quoted 41 lines
Hi Heiko,
Quoted 39 lines · Heiko Schocher
Hello Lokesh,
Am 24.06.2013 15:15, schrieb Lokesh Vutla:
Quoted 19 lines
Locking sequence for all the dplls is same. In the current code same sequence is done repeatedly for each dpll. Instead have a generic function for locking dplls and pass dpll data to that function.
This is derived from OMAP4 boards.
Signed-off-by Lokesh Vutla <[email protected]>--- arch/arm/cpu/armv7/am33xx/Makefile | 1 + arch/arm/cpu/armv7/am33xx/clock.c | 116 ++++++++++++++ arch/arm/cpu/armv7/am33xx/clock_am33xx.c | 222 +++++--------------------- arch/arm/cpu/armv7/am33xx/emif4.c | 4 + arch/arm/include/asm/arch-am33xx/clock.h | 68 ++++++++ arch/arm/include/asm/arch-am33xx/ddr_defs.h | 2 + arch/arm/include/asm/arch-am33xx/sys_proto.h | 1 + 7 files changed, 232 insertions(+), 182 deletions(-)create mode 100644
arch/arm/cpu/armv7/am33xx/clock.c[...]
Quoted 6 lines
arch/arm/cpu/armv7/am33xx/clock.c new file +0
-0@@ -0,0 +1,116 @@[...]
arch/arm/cpu/armv7/am33xx/clock.c line 83
Quoted 3 lines
arch/arm/cpu/armv7/am33xx/clock.c new file +3
-0+static void do_setup_dpll (const struct dpll_regs *dpll_regs, +const struct dpll_params *params) +{Could we have this function not only static? I posted a patch:
[U-Boot] arm, am335x: make mpu pll config configurable
http://patchwork.ozlabs.org/patch/248509/
Quoted 7 lines
Quoted 4 lines
which uses
mpu_pll_config()for switching mpu pll clock from board code ... you delete this function later in this patch, so I think, I can switch todo_setup_pll()... if this is not static code ...Yes I saw that patch. No need to make this non-static. Please have your own struct "const struct
dpll_paramsdpll_mpu" and update your values accordingly.
Hmm.. maybe I miss something here. You call setup_dplls() in arch/arm/cpu/armv7/am33xx/clock.c using &dpll_mpu defined in arch/arm/cpu/armv7/am33xx/clock_am33xx.c ... so how to make here a board specific struct?
The MPUCLK is configurable through the define CONFIG_SYS_MPUCLK which is good, but I have on this board a PMIC, which in board SPL code change MPU and core voltage ... and after that I change the MPU clock again ...
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 1/4 ARM: AM33xx: Cleanup dplls data
Hi Heiko,
Quoted 57 lines · Heiko Schocher
Hello Lokesh,
Am 25.06.2013 05:48, schrieb Lokesh Vutla:
Quoted 41 lines
Hi Heiko,
Quoted 39 lines · Heiko Schocher
Hello Lokesh,
Am 24.06.2013 15:15, schrieb Lokesh Vutla:
Quoted 19 lines
Locking sequence for all the dplls is same. In the current code same sequence is done repeatedly for each dpll. Instead have a generic function for locking dplls and pass dpll data to that function.
This is derived from OMAP4 boards.
Signed-off-by Lokesh Vutla <[email protected]>--- arch/arm/cpu/armv7/am33xx/Makefile | 1 + arch/arm/cpu/armv7/am33xx/clock.c | 116 ++++++++++++++ arch/arm/cpu/armv7/am33xx/clock_am33xx.c | 222 +++++--------------------- arch/arm/cpu/armv7/am33xx/emif4.c | 4 + arch/arm/include/asm/arch-am33xx/clock.h | 68 ++++++++ arch/arm/include/asm/arch-am33xx/ddr_defs.h | 2 + arch/arm/include/asm/arch-am33xx/sys_proto.h | 1 + 7 files changed, 232 insertions(+), 182 deletions(-)create mode 100644
arch/arm/cpu/armv7/am33xx/clock.c[...]
Quoted 6 lines
arch/arm/cpu/armv7/am33xx/clock.c new file +0
-0@@ -0,0 +1,116 @@[...]
arch/arm/cpu/armv7/am33xx/clock.c line 83
Quoted 3 lines
arch/arm/cpu/armv7/am33xx/clock.c new file +3
-0+static void do_setup_dpll (const struct dpll_regs *dpll_regs, +const struct dpll_params *params) +{Could we have this function not only static? I posted a patch:
[U-Boot] arm, am335x: make mpu pll config configurable
http://patchwork.ozlabs.org/patch/248509/Quoted 7 lines
Quoted 4 lines
which uses
mpu_pll_config()for switching mpu pll clock from board code ... you delete this function later in this patch, so I think, I can switch todo_setup_pll()... if this is not static code ...Yes I saw that patch. No need to make this non-static. Please have your own struct "const struct
dpll_paramsdpll_mpu" and update your values accordingly.Hmm.. maybe I miss something here. You call
setup_dplls()inarch/arm/cpu/armv7/am33xx/clock.cusing&dpll_mpudefined inarch/arm/cpu/armv7/am33xx/clock_am33xx.c... so how to make here a board specific struct?
Quoted 4 lines
The MPUCLK is configurable through the define
CONFIG_SYS_MPUCLKwhich is good, but I have on this board a PMIC, which in board SPL code change MPU and core voltage ... and after that I change the MPU clock again ...
Ohk.
Can't we scale the voltages before calling setup_dplls() (Why do you want to configure the MPU clocks twice? I don't know much about your board, so I am just asking..:) ) What I meant is something like below:
void __weak scale_vcores(void)
{}
void prcm_init()
{
enable_basic_clocks();
scale_vcores();
setup_dplls();
}have your own scale_vcores in your board file. and for dpll_mpu have something like this:
#ifdef CONFIG_<BOARD>
const struct dpll_params dpll_mpu = {
M, N, 1, -1, -1, -1, -1};
#else
const struct dpll_params dpll_mpu = {
CONFIG_SYS_MPUCLK, OSC-1, 1, -1, -1, -1, -1};#endif
I hope this should be possible on your board.
I am telling this because it will be easy for me during my next cleanup during
which I planned to combine omap-common and am33xx code..:)
This is the exactly what is done for omap( program voltages and then setup dplls)
You can refer to arch/arm/cpu/armv7/omap-common/clocks-common.c prcm_init() function.
Please correct me if I am wrong..
Thanks and regards,
Lokesh
Quoted 4 lines
bye,
Heiko
PATCH 1/4 ARM: AM33xx: Cleanup dplls data
Hello Lokesh,
Am 25.06.2013 07:39, schrieb Lokesh Vutla:
Quoted 59 lines
Hi Heiko,
Quoted 57 lines · Heiko Schocher
Hello Lokesh,
Am 25.06.2013 05:48, schrieb Lokesh Vutla:
Quoted 41 lines
Hi Heiko,
Quoted 39 lines · Heiko Schocher
Hello Lokesh,
Am 24.06.2013 15:15, schrieb Lokesh Vutla:
Quoted 19 lines
Locking sequence for all the dplls is same. In the current code same sequence is done repeatedly for each dpll. Instead have a generic function for locking dplls and pass dpll data to that function.
This is derived from OMAP4 boards.
Signed-off-by Lokesh Vutla <[email protected]>--- arch/arm/cpu/armv7/am33xx/Makefile | 1 + arch/arm/cpu/armv7/am33xx/clock.c | 116 ++++++++++++++ arch/arm/cpu/armv7/am33xx/clock_am33xx.c | 222 +++++--------------------- arch/arm/cpu/armv7/am33xx/emif4.c | 4 + arch/arm/include/asm/arch-am33xx/clock.h | 68 ++++++++ arch/arm/include/asm/arch-am33xx/ddr_defs.h | 2 + arch/arm/include/asm/arch-am33xx/sys_proto.h | 1 + 7 files changed, 232 insertions(+), 182 deletions(-)create mode 100644
arch/arm/cpu/armv7/am33xx/clock.c[...]
Quoted 6 lines
arch/arm/cpu/armv7/am33xx/clock.c new file +0
-0@@ -0,0 +1,116 @@[...]
arch/arm/cpu/armv7/am33xx/clock.c line 83
Quoted 3 lines
arch/arm/cpu/armv7/am33xx/clock.c new file +3
-0+static void do_setup_dpll (const struct dpll_regs *dpll_regs, +const struct dpll_params *params) +{Could we have this function not only static? I posted a patch:
[U-Boot] arm, am335x: make mpu pll config configurable
http://patchwork.ozlabs.org/patch/248509/Quoted 7 lines
Quoted 4 lines
which uses
mpu_pll_config()for switching mpu pll clock from board code ... you delete this function later in this patch, so I think, I can switch todo_setup_pll()... if this is not static code ...Yes I saw that patch. No need to make this non-static. Please have your own struct "const struct
dpll_paramsdpll_mpu" and update your values accordingly.Hmm.. maybe I miss something here. You call
setup_dplls()inarch/arm/cpu/armv7/am33xx/clock.cusing&dpll_mpudefined inarch/arm/cpu/armv7/am33xx/clock_am33xx.c... so how to make here a board specific struct?
Quoted 7 lines
Quoted 4 lines
The MPUCLK is configurable through the define
CONFIG_SYS_MPUCLKwhich is good, but I have on this board a PMIC, which in board SPL code change MPU and core voltage ... and after that I change the MPU clock again ...Ohk.
Can't we scale the voltages before callingsetup_dplls()(Why do you want to configure the MPU clocks twice?
I speak with the customer ...
Quoted 15 lines
I don't know much about your board, so I am just asking..:) ) What I meant is something like below:
void__weakscale_vcores(void)
{}void
prcm_init(){ enable_basic_clocks(); scale_vcores(); setup_dplls(); }have your own
scale_vcoresin your board file.
and fordpll_mpuhave something like this:
#ifdef CONFIG_<BOARD>
Quoted 6 lines
const struct dpll_params dpll_mpu = { M, N, 1, -1, -1, -1, -1}; #else const struct dpll_params dpll_mpu = { CONFIG_SYS_MPUCLK, OSC-1, 1, -1, -1, -1, -1};#endif
No, that is not good. We should prevent such board specific defines in common code. I think this define is not necessary, as, if we have a scale_vcore() function, I can set CONFIG_SYS_MPUCLK to the end value ! I try this out! Thanks!
Quoted 4 lines
I hope this should be possible on your board.
I am telling this because it will be easy for me during my next cleanup during
which I planned to combine omap-common and am33xx code..:)
Ok, i try it ...
Quoted 6 lines
This is the exactly what is done for omap( program voltages and then setup dplls)
You can refer toarch/arm/cpu/armv7/omap-common/clocks-common.cprcm_init()function.Please correct me if I am wrong..
Yes, that looks good. Hmm... have we access to an pmic connected over i2c at this time?
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 1/4 ARM: AM33xx: Cleanup dplls data
Hi Heiko,
Quoted 94 lines · Heiko Schocher
Hello Lokesh,
Am 25.06.2013 07:39, schrieb Lokesh Vutla:
Quoted 59 lines
Hi Heiko,
Quoted 57 lines · Heiko Schocher
Hello Lokesh,
Am 25.06.2013 05:48, schrieb Lokesh Vutla:
Quoted 41 lines
Hi Heiko,
Quoted 39 lines · Heiko Schocher
Hello Lokesh,
Am 24.06.2013 15:15, schrieb Lokesh Vutla:
Quoted 19 lines
Locking sequence for all the dplls is same. In the current code same sequence is done repeatedly for each dpll. Instead have a generic function for locking dplls and pass dpll data to that function.
This is derived from OMAP4 boards.
Signed-off-by Lokesh Vutla <[email protected]>--- arch/arm/cpu/armv7/am33xx/Makefile | 1 + arch/arm/cpu/armv7/am33xx/clock.c | 116 ++++++++++++++ arch/arm/cpu/armv7/am33xx/clock_am33xx.c | 222 +++++--------------------- arch/arm/cpu/armv7/am33xx/emif4.c | 4 + arch/arm/include/asm/arch-am33xx/clock.h | 68 ++++++++ arch/arm/include/asm/arch-am33xx/ddr_defs.h | 2 + arch/arm/include/asm/arch-am33xx/sys_proto.h | 1 + 7 files changed, 232 insertions(+), 182 deletions(-) create mode 100644 arch/arm/cpu/armv7/am33xx/clock.c[...]
Quoted 6 lines
arch/arm/cpu/armv7/am33xx/clock.c new file +0
-0@@ -0,0 +1,116 @@[...]
arch/arm/cpu/armv7/am33xx/clock.c line 83
Quoted 3 lines
arch/arm/cpu/armv7/am33xx/clock.c new file +3
-0+static void do_setup_dpll (const struct dpll_regs *dpll_regs, +const struct dpll_params *params) +{Could we have this function not only static? I posted a patch:
[U-Boot] arm, am335x: make mpu pll config configurable
http://patchwork.ozlabs.org/patch/248509/Quoted 7 lines
Quoted 4 lines
which uses
mpu_pll_config()for switching mpu pll clock from board code ... you delete this function later in this patch, so I think, I can switch todo_setup_pll()... if this is not static code ...Yes I saw that patch. No need to make this non-static. Please have your own struct "const struct
dpll_paramsdpll_mpu" and update your values accordingly.Hmm.. maybe I miss something here. You call
setup_dplls()inarch/arm/cpu/armv7/am33xx/clock.cusing&dpll_mpudefined inarch/arm/cpu/armv7/am33xx/clock_am33xx.c... so how to make here a board specific struct?Quoted 7 lines
Quoted 4 lines
The MPUCLK is configurable through the define
CONFIG_SYS_MPUCLKwhich is good, but I have on this board a PMIC, which in board SPL code change MPU and core voltage ... and after that I change the MPU clock again ...Ohk.
Can't we scale the voltages before callingsetup_dplls()(Why do you want to configure the MPU clocks twice?I speak with the customer ...
Quoted 15 lines
I don't know much about your board, so I am just asking..:) ) What I meant is something like below:
void__weakscale_vcores(void)
{}void
prcm_init(){ enable_basic_clocks(); scale_vcores(); setup_dplls(); }have your own
scale_vcoresin your board file.
and fordpll_mpuhave something like this:
#ifdef CONFIG_<BOARD>Quoted 6 lines
const struct dpll_params dpll_mpu = { M, N, 1, -1, -1, -1, -1}; #else const struct dpll_params dpll_mpu = { CONFIG_SYS_MPUCLK, OSC-1, 1, -1, -1, -1, -1};#endif
Quoted 4 lines
No, that is not good. We should prevent such board specific defines in common code. I think this define is not necessary, as, if we have a
scale_vcore()function, I can setCONFIG_SYS_MPUCLKto the end value ! I try this out! Thanks!
My idea here is to populate data according to the board. Its good if you use the same value.
Quoted 13 lines
Quoted 5 lines
I hope this should be possible on your board.
I am telling this because it will be easy for me during my next cleanup during
which I planned to combine omap-common and am33xx code..:)Ok, i try it ...
Quoted 5 lines
This is the exactly what is done for omap( program voltages and then setup dplls)
You can refer toarch/arm/cpu/armv7/omap-common/clocks-common.cprcm_init()function.
Quoted 4 lines
Quoted 1 line
Please correct me if I am wrong..
Yes, that looks good. Hmm... have we access to an pmic connected over i2c at this time?
you can do an i2c_init() here.
Thanks and regards,
Lokesh
Quoted 4 lines
bye,
Heiko
PATCH 1/4 ARM: AM33xx: Cleanup dplls data
Hello Lokesh,
Am 25.06.2013 10:17, schrieb Lokesh Vutla:
Quoted 73 lines
Hi Heiko,
Quoted 71 lines · Heiko Schocher
Hello Lokesh,
Am 25.06.2013 07:39, schrieb Lokesh Vutla:
Quoted 59 lines
Hi Heiko,
Quoted 57 lines · Heiko Schocher
Hello Lokesh,
Am 25.06.2013 05:48, schrieb Lokesh Vutla:
Quoted 41 lines
Hi Heiko,
Quoted 39 lines · Heiko Schocher
Hello Lokesh,
Am 24.06.2013 15:15, schrieb Lokesh Vutla:
Quoted 19 lines
Locking sequence for all the dplls is same. In the current code same sequence is done repeatedly for each dpll. Instead have a generic function for locking dplls and pass dpll data to that function.
This is derived from OMAP4 boards.
Signed-off-by Lokesh Vutla <[email protected]>--- arch/arm/cpu/armv7/am33xx/Makefile | 1 + arch/arm/cpu/armv7/am33xx/clock.c | 116 ++++++++++++++ arch/arm/cpu/armv7/am33xx/clock_am33xx.c | 222 +++++--------------------- arch/arm/cpu/armv7/am33xx/emif4.c | 4 + arch/arm/include/asm/arch-am33xx/clock.h | 68 ++++++++ arch/arm/include/asm/arch-am33xx/ddr_defs.h | 2 + arch/arm/include/asm/arch-am33xx/sys_proto.h | 1 + 7 files changed, 232 insertions(+), 182 deletions(-) create mode 100644 arch/arm/cpu/armv7/am33xx/clock.c[...]
Quoted 6 lines
arch/arm/cpu/armv7/am33xx/clock.c new file +0
-0@@ -0,0 +1,116 @@[...]
arch/arm/cpu/armv7/am33xx/clock.c
Quoted 3 lines
arch/arm/cpu/armv7/am33xx/clock.c new file +3
-0+static void do_setup_dpll (const struct dpll_regs *dpll_regs, +const struct dpll_params *params) +{Could we have this function not only static? I posted a patch:
[U-Boot] arm, am335x: make mpu pll config configurable
http://patchwork.ozlabs.org/patch/248509/Quoted 7 lines
Quoted 4 lines
which uses
mpu_pll_config()for switching mpu pll clock from board code ... you delete this function later in this patch, so I think, I can switch todo_setup_pll()... if this is not static code ...Yes I saw that patch. No need to make this non-static. Please have your own struct "const struct
dpll_paramsdpll_mpu" and update your values accordingly.Hmm.. maybe I miss something here. You call
setup_dplls()inarch/arm/cpu/armv7/am33xx/clock.cusing&dpll_mpudefined inarch/arm/cpu/armv7/am33xx/clock_am33xx.c... so how to make here a board specific struct?Quoted 7 lines
Quoted 4 lines
The MPUCLK is configurable through the define
CONFIG_SYS_MPUCLKwhich is good, but I have on this board a PMIC, which in board SPL code change MPU and core voltage ... and after that I change the MPU clock again ...Ohk.
Can't we scale the voltages before callingsetup_dplls()(Why do you want to configure the MPU clocks twice?I speak with the customer ...
It seems, we can make this static, no need for
doing this dynamically ... I try it ...
Quoted 41 lines
Quoted 22 lines
Quoted 15 lines
I don't know much about your board, so I am just asking..:) ) What I meant is something like below:
void__weakscale_vcores(void)
{}void
prcm_init(){ enable_basic_clocks(); scale_vcores(); setup_dplls(); }have your own
scale_vcoresin your board file.
and fordpll_mpuhave something like this:
#ifdef CONFIG_<BOARD>Quoted 6 lines
const struct dpll_params dpll_mpu = { M, N, 1, -1, -1, -1, -1}; #else const struct dpll_params dpll_mpu = { CONFIG_SYS_MPUCLK, OSC-1, 1, -1, -1, -1, -1};#endif
Quoted 4 lines
No, that is not good. We should prevent such board specific defines in common code. I think this define is not necessary, as, if we have a
scale_vcore()function, I can setCONFIG_SYS_MPUCLKto the end value ! I try this out! Thanks!My idea here is to populate data according to the board. Its good if you use the same value.
Quoted 13 lines
Quoted 5 lines
I hope this should be possible on your board.
I am telling this because it will be easy for me during my next cleanup during
which I planned to combine omap-common and am33xx code..:)Ok, i try it ...
Quoted 5 lines
This is the exactly what is done for omap( program voltages and then setup dplls)
You can refer toarch/arm/cpu/armv7/omap-common/clocks-common.cprcm_init()function.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Please correct me if I am wrong..
Yes, that looks good. Hmm... have we access to an pmic connected over i2c at this time?
you can do an
i2c_init()here.
Thanks and regards,
Lokesh
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 1/4 ARM: AM33xx: Cleanup dplls data
In reply to Lokesh VutlaQuoted 71 lines · Lokesh Vutla
Hi Heiko,
Quoted 57 lines · Heiko Schocher
Hello Lokesh,
Am 25.06.2013 05:48, schrieb Lokesh Vutla:
Quoted 41 lines
Hi Heiko,
Quoted 39 lines · Heiko Schocher
Hello Lokesh,
Am 24.06.2013 15:15, schrieb Lokesh Vutla:
Quoted 19 lines
Locking sequence for all the dplls is same. In the current code same sequence is done repeatedly for each dpll. Instead have a generic function for locking dplls and pass dpll data to that function.
This is derived from OMAP4 boards.
Signed-off-by Lokesh Vutla <[email protected]>--- arch/arm/cpu/armv7/am33xx/Makefile | 1 + arch/arm/cpu/armv7/am33xx/clock.c | 116 ++++++++++++++ arch/arm/cpu/armv7/am33xx/clock_am33xx.c | 222 +++++--------------------- arch/arm/cpu/armv7/am33xx/emif4.c | 4 + arch/arm/include/asm/arch-am33xx/clock.h | 68 ++++++++ arch/arm/include/asm/arch-am33xx/ddr_defs.h | 2 + arch/arm/include/asm/arch-am33xx/sys_proto.h | 1 + 7 files changed, 232 insertions(+), 182 deletions(-)create mode 100644
arch/arm/cpu/armv7/am33xx/clock.c[...]
Quoted 6 lines
arch/arm/cpu/armv7/am33xx/clock.c new file +0
-0@@ -0,0 +1,116 @@[...]
arch/arm/cpu/armv7/am33xx/clock.c line 83
Quoted 3 lines
arch/arm/cpu/armv7/am33xx/clock.c new file +3
-0+static void do_setup_dpll (const struct dpll_regs *dpll_regs, +const struct dpll_params *params) +{Could we have this function not only static? I posted a patch:
[U-Boot] arm, am335x: make mpu pll config configurable
http://patchwork.ozlabs.org/patch/248509/Quoted 7 lines
Quoted 4 lines
which uses
mpu_pll_config()for switching mpu pll clock from board code ... you delete this function later in this patch, so I think, I can switch todo_setup_pll()... if this is not static code ...Yes I saw that patch. No need to make this non-static. Please have your own struct "const struct
dpll_paramsdpll_mpu" and update your values accordingly.Hmm.. maybe I miss something here. You call
setup_dplls()inarch/arm/cpu/armv7/am33xx/clock.cusing&dpll_mpudefined inarch/arm/cpu/armv7/am33xx/clock_am33xx.c... so how to make here a board specific struct?Quoted 4 lines
The MPUCLK is configurable through the define
CONFIG_SYS_MPUCLKwhich is good, but I have on this board a PMIC, which in board SPL code change MPU and core voltage ... and after that I change the MPU clock again ...Ohk.
Can't we scale the voltages before callingsetup_dplls()(Why do you want to configure the MPU clocks twice? I don't know much about your board, so I am just asking..:) ) What I meant is something like below:
void__weakscale_vcores(void)
{}
Quoted 6 lines
void
prcm_init(){ enable_basic_clocks(); scale_vcores(); setup_dplls(); }
Keep in mind the OPP50 advisory (errata 1.0.24) as well. The first fix/work-around for this I've seen drops us down to start with, and then raises things up.
Signature · 8 lines
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/20130625/466cbf23/attachment.pgp>
PATCH 1/4 ARM: AM33xx: Cleanup dplls data
In reply to Lokesh VutlaHello Lokesh,
Am 24.06.2013 15:15, schrieb Lokesh Vutla:
Quoted 8 lines
Locking sequence for all the dplls is same. In the current code same sequence is done repeatedly for each dpll. Instead have a generic function for locking dplls and pass dpll data to that function.
This is derived from OMAP4 boards.
Signed-off-by Lokesh Vutla <[email protected]>
Quoted 10 lines
--- arch/arm/cpu/armv7/am33xx/Makefile | 1 + arch/arm/cpu/armv7/am33xx/clock.c | 116 ++++++++++++++ arch/arm/cpu/armv7/am33xx/clock_am33xx.c | 222 +++++--------------------- arch/arm/cpu/armv7/am33xx/emif4.c | 4 + arch/arm/include/asm/arch-am33xx/clock.h | 68 ++++++++ arch/arm/include/asm/arch-am33xx/ddr_defs.h | 2 + arch/arm/include/asm/arch-am33xx/sys_proto.h | 1 + 7 files changed, 232 insertions(+), 182 deletions(-) create mode 100644 arch/arm/cpu/armv7/am33xx/clock.c
Tested on 3 am335x boards (no need anymore to set mpu_pll twice on this boards :-), so:
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 1/4 ARM: AM33xx: Cleanup dplls data
In reply to Lokesh VutlaHello Lokesh,
Am 24.06.2013 15:15, schrieb Lokesh Vutla:
Quoted 8 lines
Locking sequence for all the dplls is same. In the current code same sequence is done repeatedly for each dpll. Instead have a generic function for locking dplls and pass dpll data to that function.
This is derived from OMAP4 boards.
Signed-off-by Lokesh Vutla <[email protected]>
Quoted 10 lines
--- arch/arm/cpu/armv7/am33xx/Makefile | 1 + arch/arm/cpu/armv7/am33xx/clock.c | 116 ++++++++++++++ arch/arm/cpu/armv7/am33xx/clock_am33xx.c | 222 +++++--------------------- arch/arm/cpu/armv7/am33xx/emif4.c | 4 + arch/arm/include/asm/arch-am33xx/clock.h | 68 ++++++++ arch/arm/include/asm/arch-am33xx/ddr_defs.h | 2 + arch/arm/include/asm/arch-am33xx/sys_proto.h | 1 + 7 files changed, 232 insertions(+), 182 deletions(-) create mode 100644 arch/arm/cpu/armv7/am33xx/clock.c
Tested on 3 am335x boards so:
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 2/4 ARM: AM33xx: Cleanup clocks layer
In reply to Lokesh VutlaCleaning up the clocks layer.
This helps in addition of new Soc with minimal
changes.
This is derived from OMAP4 boards.
--- arch/arm/cpu/armv7/am33xx/board.c | 6 - arch/arm/cpu/armv7/am33xx/clock.c | 62 +++++- arch/arm/cpu/armv7/am33xx/clock_am33xx.c | 275 ++++++++------------------- arch/arm/cpu/armv7/am33xx/clock_ti814x.c | 19 +- arch/arm/cpu/armv7/am33xx/emif4.c | 1 - arch/arm/include/asm/arch-am33xx/clock.h | 28 ++- arch/arm/include/asm/arch-am33xx/ddr_defs.h | 2 - board/isee/igep0033/board.c | 11 +- board/ti/am335x/board.c | 10 +- board/ti/ti814x/evm.c | 12 +- 10 files changed, 193 insertions(+), 233 deletions(-)
arch/arm/cpu/armv7/am33xx/board.c +0 -6
@@ -64,12 +64,6 @@ int cpu_mmc_init(bd_t *bis) }#endif -void setup_clocks_for_console (void ) -{ -/* Not yet implemented */ -return ; -} -/* AM33XX has two MUSB controllers which can be host or gadget */ #if (defined(CONFIG_MUSB_GADGET ) || defined(CONFIG_MUSB_HOST )) && \ (defined(CONFIG_AM335X_USB0 ) || defined(CONFIG_AM335X_USB1 ))
arch/arm/cpu/armv7/am33xx/clock.c +61 -1
71 lines not on this page · raw message
arch/arm/cpu/armv7/am33xx/clock_am33xx.c +78 -197
294 lines not on this page · raw message
arch/arm/cpu/armv7/am33xx/clock_ti814x.c +9 -10
@@ -272,11 +272,6 @@ const struct sata_pll *spll = (struct sata_pll *)SATA_PLL_BASE;*/ static void enable_per_clocks (void ) { -/* UART0 */ -writel (PRCM_MOD_EN , &cmalwon->uart0clkctrl); -while (readl (&cmalwon->uart0clkctrl) !=PRCM_MOD_EN ) - ; -/* HSMMC1 */ writel (PRCM_MOD_EN , &cmalwon->mmchs1clkctrl);while (readl (&cmalwon->mmchs1clkctrl) !=PRCM_MOD_EN )
@@ -463,8 +458,6 @@ void sata_pll_config(void) ; } -void enable_emif_clocks (void ) {}; -void enable_dmm_clocks (void ) {writel (PRCM_MOD_EN , &cmdef->fwclkctrl);
@@ -485,13 +478,19 @@ void enable_dmm_clocks(void) ; } +void setup_clocks_for_console (void ) +{ +unlock_pll_control_mmr (); +/* UART0 */ +writel (PRCM_MOD_EN , &cmalwon->uart0clkctrl); +while (readl (&cmalwon->uart0clkctrl) !=PRCM_MOD_EN ) + ; +}/* * Configure the PLL/PRCM for necessary peripherals */ -void pll_init () +void prcm_init (void ) { -unlock_pll_control_mmr (); -/* Enable the control module */ writel (PRCM_MOD_EN , &cmalwon->controlclkctrl);
arch/arm/cpu/armv7/am33xx/emif4.c +0 -1
@@ -91,7 +91,6 @@ void config_ddr(unsigned int pll, unsigned int ioctrl, const struct ddr_data *data, const struct cmd_control *ctrl, const struct emif_regs *regs, int nr) { -enable_emif_clocks ();ddr_pll_config (pll );config_vtp (nr);config_cmd_ctrl (ctrl, nr);
arch/arm/include/asm/arch-am33xx/clock.h +26 -2
@@ -23,6 +23,28 @@#define LDELAY 1000000 +/*CM_<clock_domain>__CLKCTRL */ +#define CD_CLKCTRL_CLKTRCTRL_SHIFT 0 +#define CD_CLKCTRL_CLKTRCTRL_MASK 3 + +#define CD_CLKCTRL_CLKTRCTRL_NO_SLEEP 0 +#define CD_CLKCTRL_CLKTRCTRL_SW_SLEEP 1 +#define CD_CLKCTRL_CLKTRCTRL_SW_WKUP 2 + +/* CM_<clock_domain>_<module>_CLKCTRL */ +#define MODULE_CLKCTRL_MODULEMODE_SHIFT 0 +#define MODULE_CLKCTRL_MODULEMODE_MASK 3 +#define MODULE_CLKCTRL_IDLEST_SHIFT 16 +#define MODULE_CLKCTRL_IDLEST_MASK (3 << 16) + +#define MODULE_CLKCTRL_MODULEMODE_SW_DISABLE 0 +#define MODULE_CLKCTRL_MODULEMODE_SW_EXPLICIT_EN 2 + +#define MODULE_CLKCTRL_IDLEST_FULLY_FUNCTIONAL 0 +#define MODULE_CLKCTRL_IDLEST_TRANSITIONING 1 +#define MODULE_CLKCTRL_IDLEST_IDLE 2 +#define MODULE_CLKCTRL_IDLEST_DISABLED 3 +/* CM_CLKMODE_DPLL */ #define CM_CLKMODE_DPLL_REGM4XEN_SHIFT 11#define CM_CLKMODE_DPLL_REGM4XEN_MASK (1 << 11)
@@ -85,8 +107,10 @@ extern const struct dpll_params dpll_core;extern const struct dpll_params dpll_per;extern const struct dpll_params dpll_ddr; -extern const struct cm_wkuppll *cmwkup; +extern struct cm_wkuppll *const cmwkup; -void setup_dplls (void ); +void prcm_init (void ); +void enable_basic_clocks (void ); +void do_enable_clocks (u32 *const *,u32 *const *,u8 );#endif
arch/arm/include/asm/arch-am33xx/ddr_defs.h +0 -2
@@ -154,8 +154,6 @@ void set_sdram_timings(const struct emif_regs *regs, int nr);*/ void config_ddr_phy (const struct emif_regs *regs,int nr); -void ddr_pll_config (unsigned int ddrpll_m); -struct ddr_cmd_regs {unsigned int resv0[7 ];unsigned int cm0csratio;/* offset 0x01C */
board/isee/igep0033/board.c +6 -5
@@ -101,11 +101,7 @@ void s_init(void) ;#ifdef CONFIG_SPL_BUILD -/* Setup the PLLs and the clocks for the peripherals */ -pll_init (); - -/* Enable RTC32K clock */ -rtc32k_enable (); +setup_clocks_for_console ();enable_uart0_pin_mux ();
@@ -114,6 +110,11 @@ void s_init(void)preloader_console_init (); +prcm_init (); + +/* Enable RTC32K clock */ +rtc32k_enable (); +/* Configure board pin mux */ enable_board_pin_mux ();
board/ti/am335x/board.c +6 -4
@@ -310,10 +310,7 @@ void s_init(void)#ifdef CONFIG_SPL_BUILD /* Setup the PLLs and the clocks for the peripherals */ -pll_init (); - -/* Enable RTC32K clock */ -rtc32k_enable (); +setup_clocks_for_console ();#ifdef CONFIG_SERIAL1 enable_uart0_pin_mux ();
@@ -340,12 +337,17 @@ void s_init(void)preloader_console_init (); +prcm_init (); +/* Initalize the board header */ enable_i2c0_pin_mux ();i2c_init (CONFIG_SYS_I2C_SPEED ,CONFIG_SYS_I2C_SLAVE );if (read_eeprom () <0 )puts ("Could not get board ID.\n" ); +/* Enable RTC32K clock */ +rtc32k_enable (); +enable_board_pin_mux (&header);if (board_is_evm_sk ()) {/*
board/ti/ti814x/evm.c +7 -5
@@ -133,11 +133,7 @@ void s_init(void)/* Enable timer */ timer_init (); -/* Setup the PLLs and the clocks for the peripherals */ -pll_init (); - -/* Enable RTC32K clock */ -rtc32k_enable (); +setup_clocks_for_console ();/* Set UART pins */ enable_uart0_pin_mux ();
@@ -155,6 +151,12 @@ void s_init(void)preloader_console_init (); +/* Setup the PLLs and the clocks for the peripherals */ +prcm_init (); + +/* Enable RTC32K clock */ +rtc32k_enable (); +config_dmm (&evm_lisa_map_regs); config_ddr(0, 0, &evm_ddr2_data, &evm_ddr2_cctrl_data,
Signature · 1 line
1.7.9.5
PATCH 2/4 ARM: AM33xx: Cleanup clocks layer
Hello Lokesh,
Am 24.06.2013 15:15, schrieb Lokesh Vutla:
Quoted 6 lines
Cleaning up the clocks layer.
This helps in addition of new Soc with minimal
changes.
This is derived from OMAP4 boards.Signed-off-by Lokesh Vutla <[email protected]>
Quoted 12 lines
--- arch/arm/cpu/armv7/am33xx/board.c | 6 - arch/arm/cpu/armv7/am33xx/clock.c | 62 +++++- arch/arm/cpu/armv7/am33xx/clock_am33xx.c | 275 ++++++++------------------- arch/arm/cpu/armv7/am33xx/clock_ti814x.c | 19 +- arch/arm/cpu/armv7/am33xx/emif4.c | 1 - arch/arm/include/asm/arch-am33xx/clock.h | 28 ++- arch/arm/include/asm/arch-am33xx/ddr_defs.h | 2 - board/isee/igep0033/board.c | 11 +- board/ti/am335x/board.c | 10 +- board/ti/ti814x/evm.c | 12 +- 10 files changed, 193 insertions(+), 233 deletions(-)
Tested on 3 am335x boards, so:
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 3/4 ARM: AM33xx: Move s_init to a common place
In reply to Lokesh VutlaFrom: Heiko Schocher <[email protected]>
s_init has the same outline for all the AM33xx based board. So making it generic.
This also helps in addition of new Soc with minimal changes.
--- arch/arm/cpu/armv7/am33xx/board.c | 46 +++++++++++++-- arch/arm/cpu/armv7/am33xx/clock_ti814x.c | 6 ++ arch/arm/cpu/armv7/am33xx/emif4.c | 6 +- arch/arm/include/asm/arch-am33xx/clocks_am33xx.h | 6 +- arch/arm/include/asm/arch-am33xx/sys_proto.h | 5 +- board/isee/igep0033/board.c | 49 +++------------- board/phytec/pcm051/board.c | 48 +++------------- board/ti/am335x/board.c | 52 +++-------------- board/ti/ti814x/evm.c | 67 +++------------------- 9 files changed, 90 insertions(+), 195 deletions(-)
arch/arm/cpu/armv7/am33xx/board.c +40 -6
@@ -145,7 +145,7 @@ int arch_misc_init(void) }#ifdef CONFIG_SPL_BUILD -void rtc32k_enable (void ) +static void rtc32k_enable (void ) {struct rtc_regs *rtc = (struct rtc_regs *)RTC_BASE ;
@@ -161,11 +161,7 @@ void rtc32k_enable(void)writel ((1 <<3 ) | (1 <<6 ), &rtc->osc); } -#define UART_RESET (0x1 << 1) -#define UART_CLK_RUNNING_MASK 0x1 -#define UART_SMART_IDLE_EN (0x1 << 0x3) - -void uart_soft_reset (void ) +static void uart_soft_reset (void ) {struct uart_sys *uart_base = (struct uart_sys *)DEFAULT_UART_BASE ;u32 regval;
@@ -182,4 +178,42 @@ void uart_soft_reset(void) regval |=UART_SMART_IDLE_EN ;writel (regval, &uart_base->uartsyscfg); } + +static void watchdog_disable (void ) +{ +struct wd_timer *wdtimer = (struct wd_timer *)WDT_BASE ; + +writel (0xAAAA , &wdtimer->wdtwspr); +while (readl (&wdtimer->wdtwwps) !=0x0 ) + ; +writel (0x5555 , &wdtimer->wdtwspr); +while (readl (&wdtimer->wdtwwps) !=0x0 ) + ; +}#endif + +void s_init (void ) +{ +/* +* Save the boot parameters passed from romcode. +* We cannot delay the saving further than this, +* to prevent overwrites. +*/ +#ifdef CONFIG_SPL_BUILD +save_omap_boot_params (); +watchdog_disable (); +timer_init (); +set_uart_mux_conf (); +setup_clocks_for_console (); +uart_soft_reset (); + + gd = &gdata; +preloader_console_init (); + +prcm_init (); +set_mux_conf_regs (); +/* Enable RTC32K clock */ +rtc32k_enable (); +sdram_init (); +#endif +}
arch/arm/cpu/armv7/am33xx/clock_ti814x.c +6 -0
@@ -285,6 +285,12 @@ static void enable_per_clocks(void)writel (PRCM_MOD_EN , &cmalwon->ethernet1clkctrl);while ((readl (&cmalwon->ethernet1clkctrl) &ENET_CLKCTRL_CMPL ) !=0 ) ; + +/* RTC clocks */ +writel (PRCM_MOD_EN , &cmalwon->rtcclkstctrl); +writel (PRCM_MOD_EN , &cmalwon->rtcclkctrl); +while (readl (&cmalwon->rtcclkctrl) !=PRCM_MOD_EN ) + ; }/*
arch/arm/cpu/armv7/am33xx/emif4.c +4 -2
@@ -44,8 +44,6 @@ void dram_init_banksize(void)#ifdef CONFIG_SPL_BUILD -static struct dmm_lisa_map_regs *hw_lisa_map_regs = - (struct dmm_lisa_map_regs *)DMM_BASE ;static struct vtp_reg *vtpreg[2 ] = { (struct vtp_reg *)VTP0_CTRL_ADDR , (struct vtp_reg *)VTP1_CTRL_ADDR };
@@ -53,6 +51,9 @@ static struct vtp_reg *vtpreg[2] = {static struct ddr_ctrl *ddrctrl = (struct ddr_ctrl *)DDR_CTRL_ADDR ;#endif +#ifdef CONFIG_TI81XX +static struct dmm_lisa_map_regs *hw_lisa_map_regs = + (struct dmm_lisa_map_regs *)DMM_BASE ;void config_dmm (const struct dmm_lisa_map_regs *regs) {enable_dmm_clocks ();
@@ -67,6 +68,7 @@ void config_dmm(const struct dmm_lisa_map_regs *regs)writel (regs->dmm_lisa_map_1, &hw_lisa_map_regs->dmm_lisa_map_1); writel(regs->dmm_lisa_map_0, &hw_lisa_map_regs->dmm_lisa_map_0); } +#endif static void config_vtp (int nr) {
arch/arm/include/asm/arch-am33xx/clocks_am33xx.h +4 -2
@@ -24,8 +24,10 @@#define CONFIG_SYS_MPUCLK 550#endif -extern void pll_init (void ); -extern void enable_emif_clocks (void ); +#define UART_RESET (0x1 << 1) +#define UART_CLK_RUNNING_MASK 0x1 +#define UART_SMART_IDLE_EN (0x1 << 0x3) +extern void enable_dmm_clocks (void );#endif /* endif _CLOCKS_AM33XX_H_ */
arch/arm/include/asm/arch-am33xx/sys_proto.h +3 -2
@@ -43,7 +43,8 @@ void enable_gpmc_cs_config(const u32 *gpmc_config, struct gpmc_cs *cs, u32 base, u32 size);void omap_nand_switch_ecc (uint32_t ,uint32_t ); -void rtc32k_enable (void ); -void uart_soft_reset (void ); +void set_uart_mux_conf (void ); +void set_mux_conf_regs (void ); +void sdram_init (void );u32 wait_on_value (u32 ,u32 ,void *,u32 );#endif
board/isee/igep0033/board.c +8 -41
70 lines not on this page · raw message
board/phytec/pcm051/board.c +8 -40
73 lines not on this page · raw message
board/ti/am335x/board.c +9 -43
86 lines not on this page · raw message
board/ti/ti814x/evm.c +8 -59
101 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 3/4 ARM: AM33xx: Move s_init to a common place
Hello Lokesh,
Am 24.06.2013 15:15, schrieb Lokesh Vutla:
Quoted 77 lines
From: Heiko Schocher <[email protected]>
s_inithas the same outline for all the AM33xx based board. So making it generic.
This also helps in addition of new Soc with minimal changes.Signed-off-by Lokesh Vutla <[email protected]>Signed-off-by Heiko Schocher <[email protected]>Signed-off-by Tom Rini <[email protected]>--- arch/arm/cpu/armv7/am33xx/board.c | 46 +++++++++++++-- arch/arm/cpu/armv7/am33xx/clock_ti814x.c | 6 ++ arch/arm/cpu/armv7/am33xx/emif4.c | 6 +- arch/arm/include/asm/arch-am33xx/clocks_am33xx.h | 6 +- arch/arm/include/asm/arch-am33xx/sys_proto.h | 5 +- board/isee/igep0033/board.c | 49 +++------------- board/phytec/pcm051/board.c | 48 +++------------- board/ti/am335x/board.c | 52 +++-------------- board/ti/ti814x/evm.c | 67 +++------------------- 9 files changed, 90 insertions(+), 195 deletions(-)arch/arm/cpu/armv7/am33xx/board.c +27
-6@@ -145,7 +145,7 @@ int arch_misc_init(void) }#ifdef CONFIG_SPL_BUILD -void rtc32k_enable (void ) +static void rtc32k_enable (void ) {struct rtc_regs *rtc = (struct rtc_regs *)RTC_BASE ;@@ -161,11 +161,7 @@ void rtc32k_enable(void)writel ((1 <<3 ) | (1 <<6 ), &rtc->osc); } -#define UART_RESET (0x1 << 1) -#define UART_CLK_RUNNING_MASK 0x1 -#define UART_SMART_IDLE_EN (0x1 << 0x3) - -void uart_soft_reset (void ) +static void uart_soft_reset (void ) {struct uart_sys *uart_base = (struct uart_sys *)DEFAULT_UART_BASE ;u32 regval;@@ -182,4 +178,42 @@ void uart_soft_reset(void) regval |=UART_SMART_IDLE_EN ; writel(regval, &uart_base->uartsyscfg); } + +static void watchdog_disable (void ) +{ +struct wd_timer *wdtimer = (struct wd_timer *)WDT_BASE ; + +writel (0xAAAA , &wdtimer->wdtwspr); +while (readl (&wdtimer->wdtwwps) !=0x0 ) + ; +writel (0x5555 , &wdtimer->wdtwspr); +while (readl (&wdtimer->wdtwwps) !=0x0 ) + ; +}#endif + +void s_init (void ) +{ +/* +* Save the boot parameters passed from romcode. +* We cannot delay the saving further than this, +* to prevent overwrites. +*/ +#ifdef CONFIG_SPL_BUILD +save_omap_boot_params (); +watchdog_disable (); +timer_init (); +set_uart_mux_conf ();
arch/arm/cpu/armv7/am33xx/board.c void uart_soft_reset(void) · line 216
Quoted 10 lines
arch/arm/cpu/armv7/am33xx/board.c +10
-0+setup_clocks_for_console (); +uart_soft_reset (); + + gd = &gdata; +preloader_console_init (); + +prcm_init (); +set_mux_conf_regs (); +/* Enable RTC32K clock */ +rtc32k_enable ();
I tried your patches on my three boards. The board with the rtc32k_enable() problem, did not work with them too :-(
Maybe we make rtc32k_enable() weak in common code, and so I can make a board specific (dummy) function?
[...]
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 3/4 ARM: AM33xx: Move s_init to a common place
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 1 line · Heiko Schocher
Hello Lokesh,
[snip]
Quoted 7 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ /* Enable RTC32K clock */ + rtc32k_enable();I tried your patches on my three boards. The board with the
rtc32k_enable()problem, did not work with them too :-(Maybe we make
rtc32k_enable()weak in common code, and so I can make a board specific (dummy) function?
I'm not a big fan of this since without this kicked, you can't do PM.
And we don't want to do it in the kernel as it takes a few seconds to
settle. Kicking it in U-Boot means it will be settled by the time it's needed, if I recall things right.
- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBAgAGBQJRyJ6YAAoJENk4IS6UOR1WpRsP/id6+SDeuNpbq3+d2e4VXXii j4Wq9Sm0wKkzzg/TcDT3ycyp7EqfyaJnpYjRORMAUjNjVcGAqTrssYtnjYgTLZXS oAN9E4hv15bxUPJJs2+/aLsI8jaHQ8E6IzKI5qLfxOKZePMPhhXmCes4V4qrkpMQ BcwinNMgfcyiNhkiDX4MvdB/tnKpMddzK/3SjiokGvH7jESFUzxw26BzpOy6uD8j tFj4D/LRzRmGXp1YqdtdqIAy15oNmTmOfK9zwVDPKLs4NUDHLGBUE6sgQJ5JLxjT pbS3JzQLe57weuW7WbD6/2RN7sJXfeZR1OUgJxuSzw8JQVDvWpW+2BJLyzoyOO7x t2XeuVgEyNyEVBRDtoeQ42hLFyk3O5G/kvRfLqqH0jDFkQKkMXMBhs2Bo4HA+157 o+HbB7GZkwR5ZKx+8RqmhP9t+IQjb1A8dkD/4gA0U0bYhbj4XhJSsDYtw1DMjya2 gr19m4n0qaRcwsRWZKX0ZahcxqWFWoRiNFxIBOeFSpeilR9dxEA3xE9VMC0jTSKA 1Wgi+cyRICTqXFhhpNinK79aszHEVBcU+A1ZgmHtpvZ2UNh4V+uXE0ydWMLw61gT ZHfB96WmFWQItu40/DN9Fo3JbJcGPtRHoR9yYV52WFszFml6p5+y6BHrNQ6D0a7l 2/4y5iHiZ7b8xpQKZbAp
=ZwYD
-----END PGP SIGNATURE-----
PATCH 3/4 ARM: AM33xx: Move s_init to a common place
Hello Tom,
Am 24.06.2013 21:31, schrieb Tom Rini:
Quoted 8 lines · Heiko Schocher
Quoted 1 line
Hello Lokesh,
[snip]
Quoted 4 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ /* Enable RTC32K clock */ + rtc32k_enable();I tried your patches on my three boards. The board with the
rtc32k_enable()problem, did not work with them too :-(
Quoted 7 lines
Quoted 2 lines
Maybe we make
rtc32k_enable()weak in common code, and so I can make a board specific (dummy) function?I'm not a big fan of this since without this kicked, you can't do PM.
And we don't want to do it in the kernel as it takes a few seconds to
settle. Kicking it in U-Boot means it will be settled by the time it's needed, if I recall things right.
Hmm.. but on my board, the cpu hangs (not accessible through bdi anymore) if I access this registers ... looking still for an explanation ...
Clocks are enabled, 24MHz (same as on am335x eval board) used ... I know, this is only a bugfix, without knowing the real reason ...
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 3/4 ARM: AM33xx: Move s_init to a common place
Hi Heiko,
I followed the same steps that you mentioned, but still i have same
problem.
During get uboot-spl.bin from uart, system become hanged and it is not
ready to receive u-boot.img.
Still compiling to uboot, i had to comment rtc32k_enable() function.
then it is working fine.
Thanks & Regards
~Sumit
Quoted 36 lines · Heiko Schocher
Hello Tom,
Am 24.06.2013 21:31, schrieb Tom Rini:
Quoted 8 lines · Heiko Schocher
Quoted 1 line
Hello Lokesh,
[snip]
Quoted 4 lines
Quoted 1 line
+ /* Enable RTC32K clock */ +
rtc32k_enable();I tried your patches on my three boards. The board with the
rtc32k_enable()problem, did not work with them too :-(Quoted 7 lines
Quoted 2 lines
Maybe we make
rtc32k_enable()weak in common code, and so I can make a board specific (dummy) function?I'm not a big fan of this since without this kicked, you can't do PM.
And we don't want to do it in the kernel as it takes a few seconds to
settle. Kicking it in U-Boot means it will be settled by the time it's needed, if I recall things right.Hmm.. but on my board, the cpu hangs (not accessible through bdi anymore) if I access this registers ... looking still for an explanation ...
Clocks are enabled, 24MHz (same as on am335x eval board) used ... I know, this is only a bugfix, without knowing the real reason ...
bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH 3/4 ARM: AM33xx: Move s_init to a common place
Hello Summit,
Am 25.06.2013 07:09, schrieb Sumit Gemini:
Quoted 4 lines
Hi Heiko,
I followed the same steps that you mentioned, but still i have same problem. During get uboot-spl.bin from uart, system become hanged and it is not ready to receive u-boot.img.
On which hardware?
Quoted 1 line
Still compiling to uboot, i had to comment
rtc32k_enable()function. then it is working fine.
Ok ... Hmm.. maybe some missing init the ROM Bootloader does (and some ROM bootloader versions not, and we miss this in spl code)? (just speculation ...)
bye,
Heiko
Quoted 39 lines · On Tue, Jun 25, 2013 at 1:14 AM, Heiko Schocher <hs at denx.de…
Hello Tom,
Am 24.06.2013 21 <tel:24.06.2013%2021>:31, schrieb Tom Rini:
> On 06/24/2013 03:17 PM, Heiko Schocher wrote:
>> Hello Lokesh,
> [snip]
>>> + /* Enable RTC32K clock */ +rtc32k_enable();
>
>> I tried your patches on my three boards. The board with the >>rtc32k_enable()problem, did not work with them too :-(
>
>> Maybe we makertc32k_enable()weak in common code, and so I can >> make a board specific (dummy) function?
>
> I'm not a big fan of this since without this kicked, you can't do PM. > And we don't want to do it in the kernel as it takes a few seconds to > settle. Kicking it in U-Boot means it will be settled by the time > it's needed, if I recall things right.Hmm.. but on my board, the cpu hangs (not accessible through bdi anymore) if I access this registers ... looking still for an explanation ...
Clocks are enabled, 24MHz (same as on am335x eval board) used ... I know, this is only a bugfix, without knowing the real reason ...
bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de <mailto:[email protected]>
http://lists.denx.de/mailman/listinfo/u-boot
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 4/4 musb: Disable extra prints
In reply to Lokesh VutlaThere are many musb prints in SPL and U-Boot log.
These prints are required only during musb debug.
So replacing printk with pr_debug in musb_core.
--- drivers/usb/musb-new/musb_core.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-)
drivers/usb/musb-new/musb_core.c +7 -11
@@ -1311,9 +1311,7 @@ static int __devinit ep_config_from_table(struct musb *musb)break ; } -printk (KERN_DEBUG "%s: setup fifo_mode %d\n" , - musb_driver_name, fifo_mode); - +pr_debug ("%s: setup fifo_mode %d\n" , musb_driver_name, fifo_mode); done: offset =fifo_setup (musb, hw_ep, &ep0_cfg,0 );
@@ -1341,10 +1339,9 @@ done: musb->nr_endpoints =max (epn, musb->nr_endpoints); } -printk (KERN_DEBUG "%s: %d/%d max ep, %d/%d memory\n" , - musb_driver_name, - n +1 , musb->config->num_eps *2 -1 , - offset, (1 << (musb->config->ram_bits +2 ))); +pr_debug ("%s: %d/%d max ep, %d/%d memory\n" , musb_driver_name, n +1 , + musb->config->num_eps *2 -1 , offset, + (1 << (musb->config->ram_bits +2 )));if (!musb->bulk_ep) {pr_debug ("%s: missing bulk\n" , musb_driver_name);
@@ -1447,8 +1444,7 @@ static int __devinit musb_core_init(u16 musb_type, struct musb *musb)if (reg &MUSB_CONFIGDATA_SOFTCONE )strcat (aInfo,", SoftConn" ); -printk (KERN_DEBUG "%s: ConfigData=0x%02x (%s)\n" , - musb_driver_name, reg, aInfo); +pr_debug ("%s:ConfigData=0x%02x (%s)\n" , musb_driver_name, reg, aInfo); aDate[0 ] =0 ;if (MUSB_CONTROLLER_MHDRC == musb_type) {
@@ -1469,8 +1465,8 @@ static int __devinit musb_core_init(u16 musb_type, struct musb *musb)snprintf (aRevision,32 ,"%d.%d%s" ,MUSB_HWVERS_MAJOR (musb->hwvers),MUSB_HWVERS_MINOR (musb->hwvers), (musb->hwvers &MUSB_HWVERS_RC ) ?"RC" :"" ); -printk (KERN_DEBUG "%s: %sHDRC RTL version %s %s\n" , - musb_driver_name, type, aRevision, aDate); +pr_debug ("%s: %sHDRC RTL version %s %s\n" , musb_driver_name, type, + aRevision, aDate);/* configure ep0 */ musb_configure_ep0 (musb);
Signature · 1 line
1.7.9.5
PATCH 4/4 musb: Disable extra prints
Hello Lokesh,
Am 24.06.2013 15:15, schrieb Lokesh Vutla:
Quoted 8 lines
There are many musb prints in SPL and U-Boot log.
These prints are required only during musb debug.
So replacing printk withpr_debuginmusb_core.Signed-off-by Lokesh Vutla <[email protected]>--- drivers/usb/musb-new/musb_core.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-)
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
cover ARM: AM33xx: Cleanup clocks and hwinit
In reply to Lokesh VutlaHi Tom,
Quoted 9 lines · Lokesh Vutla
This series tries to cleanup code for AM33xx, inorder to ensure code reusabilty by moving the duplicated code to common place.
This also helps in addition of new Soc with minimal changes.Testing:
Boot tested on BeagleBone White/Black, AM35xx EVM, TI814x. Verified MAKEALL for armv7 and am33xx boards.
You have any other comments on this series ?
Thanks and regards,
Lokesh
Quoted 28 lines
This series is on top of u-boot merged with u-boot-arm.
Heiko Schocher (1):
ARM: AM33xx: Moves_initto a common placeLokesh Vutla (3):
ARM: AM33xx: Cleanup dplls data
ARM: AM33xx: Cleanup clocks layer
musb: Disable extra printsarch/arm/cpu/armv7/am33xx/Makefile | 1 + arch/arm/cpu/armv7/am33xx/board.c | 52 ++- arch/arm/cpu/armv7/am33xx/clock.c | 176 ++++++++ arch/arm/cpu/armv7/am33xx/clock_am33xx.c | 497 +++++----------------- arch/arm/cpu/armv7/am33xx/clock_ti814x.c | 25 +- arch/arm/cpu/armv7/am33xx/emif4.c | 11 +- arch/arm/include/asm/arch-am33xx/clock.h | 92 ++++ arch/arm/include/asm/arch-am33xx/clocks_am33xx.h | 6 +- arch/arm/include/asm/arch-am33xx/sys_proto.h | 6 +- board/isee/igep0033/board.c | 48 +-- board/phytec/pcm051/board.c | 48 +-- board/ti/am335x/board.c | 50 +-- board/ti/ti814x/evm.c | 65 +-- drivers/usb/musb-new/musb_core.c | 18 +- 14 files changed, 498 insertions(+), 597 deletions(-)create mode 100644
arch/arm/cpu/armv7/am33xx/clock.c
cover ARM: AM33xx: Cleanup clocks and hwinit
Quoted 8 lines · Lokesh Vutla
Hi Tom,
Quoted 6 lines · Lokesh Vutla
This series tries to cleanup code for AM33xx, inorder to ensure code reusabilty by moving the duplicated code to common place.
This also helps in addition of new Soc with minimal changes.
Quoted 4 lines
Quoted 3 lines
Testing:
Boot tested on BeagleBone White/Black, AM35xx EVM, TI814x. Verified MAKEALL for armv7 and am33xx boards.You have any other comments on this series ?
Looks good, I'll pick it up for u-boot-ti/next soon.
Signature · 8 lines
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/20130626/124b256e/attachment.pgp>
cover ARM: AM33xx: Cleanup clocks and hwinit
Quoted 9 lines · Tom Rini
Quoted 8 lines · Lokesh Vutla
Hi Tom,
Quoted 6 lines · Lokesh Vutla
This series tries to cleanup code for AM33xx, inorder to ensure code reusabilty by moving the duplicated code to common place.
This also helps in addition of new Soc with minimal changes.
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Testing:
Boot tested on BeagleBone White/Black, AM35xx EVM, TI814x. Verified MAKEALL for armv7 and am33xx boards.You have any other comments on this series ?
Looks good, I'll pick it up for u-boot-ti/next soon.
Thanks Tom.!!
Regards,
Lokesh