From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58178C26640 for ; Sun, 20 Jan 2019 19:32:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1CA5320861 for ; Sun, 20 Jan 2019 19:32:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="hjrw0Hk1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727586AbfATTch (ORCPT ); Sun, 20 Jan 2019 14:32:37 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:49489 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727208AbfATTch (ORCPT ); Sun, 20 Jan 2019 14:32:37 -0500 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=H0rrRJ+tPHktKBXfuBpPjBwXzrx95hyoYMm3+c4eT6A=; b=hjrw0Hk1Hugwu3XcVZ6pQ9nHfNRhga/Rm3dTj/QNtFnbMbpF2Ztdl1mKq7oJUBFvrKG0dOn6rp4Qo9bgJtfF2hAgZYpkgUTY15uT8CTzwbtAa+G9tlofEmtbee3/4n3I1w6ab3VVfF5dDFxT0FKyPsFS3BGIPqaf1tTc51QLDoI=; Received: from andrew by vps0.lunn.ch with local (Exim 4.84_2) (envelope-from ) id 1glIpe-0005UH-Ad; Sun, 20 Jan 2019 20:32:34 +0100 Date: Sun, 20 Jan 2019 20:32:34 +0100 From: Andrew Lunn To: Bryan Whitehead Cc: davem@davemloft.net, netdev@vger.kernel.org, UNGLinuxDriver@microchip.com Subject: Re: [PATCH v1 net-next] lan743x: Provide Read/Write Access to on chip OTP Message-ID: <20190120193234.GD19714@lunn.ch> References: <1547848493-16985-1-git-send-email-Bryan.Whitehead@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1547848493-16985-1-git-send-email-Bryan.Whitehead@microchip.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Fri, Jan 18, 2019 at 04:54:53PM -0500, Bryan Whitehead wrote: > The LAN743x includes on chip One-Time-Programmable (OTP) memory. > > This patch extends the ethtool EEPROM read/write interface to > access OTP memory space. > > This is done by adding the private flag OTP_ACCESS, which is used > to switch between EEPROM, and OTP modes. > > The private flag OTP_ACCESS is configurable through the > ethtool --set-priv-flags command. > And visible through the > ethtool --show-priv-flags command. Hi Bryan It would be good to explain what is wrong with the current code, which allows you to select between the OTP and the EEPROM at write time. > +static int lan743x_ethtool_set_priv_flags(struct net_device *netdev, u32 flags) > +{ > + struct lan743x_adapter *adapter = netdev_priv(netdev); > + > + adapter->flags = flags; > + > + return 0; > +} Is the EEPROM mandatory? Could there be designs without an EEPROM? When setting the private flag here, should you probe to see if there actually is an EEPROM and return -ENODEV if it is missing. Andrew