01 Jul, 2022

1 commit


14 Dec, 2020

1 commit


11 Nov, 2020

1 commit

  • The RTL8401-internal PHY identifies as RTL8201CP, and the init
    sequence in r8169, copied from vendor driver r8168, uses paged
    operations. Therefore set the same paged operation callbacks as
    for the other Realtek PHY's.

    Fixes: cdafdc29ef75 ("r8169: sync support for RTL8401 with vendor driver")
    Signed-off-by: Heiner Kallweit
    Link: https://lore.kernel.org/r/69882f7a-ca2f-e0c7-ae83-c9b6937282cd@gmail.com
    Signed-off-by: Jakub Kicinski

    Heiner Kallweit
     

06 Oct, 2020

1 commit


02 Oct, 2020

1 commit

  • Realtek single-chip Ethernet PHY solutions can be separated as below:
    10M/100Mbps: RTL8201X
    1Gbps: RTL8211X
    2.5Gbps: RTL8226/RTL8221X
    RTL8226 is the first version for realtek that compatible 2.5Gbps single PHY.
    Since RTL8226 is single port only, realtek changes its name to RTL8221B from
    the second version.
    PHY ID for RTL8226 is 0x001cc800 and RTL8226B/RTL8221B is 0x001cc840.

    RTL8125 is not a single PHY solution, it integrates PHY/MAC/PCIE bus
    controller and embedded memory.

    Signed-off-by: Willy Liu
    Signed-off-by: David S. Miller

    Willy Liu
     

30 Sep, 2020

1 commit

  • There are two chip pins named TXDLY and RXDLY which actually adds the 2ns
    delays to TXC and RXC for TXD/RXD latching. These two pins can config via
    4.7k-ohm resistor to 3.3V hw setting, but also config via software setting
    (extension page 0xa4 register 0x1c bit13 12 and 11).

    The configuration register definitions from table 13 official PHY datasheet:
    PHYAD[2:0] = PHY Address
    AN[1:0] = Auto-Negotiation
    Mode = Interface Mode Select
    RX Delay = RX Delay
    TX Delay = TX Delay
    SELRGV = RGMII/GMII Selection

    This table describes how to config these hw pins via external pull-high or pull-
    low resistor.

    It is a misunderstanding that mapping it as register bits below:
    8:6 = PHY Address
    5:4 = Auto-Negotiation
    3 = Interface Mode Select
    2 = RX Delay
    1 = TX Delay
    0 = SELRGV
    So I removed these descriptions above and add related settings as below:
    14 = reserved
    13 = force Tx RX Delay controlled by bit12 bit11
    12 = Tx Delay
    11 = Rx Delay
    10:0 = Test && debug settings reserved by realtek

    Test && debug settings are not recommend to modify by default.

    Fixes: f81dadbcf7fd ("net: phy: realtek: Add rtl8211e rx/tx delays config")
    Signed-off-by: Willy Liu
    Signed-off-by: David S. Miller

    Willy Liu
     

22 Sep, 2020

1 commit


15 Jul, 2020

1 commit


21 Apr, 2020

1 commit


19 Mar, 2020

1 commit

  • At least some integrated PHY's in RTL8168/RTL8125 chip versions support
    downshift, and the actual link speed can be read from a vendor-specific
    register. Info about this register was provided by Realtek.
    More details about downshift configuration (e.g. number of attempts)
    aren't available, therefore the downshift tunable is not implemented.

    Signed-off-by: Heiner Kallweit
    Signed-off-by: David S. Miller

    Heiner Kallweit
     

27 Dec, 2019

