All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers: net: cpsw: Add support for fixed-link PHY
@ 2015-11-03 21:09 ` Markus Brunner
  0 siblings, 0 replies; 7+ messages in thread
From: Markus Brunner @ 2015-11-03 21:09 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-arm-kernel, linux-omap

Add support for a fixed-link devicetree sub-node in case the the 
cpsw MAC is directly connected to a non-mdio PHY/device. 

Signed-off-by: Markus Brunner <systemprogrammierung.brunner@gmail.com>

---
 Documentation/devicetree/bindings/net/cpsw.txt |    5 +++++
 drivers/net/ethernet/ti/cpsw.c                 |   13 +++++++++++++
 2 files changed, 18 insertions(+)

diff -upNr linux-4.3.orig/Documentation/devicetree/bindings/net/cpsw.txt linux-4.3/Documentation/devicetree/bindings/net/cpsw.txt
--- linux-4.3.orig/Documentation/devicetree/bindings/net/cpsw.txt	2015-11-03 17:21:40.000000000 +0100
+++ linux-4.3/Documentation/devicetree/bindings/net/cpsw.txt	2015-11-02 16:53:43.000000000 +0100
@@ -41,6 +41,11 @@ Optional properties:
 - mac-address		: See ethernet.txt file in the same directory
 - phy-handle		: See ethernet.txt file in the same directory
 
+Slave sub-nodes:
+- fixed-link		: See fixed-link.txt file in the same directory
+			  Either the properties phy_id and phy-mode,
+			  or the sub-node fixed-link can be specified
+
 Note: "ti,hwmods" field is used to fetch the base address and irq
 resources from TI, omap hwmod data base during device registration.
 Future plan is to migrate hwmod data base contents into device tree
diff -upNr linux-4.3.orig/drivers/net/ethernet/ti/cpsw.c linux-4.3/drivers/net/ethernet/ti/cpsw.c
--- linux-4.3.orig/drivers/net/ethernet/ti/cpsw.c	2015-11-03 17:18:00.000000000 +0100
+++ linux-4.3/drivers/net/ethernet/ti/cpsw.c	2015-11-03 17:04:08.000000000 +0100
@@ -2037,6 +2037,19 @@ static int cpsw_probe_dt(struct cpsw_pri
 			continue;
 
 		priv->phy_node = of_parse_phandle(slave_node, "phy-handle", 0);
+		if (of_phy_is_fixed_link(slave_node)) {
+			struct phy_device *pd;
+
+			ret = of_phy_register_fixed_link(slave_node);
+			if (ret)
+				return ret;
+			pd = of_phy_find_device(slave_node);
+			if (!pd)
+				return -ENODEV;
+			snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
+				 PHY_ID_FMT, pd->bus->id, pd->phy_id);
+			goto no_phy_slave;
+		}
 		parp = of_get_property(slave_node, "phy_id", &lenp);
 		if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) {
 			dev_err(&pdev->dev, "Missing slave[%d] phy_id property\n", i);

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] drivers: net: cpsw: Add support for fixed-link PHY
@ 2015-11-03 21:09 ` Markus Brunner
  0 siblings, 0 replies; 7+ messages in thread
From: Markus Brunner @ 2015-11-03 21:09 UTC (permalink / raw)
  To: linux-arm-kernel

Add support for a fixed-link devicetree sub-node in case the the 
cpsw MAC is directly connected to a non-mdio PHY/device. 

Signed-off-by: Markus Brunner <systemprogrammierung.brunner@gmail.com>

---
 Documentation/devicetree/bindings/net/cpsw.txt |    5 +++++
 drivers/net/ethernet/ti/cpsw.c                 |   13 +++++++++++++
 2 files changed, 18 insertions(+)

diff -upNr linux-4.3.orig/Documentation/devicetree/bindings/net/cpsw.txt linux-4.3/Documentation/devicetree/bindings/net/cpsw.txt
--- linux-4.3.orig/Documentation/devicetree/bindings/net/cpsw.txt	2015-11-03 17:21:40.000000000 +0100
+++ linux-4.3/Documentation/devicetree/bindings/net/cpsw.txt	2015-11-02 16:53:43.000000000 +0100
@@ -41,6 +41,11 @@ Optional properties:
 - mac-address		: See ethernet.txt file in the same directory
 - phy-handle		: See ethernet.txt file in the same directory
 
+Slave sub-nodes:
+- fixed-link		: See fixed-link.txt file in the same directory
+			  Either the properties phy_id and phy-mode,
+			  or the sub-node fixed-link can be specified
+
 Note: "ti,hwmods" field is used to fetch the base address and irq
 resources from TI, omap hwmod data base during device registration.
 Future plan is to migrate hwmod data base contents into device tree
