mirror of
				git://git.openwrt.org/openwrt/openwrt.git
				synced 2025-11-04 06:54:27 -05:00 
			
		
		
		
	This target adds support for the StarFive JH7100 and JH7110 SoCs, based on 6.1, as well as a couple boards equipped with these. Specifications: SoCs: JH7100: - StarFive JH7100 dual-core RISC-V (U74, RC64GC) - additional monitoring (S7) and control (E24) cores - 2Mb L2 cache JH7110: - StarFive JH7110 quad-core RISC-V (U74, RV64GC) - additional monitoring (S7) and control (E24) cores - 2Mb L2 cache Boards: VisionFive1: - JH7100 @ 1GHz - Memory: 8Gb LPDDR4 - 4x USB3.0 - 1x GBit ethernet - AMPak 6236 wifi / bluetooth - audio - powered via USB-C VisionFive2: - JH7110 @ 1.5GHz - Memory: 2/4/8Gb DDR4 - 2x Gbit ethernet - 2x USB3.0 / 2x USB2.0 - eMMC / SDIO - various multimedia input/outputs (MIPI CSI, HDMI, audio) - M.2 key M slot - PoE support - powered via USB-C Installation: Standard SD-card installation via dd-ing the generated image to an SD-card of at least 256Mb. Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
		
			
				
	
	
		
			64 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			64 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
From 22885637d0976473b04d4bae191fcf88e28b3df5 Mon Sep 17 00:00:00 2001
 | 
						|
From: Emil Renner Berthing <kernel@esmil.dk>
 | 
						|
Date: Wed, 29 Sep 2021 20:50:22 +0200
 | 
						|
Subject: [PATCH 1000/1024] net: stmmac: dwmac-starfive: Add JH7100 support
 | 
						|
 | 
						|
This adds support for setting the phy interface and delay chains on the
 | 
						|
StarFive JH7100 SoC.
 | 
						|
 | 
						|
Signed-off-by: Emil Renner Berthing <kernel@esmil.dk>
 | 
						|
---
 | 
						|
 .../net/ethernet/stmicro/stmmac/dwmac-starfive.c    | 13 +++++++++++++
 | 
						|
 1 file changed, 13 insertions(+)
 | 
						|
 | 
						|
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c
 | 
						|
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c
 | 
						|
@@ -17,6 +17,10 @@
 | 
						|
 #define STARFIVE_DWMAC_PHY_INFT_RMII	0x4
 | 
						|
 #define STARFIVE_DWMAC_PHY_INFT_FIELD	0x7U
 | 
						|
 
 | 
						|
+#define JH7100_SYSMAIN_REGISTER28 0x70
 | 
						|
+/* The value below is not a typo, just really bad naming by StarFive ¯\_(ツ)_/¯ */
 | 
						|
+#define JH7100_SYSMAIN_REGISTER49 0xc8
 | 
						|
+
 | 
						|
 struct starfive_dwmac {
 | 
						|
 	struct device *dev;
 | 
						|
 	struct clk *clk_tx;
 | 
						|
@@ -56,6 +60,7 @@ static int starfive_dwmac_set_mode(struc
 | 
						|
 	struct regmap *regmap;
 | 
						|
 	unsigned int args[2];
 | 
						|
 	unsigned int mode;
 | 
						|
+	u32 gtxclk_dlychain;
 | 
						|
 	int err;
 | 
						|
 
 | 
						|
 	switch (plat_dat->interface) {
 | 
						|
@@ -65,6 +70,7 @@ static int starfive_dwmac_set_mode(struc
 | 
						|
 
 | 
						|
 	case PHY_INTERFACE_MODE_RGMII:
 | 
						|
 	case PHY_INTERFACE_MODE_RGMII_ID:
 | 
						|
+	case PHY_INTERFACE_MODE_RGMII_TXID:
 | 
						|
 		mode = STARFIVE_DWMAC_PHY_INFT_RGMII;
 | 
						|
 		break;
 | 
						|
 
 | 
						|
@@ -87,6 +93,12 @@ static int starfive_dwmac_set_mode(struc
 | 
						|
 	if (err)
 | 
						|
 		return dev_err_probe(dwmac->dev, err, "error setting phy mode\n");
 | 
						|
 
 | 
						|
+	if (!of_property_read_u32(dwmac->dev->of_node, "starfive,gtxclk-dlychain", >xclk_dlychain)) {
 | 
						|
+		err = regmap_write(regmap, JH7100_SYSMAIN_REGISTER49, gtxclk_dlychain);
 | 
						|
+		if (err)
 | 
						|
+			return dev_err_probe(dwmac->dev, err, "error selecting gtxclk delay chain\n");
 | 
						|
+	}
 | 
						|
+
 | 
						|
 	return 0;
 | 
						|
 }
 | 
						|
 
 | 
						|
@@ -149,6 +161,7 @@ static int starfive_dwmac_probe(struct p
 | 
						|
 }
 | 
						|
 
 | 
						|
 static const struct of_device_id starfive_dwmac_match[] = {
 | 
						|
+	{ .compatible = "starfive,jh7100-dwmac"	},
 | 
						|
 	{ .compatible = "starfive,jh7110-dwmac"	},
 | 
						|
 	{ /* sentinel */ }
 | 
						|
 };
 |