From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Message-ID: <9e4733910711121325k6006d7a5p99906971aa66e972@mail.gmail.com> Date: Mon, 12 Nov 2007 16:25:55 -0500 From: "Jon Smirl" To: benh@kernel.crashing.org Subject: Re: Gianfar ethernet device In-Reply-To: <9e4733910711111716oea3572fq9bc42221f805e11@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 References: <9e4733910711111511v36aa3504s3b55438698a4b4a8@mail.gmail.com> <9e4733910711111530g1f50d6e6hfaa76b4f051b5887@mail.gmail.com> <1194825876.18185.3.camel@pasglop> <9e4733910711111622v5ad6fdd2jd30989819d05615d@mail.gmail.com> <1194829680.18185.10.camel@pasglop> <9e4733910711111716oea3572fq9bc42221f805e11@mail.gmail.com> Cc: PowerPC dev list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On 11/11/07, Jon Smirl wrote: > On 11/11/07, Benjamin Herrenschmidt 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