From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: Karol Kolacinski <karol.kolacinski@intel.com>,
<intel-wired-lan@lists.osuosl.org>
Subject: Re: [Intel-wired-lan] [PATCH intel-next 1/2] ice: add i2c write command
Date: Thu, 23 Jun 2022 09:24:30 -0700 [thread overview]
Message-ID: <fcef8b1b-9610-3927-b37c-d24253705fd3@intel.com> (raw)
In-Reply-To: <20220623134102.166331-1-karol.kolacinski@intel.com>
On 6/23/2022 6:41 AM, Karol Kolacinski wrote:
<snip>
> +/**
> + * ice_aq_write_i2c
> + * @hw: pointer to the hw struct
> + * @topo_addr: topology address for a device to communicate with
> + * @bus_addr: 7-bit I2C bus address
> + * @addr: I2C memory address (I2C offset) with up to 16 bits
> + * @params: I2C parameters: bit [4] - I2C address type, bits [3:0] - data size to write (0-7 bytes)
> + * @data: pointer to data (0 to 4 bytes) to be written to the I2C device
> + * @cd: pointer to command details structure or NULL
> + *
> + * Write I2C (0x06E3)
> + *
> + * * Return:
> + * * 0 - Successful write to the i2c device
> + * * -EINVAL - Data size greater than 4 bytes
> + * * -EIO - FW error
> + */
> +int
> +ice_aq_write_i2c(struct ice_hw *hw, struct ice_aqc_link_topo_addr topo_addr,
> + u16 bus_addr, __le16 addr, u8 params, u8 *data,
> + struct ice_sq_cd *cd)
> +{
> + struct ice_aq_desc desc = { 0 };
> + struct ice_aqc_i2c *cmd;
> + unsigned int i;
../drivers/net/ethernet/intel/ice/ice_common.c: In function
‘ice_aq_write_i2c’:
../drivers/net/ethernet/intel/ice/ice_common.c:4885:15: warning: unused
variable ‘i’ [-Wunused-variable]
unsigned int i;
> + u8 data_size;
> +
> + ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_write_i2c);
> + cmd = &desc.params.read_write_i2c;
> +
> + data_size = FIELD_GET(ICE_AQC_I2C_DATA_SIZE_M, params);
> +
> + /* data_size limited to 4 */
> + if (data_size > 4)
> + return -EINVAL;
> +
> + cmd->i2c_bus_addr = cpu_to_le16(bus_addr);
> + cmd->topo_addr = topo_addr;
> + cmd->i2c_params = params;
> + cmd->i2c_addr = addr;
> +
> + memcpy(cmd->i2c_data, data, data_size);
> +
> + return ice_aq_send_cmd(hw, &desc, NULL, 0, cd);
> +}
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
prev parent reply other threads:[~2022-06-23 16:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-23 13:41 [Intel-wired-lan] [PATCH intel-next 1/2] ice: add i2c write command Karol Kolacinski
2022-06-23 13:41 ` [Intel-wired-lan] [PATCH intel-next 2/2] ice: add write functionality for GNSS TTY Karol Kolacinski
2022-06-23 16:24 ` Tony Nguyen [this message]
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=fcef8b1b-9610-3927-b37c-d24253705fd3@intel.com \
--to=anthony.l.nguyen@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=karol.kolacinski@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox