ARM: OMAP4+: Cleanup clocks, control and emif code
Subsystems (2)
cover ARM: OMAP4+: Cleanup clocks, control and emif code
This series is intended to cleanup code which is duplicated across soc specific files. This is accomplished by moving soc specifc data to one place and having the code common. This helps in avoiding un necessary cpu checks and minimal code addition for future socs.
Tested this on OMAP5 ES1.0, OMAP4460 Panda boards and verified MAKEALL for all armv7 boards.
Lokesh Vutla (4):
ARM: OMAP4+: emif: Detect SDRAM from SDRAM config register
ARM: OMAP4+: Cleanup emif specific files
ARM: OMAP4+: Make control module register structure generic
ARM: OMAP5: Clean up iosettings code
R Sricharan (3):
ARM: OMAP4+: Change the PRCM structure prototype common for all Socs
ARM: OMAP4+: Cleanup the clocks layer
ARM: OMAP4+: Clean up the pmic code
arch/arm/cpu/armv7/omap-common/clocks-common.c | 284 ++++++++---- arch/arm/cpu/armv7/omap-common/emif-common.c | 71 ++- arch/arm/cpu/armv7/omap-common/hwinit-common.c | 10 +- arch/arm/cpu/armv7/omap-common/vc.c | 11 +- arch/arm/cpu/armv7/omap4/Makefile | 3 +- arch/arm/cpu/armv7/omap4/clocks.c | 517 ---------------------- arch/arm/cpu/armv7/omap4/hw_data.c | 461 +++++++++++++++++++ arch/arm/cpu/armv7/omap4/hwinit.c | 36 +- arch/arm/cpu/armv7/omap4/prcm-regs.c | 287 ++++++++++++ arch/arm/cpu/armv7/omap4/sdram_elpida.c | 16 +- arch/arm/cpu/armv7/omap5/Makefile | 3 +- arch/arm/cpu/armv7/omap5/clocks.c | 494 --------------------- arch/arm/cpu/armv7/omap5/hw_data.c | 465 ++++++++++++++++++++ arch/arm/cpu/armv7/omap5/hwinit.c | 131 +++--- arch/arm/cpu/armv7/omap5/prcm-regs.c | 352 +++++++++++++++ arch/arm/cpu/armv7/omap5/sdram.c | 119 +++-- arch/arm/include/asm/arch-omap4/clocks.h | 562 ++---------------------- arch/arm/include/asm/arch-omap4/omap.h | 33 +- arch/arm/include/asm/arch-omap4/sys_proto.h | 4 +- arch/arm/include/asm/arch-omap5/clocks.h | 506 +-------------------- arch/arm/include/asm/arch-omap5/omap.h | 96 +--- arch/arm/include/asm/arch-omap5/sys_proto.h | 5 +- arch/arm/include/asm/emif.h | 18 +- arch/arm/include/asm/omap_common.h | 482 ++++++++++++++++++++ drivers/mmc/omap_hsmmc.c | 25 +- include/configs/omap5_evm.h | 1 + 26 files changed, 2535 insertions(+), 2457 deletions(-) create mode 100644 arch/arm/cpu/armv7/omap4/hw_data.c create mode 100644 arch/arm/cpu/armv7/omap4/prcm-regs.c create mode 100644 arch/arm/cpu/armv7/omap5/hw_data.c create mode 100644 arch/arm/cpu/armv7/omap5/prcm-regs.c
Signature · 1 line
1.7.9.5
PATCH 1/7 ARM: OMAP4+: emif: Detect SDRAM from SDRAM config register
From: Lokesh Vutla <[email protected]>
Now SDRAM initialization is done on the basis of omap revision. Instead this should be done on basis of SDRAM type read from EMIF_SDRAM_CONFIG register. This will be helpful to avoid unnessecary cpu checks for new boards
--- arch/arm/cpu/armv7/omap-common/clocks-common.c | 10 +++++++++- arch/arm/cpu/armv7/omap-common/emif-common.c | 21 +++++++++++++++++---- arch/arm/cpu/armv7/omap5/hwinit.c | 2 +- arch/arm/include/asm/emif.h | 6 ++++++ 4 files changed, 33 insertions(+), 6 deletions(-)
arch/arm/cpu/armv7/omap-common/clocks-common.c +9 -1
@@ -36,6 +36,7 @@#include <asm/arch/sys_proto.h> #include <asm/utils.h> #include <asm/omap_gpio.h> +#include <asm/emif.h> #ifndef CONFIG_SPL_BUILD /*
@@ -299,7 +300,7 @@ static void setup_dplls(void)* Core DPLL will be locked after setting up EMIF * using the FREQ_UPDATE method(freq_update_core()) */ -if (omap_revision () !=OMAP5432_ES1_0 ) +if (emif_sdram_type () ==EMIF_SDRAM_TYPE_LPDDR2 )do_setup_dpll (&prcm->cm_clkmode_dpll_core, params,DPLL_NO_LOCK ,"core" );else
@@ -414,6 +415,13 @@ void do_scale_vcore(u32 vcore_reg, u32 volt_mv)if (omap_vc_bypass_send_value (SMPS_I2C_SLAVE_ADDR , vcore_reg, offset_code))printf ("Scaling voltage failed for 0x%x\n" , vcore_reg); + +if (emif_sdram_type () ==EMIF_SDRAM_TYPE_DDR3 ) { +/* Configure LDO SRAM "magic" bits */ +writel (2 , (*prcm)->prm_sldo_core_setup); +writel (2 , (*prcm)->prm_sldo_mpu_setup); +writel (2 , (*prcm)->prm_sldo_mm_setup); + } }static inline void enable_clock_domain (u32 *const clkctrl_reg,u32 enable_mode)
arch/arm/cpu/armv7/omap-common/emif-common.c +17 -4
@@ -66,6 +66,19 @@ inline u32 emif_num(u32 base)return 0 ; } +/* +* Get SDRAM type connected to EMIF. +* Assuming similar SDRAM parts are connected to both EMIF's +* which is typically the case. So it is sufficient to get +* SDRAM type from EMIF1. +*/ +u32 emif_sdram_type () +{ +struct emif_reg_struct *emif = (struct emif_reg_struct *)EMIF1_BASE ; + +return (readl (&emif->emif_sdram_config) & +EMIF_REG_SDRAM_TYPE_MASK ) >>EMIF_REG_SDRAM_TYPE_SHIFT ; +}static inline u32 get_mr (u32 base,u32 cs,u32 mr_addr) {
@@ -1079,7 +1092,7 @@ static void do_sdram_init(u32 base)* OPP to another) */ if (!(in_sdram ||warm_reset ())) { -if (omap_revision () !=OMAP5432_ES1_0 ) +if (emif_sdram_type () ==EMIF_SDRAM_TYPE_LPDDR2 )lpddr2_init (base, regs);else ddr3_init (base, regs);
@@ -1264,7 +1277,7 @@ void dmm_init(u32 base)void sdram_init (void ) {u32 in_sdram, size_prog, size_detect; -u32 omap_rev =omap_revision (); +u32 sdram_type =emif_sdram_type ();debug (">>sdram_init()\n" );
@@ -1275,7 +1288,7 @@ void sdram_init(void)debug ("in_sdram = %d\n" , in_sdram);if (!(in_sdram ||warm_reset ())) { -if (omap_rev !=OMAP5432_ES1_0 ) +if (sdram_type ==EMIF_SDRAM_TYPE_LPDDR2 )bypass_dpll (&prcm->cm_clkmode_dpll_core);else writel (CM_DLL_CTRL_NO_OVERRIDE , &prcm->cm_dll_ctrl);
@@ -1298,7 +1311,7 @@ void sdram_init(void) }/* for the shadow registers to take effect */ -if (omap_rev !=OMAP5432_ES1_0 ) +if (sdram_type ==EMIF_SDRAM_TYPE_LPDDR2 )freq_update_core ();/* Do some testing after the init */
arch/arm/cpu/armv7/omap5/hwinit.c +1 -1
@@ -191,7 +191,7 @@ void do_io_settings(void) (sc_fast <<17 ) | (sc_fast <<14 );writel (io_settings, &(ioregs_base->control_smart3io_padconf_1)); -if (omap_revision () <=OMAP5430_ES1_0 ) +if (emif_sdram_type () ==EMIF_SDRAM_TYPE_LPDDR2 )io_settings_lpddr2 ();else io_settings_ddr3 ();
arch/arm/include/asm/emif.h +6 -0
@@ -1027,6 +1027,11 @@ extern const u32 ddr3_ext_phy_ctrl_const_base[EMIF_EXT_PHY_CTRL_CONST_REG];#define MR8_IO_WIDTH_SHIFT 0x6#define MR8_IO_WIDTH_MASK (0x3 << 0x6) +/* SDRAM TYPE */ +#define EMIF_SDRAM_TYPE_DDR2 0x2 +#define EMIF_SDRAM_TYPE_DDR3 0x3 +#define EMIF_SDRAM_TYPE_LPDDR2 0x4 +struct lpddr2_addressing {u8 num_banks;u8 t_REFI_us_x10;
@@ -1156,4 +1161,5 @@ extern u32 *const emif_sizes;#endif void config_data_eye_leveling_samples (u32 emif_base); +u32 emif_sdram_type (void );#endif
Signature · 1 line
1.7.9.5
PATCH 1/7 ARM: OMAP4+: emif: Detect SDRAM from SDRAM config register
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 9 lines · R Sricharan
From: Lokesh Vutla <[email protected]>
Now SDRAM initialization is done on the basis of omap revision. Instead this should be done on basis of SDRAM type read from
EMIF_SDRAM_CONFIGregister. This will be helpful to avoid unnessecary cpu checks for new boardsSigned-off-by R Sricharan <[email protected]> Signed-off-by:Lokesh Vutla <[email protected]>
Does this mean the ROM is already doing some basic EMIF programming here? I swear I looked down this path before, when I wanted to share this code with am33xx and the problem is that while the registers aren't reset on warm boot, on cold boot they always come up in a default value, for both DDR2 and DDR3.
Or are you able to get by as the platforms come up with different default values?
- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBAgAGBQJRCpwGAAoJENk4IS6UOR1WpawP/jJE1GjmUCSDyC5yFyF2nRc2 gMxvIOni2Dl/y8EbvQyRMkJunzjHLxHmUqQLXLsauAalyx2xnBQ3WRhYNFR7G5jX vOlvsn4h5L2FdQL97/5pnsKNxdgXACw2HSidIFDGQ5/o9e53Tn3ZU7BN8bYaNEep AS7vF/ewOIbPlcavf4ov7DoICLpp8RMGPOQ+7yHAsEWfPnH3ZlfLNcUjxKzNTVpU PGeNbka50rliEaSTbNFklpy3E09O3kNvskk6TdGnRPL6/+CR2Z9jAqeVOSGnZYTr fagd9hlBB5HTfdBm8l2f2RRAce+t0lbvxl5wjqo+Wo+HZkf+c3/QBNe8jeDRblF5 OOixfQGq92LuqpF+HWlwnmV7R5TyF9CbuHRuDLGMux7h3YT4dsLuvUasRIAhKyUp NyMgdw5Ytn39kE5CT3jjYbqhiYk6O1Wo1GO6xoP2N7Zn4SqK7tkX62YDPkBw8B/v 3yI5TMmuy/tTqSUsP3xevk6yf8uPFDZwNX1yIbWBmm3acX8kShIAZsXWPC42V3Pc h3RbgBpTAU7XE9kFOSK5epk6OlipjiEdlo9Auh35yZ976bwmQsfdT5eFzLSsBO+g f9c9KZPgg/oC82vMPOZ479a4DqapuLCdR3wTtgxaycvhqLDVSxoKbgZSyE6RAuSt bXLDlFS0Lx4jqAuCWnE4
=l/qE
-----END PGP SIGNATURE-----
PATCH 1/7 ARM: OMAP4+: emif: Detect SDRAM from SDRAM config register
Quoted 14 lines · Tom Rini
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Quoted 9 lines · R Sricharan
From: Lokesh Vutla <[email protected]>
Now SDRAM initialization is done on the basis of omap revision. Instead this should be done on basis of SDRAM type read from
EMIF_SDRAM_CONFIGregister. This will be helpful to avoid unnessecary cpu checks for new boardsSigned-off-by R Sricharan <[email protected]> Signed-off-by:Lokesh Vutla <[email protected]>
Quoted 9 lines
Does this mean the ROM is already doing some basic EMIF programming here? I swear I looked down this path before, when I wanted to share this code with am33xx and the problem is that while the registers aren't reset on warm boot, on cold boot they always come up in a default value, for both DDR2 and DDR3.
Or are you able to get by as the platforms come up with different default values?
Not the ROMCODE, the default value for SDRAM_CONFIG register is exported from control module register based on efuse settings. We did see that this default value was correct depending upon LPDDR2 or DDR3 in the case of OMAP.
So does this mean that am3xx did not have the logic to load this register dynamically based on efuse settings ? If that is the only exception, then we can hardcode the register during startup only in that case. Except for this, where you able to use the emif-common driver in your case ?
Regards,
Sricharan
PATCH 1/7 ARM: OMAP4+: emif: Detect SDRAM from SDRAM config register
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 20 lines · R Sricharan
Quoted 19 lines · Tom Rini
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Quoted 9 lines · R Sricharan
From: Lokesh Vutla <[email protected]>
Now SDRAM initialization is done on the basis of omap revision. Instead this should be done on basis of SDRAM type read from
EMIF_SDRAM_CONFIGregister. This will be helpful to avoid unnessecary cpu checks for new boardsSigned-off-by R Sricharan <[email protected]> Signed-off-by:Lokesh Vutla <[email protected]>
Does this mean the ROM is already doing some basic EMIF programming here? I swear I looked down this path before, when I wanted to share this code with am33xx and the problem is that while the registers aren't reset on warm boot, on cold boot they
always come up in a default value, for both DDR2 and DDR3.
Quoted 7 lines
Quoted 3 lines
Or are you able to get by as the platforms come up with different default values?
Not the ROMCODE, the default value for
SDRAM_CONFIGregister is exported from control module register based on efuse settings. We did see that this default value was correct depending upon LPDDR2 or DDR3 in the case of OMAP.
OK, good.
Quoted 5 lines
So does this mean that am3xx did not have the logic to load this register dynamically based on efuse settings ? If that is the only
exception, then we can hardcode the register during startup only
in that case. Except for this, where you able to use the emif-common driver in your case ?
In my initial testing, it was not being setup correctly. I think it was between that, and trying to abstract out further the PM-related changes there wasn't much common EMIF code left, so I set the project aside at the time. I'll try and take another whack at it as I know someone is adding ti814x support currently and did find a good match-up with this EMIF code rather than the am33xx version, so maybe that will help me to see what's going on.
And with all of that:
- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBAgAGBQJRC9MsAAoJENk4IS6UOR1WjVkP/AzWShG1HSZR77Wk3Ax9kfs6 6P5cHTMX8Am9R+2SUk2j5LV54CzBYwGwUpdH3tDdE5nZQ0IieXs1MhYsx5kqSFHF mIZHMeO8CVM4n/VjguKybAItYCmaXjQ3QVPkN63FuVgK50AZJPeBJZJV5m0pICSq YnAQdQSirTHuJEZlhA4aJ9H5h7w1yRLeZ8YWtfX+feGotQoZgn/ZsieljfTc7MBY PowXxUbZmxjcv+9WRd/ExQxWrbGhb2Jvq3bxnJMvPoTpYgYs9MBf1lv1bO5BRqnq eD4hQjgVYWp7Et1ENHL1SEL9BCjeNmSho49a/27zV3KH+HeCnA1kwDJiwMvyxsI9 fN8rqHl87TZEOVi++VB5wtM9ksKWVcZW4IGLxExG5XCUI5rYYZjKYGW5yx4H4481 E5fS+bQohHr1PcGXvTmYJjSs/pIBvgqbmEM61Pd5AApRc0s7SVXfsHeKz0TTnFLU JaclcxGlBqa2LO3Ysard51t/+wrSz5gin5eQhwMux+IdRM2XErLh0xyBpyzc+iQR d/eG1KpUpmLOHBEk5c8lAGhkJX2t2SL7MXTiYbVgu74nUndPyJR8UR/hCF5ilh/M iDFN4tV70cc9gyuYVasJ+Qw4Ufct1THh4o5cAlew0FLCIEqdSGy/3LgVkFF28QuF xv45NQhl2nuA+Zk6Fb/M
=l80i
-----END PGP SIGNATURE-----
PATCH 2/7 ARM: OMAP4+: Change the PRCM structure prototype common for all Socs
In reply to R SricharanThe current PRCM structure prototype directly matches the hardware register layout. So there is a need to change this for every new silicon revision which has register space changes.
Avoiding this by making the prototye generic and populating the register addresses seperately for all Socs.
--- arch/arm/cpu/armv7/omap-common/clocks-common.c | 106 ++--- arch/arm/cpu/armv7/omap-common/emif-common.c | 4 +- arch/arm/cpu/armv7/omap-common/hwinit-common.c | 3 + arch/arm/cpu/armv7/omap-common/vc.c | 11 +- arch/arm/cpu/armv7/omap4/Makefile | 2 + arch/arm/cpu/armv7/omap4/clocks.c | 199 +++++---- arch/arm/cpu/armv7/omap4/hw_data.c | 38 ++ arch/arm/cpu/armv7/omap4/prcm-regs.c | 267 ++++++++++++ arch/arm/cpu/armv7/omap5/Makefile | 2 + arch/arm/cpu/armv7/omap5/clocks.c | 215 +++++----- arch/arm/cpu/armv7/omap5/hw_data.c | 38 ++ arch/arm/cpu/armv7/omap5/prcm-regs.c | 278 +++++++++++++ arch/arm/include/asm/arch-omap4/clocks.h | 524 +++--------------------- arch/arm/include/asm/arch-omap4/omap.h | 3 +- arch/arm/include/asm/arch-omap4/sys_proto.h | 2 +- arch/arm/include/asm/arch-omap5/clocks.h | 460 +-------------------- arch/arm/include/asm/arch-omap5/omap.h | 3 +- arch/arm/include/asm/arch-omap5/sys_proto.h | 2 +- arch/arm/include/asm/omap_common.h | 304 ++++++++++++++ 19 files changed, 1256 insertions(+), 1205 deletions(-) create mode 100644 arch/arm/cpu/armv7/omap4/hw_data.c create mode 100644 arch/arm/cpu/armv7/omap4/prcm-regs.c create mode 100644 arch/arm/cpu/armv7/omap5/hw_data.c create mode 100644 arch/arm/cpu/armv7/omap5/prcm-regs.c
arch/arm/cpu/armv7/omap-common/clocks-common.c +53 -53
@@ -61,7 +61,7 @@ static inline u32 __get_sys_clk_index(void) ind =OMAP_SYS_CLK_IND_38_4_MHZ ; else {/* SYS_CLKSEL - 1 to match the dpll param array indices */ - ind = (readl (&prcm->cm_sys_clksel) & + ind = (readl ((*prcm)->cm_sys_clksel) &CM_SYS_CLKSEL_SYS_CLKSEL_MASK ) -1 ; }return ind;
@@ -76,7 +76,7 @@ u32 get_sys_clk_freq(void)return sys_clk_array[index]; } -static inline void do_bypass_dpll (u32 *const base) +static inline void do_bypass_dpll (u32 const base) {struct dpll_regs *dpll_regs = (struct dpll_regs *)base;
@@ -86,17 +86,17 @@ static inline void do_bypass_dpll(u32 *const base) CM_CLKMODE_DPLL_EN_SHIFT); } -static inline void wait_for_bypass (u32 *const base) +static inline void wait_for_bypass (u32 const base) {struct dpll_regs *const dpll_regs = (struct dpll_regs *)base;if (!wait_on_value (ST_DPLL_CLK_MASK ,0 , &dpll_regs->cm_idlest_dpll,LDELAY )) { -printf ("Bypassing DPLL failed %p\n" , base); +printf ("Bypassing DPLL failed %x\n" , base); } } -static inline void do_lock_dpll (u32 *const base) +static inline void do_lock_dpll (u32 const base) {struct dpll_regs *const dpll_regs = (struct dpll_regs *)base;
@@ -105,18 +105,18 @@ static inline void do_lock_dpll(u32 *const base) DPLL_EN_LOCK << CM_CLKMODE_DPLL_EN_SHIFT); } -static inline void wait_for_lock (u32 *const base) +static inline void wait_for_lock (u32 const base) {struct dpll_regs *const dpll_regs = (struct dpll_regs *)base;if (!wait_on_value (ST_DPLL_CLK_MASK ,ST_DPLL_CLK_MASK , &dpll_regs->cm_idlest_dpll,LDELAY )) { -printf ("DPLL locking failed for %p\n" , base); +printf ("DPLL locking failed for %x\n" , base);hang (); } } -inline u32 check_for_lock (u32 *const base) +inline u32 check_for_lock (u32 const base) {struct dpll_regs *const dpll_regs = (struct dpll_regs *)base;u32 lock =readl (&dpll_regs->cm_idlest_dpll) &ST_DPLL_CLK_MASK ;
@@ -124,7 +124,7 @@ inline u32 check_for_lock(u32 *const base)return lock; } -static void do_setup_dpll (u32 *const base,const struct dpll_params *params, +static void do_setup_dpll (u32 const base,const struct dpll_params *params,u8 lock,char *dpll) {u32 temp,M ,N ;
@@ -236,24 +236,24 @@ void configure_mpu_dpll(void)*/ if ((omap_rev >=OMAP4460_ES1_0 ) && (omap_rev <OMAP5430_ES1_0 )) { mpu_dpll_regs = - (struct dpll_regs *)&prcm->cm_clkmode_dpll_mpu; -bypass_dpll (&prcm->cm_clkmode_dpll_mpu); -clrbits_le32 (&prcm->cm_mpu_mpu_clkctrl, + (struct dpll_regs *)((*prcm)->cm_clkmode_dpll_mpu); +bypass_dpll ((*prcm)->cm_clkmode_dpll_mpu); +clrbits_le32 ((*prcm)->cm_mpu_mpu_clkctrl,MPU_CLKCTRL_CLKSEL_EMIF_DIV_MODE_MASK ); -setbits_le32 (&prcm->cm_mpu_mpu_clkctrl, +setbits_le32 ((*prcm)->cm_mpu_mpu_clkctrl,MPU_CLKCTRL_CLKSEL_ABE_DIV_MODE_MASK );clrbits_le32 (&mpu_dpll_regs->cm_clksel_dpll,CM_CLKSEL_DCC_EN_MASK ); } -setbits_le32 (&prcm->cm_mpu_mpu_clkctrl, +setbits_le32 ((*prcm)->cm_mpu_mpu_clkctrl,MPU_CLKCTRL_CLKSEL_EMIF_DIV_MODE_MASK ); -setbits_le32 (&prcm->cm_mpu_mpu_clkctrl, +setbits_le32 ((*prcm)->cm_mpu_mpu_clkctrl,MPU_CLKCTRL_CLKSEL_ABE_DIV_MODE_MASK ); params =get_mpu_dpll_params (); -do_setup_dpll (&prcm->cm_clkmode_dpll_mpu, params,DPLL_LOCK ,"mpu" ); +do_setup_dpll ((*prcm)->cm_clkmode_dpll_mpu, params,DPLL_LOCK ,"mpu" );debug ("MPU DPLL locked\n" ); }
@@ -277,12 +277,12 @@ static void setup_usb_dpll(void) den = (params->n +1 ) *250 *1000 ; num += den -1 ; sd_div = num / den; -clrsetbits_le32 (&prcm->cm_clksel_dpll_usb, +clrsetbits_le32 ((*prcm)->cm_clksel_dpll_usb,CM_CLKSEL_DPLL_DPLL_SD_DIV_MASK , sd_div <<CM_CLKSEL_DPLL_DPLL_SD_DIV_SHIFT );/* Now setup the dpll with the regular function */ - do_setup_dpll(&prcm->cm_clkmode_dpll_usb, params, DPLL_LOCK, "usb"); + do_setup_dpll((*prcm)->cm_clkmode_dpll_usb, params, DPLL_LOCK, "usb"); }#endif
@@ -301,21 +301,21 @@ static void setup_dplls(void)* using the FREQ_UPDATE method(freq_update_core()) */ if (emif_sdram_type () ==EMIF_SDRAM_TYPE_LPDDR2 ) -do_setup_dpll (&prcm->cm_clkmode_dpll_core, params, +do_setup_dpll ((*prcm)->cm_clkmode_dpll_core, params,DPLL_NO_LOCK ,"core" );else -do_setup_dpll (&prcm->cm_clkmode_dpll_core, params, +do_setup_dpll ((*prcm)->cm_clkmode_dpll_core, params,DPLL_LOCK ,"core" );/* Set the ratios for CORE_CLK, L3_CLK, L4_CLK */ temp = (CLKSEL_CORE_X2_DIV_1 <<CLKSEL_CORE_SHIFT ) | (CLKSEL_L3_CORE_DIV_2 <<CLKSEL_L3_SHIFT ) | (CLKSEL_L4_L3_DIV_2 <<CLKSEL_L4_SHIFT ); -writel (temp, &prcm->cm_clksel_core); +writel (temp, (*prcm)->cm_clksel_core);debug ("Core DPLL configured\n" );/* lock PER dpll */ params =get_per_dpll_params (); -do_setup_dpll (&prcm->cm_clkmode_dpll_per, +do_setup_dpll ((*prcm)->cm_clkmode_dpll_per, params,DPLL_LOCK ,"per" );debug ("PER DPLL locked\n" );
@@ -334,11 +334,11 @@ static void setup_non_essential_dplls(void)const struct dpll_params *params;/* IVA */ -clrsetbits_le32 (&prcm->cm_bypclk_dpll_iva, +clrsetbits_le32 ((*prcm)->cm_bypclk_dpll_iva,CM_BYPCLK_DPLL_IVA_CLKSEL_MASK ,DPLL_IVA_CLKSEL_CORE_X2_DIV_2 ); params =get_iva_dpll_params (); -do_setup_dpll (&prcm->cm_clkmode_dpll_iva, params,DPLL_LOCK ,"iva" ); +do_setup_dpll ((*prcm)->cm_clkmode_dpll_iva, params,DPLL_LOCK ,"iva" );/* Configure ABE dpll */ params =get_abe_dpll_params ();
@@ -350,23 +350,23 @@ static void setup_non_essential_dplls(void)* We need to enable some additional options to achieve * 196.608MHz from 32768 Hz */ -setbits_le32 (&prcm->cm_clkmode_dpll_abe, +setbits_le32 ((*prcm)->cm_clkmode_dpll_abe,CM_CLKMODE_DPLL_DRIFTGUARD_EN_MASK |CM_CLKMODE_DPLL_RELOCK_RAMP_EN_MASK |CM_CLKMODE_DPLL_LPMODE_EN_MASK |CM_CLKMODE_DPLL_REGM4XEN_MASK );/* Spend 4 REFCLK cycles at each stage */ -clrsetbits_le32 (&prcm->cm_clkmode_dpll_abe, +clrsetbits_le32 ((*prcm)->cm_clkmode_dpll_abe,CM_CLKMODE_DPLL_RAMP_RATE_MASK ,1 <<CM_CLKMODE_DPLL_RAMP_RATE_SHIFT );#endif /* Select the right reference clk */ -clrsetbits_le32 (&prcm->cm_abe_pll_ref_clksel, +clrsetbits_le32 ((*prcm)->cm_abe_pll_ref_clksel,CM_ABE_PLL_REF_CLKSEL_CLKSEL_MASK , abe_ref_clk <<CM_ABE_PLL_REF_CLKSEL_CLKSEL_SHIFT );/* Lock the dpll */ - do_setup_dpll(&prcm->cm_clkmode_dpll_abe, params, DPLL_LOCK, "abe"); + do_setup_dpll((*prcm)->cm_clkmode_dpll_abe, params, DPLL_LOCK, "abe"); }#endif
@@ -424,14 +424,14 @@ void do_scale_vcore(u32 vcore_reg, u32 volt_mv) } } -static inline void enable_clock_domain (u32 *const clkctrl_reg,u32 enable_mode) +static inline void enable_clock_domain (u32 const clkctrl_reg,u32 enable_mode) {clrsetbits_le32 (clkctrl_reg,CD_CLKCTRL_CLKTRCTRL_MASK , enable_mode <<CD_CLKCTRL_CLKTRCTRL_SHIFT ); -debug ("Enable clock domain - %p\n" , clkctrl_reg); +debug ("Enable clock domain - %x\n" , clkctrl_reg); } -static inline void wait_for_clk_enable (u32 *clkctrl_addr) +static inline void wait_for_clk_enable (u32 clkctrl_addr) {u32 clkctrl, idlest =MODULE_CLKCTRL_IDLEST_DISABLED ;u32 bound =LDELAY ;
@@ -443,19 +443,19 @@ static inline void wait_for_clk_enable(u32 *clkctrl_addr) idlest = (clkctrl &MODULE_CLKCTRL_IDLEST_MASK ) >>MODULE_CLKCTRL_IDLEST_SHIFT ;if (--bound ==0 ) { -printf ("Clock enable failed for 0x%p idlest 0x%x\n" , +printf ("Clock enable failed for 0x%x idlest 0x%x\n" , clkctrl_addr, clkctrl);return ; } } } -static inline void enable_clock_module (u32 *const clkctrl_addr,u32 enable_mode, +static inline void enable_clock_module (u32 const clkctrl_addr,u32 enable_mode,u32 wait_for_enable) {clrsetbits_le32 (clkctrl_addr,MODULE_CLKCTRL_MODULEMODE_MASK , enable_mode <<MODULE_CLKCTRL_MODULEMODE_SHIFT ); -debug ("Enable clock module - %p\n" , clkctrl_addr); +debug ("Enable clock module - %x\n" , clkctrl_addr);if (wait_for_enable)wait_for_clk_enable (clkctrl_addr); }
@@ -468,10 +468,10 @@ void freq_update_core(void) core_dpll_params =get_core_dpll_params ();/* Put EMIF clock domain in sw wakeup mode */ -enable_clock_domain (&prcm->cm_memif_clkstctrl, +enable_clock_domain ((*prcm)->cm_memif_clkstctrl,CD_CLKCTRL_CLKTRCTRL_SW_WKUP ); -wait_for_clk_enable (&prcm->cm_memif_emif_1_clkctrl); -wait_for_clk_enable (&prcm->cm_memif_emif_2_clkctrl); +wait_for_clk_enable ((*prcm)->cm_memif_emif_1_clkctrl); +wait_for_clk_enable ((*prcm)->cm_memif_emif_2_clkctrl); freq_config1 =SHADOW_FREQ_CONFIG1_FREQ_UPDATE_MASK |SHADOW_FREQ_CONFIG1_DLL_RESET_MASK ;
@@ -483,9 +483,9 @@ void freq_update_core(void) SHADOW_FREQ_CONFIG1_M2_DIV_SHIFT) &SHADOW_FREQ_CONFIG1_M2_DIV_MASK ; -writel (freq_config1, &prcm->cm_shadow_freq_config1); +writel (freq_config1, (*prcm)->cm_shadow_freq_config1);if (!wait_on_value (SHADOW_FREQ_CONFIG1_FREQ_UPDATE_MASK ,0 , - &prcm->cm_shadow_freq_config1,LDELAY )) { + (u32 *) (*prcm)->cm_shadow_freq_config1,LDELAY )) {puts ("FREQ UPDATE procedure failed!!" );hang (); }
@@ -497,20 +497,20 @@ void freq_update_core(void)*/ if (omap_rev !=OMAP5430_ES1_0 ) {/* Put EMIF clock domain back in hw auto mode */ -enable_clock_domain (&prcm->cm_memif_clkstctrl, +enable_clock_domain ((*prcm)->cm_memif_clkstctrl,CD_CLKCTRL_CLKTRCTRL_HW_AUTO ); -wait_for_clk_enable (&prcm->cm_memif_emif_1_clkctrl); -wait_for_clk_enable (&prcm->cm_memif_emif_2_clkctrl); +wait_for_clk_enable ((*prcm)->cm_memif_emif_1_clkctrl); +wait_for_clk_enable ((*prcm)->cm_memif_emif_2_clkctrl); } } -void bypass_dpll (u32 *const base) +void bypass_dpll (u32 const base) {do_bypass_dpll (base);wait_for_bypass (base); } -void lock_dpll (u32 *const base) +void lock_dpll (u32 const base) {do_lock_dpll (base);wait_for_lock (base);
@@ -519,39 +519,39 @@ void lock_dpll(u32 *const base)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 , +clrsetbits_le32 ((*prcm)->cm_l4per_clkstctrl,CD_CLKCTRL_CLKTRCTRL_MASK ,CD_CLKCTRL_CLKTRCTRL_SW_WKUP <<CD_CLKCTRL_CLKTRCTRL_SHIFT );/* Enable all UARTs - console will be on one of them */ -clrsetbits_le32 (&prcm->cm_l4per_uart1_clkctrl, +clrsetbits_le32 ((*prcm)->cm_l4per_uart1_clkctrl,MODULE_CLKCTRL_MODULEMODE_MASK ,MODULE_CLKCTRL_MODULEMODE_SW_EXPLICIT_EN <<MODULE_CLKCTRL_MODULEMODE_SHIFT ); -clrsetbits_le32 (&prcm->cm_l4per_uart2_clkctrl, +clrsetbits_le32 ((*prcm)->cm_l4per_uart2_clkctrl,MODULE_CLKCTRL_MODULEMODE_MASK ,MODULE_CLKCTRL_MODULEMODE_SW_EXPLICIT_EN <<MODULE_CLKCTRL_MODULEMODE_SHIFT ); -clrsetbits_le32 (&prcm->cm_l4per_uart3_clkctrl, +clrsetbits_le32 ((*prcm)->cm_l4per_uart3_clkctrl,MODULE_CLKCTRL_MODULEMODE_MASK ,MODULE_CLKCTRL_MODULEMODE_SW_EXPLICIT_EN <<MODULE_CLKCTRL_MODULEMODE_SHIFT ); -clrsetbits_le32 (&prcm->cm_l4per_uart3_clkctrl, +clrsetbits_le32 ((*prcm)->cm_l4per_uart3_clkctrl,MODULE_CLKCTRL_MODULEMODE_MASK ,MODULE_CLKCTRL_MODULEMODE_SW_EXPLICIT_EN <<MODULE_CLKCTRL_MODULEMODE_SHIFT ); -clrsetbits_le32 (&prcm->cm_l4per_clkstctrl,CD_CLKCTRL_CLKTRCTRL_MASK , +clrsetbits_le32 ((*prcm)->cm_l4per_clkstctrl,CD_CLKCTRL_CLKTRCTRL_MASK ,CD_CLKCTRL_CLKTRCTRL_HW_AUTO <<CD_CLKCTRL_CLKTRCTRL_SHIFT ); } -void do_enable_clocks (u32 *const *clk_domains, -u32 *const *clk_modules_hw_auto, -u32 *const *clk_modules_explicit_en, +void do_enable_clocks (u32 const *clk_domains, +u32 const *clk_modules_hw_auto, +u32 const *clk_modules_explicit_en,u8 wait_for_enable) {u32 i, max =100 ;
arch/arm/cpu/armv7/omap-common/emif-common.c +2 -2
@@ -1289,9 +1289,9 @@ void sdram_init(void)if (!(in_sdram ||warm_reset ())) {if (sdram_type ==EMIF_SDRAM_TYPE_LPDDR2 ) -bypass_dpll (&prcm->cm_clkmode_dpll_core); +bypass_dpll ((*prcm)->cm_clkmode_dpll_core);else -writel (CM_DLL_CTRL_NO_OVERRIDE , &prcm->cm_dll_ctrl); +writel (CM_DLL_CTRL_NO_OVERRIDE , (*prcm)->cm_dll_ctrl); }if (!in_sdram)
arch/arm/cpu/armv7/omap-common/hwinit-common.c +3 -0
@@ -34,6 +34,7 @@#include <asm/emif.h> #include <asm/cache.h> #include <asm/system.h> +#include <asm/omap_common.h> #define ARMV7_DCACHE_WRITEBACK 0xe#define ARMV7_DOMAIN_CLIENT 1
@@ -122,6 +123,8 @@ void spl_display_print(void)void s_init (void ) {init_omap_revision (); +hw_data_init (); +#ifdef CONFIG_SPL_BUILD if (warm_reset () && (omap_revision () <=OMAP5430_ES1_0 ))force_emif_self_refresh ();
arch/arm/cpu/armv7/omap-common/vc.c +6 -5
@@ -81,13 +81,13 @@ void omap_vc_init(u16 speed_khz) cycles_low -=7 ; val = (cycles_hi <<PRM_VC_CFG_I2C_CLK_SCLH_SHIFT ) | (cycles_low <<PRM_VC_CFG_I2C_CLK_SCLL_SHIFT ); -writel (val, &prcm->prm_vc_cfg_i2c_clk); +writel (val, (*prcm)->prm_vc_cfg_i2c_clk); val =CONFIG_OMAP_VC_I2C_HS_MCODE <<PRM_VC_CFG_I2C_MODE_HSMCODE_SHIFT ;/* No HS mode for now */ val &= ~PRM_VC_CFG_I2C_MODE_HSMODEEN_BIT ; -writel (val, &prcm->prm_vc_cfg_i2c_mode); +writel (val, (*prcm)->prm_vc_cfg_i2c_mode); }/**
@@ -113,14 +113,15 @@ int omap_vc_bypass_send_value(u8 sa, u8 reg_addr, u8 reg_data) reg_val = sa <<PRM_VC_VAL_BYPASS_SLAVEADDR_SHIFT | reg_addr <<PRM_VC_VAL_BYPASS_REGADDR_SHIFT | reg_data <<PRM_VC_VAL_BYPASS_DATA_SHIFT ; -writel (reg_val, &prcm->prm_vc_val_bypass); +writel (reg_val, (*prcm)->prm_vc_val_bypass);/* Signal VC to send data */ -writel (reg_val |PRM_VC_VAL_BYPASS_VALID_BIT , &prcm->prm_vc_val_bypass); +writel (reg_val |PRM_VC_VAL_BYPASS_VALID_BIT , + (*prcm)->prm_vc_val_bypass);/* Wait on VC to complete transmission */ do { - reg_val = readl(&prcm->prm_vc_val_bypass) & + reg_val = readl((*prcm)->prm_vc_val_bypass) & PRM_VC_VAL_BYPASS_VALID_BIT; if (!reg_val) break;
arch/arm/cpu/armv7/omap4/Makefile +2 -0
@@ -29,6 +29,8 @@ COBJS += sdram_elpida.o COBJS += hwinit.o COBJS += clocks.o COBJS += emif.o +COBJS += prcm-regs.o +COBJS += hw_data.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS))
arch/arm/cpu/armv7/omap4/clocks.c +99 -100
273 lines not on this page · raw message
arch/arm/cpu/armv7/omap4/hw_data.c new file +38 -0
@@ -0,0 +1,38 @@ +/* +* +* HW data initialization for OMAP4 +* +* (C) Copyright 2013 +* Texas Instruments, <www.ti.com> +* +* Sricharan R <[email protected]> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ +#include <common.h> +#include <asm/arch/omap.h> +#include <asm/omap_common.h> + +struct prcm_regs const **prcm = + (struct prcm_regs const **)OMAP_SRAM_SCRATCH_PRCM_PTR ; + +void hw_data_init (void ) +{ + *prcm = &omap4_prcm; +}
arch/arm/cpu/armv7/omap4/prcm-regs.c new file +267 -0
267 lines not on this page · raw message
arch/arm/cpu/armv7/omap5/Makefile +2 -0
@@ -29,6 +29,8 @@ COBJS += hwinit.o COBJS += clocks.o COBJS += emif.o COBJS += sdram.o +COBJS += prcm-regs.o +COBJS += hw_data.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS))
arch/arm/cpu/armv7/omap5/clocks.c +107 -108
306 lines not on this page · raw message
arch/arm/cpu/armv7/omap5/hw_data.c new file +38 -0
@@ -0,0 +1,38 @@ +/* +* +* HW data initialization for OMAP5 +* +* (C) Copyright 2013 +* Texas Instruments, <www.ti.com> +* +* Sricharan R <[email protected]> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ +#include <common.h> +#include <asm/arch/omap.h> +#include <asm/omap_common.h> + +struct prcm_regs const **prcm = + (struct prcm_regs const **)OMAP_SRAM_SCRATCH_PRCM_PTR ; + +void hw_data_init (void ) +{ + *prcm = &omap5_es1_prcm; +}
arch/arm/cpu/armv7/omap5/prcm-regs.c new file +278 -0
278 lines not on this page · raw message
arch/arm/include/asm/arch-omap4/clocks.h +46 -478
556 lines not on this page · raw message
arch/arm/include/asm/arch-omap4/omap.h +2 -1
@@ -178,7 +178,8 @@ struct control_lpddr2io_regs {#define OMAP4_SRAM_SCRATCH_EMIF_SIZE (SRAM_SCRATCH_SPACE_ADDR + 0x4)#define OMAP4_SRAM_SCRATCH_EMIF_T_NUM (SRAM_SCRATCH_SPACE_ADDR + 0xC)#define OMAP4_SRAM_SCRATCH_EMIF_T_DEN (SRAM_SCRATCH_SPACE_ADDR + 0x10) -#define OMAP4_SRAM_SCRATCH_SPACE_END (SRAM_SCRATCH_SPACE_ADDR + 0x14) +#define OMAP_SRAM_SCRATCH_PRCM_PTR (SRAM_SCRATCH_SPACE_ADDR + 0x14) +#define OMAP4_SRAM_SCRATCH_SPACE_END (SRAM_SCRATCH_SPACE_ADDR + 0x18)/* ROM code defines */ /* Boot device */
arch/arm/include/asm/arch-omap4/sys_proto.h +1 -1
@@ -44,7 +44,7 @@ void sdelay(unsigned long);void set_pl310_ctrl_reg (u32 val);void setup_clocks_for_console (void );void prcm_init (void ); -void bypass_dpll (u32 *const base); +void bypass_dpll (u32 const base);void freq_update_core (void );u32 get_sys_clk_freq (void );u32 omap4_ddr_clk (void );
arch/arm/include/asm/arch-omap5/clocks.h +5 -455
488 lines not on this page · raw message
arch/arm/include/asm/arch-omap5/omap.h +2 -1
@@ -271,7 +271,8 @@ struct omap_sys_ctrl_regs {#define OMAP5_SRAM_SCRATCH_EMIF_SIZE (SRAM_SCRATCH_SPACE_ADDR + 0x4)#define OMAP5_SRAM_SCRATCH_EMIF_T_NUM (SRAM_SCRATCH_SPACE_ADDR + 0xC)#define OMAP5_SRAM_SCRATCH_EMIF_T_DEN (SRAM_SCRATCH_SPACE_ADDR + 0x10) -#define OMAP5_SRAM_SCRATCH_SPACE_END (SRAM_SCRATCH_SPACE_ADDR + 0x14) +#define OMAP_SRAM_SCRATCH_PRCM_PTR (SRAM_SCRATCH_SPACE_ADDR + 0x14) +#define OMAP5_SRAM_SCRATCH_SPACE_END (SRAM_SCRATCH_SPACE_ADDR + 0x18)/* Silicon revisions */ #define OMAP4430_SILICON_ID_INVALID 0xFFFFFFFF
arch/arm/include/asm/arch-omap5/sys_proto.h +1 -1
@@ -44,7 +44,7 @@ u32 wait_on_value(u32, u32, void *, u32);void sdelay (unsigned long );void setup_clocks_for_console (void );void prcm_init (void ); -void bypass_dpll (u32 *const base); +void bypass_dpll (u32 const base);void freq_update_core (void );u32 get_sys_clk_freq (void );u32 omap5_ddr_clk (void );
arch/arm/include/asm/omap_common.h +304 -0
310 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 2/7 ARM: OMAP4+: Change the PRCM structure prototype common for all Socs
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 8 lines · R Sricharan
The current PRCM structure prototype directly matches the hardware
register layout. So there is a need to change this for every new
silicon revision which has register space changes.Avoiding this by making the prototye generic and populating the register addresses seperately for all Socs.
Signed-off-by R Sricharan <[email protected]>
[snip]
Quoted 3 lines
arch/arm/cpu/armv7/omap4/prcm-regs.c| 267 ++++++++++++arch/arm/cpu/armv7/omap5/prcm-regs.c | 278+++++++++++++
These two are missing license information, please fix.
Otherwise, I like the concept and I think it all looks fine. We stay about the same, binary size wise with all of this, correct?
- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBAgAGBQJRCp5zAAoJENk4IS6UOR1WVbwQAJ5oRqFDxGIfBG3Z17BoUWcv NI6A09ay83lss+pnL8hsETx4hc0IWyZKDvHIYMvvdGUk0Cn1mXpmVSOqyZwGQIAI RDOhOE4xdZuaCN39CrNHwmOejC3CgDft25wVuc2AwdfeqOqhdoO8k9aBq78CYgGQ i1xY/bAy0wAu1sxOvFgUlHqkGX+YSn+yCq3FNXgNJ3j+hJ/kemNSurEoeHUDXtwR 9zd16DGiApuywImuMI0qwfXBDTXYm3Rjv+Wsz5QfLNBkNkx0+O1bWsPhZFpB0Ygr EGggUAUYuS4H/ubrH2/j3951apLAuNGdiC/1gFbg8bov6RBSiFP9gXpLKKytTu5H WptzpxvGnNGbNgM8IHDqhUtFnmKg6azOgZilUQl6TO0gBmOi/o6fNvrg9fR2Em5C Eq+/whFsdypHxUkiqGrG57uD3xO7FCuu63yg4NkTX1jn70dGNd+V5Ad/u63Uejzx ut2sr0S9iAc611z1A10pUZGq4pnQCERtiBIZwOJOGPmv0O1oYatP2JNNctmDQs3U LR1/S3KvO9yl7ncpnKDwmO/Cn/RzBZ+xp8VvnwXeB/upVwMWkn9IhyLL1aYQDl4W a6i1oN55Sz911j65d8G66CT4rUMcG9tkcXmH0JQQTunF8O+Gzk8+ImQ5HuFz9qsz TYhk4OvsZeSZXiVVFFBI
=p87D
-----END PGP SIGNATURE-----
PATCH 2/7 ARM: OMAP4+: Change the PRCM structure prototype common for all Socs
Quoted 11 lines · Tom Rini
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Quoted 7 lines · R Sricharan
The current PRCM structure prototype directly matches the hardware
register layout. So there is a need to change this for every new
silicon revision which has register space changes.Avoiding this by making the prototye generic and populating the register addresses seperately for all Socs.
Quoted 8 lines
Quoted 1 line
Signed-off-by R Sricharan <[email protected]>[snip]
Quoted 3 lines
arch/arm/cpu/armv7/omap4/prcm-regs.c| 267 ++++++++++++arch/arm/cpu/armv7/omap5/prcm-regs.c | 278+++++++++++++
These two are missing license information, please fix.
Sorry for missing this. Will send a V2
Quoted 3 lines
Otherwise, I like the concept and I think it all looks fine. We stay about the same, binary size wise with all of this, correct?
Yes,i checked this after the change.The spl size for OMAP4 is still
29KB and less than the limit (32KB). The size is never an issue with OMAP5
Regards,
Sricharan
PATCH 3/7 ARM: OMAP4+: Cleanup the clocks layer
In reply to R SricharanCurrently there is quite a lot of code which is duplicated in the clocks code for OMAP 4 and 5 Socs. Avoiding this here by moving the clocks data to a SOC specific place and the sharing the common code.
This helps in addition of a new Soc with minimal changes.
--- arch/arm/cpu/armv7/omap-common/clocks-common.c | 91 +++++- arch/arm/cpu/armv7/omap-common/hwinit-common.c | 2 +- arch/arm/cpu/armv7/omap4/clocks.c | 393 ----------------------- arch/arm/cpu/armv7/omap4/hw_data.c | 367 +++++++++++++++++++++- arch/arm/cpu/armv7/omap5/clocks.c | 396 ------------------------ arch/arm/cpu/armv7/omap5/hw_data.c | 357 +++++++++++++++++++++ arch/arm/include/asm/arch-omap4/clocks.h | 45 --- arch/arm/include/asm/arch-omap4/omap.h | 3 +- arch/arm/include/asm/arch-omap4/sys_proto.h | 2 +- arch/arm/include/asm/arch-omap5/clocks.h | 50 --- arch/arm/include/asm/arch-omap5/omap.h | 3 +- arch/arm/include/asm/arch-omap5/sys_proto.h | 2 +- arch/arm/include/asm/omap_common.h | 63 ++++ 13 files changed, 875 insertions(+), 899 deletions(-)
arch/arm/cpu/armv7/omap-common/clocks-common.c +82 -9
@@ -47,6 +47,16 @@#define puts (s)#endif +const u32 sys_clk_array[8 ] = { +12000000 ,/* 12 MHz */ +13000000 ,/* 13 MHz */ +16800000 ,/* 16.8 MHz */ +19200000 ,/* 19.2 MHz */ +26000000 ,/* 26 MHz */ +27000000 ,/* 27 MHz */ +38400000 ,/* 38.4 MHz */ +}; +static inline u32 __get_sys_clk_index (void ) {u32 ind;
@@ -76,6 +86,29 @@ u32 get_sys_clk_freq(void)return sys_clk_array[index]; } +void setup_post_dividers (u32 const base,const struct dpll_params *params) +{ +struct dpll_regs *const dpll_regs = (struct dpll_regs *)base; + +/* Setup post-dividers */ +if (params->m2 >=0 ) +writel (params->m2, &dpll_regs->cm_div_m2_dpll); +if (params->m3 >=0 ) +writel (params->m3, &dpll_regs->cm_div_m3_dpll); +if (params->m4_h11 >=0 ) +writel (params->m4_h11, &dpll_regs->cm_div_m4_h11_dpll); +if (params->m5_h12 >=0 ) +writel (params->m5_h12, &dpll_regs->cm_div_m5_h12_dpll); +if (params->m6_h13 >=0 ) +writel (params->m6_h13, &dpll_regs->cm_div_m6_h13_dpll); +if (params->m7_h14 >=0 ) +writel (params->m7_h14, &dpll_regs->cm_div_m7_h14_dpll); +if (params->h22 >=0 ) +writel (params->h22, &dpll_regs->cm_div_h22_dpll); +if (params->h23 >=0 ) +writel (params->h23, &dpll_regs->cm_div_h23_dpll); +} +static inline void do_bypass_dpll (u32 const base) {struct dpll_regs *dpll_regs = (struct dpll_regs *)base;
@@ -124,6 +157,46 @@ inline u32 check_for_lock(u32 const base)return lock; } +const struct dpll_params *get_mpu_dpll_params (struct dplls const *dpll_data) +{ +u32 sysclk_ind =get_sys_clk_index (); +return &dpll_data->mpu[sysclk_ind]; +} + +const struct dpll_params *get_core_dpll_params (struct dplls const *dpll_data) +{ +u32 sysclk_ind =get_sys_clk_index (); +return &dpll_data->core[sysclk_ind]; +} + +const struct dpll_params *get_per_dpll_params (struct dplls const *dpll_data) +{ +u32 sysclk_ind =get_sys_clk_index (); +return &dpll_data->per[sysclk_ind]; +} + +const struct dpll_params *get_iva_dpll_params (struct dplls const *dpll_data) +{ +u32 sysclk_ind =get_sys_clk_index (); +return &dpll_data->iva[sysclk_ind]; +} + +const struct dpll_params *get_usb_dpll_params (struct dplls const *dpll_data) +{ +u32 sysclk_ind =get_sys_clk_index (); +return &dpll_data->usb[sysclk_ind]; +} + +const struct dpll_params *get_abe_dpll_params (struct dplls const *dpll_data) +{ +#ifdef CONFIG_SYS_OMAP_ABE_SYSCK +u32 sysclk_ind =get_sys_clk_index (); +return &dpll_data->abe[sysclk_ind]; +#else +return dpll_data->abe; +#endif +} +static void do_setup_dpll (u32 const base,const struct dpll_params *params,u8 lock,char *dpll) {
@@ -184,7 +257,7 @@ u32 omap_ddr_clk(void) omap_rev =omap_revision (); sys_clk_khz =get_sys_clk_freq () /1000 ; - core_dpll_params =get_core_dpll_params (); + core_dpll_params =get_core_dpll_params (*dplls_data);debug ("sys_clk %d\n " , sys_clk_khz *1000 );
@@ -251,7 +324,7 @@ void configure_mpu_dpll(void)setbits_le32 ((*prcm)->cm_mpu_mpu_clkctrl,MPU_CLKCTRL_CLKSEL_ABE_DIV_MODE_MASK ); - params =get_mpu_dpll_params (); + params =get_mpu_dpll_params (*dplls_data);do_setup_dpll ((*prcm)->cm_clkmode_dpll_mpu, params,DPLL_LOCK ,"mpu" );debug ("MPU DPLL locked\n" );
@@ -272,7 +345,7 @@ static void setup_usb_dpll(void)* Use CLKINP in KHz and adjust the denominator accordingly so * that we have enough accuracy and at the same time no overflow */ - params =get_usb_dpll_params (); + params =get_usb_dpll_params (*dplls_data); num = params->m * sys_clk_khz; den = (params->n +1 ) *250 *1000 ; num += den -1 ;
@@ -294,7 +367,7 @@ static void setup_dplls(void)debug ("setup_dplls\n" );/* CORE dpll */ - params =get_core_dpll_params ();/* default - safest */ + params =get_core_dpll_params (*dplls_data);/* default - safest */ /* * Do not lock the core DPLL now. Just set it up. * Core DPLL will be locked after setting up EMIF
@@ -314,7 +387,7 @@ static void setup_dplls(void)debug ("Core DPLL configured\n" );/* lock PER dpll */ - params =get_per_dpll_params (); + params =get_per_dpll_params (*dplls_data);do_setup_dpll ((*prcm)->cm_clkmode_dpll_per, params,DPLL_LOCK ,"per" );debug ("PER DPLL locked\n" );
@@ -337,11 +410,11 @@ static void setup_non_essential_dplls(void)clrsetbits_le32 ((*prcm)->cm_bypclk_dpll_iva,CM_BYPCLK_DPLL_IVA_CLKSEL_MASK ,DPLL_IVA_CLKSEL_CORE_X2_DIV_2 ); - params =get_iva_dpll_params (); + params =get_iva_dpll_params (*dplls_data);do_setup_dpll ((*prcm)->cm_clkmode_dpll_iva, params,DPLL_LOCK ,"iva" );/* Configure ABE dpll */ - params =get_abe_dpll_params (); + params =get_abe_dpll_params (*dplls_data);#ifdef CONFIG_SYS_OMAP_ABE_SYSCK abe_ref_clk =CM_ABE_PLL_REF_CLKSEL_CLKSEL_SYSCLK ;#else
@@ -466,7 +539,7 @@ void freq_update_core(void)const struct dpll_params *core_dpll_params;u32 omap_rev =omap_revision (); - core_dpll_params =get_core_dpll_params (); + core_dpll_params =get_core_dpll_params (*dplls_data);/* Put EMIF clock domain in sw wakeup mode */ enable_clock_domain ((*prcm)->cm_memif_clkstctrl,CD_CLKCTRL_CLKTRCTRL_SW_WKUP );
@@ -583,7 +656,7 @@ void do_enable_clocks(u32 const *clk_domains, } } -void prcm_init (void ) +void prcm_init (struct vcores_data *omap_vcores) {switch (omap_hw_init_context ()) {case OMAP_INIT_CONTEXT_SPL :
arch/arm/cpu/armv7/omap-common/hwinit-common.c +1 -1
@@ -139,7 +139,7 @@ void s_init(void)preloader_console_init ();do_io_settings ();#endif -prcm_init (); +#ifdef CONFIG_SPL_BUILD timer_init ();
arch/arm/cpu/armv7/omap4/clocks.c +0 -393
402 lines not on this page · raw message
arch/arm/cpu/armv7/omap4/hw_data.c +366 -1
378 lines not on this page · raw message
arch/arm/cpu/armv7/omap5/clocks.c +0 -396
405 lines not on this page · raw message
arch/arm/cpu/armv7/omap5/hw_data.c +357 -0
369 lines not on this page · raw message
arch/arm/include/asm/arch-omap4/clocks.h +0 -45
55 lines not on this page · raw message
arch/arm/include/asm/arch-omap4/omap.h +2 -1
@@ -179,7 +179,8 @@ struct control_lpddr2io_regs {#define OMAP4_SRAM_SCRATCH_EMIF_T_NUM (SRAM_SCRATCH_SPACE_ADDR + 0xC)#define OMAP4_SRAM_SCRATCH_EMIF_T_DEN (SRAM_SCRATCH_SPACE_ADDR + 0x10)#define OMAP_SRAM_SCRATCH_PRCM_PTR (SRAM_SCRATCH_SPACE_ADDR + 0x14) -#define OMAP4_SRAM_SCRATCH_SPACE_END (SRAM_SCRATCH_SPACE_ADDR + 0x18) +#define OMAP_SRAM_SCRATCH_DPLLS_PTR (SRAM_SCRATCH_SPACE_ADDR + 0x18) +#define OMAP4_SRAM_SCRATCH_SPACE_END (SRAM_SCRATCH_SPACE_ADDR + 0x1C)/* ROM code defines */ /* Boot device */
arch/arm/include/asm/arch-omap4/sys_proto.h +1 -1
@@ -43,7 +43,7 @@ u32 wait_on_value(u32, u32, void *, u32);void sdelay (unsigned long );void set_pl310_ctrl_reg (u32 val);void setup_clocks_for_console (void ); -void prcm_init (void ); +void prcm_init (struct vcores_data *);void bypass_dpll (u32 const base);void freq_update_core (void );u32 get_sys_clk_freq (void );
arch/arm/include/asm/arch-omap5/clocks.h +0 -50
58 lines not on this page · raw message
arch/arm/include/asm/arch-omap5/omap.h +2 -1
@@ -272,7 +272,8 @@ struct omap_sys_ctrl_regs {#define OMAP5_SRAM_SCRATCH_EMIF_T_NUM (SRAM_SCRATCH_SPACE_ADDR + 0xC)#define OMAP5_SRAM_SCRATCH_EMIF_T_DEN (SRAM_SCRATCH_SPACE_ADDR + 0x10)#define OMAP_SRAM_SCRATCH_PRCM_PTR (SRAM_SCRATCH_SPACE_ADDR + 0x14) -#define OMAP5_SRAM_SCRATCH_SPACE_END (SRAM_SCRATCH_SPACE_ADDR + 0x18) +#define OMAP_SRAM_SCRATCH_DPLLS_PTR (SRAM_SCRATCH_SPACE_ADDR + 0x18) +#define OMAP5_SRAM_SCRATCH_SPACE_END (SRAM_SCRATCH_SPACE_ADDR + 0x1C)/* Silicon revisions */ #define OMAP4430_SILICON_ID_INVALID 0xFFFFFFFF
arch/arm/include/asm/arch-omap5/sys_proto.h +1 -1
@@ -43,7 +43,7 @@ void sr32(void *, u32, u32, u32);u32 wait_on_value (u32 ,u32 ,void *,u32 );void sdelay (unsigned long );void setup_clocks_for_console (void ); -void prcm_init (void ); +void prcm_init (struct vcores_data *);void bypass_dpll (u32 const base);void freq_update_core (void );u32 get_sys_clk_freq (void );
arch/arm/include/asm/omap_common.h +63 -0
80 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 3/7 ARM: OMAP4+: Cleanup the clocks layer
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 8 lines · R Sricharan
Currently there is quite a lot of code which is duplicated in the clocks code for OMAP 4 and 5 Socs. Avoiding this here by moving the clocks data to a SOC specific place and the sharing the common code.
This helps in addition of a new Soc with minimal changes.
Signed-off-by R Sricharan <[email protected]>
- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBAgAGBQJRCp8NAAoJENk4IS6UOR1WTDAP/2u9KQ/Y7eNzHL/yEHPhhuIw JVXUopXjUk/ZtZWO3pQnb7JrioLqJbjuZfdvDbLxyfzJH5oJGLbQW59tKajS+zLn sE47/n9bJZ58yF93HQzpqje8w6RfCZ0fgQAuzUg6IG5grTSUShbMNrwZfM4bZG5C vTz41BUpt2pSb0epb33Q4tc4pz3jgq8FrNFDy7kO63GEGzbeAwxE553/Cylo8AJ/ kVDhNXm2zseGmrf/q4acBL5ryWXjd7WncDIAF8nY/N1nsv4Hcp7G3kykn9oe9zXM GzX/OUN1R5nJ9aeHBiXhg1195quJAmHI8N4AC1ReeRjkI48Pv0xIT91VsMuvQApe Rjoh4P/QMUuIJlZgWez0t4waoU9a5N4F/Svx/aRaJ/AgH4KallNoMRVzHvx4W9aT +nc0GhGuHHdW57iSM2FdNgQc/E0Iu1VG1eNAdooKZcGDpKS1dIGWwfr4PSwP6Plp QvkDZpBKN2wTqN/e35TA2R9rR6EZmLktB+xRUu4HH1VXpqpf+L+KY4DypTyNDgjz ApWcC1Irb4617BM2WgbHh81X0XJ+CjAP+tq3RfKzZCl07lXXXjI561L5gXn0PtlH DNQbmJiRJ7caN3bm6zEnY/Ap2NQ5FGQD4Fd7af9wFhQsFfCiHTqrlUrwMwdwkLJd UDzXcWPPTvO1uRKyJQls
=fkAc
-----END PGP SIGNATURE-----
PATCH 4/7 ARM: OMAP4+: Clean up the pmic code
In reply to R SricharanThe pmic code is duplicated for OMAP 4 and 5.
Instead move the data to Soc specific place and
share the code.
--- arch/arm/cpu/armv7/omap-common/clocks-common.c | 79 +++++++++------ arch/arm/cpu/armv7/omap4/Makefile | 1 - arch/arm/cpu/armv7/omap4/clocks.c | 123 ------------------------ arch/arm/cpu/armv7/omap4/hw_data.c | 54 +++++++++++ arch/arm/cpu/armv7/omap5/Makefile | 1 - arch/arm/cpu/armv7/omap5/clocks.c | 97 ------------------- arch/arm/cpu/armv7/omap5/hw_data.c | 32 ++++++ arch/arm/include/asm/arch-omap4/clocks.h | 5 - arch/arm/include/asm/arch-omap5/clocks.h | 4 - arch/arm/include/asm/omap_common.h | 24 +++++ include/configs/omap5_evm.h | 1 + 11 files changed, 163 insertions(+), 258 deletions(-)
arch/arm/cpu/armv7/omap-common/clocks-common.c +52 -27
@@ -443,44 +443,45 @@ static void setup_non_essential_dplls(void) }#endif -void do_scale_tps62361 (int gpio,u32 reg,u32 volt_mv) +u32 get_offset_code (u32 volt_offset,struct pmic_data *pmic) { -u32 step; -int ret =0 ; - -/* See if we can first get the GPIO if needed */ -if (gpio >=0 ) - ret =gpio_request (gpio,"TPS62361_VSEL0_GPIO" ); -if (ret <0 ) { -printf ("%s: gpio %d request failed %d\n" , __func__, gpio, ret); - gpio =-1 ; - } - -/* Pull the GPIO low to select SET0 register, while we program SET1 */ -if (gpio >=0 ) -gpio_direction_output (gpio,0 ); +u32 offset_code; - step = volt_mv -TPS62361_BASE_VOLT_MV ; - step /=10 ; + volt_offset -= pmic->base_offset; -debug ("do_scale_tps62361: volt - %d step - 0x%x\n" , volt_mv, step); -if (omap_vc_bypass_send_value (TPS62361_I2C_SLAVE_ADDR , reg, step)) -puts ("Scaling voltage failed for vdd_mpu from TPS\n" ); + offset_code = (volt_offset + pmic->step -1 ) / pmic->step; -/* Pull the GPIO high to select SET1 register */ -if (gpio >=0 ) -gpio_direction_output (gpio,1 ); +/* +* Offset codes 1-6 all give the base voltage in Palmas +* Offset code 0 switches OFF the SMPS +*/ +return offset_code + pmic->start_code; } -void do_scale_vcore (u32 vcore_reg,u32 volt_mv) +void do_scale_vcore (u32 vcore_reg,u32 volt_mv,struct pmic_data *pmic) {u32 offset_code;u32 offset = volt_mv; +int ret =0 ; + +/* See if we can first get the GPIO if needed */ +if (pmic->gpio_en) + ret =gpio_request (pmic->gpio,"PMIC_GPIO" ); + +if (ret <0 ) { +printf ("%s: gpio %d request failed %d\n" , __func__, + pmic->gpio, ret); +return ; + } + +/* Pull the GPIO low to select SET0 register, while we program SET1 */ +if (pmic->gpio_en) +gpio_direction_output (pmic->gpio,0 );/* convert to uV for better accuracy in the calculations */ offset *=1000 ; - offset_code =get_offset_code (offset); + offset_code =get_offset_code (offset, pmic);debug ("do_scale_vcore: volt - %d offset_code - 0x%x\n" , volt_mv, offset_code);
@@ -489,7 +490,31 @@ void do_scale_vcore(u32 vcore_reg, u32 volt_mv) vcore_reg, offset_code))printf ("Scaling voltage failed for 0x%x\n" , vcore_reg); -if (emif_sdram_type () ==EMIF_SDRAM_TYPE_DDR3 ) { +/* Pull the GPIO high to select SET1 register */ +if (pmic->gpio_en) +gpio_direction_output (pmic->gpio,1 ); +} + +/* +* Setup the voltages for vdd_mpu, vdd_core, and vdd_iva +* We set the maximum voltages allowed here because Smart-Reflex is not +* enabled in bootloader. Voltage initialization in the kernel will set +* these to the nominal values after enabling Smart-Reflex +*/ +void scale_vcores (struct vcores_data *vcores) +{ +omap_vc_init (PRM_VC_I2C_CHANNEL_FREQ_KHZ ); + +do_scale_vcore (vcores->core.addr, vcores->core.value, + vcores->core.pmic); + +do_scale_vcore (vcores->mpu.addr, vcores->mpu.value, + vcores->mpu.pmic); + +do_scale_vcore (vcores->mm.addr, vcores->mm.value, + vcores->mm.pmic); + +if (emif_sdram_type () ==EMIF_SDRAM_TYPE_DDR3 ) {/* Configure LDO SRAM "magic" bits */ writel (2 , (*prcm)->prm_sldo_core_setup);writel (2 , (*prcm)->prm_sldo_mpu_setup);
@@ -663,7 +688,7 @@ void prcm_init(struct vcores_data *omap_vcores)case OMAP_INIT_CONTEXT_UBOOT_FROM_NOR :case OMAP_INIT_CONTEXT_UBOOT_AFTER_CH :enable_basic_clocks (); -scale_vcores (); +scale_vcores (omap_vcores);setup_dplls ();#ifdef CONFIG_SYS_CLOCKS_ENABLE_ALL setup_non_essential_dplls ();
arch/arm/cpu/armv7/omap4/Makefile +0 -1
@@ -27,7 +27,6 @@ LIB = $(obj)lib$(SOC).o COBJS += sdram_elpida.o COBJS += hwinit.o -COBJS += clocks.o COBJS += emif.o COBJS += prcm-regs.o COBJS += hw_data.o
arch/arm/cpu/armv7/omap4/clocks.c +0 -123
123 lines not on this page · raw message
arch/arm/cpu/armv7/omap4/hw_data.c +54 -0
88 lines not on this page · raw message
arch/arm/cpu/armv7/omap5/Makefile +0 -1
@@ -26,7 +26,6 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(SOC).o COBJS += hwinit.o -COBJS += clocks.o COBJS += emif.o COBJS += sdram.o COBJS += prcm-regs.o
arch/arm/cpu/armv7/omap5/clocks.c +0 -97
97 lines not on this page · raw message
arch/arm/cpu/armv7/omap5/hw_data.c +32 -0
@@ -30,6 +30,7 @@#include <asm/arch/sys_proto.h> #include <asm/omap_common.h> #include <asm/arch/clocks.h> +#include <asm/omap_gpio.h> #include <asm/io.h> struct prcm_regs const **prcm =
@@ -179,6 +180,34 @@ struct dplls omap5_dplls_es1 = { .usb = usb_dpll_params_1920mhz }; +struct pmic_data palmas = { + .base_offset =PALMAS_SMPS_BASE_VOLT_UV , + .step =10000 ,/* 10 mV represented in uV */ +/* +* Offset codes 1-6 all give the base voltage in Palmas +* Offset code 0 switches OFF the SMPS +*/ + .start_code =6 , +}; + +struct vcores_data omap5430_volts = { + .mpu.value =VDD_MPU , .mpu.addr =SMPS_REG_ADDR_12_MPU , + .mpu.pmic = &palmas, + .core.value =VDD_CORE , .core.addr =SMPS_REG_ADDR_8_CORE , + .core.pmic = &palmas, + .mm.value =VDD_MM , .mm.addr =SMPS_REG_ADDR_45_IVA , + .mm.pmic = &palmas, +}; + +struct vcores_data omap5432_volts = { + .mpu.value =VDD_MPU_5432 , .mpu.addr =SMPS_REG_ADDR_12_MPU , + .mpu.pmic = &palmas, + .core.value =VDD_CORE_5432 , .core.addr =SMPS_REG_ADDR_8_CORE , + .core.pmic = &palmas, + .mm.value =VDD_MM_5432 , .mm.addr =SMPS_REG_ADDR_45_IVA , + .mm.pmic = &palmas, +}; +/* * Enable essential clock domains, modules and * do some additional special settings needed
@@ -374,17 +403,20 @@ void enable_non_essential_clocks(void)void hw_data_init (void ) {u32 omap_rev =omap_revision (); +struct vcores_data *omap_vcores =0 ;switch (omap_rev) {case OMAP5430_ES1_0 : *prcm = &omap5_es1_prcm; *dplls_data = &omap5_dplls_es1; + omap_vcores = &omap5430_volts;break ;case OMAP5432_ES1_0 : *prcm = &omap5_es1_prcm; *dplls_data = &omap5_dplls_es1; + omap_vcores = &omap5432_volts;break ;default :
arch/arm/include/asm/arch-omap4/clocks.h +0 -5
@@ -242,11 +242,6 @@#define DPLL_NO_LOCK 0#define DPLL_LOCK 1 -void scale_vcores (void ); -void do_scale_tps62361 (int gpio,u32 reg,u32 volt_mv); -u32 get_offset_code (u32 offset); -void do_scale_vcore (u32 vcore_reg,u32 volt_mv); -struct omap4_scrm_regs {u32 revision;/* 0x0000 */ u32 pad00[63 ];
arch/arm/include/asm/arch-omap5/clocks.h +0 -4
@@ -234,8 +234,4 @@#define DPLL_NO_LOCK 0#define DPLL_LOCK 1 -void scale_vcores (void ); -void do_scale_tps62361 (int gpio,u32 reg,u32 volt_mv); -u32 get_offset_code (u32 offset); -void do_scale_vcore (u32 vcore_reg,u32 volt_mv);#endif /* _CLOCKS_OMAP5_H_ */
arch/arm/include/asm/omap_common.h +24 -0
@@ -364,10 +364,31 @@ struct dplls {const struct dpll_params *usb; }; +struct pmic_data { +u32 base_offset; +u32 step; +u32 start_code; +unsigned gpio; +int gpio_en; +}; + +struct volts { +u32 value; +u32 addr; +struct pmic_data *pmic; +}; + +struct vcores_data { +struct volts mpu; +struct volts core; +struct volts mm; +}; +extern struct prcm_regs const **prcm;extern struct prcm_regs const omap5_es1_prcm;extern struct prcm_regs const omap4_prcm;extern struct dplls const **dplls_data; +extern struct vcores_data *omap_vcores;extern const u32 sys_clk_array[8 ];void hw_data_init (void );
@@ -391,6 +412,9 @@ u32 get_sys_clk_index(void);void enable_basic_clocks (void );void enable_basic_uboot_clocks (void );void enable_non_essential_clocks (void ); +void scale_vcores (struct vcores_data *vcores); +u32 get_offset_code (u32 volt_offset,struct pmic_data *pmic); +void do_scale_vcore (u32 vcore_reg,u32 volt_mv,struct pmic_data *pmic);/* Max value for DPLL multiplier M */ #define OMAP_DPLL_MAX_N 127
include/configs/omap5_evm.h +1 -0
@@ -264,5 +264,6 @@#define CONFIG_SPL_BSS_MAX_SIZE 0x100000/* 1 MB */ #define CONFIG_SYS_SPL_MALLOC_START 0x84100000#define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000/* 1 MB */ +#define CONFIG_SPL_GPIO_SUPPORT #endif /* __CONFIG_H */
Signature · 1 line
1.7.9.5
PATCH 4/7 ARM: OMAP4+: Clean up the pmic code
Quoted 5 lines · R Sricharan
The pmic code is duplicated for OMAP 4 and 5.
Instead move the data to Soc specific place and
share the code.Signed-off-by R Sricharan <[email protected]>
[snip]
Quoted 1 line
+++
b/arch/arm/cpu/armv7/omap4/hw_data.c
[snip]
arch/arm/cpu/armv7/omap4/hw_data.c struct dplls omap4460_dplls = { · line 222
Quoted 3 lines
arch/arm/cpu/armv7/omap4/hw_data.c +3
-0+struct vcores_data omap4430_volts_es1 = { + .mpu.value =1325 , .mpu.addr =SMPS_REG_ADDR_VCORE1 , + .mpu.pmic = &twl6030_4430es1,
Here and in omap5/hw_data.c, split these up into multiple lines.
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/20130131/bd294ef1/attachment.pgp>
PATCH 4/7 ARM: OMAP4+: Clean up the pmic code
Hi Tom,
Quoted 7 lines · Tom Rini
Quoted 5 lines · R Sricharan
The pmic code is duplicated for OMAP 4 and 5.
Instead move the data to Soc specific place and
share the code.Signed-off-by R Sricharan <[email protected]>
Quoted 9 lines
[snip]
Quoted 1 line
+++
b/arch/arm/cpu/armv7/omap4/hw_data.c[snip]
arch/arm/cpu/armv7/omap4/hw_data.c struct dplls omap4460_dplls = { · line 222
Quoted 3 lines
arch/arm/cpu/armv7/omap4/hw_data.c +3
-0+struct vcores_data omap4430_volts_es1 = { + .mpu.value =1325 , .mpu.addr =SMPS_REG_ADDR_VCORE1 , + .mpu.pmic = &twl6030_4430es1,Here and in
omap5/hw_data.c, split these up into multiple lines.
Thanks for reviewing all. Will correct this and send a consolidated V2.
Regards,
Sricharan
PATCH 5/7 ARM: OMAP4+: Cleanup emif specific files
In reply to R SricharanFrom: Lokesh Vutla <[email protected]>
Removing the duplicated code in ddr3 initialization. Also creating structure for lpddr2 mode registers to avoid unnessecary revision checks.
These change reduces code addition for future Socs.
--- arch/arm/cpu/armv7/omap-common/emif-common.c | 46 ++-------- arch/arm/cpu/armv7/omap4/sdram_elpida.c | 16 +++- arch/arm/cpu/armv7/omap5/sdram.c | 119 +++++++++++++++++--------- arch/arm/include/asm/emif.h | 12 ++- 4 files changed, 108 insertions(+), 85 deletions(-)
arch/arm/cpu/armv7/omap-common/emif-common.c +9 -37
@@ -123,11 +123,13 @@ void emif_reset_phy(u32 base)static void do_lpddr2_init (u32 base,u32 cs) {u32 mr_addr; +const struct lpddr2_mr_regs *mr_regs; +get_lpddr2_mr_regs (&mr_regs);/* Wait till device auto initialization is complete */ while (get_mr (base, cs,LPDDR2_MR0 ) &LPDDR2_MR0_DAI_MASK ) ; -set_mr (base, cs,LPDDR2_MR10 ,MR10_ZQ_ZQINIT ); +set_mr (base, cs,LPDDR2_MR10 , mr_regs->mr10);/* * tZQINIT = 1 us * Enough loops assuming a maximum of 2GHz
@@ -135,22 +137,18 @@ static void do_lpddr2_init(u32 base, u32 cs)sdelay (2000 ); -if (omap_revision () >=OMAP5430_ES1_0 ) -set_mr (base, cs,LPDDR2_MR1 ,MR1_BL_8_BT_SEQ_WRAP_EN_NWR_8 ); -else -set_mr (base, cs,LPDDR2_MR1 ,MR1_BL_8_BT_SEQ_WRAP_EN_NWR_3 ); - -set_mr (base, cs,LPDDR2_MR16 ,MR16_REF_FULL_ARRAY ); +set_mr (base, cs,LPDDR2_MR1 , mr_regs->mr1); +set_mr (base, cs,LPDDR2_MR16 , mr_regs->mr16);/* * Enable refresh along with writing MR2 * Encoding of RL in MR2 is (RL - 2) */ mr_addr =LPDDR2_MR2 |EMIF_REG_REFRESH_EN_MASK ; -set_mr (base, cs, mr_addr,RL_FINAL -2 ); +set_mr (base, cs, mr_addr, mr_regs->mr2); -if (omap_revision () >=OMAP5430_ES1_0 ) -set_mr (base, cs,LPDDR2_MR3 ,0x1 ); +if (mr_regs->mr3 >0 ) +set_mr (base, cs,LPDDR2_MR3 , mr_regs->mr3); }static void lpddr2_init (u32 base,const struct emif_regs *regs)
@@ -268,9 +266,6 @@ static void ddr3_leveling(u32 base, const struct emif_regs *regs)static void ddr3_init (u32 base,const struct emif_regs *regs) {struct emif_reg_struct *emif = (struct emif_reg_struct *)base; -u32 *ext_phy_ctrl_base =0 ; -u32 *emif_ext_phy_ctrl_base =0 ; -u32 i =0 ;/* * Set SDRAM_CONFIG and PHY control registers to locked frequency
@@ -290,27 +285,7 @@ static void ddr3_init(u32 base, const struct emif_regs *regs)writel (regs->ref_ctrl, &emif->emif_sdram_ref_ctrl);writel (regs->read_idle_ctrl, &emif->emif_read_idlectrl); - ext_phy_ctrl_base = (u32 *) &(regs->emif_ddr_ext_phy_ctrl_1); - emif_ext_phy_ctrl_base = (u32 *) &(emif->emif_ddr_ext_phy_ctrl_1); - -/* Configure external phy control timing registers */ -for (i =0 ; i <EMIF_EXT_PHY_CTRL_TIMING_REG ; i++) { -writel (*ext_phy_ctrl_base, emif_ext_phy_ctrl_base++); -/* Update shadow registers */ -writel (*ext_phy_ctrl_base++, emif_ext_phy_ctrl_base++); - } - -/* -* external phy 6-24 registers do not change with -* ddr frequency -*/ -for (i =0 ; i <EMIF_EXT_PHY_CTRL_CONST_REG ; i++) { -writel (ddr3_ext_phy_ctrl_const_base[i], - emif_ext_phy_ctrl_base++); -/* Update shadow registers */ -writel (ddr3_ext_phy_ctrl_const_base[i], - emif_ext_phy_ctrl_base++); - } +do_ext_phy_settings (base, regs);/* enable leveling */ writel (regs->emif_rd_wr_lvl_rmp_ctl, &emif->emif_rd_wr_lvl_rmp_ctl);
@@ -1109,9 +1084,6 @@ void emif_post_init_config(u32 base)struct emif_reg_struct *emif = (struct emif_reg_struct *)base;u32 omap_rev =omap_revision (); -if (omap_rev ==OMAP5430_ES1_0 ) -return ; -/* reset phy on ES2.0 */ if (omap_rev ==OMAP4430_ES2_0 )emif_reset_phy (base);
arch/arm/cpu/armv7/omap4/sdram_elpida.c +13 -3
@@ -90,9 +90,6 @@ const struct emif_regs emif_regs_elpida_400_mhz_2cs = { .emif_ddr_phy_ctlr_1 = 0x049ff418 }; -/* Dummy registers for OMAP44xx */ -const u32 ddr3_ext_phy_ctrl_const_base[EMIF_EXT_PHY_CTRL_CONST_REG ]; -const struct dmm_lisa_map_regs lisa_map_2G_x_1_x_2 = { .dmm_lisa_map_0 =0xFF020100 , .dmm_lisa_map_1 =0 ,
@@ -284,3 +281,16 @@ void emif_get_device_timings(u32 emif_nr, __attribute__((weak, alias("emif_get_device_timings_sdp")));#endif /* CONFIG_SYS_DEFAULT_LPDDR2_TIMINGS */ + +const struct lpddr2_mr_regs mr_regs = { + .mr1 =MR1_BL_8_BT_SEQ_WRAP_EN_NWR_3 , + .mr2 =0x4 , + .mr3 =-1 , + .mr10 =MR10_ZQ_ZQINIT , + .mr16 =MR16_REF_FULL_ARRAY +}; + +void get_lpddr2_mr_regs (const struct lpddr2_mr_regs **regs) +{ + *regs = &mr_regs; +}
arch/arm/cpu/armv7/omap5/sdram.c +77 -42
156 lines not on this page · raw message
arch/arm/include/asm/emif.h +9 -3
@@ -698,9 +698,6 @@ struct dmm_lisa_map_regs {u32 dmm_lisa_map_3; }; -extern const u32 ext_phy_ctrl_const_base[EMIF_EXT_PHY_CTRL_CONST_REG ]; -extern const u32 ddr3_ext_phy_ctrl_const_base[EMIF_EXT_PHY_CTRL_CONST_REG ]; -#define CS0 0#define CS1 1/* The maximum frequency@which the LPDDR2 interface can operate in Hz*/
@@ -1134,6 +1131,14 @@ struct emif_regs {u32 emif_rd_wr_exec_thresh; }; +struct lpddr2_mr_regs { +s8 mr1; +s8 mr2; +s8 mr3; +s8 mr10; +s8 mr16; +}; +/* assert macros */ #if defined(DEBUG )#define emif_assert (c) ({ if (!(c)) for (;;); })
@@ -1153,6 +1158,7 @@ void emif_get_device_timings(u32 emif_nr,#endif void do_ext_phy_settings (u32 base,const struct emif_regs *regs); +void get_lpddr2_mr_regs (const struct lpddr2_mr_regs **regs);#ifndef CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS extern u32 *const T_num;
Signature · 1 line
1.7.9.5
PATCH 5/7 ARM: OMAP4+: Cleanup emif specific files
Quoted 10 lines · R Sricharan
From: Lokesh Vutla <[email protected]>
Removing the duplicated code in ddr3 initialization. Also creating structure for lpddr2 mode registers to avoid unnessecary revision checks.
These change reduces code addition for future Socs.
Signed-off-by R Sricharan <[email protected]>Signed-off-by Lokesh Vutla <[email protected]>
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/20130131/4054d1eb/attachment.pgp>
PATCH 6/7 ARM: OMAP4+: Make control module register structure generic
In reply to R SricharanFrom: Lokesh Vutla <[email protected]>
A seperate omap_sys_ctrl_regs structure is defined for omap4 & 5. If there is any change in control module for any of the ES versions, a new structure needs to be created. In order to remove this dependency, making the register structure generic for all the omap4+ boards.
--- arch/arm/cpu/armv7/omap-common/hwinit-common.c | 5 +- arch/arm/cpu/armv7/omap4/hw_data.c | 4 + arch/arm/cpu/armv7/omap4/hwinit.c | 36 ++++----- arch/arm/cpu/armv7/omap4/prcm-regs.c | 20 +++++ arch/arm/cpu/armv7/omap5/hw_data.c | 4 +- arch/arm/cpu/armv7/omap5/hwinit.c | 102 +++++++++++------------- arch/arm/cpu/armv7/omap5/prcm-regs.c | 74 +++++++++++++++++ arch/arm/include/asm/arch-omap4/omap.h | 31 +------ arch/arm/include/asm/arch-omap5/omap.h | 84 +------------------ arch/arm/include/asm/omap_common.h | 91 +++++++++++++++++++++ drivers/mmc/omap_hsmmc.c | 25 +++--- 11 files changed, 269 insertions(+), 207 deletions(-)
arch/arm/cpu/armv7/omap-common/hwinit-common.c +1 -4
@@ -244,10 +244,7 @@ int checkboard(void)*/ u32 get_device_type (void ) { -struct omap_sys_ctrl_regs *ctrl = - (struct omap_sys_ctrl_regs *)SYSCTRL_GENERAL_CORE_BASE ; - -return (readl (&ctrl->control_status) & +return (readl ((*ctrl)->control_status) & (DEVICE_TYPE_MASK )) >>DEVICE_TYPE_SHIFT ; }
arch/arm/cpu/armv7/omap4/hw_data.c +4 -0
@@ -37,6 +37,8 @@ struct prcm_regs const **prcm = (struct prcm_regs const **)OMAP_SRAM_SCRATCH_PRCM_PTR ;struct dplls const **dplls_data = (struct dplls const **)OMAP_SRAM_SCRATCH_DPLLS_PTR ; +struct omap_sys_ctrl_regs const **ctrl = + (struct omap_sys_ctrl_regs const **)OMAP4_SRAM_SCRATCH_SYS_CTRL ;/* * The M & N values in the following tables are created using the
@@ -454,4 +456,6 @@ void hw_data_init(void)printf ("\n INVALID OMAP REVISION " ); } + *ctrl = &omap4_ctrl; +prcm_init (omap_vcores); }
arch/arm/cpu/armv7/omap4/hwinit.c +16 -20
@@ -57,10 +57,6 @@ const struct gpio_bank *const omap_gpio_bank = gpio_bank_44xx;void do_io_settings (void ) {u32 lpddr2io; -struct control_lpddr2io_regs *lpddr2io_regs = - (struct control_lpddr2io_regs *)LPDDR2_IO_REGS_BASE ; -struct omap_sys_ctrl_regs *const ctrl = - (struct omap_sys_ctrl_regs *)SYSCTRL_GENERAL_CORE_BASE ;u32 omap4_rev =omap_revision ();
@@ -72,20 +68,20 @@ void do_io_settings(void) lpddr2io =CONTROL_LPDDR2IO_SLEW_315PS_DRV12_PULL_DOWN ;/* EMIF1 */ -writel (lpddr2io, &lpddr2io_regs->control_lpddr2io1_0); -writel (lpddr2io, &lpddr2io_regs->control_lpddr2io1_1); +writel (lpddr2io, (*ctrl)->control_lpddr2io1_0); +writel (lpddr2io, (*ctrl)->control_lpddr2io1_1);/* No pull for GR10 as per hw team's recommendation */ writel (lpddr2io & ~LPDDR2IO_GR10_WD_MASK , - &lpddr2io_regs->control_lpddr2io1_2); -writel (CONTROL_LPDDR2IO_3_VAL , &lpddr2io_regs->control_lpddr2io1_3); + (*ctrl)->control_lpddr2io1_2); +writel (CONTROL_LPDDR2IO_3_VAL , (*ctrl)->control_lpddr2io1_3);/* EMIF2 */ -writel (lpddr2io, &lpddr2io_regs->control_lpddr2io2_0); -writel (lpddr2io, &lpddr2io_regs->control_lpddr2io2_1); +writel (lpddr2io, (*ctrl)->control_lpddr2io2_0); +writel (lpddr2io, (*ctrl)->control_lpddr2io2_1);/* No pull for GR10 as per hw team's recommendation */ writel (lpddr2io & ~LPDDR2IO_GR10_WD_MASK , - &lpddr2io_regs->control_lpddr2io2_2); -writel (CONTROL_LPDDR2IO_3_VAL , &lpddr2io_regs->control_lpddr2io2_3); + (*ctrl)->control_lpddr2io2_2); +writel (CONTROL_LPDDR2IO_3_VAL , (*ctrl)->control_lpddr2io2_3);/* * Some of these settings (TRIM values) come from eFuse and are
@@ -93,16 +89,16 @@ void do_io_settings(void)* calibration of the device. Do the software over-ride only if * the device is not correctly trimmed */ -if (!(readl (&ctrl->control_std_fuse_opp_bgap) &0xFFFF )) { +if (!(readl ((*ctrl)->control_std_fuse_opp_bgap) &0xFFFF )) {writel (LDOSRAM_VOLT_CTRL_OVERRIDE , - &ctrl->control_ldosram_iva_voltage_ctrl); + (*ctrl)->control_ldosram_iva_voltage_ctrl);writel (LDOSRAM_VOLT_CTRL_OVERRIDE , - &ctrl->control_ldosram_mpu_voltage_ctrl); + (*ctrl)->control_ldosram_mpu_voltage_ctrl);writel (LDOSRAM_VOLT_CTRL_OVERRIDE , - &ctrl->control_ldosram_core_voltage_ctrl); + (*ctrl)->control_ldosram_core_voltage_ctrl); }/*
@@ -110,11 +106,11 @@ void do_io_settings(void)* i. unconditionally for all 4430 * ii. only if un-trimmed for 4460 */ -if (!readl (&ctrl->control_efuse_1)) -writel (CONTROL_EFUSE_1_OVERRIDE , &ctrl->control_efuse_1); +if (!readl ((*ctrl)->control_efuse_1)) +writel (CONTROL_EFUSE_1_OVERRIDE , (*ctrl)->control_efuse_1); -if ((omap4_rev <OMAP4460_ES1_0 ) || !readl (&ctrl->control_efuse_2)) - writel(CONTROL_EFUSE_2_OVERRIDE, &ctrl->control_efuse_2); +if ((omap4_rev <OMAP4460_ES1_0 ) || !readl ((*ctrl)->control_efuse_2)) + writel(CONTROL_EFUSE_2_OVERRIDE, (*ctrl)->control_efuse_2); }#endif /* CONFIG_SPL_BUILD */
arch/arm/cpu/armv7/omap4/prcm-regs.c +20 -0
@@ -265,3 +265,23 @@ struct prcm_regs const omap4_prcm = { .prm_vc_cfg_i2c_mode = 0x4a307ba8, .prm_vc_cfg_i2c_clk = 0x4a307bac, }; + +struct omap_sys_ctrl_regs const omap4_ctrl = { + .control_id_code =0x4A002204 , + .control_std_fuse_opp_bgap =0x4a002260 , + .control_status =0x4a0022c4 , + .control_ldosram_iva_voltage_ctrl =0x4A002320 , + .control_ldosram_mpu_voltage_ctrl =0x4A002324 , + .control_ldosram_core_voltage_ctrl =0x4A002328 , + .control_pbiaslite =0x4A100600 , + .control_lpddr2io1_0 =0x4A100638 , + .control_lpddr2io1_1 =0x4A10063C , + .control_lpddr2io1_2 =0x4A100640 , + .control_lpddr2io1_3 =0x4A100644 , + .control_lpddr2io2_0 =0x4A100648 , + .control_lpddr2io2_1 =0x4A10064C , + .control_lpddr2io2_2 =0x4A100650 , + .control_lpddr2io2_3 =0x4A100654 , + .control_efuse_1 =0x4A100700 , + .control_efuse_2 =0x4A100704 , +};
arch/arm/cpu/armv7/omap5/hw_data.c +3 -1
@@ -37,6 +37,8 @@ struct prcm_regs const **prcm = (struct prcm_regs const **)OMAP_SRAM_SCRATCH_PRCM_PTR ;struct dplls const **dplls_data = (struct dplls const **)OMAP_SRAM_SCRATCH_DPLLS_PTR ; +struct omap_sys_ctrl_regs const **ctrl = + (struct omap_sys_ctrl_regs const **)OMAP5_SRAM_SCRATCH_SYS_CTRL ;static const struct dpll_params mpu_dpll_params_1_5ghz[NUM_SYS_CLKS ] = { {125 ,0 ,1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 },/* 12 MHz */
@@ -422,6 +424,6 @@ void hw_data_init(void)default :printf ("\n INVALID OMAP REVISION " ); } - + *ctrl = &omap5_ctrl;prcm_init (omap_vcores); }
arch/arm/cpu/armv7/omap5/hwinit.c +46 -56
209 lines not on this page · raw message
arch/arm/cpu/armv7/omap5/prcm-regs.c +74 -0
77 lines not on this page · raw message
arch/arm/include/asm/arch-omap4/omap.h +2 -29
@@ -132,34 +132,6 @@ struct s32ktimer {#define DEVICE_TYPE_MASK (0x7 << DEVICE_TYPE_SHIFT)#define DEVICE_GP 0x3 -struct omap_sys_ctrl_regs { -unsigned int pad1[129 ]; -unsigned int control_id_code;/* 0x4A002204 */ -unsigned int pad11[22 ]; -unsigned int control_std_fuse_opp_bgap;/* 0x4a002260 */ -unsigned int pad2[24 ];/* 0x4a002264 */ -unsigned int control_status;/* 0x4a0022c4 */ -unsigned int pad3[22 ];/* 0x4a0022c8 */ -unsigned int control_ldosram_iva_voltage_ctrl;/* 0x4A002320 */ -unsigned int control_ldosram_mpu_voltage_ctrl;/* 0x4A002324 */ -unsigned int control_ldosram_core_voltage_ctrl;/* 0x4A002328 */ -unsigned int pad4[260277 ]; -unsigned int control_pbiaslite;/* 0x4A100600 */ -unsigned int pad5[63 ]; -unsigned int control_efuse_1;/* 0x4A100700 */ -unsigned int control_efuse_2;/* 0x4A100704 */ -}; - -struct control_lpddr2io_regs { -unsigned int control_lpddr2io1_0; -unsigned int control_lpddr2io1_1; -unsigned int control_lpddr2io1_2; -unsigned int control_lpddr2io1_3; -unsigned int control_lpddr2io2_0; -unsigned int control_lpddr2io2_1; -unsigned int control_lpddr2io2_2; -unsigned int control_lpddr2io2_3; -};#endif /* __ASSEMBLY__ */ /*
@@ -180,7 +152,8 @@ struct control_lpddr2io_regs {#define OMAP4_SRAM_SCRATCH_EMIF_T_DEN (SRAM_SCRATCH_SPACE_ADDR + 0x10)#define OMAP_SRAM_SCRATCH_PRCM_PTR (SRAM_SCRATCH_SPACE_ADDR + 0x14)#define OMAP_SRAM_SCRATCH_DPLLS_PTR (SRAM_SCRATCH_SPACE_ADDR + 0x18) -#define OMAP4_SRAM_SCRATCH_SPACE_END (SRAM_SCRATCH_SPACE_ADDR + 0x1C) +#define OMAP4_SRAM_SCRATCH_SYS_CTRL (SRAM_SCRATCH_SPACE_ADDR + 0x1C) +#define OMAP4_SRAM_SCRATCH_SPACE_END (SRAM_SCRATCH_SPACE_ADDR + 0x20)/* ROM code defines */ /* Boot device */
arch/arm/include/asm/arch-omap5/omap.h +2 -82
96 lines not on this page · raw message
arch/arm/include/asm/omap_common.h +91 -0
103 lines not on this page · raw message
drivers/mmc/omap_hsmmc.c +10 -15
@@ -50,18 +50,15 @@ static struct mmc hsmmc_dev[2];static void omap4_vmmc_pbias_config (struct mmc *mmc) {u32 value =0 ; -struct omap_sys_ctrl_regs *const ctrl = - (struct omap_sys_ctrl_regs *)SYSCTRL_GENERAL_CORE_BASE ; - - value =readl (&ctrl->control_pbiaslite); + value =readl ((*ctrl)->control_pbiaslite); value &= ~(MMC1_PBIASLITE_PWRDNZ |MMC1_PWRDNZ ); -writel (value, &ctrl->control_pbiaslite); +writel (value, (*ctrl)->control_pbiaslite);/* set VMMC to 3V */ twl6030_power_mmc_init (); - value =readl (&ctrl->control_pbiaslite); + value =readl ((*ctrl)->control_pbiaslite); value |=MMC1_PBIASLITE_VMODE |MMC1_PBIASLITE_PWRDNZ |MMC1_PWRDNZ ; -writel (value, &ctrl->control_pbiaslite); +writel (value, (*ctrl)->control_pbiaslite); }#endif
@@ -69,26 +66,24 @@ static void omap4_vmmc_pbias_config(struct mmc *mmc)static void omap5_pbias_config (struct mmc *mmc) {u32 value =0 ; -struct omap_sys_ctrl_regs *const ctrl = - (struct omap_sys_ctrl_regs *)SYSCTRL_GENERAL_CORE_BASE ; - value =readl (&ctrl->control_pbias); + value =readl ((*ctrl)->control_pbias); value &= ~(SDCARD_PWRDNZ |SDCARD_BIAS_PWRDNZ ); value |=SDCARD_BIAS_HIZ_MODE ; -writel (value, &ctrl->control_pbias); +writel (value, (*ctrl)->control_pbias);twl6035_mmc1_poweron_ldo (); - value =readl (&ctrl->control_pbias); + value =readl ((*ctrl)->control_pbias); value &= ~SDCARD_BIAS_HIZ_MODE ; value |=SDCARD_PBIASLITE_VMODE |SDCARD_PWRDNZ |SDCARD_BIAS_PWRDNZ ; -writel (value, &ctrl->control_pbias); +writel (value, (*ctrl)->control_pbias); - value =readl (&ctrl->control_pbias); + value =readl ((*ctrl)->control_pbias);if (value & (1 <<23 )) { value &= ~(SDCARD_PWRDNZ |SDCARD_BIAS_PWRDNZ ); value |=SDCARD_BIAS_HIZ_MODE ; -writel (value, &ctrl->control_pbias); +writel (value, (*ctrl)->control_pbias); } }#endif
Signature · 1 line
1.7.9.5
PATCH 6/7 ARM: OMAP4+: Make control module register structure generic
Quoted 10 lines · R Sricharan
From: Lokesh Vutla <[email protected]>
A seperate
omap_sys_ctrl_regsstructure is defined for omap4 & 5. If there is any change in control module for any of the ES versions, a new structure needs to be created. In order to remove this dependency, making the register structure generic for all the omap4+ boards.Signed-off-by R Sricharan <[email protected]>Signed-off-by Lokesh Vutla <[email protected]>
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/20130131/7ba75fbf/attachment.pgp>
PATCH 7/7 ARM: OMAP5: Clean up iosettings code
In reply to R SricharanFrom: Lokesh Vutla <[email protected]>
There is some code duplication in the ddr io settings code. This is avoided by moving the data to a Soc specific place and letting the code generic.
This avoids unnessecary code addition for future socs.
--- arch/arm/cpu/armv7/omap5/hw_data.c | 36 +++++++++++++ arch/arm/cpu/armv7/omap5/hwinit.c | 75 +++++++++++---------------- arch/arm/include/asm/arch-omap5/omap.h | 10 ++++ arch/arm/include/asm/arch-omap5/sys_proto.h | 1 + 4 files changed, 78 insertions(+), 44 deletions(-)
arch/arm/cpu/armv7/omap5/hw_data.c +36 -0
@@ -32,6 +32,7 @@#include <asm/arch/clocks.h> #include <asm/omap_gpio.h> #include <asm/io.h> +#include <asm/emif.h> struct prcm_regs const **prcm = (struct prcm_regs const **)OMAP_SRAM_SCRATCH_PRCM_PTR ;
@@ -402,6 +403,24 @@ void enable_non_essential_clocks(void) MODULE_CLKCTRL_MODULEMODE_SHIFT); } +const struct ctrl_ioregs ioregs_omap5430 = { + .ctrl_ddrch =DDR_IO_I_34OHM_SR_FASTEST_WD_DQ_NO_PULL_DQS_PULL_DOWN , + .ctrl_lpddr2ch =DDR_IO_I_34OHM_SR_FASTEST_WD_CK_CKE_NCS_CA_PULL_DOWN , + .ctrl_ddrio_0 =DDR_IO_0_DDR2_DQ_INT_EN_ALL_DDR3_CA_DIS_ALL , + .ctrl_ddrio_1 =DDR_IO_1_DQ_OUT_EN_ALL_DQ_INT_EN_ALL , + .ctrl_ddrio_2 =DDR_IO_2_CA_OUT_EN_ALL_CA_INT_EN_ALL , +}; + +const struct ctrl_ioregs ioregs_omap5432_es1 = { + .ctrl_ddrch =DDR_IO_I_40OHM_SR_FAST_WD_DQ_NO_PULL_DQS_NO_PULL , + .ctrl_lpddr2ch =0x0 , + .ctrl_ddr3ch =DDR_IO_I_40OHM_SR_SLOWEST_WD_DQ_NO_PULL_DQS_NO_PULL , + .ctrl_ddrio_0 =DDR_IO_0_VREF_CELLS_DDR3_VALUE , + .ctrl_ddrio_1 =DDR_IO_1_VREF_CELLS_DDR3_VALUE , + .ctrl_ddrio_2 =DDR_IO_2_VREF_CELLS_DDR3_VALUE , + .ctrl_emif_sdram_config_ext =SDRAM_CONFIG_EXT_RD_LVL_11_SAMPLES , +}; +void hw_data_init (void ) {u32 omap_rev =omap_revision ();
@@ -427,3 +446,20 @@ void hw_data_init(void) *ctrl = &omap5_ctrl;prcm_init (omap_vcores); } + +void get_ioregs (const struct ctrl_ioregs **regs) +{ +u32 omap_rev =omap_revision (); + +switch (omap_rev) { +case OMAP5430_ES1_0 : + *regs = &ioregs_omap5430; +break ; +case OMAP5432_ES1_0 : + *regs = &ioregs_omap5432_es1; +break ; + +default : +printf ("\n INVALID OMAP REVISION " ); + } +}
arch/arm/cpu/armv7/omap5/hwinit.c +31 -44
91 lines not on this page · raw message
arch/arm/include/asm/arch-omap5/omap.h +10 -0
@@ -228,5 +228,15 @@ struct omap_boot_parameters {unsigned char reset_reason;unsigned char ch_flags; }; + +struct ctrl_ioregs { +u32 ctrl_ddrch; +u32 ctrl_lpddr2ch; +u32 ctrl_ddr3ch; +u32 ctrl_ddrio_0; +u32 ctrl_ddrio_1; +u32 ctrl_ddrio_2; +u32 ctrl_emif_sdram_config_ext; +};#endif /* __ASSEMBLY__ */ #endif
arch/arm/include/asm/arch-omap5/sys_proto.h +1 -0
@@ -58,6 +58,7 @@ void omap_vc_init(u16 speed_khz);int omap_vc_bypass_send_value (u8 sa,u8 reg_addr,u8 reg_data);u32 warm_reset (void );void force_emif_self_refresh (void ); +void get_ioregs (const struct ctrl_ioregs **regs);/* * This is used to verify if the configuration header
Signature · 1 line
1.7.9.5
PATCH 7/7 ARM: OMAP5: Clean up iosettings code
Quoted 9 lines · R Sricharan
From: Lokesh Vutla <[email protected]>
There is some code duplication in the ddr io settings code. This is avoided by moving the data to a Soc specific place and letting the code generic.
This avoids unnessecary code addition for future socs.
Signed-off-by Lokesh Vutla <[email protected]>
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/20130131/79b8c310/attachment.pgp>