From: Wolfgang Denk Date: Fri, 28 Oct 2011 00:37:14 +0200 Subject: [U-Boot] [PATCH 5/5] e1000: Allow direct access to the E1000 SPI EEPROM device In-Reply-To: <1318971929-1160-6-git-send-email-Kyle.D.Moffett@boeing.com> References: <1318971929-1160-1-git-send-email-Kyle.D.Moffett@boeing.com> <1318971929-1160-6-git-send-email-Kyle.D.Moffett@boeing.com> Message-ID: <20111027223714.1B1841809853@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Kyle Moffett, In message <1318971929-1160-6-git-send-email-Kyle.D.Moffett@boeing.com> you wrote: > As a part of the manufacturing process for some of our custom hardware, > we are programming the EEPROMs attached to our Intel 82571EB controllers > from software using U-Boot and Linux. > > This code provides several conditionally-compiled features to assist in > our manufacturing process: > > CONFIG_CMD_E1000: > This is a basic "e1000" command which allows querying the controller > and (if other config options are set) performing EEPROM programming. > In particular, with CONFIG_E1000_SPI this allows you to display a > hex-dump of the EEPROM, copy to/from main memory, and verify/update > the software checksum. > > CONFIG_E1000_SPI_GENERIC: > Build a generic SPI driver providing the standard U-Boot SPI driver > interface. This allows commands such as "sspi" to access the bus > attached to the E1000 controller. Additionally, some E1000 chipsets > can support user data in a reserved space in the E1000 EEPROM which > could be used for U-Boot environment storage. > > CONFIG_E1000_SPI: > The core SPI access code used by the above interfaces. > > For example, the following commands allow you to program the EEPROM from > a USB device (assumes CONFIG_E1000_SPI and CONFIG_CMD_E1000 are enabled): > usb start > fatload usb 0 $loadaddr 82571EB_No_Mgmt_Discrete-LOM.bin > e1000 0 spi program $loadaddr 0 1024 > e1000 0 spi checksum update > > Please keep in mind that the Intel-provided .eep files are organized as > 16-bit words. When converting them to binary form for programming you > must byteswap each 16-bit word so that it is in little-endian form. > > This means that when reading and writing words to the SPI EEPROM, the > bit ordering for each word looks like this on the wire: > > Time >>> > ------------------------------------------------------------------ > ... [7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8], ... > ------------------------------------------------------------------ > (MSB is 15, LSB is 0). > > Signed-off-by: Kyle Moffett > Cc: Ben Warren > --- > README | 15 ++- > drivers/net/Makefile | 1 + > drivers/net/e1000.c | 66 ++++++- > drivers/net/e1000.h | 15 ++ > drivers/net/e1000_spi.c | 576 +++++++++++++++++++++++++++++++++++++++++++++++ > 5 files changed, 671 insertions(+), 2 deletions(-) > create mode 100644 drivers/net/e1000_spi.c Applied, thanks. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "It is easier to port a shell than a shell script." - Larry Wall