From: Michal Simek Date: Thu, 2 May 2013 10:47:54 +0000 (+0200) Subject: microblaze: Fix coding style for bootb X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=08fe4940ec8a3807e3743c9b6a1b2d9ad0e26f98;p=thirdparty%2Fu-boot.git microblaze: Fix coding style for bootb Fix this weird untested code to be able to do other changes. Signed-off-by: Michal Simek --- diff --git a/arch/microblaze/lib/bootm.c b/arch/microblaze/lib/bootm.c index 7da683d24f1..6c4fa6084e4 100644 --- a/arch/microblaze/lib/bootm.c +++ b/arch/microblaze/lib/bootm.c @@ -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(