aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMagnus Damm <magnus.damm@gmail.com>2008-01-23 02:21:18 -0500
committerPaul Mundt <lethal@linux-sh.org>2008-01-28 02:24:46 -0500
commit6582d7b7376aa587d74b08c74457dc28abc1a9fa (patch)
tree2f069e6ec29cdcfedb400b437dd8f02079410522
parentda2d7f4bc578651455a7353995beb87db3cd8815 (diff)
sh: add spi header and r2d platform data V3
This patch adds the header file asm/spi.h and board specific code for the r2d board. The header file contains a structure that should be used to point out a single spi bus. The board specific code for r2d is updated with such a structure for the new spi_sh_sci driver. The structure contains a chip select callback plus information about the R9701 rtc chip which is attached to the spi bus. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r--arch/sh/boards/renesas/rts7751r2d/setup.c42
-rw-r--r--include/asm-sh/spi.h13
2 files changed, 55 insertions, 0 deletions
diff --git a/arch/sh/boards/renesas/rts7751r2d/setup.c b/arch/sh/boards/renesas/rts7751r2d/setup.c
index 8528616feaa0..3452b072adde 100644
--- a/arch/sh/boards/renesas/rts7751r2d/setup.c
+++ b/arch/sh/boards/renesas/rts7751r2d/setup.c
@@ -16,9 +16,12 @@
16#include <linux/sm501-regs.h> 16#include <linux/sm501-regs.h>
17#include <linux/pm.h> 17#include <linux/pm.h>
18#include <linux/fb.h> 18#include <linux/fb.h>
19#include <linux/spi/spi.h>
20#include <linux/spi/spi_bitbang.h>
19#include <asm/machvec.h> 21#include <asm/machvec.h>
20#include <asm/rts7751r2d.h> 22#include <asm/rts7751r2d.h>
21#include <asm/io.h> 23#include <asm/io.h>
24#include <asm/spi.h>
22 25
23static struct resource cf_ide_resources[] = { 26static struct resource cf_ide_resources[] = {
24 [0] = { 27 [0] = {
@@ -53,6 +56,43 @@ static struct platform_device cf_ide_device = {
53 }, 56 },
54}; 57};
55 58
59static struct spi_board_info spi_bus[] = {
60 {
61 .modalias = "rtc-r9701",
62 .max_speed_hz = 1000000,
63 .mode = SPI_MODE_3,
64 },
65};
66
67static void r2d_chip_select(struct sh_spi_info *spi, int cs, int state)
68{
69 BUG_ON(cs != 0); /* Single Epson RTC-9701JE attached on CS0 */
70 ctrl_outw(state == BITBANG_CS_ACTIVE, PA_RTCCE);
71}
72
73static struct sh_spi_info spi_info = {
74 .num_chipselect = 1,
75 .chip_select = r2d_chip_select,
76};
77
78static struct resource spi_sh_sci_resources[] = {
79 {
80 .start = 0xffe00000,
81 .end = 0xffe0001f,
82 .flags = IORESOURCE_MEM,
83 },
84};
85
86static struct platform_device spi_sh_sci_device = {
87 .name = "spi_sh_sci",
88 .id = -1,
89 .num_resources = ARRAY_SIZE(spi_sh_sci_resources),
90 .resource = spi_sh_sci_resources,
91 .dev = {
92 .platform_data = &spi_info,
93 },
94};
95
56static struct resource heartbeat_resources[] = { 96static struct resource heartbeat_resources[] = {
57 [0] = { 97 [0] = {
58 .start = PA_OUTPORT, 98 .start = PA_OUTPORT,
@@ -176,10 +216,12 @@ static struct platform_device *rts7751r2d_devices[] __initdata = {
176#endif 216#endif
177 &cf_ide_device, 217 &cf_ide_device,
178 &heartbeat_device, 218 &heartbeat_device,
219 &spi_sh_sci_device,
179}; 220};
180 221
181static int __init rts7751r2d_devices_setup(void) 222static int __init rts7751r2d_devices_setup(void)
182{ 223{
224 spi_register_board_info(spi_bus, ARRAY_SIZE(spi_bus));
183 return platform_add_devices(rts7751r2d_devices, 225 return platform_add_devices(rts7751r2d_devices,
184 ARRAY_SIZE(rts7751r2d_devices)); 226 ARRAY_SIZE(rts7751r2d_devices));
185} 227}
diff --git a/include/asm-sh/spi.h b/include/asm-sh/spi.h
new file mode 100644
index 000000000000..e96f5b0953c8
--- /dev/null
+++ b/include/asm-sh/spi.h
@@ -0,0 +1,13 @@
1#ifndef __ASM_SPI_H__
2#define __ASM_SPI_H__
3
4struct sh_spi_info;
5
6struct sh_spi_info {
7 int bus_num;
8 int num_chipselect;
9
10 void (*chip_select)(struct sh_spi_info *spi, int cs, int state);
11};
12
13#endif /* __ASM_SPI_H__ */