Skip to contentSkip to conversation

net: phy: dp83867: Do not check sgmii if rgmii is already used

PATCH New Michal Simek 2 participants 9 messages Feb 7, 2020 – Feb 20, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: phy: dp83867: Do not check sgmii if rgmii is already used

There is no reason to check sgmii branch again when it is clear that phy interface is rgmii.

---

 drivers/net/phy/dp83867.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/phy/dp83867.c +1 -3
index 4d796e289c45..3178787ff1c7 100644
@@ -327,9 +327,7 @@ static int dp83867_config(struct phy_device *phydev)
 
 		phy_write_mmd(phydev, DP83867_DEVADDR,
 			      DP83867_RGMIIDCTL, delay);
-	}
-
-	if (phy_interface_is_sgmii(phydev)) {
+	} else if (phy_interface_is_sgmii(phydev)) {
 		phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR,
 			  (BMCR_ANENABLE | BMCR_FULLDPLX | BMCR_SPEED1000));
 
Signature · 1 line
2.25.0
#1 lore raw

PATCH 1/1 net: phy: dp83867: Do not check sgmii if rgmii is already used

Quoted 15 lines · Michal Simek

There is no reason to check sgmii branch again when it is clear that phy interface is rgmii.

---

  drivers/net/phy/dp83867.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/phy/dp83867.c +0 -0
index 4d796e289c45..3178787ff1c7 100644

drivers/net/phy/dp83867.c static int dp83867_config(struct phy_device *phydev) · line 333

Quoted 10 lines
drivers/net/phy/dp83867.c +1 -3
@@ -327,9 +327,7 @@ static int dp83867_config(struct phy_device *phydev)
 
  		phy_write_mmd(phydev, DP83867_DEVADDR,
  			      DP83867_RGMIIDCTL, delay);
-	}
-
-	if (phy_interface_is_sgmii(phydev)) {
+	} else if (phy_interface_is_sgmii(phydev)) {
  		phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR,
  			  (BMCR_ANENABLE | BMCR_FULLDPLX | BMCR_SPEED1000));
 

From one side I have no objections, but from another - I'd prefer to keep as is.

Signature · 2 lines
Best regards,
grygorii
#2 lore raw

PATCH 1/1 net: phy: dp83867: Do not check sgmii if rgmii is already used

Quoted 21 lines · Grygorii Strashko
Quoted 18 lines · Michal Simek

There is no reason to check sgmii branch again when it is clear that phy interface is rgmii.

---

  drivers/net/phy/dp83867.c | 4 +---

  1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/phy/dp83867.c +0 -2
index 4d796e289c45..3178787ff1c7 100644
@@ -327,9 +327,7 @@ static int dp83867_config(struct phy_device *phydev)
             phy_write_mmd(phydev, DP83867_DEVADDR,
                     DP83867_RGMIIDCTL, delay);
-    }
-
Quoted 8 lines
Quoted 5 lines
drivers/net/phy/dp83867.c +1 -1
-    if (phy_interface_is_sgmii(phydev)) {
+    } else if (phy_interface_is_sgmii(phydev)) {
           phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR,
                 (BMCR_ANENABLE | BMCR_FULLDPLX | BMCR_SPEED1000));

From one side I have no objections, but from another - I'd prefer to keep as is.

Can you please be elaborate on this one more?

Thanks,
Michal

#3 lore raw

PATCH 1/1 net: phy: dp83867: Do not check sgmii if rgmii is already used

Quoted 31 lines · Michal Simek
Quoted 21 lines · Grygorii Strashko
Quoted 18 lines · Michal Simek

There is no reason to check sgmii branch again when it is clear that phy interface is rgmii.

---

 ? drivers/net/phy/dp83867.c | 4 +---

? 1 file changed, 1 insertion(+), 3 deletions(-)

