devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org>
To: Varka Bhadram
	<varkabhadram-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>,
	santosh.shilimkar-l0cyMroinI0@public.gmane.org,
	Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>
Cc: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Kumar Gala <galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	ivan.khoronzhuk-l0cyMroinI0@public.gmane.org,
	m-karicheri2-l0cyMroinI0@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v2] irqchip: add keystone irq controller ip driver
Date: Wed, 23 Jul 2014 21:01:10 +0300	[thread overview]
Message-ID: <53CFF866.6060703@ti.com> (raw)
In-Reply-To: <53CFD581.5040908-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Hi,

On 07/23/2014 06:32 PM, Varka Bhadram wrote:
> 
> On Wednesday 23 July 2014 08:10 PM, Grygorii Strashko wrote:
>> On Keystone SOCs, DSP cores can send interrupts to ARM
>> host using the IRQ controller IP. It provides 28 IRQ
>> signals to ARM. The IRQ handler running on HOST OS can
>> identify DSP signal source by analyzing SRCCx bits in
>> IPCARx registers. This is one of the component used by
>> the IPC mechanism used on Keystone SOCs.
> 
> (...)
> 
>> +Required Properties:
>> +- compatible: should be "ti,keystone-irq"
>> +- ti,syscon-dev : phandle and offset pair. The phandle to syscon used to
>> +            access device control registers and the offset inside
>> +            device control registers range.
>> +- interrupt-controller : Identifies the node as an interrupt controller
>> +- #interrupt-cells : Specifies the number of cells needed to encode 
>> interrupt
>> +                     source should be 1.
>> +- interrupts: interrupt reference to primary interrupt controller
> 
> proper indentation for the properties
> 
> - compatible        : Should be "ti,keystone-irq"
> - ti,syscon-dev        : phandle and offset pair. The phandle to syscon 
> used to
>                access device control registers and the offset inside
>                device control registers range.
> 
>> +
>> +Please refer to interrupts.txt in this directory for details of the 
>> common
>> +Interrupt Controllers bindings used by client devices.
>> +
> 
> (...)
> 
>> +#include <linux/irq.h>
>> +#include <linux/bitops.h>
>> +#include <linux/module.h>
>> +#include <linux/moduleparam.h>
>> +#include <linux/irqdomain.h>
>> +#include <linux/irqchip/chained_irq.h>
>> +#include <linux/of.h>
>> +#include <linux/of_platform.h>
>> +#include <linux/mfd/syscon.h>
>> +#include <linux/regmap.h>
> 
> Includes in alphabetical order...
> 
> Give one line gap before local includes..
> 
> ...
> #include <linux/regmap.h>
> 
> #include "irqchip.h"
> 
>> +#include "irqchip.h"
>> +
>> +
>> +/* The source ID bits start from 4 to 31 (total 28 bits)*/
>> +#define BIT_OFS            4
>> +#define KEYSTONE_N_IRQ        (32 - BIT_OFS)
>> +
>> +struct keystone_irq_device {
>> +    struct device        *dev;
>> +    struct irq_chip         chip;
>> +    u32             mask;
>> +    u32             irq;
>> +    struct irq_domain    *irqd;
>> +    struct regmap        *devctrl_regs;
>> +    u32            devctrl_offset;
>> +};
>> +
>> +static inline u32 keystone_irq_readl(struct keystone_irq_device *kirq)
>> +{
>> +    int ret;
>> +    u32 val = 0;
>> +
>> +    ret = regmap_read(kirq->devctrl_regs, kirq->devctrl_offset, &val);
>> +    if (ret < 0)
>> +        dev_dbg(kirq->dev, "irq read failed ret(%d)\n", ret);
>> +    return val;
>> +}
>> +
>> +static inline void
>> +keystone_irq_writel(struct keystone_irq_device *kirq, u32 value)
>> +{
>> +    int ret;
>> +
>> +    ret = regmap_write(kirq->devctrl_regs, kirq->devctrl_offset, value);
>> +    if (ret < 0)
>> +        dev_dbg(kirq->dev, "irq write failed ret(%d)\n", ret);
> 
> It can be like
> 
> if (!regmap_write(kirq->devctrl_regs, kirq->devctrl_offset, value))
>      dev_dbg(kirq->dev, "irq write failed \n");
> 
>> +}
>> +
>> +

Pls, Pay attention that I'd like to see ret code here in case of failure.

> 
> (...)
> 
>> +}
>> +
>> +static int keystone_irq_map(struct irq_domain *h, unsigned int virq,
>> +                irq_hw_number_t hw)
> 
> should match open parenthesis:
> 
> static int keystone_irq_map(struct irq_domain *h, unsigned int virq,
>                  irq_hw_number_t hw)
> 
>> +{
>> +    struct keystone_irq_device *kirq = h->host_data;
>> +
>> +    irq_set_chip_data(virq, kirq);
>> +    irq_set_chip_and_handler(virq, &kirq->chip, handle_level_irq);
>> +    set_irq_flags(virq, IRQF_VALID | IRQF_PROBE);
>> +    return 0;
>> +}
>> +
>> +static struct irq_domain_ops keystone_irq_ops = {
>> +    .map    = keystone_irq_map,
>> +    .xlate    = irq_domain_xlate_onecell,
>> +};
>> +
>> +static int keystone_irq_probe(struct platform_device *pdev)
>> +{
>> +    struct device *dev = &pdev->dev;
>> +    struct device_node *np = dev->of_node;
>> +    struct keystone_irq_device *kirq;
>> +    int ret;
>> +
>> +    if (np == NULL)
>> +        return -EINVAL;
> 
> return -ENODEV??????

If probe is executed - the dev is present, but it was created in a wrong/unsupported way
or dev structure contains wrong data.

> 
> (...)
> 
>> +static struct platform_driver keystone_irq_device_driver = {
>> +    .probe        = keystone_irq_probe,
>> +    .remove        = keystone_irq_remove,
>> +    .driver        = {
>> +        .name    = "keystone_irq",
>> +        .owner    = THIS_MODULE,
> 
> No need to update it. Its done by module_platform_driver()..
> 
>> +        .of_match_table    = of_match_ptr(keystone_irq_dt_ids),
> 
> This driver is always populate through the dts file. So no need to use
> of_match_ptr....
> 

Regards,
-grygorii
--
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

  parent reply	other threads:[~2014-07-23 18:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-23 14:40 [PATCH v2] irqchip: add keystone irq controller ip driver Grygorii Strashko
2014-07-23 15:32 ` Varka Bhadram
     [not found]   ` <53CFD581.5040908-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-07-23 18:01     ` Grygorii Strashko [this message]
2014-07-24  0:58       ` Varka Bhadram
     [not found]         ` <53D05A4F.5080905-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-07-24 16:20           ` Grygorii Strashko
     [not found] ` <1406126430-9978-1-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
2014-08-17 19:39   ` Jason Cooper

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=53CFF866.6060703@ti.com \
    --to=grygorii.strashko-l0cymroini0@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=ivan.khoronzhuk-l0cyMroinI0@public.gmane.org \
    --cc=jason-NLaQJdtUoK4Be96aLqz0jA@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 \
    --cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
    --cc=varkabhadram-Re5JQEeQqe8AvxtiuMwx3w@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).