From: Andrew Lunn <andrew@lunn.ch>
To: Yuiko Oshino <yuiko.oshino@microchip.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
nisar.sayed@microchip.com, UNGLinuxDriver@microchip.com
Subject: Re: [PATCH net-next] net: phy: microchip_t1: add cable test support for lan87xx phy
Date: Fri, 22 Oct 2021 21:56:42 +0200 [thread overview]
Message-ID: <YXMXeuMUVvmR5Zrc@lunn.ch> (raw)
In-Reply-To: <20211022183632.8415-1-yuiko.oshino@microchip.com>
> +static int lan87xx_cable_test_start(struct phy_device *phydev)
> +{
> + static const struct access_ereg_val cable_test[] = {
> + /* min wait */
> + {PHYACC_ATTR_MODE_WRITE, PHYACC_ATTR_BANK_DSP, 93,
> + 0, 0},
> + /* max wait */
> + {PHYACC_ATTR_MODE_WRITE, PHYACC_ATTR_BANK_DSP, 94,
> + 10, 0},
> + /* pulse cycle */
> + {PHYACC_ATTR_MODE_WRITE, PHYACC_ATTR_BANK_DSP, 95,
> + 90, 0},
> + /* cable diag thresh */
> + {PHYACC_ATTR_MODE_WRITE, PHYACC_ATTR_BANK_DSP, 92,
> + 60, 0},
> + /* max gain */
> + {PHYACC_ATTR_MODE_WRITE, PHYACC_ATTR_BANK_DSP, 79,
> + 31, 0},
> + /* clock align for each iteration */
> + {PHYACC_ATTR_MODE_MODIFY, PHYACC_ATTR_BANK_DSP, 55,
> + 0, 0x0038},
> + /* max cycle wait config */
> + {PHYACC_ATTR_MODE_WRITE, PHYACC_ATTR_BANK_DSP, 94,
> + 70, 0},
> + /* start cable diag*/
> + {PHYACC_ATTR_MODE_WRITE, PHYACC_ATTR_BANK_DSP, 90,
> + 1, 0},
> + };
> + int rc, i;
> +
> + rc = microchip_cable_test_start_common(phydev);
> + if (rc < 0)
> + return rc;
> +
> + /* start cable diag */
> + /* check if part is alive - if not, return diagnostic error */
> + rc = access_ereg(phydev, PHYACC_ATTR_MODE_READ, PHYACC_ATTR_BANK_SMI,
> + 0x00, 0);
> + if (rc < 0)
> + return rc;
> +
> + if (rc != 0x2100)
> + return -ENODEV;
What does this actually mean? Would -EOPNOTSUPP be better?
> +static int lan87xx_cable_test_report_trans(u32 result)
> +{
> + switch (result) {
> + case 0:
> + return ETHTOOL_A_CABLE_RESULT_CODE_OK;
> + case 1:
> + return ETHTOOL_A_CABLE_RESULT_CODE_OPEN;
> + case 2:
> + return ETHTOOL_A_CABLE_RESULT_CODE_SAME_SHORT;
Please add some #defines for 0, 1, 2.
Andrew
next prev parent reply other threads:[~2021-10-22 19:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-22 18:36 [PATCH net-next] net: phy: microchip_t1: add cable test support for lan87xx phy Yuiko Oshino
2021-10-22 19:48 ` Andrew Lunn
2021-10-27 14:21 ` Yuiko.Oshino
2021-10-22 19:56 ` Andrew Lunn [this message]
2021-10-27 14:30 ` Yuiko.Oshino
2021-10-27 14:46 ` Andrew Lunn
2021-10-27 14:54 ` Yuiko.Oshino
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YXMXeuMUVvmR5Zrc@lunn.ch \
--to=andrew@lunn.ch \
--cc=UNGLinuxDriver@microchip.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=nisar.sayed@microchip.com \
--cc=yuiko.oshino@microchip.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).