/* Check if the rx descriptor is ready */
invalidate_cache(port_info->rx_desc_cur, sizeof(struct rx_desc_s));
if (port_info->rx_desc_cur->rd0 & RD_RACT)
- return -EINVAL;
+ return -EAGAIN;
/* Check for errors */
if (port_info->rx_desc_cur->rd0 & RD_RFE)
- return -EINVAL;
+ return 0;
return port_info->rx_desc_cur->rd1 & 0xffff;
}
*packetp = packet;
return len;
- } else {
- len = 0;
+ }
- /* Restart the receiver if disabled */
- if (!(sh_eth_read(port_info, EDRRR) & EDRRR_R))
- sh_eth_write(port_info, EDRRR_R, EDRRR);
+ /* Restart the receiver if disabled */
+ if (!(sh_eth_read(port_info, EDRRR) & EDRRR_R))
+ sh_eth_write(port_info, EDRRR_R, EDRRR);
- return -EAGAIN;
- }
+ return len;
}
static int sh_ether_free_pkt(struct udevice *dev, uchar *packet, int length)