 common/cmd_nand.c |   37 +++++++++++++++++++++++++++++++++----
 1 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 0a366d3..47cf69f 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -321,6 +321,10 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 	if (strncmp(cmd, "read", 4) == 0 || strncmp(cmd, "write", 5) == 0) {
 		int read;
 
+#ifdef CONFIG_SYS_NAND_FIXUP_WRITES
+		size_t fixup_size;
+#endif
+
 		if (argc < 4)
 			goto usage;
 
@@ -331,6 +335,17 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 		if (arg_off_size(argc - 3, argv + 3, nand, &off, &size) != 0)
 			return 1;
 
+#ifdef CONFIG_SYS_NAND_FIXUP_WRITES
+		
+		if(!read)
+		{
+			fixup_size = (size & (nand->writesize - 1));
+			if(fixup_size)
+			{
+				size += (nand->writesize - fixup_size);
+			}
+		}
+#endif
 		s = strchr(cmd, '.');
 		if (!s || !strcmp(s, ".jffs2") ||
 		    !strcmp(s, ".e") || !strcmp(s, ".i")) {
@@ -507,9 +522,23 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
 	}
 
 	printf("\nLoading from %s, offset 0x%lx\n", nand->name, offset);
+	
+	/* When using nand_read_skip_bad the process fails 
+	 * with the original size of writesize when a bad block 
+	 * needs to be skipped.
+	 *
+	 * This points to a bug in nand_read_skip_bad, but since 
+	 * this is supposed to be a simple fix let's just bump up 
+	 * the size so that the read doesn't fail with bad blocks.
+	 */
+
+	cnt = nand->erasesize;
+
+	/* Should be skipping bad blocks just as a nand read does
+	 * so we'll do the same thing here.
+	 */
 
-	cnt = nand->writesize;
-	r = nand_read(nand, offset, &cnt, (u_char *) addr);
+	r = nand_read_skip_bad(nand, offset, &cnt, (u_char *) addr);
 	if (r) {
 		puts("** Read error\n");
 		show_boot_progress (-56);
@@ -541,8 +570,8 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
 	}
 	show_boot_progress (57);
 
-	/* FIXME: skip bad blocks */
-	r = nand_read(nand, offset, &cnt, (u_char *) addr);
+	/* Use same read function as nand read command */
+	r = nand_read_skip_bad(nand, offset, &cnt, (u_char *) addr);
 	if (r) {
 		puts("** Read error\n");
 		show_boot_progress (-58);
