嵌入式Linux2.6.32系统移植–DM9000
主机:RHEL6.0(2.6.32-220.2.1.el6.i686)
开发板:FL2440
编译器:arm-unknown-linux-gnueabi-gcc-4.4.6
@@arch/arm/plat-s3c24xx/common-smdk.c
##添加头文件
#include
##添加函数
- /* DM9000 */
- static struct resource s3c_dm9k_resource[] = {
- [0] = {
- .start = S3C2410_CS4, /* ADDR2=0 ,发送地址时使用这个地址 */
- .end = S3C2410_CS4 + 3,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = S3C2410_CS4 + 4, /* ADDR2=1 ,传输数据时使用这个地址 */
- .end = S3C2410_CS4 + 4 + 3,
- .flags = IORESOURCE_MEM,
- },
- [2] = {
- .start = IRQ_EINT7, /* 中断号 */
- .end = IRQ_EINT7,
- .flags = IORESOURCE_IRQ|IRQF_TRIGGER_RISING,
- }
- };
- /* for the moment we limit ourselves to 16bit IO until some
- *
- * * better IO routines can be written and tested
- *
- * */
- static struct dm9000_plat_data s3c_dm9k_platdata = {
- .flags = DM9000_PLATF_16BITONLY,
- };
- static struct platform_device s3c_device_dm9k = {
- .name = "dm9000",
- .id = 0,
- .num_resources = ARRAY_SIZE(s3c_dm9k_resource),
- .resource = s3c_dm9k_resource,
- .dev = {
- .platform_data = &s3c_dm9k_platdata,
- }
- };
##注册设备
- &s3c_device_nand,
- + &s3c_device_dm9k,
修改dm9000.c源码
##添加头文件
- #ifdef CONFIG_ARCH_S3C2440
- #include <mach/regs-mem.h>
- #endif
##添加初始化部分
- dm9000_init(void)
- {
- +#ifdef CONFIG_ARCH_S3C2440
- + unsigned int oldval_bwscon = *(volatile unsigned int *)S3C2410_BWSCON;
- + unsigned int oldval_bankcon4 = *(volatile unsigned int *)S3C2410_BANKCON4;
- + *((volatile unsigned int *)S3C2410_BWSCON) =
- + (oldval_bwscon & ~(3<<16)) | S3C2410_BWSCON_DW4_16 |
- + S3C2410_BWSCON_WS4 | S3C2410_BWSCON_ST4;
- + *((volatile unsigned int *)S3C2410_BANKCON4) = 0x1f7c;
- +#endif
- printk(KERN_INFO "%s Ethernet Driver, V%s\n", CARDNAME, DRV_VERSION);
- return platform_driver_register(&dm9000_driver);
- }
##添加软MAC地址
- + //使用软MAC地址,10:23:45:67:89:ab
- + memcpy(ndev->dev_addr, "\x10\x23\x45\x67\x89\xab", 6);
- if (!is_valid_ether_addr(ndev->dev_addr))
- dev_warn(db->dev, "%s: Invalid ethernet MAC address. Please "
- "set using ifconfig\n", ndev->name);
##指定中断方式
##不然会出现:dm9000
dm9000.0: WARNING: no IRQ resource flags set.
##在dm9000_open函数中
- +#ifdef CONFIG_ARCH_S3C2440
- + if (request_irq(dev->irq, &dm9000_interrupt, IRQF_SHARED|IRQF_TRIGGER_RISING, dev->name, dev))
- +#else
- if (request_irq(dev->irq, &dm9000_interrupt, irqflags, dev->name, dev))
- +#endif
- return -EAGAIN;
至此,DM9000的移植完成。
##附RTC的实现
@@arch/arm/mach-s3c2440/mach-smdk2440.c
在smdk2440_devices[]
__initdata添加一行:
&s3c_device_rtc,
阅读(794) | 评论(0) | 转发(0) |