diff mbox

[v2,3/3] sh_eth: add R8A77980 support

Message ID a0dec765-3196-c09d-b41c-c1eb3025a8ad@cogentembedded.com (mailing list archive)
State Accepted
Delegated to: Geert Uytterhoeven
Headers show

Commit Message

Sergei Shtylyov May 18, 2018, 6:32 p.m. UTC
Finally, add support for the DT probing of the R-Car V3H (AKA R8A77980) --
it's the only R-Car gen3 SoC having the GEther controller -- others have
only EtherAVB...

Based on the original (and large) patch by Vladimir Barinov.

Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>

---
Changes in version 2:
- added Simon's tag.

 Documentation/devicetree/bindings/net/sh_eth.txt |    1 
 drivers/net/ethernet/renesas/sh_eth.c            |   44 +++++++++++++++++++++++
 2 files changed, 45 insertions(+)

Comments

Sergei Shtylyov Dec. 30, 2018, 5:24 p.m. UTC | #1
On 05/18/2018 09:32 PM, Sergei Shtylyov wrote:

> Finally, add support for the DT probing of the R-Car V3H (AKA R8A77980) --
> it's the only R-Car gen3 SoC having the GEther controller -- others have
> only EtherAVB...
> 
> Based on the original (and large) patch by Vladimir Barinov.
> 
> Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
> 
[...]
> Index: net-next/drivers/net/ethernet/renesas/sh_eth.c
> ===================================================================
> --- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c
> +++ net-next/drivers/net/ethernet/renesas/sh_eth.c
> @@ -753,6 +753,49 @@ static struct sh_eth_cpu_data rcar_gen2_
>  	.rmiimode	= 1,
>  	.magic		= 1,
>  };
> +
> +/* R8A77980 */
> +static struct sh_eth_cpu_data r8a77980_data = {
> +	.soft_reset	= sh_eth_soft_reset_gether,
> +
> +	.set_duplex	= sh_eth_set_duplex,
> +	.set_rate	= sh_eth_set_rate_gether,
> +
> +	.register_type  = SH_ETH_REG_GIGABIT,
> +
> +	.edtrr_trns	= EDTRR_TRNS_GETHER,
> +	.ecsr_value	= ECSR_PSRTO | ECSR_LCHNG | ECSR_ICD | ECSR_MPD,
> +	.ecsipr_value	= ECSIPR_PSRTOIP | ECSIPR_LCHNGIP | ECSIPR_ICDIP |
> +			  ECSIPR_MPDIP,
> +	.eesipr_value	= EESIPR_RFCOFIP | EESIPR_ECIIP |
> +			  EESIPR_FTCIP | EESIPR_TDEIP | EESIPR_TFUFIP |
> +			  EESIPR_FRIP | EESIPR_RDEIP | EESIPR_RFOFIP |
> +			  EESIPR_RMAFIP | EESIPR_RRFIP |
> +			  EESIPR_RTLFIP | EESIPR_RTSFIP |
> +			  EESIPR_PREIP | EESIPR_CERFIP,
> +
> +	.tx_check       = EESR_FTC | EESR_CD | EESR_RTO,
> +	.eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT |
> +			  EESR_RFE | EESR_RDE | EESR_RFRMER |
> +			  EESR_TFE | EESR_TDE | EESR_ECI,
> +	.fdr_value	= 0x0000070f,
> +
> +	.apr		= 1,
> +	.mpr		= 1,
> +	.tpauser	= 1,
> +	.bculr		= 1,
> +	.hw_swap	= 1,
> +	.nbst		= 1,
> +	.rpadir		= 1,
> +	.rpadir_value   = 2 << 16,
> +	.no_trimd	= 1,
> +	.no_ade		= 1,
> +	.xdfar_rw	= 1,
> +	.hw_checksum	= 1,

   Ugh, the "intelligent" checksum is not actually supported, just a simplistic
checksum (from byte 14). I'll send a fix.

> +	.select_mii	= 1,
> +	.magic		= 1,
> +	.cexcr		= 1,
> +};
>  #endif /* CONFIG_OF */
>  
>  static void sh_eth_set_rate_sh7724(struct net_device *ndev)
[...]

