mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Kamoolkar, Mugdha" <mugdha@ti.com>
To: "'Ohad Ben-Cohen'" <ohad@wizery.com>,
	Kevin Hilman <khilman@deeprootsystems.com>,
	"Krishnamoorthy, Balaji T" <balajitk@ti.com>,
	"Kamat, Nishant" <nskamat@ti.com>
Cc: "linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	Greg KH <greg@kroah.com>, Tony Lindgren <tony@atomide.com>,
	"Cousson, Benoit" <b-cousson@ti.com>,
	Grant Likely <grant.likely@secretlab.ca>,
	"Kanigeri, Hari" <h-kanigeri2@ti.com>,
	"Anna, Suman" <s-anna@ti.com>, Simon Que <sque@ti.com>
Subject: RE: [PATCH 3/3] omap: add hwspinlock device
Date: Thu, 21 Oct 2010 14:06:59 +0530	[thread overview]
Message-ID: <B85A65D85D7EB246BE421B3FB0FBB5930233F94602@dbde02.ent.ti.com> (raw)
In-Reply-To: <AANLkTikdjtYtzhgM_=io3SFdUZq=8Xcc8n24bW=SFgTA@mail.gmail.com>

> <khilman@deeprootsystems.com> wrote:
> >> Let's take the i2c-omap for example.
> >>
> >> It sounds like it must have a predefined hwspinlock, but what if:
> >>
> >> 1. It will use omap_hwspinlock_request() to dynamically allocate
> a hwspinlock
> >> 2. Obviously, the hwspinlock id number must be communicated to
> the M3
> >> BIOS, so the i2c-omap will publish that id using a small shared
> memory
> >> entry that will be allocated for this sole purpose
> >> 3. we will make sure that 1+2 completes before the remote
> processor is
> >> taken out of reset
> >>
> >> This does not require any smart IPC and it will allow us to get
> rid of
> >> the omap_hwspinlock_request_specific() API and its early-callers
> >> requirement.
> >
> > Yes, that would indeed simplify things.
> 
> Balaji, Nishant, are you OK with this ?
> 
The problem with this approach is that the i2c driver would have to 
sync up on the shared memory location that it uses to share the 
information of the spinlock ID. What location would this be? How would 
the i2c driver on the m3 know about this location? Does this mean 
hard-coding of the shared memory address? If yes, then there would be 
an impact to users if they wanted to change their memory map. Any kind 
of hard-coding of this sort can be painful in such cases, especially 
if it happens in multiple drivers. On the other hand, hard-coding 
(reserving) spinlock IDs is a much safer option and does not impact 
anything else.

