aboutsummaryrefslogtreecommitdiff
path: root/sys/arm/rockchip
diff options
context:
space:
mode:
authorAndrew Turner <andrew@FreeBSD.org>2016-11-14 12:03:08 +0000
committerAndrew Turner <andrew@FreeBSD.org>2016-11-14 12:03:08 +0000
commit9783ea5c9f762c43a4a43f344382e90ce2d53fa8 (patch)
tree042191ed86eceb5731e1295408b29fc3fc707493 /sys/arm/rockchip
parent222102cfcad6179aa3d99658453ef68e6bccc1d1 (diff)
downloadsrc-9783ea5c9f762c43a4a43f344382e90ce2d53fa8.tar.gz
src-9783ea5c9f762c43a4a43f344382e90ce2d53fa8.zip
Use the correct OF_getencprop over OF_getprop + fdt32_to_cpu to read
integer data from the device tree. Sponsored by: ABT Systems Ltd
Notes
Notes: svn path=/head/; revision=308640
Diffstat (limited to 'sys/arm/rockchip')
-rw-r--r--sys/arm/rockchip/rk30xx_gpio.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/sys/arm/rockchip/rk30xx_gpio.c b/sys/arm/rockchip/rk30xx_gpio.c
index 668b0e699c56..75bfd0034041 100644
--- a/sys/arm/rockchip/rk30xx_gpio.c
+++ b/sys/arm/rockchip/rk30xx_gpio.c
@@ -526,10 +526,8 @@ rk30_gpios_prop_handle(phandle_t ctrl, pcell_t *gpios, int len)
if (sc == NULL)
return ENXIO;
- if (OF_getprop(ctrl, "#gpio-cells", &gpio_cells, sizeof(pcell_t)) < 0)
+ if (OF_getencprop(ctrl, "#gpio-cells", &gpio_cells, sizeof(pcell_t)) < 0)
return (ENXIO);
-
- gpio_cells = fdt32_to_cpu(gpio_cells);
if (gpio_cells != 2)
return (ENXIO);
@@ -546,9 +544,9 @@ rk30_gpios_prop_handle(phandle_t ctrl, pcell_t *gpios, int len)
inc = sizeof(ihandle_t) / sizeof(pcell_t);
gpios += inc;
for (t = 0; t < tuples; t++) {
- pin = fdt32_to_cpu(gpios[0]);
- dir = fdt32_to_cpu(gpios[1]);
- flags = fdt32_to_cpu(gpios[2]);
+ pin = gpios[0];
+ dir = gpios[1];
+ flags = gpios[2];
for (i = 0; i < sc->sc_gpio_npins; i++) {
if (sc->sc_gpio_pins[i].gp_pin == pin)
@@ -601,7 +599,7 @@ rk30_gpio_init(void)
return (ENXIO);
/* Get 'gpios' property. */
- OF_getprop(child, "gpios", &gpios, len);
+ OF_getencprop(child, "gpios", gpios, len);
e = (struct gpio_ctrl_entry *)&gpio_controllers;
@@ -612,7 +610,7 @@ rk30_gpio_init(void)
* contain a ref. to a node defining GPIO
* controller.
*/
- ctrl = OF_node_from_xref(fdt32_to_cpu(gpios[0]));
+ ctrl = OF_node_from_xref(gpios[0]);
if (ofw_bus_node_is_compatible(ctrl, e->compat))
/* Call a handler. */