drivers/net/phy/dp83867.c +0 -2
index 4d796e289c45..3178787ff1c7 100644
@@ -327,9 +327,7 @@ static int dp83867_config(struct phy_device *phydev)
 ? ????????? phy_write_mmd(phydev, DP83867_DEVADDR,
 ??????????????????? DP83867_RGMIIDCTL, delay);
-??? }
-
Quoted 8 lines

drivers/net/phy/dp83867.c static int dp83867_config(struct phy_device *phydev) · line 332

Quoted 5 lines
drivers/net/phy/dp83867.c +1 -1
-??? if (phy_interface_is_sgmii(phydev)) {
+??? } else if (phy_interface_is_sgmii(phydev)) {
 ????????? phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR,
 ??????????????? (BMCR_ANENABLE | BMCR_FULLDPLX | BMCR_SPEED1000));
 

From one side I have no objections, but from another - I'd prefer to
keep as is.

Quoted 1 line

Can you please be elaborate on this one more?

- keep the same way as in the Kernel
- code readability

Signature · 2 lines
Best regards,
grygorii
#4 lore raw

PATCH 1/1 net: phy: dp83867: Do not check sgmii if rgmii is already used

Quoted 36 lines · Grygorii Strashko
Quoted 33 lines · Michal Simek
Quoted 31 lines · Grygorii Strashko
Quoted 24 lines · Michal Simek

There is no reason to check sgmii branch again when it is clear that phy
interface is rgmii.

---

?? drivers/net/phy/dp83867.c | 4 +---
?? 1 file changed, 1 insertion(+), 3 deletions(-)

drivers/net/phy/dp83867.c +1 -3
index 4d796e289c45..3178787ff1c7 100644
@@ -327,9 +327,7 @@ static int dp83867_config(struct phy_device
 *phydev)
 ?? ????????? phy_write_mmd(phydev, DP83867_DEVADDR,
 ???????????????????? DP83867_RGMIIDCTL, delay);
-??? }
-
-??? if (phy_interface_is_sgmii(phydev)) {
+??? } else if (phy_interface_is_sgmii(phydev)) {
 ?????????? phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR,
 ???????????????? (BMCR_ANENABLE | BMCR_FULLDPLX | BMCR_SPEED1000));
Quoted 1 line

?

?From one side I have no objections, but from another - I'd prefer to keep as is.

Quoted 3 lines
Quoted 1 line

Can you please be elaborate on this one more?

- keep the same way as in the Kernel

If kernel does it in the same way it should be also fixed.

I have been checking yesterday dt binding docs in u-boot and in Linux and surprisingly they are different.

ti,dp83867-rxctrl-strap-quirk is supported in u-boot but not described

ti,clk-output-sel is supported but even in code is said that it is optional property.

ti,min-output-impedance, ti,max-output-impedance and ti,fifo-depth are not documented in dt binding doc

ti,sgmii-ref-clock-output-enable is not supported in u-boot but it is in Linux and we are using this feature.

Can you please sync it if you want to keep it in the same was as is done in Linux?

Quoted 1 line

- code readability

I don't think this is really changing code readability. For improving readability would be the best to move bodies of these ifs to separate functions and not have dp83867_config() ~140 lines long.

Thanks,
Michal

#5 lore raw

PATCH 1/1 net: phy: dp83867: Do not check sgmii if rgmii is already used

Quoted 48 lines · Michal Simek
Quoted 36 lines · Grygorii Strashko
Quoted 33 lines · Michal Simek
Quoted 31 lines · Grygorii Strashko
Quoted 15 lines · Michal Simek

There is no reason to check sgmii branch again when it is clear that phy
interface is rgmii.

---

 ?? drivers/net/phy/dp83867.c | 4 +---

?? 1 file changed, 1 insertion(+), 3 deletions(-)

drivers/net/phy/dp83867.c +0 -0
index 4d796e289c45..3178787ff1c7 100644

