linux的usb驱动失败,linux2.6.24下usb驱动完成情况及问题解决

1.在kernel启动是出现如下问题:

mount: mounting tmpfs on /dev failed

解决方案如下,

File systems  --->Pseudo filesystems  --->[*] Virtual memory file system support (former shm fs)

2.另附上vivi启动参数,最近一直用nfs,转换着麻烦,先记下来cp

设置从flash 启动:

param set linux_cmd_line "noinitrd init=/linuxrc console=ttySAC0 root=/dev/mtdblock3"

设置从nfs启动:

param set linux_cmd_line "noinitrd init=/linuxrc console=ttySAC0 root=/dev/nfs nfsroot=192.192.192.xx:/srv/nfs/rootfs ip=192.192.192.200:192.192.192.xx:192.192.192.xx:255.255.255.0::eth0:off"

设置从ramdisk启动:

param set linux_cmd_line "console=ttySAC0 initrd=0x30800000,0x400000 root=/dev/ram"。

3.测试通过了usb device的测试,可以进行从设备操作,对usb device进行模块加载操作,方法如下:(两个.ko文件为usb驱动的模块文件,需要加载后使用)

$ insmod s3c2410_udc.ko$ insmod g_file_storage.ko file=/dev/mtdblock5 stall=0 removable=1

4、usb从部分添加内容:

4.1.usb初始化为从设备时配置:

+++ linux-2.6.22/arch/arm/mach-s3c2410/mach-f2410.c    2007-11-15&s3c_device_i2c,&s3c_device_iis,&s3c_device_nand,+/* add by feng */+    &s3c_device_usbgadget,};/* USB */s3c_device_usb.dev.platform_data = &usb_s3c2410_info;s3c2410_modify_misccr(S3C2410_MISCCR_USBSUSPND0 |-                  S3C2410_MISCCR_USBSUSPND1, 0x8);+                  S3C2410_MISCCR_USBSUSPND1 |+                  S3C2410_MISCCR_USBHOST, 0x0);

4.2.添加udc驱动:

+++ linux-2.6.22/drivers/usb/gadget/s3c2410-udc.c    2007-11-15 17:38:17.000000000 +0800+++ linux-2.6.22/drivers/usb/gadget/s3c2410-udc.h    2007-11-15 17:38:31.000000000 +0800+++ linux-2.6.22/include/asm/arch-s3c2410/regs-udc.h    2007-11-16 01:22:25.000000000 +0800

4.3.在kconfig中添加udc选项支持:

+++ linux-2.6.22/drivers/usb/gadget/Kconfig    2007-11-15Select this only if your OMAP board has a Mini-AB connector.+# add by feng+config USB_GADGET_S3C2410+        boolean "S3C2410"+        depends on ARCH_S3C2410+        help+          Samsung's S3C2410 is an ARM-4 processor with an integrated+          full speed USB 1.1 device controller.+          It has 4 configurable endpoints, as well as endpoint+          zero (for control transfers).++config USB_S3C2410+        tristate+        depends on USB_GADGET_S3C2410+        default USB_GADGET+        select USB_GADGET_SELECTED++config USB_S3C2410_DEBUG+        boolean "S3C2410 udc debug messages"+        depends on USB_GADGET_S3C2410+#end add+config USB_GADGET_AT91boolean "AT91 USB Device Port"

4.4.在makefile中添加udc选项支持:

+++ linux-2.6.22/drivers/usb/gadget/Makefile    2007-11-15 17:01:04.000000000 +0800obj-$(CONFIG_USB_FSL_USB2)    += fsl_usb2_udc.o+#add by feng+obj-$(CONFIG_USB_S3C2410)       += s3c2410-udc.o

一、学习ctags查找源码的用法,超级方便

步骤:

1,现在源码目录中运行指令

$ ctags –R *      ($ 为Linux系统Shell提示符)

2,用vi进入编辑环境,

Ctrl + ]查找查询

Ctrl + T返回上一步

:ta XX    查找文件XX

二、usb从部分(以后添加)

1,添加udc驱动:

在kconfig中添加udc支持:

在makefile中添加udc支持:

2.配置

Device Drivers  --->USB Gadget Support  ---> Support for USB GadgetsUSB Peripheral Controller (S3C2410)  --->(X) S3C2410   File-backed Storage Gadget

参考luofuchong的帖子,修改文件,并修改mach-f2410.c文件,使其支持usb的初始化

在mach-f2410.c添加如下:

#include #include #include #include #include /* USB */static struct s3c2410_hcd_info usb_s3c2410_info = {.port[0]        = {.flags  = S3C_HCDFLG_USED},.port[1]        = {.flags  = S3C_HCDFLG_USED}};int __init s3c2410_init_usb(void){unsigned long upllvalue;printk("USB Control, (c) 2006 pc104/n");s3c_device_usb.dev.platform_data = &usb_s3c2410_info;s3c2410_modify_misccr(S3C2410_MISCCR_USBSUSPND0 |S3C2410_MISCCR_USBSUSPND1, 0x8);upllvalue = (0x78<<12)|(0x02<<4)|(0x03);while(upllvalue!=__raw_readl(S3C2410_UPLLCON)){__raw_writel(upllvalue,S3C2410_UPLLCON);mdelay(1);}return 0;}

static void __init f2410_init_machine(void)

{

s3c_device_nand.dev.platform_data = &sbc2410x_nand_info;

platform_add_devices(f2410_devices, ARRAY_SIZE(f2410_devices));

s3c2410_init_usb();

}

下面为配置:

下面为拷贝luofuchong的 linux-2.6.14下USB驱动移植心得,主要根据2.6.22的核改了一下,使其可以支持u盘。

/*****************************************from luofuchong**********************************/1、让内核支持热插拔│         General setup  --->[*] Configure standard kernel features (for small systems)  --->[*]   Support for hot-pluggable devices (NEW)2.USB驱动设置Device Drivers  --->Generic Driver Options  ---> Userspace firmware loading supportBlock devices  ---> Low Performance USB Block driverSCSI device support  ---> SCSI generic support[*] Probe all LUNs on each SCSI deviceUSB support  ---> Support for Host-side USB[*]   USB device filesystem   OHCI HCD support   USB Mass Storage support[*]   USB Monitor3、加入了MSDOS fs和VFAT fs的支持。File systems  --->DOS/FAT/NT Filesystems  ---> MSDOS fs support VFAT (Windows-95) fs support(936) Default codepage for FAT(cp936) Default iocharset for FATFile systems  --->Partition Types  --->[*]   PC BIOS (MSDOS partition tables) support4.  加入中文字体库(可惜在我的板上还是没能正常显示中文~_~,知道的朋友麻烦告诉我一声,大家一起探讨)Native Language Support  --->   Simplified Chinese charset (CP936, GB2312)   NLS UTF85、另外,如果想让内核把它当成SCSI设备来处理的话,只要把上面:Device Drivers  --->Block devices  ---> Low Performance USB Block driver的 Low Performance USB Block driver这个选项去掉,然后把:Device Drivers  --->SCSI device support  --->SCSI disk support的SCSI disk support这个选项选上,重新编译内核就行。/***************************************end from*********************************************/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值