All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
To: Michael Ellerman <mpe@ellerman.id.au>,
	Gregory Fong <gregory.0xf0@gmail.com>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: mpic IRQ_TYPE_BOTH handling
Date: Wed, 6 Sep 2017 09:34:31 +0000	[thread overview]
Message-ID: <59AFC126.30909@nxp.com> (raw)
In-Reply-To: <87efrs8y8q.fsf@concordia.ellerman.id.au>



On 08/31/2017 01:52 AM, Michael Ellerman wrote:
> Hi Gregory,
>
> Gregory Fong <gregory.0xf0@gmail.com> writes:
>> Hi all,
>>
>> In arch/powerpc/sysdev/mpic.c , it looks like IRQ_TYPE_EDGE_BOTH is
>> handled the same way as IRQ_TYPE_EDGE_FALLING:
>>
>> static unsigned int mpic_type_to_vecpri(struct mpic *mpic, unsigned int =
type)
>> {
>>          /* Now convert sense value */
>>          switch(type & IRQ_TYPE_SENSE_MASK) {
>>          case IRQ_TYPE_EDGE_RISING:
>>                  return MPIC_INFO(VECPRI_SENSE_EDGE) |
>>                         MPIC_INFO(VECPRI_POLARITY_POSITIVE);
>>          case IRQ_TYPE_EDGE_FALLING:
>>          case IRQ_TYPE_EDGE_BOTH:
>>                  return MPIC_INFO(VECPRI_SENSE_EDGE) |
>>                         MPIC_INFO(VECPRI_POLARITY_NEGATIVE);
>>          case IRQ_TYPE_LEVEL_HIGH:
>>                  return MPIC_INFO(VECPRI_SENSE_LEVEL) |
>>                         MPIC_INFO(VECPRI_POLARITY_POSITIVE);
>>          case IRQ_TYPE_LEVEL_LOW:
>>          default:
>>                  return MPIC_INFO(VECPRI_SENSE_LEVEL) |
>>                         MPIC_INFO(VECPRI_POLARITY_NEGATIVE);
>>          }
>> }
>>
>> If IRQ_TYPE_EDGE_BOTH is unsupported, shouldn't we be returning an
>> error, instead of silently setting to use IRQ_TYPE_EDGE_FALLING?
>> Something like the following (sorry if the diff wraps weirdly, on
>> webmail at the moment):
>
> I don't know this code so I asked Ben and he said something like
> "PowerMacs never use BOTH, so it hasn't mattered, but Freescale machines
> might".

IIRC, the mpic in freescale MPICs the interrupts are either low or high,=20
so not both. There's a bit which controls the interrupt polarity which=20
selects if the interrupt triggers on high-to-low or low-to-high.
So i guess it doesn't matter on freescale machines too.

---
Best Regards, Laurentiu=

WARNING: multiple messages have this Message-ID (diff)
From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
To: Michael Ellerman <mpe@ellerman.id.au>,
	Gregory Fong <gregory.0xf0@gmail.com>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: mpic IRQ_TYPE_BOTH handling
Date: Wed, 6 Sep 2017 09:34:31 +0000	[thread overview]
Message-ID: <59AFC126.30909@nxp.com> (raw)
In-Reply-To: <87efrs8y8q.fsf@concordia.ellerman.id.au>



On 08/31/2017 01:52 AM, Michael Ellerman wrote:
> Hi Gregory,
>
> Gregory Fong <gregory.0xf0@gmail.com> writes:
>> Hi all,
>>
>> In arch/powerpc/sysdev/mpic.c , it looks like IRQ_TYPE_EDGE_BOTH is
>> handled the same way as IRQ_TYPE_EDGE_FALLING:
>>
>> static unsigned int mpic_type_to_vecpri(struct mpic *mpic, unsigned int type)
>> {
>>          /* Now convert sense value */
>>          switch(type & IRQ_TYPE_SENSE_MASK) {
>>          case IRQ_TYPE_EDGE_RISING:
>>                  return MPIC_INFO(VECPRI_SENSE_EDGE) |
>>                         MPIC_INFO(VECPRI_POLARITY_POSITIVE);
>>          case IRQ_TYPE_EDGE_FALLING:
>>          case IRQ_TYPE_EDGE_BOTH:
>>                  return MPIC_INFO(VECPRI_SENSE_EDGE) |
>>                         MPIC_INFO(VECPRI_POLARITY_NEGATIVE);
>>          case IRQ_TYPE_LEVEL_HIGH:
>>                  return MPIC_INFO(VECPRI_SENSE_LEVEL) |
>>                         MPIC_INFO(VECPRI_POLARITY_POSITIVE);
>>          case IRQ_TYPE_LEVEL_LOW:
>>          default:
>>                  return MPIC_INFO(VECPRI_SENSE_LEVEL) |
>>                         MPIC_INFO(VECPRI_POLARITY_NEGATIVE);
>>          }
>> }
>>
>> If IRQ_TYPE_EDGE_BOTH is unsupported, shouldn't we be returning an
>> error, instead of silently setting to use IRQ_TYPE_EDGE_FALLING?
>> Something like the following (sorry if the diff wraps weirdly, on
>> webmail at the moment):
>
> I don't know this code so I asked Ben and he said something like
> "PowerMacs never use BOTH, so it hasn't mattered, but Freescale machines
> might".

IIRC, the mpic in freescale MPICs the interrupts are either low or high, 
so not both. There's a bit which controls the interrupt polarity which 
selects if the interrupt triggers on high-to-low or low-to-high.
So i guess it doesn't matter on freescale machines too.

---
Best Regards, Laurentiu

  reply	other threads:[~2017-09-06  9:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-03  1:43 mpic IRQ_TYPE_BOTH handling Gregory Fong
2017-08-30 22:52 ` Michael Ellerman
2017-09-06  9:34   ` Laurentiu Tudor [this message]
2017-09-06  9:34     ` Laurentiu Tudor

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=59AFC126.30909@nxp.com \
    --to=laurentiu.tudor@nxp.com \
    --cc=gregory.0xf0@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    /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.