{"id":812851,"url":"http://patchwork.ozlabs.org/api/patches/812851/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20170912134659.22613-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":"<20170912134659.22613-1-moritz.fischer@ettus.com>","list_archive_url":null,"date":"2017-09-12T13:46:59","name":"[U-Boot,v3] i2c: muxes: pca954x: Add support for GPIO reset line","commit_ref":"36bdeb75a4f4f276c841644775e687eb6b3d9ec4","pull_url":null,"state":"accepted","archived":false,"hash":"30c81eb6c97c0b73ee59ca7158c8650030833048","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/20170912134659.22613-1-moritz.fischer@ettus.com/mbox/","series":[{"id":2703,"url":"http://patchwork.ozlabs.org/api/series/2703/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=2703","date":"2017-09-12T13:46:59","name":"[U-Boot,v3] i2c: muxes: pca954x: Add support for GPIO reset line","version":3,"mbox":"http://patchwork.ozlabs.org/series/2703/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/812851/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/812851/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=\"ZR5XtFHp\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xs5fn2kq8z9s5L\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 12 Sep 2017 23:46:09 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid C5C6EC21EC6; Tue, 12 Sep 2017 13:46:05 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 0BFD8C21FD5;\n\tTue, 12 Sep 2017 13:46:02 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 2D999C21FD5; Tue, 12 Sep 2017 13:46:00 +0000 (UTC)","from mail-pg0-f50.google.com (mail-pg0-f50.google.com\n\t[74.125.83.50])\n\tby lists.denx.de (Postfix) with ESMTPS id 6BE59C21F49\n\tfor <u-boot@lists.denx.de>; Tue, 12 Sep 2017 13:45:59 +0000 (UTC)","by mail-pg0-f50.google.com with SMTP id d8so21341424pgt.4\n\tfor <u-boot@lists.denx.de>; Tue, 12 Sep 2017 06:45:59 -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\tf70sm19473308pfd.74.2017.09.12.06.45.54\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tTue, 12 Sep 2017 06:45:54 -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_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID autolearn=unavailable\n\tautolearn_force=no version=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;\n\tbh=pv3Bdxa+/bdHIqqWIeKtyBJbdjay7NW3g5z61EUDe+0=;\n\tb=ZR5XtFHpypaN+Gt6tGziI2GXsdtDgIooLXC+Q3U5M6OPFfdjodnjHr4Hl26qFzcOeA\n\tTz4g+NC3DMKnJMqp+BQL3vrqsT2rPZIAj9VuBJVHbWuBwrXmjqEZXSjYgSxK0+E2n8JX\n\tFV68ppR1dWUYgcTlxWjJBspjfl+CBw33FEbNx3QXuGt65+PmuGaj0jSePabQDi+5CJeG\n\tZ+NfGsZ3asO7ELu6r1Kb0AtY7nQzSVszEl9kpdoBZZe5f+ei+m4Id0YJPmvtjSE5cU4I\n\tDPJ9i2KiAYBvraedJVovjAD829MVkz3OlVzHx+fC1Zqiooex7kccFd+5LDAzB4mZozKN\n\tdo/w==","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;\n\tbh=pv3Bdxa+/bdHIqqWIeKtyBJbdjay7NW3g5z61EUDe+0=;\n\tb=Hd1fRlHKo/zVQGIiAh11R3S7YW3AJOA89Aa8V25zAmdqunb1ctOaeYy4kPuJ6Q5T1z\n\t88N0lQMzCBuIfgqjU/QY0tzETq/DV27mbvrlGL9Nqpn4kdvl21imlfQMc3c7h4cMEW5A\n\tdefRKa2BpNDt7MprlTCIuA8HIfOAlNeqpo9rErns7zMnwgBOOPO3e1MDS7DdcT9XIkKZ\n\t1XvNVPvIV4lwfK6qiYeHa7M3f9MQ3PWZ7EQgDxrvnrMX3oaT+cSRS48fUpQvC9dLrb68\n\tGkuTa4Wz1LzwGGdItTmfyLodHGgW7DEoS64T/oP4hB+/03d0gkpj5+VA1S4vhxkRPb/Z\n\t1i4A==","X-Gm-Message-State":"AHPjjUiTGDeU9MQnBPOYX4iPUiqAkDxC+36Ibf+GIOy55JqaoxKTTd93\n\tC/H8tQYqHFdCDsImVuaIsA==","X-Google-Smtp-Source":"ADKCNb6SDCzl5WCfj56XiKQ3nfmTo4zgPFEYcPHOIywJrFYG0O1JmRLiWV48gvs+uU3FI3r3U6fSEw==","X-Received":"by 10.99.116.90 with SMTP id e26mr14976147pgn.290.1505223955917; \n\tTue, 12 Sep 2017 06:45:55 -0700 (PDT)","From":"Moritz Fischer <moritz.fischer@ettus.com>","To":"u-boot@lists.denx.de","Date":"Tue, 12 Sep 2017 06:46:59 -0700","Message-Id":"<20170912134659.22613-1-moritz.fischer@ettus.com>","X-Mailer":"git-send-email 2.14.1","Cc":"sr@denx.de, mdf@kernel.org","Subject":"[U-Boot] [PATCH v3] 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>","MIME-Version":"1.0","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>\nReviewed-by: Heiko Schocher <hs@denx.de>\nReviewed-by: Simon Glass <sjg@chromium.org>\n---\n\nChanges from v2:\n-  Removed ifdef that would break build as suggested by Simon\n-  Added Simon's and Heko's Reviewed-by\n\nChanges from v1:\n- Simon's feedback on ifdef vs IS_ENABLED()\n\nCheers,\nMoritz\n\n---\n drivers/i2c/muxes/pca954x.c | 40 +++++++++++++++++++++++++++++++++++++++-\n 1 file changed, 39 insertions(+), 1 deletion(-)","diff":"diff --git a/drivers/i2c/muxes/pca954x.c b/drivers/i2c/muxes/pca954x.c\nindex 383f72f552..01ca1ff48d 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,8 @@\n #include <dm.h>\n #include <errno.h>\n #include <i2c.h>\n-#include <asm/gpio.h>\n+\n+#include <asm-generic/gpio.h>\n \n DECLARE_GLOBAL_DATA_PTR;\n \n@@ -30,6 +32,7 @@ struct chip_desc {\n struct pca954x_priv {\n \tu32 addr; /* I2C mux address */\n \tu32 width; /* I2C mux width - number of busses */\n+\tstruct gpio_desc gpio_mux_reset;\n };\n \n static const struct chip_desc chips[] = {\n@@ -105,10 +108,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+\tif (IS_ENABLED(CONFIG_DM_GPIO)) {\n+\t\tstruct pca954x_priv *priv = dev_get_priv(dev);\n+\t\tint err;\n+\n+\t\terr = gpio_request_by_name(dev, \"reset-gpios\", 0,\n+\t\t\t\t&priv->gpio_mux_reset, GPIOD_IS_OUT);\n+\n+\t\t/* it's optional so only bail if we get a real error */\n+\t\tif (err && (err != -ENOENT))\n+\t\t\treturn err;\n+\n+\t\t/* dm will take care of polarity */\n+\t\tif (dm_gpio_is_valid(&priv->gpio_mux_reset))\n+\t\t\tdm_gpio_set_value(&priv->gpio_mux_reset, 0);\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int pca954x_remove(struct udevice *dev)\n+{\n+\tif (IS_ENABLED(CONFIG_DM_GPIO)) {\n+\t\tstruct pca954x_priv *priv = dev_get_priv(dev);\n+\n+\t\tif (dm_gpio_is_valid(&priv->gpio_mux_reset))\n+\t\t\tdm_gpio_free(dev, &priv->gpio_mux_reset);\n+\t}\n+\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","v3"]}