From: Dan Murphy <dmurphy@ti.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: <f.fainelli@gmail.com>, <hkallweit1@gmail.com>,
<davem@davemloft.net>, <robh@kernel.org>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<devicetree@vger.kernel.org>
Subject: Re: [PATCH net-next v3 2/4] net: phy: Add a helper to return the index for of the internal delay
Date: Wed, 27 May 2020 07:13:33 -0500 [thread overview]
Message-ID: <629b3145-719b-08a6-b6f4-ece4d26fdbdb@ti.com> (raw)
In-Reply-To: <20200527004220.GE782807@lunn.ch>
Andrew
On 5/26/20 7:42 PM, Andrew Lunn wrote:
>> +/**
>> + * phy_get_delay_index - returns the index of the internal delay
>> + * @phydev: phy_device struct
>> + * @delay_values: array of delays the PHY supports
>> + * @size: the size of the delay array
>> + * @int_delay: the internal delay to be looked up
>> + * @descending: if the delay array is in descending order
>> + *
>> + * Returns the index within the array of internal delay passed in.
>> + * Return errno if the delay is invalid or cannot be found.
>> + */
>> +s32 phy_get_delay_index(struct phy_device *phydev, int *delay_values, int size,
>> + int int_delay, bool descending)
>> +{
>> + if (int_delay < 0)
>> + return -EINVAL;
>> +
>> + if (size <= 0)
>> + return -EINVAL;
>> +
>> + if (descending)
>> + return phy_find_descending_delay(phydev, delay_values, size,
>> + int_delay);
>> +
>> + return phy_find_ascending_delay(phydev, delay_values, size, int_delay);
>> +}
>> +EXPORT_SYMBOL(phy_get_delay_index);
> Do we really need this ascending vs descending? This array is not
> coming from device tree of anything, it is a static list in the PHY
> driver. I would just define it needs to be ascending and be done.
I was thinking about the constraints of having just an ascending array
helper.
If there is a PHY out there that has a descending delay array then this
function is not a helper.
Then the PHY driver now has to implement a descending search or extend
out this helper to do the same.
I can just keep it ascending for now but this helper may need to be
updated in the future to accommodate any PHYs with descending delay arrays.
Dan
> Andrew
next prev parent reply other threads:[~2020-05-27 12:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-26 17:47 [PATCH net-next v3 0/4] RGMII Internal delay common property Dan Murphy
2020-05-26 17:47 ` [PATCH net-next v3 1/4] dt-bindings: net: Add tx and rx internal delays Dan Murphy
2020-05-26 17:47 ` [PATCH net-next v3 2/4] net: phy: Add a helper to return the index for of the internal delay Dan Murphy
2020-05-27 0:42 ` Andrew Lunn
2020-05-27 12:13 ` Dan Murphy [this message]
2020-05-26 17:47 ` [PATCH net-next v3 3/4] dt-bindings: net: Add RGMII internal delay for DP83869 Dan Murphy
2020-05-26 17:47 ` [PATCH net-next v3 4/4] net: dp83869: Add RGMII internal delay configuration Dan Murphy
2020-05-27 0:52 ` Andrew Lunn
2020-05-27 12:23 ` Dan Murphy
2020-05-27 13:12 ` Andrew Lunn
2020-05-27 14:51 ` Dan Murphy
2020-05-27 0:54 ` Andrew Lunn
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=629b3145-719b-08a6-b6f4-ece4d26fdbdb@ti.com \
--to=dmurphy@ti.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--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