[PATCH 1/6] spi/mpc8xxx: refactor the common code for SPI/eSPI controller

Grant Likely grant.likely at secretlab.ca
Mon Jul 26 16:48:11 EST 2010


On Mon, Jul 26, 2010 at 12:18 AM, Hu Mingkai-B21284
<B21284 at freescale.com> wrote:
>
>
>> -----Original Message-----
>> From: Grant Likely [mailto:glikely at secretlab.ca] On Behalf Of
>> Grant Likely
>> Sent: Monday, July 26, 2010 8:14 AM
>> To: Hu Mingkai-B21284; "@angua.secretlab.ca"@angua.secretlab.ca
>> Cc: linuxppc-dev at ozlabs.org; galak at kernel.crashing.org; Zang
>> Roy-R61911
>> Subject: Re: [PATCH 1/6] spi/mpc8xxx: refactor the common
>> code for SPI/eSPI controller
>>
>> On Tue, Jul 20, 2010 at 10:08:20AM +0800, Mingkai Hu wrote:
>> > Refactor the common code to file spi_mpc8xxx.c used by SPI/eSPI
>> > controller driver, move the SPI controller driver to a new file
>> > fsl_spi.c, and leave the QE/CPM SPI controller code in this file.
>> >
>> > Because the register map of the SPI controller and eSPI controller
>> > is so different, also leave the code operated the register to the
>> > driver code, not the common code.
>> >
>> > Signed-off-by: Mingkai Hu <Mingkai.hu at freescale.com>
>> > ---
>> >  drivers/spi/Kconfig       |   13 +-
>> >  drivers/spi/Makefile      |    1 +
>> >  drivers/spi/fsl_spi.c     | 1118
>> ++++++++++++++++++++++++++++++++++++++++++
>> >  drivers/spi/spi_mpc8xxx.c | 1198
>> ++-------------------------------------------
>> >  drivers/spi/spi_mpc8xxx.h |  135 +++++
>>
>> Please name files spi-*.[ch].  I'm going to start enforcing
>> this naming convention in the drivers/spi directory.
>>
>
> Ok.
>
>> >  5 files changed, 1299 insertions(+), 1166 deletions(-)
>> >  create mode 100644 drivers/spi/fsl_spi.c
>> >  create mode 100644 drivers/spi/spi_mpc8xxx.h
>> >
>> > diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
>> > index 91c2f4f..cd564e2 100644
>> > --- a/drivers/spi/Kconfig
>> > +++ b/drivers/spi/Kconfig
>> > @@ -183,11 +183,18 @@ config SPI_MPC512x_PSC
>> >       Controller in SPI master mode.
>> >
>> >  config SPI_MPC8xxx
>> > -   tristate "Freescale MPC8xxx SPI controller"
>> > +   bool
>>
>> This should be tristate so it can be loaded as a module.
>>
>
> This option is selected by FSL_SPI and FSL_ESPI option, can we load the
> driver as a module?

Yes.  You may need to export some symbols, but the common library can
be loaded as a module.

>> > +static void __exit fsl_spi_exit(void)
>> > +{
>> > +   of_unregister_platform_driver(&of_fsl_spi_driver);
>> > +   legacy_driver_unregister();
>> > +}
>>
>> It would appear that the legacy driver should *also* be
>> separated out into its own module.  I realize you're just cut
>> & pasting code here, but it should be considered for a followup patch.
>>
>
> Can we remove the legacy driver thoroughly?
> If we separated out the code, what's the proper name for it?
> spi_mpc8xxx_legacy.c?

Sure.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.


More information about the Linuxppc-dev mailing list