* [PATCH 1/8] gpio: omap: convert omap_gpio_is_input() to use gpio offset
2015-03-19 17:25 [PATCH 0/8] gpio: omap: cleanup: get rid of system GPIO <-> GPIO offset converseations grygorii.strashko
@ 2015-03-19 17:25 ` grygorii.strashko
2015-03-20 16:42 ` santosh.shilimkar
2015-03-19 17:25 ` [PATCH 2/8] gpio: omap: simplify omap_set_gpio_dataout_x() grygorii.strashko
` (7 subsequent siblings)
8 siblings, 1 reply; 28+ messages in thread
From: grygorii.strashko @ 2015-03-19 17:25 UTC (permalink / raw)
To: Javier Martinez Canillas, Linus Walleij, Alexandre Courbot,
ssantosh, Kevin Hilman, tony
Cc: linux-omap, linux-gpio, linux-kernel, Grygorii Strashko
From: Grygorii Strashko <grygorii.strashko@linaro.org>
Convert omap_gpio_is_input() to use GPIO offset instead of mask and,
in such way, make code simpler and remove few lines of code.
Signed-off-by: Grygorii Strashko <grygorii.strashko@linaro.org>
---
drivers/gpio/gpio-omap.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 2b2fc4b..ce71239 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -472,11 +472,11 @@ static void omap_disable_gpio_module(struct gpio_bank *bank, unsigned offset)
}
}
-static int omap_gpio_is_input(struct gpio_bank *bank, int mask)
+static int omap_gpio_is_input(struct gpio_bank *bank, unsigned offset)
{
void __iomem *reg = bank->base + bank->regs->direction;
- return readl_relaxed(reg) & mask;
+ return readl_relaxed(reg) & BIT(offset);
}
static void omap_gpio_init_irq(struct gpio_bank *bank, unsigned gpio,
@@ -519,7 +519,7 @@ static int omap_gpio_irq_type(struct irq_data *d, unsigned type)
offset = GPIO_INDEX(bank, gpio);
retval = omap_set_gpio_triggering(bank, offset, type);
omap_gpio_init_irq(bank, gpio, offset);
- if (!omap_gpio_is_input(bank, BIT(offset))) {
+ if (!omap_gpio_is_input(bank, offset)) {
spin_unlock_irqrestore(&bank->lock, flags);
return -EINVAL;
}
@@ -976,12 +976,10 @@ static int omap_gpio_input(struct gpio_chip *chip, unsigned offset)
static int omap_gpio_get(struct gpio_chip *chip, unsigned offset)
{
struct gpio_bank *bank;
- u32 mask;
bank = container_of(chip, struct gpio_bank, chip);
- mask = (BIT(offset));
- if (omap_gpio_is_input(bank, mask))
+ if (omap_gpio_is_input(bank, offset))
return omap_get_gpio_datain(bank, offset);
else
return omap_get_gpio_dataout(bank, offset);
--
1.9.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [PATCH 1/8] gpio: omap: convert omap_gpio_is_input() to use gpio offset
2015-03-19 17:25 ` [PATCH 1/8] gpio: omap: convert omap_gpio_is_input() to use gpio offset grygorii.strashko
@ 2015-03-20 16:42 ` santosh.shilimkar
2015-03-20 18:37 ` Javier Martinez Canillas
0 siblings, 1 reply; 28+ messages in thread
From: santosh.shilimkar @ 2015-03-20 16:42 UTC (permalink / raw)
To: grygorii.strashko, Javier Martinez Canillas, Linus Walleij,
Alexandre Courbot, ssantosh, Kevin Hilman, tony
Cc: linux-omap, linux-gpio, linux-kernel
On 3/19/15 10:25 AM, grygorii.strashko@linaro.org wrote:
> From: Grygorii Strashko <grygorii.strashko@linaro.org>
>
> Convert omap_gpio_is_input() to use GPIO offset instead of mask and,
> in such way, make code simpler and remove few lines of code.
>
> Signed-off-by: Grygorii Strashko <grygorii.strashko@linaro.org>
> ---
Acked-by: Santosh Shilimkar <ssantosh@kernel.org>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 1/8] gpio: omap: convert omap_gpio_is_input() to use gpio offset
2015-03-20 16:42 ` santosh.shilimkar
@ 2015-03-20 18:37 ` Javier Martinez Canillas
0 siblings, 0 replies; 28+ messages in thread
From: Javier Martinez Canillas @ 2015-03-20 18:37 UTC (permalink / raw)
To: santosh.shilimkar@oracle.com
Cc: grygorii.strashko, Linus Walleij, Alexandre Courbot,
Santosh Shilimkar, Kevin Hilman, Tony Lindgren,
linux-omap@vger.kernel.org, Linux GPIO List, Linux Kernel
On Fri, Mar 20, 2015 at 5:42 PM, santosh.shilimkar@oracle.com
<santosh.shilimkar@oracle.com> wrote:
> On 3/19/15 10:25 AM, grygorii.strashko@linaro.org wrote:
>>
>> From: Grygorii Strashko <grygorii.strashko@linaro.org>
>>
>> Convert omap_gpio_is_input() to use GPIO offset instead of mask and,
>> in such way, make code simpler and remove few lines of code.
>>
>> Signed-off-by: Grygorii Strashko <grygorii.strashko@linaro.org>
>> ---
>
>
> Acked-by: Santosh Shilimkar <ssantosh@kernel.org>
Acked-by: Javier Martinez Canillas <javier@dowhile0.org>
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH 2/8] gpio: omap: simplify omap_set_gpio_dataout_x()
2015-03-19 17:25 [PATCH 0/8] gpio: omap: cleanup: get rid of system GPIO <-> GPIO offset converseations grygorii.strashko
2015-03-19 17:25 ` [PATCH 1/8] gpio: omap: convert omap_gpio_is_input() to use gpio offset grygorii.strashko
@ 2015-03-19 17:25 ` grygorii.strashko
2015-03-20 16:45 ` santosh.shilimkar
2015-03-19 17:25 ` [PATCH 3/8] gpio: omap: convert debounce functions switch to use gpio offset grygorii.strashko
` (6 subsequent siblings)
8 siblings, 1 reply; 28+ messages in thread
From: grygorii.strashko @ 2015-03-19 17:25 UTC (permalink / raw)
To: Javier Martinez Canillas, Linus Walleij, Alexandre Courbot,
ssantosh, Kevin Hilman, tony
Cc: linux-omap, linux-gpio, linux-kernel, Grygorii Strashko
From: Grygorii Strashko <grygorii.strashko@linaro.org>
Both functions omap_set_gpio_dataout_reg() and
omap_set_gpio_dataout_mask() accept GPIO offset
as 'gpio' input parameter, so rename it to 'offset' and
drop usage of GPIO_BIT() macro.
Signed-off-by: Grygorii Strashko <grygorii.strashko@linaro.org>
---
drivers/gpio/gpio-omap.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index ce71239..7aeee7b 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -75,7 +75,7 @@ struct gpio_bank {
int power_mode;
bool workaround_enabled;
- void (*set_dataout)(struct gpio_bank *bank, int gpio, int enable);
+ void (*set_dataout)(struct gpio_bank *bank, unsigned gpio, int enable);
int (*get_context_loss_count)(struct device *dev);
struct omap_gpio_reg_offs *regs;
@@ -119,11 +119,11 @@ static void omap_set_gpio_direction(struct gpio_bank *bank, int gpio,
/* set data out value using dedicate set/clear register */
-static void omap_set_gpio_dataout_reg(struct gpio_bank *bank, int gpio,
+static void omap_set_gpio_dataout_reg(struct gpio_bank *bank, unsigned offset,
int enable)
{
void __iomem *reg = bank->base;
- u32 l = GPIO_BIT(bank, gpio);
+ u32 l = BIT(offset);
if (enable) {
reg += bank->regs->set_dataout;
@@ -137,11 +137,11 @@ static void omap_set_gpio_dataout_reg(struct gpio_bank *bank, int gpio,
}
/* set data out value using mask register */
-static void omap_set_gpio_dataout_mask(struct gpio_bank *bank, int gpio,
+static void omap_set_gpio_dataout_mask(struct gpio_bank *bank, unsigned offset,
int enable)
{
void __iomem *reg = bank->base + bank->regs->dataout;
- u32 gpio_bit = GPIO_BIT(bank, gpio);
+ u32 gpio_bit = BIT(offset);
u32 l;
l = readl_relaxed(reg);
--
1.9.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [PATCH 2/8] gpio: omap: simplify omap_set_gpio_dataout_x()
2015-03-19 17:25 ` [PATCH 2/8] gpio: omap: simplify omap_set_gpio_dataout_x() grygorii.strashko
@ 2015-03-20 16:45 ` santosh.shilimkar
2015-03-20 18:40 ` Javier Martinez Canillas
0 siblings, 1 reply; 28+ messages in thread
From: santosh.shilimkar @ 2015-03-20 16:45 UTC (permalink / raw)
To: grygorii.strashko, Javier Martinez Canillas, Linus Walleij,
Alexandre Courbot, ssantosh, Kevin Hilman, tony
Cc: linux-omap, linux-gpio, linux-kernel
On 3/19/15 10:25 AM, grygorii.strashko@linaro.org wrote:
> From: Grygorii Strashko <grygorii.strashko@linaro.org>
>
> Both functions omap_set_gpio_dataout_reg() and
> omap_set_gpio_dataout_mask() accept GPIO offset
> as 'gpio' input parameter, so rename it to 'offset' and
> drop usage of GPIO_BIT() macro.
>
> Signed-off-by: Grygorii Strashko <grygorii.strashko@linaro.org>
> ---
Acked-by: Santosh Shilimkar <ssantosh@kernel.org>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 2/8] gpio: omap: simplify omap_set_gpio_dataout_x()
2015-03-20 16:45 ` santosh.shilimkar
@ 2015-03-20 18:40 ` Javier Martinez Canillas
0 siblings, 0 replies; 28+ messages in thread
From: Javier Martinez Canillas @ 2015-03-20 18:40 UTC (permalink / raw)
To: santosh.shilimkar@oracle.com
Cc: grygorii.strashko, Linus Walleij, Alexandre Courbot,
Santosh Shilimkar, Kevin Hilman, Tony Lindgren,
linux-omap@vger.kernel.org, Linux GPIO List, Linux Kernel
On Fri, Mar 20, 2015 at 5:45 PM, santosh.shilimkar@oracle.com
<santosh.shilimkar@oracle.com> wrote:
> On 3/19/15 10:25 AM, grygorii.strashko@linaro.org wrote:
>>
>> From: Grygorii Strashko <grygorii.strashko@linaro.org>
>>
>> Both functions omap_set_gpio_dataout_reg() and
>> omap_set_gpio_dataout_mask() accept GPIO offset
>> as 'gpio' input parameter, so rename it to 'offset' and
>> drop usage of GPIO_BIT() macro.
>>
>> Signed-off-by: Grygorii Strashko <grygorii.strashko@linaro.org>
>> ---
>
> Acked-by: Santosh Shilimkar <ssantosh@kernel.org>
Acked-by: Javier Martinez Canillas <javier@dowhile0.org>
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH 3/8] gpio: omap: convert debounce functions switch to use gpio offset
2015-03-19 17:25 [PATCH 0/8] gpio: omap: cleanup: get rid of system GPIO <-> GPIO offset converseations grygorii.strashko
2015-03-19 17:25 ` [PATCH 1/8] gpio: omap: convert omap_gpio_is_input() to use gpio offset grygorii.strashko
2015-03-19 17:25 ` [PATCH 2/8] gpio: omap: simplify omap_set_gpio_dataout_x() grygorii.strashko
@ 2015-03-19 17:25 ` grygorii.strashko
2015-03-20 18:44 ` Javier Martinez Canillas
2015-03-19 17:25 ` [PATCH 4/8] gpio: omap: drop 'gpio' param from omap_gpio_init_irq() grygorii.strashko
` (5 subsequent siblings)
8 siblings, 1 reply; 28+ messages in thread
From: grygorii.strashko @ 2015-03-19 17:25 UTC (permalink / raw)
To: Javier Martinez Canillas, Linus Walleij, Alexandre Courbot,
ssantosh, Kevin Hilman, tony
Cc: linux-omap, linux-gpio, linux-kernel, Grygorii Strashko
From: Grygorii Strashko <grygorii.strashko@linaro.org>
Convert debounce functions to use GPIO offset instead of system
GPIO numbers. This allows to drop unneeded conversations between
system GPIO <-> GPIO offset which are done in many places and
many times.
It is safe to do now because:
- gpiolib always passes GPIO offset to GPIO controller
- OMAP GPIO driver converted to use IRQ domain
This is preparation step before removing:
#define GPIO_INDEX(bank, gpio)
#define GPIO_BIT(bank, gpio)
int omap_irq_to_gpio()
Signed-off-by: Grygorii Strashko <grygorii.strashko@linaro.org>
---
drivers/gpio/gpio-omap.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 7aeee7b..2df693b 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -208,13 +208,13 @@ static inline void omap_gpio_dbck_disable(struct gpio_bank *bank)
/**
* omap2_set_gpio_debounce - low level gpio debounce time
* @bank: the gpio bank we're acting upon
- * @gpio: the gpio number on this @gpio
+ * @offset: the gpio number on this @bank
* @debounce: debounce time to use
*
* OMAP's debounce time is in 31us steps so we need
* to convert and round up to the closest unit.
*/
-static void omap2_set_gpio_debounce(struct gpio_bank *bank, unsigned gpio,
+static void omap2_set_gpio_debounce(struct gpio_bank *bank, unsigned offset,
unsigned debounce)
{
void __iomem *reg;
@@ -231,7 +231,7 @@ static void omap2_set_gpio_debounce(struct gpio_bank *bank, unsigned gpio,
else
debounce = (debounce / 0x1f) - 1;
- l = GPIO_BIT(bank, gpio);
+ l = BIT(offset);
clk_prepare_enable(bank->dbck);
reg = bank->base + bank->regs->debounce;
@@ -266,16 +266,16 @@ static void omap2_set_gpio_debounce(struct gpio_bank *bank, unsigned gpio,
/**
* omap_clear_gpio_debounce - clear debounce settings for a gpio
* @bank: the gpio bank we're acting upon
- * @gpio: the gpio number on this @gpio
+ * @offset: the gpio number on this @bank
*
* If a gpio is using debounce, then clear the debounce enable bit and if
* this is the only gpio in this bank using debounce, then clear the debounce
* time too. The debounce clock will also be disabled when calling this function
* if this is the only gpio in the bank using debounce.
*/
-static void omap_clear_gpio_debounce(struct gpio_bank *bank, unsigned gpio)
+static void omap_clear_gpio_debounce(struct gpio_bank *bank, unsigned offset)
{
- u32 gpio_bit = GPIO_BIT(bank, gpio);
+ u32 gpio_bit = BIT(offset);
if (!bank->dbck_flag)
return;
@@ -659,7 +659,7 @@ static void omap_reset_gpio(struct gpio_bank *bank, int gpio)
omap_set_gpio_irqenable(bank, gpio, 0);
omap_clear_gpio_irqstatus(bank, gpio);
omap_set_gpio_triggering(bank, GPIO_INDEX(bank, gpio), IRQ_TYPE_NONE);
- omap_clear_gpio_debounce(bank, gpio);
+ omap_clear_gpio_debounce(bank, GPIO_INDEX(bank, gpio));
}
/* Use disable_irq_wake() and enable_irq_wake() functions from drivers */
--
1.9.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [PATCH 3/8] gpio: omap: convert debounce functions switch to use gpio offset
2015-03-19 17:25 ` [PATCH 3/8] gpio: omap: convert debounce functions switch to use gpio offset grygorii.strashko
@ 2015-03-20 18:44 ` Javier Martinez Canillas
0 siblings, 0 replies; 28+ messages in thread
From: Javier Martinez Canillas @ 2015-03-20 18:44 UTC (permalink / raw)
To: grygorii.strashko
Cc: Linus Walleij, Alexandre Courbot, Santosh Shilimkar, Kevin Hilman,
Tony Lindgren, linux-omap@vger.kernel.org, Linux GPIO List,
Linux Kernel
On Thu, Mar 19, 2015 at 6:25 PM, <grygorii.strashko@linaro.org> wrote:
> From: Grygorii Strashko <grygorii.strashko@linaro.org>
>
> Convert debounce functions to use GPIO offset instead of system
> GPIO numbers. This allows to drop unneeded conversations between
> system GPIO <-> GPIO offset which are done in many places and
> many times.
> It is safe to do now because:
> - gpiolib always passes GPIO offset to GPIO controller
> - OMAP GPIO driver converted to use IRQ domain
>
> This is preparation step before removing:
> #define GPIO_INDEX(bank, gpio)
> #define GPIO_BIT(bank, gpio)
> int omap_irq_to_gpio()
>
> Signed-off-by: Grygorii Strashko <grygorii.strashko@linaro.org>
> ---
Acked-by: Javier Martinez Canillas <javier@dowhile0.org>
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH 4/8] gpio: omap: drop 'gpio' param from omap_gpio_init_irq()
2015-03-19 17:25 [PATCH 0/8] gpio: omap: cleanup: get rid of system GPIO <-> GPIO offset converseations grygorii.strashko
` (2 preceding siblings ...)
2015-03-19 17:25 ` [PATCH 3/8] gpio: omap: convert debounce functions switch to use gpio offset grygorii.strashko
@ 2015-03-19 17:25 ` grygorii.strashko
2015-03-20 18:46 ` Javier Martinez Canillas
2015-03-19 17:25 ` [PATCH 5/8] gpio: omap: convert gpio irq functions to use GPIO offset grygorii.strashko
` (4 subsequent siblings)
8 siblings, 1 reply; 28+ messages in thread
From: grygorii.strashko @ 2015-03-19 17:25 UTC (permalink / raw)
To: Javier Martinez Canillas, Linus Walleij, Alexandre Courbot,
ssantosh, Kevin Hilman, tony
Cc: linux-omap, linux-gpio, linux-kernel, Grygorii Strashko
From: Grygorii Strashko <grygorii.strashko@linaro.org>
The 'gpio' parameter isn't needed any more as it
duplicates 'offset' parameter, so drop it.
Signed-off-by: Grygorii Strashko <grygorii.strashko@linaro.org>
---
drivers/gpio/gpio-omap.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 2df693b..ff5d54d 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -479,14 +479,13 @@ static int omap_gpio_is_input(struct gpio_bank *bank, unsigned offset)
return readl_relaxed(reg) & BIT(offset);
}
-static void omap_gpio_init_irq(struct gpio_bank *bank, unsigned gpio,
- unsigned offset)
+static void omap_gpio_init_irq(struct gpio_bank *bank, unsigned offset)
{
if (!LINE_USED(bank->mod_usage, offset)) {
omap_enable_gpio_module(bank, offset);
omap_set_gpio_direction(bank, offset, 1);
}
- bank->irq_usage |= BIT(GPIO_INDEX(bank, gpio));
+ bank->irq_usage |= BIT(offset);
}
static int omap_gpio_irq_type(struct irq_data *d, unsigned type)
@@ -518,7 +517,7 @@ static int omap_gpio_irq_type(struct irq_data *d, unsigned type)
spin_lock_irqsave(&bank->lock, flags);
offset = GPIO_INDEX(bank, gpio);
retval = omap_set_gpio_triggering(bank, offset, type);
- omap_gpio_init_irq(bank, gpio, offset);
+ omap_gpio_init_irq(bank, offset);
if (!omap_gpio_is_input(bank, offset)) {
spin_unlock_irqrestore(&bank->lock, flags);
return -EINVAL;
@@ -803,15 +802,14 @@ exit:
static unsigned int omap_gpio_irq_startup(struct irq_data *d)
{
struct gpio_bank *bank = omap_irq_data_get_bank(d);
- unsigned int gpio = omap_irq_to_gpio(bank, d->hwirq);
unsigned long flags;
- unsigned offset = GPIO_INDEX(bank, gpio);
+ unsigned offset = d->hwirq;
if (!BANK_USED(bank))
pm_runtime_get_sync(bank->dev);
spin_lock_irqsave(&bank->lock, flags);
- omap_gpio_init_irq(bank, gpio, offset);
+ omap_gpio_init_irq(bank, offset);
spin_unlock_irqrestore(&bank->lock, flags);
omap_gpio_unmask_irq(d);
--
1.9.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [PATCH 4/8] gpio: omap: drop 'gpio' param from omap_gpio_init_irq()
2015-03-19 17:25 ` [PATCH 4/8] gpio: omap: drop 'gpio' param from omap_gpio_init_irq() grygorii.strashko
@ 2015-03-20 18:46 ` Javier Martinez Canillas
0 siblings, 0 replies; 28+ messages in thread
From: Javier Martinez Canillas @ 2015-03-20 18:46 UTC (permalink / raw)
To: grygorii.strashko
Cc: Linus Walleij, Alexandre Courbot, Santosh Shilimkar, Kevin Hilman,
Tony Lindgren, linux-omap@vger.kernel.org, Linux GPIO List,
Linux Kernel
On Thu, Mar 19, 2015 at 6:25 PM, <grygorii.strashko@linaro.org> wrote:
> From: Grygorii Strashko <grygorii.strashko@linaro.org>
>
> The 'gpio' parameter isn't needed any more as it
> duplicates 'offset' parameter, so drop it.
>
> Signed-off-by: Grygorii Strashko <grygorii.strashko@linaro.org>
Acked-by: Javier Martinez Canillas <javier@dowhile0.org>
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH 5/8] gpio: omap: convert gpio irq functions to use GPIO offset
2015-03-19 17:25 [PATCH 0/8] gpio: omap: cleanup: get rid of system GPIO <-> GPIO offset converseations grygorii.strashko
` (3 preceding siblings ...)
2015-03-19 17:25 ` [PATCH 4/8] gpio: omap: drop 'gpio' param from omap_gpio_init_irq() grygorii.strashko
@ 2015-03-19 17:25 ` grygorii.strashko
2015-03-19 23:03 ` Tony Lindgren
2015-03-20 16:49 ` santosh.shilimkar
2015-03-19 17:25 ` [PATCH 6/8] gpio: omap: get rid of GPIO_BIT() macro grygorii.strashko
` (3 subsequent siblings)
8 siblings, 2 replies; 28+ messages in thread
From: grygorii.strashko @ 2015-03-19 17:25 UTC (permalink / raw)
To: Javier Martinez Canillas, Linus Walleij, Alexandre Courbot,
ssantosh, Kevin Hilman, tony
Cc: linux-omap, linux-gpio, linux-kernel, Grygorii Strashko
From: Grygorii Strashko <grygorii.strashko@linaro.org>
Convert GPIO IRQ functions to use GPIO offset instead of system
GPIO numbers. This allows to drop unneeded conversations between
system GPIO <-> GPIO offset which are done in many places and
many times.
It is safe to do now because:
- gpiolib always passes GPIO offset to GPIO controller
- OMAP GPIO driver converted to use IRQ domain, so
struct irq_data->hwirq contains GPIO offset
This is preparation step before removing:
#define GPIO_INDEX(bank, gpio)
#define GPIO_BIT(bank, gpio)
int omap_irq_to_gpio()
Signed-off-by: Grygorii Strashko <grygorii.strashko@linaro.org>
---
drivers/gpio/gpio-omap.c | 64 +++++++++++++++++++++++++-----------------------
1 file changed, 33 insertions(+), 31 deletions(-)
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index ff5d54d..b39faa8 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -549,9 +549,10 @@ static void omap_clear_gpio_irqbank(struct gpio_bank *bank, int gpio_mask)
readl_relaxed(reg);
}
-static inline void omap_clear_gpio_irqstatus(struct gpio_bank *bank, int gpio)
+static inline void omap_clear_gpio_irqstatus(struct gpio_bank *bank,
+ unsigned offset)
{
- omap_clear_gpio_irqbank(bank, GPIO_BIT(bank, gpio));
+ omap_clear_gpio_irqbank(bank, BIT(offset));
}
static u32 omap_get_gpio_irqbank_mask(struct gpio_bank *bank)
@@ -612,13 +613,13 @@ static void omap_disable_gpio_irqbank(struct gpio_bank *bank, int gpio_mask)
writel_relaxed(l, reg);
}
-static inline void omap_set_gpio_irqenable(struct gpio_bank *bank, int gpio,
- int enable)
+static inline void omap_set_gpio_irqenable(struct gpio_bank *bank,
+ unsigned offset, int enable)
{
if (enable)
- omap_enable_gpio_irqbank(bank, GPIO_BIT(bank, gpio));
+ omap_enable_gpio_irqbank(bank, BIT(offset));
else
- omap_disable_gpio_irqbank(bank, GPIO_BIT(bank, gpio));
+ omap_disable_gpio_irqbank(bank, BIT(offset));
}
/*
@@ -629,14 +630,16 @@ static inline void omap_set_gpio_irqenable(struct gpio_bank *bank, int gpio,
* enabled. When system is suspended, only selected GPIO interrupts need
* to have wake-up enabled.
*/
-static int omap_set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable)
+static int omap_set_gpio_wakeup(struct gpio_bank *bank, unsigned offset,
+ int enable)
{
- u32 gpio_bit = GPIO_BIT(bank, gpio);
+ u32 gpio_bit = BIT(offset);
unsigned long flags;
if (bank->non_wakeup_gpios & gpio_bit) {
dev_err(bank->dev,
- "Unable to modify wakeup on non-wakeup GPIO%d\n", gpio);
+ "Unable to modify wakeup on non-wakeup GPIO%d\n",
+ offset);
return -EINVAL;
}
@@ -652,22 +655,22 @@ static int omap_set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable)
return 0;
}
-static void omap_reset_gpio(struct gpio_bank *bank, int gpio)
+static void omap_reset_gpio(struct gpio_bank *bank, unsigned offset)
{
- omap_set_gpio_direction(bank, GPIO_INDEX(bank, gpio), 1);
- omap_set_gpio_irqenable(bank, gpio, 0);
- omap_clear_gpio_irqstatus(bank, gpio);
- omap_set_gpio_triggering(bank, GPIO_INDEX(bank, gpio), IRQ_TYPE_NONE);
- omap_clear_gpio_debounce(bank, GPIO_INDEX(bank, gpio));
+ omap_set_gpio_direction(bank, offset, 1);
+ omap_set_gpio_irqenable(bank, offset, 0);
+ omap_clear_gpio_irqstatus(bank, offset);
+ omap_set_gpio_triggering(bank, offset, IRQ_TYPE_NONE);
+ omap_clear_gpio_debounce(bank, offset);
}
/* Use disable_irq_wake() and enable_irq_wake() functions from drivers */
static int omap_gpio_wake_enable(struct irq_data *d, unsigned int enable)
{
struct gpio_bank *bank = omap_irq_data_get_bank(d);
- unsigned int gpio = omap_irq_to_gpio(bank, d->hwirq);
+ unsigned offset = d->hwirq;
- return omap_set_gpio_wakeup(bank, gpio, enable);
+ return omap_set_gpio_wakeup(bank, offset, enable);
}
static int omap_gpio_request(struct gpio_chip *chip, unsigned offset)
@@ -705,7 +708,7 @@ static void omap_gpio_free(struct gpio_chip *chip, unsigned offset)
spin_lock_irqsave(&bank->lock, flags);
bank->mod_usage &= ~(BIT(offset));
omap_disable_gpio_module(bank, offset);
- omap_reset_gpio(bank, bank->chip.base + offset);
+ omap_reset_gpio(bank, offset);
spin_unlock_irqrestore(&bank->lock, flags);
/*
@@ -819,14 +822,13 @@ static unsigned int omap_gpio_irq_startup(struct irq_data *d)
static void omap_gpio_irq_shutdown(struct irq_data *d)
{
struct gpio_bank *bank = omap_irq_data_get_bank(d);
- unsigned int gpio = omap_irq_to_gpio(bank, d->hwirq);
unsigned long flags;
- unsigned offset = GPIO_INDEX(bank, gpio);
+ unsigned offset = d->hwirq;
spin_lock_irqsave(&bank->lock, flags);
bank->irq_usage &= ~(BIT(offset));
omap_disable_gpio_module(bank, offset);
- omap_reset_gpio(bank, gpio);
+ omap_reset_gpio(bank, offset);
spin_unlock_irqrestore(&bank->lock, flags);
/*
@@ -840,43 +842,43 @@ static void omap_gpio_irq_shutdown(struct irq_data *d)
static void omap_gpio_ack_irq(struct irq_data *d)
{
struct gpio_bank *bank = omap_irq_data_get_bank(d);
- unsigned int gpio = omap_irq_to_gpio(bank, d->hwirq);
+ unsigned offset = d->hwirq;
- omap_clear_gpio_irqstatus(bank, gpio);
+ omap_clear_gpio_irqstatus(bank, offset);
}
static void omap_gpio_mask_irq(struct irq_data *d)
{
struct gpio_bank *bank = omap_irq_data_get_bank(d);
- unsigned int gpio = omap_irq_to_gpio(bank, d->hwirq);
+ unsigned offset = d->hwirq;
unsigned long flags;
spin_lock_irqsave(&bank->lock, flags);
- omap_set_gpio_irqenable(bank, gpio, 0);
- omap_set_gpio_triggering(bank, GPIO_INDEX(bank, gpio), IRQ_TYPE_NONE);
+ omap_set_gpio_irqenable(bank, offset, 0);
+ omap_set_gpio_triggering(bank, offset, IRQ_TYPE_NONE);
spin_unlock_irqrestore(&bank->lock, flags);
}
static void omap_gpio_unmask_irq(struct irq_data *d)
{
struct gpio_bank *bank = omap_irq_data_get_bank(d);
- unsigned int gpio = omap_irq_to_gpio(bank, d->hwirq);
+ unsigned offset = d->hwirq;
unsigned int irq_mask = GPIO_BIT(bank, gpio);
u32 trigger = irqd_get_trigger_type(d);
unsigned long flags;
spin_lock_irqsave(&bank->lock, flags);
if (trigger)
- omap_set_gpio_triggering(bank, GPIO_INDEX(bank, gpio), trigger);
+ omap_set_gpio_triggering(bank, offset, trigger);
/* For level-triggered GPIOs, the clearing must be done after
* the HW source is cleared, thus after the handler has run */
if (bank->level_mask & irq_mask) {
- omap_set_gpio_irqenable(bank, gpio, 0);
- omap_clear_gpio_irqstatus(bank, gpio);
+ omap_set_gpio_irqenable(bank, offset, 0);
+ omap_clear_gpio_irqstatus(bank, offset);
}
- omap_set_gpio_irqenable(bank, gpio, 1);
+ omap_set_gpio_irqenable(bank, offset, 1);
spin_unlock_irqrestore(&bank->lock, flags);
}
--
1.9.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [PATCH 5/8] gpio: omap: convert gpio irq functions to use GPIO offset
2015-03-19 17:25 ` [PATCH 5/8] gpio: omap: convert gpio irq functions to use GPIO offset grygorii.strashko
@ 2015-03-19 23:03 ` Tony Lindgren
2015-03-20 15:06 ` Grygorii.Strashko@linaro.org
2015-03-20 16:49 ` santosh.shilimkar
1 sibling, 1 reply; 28+ messages in thread
From: Tony Lindgren @ 2015-03-19 23:03 UTC (permalink / raw)
To: grygorii.strashko
Cc: Javier Martinez Canillas, Linus Walleij, Alexandre Courbot,
ssantosh, Kevin Hilman, linux-omap, linux-gpio, linux-kernel
* grygorii.strashko@linaro.org <grygorii.strashko@linaro.org> [150319 10:26]:
> From: Grygorii Strashko <grygorii.strashko@linaro.org>
>
> Convert GPIO IRQ functions to use GPIO offset instead of system
> GPIO numbers. This allows to drop unneeded conversations between
> system GPIO <-> GPIO offset which are done in many places and
> many times.
> It is safe to do now because:
> - gpiolib always passes GPIO offset to GPIO controller
> - OMAP GPIO driver converted to use IRQ domain, so
> struct irq_data->hwirq contains GPIO offset
>
> This is preparation step before removing:
> #define GPIO_INDEX(bank, gpio)
> #define GPIO_BIT(bank, gpio)
> int omap_irq_to_gpio()
...
> static void omap_gpio_unmask_irq(struct irq_data *d)
> {
> struct gpio_bank *bank = omap_irq_data_get_bank(d);
> - unsigned int gpio = omap_irq_to_gpio(bank, d->hwirq);
> + unsigned offset = d->hwirq;
> unsigned int irq_mask = GPIO_BIT(bank, gpio);
> u32 trigger = irqd_get_trigger_type(d);
> unsigned long flags;
This series up to this patch produces a build error that
would break git bisect:
drivers/gpio/gpio-omap.c: In function ‘omap_gpio_unmask_irq’:
drivers/gpio/gpio-omap.c:866:37: error: ‘gpio’ undeclared (first use in this function)
unsigned int irq_mask = GPIO_BIT(bank, gpio);
Applying the following patch makes things build again.
Regards,
Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 5/8] gpio: omap: convert gpio irq functions to use GPIO offset
2015-03-19 23:03 ` Tony Lindgren
@ 2015-03-20 15:06 ` Grygorii.Strashko@linaro.org
0 siblings, 0 replies; 28+ messages in thread
From: Grygorii.Strashko@linaro.org @ 2015-03-20 15:06 UTC (permalink / raw)
To: Tony Lindgren
Cc: Javier Martinez Canillas, Linus Walleij, Alexandre Courbot,
ssantosh, Kevin Hilman, linux-omap, linux-gpio, linux-kernel
On 03/20/2015 01:03 AM, Tony Lindgren wrote:
> * grygorii.strashko@linaro.org <grygorii.strashko@linaro.org> [150319 10:26]:
>> From: Grygorii Strashko <grygorii.strashko@linaro.org>
>>
>> Convert GPIO IRQ functions to use GPIO offset instead of system
>> GPIO numbers. This allows to drop unneeded conversations between
>> system GPIO <-> GPIO offset which are done in many places and
>> many times.
>> It is safe to do now because:
>> - gpiolib always passes GPIO offset to GPIO controller
>> - OMAP GPIO driver converted to use IRQ domain, so
>> struct irq_data->hwirq contains GPIO offset
>>
>> This is preparation step before removing:
>> #define GPIO_INDEX(bank, gpio)
>> #define GPIO_BIT(bank, gpio)
>> int omap_irq_to_gpio()
> ...
>
>> static void omap_gpio_unmask_irq(struct irq_data *d)
>> {
>> struct gpio_bank *bank = omap_irq_data_get_bank(d);
>> - unsigned int gpio = omap_irq_to_gpio(bank, d->hwirq);
>> + unsigned offset = d->hwirq;
>> unsigned int irq_mask = GPIO_BIT(bank, gpio);
>> u32 trigger = irqd_get_trigger_type(d);
>> unsigned long flags;
>
> This series up to this patch produces a build error that
> would break git bisect:
>
> drivers/gpio/gpio-omap.c: In function ‘omap_gpio_unmask_irq’:
> drivers/gpio/gpio-omap.c:866:37: error: ‘gpio’ undeclared (first use in this function)
> unsigned int irq_mask = GPIO_BIT(bank, gpio);
Oh. Thanks for catching that :) - splitting/rebasing issue.
--
regards,
-grygorii
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 5/8] gpio: omap: convert gpio irq functions to use GPIO offset
2015-03-19 17:25 ` [PATCH 5/8] gpio: omap: convert gpio irq functions to use GPIO offset grygorii.strashko
2015-03-19 23:03 ` Tony Lindgren
@ 2015-03-20 16:49 ` santosh.shilimkar
2015-03-20 18:47 ` Javier Martinez Canillas
1 sibling, 1 reply; 28+ messages in thread
From: santosh.shilimkar @ 2015-03-20 16:49 UTC (permalink / raw)
To: grygorii.strashko, Javier Martinez Canillas, Linus Walleij,
Alexandre Courbot, ssantosh, Kevin Hilman, tony
Cc: linux-omap, linux-gpio, linux-kernel
On 3/19/15 10:25 AM, grygorii.strashko@linaro.org wrote:
> From: Grygorii Strashko <grygorii.strashko@linaro.org>
>
> Convert GPIO IRQ functions to use GPIO offset instead of system
> GPIO numbers. This allows to drop unneeded conversations between
> system GPIO <-> GPIO offset which are done in many places and
> many times.
> It is safe to do now because:
> - gpiolib always passes GPIO offset to GPIO controller
> - OMAP GPIO driver converted to use IRQ domain, so
> struct irq_data->hwirq contains GPIO offset
>
> This is preparation step before removing:
> #define GPIO_INDEX(bank, gpio)
> #define GPIO_BIT(bank, gpio)
> int omap_irq_to_gpio()
>
> Signed-off-by: Grygorii Strashko <grygorii.strashko@linaro.org>
> ---
Once you take care of the bisect/build issue, feel free to add
Acked-by: Santosh Shilimkar <ssantosh@kernel.org>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 5/8] gpio: omap: convert gpio irq functions to use GPIO offset
2015-03-20 16:49 ` santosh.shilimkar
@ 2015-03-20 18:47 ` Javier Martinez Canillas
0 siblings, 0 replies; 28+ messages in thread
From: Javier Martinez Canillas @ 2015-03-20 18:47 UTC (permalink / raw)
To: santosh.shilimkar@oracle.com
Cc: Grygorii Strashko, Linus Walleij, Alexandre Courbot,
Santosh Shilimkar, Kevin Hilman, Tony Lindgren,
linux-omap@vger.kernel.org, Linux GPIO List, Linux Kernel
On Fri, Mar 20, 2015 at 5:49 PM, santosh.shilimkar@oracle.com
<santosh.shilimkar@oracle.com> wrote:
> On 3/19/15 10:25 AM, grygorii.strashko@linaro.org wrote:
>>
>> From: Grygorii Strashko <grygorii.strashko@linaro.org>
>>
>> Convert GPIO IRQ functions to use GPIO offset instead of system
>> GPIO numbers. This allows to drop unneeded conversations between
>> system GPIO <-> GPIO offset which are done in many places and
>> many times.
>> It is safe to do now because:
>> - gpiolib always passes GPIO offset to GPIO controller
>> - OMAP GPIO driver converted to use IRQ domain, so
>> struct irq_data->hwirq contains GPIO offset
>>
>> This is preparation step before removing:
>> #define GPIO_INDEX(bank, gpio)
>> #define GPIO_BIT(bank, gpio)
>> int omap_irq_to_gpio()
>>
>> Signed-off-by: Grygorii Strashko <grygorii.strashko@linaro.org>
>> ---
>
>
> Once you take care of the bisect/build issue, feel free to add
> Acked-by: Santosh Shilimkar <ssantosh@kernel.org>
Same for me, after the rebase/split fixup:
Acked-by: Javier Martinez Canillas <javier@dowhile0.org>
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH 6/8] gpio: omap: get rid of GPIO_BIT() macro
2015-03-19 17:25 [PATCH 0/8] gpio: omap: cleanup: get rid of system GPIO <-> GPIO offset converseations grygorii.strashko
` (4 preceding siblings ...)
2015-03-19 17:25 ` [PATCH 5/8] gpio: omap: convert gpio irq functions to use GPIO offset grygorii.strashko
@ 2015-03-19 17:25 ` grygorii.strashko
2015-03-20 16:50 ` santosh.shilimkar
2015-03-19 17:25 ` [RFT OMAP1 PATCH 7/8] gpio: omap: get rid of omap_irq_to_gpio() grygorii.strashko
` (2 subsequent siblings)
8 siblings, 1 reply; 28+ messages in thread
From: grygorii.strashko @ 2015-03-19 17:25 UTC (permalink / raw)
To: Javier Martinez Canillas, Linus Walleij, Alexandre Courbot,
ssantosh, Kevin Hilman, tony
Cc: linux-omap, linux-gpio, linux-kernel, Grygorii Strashko
From: Grygorii Strashko <grygorii.strashko@linaro.org>
Now OMAP GPIO driver prepared for GPIO_BIT() macro removing.
Do it ;)
Signed-off-by: Grygorii Strashko <grygorii.strashko@linaro.org>
---
drivers/gpio/gpio-omap.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index b39faa8..dd7934a 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -82,7 +82,6 @@ struct gpio_bank {
};
#define GPIO_INDEX(bank, gpio) (gpio % bank->width)
-#define GPIO_BIT(bank, gpio) (BIT(GPIO_INDEX(bank, gpio)))
#define GPIO_MOD_CTRL_BIT BIT(0)
#define BANK_USED(bank) (bank->mod_usage || bank->irq_usage)
@@ -863,7 +862,6 @@ static void omap_gpio_unmask_irq(struct irq_data *d)
{
struct gpio_bank *bank = omap_irq_data_get_bank(d);
unsigned offset = d->hwirq;
- unsigned int irq_mask = GPIO_BIT(bank, gpio);
u32 trigger = irqd_get_trigger_type(d);
unsigned long flags;
@@ -873,7 +871,7 @@ static void omap_gpio_unmask_irq(struct irq_data *d)
/* For level-triggered GPIOs, the clearing must be done after
* the HW source is cleared, thus after the handler has run */
- if (bank->level_mask & irq_mask) {
+ if (bank->level_mask & BIT(offset)) {
omap_set_gpio_irqenable(bank, offset, 0);
omap_clear_gpio_irqstatus(bank, offset);
}
--
1.9.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [PATCH 6/8] gpio: omap: get rid of GPIO_BIT() macro
2015-03-19 17:25 ` [PATCH 6/8] gpio: omap: get rid of GPIO_BIT() macro grygorii.strashko
@ 2015-03-20 16:50 ` santosh.shilimkar
2015-03-20 18:48 ` Javier Martinez Canillas
0 siblings, 1 reply; 28+ messages in thread
From: santosh.shilimkar @ 2015-03-20 16:50 UTC (permalink / raw)
To: grygorii.strashko, Javier Martinez Canillas, Linus Walleij,
Alexandre Courbot, ssantosh, Kevin Hilman, tony
Cc: linux-omap, linux-gpio, linux-kernel
On 3/19/15 10:25 AM, grygorii.strashko@linaro.org wrote:
> From: Grygorii Strashko <grygorii.strashko@linaro.org>
>
> Now OMAP GPIO driver prepared for GPIO_BIT() macro removing.
> Do it ;)
>
> Signed-off-by: Grygorii Strashko <grygorii.strashko@linaro.org>
> ---
Thanks for the cleanup Grygorii.
Acked-by: Santosh Shilimkar <ssantosh@kernel.org>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 6/8] gpio: omap: get rid of GPIO_BIT() macro
2015-03-20 16:50 ` santosh.shilimkar
@ 2015-03-20 18:48 ` Javier Martinez Canillas
0 siblings, 0 replies; 28+ messages in thread
From: Javier Martinez Canillas @ 2015-03-20 18:48 UTC (permalink / raw)
To: santosh.shilimkar@oracle.com
Cc: Grygorii Strashko, Linus Walleij, Alexandre Courbot,
Santosh Shilimkar, Kevin Hilman, Tony Lindgren,
linux-omap@vger.kernel.org, Linux GPIO List, Linux Kernel
On Fri, Mar 20, 2015 at 5:50 PM, santosh.shilimkar@oracle.com
<santosh.shilimkar@oracle.com> wrote:
> On 3/19/15 10:25 AM, grygorii.strashko@linaro.org wrote:
>>
>> From: Grygorii Strashko <grygorii.strashko@linaro.org>
>>
>> Now OMAP GPIO driver prepared for GPIO_BIT() macro removing.
>> Do it ;)
>>
>> Signed-off-by: Grygorii Strashko <grygorii.strashko@linaro.org>
>> ---
>
>
> Thanks for the cleanup Grygorii.
>
> Acked-by: Santosh Shilimkar <ssantosh@kernel.org>
Indeed!
Acked-by: Javier Martinez Canillas <javier@dowhile0.org>
^ permalink raw reply [flat|nested] 28+ messages in thread
* [RFT OMAP1 PATCH 7/8] gpio: omap: get rid of omap_irq_to_gpio()
2015-03-19 17:25 [PATCH 0/8] gpio: omap: cleanup: get rid of system GPIO <-> GPIO offset converseations grygorii.strashko
` (5 preceding siblings ...)
2015-03-19 17:25 ` [PATCH 6/8] gpio: omap: get rid of GPIO_BIT() macro grygorii.strashko
@ 2015-03-19 17:25 ` grygorii.strashko
2015-03-20 18:56 ` Javier Martinez Canillas
2015-03-19 17:25 ` [RFT OMAP1 PATCH 8/8] gpio: omap: get rid of GPIO_INDEX() macro grygorii.strashko
2015-03-19 23:00 ` [PATCH 0/8] gpio: omap: cleanup: get rid of system GPIO <-> GPIO offset converseations Tony Lindgren
8 siblings, 1 reply; 28+ messages in thread
From: grygorii.strashko @ 2015-03-19 17:25 UTC (permalink / raw)
To: Javier Martinez Canillas, Linus Walleij, Alexandre Courbot,
ssantosh, Kevin Hilman, tony
Cc: linux-omap, linux-gpio, linux-kernel, Grygorii Strashko
From: Grygorii Strashko <grygorii.strashko@linaro.org>
Now OMAP GPIO driver prepared for omap_irq_to_gpio() removing.
Do it ;)
Signed-off-by: Grygorii Strashko <grygorii.strashko@linaro.org>
---
drivers/gpio/gpio-omap.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index dd7934a..615e950 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -89,11 +89,6 @@ struct gpio_bank {
static void omap_gpio_unmask_irq(struct irq_data *d);
-static int omap_irq_to_gpio(struct gpio_bank *bank, unsigned int gpio_irq)
-{
- return bank->chip.base + gpio_irq;
-}
-
static inline struct gpio_bank *omap_irq_data_get_bank(struct irq_data *d)
{
struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
@@ -490,22 +485,21 @@ static void omap_gpio_init_irq(struct gpio_bank *bank, unsigned offset)
static int omap_gpio_irq_type(struct irq_data *d, unsigned type)
{
struct gpio_bank *bank = omap_irq_data_get_bank(d);
- unsigned gpio = 0;
int retval;
unsigned long flags;
- unsigned offset;
+ unsigned offset = d->hwirq;
if (!BANK_USED(bank))
pm_runtime_get_sync(bank->dev);
#ifdef CONFIG_ARCH_OMAP1
- if (d->irq > IH_MPUIO_BASE)
+ if (d->irq > IH_MPUIO_BASE) {
+ unsigned gpio = 0;
gpio = OMAP_MPUIO(d->irq - IH_MPUIO_BASE);
+ offset = GPIO_INDEX(bank, gpio);
+ }
#endif
- if (!gpio)
- gpio = omap_irq_to_gpio(bank, d->hwirq);
-
if (type & ~IRQ_TYPE_SENSE_MASK)
return -EINVAL;
@@ -514,7 +508,6 @@ static int omap_gpio_irq_type(struct irq_data *d, unsigned type)
return -EINVAL;
spin_lock_irqsave(&bank->lock, flags);
- offset = GPIO_INDEX(bank, gpio);
retval = omap_set_gpio_triggering(bank, offset, type);
omap_gpio_init_irq(bank, offset);
if (!omap_gpio_is_input(bank, offset)) {
--
1.9.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [RFT OMAP1 PATCH 7/8] gpio: omap: get rid of omap_irq_to_gpio()
2015-03-19 17:25 ` [RFT OMAP1 PATCH 7/8] gpio: omap: get rid of omap_irq_to_gpio() grygorii.strashko
@ 2015-03-20 18:56 ` Javier Martinez Canillas
2015-03-20 20:39 ` Grygorii.Strashko@linaro.org
0 siblings, 1 reply; 28+ messages in thread
From: Javier Martinez Canillas @ 2015-03-20 18:56 UTC (permalink / raw)
To: Grygorii Strashko
Cc: Linus Walleij, Alexandre Courbot, Santosh Shilimkar, Kevin Hilman,
Tony Lindgren, linux-omap@vger.kernel.org, Linux GPIO List,
Linux Kernel
Hello Grygorii,
On Thu, Mar 19, 2015 at 6:25 PM, <grygorii.strashko@linaro.org> wrote:
> From: Grygorii Strashko <grygorii.strashko@linaro.org>
>
> Now OMAP GPIO driver prepared for omap_irq_to_gpio() removing.
> Do it ;)
>
> Signed-off-by: Grygorii Strashko <grygorii.strashko@linaro.org>
I don't have access to OMAP1 boards to test but Tony did it o an
osk5912 and Aaro can confirm that it doesn't cause regressions on
other OMAP1 boards.
Thanks a lot for the cleanup.
Acked-by: Javier Martinez Canillas <javier@dowhile0.org>
Best regards,
Javier
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [RFT OMAP1 PATCH 7/8] gpio: omap: get rid of omap_irq_to_gpio()
2015-03-20 18:56 ` Javier Martinez Canillas
@ 2015-03-20 20:39 ` Grygorii.Strashko@linaro.org
2015-03-20 23:44 ` Javier Martinez Canillas
0 siblings, 1 reply; 28+ messages in thread
From: Grygorii.Strashko@linaro.org @ 2015-03-20 20:39 UTC (permalink / raw)
To: Javier Martinez Canillas, Grygorii Strashko, Aaro Koskinen
Cc: Linus Walleij, Alexandre Courbot, Santosh Shilimkar, Kevin Hilman,
Tony Lindgren, linux-omap@vger.kernel.org, Linux GPIO List,
Linux Kernel
On 03/20/2015 08:56 PM, Javier Martinez Canillas wrote:
> Hello Grygorii,
>
> On Thu, Mar 19, 2015 at 6:25 PM, <grygorii.strashko@linaro.org> wrote:
>> From: Grygorii Strashko <grygorii.strashko@linaro.org>
>>
>> Now OMAP GPIO driver prepared for omap_irq_to_gpio() removing.
>> Do it ;)
>>
>> Signed-off-by: Grygorii Strashko <grygorii.strashko@linaro.org>
>
> I don't have access to OMAP1 boards to test but Tony did it o an
> osk5912 and Aaro can confirm that it doesn't cause regressions on
> other OMAP1 boards.
Thanks. But could you clarify one point to me please?
"Aaro can confirm that it doesn't cause regressions on
other OMAP1 boards" - Does It mean I can add his Tested-by?
Or I still have to wait for his direct reply?
Just to avoid any confusions ;)
> Acked-by: Javier Martinez Canillas <javier@dowhile0.org>
>
--
regards,
-grygorii
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [RFT OMAP1 PATCH 7/8] gpio: omap: get rid of omap_irq_to_gpio()
2015-03-20 20:39 ` Grygorii.Strashko@linaro.org
@ 2015-03-20 23:44 ` Javier Martinez Canillas
0 siblings, 0 replies; 28+ messages in thread
From: Javier Martinez Canillas @ 2015-03-20 23:44 UTC (permalink / raw)
To: Grygorii.Strashko@linaro.org
Cc: Aaro Koskinen, Linus Walleij, Alexandre Courbot,
Santosh Shilimkar, Kevin Hilman, Tony Lindgren,
linux-omap@vger.kernel.org, Linux GPIO List, Linux Kernel
Hello Grygorii,
On Fri, Mar 20, 2015 at 9:39 PM, Grygorii.Strashko@linaro.org
<grygorii.strashko@linaro.org> wrote:
> On 03/20/2015 08:56 PM, Javier Martinez Canillas wrote:
>> Hello Grygorii,
>>
>> On Thu, Mar 19, 2015 at 6:25 PM, <grygorii.strashko@linaro.org> wrote:
>>> From: Grygorii Strashko <grygorii.strashko@linaro.org>
>>>
>>> Now OMAP GPIO driver prepared for omap_irq_to_gpio() removing.
>>> Do it ;)
>>>
>>> Signed-off-by: Grygorii Strashko <grygorii.strashko@linaro.org>
>>
>> I don't have access to OMAP1 boards to test but Tony did it o an
>> osk5912 and Aaro can confirm that it doesn't cause regressions on
>> other OMAP1 boards.
>
> Thanks. But could you clarify one point to me please?
> "Aaro can confirm that it doesn't cause regressions on
> other OMAP1 boards" - Does It mean I can add his Tested-by?
> Or I still have to wait for his direct reply?
> Just to avoid any confusions ;)
>
I meant that as far as I know Aaro has access to more OMAP1 systems so
he should be able to test that no regressions are added for those. But
I don't know if he would be able to test and I think your cleanups are
good so that's why I acked the patches.
Sorry for the confusion.
Best regards,
Javier
^ permalink raw reply [flat|nested] 28+ messages in thread
* [RFT OMAP1 PATCH 8/8] gpio: omap: get rid of GPIO_INDEX() macro
2015-03-19 17:25 [PATCH 0/8] gpio: omap: cleanup: get rid of system GPIO <-> GPIO offset converseations grygorii.strashko
` (6 preceding siblings ...)
2015-03-19 17:25 ` [RFT OMAP1 PATCH 7/8] gpio: omap: get rid of omap_irq_to_gpio() grygorii.strashko
@ 2015-03-19 17:25 ` grygorii.strashko
2015-03-20 18:56 ` Javier Martinez Canillas
2015-03-19 23:00 ` [PATCH 0/8] gpio: omap: cleanup: get rid of system GPIO <-> GPIO offset converseations Tony Lindgren
8 siblings, 1 reply; 28+ messages in thread
From: grygorii.strashko @ 2015-03-19 17:25 UTC (permalink / raw)
To: Javier Martinez Canillas, Linus Walleij, Alexandre Courbot,
ssantosh, Kevin Hilman, tony
Cc: linux-omap, linux-gpio, linux-kernel, Grygorii Strashko
From: Grygorii Strashko <grygorii.strashko@linaro.org>
Now OMAP GPIO driver prepared for GPIO_INDEX() macro removing.
Do It ;)
Signed-off-by: Grygorii Strashko <grygorii.strashko@linaro.org>
---
drivers/gpio/gpio-omap.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 615e950..cd1d5bf 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -81,7 +81,6 @@ struct gpio_bank {
struct omap_gpio_reg_offs *regs;
};
-#define GPIO_INDEX(bank, gpio) (gpio % bank->width)
#define GPIO_MOD_CTRL_BIT BIT(0)
#define BANK_USED(bank) (bank->mod_usage || bank->irq_usage)
@@ -492,14 +491,6 @@ static int omap_gpio_irq_type(struct irq_data *d, unsigned type)
if (!BANK_USED(bank))
pm_runtime_get_sync(bank->dev);
-#ifdef CONFIG_ARCH_OMAP1
- if (d->irq > IH_MPUIO_BASE) {
- unsigned gpio = 0;
- gpio = OMAP_MPUIO(d->irq - IH_MPUIO_BASE);
- offset = GPIO_INDEX(bank, gpio);
- }
-#endif
-
if (type & ~IRQ_TYPE_SENSE_MASK)
return -EINVAL;
--
1.9.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [RFT OMAP1 PATCH 8/8] gpio: omap: get rid of GPIO_INDEX() macro
2015-03-19 17:25 ` [RFT OMAP1 PATCH 8/8] gpio: omap: get rid of GPIO_INDEX() macro grygorii.strashko
@ 2015-03-20 18:56 ` Javier Martinez Canillas
0 siblings, 0 replies; 28+ messages in thread
From: Javier Martinez Canillas @ 2015-03-20 18:56 UTC (permalink / raw)
To: Grygorii Strashko
Cc: Linus Walleij, Alexandre Courbot, Santosh Shilimkar, Kevin Hilman,
Tony Lindgren, linux-omap@vger.kernel.org, Linux GPIO List,
Linux Kernel
On Thu, Mar 19, 2015 at 6:25 PM, <grygorii.strashko@linaro.org> wrote:
> From: Grygorii Strashko <grygorii.strashko@linaro.org>
>
> Now OMAP GPIO driver prepared for GPIO_INDEX() macro removing.
> Do It ;)
>
> Signed-off-by: Grygorii Strashko <grygorii.strashko@linaro.org>
Acked-by: Javier Martinez Canillas <javier@dowhile0.org>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 0/8] gpio: omap: cleanup: get rid of system GPIO <-> GPIO offset converseations
2015-03-19 17:25 [PATCH 0/8] gpio: omap: cleanup: get rid of system GPIO <-> GPIO offset converseations grygorii.strashko
` (7 preceding siblings ...)
2015-03-19 17:25 ` [RFT OMAP1 PATCH 8/8] gpio: omap: get rid of GPIO_INDEX() macro grygorii.strashko
@ 2015-03-19 23:00 ` Tony Lindgren
2015-03-20 15:11 ` Grygorii.Strashko@linaro.org
8 siblings, 1 reply; 28+ messages in thread
From: Tony Lindgren @ 2015-03-19 23:00 UTC (permalink / raw)
To: grygorii.strashko
Cc: Javier Martinez Canillas, Linus Walleij, Alexandre Courbot,
ssantosh, Kevin Hilman, linux-omap, linux-gpio, linux-kernel,
Aaro Koskinen
* grygorii.strashko@linaro.org <grygorii.strashko@linaro.org> [150319 10:26]:
> From: Grygorii Strashko <grygorii.strashko@linaro.org>
>
> Now in TI OMAP GPIO driver there are a lot of places where
> System GPIO number calculated and then converted to GPIO offset.
> What is worse is that in many place such conversation performed twice
> or even three times. But actually, we don't need to do that at all, because
> - gpiolib always passes GPIO offset to GPIO controller
> - OMAP GPIO driver converted to use IRQ domain, so
> struct irq_data->hwirq contains GPIO offset
>
> Hence, it is safe to convert all GPIO OMAP functions to use GPIO
> offset instead of system GPIO numbers. Also, this allows to remove
> unneeded conversations routines
> #define GPIO_INDEX(bank, gpio)
> #define GPIO_BIT(bank, gpio)
> int omap_irq_to_gpio()
Right on! This is excellent news. I've tested this set on top of -rc4
plus the patch mentioned below, and I'm not seeing regressions on
the platforms I tested with. Wake up to smsc911x ping with off-idle
still works on omap3.
I only briefly tested on omap1 (osk5912), so I'like to wait for
Aaro's ack before this gets merged.
I found one build error, other than that, for the whole series
please feel free to add:
Tested-by: Tony Lindgren <tony@atomide.com>
> Tested on dra7-evm.
>
> Last two patches have to be tested on OMAP1:
> - gpio: omap: get rid of omap_irq_to_gpio()
> - gpio: omap: get rid of GPIO_INDEX() macro
>
> Based on top of Linux 4.0-rc4 plus patch
> '[PATCH 1/2] gpio: omap: irq_shutdown: remove unnecessary call of gpiochip_unlock_as_irq'
> http://www.spinics.net/lists/linux-omap/msg116482.html
>
> Grygorii Strashko (8):
> gpio: omap: convert omap_gpio_is_input() to use gpio offset
> gpio: omap: simplify omap_set_gpio_dataout_x()
> gpio: omap: convert debounce functions switch to use gpio offset
> gpio: omap: drop 'gpio' param from omap_gpio_init_irq()
> gpio: omap: convert gpio irq functions to use GPIO offset
> gpio: omap: get rid of GPIO_BIT() macro
> gpio: omap: get rid of omap_irq_to_gpio()
> gpio: omap: get rid of GPIO_INDEX() macro
>
> drivers/gpio/gpio-omap.c | 130 ++++++++++++++++++++---------------------------
> 1 file changed, 55 insertions(+), 75 deletions(-)
>
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 0/8] gpio: omap: cleanup: get rid of system GPIO <-> GPIO offset converseations
2015-03-19 23:00 ` [PATCH 0/8] gpio: omap: cleanup: get rid of system GPIO <-> GPIO offset converseations Tony Lindgren
@ 2015-03-20 15:11 ` Grygorii.Strashko@linaro.org
2015-03-22 17:32 ` Aaro Koskinen
0 siblings, 1 reply; 28+ messages in thread
From: Grygorii.Strashko@linaro.org @ 2015-03-20 15:11 UTC (permalink / raw)
To: Tony Lindgren
Cc: Javier Martinez Canillas, Linus Walleij, Alexandre Courbot,
ssantosh, Kevin Hilman, linux-omap, linux-gpio, linux-kernel,
Aaro Koskinen
On 03/20/2015 01:00 AM, Tony Lindgren wrote:
> * grygorii.strashko@linaro.org <grygorii.strashko@linaro.org> [150319 10:26]:
>> From: Grygorii Strashko <grygorii.strashko@linaro.org>
>>
>> Now in TI OMAP GPIO driver there are a lot of places where
>> System GPIO number calculated and then converted to GPIO offset.
>> What is worse is that in many place such conversation performed twice
>> or even three times. But actually, we don't need to do that at all, because
>> - gpiolib always passes GPIO offset to GPIO controller
>> - OMAP GPIO driver converted to use IRQ domain, so
>> struct irq_data->hwirq contains GPIO offset
>>
>> Hence, it is safe to convert all GPIO OMAP functions to use GPIO
>> offset instead of system GPIO numbers. Also, this allows to remove
>> unneeded conversations routines
>> #define GPIO_INDEX(bank, gpio)
>> #define GPIO_BIT(bank, gpio)
>> int omap_irq_to_gpio()
>
> Right on! This is excellent news. I've tested this set on top of -rc4
> plus the patch mentioned below, and I'm not seeing regressions on
> the platforms I tested with. Wake up to smsc911x ping with off-idle
> still works on omap3.
>
> I only briefly tested on omap1 (osk5912), so I'like to wait for
> Aaro's ack before this gets merged.
>
> I found one build error, other than that, for the whole series
> please feel free to add:
>
> Tested-by: Tony Lindgren <tony@atomide.com>
Thanks Tony.
Yep. I'll wait for news from Aaro then will re-send if ok.
--
regards,
-grygorii
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 0/8] gpio: omap: cleanup: get rid of system GPIO <-> GPIO offset converseations
2015-03-20 15:11 ` Grygorii.Strashko@linaro.org
@ 2015-03-22 17:32 ` Aaro Koskinen
0 siblings, 0 replies; 28+ messages in thread
From: Aaro Koskinen @ 2015-03-22 17:32 UTC (permalink / raw)
To: Grygorii.Strashko@linaro.org
Cc: Tony Lindgren, Javier Martinez Canillas, Linus Walleij,
Alexandre Courbot, ssantosh, Kevin Hilman, linux-omap, linux-gpio,
linux-kernel
Hi,
On Fri, Mar 20, 2015 at 05:11:23PM +0200, Grygorii.Strashko@linaro.org wrote:
> On 03/20/2015 01:00 AM, Tony Lindgren wrote:
> > * grygorii.strashko@linaro.org <grygorii.strashko@linaro.org> [150319 10:26]:
> >> From: Grygorii Strashko <grygorii.strashko@linaro.org>
> >> Now in TI OMAP GPIO driver there are a lot of places where
> >> System GPIO number calculated and then converted to GPIO offset.
> >> What is worse is that in many place such conversation performed twice
> >> or even three times. But actually, we don't need to do that at all, because
> >> - gpiolib always passes GPIO offset to GPIO controller
> >> - OMAP GPIO driver converted to use IRQ domain, so
> >> struct irq_data->hwirq contains GPIO offset
> >>
> >> Hence, it is safe to convert all GPIO OMAP functions to use GPIO
> >> offset instead of system GPIO numbers. Also, this allows to remove
> >> unneeded conversations routines
> >> #define GPIO_INDEX(bank, gpio)
> >> #define GPIO_BIT(bank, gpio)
> >> int omap_irq_to_gpio()
> >
> > Right on! This is excellent news. I've tested this set on top of -rc4
> > plus the patch mentioned below, and I'm not seeing regressions on
> > the platforms I tested with. Wake up to smsc911x ping with off-idle
> > still works on omap3.
> >
> > I only briefly tested on omap1 (osk5912), so I'like to wait for
> > Aaro's ack before this gets merged.
> >
> > I found one build error, other than that, for the whole series
> > please feel free to add:
> >
> > Tested-by: Tony Lindgren <tony@atomide.com>
>
> Thanks Tony.
> Yep. I'll wait for news from Aaro then will re-send if ok.
Works fine on 770 and E3.
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
A.
^ permalink raw reply [flat|nested] 28+ messages in thread