Chinaunix首页 | 论坛 | 博客
  • 博客访问: 84586
  • 博文数量: 16
  • 博客积分: 86
  • 博客等级: 民兵
  • 技术积分: 222
  • 用 户 组: 普通用户
  • 注册时间: 2012-11-08 17:46
文章分类

全部博文(16)

文章存档

2014年(1)

2013年(15)

分类: LINUX

2013-02-23 15:33:36

Linux-2.6.30 _USB_HOST 移植

USB_HOST0驱动移植

、修改 arch/arm/mach-s3c2410/mach-smdk2410.c 文件,添加以下部分代码:

#include 

#include 

#include 

#include 

static struct s3c2410_hcd_info usb_gec2410_info = {

  .port[0] = {

.flags = S3C_HCDFLG_USED ,

}

};

int usb_gec2410_init(void)

{

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

printk("USB Control, (c) 2009 gec2410\n");

s3c_device_usb.dev.platform_data = &usb_gec2410_info;

while(upllvalue!=__raw_readl(S3C2410_UPLLCON))

{

  __raw_writel(upllvalue,S3C2410_UPLLCON);

  mdelay(1);

  }

  return 0;

}

、 在static void __init smdk2410_map_io()函数中添加 usb_sbc2410_init()函数。(红色部分

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));

s3c24xx_set_board(&smdk2410_board);

usb_gec2410_init();

}

3. 内核配置

■ 让内核支持热插拔

General setup --->

  [ * ] Configure standard kernel features (for small systems) —— >

  < * >Support for hot-pluggable devices

■ 让内核支持 USB 设备

Device drivers 

  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

  < * >USB Mass Storage support

  < * >USB Monitor

■ 加入 MSDOS 文件系统和 VFAT 文件系统支持(为适应挂载 盘)

File systems --->

  DOS/FAT/NT Filesystems --->

  <*> MSDOS fs support

  <*>VFAT (Windows-95) fs support

  936 ) Default codepage for FAT // 更改默认值为 936

  cp936 ) Default iocharset for FAT // 更改默认值为 cp936

■ 使能( DOS 分区) CONFIG_MSDOS_PARTITION

Partition Types --->

  * ] PC BIOS (MSDOS partition tables) support

■ 添加对中文字体库的支持

-*- Native language support --->

  >Simplified Chinese charset (CP936, GB2312)

  > NLS UTF8

、修改好源码并配置好内核选项后编译

make

、挂载USB设备U 

1设置 mdev

# mkdir /etc/mdev.conf

创建所有设备节点

# mdev -s

2启动实验板,查看系统分区的主次设备号。

# cat /proc/partitions

打印分区情况如下

 major    minor    #blocks    name

  31        0        256   mtdblock0

  31        1       3072   mtdblock1

  31        2      62208   mtdblock2

入 盘后 /proc/partitions 目录中增加了一个 uba 类型设备(此设备号

为 ),并出现 一个 uba1 的真实设备(设备号一般为 或大于 

 major    minor     #blocks    name

  31        0        256    mtdblock0

  31        1       3072    mtdblock1

  31        2      62208    mtdblock2

   8        0    1993728      sda

   8        1    1993604      sda1

3)挂载 

创建设备节点(根据所查分区情况----上面两个设备节点均可行

mknod  /dev/sda1  b  8  1

挂载

#mount -t vfat /dev/sda1 /tmp

#ls /tmp

至此,可以查看到U盘中资料。

常见错误

现象1

[root@GEC/]#usb 1-1: new full speed USB device using s3c2410-ohci and

address 4

usb 1-1: device descriptor read/64, error -62

usb 1-1: device descriptor read/64, error -62

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

usb 1-1: device descriptor read/64, error -62

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

解决方法:去掉

Device Drivers-->

  Real Time Clock

现象2

插入 盘时显示:

bash-4.0# scsi 0:0:0:0: Direct-Access ChipsBnk Flash Disk 2.00 PQ:0 ANSI: 2

sd 0:0:0:0: Attached scsi generic sg0 type 0

sd 0:0:0:0: [sda] 516608 512-byte hardware sectors: (264 MB/252 MiB)

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] Assuming drive cache: write through

sda: sda1

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

并在在挂载时出现一下提示:

Unable to load NLS charset cp437

FAT: codepage cp437 not found

解决方法:添加

File systems-->

  Native language support-->

   Codepage 437 (United States, Canada)

现象3

挂载时出现一下提示:

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)

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