From patchwork Tue Aug 19 23:52:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanwoo Choi X-Patchwork-Id: 4746291 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D749D9F344 for ; Tue, 19 Aug 2014 23:55:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E9A442015A for ; Tue, 19 Aug 2014 23:55:14 +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 DFC352014A for ; Tue, 19 Aug 2014 23:55:13 +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 1XJtDE-0001gm-Ng; Tue, 19 Aug 2014 23:53:12 +0000 Received: from mailout1.samsung.com ([203.254.224.24]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XJtDA-0001e5-Bg for linux-arm-kernel@lists.infradead.org; Tue, 19 Aug 2014 23:53:09 +0000 Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NAK00CMIVNXRL30@mailout1.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 20 Aug 2014 08:52:45 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.115]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id 04.85.19786.D43E3F35; Wed, 20 Aug 2014 08:52:45 +0900 (KST) X-AuditID: cbfee68e-b7fab6d000004d4a-65-53f3e34da4aa Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 0E.93.04943.C43E3F35; Wed, 20 Aug 2014 08:52:45 +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 <0NAK00MJWVNWR910@mmp1.samsung.com>; Wed, 20 Aug 2014 08:52:44 +0900 (KST) From: Chanwoo Choi To: rui.zhang@intel.com, eduardo.valentin@ti.com, amit.daniel@samsung.com Subject: [PATCHv3] thermal: exynos: Add support for TRIM_RELOAD feature at Exynos3250 Date: Wed, 20 Aug 2014 08:52:44 +0900 Message-id: <1408492364-8012-1-git-send-email-cw00.choi@samsung.com> X-Mailer: git-send-email 1.8.0 In-reply-to: <1408450078-6296-1-git-send-email-cw00.choi@samsung.com> References: <1408450078-6296-1-git-send-email-cw00.choi@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGIsWRmVeSWpSXmKPExsWyRsSkWNf38edggzOTuCwaroZYbJyxntXi 7vPDjBbXvzxntZh/5ByrxZr9P5ks5l+5xmrRu+Aqm8XZpjfsFm8ebma02PQYKHZ51xw2i8+9 RxgtZpzfx2Tx5GEfm8X6Ga9ZHAQ8ds66y+6xeM9LJo/NS+o9+rasYvQ4fmM7k8fnTXIBbFFc NimpOZllqUX6dglcGafPLWEquKFW8bhrKnMDY5diFyMHh4SAicStBz5djJxAppjEhXvr2boY uTiEBJYySmw/dI8JImEicXPFViaIxCJGie5nJ6GcJiaJxZsOsoNUsQloSex/cYMNxBYR8JSY M/0EC4jNLNDGLDFpZgKILSwQLvF7UgsriM0ioCrx5NQ1sBpeAReJS8d+MUJsk5P4sOcR2ExO AVeJ9m8HwWYKAdV8vrSYHWSxhMA9dolN948xQgwSkPg2+RALxDuyEpsOMEPM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piSWp2ampBalFMH1MHJxS DYzHQwqVgi6v+FAxkcVZ17vhj3fDgj1h2z51VOsJcJWX652TzQzmnx48V9NhZlWIbfv5g8+f 5XFamTgIMLE5yb1foCxYmSCk4HHozard0xh/n4x8H/Z3V8Yyw/prJ6YLqUwSZ5U6cqda68zv FdvPr9xw2jXocMzJ9z6Lvkku3Liee+/LF5p/XyxQYinOSDTUYi4qTgQAUgs8kukCAAA= 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-20140819_165308_546267_C496FAAF X-CRM114-Status: GOOD ( 14.44 ) X-Spam-Score: -5.7 (-----) Cc: devicetree@vger.kernel.org, l.majewski@samsung.com, kgene.kim@samsung.com, b.zolnierkie@samsung.com, t.figa@samsung.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Eduardo Valentin , Chanwoo Choi , kyungmin.park@samsung.com, linux-samsung-soc@vger.kernel.org, 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, RCVD_IN_DNSWL_NONE, 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 This patch add support for TRIM_RELOAD feature at Exynos3250. The TMU of Exynos3250 has two TRIMINFO_CON register. Signed-off-by: Chanwoo Choi Acked-by: Kyungmin Park Cc: Zhang Rui Cc: Eduardo Valentin Cc: Amit Daniel Kachhap Reviewed-by: Amit Daniel Kachhap --- Changes from v2: - Fix build break because of missing 'or' operation. Changes from v1: - Add missing 'TMU_SUPPORT_TRIM_RELOAD' feature drivers/thermal/samsung/exynos_tmu.c | 7 +++++-- drivers/thermal/samsung/exynos_tmu.h | 5 +++-- drivers/thermal/samsung/exynos_tmu_data.c | 11 +++++++++-- drivers/thermal/samsung/exynos_tmu_data.h | 7 +++++-- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index acbff14..ed01606 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -164,8 +164,11 @@ static int exynos_tmu_initialize(struct platform_device *pdev) } } - if (TMU_SUPPORTS(pdata, TRIM_RELOAD)) - __raw_writel(1, data->base + reg->triminfo_ctrl); + if (TMU_SUPPORTS(pdata, TRIM_RELOAD)) { + for (i = 0; i < pdata->triminfo_reload_count; i++) + __raw_writel(pdata->triminfo_reload[i], + data->base + reg->triminfo_ctrl[i]); + } if (pdata->cal_mode == HW_MODE) goto skip_calib_data; diff --git a/drivers/thermal/samsung/exynos_tmu.h b/drivers/thermal/samsung/exynos_tmu.h index 1b4a644..72cb54e 100644 --- a/drivers/thermal/samsung/exynos_tmu.h +++ b/drivers/thermal/samsung/exynos_tmu.h @@ -151,8 +151,7 @@ struct exynos_tmu_registers { u32 triminfo_25_shift; u32 triminfo_85_shift; - u32 triminfo_ctrl; - u32 triminfo_ctrl1; + u32 triminfo_ctrl[2]; u32 triminfo_reload_shift; u32 tmu_ctrl; @@ -295,6 +294,8 @@ struct exynos_tmu_platform_data { u8 second_point_trim; u8 default_temp_offset; u8 test_mux; + u8 triminfo_reload[2]; + u8 triminfo_reload_count; enum calibration_type cal_type; enum calibration_mode cal_mode; diff --git a/drivers/thermal/samsung/exynos_tmu_data.c b/drivers/thermal/samsung/exynos_tmu_data.c index aa8e0de..8cd609c 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.c +++ b/drivers/thermal/samsung/exynos_tmu_data.c @@ -95,6 +95,8 @@ static const struct exynos_tmu_registers exynos3250_tmu_registers = { .triminfo_data = EXYNOS_TMU_REG_TRIMINFO, .triminfo_25_shift = EXYNOS_TRIMINFO_25_SHIFT, .triminfo_85_shift = EXYNOS_TRIMINFO_85_SHIFT, + .triminfo_ctrl[0] = EXYNOS_TMU_TRIMINFO_CON1, + .triminfo_ctrl[1] = EXYNOS_TMU_TRIMINFO_CON2, .tmu_ctrl = EXYNOS_TMU_REG_CONTROL, .test_mux_addr_shift = EXYNOS4412_MUX_ADDR_SHIFT, .buf_vref_sel_shift = EXYNOS_TMU_REF_VOLTAGE_SHIFT, @@ -160,8 +162,11 @@ static const struct exynos_tmu_registers exynos3250_tmu_registers = { .temp_level = 95, \ }, \ .freq_tab_count = 2, \ + .triminfo_reload[0] = 0x1, \ + .triminfo_reload[1] = 0x11, \ + .triminfo_reload_count = 2, \ .registers = &exynos3250_tmu_registers, \ - .features = (TMU_SUPPORT_EMULATION | \ + .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \ TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \ TMU_SUPPORT_EMUL_TIME) #endif @@ -184,7 +189,7 @@ static const struct exynos_tmu_registers exynos4412_tmu_registers = { .triminfo_data = EXYNOS_TMU_REG_TRIMINFO, .triminfo_25_shift = EXYNOS_TRIMINFO_25_SHIFT, .triminfo_85_shift = EXYNOS_TRIMINFO_85_SHIFT, - .triminfo_ctrl = EXYNOS_TMU_TRIMINFO_CON, + .triminfo_ctrl[0] = EXYNOS_TMU_TRIMINFO_CON2, .triminfo_reload_shift = EXYNOS_TRIMINFO_RELOAD_SHIFT, .tmu_ctrl = EXYNOS_TMU_REG_CONTROL, .test_mux_addr_shift = EXYNOS4412_MUX_ADDR_SHIFT, @@ -252,6 +257,8 @@ static const struct exynos_tmu_registers exynos4412_tmu_registers = { .temp_level = 95, \ }, \ .freq_tab_count = 2, \ + .triminfo_reload[0] = 0x1, \ + .triminfo_reload_count = 1, \ .registers = &exynos4412_tmu_registers, \ .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \ TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \ diff --git a/drivers/thermal/samsung/exynos_tmu_data.h b/drivers/thermal/samsung/exynos_tmu_data.h index f0979e5..e0536c3 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.h +++ b/drivers/thermal/samsung/exynos_tmu_data.h @@ -57,8 +57,11 @@ #define EXYNOS4210_TMU_TRIG_LEVEL_MASK 0x1111 #define EXYNOS4210_TMU_INTCLEAR_VAL 0x1111 -/* Exynos5250 and Exynos4412 specific registers */ -#define EXYNOS_TMU_TRIMINFO_CON 0x14 +/* Exynos3250 specific registers */ +#define EXYNOS_TMU_TRIMINFO_CON1 0x10 + +/* Exynos5250, Exynos4412 and Exynos3250 specific registers */ +#define EXYNOS_TMU_TRIMINFO_CON2 0x14 #define EXYNOS_THD_TEMP_RISE 0x50 #define EXYNOS_THD_TEMP_FALL 0x54 #define EXYNOS_EMUL_CON 0x80