{"id":810245,"url":"http://patchwork.ozlabs.org/api/patches/810245/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20170905182448.21932-1-moritz.fischer@ettus.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170905182448.21932-1-moritz.fischer@ettus.com>","list_archive_url":null,"date":"2017-09-05T18:24:48","name":"[U-Boot] i2c: muxes: pca954x: Add support for GPIO reset line","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"ea54a7a3b1f1111036d00796ecc02409af0c3d5b","submitter":{"id":65751,"url":"http://patchwork.ozlabs.org/api/people/65751/?format=json","name":"Moritz Fischer","email":"moritz.fischer@ettus.com"},"delegate":{"id":1691,"url":"http://patchwork.ozlabs.org/api/users/1691/?format=json","username":"hs","first_name":"Heiko","last_name":"Schocher","email":"hs@denx.de"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20170905182448.21932-1-moritz.fischer@ettus.com/mbox/","series":[{"id":1627,"url":"http://patchwork.ozlabs.org/api/series/1627/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=1627","date":"2017-09-05T18:24:48","name":"[U-Boot] i2c: muxes: pca954x: Add support for GPIO reset line","version":1,"mbox":"http://patchwork.ozlabs.org/series/1627/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/810245/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/810245/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=ettus-com.20150623.gappssmtp.com\n\theader.i=@ettus-com.20150623.gappssmtp.com\n\theader.b=\"Z+JBRhDX\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xmw8p3g3Dz9t16\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed,  6 Sep 2017 04:24:10 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 23CE5C21E77; Tue,  5 Sep 2017 18:24:07 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 1FC81C21C54;\n\tTue,  5 Sep 2017 18:24:05 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 6D37DC21C54; Tue,  5 Sep 2017 18:24:03 +0000 (UTC)","from mail-pg0-f48.google.com (mail-pg0-f48.google.com\n\t[74.125.83.48])\n\tby lists.denx.de (Postfix) with ESMTPS id B42B3C21C45\n\tfor <u-boot@lists.denx.de>; Tue,  5 Sep 2017 18:24:02 +0000 (UTC)","by mail-pg0-f48.google.com with SMTP id 63so1788500pgc.1\n\tfor <u-boot@lists.denx.de>; Tue, 05 Sep 2017 11:24:02 -0700 (PDT)","from localhost (207-114-172-147.static.twtelecom.net.\n\t[207.114.172.147]) by smtp.gmail.com with ESMTPSA id\n\t205sm2225048pfy.122.2017.09.05.11.23.59\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tTue, 05 Sep 2017 11:23:59 -0700 (PDT)"],"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=RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_MSPIKE_H2,\n\tT_DKIM_INVALID autolearn=unavailable autolearn_force=no\n\tversion=3.4.0","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ettus-com.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=wXXWpAzymQdTz3oxTB3ad2qgsOqyRxtVfO0bmXAmN/M=;\n\tb=Z+JBRhDXVY05Q6yEUf+XsEITAR+Mgx2mszAW1LtVLAWriBqhbdyDNmmRq6wmV1FT1w\n\tNqXU7HvGPEJ4uF7D8W7PYh6hZmRe93PpZm3LUDjV8NaWsEyioldJD1HTp5pyPJ5OK3e7\n\t+EL4Z2q2vs1ZDug/RrLLgzaoA/ZXsf3i2vyaUwbfaaj7oUY9fbav/T0LyzkY5qynXelG\n\tSrknc8pD4ZrJtsanYkb0aEo5txBqnFDTW3NKRJQ+gDob0mypxmjGTNEvOKjXNxTPQALC\n\tGcPMWJ70o/QENDvhumNORvfwEEQ+DIdIcvs7/9mS6CMUuLUe5sNo3JlnGus7LdbKOrdm\n\tjNaA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=wXXWpAzymQdTz3oxTB3ad2qgsOqyRxtVfO0bmXAmN/M=;\n\tb=aFgSET7obYcPtgHonDWMF8Wni5rGjTU+lbyR4SeYEYkbkHsQEkDUqLCmbR48evwxw2\n\trKERRcyZ5GRf+S+ineam+yA6UjKi61fxf5Vi6LVrJrKevtzneY15yoHmysLKYwFWsyMd\n\thiVIMcYIQu8jlS/K8ZqH3pqCdbrRimawX8qMqe/PhIK+ly1XZbacEknNz6KCtjCu4szT\n\tCaNFkRtMpMlXq/5x/T5J9x4O0rs2QS/2YKaTpW1dT5ySvZHnAO39ULLKzqE20SIenUDu\n\tPW46EIAZeEGKYBHLav3jV0d3mjage9shz0QAcvopLgSSXS8LrR0ygLiKkihu5S28uSda\n\tbmPQ==","X-Gm-Message-State":"AHPjjUiDaUtnICipbNl3xV+YxeI6/ao5EHJrhYySVHHToRfk9XnkOGYW\n\tyt8MWL4U8WgyUJC8mIJTRA==","X-Google-Smtp-Source":"ADKCNb4igE/MFK6nzsbDtSLymHIBqJiD8naPAeAI4ktW3S88yx6Adf9XQVAiFm+bMBOgNW4Zp0JG6A==","X-Received":"by 10.98.150.151 with SMTP id s23mr4689318pfk.149.1504635840384; \n\tTue, 05 Sep 2017 11:24:00 -0700 (PDT)","From":"Moritz Fischer <moritz.fischer@ettus.com>","To":"u-boot@lists.denx.de","Date":"Tue,  5 Sep 2017 11:24:48 -0700","Message-Id":"<20170905182448.21932-1-moritz.fischer@ettus.com>","X-Mailer":"git-send-email 2.14.1","MIME-Version":"1.0","Cc":"mdf@kernel.org, Stefan Roese <sr@denx.de>","Subject":"[U-Boot] [PATCH] i2c: muxes: pca954x: Add support for GPIO reset\n\tline","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"},"content":"This commit adds support for GPIO reset lines matching the\ncommon linux \"reset-gpios\" devicetree binding.\n\nSigned-off-by: Moritz Fischer <moritz.fischer@ettus.com>\nCc: Heiko Schocher <hs@denx.de>\nCc: Stefan Roese <sr@denx.de>\nCc: Marek Behún <marek.behun@nic.cz>\nCc: Simon Glass <sjg@chromium.org>\nCc: Michal Simek <monstr@monstr.eu>\n\n---\n drivers/i2c/muxes/pca954x.c | 44 +++++++++++++++++++++++++++++++++++++++++++-\n 1 file changed, 43 insertions(+), 1 deletion(-)","diff":"diff --git a/drivers/i2c/muxes/pca954x.c b/drivers/i2c/muxes/pca954x.c\nindex 383f72f552..dd28ff057b 100644\n--- a/drivers/i2c/muxes/pca954x.c\n+++ b/drivers/i2c/muxes/pca954x.c\n@@ -1,5 +1,6 @@\n /*\n  * Copyright (C) 2015 - 2016 Xilinx, Inc.\n+ * Copyright (C) 2017 National Instruments Corp\n  * Written by Michal Simek\n  *\n  * SPDX-License-Identifier:\tGPL-2.0+\n@@ -9,7 +10,10 @@\n #include <dm.h>\n #include <errno.h>\n #include <i2c.h>\n-#include <asm/gpio.h>\n+\n+#if CONFIG_DM_GPIO\n+# include <asm-generic/gpio.h>\n+#endif /* CONFIG_DM_GPIO */\n \n DECLARE_GLOBAL_DATA_PTR;\n \n@@ -30,6 +34,9 @@ struct chip_desc {\n struct pca954x_priv {\n \tu32 addr; /* I2C mux address */\n \tu32 width; /* I2C mux width - number of busses */\n+#ifdef CONFIG_DM_GPIO\n+\tstruct gpio_desc gpio_mux_reset;\n+#endif /* CONFIG_DM_GPIO */\n };\n \n static const struct chip_desc chips[] = {\n@@ -105,10 +112,45 @@ static int pca954x_ofdata_to_platdata(struct udevice *dev)\n \treturn 0;\n }\n \n+static int pca954x_probe(struct udevice *dev)\n+{\n+#ifdef CONFIG_DM_GPIO\n+\tstruct pca954x_priv *priv = dev_get_priv(dev);\n+\tint err;\n+\n+\terr = gpio_request_by_name(dev, \"reset-gpios\", 0,\n+\t\t\t&priv->gpio_mux_reset, GPIOD_IS_OUT);\n+\n+\t/* it's optional so only bail if we get a real error */\n+\tif (err && (err != -ENOENT))\n+\t\treturn err;\n+\n+\t/* dm will take care of polarity */\n+\tif (dm_gpio_is_valid(&priv->gpio_mux_reset))\n+\t\tdm_gpio_set_value(&priv->gpio_mux_reset, 0);\n+\n+#endif /* CONFIG_DM_GPIO */\n+\treturn 0;\n+}\n+\n+static int pca954x_remove(struct udevice *dev)\n+{\n+#ifdef CONFIG_DM_GPIO\n+\tstruct pca954x_priv *priv = dev_get_priv(dev);\n+\n+\tif (dm_gpio_is_valid(&priv->gpio_mux_reset))\n+\t\tdm_gpio_free(dev, &priv->gpio_mux_reset);\n+\n+#endif /* CONFIG_DM_GPIO */\n+\treturn 0;\n+}\n+\n U_BOOT_DRIVER(pca954x) = {\n \t.name = \"pca954x\",\n \t.id = UCLASS_I2C_MUX,\n \t.of_match = pca954x_ids,\n+\t.probe = pca954x_probe,\n+\t.remove = pca954x_remove,\n \t.ops = &pca954x_ops,\n \t.ofdata_to_platdata = pca954x_ofdata_to_platdata,\n \t.priv_auto_alloc_size = sizeof(struct pca954x_priv),\n","prefixes":["U-Boot"]}