[U-Boot] [PATCH] spi: add support SuperH SPI module
Nobuhiro Iwamatsu
iwamatsu at nigauri.org
Mon Jan 17 11:28:32 CET 2011
Hi, Shioda-san.
2011/1/17 Yoshihiro Shimoda <yoshihiro.shimoda.uh at renesas.com>:
> SH7757 has SPI module. This patch supports it.
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh at renesas.com>
> ---
> drivers/spi/Makefile | 1 +
> drivers/spi/sh_spi.c | 295 ++++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 296 insertions(+), 0 deletions(-)
> create mode 100644 drivers/spi/sh_spi.c
>
> diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
> index e34a124..d582fbb 100644
> --- a/drivers/spi/Makefile
> +++ b/drivers/spi/Makefile
> @@ -37,6 +37,7 @@ COBJS-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
> COBJS-$(CONFIG_MXC_SPI) += mxc_spi.o
> COBJS-$(CONFIG_OMAP3_SPI) += omap3_spi.o
> COBJS-$(CONFIG_SOFT_SPI) += soft_spi.o
> +COBJS-$(CONFIG_SH_SPI) += sh_spi.o
>
> COBJS := $(COBJS-y)
> SRCS := $(COBJS:.o=.c)
> diff --git a/drivers/spi/sh_spi.c b/drivers/spi/sh_spi.c
> new file mode 100644
> index 0000000..89ea5e2
> --- /dev/null
> +++ b/drivers/spi/sh_spi.c
> @@ -0,0 +1,295 @@
> +/*
> + * SH SPI driver
> + *
> + * Copyright (C) 2011 Renesas Solutions Corp.
> + *
> + * 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; version 2 of the License.
> + *
> + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
> + *
> + */
> +
> +#include <common.h>
> +#include <malloc.h>
> +#include <spi.h>
> +#include <asm/io.h>
> +
> +#define SPI_TBR 0x00
> +#define SPI_RBR 0x00
> +#define SPI_CR1 0x08
> +#define SPI_CR2 0x10
> +#define SPI_CR3 0x18
> +#define SPI_CR4 0x20
> +
> +/* CR1 */
> +#define SPI_TBE 0x80
> +#define SPI_TBF 0x40
> +#define SPI_RBE 0x20
> +#define SPI_RBF 0x10
> +#define SPI_PFONRD 0x08
> +#define SPI_SSDB 0x04
> +#define SPI_SSD 0x02
> +#define SPI_SSA 0x01
> +
> +/* CR2 */
> +#define SPI_RSTF 0x80
> +#define SPI_LOOPBK 0x40
> +#define SH_SPI_CPOL 0x20
> +#define SH_SPI_CPHA 0x10
> +#define SPI_L1M0 0x08
> +
> +/* CR3 */
> +#define SPI_MAX_BYTE 0xFF
> +
> +/* CR4 */
> +#define SPI_TBEI 0x80
> +#define SPI_TBFI 0x40
> +#define SPI_RBEI 0x20
> +#define SPI_RBFI 0x10
> +#define SPI_WPABRT 0x04
> +#define SPI_SSS 0x01
> +
> +#define SPI_FIFO_SIZE 32
> +
Please add prefix of "SH_".
> +static void sh_spi_write(unsigned long data, unsigned long offset)
> +{
> + writel(data, CONFIG_SH_SPI_BASE + offset);
> +}
> +
<snip>
\> +
> +int spi_cs_is_valid(unsigned int bus, unsigned int cs)
> +{
> + return 1;
> +}
Why does this function return "1" every time?
> +
> +void spi_cs_activate(struct spi_slave *slave)
> +{
> +
> +}
> +
> +void spi_cs_deactivate(struct spi_slave *slave)
> +{
> +
> +}
> +
> --
> 1.7.1
Best regards,
Nobuhiro
--
Nobuhiro Iwamatsu
iwamatsu at {nigauri.org / debian.org}
GPG ID: 40AD1FA6
More information about the U-Boot
mailing list