From patchwork Mon Jul 28 12:44:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanwoo Choi X-Patchwork-Id: 4634181 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 81FE2C0338 for ; Mon, 28 Jul 2014 12:46:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 90A5E2017E for ; Mon, 28 Jul 2014 12:46:07 +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 B24FE2018B for ; Mon, 28 Jul 2014 12:46: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 1XBkI2-0003V2-Bk; Mon, 28 Jul 2014 12:44:30 +0000 Received: from mailout3.samsung.com ([203.254.224.33]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XBkHz-0003Jo-4G for linux-arm-kernel@lists.infradead.org; Mon, 28 Jul 2014 12:44:27 +0000 Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N9F004JLA1HTIA0@mailout3.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 28 Jul 2014 21:44:05 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.113]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id 66.5E.15745.59546D35; Mon, 28 Jul 2014 21:44:05 +0900 (KST) X-AuditID: cbfee691-b7f306d000003d81-22-53d64595331f Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id A2.B6.05196.59546D35; Mon, 28 Jul 2014 21:44:05 +0900 (KST) Received: from chan.10.32.193.11 ([10.252.81.195]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N9F00HZBA1GBE10@mmp1.samsung.com>; Mon, 28 Jul 2014 21:44:05 +0900 (KST) From: Chanwoo Choi To: jic23@kernel.org Subject: [PATCHv2 1/3] iio: adc: exynos_adc: add support for s3c64xx adc Date: Mon, 28 Jul 2014 21:44:00 +0900 Message-id: <1406551442-15186-2-git-send-email-cw00.choi@samsung.com> X-Mailer: git-send-email 1.8.0 In-reply-to: <1406551442-15186-1-git-send-email-cw00.choi@samsung.com> References: <1406551442-15186-1-git-send-email-cw00.choi@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrKIsWRmVeSWpSXmKPExsWyRsSkUHeq67Vgg33XtS3+TjrGbnH3+WFG i+tfnrNazD9yjtXi/6PXrBYPmlYxWfQuuMpmsev/G2aLs01v2C02Pb7GarGwbQmLxbwj71gs Lu+aw2Yx4/w+Jov1M16zOPB7/P41idHjw8c4j02rOtk8Ni+p9+jbsorRY/u1ecwenzfJBbBH cdmkpOZklqUW6dslcGXMfvGFtWCpZMX1FYeZGhj/iXQxcnJICJhInH16ihnCFpO4cG89Wxcj F4eQwFJGiWMHdrB2MXKAFU2YaQcRX8Qo8XHKL2YIp4lJYteE1+wg3WwCWhL7X9xgA7FFBEQk 7p3+wAhiMwv8ZJLY8bQIZJCwgIfE/j5rkDCLgKrEx65fYIt5BVwlzrYsZoc4Qk7iw55HYDan gJvEmh1bwWwhoJpPizrZQfZKCDxil9iy4CATxCABiW+TD7FAHCorsekA1DOSEgdX3GCZwCi8 gJFhFaNoakFyQXFSepGpX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Lrp8aN1yod0Gr1t3T+nwWB/xbFHb90tNRyX6n2RKB8ocWH0vYYmIn2fVMt5yzVXT FSUCzWbOX/KUgUtOqVquekqigPMTmRu56x8sUo1v7S26MHGCs9KvT/XWL3zUnj9IvST91Hrn d7G5Hl5ilYtnTd/1PqjwzOfzbIf9i4+xcccs5THPadecp8RSnJFoqMVcVJwIAPZkFXznAgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140728_054427_331804_04166604 X-CRM114-Status: GOOD ( 13.37 ) X-Spam-Score: -5.7 (-----) Cc: devicetree@vger.kernel.org, kgene.kim@samsung.com, heiko@sntech.de, arnd@arndb.de, linux-doc@vger.kernel.org, linux-iio@vger.kernel.org, t.figa@samsung.com, linux-kernel@vger.kernel.org, Chanwoo Choi , kyungmin.park@samsung.com, linux-samsung-soc@vger.kernel.org, knaack.h@gmx.de, ch.naveen@samsung.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 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.6 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 From: Arnd Bergmann The ADC in s3c64xx is almost the same as exynosv1, but has a different 'select' method. Adding this here will be helpful to move over the existing s3c64xx platform from the legacy plat-samsung/adc driver to the new exynos-adc. Signed-off-by: Arnd Bergmann Signed-off-by: Chanwoo Choi --- .../devicetree/bindings/arm/samsung/exynos-adc.txt | 2 ++ drivers/iio/adc/exynos_adc.c | 28 +++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt b/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt index adc61b0..d3dad46 100644 --- a/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt +++ b/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt @@ -16,6 +16,8 @@ Required properties: future controllers. Must be "samsung,exynos3250-adc" for controllers compatible with ADC of Exynos3250. + Must be "samsung,s3c6410-adc" for + the ADC in s3c6410 and compatibles - reg: Contains ADC register address range (base address and length) and the address of the phy enable register. - interrupts: Contains the interrupt information for the timer. The diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c index 87e0895..ed9e4c8 100644 --- a/drivers/iio/adc/exynos_adc.c +++ b/drivers/iio/adc/exynos_adc.c @@ -40,7 +40,7 @@ #include #include -/* EXYNOS4412/5250 ADC_V1 registers definitions */ +/* S3C/EXYNOS4412/5250 ADC_V1 registers definitions */ #define ADC_V1_CON(x) ((x) + 0x00) #define ADC_V1_DLY(x) ((x) + 0x08) #define ADC_V1_DATX(x) ((x) + 0x0C) @@ -61,6 +61,9 @@ #define ADC_V1_CON_PRSCLV(x) (((x) & 0xFF) << 6) #define ADC_V1_CON_STANDBY (1u << 2) +/* Bit definitions for S3C2410 ADC */ +#define ADC_S3C2410_CON_SELMUX(x) (((x) & 7) << 3) + /* Bit definitions for ADC_V2 */ #define ADC_V2_CON1_SOFT_RESET (1u << 2) @@ -217,6 +220,26 @@ static const struct exynos_adc_data const exynos_adc_v1_data = { .start_conv = exynos_adc_v1_start_conv, }; +static void exynos_adc_s3c64xx_start_conv(struct exynos_adc *info, + unsigned long addr) +{ + u32 con1; + + con1 = readl(ADC_V1_CON(info->regs)); + con1 &= ~ADC_S3C2410_CON_SELMUX(0x7); + con1 |= ADC_S3C2410_CON_SELMUX(addr); + writel(con1 | ADC_CON_EN_START, ADC_V1_CON(info->regs)); +} + +static struct exynos_adc_data const exynos_adc_s3c64xx_data = { + .num_channels = MAX_ADC_V1_CHANNELS, + + .init_hw = exynos_adc_v1_init_hw, + .exit_hw = exynos_adc_v1_exit_hw, + .clear_irq = exynos_adc_v1_clear_irq, + .start_conv = exynos_adc_s3c64xx_start_conv, +}; + static void exynos_adc_v2_init_hw(struct exynos_adc *info) { u32 con1, con2; @@ -285,6 +308,9 @@ static const struct exynos_adc_data const exynos3250_adc_data = { static const struct of_device_id exynos_adc_match[] = { { + .compatible = "samsung,s3c6410-adc", + .data = &exynos_adc_s3c64xx_data, + }, { .compatible = "samsung,exynos-adc-v1", .data = &exynos_adc_v1_data, }, {