From mboxrd@z Thu Jan 1 00:00:00 1970 From: Detlev Zundel Date: Mon, 08 Jun 2009 17:58:21 +0200 Subject: [U-Boot] [PATCH 1/3] mpc52xx: Add SPI driver. In-Reply-To: <1243416179-64368-1-git-send-email-gjb@semihalf.com> (Grzegorz Bernacki's message of "Wed, 27 May 2009 11:22:57 +0200") References: <1243416179-64368-1-git-send-email-gjb@semihalf.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Grzegorz, > Signed-off-by: Grzegorz Bernacki > --- > drivers/spi/Makefile | 1 + > drivers/spi/mpc52xx_spi.c | 108 +++++++++++++++++++++++++++++++++++++++++++++ > include/mpc5xxx.h | 18 +++++++ > 3 files changed, 127 insertions(+), 0 deletions(-) > create mode 100644 drivers/spi/mpc52xx_spi.c > > diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile > index 1350f3e..1272c17 100644 > --- a/drivers/spi/Makefile > +++ b/drivers/spi/Makefile > @@ -28,6 +28,7 @@ LIB := $(obj)libspi.a > COBJS-$(CONFIG_ATMEL_DATAFLASH_SPI) += atmel_dataflash_spi.o > COBJS-$(CONFIG_ATMEL_SPI) += atmel_spi.o > COBJS-$(CONFIG_BFIN_SPI) += bfin_spi.o > +COBJS-$(CONFIG_MPC52XX_SPI) += mpc52xx_spi.o > COBJS-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o > COBJS-$(CONFIG_MXC_SPI) += mxc_spi.o > COBJS-$(CONFIG_SOFT_SPI) += soft_spi.o > diff --git a/drivers/spi/mpc52xx_spi.c b/drivers/spi/mpc52xx_spi.c > new file mode 100644 > index 0000000..6dae7ad > --- /dev/null > +++ b/drivers/spi/mpc52xx_spi.c > @@ -0,0 +1,108 @@ > +/* > + * (C) Copyright 2009 > + * Frank Bodammer > + * (C) Copyright 2009 Semihalf, Grzegorz Bernacki > + * > + * See file CREDITS for list of people who contributed to this > + * project. > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of the GNU General Public License as > + * published by the Free Software Foundation; either version 2 of > + * the License, or (at your option) any later version. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + * You should have received a copy of the GNU General Public License > + * along with this program; if not, write to the Free Software > + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, > + * MA 02111-1307 USA > + */ > + > +#include > +#include > +#include > +#include > + > +void spi_init(void) > +{ > + struct mpc5xxx_spi *spi = (struct mpc5xxx_spi *)MPC5XXX_SPI; > + /* > + * Its important to use the correct order when initializing the > + * registers > + */ > + spi->ddr = 0x0F; /* set all SPI pins as output */ Here and below you want to use accessor macros - please check the whole patch. Cheers Detlev -- The latest code looks a bit similar to the old [linux] big-reader-locks hack (which got dropped for good many eons ago and with which i deny any involvement with, such as having authored it. [oh, did i say that out loud? crap.]), imple- mented cleanly and properly. -- Ingo Molnar <20090428124033.GA1655@elte.hu> -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de