[{"id":1765730,"web_url":"http://patchwork.ozlabs.org/comment/1765730/","msgid":"<CAPnjgZ1W4mjC1Tqu-9oJx2grNitv4=Dzk4RfWZQ0ug3Y1+KSqA@mail.gmail.com>","list_archive_url":null,"date":"2017-09-09T04:55:11","subject":"Re: [U-Boot] [PATCH] i2c: muxes: pca954x: Add support for GPIO\n\treset line","submitter":{"id":6170,"url":"http://patchwork.ozlabs.org/api/people/6170/","name":"Simon Glass","email":"sjg@chromium.org"},"content":"On 5 September 2017 at 12:24, Moritz Fischer <moritz.fischer@ettus.com> wrote:\n> This commit adds support for GPIO reset lines matching the\n> common linux \"reset-gpios\" devicetree binding.\n>\n> Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com>\n> Cc: Heiko Schocher <hs@denx.de>\n> Cc: Stefan Roese <sr@denx.de>\n> Cc: Marek Behún <marek.behun@nic.cz>\n> Cc: Simon Glass <sjg@chromium.org>\n> Cc: Michal Simek <monstr@monstr.eu>\n>\n> ---\n>  drivers/i2c/muxes/pca954x.c | 44 +++++++++++++++++++++++++++++++++++++++++++-\n>  1 file changed, 43 insertions(+), 1 deletion(-)\n>\n> diff --git a/drivers/i2c/muxes/pca954x.c b/drivers/i2c/muxes/pca954x.c\n> index 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:    GPL-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\nCan we drop the #ifdef?\n\n>\n>  DECLARE_GLOBAL_DATA_PTR;\n>\n> @@ -30,6 +34,9 @@ struct chip_desc {\n>  struct pca954x_priv {\n>         u32 addr; /* I2C mux address */\n>         u32 width; /* I2C mux width - number of busses */\n> +#ifdef CONFIG_DM_GPIO\n> +       struct 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>         return 0;\n>  }\n>\n> +static int pca954x_probe(struct udevice *dev)\n> +{\n> +#ifdef CONFIG_DM_GPIO\n\nCan we use if (IS_ENABLED(CONFIG_DM_GPIO)) ?\n\n> +       struct pca954x_priv *priv = dev_get_priv(dev);\n> +       int err;\n> +\n> +       err = gpio_request_by_name(dev, \"reset-gpios\", 0,\n> +                       &priv->gpio_mux_reset, GPIOD_IS_OUT);\n> +\n> +       /* it's optional so only bail if we get a real error */\n> +       if (err && (err != -ENOENT))\n> +               return err;\n> +\n> +       /* dm will take care of polarity */\n> +       if (dm_gpio_is_valid(&priv->gpio_mux_reset))\n> +               dm_gpio_set_value(&priv->gpio_mux_reset, 0);\n> +\n> +#endif /* CONFIG_DM_GPIO */\n> +       return 0;\n> +}\n> +\n> +static int pca954x_remove(struct udevice *dev)\n> +{\n> +#ifdef CONFIG_DM_GPIO\n> +       struct pca954x_priv *priv = dev_get_priv(dev);\n> +\n> +       if (dm_gpio_is_valid(&priv->gpio_mux_reset))\n> +               dm_gpio_free(dev, &priv->gpio_mux_reset);\n> +\n> +#endif /* CONFIG_DM_GPIO */\n> +       return 0;\n> +}\n> +\n>  U_BOOT_DRIVER(pca954x) = {\n>         .name = \"pca954x\",\n>         .id = UCLASS_I2C_MUX,\n>         .of_match = pca954x_ids,\n> +       .probe = pca954x_probe,\n> +       .remove = pca954x_remove,\n>         .ops = &pca954x_ops,\n>         .ofdata_to_platdata = pca954x_ofdata_to_platdata,\n>         .priv_auto_alloc_size = sizeof(struct pca954x_priv),\n> --\n> 2.14.1\n>","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=google.com header.i=@google.com\n\theader.b=\"RaQVPwhr\"; \n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"ZmhbQo9Q\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xq2Jm1dGjz9sBZ\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat,  9 Sep 2017 15:08:23 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 6F0F3C21F16; Sat,  9 Sep 2017 05:01:06 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 6170EC21F6D;\n\tSat,  9 Sep 2017 04:56:59 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 9BC25C21F78; Sat,  9 Sep 2017 04:56:34 +0000 (UTC)","from mail-qt0-f181.google.com (mail-qt0-f181.google.com\n\t[209.85.216.181])\n\tby lists.denx.de (Postfix) with ESMTPS id 91678C21CA5\n\tfor <u-boot@lists.denx.de>; Sat,  9 Sep 2017 04:55:33 +0000 (UTC)","by mail-qt0-f181.google.com with SMTP id q8so10592696qtb.5\n\tfor <u-boot@lists.denx.de>; Fri, 08 Sep 2017 21:55:33 -0700 (PDT)","by 10.200.37.200 with HTTP; Fri, 8 Sep 2017 21:55:11 -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.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,\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; d=google.com;\n\ts=20161025; \n\th=mime-version:sender:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:content-transfer-encoding;\n\tbh=y86CGx5hMK6UxcPlvcQRfFzA+sTzhOu3E8j/d2nlmHw=;\n\tb=RaQVPwhrT6APhEi3zFQYClFeOnTXF2/GOu5lZ0nDpEysi73raNQujp+q6X6q/e+J5R\n\txAZthpPim8ZhVsQgoyH8t5LboAWAIBr3oxosrfRTcEmeJ0efY0IdTVqyDEWzQ6pNGHtn\n\tP+tgWjEwv8tvD1XpE1+Iwx//kdeSlBqsBjcmXlzR1d4fryIVy9soAxEq5hhwEp/fpDQ8\n\t6CKz+Dv1zKCb0Kv6H2jp65lFCobxGEML6R0TDAvODIVxkxYT+snlaskDX9oHzzDVH4Ow\n\tpecMoDIk8UEKt3DOcfbEbE4v09+RfgvmRE2K3SsMmXGqjWNe+PxIobc1P9aSR3Za7h/u\n\tD8Rg==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=mime-version:sender:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:content-transfer-encoding;\n\tbh=y86CGx5hMK6UxcPlvcQRfFzA+sTzhOu3E8j/d2nlmHw=;\n\tb=ZmhbQo9Qu9lUhSJFqvG2UYoWHFhv5G0PLOVrv3wwkuw02qxSd2ysqovkV6YsATB1hP\n\tpa3Ix4Ui75UrucDQ5FDqLWOFxjt7NyGTcw9mwOxCguXBNGknqIYUIA8RgUYNLn9C6vEb\n\tvyXMb3Klc2jOMCGQIyxbTT7ANfa70admg1YmM="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:sender:in-reply-to:references:from\n\t:date:message-id:subject:to:cc:content-transfer-encoding;\n\tbh=y86CGx5hMK6UxcPlvcQRfFzA+sTzhOu3E8j/d2nlmHw=;\n\tb=pJLN0fKvmQd3S30QUgnDjb0fraM54CuRPkKdu+hNyHqikC6YfaP/2N2VORLTEh94Tx\n\tAWh2QMrJ+4prajP6XH4FSfG45AGPvVW5mZEWp2LxHiuzn28LZ8qW/rDI9mV6RKCJzsCv\n\tSTV7oEH1SZXPJalsv8IT3zISStq6cRmvK4UYDhxWRspgjspUN1rV8ZjrOrJrCjuPh2q0\n\tw88VSlvV58yYnh2uQo6D+EUjK/cGEOqn6iEaat5qK9URJDck0BxUmARZVL5yhK/PmpjQ\n\tpssDYxa6STBi+4OLSmj+hbywpEfhDWrKhRWHRNx+JwZGYrednvoMXObaBHolWgbCyl3F\n\t71DA==","X-Gm-Message-State":"AHPjjUiPAvHCy1ohYqjumsNLe+bTzEvqlxbM70ILvRqzScc9kiSXw2IV\n\t6Z/IYvxhzFO8cRN0BmKAAUl8ZOpwvYU29UPDcJTOKw==","X-Google-Smtp-Source":"AOwi7QDUzEfjx5bMDbX8DeeplW3450O5DK+8t0TiNGrqCwoQHr7DqfPjIVGxYTiLjZ2wlAJ5gqTSpw7f2iKLOjochDI=","X-Received":"by 10.200.41.239 with SMTP id 44mr6881698qtt.138.1504932932326; \n\tFri, 08 Sep 2017 21:55:32 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<20170905182448.21932-1-moritz.fischer@ettus.com>","References":"<20170905182448.21932-1-moritz.fischer@ettus.com>","From":"Simon Glass <sjg@chromium.org>","Date":"Fri, 8 Sep 2017 22:55:11 -0600","X-Google-Sender-Auth":"Rrr_C7ekQgnarRnbqyllYGWnf1Y","Message-ID":"<CAPnjgZ1W4mjC1Tqu-9oJx2grNitv4=Dzk4RfWZQ0ug3Y1+KSqA@mail.gmail.com>","To":"Moritz Fischer <moritz.fischer@ettus.com>","Cc":"U-Boot Mailing List <u-boot@lists.denx.de>, mdf@kernel.org,\n\tStefan Roese <sr@denx.de>","Subject":"Re: [U-Boot] [PATCH] i2c: muxes: pca954x: Add support for GPIO\n\treset line","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>"}},{"id":1765740,"web_url":"http://patchwork.ozlabs.org/comment/1765740/","msgid":"<CAAtXAHfCAET8f5dMZ_dKUr07fjZBPL48ckUb9K-ieOYzmvPtVQ@mail.gmail.com>","list_archive_url":null,"date":"2017-09-09T05:27:02","subject":"Re: [U-Boot] [PATCH] i2c: muxes: pca954x: Add support for GPIO\n\treset line","submitter":{"id":65751,"url":"http://patchwork.ozlabs.org/api/people/65751/","name":"Moritz Fischer","email":"moritz.fischer@ettus.com"},"content":"Hi Simon,\n\nOn Fri, Sep 8, 2017 at 9:55 PM, Simon Glass <sjg@chromium.org> wrote:\n> On 5 September 2017 at 12:24, Moritz Fischer <moritz.fischer@ettus.com> wrote:\n>> This commit adds support for GPIO reset lines matching the\n>> common linux \"reset-gpios\" devicetree binding.\n>>\n>> Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com>\n>> Cc: Heiko Schocher <hs@denx.de>\n>> Cc: Stefan Roese <sr@denx.de>\n>> Cc: Marek Behún <marek.behun@nic.cz>\n>> Cc: Simon Glass <sjg@chromium.org>\n>> Cc: Michal Simek <monstr@monstr.eu>\n>>\n>> ---\n>>  drivers/i2c/muxes/pca954x.c | 44 +++++++++++++++++++++++++++++++++++++++++++-\n>>  1 file changed, 43 insertions(+), 1 deletion(-)\n>>\n>> diff --git a/drivers/i2c/muxes/pca954x.c b/drivers/i2c/muxes/pca954x.c\n>> index 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:    GPL-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> Can we drop the #ifdef?\n\nYeah, will do.\n>\n>>\n>>  DECLARE_GLOBAL_DATA_PTR;\n>>\n>> @@ -30,6 +34,9 @@ struct chip_desc {\n>>  struct pca954x_priv {\n>>         u32 addr; /* I2C mux address */\n>>         u32 width; /* I2C mux width - number of busses */\n>> +#ifdef CONFIG_DM_GPIO\n>> +       struct 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>>         return 0;\n>>  }\n>>\n>> +static int pca954x_probe(struct udevice *dev)\n>> +{\n>> +#ifdef CONFIG_DM_GPIO\n>\n> Can we use if (IS_ENABLED(CONFIG_DM_GPIO)) ?\n\nI suppose. I was wondering. Is this in general preferable?\n>\n>> +       struct pca954x_priv *priv = dev_get_priv(dev);\n>> +       int err;\n>> +\n>> +       err = gpio_request_by_name(dev, \"reset-gpios\", 0,\n>> +                       &priv->gpio_mux_reset, GPIOD_IS_OUT);\n>> +\n>> +       /* it's optional so only bail if we get a real error */\n>> +       if (err && (err != -ENOENT))\n>> +               return err;\n>> +\n>> +       /* dm will take care of polarity */\n>> +       if (dm_gpio_is_valid(&priv->gpio_mux_reset))\n>> +               dm_gpio_set_value(&priv->gpio_mux_reset, 0);\n>> +\n>> +#endif /* CONFIG_DM_GPIO */\n>> +       return 0;\n>> +}\n>> +\n>> +static int pca954x_remove(struct udevice *dev)\n>> +{\n>> +#ifdef CONFIG_DM_GPIO\n>> +       struct pca954x_priv *priv = dev_get_priv(dev);\n>> +\n>> +       if (dm_gpio_is_valid(&priv->gpio_mux_reset))\n>> +               dm_gpio_free(dev, &priv->gpio_mux_reset);\n>> +\n>> +#endif /* CONFIG_DM_GPIO */\n>> +       return 0;\n>> +}\n>> +\n>>  U_BOOT_DRIVER(pca954x) = {\n>>         .name = \"pca954x\",\n>>         .id = UCLASS_I2C_MUX,\n>>         .of_match = pca954x_ids,\n>> +       .probe = pca954x_probe,\n>> +       .remove = pca954x_remove,\n>>         .ops = &pca954x_ops,\n>>         .ofdata_to_platdata = pca954x_ofdata_to_platdata,\n>>         .priv_auto_alloc_size = sizeof(struct pca954x_priv),\n>> --\n>> 2.14.1\n>>\n\nThanks for the review,\n\nMoritz","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=\"JEcz5Ug0\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xq2kf5hRbz9sBZ\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat,  9 Sep 2017 15:27:21 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid F0297C21F32; Sat,  9 Sep 2017 05:27:12 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 24ECAC21C60;\n\tSat,  9 Sep 2017 05:27:09 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 489DDC21C60; Sat,  9 Sep 2017 05:27:08 +0000 (UTC)","from mail-lf0-f45.google.com (mail-lf0-f45.google.com\n\t[209.85.215.45])\n\tby lists.denx.de (Postfix) with ESMTPS id E884BC21C46\n\tfor <u-boot@lists.denx.de>; Sat,  9 Sep 2017 05:27:03 +0000 (UTC)","by mail-lf0-f45.google.com with SMTP id c80so9272501lfh.0\n\tfor <u-boot@lists.denx.de>; Fri, 08 Sep 2017 22:27:03 -0700 (PDT)","by 10.46.72.10 with HTTP; Fri, 8 Sep 2017 22:27:02 -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=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc:content-transfer-encoding;\n\tbh=6S/ozTkC0W+6nPLEboU7Pf/SPueIBz27OFHun0qtwpM=;\n\tb=JEcz5Ug0J7oAn+ysbKRi6r4QjVaybzZNkcGXcBwQQYEh9F0gio2JfqpexLzPLXaIMi\n\tvZbQd2uxuZNQmkJFcK+rZX+bZ0BYoUjAXEiqbrGiu/jURR0KrbEVYX68zAoTCJwhS8zf\n\tWYnLr/J86dlC/tCzBamY7ZlgwCRMH7AayFXQpZd5sHg5SxQaf/6YZIwrKcnjE1ZC/BVG\n\tyC7Xz2bOIjwBrfYpZ/jGmH3Mybd5nlkwYaXe7ioF/xFoKlylSdKw8DUc54vYSCLXF4v0\n\tlls9mH6HAGQdcVS5FmLVmbB3sLmxvvca6SSPDSMoQcPfHXOp49vok9acBTeoWXIEUOtz\n\t0pPA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc:content-transfer-encoding;\n\tbh=6S/ozTkC0W+6nPLEboU7Pf/SPueIBz27OFHun0qtwpM=;\n\tb=terBlEpTmI3T5EN3N3lcFcg7n7+BVoLQ1mq0OuAvqT8o2GEuLaH5PFO7jL4HkBKqIy\n\tpA2RsdARWPWiF6MY5ON81sEZT1Ha+G4eQapw5Tf8eIYVGvNQqkEv5DFMziO9oi6z7Ml+\n\tlEnh69rY7aEAXODqYQuGhXCzYetwk1bsnWQ0myG2Ii1p4JiBAMcecSGzHMDxNW7S08EF\n\tdgmIflc843i1djkUlesi1FGMOxdsk/e40fvKEQ8gwle2Epw5qx+51Ab8qz3yD8JlMxRu\n\tD+uOqlfeNtnVFMuIK/vJz2GsAvPXqeTdX5cONyTMNrmrx02CbV5L7IRHGqC6azshTdGh\n\thZDg==","X-Gm-Message-State":"AHPjjUgq9rMBQ7NsQ1dgaIXMiPvREM+Uqkpml5+jEEThD+E7hwqkadkC\n\ttnR6aVeO5UrLiM0rq8VcMRw7JSQG9GaT","X-Google-Smtp-Source":"AOwi7QAK0xOp5AuEpPENx0Y64QuBwB5WwTqQjoMtbxD2cf9UaolowBaQukG5NwhfxCbffY0fWCpp18XdxaWARGqZOfE=","X-Received":"by 10.25.235.90 with SMTP id j87mr1829903lfh.251.1504934823175; \n\tFri, 08 Sep 2017 22:27:03 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<CAPnjgZ1W4mjC1Tqu-9oJx2grNitv4=Dzk4RfWZQ0ug3Y1+KSqA@mail.gmail.com>","References":"<20170905182448.21932-1-moritz.fischer@ettus.com>\n\t<CAPnjgZ1W4mjC1Tqu-9oJx2grNitv4=Dzk4RfWZQ0ug3Y1+KSqA@mail.gmail.com>","From":"Moritz Fischer <moritz.fischer@ettus.com>","Date":"Fri, 8 Sep 2017 22:27:02 -0700","Message-ID":"<CAAtXAHfCAET8f5dMZ_dKUr07fjZBPL48ckUb9K-ieOYzmvPtVQ@mail.gmail.com>","To":"Simon Glass <sjg@chromium.org>","Cc":"Stefan Roese <sr@denx.de>, U-Boot Mailing List <u-boot@lists.denx.de>","Subject":"Re: [U-Boot] [PATCH] i2c: muxes: pca954x: Add support for GPIO\n\treset line","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>"}},{"id":1767010,"web_url":"http://patchwork.ozlabs.org/comment/1767010/","msgid":"<CAPnjgZ2gK35=SkXpiazss6XC7RBZLTGpmY0sfCKPueC+vyjszA@mail.gmail.com>","list_archive_url":null,"date":"2017-09-12T12:28:55","subject":"Re: [U-Boot] [PATCH] i2c: muxes: pca954x: Add support for GPIO\n\treset line","submitter":{"id":6170,"url":"http://patchwork.ozlabs.org/api/people/6170/","name":"Simon Glass","email":"sjg@chromium.org"},"content":"+Tom for question below\n\nHi Moritz,\n\nOn 8 September 2017 at 23:27, Moritz Fischer <moritz.fischer@ettus.com> wrote:\n> Hi Simon,\n>\n> On Fri, Sep 8, 2017 at 9:55 PM, Simon Glass <sjg@chromium.org> wrote:\n>> On 5 September 2017 at 12:24, Moritz Fischer <moritz.fischer@ettus.com> wrote:\n>>> This commit adds support for GPIO reset lines matching the\n>>> common linux \"reset-gpios\" devicetree binding.\n>>>\n>>> Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com>\n>>> Cc: Heiko Schocher <hs@denx.de>\n>>> Cc: Stefan Roese <sr@denx.de>\n>>> Cc: Marek Behún <marek.behun@nic.cz>\n>>> Cc: Simon Glass <sjg@chromium.org>\n>>> Cc: Michal Simek <monstr@monstr.eu>\n>>>\n>>> ---\n>>>  drivers/i2c/muxes/pca954x.c | 44 +++++++++++++++++++++++++++++++++++++++++++-\n>>>  1 file changed, 43 insertions(+), 1 deletion(-)\n>>>\n>>> diff --git a/drivers/i2c/muxes/pca954x.c b/drivers/i2c/muxes/pca954x.c\n>>> index 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:    GPL-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>> Can we drop the #ifdef?\n>\n> Yeah, will do.\n>>\n>>>\n>>>  DECLARE_GLOBAL_DATA_PTR;\n>>>\n>>> @@ -30,6 +34,9 @@ struct chip_desc {\n>>>  struct pca954x_priv {\n>>>         u32 addr; /* I2C mux address */\n>>>         u32 width; /* I2C mux width - number of busses */\n>>> +#ifdef CONFIG_DM_GPIO\n>>> +       struct 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>>>         return 0;\n>>>  }\n>>>\n>>> +static int pca954x_probe(struct udevice *dev)\n>>> +{\n>>> +#ifdef CONFIG_DM_GPIO\n>>\n>> Can we use if (IS_ENABLED(CONFIG_DM_GPIO)) ?\n>\n> I suppose. I was wondering. Is this in general preferable?\n\nWell one benefit is that it reduces build-time code branching so we\ncan potentially detect build errors more easily (e.g. this driver\ncould be enabled for sandbox). We have traditionally had loads of\n#ifdefs in U-Boot and IMO they make the code harder to read. Note that\nusing if() relies on not using -O0 in many cases but I think we gave\nup on supporting -O0 some time ago since debugging of optimised code\nis better these days.\n\nTom, what do you think?\n\nRegards,\nSimon","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=google.com header.i=@google.com\n\theader.b=\"gqFR0x2X\"; \n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"BpT0vOli\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xs4mC5Y10z9rxl\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 12 Sep 2017 23:05:47 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 9E9FFC220FD; Tue, 12 Sep 2017 12:31:01 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id EB926C21DC5;\n\tTue, 12 Sep 2017 12:30:14 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 52051C21FE2; Tue, 12 Sep 2017 12:29:21 +0000 (UTC)","from mail-qt0-f178.google.com (mail-qt0-f178.google.com\n\t[209.85.216.178])\n\tby lists.denx.de (Postfix) with ESMTPS id 1308AC21E65\n\tfor <u-boot@lists.denx.de>; Tue, 12 Sep 2017 12:29:17 +0000 (UTC)","by mail-qt0-f178.google.com with SMTP id s18so23257965qta.3\n\tfor <u-boot@lists.denx.de>; Tue, 12 Sep 2017 05:29:17 -0700 (PDT)","by 10.200.37.200 with HTTP; Tue, 12 Sep 2017 05:28:55 -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.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,\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; d=google.com;\n\ts=20161025; \n\th=mime-version:sender:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:content-transfer-encoding;\n\tbh=nX/JR0eLSMM2C2gZI0/wYXShNd5Jw5JMR0V911dcJ5Q=;\n\tb=gqFR0x2XIwpCYhm/vBRvGqxtCzGoiw8d/sYJeuGVaBY/mTql86XIHcJc6d6AwhQ1ww\n\t0Rup3SYLDmZEuMkj4NIIPP4LD34u51oQzf3x5E6cg1BUvGNfvhWXPnCSz7P/zjJXwyS8\n\tIFFxrFVvtC+2bgY+yHvIE7z6ep2AzXWJXWZbM1aQ3yqiDv69rc+7USGwb16p3ZNOPUT8\n\tbaEcFTo9mDMBXAHGtkrbABK3LhP3sTdLnGUY5RLNiZOmOU0zFPvoablnw1tJAbTeQi+I\n\tvjKcxIgJtSoYWGi0exO2845KoJAnmZzdwosD2q5AxKZCBIIRoIdc4n4hEKXEjaAi5PPk\n\tVdZQ==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=mime-version:sender:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:content-transfer-encoding;\n\tbh=nX/JR0eLSMM2C2gZI0/wYXShNd5Jw5JMR0V911dcJ5Q=;\n\tb=BpT0vOlipyWQPy10PN83nz9K6i8uzk3khZWQatXi6yyGUe3tMoXgbYi6S8n6iRWIAI\n\tg9qh9DGsHmRl2GyR3jAN13xwka2CVRiwv6WuDcWlhgyoAcUdsqiQ2DVCgNeYd+M7WXb5\n\tkv9EdPgFRTdC3fJy9NleRoT49ilBoXIe7ntpw="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:sender:in-reply-to:references:from\n\t:date:message-id:subject:to:cc:content-transfer-encoding;\n\tbh=nX/JR0eLSMM2C2gZI0/wYXShNd5Jw5JMR0V911dcJ5Q=;\n\tb=AjrOTP7CW6FGlq87HN/IQNNK5rswyHA3eNbsY6RR18dBHcnWNju3KG0xVOJC3XnLdH\n\t+7o8+/ETIkfQgbrmQWrbtQPdecct1ASUFvXFYLrdFz0AO8tZI/hVGW4Ybe/LW+GaSQ3W\n\tZ18DXxXhjsd8obwipTtljW3R64W2XQk3bAse5EsBlOg0aEIdNvZaD8nmdCcezqJj1jQh\n\tkSG62G0cprWJBmp2VROxa+KvhEAgpCIYXpYJDNJ1qXfkM4buhf96gLqUJh7/Ga3kh8vs\n\tknor0GeXa1y4dYWMLtgWlMOFHUBXpXMRJ7Fxe1N9BPSQYgtUKX1zEiqPT8m+mBqpSC1i\n\ttQew==","X-Gm-Message-State":"AHPjjUgISdic39Het4VW5hWTLKNP2Ewgij9STOLZiMF2DIWLBLQueDEQ\n\tLs+o/eTL15wv0kK2Coid6IFe+xbXI/em+AtNbEJfaw==","X-Google-Smtp-Source":"AOwi7QDcA4xvMKZrTQDM1nKc7lu51NhrsSo9mb8AqLpy+ImXuFZEg8us3Lqeoi5KAlCiQOyUzZyIHUGcwamHV4nNQr8=","X-Received":"by 10.200.52.241 with SMTP id x46mr12800320qtb.38.1505219355808; \n\tTue, 12 Sep 2017 05:29:15 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<CAAtXAHfCAET8f5dMZ_dKUr07fjZBPL48ckUb9K-ieOYzmvPtVQ@mail.gmail.com>","References":"<20170905182448.21932-1-moritz.fischer@ettus.com>\n\t<CAPnjgZ1W4mjC1Tqu-9oJx2grNitv4=Dzk4RfWZQ0ug3Y1+KSqA@mail.gmail.com>\n\t<CAAtXAHfCAET8f5dMZ_dKUr07fjZBPL48ckUb9K-ieOYzmvPtVQ@mail.gmail.com>","From":"Simon Glass <sjg@chromium.org>","Date":"Tue, 12 Sep 2017 06:28:55 -0600","X-Google-Sender-Auth":"B8DgwE9nUBMWOVe6MeupDjdZDMQ","Message-ID":"<CAPnjgZ2gK35=SkXpiazss6XC7RBZLTGpmY0sfCKPueC+vyjszA@mail.gmail.com>","To":"Moritz Fischer <moritz.fischer@ettus.com>","Cc":"Tom Rini <trini@konsulko.com>, U-Boot Mailing List <u-boot@lists.denx.de>,\n\tStefan Roese <sr@denx.de>","Subject":"Re: [U-Boot] [PATCH] i2c: muxes: pca954x: Add support for GPIO\n\treset line","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>"}}]