From 95af24d54c993aa3497bd4669fae82a3bde6183e Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E9=BB=84=E6=B6=9B?= Date: Tue, 21 Jun 2011 19:42:34 +0800 Subject: [PATCH] rk29: usb: f_mass_storage: support reboot to loader --- drivers/usb/gadget/f_mass_storage.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index 8bdf100be5dc..b930725dd89a 100755 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c @@ -69,6 +69,10 @@ #include #include #include +#ifdef CONFIG_ARCH_RK29 +#include +#include +#endif #include #include @@ -1826,6 +1830,15 @@ static int check_command(struct fsg_dev *fsg, int cmnd_size, } +#ifdef CONFIG_ARCH_RK29 +static void deferred_restart(struct work_struct *dummy) +{ + sys_sync(); + kernel_restart("loader"); +} +static DECLARE_WORK(restart_work, deferred_restart); +#endif + static int do_scsi_command(struct fsg_dev *fsg) { struct fsg_buffhd *bh; @@ -2023,6 +2036,15 @@ static int do_scsi_command(struct fsg_dev *fsg) reply = -EINVAL; } break; +#ifdef CONFIG_ARCH_RK29 + case 0xff: + if (fsg->cmnd_size >= 6 && fsg->cmnd[1] == 0xe0 && + fsg->cmnd[2] == 0xff && fsg->cmnd[3] == 0xff && + fsg->cmnd[4] == 0xff && fsg->cmnd[5] == 0xfe) { + schedule_work(&restart_work); + } + break; +#endif } up_read(&fsg->filesem); -- 2.34.1