> It means that the I2C driver will dynamically get a hwspinlock and
> then it would need to announce the id of that hwspinlock before the
> M3
> is taken out of reset.
> 
> It will help us get rid of static allocations that will never scale
> nicely and static vs. dynamic allocation races.
> 
> >
> >> All we will be left to take care of is the order of the ->probe()
> >> execution (assuming we want both the i2c and the hwspinlock
> drivers to
> >> be device_initcall)
> >
> > I understand the dependency between i2c and hwspinlock for some
> > platforms with a shared i2c bus.  Besides that being a broken
> hardware
> > design, I can see the need for the i2c driver to take a hwspinlock
> for
> > i2c xfers, but why does the i2c driver need to take the hwspinlock
> at
> > probe time?
> 
> It doesn't; it just needs to reserve a hwspinlock, and for that, we
> need the hwspinlock driver in place.
> 
> >  Presumably, this is before the remote cores are executing
> > code.
> >
> >>>
> >>> This kind of thing needs to be done by platform_data function
> pointers,
> >>> as is done for every other driver that needs platform-specific
> driver
> >>> customization.
> >>
> >> Why would we need platform-specific function pointers here ? I'm
> not
> >> sure I'm following this one.
> >
> > So that board code (built-in) does not call the hwspinlock driver
> > (potentially a module.)
> >
> > The way to solve this is to have platform_data with function
> pointers,
> > so that when the driver's ->probe() is done, it can call cany
> custom
> > hooks registered by the board code.
> 
> Sorry, still not following.
> 
> Do you refer to the i2c driver calling the hwspinlcok_request
> function
> at probe time via platform_data function pointers ?
> 
> With the previous _request_specific() allocation API, the important
> issue to follow was the timing:  it had to be called before any
> driver
> gets the chance to call the dynamic _request() API.
> That's why we had to have early board code calling it. Obviously the
> hwspinlock instance would then had to be delivered to the driver via
> platform data.
> 
> But now, if we get rid of that static allocation method entirely,
> i2c_omap can just call hwspinlock_request() on probe(), but again,
> no
> pdata function pointers are involved because this API is
> EXPORT_SYMBOL'ed.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-
> omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Regards,
Mugdha

  parent reply	other threads:[~2010-10-21  8:37 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-18  7:44 [PATCH 0/3] Add OMAP hardware spinlock misc driver Ohad Ben-Cohen
2010-10-18  7:44 ` [PATCH 1/3] drivers: misc: add omap_hwspinlock driver Ohad Ben-Cohen
2010-10-19 15:46   ` Greg KH
2010-10-19 20:18     ` Ohad Ben-Cohen
2010-10-19 16:58   ` Kevin Hilman
2010-10-19 20:21     ` Ohad Ben-Cohen
2010-10-19 17:01   ` Grant Likely
2010-10-19 20:43     ` Ohad Ben-Cohen
2010-10-19 20:58       ` Arnd Bergmann
2010-10-19 21:57         ` Ohad Ben-Cohen
2010-10-19 17:16   ` Kevin Hilman
2010-10-20 13:00     ` Ohad Ben-Cohen
2010-10-20 18:18       ` Kevin Hilman
2010-10-19 17:21   ` Arnd Bergmann
2010-10-19 20:51     ` Ohad Ben-Cohen
2010-10-19 21:08       ` Arnd Bergmann
2010-10-20 22:43         ` Ohad Ben-Cohen
2010-10-21  9:04           ` Arnd Bergmann
2010-10-21 10:13             ` Ohad Ben-Cohen
2010-10-21 12:02               ` Arnd Bergmann
2010-10-22 17:00   ` Tony Lindgren
2010-10-18  7:44 ` [PATCH 2/3] OMAP4: hwmod data: Add hwspinlock Ohad Ben-Cohen
2010-10-18  7:44 ` [PATCH 3/3] omap: add hwspinlock device Ohad Ben-Cohen
2010-10-19 17:03   ` Kevin Hilman
2010-10-19 17:05     ` Grant Likely
2010-10-19 21:02     ` Ohad Ben-Cohen
2010-10-19 23:12       ` Grant Likely
2010-10-20 14:09         ` Ohad Ben-Cohen
2010-10-20 15:51           ` Grant Likely
2010-10-19 23:53       ` Kevin Hilman
2010-10-20  1:20         ` Ryan Mallon
2010-10-20 14:38         ` Ohad Ben-Cohen
2010-10-20 15:55           ` Grant Likely
2010-10-20 18:37           ` Kevin Hilman
2010-10-20 19:21             ` Ohad Ben-Cohen
2010-10-20 23:58               ` Kevin Hilman
2010-10-21  6:11                 ` Ohad Ben-Cohen
2010-10-21  8:36               ` Kamoolkar, Mugdha [this message]
2010-10-21  9:06                 ` Ohad Ben-Cohen
2010-10-22  9:59                   ` Kamoolkar, Mugdha
2010-10-22 11:16                     ` Ohad Ben-Cohen
2010-10-21 12:26                 ` Kanigeri, Hari
2010-10-22 10:14                   ` Kamoolkar, Mugdha
2010-10-22 16:56               ` Tony Lindgren
2010-10-22 17:03                 ` Grant Likely
2010-10-22 17:28                   ` Tony Lindgren
2010-10-24 17:54                 ` Ohad Ben-Cohen
2010-10-25 19:02                   ` Tony Lindgren
2010-10-26 11:54                     ` Ohad Ben-Cohen
2010-10-26 19:06                       ` Tony Lindgren
2010-10-18 12:46 ` [PATCH 0/3] Add OMAP hardware spinlock misc driver Peter Zijlstra
2010-10-18 13:35   ` Russell King - ARM Linux
2010-10-18 13:43     ` Peter Zijlstra
2010-10-18 14:28       ` Ohad Ben-Cohen
2010-10-18 14:33         ` Peter Zijlstra
2010-10-18 14:39           ` Ohad Ben-Cohen
2010-10-18 15:27       ` Catalin Marinas
2010-10-18 15:32         ` Peter Zijlstra
2010-10-18 15:35           ` Ohad Ben-Cohen
2010-10-18 15:48             ` Peter Zijlstra
2010-10-18 15:51           ` Catalin Marinas
2010-10-18 15:58             ` Peter Zijlstra
2010-10-19 23:31 ` Daniel Walker
2010-10-20  6:13   ` Ohad Ben-Cohen
2010-10-20 10:00     ` Ohad Ben-Cohen
2010-10-20 22:29       ` Bryan Huntsman
2010-10-20  9:53   ` Russell King - ARM Linux
2010-10-20 22:15     ` Daniel Walker

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=B85A65D85D7EB246BE421B3FB0FBB5930233F94602@dbde02.ent.ti.com \
    --to=mugdha@ti.com \
    --cc=akpm@linux-foundation.org \
    --cc=b-cousson@ti.com \
    --cc=balajitk@ti.com \
    --cc=grant.likely@secretlab.ca \
    --cc=greg@kroah.com \
    --cc=h-kanigeri2@ti.com \
    --cc=khilman@deeprootsystems.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=nskamat@ti.com \
    --cc=ohad@wizery.com \
    --cc=s-anna@ti.com \
    --cc=sque@ti.com \
    --cc=tony@atomide.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

all inboxes | Powered by JetHome®