Chinaunix首页 | 论坛 | 博客
  • 博客访问: 216065
  • 博文数量: 63
  • 博客积分: 3010
  • 博客等级: 中校
  • 技术积分: 620
  • 用 户 组: 普通用户
  • 注册时间: 2009-09-05 14:36
文章存档

2010年(8)

2009年(55)

我的朋友

分类: 嵌入式

2009-09-08 09:55:45

硬件设备:
网卡芯片: dm9000
NandFlash: K9F1208U0C 64M


1,
下载并解压缩内核,修改顶层Makefile的编译器选项:
ARCH
?= arm
CROSS_COMPILE
?= arm-softfloat-linux-gnu-



2,
修改arch/arm/plat-s3c24xx/devs.c, 使其支持DM9000网卡:

添加头文件:

#include



添加dm9000网卡设备的支持
EXPORT_SYMBOL(s3c_device_usb);
-
-/* add by guowenxue 2009.05.15 My board use nETH_CS->NGCS3, IRQ_LAN->IRQ_LAN, CMD->A2
*/

-
-static struct resource s3c_dm9000_resource[] =
-{
-
[0] = {

-
.start = S3C2410_CS3 + 0x300,

-
.end
= S3C2410_CS3 + 0x300 + 0x03,

-
.flags = IORESOURCE_MEM

-
},

-
-
[1] = {

-
.start = S3C2410_CS3 + 0x300 + 0x04,

-
.end
= S3C2410_CS3 + 0x300 + 0x04 + 0x3f,
//
It's 0x3f, not 0x3

-
.flags = IORESOURCE_MEM

-
},

-
-
[2] = {

-
.start = IRQ_EINT9,
// My board use EINT9

-
.end
= IRQ_EINT9,

-
.flags = IORESOURCE_IRQ

-

}

-};
-
-static struct dm9000_plat_data s3c_device_dm9000_platdata =
-{
-
.flags= DM9000_PLATF_16BITONLY

-};
-
-struct platform_device s3c_device_dm9000 = {
-
.name= "dm9000",

-
.id= -1,

-
.num_resources= ARRAY_SIZE(s3c_dm9000_resource),

-
.resource= s3c_dm9000_resource,

-
.dev= {

-
.platform_data = &s3c_device_dm9000_platdata,

-
}

-
-};
-
-
-EXPORT_SYMBOL(s3c_device_dm9000);
-// add end
-


3, 修改文件arch/arm/plat-s3c24xx/include/plat/devs.h,导出dm9000设备:


extern struct platform_device s3c_device_sdi;
extern struct platform_device s3c_device_dm9000;
//add by guowenxue,2009.05.15




4, 修改文件arch/arm/mach-s3c2410/mach-smdk2410.c, 添加dm9000



添加头文件:
#include
// add by guowenxue, 2009.05.15

………

static struct platform_device *smdk2410_devices[] __initdata = {

&s3c_device_usb,

&s3c_device_lcd,

&s3c_device_wdt,

&s3c_device_i2c,


&s3c_device_iis,


&s3c_device_dm9000,
// this member add by guowenxue 2009.05.15

};


5,修改文件linux-2.6.28/arch/arm/plat-s3c24xx/common-smdk.c,设置NandFlash的分区情况:

/* NAND parititon from 2.4.18-swl5 */


// modify by guowenxue 2009.05.15
static struct mtd_partition smdk_default_nand_part[] = {

[0] = {


.name
= "mtdblock0 uboot 1M",


.size
= SZ_1M,


.offset = 0,


},


[1] = {


.name
= "mtdblock1 kernel 3M",


.offset = SZ_1M * 1,


.size
= SZ_1M * 3,


},


[2] = {


.name
= "mtdblock2 rootfs 6M",


.offset = SZ_1M * 4,


.size
= SZ_1M * 6,


},


[3] = {



.name
= "mtdblock3 apps 27M",


.offset = SZ_1M * 10,


.size
= SZ_1M * 27,


},


[4] = {


.name
= "mtdblock4 user 27M",


.offset = SZ_1M * 37,


.size
= SZ_1M * 27,


}

};
//modify end


6, 修改dm9000驱动程序文件:migrate-linux-2.6.28/drivers/net/dm9000.c

47行处:

#define CARDNAME
"dm9000"


#define DRV_VERSION
"1.31"


-#define INTMOD
(0x4A000004)
//These two line add by guowenxue 2009.05.15

-static void *intmod;


996行处

dm9000_open(struct net_device *dev)

{

board_info_t *db = dev->priv;
-

db->irq_res->flags |= IRQ_TYPE_EDGE_RISING;
// add by guowenxue,2009.05.15

-

unsigned long irqflags = db->irq_res->flags & IRQF_TRIGGER_MASK;


-
set_irq_type(dev->irq, IRQ_TYPE_EDGE_RISING); // add by guowenxue,2009.05.15
-

if (netif_msg_ifup(db))

dev_dbg(db->dev, "enabling %s\n", dev->name);
……..


1185行处函数static int __devinit dm9000_probe(struct platform_device *pdev)




int i;

u32 id_val;


-// add by guowenxue,2009.05.15
-
intmod=ioremap_nocache(INTMOD,0x0000004);

-
writel(0x0,intmod);

-// add end
-

/* Init network device */

ndev = alloc_etherdev(sizeof(struct board_info));

if (!ndev) {
........
阅读(821) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~