歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> linaro Android 4.0.4 for FS100 - DM9000移植

linaro Android 4.0.4 for FS100 - DM9000移植

日期:2017/3/1 10:17:27   编辑:Linux編程

1. 平台代碼修改

vim arch/arm/mach-s5pc100/mach-smdkc100.c

2. 添加需要的頭文件

#if defined (CONFIG_DM9000)

#include <linux/dm9000.h>

#include <linux/irq.h>

#endif

3. 平台設備添加

// CMD為低,讀寫地址寄存器, CMD為高,讀寫數據寄存器

// 訪問dm9000內部寄存器時,先將cmd拉低,向dm9000寄存器裡寫地址,然後,將cmd拉高,讀寫dm9000數據寄存器裡的數據

#if defined(CONFIG_DM9000)

// MichaelTang add start
static struct resource dm9000_resources[] = {
[0] = {
.start = 0x88000000, // 地址線
.end = 0x88000000 + 0x4 - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = 0x88000000 + 0x4, // 數據線
.end = 0x88000000 + 0x8 - 1,
.flags = IORESOURCE_MEM,
},
[2] = {
.start = S5P_IRQ_VIC0(10),
.end = S5P_IRQ_VIC0(10),
.flags = IORESOURCE_IRQ | IRQ_TYPE_LEVEL_HIGH, //申請中斷及觸發方式
},
};

static struct dm9000_plat_data s5pc100_dm9000_platdata = { // 設置網卡mac物理地址
.flags = DM9000_PLATF_16BITONLY,
.dev_addr[0] = 0x0,
.dev_addr[1] = 0x0,
.dev_addr[2] = 0x11,
.dev_addr[3] = 0x22,
.dev_addr[4] = 0x33,
.dev_addr[5] = 0x44,
};
static struct platform_device s3c_device_dm9ks = { // 注冊設備結構體
.name = "dm9000",
.id = -1,
.num_resources = ARRAY_SIZE(dm9000_resources),
.resource = dm9000_resources,
.dev = {
.platform_data = &s5pc100_dm9000_platdata,
}
};
// MichaelTang add end


#endif

4. 將dm9000添加到平台設備列表中

添加位置: smdkc100_devices[]中


#if defined (CONFIG_DM9000)


// Michaeltang add
&s3c_device_dm9ks,

// MichaelTang add end


#endif

5. 配置內核

$ make menuconfig

6. 網絡配置

將dm9000配置編譯進內核,執行make zImage,拷貝到tftp目錄中,通過tftp加載測試內核。

Copyright © Linux教程網 All Rights Reserved