From f89333109d18ac91e89193c8619356e0073f458b Mon Sep 17 00:00:00 2001 From: Zhuo Wang Date: Thu, 25 Apr 2019 17:00:46 +0800 Subject: [PATCH] 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 --- drivers/amlogic/ethernet/phy/amlogic.c | 11 ++++++++++- drivers/amlogic/mailbox/scpi_protocol.c | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/amlogic/ethernet/phy/amlogic.c b/drivers/amlogic/ethernet/phy/amlogic.c index 4db2444..f22be80 100644 --- a/drivers/amlogic/ethernet/phy/amlogic.c +++ b/drivers/amlogic/ethernet/phy/amlogic.c @@ -32,6 +32,7 @@ #include #include #include +#include #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) { diff --git a/drivers/amlogic/mailbox/scpi_protocol.c b/drivers/amlogic/mailbox/scpi_protocol.c index cc5f369..7718892 100644 --- a/drivers/amlogic/mailbox/scpi_protocol.c +++ b/drivers/amlogic/mailbox/scpi_protocol.c @@ -615,7 +615,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); -- 2.7.4