All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
To: Hiroshi Doyu <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: "thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org"
	<thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>,
	"olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org"
	<olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>,
	"joerg.roedel-5C7GfCeVMHo@public.gmane.org"
	<joerg.roedel-5C7GfCeVMHo@public.gmane.org>,
	"grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org"
	<grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>,
	"rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org"
	<rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>,
	"linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org"
	<ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>,
	"iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org"
	<iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
	"devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org"
	<devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org>
Subject: Re: [PATCH v2] ARM: dt: tegra20: Add GART device
Date: Mon, 07 May 2012 10:06:46 -0600	[thread overview]
Message-ID: <4FA7F316.7070904@wwwdotorg.org> (raw)
In-Reply-To: <20120507.144758.1558303336683449254.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

On 05/07/2012 05:47 AM, Hiroshi Doyu wrote:
> Stephen Warren wrote at Fri, 4 May 2012 19:24:45 +0200:
...
>> Perhaps the simplest way is to represent those chunks as separate reg
>> entries:
>>
>>     mc@7000f010 {
>>         compatible = "nvidia,tegra30-mc";
>>         reg = <0x7000f010 0x1d4 0x70000228 0xd4>;
>>     };
>>
>>     smmu@0x70000050 {
>>         compatible = "nvidia,tegra30-smmu";
>>         reg = <0x70000010 0x2c 0x70000228 0x5c>;
>>     };
...
> Ok, let's start with the simplest way, and improve later with nice
> framework.

Uggh. So that patch is for the SMMU, but this thread is about the GART.
Also, attaching patches makes it more difficult to review them, since
them may not appear inline when reading the mail, and certainly don't
when replying. Anyway...

> diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c

> +#include <mach/tegra-ahb.h>

Note that this patch therefor depends on the AHB series that you just
posted, and isn't applied anywhere yet.

> +static int get_reg_bank(u32 offset)
>  {
> -	writel(val, smmu->regs + offs);
> +	int i;
> +	const struct smmu_reg_bank {
> +		u32 start;
> +		size_t size;
> +	} r[] = {
> +		{
> +			.start = 0x10,
> +			.size = 0x2c,
> +		},
> +		{
> +			.start = 0x1f0,
> +			.size = 0x10,
> +		},
> +		{
> +			.start = 0x228,
> +			.size = 0x5c,
> +		},
> +	};
> +
> +	for (i = 0; i < ARRAY_SIZE(r); i++) {
> +		BUG_ON(offset < r[i].start);
> +		if (offset < r[i].start + r[i].size)
> +			return i;
> +	}
> +	BUG();
> +	return 0; /* Never reach here */
>  }

While stylistically nice, I'm not sure that will be as likely to
optimize out as the simple if/else code I gave as an example. I suppose
it's not a big deal though.

>  static int tegra_smmu_probe(struct platform_device *pdev)

> +	err = of_get_dma_window(dev->of_node, "dma-window", 0, NULL,
> +				&base, &size);

So this also relies on the generic DMA window parsing patch too. I don't
think that's checked in anywhere yet right?

> +	size >>= SMMU_PAGE_SHIFT;
> +	if (!size)
> +		return -ENODEV;

It seems like this should validate that !(size & ((1 << SMMU_PAGE_SHIFT)
- 1)) too?

This patch looks like it adds the full implementation of device tree
support, yet doesn't add any documentation for the binding.

Finally, I assume you're going to post a similar patch for the Tegra20
GART, so its register ranges don't overlap the Tegra20 MC?

  parent reply	other threads:[~2012-05-07 16:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-16 15:04 [PATCH v2] ARM: dt: tegra20: Add GART device Thierry Reding
     [not found] ` <1334588670-15124-1-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2012-04-16 18:47   ` Stephen Warren
2012-05-03 18:28   ` Stephen Warren
     [not found]     ` <4FA2CE32.7010406-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-05-03 18:58       ` Stephen Warren
     [not found]         ` <4FA2D55F.2090708-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-05-04  5:23           ` Hiroshi Doyu
2012-05-04  5:23             ` Hiroshi Doyu
2012-05-04  9:13       ` Hiroshi Doyu
2012-05-04  9:13         ` Hiroshi Doyu
     [not found]         ` <20120504.121357.1085445784831612281.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-05-04 17:24           ` Stephen Warren
     [not found]             ` <4FA410DD.3090105-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-05-07 11:47               ` Hiroshi Doyu
     [not found]                 ` <20120507.144758.1558303336683449254.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-05-07 16:06                   ` Stephen Warren [this message]
     [not found]                     ` <4FA7F316.7070904-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-05-08  6:03                       ` Hiroshi Doyu
2012-05-08  6:09                       ` Hiroshi Doyu
2012-05-08  6:09                         ` Hiroshi Doyu

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=4FA7F316.7070904@wwwdotorg.org \
    --to=swarren-3lzwwm7+weoh9zmkesr00q@public.gmane.org \
    --cc=ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
    --cc=hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=joerg.roedel-5C7GfCeVMHo@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org \
    --cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org \
    --cc=thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@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.