From patchwork Fri Sep 29 17:16:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Brandt X-Patchwork-Id: 9978463 X-Patchwork-Delegate: geert@linux-m68k.org 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 B3F9460311 for ; Fri, 29 Sep 2017 17:17:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C39B296F8 for ; Fri, 29 Sep 2017 17:17:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 90F1429702; Fri, 29 Sep 2017 17:17:43 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21B45296F8 for ; Fri, 29 Sep 2017 17:17:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751828AbdI2RRm (ORCPT ); Fri, 29 Sep 2017 13:17:42 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:42554 "EHLO relmlie1.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751224AbdI2RRl (ORCPT ); Fri, 29 Sep 2017 13:17:41 -0400 Received: from unknown (HELO relmlir2.idc.renesas.com) ([10.200.68.152]) by relmlie1.idc.renesas.com with ESMTP; 30 Sep 2017 02:17:40 +0900 Received: from relmlii1.idc.renesas.com (relmlii1.idc.renesas.com [10.200.68.65]) by relmlir2.idc.renesas.com (Postfix) with ESMTP id 1E2264330B; Sat, 30 Sep 2017 02:17:40 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.42,453,1500908400"; d="scan'208";a="258117029" Received: from unknown (HELO rtamta01.rta.renesas.com) ([143.103.48.75]) by relmlii1.idc.renesas.com with ESMTP; 30 Sep 2017 02:17:38 +0900 Received: from localhost.localdomain (unknown [143.103.58.190]) by rtamta01.rta.renesas.com (Postfix) with ESMTP id 0BF3FA3; Fri, 29 Sep 2017 17:17:33 +0000 (UTC) From: Chris Brandt To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Simon Horman , Geert Uytterhoeven , Chris Brandt Subject: [PATCH v2] i2c: riic: remove fixed clock restriction Date: Fri, 29 Sep 2017 12:16:37 -0500 Message-Id: <20170929171637.121262-1-chris.brandt@renesas.com> X-Mailer: git-send-email 2.14.1 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Most systems with this i2c are going to have a clock of either 33.3MHz or 32MHz. That 4% difference is not reason enough to warrant that the driver to completely fail. Signed-off-by: Chris Brandt --- v2: * simplified error message. --- drivers/i2c/busses/i2c-riic.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c index c811af4c8d81..b16b54c88e65 100644 --- a/drivers/i2c/busses/i2c-riic.c +++ b/drivers/i2c/busses/i2c-riic.c @@ -299,12 +299,12 @@ static int riic_init_hw(struct riic_dev *riic, u32 spd) /* * TODO: Implement formula to calculate the timing values depending on - * variable parent clock rate and arbitrary bus speed + * variable parent clock rate and arbitrary bus speed. + * For now, just use calculations based on a 33325000Hz clock. */ rate = clk_get_rate(riic->clk); - if (rate != 33325000) { - dev_err(&riic->adapter.dev, - "invalid parent clk (%lu). Must be 33325000Hz\n", rate); + if (!rate) { + dev_err(&riic->adapter.dev, "invalid parent clock rate of 0\n"); clk_disable_unprepare(riic->clk); return -EINVAL; }