From: Nguyen, Anthony L <anthony.l.nguyen@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH intel-next 1/2] ice: add i2c read/write read commands
Date: Tue, 14 Sep 2021 23:37:34 +0000 [thread overview]
Message-ID: <41417ec2e162d70d207d4a5539fb53e4c48a9e43.camel@intel.com> (raw)
In-Reply-To: <20210913101108.17927-1-karol.kolacinski@intel.com>
On Mon, 2021-09-13 at 12:11 +0200, Karol Kolacinski wrote:
> Add I2C read/write AQ commands. They are now required for controlling
> the external physical connectors via external I2C port expander on
> E810-T adapters.
>
> Signed-off-by: Karol Kolacinski <karol.kolacinski@intel.com>
> ---
> .../net/ethernet/intel/ice/ice_adminq_cmd.h | 29 ++++++
> drivers/net/ethernet/intel/ice/ice_common.c | 94
> +++++++++++++++++++
> drivers/net/ethernet/intel/ice/ice_common.h | 8 ++
> 3 files changed, 131 insertions(+)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
> b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
> index 0f64fbc9d3e8..89448e61c3dd 100644
> --- a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
> +++ b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
> @@ -1341,6 +1341,31 @@ struct ice_aqc_get_link_topo {
> u8 rsvd[9];
> };
>
> +/* Read/Write I2C (direct, 0x06E2/0x06E3) */
> +struct ice_aqc_i2c {
> + struct ice_aqc_link_topo_addr topo_addr;
> + __le16 i2c_addr;
> + u8 i2c_params;
> +#define ICE_AQC_I2C_DATA_SIZE_S 0
> +#define ICE_AQC_I2C_DATA_SIZE_M (0xF <<
> ICE_AQC_I2C_DATA_SIZE_S)
> +#define ICE_AQC_I2C_ADDR_TYPE_M BIT(4)
> +#define ICE_AQC_I2C_ADDR_TYPE_7BIT 0
> +#define ICE_AQC_I2C_ADDR_TYPE_10BIT ICE_AQC_I2C_ADDR_TYPE_M
> +#define ICE_AQC_I2C_DATA_OFFSET_S 5
> +#define ICE_AQC_I2C_DATA_OFFSET_M (0x3 <<
> ICE_AQC_I2C_DATA_OFFSET_S)
> +#define ICE_AQC_I2C_USE_REPEATED_START BIT(7)
Not all of these defines are being used.
> + u8 rsvd;
> + __le16 i2c_bus_addr;
> +#define ICE_AQC_I2C_ADDR_7BIT_MASK 0x7F
> +#define ICE_AQC_I2C_ADDR_10BIT_MASK 0x3FF
nor these.
> + u8 i2c_data[4]; /* Used only by write command, reserved in
> read. */
> +};
<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)
> + */
> +enum ice_status
> +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)
If write functionality will be introduced in the future don't include
the write implementations until you use them.
It may make sense to squash this with patch 2 after this. Just a
suggestion though.
prev parent reply other threads:[~2021-09-14 23:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-13 10:11 [Intel-wired-lan] [PATCH intel-next 1/2] ice: add i2c read/write read commands Karol Kolacinski
2021-09-13 10:11 ` [Intel-wired-lan] [PATCH intel-next 2/2] ice: add TTY device for GNSS module for E810T device Karol Kolacinski
2021-09-14 23:37 ` Nguyen, Anthony L
2021-09-14 23:37 ` Nguyen, Anthony L [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=41417ec2e162d70d207d4a5539fb53e4c48a9e43.camel@intel.com \
--to=anthony.l.nguyen@intel.com \
--cc=intel-wired-lan@osuosl.org \
/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