From: Ioana Ciornei <ciorneiioana@gmail.com>
To: Dan Murphy <dmurphy@ti.com>
Cc: davem@davemloft.net, andrew@lunn.ch, f.fainelli@gmail.com,
hkallweit1@gmail.com, robh@kernel.org, ciorneiioana@gmail.com,
devicetree@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v4 4/4] net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY
Date: Tue, 17 Nov 2020 22:57:00 +0200 [thread overview]
Message-ID: <20201117205700.to7h7pfgniq5fx5l@skbuf> (raw)
In-Reply-To: <20201117201555.26723-5-dmurphy@ti.com>
On Tue, Nov 17, 2020 at 02:15:55PM -0600, Dan Murphy wrote:
> The DP83TD510E is an ultra-low power Ethernet physical layer transceiver
> that supports 10M single pair cable.
>
> The device supports both 2.4-V p2p and 1-V p2p output voltage as defined
> by IEEE 802.3cg 10Base-T1L specfications. These modes can be forced via
> the device tree or the device is defaulted to auto negotiation to
> determine the proper p2p voltage.
>
> Signed-off-by: Dan Murphy <dmurphy@ti.com>
> ---
>
> v4 - Considerable rework of the code after secondary test setup was created.
> This version also uses the handle_interrupt call back and reduces the
> configuration arrays as it was determined that 80% of the array was the same.
>
> drivers/net/phy/Kconfig | 6 +
> drivers/net/phy/Makefile | 1 +
> drivers/net/phy/dp83td510.c | 505 ++++++++++++++++++++++++++++++++++++
> 3 files changed, 512 insertions(+)
> create mode 100644 drivers/net/phy/dp83td510.c
>
[snip]
> +static int dp83td510_ack_interrupt(struct phy_device *phydev)
> +{
> + int ret;
> +
> + ret = phy_read(phydev, DP83TD510_INT_REG1);
> + if (ret < 0)
> + return ret;
> +
> + ret = phy_read(phydev, DP83TD510_INT_REG2);
> + if (ret < 0)
> + return ret;
> +
> + phy_trigger_machine(phydev);
> +
> + return 0;
> +}
> +
> +static irqreturn_t dp83td510_handle_interrupt(struct phy_device *phydev)
> +{
> + int ret;
> +
> + ret = dp83td510_ack_interrupt(phydev);
> + if (ret)
> + return IRQ_NONE;
> +
> + return IRQ_HANDLED;
> +}
From what I can see in the datasheet, the INT_REG1 and INT_REG2 are used
for both interrupt configuration and interrupt status.
If this is the case, the state machine should only be triggered if the
interrupt was triggered (eg DP83TD510_INT1_LINK is set), not if _any_
bit from the register is set. This is broken since anytime you have
interrupts enabled, the lower half of the register will be non-zero
since that contains you interrupt enabled bits.
The .handle_interrupt() should look something like:
ret = phy_read(phydev, DP83TD510_INT_REG1);
if (ret < 0)
return ret;
if (!(ret & (DP83TD510_INT1_ESD | DP83TD510_INT1_LINK | DP83TD510_INT1_RHF)))
return IRQ_NONE;
ret = phy_read(phydev, DP83TD510_INT_REG2);
if (ret < 0)
return ret;
if (!(ret & (DP83TD510_INT2_POR | DP83TD510_INT2_POL | DP83TD510_INT2_PAGE)))
return IRQ_NONE;
phy_trigger_machine(phydev);
return IRQ_HANDLED;
> +
> +static int dp83td510_config_intr(struct phy_device *phydev)
> +{
> + int int_status;
> + int gen_cfg_val;
> + int ret;
> +
> + if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
> + int_status = phy_read(phydev, DP83TD510_INT_REG1);
> + if (int_status < 0)
> + return int_status;
> +
> + int_status = (DP83TD510_INT1_ESD_EN | DP83TD510_INT1_LINK_EN |
> + DP83TD510_INT1_RHF_EN);
> +
> + ret = phy_write(phydev, DP83TD510_INT_REG1, int_status);
> + if (ret)
> + return ret;
> +
> + int_status = phy_read(phydev, DP83TD510_INT_REG2);
> + if (int_status < 0)
> + return int_status;
> +
> + int_status = (DP83TD510_INT2_POR | DP83TD510_INT2_POL |
> + DP83TD510_INT2_PAGE);
> +
Shouldn't you use DP83TD510_INT2_POR_EN, DP83TD510_INT2_POL_EN etc here?
It seems that you are setting up the bits corresponding with the
interrupt status and not the interrupt enable.
Ioana
next prev parent reply other threads:[~2020-11-17 20:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-17 20:15 [PATCH net-next v4 0/4] DP83TD510 Single Pair 10Mbps Ethernet PHY Dan Murphy
2020-11-17 20:15 ` [PATCH net-next v4 1/4] ethtool: Add 10base-T1L link mode entries Dan Murphy
2020-11-17 20:15 ` [PATCH net-next v4 2/4] dt-bindings: net: Add Rx/Tx output configuration for 10base T1L Dan Murphy
2020-11-17 20:31 ` Andrew Lunn
2020-11-17 20:36 ` Dan Murphy
2020-12-01 0:02 ` Rob Herring
2020-11-17 20:15 ` [PATCH net-next v4 3/4] dt-bindings: dp83td510: Add binding for DP83TD510 Ethernet PHY Dan Murphy
2020-12-01 0:13 ` Rob Herring
2020-11-17 20:15 ` [PATCH net-next v4 4/4] net: phy: dp83td510: Add support for the " Dan Murphy
2020-11-17 20:57 ` Ioana Ciornei [this message]
2020-11-18 7:36 ` kernel test robot
2020-11-20 1:49 ` Andrew Lunn
2020-11-30 16:57 ` Dan Murphy
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=20201117205700.to7h7pfgniq5fx5l@skbuf \
--to=ciorneiioana@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=dmurphy@ti.com \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=robh@kernel.org \
/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