天天看點

fl2440——添加DM9000網卡支援

1、修改核心代碼

vim arch/arm/mach-s3c2440/mach-smdk2440.c
#include <Linux/dm9000.h>  //添加DM9000網卡的頭檔案
           

并添加如下代碼:

/*Add DM9000 ethernet drivers*/
#define DM9000_BASE    (S3C2410_CS4 + 0x300)
static struct resource s3c_dm9000_resource[] = {
     [] = {
        .start = DM9000_BASE,
        .end   = DM9000_BASE + ,
        .flags = IORESOURCE_MEM
    },
    [] = {
        .start = DM9000_BASE + ,
        .end   = DM9000_BASE + ,
        .flags = IORESOURCE_MEM
    },
    [] = {
        .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 s3c_dm9000_pdata = {
    .flags      = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
};
static struct platform_device s3c_device_dm9000 = {
    .name       = "dm9000",
    .id     = -,
    .num_resources  = ARRAY_SIZE(s3c_dm9000_resource),
    .resource   = s3c_dm9000_resource,
    .dev        = {
        .platform_data  = &s3c_dm9000_pdata,
    },
};
           

2、在platform_device *smdk2440_devices[] __initdata結構體添加啟動DM9000

static struct platform_device *smdk2440_devices[] __initdata = {
    &s3c_device_ohci,
    &s3c_device_lcd,
    &s3c_device_wdt,
    &s3c_device_i2c0,
    &s3c_device_iis,
    &s3c_device_dm9000,
};
           

3、在dm9000.h下添加頭檔案

vim include/linux/dm900.h

#include <linux/io.h>
           

重新make編譯核心,我們得核心就能DM9000網卡了。

繼續閱讀