[U-Boot] [PATCH 18/31] iMX28: Add SPI driver

Stefano Babic sbabic at denx.de
Fri Sep 9 10:51:17 CEST 2011


On 09/08/2011 10:42 PM, Marek Vasut wrote:
> Signed-off-by: Marek Vasut <marek.vasut at gmail.com>
> Cc: Stefano Babic <sbabic at denx.de>
> Cc: Wolfgang Denk <wd at denx.de>
> Cc: Detlev Zundel <dzu at denx.de>
> ---
>  drivers/spi/Makefile  |    1 +
>  drivers/spi/mxs_spi.c |  174 +++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 175 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/spi/mxs_spi.c


> diff --git a/drivers/spi/mxs_spi.c b/drivers/spi/mxs_spi.c
> new file mode 100644
> index 0000000..b9c2f06
> --- /dev/null
> +++ b/drivers/spi/mxs_spi.c

Ok - now I am sure and I agree with your choice. Please then use mxs
consequently in all files.

> @@ -0,0 +1,174 @@
> +/*
> + * Freescale i.MX28 SPI driver
> + *
> + * Copyright (C) 2011 Marek Vasut <marek.vasut at gmail.com>
> + * on behalf of DENX Software Engineering GmbH
> + *
> + * 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 <asm/errno.h>
> +#include <asm/io.h>
> +#include <asm/arch/clock.h>
> +#include <asm/arch/regs-common.h>
> +#include <asm/arch/regs-base.h>
> +#include <asm/arch/regs-clkctrl.h>
> +#include <asm/arch/regs-ssp.h>
> +#include <asm/arch/iomux-mx28.h>
> +#include <asm/arch/gpio.h>
> +#include <asm/arch/mx28.h>

General comment: drop this stuff and include only imx-regs.h

> +
> +#define	MXS_SPI_MAX_TIMEOUT	1000000
> +
> +static inline struct mx28_ssp_regs *to_mxs_regs(struct spi_slave *slave)
> +{
> +	return (struct mx28_ssp_regs *)(MXS_SSP0_BASE + (slave->bus * 0x2000));
> +}
> +
> +void spi_init(void)
> +{
> +}
> +
> +struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
> +				  unsigned int max_hz, unsigned int mode)
> +{

Only the CS supplied in the SOC are supported, it is not possible to use
a GPIO. Please add a comment to explain that.

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================


More information about the U-Boot mailing list