All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Galea <michaelgalea@domain.hid>
To: rpm@xenomai.org
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] How can I make Xenomai share a mii bus with the kernel?
Date: Thu, 03 Jul 2008 16:32:58 -0400	[thread overview]
Message-ID: <486D377A.2050709@domain.hid> (raw)
In-Reply-To: <486CF405.4070206@domain.hid>

Philippe Gerum wrote:
> Gilles Chanteperdrix wrote:
>> Philippe Gerum wrote:
>>> Gilles Chanteperdrix wrote:
>>>> Michael Galea wrote:
>>>>> I wonder if someone can suggest an approach to the following problem.
>>>>>
>>>>> We need to use xenomai to manage devices on the mii bus.  The mii
>>>>> bus has PHYs managed by linux. What is the best way of providing
>>>>> access to both linux and xenomai?
>>>>>
>>>>> I know that before xenomai "loads", I can simply access the mii bus
>>>>> from linux.  But after xenomai loads, is the right answer to make
>>>>> the linux function that reads the phy migrate into the xenomai
>>>>> domain and contend for the bus there?
>>>> What protects this access to the bus, is this a mutex or a spinlock ?
>>>> If a spinlock, then simply make it an ipipe_spinlock, it will provide
>>>> mutual exclusion between all domains.
>>>>
>>> It's a spinlock_bh, but you can't tell actually, since there is a
>>> callback
>>> mechanism to perform the actual read depending on the bus implementation.
>>> Additionally, genphy_read may trigger an update from the link status
>>> and so on.
>>> I'm afraid this kind of sport may well resemble playing Russian
>>> roulette with a
>>> fully loaded gun. This said, if all executed code paths can be
>>> identified and
>>> fixed, why not (having fun).
>> I was talking about the actual implementation by the hardware driver,
>> not the generic part. This probably depends on the driver.
>>
>>
> 
> The drivers don't do much, except IRQ handling. Most of them route their
> requests to the generic PHY layer, therefore a parallel implementation would be
> needed. Still, concurrency on the bus would not be solved.
> 

My boards driver, ucc_geth_mii, seems to do even less. A write looks like.

/* Setting up the MII Mangement Address Register */
out_be32(&regs->miimadd, (mii_id << MIIMADD_PHY_ADDRESS_SHIFT) | regnum);

/* Setting up the MII Mangement Control Register with the value */
out_be32(&regs->miimcon, value);

/* Wait till MII management write is complete */
while ((in_be32(&regs->miimind)) & MIIMIND_BUSY) cpu_relax();

I imagine that this is what would have to move to a "parallel 
implementation" part.  Could I use the ipipe_spinlock to ensure 
exclusion between xenomai and linux for the bus?



  parent reply	other threads:[~2008-07-03 20:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-03 14:40 [Xenomai-help] How can I make Xenomai share a mii bus with the kernel? Michael Galea
2008-07-03 15:25 ` Gilles Chanteperdrix
2008-07-03 15:35   ` Philippe Gerum
2008-07-03 15:38     ` Gilles Chanteperdrix
2008-07-03 15:45       ` Philippe Gerum
2008-07-03 15:52         ` Gilles Chanteperdrix
2008-07-03 20:32         ` Michael Galea [this message]
2008-07-03 20:34           ` Gilles Chanteperdrix
2008-07-03 15:41   ` Michael Galea
2008-07-03 15:43     ` Gilles Chanteperdrix
2008-07-03 15:26 ` Philippe Gerum
2008-07-03 20:15   ` Michael Galea

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=486D377A.2050709@domain.hid \
    --to=michaelgalea@domain.hid \
    --cc=rpm@xenomai.org \
    --cc=xenomai@xenomai.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.