uboot can't send package use ENET1 on my board

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

uboot can't send package use ENET1 on my board

714 Views
caibai
Contributor III

hi, my board is IMX6UL,i get code from git://git.freescale.com/imx/uboot-imx.git and change to branch origin/imx_v2016.03_4.1.15_2.0.0_ga,then i have some modify

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 2d12c0b..208df74 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -533,6 +533,33 @@ static int fec_open(struct eth_device *edev)
return 0;
}

+static int fec_printreg(struct ethernet_regs * reg){
+#define ETHER_REG_PRINT(_r) printf("%s = 0x%08x\r\n",#_r,(_r))
+ ETHER_REG_PRINT(reg->ievent);
+ ETHER_REG_PRINT(reg->imask);
+ ETHER_REG_PRINT(reg->r_des_active);
+ ETHER_REG_PRINT(reg->x_des_active);
+ ETHER_REG_PRINT(reg->ecntrl);
+ ETHER_REG_PRINT(reg->mii_data);
+ ETHER_REG_PRINT(reg->mii_speed);
+ ETHER_REG_PRINT(reg->mib_control);
+ ETHER_REG_PRINT(reg->r_cntrl);
+ ETHER_REG_PRINT(reg->x_cntrl);
+ ETHER_REG_PRINT(reg->paddr1);
+ ETHER_REG_PRINT(reg->paddr2);
+ ETHER_REG_PRINT(reg->op_pause);
+ ETHER_REG_PRINT(reg->iaddr1);
+ ETHER_REG_PRINT(reg->iaddr2);
+ ETHER_REG_PRINT(reg->gaddr1);
+ ETHER_REG_PRINT(reg->gaddr2);
+ ETHER_REG_PRINT(reg->x_wmrk);
+ //ETHER_REG_PRINT(reg->r_bound);
+ //ETHER_REG_PRINT(reg->r_fstart);
+ ETHER_REG_PRINT(reg->erdsr);
+ ETHER_REG_PRINT(reg->etdsr);
+ ETHER_REG_PRINT(reg->emrbr);
+ return 0;
+}
static int fec_init(struct eth_device *dev, bd_t* bd)
{
struct fec_priv *fec = (struct fec_priv *)dev->priv;
@@ -643,13 +670,13 @@ static int fec_send(struct eth_device *dev, void *packet, int length)
uint32_t addr;
int timeout = FEC_XFER_TIMEOUT;
int ret = 0;
-
/*
* This routine transmits one frame. This routine only accepts
* 6-byte Ethernet addresses.
*/
struct fec_priv *fec = (struct fec_priv *)dev->priv;
-
+ printf("%p---%d\r\n", fec->eth,length);
+ fec_printreg(fec->eth);
/*
* Check for valid length of data.
*/
@@ -764,7 +791,7 @@ static int fec_send(struct eth_device *dev, void *packet, int length)
ret = -EINVAL;

out:
- debug("fec_send: status 0x%x index %d ret %i\n",
+ printf("fec_send: status 0x%x index %d ret %i\n",
readw(&fec->tbd_base[fec->tbd_index].status),
fec->tbd_index, ret);
/* for next transmission use the other buffer */
@@ -797,7 +824,7 @@ static int fec_recv(struct eth_device *dev)
*/
ievent = readl(&fec->eth->ievent);
writel(ievent, &fec->eth->ievent);
- debug("fec_recv: ievent 0x%lx\n", ievent);
+ if(ievent) printf("fec_recv: ievent 0x%lx\n", ievent);
if (ievent & FEC_IEVENT_BABR) {
fec_halt(dev);
fec_init(dev, fec->bd);
diff --git a/include/configs/mx6ul_14x14_evk.h b/include/configs/mx6ul_14x14_evk.h
index 85b8b70..41f4e7e 100644
--- a/include/configs/mx6ul_14x14_evk.h
+++ b/include/configs/mx6ul_14x14_evk.h
@@ -120,6 +120,9 @@
"fdt_addr=0x83000000\0" \
"fdt_high=0xffffffff\0" \
"console=ttymxc0\0" \
+ "ethact=FEC0\0" \
+ "ethprime=FEC\0" \
+ "ipaddr=192.168.2.204\0" \
"bootargs=console=ttymxc0,115200 ubi.mtd=3 " \
"root=ubi0:rootfs rootfstype=ubifs " \
CONFIG_BOOTARGS_CMA_SIZE \
@@ -328,11 +331,11 @@
#ifdef CONFIG_CMD_NET
#define CONFIG_FEC_MXC
#define CONFIG_MII
-#define CONFIG_FEC_ENET_DEV 1
+#define CONFIG_FEC_ENET_DEV 0

#if (CONFIG_FEC_ENET_DEV == 0)
#define IMX_FEC_BASE ENET_BASE_ADDR
-#define CONFIG_FEC_MXC_PHYADDR 0x2
+#define CONFIG_FEC_MXC_PHYADDR 0x0
#define CONFIG_FEC_XCV_TYPE RMII
#elif (CONFIG_FEC_ENET_DEV == 1)
#define IMX_FEC_BASE ENET2_BASE_ADDR

i print some ENET1 regs value in fec_send and change CONFIG_FEC_MXC_PHYADDR from 0x2 to 0x0.

then ping my computer on uboot and it said that my computer is not alive

=> ping 192.168.2.1
Using FEC0 device
---eth_send 385---
02188000---42
reg->ievent = 0x00000000
reg->imask = 0x00000000
reg->r_des_active = 0x01000000
reg->x_des_active = 0x00000000
reg->ecntrl = 0xf0000102
reg->mii_data = 0x6016c5e1
reg->mii_speed = 0x0000001a
reg->mib_control = 0xc0000000
reg->r_cntrl = 0x05ee0124
reg->x_cntrl = 0x00000004
reg->paddr1 = 0x00112233
reg->paddr2 = 0x44558808
reg->op_pause = 0x00010020
reg->iaddr1 = 0x00000000
reg->iaddr2 = 0x00000000
reg->gaddr1 = 0x00000000
reg->gaddr2 = 0x00000000
reg->x_wmrk = 0x00000102
reg->erdsr = 0x9ef25280
reg->etdsr = 0x9ef25200
reg->emrbr = 0x00000600
fec_send: status 0xc00 index 0 ret 0
fec_recv: ievent 0xc000000


ping failed; host 192.168.2.1 is not alive

it print fec_send: status 0xc00 index 0 ret 0 ,does it mean package send success?

i cant capture any package on my computer by wireshark?

can anyone help me,i dont know what information to provide.if you need more information ,tell me please.

Labels (2)
0 Kudos
1 Reply

478 Views
Carlos_Musich
NXP Employee
NXP Employee

hello cai bai,

Please note that only Eth0 port is defined and enabled by default, this is why you cannot use both. You may enable the 2 ports in /etc/network/interfaces file. You may try first with static IP by adding the information below in such file.

 

For a DHCP client:

auto eth1

iface eth1 inet dhcp

For a Static IP (of course this is an example, your numbers will be different):

auto eth1

iface eth1 inet static

address 192.168.0.100

network 192.168.0.0

netmask 255.255.255.0

broadcast 192.168.0.255

gateway 192.168.0.1


Regards,
Carlos

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos