From patchwork Thu Dec 3 09:25:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 1410229 X-Patchwork-Delegate: eugen.hristev@microchip.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=DQnRlEpn; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Cmr7H2WBKz9s1l for ; Thu, 3 Dec 2020 20:26:19 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 03BD882752; Thu, 3 Dec 2020 10:26:09 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.b="DQnRlEpn"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2B9B68274D; Thu, 3 Dec 2020 10:26:05 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from esa3.microchip.iphmx.com (esa3.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9A82A82653 for ; Thu, 3 Dec 2020 10:26:01 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=Claudiu.Beznea@microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1606987561; x=1638523561; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=MIJ2qTaamkXTmhhW3aClkAwfgPbP0l09xm2QaZsS7WU=; b=DQnRlEpnfCIJa6jf0KY9H9RWxS2p49EPe7LEkQujut5NADcRqYpGeHy7 iN3Pd9IQmbncZ7bA0ZN6JpSLewvDjjkLWSY016yas/GHxl9tyBT6+XE8i mBZvAAjkKrjB5hxc6PLwjRCYE++qefDSknUmpnN0X2hA1FuMauV6N5agL P76bJ+UaBXD7xKzY38C9vRIJCni0COvl012GNyLiYpE+mHDoe8CgUjLbs 7GI64cnsjTWn+FW4XG+CP9Fw05Wvy7eae90XrTbENYm6bCLpJod2kvwvG lc/1QBT2Ff0gN0sahv43mR5Jd+w12yEwTNDvI9FFgxtnEQj1cCznAQ/k5 w==; IronPort-SDR: 7ldEPXJY6DlgSzT2ckP/8iQyECUSgz/exc1G3H3cWWnkgocZfQRcPHv2BveopHVxp2xt1Hq7rL ssZPy/ntzJQS+Nky5i8aqqNtkFQfge2teLmg3gnytINGYFCuCALGT8+poqygdcddzEDa0RVLbp BcjtpK13nTw0DTLpFSwgNmiF1HSW74C3fcRHG9zZZnIcbu0FQjlmEow/HlFGOuiCm51W87VAWG ZbCHCrs8DujhBIS4KOsjup39WjTTrvkQVss3aul6oNHGcEHahN0kduczyxxuqu07efHWgRrZTV 1yw= X-IronPort-AV: E=Sophos;i="5.78,389,1599548400"; d="scan'208";a="101253967" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 03 Dec 2020 02:26:01 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Thu, 3 Dec 2020 02:26:00 -0700 Received: from m18063-ThinkPad-T460p.microchip.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Thu, 3 Dec 2020 02:25:59 -0700 From: Claudiu Beznea To: CC: , Claudiu Beznea Subject: [PATCH 1/6] net: macb: use dummy descriptor for RBQP Date: Thu, 3 Dec 2020 11:25:51 +0200 Message-ID: <1606987556-20217-2-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1606987556-20217-1-git-send-email-claudiu.beznea@microchip.com> References: <1606987556-20217-1-git-send-email-claudiu.beznea@microchip.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean In case of multiple queues on RX side the queue scheduler will try to use all the available configured queues (with descriptors having TX_USED bit cleared). If at least one RBQP points to a descriptor with a valid used bit configuration then the reception may block as this may point to any memory. To avoid this scenario all the queues (except queue zero) were disabled by setting DMA descriptors with used bit set on proper RBQP. The driver anyway uses only queue 0 for TX/RX. Signed-off-by: Claudiu Beznea --- drivers/net/macb.c | 4 +++- drivers/net/macb.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/macb.c b/drivers/net/macb.c index b80a259ff757..836eb85ec96a 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -732,8 +732,10 @@ static int gmac_init_multi_queues(struct macb_device *macb) flush_dcache_range(macb->dummy_desc_dma, macb->dummy_desc_dma + ALIGN(MACB_TX_DUMMY_DMA_DESC_SIZE, PKTALIGN)); - for (i = 1; i < num_queues; i++) + for (i = 1; i < num_queues; i++) { gem_writel_queue_TBQP(macb, macb->dummy_desc_dma, i - 1); + gem_writel_queue_RBQP(macb, macb->dummy_desc_dma, i - 1); + } return 0; } diff --git a/drivers/net/macb.h b/drivers/net/macb.h index 9b16383eba46..28c7fe306883 100644 --- a/drivers/net/macb.h +++ b/drivers/net/macb.h @@ -768,5 +768,7 @@ #define GEM_RX_CSUM_CHECKED_MASK 2 #define gem_writel_queue_TBQP(port, value, queue_num) \ writel((value), (port)->regs + GEM_TBQP(queue_num)) +#define gem_writel_queue_RBQP(port, value, queue_num) \ + writel((value), (port)->regs + GEM_RBQP(queue_num)) #endif /* __DRIVERS_MACB_H__ */ From patchwork Thu Dec 3 09:25:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 1410230 X-Patchwork-Delegate: eugen.hristev@microchip.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=DGtNsMtg; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Cmr7S3mp3z9s1l for ; Thu, 3 Dec 2020 20:26:28 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 798458280C; Thu, 3 Dec 2020 10:26:11 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.b="DGtNsMtg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A446182767; Thu, 3 Dec 2020 10:26:07 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from esa3.microchip.iphmx.com (esa3.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9DCC382715 for ; Thu, 3 Dec 2020 10:26:03 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=Claudiu.Beznea@microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1606987563; x=1638523563; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=SHn26TGIJjZEACHzP/FLN+H8p559AN7vL+W7xmR05VQ=; b=DGtNsMtgBpn3FOR6qALP51kiqgFGnbMlY+udx2gxwpNvEbqewz9gX/DO gFi7hKilVpd5XtUoMv4EEsTkMEPbNMxqoMZdRrG3PpRWDamNQaGsS9uko lxGbsLHsb4gtcN3Xo88JAtdhRT6OtA2/nS3cKKUrNqa9TPmuf2zmmoHeU ftucGANIKivDvfhgaQn0DUkA+tSCwtFRTHiH5Wby3c/OgzXp9T+soialL ttXbfKvrT6GQcBJRFsV4gvRPmJfvUVCuR5QN3JpmL7OXLPyLci7CBVDK+ IesNnJ3n9TK7NNNtZFCugbqd9Y6DZKmTUcXldyK1BI+QWmjAdf0yU3SZo Q==; IronPort-SDR: K0iAjJObapNcbk8buku5rv7AGhUqJ5lMFwobf3h59foIdeS+i/Tuh6w2pQSn0jlf6bOztJfBM1 h6+FEilaVNUKpcd3dvC9wTp65dztiuFLRDgRJWjs4Ix6bEHEBH3Z3gd5AnaNekzxrOqRTh+ywp /SIY9M680bmNjQZojL9OijA++DtVUdE0N66baNfMCi73nzE/SWOtgFHBenqy/gzacyHBkPFSAA IcWUEozFIY4EE3XRs5Spg9AAHrTOBtwbF/147Rmfd2Ukf6hL6d5LXSoDCij26BA7K4w7Bqsuul gZo= X-IronPort-AV: E=Sophos;i="5.78,389,1599548400"; d="scan'208";a="101253976" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 03 Dec 2020 02:26:03 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Thu, 3 Dec 2020 02:26:02 -0700 Received: from m18063-ThinkPad-T460p.microchip.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Thu, 3 Dec 2020 02:26:01 -0700 From: Claudiu Beznea To: CC: , Claudiu Beznea Subject: [PATCH 2/6] net: macb: add user io config data structure Date: Thu, 3 Dec 2020 11:25:52 +0200 Message-ID: <1606987556-20217-3-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1606987556-20217-1-git-send-email-claudiu.beznea@microchip.com> References: <1606987556-20217-1-git-send-email-claudiu.beznea@microchip.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Different implementation of USER IO register needs different mapping for bit fields of this register. Add implementation for this and, since clken is part of USER IO and it needs to be activated based on per SoC capabilities, add caps in macb_config where clken specific information needs to be filled. Signed-off-by: Claudiu Beznea --- drivers/net/macb.c | 52 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 836eb85ec96a..585d126a17f9 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -135,10 +135,19 @@ struct macb_device { #endif }; +struct macb_usrio_cfg { + unsigned int mii; + unsigned int rmii; + unsigned int rgmii; + unsigned int clken; +}; + struct macb_config { unsigned int dma_burst_length; + unsigned int caps; int (*clk_init)(struct udevice *dev, ulong rate); + const struct macb_usrio_cfg *usrio; }; #ifndef CONFIG_DM_ETH @@ -818,6 +827,7 @@ static int _macb_init(struct macb_device *macb, const char *name) macb_writel(macb, TBQP, macb->tx_ring_dma); if (macb_is_gem(macb)) { + unsigned int val = 0; /* Initialize DMA properties */ gmac_configure_dma(macb); /* Check the multi queue and initialize the queue for tx */ @@ -830,11 +840,17 @@ static int _macb_init(struct macb_device *macb, const char *name) * to select interface between RMII and MII. */ #ifdef CONFIG_DM_ETH - if ((macb->phy_interface == PHY_INTERFACE_MODE_RMII) || - (macb->phy_interface == PHY_INTERFACE_MODE_RGMII)) - gem_writel(macb, USRIO, GEM_BIT(RGMII)); - else - gem_writel(macb, USRIO, 0); + if (macb->phy_interface == PHY_INTERFACE_MODE_RGMII) + val = macb->config->usrio->rgmii; + else if (macb->phy_interface == PHY_INTERFACE_MODE_RMII) + val = macb->config->usrio->rmii; + else if (macb->phy_interface == PHY_INTERFACE_MODE_MII) + val = macb->config->usrio->mii; + + if (macb->config->caps & MACB_CAPS_USRIO_HAS_CLKEN) + val |= macb->config->usrio->clken; + + gem_writel(macb, USRIO, val); if (macb->phy_interface == PHY_INTERFACE_MODE_SGMII) { unsigned int ncfgr = macb_readl(macb, NCFGR); @@ -844,7 +860,7 @@ static int _macb_init(struct macb_device *macb, const char *name) } #else #if defined(CONFIG_RGMII) || defined(CONFIG_RMII) - gem_writel(macb, USRIO, GEM_BIT(RGMII)); + gem_writel(macb, USRIO, macb->config->usrio->rgmii); #else gem_writel(macb, USRIO, 0); #endif @@ -855,28 +871,30 @@ static int _macb_init(struct macb_device *macb, const char *name) #ifdef CONFIG_AT91FAMILY if (macb->phy_interface == PHY_INTERFACE_MODE_RMII) { macb_writel(macb, USRIO, - MACB_BIT(RMII) | MACB_BIT(CLKEN)); + macb->config->usrio->rmii | + macb->config->usrio->clken); } else { - macb_writel(macb, USRIO, MACB_BIT(CLKEN)); + macb_writel(macb, USRIO, macb->config->usrio->clken); } #else if (macb->phy_interface == PHY_INTERFACE_MODE_RMII) macb_writel(macb, USRIO, 0); else - macb_writel(macb, USRIO, MACB_BIT(MII)); + macb_writel(macb, USRIO, macb->config->usrio->mii); #endif #else #ifdef CONFIG_RMII #ifdef CONFIG_AT91FAMILY - macb_writel(macb, USRIO, MACB_BIT(RMII) | MACB_BIT(CLKEN)); + macb_writel(macb, USRIO, macb->config->usrio->rmii | + macb->config->usrio->clken); #else macb_writel(macb, USRIO, 0); #endif #else #ifdef CONFIG_AT91FAMILY - macb_writel(macb, USRIO, MACB_BIT(CLKEN)); + macb_writel(macb, USRIO, macb->config->usrio->clken); #else - macb_writel(macb, USRIO, MACB_BIT(MII)); + macb_writel(macb, USRIO, macb->config->usrio->mii); #endif #endif /* CONFIG_RMII */ #endif @@ -1217,9 +1235,17 @@ static int macb_enable_clk(struct udevice *dev) } #endif +static const struct macb_usrio_cfg macb_default_usrio = { + .mii = MACB_BIT(MII), + .rmii = MACB_BIT(RMII), + .rgmii = GEM_BIT(RGMII), + .clken = MACB_BIT(CLKEN), +}; + static const struct macb_config default_gem_config = { .dma_burst_length = 16, .clk_init = NULL, + .usrio = &macb_default_usrio, }; static int macb_eth_probe(struct udevice *dev) @@ -1309,11 +1335,13 @@ static int macb_eth_ofdata_to_platdata(struct udevice *dev) static const struct macb_config sama5d4_config = { .dma_burst_length = 4, .clk_init = NULL, + .usrio = &macb_default_usrio, }; static const struct macb_config sifive_config = { .dma_burst_length = 16, .clk_init = macb_sifive_clk_init, + .usrio = &macb_default_usrio, }; static const struct udevice_id macb_eth_ids[] = { From patchwork Thu Dec 3 09:25:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 1410231 X-Patchwork-Delegate: eugen.hristev@microchip.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=wmGNa+m1; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Cmr7f40Hlz9s1l for ; Thu, 3 Dec 2020 20:26:38 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B2E528281B; Thu, 3 Dec 2020 10:26:13 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.b="wmGNa+m1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E069082767; Thu, 3 Dec 2020 10:26:08 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from esa3.microchip.iphmx.com (esa3.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8C90482653 for ; Thu, 3 Dec 2020 10:26:05 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=Claudiu.Beznea@microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1606987565; x=1638523565; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=7RJ/PgfWHCvXiORNMzJgP0SiGGAH6wuBKAlurqwdijo=; b=wmGNa+m1uZ+9JCfYk0vXYS95H+yVjuZ14lIGKPjn5uZ0cnZVbumgrbAw YcRKGUWyr6UyV1pCq967WyT2Uh7ixyllOL2YBMXgtW958h41oq40PQmOI mmEh92TzEI9m18g8aKGI+To23Nl26ANrZYvmwD8qte1RAVNtzyjQLyIPF a54K1PQSKeLwpdxbMXdTl32omsfG/qAIIOUkMBKNv1rfcEncPX7C9e3I0 18BSztN5KmhzPFY7FjbJaDmb4vjDdX87giRmshUxfWiAsEAnfZjjZ3mHv JPlgKLn1i8xET4p3+RLimXCqcMtN9jOZ7Y7EUGZfNtaQ58hQJBkKvIn9N g==; IronPort-SDR: kW5TlbdTPQTyt9cwBeVg9D4eHaUpoUJeVbeMh7uXhqd3iaX2MeUQwgl+09ocFNRqMvn4vcTpy8 4WIwYMZn8YTpeKxQAgNBvhyvl5WGicCtAg0Q1gs2ZunBFXBvNyk78mqXRof4tbDE0wF51w7dq3 Wu8jLyDK+bWEkVmhcKrZYaSxLCcc5fFlrmY/5WxSv5FOgQjhW1gtol96n397IxfA5VFd7PJN9F bUs9HVFK0jk+o6U8b5pJEZEa/L7O5DSeAzMmVCqWySdoK4cb1oyFwaf3BDOUrwfXO8G4/3ZqrW fCA= X-IronPort-AV: E=Sophos;i="5.78,389,1599548400"; d="scan'208";a="101253980" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 03 Dec 2020 02:26:04 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Thu, 3 Dec 2020 02:26:04 -0700 Received: from m18063-ThinkPad-T460p.microchip.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Thu, 3 Dec 2020 02:26:03 -0700 From: Claudiu Beznea To: CC: , Claudiu Beznea Subject: [PATCH 3/6] net: macb: check clk_set_rate return value to be negative Date: Thu, 3 Dec 2020 11:25:53 +0200 Message-ID: <1606987556-20217-4-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1606987556-20217-1-git-send-email-claudiu.beznea@microchip.com> References: <1606987556-20217-1-git-send-email-claudiu.beznea@microchip.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean clk_set_rate() returns the set rate in case of success and a negative number in case of failure. Consider failure only the negative numbers. Fixes: 3ef64444de157 ("dm: net: macb: Implement link speed change callback") Signed-off-by: Claudiu Beznea --- drivers/net/macb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 585d126a17f9..439d1706485c 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -564,7 +564,7 @@ int __weak macb_linkspd_cb(struct udevice *dev, unsigned int speed) if (tx_clk.dev) { ret = clk_set_rate(&tx_clk, rate); - if (ret) + if (ret < 0) return ret; } #endif From patchwork Thu Dec 3 09:25:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 1410232 X-Patchwork-Delegate: eugen.hristev@microchip.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=kHSM9/BL; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Cmr7s2K4pz9s1l for ; Thu, 3 Dec 2020 20:26:49 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 43F118273E; Thu, 3 Dec 2020 10:26:18 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.b="kHSM9/BL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6711582825; Thu, 3 Dec 2020 10:26:15 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from esa3.microchip.iphmx.com (esa3.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C6C2682715 for ; Thu, 3 Dec 2020 10:26:07 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=Claudiu.Beznea@microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1606987567; x=1638523567; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=qwDJVJJOci7EbrP+jGQaE8fFK2Tn5xyUGpAQYTapet8=; b=kHSM9/BLA5bIGC1WaHpXqMPtvbHWtoU4CLv72Psnc+eJQ8auiiSWGXVp 6C4MvG9MnTzEdf1lNz86tvVoLGRYorKBStzIFBaHPqmbr4lpWreOyw4fX X0AaP2qmuPJXze3W8gMxs5KviQeDi/XVEQ6vTzpjJ8j/SZq5pjvO0RWg9 rCg/i+h98CLskbYiQZqbGpZ5NCgOZmGPUaGUUHrCk6MYl6vAb4yxcdrOY xE5YGn8U5nsdiDUAr6Hf2PZKDQZsHGPy/+vBQ7+2Dj2nA0LB2kwtHGJGu vfJ8MtoO3xCcr2okRFcvg69LMt8s6W2r2DITNrEKFu8+1Q5XHRhES80Nx w==; IronPort-SDR: go14NfpWDDfvSKw/ssSrk5Zr3u9E0/AN7N6zKVyKQk2yokEPAANkadgMX3roYlPjcVUSKjj1Du BZMt2Q8fLb9hfWQUsp63GbKzs2TDS/cGI6fW8554/9dma/UA2/uaoHWc/GKnudEiqKPWNeojkt 0pZ2sRKvE6OeMIko2miA4FVPCV5E1ZmXN89OrFFTtyDwmnbGtGPZ6ECHzgBCeUCEIbdrHx2i7c RaXhl4ow7AECALCXvSrKQfabeT4UAT8C/Fti1Wd8tMIdGlFdr4SnGYTFsWSxgaay/fD/hDdvfG X2Y= X-IronPort-AV: E=Sophos;i="5.78,389,1599548400"; d="scan'208";a="101253984" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 03 Dec 2020 02:26:06 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Thu, 3 Dec 2020 02:26:06 -0700 Received: from m18063-ThinkPad-T460p.microchip.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Thu, 3 Dec 2020 02:26:05 -0700 From: Claudiu Beznea To: CC: , Claudiu Beznea Subject: [PATCH 4/6] net: macb: add support for sama7g5 gmac Date: Thu, 3 Dec 2020 11:25:54 +0200 Message-ID: <1606987556-20217-5-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1606987556-20217-1-git-send-email-claudiu.beznea@microchip.com> References: <1606987556-20217-1-git-send-email-claudiu.beznea@microchip.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Add support for SAMA7G5 GMAC. Signed-off-by: Claudiu Beznea --- drivers/net/macb.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 439d1706485c..8039a53d4f4c 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -528,6 +528,23 @@ static int macb_sifive_clk_init(struct udevice *dev, ulong rate) return 0; } +static int macb_sama7g5_clk_init(struct udevice *dev, ulong rate) +{ + struct clk clk; + int ret; + + ret = clk_get_by_name(dev, "tx_clk", &clk); + if (ret) + return ret; + + /* + * This is for using GCK. Clock rate is addressed via assigned-clock + * property, so only clock enable is needed here. The switching to + * proper clock rate depending on link speed is managed by IP logic. + */ + return clk_enable(&clk); +} + int __weak macb_linkspd_cb(struct udevice *dev, unsigned int speed) { #ifdef CONFIG_CLK @@ -1332,6 +1349,13 @@ static int macb_eth_ofdata_to_platdata(struct udevice *dev) return macb_late_eth_ofdata_to_platdata(dev); } +static const struct macb_usrio_cfg sama7g5_usrio = { + .mii = 0, + .rmii = 1, + .rgmii = 2, + .clken = BIT(2), +}; + static const struct macb_config sama5d4_config = { .dma_burst_length = 4, .clk_init = NULL, @@ -1344,10 +1368,18 @@ static const struct macb_config sifive_config = { .usrio = &macb_default_usrio, }; +static const struct macb_config sama7g5_gmac_config = { + .dma_burst_length = 16, + .clk_init = macb_sama7g5_clk_init, + .usrio = &sama7g5_usrio, +}; + static const struct udevice_id macb_eth_ids[] = { { .compatible = "cdns,macb" }, { .compatible = "cdns,at91sam9260-macb" }, { .compatible = "cdns,sam9x60-macb" }, + { .compatible = "cdns,sama7g5-gem", + .data = (ulong)&sama7g5_gmac_config }, { .compatible = "atmel,sama5d2-gem" }, { .compatible = "atmel,sama5d3-gem" }, { .compatible = "atmel,sama5d4-gem", .data = (ulong)&sama5d4_config }, From patchwork Thu Dec 3 09:25:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 1410234 X-Patchwork-Delegate: eugen.hristev@microchip.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=Imy+B3jy; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Cmr8D6YFDz9s1l for ; Thu, 3 Dec 2020 20:27:08 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C3F2382830; Thu, 3 Dec 2020 10:26:21 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.b="Imy+B3jy"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0867B8273E; Thu, 3 Dec 2020 10:26:17 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from esa3.microchip.iphmx.com (esa3.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7E0F5827F4 for ; Thu, 3 Dec 2020 10:26:09 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=Claudiu.Beznea@microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1606987569; x=1638523569; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=j5qY94W3XRXXYy2dScNuiPUKuweW0/dNII/j02M5pxg=; b=Imy+B3jyRhMW8zq7XMclU+traPGElufCVlBgCk4bcLe/iZ2mGxkBv1PJ pKpDCBzBgCHd4OzklxeUZAmrgicpSTw+BSyo2vhHHwHdW4DbpbisJUqsE g7HmXzZzWwabW7unFz3qLXvEeZDpezouIDusJjLLang9oM05dLl8kOrGk A3V24u77NHnqCwYDOr+JEGHwZND/HkMutqCyhscNstxcHtwBWgrXEPW8j xcmPEpr8aMfvCrSAda8cFEzTaI9jPREgZFmyBBtsDhBJ1444lSukNSVI5 GvwDfuCNKriYu7WfUVn3xIkEVBq23GzSqZ2y9sJQSZK/Id6FbdMY5g908 g==; IronPort-SDR: oIse2X2cwgehTs4zoKXUTg+CUE8b3UZbmouSFR1rYSQs4PXlhxxj22R0P36sVZeywBtCQf1OTS 5g0zhVbtLPbNHjsZFodjN0GFY0X+SiLyZGkgQzUl0DpQxoBRIQAtFwFRTFnzUk9QgWhODdGjXY i1WE8A8swV8vwtowf9/H3eRdmJEpjBGsQmXF4hCzrrmHR3SKJ7oNLv1e08g07UsLJlj0V5Gs6T Vh8Si/CQPmb1nrPb/LcrfijN94IyY3BG5O7LH4/1CXFNhmQe0O5Sz/WsB5/prmV8fpi8b9h373 q4w= X-IronPort-AV: E=Sophos;i="5.78,389,1599548400"; d="scan'208";a="101253991" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 03 Dec 2020 02:26:08 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Thu, 3 Dec 2020 02:26:08 -0700 Received: from m18063-ThinkPad-T460p.microchip.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Thu, 3 Dec 2020 02:26:07 -0700 From: Claudiu Beznea To: CC: , Claudiu Beznea Subject: [PATCH 5/6] net: macb: add support for sama7g5 emac Date: Thu, 3 Dec 2020 11:25:55 +0200 Message-ID: <1606987556-20217-6-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1606987556-20217-1-git-send-email-claudiu.beznea@microchip.com> References: <1606987556-20217-1-git-send-email-claudiu.beznea@microchip.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Add support for SAMA7G5 EMAC. Signed-off-by: Claudiu Beznea --- drivers/net/macb.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 8039a53d4f4c..e3003cb4a619 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -1374,12 +1374,20 @@ static const struct macb_config sama7g5_gmac_config = { .usrio = &sama7g5_usrio, }; +static const struct macb_config sama7g5_emac_config = { + .caps = MACB_CAPS_USRIO_HAS_CLKEN, + .dma_burst_length = 16, + .usrio = &sama7g5_usrio, +}; + static const struct udevice_id macb_eth_ids[] = { { .compatible = "cdns,macb" }, { .compatible = "cdns,at91sam9260-macb" }, { .compatible = "cdns,sam9x60-macb" }, { .compatible = "cdns,sama7g5-gem", .data = (ulong)&sama7g5_gmac_config }, + { .compatible = "cdns,sama7g5-emac", + .data = (ulong)&sama7g5_emac_config }, { .compatible = "atmel,sama5d2-gem" }, { .compatible = "atmel,sama5d3-gem" }, { .compatible = "atmel,sama5d4-gem", .data = (ulong)&sama5d4_config }, From patchwork Thu Dec 3 09:25:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 1410233 X-Patchwork-Delegate: eugen.hristev@microchip.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=VWm3yu7l; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Cmr831qvBz9s1l for ; Thu, 3 Dec 2020 20:26:59 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 216DB82829; Thu, 3 Dec 2020 10:26:20 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.b="VWm3yu7l"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B0BE48282B; Thu, 3 Dec 2020 10:26:16 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from esa3.microchip.iphmx.com (esa3.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6D6C68280B for ; Thu, 3 Dec 2020 10:26:11 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=Claudiu.Beznea@microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1606987571; x=1638523571; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=iKwKX7WsadrkZxDA8IvDNXV8wQvTtZkS2bDw3D96KaE=; b=VWm3yu7lD69D29futhT60hIERGU0mvSucUuo7eQF/o7xY6zNOYc1pzyC kt3ENuau/cZunf0e2swDDFwU7UuvtBn37k4Od+wVT5M8y6tM2fQkPvg2K Jxr9meg4tI+NzmyMDmt/f6Ye+b/uyTPhMMdQTeKxJliOJEamj+V6ZFm9g u+QIERO4YKuoQbV1CIXHDHdSgNRkXdjYgufW74D6gY5wbR4mmMz8RK2E8 IADXkpuLgtbDvZD3USkxCWeFW6KCDvLUgnK5iQ93c8PcjNdBV54lpkq23 NXAeoCgW9yK0yNUBALnK2QoaaoMJ6lRfPjJe6laoknqe76bToVvPS01/b Q==; IronPort-SDR: EhFdUoyu/6D78HYYQ61IQMeUhswMDI9rXB8InRKrkRoM5a9xaj2AnyFSMsSn02uiqxwtqcM9+V yeXqSXuo8emJ6S3EUqsxA3SxlpFhiqaIADAe0SOVUAYezgAsWGjiu5An/vVWKIDIhTxiOhT2zO 7wagm7InXl+h58/hw6hCfGtQqZ7rYfMxDT0ZXYkM/NxU49MkmkroUlW7WBaaePiiuFm8dvMFGo C5c7xObIrmiOwSOT9SCwjlYtDx5g6oHltbEZr/2LJnH0gzbzrIdoVflt35uc/xx4M3OrkP8kET Z2k= X-IronPort-AV: E=Sophos;i="5.78,389,1599548400"; d="scan'208";a="101254001" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 03 Dec 2020 02:26:10 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Thu, 3 Dec 2020 02:26:10 -0700 Received: from m18063-ThinkPad-T460p.microchip.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Thu, 3 Dec 2020 02:26:09 -0700 From: Claudiu Beznea To: CC: , Claudiu Beznea Subject: [PATCH 6/6] net: macb: take into account all RGMII interface types Date: Thu, 3 Dec 2020 11:25:56 +0200 Message-ID: <1606987556-20217-7-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1606987556-20217-1-git-send-email-claudiu.beznea@microchip.com> References: <1606987556-20217-1-git-send-email-claudiu.beznea@microchip.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Take into account all RGMII interface types. Depending on it the RGMII PHY's timings are setup. Signed-off-by: Claudiu Beznea --- drivers/net/macb.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/macb.c b/drivers/net/macb.c index e3003cb4a619..127d6e899bad 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -630,7 +630,7 @@ static int macb_phy_init(struct macb_device *macb, const char *name) #else /* need to consider other phy interface mode */ macb->phydev = phy_connect(macb->bus, macb->phy_addr, &macb->netdev, - PHY_INTERFACE_MODE_RGMII); + macb->phy_interface); #endif if (!macb->phydev) { printf("phy_connect failed\n"); @@ -857,7 +857,10 @@ static int _macb_init(struct macb_device *macb, const char *name) * to select interface between RMII and MII. */ #ifdef CONFIG_DM_ETH - if (macb->phy_interface == PHY_INTERFACE_MODE_RGMII) + if (macb->phy_interface == PHY_INTERFACE_MODE_RGMII || + macb->phy_interface == PHY_INTERFACE_MODE_RGMII_ID || + macb->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID || + macb->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID) val = macb->config->usrio->rgmii; else if (macb->phy_interface == PHY_INTERFACE_MODE_RMII) val = macb->config->usrio->rmii;