diff mbox series

[v2,3/3] net: stmmac: dwmac-qcom-ethqos: add support for EMAC on qcs615 platforms

Message ID 20241224-schema-v2-3-000ea9044c49@quicinc.com (mailing list archive)
State New
Headers show
Series Add standalone ethernet MAC entries for qcs615 | expand

Commit Message

Yijie Yang Dec. 24, 2024, 3:07 a.m. UTC
qcs615 uses EMAC version 2.3.1, add the relevant defines and add the new
compatible.

Signed-off-by: Yijie Yang <quic_yijiyang@quicinc.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Dmitry Baryshkov Dec. 24, 2024, 4:18 a.m. UTC | #1
On Tue, Dec 24, 2024 at 11:07:03AM +0800, Yijie Yang wrote:
> qcs615 uses EMAC version 2.3.1, add the relevant defines and add the new
> compatible.
> 
> Signed-off-by: Yijie Yang <quic_yijiyang@quicinc.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> index 901a3c1959fa57efb078da795ad4f92a8b6f71e1..8c76beaee48821eb2853f4e3f8bfd37db8cadf78 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> @@ -249,6 +249,22 @@ static const struct ethqos_emac_driver_data emac_v2_1_0_data = {
>  	.has_emac_ge_3 = false,
>  };
>  
> +static const struct ethqos_emac_por emac_v2_3_1_por[] = {
> +	{ .offset = RGMII_IO_MACRO_CONFIG,	.value = 0x00C01343 },
> +	{ .offset = SDCC_HC_REG_DLL_CONFIG,	.value = 0x2004642C },

lowercase the hex, please.

> +	{ .offset = SDCC_HC_REG_DDR_CONFIG,	.value = 0x00000000 },
> +	{ .offset = SDCC_HC_REG_DLL_CONFIG2,	.value = 0x00200000 },
> +	{ .offset = SDCC_USR_CTL,		.value = 0x00010800 },
> +	{ .offset = RGMII_IO_MACRO_CONFIG2,	.value = 0x00002060 },
> +};
> +
> +static const struct ethqos_emac_driver_data emac_v2_3_1_data = {
> +	.por = emac_v2_3_1_por,
> +	.num_por = ARRAY_SIZE(emac_v2_3_1_por),
> +	.rgmii_config_loopback_en = true,
> +	.has_emac_ge_3 = false,
> +};

Modulo emac_v2_3_1_por vs emac_v2_3_0_por, this is the same as
emac_v2_3_0_data. Which means that bindings for qcs615-ethqos should be
corrected to use qcom,qcs404-ethqos as as fallback entry, making this
patch unused. Please correct the bindings instead.

