All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: Sudeep Holla <sudeep.holla-5wv7dgnIgG8@public.gmane.org>
Cc: Jassi Brar
	<jassisinghbrar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 4/4] mailbox: mailbox-test: add support for separate tx/rx buffer with single channel
Date: Fri, 12 Feb 2016 09:15:05 +0000	[thread overview]
Message-ID: <20160212091505.GS20693@x1> (raw)
In-Reply-To: <1455210808-29395-5-git-send-email-sudeep.holla-5wv7dgnIgG8@public.gmane.org>

On Thu, 11 Feb 2016, Sudeep Holla wrote:

> This patch adds support for different MMIO region for Tx and Rx paths.
> If only one region is specified, it's assumed to be shared between Rx
> and Tx, thereby retaining backward compatibility.
> 
> Also in order to support single channel dealing with both Tx and Rx with
> dedicated MMIO regions, Tx channel itself is assigned to Rx if MMIO
> regions are different and Rx is not specified.
> 
> Cc: Jassi Brar <jassisinghbrar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Cc: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> Signed-off-by: Sudeep Holla <sudeep.holla-5wv7dgnIgG8@public.gmane.org>
> ---
>  drivers/mailbox/mailbox-test.c | 28 ++++++++++++++++++----------
>  1 file changed, 18 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/mailbox/mailbox-test.c b/drivers/mailbox/mailbox-test.c
> index f690f11969a1..767b9ec37a96 100644
> --- a/drivers/mailbox/mailbox-test.c
> +++ b/drivers/mailbox/mailbox-test.c
> @@ -31,7 +31,8 @@ static struct dentry *root_debugfs_dir;
>  
>  struct mbox_test_device {
>  	struct device		*dev;
> -	void __iomem		*mmio;
> +	void __iomem		*tx_mmio;
> +	void __iomem		*rx_mmio;
>  	struct mbox_chan	*tx_channel;
>  	struct mbox_chan	*rx_channel;
>  	char			*rx_buffer;
> @@ -112,7 +113,7 @@ static ssize_t mbox_test_message_write(struct file *filp,
>  	 * A separate signal is only of use if there is
>  	 * MMIO to subsequently pass the message through
>  	 */
> -	if (tdev->mmio && tdev->signal) {
> +	if (tdev->tx_mmio && tdev->signal) {
>  		print_hex_dump_bytes("Client: Sending: Signal: ", DUMP_PREFIX_ADDRESS,
>  				     tdev->signal, MBOX_MAX_SIG_LEN);
>  
> @@ -220,8 +221,8 @@ static void mbox_test_receive_message(struct mbox_client *client, void *message)
>  	unsigned long flags;
>  
>  	spin_lock_irqsave(&tdev->lock, flags);
> -	if (tdev->mmio) {
> -		memcpy_fromio(tdev->rx_buffer, tdev->mmio, MBOX_MAX_MSG_LEN);
> +	if (tdev->rx_mmio) {
> +		memcpy_fromio(tdev->rx_buffer, tdev->rx_mmio, MBOX_MAX_MSG_LEN);
>  		print_hex_dump_bytes("Client: Received [MMIO]: ", DUMP_PREFIX_ADDRESS,
>  				     tdev->rx_buffer, MBOX_MAX_MSG_LEN);
>  	} else if (message) {
> @@ -236,11 +237,11 @@ static void mbox_test_prepare_message(struct mbox_client *client, void *message)
>  {
>  	struct mbox_test_device *tdev = dev_get_drvdata(client->dev);
>  
> -	if (tdev->mmio) {
> +	if (tdev->tx_mmio) {
>  		if (tdev->signal)
> -			memcpy_toio(tdev->mmio, tdev->message, MBOX_MAX_MSG_LEN);
> +			memcpy_toio(tdev->tx_mmio, tdev->message, MBOX_MAX_MSG_LEN);
>  		else
> -			memcpy_toio(tdev->mmio, message, MBOX_MAX_MSG_LEN);
> +			memcpy_toio(tdev->tx_mmio, message, MBOX_MAX_MSG_LEN);
>  	}
>  }
>  
> @@ -294,9 +295,13 @@ static int mbox_test_probe(struct platform_device *pdev)
>  
>  	/* It's okay for MMIO to be NULL */
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	tdev->mmio = devm_ioremap_resource(&pdev->dev, res);
> -	if (IS_ERR(tdev->mmio))
> -		tdev->mmio = NULL;
> +	tdev->tx_mmio = devm_ioremap_resource(&pdev->dev, res);
> +	if (IS_ERR(tdev->tx_mmio))
> +		tdev->tx_mmio = NULL;

Nit: I'd prefer to see a new line separator here.

> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> +	tdev->rx_mmio = devm_ioremap_resource(&pdev->dev, res);
> +	if (IS_ERR(tdev->rx_mmio))
> +		tdev->rx_mmio = tdev->tx_mmio;
>  
>  	tdev->tx_channel = mbox_test_request_channel(pdev, "tx");
>  	tdev->rx_channel = mbox_test_request_channel(pdev, "rx");
> @@ -304,6 +309,9 @@ static int mbox_test_probe(struct platform_device *pdev)
>  	if (!tdev->tx_channel && !tdev->rx_channel)
>  		return -EPROBE_DEFER;
>  
> +	if (!tdev->rx_channel && (tdev->rx_mmio != tdev->tx_mmio))
> +		tdev->rx_channel = tdev->tx_channel;
> +
>  	tdev->dev = &pdev->dev;
>  	platform_set_drvdata(pdev, tdev);

Otherwise code looks good.  Nice extension.

Acked-by: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Lee Jones <lee.jones@linaro.org>
To: Sudeep Holla <sudeep.holla@arm.com>
Cc: Jassi Brar <jassisinghbrar@gmail.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] mailbox: mailbox-test: add support for separate tx/rx buffer with single channel
Date: Fri, 12 Feb 2016 09:15:05 +0000	[thread overview]
Message-ID: <20160212091505.GS20693@x1> (raw)
In-Reply-To: <1455210808-29395-5-git-send-email-sudeep.holla@arm.com>

On Thu, 11 Feb 2016, Sudeep Holla wrote:

> This patch adds support for different MMIO region for Tx and Rx paths.
> If only one region is specified, it's assumed to be shared between Rx
> and Tx, thereby retaining backward compatibility.
> 
> Also in order to support single channel dealing with both Tx and Rx with
> dedicated MMIO regions, Tx channel itself is assigned to Rx if MMIO
> regions are different and Rx is not specified.
> 
> Cc: Jassi Brar <jassisinghbrar@gmail.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
>  drivers/mailbox/mailbox-test.c | 28 ++++++++++++++++++----------
>  1 file changed, 18 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/mailbox/mailbox-test.c b/drivers/mailbox/mailbox-test.c
> index f690f11969a1..767b9ec37a96 100644
> --- a/drivers/mailbox/mailbox-test.c
> +++ b/drivers/mailbox/mailbox-test.c
> @@ -31,7 +31,8 @@ static struct dentry *root_debugfs_dir;
>  
>  struct mbox_test_device {
>  	struct device		*dev;
> -	void __iomem		*mmio;
> +	void __iomem		*tx_mmio;
> +	void __iomem		*rx_mmio;
>  	struct mbox_chan	*tx_channel;
>  	struct mbox_chan	*rx_channel;
>  	char			*rx_buffer;
> @@ -112,7 +113,7 @@ static ssize_t mbox_test_message_write(struct file *filp,
>  	 * A separate signal is only of use if there is
>  	 * MMIO to subsequently pass the message through
>  	 */
> -	if (tdev->mmio && tdev->signal) {
> +	if (tdev->tx_mmio && tdev->signal) {
>  		print_hex_dump_bytes("Client: Sending: Signal: ", DUMP_PREFIX_ADDRESS,
>  				     tdev->signal, MBOX_MAX_SIG_LEN);
>  
> @@ -220,8 +221,8 @@ static void mbox_test_receive_message(struct mbox_client *client, void *message)
>  	unsigned long flags;
>  
>  	spin_lock_irqsave(&tdev->lock, flags);
> -	if (tdev->mmio) {
> -		memcpy_fromio(tdev->rx_buffer, tdev->mmio, MBOX_MAX_MSG_LEN);
> +	if (tdev->rx_mmio) {
> +		memcpy_fromio(tdev->rx_buffer, tdev->rx_mmio, MBOX_MAX_MSG_LEN);
>  		print_hex_dump_bytes("Client: Received [MMIO]: ", DUMP_PREFIX_ADDRESS,
>  				     tdev->rx_buffer, MBOX_MAX_MSG_LEN);
>  	} else if (message) {
> @@ -236,11 +237,11 @@ static void mbox_test_prepare_message(struct mbox_client *client, void *message)
>  {
>  	struct mbox_test_device *tdev = dev_get_drvdata(client->dev);
>  
> -	if (tdev->mmio) {
> +	if (tdev->tx_mmio) {
>  		if (tdev->signal)
> -			memcpy_toio(tdev->mmio, tdev->message, MBOX_MAX_MSG_LEN);
> +			memcpy_toio(tdev->tx_mmio, tdev->message, MBOX_MAX_MSG_LEN);
>  		else
> -			memcpy_toio(tdev->mmio, message, MBOX_MAX_MSG_LEN);
> +			memcpy_toio(tdev->tx_mmio, message, MBOX_MAX_MSG_LEN);
>  	}
>  }
>  
> @@ -294,9 +295,13 @@ static int mbox_test_probe(struct platform_device *pdev)
>  
>  	/* It's okay for MMIO to be NULL */
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	tdev->mmio = devm_ioremap_resource(&pdev->dev, res);
> -	if (IS_ERR(tdev->mmio))
> -		tdev->mmio = NULL;
> +	tdev->tx_mmio = devm_ioremap_resource(&pdev->dev, res);
> +	if (IS_ERR(tdev->tx_mmio))
> +		tdev->tx_mmio = NULL;

Nit: I'd prefer to see a new line separator here.

> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> +	tdev->rx_mmio = devm_ioremap_resource(&pdev->dev, res);
> +	if (IS_ERR(tdev->rx_mmio))
> +		tdev->rx_mmio = tdev->tx_mmio;
>  
>  	tdev->tx_channel = mbox_test_request_channel(pdev, "tx");
>  	tdev->rx_channel = mbox_test_request_channel(pdev, "rx");
> @@ -304,6 +309,9 @@ static int mbox_test_probe(struct platform_device *pdev)
>  	if (!tdev->tx_channel && !tdev->rx_channel)
>  		return -EPROBE_DEFER;
>  
> +	if (!tdev->rx_channel && (tdev->rx_mmio != tdev->tx_mmio))
> +		tdev->rx_channel = tdev->tx_channel;
> +
>  	tdev->dev = &pdev->dev;
>  	platform_set_drvdata(pdev, tdev);

Otherwise code looks good.  Nice extension.

Acked-by: Lee Jones <lee.jones@linaro.org>

-- 
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-02-12  9:15 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-11 17:13 [PATCH 0/4] mailbox: mailbox-test: support single channel with separate Tx and Rx buffer Sudeep Holla
2016-02-11 17:13 ` Sudeep Holla
     [not found] ` <1455210808-29395-1-git-send-email-sudeep.holla-5wv7dgnIgG8@public.gmane.org>
2016-02-11 17:13   ` [PATCH 1/4] mailbox: mailbox-test: rename driver as generic test driver Sudeep Holla
2016-02-11 17:13     ` Sudeep Holla
2016-02-12  9:08     ` Lee Jones
2016-02-15 12:17   ` [PATCH 0/4] mailbox: mailbox-test: support single channel with separate Tx and Rx buffer Sudeep Holla
2016-02-15 12:17     ` Sudeep Holla
2016-02-15 12:31     ` Jassi Brar
2016-02-15 12:38       ` Sudeep Holla
2016-02-11 17:13 ` [PATCH 2/4] mailbox: mailbox-test: fix the compatible string Sudeep Holla
2016-02-12  9:08   ` Lee Jones
     [not found]   ` <1455210808-29395-3-git-send-email-sudeep.holla-5wv7dgnIgG8@public.gmane.org>
2016-02-12 16:49     ` Rob Herring
2016-02-12 16:49       ` Rob Herring
2016-02-11 17:13 ` [PATCH 3/4] mailbox: mailbox-test: use print_hex_dump_bytes to allow dynamic printk Sudeep Holla
     [not found]   ` <1455210808-29395-4-git-send-email-sudeep.holla-5wv7dgnIgG8@public.gmane.org>
2016-02-12  9:12     ` Lee Jones
2016-02-12  9:12       ` Lee Jones
2016-02-12  9:32       ` Sudeep Holla
2016-02-11 17:13 ` [PATCH 4/4] mailbox: mailbox-test: add support for separate tx/rx buffer with single channel Sudeep Holla
     [not found]   ` <1455210808-29395-5-git-send-email-sudeep.holla-5wv7dgnIgG8@public.gmane.org>
2016-02-12  9:15     ` Lee Jones [this message]
2016-02-12  9:15       ` Lee Jones
2016-02-12  9:34       ` Sudeep Holla
2016-02-12  9:34         ` Sudeep Holla
2016-02-12  9:17 ` [PATCH 0/4] mailbox: mailbox-test: support single channel with separate Tx and Rx buffer Lee Jones
2016-02-12  9:41   ` Sudeep Holla
     [not found]     ` <56BDA8E3.8060800-5wv7dgnIgG8@public.gmane.org>
2016-02-15 12:14       ` Sudeep Holla
2016-02-15 12:14         ` Sudeep Holla

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=20160212091505.GS20693@x1 \
    --to=lee.jones-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=jassisinghbrar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sudeep.holla-5wv7dgnIgG8@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.