* [PATCH v2 0/2] gpio: davinci: reuse for keystone arch @ 2013-12-18 10:07 Grygorii Strashko [not found] ` <1387361272-20861-1-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org> 2013-12-20 9:40 ` [PATCH v2 0/2] gpio: davinci: reuse for keystone arch Linus Walleij 0 siblings, 2 replies; 12+ messages in thread From: Grygorii Strashko @ 2013-12-18 10:07 UTC (permalink / raw) To: Santosh Shilimkar, Linus Walleij, Sekhar Nori, Alexandre Courbot Cc: davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring, linux-gpio-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r This series is intended to update Davinci GPIO driver and reuse it for Keystone SoCs, because Keystone uses the similar GPIO IP like Davinci. Keystone GPIO IP: supports: - up to 32 GPIO lines; - only unbanked irqs; See Documentation: Keystone - http://www.ti.com/lit/ug/sprugv1/sprugv1.pdf This series based on: https://git.kernel.org/cgit/linux/kernel/git/nsekhar/linux-davinci.git/log/?h=v3.14/gpio Changes in v2: - minor comments applied, no functional changes v1: https://lkml.org/lkml/2013/12/12/366 Cc: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> Cc: Alexandre Courbot <gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Cc: Sekhar Nori <nsekhar-l0cyMroinI0@public.gmane.org> Cc: Santosh Shilimkar <santosh.shilimkar-l0cyMroinI0@public.gmane.org> Grygorii Strashko (2): gpio: davinci: don't create irq_domain in case of unbanked irqs gpio: davinci: reuse for Keystone SoC .../devicetree/bindings/gpio/gpio-davinci.txt | 4 +- drivers/gpio/gpio-davinci.c | 80 ++++++++++++++------ 2 files changed, 59 insertions(+), 25 deletions(-) -- 1.7.9.5 ^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <1387361272-20861-1-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>]
* [PATCH v2 1/2] gpio: davinci: don't create irq_domain in case of unbanked irqs [not found] ` <1387361272-20861-1-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org> @ 2013-12-18 10:07 ` Grygorii Strashko 2013-12-21 8:20 ` Prabhakar Lad [not found] ` <1387361272-20861-2-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org> 2013-12-18 10:07 ` [PATCH v2 2/2] gpio: davinci: reuse for Keystone SoC Grygorii Strashko 1 sibling, 2 replies; 12+ messages in thread From: Grygorii Strashko @ 2013-12-18 10:07 UTC (permalink / raw) To: Santosh Shilimkar, Linus Walleij, Sekhar Nori, Alexandre Courbot Cc: davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring, linux-gpio-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r The system may crash if: - there are more then 1 bank - unbanked irqs are enabled - someone will call gpio_to_irq() for GPIO from bank2 or above Hence, fix it by not creating irq_domain if unbanked irqs are enabled and correct gpio_to_irq_banked() to handle this properly. Cc: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> Cc: Alexandre Courbot <gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Cc: Sekhar Nori <nsekhar-l0cyMroinI0@public.gmane.org> Acked-by: Santosh Shilimkar <santosh.shilimkar-l0cyMroinI0@public.gmane.org> Signed-off-by: Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org> --- drivers/gpio/gpio-davinci.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c index 5d163c0..1b33806 100644 --- a/drivers/gpio/gpio-davinci.c +++ b/drivers/gpio/gpio-davinci.c @@ -351,7 +351,10 @@ static int gpio_to_irq_banked(struct gpio_chip *chip, unsigned offset) { struct davinci_gpio_controller *d = chip2controller(chip); - return irq_create_mapping(d->irq_domain, d->chip.base + offset); + if (d->irq_domain) + return irq_create_mapping(d->irq_domain, d->chip.base + offset); + else + return -ENXIO; } static int gpio_to_irq_unbanked(struct gpio_chip *chip, unsigned offset) @@ -429,7 +432,7 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) struct davinci_gpio_controller *chips = platform_get_drvdata(pdev); struct davinci_gpio_platform_data *pdata = dev->platform_data; struct davinci_gpio_regs __iomem *g; - struct irq_domain *irq_domain; + struct irq_domain *irq_domain = NULL; ngpio = pdata->ngpio; res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); @@ -453,18 +456,20 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) } clk_prepare_enable(clk); - irq = irq_alloc_descs(-1, 0, ngpio, 0); - if (irq < 0) { - dev_err(dev, "Couldn't allocate IRQ numbers\n"); - return irq; - } + if (!pdata->gpio_unbanked) { + irq = irq_alloc_descs(-1, 0, ngpio, 0); + if (irq < 0) { + dev_err(dev, "Couldn't allocate IRQ numbers\n"); + return -ENODEV; + } - irq_domain = irq_domain_add_legacy(NULL, ngpio, irq, 0, - &davinci_gpio_irq_ops, - chips); - if (!irq_domain) { - dev_err(dev, "Couldn't register an IRQ domain\n"); - return -ENODEV; + irq_domain = irq_domain_add_legacy(NULL, ngpio, irq, 0, + &davinci_gpio_irq_ops, + chips); + if (!irq_domain) { + dev_err(dev, "Couldn't register an IRQ domain\n"); + return -ENODEV; + } } /* @@ -475,8 +480,7 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) */ for (gpio = 0, bank = 0; gpio < ngpio; bank++, gpio += 32) { chips[bank].chip.to_irq = gpio_to_irq_banked; - if (!pdata->gpio_unbanked) - chips[bank].irq_domain = irq_domain; + chips[bank].irq_domain = irq_domain; } /* -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v2 1/2] gpio: davinci: don't create irq_domain in case of unbanked irqs 2013-12-18 10:07 ` [PATCH v2 1/2] gpio: davinci: don't create irq_domain in case of unbanked irqs Grygorii Strashko @ 2013-12-21 8:20 ` Prabhakar Lad [not found] ` <1387361272-20861-2-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org> 1 sibling, 0 replies; 12+ messages in thread From: Prabhakar Lad @ 2013-12-21 8:20 UTC (permalink / raw) To: Grygorii Strashko Cc: Santosh Shilimkar, Linus Walleij, Sekhar Nori, Alexandre Courbot, Rob Herring, dlos, linux-gpio@vger.kernel.org, LAK, LKML On Wed, Dec 18, 2013 at 3:37 PM, Grygorii Strashko <grygorii.strashko@ti.com> wrote: > The system may crash if: > - there are more then 1 bank > - unbanked irqs are enabled > - someone will call gpio_to_irq() for GPIO from bank2 or above > > Hence, fix it by not creating irq_domain if unbanked irqs are enabled > and correct gpio_to_irq_banked() to handle this properly. > > Cc: Linus Walleij <linus.walleij@linaro.org> > Cc: Alexandre Courbot <gnurou@gmail.com> > Cc: Sekhar Nori <nsekhar@ti.com> > > Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com> > Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Regards, --Prabhakar Lad ^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <1387361272-20861-2-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>]
* Re: [PATCH v2 1/2] gpio: davinci: don't create irq_domain in case of unbanked irqs [not found] ` <1387361272-20861-2-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org> @ 2013-12-22 15:52 ` Sekhar Nori 2013-12-23 13:35 ` Grygorii Strashko 0 siblings, 1 reply; 12+ messages in thread From: Sekhar Nori @ 2013-12-22 15:52 UTC (permalink / raw) To: Grygorii Strashko, Santosh Shilimkar, Linus Walleij, Alexandre Courbot Cc: davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring, linux-gpio-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r On Wednesday 18 December 2013 03:37 PM, Grygorii Strashko wrote: > The system may crash if: > - there are more then 1 bank s/then/than > - unbanked irqs are enabled > - someone will call gpio_to_irq() for GPIO from bank2 or above > > Hence, fix it by not creating irq_domain if unbanked irqs are enabled > and correct gpio_to_irq_banked() to handle this properly. > > Cc: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> > Cc: Alexandre Courbot <gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > Cc: Sekhar Nori <nsekhar-l0cyMroinI0@public.gmane.org> > > Acked-by: Santosh Shilimkar <santosh.shilimkar-l0cyMroinI0@public.gmane.org> > Signed-off-by: Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org> > --- > drivers/gpio/gpio-davinci.c | 34 +++++++++++++++++++--------------- > 1 file changed, 19 insertions(+), 15 deletions(-) > > diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c > index 5d163c0..1b33806 100644 > --- a/drivers/gpio/gpio-davinci.c > +++ b/drivers/gpio/gpio-davinci.c > @@ -351,7 +351,10 @@ static int gpio_to_irq_banked(struct gpio_chip *chip, unsigned offset) > { > struct davinci_gpio_controller *d = chip2controller(chip); > > - return irq_create_mapping(d->irq_domain, d->chip.base + offset); > + if (d->irq_domain) > + return irq_create_mapping(d->irq_domain, d->chip.base + offset); > + else > + return -ENXIO; > } > > static int gpio_to_irq_unbanked(struct gpio_chip *chip, unsigned offset) > @@ -429,7 +432,7 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) > struct davinci_gpio_controller *chips = platform_get_drvdata(pdev); > struct davinci_gpio_platform_data *pdata = dev->platform_data; > struct davinci_gpio_regs __iomem *g; > - struct irq_domain *irq_domain; > + struct irq_domain *irq_domain = NULL; > > ngpio = pdata->ngpio; > res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); > @@ -453,18 +456,20 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) > } > clk_prepare_enable(clk); > > - irq = irq_alloc_descs(-1, 0, ngpio, 0); > - if (irq < 0) { > - dev_err(dev, "Couldn't allocate IRQ numbers\n"); > - return irq; > - } > + if (!pdata->gpio_unbanked) { > + irq = irq_alloc_descs(-1, 0, ngpio, 0); > + if (irq < 0) { > + dev_err(dev, "Couldn't allocate IRQ numbers\n"); > + return -ENODEV; The code was correct before moving. Any objections to doing return irq; instead? Thanks, Sekhar ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 1/2] gpio: davinci: don't create irq_domain in case of unbanked irqs 2013-12-22 15:52 ` Sekhar Nori @ 2013-12-23 13:35 ` Grygorii Strashko 0 siblings, 0 replies; 12+ messages in thread From: Grygorii Strashko @ 2013-12-23 13:35 UTC (permalink / raw) To: Sekhar Nori, Santosh Shilimkar, Linus Walleij, Alexandre Courbot Cc: Rob Herring, prabhakar.csengg, davinci-linux-open-source, linux-gpio, linux-arm-kernel, linux-kernel On 12/22/2013 05:52 PM, Sekhar Nori wrote: > On Wednesday 18 December 2013 03:37 PM, Grygorii Strashko wrote: >> The system may crash if: >> - there are more then 1 bank > > s/then/than > >> - unbanked irqs are enabled >> - someone will call gpio_to_irq() for GPIO from bank2 or above >> >> Hence, fix it by not creating irq_domain if unbanked irqs are enabled >> and correct gpio_to_irq_banked() to handle this properly. >> >> Cc: Linus Walleij <linus.walleij@linaro.org> >> Cc: Alexandre Courbot <gnurou@gmail.com> >> Cc: Sekhar Nori <nsekhar@ti.com> >> >> Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com> >> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> >> --- >> drivers/gpio/gpio-davinci.c | 34 +++++++++++++++++++--------------- >> 1 file changed, 19 insertions(+), 15 deletions(-) >> >> diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c >> index 5d163c0..1b33806 100644 >> --- a/drivers/gpio/gpio-davinci.c >> +++ b/drivers/gpio/gpio-davinci.c >> @@ -351,7 +351,10 @@ static int gpio_to_irq_banked(struct gpio_chip *chip, unsigned offset) >> { >> struct davinci_gpio_controller *d = chip2controller(chip); >> >> - return irq_create_mapping(d->irq_domain, d->chip.base + offset); >> + if (d->irq_domain) >> + return irq_create_mapping(d->irq_domain, d->chip.base + offset); >> + else >> + return -ENXIO; >> } >> >> static int gpio_to_irq_unbanked(struct gpio_chip *chip, unsigned offset) >> @@ -429,7 +432,7 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) >> struct davinci_gpio_controller *chips = platform_get_drvdata(pdev); >> struct davinci_gpio_platform_data *pdata = dev->platform_data; >> struct davinci_gpio_regs __iomem *g; >> - struct irq_domain *irq_domain; >> + struct irq_domain *irq_domain = NULL; >> >> ngpio = pdata->ngpio; >> res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); >> @@ -453,18 +456,20 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) >> } >> clk_prepare_enable(clk); >> >> - irq = irq_alloc_descs(-1, 0, ngpio, 0); >> - if (irq < 0) { >> - dev_err(dev, "Couldn't allocate IRQ numbers\n"); >> - return irq; >> - } >> + if (!pdata->gpio_unbanked) { >> + irq = irq_alloc_descs(-1, 0, ngpio, 0); >> + if (irq < 0) { >> + dev_err(dev, "Couldn't allocate IRQ numbers\n"); >> + return -ENODEV; > > The code was correct before moving. Any objections to doing > > return irq; > > instead? This is mistake. I'll update. Thanks > > Thanks, > Sekhar > ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 2/2] gpio: davinci: reuse for Keystone SoC [not found] ` <1387361272-20861-1-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org> 2013-12-18 10:07 ` [PATCH v2 1/2] gpio: davinci: don't create irq_domain in case of unbanked irqs Grygorii Strashko @ 2013-12-18 10:07 ` Grygorii Strashko 2013-12-21 8:21 ` Prabhakar Lad [not found] ` <1387361272-20861-3-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org> 1 sibling, 2 replies; 12+ messages in thread From: Grygorii Strashko @ 2013-12-18 10:07 UTC (permalink / raw) To: Santosh Shilimkar, Linus Walleij, Sekhar Nori, Alexandre Courbot Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring, linux-gpio-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r The similar GPIO HW block is used by keystone SoCs as in Davinci SoCs. Hence, reuse Davinci GPIO driver for Keystone taking into account that Keystone contains ARM GIC IRQ controller which is implemented using IRQ Chip. Documentation: http://www.ti.com/lit/ug/sprugv1/sprugv1.pdf Cc: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> Cc: Alexandre Courbot <gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Cc: Sekhar Nori <nsekhar-l0cyMroinI0@public.gmane.org> Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Acked-by: Santosh Shilimkar <santosh.shilimkar-l0cyMroinI0@public.gmane.org> Signed-off-by: Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org> --- .../devicetree/bindings/gpio/gpio-davinci.txt | 4 +- drivers/gpio/gpio-davinci.c | 46 ++++++++++++++++---- 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/Documentation/devicetree/bindings/gpio/gpio-davinci.txt b/Documentation/devicetree/bindings/gpio/gpio-davinci.txt index a2e839d..4ce9862 100644 --- a/Documentation/devicetree/bindings/gpio/gpio-davinci.txt +++ b/Documentation/devicetree/bindings/gpio/gpio-davinci.txt @@ -1,7 +1,7 @@ -Davinci GPIO controller bindings +Davinci/Keystone GPIO controller bindings Required Properties: -- compatible: should be "ti,dm6441-gpio" +- compatible: should be "ti,dm6441-gpio", "ti,keystone-gpio" - reg: Physical base address of the controller and the size of memory mapped registers. diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c index 1b33806..38741cc 100644 --- a/drivers/gpio/gpio-davinci.c +++ b/drivers/gpio/gpio-davinci.c @@ -413,6 +413,26 @@ static const struct irq_domain_ops davinci_gpio_irq_ops = { .xlate = irq_domain_xlate_onetwocell, }; +static struct irq_chip *davinci_gpio_get_irq_chip(unsigned int irq) +{ + static struct irq_chip_type gpio_unbanked; + + gpio_unbanked = *container_of(irq_get_chip(irq), + struct irq_chip_type, chip); + + return &gpio_unbanked.chip; +}; + +static struct irq_chip *keystone_gpio_get_irq_chip(unsigned int irq) +{ + static struct irq_chip gpio_unbanked; + + gpio_unbanked = *irq_get_chip(irq); + return &gpio_unbanked; +}; + +static const struct of_device_id davinci_gpio_ids[]; + /* * NOTE: for suspend/resume, probably best to make a platform_device with * suspend_late/resume_resume calls hooking into results of the set_wake() @@ -433,6 +453,18 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) struct davinci_gpio_platform_data *pdata = dev->platform_data; struct davinci_gpio_regs __iomem *g; struct irq_domain *irq_domain = NULL; + const struct of_device_id *match; + struct irq_chip *irq_chip; + struct irq_chip *(*gpio_get_irq_chip)(unsigned int irq); + + /* + * Use davinci_gpio_get_irq_chip by default to handle non DT cases + */ + gpio_get_irq_chip = davinci_gpio_get_irq_chip; + match = of_match_device(of_match_ptr(davinci_gpio_ids), + dev); + if (match) + gpio_get_irq_chip = match->data; ngpio = pdata->ngpio; res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); @@ -489,8 +521,6 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) * IRQ mux conflicts; gpio_irq_type_unbanked() is only for GPIOs. */ if (pdata->gpio_unbanked) { - static struct irq_chip_type gpio_unbanked; - /* pass "bank 0" GPIO IRQs to AINTC */ chips[0].chip.to_irq = gpio_to_irq_unbanked; chips[0].gpio_irq = bank_irq; @@ -499,10 +529,9 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) /* AINTC handles mask/unmask; GPIO handles triggering */ irq = bank_irq; - gpio_unbanked = *container_of(irq_get_chip(irq), - struct irq_chip_type, chip); - gpio_unbanked.chip.name = "GPIO-AINTC"; - gpio_unbanked.chip.irq_set_type = gpio_irq_type_unbanked; + irq_chip = gpio_get_irq_chip(irq); + irq_chip->name = "GPIO-AINTC"; + irq_chip->irq_set_type = gpio_irq_type_unbanked; /* default trigger: both edges */ g = gpio2regs(0); @@ -511,7 +540,7 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) /* set the direct IRQs up to use that irqchip */ for (gpio = 0; gpio < pdata->gpio_unbanked; gpio++, irq++) { - irq_set_chip(irq, &gpio_unbanked.chip); + irq_set_chip(irq, irq_chip); irq_set_handler_data(irq, &chips[gpio / 32]); irq_set_status_flags(irq, IRQ_TYPE_EDGE_BOTH); } @@ -554,7 +583,8 @@ done: #if IS_ENABLED(CONFIG_OF) static const struct of_device_id davinci_gpio_ids[] = { - { .compatible = "ti,dm6441-gpio", }, + { .compatible = "ti,keystone-gpio", keystone_gpio_get_irq_chip}, + { .compatible = "ti,dm6441-gpio", davinci_gpio_get_irq_chip}, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, davinci_gpio_ids); -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v2 2/2] gpio: davinci: reuse for Keystone SoC 2013-12-18 10:07 ` [PATCH v2 2/2] gpio: davinci: reuse for Keystone SoC Grygorii Strashko @ 2013-12-21 8:21 ` Prabhakar Lad [not found] ` <1387361272-20861-3-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org> 1 sibling, 0 replies; 12+ messages in thread From: Prabhakar Lad @ 2013-12-21 8:21 UTC (permalink / raw) To: Grygorii Strashko Cc: Santosh Shilimkar, Linus Walleij, Sekhar Nori, Alexandre Courbot, Rob Herring, dlos, linux-gpio@vger.kernel.org, LAK, LKML, devicetree@vger.kernel.org On Wed, Dec 18, 2013 at 3:37 PM, Grygorii Strashko <grygorii.strashko@ti.com> wrote: > The similar GPIO HW block is used by keystone SoCs as > in Davinci SoCs. > Hence, reuse Davinci GPIO driver for Keystone taking into > account that Keystone contains ARM GIC IRQ controller which > is implemented using IRQ Chip. > > Documentation: > http://www.ti.com/lit/ug/sprugv1/sprugv1.pdf > > Cc: Linus Walleij <linus.walleij@linaro.org> > Cc: Alexandre Courbot <gnurou@gmail.com> > Cc: Sekhar Nori <nsekhar@ti.com> > Cc: devicetree@vger.kernel.org > > Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com> > Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Regards, --Prabhakar Lad ^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <1387361272-20861-3-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>]
* Re: [PATCH v2 2/2] gpio: davinci: reuse for Keystone SoC [not found] ` <1387361272-20861-3-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org> @ 2013-12-22 15:35 ` Sekhar Nori 2013-12-22 15:41 ` Sekhar Nori 1 sibling, 0 replies; 12+ messages in thread From: Sekhar Nori @ 2013-12-22 15:35 UTC (permalink / raw) To: Rob Herring Cc: Alexandre Courbot, davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/, devicetree-u79uwXL29TY76Z2rM5mHXA, Linus Walleij, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-gpio-u79uwXL29TY76Z2rM5mHXA, Santosh Shilimkar, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r Rob, On Wednesday 18 December 2013 03:37 PM, Grygorii Strashko wrote: > The similar GPIO HW block is used by keystone SoCs as > in Davinci SoCs. > Hence, reuse Davinci GPIO driver for Keystone taking into > account that Keystone contains ARM GIC IRQ controller which > is implemented using IRQ Chip. > > Documentation: > http://www.ti.com/lit/ug/sprugv1/sprugv1.pdf > > Cc: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> > Cc: Alexandre Courbot <gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > Cc: Sekhar Nori <nsekhar-l0cyMroinI0@public.gmane.org> > Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > > Acked-by: Santosh Shilimkar <santosh.shilimkar-l0cyMroinI0@public.gmane.org> > Signed-off-by: Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org> > --- > .../devicetree/bindings/gpio/gpio-davinci.txt | 4 +- > drivers/gpio/gpio-davinci.c | 46 ++++++++++++++++---- > 2 files changed, 40 insertions(+), 10 deletions(-) > > diff --git a/Documentation/devicetree/bindings/gpio/gpio-davinci.txt b/Documentation/devicetree/bindings/gpio/gpio-davinci.txt > index a2e839d..4ce9862 100644 > --- a/Documentation/devicetree/bindings/gpio/gpio-davinci.txt > +++ b/Documentation/devicetree/bindings/gpio/gpio-davinci.txt > @@ -1,7 +1,7 @@ > -Davinci GPIO controller bindings > +Davinci/Keystone GPIO controller bindings > > Required Properties: > -- compatible: should be "ti,dm6441-gpio" > +- compatible: should be "ti,dm6441-gpio", "ti,keystone-gpio" Can I get your ack for this change? Its pretty trivial, but still.. Thanks, Sekhar ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 2/2] gpio: davinci: reuse for Keystone SoC [not found] ` <1387361272-20861-3-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org> 2013-12-22 15:35 ` Sekhar Nori @ 2013-12-22 15:41 ` Sekhar Nori 2013-12-23 13:35 ` Grygorii Strashko 1 sibling, 1 reply; 12+ messages in thread From: Sekhar Nori @ 2013-12-22 15:41 UTC (permalink / raw) To: Grygorii Strashko, Santosh Shilimkar, Linus Walleij, Alexandre Courbot Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring, linux-gpio-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r On Wednesday 18 December 2013 03:37 PM, Grygorii Strashko wrote: > The similar GPIO HW block is used by keystone SoCs as > in Davinci SoCs. > Hence, reuse Davinci GPIO driver for Keystone taking into > account that Keystone contains ARM GIC IRQ controller which > is implemented using IRQ Chip. > > Documentation: > http://www.ti.com/lit/ug/sprugv1/sprugv1.pdf > > Cc: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> > Cc: Alexandre Courbot <gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > Cc: Sekhar Nori <nsekhar-l0cyMroinI0@public.gmane.org> > Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > > Acked-by: Santosh Shilimkar <santosh.shilimkar-l0cyMroinI0@public.gmane.org> > Signed-off-by: Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org> > --- > .../devicetree/bindings/gpio/gpio-davinci.txt | 4 +- > drivers/gpio/gpio-davinci.c | 46 ++++++++++++++++---- > 2 files changed, 40 insertions(+), 10 deletions(-) > > diff --git a/Documentation/devicetree/bindings/gpio/gpio-davinci.txt b/Documentation/devicetree/bindings/gpio/gpio-davinci.txt > index a2e839d..4ce9862 100644 > --- a/Documentation/devicetree/bindings/gpio/gpio-davinci.txt > +++ b/Documentation/devicetree/bindings/gpio/gpio-davinci.txt > @@ -1,7 +1,7 @@ > -Davinci GPIO controller bindings > +Davinci/Keystone GPIO controller bindings > > Required Properties: > -- compatible: should be "ti,dm6441-gpio" > +- compatible: should be "ti,dm6441-gpio", "ti,keystone-gpio" > > - reg: Physical base address of the controller and the size of memory mapped > registers. > diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c > index 1b33806..38741cc 100644 > --- a/drivers/gpio/gpio-davinci.c > +++ b/drivers/gpio/gpio-davinci.c > @@ -413,6 +413,26 @@ static const struct irq_domain_ops davinci_gpio_irq_ops = { > .xlate = irq_domain_xlate_onetwocell, > }; > > +static struct irq_chip *davinci_gpio_get_irq_chip(unsigned int irq) > +{ > + static struct irq_chip_type gpio_unbanked; > + > + gpio_unbanked = *container_of(irq_get_chip(irq), > + struct irq_chip_type, chip); > + > + return &gpio_unbanked.chip; > +}; > + > +static struct irq_chip *keystone_gpio_get_irq_chip(unsigned int irq) > +{ > + static struct irq_chip gpio_unbanked; > + > + gpio_unbanked = *irq_get_chip(irq); > + return &gpio_unbanked; > +}; > + > +static const struct of_device_id davinci_gpio_ids[]; > + > /* > * NOTE: for suspend/resume, probably best to make a platform_device with > * suspend_late/resume_resume calls hooking into results of the set_wake() > @@ -433,6 +453,18 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) > struct davinci_gpio_platform_data *pdata = dev->platform_data; > struct davinci_gpio_regs __iomem *g; > struct irq_domain *irq_domain = NULL; > + const struct of_device_id *match; > + struct irq_chip *irq_chip; > + struct irq_chip *(*gpio_get_irq_chip)(unsigned int irq); > + > + /* > + * Use davinci_gpio_get_irq_chip by default to handle non DT cases > + */ > + gpio_get_irq_chip = davinci_gpio_get_irq_chip; > + match = of_match_device(of_match_ptr(davinci_gpio_ids), > + dev); > + if (match) > + gpio_get_irq_chip = match->data; This produces a sparse warning: CHECK drivers/gpio/gpio-davinci.c drivers/gpio/gpio-davinci.c:467:35: warning: incorrect type in assignment (different modifiers) drivers/gpio/gpio-davinci.c:467:35: expected struct irq_chip *( *[assigned] gpio_get_irq_chip )( ... ) drivers/gpio/gpio-davinci.c:467:35: got void const *const data Thanks, Sekhar ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 2/2] gpio: davinci: reuse for Keystone SoC 2013-12-22 15:41 ` Sekhar Nori @ 2013-12-23 13:35 ` Grygorii Strashko 0 siblings, 0 replies; 12+ messages in thread From: Grygorii Strashko @ 2013-12-23 13:35 UTC (permalink / raw) To: Sekhar Nori, Santosh Shilimkar, Linus Walleij, Alexandre Courbot Cc: Rob Herring, prabhakar.csengg, davinci-linux-open-source, linux-gpio, linux-arm-kernel, linux-kernel, devicetree On 12/22/2013 05:41 PM, Sekhar Nori wrote: > On Wednesday 18 December 2013 03:37 PM, Grygorii Strashko wrote: >> The similar GPIO HW block is used by keystone SoCs as >> in Davinci SoCs. >> Hence, reuse Davinci GPIO driver for Keystone taking into >> account that Keystone contains ARM GIC IRQ controller which >> is implemented using IRQ Chip. >> >> Documentation: >> http://www.ti.com/lit/ug/sprugv1/sprugv1.pdf >> >> Cc: Linus Walleij <linus.walleij@linaro.org> >> Cc: Alexandre Courbot <gnurou@gmail.com> >> Cc: Sekhar Nori <nsekhar@ti.com> >> Cc: devicetree@vger.kernel.org >> >> Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com> >> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> >> --- >> .../devicetree/bindings/gpio/gpio-davinci.txt | 4 +- >> drivers/gpio/gpio-davinci.c | 46 ++++++++++++++++---- >> 2 files changed, 40 insertions(+), 10 deletions(-) >> >> diff --git a/Documentation/devicetree/bindings/gpio/gpio-davinci.txt b/Documentation/devicetree/bindings/gpio/gpio-davinci.txt >> index a2e839d..4ce9862 100644 >> --- a/Documentation/devicetree/bindings/gpio/gpio-davinci.txt >> +++ b/Documentation/devicetree/bindings/gpio/gpio-davinci.txt >> @@ -1,7 +1,7 @@ >> -Davinci GPIO controller bindings >> +Davinci/Keystone GPIO controller bindings >> >> Required Properties: >> -- compatible: should be "ti,dm6441-gpio" >> +- compatible: should be "ti,dm6441-gpio", "ti,keystone-gpio" >> >> - reg: Physical base address of the controller and the size of memory mapped >> registers. >> diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c >> index 1b33806..38741cc 100644 >> --- a/drivers/gpio/gpio-davinci.c >> +++ b/drivers/gpio/gpio-davinci.c >> @@ -413,6 +413,26 @@ static const struct irq_domain_ops davinci_gpio_irq_ops = { >> .xlate = irq_domain_xlate_onetwocell, >> }; >> >> +static struct irq_chip *davinci_gpio_get_irq_chip(unsigned int irq) >> +{ >> + static struct irq_chip_type gpio_unbanked; >> + >> + gpio_unbanked = *container_of(irq_get_chip(irq), >> + struct irq_chip_type, chip); >> + >> + return &gpio_unbanked.chip; >> +}; >> + >> +static struct irq_chip *keystone_gpio_get_irq_chip(unsigned int irq) >> +{ >> + static struct irq_chip gpio_unbanked; >> + >> + gpio_unbanked = *irq_get_chip(irq); >> + return &gpio_unbanked; >> +}; >> + >> +static const struct of_device_id davinci_gpio_ids[]; >> + >> /* >> * NOTE: for suspend/resume, probably best to make a platform_device with >> * suspend_late/resume_resume calls hooking into results of the set_wake() >> @@ -433,6 +453,18 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) >> struct davinci_gpio_platform_data *pdata = dev->platform_data; >> struct davinci_gpio_regs __iomem *g; >> struct irq_domain *irq_domain = NULL; >> + const struct of_device_id *match; >> + struct irq_chip *irq_chip; >> + struct irq_chip *(*gpio_get_irq_chip)(unsigned int irq); >> + >> + /* >> + * Use davinci_gpio_get_irq_chip by default to handle non DT cases >> + */ >> + gpio_get_irq_chip = davinci_gpio_get_irq_chip; >> + match = of_match_device(of_match_ptr(davinci_gpio_ids), >> + dev); >> + if (match) >> + gpio_get_irq_chip = match->data; > > This produces a sparse warning: > > CHECK drivers/gpio/gpio-davinci.c > drivers/gpio/gpio-davinci.c:467:35: warning: incorrect type in assignment (different modifiers) > drivers/gpio/gpio-davinci.c:467:35: expected struct irq_chip *( *[assigned] gpio_get_irq_chip )( ... ) > drivers/gpio/gpio-davinci.c:467:35: got void const *const data > I'll fix it, thanks. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 0/2] gpio: davinci: reuse for keystone arch 2013-12-18 10:07 [PATCH v2 0/2] gpio: davinci: reuse for keystone arch Grygorii Strashko [not found] ` <1387361272-20861-1-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org> @ 2013-12-20 9:40 ` Linus Walleij [not found] ` <CACRpkdYcvtWNgJ=JCgpZFdZmypLu7UmtpyTQusRshSGT=EqsVg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 1 sibling, 1 reply; 12+ messages in thread From: Linus Walleij @ 2013-12-20 9:40 UTC (permalink / raw) To: Grygorii Strashko Cc: Santosh Shilimkar, Sekhar Nori, Alexandre Courbot, Rob Herring, Prabhakar Lad, davinci-linux-open-source@linux.davincidsp.com, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org On Wed, Dec 18, 2013 at 11:07 AM, Grygorii Strashko <grygorii.strashko@ti.com> wrote: > This series is intended to update Davinci GPIO driver and reuse > it for Keystone SoCs, because Keystone uses the similar GPIO IP like Davinci. > Keystone GPIO IP: supports: > - up to 32 GPIO lines; > - only unbanked irqs; > > See Documentation: > Keystone - http://www.ti.com/lit/ug/sprugv1/sprugv1.pdf > > This series based on: > https://git.kernel.org/cgit/linux/kernel/git/nsekhar/linux-davinci.git/log/?h=v3.14/gpio > > Changes in v2: > - minor comments applied, no functional changes > > v1: https://lkml.org/lkml/2013/12/12/366 Acked-by: Linus Walleij <linus.walleij@linaro.org> For this v2 series. Expecting this to go in through the DaVinci tree! Yours, Linus Walleij ^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <CACRpkdYcvtWNgJ=JCgpZFdZmypLu7UmtpyTQusRshSGT=EqsVg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH v2 0/2] gpio: davinci: reuse for keystone arch [not found] ` <CACRpkdYcvtWNgJ=JCgpZFdZmypLu7UmtpyTQusRshSGT=EqsVg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2013-12-20 14:36 ` Santosh Shilimkar 0 siblings, 0 replies; 12+ messages in thread From: Santosh Shilimkar @ 2013-12-20 14:36 UTC (permalink / raw) To: Linus Walleij, Sekhar Nori Cc: Alexandre Courbot, davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Rob Herring, linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org On Friday 20 December 2013 04:40 AM, Linus Walleij wrote: > On Wed, Dec 18, 2013 at 11:07 AM, Grygorii Strashko > <grygorii.strashko-l0cyMroinI0@public.gmane.org> wrote: > >> This series is intended to update Davinci GPIO driver and reuse >> it for Keystone SoCs, because Keystone uses the similar GPIO IP like Davinci. >> Keystone GPIO IP: supports: >> - up to 32 GPIO lines; >> - only unbanked irqs; >> >> See Documentation: >> Keystone - http://www.ti.com/lit/ug/sprugv1/sprugv1.pdf >> >> This series based on: >> https://git.kernel.org/cgit/linux/kernel/git/nsekhar/linux-davinci.git/log/?h=v3.14/gpio >> >> Changes in v2: >> - minor comments applied, no functional changes >> >> v1: https://lkml.org/lkml/2013/12/12/366 > > Acked-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> > Great !! > For this v2 series. > > Expecting this to go in through the DaVinci tree! > Sekhar, Can you please include these to your DaVinci gpio branch ? Regards, Santosh ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2013-12-23 13:35 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-12-18 10:07 [PATCH v2 0/2] gpio: davinci: reuse for keystone arch Grygorii Strashko [not found] ` <1387361272-20861-1-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org> 2013-12-18 10:07 ` [PATCH v2 1/2] gpio: davinci: don't create irq_domain in case of unbanked irqs Grygorii Strashko 2013-12-21 8:20 ` Prabhakar Lad [not found] ` <1387361272-20861-2-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org> 2013-12-22 15:52 ` Sekhar Nori 2013-12-23 13:35 ` Grygorii Strashko 2013-12-18 10:07 ` [PATCH v2 2/2] gpio: davinci: reuse for Keystone SoC Grygorii Strashko 2013-12-21 8:21 ` Prabhakar Lad [not found] ` <1387361272-20861-3-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org> 2013-12-22 15:35 ` Sekhar Nori 2013-12-22 15:41 ` Sekhar Nori 2013-12-23 13:35 ` Grygorii Strashko 2013-12-20 9:40 ` [PATCH v2 0/2] gpio: davinci: reuse for keystone arch Linus Walleij [not found] ` <CACRpkdYcvtWNgJ=JCgpZFdZmypLu7UmtpyTQusRshSGT=EqsVg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2013-12-20 14:36 ` Santosh Shilimkar
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).