Use OF_getencprop() in preference to OF_getprop() and manual byte-swapping.
This commit is contained in:
parent
6bff82d03d
commit
2d4c9dd88f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=269702
@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <sys/mutex.h>
|
#include <sys/mutex.h>
|
||||||
#include <sys/gpio.h>
|
#include <sys/gpio.h>
|
||||||
|
|
||||||
#include <dev/fdt/fdt_common.h>
|
|
||||||
#include <dev/ofw/openfirm.h>
|
#include <dev/ofw/openfirm.h>
|
||||||
#include <dev/ofw/ofw_bus.h>
|
#include <dev/ofw/ofw_bus.h>
|
||||||
#include <dev/ofw/ofw_bus_subr.h>
|
#include <dev/ofw/ofw_bus_subr.h>
|
||||||
@ -57,7 +56,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <sys/kbio.h>
|
#include <sys/kbio.h>
|
||||||
|
|
||||||
#include <machine/bus.h>
|
#include <machine/bus.h>
|
||||||
#include <machine/fdt.h>
|
|
||||||
#include <machine/cpu.h>
|
#include <machine/cpu.h>
|
||||||
#include <machine/intr.h>
|
#include <machine/intr.h>
|
||||||
|
|
||||||
@ -741,18 +739,18 @@ parse_dts(struct ckb_softc *sc)
|
|||||||
|
|
||||||
if ((len = OF_getproplen(node, "google,key-rows")) <= 0)
|
if ((len = OF_getproplen(node, "google,key-rows")) <= 0)
|
||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
OF_getprop(node, "google,key-rows", &dts_value, len);
|
OF_getencprop(node, "google,key-rows", &dts_value, len);
|
||||||
sc->rows = fdt32_to_cpu(dts_value);
|
sc->rows = dts_value;
|
||||||
|
|
||||||
if ((len = OF_getproplen(node, "google,key-columns")) <= 0)
|
if ((len = OF_getproplen(node, "google,key-columns")) <= 0)
|
||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
OF_getprop(node, "google,key-columns", &dts_value, len);
|
OF_getencprop(node, "google,key-columns", &dts_value, len);
|
||||||
sc->cols = fdt32_to_cpu(dts_value);
|
sc->cols = dts_value;
|
||||||
|
|
||||||
if ((len = OF_getproplen(node, "freebsd,intr-gpio")) <= 0)
|
if ((len = OF_getproplen(node, "freebsd,intr-gpio")) <= 0)
|
||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
OF_getprop(node, "freebsd,intr-gpio", &dts_value, len);
|
OF_getencprop(node, "freebsd,intr-gpio", &dts_value, len);
|
||||||
sc->gpio = fdt32_to_cpu(dts_value);
|
sc->gpio = dts_value;
|
||||||
|
|
||||||
if (OF_hasprop(node, "freebsd,keymap")) {
|
if (OF_hasprop(node, "freebsd,keymap")) {
|
||||||
keymap_prop = "freebsd,keymap";
|
keymap_prop = "freebsd,keymap";
|
||||||
|
@ -50,8 +50,8 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <vm/vm.h>
|
#include <vm/vm.h>
|
||||||
#include <vm/vm_extern.h>
|
#include <vm/vm_extern.h>
|
||||||
#include <vm/vm_kern.h>
|
#include <vm/vm_kern.h>
|
||||||
|
#include <vm/pmap.h>
|
||||||
|
|
||||||
#include <dev/fdt/fdt_common.h>
|
|
||||||
#include <dev/ofw/openfirm.h>
|
#include <dev/ofw/openfirm.h>
|
||||||
#include <dev/ofw/ofw_bus.h>
|
#include <dev/ofw/ofw_bus.h>
|
||||||
#include <dev/ofw/ofw_bus_subr.h>
|
#include <dev/ofw/ofw_bus_subr.h>
|
||||||
@ -64,7 +64,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include "gpio_if.h"
|
#include "gpio_if.h"
|
||||||
|
|
||||||
#include <machine/bus.h>
|
#include <machine/bus.h>
|
||||||
#include <machine/fdt.h>
|
|
||||||
#include <machine/cpu.h>
|
#include <machine/cpu.h>
|
||||||
#include <machine/intr.h>
|
#include <machine/intr.h>
|
||||||
|
|
||||||
@ -213,37 +212,37 @@ get_panel_info(struct fimd_softc *sc, struct panel_info *panel)
|
|||||||
/* panel size */
|
/* panel size */
|
||||||
if ((len = OF_getproplen(node, "panel-size")) <= 0)
|
if ((len = OF_getproplen(node, "panel-size")) <= 0)
|
||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
OF_getprop(node, "panel-size", &dts_value, len);
|
OF_getencprop(node, "panel-size", dts_value, len);
|
||||||
panel->width = fdt32_to_cpu(dts_value[0]);
|
panel->width = dts_value[0];
|
||||||
panel->height = fdt32_to_cpu(dts_value[1]);
|
panel->height = dts_value[1];
|
||||||
|
|
||||||
/* hsync */
|
/* hsync */
|
||||||
if ((len = OF_getproplen(node, "panel-hsync")) <= 0)
|
if ((len = OF_getproplen(node, "panel-hsync")) <= 0)
|
||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
OF_getprop(node, "panel-hsync", &dts_value, len);
|
OF_getencprop(node, "panel-hsync", dts_value, len);
|
||||||
panel->h_back_porch = fdt32_to_cpu(dts_value[0]);
|
panel->h_back_porch = dts_value[0];
|
||||||
panel->h_pulse_width = fdt32_to_cpu(dts_value[1]);
|
panel->h_pulse_width = dts_value[1];
|
||||||
panel->h_front_porch = fdt32_to_cpu(dts_value[2]);
|
panel->h_front_porch = dts_value[2];
|
||||||
|
|
||||||
/* vsync */
|
/* vsync */
|
||||||
if ((len = OF_getproplen(node, "panel-vsync")) <= 0)
|
if ((len = OF_getproplen(node, "panel-vsync")) <= 0)
|
||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
OF_getprop(node, "panel-vsync", &dts_value, len);
|
OF_getencprop(node, "panel-vsync", dts_value, len);
|
||||||
panel->v_back_porch = fdt32_to_cpu(dts_value[0]);
|
panel->v_back_porch = dts_value[0];
|
||||||
panel->v_pulse_width = fdt32_to_cpu(dts_value[1]);
|
panel->v_pulse_width = dts_value[1];
|
||||||
panel->v_front_porch = fdt32_to_cpu(dts_value[2]);
|
panel->v_front_porch = dts_value[2];
|
||||||
|
|
||||||
/* clk divider */
|
/* clk divider */
|
||||||
if ((len = OF_getproplen(node, "panel-clk-div")) <= 0)
|
if ((len = OF_getproplen(node, "panel-clk-div")) <= 0)
|
||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
OF_getprop(node, "panel-clk-div", &dts_value, len);
|
OF_getencprop(node, "panel-clk-div", dts_value, len);
|
||||||
panel->clk_div = fdt32_to_cpu(dts_value[0]);
|
panel->clk_div = dts_value[0];
|
||||||
|
|
||||||
/* backlight pin */
|
/* backlight pin */
|
||||||
if ((len = OF_getproplen(node, "panel-backlight-pin")) <= 0)
|
if ((len = OF_getproplen(node, "panel-backlight-pin")) <= 0)
|
||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
OF_getprop(node, "panel-backlight-pin", &dts_value, len);
|
OF_getencprop(node, "panel-backlight-pin", dts_value, len);
|
||||||
panel->backlight_pin = fdt32_to_cpu(dts_value[0]);
|
panel->backlight_pin = dts_value[0];
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
@ -43,13 +43,11 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <sys/watchdog.h>
|
#include <sys/watchdog.h>
|
||||||
#include <sys/gpio.h>
|
#include <sys/gpio.h>
|
||||||
|
|
||||||
#include <dev/fdt/fdt_common.h>
|
|
||||||
#include <dev/ofw/openfirm.h>
|
#include <dev/ofw/openfirm.h>
|
||||||
#include <dev/ofw/ofw_bus.h>
|
#include <dev/ofw/ofw_bus.h>
|
||||||
#include <dev/ofw/ofw_bus_subr.h>
|
#include <dev/ofw/ofw_bus_subr.h>
|
||||||
|
|
||||||
#include <machine/bus.h>
|
#include <machine/bus.h>
|
||||||
#include <machine/fdt.h>
|
|
||||||
#include <machine/cpu.h>
|
#include <machine/cpu.h>
|
||||||
#include <machine/intr.h>
|
#include <machine/intr.h>
|
||||||
|
|
||||||
@ -158,8 +156,8 @@ vbus_on(struct usb_phy_softc *sc)
|
|||||||
/* Power pin */
|
/* Power pin */
|
||||||
if ((len = OF_getproplen(node, "vbus-supply")) <= 0)
|
if ((len = OF_getproplen(node, "vbus-supply")) <= 0)
|
||||||
return (-1);
|
return (-1);
|
||||||
OF_getprop(node, "vbus-supply", &dts_value, len);
|
OF_getencprop(node, "vbus-supply", dts_value, len);
|
||||||
pin = fdt32_to_cpu(dts_value[0]);
|
pin = dts_value[0];
|
||||||
|
|
||||||
gpio_dev = devclass_get_device(devclass_find("gpio"), 0);
|
gpio_dev = devclass_get_device(devclass_find("gpio"), 0);
|
||||||
if (gpio_dev == NULL) {
|
if (gpio_dev == NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user