Author: andrew
Date: Mon Nov 14 12:03:08 2016
New Revision: 308640
URL: https://svnweb.freebsd.org/changeset/base/308640

Log:
  Use the correct OF_getencprop over OF_getprop + fdt32_to_cpu to read
  integer data from the device tree.
  
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/arm/altera/socfpga/socfpga_common.c
  head/sys/arm/altera/socfpga/socfpga_rstmgr.c
  head/sys/arm/broadcom/bcm2835/bcm2835_fb.c
  head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
  head/sys/arm/freescale/imx/imx51_ipuv3.c
  head/sys/arm/freescale/imx/imx51_ipuv3_fbd.c
  head/sys/arm/freescale/imx/imx6_ssi.c
  head/sys/arm/freescale/vybrid/vf_common.c
  head/sys/arm/freescale/vybrid/vf_dcu4.c
  head/sys/arm/freescale/vybrid/vf_edma.c
  head/sys/arm/freescale/vybrid/vf_iomuxc.c
  head/sys/arm/freescale/vybrid/vf_sai.c
  head/sys/arm/lpc/lpc_fb.c
  head/sys/arm/lpc/lpc_timer.c
  head/sys/arm/mv/gpio.c
  head/sys/arm/mv/mv_machdep.c
  head/sys/arm/rockchip/rk30xx_gpio.c
  head/sys/arm/ti/am335x/am335x_lcd.c
  head/sys/arm/ti/am335x/am335x_lcd_syscons.c
  head/sys/arm/ti/ti_adc.c
  head/sys/arm/ti/ti_sdhci.c
  head/sys/arm/versatile/sp804.c
  head/sys/arm/xilinx/zy7_slcr.c

Modified: head/sys/arm/altera/socfpga/socfpga_common.c
==============================================================================
--- head/sys/arm/altera/socfpga/socfpga_common.c        Mon Nov 14 11:52:22 
2016        (r308639)
+++ head/sys/arm/altera/socfpga/socfpga_common.c        Mon Nov 14 12:03:08 
2016        (r308640)
@@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/bus.h>
 #include <sys/kernel.h>
 
-#include <dev/fdt/fdt_common.h>
 #include <dev/ofw/openfirm.h>
 
 #include <machine/bus.h>
