From patchwork Wed Jul 15 20:40:20 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: s-paulraj@ti.com X-Patchwork-Id: 35755 Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6FKgfgc018353 for ; Wed, 15 Jul 2009 20:42:41 GMT Received: from dlep34.itg.ti.com ([157.170.170.115]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id n6FKeOsh004025; Wed, 15 Jul 2009 15:40:29 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep34.itg.ti.com (8.13.7/8.13.7) with ESMTP id n6FKeNC0026666; Wed, 15 Jul 2009 15:40:23 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id B916380627; Wed, 15 Jul 2009 15:40:22 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dlep36.itg.ti.com (dlep36.itg.ti.com [157.170.170.91]) by linux.omap.com (Postfix) with ESMTP id 3F5FE80626 for ; Wed, 15 Jul 2009 15:40:21 -0500 (CDT) Received: from legion.dal.design.ti.com (localhost [127.0.0.1]) by dlep36.itg.ti.com (8.13.8/8.13.8) with ESMTP id n6FKeKtq022381; Wed, 15 Jul 2009 15:40:20 -0500 (CDT) Received: from gt5d9d821.telogy.design.ti.com (gt5d9d821.telogy.design.ti.com [158.218.100.23]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id n6FKeK913838; Wed, 15 Jul 2009 15:40:20 -0500 (CDT) Received: from gt5d9d821.telogy.design.ti.com (localhost.localdomain [127.0.0.1]) by gt5d9d821.telogy.design.ti.com (8.13.1/8.13.1) with ESMTP id n6FKeKSG001166; Wed, 15 Jul 2009 16:40:20 -0400 Received: (from a0866907@localhost) by gt5d9d821.telogy.design.ti.com (8.13.1/8.13.1/Submit) id n6FKeKwp001163; Wed, 15 Jul 2009 16:40:20 -0400 From: s-paulraj@ti.com To: davinci-linux-open-source@linux.davincidsp.com Date: Wed, 15 Jul 2009 16:40:20 -0400 Message-Id: <1247690420-1140-1-git-send-email-s-paulraj@ti.com> X-Mailer: git-send-email 1.6.0.4 Cc: Subject: [PATCH 5/6] DaVinci: DM646x: Adding Support for SPI X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.4 Precedence: list List-Id: davinci-linux-open-source.linux.davincidsp.com List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com From: Sandeep Paulraj The patch does the following 1) Adds a clock for SPI 2) Defines resources specific to DM646x SOC Signed-off-by: Sandeep Paulraj --- arch/arm/mach-davinci/dm646x.c | 53 +++++++++++++++++++++++++++ arch/arm/mach-davinci/include/mach/dm646x.h | 2 + 2 files changed, 55 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c index 50f01e0..66857ef 100644 --- a/arch/arm/mach-davinci/dm646x.c +++ b/arch/arm/mach-davinci/dm646x.c @@ -14,6 +14,7 @@ #include #include #include +#include #include @@ -28,6 +29,7 @@ #include #include #include +#include #include "clock.h" #include "mux.h" @@ -253,6 +255,12 @@ static struct clk emac_clk = { .lpsc = DM646X_LPSC_EMAC, }; +static struct clk spi0_clk = { + .name = "spi0", + .parent = &pll1_sysclk3, + .lpsc = DM646X_LPSC_SPI, +}; + static struct clk pwm0_clk = { .name = "pwm0", .parent = &pll1_sysclk3, @@ -338,6 +346,7 @@ struct davinci_clk dm646x_clks[] = { CLK(NULL, "mcasp1", &mcasp1_clk), CLK(NULL, "aemif", &aemif_clk), CLK("davinci_emac.1", NULL, &emac_clk), + CLK("spi_davinci.0", NULL, &spi0_clk), CLK(NULL, "pwm0", &pwm0_clk), CLK(NULL, "pwm1", &pwm1_clk), CLK(NULL, "timer0", &timer0_clk), @@ -349,6 +358,50 @@ struct davinci_clk dm646x_clks[] = { CLK(NULL, NULL, NULL), }; +static u64 dm646x_spi0_dma_mask = DMA_BIT_MASK(32); + +static struct davinci_spi_platform_data dm646x_spi0_pdata = { + .version = SPI_VERSION_1, + .num_chipselect = 2, + .clk_internal = 1, + .cs_hold = 1, + .intr_level = 0, + .poll_mode = 1, + .c2tdelay = 8, + .t2cdelay = 8, +}; + +static struct resource dm646x_spi0_resources[] = { + { + .start = 0x01c66800, + .end = 0x01c66fff, + .flags = IORESOURCE_MEM, + }, + { + .start = IRQ_DM646X_SPINT0, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device dm646x_spi0_device = { + .name = "spi_davinci", + .id = 0, + .dev = { + .dma_mask = &dm646x_spi0_dma_mask, + .coherent_dma_mask = DMA_BIT_MASK(32), + .platform_data = &dm646x_spi0_pdata, + }, + .num_resources = ARRAY_SIZE(dm646x_spi0_resources), + .resource = dm646x_spi0_resources, +}; + +void __init dm646x_init_spi0(struct spi_board_info *info, unsigned len) +{ + spi_register_board_info(info, len); + + platform_device_register(&dm646x_spi0_device); +} + static struct emac_platform_data dm646x_emac_pdata = { .ctrl_reg_offset = DM646X_EMAC_CNTRL_OFFSET, .ctrl_mod_reg_offset = DM646X_EMAC_CNTRL_MOD_OFFSET, diff --git a/arch/arm/mach-davinci/include/mach/dm646x.h b/arch/arm/mach-davinci/include/mach/dm646x.h index 0585484..498163f 100644 --- a/arch/arm/mach-davinci/include/mach/dm646x.h +++ b/arch/arm/mach-davinci/include/mach/dm646x.h @@ -25,5 +25,7 @@ void __init dm646x_init(void); void __init dm646x_init_mcasp0(struct snd_platform_data *pdata); void __init dm646x_init_mcasp1(struct snd_platform_data *pdata); +struct spi_board_info; +void dm646x_init_spi0(struct spi_board_info *info, unsigned len); #endif /* __ASM_ARCH_DM646X_H */