linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Jon Smirl" <jonsmirl@gmail.com>
To: benh@kernel.crashing.org
Cc: PowerPC dev list <Linuxppc-dev@ozlabs.org>
Subject: Re: Gianfar ethernet device
Date: Mon, 12 Nov 2007 16:25:55 -0500	[thread overview]
Message-ID: <9e4733910711121325k6006d7a5p99906971aa66e972@mail.gmail.com> (raw)
In-Reply-To: <9e4733910711111716oea3572fq9bc42221f805e11@mail.gmail.com>

On 11/11/07, Jon Smirl <jonsmirl@gmail.com> wrote:
> On 11/11/07, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> >
> > > The real solution is that gianfar support belongs in a device driver,
> > > not in a common file. That whole fsl_soc.c file is a catch-all of
> > > things that belong in device drivers. I haven't looked at every line
> > > in it, but 90%+ of the code should be moved into device drivers.
> > >
> > > I'm preparing a patch that moves the i2c driver out of fsl_soc.c and
> > > into i2c_mpc.c.
> >
> > The problem is how do you instantiate it. I'm working on some solution
> > for that but it's not there yet.

What's an example of a device that can't be instantiated?

>
> Are there powerpc platforms without device trees?
>
> Standard of_platform driver works fine to instantiate the i2c driver
> on mpc5200.
>
> static struct of_device_id mpc_i2c_of_match[] = {
>         {
>                 .compatible     = "fsl-i2c",
>         },
> };
> MODULE_DEVICE_TABLE(of, mpc_i2c_of_match);
>
> /* Structure for a device driver */
> static struct of_platform_driver mpc_i2c_driver = {
>         .match_table    = mpc_i2c_of_match,
>         .probe          = mpc_i2c_probe,
>         .remove         = __devexit_p(mpc_i2c_remove),
>         .driver         = {
>                 .owner  = THIS_MODULE,
>                 .name   = DRV_NAME,
>         },
> };
>
> static int __init mpc_i2c_init(void)
> {
>         int rv;
>
>         rv = of_register_platform_driver(&mpc_i2c_driver);
>         if (rv) {
>                 printk(KERN_ERR DRV_NAME " of_register_platform_driver failed (%i)\n", rv);
>                 return rv;
>         }
>         return 0;
> }
>
> module_init(mpc_i2c_init);
>
> ----------------------------------------------------------------------------------------------
>
> i2c and alsa soc core instantiate like this, asoc v2 is not in tree
> yet. These cores used to create platform drivers, but that was wrong,
> they don't have any hardware associated with them.
>
> static int __init i2c_init(void)
> {
>         int retval;
>
>         retval = bus_register(&i2c_bus_type);
>         if (retval)
>                 return retval;
>         return class_register(&i2c_adapter_class);
> }
>
> subsys_initcall(i2c_init);
>
> --
> Jon Smirl
> jonsmirl@gmail.com
>


-- 
Jon Smirl
jonsmirl@gmail.com

      parent reply	other threads:[~2007-11-12 21:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-11 23:11 Gianfar ethernet device Jon Smirl
2007-11-11 23:30 ` Jon Smirl
2007-11-12  0:04   ` Benjamin Herrenschmidt
2007-11-12  0:22     ` Jon Smirl
2007-11-12  0:30       ` Jon Smirl
2007-11-12  1:08       ` Benjamin Herrenschmidt
2007-11-12  1:16         ` Jon Smirl
2007-11-12  2:03           ` Benjamin Herrenschmidt
2007-11-12 21:25           ` Jon Smirl [this message]

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=9e4733910711121325k6006d7a5p99906971aa66e972@mail.gmail.com \
    --to=jonsmirl@gmail.com \
    --cc=Linuxppc-dev@ozlabs.org \
    --cc=benh@kernel.crashing.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;
as well as URLs for NNTP newsgroup(s).