From patchwork Wed Jun 16 15:57:32 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Niebuhr X-Patchwork-Id: 106505 Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o5GFxRtf007153 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 16 Jun 2010 16:00:04 GMT Received: from dlep34.itg.ti.com ([157.170.170.115]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id o5GFvkth007483 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 16 Jun 2010 10:57:46 -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 o5GFvikO005707; Wed, 16 Jun 2010 10:57:46 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 7A04380627; Wed, 16 Jun 2010 10:57:44 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp51.itg.ti.com (dflp51.itg.ti.com [128.247.22.94]) by linux.omap.com (Postfix) with ESMTP id F10D08062B for ; Wed, 16 Jun 2010 10:57:42 -0500 (CDT) Received: from white.ext.ti.com (localhost [127.0.0.1]) by dflp51.itg.ti.com (8.13.7/8.13.7) with ESMTP id o5GFvfcR026038 for ; Wed, 16 Jun 2010 10:57:41 -0500 (CDT) Received: from psmtp.com (na3sys009amx259.postini.com [74.125.149.143]) by white.ext.ti.com (8.13.7/8.13.7) with SMTP id o5GFveOu014751 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 16 Jun 2010 10:57:40 -0500 Received: from source ([213.199.154.139]) (using TLSv1) by na3sys009amx259.postini.com ([74.125.148.10]) with SMTP; Wed, 16 Jun 2010 15:57:40 GMT Received: from mail53-db3-R.bigfish.com (10.3.81.245) by DB3EHSOBE001.bigfish.com (10.3.84.21) with Microsoft SMTP Server id 8.1.436.0; Wed, 16 Jun 2010 15:57:38 +0000 Received: from mail53-db3 (localhost.localdomain [127.0.0.1]) by mail53-db3-R.bigfish.com (Postfix) with ESMTP id 2E65E10A0629; Wed, 16 Jun 2010 15:57:38 +0000 (UTC) X-SpamScore: -6 X-BigFish: VS-6(zz1432Nzz1202hzzz2dh27ah43h) Received: from mail53-db3 (localhost.localdomain [127.0.0.1]) by mail53-db3 (MessageSwitch) id 127670385737806_22806; Wed, 16 Jun 2010 15:57:37 +0000 (UTC) Received: from DB3EHSMHS007.bigfish.com (unknown [10.3.81.251]) by mail53-db3.bigfish.com (Postfix) with ESMTP id 02DD215D804F; Wed, 16 Jun 2010 15:57:37 +0000 (UTC) Received: from efjdfwfs07.EFJDFW.local (12.5.72.193) by DB3EHSMHS007.bigfish.com (10.3.87.107) with Microsoft SMTP Server id 14.0.482.44; Wed, 16 Jun 2010 15:57:35 +0000 Received: from transmx01.transcrypt.local ([10.1.0.8]) by efjdfwfs07.EFJDFW.local with Microsoft SMTPSVC(6.0.3790.4675); Wed, 16 Jun 2010 10:57:34 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-Class: urn:content-classes:message MIME-Version: 1.0 Subject: RE: [PATCH 3/3] davinci: spi: modify platform data for updated SPIdriver Date: Wed, 16 Jun 2010 10:57:32 -0500 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PATCH 3/3] davinci: spi: modify platform data for updated SPIdriver Thread-Index: AcsNYnbYPzizPVrjQ5OB75KP/Z+MdwAB7+Pw References: <1275923348-8533-1-git-send-email-bniebuhr@efjohnson.com><1275923348-8533-2-git-send-email-bniebuhr@efjohnson.com><1275923348-8533-3-git-send-email-bniebuhr@efjohnson.com><1275923348-8533-4-git-send-email-bniebuhr@efjohnson.com> From: Brian Niebuhr To: "Nicolas Luna" X-OriginalArrivalTime: 16 Jun 2010 15:57:34.0085 (UTC) FILETIME=[A24E2350:01CB0D6C] X-Bypass-Agent: EF-1; X-Reverse-DNS: unknown X-pstn-neptune: 0/0/0.00/0 X-pstn-levels: (S:96.32324/99.90000 CV:99.9000 FC:95.5390 LC:95.5390 R:95.9108 P:95.9108 M:97.0282 C:98.6951 ) X-pstn-settings: 2 (0.5000:0.5000) s cv gt3 gt2 gt1 r p m c X-pstn-addresses: from [db-null] Cc: davinci-linux-open-source@linux.davincidsp.com X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: 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 X-Greylist: Sender succeeded STARTTLS authentication, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 16 Jun 2010 16:00:04 +0000 (UTC) diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/boa index 2ec3095..4ecae04 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include #include @@ -35,6 +37,7 @@ #include #include #include +#include #define DA850_EVM_PHY_MASK 0x1 #define DA850_EVM_MDIO_FREQUENCY 2200000 /* PHY bus frequency */ @@ -92,6 +95,59 @@ static struct platform_device da850_evm_norflash_device = { .resource = da850_evm_norflash_resource, }; +static struct mtd_partition spi_flash_partitions[] = { + [0] = { + .name = "U-Boot", + .offset = 0, + .size = SZ_256K, + .mask_flags = MTD_WRITEABLE, + }, + [1] = { + .name = "U-Boot Environment", + .offset = MTDPART_OFS_APPEND, + .size = SZ_64K, + .mask_flags = MTD_WRITEABLE, + }, + [2] = { + .name = "Linux", + .offset = MTDPART_OFS_NXTBLK, + .size = SZ_8M - (SZ_256K + SZ_64K + SZ_64K), + .mask_flags = 0, + }, +}; + +struct davinci_spi_config m25p64_spi_cfg = { + .odd_parity = 0, + .parity_enable = 0, + .intr_level = 1, + .io_type = SPI_IO_TYPE_DMA, + .wdelay = 0, + .timer_disable = 1, + .c2t_delay = 0, + .t2c_delay = 0, + .t2e_delay = 0, + .c2e_delay = 0, +}; + +static struct flash_platform_data spi_flash_data = { + .name = "m25p80", + .parts = spi_flash_partitions, + .nr_parts = ARRAY_SIZE(spi_flash_partitions), + .type = "m25p64", +}; + +static struct spi_board_info da850_spi_board_info[] = { + [0] = { + .modalias = "m25p80", + .platform_data = &spi_flash_data, + .controller_data = &m25p64_spi_cfg, + .mode = SPI_MODE_0, + .max_speed_hz = 30000000, + .bus_num = 1, + .chip_select = 0, + }, +}; + static struct davinci_pm_config da850_pm_pdata = { .sleepcount = 128, }; @@ -629,6 +685,61 @@ static int __init da850_evm_config_emac(void) } device_initcall(da850_evm_config_emac); +static struct davinci_spi_platform_data da850_spi_pdata1 = { + .version = SPI_VERSION_2, +}; + +static struct resource da850_spi_resources1[] = { + [0] = { + .start = 0x01F0E000, + .end = 0x01F0E000 + 0xfff, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = IRQ_DA8XX_SPINT1, + .end = IRQ_DA8XX_SPINT1, + .flags = IORESOURCE_IRQ, + }, + [2] = { + .start = EDMA_CTLR_CHAN(0, 18), + .end = EDMA_CTLR_CHAN(0, 18), + .flags = IORESOURCE_DMA | IORESOURCE_DMA_RX_CHAN, + }, + [3] = { + .start = EDMA_CTLR_CHAN(0, 19), + .end = EDMA_CTLR_CHAN(0, 19), + .flags = IORESOURCE_DMA | IORESOURCE_DMA_TX_CHAN, + }, + [4] = { + .start = 1, + .end = 1, + .flags = IORESOURCE_DMA | IORESOURCE_DMA_EVENT_Q, + }, +}; + +static struct platform_device da850_spi_pdev1 = { + .name = "spi_davinci", + .id = 1, + .resource = da850_spi_resources1, + .num_resources = ARRAY_SIZE(da850_spi_resources1), + .dev = { + .platform_data = &da850_spi_pdata1, + }, +}; + +static void __init da850_init_spi1(unsigned char* chip_sel, + unsigned int num_sel, struct spi_board_info *info, unsigned num_dev) +{ + struct davinci_spi_platform_data *pdata = + da850_spi_pdev1.dev.platform_data; + + spi_register_board_info(info, num_dev); + + pdata->chip_sel = chip_sel; + pdata->num_chipselect = num_sel; + platform_device_register(&da850_spi_pdev1); +} + static __init void da850_evm_init(void) { int ret; @@ -739,6 +850,9 @@ static __init void da850_evm_init(void) pr_warning("da850_evm_init: cpuidle registration failed: %d\n", ret); + da850_init_spi1(NULL, 1, da850_spi_board_info, + ARRAY_SIZE(da850_spi_board_info)); + ret = da850_register_pm(&da850_pm_device); if (ret) pr_warning("da850_evm_init: suspend registration failed: %d\n", diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c index 6b8331b..311c447 100644 --- a/arch/arm/mach-davinci/da850.c +++ b/arch/arm/mach-davinci/da850.c @@ -336,6 +336,13 @@ static struct clk aemif_clk = { .flags = ALWAYS_ENABLED, }; +static struct clk spi1_clk = { + .name = "spi1", + .parent = &pll0_sysclk2, + .lpsc = DA8XX_LPSC1_SPI1, + .gpsc = 1, +}; + static struct clk_lookup da850_clks[] = { CLK(NULL, "ref", &ref_clk), CLK(NULL, "pll0", &pll0_clk), @@ -377,6 +384,7 @@ static struct clk_lookup da850_clks[] = { CLK("da8xx_lcdc.0", NULL, &lcdc_clk), CLK("davinci_mmc.0", NULL, &mmcsd_clk), CLK(NULL, "aemif", &aemif_clk), + CLK("spi_davinci.1", NULL, &spi1_clk), CLK(NULL, NULL, NULL), };