diff mbox series

[net,1/2] net: usb: aqc111: Add read_mdio operation

Message ID f07449227d8f6d2a3e82fe6cbe6886214527ecc7.1544622414.git.igor.russkikh@aquantia.com (mailing list archive)
State New, archived
Headers show
Series aqc111: Thermal throttling feature | expand

Commit Message

Igor Russkikh Dec. 12, 2018, 1:50 p.m. UTC
From: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com>

Add necessary defines to read phy registers and temparature

Signed-off-by: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
 drivers/net/usb/aqc111.c |  5 +++++
 drivers/net/usb/aqc111.h | 11 +++++++++++
 2 files changed, 16 insertions(+)

Comments

Andrew Lunn Dec. 12, 2018, 4:11 p.m. UTC | #1
On Wed, Dec 12, 2018 at 01:50:08PM +0000, Igor Russkikh wrote:
> From: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com>
> 
> Add necessary defines to read phy registers and temparature

Hi Igor

[Puts tongue in cheek]

I thought the firmware was supposed to manage the PHY.

So maybe the better fix is to add code to allow firmware upgrade? And
issue new firmware to linux-firmware?

      Andrew
Igor Russkikh Dec. 12, 2018, 7:38 p.m. UTC | #2
>>
>> Add necessary defines to read phy registers and temparature
> 
> Hi Igor
> 
> [Puts tongue in cheek]
> 
> I thought the firmware was supposed to manage the PHY.

FW team due to various reasons do not want to have thermal throttling in their control,
Thus at this moment we are trying to release the product which
will not burn out the table under it ;-)

> So maybe the better fix is to add code to allow firmware upgrade? And
> issue new firmware to linux-firmware?

I would say thats our long term future.

On your request for linux-firmware, I've pushed the question to Phy team,
will inform you on any news.

Regards,
  Igor
diff mbox series

Patch

diff --git a/drivers/net/usb/aqc111.c b/drivers/net/usb/aqc111.c
index 57f1c94fca0b..8867f6a3eaa7 100644
--- a/drivers/net/usb/aqc111.c
+++ b/drivers/net/usb/aqc111.c
@@ -193,6 +193,11 @@  static int aqc111_write16_cmd_async(struct usbnet *dev, u8 cmd, u16 value,
 				      sizeof(tmp), &tmp);
 }
 
+static int aqc111_mdio_read(struct usbnet *dev, u16 value, u16 index, u16 *data)
+{
+	return aqc111_read16_cmd(dev, AQ_PHY_CMD, value, index, data);
+}
+
 static void aqc111_get_drvinfo(struct net_device *net,
 			       struct ethtool_drvinfo *info)
 {
diff --git a/drivers/net/usb/aqc111.h b/drivers/net/usb/aqc111.h
index 4d68b3a6067c..359663635b49 100644
--- a/drivers/net/usb/aqc111.h
+++ b/drivers/net/usb/aqc111.h
@@ -18,9 +18,20 @@ 
 #define AQ_ACCESS_MAC			0x01
 #define AQ_FLASH_PARAMETERS		0x20
 #define AQ_PHY_POWER			0x31
+#define AQ_PHY_CMD			0x32
 #define AQ_WOL_CFG			0x60
 #define AQ_PHY_OPS			0x61
 
+#define AQC111_PHY_ID			0x00
+#define AQ_PHY_ADDR(mmd)		((AQC111_PHY_ID << 8) | (mmd))
+
+#define AQ_PHY_GLOBAL_MMD		0x1E
+#define AQ_PHY_GLOBAL_ADDR		AQ_PHY_ADDR(AQ_PHY_GLOBAL_MMD)
+
+#define AQ_GLB_THERMAL_STATUS1		0xC820
+#define AQ_GLB_THERMAL_STATUS2		0xC821
+	#define AQ_THERM_ST_READY		0x0001
+
 #define AQ_USB_PHY_SET_TIMEOUT		10000
 #define AQ_USB_SET_TIMEOUT		4000