From patchwork Tue Jul 28 22:08:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joachim Eastwood X-Patchwork-Id: 6888581 Return-Path: X-Original-To: patchwork-linux-rockchip@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E73ECC05AC for ; Tue, 28 Jul 2015 22:09:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1BA4020778 for ; Tue, 28 Jul 2015 22:09:56 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 411DE2027D for ; Tue, 28 Jul 2015 22:09:55 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZKD4M-0003AI-TJ; Tue, 28 Jul 2015 22:09:54 +0000 Received: from mail-lb0-x22f.google.com ([2a00:1450:4010:c04::22f]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZKD4K-0002y2-Jh for linux-rockchip@lists.infradead.org; Tue, 28 Jul 2015 22:09:53 +0000 Received: by lblf12 with SMTP id f12so83957658lbl.2 for ; Tue, 28 Jul 2015 15:09:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5IrzZngg4F76kNRElGzOm+fP5Zcqdr/6wLrGsCsyY64=; b=i6moq6OUD9qTrosRHdtID36ZJbRgwhV/RF2njPE5O7NmUGXMIMA2ATVHFwPG/2Zxzw C6WRAMDkDqGPGw9KspzErqJsrZ+62kD8MEf9iBQ3Y1FnAfjBdgTQd2NXRaqURqc6/2Qe YFYJCkol2855KyYOghQhmcbZqm0d1VnYfZMu5dSpEPP1QQQ01E+KG9UoDtMxKDui9iHB 6kp2Le2+aQV/dOtv1HllI2kmpmbjQGcmjHVkMYVzR7a3hMZwDeVF5zf8ZI/GWhJRhWmG LtbP15WlyAYqf2HuiY89bXlvcDgfV+FNiHpgbbV7u3WjjG2ueJyCA/hDhhpEAm/bQsor yUqA== X-Received: by 10.153.7.137 with SMTP id dc9mr34847312lad.16.1438121370454; Tue, 28 Jul 2015 15:09:30 -0700 (PDT) Received: from localhost.localdomain ([89.11.213.141]) by smtp.gmail.com with ESMTPSA id kv1sm4913123lbb.48.2015.07.28.15.09.29 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 28 Jul 2015 15:09:29 -0700 (PDT) From: Joachim Eastwood To: peppe.cavallaro@st.com, heiko@sntech.de, roger.chen@rock-chips.com, davem@davemloft.net Subject: [PATCH net-next 09/17] stmmac: dwmac-rk: create a new probe function Date: Wed, 29 Jul 2015 00:08:56 +0200 Message-Id: <1438121344-5304-10-git-send-email-manabian@gmail.com> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1438121344-5304-1-git-send-email-manabian@gmail.com> References: <1438121344-5304-1-git-send-email-manabian@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150728_150952_854140_58409016 X-CRM114-Status: GOOD ( 10.70 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, Joachim Eastwood , linux-rockchip@lists.infradead.org MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Create a new probe functions that call the necessary setup functions. This is done in preparation for a code refactor in this driver and dropping the common probe function in stmmac_platform.c. Signed-off-by: Joachim Eastwood --- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 40 ++++++++++++++++++++------ 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c index 00a1e1e09d4f..21193a73acfc 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c @@ -576,20 +576,42 @@ static void rk_fix_speed(void *priv, unsigned int speed) dev_err(dev, "unsupported interface %d", bsp_priv->phy_iface); } +static int rk_gmac_probe(struct platform_device *pdev) +{ + struct plat_stmmacenet_data *plat_dat; + struct stmmac_resources stmmac_res; + int ret; + + ret = stmmac_get_platform_resources(pdev, &stmmac_res); + if (ret) + return ret; + + plat_dat = stmmac_probe_config_dt(pdev, &stmmac_res.mac); + if (IS_ERR(plat_dat)) + return PTR_ERR(plat_dat); + + plat_dat->has_gmac = true; + plat_dat->init = rk_gmac_init; + plat_dat->exit = rk_gmac_exit; + plat_dat->fix_mac_speed = rk_fix_speed; + + plat_dat->bsp_priv = plat_dat->setup(pdev); + if (IS_ERR(plat_dat->bsp_priv)) + return PTR_ERR(plat_dat->bsp_priv); + + ret = rk_gmac_init(pdev, plat_dat->bsp_priv); + if (ret) + return ret; + + return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); +} + static const struct stmmac_of_data rk3288_gmac_data = { - .has_gmac = 1, - .fix_mac_speed = rk_fix_speed, .setup = rk3288_gmac_setup, - .init = rk_gmac_init, - .exit = rk_gmac_exit, }; static const struct stmmac_of_data rk3368_gmac_data = { - .has_gmac = 1, - .fix_mac_speed = rk_fix_speed, .setup = rk3368_gmac_setup, - .init = rk_gmac_init, - .exit = rk_gmac_exit, }; static const struct of_device_id rk_gmac_dwmac_match[] = { @@ -600,7 +622,7 @@ static const struct of_device_id rk_gmac_dwmac_match[] = { MODULE_DEVICE_TABLE(of, rk_gmac_dwmac_match); static struct platform_driver rk_gmac_dwmac_driver = { - .probe = stmmac_pltfr_probe, + .probe = rk_gmac_probe, .remove = stmmac_pltfr_remove, .driver = { .name = "rk_gmac-dwmac",