免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4372 | 回复: 5
打印 上一主题 下一主题

移植16550 UART驱动 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-11-28 13:24 |只看该作者 |倒序浏览
求教:公司自己做的板子,处理器MPC5200,扩展16550 UART(不做console),Kernel 2.6.16,之前未加载该驱动时启动正常,加载后在"Freeing unused kernel memory: 100k"挂住了。因板子与Freescale公司的lite5200b基本类似,我在arch/ppc/platform/lite5200b.c定义了以下结构(感觉在哪定义都行):

  1. static struct plat_serial8250_port serial8250_ports[] = {

  2. [0] = {
  3. .uartclk = 9600*16,
  4. .iotype = UPIO_MEM,
  5. .mapbase = 0xfc000000,
  6. .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_SHARE_IRQ,
  7. .irq = MPC52xx_IRQ1,
  8. },
  9. [1] = {
  10. .uartclk = 9600*16,,
  11. .iotype = UPIO_MEM,
  12. .mapbase = 0xfc000008,
  13. .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_SHARE_IRQ,
  14. .irq = MPC52xx_IRQ1,
  15. },
  16. [2] = {
  17. .uartclk =  9600*16,,
  18. .iotype = UPIO_MEM,
  19. .mapbase = 0xfc000010,
  20. .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_SHARE_IRQ,
  21. .irq = MPC52xx_IRQ2,
  22. },
  23. [3] = {
  24. .uartclk =  9600*16,,
  25. .iotype = UPIO_MEM,
  26. .mapbase = 0xfc000018,
  27. .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_SHARE_IRQ,
  28. .irq = MPC52xx_IRQ2,
  29. },
  30. [4] = {
  31. .uartclk =  9600*16,,
  32. .iotype = UPIO_MEM,
  33. .mapbase = 0xfc000020,
  34. .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_SHARE_IRQ,
  35. .irq = MPC52xx_IRQ3,
  36. },
  37. [5] = {
  38. .uartclk =  9600*16,,
  39. .iotype = UPIO_MEM,
  40. .mapbase = 0xfc000028,
  41. .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_SHARE_IRQ,
  42. .irq = MPC52xx_IRQ3,
  43. },
  44. {},
  45. };

  46. static struct platform_device serial8250_device = {
  47. .name = "serial8250",
  48. .id = 0,
  49. .dev.platform_data = serial8250_ports,
  50. };

  51. static int __init
  52. add_serial8250_devices(void)
  53. {
  54. return platform_device_register(&serial8250_device);
  55. }

  56. arch_initcall(add_serial8250_devices);
复制代码


启动信息如下
The boot message is :
FT-Boot 1.2.0 (Sep 17 2008 - 09:16:55)

CPU:   MPC5200 v2.2, Core v1.4 at 462 MHz
       Bus 132 MHz, IPB 132 MHz, PCI 33 MHz
