Skip to contentSkip to conversation

tegra2: spi: Add SPI driver for Tegra2 SOC

PATCH New Simon Glass 2 participants 2 messages Nov 5, 2011 – Nov 6, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v4 3/8 tegra2: spi: Add SPI driver for Tegra2 SOC

From: Tom Warren <[email protected]>

This driver supports SPI on Tegra2, running at 48MHz.

---
Changes in v2:
- Update to support SPI mode and frequency
- Tidy driver according to comments, and tidy a little more

Changes in v3:
- Remove the replaced bus/cs check function
- Change (bitlen & 7) to (bitlen % 8)

Changes in v4:
- Put back the bus/cs check functions
- Remove verbose errors when wrong bus/cs is provided

 arch/arm/include/asm/arch-tegra2/tegra2.h     |    1 +
 arch/arm/include/asm/arch-tegra2/tegra2_spi.h |   76 +++++++
 board/nvidia/common/board.c                   |    4 +
 drivers/spi/Makefile                          |    1 +
 drivers/spi/tegra2_spi.c                      |  265 +++++++++++++++++++++++++
 5 files changed, 347 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-tegra2/tegra2_spi.h
 create mode 100644 drivers/spi/tegra2_spi.c
arch/arm/include/asm/arch-tegra2/tegra2.h +1 -0
index 742a75a..8941443 100644
@@ -38,6 +38,7 @@
 #define NV_PA_APB_UARTC_BASE	(NV_PA_APB_MISC_BASE + 0x6200)
 #define NV_PA_APB_UARTD_BASE	(NV_PA_APB_MISC_BASE + 0x6300)
 #define NV_PA_APB_UARTE_BASE	(NV_PA_APB_MISC_BASE + 0x6400)
+#define TEGRA2_SPI_BASE		(NV_PA_APB_MISC_BASE + 0xC380)
 #define NV_PA_PMC_BASE		0x7000E400
 #define NV_PA_CSITE_BASE	0x70040000
 
arch/arm/include/asm/arch-tegra2/tegra2_spi.h new file +76 -0

76 lines not on this page · raw message

board/nvidia/common/board.c +4 -0
index a2d45c1..2591ebc 100644
@@ -31,6 +31,7 @@
 #include <asm/arch/clock.h>
 #include <asm/arch/pinmux.h>
 #include <asm/arch/uart.h>
+#include <spi.h>
 #include "board.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -114,6 +115,9 @@ int board_init(void)
 	clock_init();
 	clock_verify();
 
+#ifdef CONFIG_TEGRA2_SPI
+	spi_init();
+#endif
 	/* boot param addr */
 	gd->bd->bi_boot_params = (NV_PA_SDRAM_BASE + 0x100);
 
drivers/spi/Makefile +1 -0
index 84ad6fa..0a06822 100644
@@ -42,6 +42,7 @@ COBJS-$(CONFIG_OMAP3_SPI) += omap3_spi.o
 COBJS-$(CONFIG_SOFT_SPI) += soft_spi.o
 COBJS-$(CONFIG_SH_SPI) += sh_spi.o
 COBJS-$(CONFIG_FSL_ESPI) += fsl_espi.o
+COBJS-$(CONFIG_TEGRA2_SPI) += tegra2_spi.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
drivers/spi/tegra2_spi.c new file +265 -0

265 lines not on this page · raw message

Signature · 1 line
1.7.3.1