]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
microblaze: Fix coding style for bootb
authorMichal Simek <michal.simek@xilinx.com>
Thu, 2 May 2013 10:47:54 +0000 (12:47 +0200)
committerMichal Simek <michal.simek@xilinx.com>
Fri, 3 May 2013 07:01:05 +0000 (09:01 +0200)
Fix this weird untested code to be able to do other changes.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
arch/microblaze/lib/bootm.c

index 7da683d24f1e03bcbb2ea7d37e0eed75f5fe1922..6c4fa6084e48c1a0d1aa663a1b94b6016384d538 100644 (file)
@@ -91,52 +91,57 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima
 #if defined(CONFIG_CMD_BOOTB)
 int do_bootb_kintex7(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-       u32 FrameBuffer[8];
-    u32 BootAddress = simple_strtoul(argv[1], NULL, 16);
-       u32 Index = 0;
-    u32 Count;
-    
-    if (argc < 2)
+       u32 framebuffer[8];
+       u32 bootaddress = simple_strtoul(argv[1], NULL, 16);
+       u32 index = 0;
+       u32 count;
+
+       if (argc < 2)
+               return -1;
+
+       if ((bootaddress < CONFIG_SYS_FLASH_BASE) ||
+           (bootaddress > (CONFIG_SYS_FLASH_BASE + CONFIG_SYS_FLASH_SIZE)))
                return -1;
-    
-    if ((BootAddress <  CONFIG_SYS_FLASH_BASE) || (BootAddress > (CONFIG_SYS_FLASH_BASE + CONFIG_SYS_FLASH_SIZE)))
-    {
-        return -1;
-    }
 
-    /*
+       /*
         * Create the data to be written to the ICAP.
         */
-       FrameBuffer[Index++] = XHI_DUMMY_PACKET;
-       FrameBuffer[Index++] = XHI_SYNC_PACKET;
-       FrameBuffer[Index++] = XHI_NOOP_PACKET;
-    FrameBuffer[Index++] = 0x30020001;                        /* Type 1 write to WBSTAR */
-    FrameBuffer[Index++] = BootAddress;
-    FrameBuffer[Index++] = 0x30008001;                        /* Type 1 Write to CMD */
-    FrameBuffer[Index++] = XHI_CMD_IPROG;
-       FrameBuffer[Index++] = XHI_NOOP_PACKET;
-
-     /*
-         * Fill the FIFO with as many words as it will take (or as many as we have to send).
-         */
-       while(Index > XHwIcap_GetWrFifoVacancy(HWICAP_BASEADDR));
-       for (Count = 0; Count < Index; Count++)
-    {
-       XHwIcap_FifoWrite(HWICAP_BASEADDR, FrameBuffer[Count]);
-       }
-
-    /*
+       framebuffer[index++] = XHI_DUMMY_PACKET;
+       framebuffer[index++] = XHI_SYNC_PACKET;
+       framebuffer[index++] = XHI_NOOP_PACKET;
+       framebuffer[index++] = 0x30020001; /* Type 1 write to WBSTAR */
+       framebuffer[index++] = bootaddress;
+       framebuffer[index++] = 0x30008001; /* Type 1 Write to CMD */
+       framebuffer[index++] = XHI_CMD_IPROG;
+       framebuffer[index++] = XHI_NOOP_PACKET;
+
+       /*
+        * Fill the FIFO with as many words as it will take
+        * (or as many as we have to send).
+        */
+       while (index > XHwIcap_GetWrFifoVacancy(HWICAP_BASEADDR))
+               ;
+       for (count = 0; count < index; count++)
+               XHwIcap_FifoWrite(HWICAP_BASEADDR, framebuffer[count]);
+
+
+       /*
         * Start the transfer of the data from the FIFO to the ICAP device.
         */
        XHwIcap_StartConfig(HWICAP_BASEADDR);
 
-       while ((XHwIcap_ReadReg(HWICAP_BASEADDR,XHI_CR_OFFSET)) & XHI_CR_WRITE_MASK);
-    
-       while (XHwIcap_IsDeviceBusy(HWICAP_BASEADDR) != 0);
-       while (XHwIcap_ReadReg(HWICAP_BASEADDR, XHI_CR_OFFSET) & XHI_CR_WRITE_MASK);
-    
-    /* The code should never get here sice the FPGA should reset */
-    return -1;
+       while ((XHwIcap_ReadReg(HWICAP_BASEADDR, XHI_CR_OFFSET)) &
+              XHI_CR_WRITE_MASK)
+               ;
+
+       while (XHwIcap_IsDeviceBusy(HWICAP_BASEADDR) != 0)
+               ;
+       while (XHwIcap_ReadReg(HWICAP_BASEADDR, XHI_CR_OFFSET) &
+              XHI_CR_WRITE_MASK)
+               ;
+
+       /* The code should never get here sice the FPGA should reset */
+       return -1;
 }
 
 U_BOOT_CMD(