drivers/net/phy/dp83867.c static int dp83867_config(struct phy_device · line 333

Quoted 10 lines
drivers/net/phy/dp83867.c +1 -3
@@ -327,9 +327,7 @@ static int dp83867_config(struct phy_device
 *phydev)
 ?? ????????? phy_write_mmd(phydev, DP83867_DEVADDR,
 ???????????????????? DP83867_RGMIIDCTL, delay);
-??? }
-
-??? if (phy_interface_is_sgmii(phydev)) {
+??? } else if (phy_interface_is_sgmii(phydev)) {
 ?????????? phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR,
 ???????????????? (BMCR_ANENABLE | BMCR_FULLDPLX | BMCR_SPEED1000));
 

?From one side I have no objections, but from another - I'd prefer to
keep as is.

Quoted 3 lines
Quoted 1 line

Can you please be elaborate on this one more?

- keep the same way as in the Kernel

If kernel does it in the same way it should be also fixed.

I have been checking yesterday dt binding docs in u-boot and in Linux and surprisingly they are different.

ti,dp83867-rxctrl-strap-quirk is supported in u-boot but not described

Quoted 9 lines

ti,clk-output-sel is supported but even in code is said that it is optional property.

ti,min-output-impedance, ti,max-output-impedance and ti,fifo-depth are not documented in dt binding doc

ti,sgmii-ref-clock-output-enable is not supported in u-boot but it is in Linux and we are using this feature.

My understanding is that u-boot goal is to have uboot-dt == kernel-dt and current approach add DT+bindings to the kernel first.

So, if you check most of u-boot bindings are missed or obsolete.

Quoted 2 lines

Can you please sync it if you want to keep it in the same was as is done in Linux?

So, may be it can be just deleted.

Quoted 6 lines
Quoted 2 lines

- code readability

I don't think this is really changing code readability. For improving readability would be the best to move bodies of these ifs to separate functions and not have dp83867_config() ~140 lines long.

It really too minor change to fight for. But if you wish you can update kernel driver as per-above your proposal and then port it in u-boot.

Signature · 2 lines
Best regards,
grygorii
#6 lore raw

PATCH 1/1 net: phy: dp83867: Do not check sgmii if rgmii is already used

Quoted 65 lines · Grygorii Strashko
Quoted 48 lines · Michal Simek
Quoted 36 lines · Grygorii Strashko
Quoted 33 lines · Michal Simek
Quoted 31 lines · Grygorii Strashko
Quoted 24 lines · Michal Simek

There is no reason to check sgmii branch again when it is clear that phy
interface is rgmii.

---

??? drivers/net/phy/dp83867.c | 4 +---
??? 1 file changed, 1 insertion(+), 3 deletions(-)

drivers/net/phy/dp83867.c +1 -3
index 4d796e289c45..3178787ff1c7 100644
@@ -327,9 +327,7 @@ static int dp83867_config(struct phy_device
 *phydev)
 ??? ????????? phy_write_mmd(phydev, DP83867_DEVADDR,
 ????????????????????? DP83867_RGMIIDCTL, delay);
-??? }
-
-??? if (phy_interface_is_sgmii(phydev)) {
+??? } else if (phy_interface_is_sgmii(phydev)) {
 ??????????? phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR,
 ????????????????? (BMCR_ANENABLE | BMCR_FULLDPLX | BMCR_SPEED1000));
Quoted 1 line

??

??From one side I have no objections, but from another - I'd prefer to keep as is.

Quoted 3 lines
Quoted 1 line

Can you please be elaborate on this one more?

- keep the same way as in the Kernel

If kernel does it in the same way it should be also fixed.

I have been checking yesterday dt binding docs in u-boot and in Linux and surprisingly they are different.

ti,dp83867-rxctrl-strap-quirk is supported in u-boot but not described

Quoted 9 lines

ti,clk-output-sel is supported but even in code is said that it is optional property.

ti,min-output-impedance, ti,max-output-impedance and ti,fifo-depth? are not documented in dt binding doc

ti,sgmii-ref-clock-output-enable is not supported in u-boot but it is in Linux and we are using this feature.

My understanding is that u-boot goal is to have uboot-dt == kernel-dt and current
approach add DT+bindings to the kernel first.

