[U-Boot] [PATCH v3 1/4] Add support for SMSC95XX USB 2.0 10/100MBit Ethernet Adapter

Andy Fleming afleming at gmail.com
Wed Apr 13 21:16:09 CEST 2011


> +       ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf);
> +       if (ret < 0) {
> +               debug("Failed to read HW_CFG: %d\n", ret);
> +               return ret;
> +       }
> +       debug("Read Value from HW_CFG: 0x%08x\n", read_buf);
> +
> +       if (turbo_mode)
> +               read_buf |= (HW_CFG_MEF_ | HW_CFG_BCE_);


I think you missed this one...


> +       read_buf &= ~HW_CFG_RXDOFF_;
> +
> +#ifdef CONFIG_TEGRA2
> +       /* Tegra2 requires NET_IP_ALIGN = 0 */
> +#define NET_IP_ALIGN 0
> +#else
> +       /* set Rx data offset=2, Make IP header aligns on word boundary. */
> +#define NET_IP_ALIGN 2
> +#endif
> +       read_buf |= NET_IP_ALIGN << 9;


This is usually a performance optimization, which isn't all that
useful in u-boot. And doesn't it mean that you can't rx directly into
the NetRxPackets array?

Also, more importantly, platform-specific code in the driver should be
avoided, if possible.  Either make NET_IP_ALIGN a config option, or
make whether you set it to 2 or 0 trigger on a driver-specific config
option.

Andy


More information about the U-Boot mailing list