2 commits

  • On RTL8211F the RX and TX delays (2ns) can be configured in two ways:
    - pin strapping (RXD1 for the TX delay and RXD0 for the RX delay, LOW
    means "off" and HIGH means "on") which is read during PHY reset
    - using software to configure the TX and RX delay registers

    So far only the configuration using pin strapping has been supported.
    Add support for enabling or disabling the RGMII RX delay based on the
    phy-mode to be able to get the RX delay into a known state. This is
    important because the RX delay has to be coordinated between the PHY,
    MAC and the PCB design (trace length). With an invalid RX delay applied
    (for example if both PHY and MAC add a 2ns RX delay) Ethernet may not
    work at all.

    Also add debug logging when configuring the RX delay (just like the TX
    delay) because this is a common source of problems.

    Signed-off-by: Martin Blumenstingl
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Martin Blumenstingl
     
  • RGMII requires a delay of 2ns between the data and the clock signal.
    There are at least three ways this can happen. One possibility is by
    having the PHY generate this delay.
    This is a common source for problems (for example with slow TX speeds or
    packet loss when sending data). The TX delay configuration of the
    RTL8211F PHY can be set either by pin-strappping the RXD1 pin (HIGH
    means enabled, LOW means disabled) or through configuring a paged
    register. The setting from the RXD1 pin is also reflected in the
    register.

    Add debug logging to the TX delay configuration on RTL8211F so it's
    easier to spot these issues (for example if the TX delay is enabled for
    both, the RTL8211F PHY and the MAC).
    This is especially helpful because there is no public datasheet for the
    RTL8211F PHY available with all the RX/TX delay specifics.

    Signed-off-by: Martin Blumenstingl
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Martin Blumenstingl
     

02 Dec, 2019

1 commit

  • It was reported [0] that since the referenced commit a warning is
    triggered in phylib that complains about paged operations being used
    with a PHY driver that doesn't support this. The commit isn't wrong,
    just for one chip version (RTL8105e) no dedicated PHY driver exists
    yet. So add the missing PHY driver.

    [0] https://bugzilla.kernel.org/show_bug.cgi?id=202103

    Fixes: 3a129e3f9ac4 ("r8169: switch to phylib functions in more places")
    Reported-by: jhdskag3
    Tested-by: jhdskag3
    Signed-off-by: Heiner Kallweit
    Signed-off-by: David S. Miller

    Heiner Kallweit
     

20 Aug, 2019

1 commit


16 Aug, 2019

1 commit


15 Aug, 2019

1 commit

  • Realtek provided information on how the new NIC-integrated PHY's
    expose whether they support 2.5G/5G/10G. This allows to automatically
    differentiate 1Gbps and 2.5Gbps PHY's, and therefore allows to
    remove the fake PHY ID mechanism for RTL8125.
    So far RTL8125 supports 2.5Gbps only, but register layout for faster
    modes has been defined already, so let's use this information to be
    future-proof.

    Signed-off-by: Heiner Kallweit
    Signed-off-by: David S. Miller

    Heiner Kallweit
     

12 Aug, 2019

1 commit

  • This adds support for the integrated 2.5Gbps PHY in Realtek RTL8125.
    Advertisement of 2.5Gbps mode is done via a vendor-specific register.
    Same applies to reading NBase-T link partner advertisement.
    Unfortunately this 2.5Gbps PHY shares the PHY ID with the integrated
    1Gbps PHY's in other Realtek network chips and so far no method is
    known to differentiate them. As a workaround use a dedicated fake PHY ID
    that is set by the network driver by intercepting the MDIO PHY ID read.

    v2:
    - Create dedicated PHY driver and use a fake PHY ID that is injected by
    the network driver. Suggested by Andrew Lunn.

    Signed-off-by: Heiner Kallweit
    Reviewed-by: Andrew Lunn
    Signed-off-by: David S. Miller

    Heiner Kallweit
     

14 May, 2019

1 commit

  • After calling phy_select_page() and until calling phy_restore_page(),
    the mutex 'mdio_lock' is already locked, so the driver should use
    non-locked version of phy functions. Or there will be a deadlock with
    'mdio_lock'.

    This replaces phy functions called from rtl8211e_config_init() to avoid
    the deadlock issue.

    Fixes: f81dadbcf7fd ("net: phy: realtek: Add rtl8211e rx/tx delays config")
    Signed-off-by: Kunihiko Hayashi
    Reviewed-by: Andrew Lunn
    Signed-off-by: David S. Miller

    Kunihiko Hayashi
     

