block: pass block dev not num to read/write/erase()

This will allow the implementation to make use of data in the block_dev
structure beyond the base device number. This will be useful so that eMMC
block devices can encompass the HW partition ID rather than treating this
out-of-band. Equally, the existence of the priv field is crying out for
this patch to exist.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index ecd3e9d..f19a7ce 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -79,8 +79,8 @@
 
 #ifdef CONFIG_ATAPI
 static void	atapi_inquiry(block_dev_desc_t *dev_desc);
-static ulong atapi_read(int device, lbaint_t blknr, lbaint_t blkcnt,
-			void *buffer);
+static ulong atapi_read(block_dev_desc_t *block_dev, lbaint_t blknr,
+			lbaint_t blkcnt, void *buffer);
 #endif
 
 
@@ -187,6 +187,7 @@
 		if (strcmp(argv[1], "read") == 0) {
 			ulong addr = simple_strtoul(argv[2], NULL, 16);
 			ulong cnt = simple_strtoul(argv[4], NULL, 16);
+			block_dev_desc_t *dev_desc;
 			ulong n;
 
 #ifdef CONFIG_SYS_64BIT_LBA
@@ -201,9 +202,9 @@
 				curr_device, blk, cnt);
 #endif
 
-			n = ide_dev_desc[curr_device].block_read(curr_device,
-								 blk, cnt,
-								 (ulong *)addr);
+			dev_desc = &ide_dev_desc[curr_device];
+			n = dev_desc->block_read(dev_desc, blk, cnt,
+						 (ulong *)addr);
 			/* flush cache after read */
 			flush_cache(addr,
 				    cnt * ide_dev_desc[curr_device].blksz);
@@ -230,7 +231,8 @@
 			printf("\nIDE write: device %d block # %ld, count %ld ... ",
 				curr_device, blk, cnt);
 #endif
-			n = ide_write(curr_device, blk, cnt, (ulong *) addr);
+			n = ide_write(&ide_dev_desc[curr_device], blk, cnt,
+				      (ulong *)addr);
 
 			printf("%ld blocks written: %s\n",
 				n, (n == cnt) ? "OK" : "ERROR");
@@ -711,8 +713,10 @@
 
 /* ------------------------------------------------------------------------- */
 
-ulong ide_read(int device, lbaint_t blknr, lbaint_t blkcnt, void *buffer)
+ulong ide_read(block_dev_desc_t *block_dev, lbaint_t blknr, lbaint_t blkcnt,
+	       void *buffer)
 {
+	int device = block_dev->dev;
 	ulong n = 0;
 	unsigned char c;
 	unsigned char pwrsave = 0;	/* power save */
@@ -835,8 +839,10 @@
 /* ------------------------------------------------------------------------- */
 
 
-ulong ide_write(int device, lbaint_t blknr, lbaint_t blkcnt, const void *buffer)
+ulong ide_write(block_dev_desc_t *block_dev, lbaint_t blknr, lbaint_t blkcnt,
+		const void *buffer)
 {
+	int device = block_dev->dev;
 	ulong n = 0;
 	unsigned char c;
 
@@ -1388,8 +1394,10 @@
 #define ATAPI_READ_BLOCK_SIZE	2048	/* assuming CD part */
 #define ATAPI_READ_MAX_BLOCK	(ATAPI_READ_MAX_BYTES/ATAPI_READ_BLOCK_SIZE)
 
-ulong atapi_read(int device, lbaint_t blknr, lbaint_t blkcnt, void *buffer)
+ulong atapi_read(block_dev_desc_t *block_dev, lbaint_t blknr, lbaint_t blkcnt,
+		 void *buffer)
 {
+	int device = block_dev->dev;
 	ulong n = 0;
 	unsigned char ccb[12];	/* Command descriptor block */
 	ulong cnt;