All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [PATCH v4 1/2] drivers: gpio: add broadcom iproc gpio driver support
Date: Mon, 4 May 2020 08:17:55 -0600	[thread overview]
Message-ID: <CAPnjgZ1bdtEFD5YebCdWGLEdPUNkOKT3mud8rxqieDakLBatEQ@mail.gmail.com> (raw)
In-Reply-To: <20200503163153.11532-2-rayagonda.kokatanur@broadcom.com>

Hi Rayagonda,

On Sun, 3 May 2020 at 10:32, Rayagonda Kokatanur
<rayagonda.kokatanur@broadcom.com> wrote:
>
> Add gpio driver support for Broadcom iproc-based socs.
>
> Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
> Signed-off-by: Sheetal Tigadoli <sheetal.tigadoli@broadcom.com>
> ---
>  drivers/gpio/Kconfig      |  11 ++
>  drivers/gpio/Makefile     |   1 +
>  drivers/gpio/iproc_gpio.c | 269 ++++++++++++++++++++++++++++++++++++++
>  3 files changed, 281 insertions(+)
>  create mode 100644 drivers/gpio/iproc_gpio.c
>
[..]

> +static int iproc_gpio_ofdata_to_platdata(struct udevice *dev)
> +{
> +       struct iproc_gpio_platdata *plat = dev_get_platdata(dev);
> +       struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
> +       int ret;
> +       char name[10];
> +
> +       plat->base = dev_read_addr_ptr(dev);
> +       if (!plat->base) {
> +               debug("%s: Failed to get base address\n", __func__);
> +               return -EINVAL;
> +       }
> +
> +       ret = dev_read_u32(dev, "ngpios", &plat->ngpios);
> +       if (ret < 0) {
> +               dev_err(dev, "%s: Failed to get ngpios\n", __func__);
> +               return ret;
> +       }
> +
> +       uclass_get_device_by_phandle(UCLASS_PINCTRL, dev, "gpio-ranges",
> +                                    &plat->pinctrl_dev);

Should check return value here.

> +
> +       INIT_LIST_HEAD(&plat->gpiomap);
> +       ret = iproc_get_gpio_pctrl_mapping(dev);

This is confusing, please drop the !

> +       if (ret) {
> +               dev_err(dev, "%s: Failed to get gpio to pctrl map ret(%d)\n",
> +                       __func__, ret);
> +               return ret;
> +       }
> +
> +       snprintf(name, sizeof(name), "GPIO%d", dev->req_seq);
> +       plat->name = strdup(name);

Check for error and return -ENOMEM

> +
> +       uc_priv->gpio_count = plat->ngpios;
> +       uc_priv->bank_name = plat->name;
> +
> +       dev_info(dev, ":bank name(%s) base %p, #gpios %d\n",
> +                plat->name, plat->base, plat->ngpios);
> +
> +       return 0;
> +}
> +

[..]


Regards,
Simon

  reply	other threads:[~2020-05-04 14:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-03 16:31 [PATCH v4 0/2] add brcm iproc gpio driver Rayagonda Kokatanur
2020-05-03 16:31 ` [PATCH v4 1/2] drivers: gpio: add broadcom iproc gpio driver support Rayagonda Kokatanur
2020-05-04 14:17   ` Simon Glass [this message]
2020-05-03 16:31 ` [PATCH v4 2/2] gpio: do not include <asm/arch/gpio.h> on TARGET_BCMNS3 Rayagonda Kokatanur

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPnjgZ1bdtEFD5YebCdWGLEdPUNkOKT3mud8rxqieDakLBatEQ@mail.gmail.com \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.