From patchwork Fri Jun 6 07:41:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bo Shen X-Patchwork-Id: 4310561 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E5715BEECB for ; Fri, 6 Jun 2014 07:45:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CC0C1201DD for ; Fri, 6 Jun 2014 07:45:06 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0583220155 for ; Fri, 6 Jun 2014 07:45:06 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WsonP-0002V4-2R; Fri, 06 Jun 2014 07:42:39 +0000 Received: from nasmtp01.atmel.com ([192.199.1.245] helo=DVREDG01.corp.atmel.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WsonC-0002RC-JH for linux-arm-kernel@lists.infradead.org; Fri, 06 Jun 2014 07:42:26 +0000 Received: from sjogate2.atmel.com (10.42.103.223) by DVREDG01.corp.atmel.com (10.42.103.30) with Microsoft SMTP Server id 14.2.347.0; Fri, 6 Jun 2014 01:41:56 -0600 Received: from Dev4Android.corp.atmel.com ([10.217.2.46]) by sjogate2.atmel.com (8.13.6/8.13.6) with ESMTP id s567YG4l018102; Fri, 6 Jun 2014 00:34:17 -0700 (PDT) From: Bo Shen To: Subject: [PATCH 1/2] misc: atmel-ssc: support to read ssc version Date: Fri, 6 Jun 2014 15:41:34 +0800 Message-ID: <1402040495-10320-1-git-send-email-voice.shen@atmel.com> X-Mailer: git-send-email 1.8.5.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140606_004226_664829_E6800B29 X-CRM114-Status: UNSURE ( 9.10 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) Cc: Bo Shen , alsa-devel@alsa-project.org, nicolas.ferre@atmel.com, linux-arm-kernel@lists.infradead.org, linux-sound@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Read SSC IP version to check whether it supports frame sync length extension feature. Signed-off-by: Bo Shen --- drivers/misc/atmel-ssc.c | 7 +++++++ include/linux/atmel-ssc.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c index 22de137..9f49bcb 100644 --- a/drivers/misc/atmel-ssc.c +++ b/drivers/misc/atmel-ssc.c @@ -136,6 +136,7 @@ static int ssc_probe(struct platform_device *pdev) struct resource *regs; struct ssc_device *ssc; const struct atmel_ssc_platform_data *plat_dat; + u32 version; ssc = devm_kzalloc(&pdev->dev, sizeof(struct ssc_device), GFP_KERNEL); if (!ssc) { @@ -173,8 +174,14 @@ static int ssc_probe(struct platform_device *pdev) clk_prepare_enable(ssc->clk); ssc_writel(ssc->regs, IDR, -1); ssc_readl(ssc->regs, SR); + version = ssc_readl(ssc->regs, VERSION); clk_disable_unprepare(ssc->clk); + if (version >= 0x300) + ssc->has_fslen_ext = 1; + else + ssc->has_fslen_ext = 0; + ssc->irq = platform_get_irq(pdev, 0); if (!ssc->irq) { dev_dbg(&pdev->dev, "could not get irq\n"); diff --git a/include/linux/atmel-ssc.h b/include/linux/atmel-ssc.h index 571a12e..9ee1b68 100644 --- a/include/linux/atmel-ssc.h +++ b/include/linux/atmel-ssc.h @@ -19,6 +19,7 @@ struct ssc_device { int user; int irq; bool clk_from_rk_pin; + int has_fslen_ext; }; struct ssc_device * __must_check ssc_request(unsigned int ssc_num); @@ -258,6 +259,8 @@ void ssc_free(struct ssc_device *ssc); #define SSC_IMR_TXSYN_SIZE 1 #define SSC_IMR_TXSYN_OFFSET 10 +#define SSC_VERSION 0x000000fc + /* SSC PDC Receive Pointer Register */ #define SSC_PDC_RPR 0x00000100