> +
>  static const struct ethqos_emac_por emac_v3_0_0_por[] = {
>  	{ .offset = RGMII_IO_MACRO_CONFIG,	.value = 0x40c01343 },
>  	{ .offset = SDCC_HC_REG_DLL_CONFIG,	.value = 0x2004642c },
> @@ -898,6 +914,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
>  
>  static const struct of_device_id qcom_ethqos_match[] = {
>  	{ .compatible = "qcom,qcs404-ethqos", .data = &emac_v2_3_0_data},
> +	{ .compatible = "qcom,qcs615-ethqos", .data = &emac_v2_3_1_data},
>  	{ .compatible = "qcom,sa8775p-ethqos", .data = &emac_v4_0_0_data},
>  	{ .compatible = "qcom,sc8280xp-ethqos", .data = &emac_v3_0_0_data},
>  	{ .compatible = "qcom,sm8150-ethqos", .data = &emac_v2_1_0_data},
> 
> -- 
> 2.34.1
>
Yijie Yang Dec. 24, 2024, 4:36 a.m. UTC | #2
On 2024-12-24 12:18, Dmitry Baryshkov wrote:
> On Tue, Dec 24, 2024 at 11:07:03AM +0800, Yijie Yang wrote:
>> qcs615 uses EMAC version 2.3.1, add the relevant defines and add the new
>> compatible.
>>
>> Signed-off-by: Yijie Yang <quic_yijiyang@quicinc.com>
>> ---
>>   drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 17 +++++++++++++++++
>>   1 file changed, 17 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
>> index 901a3c1959fa57efb078da795ad4f92a8b6f71e1..8c76beaee48821eb2853f4e3f8bfd37db8cadf78 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
>> @@ -249,6 +249,22 @@ static const struct ethqos_emac_driver_data emac_v2_1_0_data = {
>>   	.has_emac_ge_3 = false,
>>   };
>>   
>> +static const struct ethqos_emac_por emac_v2_3_1_por[] = {
>> +	{ .offset = RGMII_IO_MACRO_CONFIG,	.value = 0x00C01343 },
>> +	{ .offset = SDCC_HC_REG_DLL_CONFIG,	.value = 0x2004642C },
> 
> lowercase the hex, please.

I will take care of it.

> 
>> +	{ .offset = SDCC_HC_REG_DDR_CONFIG,	.value = 0x00000000 },
>> +	{ .offset = SDCC_HC_REG_DLL_CONFIG2,	.value = 0x00200000 },
>> +	{ .offset = SDCC_USR_CTL,		.value = 0x00010800 },
>> +	{ .offset = RGMII_IO_MACRO_CONFIG2,	.value = 0x00002060 },
>> +};
>> +
>> +static const struct ethqos_emac_driver_data emac_v2_3_1_data = {
>> +	.por = emac_v2_3_1_por,
>> +	.num_por = ARRAY_SIZE(emac_v2_3_1_por),
>> +	.rgmii_config_loopback_en = true,
>> +	.has_emac_ge_3 = false,
>> +};
> 
> Modulo emac_v2_3_1_por vs emac_v2_3_0_por, this is the same as
> emac_v2_3_0_data. Which means that bindings for qcs615-ethqos should be
> corrected to use qcom,qcs404-ethqos as as fallback entry, making this
> patch unused. Please correct the bindings instead.

Although they currently share the same data, they are actually two 
different versions. Their differences are not apparent now but will 
become evident once new features are uploaded. If I revert to 
qcom,qcs404-ethqos now, it will be challenging to distinguish between 
them in the future.

> 
>> +
>>   static const struct ethqos_emac_por emac_v3_0_0_por[] = {
>>   	{ .offset = RGMII_IO_MACRO_CONFIG,	.value = 0x40c01343 },
>>   	{ .offset = SDCC_HC_REG_DLL_CONFIG,	.value = 0x2004642c },
>> @@ -898,6 +914,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
>>   
>>   static const struct of_device_id qcom_ethqos_match[] = {
>>   	{ .compatible = "qcom,qcs404-ethqos", .data = &emac_v2_3_0_data},
>> +	{ .compatible = "qcom,qcs615-ethqos", .data = &emac_v2_3_1_data},
>>   	{ .compatible = "qcom,sa8775p-ethqos", .data = &emac_v4_0_0_data},
>>   	{ .compatible = "qcom,sc8280xp-ethqos", .data = &emac_v3_0_0_data},
>>   	{ .compatible = "qcom,sm8150-ethqos", .data = &emac_v2_1_0_data},
>>
>> -- 
>> 2.34.1
>>
>
Dmitry Baryshkov Dec. 24, 2024, 5:05 a.m. UTC | #3
On Tue, Dec 24, 2024 at 12:36:29PM +0800, Yijie Yang wrote:
> 
> 
> On 2024-12-24 12:18, Dmitry Baryshkov wrote:
> > On Tue, Dec 24, 2024 at 11:07:03AM +0800, Yijie Yang wrote:
> > > qcs615 uses EMAC version 2.3.1, add the relevant defines and add the new
> > > compatible.
> > > 
> > > Signed-off-by: Yijie Yang <quic_yijiyang@quicinc.com>
> > > ---
> > >   drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 17 +++++++++++++++++
> > >   1 file changed, 17 insertions(+)
> > > 
> > > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> > > index 901a3c1959fa57efb078da795ad4f92a8b6f71e1..8c76beaee48821eb2853f4e3f8bfd37db8cadf78 100644
> > > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> > > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> > > @@ -249,6 +249,22 @@ static const struct ethqos_emac_driver_data emac_v2_1_0_data = {
> > >   	.has_emac_ge_3 = false,
> > >   };
> > > +static const struct ethqos_emac_por emac_v2_3_1_por[] = {
> > > +	{ .offset = RGMII_IO_MACRO_CONFIG,	.value = 0x00C01343 },
> > > +	{ .offset = SDCC_HC_REG_DLL_CONFIG,	.value = 0x2004642C },
> > 
> > lowercase the hex, please.
> 
> I will take care of it.
> 
> > 
> > > +	{ .offset = SDCC_HC_REG_DDR_CONFIG,	.value = 0x00000000 },
> > > +	{ .offset = SDCC_HC_REG_DLL_CONFIG2,	.value = 0x00200000 },
> > > +	{ .offset = SDCC_USR_CTL,		.value = 0x00010800 },
> > > +	{ .offset = RGMII_IO_MACRO_CONFIG2,	.value = 0x00002060 },
> > > +};
> > > +
> > > +static const struct ethqos_emac_driver_data emac_v2_3_1_data = {
> > > +	.por = emac_v2_3_1_por,
> > > +	.num_por = ARRAY_SIZE(emac_v2_3_1_por),
> > > +	.rgmii_config_loopback_en = true,
> > > +	.has_emac_ge_3 = false,
> > > +};
> > 
> > Modulo emac_v2_3_1_por vs emac_v2_3_0_por, this is the same as
> > emac_v2_3_0_data. Which means that bindings for qcs615-ethqos should be
> > corrected to use qcom,qcs404-ethqos as as fallback entry, making this
> > patch unused. Please correct the bindings instead.
> 
> Although they currently share the same data, they are actually two different
> versions. Their differences are not apparent now but will become evident
> once new features are uploaded. If I revert to qcom,qcs404-ethqos now, it
> will be challenging to distinguish between them in the future.

Which features? Moreover, note, the use of the fallback doesn't preclude
you from addign a new compat entry later on. By having a fallback you
simply declare that the device A is also compatible with the device B.

> 
> > 
> > > +
> > >   static const struct ethqos_emac_por emac_v3_0_0_por[] = {
> > >   	{ .offset = RGMII_IO_MACRO_CONFIG,	.value = 0x40c01343 },
> > >   	{ .offset = SDCC_HC_REG_DLL_CONFIG,	.value = 0x2004642c },
> > > @@ -898,6 +914,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
> > >   static const struct of_device_id qcom_ethqos_match[] = {
> > >   	{ .compatible = "qcom,qcs404-ethqos", .data = &emac_v2_3_0_data},
> > > +	{ .compatible = "qcom,qcs615-ethqos", .data = &emac_v2_3_1_data},
> > >   	{ .compatible = "qcom,sa8775p-ethqos", .data = &emac_v4_0_0_data},
> > >   	{ .compatible = "qcom,sc8280xp-ethqos", .data = &emac_v3_0_0_data},
> > >   	{ .compatible = "qcom,sm8150-ethqos", .data = &emac_v2_1_0_data},
> > > 
> > > -- 
> > > 2.34.1
> > > 
> > 
> 
> -- 
> Best Regards,
> Yijie
>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
index 901a3c1959fa57efb078da795ad4f92a8b6f71e1..8c76beaee48821eb2853f4e3f8bfd37db8cadf78 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
@@ -249,6 +249,22 @@  static const struct ethqos_emac_driver_data emac_v2_1_0_data = {
 	.has_emac_ge_3 = false,
 };
 
+static const struct ethqos_emac_por emac_v2_3_1_por[] = {
+	{ .offset = RGMII_IO_MACRO_CONFIG,	.value = 0x00C01343 },
+	{ .offset = SDCC_HC_REG_DLL_CONFIG,	.value = 0x2004642C },
+	{ .offset = SDCC_HC_REG_DDR_CONFIG,	.value = 0x00000000 },
+	{ .offset = SDCC_HC_REG_DLL_CONFIG2,	.value = 0x00200000 },
+	{ .offset = SDCC_USR_CTL,		.value = 0x00010800 },
+	{ .offset = RGMII_IO_MACRO_CONFIG2,	.value = 0x00002060 },
+};
+
+static const struct ethqos_emac_driver_data emac_v2_3_1_data = {
+	.por = emac_v2_3_1_por,
+	.num_por = ARRAY_SIZE(emac_v2_3_1_por),
+	.rgmii_config_loopback_en = true,
+	.has_emac_ge_3 = false,
+};
+
 static const struct ethqos_emac_por emac_v3_0_0_por[] = {
 	{ .offset = RGMII_IO_MACRO_CONFIG,	.value = 0x40c01343 },
 	{ .offset = SDCC_HC_REG_DLL_CONFIG,	.value = 0x2004642c },
@@ -898,6 +914,7 @@  static int qcom_ethqos_probe(struct platform_device *pdev)
 
 static const struct of_device_id qcom_ethqos_match[] = {
 	{ .compatible = "qcom,qcs404-ethqos", .data = &emac_v2_3_0_data},
+	{ .compatible = "qcom,qcs615-ethqos", .data = &emac_v2_3_1_data},
 	{ .compatible = "qcom,sa8775p-ethqos", .data = &emac_v4_0_0_data},
 	{ .compatible = "qcom,sc8280xp-ethqos", .data = &emac_v3_0_0_data},
 	{ .compatible = "qcom,sm8150-ethqos", .data = &emac_v2_1_0_data},