Quoted 6 lines

So, if you check most of u-boot bindings are missed or obsolete.

Quoted 2 lines

Can you please sync it if you want to keep it in the same was as is done in Linux?

So, may be it can be just deleted.

I am ok with that.

Quoted 11 lines
Quoted 7 lines
Quoted 3 lines

- code readability

I don't think this is really changing code readability. For improving readability would be the best to move bodies of these ifs to separate functions and not have dp83867_config() ~140 lines long.

It really too minor change to fight for. But if you wish you can update kernel
driver as per-above your proposal and then port it in u-boot.

I was looking at latest kernel code and it is designed differently there.
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/net/phy/dp83867.c?h=next-20200213#n479

there is
if rgmii or sgmii
if rgmii
io impedance
if sgmii

in u-boot you have
if rgmii
if sgmii
io impedance

I am ok with having this in sync but that's not what we have today.

Thanks,
Michal

#7 lore raw

PATCH 1/1 net: phy: dp83867: Do not check sgmii if rgmii is already used

Quoted 97 lines · Michal Simek
Quoted 65 lines · Grygorii Strashko
Quoted 48 lines · Michal Simek
Quoted 36 lines · Grygorii Strashko
Quoted 33 lines · Michal Simek
Quoted 31 lines · Grygorii Strashko
Quoted 15 lines · Michal Simek

There is no reason to check sgmii branch again when it is clear that phy
interface is rgmii.

---

 ??? drivers/net/phy/dp83867.c | 4 +---

??? 1 file changed, 1 insertion(+), 3 deletions(-)

drivers/net/phy/dp83867.c +0 -0
index 4d796e289c45..3178787ff1c7 100644

drivers/net/phy/dp83867.c static int dp83867_config(struct phy_device · line 333

Quoted 10 lines
drivers/net/phy/dp83867.c +1 -3
@@ -327,9 +327,7 @@ static int dp83867_config(struct phy_device
 *phydev)
 ??? ????????? phy_write_mmd(phydev, DP83867_DEVADDR,
 ????????????????????? DP83867_RGMIIDCTL, delay);
-??? }
-
-??? if (phy_interface_is_sgmii(phydev)) {
+??? } else if (phy_interface_is_sgmii(phydev)) {
 ??????????? phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR,
 ????????????????? (BMCR_ANENABLE | BMCR_FULLDPLX | BMCR_SPEED1000));
 

??From one side I have no objections, but from another - I'd prefer to
keep as is.

Quoted 3 lines
Quoted 1 line

Can you please be elaborate on this one more?

- keep the same way as in the Kernel

If kernel does it in the same way it should be also fixed.

I have been checking yesterday dt binding docs in u-boot and in Linux and surprisingly they are different.

ti,dp83867-rxctrl-strap-quirk is supported in u-boot but not described

Quoted 9 lines

ti,clk-output-sel is supported but even in code is said that it is optional property.

ti,min-output-impedance, ti,max-output-impedance and ti,fifo-depth? are not documented in dt binding doc

ti,sgmii-ref-clock-output-enable is not supported in u-boot but it is in Linux and we are using this feature.

My understanding is that u-boot goal is to have uboot-dt == kernel-dt and current
approach add DT+bindings to the kernel first.

Quoted 6 lines

So, if you check most of u-boot bindings are missed or obsolete.

Quoted 2 lines

Can you please sync it if you want to keep it in the same was as is done in Linux?

So, may be it can be just deleted.

I am ok with that.

Quoted 11 lines
Quoted 7 lines
Quoted 3 lines

- code readability

I don't think this is really changing code readability. For improving readability would be the best to move bodies of these ifs to separate functions and not have dp83867_config() ~140 lines long.

It really too minor change to fight for. But if you wish you can update kernel
driver as per-above your proposal and then port it in u-boot.

I was looking at latest kernel code and it is designed differently there.
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/net/phy/dp83867.c?h=next-20200213#n479

