Topic:S3C2416支持DM9000驱动(作者:Sturtle)
//----------------------------------------------------------------------------------------------------------------------------
// 作者:Eleven([email protected])
// 论坛ID:Sturtle
// 版权:Eleven
// 平台:友坚UT-S3C2416开发板+Linux2.6.21 OS
// 发布日期:2011-10-17
// 最后修改:2011-10-19
// 注意事项:未经作者同意,商业网站不能转载,更不得在转载的时候擅自修改、删除文章的任何部分
// 摘自:http://blog.csdn.net/anthone_ligang/article/details/6607643
//------------------------------------------------------------------------------------------------------------------------------
一、硬件连接:
1、16bit模式
2、INT接到S3C2416的IRQ_LAV/EINT4,INT脚为低时为有效中断信号,中断线为EINT4;
3、CS接到S5PV210的CSn1,CMD连接到S3C2416的地址总线ADDR[1],故INDEX和DATA[15:0]的端口地址分别为0x80000000和0x80000004。
二、软件设定
1、在\kernel2416\arch\arm\plat-s3c24xx\devs.c中添加如下:
[cpp] view plain copy print ?
- #include <linux/dm9000.h>
- #define S3C24XX_VA_DM9000 (0xe0000000)
- #define S3C24XX_PA_DM9000 (0x08000000)
- #define S3C24XX_SZ_DM9000 SZ_1M
-
- static struct resource dm9000_resources[] = {
- [0] = {
- .start = S3C24XX_PA_DM9000,
- .end = S3C24XX_PA_DM9000+0x3,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = S3C24XX_PA_DM9000+0x4,
- .end = S3C24XX_PA_DM9000+S3C24XX_SZ_DM9000-1,
- .flags = IORESOURCE_MEM,
- },
- [2] = {
- .start = IRQ_EINT4,
- .end = IRQ_EINT4,
-
- .flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH,
- },
- };
-
- static struct dm9000_plat_data dm9000_setup = {
- .flags = DM9000_PLATF_16BITONLY
- };
-
- struct platform_device s3c_device_dm9000 = {
- .name = "dm9000",
- .id = 0,
- .num_resources = ARRAY_SIZE(dm9000_resources),
- .resource = dm9000_resources,
- .dev =
- {
- .platform_data = &dm9000_setup,
- }
- };
- EXPORT_SYMBOL(s3c_device_dm9000);
#include <linux/dm9000.h> #define S3C24XX_VA_DM9000 (0xe0000000) #define S3C24XX_PA_DM9000 (0x08000000) #define S3C24XX_SZ_DM9000 SZ_1M static struct resource dm9000_resources[] = { [0] = { .start = S3C24XX_PA_DM9000, .end = S3C24XX_PA_DM9000+0x3, .flags = IORESOURCE_MEM, }, [1] = { .start = S3C24XX_PA_DM9000+0x4, .end = S3C24XX_PA_DM9000+S3C24XX_SZ_DM9000-1, .flags = IORESOURCE_MEM, }, [2] = { .start = IRQ_EINT4, .end = IRQ_EINT4, // .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, .flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH, }, }; static struct dm9000_plat_data dm9000_setup = { .flags = DM9000_PLATF_16BITONLY }; struct platform_device s3c_device_dm9000 = { .name = "dm9000", .id = 0, .num_resources = ARRAY_SIZE(dm9000_resources), .resource = dm9000_resources, .dev = { .platform_data = &dm9000_setup, } }; EXPORT_SYMBOL(s3c_device_dm9000);
2、在\kernel2416\arch\arm\mach-s3c2416\mach-smdk2416.c修改成:
[cpp] view plain copy print ?
- static struct platform_device *smdk2416_devices[] __initdata = {
-
-
- &s3c_device_i2c,
- &s3c_device_lcd,
- &s3c_device_rtc,
- &s3c_device_adc,
- &s3c_device_iis,
- &s3c_device_usbgadget,
- &s3c_device_usb,
- &s3c_device_hsmmc0,
- &s3c_device_hsmmc1,
-
- &s3c_device_dm9000,
- };
static struct platform_device *smdk2416_devices[] __initdata = { //&s3c_device_wdt, &s3c_device_i2c, &s3c_device_lcd, &s3c_device_rtc, &s3c_device_adc, &s3c_device_iis, &s3c_device_usbgadget, &s3c_device_usb, &s3c_device_hsmmc0, &s3c_device_hsmmc1, //&s3c_device_smc911x &s3c_device_dm9000, };
3、修改\include\asm-arm\plat-s3c24xx\devs.h ,添加:
[cpp] view plain copy print ?
- #if defined(CONFIG_CPU_S3C6410) || defined(CONFIG_CPU_S3C2450)|| defined(CONFIG_CPU_S3C2416)
- extern struct platform_device s3c_device_smc911x;
- extern struct platform_device s3c_device_dm9000;
- #endif
#if defined(CONFIG_CPU_S3C6410) || defined(CONFIG_CPU_S3C2450)|| defined(CONFIG_CPU_S3C2416) extern struct platform_device s3c_device_smc911x; extern struct platform_device s3c_device_dm9000; #endif
4、修改\include\linux\dm9000.h ,添加:
[cpp] view plain copy print ?
- #define S3C24XX_VA_DM9000 (0xe0000000)
- #define S3C24XX_PA_DM9000 (0x08000000)
- #define S3C24XX_SZ_DM9000 SZ_1M
#define S3C24XX_VA_DM9000 (0xe0000000) #define S3C24XX_PA_DM9000 (0x08000000) #define S3C24XX_SZ_DM9000 SZ_1M
//如有错误,请留言指正;同时希望有更好的方法与大家交流和分享,让我们大家一起学习,共同进步!
原文出处:http://blog.csdn.net/sturtle/article/details/6881363