From b3de3b7abfde4e21ba6b4e0e01c0dc6355706e96 Mon Sep 17 00:00:00 2001 From: Vandhiadevan Karunamoorthy Date: Fri, 21 May 2021 15:43:05 +0530 Subject: [PATCH] ipq50xx: update gephy debug register RW Signed-off-by: Vandhiadevan Karunamoorthy Change-Id: Id179a343a93b465941630ba6613930c29d5ffcdd --- .../include/asm/arch-ipq5018/ipq5018_gmac.h | 4 ++- drivers/net/ipq5018/ipq5018_gmac.c | 29 ++++++++++++------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/arch/arm/include/asm/arch-ipq5018/ipq5018_gmac.h b/arch/arm/include/asm/arch-ipq5018/ipq5018_gmac.h index f93bca4a5f..4d71b39959 100644 --- a/arch/arm/include/asm/arch-ipq5018/ipq5018_gmac.h +++ b/arch/arm/include/asm/arch-ipq5018/ipq5018_gmac.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -27,6 +27,8 @@ #define MPGE_PHY_MMD1_DAC_MASK 0xff00 #define PHY_DAC(val) (val<<8) #define MPGE_PHY_DEBUG_EDAC 0x4380 +#define QCA808X_DEBUG_PORT_ADDRESS 29 +#define QCA808X_DEBUG_PORT_DATA 30 #define LINK_UP 0x400 #define LINK(_data) (_data & LINK_UP)? "Up" : "Down" diff --git a/drivers/net/ipq5018/ipq5018_gmac.c b/drivers/net/ipq5018/ipq5018_gmac.c index 76f552daa1..6e8d163950 100644 --- a/drivers/net/ipq5018/ipq5018_gmac.c +++ b/drivers/net/ipq5018/ipq5018_gmac.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2019-2020 The Linux Foundation. All rights reserved. +* Copyright (c) 2019-2021 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -685,18 +685,27 @@ static void gephy_mdac_edac_config(ipq_gmac_board_cfg_t *gmac_cfg) (phy_data | phy_dac) ); mdelay(1); - /*set edac value*/ + /* + || set edac value debug register write follows indirect + || adressing so first write address in port address and + || write value in data register + */ + ipq5018_mdio_write(gmac_cfg->phy_addr, + QCA808X_DEBUG_PORT_ADDRESS, + MPGE_PHY_DEBUG_EDAC); phy_data = ipq5018_mdio_read( gmac_cfg->phy_addr, - MPGE_PHY_DEBUG_EDAC, - NULL - ); + QCA808X_DEBUG_PORT_DATA, + NULL); + phy_data &= ~(MPGE_PHY_MMD1_DAC_MASK); - ipq5018_mdio_write( - gmac_cfg->phy_addr, - MPGE_PHY_DEBUG_EDAC, - (phy_data | phy_dac) - ); + + ipq5018_mdio_write(gmac_cfg->phy_addr, + QCA808X_DEBUG_PORT_ADDRESS, + MPGE_PHY_DEBUG_EDAC); + ipq5018_mdio_write(gmac_cfg->phy_addr, + QCA808X_DEBUG_PORT_DATA, + (phy_data | phy_dac)); mdelay(1); }