@@ -47,7 +46,7 @@ __FBSDID("$FreeBSD$");
 void
 cpu_reset(void)
 {
-       uint32_t addr, paddr;
+       uint32_t paddr;
        bus_addr_t vaddr;
        phandle_t node;
 
@@ -58,9 +57,8 @@ cpu_reset(void)
        if (node == -1)
                goto end;
 
-       if ((OF_getprop(node, "reg", &paddr, sizeof(paddr))) > 0) {
-               addr = fdt32_to_cpu(paddr);
-               if (bus_space_map(fdtbus_bs_tag, addr, 0x8, 0, &vaddr) == 0) {
+       if ((OF_getencprop(node, "reg", &paddr, sizeof(paddr))) > 0) {
+               if (bus_space_map(fdtbus_bs_tag, paddr, 0x8, 0, &vaddr) == 0) {
                        bus_space_write_4(fdtbus_bs_tag, vaddr,
                            RSTMGR_CTRL, CTRL_SWWARMRSTREQ);
                }

Modified: head/sys/arm/altera/socfpga/socfpga_rstmgr.c
==============================================================================
--- head/sys/arm/altera/socfpga/socfpga_rstmgr.c        Mon Nov 14 11:52:22 
2016        (r308639)
+++ head/sys/arm/altera/socfpga/socfpga_rstmgr.c        Mon Nov 14 12:03:08 
2016        (r308640)
@@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/timetc.h>
 #include <sys/sysctl.h>
 
-#include <dev/fdt/fdt_common.h>
 #include <dev/ofw/openfirm.h>
 #include <dev/ofw/ofw_bus.h>
 #include <dev/ofw/ofw_bus_subr.h>
@@ -84,7 +83,7 @@ enum {
 static int
 l3remap(struct rstmgr_softc *sc, int remap, int enable)
 {
-       uint32_t addr, paddr;
+       uint32_t paddr;
        bus_addr_t vaddr;
        phandle_t node;
        int reg;
@@ -106,9 +105,8 @@ l3remap(struct rstmgr_softc *sc, int rem
                return (1);
        }
 
-       if ((OF_getprop(node, "reg", &paddr, sizeof(paddr))) > 0) {
-               addr = fdt32_to_cpu(paddr);
-               if (bus_space_map(fdtbus_bs_tag, addr, 0x4, 0, &vaddr) == 0) {
+       if ((OF_getencprop(node, "reg", &paddr, sizeof(paddr))) > 0) {
+               if (bus_space_map(fdtbus_bs_tag, paddr, 0x4, 0, &vaddr) == 0) {
                        bus_space_write_4(fdtbus_bs_tag, vaddr,
                            L3REGS_REMAP, reg);
                        return (0);

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fb.c
==============================================================================
--- head/sys/arm/broadcom/bcm2835/bcm2835_fb.c  Mon Nov 14 11:52:22 2016        
(r308639)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_fb.c  Mon Nov 14 12:03:08 2016        
(r308640)
@@ -473,15 +473,15 @@ bcmfb_configure(int flags)
        if ((root != 0) && 
            (display = fdt_find_compatible(root, "broadcom,bcm2835-fb", 1))) {
                if (sc->width == 0) {
-                       if ((OF_getprop(display, "broadcom,width", 
+                       if ((OF_getencprop(display, "broadcom,width",
                            &cell, sizeof(cell))) > 0)
-                               sc->width = (int)fdt32_to_cpu(cell);
+                               sc->width = cell;
                }
 
                if (sc->height == 0) {
                        if ((OF_getprop(display, "broadcom,height", 
                            &cell, sizeof(cell))) > 0)
-                               sc->height = (int)fdt32_to_cpu(cell);
+                               sc->height = cell;
                }
        }
 

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
==============================================================================
--- head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c     Mon Nov 14 11:52:22 
2016        (r308639)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c     Mon Nov 14 12:03:08 
2016        (r308640)
@@ -78,13 +78,15 @@ bcm2835_late_init(platform_t plat)
 
        system = OF_finddevice("/system");
        if (system != 0) {
-               len = OF_getprop(system, "linux,serial", &cells, sizeof(cells));
+               len = OF_getencprop(system, "linux,serial", cells,
+                   sizeof(cells));
                if (len > 0)
-                       board_set_serial(fdt64_to_cpu(*((uint64_t *)cells)));
+                       board_set_serial(((uint64_t)cells[0]) << 32 | cells[1]);
 
-               len = OF_getprop(system, "linux,revision", &cells, 
sizeof(cells));
+               len = OF_getencprop(system, "linux,revision", cells,
+                   sizeof(cells));
                if (len > 0)
-                       board_set_revision(fdt32_to_cpu(*((uint32_t *)cells)));
+                       board_set_revision(cells[0]);
        }
 }
 

Modified: head/sys/arm/freescale/imx/imx51_ipuv3.c
==============================================================================
--- head/sys/arm/freescale/imx/imx51_ipuv3.c    Mon Nov 14 11:52:22 2016        
(r308639)
+++ head/sys/arm/freescale/imx/imx51_ipuv3.c    Mon Nov 14 12:03:08 2016        
(r308640)
@@ -61,7 +61,6 @@ __FBSDID("$FreeBSD$");
 #include <machine/resource.h>
 #include <machine/intr.h>
 
-#include <dev/fdt/fdt_common.h>
 #include <dev/ofw/ofw_bus.h>
 #include <dev/ofw/ofw_bus_subr.h>
 
@@ -313,10 +312,10 @@ ipu3_fb_attach(device_t dev)
         * On i.MX53, the offset is 0.
         */
        node = ofw_bus_get_node(dev);
-       if ((OF_getprop(node, "reg", &reg, sizeof(reg))) <= 0)
+       if ((OF_getencprop(node, "reg", &reg, sizeof(reg))) <= 0)
                base = 0;
        else
-               base = fdt32_to_cpu(reg) - IPU_CM_BASE(0);
+               base = reg - IPU_CM_BASE(0);
        /* map controller registers */
        err = bus_space_map(iot, IPU_CM_BASE(base), IPU_CM_SIZE, 0, &ioh);
        if (err)

Modified: head/sys/arm/freescale/imx/imx51_ipuv3_fbd.c
==============================================================================
--- head/sys/arm/freescale/imx/imx51_ipuv3_fbd.c        Mon Nov 14 11:52:22 
2016        (r308639)
+++ head/sys/arm/freescale/imx/imx51_ipuv3_fbd.c        Mon Nov 14 12:03:08 
2016        (r308640)
@@ -221,10 +221,10 @@ ipu3_fb_attach(device_t dev)
         * On i.MX53, the offset is 0.
         */
        node = ofw_bus_get_node(dev);
-       if ((OF_getprop(node, "reg", &reg, sizeof(reg))) <= 0)
+       if ((OF_getencprop(node, "reg", &reg, sizeof(reg))) <= 0)
                base = 0;
        else
-               base = fdt32_to_cpu(reg) - IPU_CM_BASE(0);
+               base = reg - IPU_CM_BASE(0);
        /* map controller registers */
        err = bus_space_map(iot, IPU_CM_BASE(base), IPU_CM_SIZE, 0, &ioh);
        if (err)

Modified: head/sys/arm/freescale/imx/imx6_ssi.c
==============================================================================
--- head/sys/arm/freescale/imx/imx6_ssi.c       Mon Nov 14 11:52:22 2016        
(r308639)
+++ head/sys/arm/freescale/imx/imx6_ssi.c       Mon Nov 14 12:03:08 2016        
(r308640)
@@ -446,12 +446,12 @@ find_sdma_controller(struct sc_info *sc)
        if ((len = OF_getproplen(node, "dmas")) <= 0)
                return (ENXIO);
 
-       OF_getprop(node, "dmas", &dts_value, len);
+       OF_getencprop(node, "dmas", &dts_value, len);
 
-       sc->sdma_ev_rx = fdt32_to_cpu(dts_value[1]);
-       sc->sdma_ev_tx = fdt32_to_cpu(dts_value[5]);
+       sc->sdma_ev_rx = dts_value[1];
+       sc->sdma_ev_tx = dts_value[5];
 
-       sdma_node = OF_node_from_xref(fdt32_to_cpu(dts_value[0]));
+       sdma_node = OF_node_from_xref(dts_value[0]);
 
        sdma_sc = NULL;
 

Modified: head/sys/arm/freescale/vybrid/vf_common.c
==============================================================================
--- head/sys/arm/freescale/vybrid/vf_common.c   Mon Nov 14 11:52:22 2016        
(r308639)
+++ head/sys/arm/freescale/vybrid/vf_common.c   Mon Nov 14 12:03:08 2016        
(r308640)
@@ -32,7 +32,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/bus.h>
 #include <sys/kernel.h>
 
-#include <dev/fdt/fdt_common.h>
 #include <dev/ofw/openfirm.h>
 
 #include <machine/bus.h>
@@ -44,16 +43,15 @@ void
 cpu_reset(void)
 {
        phandle_t src;
-       uint32_t addr, paddr;
+       uint32_t paddr;
        bus_addr_t vaddr;
 
        if (src_swreset() == 0)
                goto end;
 
        src = OF_finddevice("src");
-       if ((src != 0) && (OF_getprop(src, "reg", &paddr, sizeof(paddr))) > 0) {
-               addr = fdt32_to_cpu(paddr);
-               if (bus_space_map(fdtbus_bs_tag, addr, 0x10, 0, &vaddr) == 0) {
+       if ((src != 0) && (OF_getencprop(src, "reg", &paddr, sizeof(paddr))) > 
0) {
+               if (bus_space_map(fdtbus_bs_tag, paddr, 0x10, 0, &vaddr) == 0) {
                        bus_space_write_4(fdtbus_bs_tag, vaddr, 0x00, SW_RST);
                }
        }

Modified: head/sys/arm/freescale/vybrid/vf_dcu4.c
==============================================================================
--- head/sys/arm/freescale/vybrid/vf_dcu4.c     Mon Nov 14 11:52:22 2016        
(r308639)
+++ head/sys/arm/freescale/vybrid/vf_dcu4.c     Mon Nov 14 12:03:08 2016        
(r308640)
@@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$");
 #include <vm/vm.h>
 #include <vm/pmap.h>
 
-#include <dev/fdt/fdt_common.h>
 #include <dev/ofw/openfirm.h>
 #include <dev/ofw/ofw_bus.h>
 #include <dev/ofw/ofw_bus_subr.h>
@@ -246,37 +245,37 @@ get_panel_info(struct dcu_softc *sc, str
        /* panel size */
        if ((len = OF_getproplen(node, "panel-size")) <= 0)
                return (ENXIO);
-       OF_getprop(node, "panel-size", &dts_value, len);
-       panel->width = fdt32_to_cpu(dts_value[0]);
-       panel->height = fdt32_to_cpu(dts_value[1]);
+       OF_getencprop(node, "panel-size", dts_value, len);
+       panel->width = dts_value[0];
+       panel->height = dts_value[1];
 
        /* hsync */
        if ((len = OF_getproplen(node, "panel-hsync")) <= 0)
                return (ENXIO);
-       OF_getprop(node, "panel-hsync", &dts_value, len);
-       panel->h_back_porch = fdt32_to_cpu(dts_value[0]);
-       panel->h_pulse_width = fdt32_to_cpu(dts_value[1]);
-       panel->h_front_porch = fdt32_to_cpu(dts_value[2]);
+       OF_getencprop(node, "panel-hsync", dts_value, len);
+       panel->h_back_porch = dts_value[0];
+       panel->h_pulse_width = dts_value[1];
+       panel->h_front_porch = dts_value[2];
 
        /* vsync */
        if ((len = OF_getproplen(node, "panel-vsync")) <= 0)
                return (ENXIO);
-       OF_getprop(node, "panel-vsync", &dts_value, len);
-       panel->v_back_porch = fdt32_to_cpu(dts_value[0]);
-       panel->v_pulse_width = fdt32_to_cpu(dts_value[1]);
-       panel->v_front_porch = fdt32_to_cpu(dts_value[2]);
+       OF_getencprop(node, "panel-vsync", dts_value, len);
+       panel->v_back_porch = dts_value[0];
+       panel->v_pulse_width = dts_value[1];
+       panel->v_front_porch = dts_value[2];
 
        /* clk divider */
        if ((len = OF_getproplen(node, "panel-clk-div")) <= 0)
                return (ENXIO);
-       OF_getprop(node, "panel-clk-div", &dts_value, len);
-       panel->clk_div = fdt32_to_cpu(dts_value[0]);
+       OF_getencprop(node, "panel-clk-div", dts_value, len);
+       panel->clk_div = dts_value[0];
 
        /* backlight pin */
        if ((len = OF_getproplen(node, "panel-backlight-pin")) <= 0)
                return (ENXIO);
-       OF_getprop(node, "panel-backlight-pin", &dts_value, len);
-       panel->backlight_pin = fdt32_to_cpu(dts_value[0]);
+       OF_getencprop(node, "panel-backlight-pin", dts_value, len);
+       panel->backlight_pin = dts_value[0];
 
        return (0);
 }

Modified: head/sys/arm/freescale/vybrid/vf_edma.c
==============================================================================
--- head/sys/arm/freescale/vybrid/vf_edma.c     Mon Nov 14 11:52:22 2016        
(r308639)
+++ head/sys/arm/freescale/vybrid/vf_edma.c     Mon Nov 14 12:03:08 2016        
(r308640)
@@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/timetc.h>
 #include <sys/watchdog.h>
 
-#include <dev/fdt/fdt_common.h>
 #include <dev/ofw/openfirm.h>
 #include <dev/ofw/ofw_bus.h>
 #include <dev/ofw/ofw_bus_subr.h>
@@ -284,8 +283,8 @@ edma_attach(device_t dev)
        if ((len = OF_getproplen(node, "device-id")) <= 0)
                return (ENXIO);
 
-       OF_getprop(node, "device-id", &dts_value, len);
-       sc->device_id = fdt32_to_cpu(dts_value);
+       OF_getencprop(node, "device-id", &dts_value, len);
+       sc->device_id = dts_value;
 
        sc->dma_stop = dma_stop;
        sc->dma_setup = dma_setup;

Modified: head/sys/arm/freescale/vybrid/vf_iomuxc.c
==============================================================================
--- head/sys/arm/freescale/vybrid/vf_iomuxc.c   Mon Nov 14 11:52:22 2016        
(r308639)
+++ head/sys/arm/freescale/vybrid/vf_iomuxc.c   Mon Nov 14 12:03:08 2016        
(r308640)
@@ -148,12 +148,12 @@ pinmux_set(struct iomuxc_softc *sc)
                        continue;
 
                if ((len = OF_getproplen(child, "iomux_config")) > 0) {
-                       OF_getprop(child, "iomux_config", &iomux_config, len);
+                       OF_getencprop(child, "iomux_config", iomux_config, len);
 
                        values = len / (sizeof(uint32_t));
                        for (i = 0; i < values; i += 2) {
-                               pin = fdt32_to_cpu(iomux_config[i]);
-                               pin_cfg = fdt32_to_cpu(iomux_config[i+1]);
+                               pin = iomux_config[i];
+                               pin_cfg = iomux_config[i+1];
 #if 0
                                device_printf(sc->dev, "Set pin %d to 0x%08x\n",
                                    pin, pin_cfg);

Modified: head/sys/arm/freescale/vybrid/vf_sai.c
==============================================================================
--- head/sys/arm/freescale/vybrid/vf_sai.c      Mon Nov 14 11:52:22 2016        
(r308639)
+++ head/sys/arm/freescale/vybrid/vf_sai.c      Mon Nov 14 12:03:08 2016        
(r308640)
@@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$");
 #include <dev/sound/chip.h>
 #include <mixer_if.h>
 
-#include <dev/fdt/fdt_common.h>
 #include <dev/ofw/openfirm.h>
 #include <dev/ofw/ofw_bus.h>
 #include <dev/ofw/ofw_bus_subr.h>
@@ -424,19 +423,19 @@ find_edma_controller(struct sc_info *sc)
        if ((len = OF_getproplen(node, "edma-mux-group")) <= 0)
                return (ENXIO);
 
-       OF_getprop(node, "edma-src-transmit", &dts_value, len);
-       edma_src_transmit = fdt32_to_cpu(dts_value);
-       OF_getprop(node, "edma-mux-group", &dts_value, len);
-       edma_mux_group = fdt32_to_cpu(dts_value);
-       OF_getprop(node, "edma-controller", &dts_value, len);
-       edma_node = OF_node_from_xref(fdt32_to_cpu(dts_value));
+       OF_getencprop(node, "edma-src-transmit", &dts_value, len);
+       edma_src_transmit = dts_value;
+       OF_getencprop(node, "edma-mux-group", &dts_value, len);
+       edma_mux_group = dts_value;
+       OF_getencprop(node, "edma-controller", &dts_value, len);
+       edma_node = OF_node_from_xref(dts_value);
 
        if ((len = OF_getproplen(edma_node, "device-id")) <= 0) {
                return (ENXIO);
        }
 
-       OF_getprop(edma_node, "device-id", &dts_value, len);
-       edma_device_id = fdt32_to_cpu(dts_value);
+       OF_getencprop(edma_node, "device-id", &dts_value, len);
+       edma_device_id = dts_value;
 
        edma_sc = NULL;
 

Modified: head/sys/arm/lpc/lpc_fb.c
==============================================================================
--- head/sys/arm/lpc/lpc_fb.c   Mon Nov 14 11:52:22 2016        (r308639)
+++ head/sys/arm/lpc/lpc_fb.c   Mon Nov 14 12:03:08 2016        (r308640)
@@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$");
 #include <machine/resource.h>
 #include <machine/intr.h>
 
-#include <dev/fdt/fdt_common.h>
 #include <dev/ofw/ofw_bus.h>
 #include <dev/ofw/ofw_bus_subr.h>
 
@@ -280,10 +279,9 @@ lpc_fb_intr(void *arg)
 static int
 lpc_fb_fdt_read(phandle_t node, const char *name, uint32_t *ret)
 {
-       if (OF_getprop(node, name, ret, sizeof(uint32_t)) <= 0)
+       if (OF_getencprop(node, name, ret, sizeof(uint32_t)) <= 0)
                return (ENOENT);
 
-       *ret = fdt32_to_cpu(*ret);
        return (0);
 }
 

Modified: head/sys/arm/lpc/lpc_timer.c
==============================================================================
--- head/sys/arm/lpc/lpc_timer.c        Mon Nov 14 11:52:22 2016        
(r308639)
+++ head/sys/arm/lpc/lpc_timer.c        Mon Nov 14 12:03:08 2016        
(r308640)
@@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$");
 #include <machine/cpu.h>
 #include <machine/intr.h>
 
-#include <dev/fdt/fdt_common.h>
 #include <dev/ofw/ofw_bus.h>
 #include <dev/ofw/ofw_bus_subr.h>
 
@@ -158,7 +157,7 @@ lpc_timer_attach(device_t dev)
 
        /* Get PERIPH_CLK encoded in parent bus 'bus-frequency' property */
        node = ofw_bus_get_node(dev);
-       if (OF_getprop(OF_parent(node), "bus-frequency", &freq,
+       if (OF_getencprop(OF_parent(node), "bus-frequency", &freq,
            sizeof(pcell_t)) <= 0) {
                bus_release_resources(dev, lpc_timer_spec, sc->lt_res);
                bus_teardown_intr(dev, sc->lt_res[2], intrcookie);
@@ -166,8 +165,6 @@ lpc_timer_attach(device_t dev)
                return (ENXIO);
        }
 
-       freq = fdt32_to_cpu(freq);
-
        /* Set desired frequency in event timer and timecounter */
        sc->lt_et.et_frequency = (uint64_t)freq;
        lpc_timecounter.tc_frequency = (uint64_t)freq;  

Modified: head/sys/arm/mv/gpio.c
==============================================================================
--- head/sys/arm/mv/gpio.c      Mon Nov 14 11:52:22 2016        (r308639)
+++ head/sys/arm/mv/gpio.c      Mon Nov 14 12:03:08 2016        (r308640)
@@ -113,7 +113,7 @@ struct gpio_ctrl_entry {
        gpios_phandler_t        handler;
 };
 
-int mv_handle_gpios_prop(phandle_t ctrl, pcell_t *gpios, int len);
+static int mv_handle_gpios_prop(phandle_t ctrl, pcell_t *gpios, int len);
 int gpio_get_config_from_dt(void);
 
 struct gpio_ctrl_entry gpio_controllers[] = {
@@ -540,7 +540,7 @@ mv_gpio_value_set(uint32_t pin, uint8_t 
                mv_gpio_reg_clear(reg, pin);
 }
 
-int
+static int
 mv_handle_gpios_prop(phandle_t ctrl, pcell_t *gpios, int len)
 {
        pcell_t gpio_cells, pincnt;
@@ -554,10 +554,8 @@ mv_handle_gpios_prop(phandle_t ctrl, pce
                /* Node is not a GPIO controller. */
                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 != 3)
                return (ENXIO);
 
@@ -567,9 +565,9 @@ mv_handle_gpios_prop(phandle_t ctrl, pce
        if (fdt_regsize(ctrl, &gpio_ctrl, &size))
                return (ENXIO);
 
-       if (OF_getprop(ctrl, "pin-count", &pincnt, sizeof(pcell_t)) < 0)
+       if (OF_getencprop(ctrl, "pin-count", &pincnt, sizeof(pcell_t)) < 0)
                return (ENXIO);
-       sc.pin_num = fdt32_to_cpu(pincnt);
+       sc.pin_num = pincnt;
 
        /*
         * Skip controller reference, since controller's phandle is given
@@ -579,9 +577,9 @@ mv_handle_gpios_prop(phandle_t ctrl, pce
        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];
 
                mv_gpio_configure(pin, flags);
 
@@ -630,7 +628,7 @@ mv_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;
 
@@ -641,7 +639,7 @@ mv_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. */

Modified: head/sys/arm/mv/mv_machdep.c
==============================================================================
--- head/sys/arm/mv/mv_machdep.c        Mon Nov 14 11:52:22 2016        
(r308639)
+++ head/sys/arm/mv/mv_machdep.c        Mon Nov 14 12:03:08 2016        
(r308640)
@@ -147,21 +147,19 @@ moveon:
        /*
         * Process 'pin-count' and 'pin-map' props.
         */
-       if (OF_getprop(node, "pin-count", &pin_count, sizeof(pin_count)) <= 0)
+       if (OF_getencprop(node, "pin-count", &pin_count, sizeof(pin_count)) <= 
0)
                return (ENXIO);
-       pin_count = fdt32_to_cpu(pin_count);
        if (pin_count > MPP_PIN_MAX)
                return (ERANGE);
 
-       if (OF_getprop(node, "#pin-cells", &pin_cells, sizeof(pin_cells)) <= 0)
+       if (OF_getencprop(node, "#pin-cells", &pin_cells, sizeof(pin_cells)) <= 
0)
                pin_cells = MPP_PIN_CELLS;
-       pin_cells = fdt32_to_cpu(pin_cells);
        if (pin_cells > MPP_PIN_CELLS)
                return (ERANGE);
        tuple_size = sizeof(pcell_t) * pin_cells;
 
        bzero(pinmap, sizeof(pinmap));
-       len = OF_getprop(node, "pin-map", pinmap, sizeof(pinmap));
+       len = OF_getencprop(node, "pin-map", pinmap, sizeof(pinmap));
        if (len <= 0)
                return (ERANGE);
        if (len % tuple_size)
@@ -176,8 +174,8 @@ moveon:
        bzero(mpp, sizeof(mpp));
        pinmap_ptr = pinmap;
        for (i = 0; i < pins; i++) {
-               mpp_pin = fdt32_to_cpu(*pinmap_ptr);
-               mpp_function = fdt32_to_cpu(*(pinmap_ptr + 1));
+               mpp_pin = *pinmap_ptr;
+               mpp_function = *(pinmap_ptr + 1);
                mpp[mpp_pin] = mpp_function;
                pinmap_ptr += pin_cells;
        }
@@ -409,12 +407,10 @@ platform_devmap_init(void)
 
                if (ofw_bus_node_is_compatible(child, "mrvl,lbc")) {
                        /* Check available space */
-                       if (OF_getprop(child, "bank-count", (void *)&bank_count,
+                       if (OF_getencprop(child, "bank-count", &bank_count,
                            sizeof(bank_count)) <= 0)
                                /* If no property, use default value */
                                bank_count = 1;
-                       else
-                               bank_count = fdt32_to_cpu(bank_count);
 
                        if ((i + bank_count) >= FDT_DEVMAP_MAX)
                                return (ENOMEM);

Modified: head/sys/arm/rockchip/rk30xx_gpio.c
==============================================================================
--- head/sys/arm/rockchip/rk30xx_gpio.c Mon Nov 14 11:52:22 2016        
(r308639)
+++ head/sys/arm/rockchip/rk30xx_gpio.c Mon Nov 14 12:03:08 2016        
(r308640)
@@ -526,10 +526,8 @@ rk30_gpios_prop_handle(phandle_t ctrl, p
        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, p
        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. */

Modified: head/sys/arm/ti/am335x/am335x_lcd.c
==============================================================================
--- head/sys/arm/ti/am335x/am335x_lcd.c Mon Nov 14 11:52:22 2016        
(r308639)
+++ head/sys/arm/ti/am335x/am335x_lcd.c Mon Nov 14 12:03:08 2016        
(r308640)
@@ -359,13 +359,13 @@ am335x_read_property(device_t dev, phand
 {
        pcell_t cell;
 
-       if ((OF_getprop(node, name, &cell, sizeof(cell))) <= 0) {
+       if ((OF_getencprop(node, name, &cell, sizeof(cell))) <= 0) {
                device_printf(dev, "missing '%s' attribute in LCD panel info\n",
                    name);
                return (ENXIO);
        }
 
-       *val = fdt32_to_cpu(cell);
+       *val = cell;
 
        return (0);
 }

Modified: head/sys/arm/ti/am335x/am335x_lcd_syscons.c
==============================================================================
--- head/sys/arm/ti/am335x/am335x_lcd_syscons.c Mon Nov 14 11:52:22 2016        
(r308639)
+++ head/sys/arm/ti/am335x/am335x_lcd_syscons.c Mon Nov 14 12:03:08 2016        
(r308640)
@@ -382,13 +382,13 @@ am335x_syscons_configure(int flags)
        root = OF_finddevice("/");
        if ((root != 0) && 
            (display = am335x_syscons_find_panel_node(root))) {
-               if ((OF_getprop(display, "panel_width", 
-                   &cell, sizeof(cell))) > 0)
-                       va_sc->width = (int)fdt32_to_cpu(cell);
-
-               if ((OF_getprop(display, "panel_height", 
-                   &cell, sizeof(cell))) > 0)
-                       va_sc->height = (int)fdt32_to_cpu(cell);
+               if ((OF_getencprop(display, "panel_width", &cell,
+                   sizeof(cell))) > 0)
+                       va_sc->width = cell;
+
+               if ((OF_getencprop(display, "panel_height", &cell,
+                   sizeof(cell))) > 0)
+                       va_sc->height = cell;
        }
 
        if (va_sc->width == 0)

Modified: head/sys/arm/ti/ti_adc.c
==============================================================================
--- head/sys/arm/ti/ti_adc.c    Mon Nov 14 11:52:22 2016        (r308639)
+++ head/sys/arm/ti/ti_adc.c    Mon Nov 14 12:03:08 2016        (r308640)
@@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$");
 
 #include <machine/bus.h>
 
-#include <dev/fdt/fdt_common.h>
 #include <dev/ofw/openfirm.h>
 #include <dev/ofw/ofw_bus.h>
 #include <dev/ofw/ofw_bus_subr.h>
@@ -767,14 +766,17 @@ ti_adc_attach(device_t dev)
        /* Read "tsc" node properties */
        child = ofw_bus_find_child(node, "tsc");
        if (child != 0 && OF_hasprop(child, "ti,wires")) {
-               if ((OF_getprop(child, "ti,wires", &cell, sizeof(cell))) > 0)
-                       sc->sc_tsc_wires = fdt32_to_cpu(cell);
-               if ((OF_getprop(child, "ti,coordinate-readouts", &cell, 
sizeof(cell))) > 0)
-                       sc->sc_coord_readouts = fdt32_to_cpu(cell);
-               if ((OF_getprop(child, "ti,x-plate-resistance", &cell, 
sizeof(cell))) > 0)
-                       sc->sc_x_plate_resistance = fdt32_to_cpu(cell);
-               if ((OF_getprop(child, "ti,charge-delay", &cell, sizeof(cell))) 
> 0)
-                       sc->sc_charge_delay = fdt32_to_cpu(cell);
+               if ((OF_getencprop(child, "ti,wires", &cell, sizeof(cell))) > 0)
+                       sc->sc_tsc_wires = cell;
+               if ((OF_getencprop(child, "ti,coordinate-readouts", &cell,
+                   sizeof(cell))) > 0)
+                       sc->sc_coord_readouts = cell;
+               if ((OF_getencprop(child, "ti,x-plate-resistance", &cell,
+                   sizeof(cell))) > 0)
+                       sc->sc_x_plate_resistance = cell;
+               if ((OF_getencprop(child, "ti,charge-delay", &cell,
+                   sizeof(cell))) > 0)
+                       sc->sc_charge_delay = cell;
                nwire_configs = OF_getencprop_alloc(child, "ti,wire-config",
                    sizeof(*wire_configs), (void **)&wire_configs);
                if (nwire_configs != sc->sc_tsc_wires) {

Modified: head/sys/arm/ti/ti_sdhci.c
==============================================================================
--- head/sys/arm/ti/ti_sdhci.c  Mon Nov 14 11:52:22 2016        (r308639)
+++ head/sys/arm/ti/ti_sdhci.c  Mon Nov 14 12:03:08 2016        (r308640)
@@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$");
 #include <machine/resource.h>
 #include <machine/intr.h>
 
-#include <dev/fdt/fdt_common.h>
 #include <dev/ofw/ofw_bus.h>
 #include <dev/ofw/ofw_bus_subr.h>
 
@@ -506,10 +505,10 @@ ti_sdhci_attach(device_t dev)
         * See if we've got a GPIO-based write detect pin.  This is not the
         * standard documented property for this, we added it in freebsd.
         */
-       if ((OF_getprop(node, "mmchs-wp-gpio-pin", &prop, sizeof(prop))) <= 0)
+       if ((OF_getencprop(node, "mmchs-wp-gpio-pin", &prop, sizeof(prop))) <= 
0)
                sc->wp_gpio_pin = 0xffffffff;
        else
-               sc->wp_gpio_pin = fdt32_to_cpu(prop);
+               sc->wp_gpio_pin = prop;
 
        if (sc->wp_gpio_pin != 0xffffffff) {
                sc->gpio_dev = devclass_get_device(devclass_find("gpio"), 0);

Modified: head/sys/arm/versatile/sp804.c
==============================================================================
--- head/sys/arm/versatile/sp804.c      Mon Nov 14 11:52:22 2016        
(r308639)
+++ head/sys/arm/versatile/sp804.c      Mon Nov 14 12:03:08 2016        
(r308640)
@@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$");
 #include <machine/cpu.h>
 #include <machine/intr.h>
 
-#include <dev/fdt/fdt_common.h>
 #include <dev/ofw/openfirm.h>
 #include <dev/ofw/ofw_bus.h>
 #include <dev/ofw/ofw_bus_subr.h>
@@ -223,8 +222,8 @@ sp804_timer_attach(device_t dev)
        sc->sysclk_freq = DEFAULT_FREQUENCY;
        /* Get the base clock frequency */
        node = ofw_bus_get_node(dev);
-       if ((OF_getprop(node, "clock-frequency", &clock, sizeof(clock))) > 0) {
-               sc->sysclk_freq = fdt32_to_cpu(clock);
+       if ((OF_getencprop(node, "clock-frequency", &clock, sizeof(clock))) > 
0) {
+               sc->sysclk_freq = clock;
        }
 
        /* Setup and enable the timer */

Modified: head/sys/arm/xilinx/zy7_slcr.c
==============================================================================
--- head/sys/arm/xilinx/zy7_slcr.c      Mon Nov 14 11:52:22 2016        
(r308639)
+++ head/sys/arm/xilinx/zy7_slcr.c      Mon Nov 14 12:03:08 2016        
(r308640)
@@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$");
 #include <machine/resource.h>
 #include <machine/stdarg.h>
 
-#include <dev/fdt/fdt_common.h>
 #include <dev/ofw/ofw_bus.h>
 #include <dev/ofw/ofw_bus_subr.h>
 
@@ -621,8 +620,8 @@ zy7_slcr_attach(device_t dev)
 
        /* Derive PLL frequencies from PS_CLK. */
        node = ofw_bus_get_node(dev);
-       if (OF_getprop(node, "clock-frequency", &cell, sizeof(cell)) > 0)
-               ps_clk_frequency = fdt32_to_cpu(cell);
+       if (OF_getencprop(node, "clock-frequency", &cell, sizeof(cell)) > 0)
+               ps_clk_frequency = cell;
        else
                ps_clk_frequency = ZYNQ_DEFAULT_PS_CLK_FREQUENCY;
 
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to