dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Maxime Ripard <maxime.ripard@bootlin.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Rob Herring <robh+dt@kernel.org>,
	Frank Rowand <frowand.list@gmail.com>,
	Chen-Yu Tsai <wens@csie.org>
Cc: devicetree@vger.kernel.org,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Arnd Bergmann <arnd@arndb.de>,
	dri-devel@lists.freedesktop.org,
	Georgi Djakov <georgi.djakov@linaro.org>,
	Paul Kocialkowski <paul.kocialkowski@bootlin.com>,
	Yong Deng <yong.deng@magewell.com>,
	Dave Martin <dave.martin@arm.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v4 4/7] of: address: Add support for the parent DMA bus
Date: Wed, 27 Mar 2019 12:46:43 +0000	[thread overview]
Message-ID: <077b2e22-eb0d-8a0a-1e47-7dd078da1438@arm.com> (raw)
In-Reply-To: <1ed042a4c5b8c13c6692e12b2d630d75effbb90a.1552595146.git-series.maxime.ripard@bootlin.com>

On 14/03/2019 20:26, Maxime Ripard wrote:
> Some SoCs have devices that are using a separate bus from the main bus to
> perform DMA.
> 
> These buses might have some restrictions and/or different mapping than from
> the CPU side, so we'd need to express those using the usual dma-ranges, but
> using a different DT node than the node's parent.
> 
> Now that the generic interconnect bindings are available, we can model an
> interconnect with the reserved name "dma" for those use-cases.

Nit: it's "dma-mem" now.

> Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
> ---
>   drivers/of/address.c | 29 ++++++++++++++++++++++++++---
>   1 file changed, 26 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/of/address.c b/drivers/of/address.c
> index 140bd0718067..95e47f2e9198 100644
> --- a/drivers/of/address.c
> +++ b/drivers/of/address.c
> @@ -678,14 +678,31 @@ u64 of_translate_address(struct device_node *dev, const __be32 *in_addr)
>   }
>   EXPORT_SYMBOL(of_translate_address);
>   
> +static struct device_node *__of_get_dma_parent(const struct device_node *np)
> +{
> +	struct of_phandle_args args;
> +	int ret, index;
> +
> +	index = of_property_match_string(np, "interconnect-names", "dma-mem");
> +	if (index < 0)
> +		return of_get_parent(np);
> +
> +	ret = of_parse_phandle_with_args(np, "interconnects",
> +					 "#interconnect-cells",
> +					 index, &args);
> +	if (ret < 0)
> +		return of_get_parent(np);
> +
> +	return of_node_get(args.np);
> +}
> +
>   u64 of_translate_dma_address(struct device_node *dev, const __be32 *in_addr)
>   {
>   	struct device_node *host;
>   	u64 ret;
>   
> -	ret = __of_translate_address(dev, of_get_parent,
> +	ret = __of_translate_address(dev, __of_get_dma_parent,
>   				     in_addr, "dma-ranges", &host);
> -

Nit: ideally patch #3 wouldn't introduce that blank line in the first place.

Otherwise,

Reviewed-by: Robin Murphy <robin.murphy@arm.com>

>   	if (host) {
>   		of_node_put(host);
>   		return OF_BAD_ADDR;
> @@ -913,9 +930,15 @@ int of_dma_get_range(struct device_node *np, u64 *dma_addr, u64 *paddr, u64 *siz
>   		return -EINVAL;
>   
>   	while (1) {
> +		struct device_node *parent;
> +
>   		naddr = of_n_addr_cells(node);
>   		nsize = of_n_size_cells(node);
> -		node = of_get_next_parent(node);
> +
> +		parent = __of_get_dma_parent(node);
> +		of_node_put(node);
> +
> +		node = parent;
>   		if (!node)
>   			break;
>   
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2019-03-27 12:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-14 20:25 [PATCH v4 0/7] sunxi: Add DT representation for the MBUS controller Maxime Ripard
2019-03-14 20:26 ` [PATCH v4 1/7] dt-bindings: interconnect: Add a dma interconnect name Maxime Ripard
2019-03-22 16:46   ` Georgi Djakov
2019-03-14 20:26 ` [PATCH v4 2/7] dt-bindings: bus: Add binding for the Allwinner MBUS controller Maxime Ripard
2019-03-14 20:26 ` [PATCH v4 3/7] of: address: Add parent pointer to the __of_translate_address args Maxime Ripard
2019-03-27 12:40   ` Robin Murphy
2019-03-14 20:26 ` [PATCH v4 4/7] of: address: Add support for the parent DMA bus Maxime Ripard
2019-03-27 12:46   ` Robin Murphy [this message]
2019-03-14 20:26 ` [PATCH v4 5/7] drm/sun4i: Rely on dma interconnect for our RAM offset Maxime Ripard
2019-03-27 12:50   ` Robin Murphy
2019-03-14 20:26 ` [PATCH v4 6/7] clk: sunxi-ng: sun5i: Export the MBUS clock Maxime Ripard
2019-03-14 20:26 ` [PATCH v4 7/7] ARM: dts: sun5i: Add the MBUS controller Maxime Ripard

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=077b2e22-eb0d-8a0a-1e47-7dd078da1438@arm.com \
    --to=robin.murphy@arm.com \
    --cc=arnd@arndb.de \
    --cc=dave.martin@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=frowand.list@gmail.com \
    --cc=georgi.djakov@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=paul.kocialkowski@bootlin.com \
    --cc=robh+dt@kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=wens@csie.org \
    --cc=yong.deng@magewell.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