MBR, Sergei
Sergei Shtylyov Dec. 30, 2018, 8:15 p.m. UTC | #2
On 12/30/2018 08:24 PM, Sergei Shtylyov wrote:

>> Finally, add support for the DT probing of the R-Car V3H (AKA R8A77980) --
>> it's the only R-Car gen3 SoC having the GEther controller -- others have
>> only EtherAVB...
>>
>> Based on the original (and large) patch by Vladimir Barinov.
>>
>> Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>> Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
>>
> [...]
>> Index: net-next/drivers/net/ethernet/renesas/sh_eth.c
>> ===================================================================
>> --- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c
>> +++ net-next/drivers/net/ethernet/renesas/sh_eth.c
>> @@ -753,6 +753,49 @@ static struct sh_eth_cpu_data rcar_gen2_
>>  	.rmiimode	= 1,
>>  	.magic		= 1,
>>  };
>> +
>> +/* R8A77980 */
>> +static struct sh_eth_cpu_data r8a77980_data = {
>> +	.soft_reset	= sh_eth_soft_reset_gether,
>> +
>> +	.set_duplex	= sh_eth_set_duplex,
>> +	.set_rate	= sh_eth_set_rate_gether,
>> +
>> +	.register_type  = SH_ETH_REG_GIGABIT,
>> +
>> +	.edtrr_trns	= EDTRR_TRNS_GETHER,
>> +	.ecsr_value	= ECSR_PSRTO | ECSR_LCHNG | ECSR_ICD | ECSR_MPD,
>> +	.ecsipr_value	= ECSIPR_PSRTOIP | ECSIPR_LCHNGIP | ECSIPR_ICDIP |
>> +			  ECSIPR_MPDIP,
>> +	.eesipr_value	= EESIPR_RFCOFIP | EESIPR_ECIIP |
>> +			  EESIPR_FTCIP | EESIPR_TDEIP | EESIPR_TFUFIP |
>> +			  EESIPR_FRIP | EESIPR_RDEIP | EESIPR_RFOFIP |
>> +			  EESIPR_RMAFIP | EESIPR_RRFIP |
>> +			  EESIPR_RTLFIP | EESIPR_RTSFIP |
>> +			  EESIPR_PREIP | EESIPR_CERFIP,
>> +
>> +	.tx_check       = EESR_FTC | EESR_CD | EESR_RTO,
>> +	.eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT |
>> +			  EESR_RFE | EESR_RDE | EESR_RFRMER |
>> +			  EESR_TFE | EESR_TDE | EESR_ECI,
>> +	.fdr_value	= 0x0000070f,
>> +
>> +	.apr		= 1,
>> +	.mpr		= 1,
>> +	.tpauser	= 1,
>> +	.bculr		= 1,
>> +	.hw_swap	= 1,
>> +	.nbst		= 1,
>> +	.rpadir		= 1,
>> +	.rpadir_value   = 2 << 16,
>> +	.no_trimd	= 1,
>> +	.no_ade		= 1,
>> +	.xdfar_rw	= 1,
>> +	.hw_checksum	= 1,
> 
>    Ugh, the "intelligent" checksum is not actually supported, just a simplistic
> checksum (from byte 14). I'll send a fix.

   Surprisingly, testing has shown that the manual is wrong and thus "intelligent"
checksumming is implemented. When I remove that flag, DHCP doesn't work.

>> +	.select_mii	= 1,
>> +	.magic		= 1,
>> +	.cexcr		= 1,
>> +};
>>  #endif /* CONFIG_OF */
>>  
>>  static void sh_eth_set_rate_sh7724(struct net_device *ndev)
> [...]

MBR, Sergei
diff mbox

Patch