there is
if rgmii or sgmii
if rgmii
io impedance
if sgmii

Quoted 6 lines

in u-boot you have
if rgmii
if sgmii
io impedance

I am ok with having this in sync but that's not what we have today.

Yes. Unfortunately, The kernel moves forward faster than u-boot and people not always interesting to port their patches in u-boot :(
Plus, not all functionality, enabled in the kernel, is really required by u-boot.

Signature · 2 lines
Best regards,
grygorii
#8 lore raw

PATCH 1/1 net: phy: dp83867: Do not check sgmii if rgmii is already used

Quoted 111 lines · Grygorii Strashko
Quoted 108 lines · Michal Simek
Quoted 69 lines · Grygorii Strashko
Quoted 54 lines · Michal Simek
Quoted 39 lines · Grygorii Strashko
Quoted 36 lines · Michal Simek
Quoted 34 lines · Grygorii Strashko
Quoted 24 lines · Michal Simek

There is no reason to check sgmii branch again when it is clear that
phy
interface is rgmii.

---

???? drivers/net/phy/dp83867.c | 4 +--- ???? 1 file changed, 1 insertion(+), 3 deletions(-)

drivers/net/phy/dp83867.c +1 -3
index 4d796e289c45..3178787ff1c7 100644
@@ -327,9 +327,7 @@ static int dp83867_config(struct phy_device
 *phydev)
 ???? ????????? phy_write_mmd(phydev, DP83867_DEVADDR,
 ?????????????????????? DP83867_RGMIIDCTL, delay);
-??? }
-
-??? if (phy_interface_is_sgmii(phydev)) {
+??? } else if (phy_interface_is_sgmii(phydev)) {
 ???????????? phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR,
Quoted 3 lines

?????????????????? (BMCR_ANENABLE | BMCR_FULLDPLX | BMCR_SPEED1000));
???

???From one side I have no objections, but from another - I'd prefer to
keep as is.

Quoted 3 lines
Quoted 1 line

Can you please be elaborate on this one more?

- keep the same way as in the Kernel

If kernel does it in the same way it should be also fixed.

I have been checking yesterday dt binding docs in u-boot and in Linux and surprisingly they are different.

ti,dp83867-rxctrl-strap-quirk is supported in u-boot but not described

ti,clk-output-sel is supported but even in code is said that it is optional property.

Quoted 7 lines

ti,min-output-impedance, ti,max-output-impedance and ti,fifo-depth? are not documented in dt binding doc

ti,sgmii-ref-clock-output-enable is not supported in u-boot but it is in
Linux and we are using this feature.

My understanding is that u-boot goal is to have uboot-dt == kernel-dt and current
approach add DT+bindings to the kernel first.

Quoted 7 lines

So, if you check most of u-boot bindings are missed or obsolete.

Quoted 3 lines

Can you please sync it if you want to keep it in the same was as is done
in Linux?

So, may be it can be just deleted.

I am ok with that.

Quoted 11 lines
Quoted 7 lines
Quoted 3 lines

- code readability

I don't think this is really changing code readability. For improving readability would be the best to move bodies of these ifs to separate functions and not have dp83867_config() ~140 lines long.

It really too minor change to fight for. But if you wish you can update kernel
driver as per-above your proposal and then port it in u-boot.

I was looking at latest kernel code and it is designed differently there.
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/net/phy/dp83867.c?h=next-20200213#n479

there is
if rgmii or sgmii
if rgmii
io impedance
if sgmii

in u-boot you have
if rgmii
if sgmii
io impedance

Quoted 7 lines
Quoted 1 line

I am ok with having this in sync but that's not what we have today.

Yes. Unfortunately, The kernel moves forward faster than u-boot and people not always
interesting to port their patches in u-boot :(
Plus, not all functionality, enabled in the kernel, is really required by u-boot.

Anyway I have sent the patch for sgmii-ref-clock. If you can review that will be great.
And if you want to sync it later I am fine with it.

Thanks,
Michal