linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Stefan Agner <stefan@agner.ch>, fugang.duan@nxp.com, davem@davemloft.net
Cc: krzk@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] net: fec: check DMA addressing limitations
Date: Thu, 2 Aug 2018 10:19:20 +0100	[thread overview]
Message-ID: <e03a908e-4c0d-a295-90a7-2da11c8fead5@arm.com> (raw)
In-Reply-To: <20180802084250.26489-1-stefan@agner.ch>

On 2018-08-02 9:42 AM, Stefan Agner wrote:
> Check DMA addressing limitations as suggested by the DMA API
> how-to. This does not fix a particular issue seen but is
> considered good style.

Reviewed-by: Robin Murphy <robin.murphy@arm.com>

> Signed-off-by: Stefan Agner <stefan@agner.ch>
> ---
>   drivers/net/ethernet/freescale/fec_main.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
> index c729665107f5..cdf2f5447910 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -3136,6 +3136,7 @@ static int fec_enet_init(struct net_device *ndev)
>   	unsigned dsize = fep->bufdesc_ex ? sizeof(struct bufdesc_ex) :
>   			sizeof(struct bufdesc);
>   	unsigned dsize_log2 = __fls(dsize);
> +	int ret;
>   
>   	WARN_ON(dsize != (1 << dsize_log2));
>   #if defined(CONFIG_ARM) || defined(CONFIG_ARM64)
> @@ -3146,6 +3147,13 @@ static int fec_enet_init(struct net_device *ndev)
>   	fep->tx_align = 0x3;
>   #endif
>   
> +	/* Check mask of the streaming and coherent API */
> +	ret = dma_set_mask_and_coherent(&fep->pdev->dev, DMA_BIT_MASK(32));
> +	if (ret < 0) {
> +		dev_warn(&fep->pdev->dev, "No suitable DMA available\n");
> +		return ret;
> +	}
> +
>   	fec_enet_alloc_queue(ndev);
>   
>   	bd_size = (fep->total_tx_ring_size + fep->total_rx_ring_size) * dsize;
> 

  parent reply	other threads:[~2018-08-02  9:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-02  8:42 [PATCH v2] net: fec: check DMA addressing limitations Stefan Agner
2018-08-02  9:14 ` Andy Duan
2018-08-02  9:19 ` Robin Murphy [this message]
2018-08-02 17:28 ` 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=e03a908e-4c0d-a295-90a7-2da11c8fead5@arm.com \
    --to=robin.murphy@arm.com \
    --cc=davem@davemloft.net \
    --cc=fugang.duan@nxp.com \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stefan@agner.ch \
    /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).