Bug 197265 - [mii] patch to support rtl8211f ethernet phys
Summary: [mii] patch to support rtl8211f ethernet phys
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Pyun YongHyeon
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2015-02-02 06:51 UTC by john
Modified: 2015-03-26 05:59 UTC (History)
2 users (show)

See Also:


Attachments
patch to support rtl8211f (3.86 KB, patch)
2015-02-02 06:51 UTC, john
no flags Details | Diff
patch to support rtl8211f Rev 2 (6.16 KB, patch)
2015-02-11 03:17 UTC, john
no flags Details | Diff
Patch for RTL8211F PHY (7.59 KB, patch)
2015-03-10 09:52 UTC, Pyun YongHyeon
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description john 2015-02-02 06:51:06 UTC
Created attachment 152469 [details]
patch to support rtl8211f

Description:

I'm in the process of bringing up the ethernet interface on
the ODROID-C1 which uses the DWC MAC and the RTL8211F PHYS.

Currently the interface fails to see link or the negotiated
speed / duplex since rgephyreg.c uses a phys specific status
register that doesn't exist on rev 6 of the silicon.

How-To-Repeat:

Build FreeBSD for the ODROID-C1 (this requires patches not
yet committed to the source tree) and attempt to use the
dwc0 ethernet interface.

Fix:

With the supplied patch ifconfig reports the correct link status
and negotiated speed / duplex.  There are other issues preventing
DWC from sending / receiving packets which I'm still looking at.
Comment 1 john 2015-02-11 03:17:49 UTC
Created attachment 152860 [details]
patch to support rtl8211f Rev 2

Rev 2 of the patch also handles the fact that the MID / MIDX bits are in a
different location and when possible uses RGEPHY_MII_BMSR to check for link
instead of silicon revision specific code.
Comment 2 John Baldwin freebsd_committer freebsd_triage 2015-03-09 17:03:33 UTC
Pyun, you seem to have done most of the non-tree-sweep changes to rgephy.  Can you review this?
Comment 3 Pyun YongHyeon freebsd_committer freebsd_triage 2015-03-10 09:52:18 UTC
Created attachment 154127 [details]
Patch for RTL8211F PHY
Comment 4 Pyun YongHyeon freebsd_committer freebsd_triage 2015-03-10 09:52:58 UTC
Thanks for the patch.  I didn't test your patch on real H/W yet but
patch looks good to me.  To improve readability I've slightly
reorganized your patch and regenerated it against HEAD.  One
difference against your diff is direct access of RGEPHY_F_MII_SSR
register in MII_TICK handler.  I wanted to remove RGEPHY_MII_BMSR,
RGEPHY_MII_BMCR register accesses in the handler and rely on
RGEPHY_F_MII_SSR or RGEPHY_MII_SSR register for non-re(4) drivers.
Of course this assumes RGEPHY_F_MII_SSR reports correct link state
in various timings.
Would you try attached patch and let me know how it goes?
Comment 5 john 2015-03-11 05:01:36 UTC
In a quick smoke test of cycling through the various
ifconfig media / mediaopt options your patch seems
fine.
Comment 6 commit-hook freebsd_committer freebsd_triage 2015-03-12 07:06:15 UTC
A commit references this bug:

Author: yongari
Date: Thu Mar 12 07:05:29 UTC 2015
New revision: 279903
URL: https://svnweb.freebsd.org/changeset/base/279903

Log:
  Add RTL8211F gigabit PHY support.

  PR:	197265
  MFC after:	2 weeks

Changes:
  head/sys/dev/mii/rgephy.c
  head/sys/dev/mii/rgephyreg.h
Comment 7 Pyun YongHyeon freebsd_committer freebsd_triage 2015-03-12 07:10:15 UTC
Take.
Comment 8 john 2015-03-12 17:14:57 UTC
I believe in rgephy_reset the old code switched to MDIX_AUTO
for revision B or newer.  The new code doesn't switch to MDIX_AUTO
in the case of revision C due to the break in the switch.  Is
that intentional?  The break would need to be removed to match
the original meaning.
Comment 9 Pyun YongHyeon freebsd_committer freebsd_triage 2015-03-13 01:19:09 UTC
Ah, you're right.
Fixed in r279941.
Thanks a lot!
Comment 10 commit-hook freebsd_committer freebsd_triage 2015-03-26 05:44:56 UTC
A commit references this bug:

Author: yongari
Date: Thu Mar 26 05:44:22 UTC 2015
New revision: 280667
URL: https://svnweb.freebsd.org/changeset/base/280667

Log:
  MFC r279903,279941:
    Add RTL8211F gigabit PHY support.

    PR:	197265

Changes:
_U  stable/10/
  stable/10/sys/dev/mii/rgephy.c
  stable/10/sys/dev/mii/rgephyreg.h
Comment 11 commit-hook freebsd_committer freebsd_triage 2015-03-26 05:45:58 UTC
A commit references this bug:

Author: yongari
Date: Thu Mar 26 05:45:22 UTC 2015
New revision: 280668
URL: https://svnweb.freebsd.org/changeset/base/280668

Log:
  MFC r279903,279941:
    Add RTL8211F gigabit PHY support.

    PR:	197265

Changes:
_U  stable/9/sys/
_U  stable/9/sys/dev/
  stable/9/sys/dev/mii/rgephy.c
  stable/9/sys/dev/mii/rgephyreg.h
Comment 12 Pyun YongHyeon freebsd_committer freebsd_triage 2015-03-26 05:59:35 UTC
MFC done.
Thanks a lot!