U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Claudiu Beznea <claudiu.beznea@microchip.com>
To: u-boot@lists.denx.de
Subject: [PATCH 4/6] net: macb: add support for sama7g5 gmac
Date: Thu, 3 Dec 2020 11:25:54 +0200	[thread overview]
Message-ID: <1606987556-20217-5-git-send-email-claudiu.beznea@microchip.com> (raw)
In-Reply-To: <1606987556-20217-1-git-send-email-claudiu.beznea@microchip.com>

Add support for SAMA7G5 GMAC.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 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 },
-- 
2.7.4

  parent reply	other threads:[~2020-12-03  9:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-03  9:25 [PATCH 0/6] add support for sama7g5 ethernet interfaces Claudiu Beznea
2020-12-03  9:25 ` [PATCH 1/6] net: macb: use dummy descriptor for RBQP Claudiu Beznea
2020-12-16  6:54   ` Eugen.Hristev at microchip.com
2020-12-16  7:17     ` Bin Meng
2020-12-16  8:29       ` Eugen.Hristev at microchip.com
2020-12-17  5:22     ` Padmarao.Begari at microchip.com
2021-01-14 11:19       ` Eugen.Hristev at microchip.com
2021-01-15  4:02         ` Padmarao Begari
2021-01-15  8:04           ` Eugen.Hristev at microchip.com
2021-01-15 12:26             ` Padmarao Begari
2021-01-15 12:42               ` Eugen.Hristev at microchip.com
2020-12-03  9:25 ` [PATCH 2/6] net: macb: add user io config data structure Claudiu Beznea
2020-12-03  9:25 ` [PATCH 3/6] net: macb: check clk_set_rate return value to be negative Claudiu Beznea
2020-12-03  9:25 ` Claudiu Beznea [this message]
2020-12-03  9:25 ` [PATCH 5/6] net: macb: add support for sama7g5 emac Claudiu Beznea
2020-12-03  9:25 ` [PATCH 6/6] net: macb: take into account all RGMII interface types Claudiu Beznea

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1606987556-20217-5-git-send-email-claudiu.beznea@microchip.com \
    --to=claudiu.beznea@microchip.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox