From patchwork Fri Mar 29 09:18:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 1069371 X-Patchwork-Delegate: mario.six@gdsys.cc 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=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gdsys.cc Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44VxFP6WhXz9sQm for ; Fri, 29 Mar 2019 20:26:33 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 848C0C21E1E; Fri, 29 Mar 2019 09:23:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id ADD54C21DF3; Fri, 29 Mar 2019 09:23:40 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 03B55C21C38; Fri, 29 Mar 2019 09:22:47 +0000 (UTC) Received: from smtprelay06.ispgateway.de (smtprelay06.ispgateway.de [80.67.18.29]) by lists.denx.de (Postfix) with ESMTPS id B1F64C21DF8 for ; Fri, 29 Mar 2019 09:22:43 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay06.ispgateway.de with esmtpa (Exim 4.90_1) (envelope-from ) id 1h9nil-0007L1-1p; Fri, 29 Mar 2019 10:22:43 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach Date: Fri, 29 Mar 2019 10:18:16 +0100 Message-Id: <20190329091819.8345-13-mario.six@gdsys.cc> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190329091819.8345-1-mario.six@gdsys.cc> References: <20190329091819.8345-1-mario.six@gdsys.cc> MIME-Version: 1.0 X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 13/16] board: gazerbeam: Fix SC detection X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" The single channel detection in the gazerbeam board driver was not implemented correctly. Fix the detection. Signed-off-by: Mario Six --- drivers/board/gazerbeam.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/board/gazerbeam.c b/drivers/board/gazerbeam.c index 481cce8e809..85de4e440ce 100644 --- a/drivers/board/gazerbeam.c +++ b/drivers/board/gazerbeam.c @@ -61,7 +61,7 @@ static int _read_board_variant_data(struct udevice *dev) struct udevice *i2c_bus; struct udevice *dummy; char *listname; - int mc4, mc2, sc, con; + int mc4, mc2, sc, mc2_sc, con; int gpio_num; int res; @@ -78,16 +78,16 @@ static int _read_board_variant_data(struct udevice *dev) return -EIO; } - mc2 = !dm_i2c_probe(i2c_bus, MC2_EXPANDER_ADDR, 0, &dummy); + mc2_sc = !dm_i2c_probe(i2c_bus, MC2_EXPANDER_ADDR, 0, &dummy); mc4 = !dm_i2c_probe(i2c_bus, MC4_EXPANDER_ADDR, 0, &dummy); - if (mc2 && mc4) { + if (mc2_sc && mc4) { debug("%s: Board hardware configuration inconsistent.\n", dev->name); return -EINVAL; } - listname = mc2 ? "var-gpios-mc2" : "var-gpios-mc4"; + listname = mc2_sc ? "var-gpios-mc2" : "var-gpios-mc4"; gpio_num = gpio_request_list_by_name(dev, listname, priv->var_gpios, ARRAY_SIZE(priv->var_gpios), @@ -105,12 +105,7 @@ static int _read_board_variant_data(struct udevice *dev) return sc; } - con = dm_gpio_get_value(&priv->var_gpios[CON_GPIO_NO]); - if (con < 0) { - debug("%s: Error while reading 'con' GPIO (err = %d)", - dev->name, con); - return con; - } + mc2 = mc2_sc ? (sc ? 0 : 1) : 0; if ((sc && mc2) || (sc && mc4) || (!sc && !mc2 && !mc4)) { debug("%s: Board hardware configuration inconsistent.\n", @@ -118,6 +113,13 @@ static int _read_board_variant_data(struct udevice *dev) return -EINVAL; } + con = dm_gpio_get_value(&priv->var_gpios[CON_GPIO_NO]); + if (con < 0) { + debug("%s: Error while reading 'con' GPIO (err = %d)", + dev->name, con); + return con; + } + priv->variant = con ? VAR_CON : VAR_CPU; priv->multichannel = mc4 ? 4 : (mc2 ? 2 : (sc ? 1 : 0));