Index: net-next/Documentation/devicetree/bindings/net/sh_eth.txt
===================================================================
--- net-next.orig/Documentation/devicetree/bindings/net/sh_eth.txt
+++ net-next/Documentation/devicetree/bindings/net/sh_eth.txt
@@ -14,6 +14,7 @@  Required properties:
 	      "renesas,ether-r8a7791"  if the device is a part of R8A7791 SoC.
 	      "renesas,ether-r8a7793"  if the device is a part of R8A7793 SoC.
 	      "renesas,ether-r8a7794"  if the device is a part of R8A7794 SoC.
+	      "renesas,gether-r8a77980" if the device is a part of R8A77980 SoC.
 	      "renesas,ether-r7s72100" if the device is a part of R7S72100 SoC.
 	      "renesas,rcar-gen1-ether" for a generic R-Car Gen1 device.
 	      "renesas,rcar-gen2-ether" for a generic R-Car Gen2 or RZ/G1
Index: net-next/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ net-next/drivers/net/ethernet/renesas/sh_eth.c
@@ -753,6 +753,49 @@  static struct sh_eth_cpu_data rcar_gen2_
 	.rmiimode	= 1,
 	.magic		= 1,
 };
+
+/* R8A77980 */
+static struct sh_eth_cpu_data r8a77980_data = {
+	.soft_reset	= sh_eth_soft_reset_gether,
+
+	.set_duplex	= sh_eth_set_duplex,
+	.set_rate	= sh_eth_set_rate_gether,
+
+	.register_type  = SH_ETH_REG_GIGABIT,
+
+	.edtrr_trns	= EDTRR_TRNS_GETHER,
+	.ecsr_value	= ECSR_PSRTO | ECSR_LCHNG | ECSR_ICD | ECSR_MPD,
+	.ecsipr_value	= ECSIPR_PSRTOIP | ECSIPR_LCHNGIP | ECSIPR_ICDIP |
+			  ECSIPR_MPDIP,
+	.eesipr_value	= EESIPR_RFCOFIP | EESIPR_ECIIP |
+			  EESIPR_FTCIP | EESIPR_TDEIP | EESIPR_TFUFIP |
+			  EESIPR_FRIP | EESIPR_RDEIP | EESIPR_RFOFIP |
+			  EESIPR_RMAFIP | EESIPR_RRFIP |
+			  EESIPR_RTLFIP | EESIPR_RTSFIP |
+			  EESIPR_PREIP | EESIPR_CERFIP,
+
+	.tx_check       = EESR_FTC | EESR_CD | EESR_RTO,
+	.eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT |
+			  EESR_RFE | EESR_RDE | EESR_RFRMER |
+			  EESR_TFE | EESR_TDE | EESR_ECI,
+	.fdr_value	= 0x0000070f,
+
+	.apr		= 1,
+	.mpr		= 1,
+	.tpauser	= 1,
+	.bculr		= 1,
+	.hw_swap	= 1,
+	.nbst		= 1,
+	.rpadir		= 1,
+	.rpadir_value   = 2 << 16,
+	.no_trimd	= 1,
+	.no_ade		= 1,
+	.xdfar_rw	= 1,
+	.hw_checksum	= 1,
+	.select_mii	= 1,
+	.magic		= 1,
+	.cexcr		= 1,
+};
 #endif /* CONFIG_OF */
 
 static void sh_eth_set_rate_sh7724(struct net_device *ndev)
@@ -3134,6 +3177,7 @@  static const struct of_device_id sh_eth_
 	{ .compatible = "renesas,ether-r8a7791", .data = &rcar_gen2_data },
 	{ .compatible = "renesas,ether-r8a7793", .data = &rcar_gen2_data },
 	{ .compatible = "renesas,ether-r8a7794", .data = &rcar_gen2_data },
+	{ .compatible = "renesas,gether-r8a77980", .data = &r8a77980_data },
 	{ .compatible = "renesas,ether-r7s72100", .data = &r7s72100_data },
 	{ .compatible = "renesas,rcar-gen1-ether", .data = &rcar_gen1_data },
 	{ .compatible = "renesas,rcar-gen2-ether", .data = &rcar_gen2_data },