迷茫 但我不迷失

在嵌入式世界中的感受

常用链接

统计

最新评论

基于s3c2410开发板2.6.25内核的USB驱动的移植

因为2.6.25内核源码中并没有USB驱动的初始化程序,因此我添加了相应的代码:

在linux-2.6.25/arch/arm/mach-s3c2410/mach-smdk2410.c文件中添加:
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 smdk2410_init(void)
{
        platform_add_devices(smdk2410_devices, ARRAY_SIZE(smdk2410_devices));
        smdk_machine_init();
       s3c2410_init_usb();
}
其对上面代码的解释看下此帖:
http://www.linuxforum.net/forum/showflat.phpCat=&Board=embedded&Number=556915&page=0&view=collapsed&sb=5&o=0&fpart=

拷贝linux-2.6.25/arch/arm/configs/s3c2410_defconfig 缺省配置文件  并命名.config
make  menuconfig  再进行配置
1.设备驱动部分设置
          General setup  --->  
     [*]Configure standard kernel features (for small systems)  --->
         [*] Support for hot-pluggable devices
              Device Drivers  ---> 
              Generic Driver Options  --->          
<*> Hotplug firmware loading support    
               Block devices  --->    
<*> Low Performance USB Block driver   
           SCSI device support  --->   
      <*>   SCSI generic support  
      <*>   SCSI disk  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

这里我选择了SCSI设备。

2 文件系统部分设置
           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
 3 加入一些字体库
  Native Language Support  --->   
    <*>   Simplified Chinese charset (CP936, GB2312) 
    <*>   NLS UTF8

但我将内核镜像烧入板中后,插入U盘  mount  挂载时出现如下错误:

Unable to load NLS charset cp437
FAT: codepage cp437 not found
mount: mounting sda1 on /mnt failed: Invalid argument


因此我又重新增加了配置选项在 Native Language Support  --->    中
File systems  --->
   
Native Language Support  --->   
  <*>   Codepage 437 (United States, Canada) 
<*>   Simplified Chinese charset (CP936, GB2312) 

然后再编译
make  zImage

烧入镜像后插入U盘显示如下信息

sd 1:0:0:0: [sda] 129312 512-byte hardware sectors (66 MB)
sd 1:0:0:0: [sda] Write Protect is off
sd 1:0:0:0: [sda] Assuming drive cache: write through
sd 1:0:0:0: [sda] 129312 512-byte hardware sectors (66 MB)
sd 1:0:0:0: [sda] Write Protect is off
sd 1:0:0:0: [sda] Assuming drive cache: write through
sda: sda1
sda: p1 exceeds device capacity
sd 1:0:0:0: [sda] Attached SCSI removable disk


然后mount  -t vfat /dev/sda1  /mnt
其中设备文件名是我在安装文件系统时生成的
在/dev/中
mknod  sda1  b 8 0

加载成功


posted on 2008-05-16 16:05 北极冰封 阅读(1434) 评论(0)  编辑 收藏 引用


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   博问   Chat2DB   管理