Use the correct OF_getencprop over OF_getprop + fdt32_to_cpu to read
integer data from the device tree. Sponsored by: ABT Systems Ltd
This commit is contained in:
parent
222102cfca
commit
9783ea5c9f
@ -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);
|
||||
}
|
||||
|
@ -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 remap, int enable)
|
||||
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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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", ®, sizeof(reg))) <= 0)
|
||||
if ((OF_getencprop(node, "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)
|
||||
|
@ -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", ®, sizeof(reg))) <= 0)
|
||||
if ((OF_getencprop(node, "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)
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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, struct panel_info *panel)
|
||||
/* 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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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 val)
|
||||
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, pcell_t *gpios, int len)
|
||||
/* 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, pcell_t *gpios, int len)
|
||||
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, pcell_t *gpios, int len)
|
||||
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. */
|
||||
|
@ -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);
|
||||
|
@ -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. */
|
||||
|
@ -359,13 +359,13 @@ am335x_read_property(device_t dev, phandle_t node, const char *name, uint32_t *v
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
@ -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_getencprop(display, "panel_width", &cell,
|
||||
sizeof(cell))) > 0)
|
||||
va_sc->width = cell;
|
||||
|
||||
if ((OF_getprop(display, "panel_height",
|
||||
&cell, sizeof(cell))) > 0)
|
||||
va_sc->height = (int)fdt32_to_cpu(cell);
|
||||
if ((OF_getencprop(display, "panel_height", &cell,
|
||||
sizeof(cell))) > 0)
|
||||
va_sc->height = cell;
|
||||
}
|
||||
|
||||
if (va_sc->width == 0)
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user