All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jamie Iles <jamie@jamieiles.com>
To: Alan Tull <delicious.quinoa@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,
	Linus Walleij <linus.walleij@stericsson.com>,
	linux-doc@vger.kernel.org,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Grant Likely <grant.likely@secretlab.ca>,
	Rob Herring <rob.herring@calxeda.com>,
	Steffen Trumtrar <s.trumtrar@pengutronix.de>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
	Jamie Iles <jamie@jamieiles.com>,
	Heiko Stuebner <heiko@sntech.de>, Alan Tull <atull@altera.com>,
	Dinh Nguyen <dinguyen@altera.com>,
	Yves Vandervennet <rocket.yvanderv@gmail.com>
Subject: Re: [PATCH 1/1] gpio: add a driver for the Synopsys DesignWare APB GPIO block
Date: Wed, 6 Nov 2013 23:34:27 +0000	[thread overview]
Message-ID: <20131106233427.GA6090@maple> (raw)
In-Reply-To: <1383778182-16941-2-git-send-email-delicious.quinoa@gmail.com>

Hi Alan,

On Wed, Nov 06, 2013 at 04:49:42PM -0600, Alan Tull wrote:
> diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
> new file mode 100644
> index 0000000..7957dfd
> --- /dev/null
> +++ b/drivers/gpio/gpio-dwapb.c
> @@ -0,0 +1,458 @@
> +/*
> + * Copyright (c) 2011 Jamie Iles
> + *
> + * 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.
> + *
> + * All enquiries to support@picochip.com
> + */
> +#include <linux/basic_mmio_gpio.h>
> +#include <linux/init.h>
> +#include <linux/io.h>
> +#include <linux/ioport.h>
> +#include <linux/irq.h>
> +#include <linux/irqdomain.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/of_address.h>
> +#include <linux/of_irq.h>
> +#include <linux/platform_device.h>
> +#include <linux/spinlock.h>
> +
> +#define GPIO_SWPORTA_DR		0x00
> +#define GPIO_SWPORTA_DDR	0x04
> +#define GPIO_SWPORTB_DR		0x0c
> +#define GPIO_SWPORTB_DDR	0x10
> +#define GPIO_SWPORTC_DR		0x18
> +#define GPIO_SWPORTC_DDR	0x1c
> +#define GPIO_SWPORTD_DR		0x24
> +#define GPIO_SWPORTD_DDR	0x28
> +#define GPIO_INTEN		0x30
> +#define GPIO_INTMASK		0x34
> +#define GPIO_INTTYPE_LEVEL	0x38
> +#define GPIO_INT_POLARITY	0x3c
> +#define GPIO_INTSTATUS		0x40
> +#define GPIO_PORTA_EOI		0x4c
> +#define GPIO_EXT_PORTA		0x50
> +#define GPIO_EXT_PORTB		0x54
> +#define GPIO_EXT_PORTC		0x58
> +#define GPIO_EXT_PORTD		0x5c
> +
> +struct dwapb_gpio;
> +
> +struct dwapb_gpio_port {
> +	struct bgpio_chip	bgc;
> +	bool			is_registered;
> +	struct dwapb_gpio	*gpio;
> +};
> +
> +struct dwapb_gpio {
> +	struct	device		*dev;
> +	void __iomem		*regs;
> +	struct dwapb_gpio_port	*ports;
> +	unsigned int		nr_ports;
> +	struct irq_domain	*domain;
> +	int			hwirq;

I'm not sure I fully understand what hwirq is in this context - is it 
the IRQ line from the Synopsys block to the system interrupt controller?  
If so I don't think this covers all configurations - the Picochip 
devices for instance have each GPIO in port A as an individual IRQ going 
to the VIC.

It looks here like hwirq is used for all of the interrupt registers so 
only one GPIO interrupt is supported?

> +static struct platform_driver dwapb_gpio_driver = {
> +	.driver		= {
> +		.name	= "gpio-dwapb",
> +		.owner	= THIS_MODULE,
> +		.of_match_table = of_match_ptr(dwapb_of_match),
> +	},
> +	.probe		= dwapb_gpio_probe,
> +	.remove		= dwapb_gpio_remove,
> +};
> +
> +static int __init dwapb_gpio_init(void)
> +{
> +	return platform_driver_register(&dwapb_gpio_driver);
> +}
> +postcore_initcall(dwapb_gpio_init);
> +
> +static void __exit dwapb_gpio_exit(void)
> +{
> +	platform_driver_unregister(&dwapb_gpio_driver);
> +}
> +module_exit(dwapb_gpio_exit);

We can replace the registration and unregistration with 
module_platform_driver() now.

Jamie

  parent reply	other threads:[~2013-11-06 23:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-06 22:49 [PATCH 0/1] gpio: add a driver for the Synopsys DesignWare APB GPIO Alan Tull
2013-11-06 22:49 ` Alan Tull
2013-11-06 22:49 ` [PATCH 1/1] gpio: add a driver for the Synopsys DesignWare APB GPIO block Alan Tull
2013-11-06 22:49   ` Alan Tull
2013-11-06 23:09   ` Fabio Estevam
2013-11-06 23:18     ` delicious quinoa
     [not found]       ` <CANk1AXTys8B-jW0bATu19pOauVqe=aMc7v=SxXPm7npWb2y7eA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-11-06 23:29         ` Sebastian Hesselbarth
2013-11-06 23:29           ` Sebastian Hesselbarth
2013-11-06 23:34   ` Jamie Iles [this message]
2013-11-06 23:44     ` Sebastian Hesselbarth
2013-11-07 21:06       ` delicious quinoa
2013-11-07 12:33   ` Sebastian Hesselbarth
2013-11-20 21:47     ` delicious quinoa
2013-11-20 23:40       ` Rob Herring
2013-11-20 23:46         ` Sebastian Hesselbarth

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=20131106233427.GA6090@maple \
    --to=jamie@jamieiles.com \
    --cc=atull@altera.com \
    --cc=delicious.quinoa@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dinguyen@altera.com \
    --cc=grant.likely@secretlab.ca \
    --cc=heiko@sntech.de \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rob.herring@calxeda.com \
    --cc=rocket.yvanderv@gmail.com \
    --cc=s.trumtrar@pengutronix.de \
    --cc=sebastian.hesselbarth@gmail.com \
    /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.