From patchwork Sun Nov 29 21:59:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrien Grassein X-Patchwork-Id: 334636 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_INVALID, DKIM_SIGNED, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C888FC3E8C5 for ; Sun, 29 Nov 2020 22:01:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 72E98206F9 for ; Sun, 29 Nov 2020 22:01:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KRAtgg0h" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728362AbgK2WBE (ORCPT ); Sun, 29 Nov 2020 17:01:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726304AbgK2WBD (ORCPT ); Sun, 29 Nov 2020 17:01:03 -0500 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AD5EC0613CF; Sun, 29 Nov 2020 14:00:23 -0800 (PST) Received: by mail-wr1-x442.google.com with SMTP id s8so12835201wrw.10; Sun, 29 Nov 2020 14:00:23 -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 :mime-version:content-transfer-encoding; bh=pK9Ea/lgfc3fvgVFGg7cOxa+M9VALejH1ACdbsPKEMs=; b=KRAtgg0hzXOZxVS59NHBhpHOhG9Y9rIM0498RODGWISfOJvYCPTtE1HNUOAlm/tVJM lIL/AdC8S/7SY0luV1cuPsHQdVkJRRxk6Ie+zM1LlHJWSXa83F2r4nHFi8Yi0Tc5g8Io ksFL1a/vsj/U/O3Ez1YpAl5Jgyl9rOQzADqp91GWC6cBqkqzVTPqhUyBvWeq3EBE/UyG 26sLDscyH6thWo8DdjfK047YRJTSaVS8qzk2YVNaEzdY+/BFW4QlwzZVHRnJONAyS1Tg dLKHfB1dkXDHHJuXi63P3FfueS83o7qhFcOS7ZO8c+CHL+SfEeOFtTac5UYF4ePuscyC RQFQ== 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:mime-version:content-transfer-encoding; bh=pK9Ea/lgfc3fvgVFGg7cOxa+M9VALejH1ACdbsPKEMs=; b=VMPu3Vqct/mjBffcHRo11VbUWpwGINpIhgNucw3cEmRANNv88P1YvBQ/61lE/+kT6b Pn3y85egfTYHyaJekuZAGfD/LoqtXhNNOPCzHdhKQONSDEHNOSAbNucUlSmEkoLOe5Ru TSXaUlSf8n8UgdZMkRtiCGrLCQVA7zyQDPNOEahxNMiwtYKeb0m1mMIq2sr73KxD0uzA /lyuOqVtYQj8eWcNCKaDqsSCpmfdRbAHjp3lVfLCUG6aROU3zwOSAmj0NmQuo+Hfgn5x FdN24Q2l79+jYDwNa/mrAnjatoY88XjiF6ljyErnrJi9wRTMa4cjPbdXZtyABq9uOPJA htXQ== X-Gm-Message-State: AOAM533hIef5EufMOLFoQ/4ox9JjxBEdqMOIBY2aXBNe1bXwD9IfpHnm oxg9jWYglfWkLxe4zuQ6mb0= X-Google-Smtp-Source: ABdhPJx5M4ah82QopUDttcRrjU+9UwtDA2W6mq8D6gp/WYVTb2oi4QvdYVcx+Dji0qHlQXg04kBbLQ== X-Received: by 2002:adf:a495:: with SMTP id g21mr24207576wrb.213.1606687221985; Sun, 29 Nov 2020 14:00:21 -0800 (PST) Received: from adgra-XPS-15-9570.home (lfbn-idf1-1-1007-144.w86-238.abo.wanadoo.fr. [86.238.83.144]) by smtp.gmail.com with ESMTPSA id b4sm4938080wrr.30.2020.11.29.14.00.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2020 14:00:21 -0800 (PST) From: Adrien Grassein Cc: fugang.duan@nxp.com, davem@davemloft.net, kuba@kernel.org, robh+dt@kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Adrien Grassein Subject: [PATCH v2 1/3] dt-bindings: net: fsl-fec add mdc/mdio bitbang option Date: Sun, 29 Nov 2020 22:59:58 +0100 Message-Id: <20201129220000.16550-1-adrien.grassein@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201128225425.19300-1-adrien.grassein@gmail.com> References: <20201128225425.19300-1-adrien.grassein@gmail.com> MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Add dt-bindings explanation for the two new gpios (mdio and mdc) used for bitbanging. Signed-off-by: Adrien Grassein --- Documentation/devicetree/bindings/net/fsl-fec.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/net/fsl-fec.txt b/Documentation/devicetree/bindings/net/fsl-fec.txt index 9b543789cd52..e9fa992354b7 100644 --- a/Documentation/devicetree/bindings/net/fsl-fec.txt +++ b/Documentation/devicetree/bindings/net/fsl-fec.txt @@ -22,6 +22,10 @@ Optional properties: - fsl,err006687-workaround-present: If present indicates that the system has the hardware workaround for ERR006687 applied and does not need a software workaround. +- mdc-gpios: Bitbanged MDIO Management Data Clock GPIO. If specified, +mdio-gpios should be specified too. +- mdio-gpios: Bitbanged MDIO Management Data I/O GPIO. If specified, +mdc-gpios should be specified too. - fsl,stop-mode: register bits of stop mode control, the format is <&gpr req_gpr req_bit>. gpr is the phandle to general purpose register node. From patchwork Sun Nov 29 21:59:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrien Grassein X-Patchwork-Id: 334635 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_INVALID, DKIM_SIGNED, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA5B9C71156 for ; Sun, 29 Nov 2020 22:01:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8B21120731 for ; Sun, 29 Nov 2020 22:01:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Agh+1b1k" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387444AbgK2WBL (ORCPT ); Sun, 29 Nov 2020 17:01:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726304AbgK2WBK (ORCPT ); Sun, 29 Nov 2020 17:01:10 -0500 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B581C0613D2; Sun, 29 Nov 2020 14:00:24 -0800 (PST) Received: by mail-wr1-x443.google.com with SMTP id 64so12853831wra.11; Sun, 29 Nov 2020 14:00:24 -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 :mime-version:content-transfer-encoding; bh=r1yObcQmDY+rcui/F/ddL0tVwxck2QNldFYHUzPVNPg=; b=Agh+1b1kpWlXn82GtB429YNKonao80rkD35sq5FECX0joaWoTcm8PwB0IJRD5CMLHU fVnCe8tyLLLRG8A0YtC+b6oouFzVBSfwOFoeJymPiHJ0GDb1YzxRmZbX2ZjxS3eUueeD NaJC9m72soNnK8xcD2c/ytejiWGmoISz0nntT+2NAYgwc1J86TsfScmXdgsOD5cvl9cj leGKbsr715HpPvs9UVbqV9kr2dWHQKToLPOTGWLEIV6sfz5K6FVFyVkgWF2sdmKSgyCS 4euwVnBUQ1wn9l0K4x8R3r1LsVjyn26biamELKY3alW18lxLp6za27dug6Jo2Yp3c8P9 +luw== 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:mime-version:content-transfer-encoding; bh=r1yObcQmDY+rcui/F/ddL0tVwxck2QNldFYHUzPVNPg=; b=oZY5wr+8WZrRQVg44zLF7DXuAPtfI1iuQqbx9qDcshUdTXpeQKcdyjtUW/oBOjSK3V Gy8jE1XFSRg0VFtqYrkj1H74cowGF68lii54XAvpgoouARQWQhkKyRn1D/7ZQgfgzGlt 9r8sbIljqN4hEOsZhL8Ib8ShPKWS0NpMmTNutdQaTbsHYmhRQzAeoYM3fVGrosUmeqqW TTl1f7tQW5QPvy5mHApDwOejVjq51ujMeGF+WNk7BR2QX/Av96fLSt26nF9c21SIovGS CHIRkRza0R5YJEmbLTJYUYRf5A/AzAL+JW8AP3dNjk1Q4R9R/UpM30h00p5nQSzKR3Xm WLSA== X-Gm-Message-State: AOAM531/lzrGKP7N/lpKM1HQjoadorl8Q4wdi+ItDFdhO7SaqhuMBKdp FbwFprE5h/8Xnpsx81vHs2E= X-Google-Smtp-Source: ABdhPJx1yz+2AVnxHq02yqnus3m5+/ueIjFeQKydwgj6mpUoPjmn2fd+ouFHsO1BruNo6G5S3mo12g== X-Received: by 2002:adf:e84e:: with SMTP id d14mr23526282wrn.190.1606687222828; Sun, 29 Nov 2020 14:00:22 -0800 (PST) Received: from adgra-XPS-15-9570.home (lfbn-idf1-1-1007-144.w86-238.abo.wanadoo.fr. [86.238.83.144]) by smtp.gmail.com with ESMTPSA id b4sm4938080wrr.30.2020.11.29.14.00.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2020 14:00:22 -0800 (PST) From: Adrien Grassein Cc: fugang.duan@nxp.com, davem@davemloft.net, kuba@kernel.org, robh+dt@kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Adrien Grassein Subject: [PATCH v2 2/3] net: fsl: fec: add mdc/mdio bitbang option Date: Sun, 29 Nov 2020 22:59:59 +0100 Message-Id: <20201129220000.16550-2-adrien.grassein@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201129220000.16550-1-adrien.grassein@gmail.com> References: <20201128225425.19300-1-adrien.grassein@gmail.com> <20201129220000.16550-1-adrien.grassein@gmail.com> MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch adds the ability for the fec to use the mdc/mdio bitbang protocol to communicate with its phy. It adds two new optional parameters in the devicetree definition for the two needed GPIO (mdc and mdio). It uses the mdio-bitbang generic implementation. Signed-off-by: Adrien Grassein --- drivers/net/ethernet/freescale/fec.h | 5 ++ drivers/net/ethernet/freescale/fec_main.c | 101 +++++++++++++++++++--- 2 files changed, 95 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h index c527f4ee1d3a..84bf9be4c6f5 100644 --- a/drivers/net/ethernet/freescale/fec.h +++ b/drivers/net/ethernet/freescale/fec.h @@ -15,6 +15,7 @@ /****************************************************************************/ #include +#include #include #include #include @@ -590,6 +591,10 @@ struct fec_enet_private { int pps_enable; unsigned int next_counter; + struct mdiobb_ctrl fec_main_bb_ctrl; + struct gpio_desc *gd_mdc; + struct gpio_desc *gd_mdio; + u64 ethtool_stats[]; }; diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 04f24c66cf36..4f22c8e3fe7e 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -2050,6 +2050,48 @@ static int fec_enet_mii_probe(struct net_device *ndev) return 0; } +static void fec_main_bb_ctrl_set_mdc(struct mdiobb_ctrl *ctrl, int level) +{ + struct fec_enet_private *fep = container_of(ctrl, + struct fec_enet_private, fec_main_bb_ctrl); + if (level) + gpiod_direction_input(fep->gd_mdc); + else + gpiod_direction_output(fep->gd_mdc, 0); +} + +static void fec_main_bb_ctrl_set_mdio_dir(struct mdiobb_ctrl *ctrl, int output) +{ + struct fec_enet_private *fep = container_of(ctrl, + struct fec_enet_private, fec_main_bb_ctrl); + if (output) + gpiod_direction_output(fep->gd_mdio, 0); + else + gpiod_direction_input(fep->gd_mdio); +} + +static void fec_main_bb_ctrl_set_mdio_data(struct mdiobb_ctrl *ctrl, int value) +{ + struct fec_enet_private *fep = container_of(ctrl, + struct fec_enet_private, fec_main_bb_ctrl); + gpiod_direction_output(fep->gd_mdio, value); +} + +static int fec_main_bb_ctrl_get_mdio_data(struct mdiobb_ctrl *ctrl) +{ + struct fec_enet_private *fep = container_of(ctrl, + struct fec_enet_private, fec_main_bb_ctrl); + return gpiod_get_value(fep->gd_mdio); +} + +static const struct mdiobb_ops fec_main_bb_ops = { + .owner = THIS_MODULE, + .set_mdc = fec_main_bb_ctrl_set_mdc, + .set_mdio_dir = fec_main_bb_ctrl_set_mdio_dir, + .set_mdio_data = fec_main_bb_ctrl_set_mdio_data, + .get_mdio_data = fec_main_bb_ctrl_get_mdio_data, +}; + static int fec_enet_mii_init(struct platform_device *pdev) { static struct mii_bus *fec0_mii_bus; @@ -2150,18 +2192,27 @@ static int fec_enet_mii_init(struct platform_device *pdev) /* Clear any pending transaction complete indication */ writel(FEC_ENET_MII, fep->hwp + FEC_IEVENT); - fep->mii_bus = mdiobus_alloc(); - if (fep->mii_bus == NULL) { - err = -ENOMEM; - goto err_out; - } + if (fep->gd_mdc && fep->gd_mdio) { + fep->fec_main_bb_ctrl.ops = &fec_main_bb_ops; + fep->mii_bus = alloc_mdio_bitbang(&fep->fec_main_bb_ctrl); + if (!fep->mii_bus) { + err = -ENOMEM; + goto err_out; + } + } else { + fep->mii_bus = mdiobus_alloc(); + if (!fep->mii_bus) { + err = -ENOMEM; + goto err_out; + } + fep->mii_bus->read = fec_enet_mdio_read; + fep->mii_bus->write = fec_enet_mdio_write; - fep->mii_bus->name = "fec_enet_mii_bus"; - fep->mii_bus->read = fec_enet_mdio_read; - fep->mii_bus->write = fec_enet_mdio_write; + fep->mii_bus->priv = fep; + } snprintf(fep->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x", pdev->name, fep->dev_id + 1); - fep->mii_bus->priv = fep; + fep->mii_bus->name = "fec_enet_mii_bus"; fep->mii_bus->parent = &pdev->dev; err = of_mdiobus_register(fep->mii_bus, node); @@ -2178,7 +2229,10 @@ static int fec_enet_mii_init(struct platform_device *pdev) return 0; err_out_free_mdiobus: - mdiobus_free(fep->mii_bus); + if (fep->gd_mdc && fep->gd_mdio) + free_mdio_bitbang(fep->mii_bus); + else + mdiobus_free(fep->mii_bus); err_out: return err; } @@ -2187,7 +2241,10 @@ static void fec_enet_mii_remove(struct fec_enet_private *fep) { if (--mii_cnt == 0) { mdiobus_unregister(fep->mii_bus); - mdiobus_free(fep->mii_bus); + if (fep->gd_mdc && fep->gd_mdio) + free_mdio_bitbang(fep->mii_bus); + else + mdiobus_free(fep->mii_bus); } } @@ -3525,6 +3582,8 @@ fec_probe(struct platform_device *pdev) char irq_name[8]; int irq_cnt; struct fec_devinfo *dev_info; + struct gpio_desc *gd; + fec_enet_get_queue_num(pdev, &num_tx_qs, &num_rx_qs); @@ -3575,6 +3634,26 @@ fec_probe(struct platform_device *pdev) !of_property_read_bool(np, "fsl,err006687-workaround-present")) fep->quirks |= FEC_QUIRK_ERR006687; + gd = devm_gpiod_get_optional(&pdev->dev, "mdc", GPIOD_IN); + if (IS_ERR(gd)) { + if (PTR_ERR(gd) != -EPROBE_DEFER) + dev_err(&pdev->dev, "Failed to get mdc gpio: %ld\n", + PTR_ERR(gd)); + ret = PTR_ERR(gd); + goto failed_ioremap; + } + fep->gd_mdc = gd; + + gd = devm_gpiod_get_optional(&pdev->dev, "mdio", GPIOD_IN); + if (IS_ERR(gd)) { + if (PTR_ERR(gd) != -EPROBE_DEFER) + dev_err(&pdev->dev, "Failed to get mdio gpio: %ld\n", + PTR_ERR(gd)); + ret = PTR_ERR(gd); + goto failed_ioremap; + } + fep->gd_mdio = gd; + if (of_get_property(np, "fsl,magic-packet", NULL)) fep->wol_flag |= FEC_WOL_HAS_MAGIC_PACKET; From patchwork Sun Nov 29 22:00:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrien Grassein X-Patchwork-Id: 335076 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_INVALID, DKIM_SIGNED, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31323C64E8A for ; Sun, 29 Nov 2020 22:01:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EC303206F9 for ; Sun, 29 Nov 2020 22:01:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UaJjRVpP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387395AbgK2WBG (ORCPT ); Sun, 29 Nov 2020 17:01:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726304AbgK2WBF (ORCPT ); Sun, 29 Nov 2020 17:01:05 -0500 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1953C0613D3; Sun, 29 Nov 2020 14:00:24 -0800 (PST) Received: by mail-wr1-x442.google.com with SMTP id 23so12872975wrc.8; Sun, 29 Nov 2020 14:00:24 -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 :mime-version:content-transfer-encoding; bh=9m45deAlqqrpV+EGvz5gA1CvOVmGlfrfttO8AgnDF8M=; b=UaJjRVpPbjqyG3EJL4oCEFQHv5RgI3bRPzUIjq6YtsL+l17Eg+kOyoIDhP7raRw0Cf WAz/uQdFRPF+kCkA/5Bg7TmlG52ZzIqJQ0qFP1SIG2Hzy3daV/u1X+H3L7V3R9CG0CIi QP+23WUzGYQdepncfXxWoc3G4XU/gjWrn/jGubz1IgHHxZuhY5FqVFG48JrP2GPyZO+m v7vckwHXRcyZBOnE9F1h4eDi67ZVrsfdgNwb4SJrm+rBsgs3hvHkZdwkcfiND7tYelU/ MiXmu4jjmcmFVyBcxskNZumtZrLTyctHhwwsd4y5fEYiI0ZZvVw9Iu4tWIoT3uIbKyuY /ruw== 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:mime-version:content-transfer-encoding; bh=9m45deAlqqrpV+EGvz5gA1CvOVmGlfrfttO8AgnDF8M=; b=TCKCBKJ5e9D6fSoHt9WVq54TApdfHrvCPwrKzJsk4NZYhxojuL8SH/paCvFwWwswWb fuGrAX5bND5P/V0miFZIctL5FSivY7nKT9YeiVSCEq1vAVd7UICbtKbVzdim9NAqaIne c36/1dh984UKoL8RkSBiYDAY7LAuS8yMDpqSbcbnMRCbVLKSTjOj7JD6R9hm4jBRbbAA DwDlq7xyxrrZawL6HONEqdcrNcgwBqh0JvNjCvn/LMrDVOentnXHeR756Q6QiWur5JHX 7BE/b4SaalqwYOQSgJlRCSuVAnDMEgQROYUCCXykM6jnkC2YMc46Woy23Zf4zLUnqzZU Zo6Q== X-Gm-Message-State: AOAM533t6rEwxDeGVwNz13K0rA3vhThgbW7cnHHuv0uPu+z9jQDP0OVL YT/iEtFOotU4WZqzlJUEFRw= X-Google-Smtp-Source: ABdhPJyMKt84005QvoggyFlAukrVlo4LUTwEvBiFT5mI8PqttNb1gwPi5BFEKF9zQOE0dMphRSwQBg== X-Received: by 2002:a5d:66c3:: with SMTP id k3mr24597824wrw.123.1606687223652; Sun, 29 Nov 2020 14:00:23 -0800 (PST) Received: from adgra-XPS-15-9570.home (lfbn-idf1-1-1007-144.w86-238.abo.wanadoo.fr. [86.238.83.144]) by smtp.gmail.com with ESMTPSA id b4sm4938080wrr.30.2020.11.29.14.00.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2020 14:00:23 -0800 (PST) From: Adrien Grassein Cc: fugang.duan@nxp.com, davem@davemloft.net, kuba@kernel.org, robh+dt@kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Adrien Grassein Subject: [PATCH v2 3/3] net: fsl: fec: add imx8mq support. Date: Sun, 29 Nov 2020 23:00:00 +0100 Message-Id: <20201129220000.16550-3-adrien.grassein@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201129220000.16550-1-adrien.grassein@gmail.com> References: <20201128225425.19300-1-adrien.grassein@gmail.com> <20201129220000.16550-1-adrien.grassein@gmail.com> MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch adds the imx8mq support to the fsl fec driver. Quirks are extracted from the NXP driver (5.4). Signed-off-by: Adrien Grassein --- drivers/net/ethernet/freescale/fec_main.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 4f22c8e3fe7e..a4bb1adbf9ed 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -131,6 +131,14 @@ static const struct fec_devinfo fec_imx6ul_info = { FEC_QUIRK_HAS_COALESCE | FEC_QUIRK_CLEAR_SETUP_MII, }; +static const struct fec_devinfo fec_imx8mq_info = { + .quirks = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | + FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | + FEC_QUIRK_HAS_VLAN | FEC_QUIRK_HAS_AVB | + FEC_QUIRK_ERR007885 | FEC_QUIRK_BUG_CAPTURE | + FEC_QUIRK_HAS_RACC | FEC_QUIRK_HAS_COALESCE +}; + static struct platform_device_id fec_devtype[] = { { /* keep it for coldfire */ @@ -158,6 +166,11 @@ static struct platform_device_id fec_devtype[] = { .name = "imx6ul-fec", .driver_data = (kernel_ulong_t)&fec_imx6ul_info, }, { + .name = "imx8mq-fec", + .driver_data = (kernel_ulong_t)&fec_imx8mq_info, + }, + + { /* sentinel */ } }; @@ -171,6 +184,7 @@ enum imx_fec_type { MVF600_FEC, IMX6SX_FEC, IMX6UL_FEC, + IMX8MQ_FEC, }; static const struct of_device_id fec_dt_ids[] = { @@ -181,6 +195,8 @@ static const struct of_device_id fec_dt_ids[] = { { .compatible = "fsl,mvf600-fec", .data = &fec_devtype[MVF600_FEC], }, { .compatible = "fsl,imx6sx-fec", .data = &fec_devtype[IMX6SX_FEC], }, { .compatible = "fsl,imx6ul-fec", .data = &fec_devtype[IMX6UL_FEC], }, + { .compatible = "fsl,imx8mq-fec", .data = &fec_devtype[IMX8MQ_FEC], }, + { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, fec_dt_ids);