From d346d441a9e7e69d1f0d9a0ea57f151f02f83d08 Mon Sep 17 00:00:00 2001 From: Piotr Dymacz Date: Tue, 28 Apr 2015 20:18:14 +0200 Subject: [PATCH] Switch to target function name for clocks reading --- u-boot/common/cmd_custom.c | 6 +++--- u-boot/cpu/mips/ar7240/ag7240.c | 4 ++-- u-boot/cpu/mips/ar7240/ar933x_clocks.c | 3 +-- u-boot/lib_mips/board.c | 8 ++++++++ 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/u-boot/common/cmd_custom.c b/u-boot/common/cmd_custom.c index 5e8b701..f9a10cf 100644 --- a/u-boot/common/cmd_custom.c +++ b/u-boot/common/cmd_custom.c @@ -26,7 +26,7 @@ #include #include "../board/ar7240/common/ar7240_flash.h" -extern void ar7240_sys_frequency(u32 *cpu_freq, u32 *ddr_freq, u32 *ahb_freq); +extern void ar933x_sys_frequency(u32 *cpu_freq, u32 *ddr_freq, u32 *ahb_freq); #if defined(OFFSET_MAC_ADDRESS) /* @@ -247,7 +247,7 @@ int do_default_env(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]){ } U_BOOT_CMD(defenv, 1, 0, do_default_env, "reset environment variables to their default values\n", NULL); -#endif /* if defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) || defined(CONFIG_FOR_DRAGINO_V2) || defined(CONFIG_FOR_MESH_POTATO_V2) */ +#endif /* if !defined(CONFIG_FOR_DLINK_DIR505_A1) */ #if defined(PLL_IN_FLASH_MAGIC_OFFSET) @@ -558,7 +558,7 @@ int do_set_clocks(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]){ if(argc == 1){ // read clocks - ar7240_sys_frequency(&cpu_freq, &ddr_freq, &ahb_freq); + ar933x_sys_frequency(&cpu_freq, &ddr_freq, &ahb_freq); // calculate SPI clock (we need to set bit 0 to 1 in SPI_FUNC_SELECT to access SPI registers) ar7240_reg_wr(AR7240_SPI_FS, 0x01); diff --git a/u-boot/cpu/mips/ar7240/ag7240.c b/u-boot/cpu/mips/ar7240/ag7240.c index b18292b..191da09 100644 --- a/u-boot/cpu/mips/ar7240/ag7240.c +++ b/u-boot/cpu/mips/ar7240/ag7240.c @@ -28,7 +28,7 @@ void ag7240_miiphy_write(char *devname, uint32_t phaddr, uint8_t reg, uint16_t d ag7240_mac_t *ag7240_macs[CFG_AG7240_NMACS]; -extern void ar7240_sys_frequency(u32 *cpu_freq, u32 *ddr_freq, u32 *ahb_freq); +extern void ar933x_sys_frequency(u32 *cpu_freq, u32 *ddr_freq, u32 *ahb_freq); extern int athrs26_phy_setup(int unit); extern int athrs26_phy_is_up(int unit); @@ -174,7 +174,7 @@ void ag7240_mii_setup(ag7240_mac_t *mac) { ag7240_reg_wr(mac, AG7240_MAC_MII_MGMT_CFG, mgmt_cfg_val); } } else { - ar7240_sys_frequency(&cpu_freq, &ddr_freq, &ahb_freq); + ar933x_sys_frequency(&cpu_freq, &ddr_freq, &ahb_freq); switch (ahb_freq / 1000000) { case 150: diff --git a/u-boot/cpu/mips/ar7240/ar933x_clocks.c b/u-boot/cpu/mips/ar7240/ar933x_clocks.c index 8771d61..fd01789 100644 --- a/u-boot/cpu/mips/ar7240/ar933x_clocks.c +++ b/u-boot/cpu/mips/ar7240/ar933x_clocks.c @@ -22,8 +22,7 @@ inline int ar933x_40MHz_xtal(void) * Get CPU, RAM and AHB clocks * Based on: Linux/arch/mips/ath79/clock.c */ -/* TODO: void ar933x_sys_frequency(u32 *cpu_freq, u32 *ddr_freq, u32 *ahb_freq) */ -void ar7240_sys_frequency(u32 *cpu_freq, u32 *ddr_freq, u32 *ahb_freq) +void ar933x_sys_frequency(u32 *cpu_freq, u32 *ddr_freq, u32 *ahb_freq) { u32 ref_rate, clock_ctrl, cpu_config, pll, temp; diff --git a/u-boot/lib_mips/board.c b/u-boot/lib_mips/board.c index cec1fcf..1572043 100644 --- a/u-boot/lib_mips/board.c +++ b/u-boot/lib_mips/board.c @@ -53,7 +53,11 @@ extern int timer_init(void); extern void all_led_on(void); extern void all_led_off(void); extern const char* print_mem_type(void); +#ifdef CONFIG_WASP extern void ar7240_sys_frequency(u32 *cpu_freq, u32 *ddr_freq, u32 *ahb_freq); +#else +extern void ar933x_sys_frequency(u32 *cpu_freq, u32 *ddr_freq, u32 *ahb_freq); +#endif ulong monitor_flash_len; @@ -336,7 +340,11 @@ void board_init_r(gd_t *id, ulong dest_addr){ bd = gd->bd; /* get CPU/RAM/AHB clocks */ +#ifdef CONFIG_WASP ar7240_sys_frequency(&cpu_freq, &ddr_freq, &ahb_freq); +#else + ar933x_sys_frequency(&cpu_freq, &ddr_freq, &ahb_freq); +#endif /* set bi_cfg_hz */ bd->bi_cfg_hz = (unsigned long)(cpu_freq >> 1); -- 2.25.1