From: Thierry Reding <thierry.reding@avionic-design.de>
To: "Philip, Avinash" <avinashphilip@ti.com>
Cc: "grant.likely@secretlab.ca" <grant.likely@secretlab.ca>,
"rob.herring@calxeda.com" <rob.herring@calxeda.com>,
"rob@landley.net" <rob@landley.net>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"devicetree-discuss@lists.ozlabs.org"
<devicetree-discuss@lists.ozlabs.org>,
"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
"Nori, Sekhar" <nsekhar@ti.com>,
"Hebbar, Gururaja" <gururaja.hebbar@ti.com>,
"Hiremath, Vaibhav" <hvaibhav@ti.com>
Subject: Re: [PATCH 1/2] pwm: pwm-tiecap: Add device-tree binding support for APWM driver
Date: Tue, 9 Oct 2012 14:48:30 +0200 [thread overview]
Message-ID: <20121009124830.GA25493@avionic-0098.mockup.avionic-design.de> (raw)
In-Reply-To: <518397C60809E147AF5323E0420B992E3E9CA82E@DBDE01.ent.ti.com>
[-- Attachment #1: Type: text/plain, Size: 3650 bytes --]
On Tue, Oct 09, 2012 at 12:36:53PM +0000, Philip, Avinash wrote:
> On Mon, Oct 08, 2012 at 19:09:51, Thierry Reding wrote:
> > On Mon, Oct 08, 2012 at 01:31:19PM +0000, Philip, Avinash wrote:
> > > On Tue, Oct 02, 2012 at 11:30:14, Thierry Reding wrote:
> > > > On Wed, Sep 26, 2012 at 04:57:42PM +0530, Philip, Avinash wrote:
> > [...]
> > > > > @@ -231,13 +290,56 @@ static int __devinit ecap_pwm_probe(struct platform_device *pdev)
> > > > > }
> > > > >
> > > > > pm_runtime_enable(&pdev->dev);
> > > > > +
> > > > > + /*
> > > > > + * Some platform has extra PWM-subsystem common config space
> > > > > + * and requires special handling of clock gating.
> > > > > + */
> > > > > + if (pdata && pdata->has_configspace) {
> > > > > + r = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> > > > > + if (!r) {
> > > > > + dev_err(&pdev->dev, "no memory resource defined\n");
> > > > > + ret = -ENODEV;
> > > > > + goto err_disable_clock;
> > > > > + }
> > > > > +
> > > > > + pc->config_base = devm_ioremap(&pdev->dev, r->start,
> > > > > + resource_size(r));
> > > > > + if (!pc->config_base) {
> > > > > + dev_err(&pdev->dev, "failed to ioremap() registers\n");
> > > > > + ret = -EADDRNOTAVAIL;
> > > > > + goto err_disable_clock;
> > > > > + }
> > > >
> > > > Isn't this missing a request_mem_region()? I assume you don't do that
> > > > here because you need the same region in the EHRPWM driver, right?
> > >
> > > request_mem_region() is avoided as this region is shared across PWM
> > > sub modules ECAP & EHRPWM.
> > >
> > > > This should be indication enough that the design is not right here.
> > > > I think we need a proper abstraction here. Can this not be done via
> > > > PM runtime support? If not, maybe this should be represented by
> > > > clock objects since the bit obviously enables a clock.
> > >
> > > It is not done as part of PM runtime as this is has nothing to
> > > do with clock tree of the SOC. The bits we were enabling here
> > > should consider as an enable of the individual sub module as
> > > part of IP integration. Hence we were handling these subsystem
> > > module enable in the driver itself.
> >
> > My point remains valid: you shouldn't be able to access the same
> > register through two different drivers. That's one of the reasons, if
> > not the only reasen, why the request_mem_region() function exists. I
> > think you should add some abstraction to provide this functionality to
> > the drivers. I assume that eventually there will be more than just the
> > PWM cores that require access to this register.
>
> Enabling of PWM sub modules from CONFIG space is only present in AM33xx
> as part of IP integration (ECAP, EHRPWM & EQEP).
>
> Enabling of sub modules (ECAP, EHRPWM & EQEP) should do in CONFIG space.
> Hence sub module drivers are accessing CONFIG space without reserving it
> Individually from drivers (request_mem_region()).
>
> Can you describe/point how it can be handled in a separate Abstraction layer
> as this is shared across ECAP, EHRPWM & EQEP (EQEP driver is not yet available).
Perhaps something like a global function to enable and disable the
clocks would be enough. You could for instance have a driver that
requests the config space memory region and provides this global
function so that it can be used by the ECAP, EHRPWM and EQEP.
A more elaborate scheme would possibly involve making the new device a
parent of the ECAP, EHRPWM and EQEP devices and have their drivers
lookup the parent to determine which configurator device to operate on.
Thierry
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2012-10-09 12:48 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-26 11:27 [PATCH 0/2] DT binding support for ECAP & EHRPWM driver Philip, Avinash
2012-09-26 11:27 ` [PATCH 1/2] pwm: pwm-tiecap: Add device-tree binding support for APWM driver Philip, Avinash
2012-10-02 6:00 ` Thierry Reding
2012-10-02 7:16 ` Sekhar Nori
[not found] ` <506A94C0.1010106-l0cyMroinI0@public.gmane.org>
2012-10-02 8:07 ` Thierry Reding
[not found] ` <20121002080751.GA16928-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-10-02 8:27 ` Sekhar Nori
2012-10-08 13:31 ` Philip, Avinash
2012-10-08 13:39 ` Thierry Reding
2012-10-09 12:36 ` Philip, Avinash
2012-10-09 12:48 ` Thierry Reding [this message]
2012-09-26 11:27 ` [PATCH 2/2] pwm: pwm-tiehrpwm: Add device-tree binding support for EHRPWM driver Philip, Avinash
[not found] ` <1348658863-29428-3-git-send-email-avinashphilip-l0cyMroinI0@public.gmane.org>
2012-10-02 6:11 ` Thierry Reding
2012-10-08 13:31 ` Philip, Avinash
2012-10-08 13:50 ` Thierry Reding
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=20121009124830.GA25493@avionic-0098.mockup.avionic-design.de \
--to=thierry.reding@avionic-design.de \
--cc=avinashphilip@ti.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=grant.likely@secretlab.ca \
--cc=gururaja.hebbar@ti.com \
--cc=hvaibhav@ti.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nsekhar@ti.com \
--cc=rob.herring@calxeda.com \
--cc=rob@landley.net \
/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).