From patchwork Tue Feb 22 13:37:04 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Williamson X-Patchwork-Id: 580441 Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1MDiTmI001556 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 22 Feb 2011 13:44:50 GMT Received: from dlep33.itg.ti.com ([157.170.170.112]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id p1MDcnV3013913 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 22 Feb 2011 07:39:10 -0600 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep33.itg.ti.com (8.13.7/8.13.7) with ESMTP id p1MDcmAL028464; Tue, 22 Feb 2011 07:38:48 -0600 (CST) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id C833C80626; Tue, 22 Feb 2011 07:38:47 -0600 (CST) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp53.itg.ti.com (dflp53.itg.ti.com [128.247.5.6]) by linux.omap.com (Postfix) with ESMTP id 7E49480639 for ; Tue, 22 Feb 2011 07:37:53 -0600 (CST) Received: from neches.ext.ti.com (localhost [127.0.0.1]) by dflp53.itg.ti.com (8.13.8/8.13.8) with ESMTP id p1MDbrSV020234 for ; Tue, 22 Feb 2011 07:37:53 -0600 (CST) Received: from psmtp.com (na3sys009amx258.postini.com [74.125.149.142]) by neches.ext.ti.com (8.13.7/8.13.7) with SMTP id p1MDbqwF010451 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 22 Feb 2011 07:37:52 -0600 Received: from source ([209.85.212.45]) (using TLSv1) by na3sys009amx258.postini.com ([74.125.148.10]) with SMTP; Tue, 22 Feb 2011 08:37:53 EST Received: by mail-vw0-f45.google.com with SMTP id 19so2757644vws.4 for ; Tue, 22 Feb 2011 05:37:52 -0800 (PST) Received: by 10.52.160.170 with SMTP id xl10mr3938990vdb.86.1298381871506; Tue, 22 Feb 2011 05:37:51 -0800 (PST) Received: from localhost.localdomain (rrcs-24-39-249-130.nys.biz.rr.com [24.39.249.130]) by mx.google.com with ESMTPS id l6sm2326746vcp.38.2011.02.22.05.37.50 (version=SSLv3 cipher=OTHER); Tue, 22 Feb 2011 05:37:51 -0800 (PST) From: Michael Williamson To: davinci-linux-open-source@linux.davincidsp.com Subject: [PATCH v3 9/9] davinci: add spi devices support for da830/omap-l137/am17x evm Date: Tue, 22 Feb 2011 08:37:04 -0500 Message-Id: <1298381824-7723-10-git-send-email-michael.williamson@criticallink.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1298381824-7723-1-git-send-email-michael.williamson@criticallink.com> References: <1298381824-7723-1-git-send-email-michael.williamson@criticallink.com> X-pstn-neptune: 1/1/1.00/86 X-pstn-levels: (S:99.90000/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.0750) s cv GT3 gt2 gt1 r p m c X-pstn-addresses: from [db-null] Cc: khilman@deeprootsystems.com, linux-arm-kernel@lists.infradead.org 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: , MIME-Version: 1.0 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.6 (demeter1.kernel.org [140.211.167.41]); Tue, 22 Feb 2011 13:44:50 +0000 (UTC) diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c index b52a3a1..93a47e3 100644 --- a/arch/arm/mach-davinci/board-da830-evm.c +++ b/arch/arm/mach-davinci/board-da830-evm.c @@ -20,6 +20,8 @@ #include #include #include +#include +#include #include #include @@ -30,6 +32,7 @@ #include #include #include +#include #define DA830_EVM_PHY_ID "" /* @@ -534,6 +537,81 @@ static struct edma_rsv_info da830_edma_rsv[] = { }, }; +static struct mtd_partition da830evm_spiflash_part[] = { + [0] = { + .name = "DSP-UBL", + .offset = 0, + .size = SZ_8K, + .mask_flags = MTD_WRITEABLE, + }, + [1] = { + .name = "ARM-UBL", + .offset = MTDPART_OFS_APPEND, + .size = SZ_16K + SZ_8K, + .mask_flags = MTD_WRITEABLE, + }, + [2] = { + .name = "U-Boot", + .offset = MTDPART_OFS_APPEND, + .size = SZ_256K - SZ_32K, + .mask_flags = MTD_WRITEABLE, + }, + [3] = { + .name = "U-Boot-Environment", + .offset = MTDPART_OFS_APPEND, + .size = SZ_16K, + .mask_flags = 0, + }, + [4] = { + .name = "Kernel", + .offset = MTDPART_OFS_APPEND, + .size = MTDPART_SIZ_FULL, + .mask_flags = 0, + }, +}; + +static struct flash_platform_data da830evm_spiflash_data = { + .name = "m25p80", + .parts = da830evm_spiflash_part, + .nr_parts = ARRAY_SIZE(da830evm_spiflash_part), + .type = "w25x32", +}; + +static struct davinci_spi_config da830evm_spiflash_cfg = { + .io_type = SPI_IO_TYPE_DMA, + .c2tdelay = 8, + .t2cdelay = 8, +}; + +static struct spi_board_info da830evm_spi_info[] = { + { + .modalias = "m25p80", + .platform_data = &da830evm_spiflash_data, + .controller_data = &da830evm_spiflash_cfg, + .mode = SPI_MODE_0, + .max_speed_hz = 30000000, + .bus_num = 0, + .chip_select = 0, + }, +}; + +static void __init da830evm_init_spi0(struct spi_board_info *info, unsigned len) +{ + int ret; + + ret = spi_register_board_info(info, len); + if (ret) + pr_warning("%s: failed to register board info : %d\n", + __func__, ret); + + da8xx_spi_pdata[0].num_chipselect = len; + + ret = da8xx_register_spi(0); + if (ret) + pr_warning("%s: failed to register spi 0 device : %d\n", + __func__, ret); +} + static __init void da830_evm_init(void) { struct davinci_soc_info *soc_info = &davinci_soc_info; @@ -590,6 +668,8 @@ static __init void da830_evm_init(void) ret = da8xx_register_rtc(); if (ret) pr_warning("da830_evm_init: rtc setup failed: %d\n", ret); + + da830evm_init_spi0(da830evm_spi_info, ARRAY_SIZE(da830evm_spi_info)); } #ifdef CONFIG_SERIAL_8250_CONSOLE