All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] net: phy: Add clause 45 identifier to phy_device
@ 2018-11-16  6:26 Pankaj Bansal
  2019-01-02 21:58 ` Joe Hershberger
  2019-01-24 17:37 ` [U-Boot] " Joe Hershberger
  0 siblings, 2 replies; 3+ messages in thread
From: Pankaj Bansal @ 2018-11-16  6:26 UTC (permalink / raw)
  To: u-boot

The phy devices can be accessed via clause 22 or via clause 45.
This information can be deduced when we read phy id. if the phy id
is read without giving any MDIO Manageable Device Address (MMD), then
it conforms to clause 22. otherwise it conforms to clause 45.

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index e837eb7688..fa08c75f82 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -620,7 +620,7 @@ static struct phy_driver *get_phy_driver(struct phy_device *phydev,
 }
 
 static struct phy_device *phy_device_create(struct mii_dev *bus, int addr,
-					    u32 phy_id,
+					    u32 phy_id, bool is_c45,
 					    phy_interface_t interface)
 {
 	struct phy_device *dev;
@@ -650,6 +650,7 @@ static struct phy_device *phy_device_create(struct mii_dev *bus, int addr,
 
 	dev->addr = addr;
 	dev->phy_id = phy_id;
+	dev->is_c45 = is_c45;
 	dev->bus = bus;
 
 	dev->drv = get_phy_driver(dev, interface);
@@ -701,13 +702,17 @@ static struct phy_device *create_phy_by_mask(struct mii_dev *bus,
 					     phy_interface_t interface)
 {
 	u32 phy_id = 0xffffffff;
+	bool is_c45;
 
 	while (phy_mask) {
 		int addr = ffs(phy_mask) - 1;
 		int r = get_phy_id(bus, addr, devad, &phy_id);
 		/* If the PHY ID is mostly f's, we didn't find anything */
-		if (r == 0 && (phy_id & 0x1fffffff) != 0x1fffffff)
-			return phy_device_create(bus, addr, phy_id, interface);
+		if (r == 0 && (phy_id & 0x1fffffff) != 0x1fffffff) {
+			is_c45 = (devad == MDIO_DEVAD_NONE) ? false : true;
+			return phy_device_create(bus, addr, phy_id, is_c45,
+						 interface);
+		}
 		phy_mask &= ~(1 << addr);
 	}
 	return NULL;
diff --git a/include/phy.h b/include/phy.h
index b86fdfb2ce..f23ca63f3b 100644
--- a/include/phy.h
+++ b/include/phy.h
@@ -138,6 +138,7 @@ struct phy_device {
 	int pause;
 	int asym_pause;
 	u32 phy_id;
+	bool is_c45;
 	u32 flags;
 };
 
-- 
2.17.1

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

* [U-Boot] [PATCH] net: phy: Add clause 45 identifier to phy_device
  2018-11-16  6:26 [U-Boot] [PATCH] net: phy: Add clause 45 identifier to phy_device Pankaj Bansal
@ 2019-01-02 21:58 ` Joe Hershberger
  2019-01-24 17:37 ` [U-Boot] " Joe Hershberger
  1 sibling, 0 replies; 3+ messages in thread
From: Joe Hershberger @ 2019-01-02 21:58 UTC (permalink / raw)
  To: u-boot

On Fri, Nov 16, 2018 at 12:26 AM Pankaj Bansal <pankaj.bansal@nxp.com> wrote:
>
> The phy devices can be accessed via clause 22 or via clause 45.
> This information can be deduced when we read phy id. if the phy id
> is read without giving any MDIO Manageable Device Address (MMD), then
> it conforms to clause 22. otherwise it conforms to clause 45.
>
> Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>

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

* [U-Boot] net: phy: Add clause 45 identifier to phy_device
  2018-11-16  6:26 [U-Boot] [PATCH] net: phy: Add clause 45 identifier to phy_device Pankaj Bansal
  2019-01-02 21:58 ` Joe Hershberger
@ 2019-01-24 17:37 ` Joe Hershberger
  1 sibling, 0 replies; 3+ messages in thread
From: Joe Hershberger @ 2019-01-24 17:37 UTC (permalink / raw)
  To: u-boot

Hi Pankaj,

https://patchwork.ozlabs.org/patch/998770/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe

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

end of thread, other threads:[~2019-01-24 17:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-16  6:26 [U-Boot] [PATCH] net: phy: Add clause 45 identifier to phy_device Pankaj Bansal
2019-01-02 21:58 ` Joe Hershberger
2019-01-24 17:37 ` [U-Boot] " Joe Hershberger

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.