Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1135609imu; Mon, 5 Nov 2018 14:37:45 -0800 (PST) X-Google-Smtp-Source: AJdET5fkT8JqQBI8Th/8zhXPazMZ8BeTZ3T8PtK6uzQTJA10f4IRFBbagxIjLOi+iOBjSVpuUZDr X-Received: by 2002:a62:1803:: with SMTP id 3-v6mr23769318pfy.21.1541457465773; Mon, 05 Nov 2018 14:37:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541457465; cv=none; d=google.com; s=arc-20160816; b=bNj/dmHH15VhnsUBhMeUcwnwflhr6gMyv6zucR6GL7+JSqa2phc8q4t7khEiQe371L WfFtnBs9nBhS/usz+6HL6MWA9E3yFUUXtF89EjDwvr8eFAC5jGeWfxt/eM5M3PNBby9s F7+y9n+LR9my3nvPdBfVBB5ksYqk1XPqEwI3zJoUryfusjUVC4eqKPIvAABtb08qg90H hFO1Af8MpQkLX6/ha39TJhoPfeai0+zAacWrwZbm+ngVgRjfkUnDRBLH62yV0anV9Zt/ yVfEpxXWzqvuxxwzYvQbJoFGfBCeubERuT52DWMAcRfQW+nrJrO/TanpcYYNjR55OWMH fKtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject :smtp-origin-cluster:cc:to:smtp-origin-hostname:from :smtp-origin-hostprefix:dkim-signature; bh=z+B/rlr/YWeW91bdB9QkfqTblPJ9XzU3SNWQbNx0uR8=; b=Ip0fwHmp2tR2U7G5CLpDsXVul0/AxhiW7w6IX5SgtdcuwX7QwnOH+ekusFCFjOwRVI Dyc0C+BOqp1CFHyO1bojFhDDR7Q5ggNCcIHs9pftA/SrMtZtGXLlMnUEafbq6ABgl/+z D4r6+yGuohsxejI9rf/oasTxSkQ2OmPzvKz8czWf6U3xdG9iaoK79118IIfPhgKEsQFY Y9UgrlzO6DeDq9NCn3tloU0C5jG4QN9JtC75wpC8RXqHBUvlX6VhGeB9yBivnHMSmj4l 6taceX1b5Pb0OrRJcC9YtlUo79L62xtYIxAimv9rIQHYjp9kHcRHFVrpTy1Y/xayw49q SHQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=WcE1Aep7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 61-v6si16086407plz.40.2018.11.05.14.37.30; Mon, 05 Nov 2018 14:37:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=WcE1Aep7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388186AbeKFH5o (ORCPT + 99 others); Tue, 6 Nov 2018 02:57:44 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:46982 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388034AbeKFH5o (ORCPT ); Tue, 6 Nov 2018 02:57:44 -0500 Received: from pps.filterd (m0148461.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wA5MXgBZ009782 for ; Mon, 5 Nov 2018 14:35:46 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=facebook; bh=z+B/rlr/YWeW91bdB9QkfqTblPJ9XzU3SNWQbNx0uR8=; b=WcE1Aep7p95TTO8mIX1eS1soPT2iLLBWqHZPdo7H9Gqw7G2ceVSY3rfDOXqbVWBdYJvK m5TFS+9AnORdba8YzH3+rNcSajGYalSsvsqo+jwZylKmryW4ZU5ld49Lv1ttzVOOkwMS Ya9VAtiXRZwT3If27v3GiY9D3SuT6JFsQEU= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0a-00082601.pphosted.com with ESMTP id 2njvx20c2f-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 05 Nov 2018 14:35:46 -0800 Received: from mx-out.facebook.com (2620:10d:c0a1:3::13) by mail.thefacebook.com (2620:10d:c021:18::174) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.1.1531.3; Mon, 5 Nov 2018 14:35:45 -0800 Received: by devvm24792.prn1.facebook.com (Postfix, from userid 150176) id E4C867A7E5F7; Mon, 5 Nov 2018 14:35:42 -0800 (PST) Smtp-Origin-Hostprefix: devvm From: Tao Ren Smtp-Origin-Hostname: devvm24792.prn1.facebook.com To: Andrew Lunn , Florian Fainelli , "David S . Miller" , , CC: Tao Ren , Smtp-Origin-Cluster: prn1c35 Subject: [PATCH net] net: phy: Allow BCM54616S PHY to setup internal TX/RX clock delay Date: Mon, 5 Nov 2018 14:35:40 -0800 Message-ID: <20181105223540.1897084-1-taoren@fb.com> X-Mailer: git-send-email 2.17.1 X-FB-Internal: Safe MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-11-05_13:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch allows users to enable/disable internal TX and/or RX clock delay for BCM54616S PHYs so as to satisfy RGMII timing specifications. On a particular platform, whether TX and/or RX clock delay is required depends on how PHY connected to the MAC IP. This requirement can be specified through "phy-mode" property in the platform device tree. The patch is inspired by commit 733336262b28 ("net: phy: Allow BCM5481x PHYs to setup internal TX/RX clock delay"). Signed-off-by: Tao Ren --- drivers/net/phy/broadcom.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c index e86ea105c802..704537010453 100644 --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c @@ -92,7 +92,7 @@ static int bcm54612e_config_init(struct phy_device *phydev) return 0; } -static int bcm5481x_config(struct phy_device *phydev) +static int bcm54xx_config_clock_delay(struct phy_device *phydev) { int rc, val; @@ -429,7 +429,7 @@ static int bcm5481_config_aneg(struct phy_device *phydev) ret = genphy_config_aneg(phydev); /* Then we can set up the delay. */ - bcm5481x_config(phydev); + bcm54xx_config_clock_delay(phydev); if (of_property_read_bool(np, "enet-phy-lane-swap")) { /* Lane Swap - Undocumented register...magic! */ @@ -442,6 +442,19 @@ static int bcm5481_config_aneg(struct phy_device *phydev) return ret; } +static int bcm54616s_config_aneg(struct phy_device *phydev) +{ + int ret; + + /* Aneg firsly. */ + ret = genphy_config_aneg(phydev); + + /* Then we can set up the delay. */ + bcm54xx_config_clock_delay(phydev); + + return ret; +} + static int brcm_phy_setbits(struct phy_device *phydev, int reg, int set) { int val; @@ -636,6 +649,7 @@ static struct phy_driver broadcom_drivers[] = { .features = PHY_GBIT_FEATURES, .flags = PHY_HAS_INTERRUPT, .config_init = bcm54xx_config_init, + .config_aneg = bcm54616s_config_aneg, .ack_interrupt = bcm_phy_ack_intr, .config_intr = bcm_phy_config_intr, }, { -- 2.17.1