OKe
U-Boot 1.1.6 (Nov 5 2010 - 09:50:08) for SMDK6410
CPU: S3C6410@532MHz
Fclk = 532MHz, Hclk = 133MHz, Pclk = 66MHz, Serial = CLKUART (SYNC Mode)
Board: SMDK6410
DRAM: 128 MB
Flash: 0 kB
NAND: 1024 MB
*** Warning - bad CRC or NAND, using default environment
In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 0
SMDK6410 # tftp c0008000 /Image_Nand
dm9000 i/o: 0x18000000, id: 0x90000a46
MAC: 00:40:5c:26:0a:5b
operating at 100M full duplex mode
TFTP from server 192.168.1.12; our IP address is 192.168.1.20
Filename '/Image_Nand'.
Load address: 0xc0008000
Loading: T T T
Abort
SMDK6410 # ping 192.168.1.12
dm9000 i/o: 0x18000000, id: 0x90000a46
MAC: 00:40:5c:26:0a:5b
operating at 100M full duplex mode
host 192.168.1.12 is alive
SMDK6410 # tftp c0008000 /Image_Nand
dm9000 i/o: 0x18000000, id: 0x90000a46
MAC: 00:40:5c:26:0a:5b
operating at 100M full duplex mode
TFTP from server 192.168.1.12; our IP address is 192.168.1.20
Filename '/Image_Nand'.
Load address: 0xc0008000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
##########
done
Bytes transferred = 4040704 (3da800 hex)
SMDK6410 #
這篇帖子是寫在OK6410開(kāi)發(fā)板的DM9000 10/100M網(wǎng)卡調(diào)試通過(guò)之后;上面的輸出信息是通過(guò)網(wǎng)卡下載內(nèi)核到mobile sdram的log。
板卡是飛凌設(shè)計(jì)的OK6410,默認(rèn)帶的u-boot居然不支持tftp,ping這些基本的東西。下載個(gè)內(nèi)核吭哧吭哧幾十分鐘,當(dāng)然也可以用USB會(huì)快很多,但是作者愛(ài)瞎折騰,要把這個(gè)爛東西調(diào)通,DM9000AE,嗬,不知道這世界上還有沒(méi)有人用這玩意。
修改smdk6410.h的以下代碼:
#ifdef CONFIG_DRIVER_SMC911X
#undef CONFIG_DRIVER_CS8900
#define CONFIG_DRIVER_SMC911X_BASE 0x18800300
#else
#define CONFIG_DRIVER_CS8900 0 /* we have a CS8900 on-board */
#define CS8900_BASE 0x18800300
#define CS8900_BUS16 1 /* the Linux driver does accesses as shorts */
#endif
改為:
#define CONFIG_DRIVER_DM9000 1
#define CONFIG_DM9000_BASE 0x18000000/*XM0CSN1*/
#define DM9000_DATA 0x18000004/*ADDR2*/
#define DM9000_IO CONFIG_DM9000_BASE
//#define CONFIG_DM9000_DEBUG 1
#define CONFIG_DM9000_USE_16BIT 1
一般的網(wǎng)卡甚至USB,藍(lán)牙芯片都會(huì)外接預(yù)留的EEPROM,用來(lái)存儲(chǔ)地址等配置信息;DM9000也不例外,默認(rèn)驅(qū)動(dòng)就是使用EEPROM存地址的,飛凌為了省錢,直接懸空,因此MAC地址需要從Nand Flash上面讀出來(lái),再寫到DM9000寄存器里。
從Linux2.6.28內(nèi)核中拷貝如下2個(gè)函數(shù),后面判斷空地址要用:
/**
* is_zero_ether_addr - Determine if give Ethernet address is all zeros.
* @addr: Pointer to a six-byte array containing the Ethernet address
*
* Return true if the address is all zeroes.
*/
static inline int is_zero_ether_addr(const u8 *addr)
{
return !(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]);
}
/**
* is_multicast_ether_addr - Determine if the Ethernet address is a multicast.
* @addr: Pointer to a six-byte array containing the Ethernet address
*
* Return true if the address is a multicast address.
* By definition the broadcast address is also a multicast address.
*/
static inline int is_multicast_ether_addr(const u8 *addr)
{
return (0x01 & addr[0]);
}
無(wú)數(shù)的先賢采用了以下代碼來(lái)設(shè)置MAC地址,外加空判斷,算是很排場(chǎng)了:
/* Set Node address */
#ifdef DM9000AE_ZENGJUN_SHARE
if (is_zero_ether_addr(bd->bi_enetaddr) ||
is_multicast_ether_addr(bd->bi_enetaddr)) {
/* try reading from environment */
u8 i;
char *s, *e;
s = getenv ("ethaddr");
for (i = 0; i < 6; ++i) {
bd->bi_enetaddr = s ?
simple_strtoul (s, &e, 16) : 0;
if (s)
s = (*e) ? e + 1 : e;
}
}
#else
for (i = 0; i < 6; i++)
((u16 *) bd->bi_enetaddr) = read_srom_word(i);
#endif
另外參考內(nèi)核代碼rx之前一定要讀兩次MRR,估計(jì)是芯片設(shè)計(jì)缺陷,沒(méi)什么理由:
#ifndef DM9000AE_ZENGJUN_SHARE
DM9000_ior(DM9000_MRRH);
DM9000_ior(DM9000_MRRL);
#endif
/* Check packet ready or not */
DM9000_ior(DM9000_MRCMDX); /* Dummy read */
最后,注空eth_halt函數(shù),一切OK;設(shè)置好網(wǎng)關(guān),服務(wù)器,就能下載內(nèi)核了。
默認(rèn)的是CS8900,有這個(gè)CS8900的好處是,他把XM0CSN1所在的BANK1初始化了,省的我再去配時(shí)序,下面是飛凌默認(rèn)設(shè)置時(shí)的u-boot輸出:OKs
U-Boot 1.1.6 (Nov 5 2010 - 10:29:09) for SMDK6410
CPU: S3C6410@532MHz
Fclk = 532MHz, Hclk = 133MHz, Pclk = 66MHz, Serial = CLKUART (SYNC Mode)
Board: SMDK6410
DRAM: 128 MB
Flash: 0 kB
NAND: 1024 MB
*** Warning - bad CRC or NAND, using default environment
In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 0
SMDK6410 # ping 192.168.1.10
CS8900 Ethernet chip not found?!
ping failed; host 192.168.1.10 is not alive
SMDK6410 # ping 192.168.1.10
CS8900 Ethernet chip not found?!
ping failed; host 192.168.1.10 is not alive
SMDK6410 #