From patchwork Sat Mar 11 18:23:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9618919 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 19B7F604CC for ; Sat, 11 Mar 2017 18:25:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1205A28678 for ; Sat, 11 Mar 2017 18:25:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 06E6E28722; Sat, 11 Mar 2017 18:25:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 479432870E for ; Sat, 11 Mar 2017 18:25:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:References:To:Subject:From:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7AiLVJdtMXWtMxDxBGk7pg8+PQQf3bOtU6udouoM7vc=; b=cyhg7W9Acn3Mtj HH5ap+UJti5khfLI0LgrRvmy6B5PzCUI7slXyuCfpmqj+QkkrIi04j0myBiP6+NfVZYJBoLYuwdvd L5gol09naK6grMvtxbQYO6NfBnFoObSpJOsAprJwh2qdbbKQOgB4XJcVH9MuGzFisrYryb9SmeEgq i+LAprozWjBAO8NRhvq2acRXcQdvV6GKJzBXjowGgyavBM7n4ocuaDoZNj2B8sLaOd8W6ybiNwlEu o6QqzxgeX6WezcuOK2imwQiiTa/lN11SJpumrA6T+MwigMPbkKCKf2fgKIVzNsj9bLAjUoBuo6r5f 4CcqjcPTFkopH62n4mmw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cmlha-0002A5-50; Sat, 11 Mar 2017 18:25:14 +0000 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cmlhT-0000sI-QB for linux-amlogic@lists.infradead.org; Sat, 11 Mar 2017 18:25:10 +0000 Received: by mail-wm0-x243.google.com with SMTP id u132so3790146wmg.1 for ; Sat, 11 Mar 2017 10:24:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:references:cc:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=so2Aw8YZx/3DUBRbtdWPFzWs0iBjqBkLAYvjaUgXLVc=; b=rNAXJv2sX8KRsHioGLDUGcmZI+ZFOkHHIwdZjAvJpdqfzBO03bXTv7BCK7CtxFMjwQ VKY0CxTtZhOgD9s/73I2c14hq3xgu1UBykqvUNLRv5l9uh243VOC5bXh+QT1ZRlZIMI4 MiTmNtm++/8cilDqBbAo1Ul3+gb6L71g+LVZouUISPbHIWusV6Ha/NkYAkxixa4xlVzv pUfn6NyrIJlc0N8WjjfpKMmrnaFXT1DIndTQqa0n4iXbfm/rJY8E+wUxaWudWNj1KdTr 7URBuzJvRp4fmxNeps67qip69hl2Zq/AzLOyf2VmwsSV1eVEWQLom3KGCu/Cn8vY1Xl6 MCNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:references:cc:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=so2Aw8YZx/3DUBRbtdWPFzWs0iBjqBkLAYvjaUgXLVc=; b=Qcm88U8q1PiyVrUKzN0rtDtDXFtCr7fJWY7WIVLMerfgpBjP2Hwazo3LE3AbXHN5i8 uuh89Iti/TbFbxIu21V+VEKf8feCK3hJe3Fsxdwu+8gqqMSP42RS2q83Fv1PsxQCj3Ur xV87I5hI6/A+O2anWbFTjPuIrxXIjpjh8QKEvcUBlowTEVU4sPBUpuK0JMQ7zEGslpLr CVrK9X726qHV/mFXsRNULJ8tBGtQTwua2uVKf7CCEmWKGEBTPyHrM8iRDYgX+e0FDt/m JJNPoRbX5oE086OHoq65Nm9gV+o7HtPbPnlc08gEmnOUP/9bfdmgIAwhKER8rbSLMxhA s38A== X-Gm-Message-State: AFeK/H0VDsagm7A7TOhOXCvs3e8ExQXA0vQDkJ8/l0VUHWx+u79CiZM5heLjYMT7AAs45A== X-Received: by 10.28.169.130 with SMTP id s124mr3639985wme.137.1489256686023; Sat, 11 Mar 2017 10:24:46 -0800 (PST) Received: from ?IPv6:2003:c6:ebdc:4000:3419:a191:120:8b2e? (p200300C6EBDC40003419A19101208B2E.dip0.t-ipconnect.de. [2003:c6:ebdc:4000:3419:a191:120:8b2e]) by smtp.googlemail.com with ESMTPSA id k128sm4482032wmf.16.2017.03.11.10.24.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 11 Mar 2017 10:24:45 -0800 (PST) From: Heiner Kallweit Subject: [PATCH v3 04/10] i2c: meson: use i2c core for DT clock-frequency parsing To: Wolfram Sang , Jerome Brunet References: Message-ID: <27b52215-3cbe-b407-c439-216fdace3745@gmail.com> Date: Sat, 11 Mar 2017 19:23:24 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170311_102508_093706_7992261E X-CRM114-Status: UNSURE ( 8.97 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-amlogic@lists.infradead.org, "linux-i2c@vger.kernel.org" Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP We don't have to parse the DT manually to retrieve the bus frequency and we don't have to maintain an own default for the bus frequency. Let the i2c core do this for us. Signed-off-by: Heiner Kallweit Reviewed-by: Jerome Brunet --- v2: - added Reviewed-by v3: - changed order of patches --- drivers/i2c/busses/i2c-meson.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/busses/i2c-meson.c b/drivers/i2c/busses/i2c-meson.c index e597764e..ac0ac82d 100644 --- a/drivers/i2c/busses/i2c-meson.c +++ b/drivers/i2c/busses/i2c-meson.c @@ -38,7 +38,6 @@ #define REG_CTRL_CLKDIV_MASK ((BIT(10) - 1) << REG_CTRL_CLKDIV_SHIFT) #define I2C_TIMEOUT_MS 500 -#define DEFAULT_FREQ 100000 enum { TOKEN_END = 0, @@ -387,15 +386,14 @@ static int meson_i2c_probe(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; struct meson_i2c *i2c; struct resource *mem; - u32 freq; + struct i2c_timings timings; int irq, ret = 0; i2c = devm_kzalloc(&pdev->dev, sizeof(struct meson_i2c), GFP_KERNEL); if (!i2c) return -ENOMEM; - if (of_property_read_u32(pdev->dev.of_node, "clock-frequency", &freq)) - freq = DEFAULT_FREQ; + i2c_parse_fw_timings(&pdev->dev, &timings, true); i2c->dev = &pdev->dev; platform_set_drvdata(pdev, i2c); @@ -453,7 +451,7 @@ static int meson_i2c_probe(struct platform_device *pdev) return ret; } - meson_i2c_set_clk_div(i2c, freq); + meson_i2c_set_clk_div(i2c, timings.bus_freq_hz); return 0; }