From patchwork Thu Feb 16 12:48:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 9577049 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1D18860244 for ; Thu, 16 Feb 2017 12:51:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 032852858D for ; Thu, 16 Feb 2017 12:51:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA831285BA; Thu, 16 Feb 2017 12:51:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 827922858D for ; Thu, 16 Feb 2017 12:51:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Henuo+gRvaWjCou78oDOkkfXG7+SG+OyYyoXF0wzu6Y=; b=Xh1W5o0I6dBvp403hg3+j8lLMi mcWw93PfFbbXiHe+WrNDfQ71dISDKV+bs3TAE9HizErmo9ww8YrV8+3WL4Jb+llwoEGsvfTBK0uCM 55EisVXdqGykAwBbaDkOzNkpy+Lhnlrmcx9afVFxxIVF7wdMxI0kkE6SbgyQDyYEU/bao2FjVp7z6 gQ3B3z6So/zorwUtFoWjKFYrE+C09TvKGa0Gz8CMJUNFr8AbhMArrqZA0dYavkqHt2vl2ksrnBEWt 8F1ABP2ayH9bD9t/KLSuWrOHfo2/gdwD+ggYat5AH3Uc09PaJZ6jUHwwXP3fKNQOeSqBaEBfaIGQz w9pE6Eig==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ceLXA-0001Nj-On; Thu, 16 Feb 2017 12:51:40 +0000 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ceLX7-0001L7-EO for linux-arm-kernel@lists.infradead.org; Thu, 16 Feb 2017 12:51:39 +0000 Received: by mail-wm0-x243.google.com with SMTP id c85so2988692wmi.1 for ; Thu, 16 Feb 2017 04:51:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=UZV0HSgf6wJw8mi6xYim/2aLezngXiEzcf4SJVmjG30=; b=aJOaH4Q12VKPmxEIG/CuU4d1PqoJsHbm3FSEotZ+lTp4+L1UpZfmcxZaJ7eLnViqp3 goK/l6e+zUNGOBnGA6ENCVtQu3/RPiXWEVssUl+bKHkY8BlS26Qzd4Etryf9NE5Y7jcU OgO/+Z39Jq+yzjqrDKFmCQh6vtB9avXaxMn4W+5VpTS4TY8TYGP8vAlz+GcQPi4VKRHC UIFwWDHTXX8dybjmtZjslnC68JFgXV4YOm9kJu2OT42xGSk3X5u76Gu3ZGeqo7Yu3EVA HXsWcugdogPTY5zkYGW5vwUu1m464caNwkN4plZiLlvO4791QwES/rQVmQPzYH8GNDqR /IiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=UZV0HSgf6wJw8mi6xYim/2aLezngXiEzcf4SJVmjG30=; b=AbXqbMhZPXXvVWlTisvRmndY4Li4ITVkhVMF9bYlebgfH/Sz1tSuSvOIiwBz6nZn+l APD/vLwS77iqjd1YG7+zc+dJkIMNu2qM2eEyFsXkB6R8oUtZnyKcgDt6E9B8Z6Z8q4P7 yZOfEMIs8YAacYLIUSWu6IAW1MBuxjiEWyuI9PedvSoF3baAS4nimBGtFWJv/7PQRAeL koZdSW/k8Z10hTT0BffcF3E7SXmDj1E0tF4SgQSLBBetKmxbRv3pSicqXmN98CDwcKPj 0y+D8CTfafRK57YmcYZ9T5gbz2+5YByL/X2/5yHsZBQ+9MNAx143zA5tSTEZMFhzjV7k ITAw== X-Gm-Message-State: AMke39kI62pDXghW05OtUG7TgFAnzzaQLxszRGLiDqvsSWsGCSCT8bNGWuhJEQHpVy2zjQ== X-Received: by 10.28.130.207 with SMTP id e198mr12269218wmd.4.1487249478764; Thu, 16 Feb 2017 04:51:18 -0800 (PST) Received: from Red.local (LFbn-1-7035-57.w90-116.abo.wanadoo.fr. [90.116.208.57]) by smtp.googlemail.com with ESMTPSA id o143sm144705wmd.3.2017.02.16.04.51.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 16 Feb 2017 04:51:18 -0800 (PST) From: Corentin Labbe To: peppe.cavallaro@st.com, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@free-electrons.com, wens@csie.org, linux@armlinux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, alexandre.torgue@st.com Subject: [PATCH 03/21] net-next: stmmac: add optional setup function Date: Thu, 16 Feb 2017 13:48:41 +0100 Message-Id: <20170216124859.14346-4-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170216124859.14346-1-clabbe.montjoie@gmail.com> References: <20170216124859.14346-1-clabbe.montjoie@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170216_045137_645840_16DC55A3 X-CRM114-Status: GOOD ( 12.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Corentin Labbe , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of ading more ifthen login for adding a new mac_device_info setup function, it is easier to add a function pointer to the function needed. Signed-off-by: Corentin Labbe --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 ++++++- include/linux/stmmac.h | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 942efb7..319394e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3117,7 +3117,12 @@ static int stmmac_hw_init(struct stmmac_priv *priv) struct mac_device_info *mac; /* Identify the MAC HW device */ - if (priv->plat->has_gmac) { + if (priv->plat->setup) { + mac = priv->plat->setup(priv->ioaddr, + priv->plat->multicast_filter_bins, + priv->plat->unicast_filter_entries, + &priv->synopsys_id); + } else if (priv->plat->has_gmac) { priv->dev->priv_flags |= IFF_UNICAST_FLT; mac = dwmac1000_setup(priv->ioaddr, priv->plat->multicast_filter_bins, diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index fc273e9..95ee4c4 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -136,6 +136,9 @@ struct plat_stmmacenet_data { void (*fix_mac_speed)(void *priv, unsigned int speed); int (*init)(struct platform_device *pdev, void *priv); void (*exit)(struct platform_device *pdev, void *priv); + struct mac_device_info *(*setup)(void __iomem *ioaddr, int mcbins, + int perfect_uc_entries, + int *synopsys_id); void *bsp_priv; struct clk *stmmac_clk; struct clk *pclk;