您的位置:首页 > 其它

S5PV210 uboot-2012-10移植 之支持LAN9220网卡转载与补充

2014-08-07 18:37 465 查看
开发板是100M的LAN9220网卡芯片,通过CS5的总线连接的,对应的地址空间是0xA8000000,16位的,如图:



首先解释基地址确定:

原文:http://blog.sina.com.cn/s/blog_621dafdb0100v3yg.html

“DM9000对外来说只有两个端口——地址口和数据口,地址口用于输入内部寄存器的地址,而数据口则完成对某一寄存器的读写。DM9000的CMD引脚用来区分这两个端口,当CMD引脚为0时,DM9000的数据线上传输的是寄存器地址,当CMD引脚为1时,传输的是读写数据。我们把DM9000的AEN接到s3c2440的nGCS4引脚上,则DM9000的端口基址为0x20000300,如果再把DM9000的CMD引脚接到s3c2440的ADDR2引脚上”
我们所说的地址:0x20000000 和 0x20000004是由ARM芯片的地址引脚决定的,注意,这个地址表示是用的16进制,那么,0x20000004的每一位的值都可以是0~f,它由ARM的4根地址线的电平高,比如最低的一位,就是由ADDR3~ADDR0 这4个引脚的电平决定,如果 ADDR3~ADDR0 = 1111,则该位为f ,如果LADDR3~LADDR0 = 0100,则该位为 4
因此,如果将DM9000的CMD引脚接到s3c2440的ADDR2,由于CMD引脚的高低电平决定地址口和数据口,那么,ADDR2为0时,访问的就是地址口,所以地址口的起始地址为ARRD2为0的情况,即0x20000000 ;ADDR2为1时,(LADDR3~LADDR0 =0100)访问的就是数据口,所以数据口的地址即 0x20000004。

根据上述结论查阅S5PV210手册:



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

<pre name="code" class="html">#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   5       /* Select SROM Bank-3 for Ethernet*/
#define CONFIG_CMD_PING
#define CONFIG_NETMASK      255.255.255.0
#define CONFIG_IPADDR       192.168.1.101
#define CONFIG_SERVERIP     192.168.1.100
#define CONFIG_ETHADDR     00:40:5c:26:0a:5b
#define CONFIG_GATEWAYIP    192.168.1.1
#endif /* CONFIG_CMD_NET */




<pre name="code" class="html">CONFIG_NETMASK  填写MASK地址
<pre name="code" class="html"><pre name="code" class="html">CONFIG_IPADDR      开发板地址



<pre name="code" class="html">CONFIG_SERVERIP    tftpboot目标机地址


<pre name="code" class="html">CONFIG_ETHADDR    物理地址
<pre name="code" class="html"><pre name="code" class="html">CONFIG_GATEWAYIP   网关地址(一般是路由器地址)








最后结果:



本文是个人理解,在别人多篇文章基础上补充修正,并不代表原著观点。

参考博文:http://blog.csdn.net/xiaojiaohuazi/article/details/8285054
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: