[U-Boot] [PATCH 1/3] mpc52xx: Add SPI driver.

Detlev Zundel dzu at denx.de
Mon Jun 8 17:58:21 CEST 2009


Hi Grzegorz,

> Signed-off-by: Grzegorz Bernacki <gjb at semihalf.com>
> ---
>  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 <frank.bodammer at gcd-solutions.de>
> + * (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 <common.h>
> +#include <malloc.h>
> +#include <spi.h>
> +#include <mpc5xxx.h>
> +
> +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 at 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


More information about the U-Boot mailing list