Lines Matching refs:mdev
24 struct maple_device *mdev; member
60 struct maple_device *mdev; in ofs_to_block() local
66 mdev = mpart->mdev; in ofs_to_block()
67 card = maple_get_drvdata(mdev); in ofs_to_block()
91 struct maple_device *mdev; in vmu_blockread() local
94 mdev = mq->dev; in vmu_blockread()
95 card = maple_get_drvdata(mdev); in vmu_blockread()
114 struct maple_device *mdev; in maple_vmu_read_block() local
121 mdev = mpart->mdev; in maple_vmu_read_block()
123 card = maple_get_drvdata(mdev); in maple_vmu_read_block()
131 dev_err(&mdev->dev, "VMU at (%d, %d) - read fails due" in maple_vmu_read_block()
132 " to lack of memory\n", mdev->port, in maple_vmu_read_block()
133 mdev->unit); in maple_vmu_read_block()
147 if (atomic_read(&mdev->busy) == 1) { in maple_vmu_read_block()
148 wait_event_interruptible_timeout(mdev->maple_wait, in maple_vmu_read_block()
149 atomic_read(&mdev->busy) == 0, HZ); in maple_vmu_read_block()
150 if (atomic_read(&mdev->busy) == 1) { in maple_vmu_read_block()
151 dev_notice(&mdev->dev, "VMU at (%d, %d)" in maple_vmu_read_block()
152 " is busy\n", mdev->port, mdev->unit); in maple_vmu_read_block()
158 atomic_set(&mdev->busy, 1); in maple_vmu_read_block()
162 atomic_set(&mdev->busy, 0); in maple_vmu_read_block()
167 maple_getcond_callback(mdev, vmu_blockread, 0, in maple_vmu_read_block()
169 error = maple_add_packet(mdev, MAPLE_FUNC_MEMCARD, in maple_vmu_read_block()
172 wait = wait_event_interruptible_timeout(mdev->maple_wait, in maple_vmu_read_block()
173 (atomic_read(&mdev->busy) == 0 || in maple_vmu_read_block()
174 atomic_read(&mdev->busy) == 2), HZ * 3); in maple_vmu_read_block()
180 if (error || atomic_read(&mdev->busy) == 2) { in maple_vmu_read_block()
181 if (atomic_read(&mdev->busy) == 2) in maple_vmu_read_block()
183 atomic_set(&mdev->busy, 0); in maple_vmu_read_block()
189 atomic_set(&mdev->busy, 0); in maple_vmu_read_block()
191 list_del_init(&(mdev->mq->list)); in maple_vmu_read_block()
192 kfree(mdev->mq->sendbuf); in maple_vmu_read_block()
193 mdev->mq->sendbuf = NULL; in maple_vmu_read_block()
195 dev_warn(&mdev->dev, "VMU read on (%d, %d)" in maple_vmu_read_block()
197 mdev->port, mdev->unit, num); in maple_vmu_read_block()
199 dev_notice(&mdev->dev, "VMU read on (%d, %d)" in maple_vmu_read_block()
201 mdev->port, mdev->unit, num); in maple_vmu_read_block()
231 struct maple_device *mdev; in maple_vmu_write_block() local
236 mdev = mpart->mdev; in maple_vmu_write_block()
238 card = maple_get_drvdata(mdev); in maple_vmu_write_block()
252 if (atomic_read(&mdev->busy) == 1) { in maple_vmu_write_block()
253 wait_event_interruptible_timeout(mdev->maple_wait, in maple_vmu_write_block()
254 atomic_read(&mdev->busy) == 0, HZ); in maple_vmu_write_block()
255 if (atomic_read(&mdev->busy) == 1) { in maple_vmu_write_block()
257 dev_notice(&mdev->dev, "VMU write at (%d, %d)" in maple_vmu_write_block()
259 mdev->port, mdev->unit); in maple_vmu_write_block()
263 atomic_set(&mdev->busy, 1); in maple_vmu_write_block()
265 locking = maple_add_packet(mdev, MAPLE_FUNC_MEMCARD, in maple_vmu_write_block()
267 wait = wait_event_interruptible_timeout(mdev->maple_wait, in maple_vmu_write_block()
268 atomic_read(&mdev->busy) == 0, HZ/10); in maple_vmu_write_block()
271 atomic_set(&mdev->busy, 0); in maple_vmu_write_block()
274 if (atomic_read(&mdev->busy) == 2) { in maple_vmu_write_block()
275 atomic_set(&mdev->busy, 0); in maple_vmu_write_block()
278 dev_warn(&mdev->dev, "Write at (%d, %d) of block" in maple_vmu_write_block()
280 " communicate with VMU", mdev->port, in maple_vmu_write_block()
281 mdev->unit, num, x); in maple_vmu_write_block()
282 atomic_set(&mdev->busy, 0); in maple_vmu_write_block()
283 kfree(mdev->mq->sendbuf); in maple_vmu_write_block()
284 mdev->mq->sendbuf = NULL; in maple_vmu_write_block()
285 list_del_init(&(mdev->mq->list)); in maple_vmu_write_block()
296 dev_err(&mdev->dev, "VMU (%d, %d): write failed\n", mdev->port, in maple_vmu_write_block()
297 mdev->unit); in maple_vmu_write_block()
308 struct maple_device *mdev; in vmu_flash_read_char() local
313 mdev = mpart->mdev; in vmu_flash_read_char()
315 card = maple_get_drvdata(mdev); in vmu_flash_read_char()
353 struct maple_device *mdev; in vmu_flash_read() local
362 mdev = mpart->mdev; in vmu_flash_read()
364 card = maple_get_drvdata(mdev); in vmu_flash_read()
419 struct maple_device *mdev; in vmu_flash_write() local
428 mdev = mpart->mdev; in vmu_flash_write()
430 card = maple_get_drvdata(mdev); in vmu_flash_write()
489 dev_err(&mdev->dev, "VMU write failing with error %d\n", error); in vmu_flash_write()
501 struct maple_device *mdev; in vmu_queryblocks() local
511 mdev = mq->dev; in vmu_queryblocks()
512 card = maple_get_drvdata(mdev); in vmu_queryblocks()
517 dev_info(&mdev->dev, "VMU device at partition %d has %d user " in vmu_queryblocks()
530 mdev->port, mdev->unit, card->partition); in vmu_queryblocks()
546 mpart->mdev = mdev; in vmu_queryblocks()
560 maple_getcond_callback(mdev, NULL, 0, in vmu_queryblocks()
569 maple_getcond_callback(mdev, vmu_queryblocks, 0, in vmu_queryblocks()
571 maple_add_packet(mdev, MAPLE_FUNC_MEMCARD, in vmu_queryblocks()
577 dev_err(&mdev->dev, "Could not register maple device at (%d, %d)" in vmu_queryblocks()
578 "error is 0x%X\n", mdev->port, mdev->unit, error); in vmu_queryblocks()
589 maple_getcond_callback(mdev, NULL, 0, in vmu_queryblocks()
597 static int vmu_connect(struct maple_device *mdev) in vmu_connect() argument
604 test_flash_data = be32_to_cpu(mdev->devinfo.function); in vmu_connect()
610 basic_flash_data = be32_to_cpu(mdev->devinfo.function_data[c - 1]); in vmu_connect()
644 maple_set_drvdata(mdev, card); in vmu_connect()
651 maple_getcond_callback(mdev, vmu_queryblocks, 0, in vmu_connect()
655 if (atomic_read(&mdev->busy) == 1) { in vmu_connect()
656 wait_event_interruptible_timeout(mdev->maple_wait, in vmu_connect()
657 atomic_read(&mdev->busy) == 0, HZ); in vmu_connect()
658 if (atomic_read(&mdev->busy) == 1) { in vmu_connect()
659 dev_notice(&mdev->dev, "VMU at (%d, %d) is busy\n", in vmu_connect()
660 mdev->port, mdev->unit); in vmu_connect()
666 atomic_set(&mdev->busy, 1); in vmu_connect()
672 error = maple_add_packet(mdev, MAPLE_FUNC_MEMCARD, in vmu_connect()
675 dev_err(&mdev->dev, "Could not lock VMU at (%d, %d)" in vmu_connect()
676 " error is 0x%X\n", mdev->port, mdev->unit, error); in vmu_connect()
691 static void vmu_disconnect(struct maple_device *mdev) in vmu_disconnect() argument
697 mdev->callback = NULL; in vmu_disconnect()
698 card = maple_get_drvdata(mdev); in vmu_disconnect()
701 mpart->mdev = NULL; in vmu_disconnect()
713 static int vmu_can_unload(struct maple_device *mdev) in vmu_can_unload() argument
719 card = maple_get_drvdata(mdev); in vmu_can_unload()
730 static void vmu_file_error(struct maple_device *mdev, void *recvbuf) in vmu_file_error() argument
737 dev_notice(&mdev->dev, ERRSTR " invalid partition number\n", in vmu_file_error()
738 mdev->port, mdev->unit); in vmu_file_error()
742 dev_notice(&mdev->dev, ERRSTR " phase error\n", in vmu_file_error()
743 mdev->port, mdev->unit); in vmu_file_error()
747 dev_notice(&mdev->dev, ERRSTR " invalid block number\n", in vmu_file_error()
748 mdev->port, mdev->unit); in vmu_file_error()
752 dev_notice(&mdev->dev, ERRSTR " write error\n", in vmu_file_error()
753 mdev->port, mdev->unit); in vmu_file_error()
757 dev_notice(&mdev->dev, ERRSTR " invalid write length\n", in vmu_file_error()
758 mdev->port, mdev->unit); in vmu_file_error()
762 dev_notice(&mdev->dev, ERRSTR " bad CRC\n", in vmu_file_error()
763 mdev->port, mdev->unit); in vmu_file_error()
767 dev_notice(&mdev->dev, ERRSTR " 0x%X\n", in vmu_file_error()
768 mdev->port, mdev->unit, error); in vmu_file_error()
775 struct maple_device *mdev = to_maple_dev(dev); in probe_maple_vmu() local
778 mdev->can_unload = vmu_can_unload; in probe_maple_vmu()
779 mdev->fileerr_handler = vmu_file_error; in probe_maple_vmu()
780 mdev->driver = mdrv; in probe_maple_vmu()
782 return vmu_connect(mdev); in probe_maple_vmu()
787 struct maple_device *mdev = to_maple_dev(dev); in remove_maple_vmu() local
789 vmu_disconnect(mdev); in remove_maple_vmu()