driver/eth/usb/asix.ko: Support for 88772C in Rev-RMII
Subsystems (3)
PATCH 1/1 driver/eth/usb/asix.ko: Support for 88772C in Rev-RMII
This Patch adds support to the asix.ko driver for the AX88772C in Reverse-RMII mode.
The 'asix.ko' driver is designed to support 88772A, B and C.
The AX88772C supports running in Reverse-RMII mode to enable MAC to MAC communication.
The base 'asix.ko' driver does NOT currently support the AX88772C in Reverse-RMII mode.
This is due to several reasons:
1. The AX88772C PHY register "LINK STATUS" Link value never is set to
1.
a. This prevents the drivers from setting the interface 'UP'
2. The AX88772C PHY-ID is hard coded to 0x10, this configures the chip
to use the internal PHY not an external PHY.
a. To use the AX88772C in Reverse-RMII mode, the chip must be
configured to use the external 'PHY'.
Asix provides a dedicated AX88772C driver which supports Reverse-RMII. This 'C' driver was references to add Reverse-RMII support to the base asix.ko driver.
To resolve the issue, the following changes were made:
1. MDIO_READ prior to configuring chip to determine what operational
mode it is in (Internal, RMII, or Reverse-RMII)
2. If in Reverse-RMII mode, force chip to be configured as if it had an
external PHY.
3. If in Reverse-RMII mode, set the interface status to UP regardless
of the value of the 'LINK STATUS' bit.
From fe97ec1812e6befc8bddc319fdf9cc913f45617f Mon Sep 17 00:00:00 2001
From: Mike <[email protected]>
Date: Tue, 22 Jul 2025 16:16:44 -0400
Subject: [PATCH] Subject: [Patch v1] driver/eth/usb/asix.ko: Support for
88772C in Rev-RMII
From: Mike Sobchuk <[email protected]>
AX88772C in Reverse-RMII mode does not set LINK status to 1. Results in driver being unable to set interface up.
PHY-ID forces driver to configure chip to use internal PHY not external. Patch provides support for AX88772C in Reverse-RMII with the following changes:mdio_read to determine operational mode (Internal, RMII, or REV-RMII). if in REV-RMII, configure mac to use external PHY (Same as RMII mode). if in REV-RMII, force LINK status to UP regardless of PHY 'LINK status' register value.
--- drivers/net/usb/asix.h | 12 +++++++++++- drivers/net/usb/asix_devices.c | 19 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-)
drivers/net/usb/asix.h +11 -1
@@ -32,6 +32,7 @@#define DRIVER_VERSION "22-Dec-2011"#define DRIVER_NAME "asix" +/* ASIX AX8817X based USB 2.0 Ethernet Devices */ #define AX_CMD_SET_SW_MII 0x06
@@ -72,7 +73,12 @@#define AX_HOST_EN 0x01#define AX_PHYSEL_PSEL 0x01 -#define AX_PHYSEL_SSMII 0 +#define AX_PHYSEL_SSMII 0x00 +#define AX_PHYSEL_ASEL 0x02 +#define AX_PHYSEL_MASK 0x0C +#define AX_PHYSEL_SSMII 0x00 +#define AX_PHYSEL_SSRMII 0x04 +#define AX_PHYSEL_SSRRMII 0x0C#define AX_PHYSEL_SSEN 0x10#define AX_PHY_SELECT_MASK (BIT(3) | BIT(2))
@@ -160,6 +166,9 @@#define AX_EMBD_PHY_ADDR 0x10 +#define OPERATION_MAC_MODE 0 +#define OPERATION_PHY_MODE 1 +/* This structure cannot exceed sizeof(unsigned long [5]) AKA 20 bytes */ struct asix_data {u8 multi_filter[AX_MCAST_FILTER_SIZE ];
@@ -191,6 +200,7 @@ struct asix_common_private {u16 phy_addr;bool embd_phy;u8 chipcode; +u8 OperationMode; };extern const struct driver_info ax88172a_info;
drivers/net/usb/asix_devices.c +19 -0
@@ -42,11 +42,17 @@ struct ax88172_int_data {static void asix_status (struct usbnet *dev,struct urb *urb) { +struct asix_common_private *priv = dev->driver_priv;struct ax88172_int_data *event;int link;if (urb->actual_length <8 )return ; +if (priv->OperationMode ==OPERATION_PHY_MODE ){ +usbnet_link_change (dev,1 ,0 ); +return ; + } + event = urb->transfer_buffer; link = event->link &0x01 ;
@@ -836,6 +842,15 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)usbnet_get_endpoints (dev, intf); + ret =asix_read_cmd (dev,AX_CMD_SW_PHY_STATUS ,0 ,0 ,1 , buf,0 ); + *buf &=AX_PHYSEL_MASK ; + +if (*buf ==AX_PHYSEL_SSRRMII ){ + priv->OperationMode =OPERATION_PHY_MODE ; +netdev_dbg (dev->net,"PHY MODE\n" ); + } + +/* Maybe the boot loader passed the MAC address via device tree */ if (!eth_platform_get_mac_address (&dev->udev->dev, buf)) { netif_dbg(dev, ifup, dev->net,
@@ -876,6 +891,10 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) priv->phy_addr = ret; priv->embd_phy = ((priv->phy_addr &0x1f ) ==AX_EMBD_PHY_ADDR ); +if (priv->OperationMode ==OPERATION_PHY_MODE ) { + priv->embd_phy =0 ; + } + ret =asix_read_cmd (dev,AX_CMD_STATMNGSTS_REG ,0 ,0 ,1 , &priv->chipcode,0 );if (ret <0 ) {
Signature · 1 line
2.43.0