aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBin Meng2018-10-15 04:21:05 -0500
committerSimon Glass2018-11-14 11:16:27 -0600
commit8f994c860d91cb40cf1bf6b9c69aeb40d05e9343 (patch)
tree28cd347b4e8a241d99b1713c7d8c1172f72371c7
parentfa583f86c97f407997f1c46b8009b26c4c58efb9 (diff)
downloadu-boot-8f994c860d91cb40cf1bf6b9c69aeb40d05e9343.tar.gz
u-boot-8f994c860d91cb40cf1bf6b9c69aeb40d05e9343.tar.xz
u-boot-8f994c860d91cb40cf1bf6b9c69aeb40d05e9343.zip
sandbox: blk: Switch to use platdata_auto_alloc_size for the driver data
Currently the sandbox block driver uses priv_auto_alloc_size for the driver data, however that's only available after the device probe phase. In order to make it accessible in an earlier phase, switch to use platdata_auto_alloc_size instead. This patch is the prerequisite for the follow up patch of DM BLK driver changes to work with Sandbox. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r--drivers/block/sandbox.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/block/sandbox.c b/drivers/block/sandbox.c
index 0392437309..576d049df7 100644
--- a/drivers/block/sandbox.c
+++ b/drivers/block/sandbox.c
@@ -33,7 +33,7 @@ static unsigned long host_block_read(struct udevice *dev,
33 unsigned long start, lbaint_t blkcnt, 33 unsigned long start, lbaint_t blkcnt,
34 void *buffer) 34 void *buffer)
35{ 35{
36 struct host_block_dev *host_dev = dev_get_priv(dev); 36 struct host_block_dev *host_dev = dev_get_platdata(dev);
37 struct blk_desc *block_dev = dev_get_uclass_platdata(dev); 37 struct blk_desc *block_dev = dev_get_uclass_platdata(dev);
38 38
39#else 39#else
@@ -64,7 +64,7 @@ static unsigned long host_block_write(struct udevice *dev,
64 unsigned long start, lbaint_t blkcnt, 64 unsigned long start, lbaint_t blkcnt,
65 const void *buffer) 65 const void *buffer)
66{ 66{
67 struct host_block_dev *host_dev = dev_get_priv(dev); 67 struct host_block_dev *host_dev = dev_get_platdata(dev);
68 struct blk_desc *block_dev = dev_get_uclass_platdata(dev); 68 struct blk_desc *block_dev = dev_get_uclass_platdata(dev);
69#else 69#else
70static unsigned long host_block_write(struct blk_desc *block_dev, 70static unsigned long host_block_write(struct blk_desc *block_dev,
@@ -131,16 +131,17 @@ int host_dev_bind(int devnum, char *filename)
131 os_lseek(fd, 0, OS_SEEK_END) / 512, &dev); 131 os_lseek(fd, 0, OS_SEEK_END) / 512, &dev);
132 if (ret) 132 if (ret)
133 goto err_file; 133 goto err_file;
134
135 host_dev = dev_get_platdata(dev);
136 host_dev->fd = fd;
137 host_dev->filename = fname;
138
134 ret = device_probe(dev); 139 ret = device_probe(dev);
135 if (ret) { 140 if (ret) {
136 device_unbind(dev); 141 device_unbind(dev);
137 goto err_file; 142 goto err_file;
138 } 143 }
139 144
140 host_dev = dev_get_priv(dev);
141 host_dev->fd = fd;
142 host_dev->filename = fname;
143
144 return blk_prepare_device(dev); 145 return blk_prepare_device(dev);
145err_file: 146err_file:
146 os_close(fd); 147 os_close(fd);
@@ -226,7 +227,7 @@ U_BOOT_DRIVER(sandbox_host_blk) = {
226 .name = "sandbox_host_blk", 227 .name = "sandbox_host_blk",
227 .id = UCLASS_BLK, 228 .id = UCLASS_BLK,
228 .ops = &sandbox_host_blk_ops, 229 .ops = &sandbox_host_blk_ops,
229 .priv_auto_alloc_size = sizeof(struct host_block_dev), 230 .platdata_auto_alloc_size = sizeof(struct host_block_dev),
230}; 231};
231#else 232#else
232U_BOOT_LEGACY_BLK(sandbox_host) = { 233U_BOOT_LEGACY_BLK(sandbox_host) = {