X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=drivers%2Fdfu%2Fdfu_mmc.c;h=0816f46bad8ebcd6350319f98be8dbeb6ed7f046;hb=1ad6364eeb4f578e423081d1748e8a3fdf1ab01d;hp=e2f39784005549170839f0e559300764715966bc;hpb=0c669fd17a9d8452f70369474925a91139e3005d;p=platform%2Fkernel%2Fu-boot.git diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c index e2f3978..0816f46 100644 --- a/drivers/dfu/dfu_mmc.c +++ b/drivers/dfu/dfu_mmc.c @@ -4,19 +4,7 @@ * Copyright (C) 2012 Samsung Electronics * author: Lukasz Majewski * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * SPDX-License-Identifier: GPL-2.0+ */ #include @@ -25,16 +13,11 @@ #include #include -enum dfu_mmc_op { - DFU_OP_READ = 1, - DFU_OP_WRITE, -}; - static unsigned char __aligned(CONFIG_SYS_CACHELINE_SIZE) dfu_file_buf[CONFIG_SYS_DFU_MAX_FILE_SIZE]; static long dfu_file_buf_len; -static int mmc_block_op(enum dfu_mmc_op op, struct dfu_entity *dfu, +static int mmc_block_op(enum dfu_op op, struct dfu_entity *dfu, u64 offset, void *buf, long *len) { char cmd_buf[DFU_CMD_BUF_SIZE]; @@ -77,7 +60,7 @@ static int mmc_file_buffer(struct dfu_entity *dfu, void *buf, long *len) return 0; } -static int mmc_file_op(enum dfu_mmc_op op, struct dfu_entity *dfu, +static int mmc_file_op(enum dfu_op op, struct dfu_entity *dfu, void *buf, long *len) { char cmd_buf[DFU_CMD_BUF_SIZE]; @@ -90,8 +73,6 @@ static int mmc_file_op(enum dfu_mmc_op op, struct dfu_entity *dfu, op == DFU_OP_READ ? "load" : "write", dfu->data.mmc.dev, dfu->data.mmc.part, (unsigned int) buf, dfu->name); - if (op == DFU_OP_WRITE) - sprintf(cmd_buf + strlen(cmd_buf), " %lx", *len); break; case DFU_FS_EXT4: sprintf(cmd_buf, "ext4%s mmc %d:%d 0x%x /%s", @@ -105,6 +86,9 @@ static int mmc_file_op(enum dfu_mmc_op op, struct dfu_entity *dfu, return -1; } + if (op == DFU_OP_WRITE) + sprintf(cmd_buf + strlen(cmd_buf), " %lx", *len); + debug("%s: %s 0x%p\n", __func__, cmd_buf, cmd_buf); ret = run_command(cmd_buf, 0);