mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Du, Bin" <bin.du@amd.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: mchehab@kernel.org, hverkuil@xs4all.nl,
	laurent.pinchart+renesas@ideasonboard.com,
	bryan.odonoghue@linaro.org,
	prabhakar.mahadev-lad.rj@bp.renesas.com,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	pratap.nirujogi@amd.com, benjamin.chan@amd.com, king.li@amd.com,
	gjorgji.rosikopulos@amd.com, Phil.Jawich@amd.com,
	Dominic.Antony@amd.com, bin.du@amd.com
Subject: Re: [PATCH v2 2/8] media: platform: amd: low level support for isp4 firmware
Date: Mon, 28 Jul 2025 17:24:36 +0800	[thread overview]
Message-ID: <13d80da3-ced9-4304-8036-78668a4bce88@amd.com> (raw)
In-Reply-To: <aIcRTapInMVSIkx5@kekkonen.localdomain>

Many thanks Sakari Ailus for the review.

On 7/28/2025 1:57 PM, Sakari Ailus wrote:
> Hi Bin,
> 
> On Wed, Jun 18, 2025 at 05:19:53PM +0800, Bin Du wrote:
>> Low level functions for access the registers and mapping to their ranges.
>> This change also includes register definitions for ring buffer used to
>> communicate with ISP Firmware.
>> Ring buffer is the communication interface between driver and ISP Firmware.
>> Command and responses are exchanged through the ring buffer.
> 
> Please rewrap this, the third line could well be longer.
> 
Sure, will do in the next patch

