• Bryan Whitehead's avatar
    lan743x: Provide Read/Write Access to on chip OTP · 662a14d0
    Bryan Whitehead authored
    The LAN743x includes on chip One-Time-Programmable (OTP) memory.
    
    This patch extends the ethtool EEPROM read/write interface to
    access OTP memory space.
    
    The currently existing interface is limited, as it does not
    allow OTP read, and OTP writes are restricted to
    offset==0, length==512, and data[0]==0xF3.
    
    This patch removes these restrictions and adds a private flag
    called 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.
    
    By default OTP_ACCESS is false, and there for previously existing
    EEPROM commands will work exactly the same. However now access to
    OTP requires one extra step of setting OTP_ACCESS to true. This
    flag controls the read, write, and length reporting, functions
    of ethtool.
    
    EEPROM presence is not checked when setting or clearing this flag.
    If the EEPROM is not present, the user, as before, will need to
    diagnose that using existing read and write function of ethtool,
    while OTP_ACCESS is false.
    
    Updates for V2:
    Added comments as to why this patch is needed.
    Added comments explaining that EEPROM presence is not check
      when setting or clearing the OTP_ACCESS flag.
    Added length checking to all otp/eeprom read/write functions.
    Signed-off-by: default avatarBryan Whitehead <Bryan.Whitehead@microchip.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    662a14d0
lan743x_main.h 26.8 KB