On Thu, Jun 27, 2024 at 05:09:25PM +0200, Karol Kolacinski wrote:
> Add a new internal structure describing PTP pins.
> Use the new structure for all non-E810T products.
> 
> Reviewed-by: Arkadiusz Kubalewski <arkadiusz.kubalew...@intel.com>
> Signed-off-by: Karol Kolacinski <karol.kolacin...@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_ptp.c | 271 ++++++++++++++++-------
>  drivers/net/ethernet/intel/ice/ice_ptp.h |  65 ++++--
>  2 files changed, 229 insertions(+), 107 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c 
> b/drivers/net/ethernet/intel/ice/ice_ptp.c

...

> +/**
> + * ice_ptp_gpio_enable - Enable/disable ancillary features of PHC
> + * @info: The driver's PTP info structure
>   * @rq: The requested feature to change
>   * @on: Enable/disable flag
> + *
> + * Return: 0 on success, -EOPNOTSUPP when request type is not supported
>   */
> -static int ice_ptp_gpio_enable_e823(struct ptp_clock_info *info,
> -                                 struct ptp_clock_request *rq, int on)
> +static int ice_ptp_gpio_enable(struct ptp_clock_info *info,
> +                            struct ptp_clock_request *rq, int on)
>  {
>       struct ice_pf *pf = ptp_info_to_pf(info);
> +     int err;

nit: This appears to be resolved by a subsequent patch in this series,
     but err is unused in this function.

     Flagged by W=1 allmodconfig builds on x86_64 with gcc-13 and clang-18.

>  
>       switch (rq->type) {
> -     case PTP_CLK_REQ_PPS:
> +     case PTP_CLK_REQ_PEROUT:
>       {
> -             struct ice_perout_channel clk_cfg = {};
> +             struct ice_perout_channel clk_cfg;
> +             int pin_desc_idx;
> +
> +             pin_desc_idx = ice_ptp_find_pin_idx(pf, PTP_PF_PEROUT,
> +                                                 rq->perout.index);
> +             if (pin_desc_idx < 0)
> +                     return -EIO;
> +
>  
>               clk_cfg.flags = rq->perout.flags;
> -             clk_cfg.gpio_pin = PPS_PIN_INDEX;
> -             clk_cfg.period = NSEC_PER_SEC;
> +             clk_cfg.gpio_pin = pf->ptp.ice_pin_desc[pin_desc_idx].gpio[1];
> +             clk_cfg.period = rq->perout.period.sec * NSEC_PER_SEC +
> +                              rq->perout.period.nsec;
> +             clk_cfg.start_time = rq->perout.start.sec * NSEC_PER_SEC +
> +                                  rq->perout.start.nsec;
>               clk_cfg.ena = !!on;
>  
> -             return ice_ptp_cfg_clkout(pf, PPS_CLK_GEN_CHAN, &clk_cfg, true);
> +             return ice_ptp_cfg_clkout(pf, rq->perout.index, &clk_cfg, true);
>       }
>       case PTP_CLK_REQ_EXTTS:
>       {
>               struct ice_extts_channel extts_cfg = {};
> +             int pin_desc_idx;
> +
> +             pin_desc_idx = ice_ptp_find_pin_idx(pf, PTP_PF_EXTTS,
> +                                                 rq->extts.index);
> +             if (pin_desc_idx < 0)
> +                     return -EIO;
>  
>               extts_cfg.flags = rq->extts.flags;
> -             extts_cfg.gpio_pin = TIME_SYNC_PIN_INDEX;
> +             extts_cfg.gpio_pin = pf->ptp.ice_pin_desc[pin_desc_idx].gpio[0];
>               extts_cfg.ena = !!on;
>  
>               return ice_ptp_cfg_extts(pf, rq->extts.index, &extts_cfg, true);

...

Reply via email to