public inbox for linux-remoteproc@vger.kernel.org
 help / color / mirror / Atom feed
From: David Lechner <david@lechnology.com>
To: Roger Quadros <rogerq@ti.com>,
	ohad@wizery.com, bjorn.andersson@linaro.org
Cc: tony@atomide.com, robh+dt@kernel.org, bcousson@baylibre.com,
	ssantosh@kernel.org, s-anna@ti.com, nsekhar@ti.com,
	t-kristo@ti.com, nsaulnier@ti.com, jreeder@ti.com,
	m-karicheri2@ti.com, woods.technical@gmail.com,
	linux-omap@vger.kernel.org, linux-remoteproc@vger.kernel.org,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 04/16] remoteproc/pru: Add PRU remoteproc driver
Date: Mon, 26 Nov 2018 16:32:45 -0600	[thread overview]
Message-ID: <e63ac3f9-8daf-af84-a200-4c5f40a1a3ed@lechnology.com> (raw)
In-Reply-To: <1543218769-5507-5-git-send-email-rogerq@ti.com>

On 11/26/18 1:52 AM, Roger Quadros wrote:

> diff --git a/drivers/remoteproc/Makefile b/drivers/remoteproc/Makefile
> index ce5d061..88a86cc 100644
> --- a/drivers/remoteproc/Makefile
> +++ b/drivers/remoteproc/Makefile
> @@ -26,3 +26,4 @@ qcom_wcnss_pil-y			+= qcom_wcnss.o
>   qcom_wcnss_pil-y			+= qcom_wcnss_iris.o
>   obj-$(CONFIG_ST_REMOTEPROC)		+= st_remoteproc.o
>   obj-$(CONFIG_ST_SLIM_REMOTEPROC)	+= st_slim_rproc.o
> +obj-$(CONFIG_PRUSS_REMOTEPROC)		+= pru_rproc.o
> diff --git a/drivers/remoteproc/pru_rproc.c b/drivers/remoteproc/pru_rproc.c
> new file mode 100644
> index 0000000..c35f432
> --- /dev/null
> +++ b/drivers/remoteproc/pru_rproc.c
> @@ -0,0 +1,392 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * PRU-ICSS remoteproc driver for various TI SoCs
> + *
> + * Copyright (C) 2014-2018 Texas Instruments Incorporated - http://www.ti.com/
> + *	Suman Anna <s-anna@ti.com>
> + *	Andrew F. Davis <afd@ti.com>
> + */
> +
> +#include <linux/bitops.h>
> +#include <linux/interrupt.h>
> +#include <linux/module.h>
> +#include <linux/of_device.h>
> +#include <linux/remoteproc.h>

alphabetical order?

> +#include <linux/pruss.h>
> +
> +#include "remoteproc_internal.h"

alphabetical order?

> +#include "pru_rproc.h"
> +
> +/* PRU_ICSS_PRU_CTRL registers */
> +#define PRU_CTRL_CTRL		0x0000
> +#define PRU_CTRL_STS		0x0004
> +#define PRU_CTRL_WAKEUP_EN	0x0008
> +#define PRU_CTRL_CYCLE		0x000C
> +#define PRU_CTRL_STALL		0x0010
> +#define PRU_CTRL_CTBIR0		0x0020
> +#define PRU_CTRL_CTBIR1		0x0024
> +#define PRU_CTRL_CTPPR0		0x0028
> +#define PRU_CTRL_CTPPR1		0x002C
> +
> +/* CTRL register bit-fields */
> +#define CTRL_CTRL_SOFT_RST_N	BIT(0)
> +#define CTRL_CTRL_EN		BIT(1)
> +#define CTRL_CTRL_SLEEPING	BIT(2)
> +#define CTRL_CTRL_CTR_EN	BIT(3)
> +#define CTRL_CTRL_SINGLE_STEP	BIT(8)
> +#define CTRL_CTRL_RUNSTATE	BIT(15)
> +
> +/**
> + * enum pru_mem - PRU core memory range identifiers
> + */
> +enum pru_mem {
> +	PRU_MEM_IRAM = 0,
> +	PRU_MEM_CTRL,
> +	PRU_MEM_DEBUG,
> +	PRU_MEM_MAX,
> +};

I am finding the name "mem" here to be confusing. I keep thinking
these are just RAM regions instead of memory mapped I/O. Maybe call
it "iomem" instead of "mem"?

...

