s5pv210 uboot-2012-10移植(五) 之支持LAN9220網卡

我的s5pv210開發板是100M的LAN9220網卡芯片,通過CS5的總線連接的,對應的地址空間是0xA8000000,16位的。

1.跟蹤代碼發現在smc9115_pre_init裏配置總線,board/samsung/smdkv210/smdkc100.c +36

/*
 * Miscellaneous platform dependent initialisations
 */
static void smc9115_pre_init(void)
{
#define SROM_BW  (*(volatile unsigned int *)0xE8000000)
#define SROM_BC5 (*(volatile unsigned int *)0xE8000018)
#define MP0_1CON (*(volatile unsigned int *)0xE02002E0)

#if 0
	u32 smc_bw_conf, smc_bc_conf;

	struct s5pc100_gpio *const gpio =
		(struct s5pc100_gpio *)samsung_get_base_gpio();

	/* gpio configuration GPK0CON */
	s5p_gpio_cfg_pin(&gpio->k0, CONFIG_ENV_SROM_BANK, GPIO_FUNC(2));

	/* Ethernet needs bus width of 16 bits */
	smc_bw_conf = SMC_DATA16_WIDTH(CONFIG_ENV_SROM_BANK);
	smc_bc_conf = SMC_BC_TACS(0x0) | SMC_BC_TCOS(0x4) | SMC_BC_TACC(0xe)
			| SMC_BC_TCOH(0x1) | SMC_BC_TAH(0x4)
			| SMC_BC_TACP(0x6) | SMC_BC_PMC(0x0);

	/* Select and configure the SROMC bank */
	s5p_config_sromc(CONFIG_ENV_SROM_BANK, smc_bw_conf, smc_bc_conf);
#endif

	unsigned int tmp;

	SROM_BW &= ~((0xf<<20));
	SROM_BW |= ((3<<20));
	
	tmp = MP0_1CON;
	tmp &= ~((0xf<<20)|(0xf<<12));
	tmp |= ((0x2<<20)|(0x2<<12));
	MP0_1CON = tmp;
}
2.跟蹤代碼,在board_eth_init函數裏,初始化LAN9220網卡,需要傳入CONFIG_SMC911X_BASE基地址

int board_eth_init(bd_t *bis)
{
	int rc = 0;
#ifdef CONFIG_SMC911X
	rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
	//printf ("rc: %d\n", rc);
#endif
	return rc;
}
修改include/configs/smdkv210.h +241

/*
 * Ethernet Contoller driver
 */
#ifdef CONFIG_CMD_NET
#define CONFIG_SMC911X         1       /* we have a SMC9115 on-board   */
#define CONFIG_SMC911X_16_BIT  1       /* SMC911X_16_BIT Mode          */
#define CONFIG_SMC911X_BASE    0xA8000000      /* SMC911X Drive Base   */
#define CONFIG_ENV_SROM_BANK   3       /* Select SROM Bank-3 for Ethernet*/
#endif /* CONFIG_CMD_NET */

3.make,把BL1和UBOOT燒寫到SD卡里,啓動,可以識別網卡芯片,使用ping 192.168.0.1會發現不支持ping命令


4.搜索代碼,發現需要配置CONFIG_CMD_PING,include/configs/smdkv210.h +246

#ifdef CONFIG_CMD_NET
#define CONFIG_SMC911X         1       /* we have a SMC9115 on-board   */
#define CONFIG_SMC911X_16_BIT  1       /* SMC911X_16_BIT Mode          */
#define CONFIG_SMC911X_BASE    0xA8000000      /* SMC911X Drive Base   */
#define CONFIG_ENV_SROM_BANK   3       /* Select SROM Bank-3 for Ethernet*/
#define CONFIG_CMD_PING
#endif /* CONFIG_CMD_NET */

5.make,把BL1和UBOOT燒寫到SD卡里,啓動,可以識別網卡芯片,使用ping 192.168.0.1會發先錯誤,沒有設置網卡物理地址和板子的ip地址


6.設置環境變量,ping


7.每次重啓後都需要重新配置,很麻煩的, include/configs/smdkv210.h +248

#define CONFIG_NETMASK		255.255.255.0
#define CONFIG_IPADDR		192.168.0.89
#define CONFIG_SERVERIP		192.168.0.88
#define CONFIG_ETHADDR          00:40:5c:26:0a:5b
#define CONFIG_GATEWAYIP        192.168.0.1

8.make,燒寫到SD卡中,上電,ping可以從控制檯裏看到,在通過tftp命令從服務器端下載uImage,或者可以printenv看看有沒有在環境變量裏設定。


                                                                                                                      

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章