add support for printing of clock information as part of 'bdinfo' command
v2 cover add support for printing of clock information as part of 'bdinfo' command
This patch series adds support for printing of clock information as part of 'bdinfo' command. Support for printing CPU, DSP core and DDR frequency is added. Also, support for printing frequency info during u-boot initialization is removed as it will delay u-boot coming up.
Changes from previous version:
1: Add support for printing clock information as part of
bdinfo command instead of custom command, so that all architectures can have benefit of it.
Manjunath Hadli (2):
davinci: remove macro CONFIG_DISPLAY_CPUINFO
davinci: add support for printing clock frequency
arch/arm/cpu/arm926ejs/davinci/cpu.c | 76 +++++++++++++------------------ arch/arm/include/asm/u-boot.h | 3 + arch/arm/lib/board.c | 10 ++++- common/cmd_bdinfo.c | 9 ++++ include/common.h | 1 + include/configs/cam_enc_4xx.h | 5 ++- include/configs/da830evm.h | 4 ++ include/configs/da850evm.h | 4 ++ include/configs/davinci_dm355evm.h | 5 ++- include/configs/davinci_dm355leopard.h | 5 ++- include/configs/davinci_dm365evm.h | 4 ++ include/configs/davinci_dm6467Tevm.h | 5 ++- include/configs/davinci_dm6467evm.h | 5 ++- include/configs/davinci_dvevm.h | 6 ++- include/configs/davinci_schmoogie.h | 5 ++- include/configs/davinci_sffsdr.h | 5 ++- include/configs/davinci_sonata.h | 5 ++- include/configs/ea20.h | 4 ++ include/configs/enbw_cmc.h | 5 ++- include/configs/hawkboard.h | 4 ++ 20 files changed, 115 insertions(+), 55 deletions(-)
PATCH v2 1/2 davinci: remove macro CONFIG_DISPLAY_CPUINFO
remove the macro CONFIG_DISPLAY_CPUINFO as it is no longer required. This is because clock info will be printed as part 'bdinfo' command and also remove support print_cpuinfo() as it will no longer be called.
--- arch/arm/cpu/arm926ejs/davinci/cpu.c | 44 -------------------------------- include/configs/cam_enc_4xx.h | 1 - include/configs/davinci_dm355evm.h | 1 - include/configs/davinci_dm355leopard.h | 1 - include/configs/davinci_dm6467Tevm.h | 1 - include/configs/davinci_dm6467evm.h | 1 - include/configs/davinci_dvevm.h | 1 - include/configs/davinci_schmoogie.h | 1 - include/configs/davinci_sffsdr.h | 1 - include/configs/davinci_sonata.h | 1 - include/configs/enbw_cmc.h | 1 - 11 files changed, 0 insertions(+), 54 deletions(-)
arch/arm/cpu/arm926ejs/davinci/cpu.c +0 -44
@@ -115,21 +115,8 @@ int clk_get(enum davinci_clk_ids id) out: return pll_out; } -#ifdef CONFIG_DISPLAY_CPUINFO -int print_cpuinfo(void) -{ - printf("Cores: ARM %d MHz", - clk_get(DAVINCI_ARM_CLKID) / 1000000); - printf("\nDDR: %d MHz\n", - /* DDR PHY uses an x2 input clock */ - clk_get(0x10001) / 1000000); - return 0; -} -#endif#else /* CONFIG_SOC_DA8XX */ -#ifdef CONFIG_DISPLAY_CPUINFO -static unsigned pll_div (volatile void *pllbase,unsigned offset) {u32 div;
@@ -185,36 +172,6 @@ static unsigned pll_sysclk_mhz(unsigned pll_addr, unsigned div)return DIV_ROUND_UP (base,1000 *pll_div (pllbase, div)); } -int print_cpuinfo (void ) -{ -/* REVISIT fetch and display CPU ID and revision information -* too ... that will matter as more revisions appear. -*/ -#if defined(CONFIG_SOC_DM365 ) -printf ("Cores: ARM %d MHz" , -pll_sysclk_mhz (DAVINCI_PLL_CNTRL1_BASE ,ARM_PLLDIV )); -#else -printf ("Cores: ARM %d MHz" , -pll_sysclk_mhz (DAVINCI_PLL_CNTRL0_BASE ,ARM_PLLDIV )); -#endif - -#ifdef DSP_PLLDIV -printf (", DSP %d MHz" , -pll_sysclk_mhz (DAVINCI_PLL_CNTRL0_BASE ,DSP_PLLDIV )); -#endif - - printf("\nDDR: %d MHz\n", -/* DDR PHY uses an x2 input clock */ -#if defined(CONFIG_SOC_DM365 ) -pll_sysclk_mhz (DAVINCI_PLL_CNTRL0_BASE ,DDR_PLLDIV ) - / 2); -#else -pll_sysclk_mhz (DAVINCI_PLL_CNTRL1_BASE ,DDR_PLLDIV ) - / 2); -#endif -return 0 ; -} -#ifdef DAVINCI_DM6467EVM unsigned int davinci_arm_clk_get () {
@@ -228,7 +185,6 @@ unsigned int davinci_clk_get(unsigned int div)return pll_sysclk_mhz (DAVINCI_PLL_CNTRL0_BASE , div) *1000000 ; }#endif -#endif /* CONFIG_DISPLAY_CPUINFO */ #endif /* !CONFIG_SOC_DA8XX */ /*
include/configs/cam_enc_4xx.h +0 -1
@@ -257,7 +257,6 @@#define CONFIG_POST CONFIG_SYS_POST_MEMORY#define _POST_WORD_ADDR 0x0 -#define CONFIG_DISPLAY_CPUINFO #define CONFIG_DISPLAY_BOARDINFO #define CONFIG_SYS_INIT_SP_ADDR CONFIG_SPL_STACK
include/configs/davinci_dm355evm.h +0 -1
@@ -26,7 +26,6 @@#define CONFIG_SKIP_LOWLEVEL_INIT /* U-Boot is a 3rd stage loader */ #define CONFIG_SYS_NO_FLASH /* that is, no *NOR* flash */ #define CONFIG_SYS_CONSOLE_INFO_QUIET -#define CONFIG_DISPLAY_CPUINFO /* SoC Configuration */ #define CONFIG_ARM926EJS /* arm926ejs CPU */
include/configs/davinci_dm355leopard.h +0 -1
@@ -25,7 +25,6 @@#define CONFIG_SKIP_LOWLEVEL_INIT /* U-Boot is a 3rd stage loader */ #define CONFIG_SYS_NO_FLASH /* that is, no *NOR* flash */ #define CONFIG_SYS_CONSOLE_INFO_QUIET -#define CONFIG_DISPLAY_CPUINFO /* SoC Configuration */ #define CONFIG_ARM926EJS /* arm926ejs CPU */
include/configs/davinci_dm6467Tevm.h +0 -1
@@ -23,7 +23,6 @@/* Spectrum Digital TMS320DM6467T EVM board */ #define DAVINCI_DM6467EVM #define DAVINCI_DM6467TEVM -#define CONFIG_DISPLAY_CPUINFO #define CONFIG_SYS_USE_NAND #define CONFIG_SYS_NAND_SMALLPAGE
include/configs/davinci_dm6467evm.h +0 -1
@@ -22,7 +22,6 @@/* Spectrum Digital TMS320DM6467 EVM board */ #define DAVINCI_DM6467EVM -#define CONFIG_DISPLAY_CPUINFO #define CONFIG_SYS_USE_NAND #define CONFIG_SYS_NAND_SMALLPAGE
include/configs/davinci_dvevm.h +0 -1
@@ -51,7 +51,6 @@#define DV_EVM #define CONFIG_SYS_NAND_SMALLPAGE #define CONFIG_SYS_USE_NAND -#define CONFIG_DISPLAY_CPUINFO /*===================*/ /* SoC Configuration */ /*===================*/
include/configs/davinci_schmoogie.h +0 -1
@@ -26,7 +26,6 @@#define SCHMOOGIE #define CONFIG_SYS_NAND_LARGEPAGE #define CONFIG_SYS_USE_NAND -#define CONFIG_DISPLAY_CPUINFO #define MACH_TYPE_SCHMOOGIE 1255#define CONFIG_MACH_TYPE MACH_TYPE_SCHMOOGIE
include/configs/davinci_sffsdr.h +0 -1
@@ -28,7 +28,6 @@#define CONFIG_SYS_NAND_LARGEPAGE #define CONFIG_SYS_USE_NAND #define CONFIG_SYS_USE_DSPLINK /* don't power up the DSP. */ -#define CONFIG_DISPLAY_CPUINFO /* SoC Configuration */ #define CONFIG_ARM926EJS /* arm926ejs CPU core */ #define CONFIG_SYS_TIMERBASE 0x01c21400/* use timer 0 */
include/configs/davinci_sonata.h +0 -1
@@ -51,7 +51,6 @@#define SONATA_BOARD #define CONFIG_SYS_NAND_SMALLPAGE #define CONFIG_SYS_USE_NOR -#define CONFIG_DISPLAY_CPUINFO #define MACH_TYPE_SONATA 1254#define CONFIG_MACH_TYPE MACH_TYPE_SONATA/*===================*/
include/configs/enbw_cmc.h +0 -1
@@ -50,7 +50,6 @@#define CONFIG_ARCH_CPU_INIT #define CONFIG_DA8XX_GPIO #define CONFIG_HOSTNAME enbw_cmc -#define CONFIG_DISPLAY_CPUINFO #define MACH_TYPE_ENBW_CMC 3585#define CONFIG_MACH_TYPE MACH_TYPE_ENBW_CMC
Signature · 1 line
1.6.2.4
PATCH v2 2/2 davinci: add support for printing clock frequency
In reply to Manjunath Hadliadd support for printing various clock frequency info found in SOC such as ARM core frequency, DSP core frequency and DDR frequency as part of bdinfo command.
--- arch/arm/cpu/arm926ejs/davinci/cpu.c | 32 ++++++++++++++++++++++++++++++++ arch/arm/include/asm/u-boot.h | 3 +++ arch/arm/lib/board.c | 10 +++++++++- common/cmd_bdinfo.c | 9 +++++++++ include/common.h | 1 + include/configs/cam_enc_4xx.h | 4 ++++ include/configs/da830evm.h | 4 ++++ include/configs/da850evm.h | 4 ++++ include/configs/davinci_dm355evm.h | 4 ++++ include/configs/davinci_dm355leopard.h | 4 ++++ include/configs/davinci_dm365evm.h | 4 ++++ include/configs/davinci_dm6467Tevm.h | 4 ++++ include/configs/davinci_dm6467evm.h | 4 ++++ include/configs/davinci_dvevm.h | 5 +++++ include/configs/davinci_schmoogie.h | 4 ++++ include/configs/davinci_sffsdr.h | 4 ++++ include/configs/davinci_sonata.h | 4 ++++ include/configs/ea20.h | 4 ++++ include/configs/enbw_cmc.h | 4 ++++ include/configs/hawkboard.h | 4 ++++ 20 files changed, 115 insertions(+), 1 deletions(-)
arch/arm/cpu/arm926ejs/davinci/cpu.c +32 -0
@@ -25,6 +25,8 @@#include <asm/arch/hardware.h> #include <asm/io.h> +DECLARE_GLOBAL_DATA_PTR ; +/* offsets from PLL controller base */ #define PLLC_PLLCTL 0x100#define PLLC_PLLM 0x110
@@ -187,6 +189,36 @@ unsigned int davinci_clk_get(unsigned int div)#endif #endif /* !CONFIG_SOC_DA8XX */ +int set_cpu_clk_info (void ) +{ +#ifdef CONFIG_SOC_DA8XX + gd->bd->bi_arm_freq =clk_get (DAVINCI_ARM_CLKID ) /1000000 ; +/* DDR PHY uses an x2 input clock */ + gd->bd->bi_ddr_freq =clk_get (0x10001 ) /1000000 ; +#else + +unsigned int pllbase =DAVINCI_PLL_CNTRL0_BASE ; +#if defined(CONFIG_SOC_DM365 ) + pllbase =DAVINCI_PLL_CNTRL1_BASE ; +#endif + gd->bd->bi_arm_freq =pll_sysclk_mhz (pllbase,ARM_PLLDIV ); + +#ifdef DSP_PLLDIV + gd->bd->bi_dsp_freq = +pll_sysclk_mhz (DAVINCI_PLL_CNTRL0_BASE ,DSP_PLLDIV ); +#else + gd->bd->bi_dsp_freq =0 ; +#endif + + pllbase =DAVINCI_PLL_CNTRL1_BASE ; +#if defined(CONFIG_SOC_DM365 ) + pllbase =DAVINCI_PLL_CNTRL0_BASE ; +#endif + gd->bd->bi_ddr_freq =pll_sysclk_mhz (pllbase,DDR_PLLDIV ) /2 ; +#endif +return 0 ; +} +/* * Initializes on-chip ethernet controllers. * to override, implement board_eth_init()
arch/arm/include/asm/u-boot.h +3 -0
@@ -41,6 +41,9 @@ typedef struct bd_info {unsigned long bi_ip_addr;/* IP Address */ ulong bi_arch_number;/* unique id for this board */ ulong bi_boot_params;/* where this board expects params */ +unsigned long bi_arm_freq;/* arm frequency */ +unsigned long bi_dsp_freq;/* dsp core frequency */ +unsigned long bi_ddr_freq;/* ddr frequency */ struct /* RAM configuration */ {ulong start;
arch/arm/lib/board.c +9 -1
@@ -463,7 +463,15 @@ void board_init_r(gd_t *id, ulong dest_addr)debug ("monitor flash len: %08lX\n" , monitor_flash_len);board_init ();/* Setup chipselects */ - +/* +* TODO: printing of the clock inforamtion of the board is now +* implemented as part of bdinfo command. Currently only support for +* davinci SOC's is added. Remove this check once all the board +* implement this. +*/ +#ifdef CONFIG_CLOCKS +set_cpu_clk_info ();/* Setup clock information */ +#endif #ifdef CONFIG_SERIAL_MULTI serial_initialize ();#endif
common/cmd_bdinfo.c +9 -0
@@ -370,6 +370,15 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])print_num ("irq_sp" , gd->irq_sp);/* irq stack pointer */ print_num ("sp start " , gd->start_addr_sp);print_num ("FB base " , gd->fb_base); +/* +* TODO: Currently only support for davinci SOC's is added. +* Remove this check once all the board implement this. +*/ +#ifdef CONFIG_CLOCKS +printf ("ARM frequency = %ld MHz\n" , gd->bd->bi_arm_freq); +printf ("DSP frequency = %ld MHz\n" , gd->bd->bi_dsp_freq); +printf ("DDR frequency = %ld MHz\n" , gd->bd->bi_ddr_freq); +#endif return 0 ; }
include/common.h +1 -0
@@ -284,6 +284,7 @@ int last_stage_init(void);extern ulong monitor_flash_len;int mac_read_from_eeprom (void );extern u8 _binary_dt_dtb_start[];/* embedded device tree blob */ +int set_cpu_clk_info (void );/* * Called when console output is requested before the console is available.
include/configs/cam_enc_4xx.h +4 -0
@@ -123,6 +123,10 @@#define CONFIG_CMD_PING #define CONFIG_CMD_SAVES +#ifdef CONFIG_CMD_BDI +#define CONFIG_CLOCKS +#endif +#ifdef CONFIG_MMC #define CONFIG_DOS_PARTITION #define CONFIG_CMD_EXT2
include/configs/da830evm.h +4 -0
@@ -204,6 +204,10 @@#undef CONFIG_CMD_FPGA#undef CONFIG_CMD_SETGETDCR +#ifdef CONFIG_CMD_BDI +#define CONFIG_CLOCKS +#endif +#ifndef CONFIG_DRIVER_TI_EMAC #undef CONFIG_CMD_NET#undef CONFIG_CMD_DHCP
include/configs/da850evm.h +4 -0
@@ -270,6 +270,10 @@#define CONFIG_CMD_SAVES #define CONFIG_CMD_MEMORY +#ifdef CONFIG_CMD_BDI +#define CONFIG_CLOCKS +#endif +#ifndef CONFIG_DRIVER_TI_EMAC #undef CONFIG_CMD_NET#undef CONFIG_CMD_DHCP
include/configs/davinci_dm355evm.h +4 -0
@@ -98,6 +98,10 @@#define CONFIG_CMD_PING #define CONFIG_CMD_SAVES +#ifdef CONFIG_CMD_BDI +#define CONFIG_CLOCKS +#endif +#ifdef CONFIG_MMC #define CONFIG_DOS_PARTITION #define CONFIG_CMD_EXT2
include/configs/davinci_dm355leopard.h +4 -0
@@ -84,6 +84,10 @@#define CONFIG_CMD_PING #define CONFIG_CMD_SAVES +#ifdef CONFIG_CMD_BDI +#define CONFIG_CLOCKS +#endif +#ifdef CONFIG_NAND_DAVINCI #define CONFIG_CMD_MTDPARTS #define CONFIG_MTD_PARTITIONS
include/configs/davinci_dm365evm.h +4 -0
@@ -142,6 +142,10 @@#define CONFIG_CMD_PING #define CONFIG_CMD_SAVES +#ifdef CONFIG_CMD_BDI +#define CONFIG_CLOCKS +#endif +#ifdef CONFIG_MMC #define CONFIG_DOS_PARTITION #define CONFIG_CMD_EXT2
include/configs/davinci_dm6467Tevm.h +4 -0
@@ -152,6 +152,10 @@ extern unsigned int davinci_arm_clk_get(void);#define CONFIG_CMD_NAND #endif +#ifdef CONFIG_CMD_BDI +#define CONFIG_CLOCKS +#endif +#define CONFIG_MAX_RAM_BANK_SIZE (256 << 20)/* 256 MB */ #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1
include/configs/davinci_dm6467evm.h +4 -0
@@ -150,6 +150,10 @@ extern unsigned int davinci_arm_clk_get(void);#define CONFIG_CMD_NAND #endif +#ifdef CONFIG_CMD_BDI +#define CONFIG_CLOCKS +#endif +#define CONFIG_MAX_RAM_BANK_SIZE (256 << 20)/* 256 MB */ #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1
include/configs/davinci_dvevm.h +5 -0
@@ -199,6 +199,11 @@#define CONFIG_CMD_SAVES #define CONFIG_CMD_EEPROM #undef CONFIG_CMD_BDI + +#ifdef CONFIG_CMD_BDI +#define CONFIG_CLOCKS +#endif +#undef CONFIG_CMD_FPGA#undef CONFIG_CMD_SETGETDCR#ifdef CONFIG_SYS_USE_NAND
include/configs/davinci_schmoogie.h +4 -0
@@ -148,6 +148,10 @@#undef CONFIG_CMD_FLASH#undef CONFIG_CMD_IMLS +#ifdef CONFIG_CMD_BDI +#define CONFIG_CLOCKS +#endif +#define CONFIG_MAX_RAM_BANK_SIZE (256 << 20)/* 256 MB */ #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1
include/configs/davinci_sffsdr.h +4 -0
@@ -141,6 +141,10 @@#undef CONFIG_CMD_FLASH#undef CONFIG_CMD_IMLS +#ifdef CONFIG_CMD_BDI +#define CONFIG_CLOCKS +#endif +#define CONFIG_MAX_RAM_BANK_SIZE (256 << 20)/* 256 MB */ #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1
include/configs/davinci_sonata.h +4 -0
@@ -199,6 +199,10 @@#error "Either CONFIG_SYS_USE_NAND or CONFIG_SYS_USE_NOR _MUST_ be defined !!!"#endif +#ifdef CONFIG_CMD_BDI +#define CONFIG_CLOCKS +#endif +#define CONFIG_MAX_RAM_BANK_SIZE (256 << 20)/* 256 MB */ #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1
include/configs/ea20.h +4 -0
@@ -168,6 +168,10 @@#define CONFIG_CMD_MEMORY #define CONFIG_CMD_I2C +#ifdef CONFIG_CMD_BDI +#define CONFIG_CLOCKS +#endif +#ifndef CONFIG_DRIVER_TI_EMAC #undef CONFIG_CMD_NET#undef CONFIG_CMD_DHCP
include/configs/enbw_cmc.h +4 -0
@@ -271,6 +271,10 @@#define CONFIG_CMD_MEMORY #define CONFIG_CMD_CACHE +#ifdef CONFIG_CMD_BDI +#define CONFIG_CLOCKS +#endif +#ifndef CONFIG_DRIVER_TI_EMAC #undef CONFIG_CMD_NET#undef CONFIG_CMD_DHCP
include/configs/hawkboard.h +4 -0
@@ -189,6 +189,10 @@#define CONFIG_CMD_SAVES #define CONFIG_CMD_MEMORY +#ifdef CONFIG_CMD_BDI +#define CONFIG_CLOCKS +#endif +#ifdef CONFIG_SYS_USE_NAND #undef CONFIG_CMD_FLASH#undef CONFIG_CMD_IMLS
Signature · 1 line
1.6.2.4
PATCH v2 2/2 davinci: add support for printing clock frequency
Quoted 6 lines · Manjunath Hadli
add support for printing various clock frequency info found in SOC such as ARM core frequency, DSP core frequency and DDR frequency as part of bdinfo command.
Signed-off-by Manjunath Hadli <[email protected]>Cc Tom Rini <[email protected]>
Sorry I am late to the party, especially as this already seems to have been applied to u-boot master, but I have just tried out this bit of code and have some feedback having looked at it.
Quoted 37 lines
--- arch/arm/cpu/arm926ejs/davinci/cpu.c | 32 ++++++++++++++++++++++++++++++++ arch/arm/include/asm/u-boot.h | 3 +++ arch/arm/lib/board.c | 10 +++++++++- common/cmd_bdinfo.c | 9 +++++++++ include/common.h | 1 + include/configs/cam_enc_4xx.h | 4 ++++ include/configs/da830evm.h | 4 ++++ include/configs/da850evm.h | 4 ++++ include/configs/davinci_dm355evm.h | 4 ++++ include/configs/davinci_dm355leopard.h | 4 ++++ include/configs/davinci_dm365evm.h | 4 ++++ include/configs/davinci_dm6467Tevm.h | 4 ++++ include/configs/davinci_dm6467evm.h | 4 ++++ include/configs/davinci_dvevm.h | 5 +++++ include/configs/davinci_schmoogie.h | 4 ++++ include/configs/davinci_sffsdr.h | 4 ++++ include/configs/davinci_sonata.h | 4 ++++ include/configs/ea20.h | 4 ++++ include/configs/enbw_cmc.h | 4 ++++ include/configs/hawkboard.h | 4 ++++ 20 files changed, 115 insertions(+), 1 deletions(-)arch/arm/cpu/arm926ejs/davinci/cpu.c +2
-0@@ -25,6 +25,8 @@#include <asm/arch/hardware.h> #include <asm/io.h> +DECLARE_GLOBAL_DATA_PTR ; +/* offsets from PLL controller base */ #define PLLC_PLLCTL 0x100#define PLLC_PLLM 0x110
arch/arm/cpu/arm926ejs/davinci/cpu.c unsigned int davinci_clk_get(unsigned int div) · line 197
Quoted 9 lines
arch/arm/cpu/arm926ejs/davinci/cpu.c +6
-0@@ -187,6 +189,36 @@ unsigned int davinci_clk_get(unsigned int div)#endif #endif /* !CONFIG_SOC_DA8XX */ +int set_cpu_clk_info (void ) +{ +#ifdef CONFIG_SOC_DA8XX + gd->bd->bi_arm_freq =clk_get (DAVINCI_ARM_CLKID ) /1000000 ; +/* DDR PHY uses an x2 input clock */ + gd->bd->bi_ddr_freq =clk_get (0x10001 ) /1000000 ;
0x10001 is a magic number... add a define for it?
Quoted 14 lines
arch/arm/cpu/arm926ejs/davinci/cpu.c +14
-0+#else + +unsigned int pllbase =DAVINCI_PLL_CNTRL0_BASE ; +#if defined(CONFIG_SOC_DM365 ) + pllbase =DAVINCI_PLL_CNTRL1_BASE ; +#endif + gd->bd->bi_arm_freq =pll_sysclk_mhz (pllbase,ARM_PLLDIV ); + +#ifdef DSP_PLLDIV + gd->bd->bi_dsp_freq = +pll_sysclk_mhz (DAVINCI_PLL_CNTRL0_BASE ,DSP_PLLDIV ); +#else + gd->bd->bi_dsp_freq =0 ; +#endif
arch/arm/cpu/arm926ejs/davinci/cpu.c unsigned int davinci_clk_get(unsigned int div) · line 221
Quoted 10 lines
arch/arm/cpu/arm926ejs/davinci/cpu.c +10
-0+ + pllbase =DAVINCI_PLL_CNTRL1_BASE ; +#if defined(CONFIG_SOC_DM365 ) + pllbase =DAVINCI_PLL_CNTRL0_BASE ; +#endif + gd->bd->bi_ddr_freq =pll_sysclk_mhz (pllbase,DDR_PLLDIV ) /2 ; +#endif +return 0 ; +} +
This function seems to be wrong. If CONFIG_SOC_DA8XX, then gd->bd->bi_dsp_freq never gets initialised, as evidenced by the following result:
gsl-diamond > bdinfoarch_number = 0x00000D27
(...snip...)
ARM frequency = 300 MHz
DSP frequency = -17 MHz
DDR frequency = 100 MHz
I suppose it could be resolved by moving the section starting at #ifdef DSP_PLLDIV to just above the return statement, but to be honest I found this function rather difficult to follow. Perhaps it could be reworked to be a bit cleaner?
Quoted 8 lines
arch/arm/cpu/arm926ejs/davinci/cpu.c +0
-0/* * Initializes on-chip ethernet controllers. * to override, implement board_eth_init() arch/arm/include/asm/u-boot.h +0
-0
arch/arm/include/asm/u-boot.h typedef struct bd_info { · line 49
Quoted 9 lines
arch/arm/include/asm/u-boot.h +3
-0@@ -41,6 +41,9 @@ typedef struct bd_info {unsigned long bi_ip_addr;/* IP Address */ ulong bi_arch_number;/* unique id for this board */ ulong bi_boot_params;/* where this board expects params */ +unsigned long bi_arm_freq;/* arm frequency */ +unsigned long bi_dsp_freq;/* dsp core frequency */ +unsigned long bi_ddr_freq;/* ddr frequency */ struct /* RAM configuration */ {ulong start;
I'm not sure that this really belongs in every ARM board's struct bd_info, as it implies the only three clocks we'll care about are ARM, DSP and DDR. I doubt that maps nicely onto most of the SoCs out there.
Whitespace doesn't match the rest of the file (even if the rest of the file is wrong, and this patch has used tabs as it should have).
Quoted 31 lines
arch/arm/lib/board.c +9
-1@@ -463,7 +463,15 @@ void board_init_r(gd_t *id, ulong dest_addr)debug ("monitor flash len: %08lX\n" , monitor_flash_len);board_init ();/* Setup chipselects */ - +/* +* TODO: printing of the clock inforamtion of the board is now +* implemented as part of bdinfo command. Currently only support for +* davinci SOC's is added. Remove this check once all the board +* implement this. +*/ +#ifdef CONFIG_CLOCKS +set_cpu_clk_info ();/* Setup clock information */ +#endif #ifdef CONFIG_SERIAL_MULTI serial_initialize ();#endif common/cmd_bdinfo.c +2
-0@@ -370,6 +370,15 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])print_num ("irq_sp" , gd->irq_sp);/* irq stack pointer */ print_num ("sp start " , gd->start_addr_sp);print_num ("FB base " , gd->fb_base); +/* +* TODO: Currently only support for davinci SOC's is added.
common/cmd_bdinfo.c int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) · line 384
Quoted 10 lines
common/cmd_bdinfo.c +7
-0+* Remove this check once all the board implement this. +*/ +#ifdef CONFIG_CLOCKS +printf ("ARM frequency = %ld MHz\n" , gd->bd->bi_arm_freq); +printf ("DSP frequency = %ld MHz\n" , gd->bd->bi_dsp_freq); +printf ("DDR frequency = %ld MHz\n" , gd->bd->bi_ddr_freq); +#endif return 0 ; }
Again, here it is implied that the only clocks we'll ever want to print are ARM, DSP and DDR. Seems way too specific for such common code.
Bye for now,
Signature · 3 lines
Laurence Withers, <[email protected]> http://www.guralp.com/ Direct tel:+447753988197 or tel:+443333408643 Software Engineer General support queries: <[email protected]> CMG-DCM CMG-EAM CMG-NAM
PATCH v2 2/2 davinci: add support for printing clock frequency
Quoted 11 lines · Laurence Withers
Quoted 6 lines · Manjunath Hadli
add support for printing various clock frequency info found in SOC such as ARM core frequency, DSP core frequency and DDR frequency as part of bdinfo command.
Signed-off-by Manjunath Hadli<[email protected]>Cc Tom Rini<[email protected]>Sorry I am late to the party, especially as this already seems to have been applied to u-boot master, but I have just tried out this bit of code and have some feedback having looked at it.
Review is always welcome, thanks.
[snip]
Quoted 10 lines
Quoted 10 lines
arch/arm/include/asm/u-boot.h +2
-0@@ -41,6 +41,9 @@ typedef struct bd_info {unsigned long bi_ip_addr;/* IP Address */ ulong bi_arch_number;/* unique id for this board */ ulong bi_boot_params;/* where this board expects params */ +unsigned long bi_arm_freq;/* arm frequency */ +unsigned long bi_dsp_freq;/* dsp core frequency */
Quoted 8 lines
arch/arm/include/asm/u-boot.h typedef struct bd_info { · line 49
Quoted 4 lines
arch/arm/include/asm/u-boot.h +1
-0+unsigned long bi_ddr_freq;/* ddr frequency */ struct /* RAM configuration */ {ulong start;I'm not sure that this really belongs in every ARM board's struct
bd_info, as it implies the only three clocks we'll care about are ARM, DSP and DDR. I doubt that maps nicely onto most of the SoCs out there.
Checking powerpc there is precedent for #if'ing this structure, so that should be done. As for making it more generic, yes, my hope is that once the next SoC says "I want to print clocks" we can start mapping things out more. And as you noted above (and I snipped) we do need to clean up and fix the current init sequence.
Quoted 2 lines
Whitespace doesn't match the rest of the file (even if the rest of the file is wrong, and this patch has used tabs as it should have).
I was hoping checkpatch warned on that type of mismatch so I need to rework my workflow a bit.
[snip]
Quoted 15 lines
Quoted 15 lines
common/cmd_bdinfo.c +7
-0@@ -370,6 +370,15 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])print_num ("irq_sp" , gd->irq_sp);/* irq stack pointer */ print_num ("sp start " , gd->start_addr_sp);print_num ("FB base " , gd->fb_base); +/* +* TODO: Currently only support for davinci SOC's is added. +* Remove this check once all the board implement this. +*/ +#ifdef CONFIG_CLOCKS +printf ("ARM frequency = %ld MHz\n" , gd->bd->bi_arm_freq); +printf ("DSP frequency = %ld MHz\n" , gd->bd->bi_dsp_freq);
Quoted 8 lines
common/cmd_bdinfo.c int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) · line 384
Quoted 5 lines
common/cmd_bdinfo.c +2
-0+printf ("DDR frequency = %ld MHz\n" , gd->bd->bi_ddr_freq); +#endif return 0 ; }Again, here it is implied that the only clocks we'll ever want to print are ARM, DSP and DDR. Seems way too specific for such common code.
Note that do_bdinfo is already per-arch. This is intended as a starting point for generic work and the first step away from doing this in a per-board fashion. Thanks!
Signature · 1 line
Tom