S3C6410 development Quanji Lu (III) "UBOOT added DM9000AE network card driver"

 UBOOT code we get is actually DM9000 network port driver located: driver / dm9000x.c

In S3C6410 configuration, and it will not open, while others have used chips

Of particular note is the dm9000 driving and dm9000AE still a difference, if you use the code that comes with dm9000 direct-driven process, the situation will not receive data

First, add dm9000AE drive

修改include/configs/smdk6410.h,参考 include/configs/scb9328.h 中的定义,添加如下宏定义
#define CONFIG_DRIVER_DM9000                1
#define CONFIG_DM9000_BASE          0x18000000
#define DM9000_IO                   CONFIG_DM9000_BASE
#define DM9000_DATA                 (CONFIG_DM9000_BASE+4)
#define CONFIG_DM9000_USE_16BIT

DM9000 base address (the value CONFIG_DRIVER_DM9000) associated with hardware design

View "OK6410 floor schematics .pdf", see, CS hanging on CSN1

View "s3c6410_rev12.pdf", 118 Ye, 2.2 DEVICE SPECIFIC ADDRESS SPACE, 0x1800_0000 0x1FFF_FFFF 128MB 1, SROMC Bank can determine the value of CONFIG_DM9000_BASE

View drivers / Makefile, you can see dm9000x the driver has been compiled into

 The entire driver / dm9000x.c code when the macro is defined by CONFIG_DRIVER_DM9000 determine its content

We can go forward with amended as follows some addresses might be used

#define CONFIG_ETHADDR          00:40:5c:26:0a:5b
#define CONFIG_NETMASK          255.255.255.0
#define CONFIG_IPADDR           192.168.30.233
#define CONFIG_SERVERIP         192.168.30.95

Second, modify DM9000 AE drive

View DM9000AE manual "DM9000AE.pdf", you can see, DM9000AE including, MAC, PHY, not with EEPROM, can be controlled by an external EEPROM pin

See page 11, 5.2 EEPROM Interface, see the operation of the DM9000 PIN EEPROM is 192,021 feet three

View "OK6410 floor schematics .pdf", see section 192 021 ethernet three PIN feet are vacant, the amount. . . This means we can not be saved by DM9000AE MAC address in the EEPROM

See "DM9000AE.pdf" 6. Vendor Control and Status Register Set this section, see PAR Physical Address Register 10H-15H This section is used to set the MAC address

That we must be the MAC address is written to these registers , let's do this, open the driver / dm9000x.c this document, see the code as follows

eth_init(bd_t * bd) 函数中

for (i = 0; i < 6; i++)
                ((u16 *) bd->bi_enetaddr)[i] = read_srom_word(i);
for (i = 0, oft = 0x10; i < 6; i++, oft++)
                DM9000_iow(oft, bd->bi_enetaddr[i]);

Testing can deal with it as do first, and then we go back into reading from other places, such as an external EEPROM, NANDFLASH, other places Well, after all, should not add other driver code in this simple card drive

u16 default_enetaddr[6] = { 0x00, 0x40, 0x5c, 0x26, 0x0a, 0x5b }; 
for (i = 0; i < 6; i++)
                bd->bi_enetaddr[i] = default_enetaddr[i];

If the MAC address to be modified to read from an environment variable, you can do so

{
	char *s, *e;
	s = getenv ("ethaddr");
	for (i = 0; i < 6; ++i) 
	{
		bd->bi_enetaddr[i] = s ? simple_strtoul (s, &e, 16) : 0;
		if (s)
			s = (*e) ? e + 1 : e;
	}
}

Modify the value of the register MAR (Multicast Address Register), the first reception error not corrected data

        for (i = 0, oft = 0x16; i < 8; i++, oft++)
                // by tr modify
                DM9000_iow(oft,0x00);
                //DM9000_iow(oft, 0xff);

Modify void eth_halt (void) function to comment out the following two lines, the correction has been unable to receive data error

        不要每次调用halt的时候都对PHY进行复位操作,否则会引起无法接受到数据的情况
        //phy_write(0, 0x8000); /* PHY RESET */
        //DM9000_iow(DM9000_GPR, 0x01); /* Power-Down PHY */


Find positioning ping fails, data can not be received or also issue a lot of people really a headache to see the results, can be found online with other descriptions are not quite the same, but also thanks to some code can refer to, these can the code to run successfully, step by step positioning, in the end are those where there is a problem.


Stated otherwise, such a chip DM9000 is MAC + PHY, there are a lot SOC have built-in MAC, PHY only plug on it

In general, in this case, the configuration of the PHY, mainly according to the hardware design, find the PHY ADDR, in OK6410 configuration PHYADDR 1, consistent with the code, there is no do any revised

 

Third, reference materials

"OK6410 floor schematics .pdf"
"s3c6410_rev12.pdf"
"DM9000AE.pdf"

Transplantation OK6410'S dm9000ae driven to the u-boot

http://lagignition.blog.163.com/blog/static/12873002320110443341961/

Linux DM9000 network card driver is fully analyzed

http://blog.csdn.net/ypoflyer/article/details/6209922

Summary dm9000ae transplant on the u-boot

http://weibing.blogbus.com/logs/12146712.html

Published 36 original articles · won praise 33 · Views 300,000 +

Guess you like

Origin blog.csdn.net/turui/article/details/6635509