Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp736895pxb; Tue, 19 Oct 2021 11:53:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybWU16/MKQcoQkdrHxn1sJ8alo0s2CvR1mW8mcuKKnJ5ipxYIzNe60fLusoxaoXvPSZd/u X-Received: by 2002:a50:da48:: with SMTP id a8mr54786631edk.155.1634669608566; Tue, 19 Oct 2021 11:53:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634669608; cv=none; d=google.com; s=arc-20160816; b=N5fS6vtJrs+E0+0XjsX+MBiceDh6F3rZb3IOnLJXzP+njQZPMxt+WhcTgNbLg6mQGx Tj4eQwUdtl+t7dmr9cS6oeW//iLvOMDjqHapWV/6VLy/COUeGLRUoLZVfV4gnP5gdk4E n3Oy+4kZj0X1o81r8XUBHiMzZkN7pjVnhllzdU0RI4UPgGYkNhc0O1u7sioXqryuU+v4 3ITBjdRJ+9F9m3irCu+mRNrE4DqkRDaP8ES/v42kSlwWmC+dfGI+ckVFgpeLr6HKyCDw Ch7xf7r5gK0WTICVDNDeuZ3uFgHcM2DwsQz9UfrwNtCN4GXrT5ILTHvHi7it0MGGJkrW k7gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XyDOlNEps2PQPz5H4bnK67kSEIkgFEX6exshJ2yzhyM=; b=Di3ewEjQkNuzNAfVpUYeyOb70u0IvZybVKnuLrFaBt9iu4GrjUtipG6TCRHIy9riqN l6d6a/6gdiSaWvPYjNqyP1mOe9hzgyCLJrV0yZ/xfUUWYrTKe9H9ZjW9BwoGUOIa3G94 hcfgPWa0laFYYV3pYuJGxr+2ppendGLJPw7Qx9DUM/BYuOu/3g1g8t15d3/+z31IihFa +KzSXUUM5e8XvVOyFJRYCJKKa8DnhgRhiz43wnm5eOtIG2tC4Wrq4EGMBicHAd5UlXd3 JiUd4B0pN/1iEGpvdwhdaBkYCpPEfEM2kT6OFI8myZmG7MOMuyaejR93f9lIYtotDVsQ QFtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=bA+YYgRD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s1si34498194ejn.348.2021.10.19.11.53.04; Tue, 19 Oct 2021 11:53:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=bA+YYgRD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234421AbhJSSxd (ORCPT + 99 others); Tue, 19 Oct 2021 14:53:33 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:47402 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230432AbhJSSxd (ORCPT ); Tue, 19 Oct 2021 14:53:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=XyDOlNEps2PQPz5H4bnK67kSEIkgFEX6exshJ2yzhyM=; b=bA+YYgRDKxKJpD5QHiKoXNPb8i cIqAjABUWsHq/iIfvSKyYreq5Kxs+xSTXA4ZgwanMczGCB1iXjvCXY7FCAVMm/mGCVAFgivPU2oJx 4BrqqGWcvD3CsP4PmU1YrhrEDcW3pl/MeKeno0dn3talGkcsjHxDcdCZvtu8nmgSsjng=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1mcuCc-00B7DH-5q; Tue, 19 Oct 2021 20:51:10 +0200 Date: Tue, 19 Oct 2021 20:51:10 +0200 From: Andrew Lunn To: Ong Boon Leong Cc: Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next 1/2] net: phy: dp83867: introduce critical chip default init for non-of platform Message-ID: References: <20211013034128.2094426-1-boon.leong.ong@intel.com> <20211013034128.2094426-2-boon.leong.ong@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211013034128.2094426-2-boon.leong.ong@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 13, 2021 at 11:41:27AM +0800, Ong Boon Leong wrote: > From: "Lay, Kuan Loon" > > PHY driver dp83867 has rich supports for OF-platform to fine-tune the PHY > chip during phy configuration. However, for non-OF platform, certain PHY > tunable parameters such as IO impedence and RX & TX internal delays are > critical and should be initialized to its default during PHY driver probe. > > Signed-off-by: Lay, Kuan Loon > Co-developed-by: Ong Boon Leong > Tested-by: Clement > Signed-off-by: Ong Boon Leong > --- > drivers/net/phy/dp83867.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c > index 6bbc81ad295f..bb4369b75179 100644 > --- a/drivers/net/phy/dp83867.c > +++ b/drivers/net/phy/dp83867.c > @@ -619,6 +619,24 @@ static int dp83867_of_init(struct phy_device *phydev) > #else > static int dp83867_of_init(struct phy_device *phydev) > { > + struct dp83867_private *dp83867 = phydev->priv; > + u16 delay; So this is in the stub for when OF is disabled. What about the case that OF is enabled? I've used DT on x86, even Intel used it for intel,ce4100 aka falconfalls. So rather than do this in the stub, i would look at the value of dev->of_node. If it is NULL, do this. That should always work, and it is how other drivers deal with none OF cases. > + /* Per datasheet, IO impedance is default to 50-ohm, so we set the same > + * here or else the default '0' means highest IO impedence which is wrong. > + */ > + dp83867->io_impedance = DP83867_IO_MUX_CFG_IO_IMPEDANCE_MIN / 2; > + I would prefer you add a new define DP83867_IO_MUX_CFG_IO_IMPEDANCE_DEFAULT, which then avoids this very odd looking 1/2 the minimum. Andrew