| Message ID | 20260504142451.4161845-4-aleksandr.loktionov@intel.com |
|---|---|
| State | Changes Requested |
| Delegated to: | Anthony Nguyen |
| Headers | show |
| Series | ice: five small fixes and cleanups | expand |
From: 'Simon Horman' <horms@kernel.org> This is an AI-generated review of your patch. The human sending this email has considered the AI review valid, or at least plausible. Full review at: https://sashiko.dev Simon says: I would also like to add that as a fix the patch description should describe the user-visible effects of the bug, and how the fix addresses them. Thanks! --- ice: add correct handling of SMA/u.FL states This commit renames ICE_SMA2_UFL2_RX_DIS to ICE_SMA2_UFL2_RX_EN, stating that the hardware bit is actually active high for enabling RX. It updates the uses of the macro in ice_dpll.c to reflect the new name. > The ICE_SMA2_UFL2_RX_DIS bit name is wrong: the bit is active high > (setting it *enables* RX for u.FL2 / SMA2), not active low. Rename > it to ICE_SMA2_UFL2_RX_EN and invert the use sites in ice_dpll.c so > that enabling the u.FL2 pin clears the bit (as it used to do) and > disabling sets it. The commit message claims that setting the bit enables RX (active high), but then states that enabling the pin clears the bit (active low). Could this description be clarified to explain exactly whether the hardware uses active high or active low logic? > diff --git a/drivers/net/ethernet/intel/ice/ice_dpll.c b/drivers/net/ethernet/intel/ice/ice_dpll.c > index 62f75701d6520..7e8bb63b262a0 100644 > --- a/drivers/net/ethernet/intel/ice/ice_dpll.c > +++ b/drivers/net/ethernet/intel/ice/ice_dpll.c > @@ -672,7 +672,7 @@ ice_dpll_sw_pins_update(struct ice_pf *pf) > p->active = false; > > p = &d->ufl[ICE_DPLL_PIN_SW_2_IDX]; > - p->active = (data & ICE_SMA2_DIR_EN) && !(data & ICE_SMA2_UFL2_RX_DIS); > + p->active = (data & ICE_SMA2_DIR_EN) && !(data & ICE_SMA2_UFL2_RX_EN); If the bit is renamed to an _EN suffix and is active high, should the logic be inverted here? This code still treats the bit as active low by checking for it being cleared (!(data & ICE_SMA2_UFL2_RX_EN)). [ ... ] > @@ -1264,10 +1264,10 @@ ice_dpll_ufl_pin_state_set(const struct dpll_pin *pin, void *pin_priv, > case ICE_DPLL_PIN_SW_2_IDX: > if (state == DPLL_PIN_STATE_SELECTABLE) { > data |= ICE_SMA2_DIR_EN; > - data &= ~ICE_SMA2_UFL2_RX_DIS; > + data &= ~ICE_SMA2_UFL2_RX_EN; > enable = true; > } else if (state == DPLL_PIN_STATE_DISCONNECTED) { > - data |= ICE_SMA2_UFL2_RX_DIS; > + data |= ICE_SMA2_UFL2_RX_EN; > enable = false; > } else { Similarly, does this code still apply active low logic by clearing the _EN bit when enable is true, and setting it when enable is false? If the bit is truly active high as the commit message suggests ("setting it enables RX"), shouldn't the bitwise operations be inverted to match?
diff --git a/drivers/net/ethernet/intel/ice/ice_dpll.c b/drivers/net/ethernet/intel/ice/ice_dpll.c index 62f75701d..7e8bb63 100644 --- a/drivers/net/ethernet/intel/ice/ice_dpll.c +++ b/drivers/net/ethernet/intel/ice/ice_dpll.c @@ -672,7 +672,7 @@ ice_dpll_sw_pins_update(struct ice_pf *pf) p->active = false; p = &d->ufl[ICE_DPLL_PIN_SW_2_IDX]; - p->active = (data & ICE_SMA2_DIR_EN) && !(data & ICE_SMA2_UFL2_RX_DIS); + p->active = (data & ICE_SMA2_DIR_EN) && !(data & ICE_SMA2_UFL2_RX_EN); d->sma_data = data; return 0; @@ -1264,10 +1264,10 @@ ice_dpll_ufl_pin_state_set(const struct dpll_pin *pin, void *pin_priv, case ICE_DPLL_PIN_SW_2_IDX: if (state == DPLL_PIN_STATE_SELECTABLE) { data |= ICE_SMA2_DIR_EN; - data &= ~ICE_SMA2_UFL2_RX_DIS; + data &= ~ICE_SMA2_UFL2_RX_EN; enable = true; } else if (state == DPLL_PIN_STATE_DISCONNECTED) { - data |= ICE_SMA2_UFL2_RX_DIS; + data |= ICE_SMA2_UFL2_RX_EN; enable = false; } else { goto unlock; diff --git a/drivers/net/ethernet/intel/ice/ice_ptp_hw.h b/drivers/net/ethernet/intel/ice/ice_ptp_hw.h index c1aa408..278d757 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp_hw.h +++ b/drivers/net/ethernet/intel/ice/ice_ptp_hw.h @@ -655,12 +655,12 @@ static inline u64 ice_get_base_incval(struct ice_hw *hw) /* SMA controller pin control */ #define ICE_SMA1_DIR_EN BIT(4) #define ICE_SMA1_TX_EN BIT(5) -#define ICE_SMA2_UFL2_RX_DIS BIT(3) +#define ICE_SMA2_UFL2_RX_EN BIT(3) #define ICE_SMA2_DIR_EN BIT(6) #define ICE_SMA2_TX_EN BIT(7) #define ICE_SMA1_MASK (ICE_SMA1_DIR_EN | ICE_SMA1_TX_EN) -#define ICE_SMA2_MASK (ICE_SMA2_UFL2_RX_DIS | ICE_SMA2_DIR_EN | \ +#define ICE_SMA2_MASK (ICE_SMA2_UFL2_RX_EN | ICE_SMA2_DIR_EN | \ ICE_SMA2_TX_EN) #define ICE_SMA2_INACTIVE_MASK (ICE_SMA2_DIR_EN | ICE_SMA2_TX_EN) #define ICE_ALL_SMA_MASK (ICE_SMA1_MASK | ICE_SMA2_MASK)
The ICE_SMA2_UFL2_RX_DIS bit name is wrong: the bit is active high (setting it *enables* RX for u.FL2 / SMA2), not active low. Rename it to ICE_SMA2_UFL2_RX_EN and invert the use sites in ice_dpll.c so that enabling the u.FL2 pin clears the bit (as it used to do) and disabling sets it. Fixes: 2dd5d03c77e2 ("ice: redesign dpll sma/u.fl pins control") Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com> --- drivers/net/ethernet/intel/ice/ice_dpll.c | 6 +++--- drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)