diff -upNr linux-4.3.orig/drivers/net/ethernet/ti/cpsw.c linux-4.3/drivers/net/ethernet/ti/cpsw.c
--- linux-4.3.orig/drivers/net/ethernet/ti/cpsw.c	2015-11-03 17:18:00.000000000 +0100
+++ linux-4.3/drivers/net/ethernet/ti/cpsw.c	2015-11-03 17:04:08.000000000 +0100
@@ -2037,6 +2037,19 @@ static int cpsw_probe_dt(struct cpsw_pri
 			continue;
 
 		priv->phy_node = of_parse_phandle(slave_node, "phy-handle", 0);
+		if (of_phy_is_fixed_link(slave_node)) {
+			struct phy_device *pd;
+
+			ret = of_phy_register_fixed_link(slave_node);
+			if (ret)
+				return ret;
+			pd = of_phy_find_device(slave_node);
+			if (!pd)
+				return -ENODEV;
+			snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
+				 PHY_ID_FMT, pd->bus->id, pd->phy_id);
+			goto no_phy_slave;
+		}
 		parp = of_get_property(slave_node, "phy_id", &lenp);
 		if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) {
 			dev_err(&pdev->dev, "Missing slave[%d] phy_id property\n", i);

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drivers: net: cpsw: Add support for fixed-link PHY
  2015-11-03 21:09 ` Markus Brunner
  (?)
@ 2015-11-04 15:25   ` Mugunthan V N
  -1 siblings, 0 replies; 7+ messages in thread
From: Mugunthan V N @ 2015-11-04 15:25 UTC (permalink / raw)
  To: Markus Brunner, davem; +Cc: netdev, linux-arm-kernel, linux-omap

On Wednesday 04 November 2015 02:39 AM, Markus Brunner wrote:
> Add support for a fixed-link devicetree sub-node in case the the 
> cpsw MAC is directly connected to a non-mdio PHY/device. 
> 
> Signed-off-by: Markus Brunner <systemprogrammierung.brunner@gmail.com>

Looks good to me.

Acked-by: Mugunthan V N <mugunthanvnm@ti.com>

Regards
Mugunthan V N

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drivers: net: cpsw: Add support for fixed-link PHY
@ 2015-11-04 15:25   ` Mugunthan V N
  0 siblings, 0 replies; 7+ messages in thread
From: Mugunthan V N @ 2015-11-04 15:25 UTC (permalink / raw)
  To: Markus Brunner, davem; +Cc: netdev, linux-arm-kernel, linux-omap

On Wednesday 04 November 2015 02:39 AM, Markus Brunner wrote:
> Add support for a fixed-link devicetree sub-node in case the the 
> cpsw MAC is directly connected to a non-mdio PHY/device. 
> 
> Signed-off-by: Markus Brunner <systemprogrammierung.brunner@gmail.com>

Looks good to me.

Acked-by: Mugunthan V N <mugunthanvnm@ti.com>

Regards
Mugunthan V N

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] drivers: net: cpsw: Add support for fixed-link PHY
@ 2015-11-04 15:25   ` Mugunthan V N
  0 siblings, 0 replies; 7+ messages in thread
From: Mugunthan V N @ 2015-11-04 15:25 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 04 November 2015 02:39 AM, Markus Brunner wrote:
> Add support for a fixed-link devicetree sub-node in case the the 
> cpsw MAC is directly connected to a non-mdio PHY/device. 
> 
> Signed-off-by: Markus Brunner <systemprogrammierung.brunner@gmail.com>

Looks good to me.

Acked-by: Mugunthan V N <mugunthanvnm@ti.com>

Regards
Mugunthan V N

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drivers: net: cpsw: Add support for fixed-link PHY
  2015-11-03 21:09 ` Markus Brunner
@ 2015-11-05  1:57   ` David Miller
  -1 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2015-11-05  1:57 UTC (permalink / raw)
  To: systemprogrammierung.brunner; +Cc: netdev, linux-arm-kernel, linux-omap

From: Markus Brunner <systemprogrammierung.brunner@gmail.com>
Date: Tue, 03 Nov 2015 22:09:51 +0100

> Add support for a fixed-link devicetree sub-node in case the the 
> cpsw MAC is directly connected to a non-mdio PHY/device. 
> 
> Signed-off-by: Markus Brunner <systemprogrammierung.brunner@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] drivers: net: cpsw: Add support for fixed-link PHY
@ 2015-11-05  1:57   ` David Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2015-11-05  1:57 UTC (permalink / raw)
  To: linux-arm-kernel

From: Markus Brunner <systemprogrammierung.brunner@gmail.com>
Date: Tue, 03 Nov 2015 22:09:51 +0100

> Add support for a fixed-link devicetree sub-node in case the the 
> cpsw MAC is directly connected to a non-mdio PHY/device. 
> 
> Signed-off-by: Markus Brunner <systemprogrammierung.brunner@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-11-05  1:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-03 21:09 [PATCH] drivers: net: cpsw: Add support for fixed-link PHY Markus Brunner
2015-11-03 21:09 ` Markus Brunner
2015-11-04 15:25 ` Mugunthan V N
2015-11-04 15:25   ` Mugunthan V N
2015-11-04 15:25   ` Mugunthan V N
2015-11-05  1:57 ` David Miller
2015-11-05  1:57   ` David Miller

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.