summaryrefslogtreecommitdiff
path: root/drivers/spi/sh_spi.h
diff options
context:
space:
mode:
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>2011-01-31 16:50:43 +0900
committerNobuhiro Iwamatsu <iwamatsu@nigauri.org>2011-02-02 16:38:41 +0900
commit6639562e6a7f2ae3160ef120d18b7796a2ff8e19 (patch)
treed3bb3e2b276669a59ce4c88a21273ef2c751a281 /drivers/spi/sh_spi.h
parent68260aab93afd7f4570d09cc63ed32752841039d (diff)
downloadu-boot-imx-6639562e6a7f2ae3160ef120d18b7796a2ff8e19.zip
u-boot-imx-6639562e6a7f2ae3160ef120d18b7796a2ff8e19.tar.gz
u-boot-imx-6639562e6a7f2ae3160ef120d18b7796a2ff8e19.tar.bz2
spi: add support SuperH SPI module
SH7757 has SPI module. This patch supports it. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Diffstat (limited to 'drivers/spi/sh_spi.h')
-rw-r--r--drivers/spi/sh_spi.h79
1 files changed, 79 insertions, 0 deletions
diff --git a/drivers/spi/sh_spi.h b/drivers/spi/sh_spi.h
new file mode 100644
index 0000000..b1cf98c
--- /dev/null
+++ b/drivers/spi/sh_spi.h
@@ -0,0 +1,79 @@
+/*
+ * 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
+ *
+ */
+
+#ifndef __SH_SPI_H__
+#define __SH_SPI_H__
+
+#include <spi.h>
+
+struct sh_spi_regs {
+ unsigned long tbr_rbr;
+ unsigned long resv1;
+ unsigned long cr1;
+ unsigned long resv2;
+ unsigned long cr2;
+ unsigned long resv3;
+ unsigned long cr3;
+ unsigned long resv4;
+ unsigned long cr4;
+};
+
+/* CR1 */
+#define SH_SPI_TBE 0x80
+#define SH_SPI_TBF 0x40
+#define SH_SPI_RBE 0x20
+#define SH_SPI_RBF 0x10
+#define SH_SPI_PFONRD 0x08
+#define SH_SPI_SSDB 0x04
+#define SH_SPI_SSD 0x02
+#define SH_SPI_SSA 0x01
+
+/* CR2 */
+#define SH_SPI_RSTF 0x80
+#define SH_SPI_LOOPBK 0x40
+#define SH_SPI_CPOL 0x20
+#define SH_SPI_CPHA 0x10
+#define SH_SPI_L1M0 0x08
+
+/* CR3 */
+#define SH_SPI_MAX_BYTE 0xFF
+
+/* CR4 */
+#define SH_SPI_TBEI 0x80
+#define SH_SPI_TBFI 0x40
+#define SH_SPI_RBEI 0x20
+#define SH_SPI_RBFI 0x10
+#define SH_SPI_WPABRT 0x04
+#define SH_SPI_SSS 0x01
+
+#define SH_SPI_FIFO_SIZE 32
+
+struct sh_spi {
+ struct spi_slave slave;
+ struct sh_spi_regs *regs;
+};
+
+static inline struct sh_spi *to_sh_spi(struct spi_slave *slave)
+{
+ return container_of(slave, struct sh_spi, slave);
+}
+
+#endif
+