diff mbox

[U-Boot,3/3] sata: use block layer for sata command

Message ID 1459105215-3647-4-git-send-email-eric@nelint.com
State Accepted
Commit 96baf368a88bc6f2bce93177c0e996b7354c289f
Delegated to: Tom Rini
Headers show

Commit Message

Eric Nelson March 27, 2016, 7 p.m. UTC
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>
---
 cmd/sata.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Tom Rini March 28, 2016, 2:16 p.m. UTC | #1
On Sun, Mar 27, 2016 at 12:00:15PM -0700, Eric Nelson wrote:

> 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>
Tom Rini April 2, 2016, 1:59 a.m. UTC | #2
On Sun, Mar 27, 2016 at 12:00:15PM -0700, Eric Nelson wrote:

> 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>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/cmd/sata.c b/cmd/sata.c
index c8de9a3..8748cce 100644
--- a/cmd/sata.c
+++ b/cmd/sata.c
@@ -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");