U_BOOT_CMD(eraseenv, 1, 1, do_erase_env, "erase environment sector in flash\n", NULL);
#endif /* if defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) */
-#if defined(CONFIG_MACH_HORNET)
-// TODO: AR9344 support
-/*
- * Show current CPU/RAM/AHB/SPI/REF clocks
- */
-int do_print_clocks(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]){
- unsigned int ahb_freq, ddr_freq, cpu_freq, spi_freq;
-#if defined(PLL_IN_FLASH_MAGIC_OFFSET)
- unsigned int pll, ref, reg;
-#endif
-
- // read clocks
- ar7240_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);
- spi_freq = ahb_freq / (((ar7240_reg_rd(AR7240_SPI_CLOCK) & 0x3F) + 1) * 2);
- ar7240_reg_wr(AR7240_SPI_FS, 0x0);
-
- // make MHz from Hz
- cpu_freq /= 1000000;
- ddr_freq /= 1000000;
- ahb_freq /= 1000000;
- spi_freq /= 1000000;
-
- printf("Current clocks (approximated):\n- CPU: %3d MHz\n", cpu_freq);
- printf("- RAM: %3d MHz\n", ddr_freq);
- printf("- AHB: %3d MHz\n", ahb_freq);
- printf("- SPI: %3d MHz\n", spi_freq);
-
-#if defined(PLL_IN_FLASH_MAGIC_OFFSET)
- if(ar7240_reg_rd(HORNET_BOOTSTRAP_STATUS) & HORNET_BOOTSTRAP_SEL_25M_40M_MASK){
- ref = 40000000;
- } else {
- ref = 25000000;
- }
-
- // do we have PLL_MAGIC in FLASH?
- reg = ar7240_reg_rd(CFG_FLASH_BASE + PLL_IN_FLASH_DATA_BLOCK_OFFSET + PLL_IN_FLASH_MAGIC_OFFSET);
-
- if(reg == PLL_IN_FLASH_MAGIC){
- puts("\nClocks configuration stored in FLASH (approximated):\n");
-
- // read CPU PLL Configuration register (CPU_PLL_CONFIG) value stored in FLASH (PLL_IN_FLASH_MAGIC_OFFSET + 4)
- reg = ar7240_reg_rd(CFG_FLASH_BASE + PLL_IN_FLASH_DATA_BLOCK_OFFSET + PLL_IN_FLASH_MAGIC_OFFSET + 4);
-
- // refdiv
- pll = ref / ((reg & HORNET_PLL_CONFIG_REFDIV_MASK) >> HORNET_PLL_CONFIG_REFDIV_SHIFT);
-
- // div_int
- pll *= ((reg & HORNET_PLL_CONFIG_NINT_MASK) >> HORNET_PLL_CONFIG_NINT_SHIFT);
-
- // outdiv
- pll >>= ((reg & HORNET_PLL_CONFIG_OUTDIV_MASK) >> HORNET_PLL_CONFIG_OUTDIV_SHIFT);
-
- // read CLOCK CONTROL Configuration register (CLOCK_CONTROL) value stored in FLASH (PLL_IN_FLASH_MAGIC_OFFSET + 8)
- reg = ar7240_reg_rd(CFG_FLASH_BASE + PLL_IN_FLASH_DATA_BLOCK_OFFSET + PLL_IN_FLASH_MAGIC_OFFSET + 8);
-
- // cpu, ram, ahb
- cpu_freq = pll / (((reg & HORNET_CLOCK_CONTROL_CPU_POST_DIV_MASK) >> HORNET_CLOCK_CONTROL_CPU_POST_DIV_SHIFT) + 1);
- ddr_freq = pll / (((reg & HORNET_CLOCK_CONTROL_DDR_POST_DIV_MASK) >> HORNET_CLOCK_CONTROL_DDR_POST_DIV_SFIFT) + 1);
- ahb_freq = pll / (((reg & HORNET_CLOCK_CONTROL_AHB_POST_DIV_MASK) >> HORNET_CLOCK_CONTROL_AHB_POST_DIV_SFIFT) + 1);
-
- // read SPI CONTROL Configuration register (SPI_CONTROL) value stored in FLASH (PLL_IN_FLASH_MAGIC_OFFSET + 12)
- reg = ar7240_reg_rd(CFG_FLASH_BASE + PLL_IN_FLASH_DATA_BLOCK_OFFSET + PLL_IN_FLASH_MAGIC_OFFSET + 12);
-
- // spi
- spi_freq = ahb_freq / (2 * ((reg & 0x3F) + 1));
-
- // make MHz from Hz
- cpu_freq /= 1000000;
- ddr_freq /= 1000000;
- ahb_freq /= 1000000;
- spi_freq /= 1000000;
-
- printf("- CPU: %3d MHz\n", cpu_freq);
- printf("- RAM: %3d MHz\n", ddr_freq);
- printf("- AHB: %3d MHz\n", ahb_freq);
- printf("- SPI: %3d MHz\n", spi_freq);
- } else {
- puts("\nPLL and clocks configuration in FLASH is empty,\nuse 'setclocks' to set them and store in FLASH.\n");
- }
-#endif
-
- if(ar7240_reg_rd(HORNET_BOOTSTRAP_STATUS) & HORNET_BOOTSTRAP_SEL_25M_40M_MASK){
- puts("\nReference clock: 40 MHz\n");
- } else {
- puts("\nReference clock: 25 MHz\n");
- }
-
- return(0);
-}
-
-U_BOOT_CMD(printclocks, 1, 1, do_print_clocks, "print CPU, RAM, AHB, SPI and REF clocks\n", NULL);
-#endif /* #if defined(CONFIG_MACH_HORNET) */
-
#if defined(PLL_IN_FLASH_MAGIC_OFFSET)
typedef struct {