>>
>> Signed-off-by: Bin Du <Bin.Du@amd.com>
>> Signed-off-by: Svetoslav Stoilov <Svetoslav.Stoilov@amd.com>
>> ---
>>   drivers/media/platform/amd/isp4/Makefile      |   3 +-
>>   drivers/media/platform/amd/isp4/isp4_hw.c     |  46 +++++++
>>   drivers/media/platform/amd/isp4/isp4_hw.h     |  14 +++
>>   drivers/media/platform/amd/isp4/isp4_hw_reg.h | 116 ++++++++++++++++++
>>   4 files changed, 178 insertions(+), 1 deletion(-)
>>   create mode 100644 drivers/media/platform/amd/isp4/isp4_hw.c
>>   create mode 100644 drivers/media/platform/amd/isp4/isp4_hw.h
>>   create mode 100644 drivers/media/platform/amd/isp4/isp4_hw_reg.h
>>
>> diff --git a/drivers/media/platform/amd/isp4/Makefile b/drivers/media/platform/amd/isp4/Makefile
>> index e9e84160517d..8ca1c4dfe246 100644
>> --- a/drivers/media/platform/amd/isp4/Makefile
>> +++ b/drivers/media/platform/amd/isp4/Makefile
>> @@ -3,7 +3,8 @@
>>   # Copyright (C) 2025 Advanced Micro Devices, Inc.
>>   
>>   obj-$(CONFIG_AMD_ISP4) += amd_capture.o
>> -amd_capture-objs := isp4.o
>> +amd_capture-objs := isp4.o	\
>> +			isp4_hw.o	\
>>   
>>   ccflags-y += -I$(srctree)/drivers/media/platform/amd/isp4
>>   ccflags-y += -I$(srctree)/include
>> diff --git a/drivers/media/platform/amd/isp4/isp4_hw.c b/drivers/media/platform/amd/isp4/isp4_hw.c
>> new file mode 100644
>> index 000000000000..e5315330a514
>> --- /dev/null
>> +++ b/drivers/media/platform/amd/isp4/isp4_hw.c
>> @@ -0,0 +1,46 @@
>> +// SPDX-License-Identifier: GPL-2.0+
>> +/*
>> + * Copyright (C) 2025 Advanced Micro Devices, Inc.
>> + */
>> +
>> +#include <linux/io.h>
>> +#include <linux/types.h>
>> +
>> +#include "isp4_hw.h"
>> +#include "isp4_hw_reg.h"
>> +
>> +#define RMMIO_SIZE 524288
>> +
>> +u32 isp4hw_rreg(void __iomem *base, u32 reg)
>> +{
>> +	void __iomem *reg_addr;
>> +
>> +	if (reg >= RMMIO_SIZE)
>> +		return RREG_FAILED_VAL;
>> +
>> +	if (reg < ISP_MIPI_PHY0_REG0)
>> +		reg_addr = base + reg;
>> +	else if (reg <= ISP_MIPI_PHY0_REG0 + ISP_MIPI_PHY0_SIZE)
>> +		reg_addr = base + (reg - ISP_MIPI_PHY0_REG0);
> 
> Redundant parentheses.
> 
Sure, will remove it in the next patch

>> +	else
>> +		return RREG_FAILED_VAL;
>> +
>> +	return readl(reg_addr);
>> +};
>> +
>> +void isp4hw_wreg(void __iomem *base, u32 reg, u32 val)
>> +{
>> +	void __iomem *reg_addr;
>> +
>> +	if (reg >= RMMIO_SIZE)
>> +		return;
>> +
>> +	if (reg < ISP_MIPI_PHY0_REG0)
>> +		reg_addr = base + reg;
>> +	else if (reg <= ISP_MIPI_PHY0_REG0 + ISP_MIPI_PHY0_SIZE)
>> +		reg_addr = base + (reg - ISP_MIPI_PHY0_REG0);
> 
> Ditto.
> 
Sure, will remove it in the next patch

>> +	else
>> +		return;
>> +
>> +	writel(val, reg_addr);
>> +};
>> diff --git a/drivers/media/platform/amd/isp4/isp4_hw.h b/drivers/media/platform/amd/isp4/isp4_hw.h
>> new file mode 100644
>> index 000000000000..072d135b9e3a
>> --- /dev/null
>> +++ b/drivers/media/platform/amd/isp4/isp4_hw.h
>> @@ -0,0 +1,14 @@
>> +/* SPDX-License-Identifier: GPL-2.0+ */
>> +/*
>> + * Copyright (C) 2025 Advanced Micro Devices, Inc.
>> + */
>> +
>> +#ifndef _ISP4_HW_H_
>> +#define _ISP4_HW_H_
>> +
>> +#define RREG_FAILED_VAL 0xFFFFFFFF
>> +
>> +u32 isp4hw_rreg(void __iomem *base, u32 reg);
>> +void isp4hw_wreg(void __iomem *base, u32 reg, u32 val);
>> +
>> +#endif
>> diff --git a/drivers/media/platform/amd/isp4/isp4_hw_reg.h b/drivers/media/platform/amd/isp4/isp4_hw_reg.h
>> new file mode 100644
>> index 000000000000..b11f12ba6c56
>> --- /dev/null
>> +++ b/drivers/media/platform/amd/isp4/isp4_hw_reg.h
>> @@ -0,0 +1,116 @@
>> +/* SPDX-License-Identifier: GPL-2.0+ */
>> +/*
>> + * Copyright (C) 2025 Advanced Micro Devices, Inc.
>> + */
>> +
>> +#ifndef _ISP4_HW_REG_H_
>> +#define _ISP4_HW_REG_H_
>> +
>> +#define ISP_SOFT_RESET		0x62000
>> +#define ISP_SYS_INT0_EN		0x62010
>> +#define ISP_SYS_INT0_STATUS	0x62014
>> +#define ISP_SYS_INT0_ACK	0x62018
>> +#define ISP_CCPU_CNTL		0x62054
>> +#define ISP_STATUS		0x62058
>> +#define ISP_LOG_RB_BASE_LO0	0x62148
>> +#define ISP_LOG_RB_BASE_HI0	0x6214C
> 
> Lower case hexadecimals, please.
> 
Sure, will modify in the next patch

