From patchwork Mon Mar 15 16:26:11 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Westerberg X-Patchwork-Id: 85995 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2FGQUl4015200 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 15 Mar 2010 16:27:06 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1NrD7e-0007RQ-5i; Mon, 15 Mar 2010 16:26:30 +0000 Received: from sfi-mx-3.v28.ch3.sourceforge.com ([172.29.28.123] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1NrD7c-0007RI-Rj for spi-devel-general@lists.sourceforge.net; Mon, 15 Mar 2010 16:26:28 +0000 Received-SPF: pass (sfi-mx-3.v28.ch3.sourceforge.com: domain of gmail.com designates 72.14.220.156 as permitted sender) client-ip=72.14.220.156; envelope-from=mika.westerberg@gmail.com; helo=fg-out-1718.google.com; Received: from fg-out-1718.google.com ([72.14.220.156]) by sfi-mx-3.v28.ch3.sourceforge.com with esmtp (Exim 4.69) id 1NrD7b-00016H-Fd for spi-devel-general@lists.sourceforge.net; Mon, 15 Mar 2010 16:26:28 +0000 Received: by fg-out-1718.google.com with SMTP id e21so1093983fga.10 for ; Mon, 15 Mar 2010 09:26:21 -0700 (PDT) Received: by 10.87.73.13 with SMTP id a13mr10116062fgl.44.1268670381628; Mon, 15 Mar 2010 09:26:21 -0700 (PDT) Received: from localhost.localdomain (a88-115-42-115.elisa-laajakaista.fi [88.115.42.115]) by mx.google.com with ESMTPS id z10sm7344413fka.31.2010.03.15.09.26.20 (version=SSLv3 cipher=RC4-MD5); Mon, 15 Mar 2010 09:26:21 -0700 (PDT) From: Mika Westerberg To: spi-devel-general@lists.sourceforge.net Date: Mon, 15 Mar 2010 18:26:11 +0200 Message-Id: <3d93e748eb068963a9378b454ba9cd117cbbc737.1268669236.git.mika.westerberg@iki.fi> X-Mailer: git-send-email 1.5.6.5 In-Reply-To: <774b9c08b6e9484a2ca5084b8b6019aa18dddd99.1268669236.git.mika.westerberg@iki.fi> References: <774b9c08b6e9484a2ca5084b8b6019aa18dddd99.1268669236.git.mika.westerberg@iki.fi> In-Reply-To: References: X-Spam-Score: -1.5 (-) 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 X-Headers-End: 1NrD7b-00016H-Fd Cc: linux-arm-kernel@lists.infradead.org Subject: [spi-devel-general] [PATCH 2/3] ep93xx: added chip revision reading function 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 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 15 Mar 2010 16:27:06 +0000 (UTC) diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c index 90fb591..2e496c9 100644 --- a/arch/arm/mach-ep93xx/core.c +++ b/arch/arm/mach-ep93xx/core.c @@ -64,6 +64,32 @@ void __init ep93xx_map_io(void) iotable_init(ep93xx_io_desc, ARRAY_SIZE(ep93xx_io_desc)); } +/** + * ep93xx_chip_revision() - returns EP93xx chip revision + * + * Returns EP93xx chip revision number read from sysconfig register. Possible + * values can be one of the following: + * + * %EP93XX_CHIP_REV_A + * %EP93XX_CHIP_REV_B + * %EP93XX_CHIP_REV_C + * %EP93XX_CHIP_REV_D0 + * %EP93XX_CHIP_REV_D1 + * %EP93XX_CHIP_REV_E0 + * %EP93XX_CHIP_REV_E1 + * %EP93XX_CHIP_REV_E2 + * + * and in future maybe something else. See also . + */ +u8 ep93xx_chip_revision(void) +{ + u32 v; + + v = __raw_readl(EP93XX_SYSCON_SYSCFG); + v &= EP93XX_SYSCON_SYSCFG_REV_MASK; + v >>= EP93XX_SYSCON_SYSCFG_REV_SHIFT; + return (u8)v; +} /************************************************************************* * Timer handling for EP93xx diff --git a/arch/arm/mach-ep93xx/include/mach/platform.h b/arch/arm/mach-ep93xx/include/mach/platform.h index c6dc14d..8603837 100644 --- a/arch/arm/mach-ep93xx/include/mach/platform.h +++ b/arch/arm/mach-ep93xx/include/mach/platform.h @@ -33,6 +33,17 @@ static inline void ep93xx_devcfg_clear_bits(unsigned int bits) ep93xx_devcfg_set_clear(0x00, bits); } +#define EP93XX_CHIP_REV_A 0 +#define EP93XX_CHIP_REV_B 1 +#define EP93XX_CHIP_REV_C 2 +#define EP93XX_CHIP_REV_D0 3 +#define EP93XX_CHIP_REV_D1 4 +#define EP93XX_CHIP_REV_E0 5 +#define EP93XX_CHIP_REV_E1 6 +#define EP93XX_CHIP_REV_E2 7 + +u8 ep93xx_chip_revision(void); + void ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr); void ep93xx_register_i2c(struct i2c_gpio_platform_data *data, struct i2c_board_info *devices, int num);