原创 USB驱动移植

2009-3-21 16:17 5321 2 2 分类: MCU/ 嵌入式

USB驱动移植
1   在arch/arm/mach-s3c2410/mach-smdk2410.c中紧接着LCD的部分添加
//usb
#include <asm/arch/usb-control.h>
#include <asm/arch/regs-clock.h>
#include <linux/device.h>
#include <linux/delay.h>
//-------------------usb两个USBHOST支持---------------
struct s3c2410_hcd_info usb_s3c2410_info = {
 .port[0] = {
  .flags = S3C_HCDFLG_USED
 }
};


int smdk2410_usb_init(void)
{
 unsigned long upllvalue = (0x78 << 12) | (0x02 <<4) |(0x03);
 printk("USB Control, (c) 2006 s3c2410\n");
 s3c_device_usb.dev.platform_data = &usb_s3c2410_info;
 while(upllvalue!=__raw_readl(S3C2410_UPLLCON))
 {
  __raw_writel(upllvalue,S3C2410_UPLLCON);
  mdelay(1);
 }
 return 0;
}
2   在smdk2410_map_io函数最后添加
 //usb
 smdk2410_usb_init();
------------配置USB鼠标键盘----------
Device Drivers >
       USB support  ---> 
            <*> Support for Host-side USB
            <*> OHCI HCD support
--- USB Input Devices
<*> USB Human Interface Devices (full HID) support

  • HID input layer support
    ------------配置U盘支持------------------------
    因为要优盘用到了SCSI 命令,所以我们先增加SCSI 支持。
    Device Drivers >
           SCSI device support  ---> 
               
  • legacy /proc/scsi support
       <*> SCSI disk support
       
  •    SCSI generic support
    Device Drivers >
            USB support  --->
        
  • Support for Host-side USB 
        <*> USB Mass Storage support
                   
  •      USB Mass Storage verbose debug
      Block devices --->
        <*> Low Performance USB Block driver
        
    -------------让内核支持热插拔 -----------
    │ General setup --->
    │ │ Support for hot-pluggable devices  
    │ Device Drivers --->
    │   Generic Driver Options --->
    │   <*> Hotplug firmware loading support  
    -----------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 │ │
    │ │    < > NTFS file system support
    │ │Partition Types --->
    │ │    PC BIOS (MSDOS partition tables) support
    没有加上这个就出现下面这个提示了...
    [root@Qiu /]# mount -t vfat /dev/scsi/host0/bus0/target0/lun0/disc /mnt
    mount: mounting /dev/scsi/host0/bus0/target0/lun0/disc on /mnt failed: No such device
    还有下面这个提示... 
    [root@Qiu /]# mount -t vfat /dev/scsi/host0/bus0/target0/lun0/disc /mnt
    FAT: codepage cp936 not found
    mount: mounting /dev/scsi/host0/bus0/target0/lun0/disc on /mnt failed: Invalid argument
    -----------加入中文字体库---------------------
    │ │ Native Language Support --->
    │ │   <*> Simplified Chinese charset (CP936, GB2312)
    │ │   <*> NLS UTF8
    最后加载提示:
    [root@Qiu /]# usb 1-1: new full speed USB device using s3c2410-ohci and address 3
    scsi1 : SCSI emulation for USB Mass Storage devices
      Vendor:           Model:                   Rev:    
      Type:   Direct-Access                      ANSI SCSI revision: 00
    SCSI device sdb: 483041 512-byte hdwr sectors (247 MB)
    sdb: Write Protect is off
    sdb: assuming drive cache: write through
    SCSI device sdb: 483041 512-byte hdwr sectors (247 MB)
    sdb: Write Protect is off
    sdb: assuming drive cache: write through
     /dev/scsi/host1/bus0/target0/lun0:<7>usb-storage: queuecommand called
     unknown partition table
    Attached scsi removable disk sdb at scsi1, channel 0, id 0, lun 0
    Attached scsi generic sg0 at scsi1, channel 0, id 0, lun 0,  type 0
    挂载上后:(刚插上拔下一次变成host1)
    [root@Qiu /]# mount -t vfat /dev/scsi/host1/bus0/target0/lun0/disc /mnt
    [root@Qiu /]# cd mnt
    [root@Qiu /mnt]# ls
    9600gso.jpg                Linux命令大全(修改版).chm



    queuecommand called unknown partition table这个提示没搞定...能挂上就先用着了 ....
    哪位高手知道帮忙下哦,谢谢。


    点击看大图

  • PARTNER CONTENT

    文章评论0条评论)

    登录后参与讨论
    EE直播间
    更多
    我要评论
    0
    2
    关闭 站长推荐上一条 /3 下一条