Skip to content

Commit 6edd94d

Browse files
Tarun Kanti DebBarmaKevin Hilman
authored andcommitted
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. Cc: [email protected] Cc: 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]> Tested-by: Janusz Krzysztofik <[email protected]> Signed-off-by: Tarun Kanti DebBarma <[email protected]> Signed-off-by: Kevin Hilman <[email protected]>
1 parent d48b97b commit 6edd94d

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

drivers/gpio/gpio-omap.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -965,18 +965,15 @@ static void omap_gpio_mod_init(struct gpio_bank *bank)
965965
}
966966

967967
_gpio_rmw(base, bank->regs->irqenable, l, bank->regs->irqenable_inv);
968-
_gpio_rmw(base, bank->regs->irqstatus, l,
969-
bank->regs->irqenable_inv == false);
970-
_gpio_rmw(base, bank->regs->irqenable, l, bank->regs->debounce_en != 0);
971-
_gpio_rmw(base, bank->regs->irqenable, l, bank->regs->ctrl != 0);
968+
_gpio_rmw(base, bank->regs->irqstatus, l, !bank->regs->irqenable_inv);
972969
if (bank->regs->debounce_en)
973-
_gpio_rmw(base, bank->regs->debounce_en, 0, 1);
970+
__raw_writel(0, base + bank->regs->debounce_en);
974971

975972
/* Save OE default value (0xffffffff) in the context */
976973
bank->context.oe = __raw_readl(bank->base + bank->regs->direction);
977974
/* Initialize interface clk ungated, module enabled */
978975
if (bank->regs->ctrl)
979-
_gpio_rmw(base, bank->regs->ctrl, 0, 1);
976+
__raw_writel(0, base + bank->regs->ctrl);
980977
}
981978

982979
static __devinit void

0 commit comments

Comments
 (0)