From: Varka Bhadram <varkabhadram-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Grygorii Strashko
<grygorii.strashko-l0cyMroinI0@public.gmane.org>,
santosh.shilimkar-l0cyMroinI0@public.gmane.org,
Linus Walleij
<linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Alexandre Courbot
<gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: ivan.khoronzhuk-l0cyMroinI0@public.gmane.org,
m-karicheri2-l0cyMroinI0@public.gmane.org,
Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Kumar Gala <galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v2] gpio: keystone: add dsp gpio controller driver
Date: Wed, 23 Jul 2014 21:24:07 +0530 [thread overview]
Message-ID: <53CFDA9F.2010406@gmail.com> (raw)
In-Reply-To: <1406126699-10053-1-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
On Wednesday 23 July 2014 08:14 PM, Grygorii Strashko wrote:
(...)
> +
> +Required Properties:
> +- compatible: should be "ti,keystone-dsp-gpio"
> +
> +- ti,syscon-dev : phandle/offset pair. The phandle to syscon used to
> + access device state control registers and the offset
> + in order to use block of device's specific registers.
> +
> +- gpio-controller : Marks the device node as a gpio controller.
> +
> +- #gpio-cells : Should be one.
> + See gpio.txt in this directory for a of the cells format
> +
proper indentation for all the properties...
> +Please refer to gpio.txt in this directory for details of the common GPIO
> +bindings used by client devices.
> +
> +Example:
> + dspgpio0: keystone_dsp_gpio@02620240 {
> + compatible = "ti,keystone-dsp-gpio";
> + ti,syscon-dev = <&devctrl 0x240>;
> + gpio-controller;
> + #gpio-cells = <2>;
> + };
> +
> + dsp0: dsp0 {
> + compatible = "linux,rproc-user";
> + ...
> + kick-gpio = <&dspgpio0 27>;
> + };
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index 4a1b511..990871f 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -158,6 +158,14 @@ config GPIO_EP93XX
> depends on ARCH_EP93XX
> select GPIO_GENERIC
>
> +config GPIO_KEYSTONE_DSP
> + tristate "Keystone DSP GPIO support"
> + depends on ARCH_KEYSTONE
> + help
> + Say yes here to support the DSP GPIO driver for Keystone 2. This defines
> + up to 28 GPIOs per each Remote (DSP) core. This is used to send
> + signals from ARM to the Remote (DSP) core.
> +
> config GPIO_ZEVIO
> bool "LSI ZEVIO SoC memory mapped GPIOs"
> depends on ARM && OF_GPIO
> diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
> index d10f6a9..15c3389 100644
> --- a/drivers/gpio/Makefile
> +++ b/drivers/gpio/Makefile
> @@ -34,6 +34,7 @@ obj-$(CONFIG_GPIO_IOP) += gpio-iop.o
> obj-$(CONFIG_GPIO_IT8761E) += gpio-it8761e.o
> obj-$(CONFIG_GPIO_JANZ_TTL) += gpio-janz-ttl.o
> obj-$(CONFIG_GPIO_KEMPLD) += gpio-kempld.o
> +obj-$(CONFIG_GPIO_KEYSTONE_DSP) += gpio-keystone.o
> obj-$(CONFIG_ARCH_KS8695) += gpio-ks8695.o
> obj-$(CONFIG_GPIO_INTEL_MID) += gpio-intel-mid.o
> obj-$(CONFIG_GPIO_LP3943) += gpio-lp3943.o
> diff --git a/drivers/gpio/gpio-keystone.c b/drivers/gpio/gpio-keystone.c
> new file mode 100644
> index 0000000..7909a1c
> --- /dev/null
> +++ b/drivers/gpio/gpio-keystone.c
> @@ -0,0 +1,138 @@
> +/*
> + * Keystone 2 DSP GPIO support.
> + *
> + * Copyright (C) 2014 Texas Instruments, Inc.
> + * Author: Murali Karicheri <m-karicheri2-l0cyMroinI0@public.gmane.org>
> + * Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +#include <linux/module.h>
> +#include <linux/of_platform.h>
> +#include <linux/gpio.h>
> +#include <linux/mfd/syscon.h>
> +#include <linux/regmap.h>
> +
includes in alphabetical order..
> +/* 28 bits in IPCGRx are treated as GPIO pins to generate interrupt */
> +#define GPIOS_PER_BANK 28
> +#define GPIO_OFFSET 4
> +
> +struct keystone_gpio_bank {
> + struct gpio_chip chip;
> + struct device *dev;
> + struct regmap *devctrl_regs;
> + u32 devctrl_offset;
> +};
> +#define chip_to_bank(c) \
> + container_of(c, struct keystone_gpio_bank, chip)
> +
> +static int keystone_gpio_direction_out(struct gpio_chip *c,
> + unsigned ofs, int val)
> +{
> + return 0;
> +}
> +
> +static int keystone_gpio_get(struct gpio_chip *c, unsigned ofs)
> +{
> + struct keystone_gpio_bank *bank = chip_to_bank(c);
> + int bit = ofs + GPIO_OFFSET;
> + int ret;
> + u32 val = 0;
> +
> + ret = regmap_read(bank->devctrl_regs, bank->devctrl_offset, &val);
> + if (ret < 0)
> + dev_dbg(bank->dev, "gpio read failed ret(%d)\n", ret);
If this read fails what will happen...?
we will get the debug message and return (val >> bit) & 1, But this val can be garbage or zero...?
> +
> + return (val >> bit) & 1;
> +}
--
-Varka Bhadram
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-07-23 15:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-23 14:44 [PATCH v2] gpio: keystone: add dsp gpio controller driver Grygorii Strashko
[not found] ` <1406126699-10053-1-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
2014-07-23 15:54 ` Varka Bhadram [this message]
2014-07-24 19:15 ` Suman Anna
2014-07-25 15:44 ` Grygorii Strashko
2014-08-08 12:53 ` Linus Walleij
2014-08-11 16:06 ` Grygorii Strashko
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=53CFDA9F.2010406@gmail.com \
--to=varkabhadram-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=grygorii.strashko-l0cyMroinI0@public.gmane.org \
--cc=ivan.khoronzhuk-l0cyMroinI0@public.gmane.org \
--cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=m-karicheri2-l0cyMroinI0@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=santosh.shilimkar-l0cyMroinI0@public.gmane.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).