gpio/omap: fix incorrect initialization of omap_gpio_mod_init
Subsystems (2)
PATCH v2 1/1 gpio/omap: fix incorrect initialization of omap_gpio_mod_init
Initialization of irqenable, irqstatus registers is the common operation done in this function for all OMAP platforms, viz. OMAP1, OMAP2+. The latter _gpio_rmw()'s which supposedly got introduced wrongly to take care of OMAP2+ platforms were overwriting initially programmed OMAP1 value breaking functionality on OMAP1. Somehow incorrect assumption was made that each _gpio_rmw()'s were mutually exclusive. On close observation it is found that the first _gpio_rmw() which is supposedly done to take care of OMAP1 platform is generic enough and takes care of OMAP2+ platform as well. Therefore remove the latter _gpio_rmw() to irqenable as they are redundant now.
Writing to ctrl and debounce_en registers for OMAP2+ platforms are modified to match the original(pre-cleanup) code where the registers are initialized with 0. In the cleanup series since we are using _gpio_rmw(reg, 0, 1), instead of __raw_writel(), we are just reading and writing the same values to ctrl and debounce_en. This is not an issue for debounce_en register because it has 0x0 as the default value. But in the case of ctrl register the default value is 0x2 (GATINGRATIO
= 0x1) so that we end up writing 0x2 instead of intended 0 value.
Therefore changing back to __raw_writel() as this is sufficient for this case besides simpler to understand.
Also, change irqstatus initalization logic that avoids comparison with bool, besides making it fit in a single line.
---
v2:
Avoid irqstatus initialization sequence change.
Use __raw_writel() to update debounce_en and ctrl registers. Update changelog to elaborate how redundant _gpio_rmw() got added.
drivers/gpio/gpio-omap.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-)
drivers/gpio/gpio-omap.c +3 -6
@@ -957,18 +957,15 @@ static void omap_gpio_mod_init(struct gpio_bank *bank) }_gpio_rmw (base, bank->regs->irqenable, l, bank->regs->irqenable_inv); -_gpio_rmw (base, bank->regs->irqstatus, l, - bank->regs->irqenable_inv == false); -_gpio_rmw (base, bank->regs->irqenable, l, bank->regs->debounce_en !=0 ); -_gpio_rmw (base, bank->regs->irqenable, l, bank->regs->ctrl !=0 ); +_gpio_rmw (base, bank->regs->irqstatus, l, !bank->regs->irqenable_inv);if (bank->regs->debounce_en) -_gpio_rmw (base, bank->regs->debounce_en,0 ,1 ); +__raw_writel (0 , base + bank->regs->debounce_en);/* Save OE default value (0xffffffff) in the context */ bank->context.oe =__raw_readl (bank->base + bank->regs->direction);/* Initialize interface clk ungated, module enabled */ if (bank->regs->ctrl) -_gpio_rmw (base, bank->regs->ctrl,0 ,1 ); +__raw_writel (0 , base + bank->regs->ctrl); } static __devinit void
Signature · 1 line
1.7.0.4
PATCH v2 1/1 gpio/omap: fix incorrect initialization of omap_gpio_mod_init
I've noticed that current mainline enables _all_ possible GPIO interrupts, this patch fixes that problem.
Also Grant doesn't seem to be on CC so might not be able to pick this up.
Quoted 75 lines · Tarun Kanti DebBarma
Initialization of irqenable, irqstatus registers is the common operation done in this function for all OMAP platforms, viz. OMAP1, OMAP2+. The latter _gpio_rmw()'s which supposedly got introduced wrongly to take care of OMAP2+ platforms were overwriting initially programmed OMAP1 value breaking functionality on OMAP1. Somehow incorrect assumption was made that each _gpio_rmw()'s were mutually exclusive. On close observation it is found that the first
_gpio_rmw()which is supposedly done to take care of OMAP1 platform is generic enough and takes care of OMAP2+ platform as well. Therefore remove the latter_gpio_rmw()to irqenable as they are redundant now.Writing to ctrl and
debounce_enregisters for OMAP2+ platforms are modified to match the original(pre-cleanup) code where the registers are initialized with 0. In the cleanup series since we are using_gpio_rmw(reg, 0, 1), instead of__raw_writel(), we are just reading and writing the same values to ctrl anddebounce_en. This is not an issue fordebounce_enregister because it has0x0as the default value. But in the case of ctrl register the default value is0x2(GATINGRATIO ?=0x1) so that we end up writing0x2instead of intended 0 value. Therefore changing back to__raw_writel()as this is sufficient for this case besides simpler to understand.Also, change irqstatus initalization logic that avoids comparison with bool, besides making it fit in a single line.
Cc stable at vger.kernel.orgCc Tony Lindgren <[email protected]>Cc Kevin Hilman <[email protected]>Cc Santosh Shilimkar <[email protected]>Cc Grant Likely <[email protected]>Reported-by Janusz Krzysztofik <[email protected]>Signed-off-by Tarun Kanti DebBarma <[email protected]>---
v2:
Avoid irqstatus initialization sequence change.
Use__raw_writel()to updatedebounce_enand ctrl registers. Update changelog to elaborate how redundant_gpio_rmw()got added.?drivers/gpio/gpio-omap.c | ? ?9 +++------
?1 files changed, 3 insertions(+), 6 deletions(-)drivers/gpio/gpio-omap.c +2
-5@@ -957,18 +957,15 @@ static void omap_gpio_mod_init(struct gpio_bank *bank) ? ? ? ?} ? ? ? ?_gpio_rmw(base, bank->regs->irqenable, l, bank->regs->irqenable_inv); - ? ? ? _gpio_rmw(base, bank->regs->irqstatus, l, - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bank->regs->irqenable_inv == false); - ? ? ? _gpio_rmw(base, bank->regs->irqenable, l, bank->regs->debounce_en != 0); - ? ? ? _gpio_rmw(base, bank->regs->irqenable, l, bank->regs->ctrl != 0); + ? ? ? _gpio_rmw(base, bank->regs->irqstatus, l, !bank->regs->irqenable_inv); ? ? ? ?if (bank->regs->debounce_en) - ? ? ? ? ? ? ? _gpio_rmw(base, bank->regs->debounce_en, 0, 1); + ? ? ? ? ? ? ? __raw_writel(0, base + bank->regs->debounce_en);? ? ? ?/* Save OE default value (
0xffffffff) in the context */ ? ? ? ?bank->context.oe =__raw_readl(bank->base + bank->regs->direction); ? ? ? ? /* Initialize interface clk ungated, module enabled */ ? ? ? ?if (bank->regs->ctrl)
- ? ? ? ? ? ? ?_gpio_rmw(base, bank->regs->ctrl, 0, 1);
+ ? ? ? ? ? ? ?__raw_writel(0, base + bank->regs->ctrl);
?}?static
__devinitvoid
--
1.7.0.4--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html
Signature · 1 line
Gra?vydas
PATCH v2 1/1 gpio/omap: fix incorrect initialization of omap_gpio_mod_init
Hi,
Quoted 2 lines · Grazvydas Ignotas
I've noticed that current mainline enables _all_ possible GPIO interrupts, this patch fixes that problem.
OK, thanks.
Quoted 1 line
Also Grant doesn't seem to be on CC so might not be able to pick this up.
I have added Cc: in the patch and was expecting that would take care. Looks like that has not happened. Anyways, I have explicitly added in the email. --
Tarun
Quoted 83 lines
Quoted 67 lines · Tarun Kanti DebBarma
Initialization of irqenable, irqstatus registers is the common operation done in this function for all OMAP platforms, viz. OMAP1, OMAP2+. The latter _gpio_rmw()'s which supposedly got introduced wrongly to take care of OMAP2+ platforms were overwriting initially programmed OMAP1 value breaking functionality on OMAP1. Somehow incorrect assumption was made that each _gpio_rmw()'s were mutually exclusive. On close observation it is found that the first
_gpio_rmw()which is supposedly done to take care of OMAP1 platform is generic enough and takes care of OMAP2+ platform as well. Therefore remove the latter_gpio_rmw()to irqenable as they are redundant now.Writing to ctrl and
debounce_enregisters for OMAP2+ platforms are modified to match the original(pre-cleanup) code where the registers are initialized with 0. In the cleanup series since we are using_gpio_rmw(reg, 0, 1), instead of__raw_writel(), we are just reading and writing the same values to ctrl anddebounce_en. This is not an issue fordebounce_enregister because it has0x0as the default value. But in the case of ctrl register the default value is0x2(GATINGRATIO ?=0x1) so that we end up writing0x2instead of intended 0 value. Therefore changing back to__raw_writel()as this is sufficient for this case besides simpler to understand.Also, change irqstatus initalization logic that avoids comparison with bool, besides making it fit in a single line.
Cc stable at vger.kernel.orgCc Tony Lindgren <[email protected]>Cc Kevin Hilman <[email protected]>Cc Santosh Shilimkar <[email protected]>Cc Grant Likely <[email protected]>Reported-by Janusz Krzysztofik <[email protected]>Signed-off-by Tarun Kanti DebBarma <[email protected]>---
v2:
Avoid irqstatus initialization sequence change.
Use__raw_writel()to updatedebounce_enand ctrl registers. Update changelog to elaborate how redundant_gpio_rmw()got added.?drivers/gpio/gpio-omap.c | ? ?9 +++------
?1 files changed, 3 insertions(+), 6 deletions(-)drivers/gpio/gpio-omap.c +2
-5@@ -957,18 +957,15 @@ static void omap_gpio_mod_init(struct gpio_bank *bank) ? ? ? ?} ? ? ? ?_gpio_rmw(base, bank->regs->irqenable, l, bank->regs->irqenable_inv); - ? ? ? _gpio_rmw(base, bank->regs->irqstatus, l, - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bank->regs->irqenable_inv == false); - ? ? ? _gpio_rmw(base, bank->regs->irqenable, l, bank->regs->debounce_en != 0); - ? ? ? _gpio_rmw(base, bank->regs->irqenable, l, bank->regs->ctrl != 0); + ? ? ? _gpio_rmw(base, bank->regs->irqstatus, l, !bank->regs->irqenable_inv); ? ? ? ?if (bank->regs->debounce_en) - ? ? ? ? ? ? ? _gpio_rmw(base, bank->regs->debounce_en, 0, 1); + ? ? ? ? ? ? ? __raw_writel(0, base + bank->regs->debounce_en);? ? ? ?/* Save OE default value (
0xffffffff) in the context */ ? ? ? ?bank->context.oe =__raw_readl(bank->base + bank->regs->direction); ? ? ? ? /* Initialize interface clk ungated, module enabled */ ? ? ? ?if (bank->regs->ctrl)
- ? ? ? ? ? ? ?_gpio_rmw(base, bank->regs->ctrl, 0, 1);
+ ? ? ? ? ? ? ?__raw_writel(0, base + bank->regs->ctrl);
?}Quoted 8 lines
?static
__devinitvoid
--
1.7.0.4--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html--
Gra?vydas
PATCH v2 1/1 gpio/omap: fix incorrect initialization of omap_gpio_mod_init
Quoted 8 lines · Tarun Kanti
Quoted 7 lines · Grazvydas Ignotas
Quoted 5 lines · Tarun Kanti DebBarma
Initialization of irqenable, irqstatus registers is the common operation done in this function for all OMAP platforms, viz. OMAP1, OMAP2+. The latter _gpio_rmw()'s which supposedly got introduced wrongly to take care of OMAP2+ platforms were overwriting initially programmed OMAP1 value breaking functionality on OMAP1.
Hi,
I can confirm that my other issues with GPIO on Amstrad Delta were not related, and this patch is still required for GPIO interrupts hardware being correctly initialized on OMAP1 in 3.4-rc6. You can add my
if you wish.
Thanks,
Janusz
PATCH v2 1/1 gpio/omap: fix incorrect initialization of omap_gpio_mod_init
Hi,
Quoted 10 lines · Janusz Krzysztofik
Quoted 8 lines · Tarun Kanti
Quoted 7 lines · Grazvydas Ignotas
Quoted 5 lines · Tarun Kanti DebBarma
Initialization of irqenable, irqstatus registers is the common operation done in this function for all OMAP platforms, viz. OMAP1, OMAP2+. The latter _gpio_rmw()'s which supposedly got introduced wrongly to take care of OMAP2+ platforms were overwriting initially programmed OMAP1 value breaking functionality on OMAP1.
Quoted 8 lines
Hi,
I can confirm that my other issues with GPIO on Amstrad Delta were not related, and this patch is still required for GPIO interrupts hardware being correctly initialized on OMAP1 in 3.4-rc6. You can add myTested-by Janusz Krzysztofik <[email protected]>if you wish.
Thank you for confirming!!
--
Tarun
Quoted 3 lines
Thanks,
Janusz
PATCH v2 1/1 gpio/omap: fix incorrect initialization of omap_gpio_mod_init
Grant,
Quoted 19 lines · Tarun Kanti
Hi,
Quoted 15 lines · Janusz Krzysztofik
Quoted 8 lines · Tarun Kanti
Quoted 7 lines · Grazvydas Ignotas
Quoted 5 lines · Tarun Kanti DebBarma
Initialization of irqenable, irqstatus registers is the common operation done in this function for all OMAP platforms, viz. OMAP1, OMAP2+. The latter _gpio_rmw()'s which supposedly got introduced wrongly to take care of OMAP2+ platforms were overwriting initially programmed OMAP1 value breaking functionality on OMAP1.
Hi,
I can confirm that my other issues with GPIO on Amstrad Delta were not related, and this patch is still required for GPIO interrupts hardware being correctly initialized on OMAP1 in 3.4-rc6. You can add my
Quoted 4 lines
Quoted 3 lines
Tested-by Janusz Krzysztofik <[email protected]>if you wish.
Thank you for confirming!!
We'd like to get this one in for v3.4-rc. Can you queue it?
I added the tested-by from Janusz and my signoff, and pull request is below.
Thanks,
Kevin
The following changes since commit d48b97b403d23f6df0b990cee652bdf9a52337a3:
Linux 3.4-rc6 (2012-05-06 15:07:32 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm.git for_3.5/fixes/gpio
for you to fetch changes up to 6edd94db250038c8fdf176f23ca4017d2f312509:
gpio/omap: fix incorrect initialization of omap_gpio_mod_init (2012-05-10 07:16:15 -0700)
----------------------------------------------------------------
Tarun Kanti DebBarma (1):
gpio/omap: fix incorrect initialization of omap_gpio_mod_init
drivers/gpio/gpio-omap.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
PATCH v2 1/1 gpio/omap: fix incorrect initialization of omap_gpio_mod_init
Quoted 25 lines · Kevin Hilman
Grant,
Quoted 21 lines · Tarun Kanti
Hi,
Quoted 17 lines · Janusz Krzysztofik
Quoted 8 lines · Tarun Kanti
Quoted 7 lines · Grazvydas Ignotas
Quoted 5 lines · Tarun Kanti DebBarma
Initialization of irqenable, irqstatus registers is the common operation done in this function for all OMAP platforms, viz. OMAP1, OMAP2+. The latter _gpio_rmw()'s which supposedly got introduced wrongly to take care of OMAP2+ platforms were overwriting initially programmed OMAP1 value breaking functionality on OMAP1.
Hi,
I can confirm that my other issues with GPIO on Amstrad Delta were not related, and this patch is still required for GPIO interrupts hardware being correctly initialized on OMAP1 in 3.4-rc6. You can add myTested-by Janusz Krzysztofik <[email protected]>
Quoted 7 lines
Quoted 2 lines
Quoted 1 line
if you wish.
Thank you for confirming!!
We'd like to get this one in for v3.4-rc. Can you queue it?
I added the tested-by from Janusz and my signoff, and pull request is below.
Pulled, thanks. I'll send a pull req out to Linus today.
g.
PATCH v2 1/1 gpio/omap: fix incorrect initialization of omap_gpio_mod_init
In reply to DebBarma, Tarun KantiQuoted 10 lines · Tarun Kanti
Hi,
Quoted 2 lines · Grazvydas Ignotas
I've noticed that current mainline enables _all_ possible GPIO interrupts, this patch fixes that problem.
OK, thanks.
Quoted 1 line
Also Grant doesn't seem to be on CC so might not be able to pick this up.
I have added Cc: in the patch and was expecting that would take care. Looks like that has not happened. Anyways, I have explicitly added in the email.
I'm particularly bursty when it comes to patch review and applying. Sometimes it takes me a while to find time for maintainership work.
g.