From patchwork Mon Dec 7 04:48:18 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cory Maccarrone X-Patchwork-Id: 65418 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nB74nwJA007785 for ; Mon, 7 Dec 2009 04:49:58 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1NHVXq-00063t-7x; Mon, 07 Dec 2009 04:49:58 +0000 Received: from sfi-mx-3.v28.ch3.sourceforge.com ([172.29.28.123] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1NHVXo-00063o-PW for spi-devel-general@lists.sourceforge.net; Mon, 07 Dec 2009 04:49:56 +0000 Received-SPF: pass (sfi-mx-3.v28.ch3.sourceforge.com: domain of gmail.com designates 209.85.222.193 as permitted sender) client-ip=209.85.222.193; envelope-from=darkstar6262@gmail.com; helo=mail-pz0-f193.google.com; Received: from mail-pz0-f193.google.com ([209.85.222.193]) by sfi-mx-3.v28.ch3.sourceforge.com with esmtp (Exim 4.69) id 1NHVXi-0005PD-69 for spi-devel-general@lists.sourceforge.net; Mon, 07 Dec 2009 04:49:56 +0000 Received: by pzk31 with SMTP id 31so3650922pzk.28 for ; Sun, 06 Dec 2009 20:49:44 -0800 (PST) Received: by 10.115.67.8 with SMTP id u8mr10442032wak.190.1260161383498; Sun, 06 Dec 2009 20:49:43 -0800 (PST) Received: from localhost (97-126-116-159.tukw.qwest.net [97.126.116.159]) by mx.google.com with ESMTPS id 21sm4874006pzk.3.2009.12.06.20.49.42 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 06 Dec 2009 20:49:43 -0800 (PST) From: Cory Maccarrone To: spi-devel-general@lists.sourceforge.net, linux-omap@vger.kernel.org Date: Sun, 6 Dec 2009 20:48:18 -0800 Message-Id: <1260161299-17656-3-git-send-email-darkstar6262@gmail.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1260161299-17656-1-git-send-email-darkstar6262@gmail.com> References: <1260161299-17656-1-git-send-email-darkstar6262@gmail.com> X-Spam-Score: -1.1 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record -0.0 DKIM_VERIFIED Domain Keys Identified Mail: signature passes verification 0.0 DKIM_SIGNED Domain Keys Identified Mail: message has a signature 0.4 AWL AWL: From: address is in the auto white-list X-Headers-End: 1NHVXi-0005PD-69 Subject: [spi-devel-general] [PATCH 2/3] [OMAP] Add spi100k configuration to OMAP1 X-BeenThere: spi-devel-general@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux SPI core/device drivers discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: spi-devel-general-bounces@lists.sourceforge.net diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c index dc8ca91..e584c0f 100644 --- a/arch/arm/mach-omap1/clock.c +++ b/arch/arm/mach-omap1/clock.c @@ -135,6 +135,10 @@ static struct omap_clk omap_clks[] = { CLK("i2c_omap.1", "fck", &i2c_fck, CK_16XX | CK_1510 | CK_310 | CK_7XX), CLK("i2c_omap.1", "ick", &i2c_ick, CK_16XX), CLK("i2c_omap.1", "ick", &dummy_ck, CK_1510 | CK_310 | CK_7XX), + CLK("omap1_spi100k.1", "fck", &dummy_ck, CK_7XX), + CLK("omap1_spi100k.1", "ick", &dummy_ck, CK_7XX), + CLK("omap1_spi100k.2", "fck", &dummy_ck, CK_7XX), + CLK("omap1_spi100k.2", "ick", &dummy_ck, CK_7XX), CLK("omap_uwire", "fck", &armxor_ck.clk, CK_16XX | CK_1510 | CK_310), CLK("omap-mcbsp.1", "ick", &dspper_ck, CK_16XX), CLK("omap-mcbsp.1", "ick", &dummy_ck, CK_1510 | CK_310), diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c index 23ded2d..9f1c1cc 100644 --- a/arch/arm/mach-omap1/devices.c +++ b/arch/arm/mach-omap1/devices.c @@ -24,6 +24,12 @@ #include #include +#if defined(CONFIG_SPI_OMAP_100K) +#include +#include +#include +#endif + /*-------------------------------------------------------------------------*/ #if defined(CONFIG_RTC_DRV_OMAP) || defined(CONFIG_RTC_DRV_OMAP_MODULE) @@ -196,6 +202,69 @@ void __init omap1_init_mmc(struct omap_mmc_platform_data **mmc_data, /*-------------------------------------------------------------------------*/ +/* OMAP7xx SPI support */ +#if defined(CONFIG_SPI_OMAP_100K) + +#include +#include +#include + +static struct omap_spi100k_platform_config omap_spi1_config = { + .num_cs = 2, +}; + +static struct resource omap_spi1_resources[] = { + { + .start = OMAP7XX_SPI1_BASE, + .end = OMAP7XX_SPI1_BASE + 0x7ff, + .flags = IORESOURCE_MEM, + }, +}; + +struct platform_device omap_spi1 = { + .name = "omap1_spi100k", + .id = 1, + .num_resources = ARRAY_SIZE(omap_spi1_resources), + .resource = omap_spi1_resources, + .dev = { + .platform_data = &omap_spi1_config, + }, +}; + +static struct omap_spi100k_platform_config omap_spi2_config = { + .num_cs = 2, +}; + +static struct resource omap_spi2_resources[] = { + { + .start = OMAP7XX_SPI2_BASE, + .end = OMAP7XX_SPI2_BASE + 0x7ff, + .flags = IORESOURCE_MEM, + }, +}; + +struct platform_device omap_spi2 = { + .name = "omap1_spi100k", + .id = 2, + .num_resources = ARRAY_SIZE(omap_spi2_resources), + .resource = omap_spi2_resources, + .dev = { + .platform_data = &omap_spi2_config, + }, +}; + +static void omap_init_spi100k(void) +{ + platform_device_register(&omap_spi1); + platform_device_register(&omap_spi2); +} + +#else +static inline void omap_init_spi100k(void) {} +#endif + +/*-------------------------------------------------------------------------*/ + #if defined(CONFIG_OMAP_STI) #define OMAP1_STI_BASE 0xfffea000 @@ -263,6 +332,7 @@ static int __init omap1_init_devices(void) omap_init_mbox(); omap_init_rtc(); + omap_init_spi100k(); omap_init_sti(); return 0; diff --git a/arch/arm/plat-omap/include/plat/omap7xx.h b/arch/arm/plat-omap/include/plat/omap7xx.h index 53f5241..48e4757 100644 --- a/arch/arm/plat-omap/include/plat/omap7xx.h +++ b/arch/arm/plat-omap/include/plat/omap7xx.h @@ -46,6 +46,9 @@ #define OMAP7XX_DSPREG_SIZE SZ_128K #define OMAP7XX_DSPREG_START 0xE1000000 +#define OMAP7XX_SPI1_BASE 0xfffc0800 +#define OMAP7XX_SPI2_BASE 0xfffc1000 + /* * ---------------------------------------------------------------------------- * OMAP7XX specific configuration registers diff --git a/arch/arm/plat-omap/include/plat/spi100k.h b/arch/arm/plat-omap/include/plat/spi100k.h new file mode 100644 index 0000000..a4e877f --- /dev/null +++ b/arch/arm/plat-omap/include/plat/spi100k.h @@ -0,0 +1,15 @@ +#ifndef _SPI100K_H +#define _SPI100K_H + +struct omap_spi100k_platform_config { + unsigned short num_cs; +}; + +struct omap_spi100k_device_config { + unsigned turbo_mode:1; + + /* Do we want one channel enabled at the same time? */ + unsigned single_channel:1; +}; +#endif /* _SPI100K_H */ +