mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Divyamani Tripathi <divyamani.tripathi@intel.com>
To: linux-kernel@vger.kernel.org
Cc: sakari.ailus@linux.intel.com, antti.laakso@linux.intel.com,
	sarang.sapre@intel.com, manik.bajpai@intel.com,
	Divyamani Tripathi <divyamani.tripathi@intel.com>
Subject: [PATCH 4/7] media: ipu6: make ipu7 gpreg stride configurable as per IPU version
Date: Wed, 30 Sep 2026 12:01:45 +0300	[thread overview]
Message-ID: <20260930090148.3980652-5-divyamani.tripathi@intel.com> (raw)
In-Reply-To: <20260930090148.3980652-1-divyamani.tripathi@intel.com>

IPU8's GPREG stride is 0x2000, not IPU7's hardcoded 0x1000. Add
csi2.gpreg_stride and use it in the two gpreg accessors instead of the
fixed value, wiring it up for both IPU7 and IPU8 in
ipu6_internal_pdata_init().

Signed-off-by: Divyamani Tripathi <divyamani.tripathi@intel.com>
---
 drivers/media/pci/intel/ipu6/ipu6.c                | 7 ++++++-
 drivers/media/pci/intel/ipu6/ipu6.h                | 1 +
 drivers/media/pci/intel/ipu6/ipu7-isys-csi-phy.c   | 6 ++++--
 drivers/media/pci/intel/ipu6/ipu7-isys-csi2-regs.h | 2 ++
 4 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/media/pci/intel/ipu6/ipu6.c b/drivers/media/pci/intel/ipu6/ipu6.c
index 43d951735f72..2ed2a41ac96f 100644
--- a/drivers/media/pci/intel/ipu6/ipu6.c
+++ b/drivers/media/pci/intel/ipu6/ipu6.c
@@ -371,8 +371,13 @@ static void ipu6_internal_pdata_init(struct ipu6_device *isp)
 		psys_ipdata.hw_variant.spc_offset = IPU6SE_PSYS_SPC_OFFSET;
 	}
 
-	if (IS_IPU7(isp)) {
+	if (IS_IPU8(isp)) {
+		isys_ipdata.csi2.gpreg = IPU8_IS_IO_CSI2_GPREGS_BASE;
+		isys_ipdata.csi2.gpreg_stride = IPU8_IS_IO_CSI2_GPREGS_STRIDE;
+		isys_ipdata.csi2.nports = 4;
+	} else if (IS_IPU7(isp)) {
 		isys_ipdata.csi2.gpreg = IPU7_IS_IO_CSI2_GPREGS_BASE;
+		isys_ipdata.csi2.gpreg_stride = IPU7_IS_IO_CSI2_GPREGS_STRIDE;
 		isys_ipdata.csi2.nports = 4;
 	}
 }
diff --git a/drivers/media/pci/intel/ipu6/ipu6.h b/drivers/media/pci/intel/ipu6/ipu6.h
index 20ffbb4a9934..00fb78a1ec1d 100644
--- a/drivers/media/pci/intel/ipu6/ipu6.h
+++ b/drivers/media/pci/intel/ipu6/ipu6.h
@@ -147,6 +147,7 @@ struct ipu6_isys_internal_csi2_pdata {
 	u32 fw_access_port_ofs;
 	/* IPU7-specific field */
 	u32 gpreg;
+	u32 gpreg_stride;
 };
 
 struct ipu6_isys_internal_tpg_pdata {
diff --git a/drivers/media/pci/intel/ipu6/ipu7-isys-csi-phy.c b/drivers/media/pci/intel/ipu6/ipu7-isys-csi-phy.c
index 10273c687faa..ac4f94764407 100644
--- a/drivers/media/pci/intel/ipu6/ipu7-isys-csi-phy.c
+++ b/drivers/media/pci/intel/ipu6/ipu7-isys-csi-phy.c
@@ -167,7 +167,8 @@ static void gpreg_write(struct ipu6_isys *isys, u32 id, u32 addr, u32 data)
 {
 	void __iomem *isys_base = isys->pdata->base;
 	u32 gpreg = isys->pdata->ipdata->csi2.gpreg;
-	void __iomem *base = isys_base + gpreg + 0x1000 * id;
+	void __iomem *base = isys_base + gpreg +
+				     isys->pdata->ipdata->csi2.gpreg_stride * id;
 	struct device *dev = &isys->adev->auxdev.dev;
 
 	dev_dbg(dev, "gpreg write: reg 0x%lx = data 0x%08x",
@@ -344,7 +345,8 @@ static int ipu7_isys_phy_ready(struct ipu6_isys *isys, u32 id)
 {
 	void __iomem *isys_base = isys->pdata->base;
 	u32 gpreg_offset = isys->pdata->ipdata->csi2.gpreg;
-	void __iomem *gpreg = isys_base + gpreg_offset + 0x1000 * id;
+	void __iomem *gpreg = isys_base + gpreg_offset +
+				      isys->pdata->ipdata->csi2.gpreg_stride * id;
 	struct device *dev = &isys->adev->auxdev.dev;
 	u32 phy_ready;
 	u32 reg, rext;
diff --git a/drivers/media/pci/intel/ipu6/ipu7-isys-csi2-regs.h b/drivers/media/pci/intel/ipu6/ipu7-isys-csi2-regs.h
index 3859401d4802..4f7f33b9d661 100644
--- a/drivers/media/pci/intel/ipu6/ipu7-isys-csi2-regs.h
+++ b/drivers/media/pci/intel/ipu6/ipu7-isys-csi2-regs.h
@@ -968,7 +968,9 @@
 
 /* software config the phy */
 #define IPU7_IS_IO_CSI2_GPREGS_BASE		(IPU7_IS_IO_BASE + 0x53400)
+#define IPU7_IS_IO_CSI2_GPREGS_STRIDE		0x1000
 #define IPU8_IS_IO_CSI2_GPREGS_BASE		(IPU7_IS_IO_BASE + 0x40e00)
+#define IPU8_IS_IO_CSI2_GPREGS_STRIDE		0x2000
 #define IPU7_CSI_ADAPT_LAYER_SRST		0x0
 #define IPU7_MPF_SRST_RST			0x4
 #define IPU7_CSI_ERR_IRQ_CTRL_SRST		0x8
-- 
2.43.0


  parent reply	other threads:[~2026-09-30  9:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30  9:01 [PATCH 0/7] media: ipu6: add IPU8 support Divyamani Tripathi
2026-09-30  9:01 ` [PATCH 1/7] media: ipu6: update ipu7 InSys ABI to 1.2.1.20251215_224531 Divyamani Tripathi
2026-09-30  9:01 ` [PATCH 2/7] media: ipu6: add IS_IPU8() macro Divyamani Tripathi
2026-09-30  9:01 ` [PATCH 3/7] media: ipu6: add IPU8 InSys ABI 1.0.14 support Divyamani Tripathi
2026-09-30  9:01 ` Divyamani Tripathi [this message]
2026-09-30  9:01 ` [PATCH 5/7] media: ipu6: add IPU8 isys chip/MMU enablement Divyamani Tripathi
2026-09-30  9:01 ` [PATCH 6/7] media: ipu6: add IPU8 psys MMU table and PLL power sequencing Divyamani Tripathi
2026-09-30  9:01 ` [PATCH 7/7] media: ipu6: add PCI ID for IPU8 Divyamani Tripathi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260930090148.3980652-5-divyamani.tripathi@intel.com \
    --to=divyamani.tripathi@intel.com \
    --cc=antti.laakso@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manik.bajpai@intel.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=sarang.sapre@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®