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"
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"
相关文章推荐
- u-boot2010.03 移植篇(三)-----进一步修改start.S,smdk6410.h,支持nand启动及配置DM9000网卡
- S5PV210 uboot-2012-10移植 之支持LAN9220网卡转载与补充
- u-boot-2011.03在TQ2440上的移植(6)--支持dm9000x网卡
- FL2440的U-boot-2009.08移植(四) 支持DM900网卡
- 天祥 TX2440 UBOOT移植(4. 支持网卡DM9000)
- 移植u-boot-2015.07-rc3之修改代码支持DM9000网卡(七)
- 移植u-boot-1.1.6之NOR的支持
- 移植uboot 1.1.6 到友善之臂 sbc2410上.(支持NAND)
- uboot1.1.6移植SDHC驱动、Fat支持
- l 移植u-boot之修改代码支持DM9000网卡-3.5
- u-boot-2016.05移植:(5)、支持DM9000网卡
- 4.移植uboot-使uboot支持DM9000网卡
- s5pv210 uboot-2012-10移植(五) 之支持LAN9220网卡
- 基于TQ2440的u-boot 1.1.6移植(二)(支持nor flash nand flash )
- 06-S3C2440学习之移植2012u-boot到S3C2440(移植过程四)支持Nand Flash+支持DM9000网卡
- U-Boot1.1.6移植DM9000网卡
- 移植u-boot-2012.04----支持DM9000网卡
- 移植u-boot学习笔记8-----修改代码之支持DM9000网卡
- 第一次移植uboot(3)(添加DM9000网卡支持)
- 移植uboot-1.1.6到勤研2440之二移植支持Nand Flash(和精智2440接近,仿照100ask24x0_config配置,重现韦东山的uboot-1.1.6_patch过程)