12 May, 2019

1 commit


11 May, 2019

1 commit

  • Add missing page operation callbacks to few Realtek drivers.
    This also fixes a NPE after the referenced commit added code to the
    RTL8211E driver that uses phy_select_page().

    Fixes: f81dadbcf7fd ("net: phy: realtek: Add rtl8211e rx/tx delays config")
    Signed-off-by: Heiner Kallweit
    Reviewed-by: Florian Fainelli
    Reported-by: Vicente Bergas
    Signed-off-by: David S. Miller

    Heiner Kallweit
     

09 May, 2019

2 commits

  • It's prone to problems if delay is cleared out for other than RGMII
    modes. So lets set/clear the TX-delay in the config register only
    if actually RGMII-like interface mode is requested. This only
    concerns rtl8211f chips.

    Signed-off-by: Serge Semin
    Signed-off-by: David S. Miller

    Serge Semin
     
  • There are two chip pins named TXDLY and RXDLY which actually adds the 2ns
    delays to TXC and RXC for TXD/RXD latching. Alas this is the only
    documented info regarding the RGMII timing control configurations the PHY
    provides. It turns out the same settings can be setup via MDIO registers
    hidden in the extension pages layout. Particularly the extension page 0xa4
    provides a register 0x1c, which bits 1 and 2 control the described delays.
    They are used to implement the "rgmii-{id,rxid,txid}" phy-mode.

    The hidden RGMII configs register utilization was found in the rtl8211e
    U-boot driver:
    https://elixir.bootlin.com/u-boot/v2019.01/source/drivers/net/phy/realtek.c#L99

    There is also a freebsd-folks discussion regarding this register:
    https://reviews.freebsd.org/D13591

    It confirms that the register bits field must control the so called
    configuration pins described in the table 12-13 of the official PHY
    datasheet:
    8:6 = PHY Address
    5:4 = Auto-Negotiation
    3 = Interface Mode Select
    2 = RX Delay
    1 = TX Delay
    0 = SELRGV

    Reviewed-by: Andrew Lunn
    Signed-off-by: Serge Semin
    Signed-off-by: David S. Miller

    Serge Semin
     

05 Apr, 2019

1 commit


03 Apr, 2019

1 commit


25 Feb, 2019

1 commit

  • Three conflicts, one of which, for marvell10g.c is non-trivial and
    requires some follow-up from Heiner or someone else.

    The issue is that Heiner converted the marvell10g driver over to
    use the generic c45 code as much as possible.

    However, in 'net' a bug fix appeared which makes sure that a new
    local mask (MDIO_AN_10GBT_CTRL_ADV_NBT_MASK) with value 0x01e0
    is cleared.

    Signed-off-by: David S. Miller

    David S. Miller
     

24 Feb, 2019

1 commit

  • This fixes a regression introduced by
    commit 0d2e778e38e0ddffab4bb2b0e9ed2ad5165c4bf7
    "net: phy: replace PHY_HAS_INTERRUPT with a check for
    config_intr and ack_interrupt".

    This assumes that a PHY cannot trigger interrupt unless
    it has .config_intr() or .ack_interrupt() implemented.
    A later patch makes the code assume both need to be
    implemented for interrupts to be present.

    But this PHY (which is inside a DSA) will happily
    fire interrupts without either callback.

    Implement dummy callbacks for .config_intr() and
    .ack_interrupt() in the phy header to fix this.

    Tested on the RTL8366RB on D-Link DIR-685.

    Fixes: 0d2e778e38e0 ("net: phy: replace PHY_HAS_INTERRUPT with a check for config_intr and ack_interrupt")
    Cc: Heiner Kallweit
    Signed-off-by: Linus Walleij
    Reviewed-by: Andrew Lunn
    Signed-off-by: David S. Miller

    Linus Walleij
     

04 Feb, 2019

