+#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