From patchwork Fri Jul 13 15:20:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Sverdlin X-Patchwork-Id: 10523573 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 98BA66028E for ; Fri, 13 Jul 2018 15:21:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B76029D37 for ; Fri, 13 Jul 2018 15:21:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F96C29D3B; Fri, 13 Jul 2018 15:21:01 +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=-2.9 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 E347929D38 for ; Fri, 13 Jul 2018 15:21:00 +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:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=QFg1ucLOUK15cBbFQ4pgUUVj/ue+rDGMACjjJFGX6bo=; b=jCaPyifvWtm3+t Ph8642+nVViUGHOHSb1UQdt8GYqgDjn0mc5st7nhPxUPEMC12do7XubKzVdTBhhXpzJZz5ATTBhzt 5e4XvTgI/0V77oFSELwwtKnq7PRRyrPQJiibaeet2wOISqIcX3Gi9E4kWVe3KBNEN6P0f4yxgKsMn pes7AdkM7rtE79WQxXXnCzsDSbZ5wbvqj7gbfgtuLhkIWOakyCQKF9//kbWdPowlRKT8jwHfokLD7 XwhXFEml1ijx46Efgnh2ckZ702olDCayBVercdzUP9znkcYFGuaLinnzobb/7bucMNl6HFo1+ezUt PYiAvnCoT3iGxgGLJiBA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fdzsP-0005a0-F2; Fri, 13 Jul 2018 15:20:57 +0000 Received: from mail-db5eur01on072d.outbound.protection.outlook.com ([2a01:111:f400:fe02::72d] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fdzsM-0005Yx-0m for linux-arm-kernel@lists.infradead.org; Fri, 13 Jul 2018 15:20:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.onmicrosoft.com; s=selector1-nokia-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cVePINV1lYqH4f0USh0zmyeL2c4Ko4eG+JiZf9CQ32c=; b=muf6oLk+ZOtqyq0aLbrgGH8qyflGlSZVGjRzlQKDUCBBAH8WA5A5EVa7EmIyTRcGg70lqT4DwjxDrk7UdTCZyuj89ViAksN8azPI3Cb+US5KsRbzlMrK+W3uCBoAuxWQeflLTvqGtj68/Gmx/rQU3gxIviGCSlZasJtBunojxVw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=alexander.sverdlin@nokia.com; Received: from ulegcpsvdell.emea.nsn-net.net (131.228.2.20) by VI1PR0701MB1886.eurprd07.prod.outlook.com (2603:10a6:800:39::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.952.8; Fri, 13 Jul 2018 15:20:40 +0000 From: Alexander Sverdlin To: linux-i2c@vger.kernel.org Subject: [PATCH] i2c: davinci: Avoid zero value of CLKH Date: Fri, 13 Jul 2018 17:20:17 +0200 Message-Id: <20180713152017.2207-1-alexander.sverdlin@nokia.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-Originating-IP: [131.228.2.20] X-ClientProxiedBy: AM4PR07CA0014.eurprd07.prod.outlook.com (2603:10a6:205:1::27) To VI1PR0701MB1886.eurprd07.prod.outlook.com (2603:10a6:800:39::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2ae686c1-55c7-4598-9980-08d5e8d431f1 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:(109105607167333); BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(48565401081)(2017052603328)(7193020); SRVR:VI1PR0701MB1886; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0701MB1886; 3:TAKW0l1GDg/S6hsI4MPVDM+snbNOXJJ6r+uDy5LTzkZr42QdK97+MFHfix/pkVxlB0ZoH3BkzuF5VTL8w10CvEy07Fs0h4QbPwXt+2TCHZzz7pTKr76JrC+9HRg5hBIf0rDmjhlyYRnYpoFcjXaEzJAUI2ftAb3hiCvr518To7+bVVWpxRd+CKTix5Rafn0kN245/S/mkjBas5/fM4ffYT1ZcQGXuoiJkRcdK4rLnPU1LGUab083l17R2jF4R8GQwiEw14hhOcyBuwci4AUs8GepQhrdz+3ulV8GgrWHWrY=; 25:l46J3KVJ/6rpBq3NOleIEnsLOGOiUuDVbT501IEzmHmJ9ii+eB1AgHMfUbhHeWQcrkxB0yCEIjm+wk48GtuuSOagZz0bQbWkA+BIwT0QrQIQnQVSs5WRbPW+gcKhor9IK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8YzCJXEnadbP7CMZVEZYhHxEAwmqj3Z6mTi7o+4P71V8p4ANmPK7Q0LWmrFs8kklQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(82608151540597)(109105607167333); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231311)(11241501184)(806099)(944501410)(52105095)(10201501046)(3002001)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:VI1PR0701MB1886; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0701MB1886; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0701MB1886; 4:xPQ1G2nMb9OKKp3Xe0MhBDYjyJEi7Z1iVq4K8GtJa1DqBRu8UyCy344p4NZ4XyMAuwrkCEORHuGIxfd1E64ot4A/oPjBfzj831Gtf48DBnN36M7jbPqiaaPMpMVDXp+44ZZZGUfbkYqDFoRshhFbWXjhqNzcv5Y5XQosrFBYrBH+Ku0HDpSKBWYemSKkU+wvWI/b+IvD49S5lnCg2BkToNtXTQ9L7Ro5MRyxhxKxHenc6o6NqYdp1QdXacDYzHWtxmwj8DpyXL4ObNmHa3OMddLuMY3wHyZ0VjzgekeJ0st+td0zihHlMI1Vtr1M0L4Nl3a0Pg+rX2uKbcnJk+4hCipc0JyTr7nkX1XmfKjNh+4= X-Forefront-PRVS: 07326CFBC4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(136003)(396003)(366004)(39860400002)(346002)(376002)(199004)(189003)(36756003)(16526019)(81156014)(81166006)(8676002)(97736004)(2906002)(1076002)(316002)(4326008)(25786009)(6116002)(3846002)(54906003)(8936002)(5660300001)(486006)(2361001)(16586007)(476003)(2616005)(478600001)(44832011)(68736007)(6486002)(186003)(956004)(86362001)(1857600001)(26005)(53936002)(6512007)(48376002)(105586002)(106356001)(52116002)(386003)(50226002)(50466002)(2351001)(6506007)(6916009)(6666003)(47776003)(66066001)(305945005)(7736002)(51416003); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0701MB1886; H:ulegcpsvdell.emea.nsn-net.net; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: nokia.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0701MB1886; 23:BeWHyp/sdHc3Y8EVTcpmeokNbvnnb02q2b6BiY2?= =?us-ascii?Q?5EZpwGs6XffLitI3QVOrz5nfxD06fn9UDWzS03ONn39l/kA2057eVj4uLxN4?= =?us-ascii?Q?dEUXfuBCwYGCyZ0iAfj09+ZfIyoz7b1eXEFvnyjMHRX6LBeg1Fy0/RL6GYzG?= =?us-ascii?Q?1fWPZjJ4T/bTogUQeuNyVMuCl2rX8NztvbeQwrWIIaaLzXNwjXXlup5IENp2?= =?us-ascii?Q?/T6glWVGPv4W4vgShPUBkDwbxV+/Wm36NjOssLD5XAHtLeaENET0GYlIDqq+?= =?us-ascii?Q?BKnpdVT5tOKyUdK/xCULeQAXKfff/gKJQr0DN9N/Ra1NvjVm2FXCu6yduw3g?= =?us-ascii?Q?olvfZuKKgPwNTkAki9Pe3OsEb/c0QiyXNpOzKiaro2QcFUpNn6jCxEVG00gS?= =?us-ascii?Q?z3IeTZALVrswEOzuq3XygLLOm5SezuLYQ4wGqHBgQET3/atWX1+sVQRHfw5K?= =?us-ascii?Q?9JbJnV/LOP4y6QNH0zdG9LnCj1BBLV47EqimVEt2cdb1X6geJIINVeb5GpCc?= =?us-ascii?Q?JYoI+AT5+acGO54PkAYYEDsyliI6NIYyR6MXt6bapTrvGUKl2zuW9Hjm3Rw6?= =?us-ascii?Q?kiHQdLFnqU28aS4t/AzduB4FP48xix1Bqt+RB2Q0HOmiidrlwSeCGJUKjGVX?= =?us-ascii?Q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80XzzGOLid77n7SnL20Pms5Ia4DjXy+IdWKy5+a3hhfhF9GFG7Hq2mqFEr1BQPuK2KsokcoT8hEmnE7Qy7MC4n+K/+DqF/FyDEiKxy2AxJ3xhts1avPKMQxfsTdhA9gCMP6gknsDpxUBFfmK0RvdxJqTwl0l+CToyzLAF7pYw6Odum0 X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2018 15:20:40.4375 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2ae686c1-55c7-4598-9980-08d5e8d431f1 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0701MB1886 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180713_082054_204365_2AE87983 X-CRM114-Status: GOOD ( 12.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sekhar Nori , Alexander Sverdlin , linux-arm-kernel@lists.infradead.org, Kevin Hilman Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP If CLKH is set to 0 I2C clock is not generated at all, so avoid this value and stretch the clock in this case. Signed-off-by: Alexander Sverdlin Acked-by: Sekhar Nori --- drivers/i2c/busses/i2c-davinci.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index 75d6ab177055..7379043711df 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c @@ -237,12 +237,16 @@ static void i2c_davinci_calc_clk_dividers(struct davinci_i2c_dev *dev) /* * It's not always possible to have 1 to 2 ratio when d=7, so fall back * to minimal possible clkh in this case. + * + * Note: + * CLKH is not allowed to be 0, in this case I2C clock is not generated + * at all */ - if (clk >= clkl + d) { + if (clk > clkl + d) { clkh = clk - clkl - d; clkl -= d; } else { - clkh = 0; + clkh = 1; clkl = clk - (d << 1); }