Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARC: [plat-axs103] refactor the quad core DT quirk code

Refactor the quad core DT quirk code:
get rid of waste division and multiplication by 1000000 constant.

Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>

authored by

Eugeniy Paltsev and committed by
Vineet Gupta
d7de73b5 fbd1cec5

+6 -4
+6 -4
arch/arc/plat-axs10x/axs10x.c
··· 317 317 * Instead of duplicating defconfig/DT for SMP/QUAD, add a small hack 318 318 * of fudging the freq in DT 319 319 */ 320 + #define AXS103_QUAD_CORE_CPU_FREQ_HZ 50000000 321 + 320 322 unsigned int num_cores = (read_aux_reg(ARC_REG_MCIP_BCR) >> 16) & 0x3F; 321 323 if (num_cores > 2) { 322 - u32 freq = 50, orig; 324 + u32 freq; 323 325 int off = fdt_path_offset(initial_boot_params, "/cpu_card/core_clk"); 324 326 const struct fdt_property *prop; 325 327 326 328 prop = fdt_get_property(initial_boot_params, off, 327 329 "assigned-clock-rates", NULL); 328 - orig = be32_to_cpu(*(u32*)(prop->data)) / 1000000; 330 + freq = be32_to_cpu(*(u32 *)(prop->data)); 329 331 330 332 /* Patching .dtb in-place with new core clock value */ 331 - if (freq != orig ) { 332 - freq = cpu_to_be32(freq * 1000000); 333 + if (freq != AXS103_QUAD_CORE_CPU_FREQ_HZ) { 334 + freq = cpu_to_be32(AXS103_QUAD_CORE_CPU_FREQ_HZ); 333 335 fdt_setprop_inplace(initial_boot_params, off, 334 336 "assigned-clock-rates", &freq, sizeof(freq)); 335 337 }