From: viresh.kumar@st.com (Viresh Kumar)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] dma/amba-pl08x: add support for the Nomadik variant
Date: Tue, 10 Apr 2012 09:13:17 +0530 [thread overview]
Message-ID: <4F83AC55.3070900@st.com> (raw)
In-Reply-To: <1334004816-20219-1-git-send-email-linus.walleij@linaro.org>
On 4/10/2012 2:23 AM, Linus Walleij wrote:
> diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
> @@ -1934,6 +1943,24 @@ static int pl08x_probe(struct amba_device *adev, const struct amba_id *id)
> spin_lock_init(&ch->lock);
> ch->serving = NULL;
> ch->signal = -1;
> +
> + /*
> + * Nomadik variants can have channels that are locked
> + * down for the secure world only. Lock up these channels
> + * by perpetually serving a dummy virtual channel.
> + */
> + if (vd->nomadik) {
> + u32 val;
> +
> + val = readl(ch->base + PL080_CH_CONFIG);
> + if (val & (PL080N_CONFIG_ITPROT | PL080N_CONFIG_SECPROT)) {
> + dev_info(&adev->dev, "physical channel %d reserved "
> + "for secure access only\n", i);
Better not to break the print string. Go beyond 80 columns.
> + ch->locked = true;
> + } else
> + ch->locked = false;
> + }
> +
Memory for ch is allocated with kmalloc and so its default value is garbage.
So we must set locked to false in else part here.
> dev_dbg(&adev->dev, "physical channel %d is %s\n",
> i, pl08x_phy_channel_busy(ch) ? "BUSY" : "FREE");
> }
> @@ -2016,6 +2043,12 @@ static struct vendor_data vendor_pl080 = {
> .dualmaster = true,
> };
>
> +static struct vendor_data vendor_nomadik = {
> + .channels = 8,
> + .dualmaster = true,
> + .nomadik = true,
> +};
> +
> static struct vendor_data vendor_pl081 = {
> .channels = 2,
> .dualmaster = false,
> @@ -2036,9 +2069,9 @@ static struct amba_id pl08x_ids[] = {
> },
> /* Nomadik 8815 PL080 variant */
> {
> - .id = 0x00280880,
> + .id = 0x00280080,
Has this changed? How it worked earlier?
> .mask = 0x00ffffff,
> - .data = &vendor_pl080,
> + .data = &vendor_nomadik,
> },
> { 0, 0 },
> };
> diff --git a/include/linux/amba/pl08x.h b/include/linux/amba/pl08x.h
> index e64ce2c..0254901 100644
> --- a/include/linux/amba/pl08x.h
> +++ b/include/linux/amba/pl08x.h
> @@ -92,6 +92,8 @@ struct pl08x_bus_data {
> * right now
> * @serving: the virtual channel currently being served by this physical
> * channel
> + * @locked: channel unavailable for the system, e.g. dedicated to secure
> + * world
> */
> struct pl08x_phy_chan {
> unsigned int id;
> @@ -99,6 +101,7 @@ struct pl08x_phy_chan {
> spinlock_t lock;
> int signal;
> struct pl08x_dma_chan *serving;
> + bool locked;
> };
>
> /**
--
viresh
WARNING: multiple messages have this Message-ID (diff)
From: Viresh Kumar <viresh.kumar@st.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Vinod Koul <vinod.koul@intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Dan Williams <dan.j.williams@intel.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Russell King <linux@arm.linux.org.uk>,
Alim Akhtar <alim.akhtar@gmail.com>
Subject: Re: [PATCH 2/2] dma/amba-pl08x: add support for the Nomadik variant
Date: Tue, 10 Apr 2012 09:13:17 +0530 [thread overview]
Message-ID: <4F83AC55.3070900@st.com> (raw)
In-Reply-To: <1334004816-20219-1-git-send-email-linus.walleij@linaro.org>
On 4/10/2012 2:23 AM, Linus Walleij wrote:
> diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
> @@ -1934,6 +1943,24 @@ static int pl08x_probe(struct amba_device *adev, const struct amba_id *id)
> spin_lock_init(&ch->lock);
> ch->serving = NULL;
> ch->signal = -1;
> +
> + /*
> + * Nomadik variants can have channels that are locked
> + * down for the secure world only. Lock up these channels
> + * by perpetually serving a dummy virtual channel.
> + */
> + if (vd->nomadik) {
> + u32 val;
> +
> + val = readl(ch->base + PL080_CH_CONFIG);
> + if (val & (PL080N_CONFIG_ITPROT | PL080N_CONFIG_SECPROT)) {
> + dev_info(&adev->dev, "physical channel %d reserved "
> + "for secure access only\n", i);
Better not to break the print string. Go beyond 80 columns.
> + ch->locked = true;
> + } else
> + ch->locked = false;
> + }
> +
Memory for ch is allocated with kmalloc and so its default value is garbage.
So we must set locked to false in else part here.
> dev_dbg(&adev->dev, "physical channel %d is %s\n",
> i, pl08x_phy_channel_busy(ch) ? "BUSY" : "FREE");
> }
> @@ -2016,6 +2043,12 @@ static struct vendor_data vendor_pl080 = {
> .dualmaster = true,
> };
>
> +static struct vendor_data vendor_nomadik = {
> + .channels = 8,
> + .dualmaster = true,
> + .nomadik = true,
> +};
> +
> static struct vendor_data vendor_pl081 = {
> .channels = 2,
> .dualmaster = false,
> @@ -2036,9 +2069,9 @@ static struct amba_id pl08x_ids[] = {
> },
> /* Nomadik 8815 PL080 variant */
> {
> - .id = 0x00280880,
> + .id = 0x00280080,
Has this changed? How it worked earlier?
> .mask = 0x00ffffff,
> - .data = &vendor_pl080,
> + .data = &vendor_nomadik,
> },
> { 0, 0 },
> };
> diff --git a/include/linux/amba/pl08x.h b/include/linux/amba/pl08x.h
> index e64ce2c..0254901 100644
> --- a/include/linux/amba/pl08x.h
> +++ b/include/linux/amba/pl08x.h
> @@ -92,6 +92,8 @@ struct pl08x_bus_data {
> * right now
> * @serving: the virtual channel currently being served by this physical
> * channel
> + * @locked: channel unavailable for the system, e.g. dedicated to secure
> + * world
> */
> struct pl08x_phy_chan {
> unsigned int id;
> @@ -99,6 +101,7 @@ struct pl08x_phy_chan {
> spinlock_t lock;
> int signal;
> struct pl08x_dma_chan *serving;
> + bool locked;
> };
>
> /**
--
viresh
next prev parent reply other threads:[~2012-04-10 3:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-09 20:53 [PATCH 2/2] dma/amba-pl08x: add support for the Nomadik variant Linus Walleij
2012-04-09 20:53 ` Linus Walleij
2012-04-10 3:43 ` Viresh Kumar [this message]
2012-04-10 3:43 ` Viresh Kumar
2012-04-11 7:59 ` Linus Walleij
2012-04-11 7:59 ` Linus Walleij
2012-04-11 7:59 ` Viresh Kumar
2012-04-11 7:59 ` Viresh Kumar
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=4F83AC55.3070900@st.com \
--to=viresh.kumar@st.com \
--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 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.