Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp4510833pxb; Tue, 25 Jan 2022 11:57:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJxzQR0GU20G2aZ8VgQwRQOlLm0rPHU3nsmWpnZBZp4taAi8D39J1SzKv5xgIqfG5Zq8gPVU X-Received: by 2002:a17:906:300e:: with SMTP id 14mr17727632ejz.732.1643140644921; Tue, 25 Jan 2022 11:57:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643140644; cv=none; d=google.com; s=arc-20160816; b=Bh+SVQI10WWwssk1iGlQI7wdqhoSGHmntk1d8d7LCaIE4S+TUdXwxE0SPp4U/zEBjY 7OryqygI6izYOAyA+L5iYhb37QnZ4UBhV1fUQRj8BEky85UW/KL94wAWpywk/6g+pEOj In+cT3a0RM3MznVREzt5r3X1VaxajpFxVy6XE1bwRru5ZdWj+uYiMxt+4JbMHtpvAKqT uj9COBfonwlX2o4l4pzXtghZSNa3wWy+mNIgiuIWSipjT30N0O9uMOf/l3cu3lCUnT7v kCj12AtiKxhA3k13rmZ627uaSkfwmKKqDf+gS/k+MFB8f0NECUfSRKHHgO/A++dyM/bN K3VQ== 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=ox78QD2G7Vl4O8u8fw2FuKHaFOQlJwcYfnNDAIdWWt4=; b=iwLQLDjHRmeStenYblwHuGZRyZhM4iEVw98dVuts10DK88zNNrCifhugkfQSCKSGzf bCvfyY7CxtZDBsaE51iwWYDQ3R+zBiuvleaoNPI4FRbUZ/6yJZj/3tfHRTv4Qh3g/Qqa H0AkqM8NV9h/nL7jqUbFXtHVyGU1Fb17PmytkCgjj/gJcbIrqpazyIPLAe4XQ+/MhCLW KSveItm3HgsOHgC7Z0HSsDC0GYl2IUxxC8qlCE2IgtPVkteW155JL2maOOz/O7tuOP3F V2UfCTEyRzXzPQjBBVhQuTbePVCYstztoEfcKOKkTLIPdqiwSMblNaYFa/D7fx20lFWE RhFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=GGtpgHhj; 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 qb36si5321147ejc.102.2022.01.25.11.57.00; Tue, 25 Jan 2022 11:57:24 -0800 (PST) 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=GGtpgHhj; 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 S1387873AbiAYODZ (ORCPT + 99 others); Tue, 25 Jan 2022 09:03:25 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:53066 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385581AbiAYN7q (ORCPT ); Tue, 25 Jan 2022 08:59:46 -0500 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=ox78QD2G7Vl4O8u8fw2FuKHaFOQlJwcYfnNDAIdWWt4=; b=GGtpgHhjFCVP5d5DvN9Be/8S37 qPF6rga96LpRgWr7aKH/DGBZwNQi76wPWZXDVAXOWYhuY0eBJTbW1hHLIkpRVTPHkrh+eu1iB4TQx yK6KbUeJ1vCQDN0S1T5UwI2qL7oxhb4kcmcI49fN4SDSOgLyBOqWRCKUMk4ezWq5/RQM=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1nCMM9-002esZ-4A; Tue, 25 Jan 2022 14:59:33 +0100 Date: Tue, 25 Jan 2022 14:59:33 +0100 From: Andrew Lunn To: Joseph CHAMG Cc: "David S . Miller" , Jakub Kicinski , Rob Herring , joseph_chang@davicom.com.tw, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, andy.shevchenko@gmail.com, leon@kernel.org Subject: Re: [PATCH v13, 2/2] net: Add dm9051 driver Message-ID: References: <20220125085837.10357-1-josright123@gmail.com> <20220125085837.10357-3-josright123@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220125085837.10357-3-josright123@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +static int dm9051_mdiobus_read(struct mii_bus *mdiobus, int phy_id, int reg) > +{ > + struct board_info *db = mdiobus->priv; > + unsigned int val = 0; > + int ret; > + > + if (phy_id == DM9051_PHY_ID) { phy_id is a poor choice of name. It normally means the value you find in register 2 and 3 of the PHY which identifies the manufacture, make and possibly revision. If you look at the read function prototype in struct mii_bus: https://elixir.bootlin.com/linux/v5.17-rc1/source/include/linux/phy.h#L357 the normal name is addr. Ideally your driver needs to look similar to other drivers. Ideally you use the same variable names for the same things. That makes it easier for somebody else to read your driver and debug it. It makes it easier to review, etc. It is worth spending time reading a few other drivers and looking for common patterns, and making use of those patterns in your driver. > +static int dm9051_map_phyup(struct board_info *db) > +{ > + int ret; > + > + /* ~BMCR_PDOWN to power-up the internal phy > + */ > + ret = mdiobus_modify(db->mdiobus, DM9051_PHY_ID, MII_BMCR, BMCR_PDOWN, 0); > + if (ret < 0) > + return ret; You are still touching PHY registers from the MAC driver. Why is your PHY driver not going this as part of the _config() function? Andrew