Chinaunix首页 | 论坛 | 博客
  • 博客访问: 971202
  • 博文数量: 261
  • 博客积分: 10026
  • 博客等级: 上将
  • 技术积分: 3420
  • 用 户 组: 普通用户
  • 注册时间: 2009-02-24 12:10
个人简介

https://smart888.taobao.com/ 立观智能监控

文章分类

全部博文(261)

文章存档

2011年(1)

2010年(4)

2009年(256)

我的朋友

分类: LINUX

2009-04-20 14:43:11

Linux 2.6.22.19移植到S3C2410(gec2410)之:USB驱动移植

参考文献:

   linux-2.6.22USB驱动移植》

http://blog.chinaunix.net/u1/43581/showart_1878283.htm

                     

平台信息:

目标板     GEC2410

OS           Fedora Cor8FC8

编译器    arm-2007q3-53-arm-none-eabi-i686-pc-linux-gnu4.2.1

根文件    busybox 1.9.2

                    

移植步骤:

1. 修改在arch/arm/mach-s3c2410目录下的mach-smdk2410.c,添加如下内容

//添加usb头文件

#include

#include

#include

#include

//-------------------------------------------------usb

struct s3c2410_hcd_info usb_gec2410_info = {

              .port[0] = {

                     .flags = S3C_HCDFLG_USED

               }

};

int usb_gec2410_init(void) /* USB */

{

       unsigned long upllvalue = (0x78<<12)|(0x02<<4)|(0x03);

      printk("USB Control, (c) 2009 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;

}

/*************************************************/
//同时将usb_ljd2410_init()函数添加到smdk2410_map_io函数里面进行初始化,如下所示:
static void __init smdk2410_map_io(void)
{
    s3c24xx_init_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc));
    s3c24xx_init_clocks(0);
    s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
      
usb_gec2410_init();
}

              

2. 编译内核,选中所装驱动,配置USB鼠标键盘

#make menuconfig

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

                

3. 配置U盘支持

因为要优盘用到了SCSI 命令,所以我们先增加SCSI 支持。

Device Drivers 菜单里面,选择SCSI device support

#make menuconfig

Device Drivers >

       SCSI device support --->

            [*] legacy /proc/scsi support

<*> SCSI disk support

然后选择返回Device Drivers 菜单,再选择 USB support,按回车进入USB support菜单找到并选中

Device Drivers >

            USB support --->

<*> USB Mass Storage support

                [*]     USB Mass Storage verbose debug

               

4. 插入U盘的信息

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

usb 1-1: configuration #1 chosen from 1 choice

scsi0 : SCSI emulation for USB Mass Storage devices

scsi 0:0:0:0: Direct-Access     USB2.0   Flash Disk       2.10 PQ: 0 ANSI: 2

sd 0:0:0:0: [sda] 4122593 512-byte hardware sectors (2111 MB)

sd 0:0:0:0: [sda] Write Protect is off

sd 0:0:0:0: [sda] Assuming drive cache: write through

sd 0:0:0:0: [sda] 4122593 512-byte hardware sectors (2111 MB)

sd 0:0:0:0: [sda] Write Protect is off

sd 0:0:0:0: [sda] Assuming drive cache: write through

sda:<7>usb-storage: queuecommand called

sda1

sd 0:0:0:0: [sda] Attached SCSI removable disk

5. mount   U盘时候出现错误:

错误一:

$ mount -t vfat sda1 /mnt

Unable to load NLS charset cp437

FAT: codepage cp437 not found

mount: mounting sda1 on /mnt failed: Invalid argument

解答:


这是因为内核缺少cp437字符集. 所以需要重新配置内核!
在filesystems
       -->native language support
               -> 中选择Codepage 437和其他的一些常用的字符集即可.

错误二:

Unable to load NLS charset iso8859-1                                                                               
FAT: IO charset iso8859-1 not found

解答:

跟上边的出错原因是一样的,缺少该语种

在File systems--》
                Native language support--》
                    <*>   NLS ISO 8859-1 (Latin 1; Western European Languages) 即可

阅读(1665) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~