[U-Boot] [PATCH v2 03/12] net: add Faraday FTMAC110 10/100Mbps ethernet support
Wolfgang Denk
wd at denx.de
Thu Apr 18 12:52:01 CEST 2013
Dear Kuo-Jung Su,
In message <1366277139-29728-4-git-send-email-dantesu at gmail.com> you wrote:
>
> +/*******************************************************************/
> +/* FTMAC110 DMA design issue */
> +/* Dante Su 2010.02.03 */
> +/* */
> +/* The DMA engine has a weird restriction that its Rx DMA engine */
> +/* accepts only 16-bits aligned address, 32-bits aligned is not */
> +/* acceptable. However this restriction does not apply to Tx DMA. */
> +/* Conclusion: */
> +/* (1) Tx DMA Buffer Address: */
> +/* 1 bytes aligned: Invalid */
> +/* 2 bytes aligned: O.K */
> +/* 4 bytes aligned: O.K (-> u-boot ZeroCopy is possible) */
> +/* (2) Rx DMA Buffer Address: */
> +/* 1 bytes aligned: Invalid */
> +/* 2 bytes aligned: O.K */
> +/* 4 bytes aligned: Invalid */
> +/*******************************************************************/
Incorrect multi-line comment style. Please fix globally.
> +/* Register access macros */
> +#define MAC_READ(r) le32_to_cpu(readl(r))
> +#define MAC_WRITE(v, r) writel(cpu_to_le32(v), r)
Please drop these and use the real functions instead.
> +static char ftmac110_mac_addr[] = { 0x00, 0x41, 0x71, 0x00, 0x00, 0x52 };
NAK. We do not allow static configuration of MAC addresses.
> + ulong ts;
> + uint32_t maccr;
> + uint16_t pa, tmp;
Are you sure using uint16_t gives more efficient code than a plain
int?
> + if (pa >= 32) {
> + puts("ftmac110: phy device not found!\n");
make this a debug() ?
...
> + MAC_WRITE(0x00001010, ®s->itc);
> + MAC_WRITE(0x00000001, ®s->aptc);
> + MAC_WRITE(0x00000390, ®s->dblac);
> + MAC_WRITE(0x000003FF, ®s->isr);
What do these magic numbers mean?
> +struct ftmac110_rxd {
> + /* RXDES0 */
> +#ifdef __ARMEB__
> + uint32_t owner:1; /* BIT: 31 - 1:Hardware, 0: Software */
> + uint32_t rsvd3:1;
> + uint32_t frs:1;
> + uint32_t lrs:1;
> + uint32_t rsvd2:5;
> + uint32_t error:5;
> + uint32_t bcast:1;
> + uint32_t mcast:1;
> + uint32_t rsvd1:5;
> + uint32_t len:11;
> +#else
> + uint32_t len:11;
> + uint32_t rsvd1:5;
> + uint32_t mcast:1;
> + uint32_t bcast:1;
> + uint32_t error:5;
> + uint32_t rsvd2:5;
> + uint32_t lrs:1;
> + uint32_t frs:1;
> + uint32_t rsvd3:1;
> + uint32_t owner:1; /* BIT: 31 - 1:Hardware, 0: Software */
> +#endif
NAK. Please do NOT use bit fields. They are non-portable and
dangerous.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
A year spent in artificial intelligence is enough to make one believe
in God.
More information about the U-Boot
mailing list