Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2365162imu; Thu, 29 Nov 2018 03:58:14 -0800 (PST) X-Google-Smtp-Source: AFSGD/XikuD/FSEZ3tQjWp54WaBsSlQd/rL89TURO5axo+EVGIJER9Ugf/pPbTwloWmopYzvAW+a X-Received: by 2002:a62:da5a:: with SMTP id w26mr1104150pfl.106.1543492694260; Thu, 29 Nov 2018 03:58:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543492694; cv=none; d=google.com; s=arc-20160816; b=YHNetSb4G9TQbTWhiLJiNRhnARfwPa5I8wK9BkGj472jufgI4vQVhAnHV4Q9EQce58 ifb0AHpAAWp7WbHv/+4yWGz9fmVfYvuKRsQeWj5V8shsKvD0c3EBiKunO1GzzC0PNzfM LXl3hc+yWmni55NYFjgxqEStJJd/hRo5F9QwbzgYqvcj81xunX+rkVyOwDNqwS+6pPCl HtKarA3BuPplsTsSwZ5w07t6Iqy6G2zWvgZu/iKN5JTU+ozsFBDZK7c0DAGmQjU7N93N Ab+jf054krVWB/N9C+J9bucLJd8u+/NWBOsKlK7QT0RaX723LhFBftASfECHzzMN+C+C UmRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from; bh=sTVJW0kJ4GcQ2KuHj4gBGyLzGr8xRTllUgDTRIZM2NQ=; b=tlBFVpirV5GrWHDihbX3kuvLW4dmpC5LAuNPKCV6OHY523hgASHHNam6705hTy8Ksc q3FMsFfJiMifzC1KJ1FHyorUpPLjFy2nk0YwBn78kKrGGjKVCVICYVl8os5b0PuXkr5R rXFXAyH8z79JwwtLFSGfWg+m5VOJuwUOwxaCKD9IAO5MqHFdco/7DKUrAnBvP5okKzMs Jsxm65Wzut16QiJZ9WpjMmMtdG5IfQJbxvfIR9bkU3lYTIbgXsARkxVjBXh1BigVkj// lb4Lxvc/QgQfwpnH9UBLc7vJzvJsSQK/gwgpxy6m1l0ogn3zUltge54aZHpB5oq4VToX F0ug== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d16si2148498plj.104.2018.11.29.03.57.59; Thu, 29 Nov 2018 03:58:14 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728203AbeK2XAx (ORCPT + 99 others); Thu, 29 Nov 2018 18:00:53 -0500 Received: from mx2.suse.de ([195.135.220.15]:38394 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726683AbeK2XAw (ORCPT ); Thu, 29 Nov 2018 18:00:52 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 40324ACC8; Thu, 29 Nov 2018 11:55:44 +0000 (UTC) From: Andreas Schwab To: Andrew Lunn Cc: Palmer Dabbelt , f.fainelli@gmail.com, sergei.shtylyov@cogentembedded.com, atish.patra@wdc.com, nicolas.ferre@microchip.com, netdev@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, hkallweit1@gmail.com Subject: Re: macb: probe of 10090000.ethernet failed with error -110 References: <2e17bba6-d932-37b2-5dca-0963fc50f5e6@gmail.com> <20181129055510.GB17675@lunn.ch> X-Yow: Can you MAIL a BEAN CAKE? Date: Thu, 29 Nov 2018 12:55:42 +0100 In-Reply-To: <20181129055510.GB17675@lunn.ch> (Andrew Lunn's message of "Thu, 29 Nov 2018 06:55:10 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Nov 29 2018, Andrew Lunn wrote: > So if we assume you can identify the PHY using its ID registers, you > can put this reset code into the soft_reset call. That gets called > first before anything else. There is no need to add a new function to > phy_driver. I've tried the following, but it made things only worse, with the probing not working at all. Andreas. diff --git a/drivers/net/phy/mscc.c b/drivers/net/phy/mscc.c index 7cae175177..65baf31331 100644 --- a/drivers/net/phy/mscc.c +++ b/drivers/net/phy/mscc.c @@ -1822,6 +1822,23 @@ static int vsc85xx_probe(struct phy_device *phydev) return vsc85xx_dt_led_modes_get(phydev, default_mode); } +static int vsc8541_soft_reset(struct phy_device *phydev) +{ + /* The VSC8541 has an unexpected feature where a single reset + * rising edge can only be used to enter managed mode. For + * unmanaged mode a pair of reset rising edges is necessary. + */ + mdio_device_reset(&phydev->mdio, 0); + mdio_device_reset(&phydev->mdio, 1); + + /* After this pair of reset rising edges we must wait at least + * 15ms before writing any phy registers. + */ + msleep(15); + + return genphy_soft_reset(phydev); +} + /* Microsemi VSC85xx PHYs */ static struct phy_driver vsc85xx_driver[] = { { @@ -1908,7 +1925,7 @@ static struct phy_driver vsc85xx_driver[] = { .phy_id_mask = 0xfffffff0, .features = PHY_GBIT_FEATURES, .flags = PHY_HAS_INTERRUPT, - .soft_reset = &genphy_soft_reset, + .soft_reset = &vsc8541_soft_reset, .config_init = &vsc85xx_config_init, .config_aneg = &vsc85xx_config_aneg, .aneg_done = &genphy_aneg_done, -- 2.19.2 -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."