From: mporter@ti.com (Matt Porter)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 8/9] ARM: OMAP: iommu: add device tree support
Date: Tue, 2 Oct 2012 17:25:23 -0400 [thread overview]
Message-ID: <20121002212523.GA11180@beef> (raw)
In-Reply-To: <1347479152-588-9-git-send-email-omar.luna@linaro.org>
On Wed, Sep 12, 2012 at 02:45:51PM -0500, Omar Ramirez Luna wrote:
> Adapt driver to use DT if provided.
Hi Omar,
I'm interested in making use of the assert/deassert APIs you exposed in
this series on AM335x for the pruss hwmod which has one hardreset
line. I have the same situation where I need to get it deasserted before
I do any runtime PM. See my comments below...
> +static int __devinit
> +iommu_add_platform_data_from_dt(struct platform_device *pdev)
> +{
> + struct iommu_platform_data *pdata;
> + struct device_node *node = pdev->dev.of_node;
> + struct omap_hwmod *oh;
> + struct omap_mmu_dev_attr *a;
> + int ret = 0;
> +
> + pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
> + if (!pdata)
> + return -ENOMEM;
> +
> + of_property_read_string(node, "ti,hwmods", &pdata->name);
> + oh = omap_hwmod_lookup(pdata->name);
> + if (!oh) {
> + dev_err(&pdev->dev, "Cannot lookup hwmod '%s'\n", pdata->name);
> + ret = -ENODEV;
> + goto out;
> + }
> +
> + a = (struct omap_mmu_dev_attr *)oh->dev_attr;
> + pdata->nr_tlb_entries = a->nr_tlb_entries;
> + pdata->da_start = a->da_start;
> + pdata->da_end = a->da_end;
> +
> + if (oh->rst_lines_cnt == 1) {
> + pdata->reset_name = oh->rst_lines->name;
> + pdata->assert_reset = omap_device_assert_hardreset;
> + pdata->deassert_reset = omap_device_deassert_hardreset;
> + }
> +
> + ret = platform_device_add_data(pdev, pdata, sizeof(*pdata));
> + if (ret)
> + dev_err(&pdev->dev, "Cannot add pdata for %s\n", pdata->name);
> +
> +out:
> + kfree(pdata);
> +
> + return ret;
> +}
I can see why you went this path with the iommu driver as it already had
some integration code present here. I have some concerns going forward
about how this should be long-term. Take any platform booting only with
DT populated, we'd like to avoid having to use this approach where
platform private APIs are called via pdata. In fact, it's going to makes
thing ugly to carry any sort of pdata for a driver that's otherwise
driven exclusively from DT.
For AM335x, I can implement this approach, but it means adding some
pruss specific integration code just to have it create the pdata for
reset_name and assert/deassert.
>From reading all the threads on hardresets and OMAP, it seems we may not
be able to come up with a generic OMAP handler for these resets and
that's really reflected in the fact that this API exists. So given that,
it reasons that OMAP isn't the only one needing a reset API for drivers.
I'm thinking that (as trivial as it may seem), this support may need to
move to a reset subsystem such that drivers have a clean way to access
reset resources in an SoC.
I'm curious if you or others have thought about where this needs to go
next. When I first thought about a reset subsystem it seemed to trivial
to bother with but looking at the reasoning behind the power_seq
subsystem, it seems to have similar justification to get this machine
specific logic out of the platform code and under standardized control
of the driver. We have resources that are manipulated outside of the IP
block but need to be controlled at the driver level and probably should
have a common driver API that isn't OMAP specific and tied to pdata.
-Matt
next prev parent reply other threads:[~2012-10-02 21:25 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-12 19:45 [PATCH v2 0/9] OMAP: iommu: hwmod, reset handling and runtime PM Omar Ramirez Luna
2012-09-12 19:45 ` [PATCH v2 1/9] ARM: OMAP: iommu: fix including iommu.h without IOMMU_API selected Omar Ramirez Luna
2012-09-19 9:35 ` Laurent Pinchart
2012-09-19 21:01 ` Paul Walmsley
2012-09-12 19:45 ` [PATCH v2 2/9] ARM: OMAP3: hwmod data: add mmu data for iva and isp Omar Ramirez Luna
2012-09-19 21:35 ` Paul Walmsley
2012-09-21 0:30 ` Paul Walmsley
2012-09-12 19:45 ` [PATCH v2 3/9] ARM: OMAP4: hwmod data: add mmu hwmod for ipu and dsp Omar Ramirez Luna
2012-09-19 20:59 ` Paul Walmsley
2012-09-19 21:20 ` Cousson, Benoit
2012-09-19 21:31 ` Paul Walmsley
2012-09-12 19:45 ` [PATCH v2 4/9] ARM: OMAP3/4: iommu: migrate to hwmod framework Omar Ramirez Luna
2012-09-12 19:45 ` [PATCH v2 5/9] ARM: OMAP3/4: iommu: adapt to runtime pm Omar Ramirez Luna
2012-09-12 19:45 ` [PATCH v2 6/9] ARM: OMAP: iommu: pm runtime save and restore context Omar Ramirez Luna
2012-09-12 19:45 ` [PATCH v2 7/9] ARM: OMAP: iommu: optimize save and restore routines Omar Ramirez Luna
2012-09-18 18:04 ` Tony Lindgren
2012-09-19 0:53 ` Omar Ramirez Luna
2012-09-12 19:45 ` [PATCH v2 8/9] ARM: OMAP: iommu: add device tree support Omar Ramirez Luna
2012-10-02 21:25 ` Matt Porter [this message]
2012-10-03 21:13 ` Omar Ramirez Luna
2012-09-12 19:45 ` [PATCH v2 9/9] arm/dts: OMAP3/4: Add iommu nodes Omar Ramirez Luna
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=20121002212523.GA11180@beef \
--to=mporter@ti.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 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).