Received: by 10.192.165.156 with SMTP id m28csp2043091imm; Thu, 12 Apr 2018 07:43:26 -0700 (PDT) X-Google-Smtp-Source: AIpwx49//ArNbmQ+TBIkTG9MbQq5q6DNbw7h44kei+wrU/Ot0v/xwJ62dHKwrDCNBdrV+BXb2oFi X-Received: by 2002:a17:902:584:: with SMTP id f4-v6mr372428plf.290.1523544205959; Thu, 12 Apr 2018 07:43:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523544205; cv=none; d=google.com; s=arc-20160816; b=iwIbK7jBuLNjCL0Z5lltHbKKemQiG+2MRFtnqDGXu8atKoMyKh2LnqsMmCQGww/TIN yJbMx1PNHixvj+sXXMT7rNo81tiiu3SW4KuVpex+yPP2RX30Ri5sFbmzXRFVrctl8WdC r8k1d87G/MDb0h/xhR1wxeLcXDe+Oj/BI8SECnOo1Hq0jUwze+NJsyN4W8QhJw+Ki+l2 FGAWR5sfwFQYatY5MSq3KgbLckxTx0T4doIMjwqUPjbzW02AdLDRjcaIOz2y/a28y9sS EMtgvgC7uA2MsT06yEM/GRV7a7yA9Iht4LC/hhYgi64qYRtqRIIvje+IWdZHQaHIAXUZ dE2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=q+QqCmg/mmzUZf2HFPEfcQnUUDzdNMBSOaBtgRNeR0s=; b=Ckn9dVOxVqCOabW7C9MAcIRxpXaFKwcNcr1NlaIBNypwhqeiWQwGS23TiCHZtXAhqO VeUynoM5p9kq2+9plXLfo7N97O/c57zlah3FpHnWUesSjgUIm4g5oCMqcakR709kyuIn qqb3gAQUCZOHOri2r1hn1LtcS7WWL5ptmDg3Qy//UbogPsYO0H7Tek1TWUHwc6k1YH0P z5n6m7x0BptxxCadIJYSVoozeEp/UZbZGDVIVgV0VHTRL+/0OEzoUNyTjXBGnNv2D/RR FYcpODXGWNZoSfEIShKgiRc1pi/+TU2gPaQ0Zpq68TW8WRsPukGELcxXmqtGMgAlRDYS TvqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=0pmeFTzc; 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 1-v6si3466809pln.656.2018.04.12.07.42.49; Thu, 12 Apr 2018 07:43:25 -0700 (PDT) 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=@lunn.ch header.s=20171124 header.b=0pmeFTzc; 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 S1753265AbeDLOhI (ORCPT + 99 others); Thu, 12 Apr 2018 10:37:08 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:56669 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753016AbeDLOhG (ORCPT ); Thu, 12 Apr 2018 10:37:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=q+QqCmg/mmzUZf2HFPEfcQnUUDzdNMBSOaBtgRNeR0s=; b=0pmeFTzc7X7r4CiV8Tyrib1FxLyTB+dp6qAfAujQORuPPlFccjgdkWoNvded8gXwPf12bqPKcc9ljmep7Yz3BLOa3OW6TNGLHYGC18v2oRsXccubVqDLmrmmkyYLfQ7rKcu/5kVmR19RFPOhKr31x/nnWS0IZufRPBTXt997pVA=; Received: from andrew by vps0.lunn.ch with local (Exim 4.84_2) (envelope-from ) id 1f6dLL-0000AM-Ht; Thu, 12 Apr 2018 16:36:55 +0200 Date: Thu, 12 Apr 2018 16:36:55 +0200 From: Andrew Lunn To: Phil Elwell Cc: Woojung Huh , Microchip Linux Driver Support , Rob Herring , Mark Rutland , "David S. Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Linus Walleij , Andrew Morton , Randy Dunlap , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: Re: [PATCH 3/4] lan78xx: Read LED modes from Device Tree Message-ID: <20180412143655.GQ28963@lunn.ch> References: <1523541336-145953-1-git-send-email-phil@raspberrypi.org> <1523541336-145953-4-git-send-email-phil@raspberrypi.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1523541336-145953-4-git-send-email-phil@raspberrypi.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > @@ -2097,6 +2098,25 @@ static int lan78xx_phy_init(struct lan78xx_net *dev) > (void)lan78xx_set_eee(dev->net, &edata); > } > > + if (!of_property_read_u32_array(dev->udev->dev.of_node, > + "microchip,led-modes", > + led_modes, ARRAY_SIZE(led_modes))) { > + u32 reg; > + int i; > + > + reg = phy_read(phydev, 0x1d); > + for (i = 0; i < ARRAY_SIZE(led_modes); i++) { > + reg &= ~(0xf << (i * 4)); > + reg |= (led_modes[i] & 0xf) << (i * 4); > + } > + (void)phy_write(phydev, 0x1d, reg); Poking PHY registers directly from the MAC driver is not always a good idea. This MAC driver does that in a few places :-( What do we know about the PHY? It is built into the device or is it external? If it is external, how do you know the LED register is at 0x1d? The safest place to do this is in the PHY driver, and place these OF properties into the PHY node. Andrew