diff options
| author | Nathan Rossi <nathan.rossi@xilinx.com> | 2013-05-07 15:21:14 +1000 |
|---|---|---|
| committer | Nathan Rossi <nathan.rossi@xilinx.com> | 2013-05-07 15:21:14 +1000 |
| commit | 838d1ee2fda4010452f737cb0352e2ac99119132 (patch) | |
| tree | 9d8bcc32bd394c8560990c3d5747ade40445dd41 | |
| parent | caec348a5954a0ff3fd5a652f862cfec63d0b8c4 (diff) | |
| download | meta-xilinx-838d1ee2fda4010452f737cb0352e2ac99119132.tar.gz | |
u-boot-xlnx: Add patches for MicroBlaze initrd support
Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com>
4 files changed, 223 insertions, 2 deletions
diff --git a/recipes-bsp/u-boot/u-boot-xlnx.inc b/recipes-bsp/u-boot/u-boot-xlnx.inc index 974b8a38..038f764d 100644 --- a/recipes-bsp/u-boot/u-boot-xlnx.inc +++ b/recipes-bsp/u-boot/u-boot-xlnx.inc | |||
| @@ -6,8 +6,13 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=1707d6db1d42237583f50183a5651ecb" | |||
| 6 | # move this to common include? | 6 | # move this to common include? |
| 7 | XILINX_EXTENSION = "-xlnx" | 7 | XILINX_EXTENSION = "-xlnx" |
| 8 | 8 | ||
| 9 | SRC_URI = "git://github.com/Xilinx/u-boot-xlnx.git;protocol=git \ | 9 | FILESEXTRAPATHS += "${THISDIR}/u-boot-xlnx:" |
| 10 | " | 10 | SRC_URI = " \ |
| 11 | git://github.com/Xilinx/u-boot-xlnx.git;protocol=git \ | ||
| 12 | file://microblaze_bootm_Add_support_for_loading_initrd.patch \ | ||
| 13 | file://microblaze_bootm_Fix_coding_style_issues.patch \ | ||
| 14 | file://microblaze_Fix_coding_style_for_bootb.patch \ | ||
| 15 | " | ||
| 11 | 16 | ||
| 12 | S = "${WORKDIR}/git" | 17 | S = "${WORKDIR}/git" |
| 13 | 18 | ||
diff --git a/recipes-bsp/u-boot/u-boot-xlnx/microblaze_Fix_coding_style_for_bootb.patch b/recipes-bsp/u-boot/u-boot-xlnx/microblaze_Fix_coding_style_for_bootb.patch new file mode 100644 index 00000000..09648c10 --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-xlnx/microblaze_Fix_coding_style_for_bootb.patch | |||
| @@ -0,0 +1,114 @@ | |||
| 1 | From: Michal Simek <michal.simek@xilinx.com> | ||
| 2 | Subject: [U-BOOT PATCH 1/3] microblaze: Fix coding style for bootb | ||
| 3 | |||
| 4 | Fix this weird untested code to be able to other changes. | ||
| 5 | |||
| 6 | Signed-off-by: Michal Simek <michal.simek@xilinx.com> | ||
| 7 | --- | ||
| 8 | arch/microblaze/lib/bootm.c | 81 ++++++++++++++++++++++++--------------------- | ||
| 9 | 1 file changed, 43 insertions(+), 38 deletions(-) | ||
| 10 | |||
| 11 | diff --git a/arch/microblaze/lib/bootm.c b/arch/microblaze/lib/bootm.c | ||
| 12 | index 7da683d..6c4fa60 100644 | ||
| 13 | --- a/arch/microblaze/lib/bootm.c | ||
| 14 | +++ b/arch/microblaze/lib/bootm.c | ||
| 15 | @@ -91,52 +91,57 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima | ||
| 16 | #if defined(CONFIG_CMD_BOOTB) | ||
| 17 | int do_bootb_kintex7(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) | ||
| 18 | { | ||
| 19 | - u32 FrameBuffer[8]; | ||
| 20 | - u32 BootAddress = simple_strtoul(argv[1], NULL, 16); | ||
| 21 | - u32 Index = 0; | ||
| 22 | - u32 Count; | ||
| 23 | - | ||
| 24 | - if (argc < 2) | ||
| 25 | + u32 framebuffer[8]; | ||
| 26 | + u32 bootaddress = simple_strtoul(argv[1], NULL, 16); | ||
| 27 | + u32 index = 0; | ||
| 28 | + u32 count; | ||
| 29 | + | ||
| 30 | + if (argc < 2) | ||
| 31 | + return -1; | ||
| 32 | + | ||
| 33 | + if ((bootaddress < CONFIG_SYS_FLASH_BASE) || | ||
| 34 | + (bootaddress > (CONFIG_SYS_FLASH_BASE + CONFIG_SYS_FLASH_SIZE))) | ||
| 35 | return -1; | ||
| 36 | - | ||
| 37 | - if ((BootAddress < CONFIG_SYS_FLASH_BASE) || (BootAddress > (CONFIG_SYS_FLASH_BASE + CONFIG_SYS_FLASH_SIZE))) | ||
| 38 | - { | ||
| 39 | - return -1; | ||
| 40 | - } | ||
| 41 | |||
| 42 | - /* | ||
| 43 | + /* | ||
| 44 | * Create the data to be written to the ICAP. | ||
| 45 | */ | ||
| 46 | - FrameBuffer[Index++] = XHI_DUMMY_PACKET; | ||
| 47 | - FrameBuffer[Index++] = XHI_SYNC_PACKET; | ||
| 48 | - FrameBuffer[Index++] = XHI_NOOP_PACKET; | ||
| 49 | - FrameBuffer[Index++] = 0x30020001; /* Type 1 write to WBSTAR */ | ||
| 50 | - FrameBuffer[Index++] = BootAddress; | ||
| 51 | - FrameBuffer[Index++] = 0x30008001; /* Type 1 Write to CMD */ | ||
| 52 | - FrameBuffer[Index++] = XHI_CMD_IPROG; | ||
| 53 | - FrameBuffer[Index++] = XHI_NOOP_PACKET; | ||
| 54 | - | ||
| 55 | - /* | ||
| 56 | - * Fill the FIFO with as many words as it will take (or as many as we have to send). | ||
| 57 | - */ | ||
| 58 | - while(Index > XHwIcap_GetWrFifoVacancy(HWICAP_BASEADDR)); | ||
| 59 | - for (Count = 0; Count < Index; Count++) | ||
| 60 | - { | ||
| 61 | - XHwIcap_FifoWrite(HWICAP_BASEADDR, FrameBuffer[Count]); | ||
| 62 | - } | ||
| 63 | - | ||
| 64 | - /* | ||
| 65 | + framebuffer[index++] = XHI_DUMMY_PACKET; | ||
| 66 | + framebuffer[index++] = XHI_SYNC_PACKET; | ||
| 67 | + framebuffer[index++] = XHI_NOOP_PACKET; | ||
| 68 | + framebuffer[index++] = 0x30020001; /* Type 1 write to WBSTAR */ | ||
| 69 | + framebuffer[index++] = bootaddress; | ||
| 70 | + framebuffer[index++] = 0x30008001; /* Type 1 Write to CMD */ | ||
| 71 | + framebuffer[index++] = XHI_CMD_IPROG; | ||
| 72 | + framebuffer[index++] = XHI_NOOP_PACKET; | ||
| 73 | + | ||
| 74 | + /* | ||
| 75 | + * Fill the FIFO with as many words as it will take | ||
| 76 | + * (or as many as we have to send). | ||
| 77 | + */ | ||
| 78 | + while (index > XHwIcap_GetWrFifoVacancy(HWICAP_BASEADDR)) | ||
| 79 | + ; | ||
| 80 | + for (count = 0; count < index; count++) | ||
| 81 | + XHwIcap_FifoWrite(HWICAP_BASEADDR, framebuffer[count]); | ||
| 82 | + | ||
| 83 | + | ||
| 84 | + /* | ||
| 85 | * Start the transfer of the data from the FIFO to the ICAP device. | ||
| 86 | */ | ||
| 87 | XHwIcap_StartConfig(HWICAP_BASEADDR); | ||
| 88 | |||
| 89 | - while ((XHwIcap_ReadReg(HWICAP_BASEADDR,XHI_CR_OFFSET)) & XHI_CR_WRITE_MASK); | ||
| 90 | - | ||
| 91 | - while (XHwIcap_IsDeviceBusy(HWICAP_BASEADDR) != 0); | ||
| 92 | - while (XHwIcap_ReadReg(HWICAP_BASEADDR, XHI_CR_OFFSET) & XHI_CR_WRITE_MASK); | ||
| 93 | - | ||
| 94 | - /* The code should never get here sice the FPGA should reset */ | ||
| 95 | - return -1; | ||
| 96 | + while ((XHwIcap_ReadReg(HWICAP_BASEADDR, XHI_CR_OFFSET)) & | ||
| 97 | + XHI_CR_WRITE_MASK) | ||
| 98 | + ; | ||
| 99 | + | ||
| 100 | + while (XHwIcap_IsDeviceBusy(HWICAP_BASEADDR) != 0) | ||
| 101 | + ; | ||
| 102 | + while (XHwIcap_ReadReg(HWICAP_BASEADDR, XHI_CR_OFFSET) & | ||
| 103 | + XHI_CR_WRITE_MASK) | ||
| 104 | + ; | ||
| 105 | + | ||
| 106 | + /* The code should never get here sice the FPGA should reset */ | ||
| 107 | + return -1; | ||
| 108 | } | ||
| 109 | |||
| 110 | U_BOOT_CMD( | ||
| 111 | -- | ||
| 112 | 1.8.2.1 | ||
| 113 | |||
| 114 | |||
diff --git a/recipes-bsp/u-boot/u-boot-xlnx/microblaze_bootm_Add_support_for_loading_initrd.patch b/recipes-bsp/u-boot/u-boot-xlnx/microblaze_bootm_Add_support_for_loading_initrd.patch new file mode 100644 index 00000000..88c44687 --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-xlnx/microblaze_bootm_Add_support_for_loading_initrd.patch | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | From: Michal Simek <michal.simek@xilinx.com> | ||
| 2 | Subject: [U-BOOT PATCH 3/3] microblaze: bootm: Add support for loading | ||
| 3 | initrd | ||
| 4 | |||
| 5 | fdt_initrd add additional information to DTB about initrd | ||
| 6 | addresses which are later used by kernel. | ||
| 7 | |||
| 8 | Signed-off-by: Michal Simek <michal.simek@xilinx.com> | ||
| 9 | --- | ||
| 10 | arch/microblaze/lib/bootm.c | 5 +++++ | ||
| 11 | 1 file changed, 5 insertions(+) | ||
| 12 | |||
| 13 | diff --git a/arch/microblaze/lib/bootm.c b/arch/microblaze/lib/bootm.c | ||
| 14 | index 56a1568..fbb43b8 100644 | ||
| 15 | --- a/arch/microblaze/lib/bootm.c | ||
| 16 | +++ b/arch/microblaze/lib/bootm.c | ||
| 17 | @@ -68,6 +68,11 @@ int do_bootm_linux(int flag, int argc, char * const argv[], | ||
| 18 | |||
| 19 | if (!of_flat_tree && argc > 3) | ||
| 20 | of_flat_tree = (char *)simple_strtoul(argv[3], NULL, 16); | ||
| 21 | + | ||
| 22 | + /* fixup the initrd now that we know where it should be */ | ||
| 23 | + if (images->rd_start && images->rd_end && of_flat_tree) | ||
| 24 | + fdt_initrd(of_flat_tree, images->rd_start, images->rd_end, 1); | ||
| 25 | + | ||
| 26 | #ifdef DEBUG | ||
| 27 | printf("## Transferring control to Linux (at address 0x%08lx) ", | ||
| 28 | (ulong)thekernel); | ||
| 29 | -- | ||
| 30 | 1.8.2.1 | ||
| 31 | |||
| 32 | |||
diff --git a/recipes-bsp/u-boot/u-boot-xlnx/microblaze_bootm_Fix_coding_style_issues.patch b/recipes-bsp/u-boot/u-boot-xlnx/microblaze_bootm_Fix_coding_style_issues.patch new file mode 100644 index 00000000..1352d828 --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-xlnx/microblaze_bootm_Fix_coding_style_issues.patch | |||
| @@ -0,0 +1,70 @@ | |||
| 1 | From: Michal Simek <michal.simek@xilinx.com> | ||
| 2 | Subject: [U-BOOT PATCH 2/3] microblaze: bootm: Fix coding style issues | ||
| 3 | |||
| 4 | Prepare place for new patch. | ||
| 5 | |||
| 6 | Signed-off-by: Michal Simek <michal.simek@xilinx.com> | ||
| 7 | --- | ||
| 8 | arch/microblaze/lib/bootm.c | 20 +++++++++++--------- | ||
| 9 | 1 file changed, 11 insertions(+), 9 deletions(-) | ||
| 10 | |||
| 11 | diff --git a/arch/microblaze/lib/bootm.c b/arch/microblaze/lib/bootm.c | ||
| 12 | index 6c4fa60..56a1568 100644 | ||
| 13 | --- a/arch/microblaze/lib/bootm.c | ||
| 14 | +++ b/arch/microblaze/lib/bootm.c | ||
| 15 | @@ -36,11 +36,12 @@ | ||
| 16 | |||
| 17 | DECLARE_GLOBAL_DATA_PTR; | ||
| 18 | |||
| 19 | -int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *images) | ||
| 20 | +int do_bootm_linux(int flag, int argc, char * const argv[], | ||
| 21 | + bootm_headers_t *images) | ||
| 22 | { | ||
| 23 | /* First parameter is mapped to $r5 for kernel boot args */ | ||
| 24 | - void (*theKernel) (char *, ulong, ulong); | ||
| 25 | - char *commandline = getenv ("bootargs"); | ||
| 26 | + void (*thekernel) (char *, ulong, ulong); | ||
| 27 | + char *commandline = getenv("bootargs"); | ||
| 28 | ulong rd_data_start, rd_data_end; | ||
| 29 | |||
| 30 | if ((flag != 0) && (flag != BOOTM_STATE_OS_GO)) | ||
| 31 | @@ -55,10 +56,10 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima | ||
| 32 | of_flat_tree = images->ft_addr; | ||
| 33 | #endif | ||
| 34 | |||
| 35 | - theKernel = (void (*)(char *, ulong, ulong))images->ep; | ||
| 36 | + thekernel = (void (*)(char *, ulong, ulong))images->ep; | ||
| 37 | |||
| 38 | /* find ramdisk */ | ||
| 39 | - ret = boot_get_ramdisk (argc, argv, images, IH_ARCH_MICROBLAZE, | ||
| 40 | + ret = boot_get_ramdisk(argc, argv, images, IH_ARCH_MICROBLAZE, | ||
| 41 | &rd_data_start, &rd_data_end); | ||
| 42 | if (ret) | ||
| 43 | return 1; | ||
| 44 | @@ -68,9 +69,10 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima | ||
| 45 | if (!of_flat_tree && argc > 3) | ||
| 46 | of_flat_tree = (char *)simple_strtoul(argv[3], NULL, 16); | ||
| 47 | #ifdef DEBUG | ||
| 48 | - printf ("## Transferring control to Linux (at address 0x%08lx) " \ | ||
| 49 | - "ramdisk 0x%08lx, FDT 0x%08lx...\n", | ||
| 50 | - (ulong) theKernel, rd_data_start, (ulong) of_flat_tree); | ||
| 51 | + printf("## Transferring control to Linux (at address 0x%08lx) ", | ||
| 52 | + (ulong)thekernel); | ||
| 53 | + printf("ramdisk 0x%08lx, FDT 0x%08lx...\n", | ||
| 54 | + rd_data_start, (ulong) of_flat_tree); | ||
| 55 | #endif | ||
| 56 | |||
| 57 | #ifdef XILINX_USE_DCACHE | ||
| 58 | @@ -82,7 +84,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima | ||
| 59 | * r6: pointer to ramdisk | ||
| 60 | * r7: pointer to the fdt, followed by the board info data | ||
| 61 | */ | ||
| 62 | - theKernel (commandline, rd_data_start, (ulong) of_flat_tree); | ||
| 63 | + thekernel(commandline, rd_data_start, (ulong)of_flat_tree); | ||
| 64 | /* does not return */ | ||
| 65 | |||
| 66 | return 1; | ||
| 67 | -- | ||
| 68 | 1.8.2.1 | ||
| 69 | |||
| 70 | |||
