From patchwork Thu Feb 13 20:24:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1237717 X-Patchwork-Delegate: hs@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=LuJUckw0; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48JSgP5vf1z9s29 for ; Fri, 14 Feb 2020 07:25:18 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1D6A881225; Thu, 13 Feb 2020 21:25:10 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="LuJUckw0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 009B481219; Thu, 13 Feb 2020 21:25:07 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x141.google.com (mail-il1-x141.google.com [IPv6:2607:f8b0:4864:20::141]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 16FE581219 for ; Thu, 13 Feb 2020 21:25:04 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x141.google.com with SMTP id s85so6101134ill.11 for ; Thu, 13 Feb 2020 12:25:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=uQHWuKbeQUGkWsam6alHGpF1E1UiaZ59wfvmkYPtuiI=; b=LuJUckw0DXxOqxi7InMHf+wHvsc3MSMdUauO8Mi80o4GzQ0z2GqHG2BPXNs5PYliqs TPfLMORHsFr/PEVdEeY00DMUbT+IJSxm+69ncRb9B0e7LW0eRjzUhn5bVBUNYC1xcd29 TaZPHWE6m0aehw4J3/URXu5XZOyYz5Geuruxc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=uQHWuKbeQUGkWsam6alHGpF1E1UiaZ59wfvmkYPtuiI=; b=giOoaBalGyzeAX0SCusvy/ULXImwH3Tir9rr0O064LRQyqgIeQDYLWoPftzHizrk2F 2ZmyDdYvrxDy7NPo5KDmDejkY5R/DoZ+p8I0C5+DK4TjlGs0BBW9RNAMB/szngpcCN5k 1kevfd0ZXgKt3jr1Jsims49dspq48kvhXdLa6r26IAYQiK5tjHqiYli1NIFzRj623gqc /cFHI7saxy7CQBFbBZoCw+W/13voMEQ2j1MGENT8spEvwIhMAn6R7SnPP4pVPm/J6Ojn DGrzhuVmqIOdK8pIhpa+bCsFt1LP95GJ7W0Z5zJqrGsjoFtvYelhkdvbV6zi30YrKfop YGuw== X-Gm-Message-State: APjAAAUgFxnAfLvx2USCLd6JzKivH5JnfYgTSwoZLzmdbfleR6gpzGeH pl+ry6zTguHfsB57CkuhV4odOwGjzcVF8Q== X-Google-Smtp-Source: APXvYqy0RRhwRZN7dZd3FAH/aCWCf8LTK8TmDXV8hV6W9xO726Sq6PnLNm4MLlJ5djgvtsSkKMIZ2g== X-Received: by 2002:a92:af8e:: with SMTP id v14mr17116006ill.150.1581625503107; Thu, 13 Feb 2020 12:25:03 -0800 (PST) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id t15sm1196872ili.50.2020.02.13.12.25.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Feb 2020 12:25:02 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Heiko Schocher Subject: [PATCH] i2c: designware_i2c: Correct the selection of speed mode Date: Thu, 13 Feb 2020 13:24:55 -0700 Message-Id: <20200213132452.1.I9fa6b7a8f7c3b13b4206f4d7c73aac809400afd5@changeid> X-Mailer: git-send-email 2.25.0.265.gbab2e86ba0-goog MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.1 at phobos.denx.de X-Virus-Status: Clean Unfortunately a recent change adjusted the order of the checks here such that 400MHz now shows up as fast-plus speed (1Mbps). Fix it. Signed-off-by: Simon Glass Fixes: d96440d1e3 ("i2c: designware_i2c: Add support for fast-plus speed") Reviewed-by: Heiko Schocher --- drivers/i2c/designware_i2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/designware_i2c.c b/drivers/i2c/designware_i2c.c index e1d5aeb19d..0b5e70af59 100644 --- a/drivers/i2c/designware_i2c.c +++ b/drivers/i2c/designware_i2c.c @@ -212,9 +212,9 @@ static int calc_bus_speed(struct dw_i2c *priv, int speed, ulong bus_clk, if (speed >= I2C_SPEED_HIGH_RATE && (!scl_sda_cfg || scl_sda_cfg->has_high_speed)) i2c_spd = IC_SPEED_MODE_HIGH; - else if (speed >= I2C_SPEED_FAST_RATE) - i2c_spd = IC_SPEED_MODE_FAST_PLUS; else if (speed >= I2C_SPEED_FAST_PLUS_RATE) + i2c_spd = IC_SPEED_MODE_FAST_PLUS; + else if (speed >= I2C_SPEED_FAST_RATE) i2c_spd = IC_SPEED_MODE_FAST; else i2c_spd = IC_SPEED_MODE_STANDARD;