From patchwork Tue Mar 14 14:18:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 9623509 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 7257E60492 for ; Tue, 14 Mar 2017 14:22:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6054D285A3 for ; Tue, 14 Mar 2017 14:22:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 532CA285B3; Tue, 14 Mar 2017 14:22:45 +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 D56BA285A3 for ; Tue, 14 Mar 2017 14:22:44 +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=qIksmZ51izj1aDZ6pRAyD3H6kzhJzzkhYIbsEPTXank=; b=jUkFdodSaQj+5GEPIT1un9NtkW TJJ2S5Vcy15f+nioux00JgbnVi0rHI2Hv/f5NzwNAidpVNkrGYpdnl2OovuRU2GfF+L27EXFINgN0 Y6VSs4jzpjAPkoJTXO7ueiJh6l0YomtK0BC0opVUBQOkmu/Ue+N9V3VKeNV/h+MGJAPImzQejdZJX ARhK3Vly1ZgXz3IwmDvTG+k/KqJAtis16bA3xAH3DGs/urcMwQiSD2OREZoc8jXuFUzcdk+kDhgSp aeQn9O6zTIV+xyZnsDKv+CXoZg+4UGaffFJwbzol1LO1L+1yO/Gd44rD3PwCLoGQZ+1GChOtoXBqQ YfK9joRg==; 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 1cnnLU-0007hy-EU; Tue, 14 Mar 2017 14:22:40 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cnnKR-0006sA-Tb for linux-arm-kernel@lists.infradead.org; Tue, 14 Mar 2017 14:21:37 +0000 Received: by mail-wm0-x242.google.com with SMTP id v190so31043wme.3 for ; Tue, 14 Mar 2017 07:21:15 -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=prIVlEuADBpXDucr/2o+afseodz8aM5Dzbjp3/oBFp0=; b=ITf+rKuVqo7uigmeXprQwnVh5YEutIIoggBLfUDvdI65NT0gFqqdN+RR0s6tHYu5sX gSVNHSAnzEVpq8fO7tndBiuaNPVpkKRppiKfhuVrxOAAbaMmlNpmp2ko2FBIwTQq9XWo gymR1zZDDpgF5y4lqPY/gQzM5+BSjJMPggKTg2r8nHz8Xz8TBn+oqteGzIPMSL08MnR8 5YygCowTQZD4uobFxuQgeVJbp3CwUfaGDESyM+a70Fao++gvsXHTipqokTdLOrQXs2ct wToF3aOhvOZNO13OipY+8xWdR4O9oZ2ZI0j6PbjHreV1LCmNdUDK/s3ru2Ijo1vPB7oi caNA== 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=prIVlEuADBpXDucr/2o+afseodz8aM5Dzbjp3/oBFp0=; b=S3LnsMUwocxW1Es5YmJ+XXE/zcZrrHaptnsdSb5p4wJfdV/mrGq9Vi6aQhia1dMgGG VrlV4czUiL39tsCytTkJI5wWCrKLYWjNVvjHUdjsKx8A1Gdd/BlRU4rVv5L36DHhk+t1 QoVo5M0IoQwXcUGwQlC6m3JmkBiT3PdBSYYOrcVwjrQDFASyyEdgKkR9f1+D4/rDdaxQ aLss8k6zcMLuZNTGUYanWsCe+9jQ3Zepd3oESP/V4CGBTXxgxpEnTqfXJcIfZ4TTUSYO dCw1plGV+u+4LSaAcCGLvAUYW85lucy+YiHC0dwiQFSbfUVRt3UP0hrfGOBu1RNAvy1h dSSg== X-Gm-Message-State: AFeK/H1rYGCAWb6EAtqkZfpOMjQ4m0B12C3Ym5HU2mv8ys/GeHPRkZjWJxP0iYdpslXMtw== X-Received: by 10.28.71.87 with SMTP id u84mr15128258wma.101.1489501274014; Tue, 14 Mar 2017 07:21:14 -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 o143sm49526wmd.3.2017.03.14.07.21.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Mar 2017 07:21:13 -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, davem@davemloft.net Subject: [PATCH v2 02/20] net-next: stmmac: add optional setup function Date: Tue, 14 Mar 2017 15:18:38 +0100 Message-Id: <20170314141856.24560-3-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170314141856.24560-1-clabbe.montjoie@gmail.com> References: <20170314141856.24560-1-clabbe.montjoie@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170314_072136_118062_ECE734A4 X-CRM114-Status: GOOD ( 12.94 ) 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, f.fainelli@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, 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 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 4498a38..856ac57 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3101,7 +3101,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 fc273e9..8f09f18 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -109,6 +109,8 @@ struct stmmac_axi { bool axi_rb; }; +struct stmmac_priv; + struct plat_stmmacenet_data { int bus_id; int phy_addr; @@ -136,6 +138,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;