Fix SPI clock calculation in setclk command, use new QC/A clocks calculation function
authorPiotr Dymacz <pepe2k@gmail.com>
Wed, 2 Dec 2015 18:30:07 +0000 (19:30 +0100)
committerPiotr Dymacz <pepe2k@gmail.com>
Wed, 2 Dec 2015 18:30:07 +0000 (19:30 +0100)
u-boot/common/cmd_custom.c

index ad97d9f1c82c78c11c0ae99123bafb5934f1bc13..c85c20f0a058078e39698db31927b77315d8c5e4 100755 (executable)
@@ -559,12 +559,7 @@ int do_set_clocks(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]){
        if(argc == 1){
 
                // read clocks
-               qca_sys_clocks(&cpu_freq, &ddr_freq, &ahb_freq, NULL, NULL);
-
-               // 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);
+               qca_sys_clocks(&cpu_freq, &ddr_freq, &ahb_freq, &spi_freq, NULL);
 
                // make MHz from Hz
                cpu_freq /= 1000000;