* [PATCH net v3 0/2] emaclite: improve error handling and minor cleanup
@ 2022-05-02 7:27 Radhey Shyam Pandey
2022-05-02 7:27 ` [PATCH net v3 1/2] net: emaclite: Don't advertise 1000BASE-T and do auto negotiation Radhey Shyam Pandey
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Radhey Shyam Pandey @ 2022-05-02 7:27 UTC (permalink / raw)
To: davem, kuba, pabeni, michal.simek, andrew
Cc: netdev, linux-kernel, git, Radhey Shyam Pandey
This patchset does error handling for of_address_to_resource() and also
removes "Don't advertise 1000BASE-T" and auto negotiation.
Changes for v3:
- Resolve git apply conflicts for 2/2 patch.
Changes for v2:
- Added Andrew's reviewed by tag in 1/2 patch.
- Move ret to down to align with reverse xmas tree style in 2/2 patch.
- Also add fixes tag in 2/2 patch.
- Specify tree name in subject prefix.
Shravya Kumbham (2):
net: emaclite: Don't advertise 1000BASE-T and do auto negotiation
net: emaclite: Add error handling for of_address_to_resource()
drivers/net/ethernet/xilinx/xilinx_emaclite.c | 30 +++++++++++----------------
1 file changed, 12 insertions(+), 18 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net v3 1/2] net: emaclite: Don't advertise 1000BASE-T and do auto negotiation
2022-05-02 7:27 [PATCH net v3 0/2] emaclite: improve error handling and minor cleanup Radhey Shyam Pandey
@ 2022-05-02 7:27 ` Radhey Shyam Pandey
2022-05-02 7:27 ` [PATCH net v3 2/2] net: emaclite: Add error handling for of_address_to_resource() Radhey Shyam Pandey
2022-05-03 9:20 ` [PATCH net v3 0/2] emaclite: improve error handling and minor cleanup patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Radhey Shyam Pandey @ 2022-05-02 7:27 UTC (permalink / raw)
To: davem, kuba, pabeni, michal.simek, andrew
Cc: netdev, linux-kernel, git, Shravya Kumbham, Radhey Shyam Pandey
From: Shravya Kumbham <shravya.kumbham@xilinx.com>
In xemaclite_open() function we are setting the max speed of
emaclite to 100Mb using phy_set_max_speed() function so,
there is no need to write the advertising registers to stop
giga-bit speed and the phy_start() function starts the
auto-negotiation so, there is no need to handle it separately
using advertising registers. Remove the phy_read and phy_write
of advertising registers in xemaclite_open() function.
Signed-off-by: Shravya Kumbham <shravya.kumbham@xilinx.com>
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
Changes for v3:
- None
Changes for v2:
- Added Andrew's Reviewed-by tag.
---
drivers/net/ethernet/xilinx/xilinx_emaclite.c | 15 ---------------
1 file changed, 15 deletions(-)
diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index 57a24f62e353..f7394a5160cf 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -926,8 +926,6 @@ static int xemaclite_open(struct net_device *dev)
xemaclite_disable_interrupts(lp);
if (lp->phy_node) {
- u32 bmcr;
-
lp->phy_dev = of_phy_connect(lp->ndev, lp->phy_node,
xemaclite_adjust_link, 0,
PHY_INTERFACE_MODE_MII);
@@ -938,19 +936,6 @@ static int xemaclite_open(struct net_device *dev)
/* EmacLite doesn't support giga-bit speeds */
phy_set_max_speed(lp->phy_dev, SPEED_100);
-
- /* Don't advertise 1000BASE-T Full/Half duplex speeds */
- phy_write(lp->phy_dev, MII_CTRL1000, 0);
-
- /* Advertise only 10 and 100mbps full/half duplex speeds */
- phy_write(lp->phy_dev, MII_ADVERTISE, ADVERTISE_ALL |
- ADVERTISE_CSMA);
-
- /* Restart auto negotiation */
- bmcr = phy_read(lp->phy_dev, MII_BMCR);
- bmcr |= (BMCR_ANENABLE | BMCR_ANRESTART);
- phy_write(lp->phy_dev, MII_BMCR, bmcr);
-
phy_start(lp->phy_dev);
}
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net v3 2/2] net: emaclite: Add error handling for of_address_to_resource()
2022-05-02 7:27 [PATCH net v3 0/2] emaclite: improve error handling and minor cleanup Radhey Shyam Pandey
2022-05-02 7:27 ` [PATCH net v3 1/2] net: emaclite: Don't advertise 1000BASE-T and do auto negotiation Radhey Shyam Pandey
@ 2022-05-02 7:27 ` Radhey Shyam Pandey
2022-05-03 9:20 ` [PATCH net v3 0/2] emaclite: improve error handling and minor cleanup patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Radhey Shyam Pandey @ 2022-05-02 7:27 UTC (permalink / raw)
To: davem, kuba, pabeni, michal.simek, andrew
Cc: netdev, linux-kernel, git, Shravya Kumbham, Radhey Shyam Pandey
From: Shravya Kumbham <shravya.kumbham@xilinx.com>
check the return value of of_address_to_resource() and also add
missing of_node_put() for np and npp nodes.
Fixes: e0a3bc65448c ("net: emaclite: Support multiple phys connected to one MDIO bus")
Addresses-Coverity: Event check_return value.
Signed-off-by: Shravya Kumbham <shravya.kumbham@xilinx.com>
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
---
Changes for v3:
- Fix conflict on net.
Changes for v2:
- Move ret further down to align with RXT as suggested by Andrew.
- Add Fixes tag.
---
drivers/net/ethernet/xilinx/xilinx_emaclite.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index f7394a5160cf..d770b3ac3f74 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -823,10 +823,10 @@ static int xemaclite_mdio_write(struct mii_bus *bus, int phy_id, int reg,
static int xemaclite_mdio_setup(struct net_local *lp, struct device *dev)
{
struct mii_bus *bus;
- int rc;
struct resource res;
struct device_node *np = of_get_parent(lp->phy_node);
struct device_node *npp;
+ int rc, ret;
/* Don't register the MDIO bus if the phy_node or its parent node
* can't be found.
@@ -836,8 +836,14 @@ static int xemaclite_mdio_setup(struct net_local *lp, struct device *dev)
return -ENODEV;
}
npp = of_get_parent(np);
-
- of_address_to_resource(npp, 0, &res);
+ ret = of_address_to_resource(npp, 0, &res);
+ of_node_put(npp);
+ if (ret) {
+ dev_err(dev, "%s resource error!\n",
+ dev->of_node->full_name);
+ of_node_put(np);
+ return ret;
+ }
if (lp->ndev->mem_start != res.start) {
struct phy_device *phydev;
phydev = of_phy_find_device(lp->phy_node);
@@ -846,6 +852,7 @@ static int xemaclite_mdio_setup(struct net_local *lp, struct device *dev)
"MDIO of the phy is not registered yet\n");
else
put_device(&phydev->mdio.dev);
+ of_node_put(np);
return 0;
}
@@ -858,6 +865,7 @@ static int xemaclite_mdio_setup(struct net_local *lp, struct device *dev)
bus = mdiobus_alloc();
if (!bus) {
dev_err(dev, "Failed to allocate mdiobus\n");
+ of_node_put(np);
return -ENOMEM;
}
@@ -870,6 +878,7 @@ static int xemaclite_mdio_setup(struct net_local *lp, struct device *dev)
bus->parent = dev;
rc = of_mdiobus_register(bus, np);
+ of_node_put(np);
if (rc) {
dev_err(dev, "Failed to register mdio bus.\n");
goto err_register;
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net v3 0/2] emaclite: improve error handling and minor cleanup
2022-05-02 7:27 [PATCH net v3 0/2] emaclite: improve error handling and minor cleanup Radhey Shyam Pandey
2022-05-02 7:27 ` [PATCH net v3 1/2] net: emaclite: Don't advertise 1000BASE-T and do auto negotiation Radhey Shyam Pandey
2022-05-02 7:27 ` [PATCH net v3 2/2] net: emaclite: Add error handling for of_address_to_resource() Radhey Shyam Pandey
@ 2022-05-03 9:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-05-03 9:20 UTC (permalink / raw)
To: Radhey Shyam Pandey
Cc: davem, kuba, pabeni, michal.simek, andrew, netdev, linux-kernel, git
Hello:
This series was applied to netdev/net.git (master)
by Paolo Abeni <pabeni@redhat.com>:
On Mon, 2 May 2022 12:57:48 +0530 you wrote:
> This patchset does error handling for of_address_to_resource() and also
> removes "Don't advertise 1000BASE-T" and auto negotiation.
>
> Changes for v3:
> - Resolve git apply conflicts for 2/2 patch.
>
> Changes for v2:
> - Added Andrew's reviewed by tag in 1/2 patch.
> - Move ret to down to align with reverse xmas tree style in 2/2 patch.
> - Also add fixes tag in 2/2 patch.
> - Specify tree name in subject prefix.
>
> [...]
Here is the summary with links:
- [net,v3,1/2] net: emaclite: Don't advertise 1000BASE-T and do auto negotiation
https://git.kernel.org/netdev/net/c/b800528b97d0
- [net,v3,2/2] net: emaclite: Add error handling for of_address_to_resource()
https://git.kernel.org/netdev/net/c/7a6bc33ab549
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-05-03 9:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-02 7:27 [PATCH net v3 0/2] emaclite: improve error handling and minor cleanup Radhey Shyam Pandey
2022-05-02 7:27 ` [PATCH net v3 1/2] net: emaclite: Don't advertise 1000BASE-T and do auto negotiation Radhey Shyam Pandey
2022-05-02 7:27 ` [PATCH net v3 2/2] net: emaclite: Add error handling for of_address_to_resource() Radhey Shyam Pandey
2022-05-03 9:20 ` [PATCH net v3 0/2] emaclite: improve error handling and minor cleanup patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.