Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1838289imm; Thu, 2 Aug 2018 01:44:13 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdesXU+YUyRo3DTpZKDMxxeUkl8W5D6H25lI143e9BSbdE7oUzbkQuZE6a6nQfsjvyuOpWh X-Received: by 2002:a17:902:e005:: with SMTP id ca5-v6mr1561222plb.224.1533199453450; Thu, 02 Aug 2018 01:44:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533199453; cv=none; d=google.com; s=arc-20160816; b=ZudAEWRtinvG4tAVFpDpznxkEYVjRcDWRvfy0hbqhOX3Lm4NHukcZGVLvojiuQubec gcS56e1YoHEkP++2Kejidy9vHfJUNm2Wx/2CzRbb+ttB2LlyT8ETY9zpgECQ+Czjcse9 5rSEZkDpUn7v8D856vvbnfHRcT2DobBUFgeU3aoXC0wVE7Ns3GBBACf8OxN8f/ertnfT ZyX/7d9IHyWx8OpWtPtOS4xqdzDqE3A0UI176iDxpHNzj+iO/XzuXga3yvLSZJuotky4 APuGo2O8x5iUiFahEoozC8iGHqdej5phQYsrE4JLegVkDI0rdW3xY84zvkFyJSy4bZop K1SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=Jex5bShoBENvnN9HpXMYmB/UJrRCVrkYWRT6EiLnQvA=; b=HEDSJ4Ch5VoIjP64U9MEYErMHFIWNeGpcBt35Vk9Dx53tW2Aq3PIdeXLm1b30dCcs9 U7mv2iOySM2W5xF2xStc/VJMXEOkQYGMNAsEd9P5reILY73VemKUmX/ZKeyyVuaCrsKD vT9mS3yszXFu+SvlZBppXseqar/0eMaPD1cYUUbns1zD6rimYVAWhOJNol5Rx87LwFJX QucXEk56AnV5dscVQbm60QDlmBQzRuwp15KgzpAam7b4uNbbLZojzXYSPqTWRY493V9O RtYrHnW/7hhh+4RB8hMKhC35mmEdUQPwWF+l8WlVkPGs4RRq5kul3WQdhX+0Y1pSl6vE VBuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@agner.ch header.s=dkim header.b=NAHnxrp0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r39-v6si1004808pld.218.2018.08.02.01.43.58; Thu, 02 Aug 2018 01:44:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@agner.ch header.s=dkim header.b=NAHnxrp0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730028AbeHBKdD (ORCPT + 99 others); Thu, 2 Aug 2018 06:33:03 -0400 Received: from mail.kmu-office.ch ([178.209.48.109]:47684 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726194AbeHBKdC (ORCPT ); Thu, 2 Aug 2018 06:33:02 -0400 Received: from trochilidae.toradex.int (unknown [46.140.72.82]) by mail.kmu-office.ch (Postfix) with ESMTPSA id 4DA075C0A80; Thu, 2 Aug 2018 10:42:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1533199373; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:content-type:content-transfer-encoding: in-reply-to:references; bh=Jex5bShoBENvnN9HpXMYmB/UJrRCVrkYWRT6EiLnQvA=; b=NAHnxrp0Heu4IEVk8znkiM6jz6INVctQTs5XrudSWcFVkBroVNzVMvapBF2Q5ZcPbQUjL0 10I2jM7wvdmpiAetYEMyawMj+lUptR4EhBQmza04hrXu+AQDbCM99pXMopb1j++AW1C4cV 0VWd6LkYjXoqFpUTAN/HbNh8aY4UAMo= From: Stefan Agner To: fugang.duan@nxp.com, davem@davemloft.net Cc: krzk@kernel.org, robin.murphy@arm.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Stefan Agner Subject: [PATCH v2] net: fec: check DMA addressing limitations Date: Thu, 2 Aug 2018 10:42:50 +0200 Message-Id: <20180802084250.26489-1-stefan@agner.ch> X-Mailer: git-send-email 2.18.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Stefan Agner --- 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; -- 2.18.0