* [PATCH] net: phy: add phyid search in vendor specific space
@ 2020-04-29 11:25 Florin Chiculita
2020-04-29 14:37 ` Madalin Bucur
2020-06-12 21:15 ` Tom Rini
0 siblings, 2 replies; 3+ messages in thread
From: Florin Chiculita @ 2020-04-29 11:25 UTC (permalink / raw)
To: u-boot
There are devices accesible through mdio clause-45, such as
retimers, that do not have PMA or PCS blocks.
This patch adds MDIO_MMD_VEND1 on the list of device addresses
where phyid is searched. Previous order of devices was kept.
Signed-off-by: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>
---
drivers/net/phy/phy.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 505d3ab..d2edf9e 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -783,17 +783,27 @@ static struct phy_device *get_phy_device_by_mask(struct mii_dev *bus,
uint phy_mask,
phy_interface_t interface)
{
- int i;
struct phy_device *phydev;
-
+ int devad[] = {
+ /* Clause-22 */
+ MDIO_DEVAD_NONE,
+ /* Clause-45 */
+ MDIO_MMD_PMAPMD,
+ MDIO_MMD_WIS,
+ MDIO_MMD_PCS,
+ MDIO_MMD_PHYXS,
+ MDIO_MMD_VEND1,
+ };
+ int i, devad_cnt;
+
+ devad_cnt = sizeof(devad)/sizeof(int);
phydev = search_for_existing_phy(bus, phy_mask, interface);
if (phydev)
return phydev;
- /* Try Standard (ie Clause 22) access */
- /* Otherwise we have to try Clause 45 */
- for (i = 0; i < 5; i++) {
+ /* try different access clauses */
+ for (i = 0; i < devad_cnt; i++) {
phydev = create_phy_by_mask(bus, phy_mask,
- i ? i : MDIO_DEVAD_NONE, interface);
+ devad[i], interface);
if (IS_ERR(phydev))
return NULL;
if (phydev)
--
1.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] net: phy: add phyid search in vendor specific space
2020-04-29 11:25 [PATCH] net: phy: add phyid search in vendor specific space Florin Chiculita
@ 2020-04-29 14:37 ` Madalin Bucur
2020-06-12 21:15 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Madalin Bucur @ 2020-04-29 14:37 UTC (permalink / raw)
To: u-boot
> -----Original Message-----
> From: U-Boot <u-boot-bounces@lists.denx.de> On Behalf Of Florin Chiculita
> Sent: Wednesday, April 29, 2020 2:26 PM
> To: u-boot at lists.denx.de
> Cc: Florin Laurentiu Chiculita <florinlaurentiu.chiculita@nxp.com>
> Subject: [PATCH] net: phy: add phyid search in vendor specific space
>
> There are devices accesible through mdio clause-45, such as
> retimers, that do not have PMA or PCS blocks.
> This patch adds MDIO_MMD_VEND1 on the list of device addresses
> where phyid is searched. Previous order of devices was kept.
>
> Signed-off-by: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>
> ---
> drivers/net/phy/phy.c | 22 ++++++++++++++++------
> 1 file changed, 16 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index 505d3ab..d2edf9e 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -783,17 +783,27 @@ static struct phy_device
> *get_phy_device_by_mask(struct mii_dev *bus,
> uint phy_mask,
> phy_interface_t interface)
> {
> - int i;
> struct phy_device *phydev;
> -
> + int devad[] = {
> + /* Clause-22 */
> + MDIO_DEVAD_NONE,
> + /* Clause-45 */
> + MDIO_MMD_PMAPMD,
> + MDIO_MMD_WIS,
> + MDIO_MMD_PCS,
> + MDIO_MMD_PHYXS,
> + MDIO_MMD_VEND1,
> + };
> + int i, devad_cnt;
> +
> + devad_cnt = sizeof(devad)/sizeof(int);
> phydev = search_for_existing_phy(bus, phy_mask, interface);
> if (phydev)
> return phydev;
> - /* Try Standard (ie Clause 22) access */
> - /* Otherwise we have to try Clause 45 */
> - for (i = 0; i < 5; i++) {
> + /* try different access clauses */
> + for (i = 0; i < devad_cnt; i++) {
> phydev = create_phy_by_mask(bus, phy_mask,
> - i ? i : MDIO_DEVAD_NONE, interface);
> + devad[i], interface);
> if (IS_ERR(phydev))
> return NULL;
> if (phydev)
> --
> 1.9.3
Nice cleanup too!
Reviewed-by: Madalin Bucur <madalin.bucur@oss.nxp.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] net: phy: add phyid search in vendor specific space
2020-04-29 11:25 [PATCH] net: phy: add phyid search in vendor specific space Florin Chiculita
2020-04-29 14:37 ` Madalin Bucur
@ 2020-06-12 21:15 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2020-06-12 21:15 UTC (permalink / raw)
To: u-boot
On Wed, Apr 29, 2020 at 02:25:48PM +0300, Florin Chiculita wrote:
> There are devices accesible through mdio clause-45, such as
> retimers, that do not have PMA or PCS blocks.
> This patch adds MDIO_MMD_VEND1 on the list of device addresses
> where phyid is searched. Previous order of devices was kept.
>
> Signed-off-by: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>
> Reviewed-by: Madalin Bucur <madalin.bucur@oss.nxp.com>
Applied to u-boot/next, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200612/d47e523d/attachment.sig>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-06-12 21:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-29 11:25 [PATCH] net: phy: add phyid search in vendor specific space Florin Chiculita
2020-04-29 14:37 ` Madalin Bucur
2020-06-12 21:15 ` Tom Rini
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.