From patchwork Tue Nov 27 12:18:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 1003791 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=renesas.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=renesasgroup.onmicrosoft.com header.i=@renesasgroup.onmicrosoft.com header.b="X59PE/K3"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 4342r83z8Pz9s8J for ; Tue, 27 Nov 2018 23:18:32 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730905AbeK0XQN (ORCPT ); Tue, 27 Nov 2018 18:16:13 -0500 Received: from mail-eopbgr1400139.outbound.protection.outlook.com ([40.107.140.139]:52032 "EHLO JPN01-TY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726359AbeK0XQN (ORCPT ); Tue, 27 Nov 2018 18:16:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=f02KsYrEGQ4d1b4vQP4LtKBhbYdW8CMb0QayIvI1Jd4=; b=X59PE/K30Tfx53Nsn0s6vE9wXBNbERHryNxtoKR/37L5aOZ0B82oA/yRL5KbICEygz96BrRGHsNZiAiYhf6wAtmnG+A2jo4HQ0xMBvPNLSsMhoqjJpegUcqSd5B+BCYZP/Z4k+LFxEaKgPb3k9+B83RRPteaB3ahL5P8X0E5V1A= Received: from OSBPR01MB2293.jpnprd01.prod.outlook.com (52.134.243.14) by OSBPR01MB3464.jpnprd01.prod.outlook.com (20.178.96.79) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1361.19; Tue, 27 Nov 2018 12:18:21 +0000 Received: from OSBPR01MB2293.jpnprd01.prod.outlook.com ([fe80::c070:7362:375f:74c5]) by OSBPR01MB2293.jpnprd01.prod.outlook.com ([fe80::c070:7362:375f:74c5%4]) with mapi id 15.20.1339.032; Tue, 27 Nov 2018 12:18:21 +0000 From: Yoshihiro Shimoda To: "andrew@lunn.ch" , "f.fainelli@gmail.com" , "davem@davemloft.net" CC: "netdev@vger.kernel.org" , "linux-renesas-soc@vger.kernel.org" , "devicetree@vger.kernel.org" , Yoshihiro Shimoda Subject: [PATCH/RFC] net: phy: device: Don't deassert the reset when register and probe Thread-Topic: [PATCH/RFC] net: phy: device: Don't deassert the reset when register and probe Thread-Index: AQHUhktJZcMI+eVkdEONSp2wRnnfOQ== Date: Tue, 27 Nov 2018 12:18:20 +0000 Message-ID: <1543320947-32763-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> Accept-Language: ja-JP, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 1.9.1 x-clientproxiedby: KAWPR01CA0076.jpnprd01.prod.outlook.com (2603:1096:402:c::12) To OSBPR01MB2293.jpnprd01.prod.outlook.com (2603:1096:603:26::14) authentication-results: spf=none (sender IP is ) smtp.mailfrom=yoshihiro.shimoda.uh@renesas.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [211.11.155.144] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; OSBPR01MB3464; 20:2Mz+ZOboIO28G1G2lfNaV5KqarxjnZN2VbwTYX+RxfYPEwA8+IESfwT6/9k+sq2fPeoZbR+A7kovLHMaHXnT3wm9i/K6/Q2KQ8pw20ZEfAp4w5DoW0hDBVL1/AOC4YIC44ohRv+TOTwyMEJa54DHyh0YSyZIJL+92IWJvh7AZgw= x-ms-office365-filtering-correlation-id: 0c666dd0-7a3a-4b06-3ef9-08d654626b24 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:OSBPR01MB3464; x-ms-traffictypediagnostic: OSBPR01MB3464: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(3231443)(944501410)(52105112)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:OSBPR01MB3464; BCL:0; PCL:0; RULEID:; SRVR:OSBPR01MB3464; x-forefront-prvs: 086943A159 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39850400004)(366004)(396003)(346002)(136003)(376002)(199004)(189003)(2501003)(50226002)(25786009)(476003)(53936002)(105586002)(486006)(8676002)(5660300001)(66066001)(86362001)(71190400001)(71200400001)(97736004)(106356001)(2201001)(6486002)(6506007)(386003)(14454004)(26005)(107886003)(316002)(305945005)(7736002)(6436002)(54906003)(102836004)(39060400002)(99286004)(2906002)(478600001)(6116002)(3846002)(6512007)(52116002)(256004)(68736007)(4326008)(8936002)(186003)(36756003)(81156014)(2616005)(14444005)(81166006)(110136005); DIR:OUT; SFP:1102; SCL:1; SRVR:OSBPR01MB3464; H:OSBPR01MB2293.jpnprd01.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: renesas.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: f1Mq1P192z1XMcqr4R/x4cSzFUrYhcO/GFbaD3TvbEPL2R0usOlhPf8xFFCuaOCiSf0CU3+B4s92Cz1dfBnqTNIe7ZGdYpptErMO+KCkrTK6uwdhMFVDkbCmTgf0VgFAwRvaofaSrHyRFIoHsmhWLQ+09gd7YFZENhpifbLSo9sa9Zhkwi/uF1TnextoCAiSmamTDQbfsLxasaYncxgBm12Tg9KlHQQlE9KnVNszuts99LaRj+iyRPET5q8QWQ6UfDUpwP6jQweryIba8O5AyZ/SIA6vAovaUoSNpxHKejEFC5N5LM2LjS/lmc1Lkhj++8TocEC7zlMOHq5EjXHpAb/A2mUSvCqX0R3t6ANmycI= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0c666dd0-7a3a-4b06-3ef9-08d654626b24 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Nov 2018 12:18:20.9007 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSBPR01MB3464 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Some PHY device needs edge signal of the reset, but the previous code is impossible to achieve it like following: 1) Kernel boots by using initramfs. --> No open the nic, so the provious code deasserts the reset by phy_device_register() and phy_probe(). 2) Kernel enters the suspend. --> So, keep the reset signal as deassert. --> On R-Car Salvator-XS board, unfortunately, the board power is turned off. 3) Kernel returns from suspend. 4) ifconfig eth0 up --> Then, since edge signal of the reset doesn't happen, it cannot link up. 5) ifconfig eth0 down 6) ifconfig eth0 up --> In this case, it can link up. This patch is possible to break if ->probe() in a phy driver will access the PHY. But, I believe ->config_init() only initializes the PHY. However, I think this patch should be RFC at first. Reported-by: Hiromitsu Yamasaki Signed-off-by: Yoshihiro Shimoda --- drivers/net/phy/phy_device.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index e06613f..e01a752 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -802,16 +802,6 @@ int phy_device_register(struct phy_device *phydev) if (err) return err; - /* Deassert the reset signal */ - phy_device_reset(phydev, 0); - - /* Run all of the fixups for this PHY */ - err = phy_scan_fixups(phydev); - if (err) { - pr_err("PHY %d failed to initialize\n", phydev->mdio.addr); - goto out; - } - err = device_add(&phydev->mdio.dev); if (err) { pr_err("PHY %d failed to add\n", phydev->mdio.addr); @@ -821,8 +811,6 @@ int phy_device_register(struct phy_device *phydev) return 0; out: - /* Assert the reset signal */ - phy_device_reset(phydev, 1); mdiobus_unregister_device(&phydev->mdio); return err; @@ -2202,16 +2190,8 @@ static int phy_probe(struct device *dev) /* Set the state to READY by default */ phydev->state = PHY_READY; - if (phydev->drv->probe) { - /* Deassert the reset signal */ - phy_device_reset(phydev, 0); - + if (phydev->drv->probe) err = phydev->drv->probe(phydev); - if (err) { - /* Assert the reset signal */ - phy_device_reset(phydev, 1); - } - } mutex_unlock(&phydev->lock);