From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: Jan Sokolowski <jan.sokolowski@intel.com>,
<intel-wired-lan@lists.osuosl.org>
Cc: Karol Kolacinski <karol.kolacinski@intel.com>
Subject: Re: [Intel-wired-lan] [PATCH iwl-next v1 1/2] ice: Add get C827 PHY index function
Date: Wed, 12 Jul 2023 13:42:08 -0700 [thread overview]
Message-ID: <e9a40c89-9540-ed43-660c-d506aa0aae4f@intel.com> (raw)
In-Reply-To: <20230711122741.780900-1-jan.sokolowski@intel.com>
On 7/11/2023 5:27 AM, Jan Sokolowski wrote:
> From: Karol Kolacinski <karol.kolacinski@intel.com>
>
> Add a function to find the C827 PHY node handle and return C827 PHY
> index for the E810 products.
>
> In order to bring this function to full functionality, some
> helpers for this were written by Michal Michalik.
>
> Co-developed-by: Michal Michalik <michal.michalik@intel.com>
> Signed-off-by: Michal Michalik <michal.michalik@intel.com>
> Signed-off-by: Karol Kolacinski <karol.kolacinski@intel.com>
> Signed-off-by: Jan Sokolowski <jan.sokolowski@intel.com>
> ---
> .../net/ethernet/intel/ice/ice_adminq_cmd.h | 1 +
> drivers/net/ethernet/intel/ice/ice_common.c | 62 +++++++++++++++++++
> drivers/net/ethernet/intel/ice/ice_common.h | 5 ++
> drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 3 +
> 4 files changed, 71 insertions(+)
This has a compile issue:
+../drivers/net/ethernet/intel/ice/ice_common.c:2473:30: warning:
incorrect type in assignment (different base types)
+../drivers/net/ethernet/intel/ice/ice_common.c:2473:30: expected
unsigned short [usertype]
+../drivers/net/ethernet/intel/ice/ice_common.c:2473:30: got
restricted __le16 [addressable] [assigned] [usertype] handle
> diff --git a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
> index 5062c445a27e..8b1d2c4c46e9 100644
> --- a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
> +++ b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
> @@ -1404,6 +1404,7 @@ struct ice_aqc_get_link_topo {
> struct ice_aqc_link_topo_addr addr;
> u8 node_part_num;
> #define ICE_AQC_GET_LINK_TOPO_NODE_NR_PCA9575 0x21
> +#define ICE_AQC_GET_LINK_TOPO_NODE_NR_C827 0x31
> u8 rsvd[9];
> };
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c
> index e5e2461ef117..458ffc3a7e47 100644
> --- a/drivers/net/ethernet/intel/ice/ice_common.c
> +++ b/drivers/net/ethernet/intel/ice/ice_common.c
> @@ -5,6 +5,7 @@
> #include "ice_sched.h"
> #include "ice_adminq_cmd.h"
> #include "ice_flow.h"
> +#include "ice_ptp_hw.h"
>
> #define ICE_PF_RESET_WAIT_COUNT 300
>
> @@ -2449,6 +2450,67 @@ ice_parse_dev_caps(struct ice_hw *hw, struct ice_hw_dev_caps *dev_p,
> ice_recalc_port_limited_caps(hw, &dev_p->common_cap);
> }
>
> +/**
> + * ice_aq_get_netlist_node
> + * @hw: pointer to the hw struct
> + * @cmd: get_link_topo AQ structure
> + * @node_part_number: output node part number if node found
> + * @node_handle: output node handle parameter if node found
> + */
> +int
> +ice_aq_get_netlist_node(struct ice_hw *hw, struct ice_aqc_get_link_topo *cmd,
> + u8 *node_part_number, u16 *node_handle)
> +{
> + struct ice_aq_desc desc;
> +
> + ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_get_link_topo);
> + desc.params.get_link_topo = *cmd;
> +
> + if (ice_aq_send_cmd(hw, &desc, NULL, 0, NULL))
> + return -EIO;
> +
> + if (node_handle)
> + *node_handle = desc.params.get_link_topo.addr.handle;
> + if (node_part_number)
> + *node_part_number = desc.params.get_link_topo.node_part_num;
> +
> + return 0;
> +}
> +
> +/**
> + * ice_is_pf_c827 - check if pf contains c827 phy
> + * @hw: pointer to the hw struct
> + */
> +bool ice_is_pf_c827(struct ice_hw *hw)
> +{
> + struct ice_aqc_get_link_topo cmd = {};
> + u8 node_part_number;
> + u16 node_handle;
> + int status;
> +
> + if (hw->mac_type != ICE_MAC_E810)
> + return false;
> +
> + if (hw->device_id != ICE_DEV_ID_E810C_QSFP)
> + return true;
> +
> + cmd.addr.topo_params.node_type_ctx =
> + FIELD_PREP(ICE_AQC_LINK_TOPO_NODE_TYPE_M, ICE_AQC_LINK_TOPO_NODE_TYPE_PHY) |
> + FIELD_PREP(ICE_AQC_LINK_TOPO_NODE_CTX_M, ICE_AQC_LINK_TOPO_NODE_CTX_PORT);
> + cmd.addr.topo_params.index = 0;
> +
> + status = ice_aq_get_netlist_node(hw, &cmd, &node_part_number,
> + &node_handle);
> +
> + if (status || node_part_number != ICE_AQC_GET_LINK_TOPO_NODE_NR_C827)
> + return false;
> +
> + if (node_handle == E810C_QSFP_C827_0_HANDLE || node_handle == E810C_QSFP_C827_1_HANDLE)
> + return true;
> +
> + return false;
> +}
> +
> /**
> * ice_aq_list_caps - query function/device capabilities
> * @hw: pointer to the HW struct
> diff --git a/drivers/net/ethernet/intel/ice/ice_common.h b/drivers/net/ethernet/intel/ice/ice_common.h
> index db95a1d2d878..b819867b9bb4 100644
> --- a/drivers/net/ethernet/intel/ice/ice_common.h
> +++ b/drivers/net/ethernet/intel/ice/ice_common.h
> @@ -16,6 +16,7 @@
> #define ICE_SQ_SEND_DELAY_TIME_MS 10
> #define ICE_SQ_SEND_MAX_EXECUTE 3
>
> +bool ice_is_pf_c827(struct ice_hw *hw);
> int ice_init_hw(struct ice_hw *hw);
> void ice_deinit_hw(struct ice_hw *hw);
> int ice_check_reset(struct ice_hw *hw);
> @@ -94,6 +95,10 @@ ice_aq_get_phy_caps(struct ice_port_info *pi, bool qual_mods, u8 report_mode,
> struct ice_aqc_get_phy_caps_data *caps,
> struct ice_sq_cd *cd);
> int
> +ice_aq_get_netlist_node(struct ice_hw *hw, struct ice_aqc_get_link_topo *cmd,
> + u8 *node_part_number, u16 *node_handle);
> +bool ice_is_pf_c827(struct ice_hw *hw);
> +int
> ice_aq_list_caps(struct ice_hw *hw, void *buf, u16 buf_size, u32 *cap_count,
> enum ice_adminq_opc opc, struct ice_sq_cd *cd);
> int
> diff --git a/drivers/net/ethernet/intel/ice/ice_ptp_hw.h b/drivers/net/ethernet/intel/ice/ice_ptp_hw.h
> index 3b68cb91bd81..1969425f0084 100644
> --- a/drivers/net/ethernet/intel/ice/ice_ptp_hw.h
> +++ b/drivers/net/ethernet/intel/ice/ice_ptp_hw.h
> @@ -112,6 +112,9 @@ struct ice_cgu_pll_params_e822 {
> extern const struct
> ice_cgu_pll_params_e822 e822_cgu_params[NUM_ICE_TIME_REF_FREQ];
>
> +#define E810C_QSFP_C827_0_HANDLE 2
> +#define E810C_QSFP_C827_1_HANDLE 3
> +
> /* Table of constants related to possible TIME_REF sources */
> extern const struct ice_time_ref_info_e822 e822_time_ref[NUM_ICE_TIME_REF_FREQ];
>
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
prev parent reply other threads:[~2023-07-12 20:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-11 12:27 [Intel-wired-lan] [PATCH iwl-next v1 1/2] ice: Add get C827 PHY index function Jan Sokolowski
2023-07-11 12:27 ` [Intel-wired-lan] [PATCH iwl-next v1 2/2] ice: add FW load wait Jan Sokolowski
2023-07-11 22:18 ` Przemek Kitszel
2023-07-12 20:45 ` Tony Nguyen
2023-07-12 20:42 ` 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=e9a40c89-9540-ed43-660c-d506aa0aae4f@intel.com \
--to=anthony.l.nguyen@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jan.sokolowski@intel.com \
--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