From patchwork Thu Dec 3 13:59: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: 1410432 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=Tr3MUI10; 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 4CmyDS6PyDz9sW8 for ; Fri, 4 Dec 2020 01:01:12 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DE41C8276F; Thu, 3 Dec 2020 15:00: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="Tr3MUI10"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8FADF82764; Thu, 3 Dec 2020 15:00:19 +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=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from esa5.microchip.iphmx.com (esa5.microchip.iphmx.com [216.71.150.166]) (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 6231382719 for ; Thu, 3 Dec 2020 15:00:15 +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=1607004016; x=1638540016; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=ke8z9w4Q+j3xKFBlQCqInkuZ1ybfAtgyKvAAiuSw8+o=; b=Tr3MUI10szEjlmeOAAM6kIz442yPeB+IvDWfbpu0b4wFJa41Xk3IuwZv g3LdkyqNkZDlXId820oFroFksX2ZjOHExsSj8ek9svZurbvXpZnhmFrL5 PMaipHZFKAUCOkOlupR+Gy4uFPk1dI9ZPHcAmfhpS+nhZphrGQTtxNLad sn6dM+JYoY6rDIlM3wB3qNJz5g+sGMdEm+UKCHJXxzaE7hJ3UbAm5C1V7 2IKyfQ8tlj/M1tBA+U4jyRXC40NZFznwbzbYOMqd3JNZy4T1ZHsWzahgY 2qHs9II/ZzM5ATdhzr4zGh987TyuGZrCSNpy046r8URKWkzwnOmuF1wy/ Q==; IronPort-SDR: GFsJ2xMsCRCz8ul0mJEZPKmooL8ZutyIsuJyNEj1S50TDmU8FOXaDDes8IIE+g4lic+IsJ/pOp M/owc9Zc0ZZUsAHsG5xa1sPLoZMaBytSgG7uLam4ZvIf+bnnIAQrQNL/s8bjUsIDPcxi4R7Yg4 Rwa2gMtHedltbp4GgyVNtWcjd0XPjqnfpEdAxr+FhSS8jxWj0Naq5eNFyeAnXXEd/GsMQQyZB8 IeikXTwWH/8OCyfaG56dFXFiL3N5GrqgcuAl6PcuTUD0FYP1pKq1F6Vg50XSnYncrH57wVWmS9 lDg= X-IronPort-AV: E=Sophos;i="5.78,389,1599548400"; d="scan'208";a="100740742" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 03 Dec 2020 07:00:13 -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 07:00:12 -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 07:00:10 -0700 From: Claudiu Beznea To: CC: , , Claudiu Beznea Subject: [PATCH v2 4/6] net: macb: add support for sama7g5 gmac Date: Thu, 3 Dec 2020 15:59:54 +0200 Message-ID: <1607003996-28099-5-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1607003996-28099-1-git-send-email-claudiu.beznea@microchip.com> References: <1607003996-28099-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 241b42a6e9d3..234d85a94d34 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 },