Skip to content

Commit

Permalink
ARM: orion5x/kirkwood/mv78xx0: fix MPP configuration corner cases
Browse files Browse the repository at this point in the history
Wrong MPP configuration would cause <cpu>_mpp_conf loop infinitely
because the mpp list iterator would not be incremented.

Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
  • Loading branch information
Mike Rapoport authored and Nicolas Pitre committed Nov 5, 2010
1 parent 377304a commit 7350f41
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
4 changes: 1 addition & 3 deletions arch/arm/mach-kirkwood/mpp.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void __init kirkwood_mpp_conf(unsigned int *mpp_list)
}
printk("\n");

while (*mpp_list) {
for ( ; *mpp_list; mpp_list++) {
unsigned int num = MPP_NUM(*mpp_list);
unsigned int sel = MPP_SEL(*mpp_list);
int shift, gpio_mode;
Expand Down Expand Up @@ -88,8 +88,6 @@ void __init kirkwood_mpp_conf(unsigned int *mpp_list)
if (sel != 0)
gpio_mode = 0;
orion_gpio_set_valid(num, gpio_mode);

mpp_list++;
}

printk(KERN_DEBUG " final MPP regs:");
Expand Down
4 changes: 1 addition & 3 deletions arch/arm/mach-mv78xx0/mpp.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void __init mv78xx0_mpp_conf(unsigned int *mpp_list)
}
printk("\n");

while (*mpp_list) {
for ( ; *mpp_list; mpp_list++) {
unsigned int num = MPP_NUM(*mpp_list);
unsigned int sel = MPP_SEL(*mpp_list);
int shift, gpio_mode;
Expand Down Expand Up @@ -83,8 +83,6 @@ void __init mv78xx0_mpp_conf(unsigned int *mpp_list)
if (sel != 0)
gpio_mode = 0;
orion_gpio_set_valid(num, gpio_mode);

mpp_list++;
}

printk(KERN_DEBUG " final MPP regs:");
Expand Down
4 changes: 1 addition & 3 deletions arch/arm/mach-orion5x/mpp.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void __init orion5x_mpp_conf(struct orion5x_mpp_mode *mode)
/* Initialize gpiolib. */
orion_gpio_init();

while (mode->mpp >= 0) {
for ( ; mode->mpp >= 0; mode++) {
u32 *reg;
int num_type;
int shift;
Expand Down Expand Up @@ -160,8 +160,6 @@ void __init orion5x_mpp_conf(struct orion5x_mpp_mode *mode)
orion_gpio_set_unused(mode->mpp);

orion_gpio_set_valid(mode->mpp, !!(mode->type == MPP_GPIO));

mode++;
}

writel(mpp_0_7_ctrl, MPP_0_7_CTRL);
Expand Down

0 comments on commit 7350f41

Please sign in to comment.