All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kumar Thangavel <thangavel.k@hcl.com>
To: "openbmc@lists.ozlabs.org" <openbmc@lists.ozlabs.org>
Cc: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com>,
	Vernon Mauery <vernon.mauery@linux.intel.com>,
	Ed Tanous <ed@tanous.net>, Amithash Prasad <amithash@fb.com>,
	"Velumani T-ERS, HCLTech" <velumanit@hcl.com>
Subject: EEPROM Validation issue in Fru Device.
Date: Wed, 29 Sep 2021 05:49:15 +0000	[thread overview]
Message-ID: <PS2PR04MB3589B9346947C693802AE1F7FDA99@PS2PR04MB3589.apcprd04.prod.outlook.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 3513 bytes --]

Classification: Confidential
Hi All,

           We are working in FRU module that has 16 bit EEPROM and Wanted to read eeprom data Via i2c.
           The below function in FruDevice.cpp in entity-manager validates 8bit or 16 bit device.

           This function returns "0" for 8 bit device.

           This function returns "0" for 16 bit device also. But it's supposed to return "1" for 16 bit device.

           We have tested with our 16bit device. It returns "0" only.

           If we read via i2c utility commands,  getting all 255 data in the first bytes.

           If we make code changes to return "1" for 16 bit device and called the function "i2cSmbusWriteThenRead",
           then we could able to read all the data perfectly for 16 bit device.

           Code snippet :

            static int isDevice16Bit(int file)
                {
                    /* Get first byte */
                    int byte1 = i2c_smbus_read_byte_data(file, 0);
                    if (byte1 < 0)
                    {
                        return byte1;
                    }
                    /* Read 7 more bytes, it will read same first byte in case of
                     * 8 bit but it will read next byte in case of 16 bit
                     */
                    for (int i = 0; i < 7; i++)
                    {
                        int byte2 = i2c_smbus_read_byte_data(file, 0);
                        if (byte2 < 0)
                        {
                            return byte2;
                        }
                        if (byte2 != byte1)
                        {
                            return 1;
                        }
                    }
                    return 0;
                }

    I2c utility command log :

    i2ctransfer 12 w2@0x51 0x00 0x00 r8
   WARNING! This program can confuse your I2C bus, cause data loss and worse!
   I will send the following messages to device file /dev/i2c-12:
   msg 0: addr 0x51, write, len 2, buf 0x00 0x00
   msg 1: addr 0x51, read, len 8
   Continue? [y/N] y
   0x01 0x00 0x00 0x01 0x0e 0x1c 0x00 0xd4

    Questions :

1.       How the function isDevice16Bit Validated for 16 bit device ?

2.       Is my validation and analysis is correct ?

     Could you please provide your suggestions on this.

Thanks,
Kumar.









::DISCLAIMER::
________________________________
The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only. E-mail transmission is not guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or may contain viruses in transmission. The e mail and its contents (with or without referred errors) shall therefore not attach any liability on the originator or HCL or its affiliates. Views or opinions, if any, presented in this email are solely those of the author and may not necessarily reflect the views or opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of this message without the prior written consent of authorized representative of HCL is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately. Before opening any email and/or attachments, please check them for viruses and other defects.
________________________________

[-- Attachment #2: Type: text/html, Size: 14065 bytes --]

             reply	other threads:[~2021-09-29  5:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-29  5:49 Kumar Thangavel [this message]
2021-09-29  5:53 ` EEPROM Validation issue in Fru Device Kumar Thangavel
2021-09-29 11:48   ` Patrick Williams
2021-09-29 13:29     ` Kumar Thangavel
2021-09-30  1:50     ` [External] " Lei Yu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PS2PR04MB3589B9346947C693802AE1F7FDA99@PS2PR04MB3589.apcprd04.prod.outlook.com \
    --to=thangavel.k@hcl.com \
    --cc=amithash@fb.com \
    --cc=ed@tanous.net \
    --cc=jae.hyun.yoo@linux.intel.com \
    --cc=openbmc@lists.ozlabs.org \
    --cc=velumanit@hcl.com \
    --cc=vernon.mauery@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.