From patchwork Mon Apr 3 09:14:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 9659061 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 F170060352 for ; Mon, 3 Apr 2017 09:18:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E205A28437 for ; Mon, 3 Apr 2017 09:18:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D6DFE284BC; Mon, 3 Apr 2017 09:18:13 +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 9481D28437 for ; Mon, 3 Apr 2017 09:18:13 +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=VXEw1jvwAC02j8YN6aq5fcsRwuyptmNgw5d+zGWV/Wc=; b=UjSD2Iydmz+53HU3HysuwXWerc Hsk5f5EeQELCDMJsNA0sWJfExOVl42iLWsWWb1fZmwaINrRxcPdhY/6rkvNts1PO0I9thfzFMKfxw 66JqjXtfQB31ehYfsbr0MU/thYyGBL2/aLr+nkeQGU7vAGzoiQRn/uWdvCmiQc2sqyWpraBIjRj5t 6MFrWbS+DA1G1tADbSpjcVhq/taPyVotWFI8i4XHOrARDqbD3LYLphFRaet0o6C+hjqXRHxSqorb4 Qz9cRjVdLGnKKyq1M5zkNTZySFovcel2ENmvblKqB+1zble3Y1PZYQLKidCAnrPEHbU4BMqgLoSH2 OtZGhdTQ==; 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 1cuy7o-0003xR-Iv; Mon, 03 Apr 2017 09:18:12 +0000 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cuy79-00030a-HD for linux-arm-kernel@lists.infradead.org; Mon, 03 Apr 2017 09:17:34 +0000 Received: by mail-wr0-x244.google.com with SMTP id p52so31746659wrc.2 for ; Mon, 03 Apr 2017 02:17:11 -0700 (PDT) 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=hUO20YqIDR8BhjyUjRjg9OHzijDwuyGhmEzQJPztPgw=; b=J8bvIlEEoTS+woKrJyngrdtYGTASs3Vv9GUivYmPO3XOy87a1yy9X8ALJjmPYV3Js0 QuRzgJsCOX+oq2QDs6OnbMETX7feflfDWMmxaOH9le1FQfdOYYlYnmAh/tkygZjm9h6i xUn5PrEeUF7tAJnXFdjCfTfToRtyJkwNm/jPDtPPM+YtCT6svF7Q1RJ6vF+ia0mhZ9Ei hz/6Asz3F67WgyRhCJ5VguF1kYdAtO0DDdP8w4sxXAIABMZgBVLz3fW4QTthL19LDIxO R5ZQ8A5ib4uIMj5ZBodK1d0rEyK42ZcqIdjwtKqi4HM71ZFLIS2pT1dGiffakya1MABO g3iQ== 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=hUO20YqIDR8BhjyUjRjg9OHzijDwuyGhmEzQJPztPgw=; b=uDr/DhDWL20GNh+XtMk05ctJ0+qNdr9rMHYHHaPNz9dcgu3W2dzGKmJUWQWFdUIGcq xygLO3SICqU4UNMb6JXF7RCtBjN/RYPksUDvssC36b21Y2KtjrT8YIryZhhrpkTE4qeB F6WTGmYpBwCa3Io6X4eoe5E8MGHczJviAtJFtn/SBVeHA3C7JFb37S6hwQjAYI0R06Xf 9nJu48g1S9exWuu3UE+T6pv/0+8hciC7wcqKPLkywSHkETRGIhcuWmxoSrdcYLSMoQko 5htT9ld1vvTwQhZHzaCBnTqjsLix8iGFRKh7BtpzQk0MlKUzBLcczVW0xyts4/ySn8IH 39bA== X-Gm-Message-State: AFeK/H2JBdWKmMb45v0FFyMwIT3gJMM2Ejs65+sygl+0IgJd8UX06Yu+9kSkmbpIlSIDSg== X-Received: by 10.223.163.80 with SMTP id d16mr15150188wrb.36.1491211029855; Mon, 03 Apr 2017 02:17:09 -0700 (PDT) Received: from Red.local (LFbn-1-7035-57.w90-116.abo.wanadoo.fr. [90.116.208.57]) by smtp.googlemail.com with ESMTPSA id v14sm13457558wmv.24.2017.04.03.02.17.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 03 Apr 2017 02:17:09 -0700 (PDT) From: Corentin Labbe To: 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, peppe.cavallaro@st.com, alexandre.torgue@st.com Subject: [PATCH v3 02/20] net: stmmac: add optional setup function Date: Mon, 3 Apr 2017 11:14:26 +0200 Message-Id: <20170403091444.29876-3-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170403091444.29876-1-clabbe.montjoie@gmail.com> References: <20170403091444.29876-1-clabbe.montjoie@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170403_021731_812213_3DBD98E2 X-CRM114-Status: GOOD ( 12.77 ) 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, Corentin Labbe , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.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 adding more ifthen logic 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 | 4 +++- include/linux/stmmac.h | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 43361f3..3beca41 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3508,7 +3508,9 @@ 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); + } 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 3921cb9..dadd74b 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -144,6 +144,8 @@ struct stmmac_txq_cfg { u32 prio; }; +struct stmmac_priv; + struct plat_stmmacenet_data { int bus_id; int phy_addr; @@ -177,6 +179,7 @@ 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)(struct stmmac_priv *priv); void *bsp_priv; struct clk *stmmac_clk; struct clk *pclk;