From patchwork Mon Dec 18 21:57:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 850435 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3z0vzm1fhKz9sBW for ; Tue, 19 Dec 2017 08:58:12 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965334AbdLRV6J (ORCPT ); Mon, 18 Dec 2017 16:58:09 -0500 Received: from sauhun.de ([88.99.104.3]:40891 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965215AbdLRV6J (ORCPT ); Mon, 18 Dec 2017 16:58:09 -0500 Received: from localhost (p54B33BFB.dip0.t-ipconnect.de [84.179.59.251]) by pokefinder.org (Postfix) with ESMTPSA id 6BDCA2C6314; Mon, 18 Dec 2017 22:58:07 +0100 (CET) From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Yoshihiro Shimoda , Wolfram Sang Subject: [RFC PATCH 1/7] i2c: sh_mobile: move type detection upwards Date: Mon, 18 Dec 2017 22:57:56 +0100 Message-Id: <20171218215802.28591-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171218215802.28591-1-wsa+renesas@sang-engineering.com> References: <20171218215802.28591-1-wsa+renesas@sang-engineering.com> Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org For refactoring reasons, we will need this information before the setup callback. Also, simplify the comment to a oneliner. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-sh_mobile.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c index b01607b4fce2b8..1ac896e46b390c 100644 --- a/drivers/i2c/busses/i2c-sh_mobile.c +++ b/drivers/i2c/busses/i2c-sh_mobile.c @@ -873,6 +873,10 @@ static int sh_mobile_i2c_probe(struct platform_device *dev) pd->bus_speed = ret ? STANDARD_MODE : bus_speed; pd->clks_per_count = 1; + /* Newer variants come with two new bits in ICIC */ + if (resource_size(res) > 0x17) + pd->flags |= IIC_FLAG_HAS_ICIC67; + config = of_device_get_match_data(&dev->dev); if (config) { pd->clks_per_count = config->clks_per_count; @@ -881,12 +885,6 @@ static int sh_mobile_i2c_probe(struct platform_device *dev) config->setup(pd); } - /* The IIC blocks on SH-Mobile ARM processors - * come with two new bits in ICIC. - */ - if (resource_size(res) > 0x17) - pd->flags |= IIC_FLAG_HAS_ICIC67; - ret = sh_mobile_i2c_init(pd); if (ret) return ret;