Skip to content

Commit

Permalink
of: GPIO: Fix OF probing on little-endian systems
Browse files Browse the repository at this point in the history
DTB is always big-endian that's why is necessary
to convert it.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
  • Loading branch information
Michal Simek authored and Grant Likely committed Sep 29, 2010
1 parent 899611e commit a04e78b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/gpio/xilinx_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,13 @@ static int __devinit xgpio_of_probe(struct device_node *np)
/* Update GPIO state shadow register with default value */
tree_info = of_get_property(np, "xlnx,dout-default", NULL);
if (tree_info)
chip->gpio_state = *tree_info;
chip->gpio_state = be32_to_cpup(tree_info);

/* Update GPIO direction shadow register with default value */
chip->gpio_dir = 0xFFFFFFFF; /* By default, all pins are inputs */
tree_info = of_get_property(np, "xlnx,tri-default", NULL);
if (tree_info)
chip->gpio_dir = *tree_info;
chip->gpio_dir = be32_to_cpup(tree_info);

/* Check device node and parent device node for device width */
chip->mmchip.gc.ngpio = 32; /* By default assume full GPIO controller */
Expand All @@ -186,7 +186,7 @@ static int __devinit xgpio_of_probe(struct device_node *np)
tree_info = of_get_property(np->parent,
"xlnx,gpio-width", NULL);
if (tree_info)
chip->mmchip.gc.ngpio = *tree_info;
chip->mmchip.gc.ngpio = be32_to_cpup(tree_info);

spin_lock_init(&chip->gpio_lock);

Expand Down

0 comments on commit a04e78b

Please sign in to comment.