[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cf70f203-bb0e-4942-8f48-c34e269ce637@linux.alibaba.com>
Date: Mon, 30 Jun 2025 17:04:49 +0800
From: Wen Gu <guwen@...ux.alibaba.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: richardcochran@...il.com, andrew+netdev@...n.ch, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
xuanzhuo@...ux.alibaba.com, dust.li@...ux.alibaba.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v2] ptp: add Alibaba CIPU PTP clock driver
On 2025/6/27 15:46, Andrew Lunn wrote:
>> +#define DRV_VER_MAJOR 1
>> +#define DRV_VER_MINOR 3
>> +#define DRV_VER_SUBMINOR 0
>
>> +#define LINUX_UPSTREAM 0x1F
>
>> +static int ptp_cipu_set_drv_version(struct ptp_cipu_ctx *ptp_ctx)
>> +{
>> + struct ptp_cipu_regs *regs = &ptp_ctx->regs;
>> + int version, patchlevel, sublevel;
>> + u32 env_ver, drv_ver;
>> + int rc;
>> +
>> + if (sscanf(utsname()->release, "%u.%u.%u",
>> + &version, &patchlevel, &sublevel) != 3)
>> + return -EINVAL;
>> + sublevel = sublevel < 0xFF ? sublevel : 0xFF;
>> +
>> + env_ver = (LINUX_UPSTREAM << 27) | (version << 16) |
>> + (patchlevel << 8) | sublevel;
>> +
>> + rc = cipu_iowrite32_and_check(ptp_ctx->reg_addr +
>> + PTP_CIPU_REG(env_ver),
>> + env_ver, ®s->env_ver);
>> + if (rc)
>> + return rc;
>> +
>> + drv_ver = (DRV_TYPE << 24) | (DRV_VER_MAJOR << 16) |
>> + (DRV_VER_MINOR << 8) | DRV_VER_SUBMINOR;
>> +
>> + return cipu_iowrite32_and_check(ptp_ctx->reg_addr +
>> + PTP_CIPU_REG(drv_ver), drv_ver,
>> + ®s->drv_ver);
>> +}
>
> Please could you explain what this is doing.
>
> Andrew
Sure.
This provides informations to cloud ptp device, so that device
can decide whether to allow the initialization to continue.
It is expected to avoid loading a version that is found to have
serious defects after it is released.
Thanks,
Powered by blists - more mailing lists