ethernet: set tx_amp according chips [1/1]
authorZhuo Wang <zhuo.wang@amlogic.com>
Thu, 25 Apr 2019 09:00:46 +0000 (17:00 +0800)
committerNick Xie <nick@khadas.com>
Mon, 5 Aug 2019 06:05:52 +0000 (14:05 +0800)
PD#SWPL-7765

Problem:
g12b revb efuse not correct

Solution:
set tx_amp with chipid to work around

Verify:
verify on g12b skt board

Change-Id: Id1babce231d866293e4de52685834834a4b65227
Signed-off-by: Zhuo Wang <zhuo.wang@amlogic.com>
drivers/amlogic/ethernet/phy/amlogic.c
drivers/amlogic/mailbox/scpi_protocol.c

index 4db2444..f22be80 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/ethtool.h>
 #include <linux/phy.h>
 #include <linux/amlogic/scpi_protocol.h>
+#include <linux/amlogic/cpu_version.h>
 
 #define  SMI_ADDR_TSTWRITE    23
 
@@ -149,7 +150,15 @@ void custom_internal_config(struct phy_device *phydev)
         *if env tx_amp ==0 we will use the efuse
         */
        efuse_amp = scpi_get_ethernet_calc();
-       efuse_valid = (efuse_amp >> 3);
+       if (is_meson_g12b_cpu() && is_meson_rev_a()) {
+               pr_info("g12b a\n");
+               efuse_valid = (efuse_amp >> 3);
+               efuse_amp = efuse_amp & 0x7;
+       } else {
+               pr_info("others\n");
+               efuse_valid = (efuse_amp >> 4);
+               efuse_amp = efuse_amp & 0xf;
+       }
        env_valid = (tx_amp >> 7);
        if (env_valid || efuse_valid) {
 
index 22883ee..f0ebfc3 100644 (file)
@@ -591,7 +591,7 @@ u8 scpi_get_ethernet_calc(void)
        SCPI_SETUP_DBUF(sdata, mdata, SCPI_CL_NONE,
                SCPI_CMD_GET_ETHERNET_CALC, temp, buf);
        if (scpi_execute_cmd(&sdata))
-               return -EPERM;
+               return 0;
        return buf.eth_calc;
 }
 EXPORT_SYMBOL_GPL(scpi_get_ethernet_calc);