CS8900在linux-2.6.30移植支持s3c2440
其实这里移植的是一种传统的旧的CS8900网卡驱动,新的内核采用不一样的驱动方式,但旧的移植也可以参考一下,因为linux-2.6.30的struct net_device有些许改动,就是原来的priv指针名字变为ml_priv。还有一个就是多了一个控制宏CONFIG_COMPAT_NET_DEV_OPS
这个宏的开启要在内核配置中
-> Device Drivers->Network device support
-> [*] Enable older network device API compatibility
1,修改drivers/net/arm/Makefile文件添加:
obj-$(CONFIG_ARM_CS8900) += cs8900.o
2,修改drivers/net/arm/Kconfig文件添加:
config ARM_CS8900
tristate "CS8900 support"
depends on NET_ETHERNET && ARM && ARCH_SMDK2410
help
support for cs8900 chipset based Ethernet cards , if you have a network card of this type
3,编译配置内核
# make menuconfig
Device Drivers --->
[*] Network device support --->
[*] Ethernet (10 or 100Mbit) --->
<*> CS8900 support
4,修改arch/arm/mach-s3c2440/mach-smdk2440.c文件
static struct map_desc smdk2440_iodesc[] __initdata最后添加:
,{
.virtual = vSMDK2410_ETH_IO,
.pfn = __phys_to_pfn(S3C2410_CS3 + (1<<24)),
.length = SZ_1M,
.type = MT_DEVICE,
}
# vi arch/arm/mach-s3c2410/mach-smdk2410.c
在static struct map_desc smdk2410_iodesc[] __initdata 最后添加:
,{
.virtual = vSMDK2410_ETH_IO,
.pfn = __phys_to_pfn(S3C2410_CS3 + (1<<24)),
.length = SZ_1M,
.type = MT_DEVICE,
}
5,修改arch/arm/mach-s3c2410/include/mach/map.h文件增加:
/* CS8900 */
#define pSMDK2410_ETH_IO __phys_to_pfn(0x19000000)
#define vSMDK2410_ETH_IO 0xE0000000
#define SMDK2410_ETH_IRQ IRQ_EINT9
6.把以下两个文件cs8900.c cs8900.h添加进drivers/net/arm/内,然后编译内核。
两个文件可以上网上去找。
对于CS8900,如果我内核是配置成CONFIG_ARCH_S3C2440,即配置时没选SMDK2410,会不行,主要是cs8900a里的宏CONFIG_ARCH_SMDK2410,可以改成(CONFIG_ARCH_SMDK2410 || CONFIG_ARCH_S3C2440),但要适当改,对于map.H的内容就不需要改了,因为在包含头文件时,s3c2440也会用到。