您的位置:首页 > 其它

u-boot1.1.6的移植 网卡支持

2009-12-24 14:05 330 查看
注:蓝色为修改部分!

driver/dm9000x.c中修改:

int
eth_init(bd_t * bd)
{
int i, oft, lnk;
DM9000_DBG("eth_init()/n");

// RESET device */
dm9000_reset();
dm9000_probe();

// NIC Type: FASTETHER, HOMERUN, LONGRUN */
identify_nic();

// GPIO0 on pre-activate PHY */
DM9000_iow(DM9000_GPR, 0x00);

// Set PHY */
set_PHY_mode();

// Program operating register */
DM9000_iow(DM9000_NCR, 0x0); // only intern phy supported by now */
DM9000_iow(DM9000_TCR, 0); // TX Polling clear */
DM9000_iow(DM9000_BPTR, 0x3f); // Less 3Kb, 200us */
DM9000_iow(DM9000_FCTR, FCTR_HWOT(3) | FCTR_LWOT(8)); // Flow Control : High/Low Water */
DM9000_iow(DM9000_FCR, 0x0); // SH FIXME: This looks strange! Flow Control */
DM9000_iow(DM9000_SMCR, 0); // Special Mode */
DM9000_iow(DM9000_NSR, NSR_WAKEST | NSR_TX2END | NSR_TX1END); // clear TX status */
DM9000_iow(DM9000_ISR, 0x0f); // Clear interrupt status */

// Set Node address */
//HJ_start // www.embedsky.net */
char *tmp = getenv("ethaddr");
char *end;

for (i = 0; i < 6; i++)
{
bd->bi_enetaddr[i] = tmp ? simple_strtoul(tmp, &end, 16) : 0;
if(tmp)
tmp = (*end) ? end+1 : end;
}
//HJ_end // www.embedsky.net */

printf("MAC: %02x:%02x:%02x:%02x:%02x:%02x/n", bd->bi_enetaddr[0],
bd->bi_enetaddr[1], bd->bi_enetaddr[2], bd->bi_enetaddr[3],
bd->bi_enetaddr[4], bd->bi_enetaddr[5]);
for (i = 0, oft = 0x10; i < 6; i++, oft++)
DM9000_iow(oft, bd->bi_enetaddr[i]);
for (i = 0, oft = 0x16; i < 8; i++, oft++)
DM9000_iow(oft, 0xff);

// read back mac, just to be sure */
for (i = 0, oft = 0x10; i < 6; i++, oft++)
DM9000_DBG("%02x:", DM9000_ior(oft));
DM9000_DBG("/n");

// Activate DM9000 */
DM9000_iow(DM9000_RCR, RCR_DIS_LONG | RCR_DIS_CRC | RCR_RXEN); // RX enable */
DM9000_iow(DM9000_IMR, IMR_PAR); // Enable TX/RX interrupt mask */

return 0;
}

driver/Makefile里修改:

COBJS = dm9000x.o

include/configs/jzy2440.h

//
* Hardware drivers
*/
#define CONFIG_DRIVER_DM9000 1
#define CONFIG_DM9000_BASE 0x20000300
#define DM9000_IO CONFIG_DM9000_BASE
#define DM9000_DATA (CONFIG_DM9000_BASE + 4)/*BASE+4 ;CMD接ADDR2*/

/*BASE+16;CMD接ADDR4*/
#define CONFIG_DM9000_USE_16BIT

#define CONFIG_BOOTDELAY 1
#define CONFIG_BOOTARGS "noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0"
#define CONFIG_ETHADDR 0a:1b:2c:3d:4e:5f
#define CONFIG_NETMASK 255.255.255.0
#define CONFIG_IPADDR 192.168.1.6
#define CONFIG_SERVERIP 192.168.1.8
#define CONFIG_BOOTCOMMAND "nboot 0x32000000 0 0x50000; bootm 0x32000000"
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: