在mach-xc2440.c中添加USB gadget驱动的支持:
加入必要的头文件:
xc2440_devices[ ]结构体中加入:
&s3c_device_usbgadget,
构建USB gadget设备的平台数据结构:
- /* USB device UDC support */
-
static void xc2440_udc_pullup(enum s3c2410_udc_cmd_e cmd)
-
{
-
switch (cmd) {
-
case S3C2410_UDC_P_ENABLE :
-
gpio_set_value(S3C2410_GPG(12), 1);
-
break;
-
case S3C2410_UDC_P_DISABLE :
-
gpio_set_value(S3C2410_GPG(12), 0);
-
break;
-
case S3C2410_UDC_P_RESET :
-
break;
-
default:
-
break;
-
}
-
}
static struct s3c2410_udc_mach_info xc2440_udc_cfg __initdata = {
.udc_command = xc2440_udc_pullup,
};
在xc2440_machine_init函数中加入:
s3c24xx_udc_set_platdata(&xc2440_udc_cfg);
配置内核,支持USB gadget驱动:
- Device Drivers --->
- [*] USB support --->
- <*> USB Gadget Support --->
- USB Peripheral Controller (S3C2410 USB Device Controller) --->
- S3C2410 USB Device Controller
- USB Gadget Drivers
- File-backed Storage Gadget
- [*] File-backed Storage Gadget testing version
- Mass Storage Gadget
内核启动输出:
s3c2440-usbgadget s3c2440-usbgadget: S3C2440: increasing FIFO to 128 bytes
编译模块:
#make M=drivers/usb/gadget modules
在drivers/usb/gadget目录下生成:g_file_storage.ko和g_mass_storage.ko两个模块文件,将这两个文件下载到开发板的文件系统中,将文件放到:/lib/modules/2.6.37.4目录下
执行命令:#insmod /lib/modules/2.6.37.4/g_file_storage.ko file=/dev/sda1
[root@XC2440 /]# insmod /lib/modules/2.6.37.4/g_file_storage.ko file=/dev/sda1
g_file_storage gadget: No serial-number string provided!
g_file_storage gadget: File-backed Storage Gadget, version: 1 September 2010
g_file_storage gadget: Number of LUNs=1
g_file_storage gadget-lun0: ro=0, nofua=0, file: /dev/sda1
g_file_storage gadget: full speed config #1
g_file_storage gadget: full speed config #1
阅读(1065) | 评论(0) | 转发(0) |