netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <Nicolas.Ferre@microchip.com>
To: <antoine.tenart@bootlin.com>, <davem@davemloft.net>,
	<linux@armlinux.org.uk>
Cc: <andrew@lunn.ch>, <alexandre.belloni@bootlin.com>,
	<netdev@vger.kernel.org>, <thomas.petazzoni@bootlin.com>,
	<mparab@cadence.com>, <piotrs@cadence.com>,
	<dkangude@cadence.com>, <ewanm@cadence.com>,
	<arthurm@cadence.com>, <stevenh@cadence.com>
Subject: Re: [PATCH net-next v3 1/2] net: macb: move the Tx and Rx buffer initialization into a function
Date: Wed, 13 Nov 2019 09:20:21 +0000	[thread overview]
Message-ID: <745a8f2c-3571-5bbc-f4d7-f9a7857ac513@microchip.com> (raw)
In-Reply-To: <20191113090006.58898-2-antoine.tenart@bootlin.com>

On 13/11/2019 at 10:00, Antoine Tenart wrote:
> External E-Mail
> 
> 
> This patch moves the Tx and Rx buffer initialization into its own
> function. This does not modify the behaviour of the driver and will be
> helpful to convert the driver to phylink.
> 
> Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>

Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

> ---
>   drivers/net/ethernet/cadence/macb_main.c | 39 +++++++++++++++---------
>   1 file changed, 24 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index b884cf7f339b..1b3c8d678116 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -388,6 +388,27 @@ static int macb_mdio_write(struct mii_bus *bus, int mii_id, int regnum,
>   	return status;
>   }
>   
> +static void macb_init_buffers(struct macb *bp)
> +{
> +	struct macb_queue *queue;
> +	unsigned int q;
> +
> +	for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) {
> +		queue_writel(queue, RBQP, lower_32_bits(queue->rx_ring_dma));
> +#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
> +		if (bp->hw_dma_cap & HW_DMA_CAP_64B)
> +			queue_writel(queue, RBQPH,
> +				     upper_32_bits(queue->rx_ring_dma));
> +#endif
> +		queue_writel(queue, TBQP, lower_32_bits(queue->tx_ring_dma));
> +#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
> +		if (bp->hw_dma_cap & HW_DMA_CAP_64B)
> +			queue_writel(queue, TBQPH,
> +				     upper_32_bits(queue->tx_ring_dma));
> +#endif
> +	}
> +}
> +
>   /**
>    * macb_set_tx_clk() - Set a clock to a new frequency
>    * @clk		Pointer to the clock to change
> @@ -1314,26 +1335,14 @@ static void macb_hresp_error_task(unsigned long data)
>   	bp->macbgem_ops.mog_init_rings(bp);
>   
>   	/* Initialize TX and RX buffers */
> -	for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) {
> -		queue_writel(queue, RBQP, lower_32_bits(queue->rx_ring_dma));
> -#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
> -		if (bp->hw_dma_cap & HW_DMA_CAP_64B)
> -			queue_writel(queue, RBQPH,
> -				     upper_32_bits(queue->rx_ring_dma));
> -#endif
> -		queue_writel(queue, TBQP, lower_32_bits(queue->tx_ring_dma));
> -#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
> -		if (bp->hw_dma_cap & HW_DMA_CAP_64B)
> -			queue_writel(queue, TBQPH,
> -				     upper_32_bits(queue->tx_ring_dma));
> -#endif
> +	macb_init_buffers(bp);
>   
> -		/* Enable interrupts */
> +	/* Enable interrupts */
> +	for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue)
>   		queue_writel(queue, IER,
>   			     bp->rx_intr_mask |
>   			     MACB_TX_INT_FLAGS |
>   			     MACB_BIT(HRESP));
> -	}
>   
>   	ctrl |= MACB_BIT(RE) | MACB_BIT(TE);
>   	macb_writel(bp, NCR, ctrl);
> 


-- 
Nicolas Ferre

  reply	other threads:[~2019-11-13  9:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-13  9:00 [PATCH net-next v3 0/2] net: macb: convert to phylink Antoine Tenart
2019-11-13  9:00 ` [PATCH net-next v3 1/2] net: macb: move the Tx and Rx buffer initialization into a function Antoine Tenart
2019-11-13  9:20   ` Nicolas.Ferre [this message]
2019-11-13  9:00 ` [PATCH net-next v3 2/2] net: macb: convert to phylink Antoine Tenart
2019-11-13 19:46 ` [PATCH net-next v3 0/2] " David Miller

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=745a8f2c-3571-5bbc-f4d7-f9a7857ac513@microchip.com \
    --to=nicolas.ferre@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=antoine.tenart@bootlin.com \
    --cc=arthurm@cadence.com \
    --cc=davem@davemloft.net \
    --cc=dkangude@cadence.com \
    --cc=ewanm@cadence.com \
    --cc=linux@armlinux.org.uk \
    --cc=mparab@cadence.com \
    --cc=netdev@vger.kernel.org \
    --cc=piotrs@cadence.com \
    --cc=stevenh@cadence.com \
    --cc=thomas.petazzoni@bootlin.com \
    /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;
as well as URLs for NNTP newsgroup(s).