Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1821730imm; Mon, 3 Sep 2018 10:18:31 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbcS+D+KXirXY96QJ5ASrARvX5IMBr/bUIK3FwJ3TVIxT9lzha3BkhzENsFDMPoei9m+zOb X-Received: by 2002:a63:2bc9:: with SMTP id r192-v6mr7414216pgr.386.1535995111059; Mon, 03 Sep 2018 10:18:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535995111; cv=none; d=google.com; s=arc-20160816; b=PSghLg9sGt8RJ9XJNNN2ce/Tv9GKqrInXMOHldarmCs6uNpheuplpJu92TO8qayCIk LcDIYQBvCmlXBip5LBbNJQz06uXhJbND0CNJ6ZUmbWTlHiS3QE7CFDSw+mP1xIQpwUBa wRK5OE2MNSMS7RPu2pI1KAsHgKNLu6Wt5+dtyHFiq9A7H7tnzcodQtbl4c9ca4CMf+nF XZy+syXvnmzJ/PdCzVUzExmgFb0TyNHtij+N0RKH3oJFQnupFK54fP5Csuuo9ueUU/7J SX5H9VXPaOmWN12mcRszD0gQU2PDedOXMA0Ldywoava77Megtc/cdWDbPuNA0/EhW3Md ZPfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=kGLWTn9Z0gcixB8nt+SmJ/LgXbE1cIg8N2boEPlM7eg=; b=UQjLxipBUpx/G/NPnHJvnjz3Sd+9th1H9wbCJN3RTIS2l0TQOWGkBRUoVV18P/cHk3 Il/hY4ayJaaeNzd3XZ/1mApo6RRhs0gN71hvQNHzk45zBTWWe9o3c2OE67tEz9Jdx+uI ivFdOaeGW7Jx3dG7DW1x/192wJlxd8tY4d0R8gaIElUyhreMpfwnkEzbtj12V/Cgf6B1 I2FrUpInCjYyGBk4EBRBWCJyrh2s9lRJuP1exFi1FvPriajuFcokmEgK2uho+3SMKxiO dYuZB6BPrLKINS9dCUVsokJjzuxrJGDytkHjS6dNkv/c660P1eycsPm2ZibwUaHX/0bx Swvg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 190-v6si20711428pfu.343.2018.09.03.10.18.16; Mon, 03 Sep 2018 10:18:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730131AbeICViS (ORCPT + 99 others); Mon, 3 Sep 2018 17:38:18 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:42734 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728154AbeICViS (ORCPT ); Mon, 3 Sep 2018 17:38:18 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 6DBA3D10; Mon, 3 Sep 2018 17:17:13 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Sverdlin , Sekhar Nori , Wolfram Sang , Sasha Levin Subject: [PATCH 4.14 041/165] i2c: davinci: Avoid zero value of CLKH Date: Mon, 3 Sep 2018 18:55:27 +0200 Message-Id: <20180903165657.184121399@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165655.003605184@linuxfoundation.org> References: <20180903165655.003605184@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexander Sverdlin [ Upstream commit cc8de9a68599b261244ea453b38678229f06ada7 ] 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 Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/busses/i2c-davinci.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c @@ -234,12 +234,16 @@ static void i2c_davinci_calc_clk_divider /* * 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); }