> +static int pru_rproc_set_id(struct pru_rproc *pru)
> +{
> +	int ret = 0;
> +	u32 mask1 = 0x34000;
> +	u32 mask2 = 0x38000;

These values are non-obvious and could use some comments. Also,
they could be made into constants or macros.

> +
> +	if ((pru->mem_regions[0].pa & mask1) == mask1)

how about this instead:

	if ((pru->mem_regions[PRU_MEM_IRAM].pa & 0xfffff) == mask1)

The 0xfffff mask will be important on AM18xx where INTC is at 0x34000,
PRU0 IRAM is at 0x38000 and PRU1 IRAM is at 0x3C000.

> +		pru->id = 0;
> +	else if ((pru->mem_regions[0].pa & mask2) == mask2)
> +		pru->id = 1;
> +	else
> +		ret = -EINVAL;
> +
> +	return ret;
> +}

  reply	other threads:[~2018-11-26 22:32 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-26  7:52 [PATCH 00/16] remoteproc: Add support for TI PRU Roger Quadros
2018-11-26  7:52 ` [PATCH 01/16] remoteproc: Extend rproc_da_to_va() API with a flags parameter Roger Quadros
2018-11-26 21:29   ` David Lechner
2018-11-29 10:29     ` Roger Quadros
2018-11-29 16:12       ` David Lechner
2018-12-04 10:03         ` Roger Quadros
2019-02-14  3:35           ` Suman Anna
2018-11-26  7:52 ` [PATCH 02/16] remoteproc: Add a rproc_set_firmware() API Roger Quadros
2018-11-26 21:41   ` David Lechner
2018-11-29  8:51     ` Roger Quadros
2018-11-26  7:52 ` [PATCH 03/16] remoteproc: Add support to handle device specific resource types Roger Quadros
2018-11-26  7:52 ` [PATCH 04/16] remoteproc/pru: Add PRU remoteproc driver Roger Quadros
2018-11-26 22:32   ` David Lechner [this message]
2018-11-29  9:26     ` Roger Quadros
2018-11-30 21:39   ` Dimitar Dimitrov
2018-12-04  8:47     ` Roger Quadros
2018-12-14  9:53     ` Roger Quadros
2018-12-15 13:43       ` Dimitar Dimitrov
2018-11-26  7:52 ` [PATCH 05/16] remoteproc/pru: Add pru-specific debugfs support Roger Quadros
2018-11-26 22:37   ` David Lechner
2018-11-29 10:17     ` Roger Quadros
2018-12-18 15:51       ` Roger Quadros
2018-12-19 12:38         ` Mark Brown
2018-12-19 15:43           ` Roger Quadros
2018-12-19 15:48             ` David Lechner
2018-12-19 17:07               ` Mark Brown
2018-12-19 17:18                 ` Tony Lindgren
2018-12-20  8:45                   ` Roger Quadros
2018-11-26  7:52 ` [PATCH 06/16] dt-bindings: remoteproc: ti-pruss: Update bindings for supporting rpmsg Roger Quadros
2018-11-26  7:52 ` [PATCH 07/16] remoteproc/pru: Add support for virtio rpmsg stack Roger Quadros
2018-11-26  7:52 ` [PATCH 08/16] remoteproc/pru: Add pru_rproc_set_ctable() function Roger Quadros
2018-11-26  7:52 ` [PATCH 09/16] remoteproc/pru: add APIs to get and put the PRU cores Roger Quadros
2018-11-26  7:52 ` [PATCH 10/16] remoteproc/pru: add pru_rproc_get_id() API to retrieve the PRU id Roger Quadros
2018-11-26  7:52 ` [PATCH 11/16] soc: ti: pruss: add helper functions to set GPI mode, MII_RT_event and XFR Roger Quadros
2018-11-26  7:52 ` [PATCH 12/16] dt-bindings: remoteproc: ti-pruss: Document application node bindings Roger Quadros
2018-11-26 23:27   ` David Lechner
2018-11-29 10:07     ` Roger Quadros
2018-11-29 16:33       ` David Lechner
2018-11-30 11:42         ` Roger Quadros
2018-12-11 22:06   ` Rob Herring
2018-12-17 16:03     ` Roger Quadros
2018-11-26  7:52 ` [PATCH 13/16] remoteproc/pru: add support for configuring GPMUX based on client setup Roger Quadros
2018-11-26  7:52 ` [PATCH 14/16] remoteproc/pru: configure firmware " Roger Quadros
2018-11-26  7:52 ` [PATCH 15/16] remoteproc/pru: add support for parsing pru interrupt mapping from DT Roger Quadros
2018-11-26  7:52 ` [PATCH 16/16] remoteproc/pru: Add support for INTC Interrupt map resource Roger Quadros

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=e63ac3f9-8daf-af84-a200-4c5f40a1a3ed@lechnology.com \
    --to=david@lechnology.com \
    --cc=bcousson@baylibre.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jreeder@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=m-karicheri2@ti.com \
    --cc=nsaulnier@ti.com \
    --cc=nsekhar@ti.com \
    --cc=ohad@wizery.com \
    --cc=robh+dt@kernel.org \
    --cc=rogerq@ti.com \
    --cc=s-anna@ti.com \
    --cc=ssantosh@kernel.org \
    --cc=t-kristo@ti.com \
    --cc=tony@atomide.com \
    --cc=woods.technical@gmail.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