rk29: usb: f_mass_storage: support reboot to loader

This commit is contained in:
黄涛
2011-06-21 19:42:34 +08:00
parent db83b54a2e
commit 95af24d54c

View File

@@ -69,6 +69,10 @@
#include <linux/wakelock.h>
#include <linux/platform_device.h>
#include <linux/power_supply.h>
#ifdef CONFIG_ARCH_RK29
#include <linux/reboot.h>
#include <linux/syscalls.h>
#endif
#include <linux/usb.h>
#include <linux/usb_usual.h>
@@ -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);