]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: camss: csiphy: Make CSIPHY status macro cross-platform
authorHangxiang Ma <hangxiang.ma@oss.qualcomm.com>
Mon, 1 Dec 2025 06:25:36 +0000 (22:25 -0800)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Tue, 13 Jan 2026 09:25:00 +0000 (10:25 +0100)
The current value of '0xb0' that represents the offset to the status
registers within the common registers of the CSIPHY has been changed on
the newer SOCs and it requires generalizing the macro using a new
variable 'common_status_offset'. This variable is initialized in the
csiphy_init() function.

Signed-off-by: Hangxiang Ma <hangxiang.ma@oss.qualcomm.com>
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
drivers/media/platform/qcom/camss/camss-csiphy.h

index 619abbf6078130bb6f036eac3ab369cdf4841054..d70d4f6117988263f81b9f79c62829c4b3a51b5c 100644 (file)
@@ -46,7 +46,8 @@
 #define CSIPHY_3PH_CMN_CSI_COMMON_CTRL5_CLK_ENABLE     BIT(7)
 #define CSIPHY_3PH_CMN_CSI_COMMON_CTRL6_COMMON_PWRDN_B BIT(0)
 #define CSIPHY_3PH_CMN_CSI_COMMON_CTRL6_SHOW_REV_ID    BIT(1)
-#define CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(offset, n)   ((offset) + 0xb0 + 0x4 * (n))
+#define CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(offset, common_status_offset, n) \
+       ((offset) + (common_status_offset) + 0x4 * (n))
 
 #define CSIPHY_DEFAULT_PARAMS          0
 #define CSIPHY_LANE_ENABLE             1
@@ -810,13 +811,17 @@ static void csiphy_hw_version_read(struct csiphy_device *csiphy,
               CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->offset, 6));
 
        hw_version = readl_relaxed(csiphy->base +
-                                  CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->offset, 12));
+               CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->offset,
+                                                 regs->common_status_offset, 12));
        hw_version |= readl_relaxed(csiphy->base +
-                                  CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->offset, 13)) << 8;
+               CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->offset,
+                                                 regs->common_status_offset, 13)) << 8;
        hw_version |= readl_relaxed(csiphy->base +
-                                  CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->offset, 14)) << 16;
+               CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->offset,
+                                                 regs->common_status_offset, 14)) << 16;
        hw_version |= readl_relaxed(csiphy->base +
-                                  CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->offset, 15)) << 24;
+               CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->offset,
+                                                 regs->common_status_offset, 15)) << 24;
 
        dev_dbg(dev, "CSIPHY 3PH HW Version = 0x%08x\n", hw_version);
 }
@@ -845,7 +850,8 @@ static irqreturn_t csiphy_isr(int irq, void *dev)
        for (i = 0; i < 11; i++) {
                int c = i + 22;
                u8 val = readl_relaxed(csiphy->base +
-                                      CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->offset, i));
+                       CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->offset,
+                                                         regs->common_status_offset, i));
 
                writel_relaxed(val, csiphy->base +
                               CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->offset, c));
@@ -1086,6 +1092,7 @@ static int csiphy_init(struct csiphy_device *csiphy)
 
        csiphy->regs = regs;
        regs->offset = 0x800;
+       regs->common_status_offset = 0xb0;
 
        switch (csiphy->camss->res->version) {
        case CAMSS_845:
index 895f80003c441dcacf98435f91567f90afa29279..2d5054819df7f9069611bcdf287846b1d20afc92 100644 (file)
@@ -90,6 +90,7 @@ struct csiphy_device_regs {
        const struct csiphy_lane_regs *lane_regs;
        int lane_array_size;
        u32 offset;
+       u32 common_status_offset;
 };
 
 struct csiphy_device {