linux-2.6.22
micro2440
大体上依据相关博客文章移植
mach-micro2440.c
#include <linux/dm9000.h>
/* DM9000AEP 10/100 ethernet controller */ //定义DM9000 网卡设备的物理基地址,以便后面用到
#define MACH_MICRO2440_DM9000_BASE (S3C2410_CS4 + 0x300)
static struct resource micro2440_dm9000_resource[] = {
[0] = {
.start = MACH_MICRO2440_DM9000_BASE,
.end = MACH_MICRO2440_DM9000_BASE + 3,
.flags = IORESOURCE_MEM
},
[1] = {
.start = MACH_MICRO2440_DM9000_BASE + 4,
.end = MACH_MICRO2440_DM9000_BASE + 7,
.flags = IORESOURCE_MEM
},
[2] = {
.start = IRQ_EINT7,
.end = IRQ_EINT7,
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
}
};
/*
* The DM9000 has no eeprom, and it's MAC address is set by
* the bootloader before starting the kernel.
*/
static struct dm9000_plat_data micro2440_dm9000_pdata = {
.flags = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
};
static struct platform_device micro2440_device_eth = {
.name = "dm9000",
.id = -1,
.num_resources = ARRAY_SIZE(micro2440_dm9000_resource),
.resource = micro2440_dm9000_resource,
.dev = {
.platform_data = µ2440_dm9000_pdata,
},
};
static struct platform_device *micro2440_devices[] __initdata = {
&s3c_device_usb,
&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c,
&s3c_device_iis,
&s3c_device_nand,
µ2440_device_eth,
};
dm9000.c
static int __init
dm9000_init(void)
{
#if defined(CONFIG_ARCH_S3C2410)
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\n", CARDNAME);