ethernet: set tx_amp according chips [1/1]

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>
This commit is contained in:
Zhuo Wang
2019-04-25 17:00:46 +08:00
committed by Luan Yuan
parent 701354450a
commit 408ded9202
2 changed files with 11 additions and 2 deletions

View 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) {

View 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);