免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1245 | 回复: 0
打印 上一主题 下一主题

任务一:linux2.6.22下usb驱动完成情况及问题解决 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-11-13 22:10 |只看该作者 |倒序浏览
========================================================================!!  任务一:                                                                                                                                                   !!
!!  任务描述:完成在linux2.6.22下的usb驱动的移植,实现usb主设备驱动,并写出总结文档        !!
========================================================================
2007.11.16
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-15  Select 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_AT91     boolean "AT91 USB Device Port"
    4.4.在makefile中添加udc选项支持:
    +++ linux-2.6.22/drivers/usb/gadget/Makefile    2007-11-15 17:01:04.000000000 +0800 obj-$(CONFIG_USB_FSL_USB2)    += fsl_usb2_udc.o+#add by feng+obj-$(CONFIG_USB_S3C2410)       += s3c2410-udc.o
    2007.11.15
    一、学习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 Gadgets         USB Peripheral Controller (S3C2410)  --->             (X) S3C2410            File-backed Storage Gadget
    2007.11.14
    参考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    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 driver    SCSI device support  --->         SCSI generic support        
  • Probe all LUNs on each SCSI device      USB support  --->                 Support for Host-side USB            
  •    USB device filesystem           OHCI HCD support             USB Mass Storage support        
  •    USB Monitor  3、加入了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 FAT File systems  --->     Partition Types  --->         
  •    PC BIOS (MSDOS partition tables) support    4.  加入中文字体库(可惜在我的板上还是没能正常显示中文~_~,知道的朋友麻烦告诉我一声,大家一起探讨) Native Language Support  --->           Simplified Chinese charset (CP936, GB2312)         NLS UTF8 5、另外,如果想让内核把它当成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*********************************************/
    2007.11.13
    查找资料:
    linux-2.6.14下USB驱动移植心得
          
                                             
    [/url]


    本文来自ChinaUnix博客,如果查看原文请点:[url]http://blog.chinaunix.net/u1/44092/showart_421641.html
  • 您需要登录后才可以回帖 登录 | 注册

    本版积分规则 发表回复

      

    北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
    未成年举报专区
    中国互联网协会会员  联系我们:huangweiwei@itpub.net
    感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

    清除 Cookies - ChinaUnix - Archiver - WAP - TOP