Lines Matching refs:blk_dev
224 struct mmcsd_blk_device *blk_dev = (struct mmcsd_blk_device *)dev->user_data; in rt_mmcsd_control() local
228 rt_memcpy(args, &blk_dev->geometry, sizeof(struct rt_device_blk_geometry)); in rt_mmcsd_control()
246 struct mmcsd_blk_device *blk_dev = (struct mmcsd_blk_device *)dev->user_data; in rt_mmcsd_read() local
247 struct dfs_partition *part = &blk_dev->part; in rt_mmcsd_read()
258 req_size = (remain_size > blk_dev->max_req_size) ? blk_dev->max_req_size : remain_size; in rt_mmcsd_read()
259 err = rt_mmcsd_req_blk(blk_dev->card, part->offset + pos + offset, rd_ptr, req_size, 0); in rt_mmcsd_read()
287 struct mmcsd_blk_device *blk_dev = (struct mmcsd_blk_device *)dev->user_data; in rt_mmcsd_write() local
288 struct dfs_partition *part = &blk_dev->part; in rt_mmcsd_write()
299 req_size = (remain_size > blk_dev->max_req_size) ? blk_dev->max_req_size : remain_size; in rt_mmcsd_write()
300 err = rt_mmcsd_req_blk(blk_dev->card, part->offset + pos + offset, wr_ptr, req_size, 1); in rt_mmcsd_write()
364 struct mmcsd_blk_device *blk_dev = RT_NULL; in rt_mmcsd_blk_probe() local
388 blk_dev = rt_calloc(1, sizeof(struct mmcsd_blk_device)); in rt_mmcsd_blk_probe()
389 if (!blk_dev) in rt_mmcsd_blk_probe()
395 blk_dev->max_req_size = BLK_MIN((card->host->max_dma_segs * in rt_mmcsd_blk_probe()
401 status = dfs_filesystem_get_partition(&blk_dev->part, sector, i); in rt_mmcsd_blk_probe()
406 blk_dev->part.lock = rt_sem_create(sname, 1, RT_IPC_FLAG_FIFO); in rt_mmcsd_blk_probe()
409 blk_dev->dev.type = RT_Device_Class_Block; in rt_mmcsd_blk_probe()
411 blk_dev->dev.ops = &mmcsd_blk_ops; in rt_mmcsd_blk_probe()
413 blk_dev->dev.init = rt_mmcsd_init; in rt_mmcsd_blk_probe()
414 blk_dev->dev.open = rt_mmcsd_open; in rt_mmcsd_blk_probe()
415 blk_dev->dev.close = rt_mmcsd_close; in rt_mmcsd_blk_probe()
416 blk_dev->dev.read = rt_mmcsd_read; in rt_mmcsd_blk_probe()
417 blk_dev->dev.write = rt_mmcsd_write; in rt_mmcsd_blk_probe()
418 blk_dev->dev.control = rt_mmcsd_control; in rt_mmcsd_blk_probe()
420 blk_dev->dev.user_data = blk_dev; in rt_mmcsd_blk_probe()
422 blk_dev->card = card; in rt_mmcsd_blk_probe()
424 blk_dev->geometry.bytes_per_sector = 1<<9; in rt_mmcsd_blk_probe()
425 blk_dev->geometry.block_size = card->card_blksize; in rt_mmcsd_blk_probe()
426 blk_dev->geometry.sector_count = blk_dev->part.size; in rt_mmcsd_blk_probe()
428 rt_device_register(&blk_dev->dev, dname, in rt_mmcsd_blk_probe()
430 rt_list_insert_after(&blk_devices, &blk_dev->list); in rt_mmcsd_blk_probe()
437 blk_dev->part.offset = 0; in rt_mmcsd_blk_probe()
438 blk_dev->part.size = 0; in rt_mmcsd_blk_probe()
439 blk_dev->part.lock = rt_sem_create("sem_sd0", 1, RT_IPC_FLAG_FIFO); in rt_mmcsd_blk_probe()
442 blk_dev->dev.type = RT_Device_Class_Block; in rt_mmcsd_blk_probe()
444 blk_dev->dev.ops = &mmcsd_blk_ops; in rt_mmcsd_blk_probe()
446 blk_dev->dev.init = rt_mmcsd_init; in rt_mmcsd_blk_probe()
447 blk_dev->dev.open = rt_mmcsd_open; in rt_mmcsd_blk_probe()
448 blk_dev->dev.close = rt_mmcsd_close; in rt_mmcsd_blk_probe()
449 blk_dev->dev.read = rt_mmcsd_read; in rt_mmcsd_blk_probe()
450 blk_dev->dev.write = rt_mmcsd_write; in rt_mmcsd_blk_probe()
451 blk_dev->dev.control = rt_mmcsd_control; in rt_mmcsd_blk_probe()
453 blk_dev->dev.user_data = blk_dev; in rt_mmcsd_blk_probe()
455 blk_dev->card = card; in rt_mmcsd_blk_probe()
457 blk_dev->geometry.bytes_per_sector = 1<<9; in rt_mmcsd_blk_probe()
458 blk_dev->geometry.block_size = card->card_blksize; in rt_mmcsd_blk_probe()
459 blk_dev->geometry.sector_count = in rt_mmcsd_blk_probe()
462 rt_device_register(&blk_dev->dev, "sd0", in rt_mmcsd_blk_probe()
464 rt_list_insert_after(&blk_devices, &blk_dev->list); in rt_mmcsd_blk_probe()
470 rt_free(blk_dev); in rt_mmcsd_blk_probe()
471 blk_dev = RT_NULL; in rt_mmcsd_blk_probe()
481 dfs_mount_device(&(blk_dev->dev)); in rt_mmcsd_blk_probe()
501 struct mmcsd_blk_device *blk_dev; in rt_mmcsd_blk_remove() local
505 blk_dev = (struct mmcsd_blk_device *)rt_list_entry(l, struct mmcsd_blk_device, list); in rt_mmcsd_blk_remove()
506 if (blk_dev->card == card) in rt_mmcsd_blk_remove()
509 const char * mounted_path = dfs_filesystem_get_mounted_path(&(blk_dev->dev)); in rt_mmcsd_blk_remove()
515 rt_device_unregister(&blk_dev->dev); in rt_mmcsd_blk_remove()
516 rt_list_remove(&blk_dev->list); in rt_mmcsd_blk_remove()
517 rt_free(blk_dev); in rt_mmcsd_blk_remove()