sata: use block layer for sata command
authorEric Nelson <eric@nelint.com>
Sun, 27 Mar 2016 19:00:15 +0000 (12:00 -0700)
committerTom Rini <trini@konsulko.com>
Fri, 1 Apr 2016 21:18:28 +0000 (17:18 -0400)
Call blk_dread, blk_dwrite, blk_derase to ensure that the block cache is
used if enabled and to remove build breakage when CONFIG_BLK is enabled.

Signed-off-by: Eric Nelson <eric@nelint.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
cmd/sata.c

index c8de9a3f83103ce919b140ad6c7f39e02691316e..8748ccef69685fee1b250633118f908fac69db5c 100644 (file)
@@ -183,7 +183,8 @@ static int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                        printf("\nSATA read: device %d block # %ld, count %ld ... ",
                                sata_curr_device, blk, cnt);
 
-                       n = sata_read(sata_curr_device, blk, cnt, (u32 *)addr);
+                       n = blk_dread(&sata_dev_desc[sata_curr_device],
+                                     blk, cnt, (u32 *)addr);
 
                        /* flush cache after read */
                        flush_cache(addr, cnt * sata_dev_desc[sata_curr_device].blksz);
@@ -201,7 +202,8 @@ static int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                        printf("\nSATA write: device %d block # %ld, count %ld ... ",
                                sata_curr_device, blk, cnt);
 
-                       n = sata_write(sata_curr_device, blk, cnt, (u32 *)addr);
+                       n = blk_dwrite(&sata_dev_desc[sata_curr_device],
+                                      blk, cnt, (u32 *)addr);
 
                        printf("%ld blocks written: %s\n",
                                n, (n == cnt) ? "OK" : "ERROR");