mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Oleksij Rempel <linux@rempel-privat.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v2 01/10] net: ath79: add ag71xx Ethernet driver
Date: Thu, 14 Sep 2017 08:44:58 +0200	[thread overview]
Message-ID: <20170914064458.3o4cgp6x4vb4opop@pengutronix.de> (raw)
In-Reply-To: <20170913141606.14508-2-linux@rempel-privat.de>

On Wed, Sep 13, 2017 at 04:15:57PM +0200, Oleksij Rempel wrote:
> +static void ag71xx_ether_halt(struct eth_device *edev)
> +{
> +	struct ag71xx *priv = edev->priv;
> +	struct device_d *dev = priv->dev;
> +	uint64_t start;
> +
> +	ag71xx_wr(priv, AG71XX_REG_RX_CTRL, 0);
> +	start = get_time_ns();
> +	while (ag71xx_rr(priv, AG71XX_REG_RX_CTRL)) {
> +		if (!is_timeout_non_interruptible(start, 100 * USECOND)) {
> +			dev_err(dev, "error: filed to stop device!\n");

s/filed/failed/

Also the test seems to be the wrong way round.

> +static int ag71xx_ether_init(struct eth_device *edev)
> +{
> +	struct ag71xx *priv = edev->priv;
> +	int i;
> +	void *rxbuf = priv->rx_buffer;
> +
> +	priv->next_rx = 0;
> +
> +	for (i = 0; i < NO_OF_RX_FIFOS; i++) {
> +		ag7240_desc_t *fr = &priv->fifo_rx[i];
> +
> +		priv->rx_pkt[i] = rxbuf;
> +		fr->pkt_start_addr = virt_to_phys(rxbuf);
> +		fr->pkt_size = MAX_RBUFF_SZ;
> +		fr->is_empty = 1;
> +		fr->next_desc = virt_to_phys(&priv->fifo_rx[(i + 1) % NO_OF_RX_FIFOS]);
> +
> +		/* invalidate */
> +		dma_sync_single_for_device((unsigned long)rxbuf, MAX_RBUFF_SZ,
> +					DMA_FROM_DEVICE);
> +
> +		rxbuf += MAX_RBUFF_SZ;
> +	}
> +
> +	/* Clean Tx BD's */
> +	memset(priv->fifo_tx, 0, TX_RING_SZ);
> +
> +	ag71xx_wr(priv, AG71XX_REG_RX_DESC, virt_to_phys(priv->fifo_rx));
> +	ag71xx_wr(priv, AG71XX_REG_RX_CTRL, RX_CTRL_RXE);
> +
> +	return 1;

Although the return code is not tested by the caller, this function
should return 0 for success.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2017-09-14  6:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-13 14:15 [PATCH v2 00/10] provide ethernet support for ar9344 and ar9331 Oleksij Rempel
2017-09-13 14:15 ` [PATCH v2 01/10] net: ath79: add ag71xx Ethernet driver Oleksij Rempel
2017-09-14  6:44   ` Sascha Hauer [this message]
2017-09-13 14:15 ` [PATCH v2 02/10] add ar9331.dtsi and enable mac0 Oleksij Rempel
2017-09-13 14:15 ` [PATCH v2 03/10] MIPS: dts: ar9344: add mac0 node Oleksij Rempel
2017-09-13 14:16 ` [PATCH v2 04/10] MIPS: dts: tl_wdr4300: enable mac0 Oleksij Rempel
2017-09-13 14:16 ` [PATCH v2 05/10] MIPS: dts: tl_wdr4300: add alias for spiflash Oleksij Rempel
2017-09-13 14:16 ` [PATCH v2 06/10] MIPS: dts: tl_wdr4300: remove RO flag from barebox partition Oleksij Rempel
2017-09-13 14:16 ` [PATCH v2 07/10] add phy: ar8327 driver Oleksij Rempel
2017-09-13 14:16 ` [PATCH v2 08/10] MIPS: dts: tl_wdr4300: rename it to tl_wdr4300 v1.7 Oleksij Rempel
2017-09-13 14:16 ` [PATCH v2 09/10] MIPS: tplink-wdr4300_defconfig: add network support Oleksij Rempel
2017-09-13 14:16 ` [PATCH v2 10/10] MIPS: dts: ar9344: add APB bus Oleksij Rempel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170914064458.3o4cgp6x4vb4opop@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=linux@rempel-privat.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox