openwrt/target/linux/generic/hack-6.1/726-net-phy-aquantia-enable-AQR111-and-AQR111B0.patch

111 lines
3.9 KiB
Diff
Raw Normal View History

ipq807x: add support for Netgear RAX120v2 Netgear Nighthawk RAX120v2 AX WIFI router with 5 1G and 1 5G ports. The majority of the code is based on @jewwest's PR #11830. Specifications: * CPU: Qualcomm IPQ8074 Quad core Cortex-A53 2.2GHz * RAM: 1024MB of DDR3 (Nanya NT5CC256M16EP-EK × 2) * Flash: SPI-NAND 512 MiB (Winbond W29N04GZBIBA) * Ethernet: 4x 10/100/1000 Mbps LAN, 1x 10/100/1000 Mbps WAN (Qualcomm QCA8075), 1x 10/100/1000/2500/5000 Mbps LAN/WAN (Aquantia AQR111B0 PHY) * Wi-Fi: * 2.4 GHz: Qualcomm QCN5024 4x4 * 2x 5 GHz: Qualcomm QCN5054 4x4 * USB: 2x USB 3.0 * LEDs: Power, 2.4GHz & 5GHz Radio, WPS, WAN, USB1 & USB2, 5G LAN * Keys: LEDs On/Off, Power, Reset, RFKILL, WPS * UART: Marked J9003 VCC TX RX GND, beginning from "1". 3.3v, 115200n8 * Power: 19 VDC, 3.1 A Installation: * Flashing OpenWrt is done in two steps: a) Flash *-squashfs-web-ui-factory.img from stock UI (thanks to @wangyu-). This writes an initramfs based OpenWrt image onto the RAX120v2 b) From OpenWrt flash the *-squashfs-sysupgrade.bin using LuCI or the commandline * U-Boot allows booting an initramfs image via TFTP: - Set ip of your PC to 192.168.1.100 - At the serial console interrupt boot at "Hit any key to stop autoboot:" - In u-boot run `tftpsrv` - On your PC send the OpenWrt initramfs image: tftp 192.168.1.1 -m binary -c put openwrt-ipq807x-generic-netgear_rax120v2-initramfs-uImage.itb Make 5G Aquantia phy work: For the 5G port labeled 'lan5' to work a firmware is needed. This can be loaded in u-boot by writing the firmware to the correct mtd partition. The firmware file found in the Netgear stock firmware under /lib/firmware/ named 'AQR-G3_v4.3.C-AQR_DNI_DR-EQ35AX8-R-prov1_ID23888_VER1311.cld' is needed and has to be converted to a MBN file. The `mkheader.py` script used here can be found in the Netgear V1.2.8.40 GPL source, under 'git_home/u-boot.git/tools/mkheader.py' Convert the CLD file to MBN using: $ python2 mkheader.py 0x44000000 0x13 <*.cld file> aqr_4.3.C.mbn This MBN file can then be flashed to the MTD partition to be used by u-boot. The necessary files can also be found in https://github.com/boretom/openwrt-fork/tree/rax120v2/aquantia-firmware * Write MBN file to MTD partition to be loaded automatically by u-boot: U-boot automatically tries to load the firmware from nand at address 0x7e00000 which corresponds to `/dev/mtd25` in OpenWrt. - find ETHPHYFW partition while running OpenWrt (expected: /dev/mtd25) $ fgrep -i 'ethphyfw' /proc/mtd mtd25: 00080000 00020000 "ethphyfw - copy mbn file to /tmp/ folder of the router $ scp aqr-v4.3.C.mbn 192.168.1.1:/tmp/ - write mbn file to ethphyfw partition $ mtd write /tmp/aqr_v4.3.C.mbn /dev/mtd25 Revert to stock firmware: * Flash the stock firmware to the bootloader using TFTP/NMRP. References to RAX120v2 GPL source: https://www.downloads.netgear.com/files/GPL/RAX120-V1.2.8.40_gpl_src.zip Reviewed-by: Robert Marko <robimarko@gmail.com> Signed-off-by: Thomas Kupper <thomas.kupper@gmail.com>
2023-05-05 15:04:33 +00:00
Author: Thomas Kupper <thomas.kupper@gmail.com>
Date: Wed May 24 21:14:17 2023 +0200
kernel: phy: add Aquantia PHY AQR111 & AQR111B0
Add the IDs for Aquantia PHY AQR111 and AQR111B0 as found in the GPL sources
of the Netgear RAX120v2 firmware v1.2.8.40.
This is a 5GbE chip but it reports support for 10G. Implement config_init()
to set max speed to 5G.
Signed-off-by: Thomas Kupper <thomas.kupper@gmail.com>
--- a/drivers/net/phy/aquantia_main.c
+++ b/drivers/net/phy/aquantia_main.c
@@ -24,6 +24,8 @@
#define PHY_ID_AQR405 0x03a1b4b0
#define PHY_ID_AQR113C 0x31c31c12
#define PHY_ID_AQR813 0x31c31cb2
+#define PHY_ID_AQR111 0x03a1b610
+#define PHY_ID_AQR111B0 0x03a1b612
#define PHY_ID_AQR112 0x03a1b662
#define PHY_ID_AQR412 0x03a1b712
#define PHY_ID_AQR113 0x31c31c40
@@ -729,6 +731,34 @@ static int aqcs109_config_init(struct ph
return aqr107_set_downshift(phydev, MDIO_AN_VEND_PROV_DOWNSHIFT_DFLT);
}
+static int aqr111_config_init(struct phy_device *phydev)
+{
+ int ret;
+
+ /* Check that the PHY interface type is compatible */
+ if (phydev->interface != PHY_INTERFACE_MODE_SGMII &&
+ phydev->interface != PHY_INTERFACE_MODE_1000BASEKX &&
+ phydev->interface != PHY_INTERFACE_MODE_2500BASEX &&
+ phydev->interface != PHY_INTERFACE_MODE_XGMII &&
+ phydev->interface != PHY_INTERFACE_MODE_USXGMII &&
+ phydev->interface != PHY_INTERFACE_MODE_10GKR &&
+ phydev->interface != PHY_INTERFACE_MODE_10GBASER &&
+ phydev->interface != PHY_INTERFACE_MODE_XAUI &&
+ phydev->interface != PHY_INTERFACE_MODE_RXAUI)
+ return -ENODEV;
+
+ WARN(phydev->interface == PHY_INTERFACE_MODE_XGMII,
+ "Your devicetree is out of date, please update it. The AQR107 family doesn't support XGMII, maybe you mean USXGMII.\n");
+
+ ret = aqr107_wait_reset_complete(phydev);
+ if (!ret)
+ aqr107_chip_info(phydev);
+
+ /* AQR111 reports supporting speed up to 10G, however only speeds up to 5G are supported. */
+ phy_set_max_speed(phydev, SPEED_5000);
+
+ return aqr107_set_downshift(phydev, MDIO_AN_VEND_PROV_DOWNSHIFT_DFLT);
+}
static void aqr107_link_change_notify(struct phy_device *phydev)
{
u8 fw_major, fw_minor;
@@ -961,6 +991,42 @@ static struct phy_driver aqr_driver[] =
.link_change_notify = aqr107_link_change_notify,
},
{
+ PHY_ID_MATCH_MODEL(PHY_ID_AQR111),
+ .name = "Aquantia AQR111",
+ .probe = aqr107_probe,
+ .config_init = aqr111_config_init,
+ .config_aneg = aqr_config_aneg,
+ .config_intr = aqr_config_intr,
+ .handle_interrupt = aqr_handle_interrupt,
+ .read_status = aqr107_read_status,
+ .get_tunable = aqr107_get_tunable,
+ .set_tunable = aqr107_set_tunable,
+ .suspend = aqr107_suspend,
+ .resume = aqr107_resume,
+ .get_sset_count = aqr107_get_sset_count,
+ .get_strings = aqr107_get_strings,
+ .get_stats = aqr107_get_stats,
+ .link_change_notify = aqr107_link_change_notify,
+},
+{
+ PHY_ID_MATCH_MODEL(PHY_ID_AQR111B0),
+ .name = "Aquantia AQR111B0",
+ .probe = aqr107_probe,
+ .config_init = aqr111_config_init,
+ .config_aneg = aqr_config_aneg,
+ .config_intr = aqr_config_intr,
+ .handle_interrupt = aqr_handle_interrupt,
+ .read_status = aqr107_read_status,
+ .get_tunable = aqr107_get_tunable,
+ .set_tunable = aqr107_set_tunable,
+ .suspend = aqr107_suspend,
+ .resume = aqr107_resume,
+ .get_sset_count = aqr107_get_sset_count,
+ .get_strings = aqr107_get_strings,
+ .get_stats = aqr107_get_stats,
+ .link_change_notify = aqr107_link_change_notify,
+},
+{
PHY_ID_MATCH_MODEL(PHY_ID_AQR112),
.name = "Aquantia AQR112",
.probe = aqr107_probe,
@@ -1030,6 +1096,8 @@ static struct mdio_device_id __maybe_unu
{ PHY_ID_MATCH_MODEL(PHY_ID_AQR405) },
{ PHY_ID_MATCH_MODEL(PHY_ID_AQR113C) },
{ PHY_ID_MATCH_MODEL(PHY_ID_AQR813) },
+ { PHY_ID_MATCH_MODEL(PHY_ID_AQR111) },
+ { PHY_ID_MATCH_MODEL(PHY_ID_AQR111B0) },
{ PHY_ID_MATCH_MODEL(PHY_ID_AQR112) },
{ PHY_ID_MATCH_MODEL(PHY_ID_AQR412) },
{ PHY_ID_MATCH_MODEL(PHY_ID_AQR113) },