From: Steven King <sfking@fdwdc.com>
To: Ben Dooks <ben-linux@fluff.org>
Cc: Jean Delvare <khali@linux-fr.org>,
gerg@snapgear.com, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org, uclinux-dev@uclinux.org
Subject: Re: [PATCH v2] m68knommu: driver for Freescale Coldfire I2C controller.
Date: Mon, 25 Jan 2010 11:56:30 -0800 [thread overview]
Message-ID: <201001251156.31110.sfking@fdwdc.com> (raw)
In-Reply-To: <20100124151519.GB28675@fluff.org.uk>
On Sunday 24 January 2010 07:15:19 you wrote:
> On Mon, Jan 11, 2010 at 10:24:05AM -0800, Steven King wrote:
> > Changes for this version:
> > rename drivers/i2c/busses/i2c-mcf.c to drivers/i2c/busses/i2c-coldfire.c
> > use I2C_COLDFIRE in drivers/i2c/busses/{Kconfig,Makefile}
> >
> > ------
> >
> > Add support for the I2C controller used on Freescale/Motorola Coldfire
> > MCUs.
> >
> > Signed-off-by: Steven King <sfking@fdwdc.com>
>
> The commit messsage should go first, the changelog and other stuff
> that won't go in should go beflore the --- line.
My bad, I think I was paying more attention to making sure this mailer didn't
line wrap on me. I can repost if you want.
> > +static irqreturn_t mcfi2c_irq_handler(int this_irq, void *dev_id)
> > +{
> > + struct mcfi2c *mcfi2c = dev_id;
> > +
> > + /* clear interrupt */
> > + mcfi2c_wr_sr(mcfi2c, 0);
> > + complete(&mcfi2c->completion);
> > +
> > + return IRQ_HANDLED;
> > +}
>
> I'm interested in why you don't just handle the interrupt here and
> wake the thread once all the data is handled?
No particular reason; when I started working on this I looked at how some of
the other drivers in drivers/i2c/busses were implemented, found one whose
workings I could understand without knowing anything about that particular
SoC (which one I don't remember) and used it as a model to adapt the i2c code
I use with other Freescale/Motorola MCUs that don't run linux (there is very
little difference in the i2c controller on an 8-bit hc08, 16 bit hc11/12,
32bit Coldfire v1 and the Coldfire v2[+] that are currently supported). So
other than having easy to understand (for me atleast) code that shared a lot
of similarity with the code I use for the some of the other systems I code
for, no real reason. That and I find statefull irq handlers disconcerting.
> > + status = request_irq(mcfi2c->irq, mcfi2c_irq_handler, IRQF_DISABLED,
> > + pdev->name, mcfi2c);
>
> do you really need IRQF_DISABLED here? your irq handler hardly does
> anything.
Yes, without it, I was getting a spurious interrupt (been there, done that).
> > + if (status) {
> > + dev_dbg(&pdev->dev, "request_irq failed\n");
> > + goto fail2;
> > + }
> > +
> > + mcfi2c->clk = clk_get(&pdev->dev, "i2c_clk");
>
> hmm, think the default device clock should be findable by clk_get(dev,
> NULL).
Interesting. Again, I had looked at the existing code in drivers/i2c/busses
to see what the other drivers were doing and most were passing an id string.
Its a trivial change so its no big deal, but I'm curious, absent anything in
Documentation, if the bulk of the existing code isn't documentation for the
correct use of an api, then what is?
--
Steven King -- sfking at fdwdc dot com
next prev parent reply other threads:[~2010-01-25 20:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-11 0:00 [PATCH] " Steven King
2010-01-11 8:37 ` Jean Delvare
2010-01-11 18:24 ` [PATCH v2] " Steven King
2010-01-24 15:15 ` Ben Dooks
2010-01-25 19:56 ` Steven King [this message]
2010-03-12 11:04 ` [uClinux-dev] " Philippe De Muyter
2010-03-12 15:42 ` Lennart Sorensen
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=201001251156.31110.sfking@fdwdc.com \
--to=sfking@fdwdc.com \
--cc=ben-linux@fluff.org \
--cc=gerg@snapgear.com \
--cc=khali@linux-fr.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=uclinux-dev@uclinux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome