当前位置: 代码迷 >> 综合 >> usb for HHARM2410 on linux2.6.14
  详细解决方案

usb for HHARM2410 on linux2.6.14

热度:73   发布时间:2024-01-21 13:40:00.0

一,修改代码

    (1)在linux-2.6.14/arch/arm/mach-s3c2410/mach-smdk2410.c 中加入如下内容

                 /******************add for usb ***********************/

                   #include <asm/arch/usb-control.h>
                   #include <asm/arch/regs-clock.h>
                   #include <linux/device.h>
                   #include <linux/delay.h>

              struct s3c2410_hcd_info usb_s3c2410_info = {
                                                           .port[0] = {
                                                           .flags = S3C_HCDFLG_USED
                                                                           }
                                                                                    }
             int smdk2410_usb_init(void)
                          {
                             /* USB */
                            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;
                             }


/******************************add by YXJ**********************************/

(2)在static void __init smdk2410_map_io(void)函数中添加如下内容

    smdk2410_usb_init(); //add for usb  by YXJ
(3)在 drivers/usb/host/ohci-s3c2410.c中

         添加头文件

           #include <asm/arch/usb-control.h>

       在static void s3c2410_start_hc(struct platform_device *dev, struct usb_hcd *hcd)函数中添加

           /*********************add for usb by YXJ***************************/
        unsigned long upllvalue = (0x78<<12)|(0x02<<4)|(0x03);

        while (upllvalue != __raw_readl(S3C2410_UPLLCON))
          {
            __raw_writel(upllvalue, S3C2410_UPLLCON);
            mdelay(1);
          }
      /***********************add for usb by YX end *********************/
  据说添加这一部分是由S3c2410中UPLLCON自身的问题引起的,具体可参考下面论述

http://www.linuxforum.net/forum/showflat.php?Cat=&Board=embedded&Number=556915&page=0&view=collapsed&sb=7&o=all&fpart=all

否则插上usb设备时会出现如下提示:

usb 1-1: new full speed USB device using s3c2410-ohci and address 2
usb 1-1: device descriptor read/64, error -110
usb 1-1: device descriptor read/64, error -110

二,编译内核

        USB驱动设置,可能有些不选也行,不过没时间去试,至于为什么要选这些选项的话可以看一下这个贴(Linux下的硬件驱动——USB设备):

http://www-128.ibm.com/developerworks/cn/linux/l-usb/index1.html

 

│ │ Device Drivers --->

│ │ Generic Driver Options --->

│<*> Hotplug firmware loading support

│ │ Block 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 │ │

│ │ < > NTFS file system support

 4,加入中文字库

 │ │ Native Language Support --->
│ │<*> Simplified Chinese charset (CP936, GB2312)
│ │<*> NLS UTF8

 

 

三,运行系统

          插上u盘后会出现如下提示

                 usb 1-1: new full speed USB device using s3c2410-ohci and address 2

                 ub(1.6): GetMaxLUN returned 0, using 1 LUNs
                 uba: uba1

        然后可执行:mount -t vfat /dev/uba1 /mnt  命令将u盘挂载在/mnt目录下