From patchwork Wed Jul 15 15:27:52 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: 35714 Received: from devils.ext.ti.com (devils.ext.ti.com [198.47.26.153]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6FFS8XD030305 for ; Wed, 15 Jul 2009 15:28:08 GMT Received: from dlep33.itg.ti.com ([157.170.170.112]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id n6FFS1xY003169 for ; Wed, 15 Jul 2009 10:28:06 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep33.itg.ti.com (8.13.7/8.13.7) with ESMTP id n6FFS0U4011712 for ; Wed, 15 Jul 2009 10:28:00 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id DCC4B8063D for ; Wed, 15 Jul 2009 10:27:58 -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 E234380626 for ; Wed, 15 Jul 2009 10:27:53 -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 n6FFRr9F000458; Wed, 15 Jul 2009 10:27:53 -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 n6FFRr909201; Wed, 15 Jul 2009 10:27:53 -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 n6FFRqB7012992; Wed, 15 Jul 2009 11:27:52 -0400 Received: (from a0866907@localhost) by gt5d9d821.telogy.design.ti.com (8.13.1/8.13.1/Submit) id n6FFRq6b012989; Wed, 15 Jul 2009 11:27:52 -0400 From: s-paulraj@ti.com To: davinci-linux-open-source@linux.davincidsp.com Date: Wed, 15 Jul 2009 11:27:52 -0400 Message-Id: <1247671672-12966-1-git-send-email-s-paulraj@ti.com> X-Mailer: git-send-email 1.6.0.4 Cc: Subject: [PATCH] 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+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces+patchwork-davinci=patchwork.kernel.org@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 | 54 +++++++++++++++++++++++++++ arch/arm/mach-davinci/include/mach/dm646x.h | 2 + 2 files changed, 56 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c index 50f01e0..49d96c1 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,8 @@ #include #include #include +#include + #include "clock.h" #include "mux.h" @@ -253,6 +256,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 +347,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 +359,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 = DAVINCI_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 */