Board: FXALM(mpc52xx)
I2C:   85 kHz, ready
DRAM:  256 MB
FLASH: (Bank#1 - 512 kB, Bank#2 - 16 MB) 16.5 MB
In:    serial
Out:   serial
Err:   serial
Net:   FEC ETHERNET
IDE:   Bus 0: OK
  Device 0: Model: 128MB  ATA Flash Disk Firm: ADAA408J Ser#: A161112339F000831558
            Type: Hard Disk
            Capacity: 122.1 MB = 0.1 GB (250112 x 512)
Hit any key to stop autoboot:  0
Using FEC ETHERNET device
TFTP from server 192.168.1.40; our IP address is 192.168.1.50
Filename '/tftpboot/uImage'.
Load address: 0x200000
Loading: #################################################################
         #################################################################
         #################################################################
         ########################################################
done
Bytes transferred = 1281939 (138f93 hex)
## Booting image at 00200000 ...
   Image Name:   Linux-2.6.16
   Created:      2008-11-19  19:22:59 UTC
   Image Type:   PowerPC Linux Kernel Image (gzip compressed)
   Data Size:    1281875 Bytes =  1.2 MB
   Load Address: 00000000
   Entry Point:  00000000
   Uncompressing Kernel Image ... OK
id mach(): done
MMU:enter
MMU:hw init
MMU:mapin
MMU:setio
MMU:exit
setup_arch: enter
setup_arch: bootmem
arch: exit
bootinfo is find_bootinfo()<5>Linux version 2.6.16 (root@...) (gcc version 3.4.3) #50 Thu No8
Built 1 zonelists
Kernel command line: console=ttyPSC0,9600 root=/dev/nfs rw nfsroot=192.168.1.40:/home/hyz/ltib-mpc5200-20070201
PID hash table entries: 2048 (order: 11, 32768 bytes)
Console: colour dummy device 80x25
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 256896k available (1968k kernel code, 664k data, 100k init, 0k highmem)
Mount-cache hash table entries: 512
NET: Registered protocol family 16
            
DMA: MPC52xx BestComm driver
MPC52xx BestComm inited
SCSI subsystem initialized
Installing knfsd (copyright (C) 1996 okir@...).
JFFS2 version 2.2. (NAND) (C) 2001-2003 Red Hat, Inc.
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Serial: 8250/16550 driver $Revision: 1.90 $ 6 ports, IRQ sharing enabled
serial8250.0: ttyS0 at MMIO 0xfc000000 (irq = 6) is a 16550A
serial8250.0: ttyS1 at MMIO 0xfc000008 (irq = 6) is a 16550A
serial8250.0: ttyS2 at MMIO 0xfc000010 (irq = 7) is a 16550A
serial8250.0: ttyS3 at MMIO 0xfc000018 (irq = 7) is a 16550A
serial8250.0: ttyS4 at MMIO 0xfc000020 (irq = 8)is a 16550A
serial8250.0: ttyS5 at MMIO 0xfc000028 (irq = 8)is a 16550A
Serial: MPC52xx PSC driver
ttyPSC0 at MMIO 0xf0002000 (irq = 40) is a MPC52xx PSC
ttyPSC1 at MMIO 0xf0002200 (irq = 41) is a MPC52xx PSC
ttyPSC2 at MMIO 0xf0002400 (irq = 42) is a MPC52xx PSC
ttyPSC3 at MMIO 0xf0002600 (irq = 50) is a MPC52xx PSC
ttyPSC4 at MMIO 0xf0002800 (irq = 51) is a MPC52xx PSC
ttyPSC5 at MMIO 0xf0002c00 (irq = 43) is a MPC52xx PSC
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx
ide: MPC52xx IDE/ATA driver
eth0: Phy @ 0x0, type LXT971 (0x001378e2)
hda: 128MB ATA Flash Disk, ATA DISK drive
ide0 at 0xf0003a60-0xf0003a67,0xf0003a5c on irq 46
mpc52xx-ide: Setup successful for ide0 (mem=f0003a00-f0003aff irq=46)
hda: max request size: 128KiB
hda: 250112 sectors (128 MB) w/1KiB Cache, CHS=977/8/32
hda: cache flushes not supported
hda: hda1
flash chip on the Lite5200/Lite5200B: Found 1 x16 devices at 0x0 in 8-bit bank
Intel/Sharp Extended Query Table at 0x0031
Using buffer write method
cfi_cmdset_0001: Erase suspend on write enabled
Creating 1 MTD partitions on "flash chip on the Lite5200/Lite5200B":
0x00000000-0x01000000 : "Filesystem"
mice: PS/2 mouse device common for all mice
NET: Registered protocol family 2
IP route cache hash table entries: 4096 (order: 2, 16384 bytes)
TCP established hash table entries: 16384 (order: 4, 65536 bytes)
TCP bind hash table entries: 16384 (order: 4, 65536 bytes)
TCP: Hash tables configured (established 16384 bind 16384)
TCP reno registered
TCP bic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
eth0: config: auto-negotiation on, 100HDX, 10HDX.
IP-Config: Complete:
      device=eth0, addr=192.168.1.50, mask=255.255.255.0, gw=192.168.1.1,
     host=192.168.1.50, domain=, nis-domain=(none),
     bootserver=192.168.1.40, rootserver=192.168.1.40, rootpath=
Looking up port of RPC 100003/2 on 192.168.1.40
Looking up port of RPC 100005/1 on 192.168.1.40
VFS: Mounted root (nfs filesystem).
Freeing unused kernel memory: 100k init

就停在这里了,我什么地方做错了?驱动8250.c文件有要修改的地方吗?

[ 本帖最后由 dreamice 于 2008-11-28 15:02 编辑 ]

论坛徽章:
3
金牛座
日期:2014-06-14 22:04:062015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:49:45
2 [报告]
发表于 2008-11-28 15:08 |只看该作者
static struct plat_serial8250_port serial8250_ports[] 你这个结构的初始化真是很奇怪哦。
另外,platform_device_register也不知道是怎么实现的

论坛徽章:
0
3 [报告]
发表于 2008-11-28 15:52 |只看该作者

回复 #2 dreamice 的帖子

哪里奇怪啊?
arch_initcall(add_serial8250_devices)不是执行了吗

论坛徽章:
3
金牛座
日期:2014-06-14 22:04:062015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:49:45
4 [报告]
发表于 2008-11-28 15:55 |只看该作者

回复 #3 youngchul 的帖子

停在这个地方,感觉和串口驱动没有什么直接的关系啊

论坛徽章:
0
5 [报告]
发表于 2008-11-28 16:32 |只看该作者

回复 #4 dreamice 的帖子

那还会有哪些原因呢?没有他的话,boot是一点问题都没有的,对了还有一点,模块方式加载的话,
insmod 8250.ko也不会死,设备文件可操作,但收发都不通,囧,还是驱动的问题吧,是不是我那些结构体里漏了或错了?

论坛徽章:
0
6 [报告]
发表于 2008-12-30 20:50 |只看该作者

回复 #5 youngchul 的帖子

1:结构体里可能有错
2:8250.ko模块中程序虽语法正确,但逻辑可能有问题
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP