From wpdster@gmail.com Wed Sep 07 20:07:50 2011
Received: from mail-fx0-f44.google.com ([209.85.161.44])
	by stoneboat.aleph1.co.uk with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16)
	(Exim 4.72) (envelope-from <wpdster@gmail.com>) id 1R1NTL-00087N-VS
	for balloon@balloonboard.org; Wed, 07 Sep 2011 20:07:50 +0100
Received: by fxe6 with SMTP id 6so891253fxe.31
	for <balloon@balloonboard.org>; Wed, 07 Sep 2011 12:07:38 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type:content-transfer-encoding;
	bh=seZQOSdFeoCKqRmhV29HI8NipaVUF4dm0feL6qA6fIQ=;
	b=LTW/EWDwI4GIwaa3FTOPEbV9eX8LGGwecxH/1R2qBDyosQj7U9eNEWqG8Bt1gu+BUl
	YLbi7UgfOhrZPczlJI87EFzEoVNtEpHgj/9wbvkcOlAHbU9J7ACpIxSeAL7dS794j1RF
	Qvvpzb38gS1wHbnBgiFF7p2jO1WlVkFp2dyU4=
Received: by 10.223.41.149 with SMTP id o21mr230407fae.19.1315422458258; Wed,
	07 Sep 2011 12:07:38 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.223.119.68 with HTTP; Wed, 7 Sep 2011 12:07:18 -0700 (PDT)
In-Reply-To: <E5B9DF95-E28F-4E4B-9EBF-09139A0CD10C@btconnect.com>
References: <CAF_dkJAWCUqyBxQ1p8SKQGygwLVkZx5vD8H+S+8xYiO47-5rhQ@mail.gmail.com>
	<E5B9DF95-E28F-4E4B-9EBF-09139A0CD10C@btconnect.com>
From: Patrick Doyle <wpdster@gmail.com>
Date: Wed, 7 Sep 2011 15:07:18 -0400
Message-ID: <CAF_dkJAaLTowydAw9HCEjkd2ONZ6hYC95isfOP3zhrKBwW61og@mail.gmail.com>
To: David Bisset <david_bisset@btconnect.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-SA-Exim-Connect-IP: 209.85.161.44
X-SA-Exim-Mail-From: wpdster@gmail.com
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
	stoneboat.aleph1.co.uk
X-Spam-Level: 
X-Spam-Status: No, score=-3.2 required=4.5 tests=AWL,BAYES_00,FREEMAIL_FROM,
	RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.1
X-SA-Exim-Version: 4.2.1 (built Mon, 22 Mar 2010 06:51:10 +0000)
X-SA-Exim-Scanned: Yes (on stoneboat.aleph1.co.uk)
Cc: balloon@balloonboard.org
Subject: Re: [Balloon] BALLOON3_AUX_NIRQ
X-BeenThere: balloon@balloonboard.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: Balloon List <balloon.balloonboard.org>
List-Unsubscribe: <http://balloonboard.org/mailman/options/balloon>,
	<mailto:balloon-request@balloonboard.org?subject=unsubscribe>
List-Archive: <http://balloonboard.org/lurker/list/balloon.html>
List-Post: <mailto:balloon@balloonboard.org>
List-Help: <mailto:balloon-request@balloonboard.org?subject=help>
List-Subscribe: <http://balloonboard.org/mailman/listinfo/balloon>,
	<mailto:balloon-request@balloonboard.org?subject=subscribe>
X-List-Received-Date: Wed, 07 Sep 2011 19:07:50 -0000

Thanks David,
I'll go see if I can find a 2.6.25 kernel someplace (kernel.org seems
to be down right now) and see if I can figure out what's changed.

--wpd


On Wed, Sep 7, 2011 at 2:58 PM, David Bisset <david_bisset@btconnect.com> w=
rote:
> Interesting.
> I had the AUX interrupt working but under 2.6.25, but since then this cod=
e has changed.
> I rebuilt the working driver under 2.6.39-4 last week it worked, all exce=
pt the interrupt. I put this down to my not being up to date.
> Interrupt names and the code in balloon.c have certainly changed between =
these versions.
> So I was about to start looking at this, but please go ahead on the assum=
ption that no one has had this working under any recent kernel and that bal=
loon.c may be in error.
> I'll not get to this till Friday, so feel free to beat me to it... :-)
>
> Kind Regards
>
> David
>
>
> On 7 Sep 2011, at 19:28, Patrick Doyle wrote:
>
>> While not trying to malign anybody, I am curious to learn if it is
>> possible that the AUX_NIRQ interrupt on the balloon3 board has never
>> been adequately tested.
>>
>> I ask because some of the code I see in arch/arm/mach-pxa/balloon3.c
>> looks just plain wrong, and because, right or wrong (I haven't even
>> gotten to that code yet), I can't seem to get my FPGA to generate an
>> interrupt that is serviced by my kernel.
>>
>> I will debug this problem differently depending on whether I should
>> assume that the code is known to work than I would if I don't have
>> that up front knowledge.
>>
>> The questionable code looks like:
>>
>> static void balloon3_irq_handler(unsigned int irq, struct irq_desc *desc=
)
>> {
>> =A0 =A0 =A0 unsigned long pending =3D __raw_readl(BALLOON3_INT_CONTROL_R=
EG) &
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 balloon3_irq_enabled;
>> =A0 =A0 =A0 do {
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* clear useless edge notification */
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (desc->chip->ack)
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 desc->chip->ack(BALLOON3_AUX=
_NIRQ);
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 while (pending) {
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 irq =3D BALLOON3_IRQ(0) + __=
ffs(pending);
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 generic_handle_irq(irq);
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 pending &=3D pending - 1;
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 pending =3D __raw_readl(BALLOON3_INT_CONTROL=
_REG) &
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 balloon3_irq=
_enabled;
>> =A0 =A0 =A0 } while (pending);
>> }
>>
>> The part that confuses me however is the line that reads:
>>
>> pending &=3D pending - 1;
>>
>> Shouldn't that be more like:
>>
>> pending &=3D ~(1 << (irq - BALLOON3_IRQ(0)))
>>
>> (I wouldn't do it exactly that way, but I'm just trying to make a point =
here).
>>
>> Feel free to tell me the code works fine in millions of applications
>> worldwide, and I'll continue down the path of assuming balloon3.c is
>> correct and my code is wrong.
>>
>> If I don't hear from anybody, I'm going to start assuming that
>> balloon3.c is questionable, fix things the way I think they should be
>> fixed, and submit a patch to the list.
>>
>> Oh yeah, for purely hysterical reasons, I'm working with the 2.6.37.6
>> kernel from the stock balloonboard tree, if that makes any difference.
>>
>> --wpd
>>
>> _______________________________________________
>> Balloon mailing list
>> Balloon@balloonboard.org
>> http://balloonboard.org/mailman/listinfo/balloon
>
>

