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