| .. | .. |
|---|
| 49 | 49 | |
|---|
| 50 | 50 | static int emmc_vendor_ops(u8 *buffer, u32 addr, u32 n_sec, int write) |
|---|
| 51 | 51 | { |
|---|
| 52 | | - u32 i, ret = 0; |
|---|
| 53 | | - |
|---|
| 54 | | - for (i = 0; i < n_sec; i++) |
|---|
| 55 | | - ret = rk_emmc_transfer(buffer + i * 512, addr + i, 512, write); |
|---|
| 56 | | - |
|---|
| 57 | | - return ret; |
|---|
| 52 | + return rk_emmc_transfer(buffer, addr, n_sec << 9, write); |
|---|
| 58 | 53 | } |
|---|
| 59 | 54 | |
|---|
| 60 | 55 | static int emmc_vendor_storage_init(void) |
|---|
| .. | .. |
|---|
| 210 | 205 | #ifdef CONFIG_ROCKCHIP_VENDOR_STORAGE_UPDATE_LOADER |
|---|
| 211 | 206 | static int id_blk_read_data(u32 index, u32 n_sec, u8 *buf) |
|---|
| 212 | 207 | { |
|---|
| 213 | | - u32 i; |
|---|
| 214 | | - u32 ret = 0; |
|---|
| 215 | | - |
|---|
| 216 | 208 | if (index + n_sec >= 1024 * 5) |
|---|
| 217 | 209 | return 0; |
|---|
| 218 | 210 | index = index + EMMC_IDB_PART_OFFSET; |
|---|
| 219 | | - for (i = 0; i < n_sec; i++) { |
|---|
| 220 | | - ret = rk_emmc_transfer(buf + i * 512, index + i, 512, 0); |
|---|
| 221 | | - if (ret) |
|---|
| 222 | | - return ret; |
|---|
| 223 | | - } |
|---|
| 224 | | - return ret; |
|---|
| 211 | + |
|---|
| 212 | + return rk_emmc_transfer(buf, index, n_sec << 9, 0); |
|---|
| 225 | 213 | } |
|---|
| 226 | 214 | |
|---|
| 227 | 215 | static int id_blk_write_data(u32 index, u32 n_sec, u8 *buf) |
|---|
| 228 | 216 | { |
|---|
| 229 | | - u32 i; |
|---|
| 230 | | - u32 ret = 0; |
|---|
| 231 | | - |
|---|
| 232 | 217 | if (index + n_sec >= 1024 * 5) |
|---|
| 233 | 218 | return 0; |
|---|
| 234 | 219 | index = index + EMMC_IDB_PART_OFFSET; |
|---|
| 235 | | - for (i = 0; i < n_sec; i++) { |
|---|
| 236 | | - ret = rk_emmc_transfer(buf + i * 512, index + i, 512, 1); |
|---|
| 237 | | - if (ret) |
|---|
| 238 | | - return ret; |
|---|
| 239 | | - } |
|---|
| 240 | | - return ret; |
|---|
| 220 | + |
|---|
| 221 | + return rk_emmc_transfer(buf, index, n_sec << 9, 1); |
|---|
| 241 | 222 | } |
|---|
| 242 | 223 | |
|---|
| 243 | 224 | static int emmc_write_idblock(u32 size, u8 *buf, u32 *id_blk_tbl) |
|---|