Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6582d7b7376aa587d74b08c74457dc28abc1a9fa
Commit:     6582d7b7376aa587d74b08c74457dc28abc1a9fa
Parent:     da2d7f4bc578651455a7353995beb87db3cd8815
Author:     Magnus Damm <[EMAIL PROTECTED]>
AuthorDate: Wed Jan 23 16:21:18 2008 +0900
Committer:  Paul Mundt <[EMAIL PROTECTED]>
CommitDate: Mon Jan 28 16:24:46 2008 +0900

    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 <[EMAIL PROTECTED]>
    Signed-off-by: Paul Mundt <[EMAIL PROTECTED]>
---
 arch/sh/boards/renesas/rts7751r2d/setup.c |   42 +++++++++++++++++++++++++++++
 include/asm-sh/spi.h                      |   13 +++++++++
 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 8528616..3452b07 100644
--- a/arch/sh/boards/renesas/rts7751r2d/setup.c
+++ b/arch/sh/boards/renesas/rts7751r2d/setup.c
@@ -16,9 +16,12 @@
 #include <linux/sm501-regs.h>
 #include <linux/pm.h>
 #include <linux/fb.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/spi_bitbang.h>
 #include <asm/machvec.h>
 #include <asm/rts7751r2d.h>
 #include <asm/io.h>
+#include <asm/spi.h>
 
 static struct resource cf_ide_resources[] = {
        [0] = {
@@ -53,6 +56,43 @@ static struct platform_device cf_ide_device  = {
        },
 };
 
+static struct spi_board_info spi_bus[] = {
+       {
+               .modalias       = "rtc-r9701",
+               .max_speed_hz   = 1000000,
+               .mode           = SPI_MODE_3,
+       },
+};
+
+static void r2d_chip_select(struct sh_spi_info *spi, int cs, int state)
+{
+       BUG_ON(cs != 0);  /* Single Epson RTC-9701JE attached on CS0 */
+       ctrl_outw(state == BITBANG_CS_ACTIVE, PA_RTCCE);
+}
+
+static struct sh_spi_info spi_info = {
+       .num_chipselect = 1,
+       .chip_select = r2d_chip_select,
+};
+
+static struct resource spi_sh_sci_resources[] = {
+       {
+               .start  = 0xffe00000,
+               .end    = 0xffe0001f,
+               .flags  = IORESOURCE_MEM,
+       },
+};
+
+static struct platform_device spi_sh_sci_device  = {
+       .name           = "spi_sh_sci",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(spi_sh_sci_resources),
+       .resource       = spi_sh_sci_resources,
+       .dev    = {
+               .platform_data  = &spi_info,
+       },
+};
+
 static struct resource heartbeat_resources[] = {
        [0] = {
                .start  = PA_OUTPORT,
@@ -176,10 +216,12 @@ static struct platform_device *rts7751r2d_devices[] 
__initdata = {
 #endif
        &cf_ide_device,
        &heartbeat_device,
+       &spi_sh_sci_device,
 };
 
 static int __init rts7751r2d_devices_setup(void)
 {
+       spi_register_board_info(spi_bus, ARRAY_SIZE(spi_bus));
        return platform_add_devices(rts7751r2d_devices,
                                    ARRAY_SIZE(rts7751r2d_devices));
 }
diff --git a/include/asm-sh/spi.h b/include/asm-sh/spi.h
new file mode 100644
index 0000000..e96f5b0
--- /dev/null
+++ b/include/asm-sh/spi.h
@@ -0,0 +1,13 @@
+#ifndef __ASM_SPI_H__
+#define __ASM_SPI_H__
+
+struct sh_spi_info;
+
+struct sh_spi_info {
+       int                      bus_num;
+       int                      num_chipselect;
+
+       void (*chip_select)(struct sh_spi_info *spi, int cs, int state);
+};
+
+#endif /* __ASM_SPI_H__ */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to