[U-Boot] [PATCH] mii: Add mii_resolve_flowctrl_fdx()

From: Yuiko Oshino yuiko.oshino@microchip.com
Add an mii helper function to resolve flow control status per IEEE 802.3-2005 table 28B-3. This function was taken from the linux source tree.
Signed-off-by: Yuiko Oshino yuiko.oshino@microchip.com --- include/linux/mii.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
diff --git a/include/linux/mii.h b/include/linux/mii.h index 66b83d8..19afb74 100644 --- a/include/linux/mii.h +++ b/include/linux/mii.h @@ -190,4 +190,27 @@ static inline unsigned int mii_duplex (unsigned int duplex_lock, return 0; }
+/** + * mii_resolve_flowctrl_fdx + * @lcladv: value of MII ADVERTISE register + * @rmtadv: value of MII LPA register + * + * Resolve full duplex flow control as per IEEE 802.3-2005 table 28B-3 + */ +static inline u8 mii_resolve_flowctrl_fdx(u16 lcladv, u16 rmtadv) +{ + u8 cap = 0; + + if (lcladv & rmtadv & ADVERTISE_PAUSE_CAP) { + cap = FLOW_CTRL_TX | FLOW_CTRL_RX; + } else if (lcladv & rmtadv & ADVERTISE_PAUSE_ASYM) { + if (lcladv & ADVERTISE_PAUSE_CAP) + cap = FLOW_CTRL_RX; + else if (rmtadv & ADVERTISE_PAUSE_CAP) + cap = FLOW_CTRL_TX; + } + + return cap; +} + #endif /* __LINUX_MII_H__ */

Hi Yuiko,
On Fri, Jun 23, 2017 at 11:33 AM, Yuiko.Oshino@microchip.com wrote:
From: Yuiko Oshino yuiko.oshino@microchip.com
Add an mii helper function to resolve flow control status per IEEE 802.3-2005 table 28B-3. This function was taken from the linux source tree.
Signed-off-by: Yuiko Oshino yuiko.oshino@microchip.com
I assume your other patch depends on this one. As such, they should be in a series.
Also, you should Cc me if you want me to see these.
Also, it would help if you prefix each of these patches' subjects with "net:"
Also, please don't use a mail client that will attach "winmail.dat" to your patches. I'm surprised this got through the mailing list.
Thanks, -Joe

On Thu, Jul 27, 2017 at 11:43 AM, Joe Hershberger joe.hershberger@gmail.com wrote:
Hi Yuiko,
On Fri, Jun 23, 2017 at 11:33 AM, Yuiko.Oshino@microchip.com wrote:
From: Yuiko Oshino yuiko.oshino@microchip.com
Add an mii helper function to resolve flow control status per IEEE 802.3-2005 table 28B-3. This function was taken from the linux source tree.
Signed-off-by: Yuiko Oshino yuiko.oshino@microchip.com
I assume your other patch depends on this one. As such, they should be in a series.
Also, you should Cc me if you want me to see these.
Also, it would help if you prefix each of these patches' subjects with "net:"
Also, please don't use a mail client that will attach "winmail.dat" to your patches. I'm surprised this got through the mailing list.
I highly recommend you use tools/patman.
Thanks, -Joe
participants (2)
-
Joe Hershberger
-
Yuiko.Oshino@microchip.com