platform: tegra: bootrom: fix pmc register config for commands
Laxman Dewangan [Fri, 6 Nov 2015 13:59:13 +0000 (18:59 +0530)]
The number of PMC commands provided from DT is not fully written
into PMC register due to mishandling of index pointer.

Fix the index pointer handling to properly increment it.

bug 200146310

Change-Id: I6d300a050923052ebd356b62dc756dd6cf197beb
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/829394
GVS: Gerrit_Virtual_Submit

drivers/platform/tegra/tegra-bootrom-pmc-config.c

index 0197fa4..9f401f5 100644 (file)
@@ -203,15 +203,15 @@ static int tegra210_configure_pmc_scratch(struct device *dev,
                reg_data_mask = (command_pw == 1) ? 0xFFFF : 0xFFFFFFFFUL;
                csum = 0;
 
-               for (j = 0; j < block->ncommands; j += command_pw) {
+               for (j = 0; j < block->ncommands; j++) {
                        command = block->commands[j] & reg_data_mask;
                        if (command_pw == 2) {
                                j++;
                                if (j == block->ncommands)
                                        goto reg_update;
+                               command |= (block->commands[j] &
+                                                       reg_data_mask) << 16;
                        }
-
-                       command |= (block->commands[j] & reg_data_mask) << 16;
 reg_update:
                        tegra_pmc_write_bootrom_command(reg_offset * 4,
                                                command);