不能使用原因:由於USB_EN 引腳 沒有拉高導致。
以下代碼將USB_EN 拉高
加入內核補丁代碼:
#include <linux/fs.h>
#include <linux/module.h>
#include <linux/miscdevice.h>
#include <linux/gpio.h>
#include <mach/regs-gpio.h>
#define DEVICE_NAME "usb devic en"
static int sbc2440_usbdev_en_ioctl(
struct inode *inode,
struct file *file,
unsigned int cmd,
unsigned long arg)
{
return 1;
}
static struct file_operations dev_fops = {
.owner = THIS_MODULE,
.ioctl = sbc2440_usbdev_en_ioctl,
};
static struct miscdevice misc = {
.minor = MISC_DYNAMIC_MINOR,
.name = DEVICE_NAME,
.fops = &dev_fops,
};
static int __init dev_init(void)
{
int ret = 0;
s3c2410_gpio_cfgpin(S3C2410_GPC(5), S3C2410_GPIO_OUTPUT);
s3c2410_gpio_setpin(S3C2410_GPC(5), 1);
ret = misc_register(&misc);
printk (DEVICE_NAME"\tinitialized\n");
return ret;
}
static void __exit dev_exit(void)
{
misc_deregister(&misc);
s3c2410_gpio_setpin(S3C2410_GPC(5), 0);
printk (DEVICE_NAME"\texited\n");
}
module_init(dev_init);
module_exit(dev_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("peng xiao lin");