>> +#define ISP_LOG_RB_SIZE0	0x62150
>> +#define ISP_LOG_RB_RPTR0	0x62154
>> +#define ISP_LOG_RB_WPTR0	0x62158
>> +#define ISP_RB_BASE_LO1		0x62170
>> +#define ISP_RB_BASE_HI1		0x62174
>> +#define ISP_RB_SIZE1		0x62178
>> +#define ISP_RB_RPTR1		0x6217C
>> +#define ISP_RB_WPTR1		0x62180
>> +#define ISP_RB_BASE_LO2		0x62184
>> +#define ISP_RB_BASE_HI2		0x62188
>> +#define ISP_RB_SIZE2		0x6218C
>> +#define ISP_RB_RPTR2		0x62190
>> +#define ISP_RB_WPTR2		0x62194
>> +#define ISP_RB_BASE_LO3		0x62198
>> +#define ISP_RB_BASE_HI3		0x6219C
>> +#define ISP_RB_SIZE3		0x621A0
>> +#define ISP_RB_RPTR3		0x621A4
>> +#define ISP_RB_WPTR3		0x621A8
>> +#define ISP_RB_BASE_LO4		0x621AC
>> +#define ISP_RB_BASE_HI4		0x621B0
>> +#define ISP_RB_SIZE4		0x621B4
>> +#define ISP_RB_RPTR4		0x621B8
>> +#define ISP_RB_WPTR4		0x621BC
>> +#define ISP_RB_BASE_LO5		0x621C0
>> +#define ISP_RB_BASE_HI5		0x621C4
>> +#define ISP_RB_SIZE5		0x621C8
>> +#define ISP_RB_RPTR5		0x621CC
>> +#define ISP_RB_WPTR5		0x621D0
>> +#define ISP_RB_BASE_LO6		0x621D4
>> +#define ISP_RB_BASE_HI6		0x621D8
>> +#define ISP_RB_SIZE6		0x621DC
>> +#define ISP_RB_RPTR6		0x621E0
>> +#define ISP_RB_WPTR6		0x621E4
>> +#define ISP_RB_BASE_LO7		0x621E8
>> +#define ISP_RB_BASE_HI7		0x621EC
>> +#define ISP_RB_SIZE7		0x621F0
>> +#define ISP_RB_RPTR7		0x621F4
>> +#define ISP_RB_WPTR7		0x621F8
>> +#define ISP_RB_BASE_LO8		0x621FC
>> +#define ISP_RB_BASE_HI8		0x62200
>> +#define ISP_RB_SIZE8		0x62204
>> +#define ISP_RB_RPTR8		0x62208
>> +#define ISP_RB_WPTR8		0x6220C
>> +#define ISP_RB_BASE_LO9		0x62210
>> +#define ISP_RB_BASE_HI9		0x62214
>> +#define ISP_RB_SIZE9		0x62218
>> +#define ISP_RB_RPTR9		0x6221C
>> +#define ISP_RB_WPTR9		0x62220
>> +#define ISP_RB_BASE_LO10	0x62224
>> +#define ISP_RB_BASE_HI10	0x62228
>> +#define ISP_RB_SIZE10		0x6222C
>> +#define ISP_RB_RPTR10		0x62230
>> +#define ISP_RB_WPTR10		0x62234
>> +#define ISP_RB_BASE_LO11	0x62238
>> +#define ISP_RB_BASE_HI11	0x6223C
>> +#define ISP_RB_SIZE11		0x62240
>> +#define ISP_RB_RPTR11		0x62244
>> +#define ISP_RB_WPTR11		0x62248
>> +#define ISP_RB_BASE_LO12	0x6224C
>> +#define ISP_RB_BASE_HI12	0x62250
>> +#define ISP_RB_SIZE12		0x62254
>> +#define ISP_RB_RPTR12		0x62258
>> +#define ISP_RB_WPTR12		0x6225C
>> +
>> +#define ISP_POWER_STATUS	0x60000
>> +
>> +#define ISP_MIPI_PHY0_REG0	0x66700
>> +#define ISP_MIPI_PHY1_REG0	0x66780
>> +#define ISP_MIPI_PHY2_REG0	0x67400
>> +
>> +#define ISP_MIPI_PHY0_SIZE	0xD30
>> +
>> +/* ISP_SOFT_RESET */
>> +#define ISP_SOFT_RESET__CCPU_SOFT_RESET_MASK			0x00000001UL
>> +
>> +/* ISP_CCPU_CNTL */
>> +#define ISP_CCPU_CNTL__CCPU_HOST_SOFT_RST_MASK			0x00040000UL
>> +
>> +/* ISP_STATUS */
>> +#define ISP_STATUS__CCPU_REPORT_MASK				0x000000feUL
>> +
>> +/* ISP_SYS_INT0_STATUS */
>> +#define ISP_SYS_INT0_STATUS__SYS_INT_RINGBUFFER_WPT9_INT_MASK	0x00010000UL
>> +#define ISP_SYS_INT0_STATUS__SYS_INT_RINGBUFFER_WPT10_INT_MASK	0x00040000UL
>> +#define ISP_SYS_INT0_STATUS__SYS_INT_RINGBUFFER_WPT11_INT_MASK	0x00100000UL
>> +#define ISP_SYS_INT0_STATUS__SYS_INT_RINGBUFFER_WPT12_INT_MASK	0x00400000UL
>> +
>> +/* ISP_SYS_INT0_EN */
>> +#define ISP_SYS_INT0_EN__SYS_INT_RINGBUFFER_WPT9_EN_MASK	0x00010000UL
>> +#define ISP_SYS_INT0_EN__SYS_INT_RINGBUFFER_WPT10_EN_MASK	0x00040000UL
>> +#define ISP_SYS_INT0_EN__SYS_INT_RINGBUFFER_WPT11_EN_MASK	0x00100000UL
>> +#define ISP_SYS_INT0_EN__SYS_INT_RINGBUFFER_WPT12_EN_MASK	0x00400000UL
>> +
>> +/* ISP_SYS_INT0_ACK */
>> +#define ISP_SYS_INT0_ACK__SYS_INT_RINGBUFFER_WPT9_ACK_MASK	0x00010000UL
>> +#define ISP_SYS_INT0_ACK__SYS_INT_RINGBUFFER_WPT10_ACK_MASK	0x00040000UL
>> +#define ISP_SYS_INT0_ACK__SYS_INT_RINGBUFFER_WPT11_ACK_MASK	0x00100000UL
>> +#define ISP_SYS_INT0_ACK__SYS_INT_RINGBUFFER_WPT12_ACK_MASK	0x00400000UL
>> +
>> +#endif
> 


  reply	other threads:[~2025-07-28  9:24 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-18  9:19 [PATCH v2 0/8] Add AMD ISP4 driver Bin Du
2025-06-18  9:19 ` [PATCH v2 1/8] media: platform: amd: Introduce amd isp4 capture driver Bin Du
2025-06-18 15:58   ` Mario Limonciello
2025-06-19  7:46     ` Du, Bin
2025-06-19 13:00       ` Mario Limonciello
2025-06-20  3:08         ` Du, Bin
2025-07-28  5:54   ` Sakari Ailus
2025-07-28  9:00     ` Du, Bin
2025-06-18  9:19 ` [PATCH v2 2/8] media: platform: amd: low level support for isp4 firmware Bin Du
2025-06-18 16:00   ` Mario Limonciello
2025-06-19  7:53     ` Du, Bin
2025-07-28  5:57   ` Sakari Ailus
2025-07-28  9:24     ` Du, Bin [this message]
2025-06-18  9:19 ` [PATCH v2 3/8] media: platform: amd: Add helpers to configure isp4 mipi phy Bin Du
2025-07-28  6:33   ` Sakari Ailus
2025-08-05  9:53     ` Du, Bin
2025-08-05 10:53       ` Laurent Pinchart
2025-08-06  9:56         ` Du, Bin
2025-08-05 10:39     ` Laurent Pinchart
2025-08-06  9:45       ` Du, Bin
2025-07-28  7:28   ` Sakari Ailus
2025-07-31  9:31     ` Du, Bin
2025-06-18  9:19 ` [PATCH v2 4/8] media: platform: amd: Add isp4 fw and hw interface Bin Du
2025-06-18 16:17   ` Mario Limonciello
2025-06-19  9:58     ` Du, Bin
2025-06-19 15:11       ` Mario Limonciello
2025-06-20  3:32         ` Du, Bin
2025-07-28  7:23   ` Sakari Ailus
2025-07-29  9:12     ` Du, Bin
2025-08-11 11:46       ` Sakari Ailus
2025-08-11 12:31         ` Laurent Pinchart
2025-08-12  3:36           ` Du, Bin
2025-08-12  7:34             ` Laurent Pinchart
2025-08-12  8:08               ` Du, Bin
2025-08-12  8:20               ` Sakari Ailus
2025-08-12 10:04                 ` Du, Bin
2025-08-12  2:44         ` Du, Bin
2025-06-18  9:19 ` [PATCH v2 5/8] media: platform: amd: isp4 subdev and firmware loading handling added Bin Du
2025-06-18 16:35   ` Mario Limonciello
2025-06-20  9:31     ` Du, Bin
2025-07-06 20:55       ` Mario Limonciello
2025-07-07  6:22         ` Du, Bin
2025-07-25  1:35   ` Sultan Alsawaf
2025-07-25  9:03     ` Du, Bin
2025-06-18  9:19 ` [PATCH v2 6/8] media: platform: amd: isp4 video node and buffers " Bin Du
2025-07-23 17:55   ` Sultan Alsawaf
2025-07-24  5:14     ` Sultan Alsawaf
2025-07-25  9:05       ` Du, Bin
2025-07-25  9:22     ` Du, Bin
2025-07-26 21:41       ` Sultan Alsawaf
2025-07-26 21:50         ` Sultan Alsawaf
2025-07-29  6:12           ` Du, Bin
2025-07-29  6:08         ` Du, Bin
2025-07-28  7:04   ` Sultan Alsawaf
2025-07-29  7:43     ` Du, Bin
2025-07-31  0:34       ` Sultan Alsawaf
2025-07-31  9:45         ` Du, Bin
2025-08-11  6:02         ` Sultan Alsawaf
2025-08-11  9:05           ` Du, Bin
2025-08-12  5:51             ` Sultan Alsawaf
2025-08-12  6:33               ` Du, Bin
2025-08-13  9:42                 ` Du, Bin
2025-08-14  6:37                   ` Sultan Alsawaf
2025-06-18  9:19 ` [PATCH v2 7/8] media: platform: amd: isp4 debug fs logging and more descriptive errors Bin Du
2025-06-18  9:19 ` [PATCH v2 8/8] Documentation: add documentation of AMD isp 4 driver Bin Du
2025-08-05 11:37   ` Laurent Pinchart
2025-08-12  1:36     ` Du, Bin
2025-08-12 13:42       ` Laurent Pinchart
2025-08-22  2:28         ` Du, Bin
2025-08-20 12:42       ` Sakari Ailus
2025-08-22  2:20         ` Du, Bin
2025-09-22  6:24           ` Sakari Ailus
2025-09-22  9:19             ` Du, Bin
2025-07-23 18:12 ` [PATCH v2 0/8] Add AMD ISP4 driver Sultan Alsawaf
2025-07-25 10:22   ` Du, Bin
2025-07-26 22:31     ` Sultan Alsawaf
2025-07-29  3:32       ` Du, Bin
2025-07-29  7:42         ` Sultan Alsawaf
2025-07-29  7:45           ` Sultan Alsawaf
2025-07-29 10:13             ` Du, Bin
2025-07-30  5:38               ` Sultan Alsawaf
2025-07-30  9:53                 ` Du, Bin
2025-07-31  0:30                   ` Sultan Alsawaf
2025-07-31 10:04                     ` Du, Bin
2025-08-04  3:32                       ` Du, Bin
2025-08-04  4:25                         ` Sultan Alsawaf
2025-08-08  9:11                           ` Du, Bin
2025-08-11  5:49                             ` Sultan Alsawaf
2025-08-11  8:35                               ` Du, Bin
2025-08-11 21:48                                 ` Sultan Alsawaf
2025-08-11 22:17                                   ` Sultan Alsawaf
2025-08-12  2:02                                     ` Du, Bin
2025-08-14  6:53 ` Sultan Alsawaf
2025-08-22  2:23   ` Du, Bin
2025-08-22  3:56     ` Sultan Alsawaf
2025-08-27 10:30       ` Du, Bin
2025-08-28  5:50         ` Sultan Alsawaf
2025-09-02  2:08           ` Du, Bin

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=13d80da3-ced9-4304-8036-78668a4bce88@amd.com \
    --to=bin.du@amd.com \
    --cc=Dominic.Antony@amd.com \
    --cc=Phil.Jawich@amd.com \
    --cc=benjamin.chan@amd.com \
    --cc=bryan.odonoghue@linaro.org \
    --cc=gjorgji.rosikopulos@amd.com \
    --cc=hverkuil@xs4all.nl \
    --cc=king.li@amd.com \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=pratap.nirujogi@amd.com \
    --cc=sakari.ailus@linux.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

Powered by JetHome