1 commit

  • The integrated PHY's of later RTL8168 network chips report the generic
    PHYID 0x001cc800 (Realtek OUI, model and revision number both set to
    zero) and therefore currently the genphy driver is used.

    To be able to use the paged version of e.g. phy_write() we need a
    PHY driver with the read_page and write_page callbacks implemented.
    So basically make a copy of the genphy driver, just with the
    read_page and write_page callbacks being set.

    Signed-off-by: Heiner Kallweit
    Signed-off-by: David S. Miller

    Heiner Kallweit
     

23 Jan, 2019

1 commit


12 Nov, 2018

2 commits


08 Nov, 2018

1 commit

  • Instead of listing every single PHYID, load the driver for every PHYID
    with a Realtek OUI, independent of model number and revision.

    This patch also improves two further aspects:
    - constify realtek_tbl[]
    - the mask should have been 0xffffffff instead of 0x001fffff so far,
    by masking out some bits a PHY from another vendor could have been
    matched

    Signed-off-by: Heiner Kallweit
    Signed-off-by: David S. Miller

    Heiner Kallweit
     

05 Nov, 2018

1 commit

  • Since 4.19 the following error in sysfs has appeared when using the
    r8169 NIC driver:

    $cd /sys/module/realtek/drivers
    $ls -l
    ls: cannot access 'mdio_bus:RTL8201F 10/100Mbps Ethernet': No such file or directory
    [..garbled dir entries follow..]

    Apparently the forward slash in "10/100Mbps Ethernet" is interpreted
    as directory separator that leads nowhere, and was introduced in commit
    513588dd44b ("net: phy: realtek: add RTL8201F phy-id and functions").

    Fix this by removing the offending slash in the driver name.

    Other drivers in net/phy seem to have the same problem, but I cannot
    test/verify them.

    Fixes: 513588dd44b ("net: phy: realtek: add RTL8201F phy-id and functions")
    Signed-off-by: Holger Hoffstätte
    Reviewed-by: Andrew Lunn
    Signed-off-by: David S. Miller

    Holger Hoffstätte
     

18 Jul, 2018

1 commit

  • The RTL8366RB is an ASIC with five internal PHYs for
    LAN0..LAN3 and WAN. The PHYs are spawn off the main
    device so they can be handled in a distributed manner
    by the Realtek PHY driver. All that is really needed
    is the power save feature enablement and letting the
    PHY driver core pick up the IRQ from the switch chip.

    Cc: Antti Seppälä
    Cc: Roman Yeryomin
    Cc: Colin Leitner
    Cc: Gabor Juhos
    Cc: Florian Fainelli
    Signed-off-by: Linus Walleij
    Signed-off-by: David S. Miller

    Linus Walleij
     

17 Jul, 2018

1 commit


02 Jul, 2018

2 commits


30 Jun, 2018

1 commit

  • In preparation of adding phylib support to the r8169 driver we need
    PHY drivers for all chip-internal PHY types. Fortunately almost all
    of them are either supported by the Realtek PHY driver already or work
    with the genphy driver.
    Still missing is support for the PHY of RTL8169s, it requires a quirk
    to properly support 100Mbit-fixed mode. The quirk was copied from
    r8169 driver which copied it from the vendor driver.
    Based on the PHYID the internal PHY seems to be a RTL8211.

    Signed-off-by: Heiner Kallweit
    Signed-off-by: David S. Miller

    Heiner Kallweit
     

29 May, 2018

1 commit


22 Mar, 2018

1 commit

  • The Ethernet on mpc8315erdb is broken since commit b6b5e8a69118
    ("gianfar: Disable EEE autoneg by default"). The reason is that
    even though the rtl8211b doesn't support the MMD extended registers
    access, it does return some random values if we trying to access
    the MMD register via indirect method. This makes it seem that the
    EEE is supported by this phy device. And the subsequent writing to
    the MMD registers does cause the phy malfunction. So use the dummy
    stubs for the MMD register access to fix this issue.

    Fixes: b6b5e8a69118 ("gianfar: Disable EEE autoneg by default")
    Signed-off-by: Kevin Hao
    Signed-off-by: David S. Miller

    Kevin Hao
     

17 Jan, 2018

1 commit