mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: Billy Tsai <billy_tsai@aspeedtech.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Frank Li <Frank.Li@nxp.com>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>, Joel Stanley <joel@jms.id.au>,
	Andrew Jeffery <andrew@codeconstruct.com.au>
Cc: linux-i3c@lists.infradead.org, devicetree@vger.kernel.org,
	 linux-arm-kernel@lists.infradead.org,
	linux-aspeed@lists.ozlabs.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/8] i3c: mipi-i3c-hci: Add support for the AST2700 I3C controller
Date: Wed, 04 Nov 2026 12:14:51 +0100	[thread overview]
Message-ID: <f0633026a1ae251715af3c7323fcfd26e96ffaab.camel@pengutronix.de> (raw)
In-Reply-To: <20260901-b4-i3c-hci-ast2700-v1-5-19909e7cbd7e@aspeedtech.com>

On Di, 2026-09-01 at 19:35 +0800, Billy Tsai wrote:
> The AST2700 I3C controller carries an ASPEED vendor extended
> capability describing an in-house control block and a PHY programming
> window. Recognize the ASPEED MIPI vendor ID in the extended capability
> parser and cache both register bases via the generic vendor_data
> pointer, which other vendors (e.g. NXP) also populate; add is_aspeed()
> to identify ASPEED specifically.
> 
[...]
>
> Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
> Assisted-by: Claude:claude-fable-5

Drop, see 1e035297ffda ("docs: remove Assisted-by references").

