2440内核移植相关问题

在使用2440开发板移植3.4内核出现错误,随便记录一下 ifconfig使能网卡出现错误

cd arch/arm/s3c24xx 使用find查找网卡平台设备 find -name "dm9000" 发现只有mini2440平台有,smdk2440没有

仿照mini2440添加网卡相关平台设备和资源

#include <linux/dm9000.h>
#define MACH_MINI2440_DM9K_BASE (S3C2410_CS4 + 0x300)

/* DM9000AEP 10/100 ethernet controller */

static struct resource mini2440_dm9k_resource[] = {
	[0] = {
		.start = MACH_MINI2440_DM9K_BASE,
		.end   = MACH_MINI2440_DM9K_BASE + 3,
		.flags = IORESOURCE_MEM
	},
	[1] = {
		.start = MACH_MINI2440_DM9K_BASE + 4,
		.end   = MACH_MINI2440_DM9K_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 mini2440_dm9k_pdata = {
	.flags		= (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
};

static struct platform_device mini2440_device_eth = {
	.name		= "dm9000",
	.id		= -1,
	.num_resources	= ARRAY_SIZE(mini2440_dm9k_resource),
	.resource	= mini2440_dm9k_resource,
	.dev		= {
		.platform_data	= &mini2440_dm9k_pdata,
	},
};

重新编译内核 ,ifconfig eth0 发现由此设备

USB连接时,出现usb 1-1: device descriptor read/ 设备枚举失败,error -62,的意思时超时错误。从这里可以看出,系统应该是识别到了USB设备,但是设备却无法工作,而且可以断定是USB主机控制器的错误,时钟错误,也就是USB是时钟没有起来,对于2440,USB时钟需要工作在48M。修改内核源码:

修改drivers/usb/host/ohci-s3c2410.c
添加头文件:
#include<mach/regs-clock.h>
在函数s3c2410_start_hc中添加:
unsigned long upllvalue = (0x78<< 12) | (0x02<< 4) | (0x03);
while (upllvalue != __raw_readl(S3C2410_UPLLCON)) {
__raw_writel(upllvalue, S3C2410_UPLLCON);
mdelay(1);
}
在这里,S3C2410_UPLLCON的值为0xF4100008

猜你喜欢

转载自blog.csdn.net/qq_18737805/article/details/85251342