linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: lee.jones@linaro.org (Lee Jones)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] soc: ti: wkup_m3_ipc: switch to using remoteproc OF infrastructure
Date: Fri, 12 Aug 2016 12:02:01 +0100	[thread overview]
Message-ID: <20160812110201.GD25844@dell> (raw)
In-Reply-To: <20160812003529.519-1-s-anna@ti.com>

On Thu, 11 Aug 2016, Suman Anna wrote:

> The remoteproc framework has been enhanced recently to provide new
> OF API to retrieve a remoteproc handle by client drivers through a
> standard 'rprocs' property in client nodes. The wkup_m3_ipc driver
> has been using a custom 'ti,rproc' property until now, switch this
> to use this new OF infrastructure. The wkup_m3_ipc driver has been
> fixed up to provide backward compatibility for older DTBs by
> replacing the older property with the standard newer property.
> 
> The wkup_m3_ipc binding has also been updated accordingly.
> 
> Signed-off-by: Suman Anna <s-anna@ti.com>
> ---
> This patch is based on the discussion [1] for introducing new standard
> OF API in remoteproc core series [2] and the exporting of couple of
> functions in OF base code [3].
> 
> With this in place, the remoteproc core need not be looking for the
> TI specific property anymore. I will submit the DTS changes once this
> makes it to mainline.
> 
> regards
> Suman
> 
> [1] https://patchwork.kernel.org/patch/9237767/
> [2] http://marc.info/?l=linux-kernel&m=146894341701010&w=2
> [3] https://patchwork.kernel.org/patch/9276181/
> 
>  .../devicetree/bindings/soc/ti/wkup_m3_ipc.txt     |  9 ++++++--
>  drivers/soc/ti/wkup_m3_ipc.c                       | 26 +++++++++++++++++++++-
>  2 files changed, 32 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt b/Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt
> index 401550487ed6..2ea7dd91acff 100644
> --- a/Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt
> +++ b/Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt
> @@ -23,12 +23,17 @@ Required properties:
>  			with the Wakeup M3 processor
>  - interrupts:		Contains the interrupt information for the wkup_m3
>  			interrupt that signals the MPU.
> -- ti,rproc:		phandle to the wkup_m3 rproc node so the IPC driver
> +- rprocs:		phandle to the wkup_m3 rproc node so the IPC driver
>  			can boot it.
>  - mboxes:		phandles used by IPC framework to get correct mbox
>  			channel for communication. Must point to appropriate
>  			mbox_wkupm3 child node.
>  
> +Deprecated properties:
> +----------------------
> +- ti,rproc:		This property has been replaced with the "rprocs"
> +			property.
> +
>  Example:
>  --------
>  /* AM33xx */
> @@ -48,7 +53,7 @@ Example:
>  				compatible = "ti,am3352-wkup-m3-ipc";
>  				reg = <0x1324 0x24>;
>  				interrupts = <78>;
> -				ti,rproc = <&wkup_m3>;
> +				rprocs = <&wkup_m3>;
>  				mboxes = <&mailbox &mbox_wkupm3>;
>  			};
>  
> diff --git a/drivers/soc/ti/wkup_m3_ipc.c b/drivers/soc/ti/wkup_m3_ipc.c
> index 8823cc81ae45..86085f9bf6a8 100644
> --- a/drivers/soc/ti/wkup_m3_ipc.c
> +++ b/drivers/soc/ti/wkup_m3_ipc.c
> @@ -1,7 +1,7 @@
>  /*
>   * AMx3 Wkup M3 IPC driver
>   *
> - * Copyright (C) 2015 Texas Instruments, Inc.
> + * Copyright (C) 2015-2016 Texas Instruments, Inc.
>   *
>   * Dave Gerlach <d-gerlach@ti.com>
>   *
> @@ -390,6 +390,8 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev)
>  	struct resource *res;
>  	struct task_struct *task;
>  	struct wkup_m3_ipc *m3_ipc;
> +	struct property *nprop, *oprop;
> +	const char nprop_name[] = "rprocs";
>  
>  	m3_ipc = devm_kzalloc(dev, sizeof(*m3_ipc), GFP_KERNEL);
>  	if (!m3_ipc)
> @@ -415,6 +417,28 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev)
>  		return ret;
>  	}
>  
> +	/* provide compatibility for older DTBs using ti,rproc property */
> +	nprop = of_find_property(dev->of_node, "rprocs", NULL);
> +	if (!nprop) {
> +		oprop = of_find_property(dev->of_node, "ti,rproc", NULL);
> +		if (!oprop) {
> +			dev_err(&pdev->dev, "node is missing ti,rproc property\n");
> +			return -ENODEV;
> +		}
> +
> +		nprop = kzalloc(sizeof(*nprop) + sizeof(nprop_name),
> +				GFP_KERNEL);
> +		if (!nprop)
> +			return -ENOMEM;
> +
> +		nprop->name = (char *)nprop + sizeof(*nprop);
> +		snprintf(nprop->name, sizeof(nprop_name), nprop_name);
> +		nprop->value = oprop->value;
> +		nprop->length = oprop->length;
> +		of_update_property(dev->of_node, nprop);
> +		of_remove_property(dev->of_node, oprop);
> +	}
> +

+1 for getting the functionality out of core code.

-100 for having to jump though all these hoops.

If you are going to keep all of this, I would at least tuck it away in
a header file or something.

>  	m3_ipc->mbox_client.dev = dev;
>  	m3_ipc->mbox_client.tx_done = NULL;
>  	m3_ipc->mbox_client.tx_prepare = NULL;

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

  parent reply	other threads:[~2016-08-12 11:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-12  0:35 [PATCH] soc: ti: wkup_m3_ipc: switch to using remoteproc OF infrastructure Suman Anna
2016-08-12  6:17 ` kbuild test robot
2016-08-12 11:02 ` Lee Jones [this message]
2016-08-12 16:00   ` Suman Anna
2016-08-12 16:43     ` Bjorn Andersson
2016-08-16 14:54       ` Rob Herring
2016-08-18 21:30         ` Suman Anna
2016-08-19 21:21           ` Rob Herring
2016-08-19 21:35             ` Suman Anna

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=20160812110201.GD25844@dell \
    --to=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).