> ---
>  drivers/i3c/master/mipi-i3c-hci/Makefile        |   2 +-
>  drivers/i3c/master/mipi-i3c-hci/cmd_v1.c        |  21 +++
>  drivers/i3c/master/mipi-i3c-hci/core.c          | 175 ++++++++++++++++--
>  drivers/i3c/master/mipi-i3c-hci/ext_caps.c      |  15 ++
>  drivers/i3c/master/mipi-i3c-hci/ext_caps.h      |   1 +
>  drivers/i3c/master/mipi-i3c-hci/vendor_aspeed.c | 234 ++++++++++++++++++++++++
>  drivers/i3c/master/mipi-i3c-hci/vendor_aspeed.h | 174 ++++++++++++++++++
>  7 files changed, 606 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
> index 2290a889701cd..e0ee8148aa2f8 100644
> --- a/drivers/i3c/master/mipi-i3c-hci/core.c
> +++ b/drivers/i3c/master/mipi-i3c-hci/core.c
[...]
> @@ -1146,10 +1235,17 @@ static int i3c_hci_init(struct i3c_hci *hci)
>  	return i3c_hci_reset_and_init(hci);
>  }
>  
> +static void i3c_hci_dma_rst_assert(void *data)
> +{
> +	reset_control_assert(data);
> +}
> +
>  static int i3c_hci_probe(struct platform_device *pdev)
>  {
>  	const struct mipi_i3c_hci_platform_data *pdata = pdev->dev.platform_data;
>  	struct clk_bulk_data *clks;
> +	irq_handler_t irq_handler;
> +	unsigned long irq_flags;
>  	struct i3c_hci *hci;
>  	int irq, ret;
>  
> @@ -1176,8 +1272,12 @@ static int i3c_hci_probe(struct platform_device *pdev)
>  	}
>  
>  	platform_set_drvdata(pdev, hci);
> -	/* temporary for dev_printk's, to be replaced in i3c_master_register */
> +	/*
> +	 * Temporary for dev_printk's and is_aspeed(), both replaced with
> +	 * the real values by i3c_master_register().
> +	 */
>  	hci->master.dev.init_name = dev_name(&pdev->dev);
> +	hci->master.dev.of_node = pdev->dev.of_node;
>  
>  	hci->quirks = (unsigned long)device_get_match_data(&pdev->dev);
>  	if (!hci->quirks && platform_get_device_id(pdev))
> @@ -1189,6 +1289,40 @@ static int i3c_hci_probe(struct platform_device *pdev)
>  					     "cannot set DMA mask\n");
>  	}
>  
> +	if (is_aspeed(hci)) {
> +		struct aspeed_i3c_vendor_data *vd;
> +
> +		vd = devm_kzalloc(&pdev->dev, sizeof(*vd), GFP_KERNEL);
> +		if (!vd)
> +			return -ENOMEM;
> +		hci->vendor_data = vd;
> +
> +		vd->rst = devm_reset_control_get_optional_exclusive(&pdev->dev, "core");

vd->rst is only ever used in i3c_hci_probe(), this could be a local
variable.

> +		if (IS_ERR(vd->rst))
> +			return PTR_ERR(vd->rst);
> +		ret = reset_control_deassert(vd->rst);
> +		if (ret)
> +			return ret;

Is the core reset never asserted again on purpose? Otherwise you could
use devm_reset_control_get_optional_exclusive_deasserted() to simplify
this.

> +
> +		vd->dma_rst = devm_reset_control_get_optional_shared(&pdev->dev, "dma");

vd->dma_rst is only ever used in i3c_hci_probe(), this could be a local
variable.

> +		if (IS_ERR(vd->dma_rst))
> +			return PTR_ERR(vd->dma_rst);
> +		if (vd->dma_rst) {
> +			ret = reset_control_deassert(vd->dma_rst);
> +			if (ret)
> +				return ret;
> +			ret = devm_add_action_or_reset(&pdev->dev,
> +						       i3c_hci_dma_rst_assert,
> +						       vd->dma_rst);
> +			if (ret)
> +				return ret;

This looks like it can be simplified with
devm_reset_control_get_optional_shared_deasserted().

> +		}
> +
> +		vd->clk = devm_clk_get_optional(&pdev->dev, NULL);
> +		if (IS_ERR(vd->clk))
> +			return PTR_ERR(vd->clk);
> +	}
> +
>  	ret = devm_clk_bulk_get_all_enabled(&pdev->dev, &clks);
>  	if (ret < 0)
>  		return dev_err_probe(&pdev->dev, ret,
[...]
> diff --git a/drivers/i3c/master/mipi-i3c-hci/vendor_aspeed.h b/drivers/i3c/master/mipi-i3c-hci/vendor_aspeed.h
> new file mode 100644
> index 0000000000000..8760384d1c6f5
> --- /dev/null
> +++ b/drivers/i3c/master/mipi-i3c-hci/vendor_aspeed.h
> @@ -0,0 +1,174 @@
[...]
> +struct aspeed_i3c_vendor_data {
> +	void __iomem *inhouse_regs;
> +	void __iomem *phy_regs;
> +	struct reset_control *rst;
> +	struct reset_control *dma_rst;

These two don't seem necessary.

> +	struct clk *clk;
> +};
> +

regards
Philipp

  parent reply	other threads:[~2026-11-04 11:14 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01 11:35 [PATCH 0/8] i3c: mipi-i3c-hci: Add Aspeed AST2700 support Billy Tsai
2026-09-01 11:35 ` [PATCH 1/8] dt-bindings: i3c: Document the AST2700 I3C controller Billy Tsai
2026-09-01 20:41   ` Frank Li
2026-09-09  5:33     ` 回覆: " Billy Tsai
2026-09-07  6:28   ` Krzysztof Kozlowski
2026-09-09  5:35     ` 回覆: " Billy Tsai
2026-09-17 15:47     ` Alexandre Belloni
2026-09-24  5:39       ` 回覆: " Billy Tsai
2026-09-30 15:26         ` Alexandre Belloni
2026-09-01 11:35 ` [PATCH 2/8] i3c: mipi-i3c-hci: Support address-indexed DAT slots Billy Tsai
2026-09-01 20:47   ` Frank Li
2026-09-09  5:36     ` 回覆: " Billy Tsai
2026-09-01 11:35 ` [PATCH 3/8] i3c: mipi-i3c-hci: Add a quirk for 64-bit DMA addressing Billy Tsai
2026-09-01 20:51   ` Frank Li
2026-09-09  5:37     ` 回覆: " Billy Tsai
2026-09-01 11:35 ` [PATCH 4/8] i3c: mipi-i3c-hci: Add a quirk to clear the TX start threshold Billy Tsai
2026-09-01 20:58   ` Frank Li
2026-09-09  5:37     ` 回覆: " Billy Tsai
2026-09-01 11:35 ` [PATCH 5/8] i3c: mipi-i3c-hci: Add support for the AST2700 I3C controller Billy Tsai
2026-09-01 21:18   ` Frank Li
2026-09-09  5:38     ` 回覆: " Billy Tsai
2026-11-04 11:14   ` Philipp Zabel [this message]
2026-09-01 11:35 ` [PATCH 6/8] i3c: mipi-i3c-hci: Program AST2700 IBI termination threshold Billy Tsai
2026-09-01 11:35 ` [PATCH 7/8] i3c: mipi-i3c-hci: Improve AST2700 PIO TX queue utilization Billy Tsai
2026-09-01 11:35 ` [PATCH 8/8] i3c: mipi-i3c-hci: Support the AST2700 internal pull-ups Billy Tsai

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=f0633026a1ae251715af3c7323fcfd26e96ffaab.camel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=Frank.Li@nxp.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andrew@codeconstruct.com.au \
    --cc=billy_tsai@aspeedtech.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=joel@jms.id.au \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-aspeed@lists.ozlabs.org \
    --cc=linux-i3c@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    /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®