Index: head/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c =================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c (nonexistent) +++ head/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c (revision 306430) @@ -0,0 +1,337 @@ +/*- + * Copyright (C) 2016 Oleksandr Tymoshenko + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include "mbox_if.h" + +#ifdef DEBUG +#define DPRINTF(fmt, ...) do { \ + printf("%s:%u: ", __func__, __LINE__); \ + printf(fmt, ##__VA_ARGS__); \ +} while (0) +#else +#define DPRINTF(fmt, ...) +#endif + +#define FT5406_LOCK(_sc) \ + mtx_lock(&(_sc)->sc_mtx) +#define FT5406_UNLOCK(_sc) \ + mtx_unlock(&(_sc)->sc_mtx) +#define FT5406_LOCK_INIT(_sc) \ + mtx_init(&_sc->sc_mtx, device_get_nameunit(_sc->sc_dev), \ + "ft5406", MTX_DEF) +#define FT5406_LOCK_DESTROY(_sc) \ + mtx_destroy(&_sc->sc_mtx); +#define FT5406_LOCK_ASSERT(_sc) \ + mtx_assert(&(_sc)->sc_mtx, MA_OWNED) + +#define FT5406_DEVICE_MODE 0 +#define FT5406_GESTURE_ID 1 +#define FT5406_NUM_POINTS 2 +#define FT5406_POINT_XH(n) (0 + 3 + (n)*6) +#define FT5406_POINT_XL(n) (1 + 3 + (n)*6) +#define FT5406_POINT_YH(n) (2 + 3 + (n)*6) +#define FT5406_POINT_YL(n) (3 + 3 + (n)*6) +#define FT5406_WINDOW_SIZE 64 + +#define GET_NUM_POINTS(buf) (buf[FT5406_NUM_POINTS]) +#define GET_X(buf, n) (((buf[FT5406_POINT_XH(n)] & 0xf) << 8) | \ + (buf[FT5406_POINT_XL(n)])) +#define GET_Y(buf, n) (((buf[FT5406_POINT_YH(n)] & 0xf) << 8) | \ + (buf[FT5406_POINT_YL(n)])) +#define GET_TOUCH_ID(buf, n) ((buf[FT5406_POINT_YH(n)] >> 4) & 0xf) + +#define NO_POINTS 99 +#define SCREEN_WIDTH 800 +#define SCREEN_HEIGHT 480 + +struct ft5406ts_softc { + device_t sc_dev; + struct mtx sc_mtx; + struct proc *sc_worker; + + /* mbox buffer (mapped to KVA) */ + uint8_t *touch_buf; + + /* initial hook for waiting mbox intr */ + struct intr_config_hook sc_init_hook; + + struct evdev_dev *sc_evdev; + int sc_detaching; +}; + +static void +ft5406ts_worker(void *data) +{ + struct ft5406ts_softc *sc = (struct ft5406ts_softc *)data; + int points; + int id, new_x, new_y, i, new_pen_down, updated; + int x, y, pen_down; + uint8_t window[FT5406_WINDOW_SIZE]; + int tick; + + /* 60Hz */ + tick = hz*17/1000; + if (tick == 0) + tick = 1; + + x = y = -1; + pen_down = 0; + + FT5406_LOCK(sc); + while(1) { + msleep(sc, &sc->sc_mtx, PCATCH | PZERO, "ft5406ts", tick); + + if (sc->sc_detaching) + break; + + memcpy(window, sc->touch_buf, sizeof(window)); + sc->touch_buf[FT5406_NUM_POINTS] = NO_POINTS; + + points = GET_NUM_POINTS(window); + /* + * No update from VC - do nothing + */ + if (points == NO_POINTS) + continue; + + /* No points and pen is already up */ + if ((points == 0) && !pen_down) + continue; + + new_pen_down = 0; + for (i = 0; i < points; i++) { + id = GET_TOUCH_ID(window, 0); + /* For now consider only touch 0 */ + if (id != 0) + continue; + new_pen_down = 1; + new_x = GET_X(window, 0); + new_y = GET_Y(window, 0); + } + + updated = 0; + + if (new_x != x) { + x = new_x; + updated = 1; + } + + if (new_y != y) { + y = new_y; + updated = 1; + } + + if (new_pen_down != pen_down) { + pen_down = new_pen_down; + updated = 1; + } + + if (updated) { + evdev_push_event(sc->sc_evdev, EV_ABS, ABS_X, x); + evdev_push_event(sc->sc_evdev, EV_ABS, ABS_Y, y); + evdev_push_event(sc->sc_evdev, EV_KEY, BTN_TOUCH, pen_down); + evdev_sync(sc->sc_evdev); + } + } + FT5406_UNLOCK(sc); + + kproc_exit(0); +} + +static void +ft5406ts_init(void *arg) +{ + struct ft5406ts_softc *sc = arg; + struct bcm2835_mbox_tag_touchbuf msg; + uint32_t touchbuf; + int err; + + /* release this hook (continue boot) */ + config_intrhook_disestablish(&sc->sc_init_hook); + + memset(&msg, 0, sizeof(msg)); + msg.hdr.buf_size = sizeof(msg); + msg.hdr.code = BCM2835_MBOX_CODE_REQ; + msg.tag_hdr.tag = BCM2835_MBOX_TAG_GET_TOUCHBUF; + msg.tag_hdr.val_buf_size = sizeof(msg.body); + msg.tag_hdr.val_len = sizeof(msg.body); + msg.end_tag = 0; + + /* call mailbox property */ + err = bcm2835_mbox_property(&msg, sizeof(msg)); + if (err) { + device_printf(sc->sc_dev, "failed to get touchbuf address\n"); + return; + } + + if (msg.body.resp.address == 0) { + device_printf(sc->sc_dev, "touchscreen not detected\n"); + return; + } + + touchbuf = VCBUS_TO_PHYS(msg.body.resp.address); + sc->touch_buf = (uint8_t*)pmap_mapdev(touchbuf, FT5406_WINDOW_SIZE); + + sc->sc_evdev = evdev_alloc(); + evdev_set_name(sc->sc_evdev, device_get_desc(sc->sc_dev)); + evdev_set_phys(sc->sc_evdev, device_get_nameunit(sc->sc_dev)); + evdev_set_id(sc->sc_evdev, BUS_VIRTUAL, 0, 0, 0); + evdev_support_prop(sc->sc_evdev, INPUT_PROP_DIRECT); + evdev_support_event(sc->sc_evdev, EV_SYN); + evdev_support_event(sc->sc_evdev, EV_ABS); + evdev_support_event(sc->sc_evdev, EV_KEY); + + evdev_support_abs(sc->sc_evdev, ABS_X, 0, 0, + SCREEN_WIDTH, 0, 0, 0); + evdev_support_abs(sc->sc_evdev, ABS_Y, 0, 0, + SCREEN_HEIGHT, 0, 0, 0); + + evdev_support_key(sc->sc_evdev, BTN_TOUCH); + + err = evdev_register(sc->sc_evdev); + if (err) { + evdev_free(sc->sc_evdev); + return; + } + + sc->touch_buf[FT5406_NUM_POINTS] = NO_POINTS; + if (kproc_create(ft5406ts_worker, (void*)sc, &sc->sc_worker, 0, 0, + "ft5406ts_worker") != 0) { + printf("failed to create ft5406ts_worker\n"); + } +} + +static int +ft5406ts_probe(device_t dev) +{ + + if (!ofw_bus_is_compatible(dev, "rpi,rpi-ft5406")) + return (ENXIO); + + device_set_desc(dev, "FT5406 touchscreen (VC memory interface)"); + + return (BUS_PROBE_DEFAULT); +} + +static int +ft5406ts_attach(device_t dev) +{ + struct ft5406ts_softc *sc; + + /* set self dev */ + sc = device_get_softc(dev); + sc->sc_dev = dev; + + /* register callback for using mbox when interrupts are enabled */ + sc->sc_init_hook.ich_func = ft5406ts_init; + sc->sc_init_hook.ich_arg = sc; + + if (config_intrhook_establish(&sc->sc_init_hook) != 0) { + device_printf(dev, "config_intrhook_establish failed\n"); + return (ENOMEM); + } + + FT5406_LOCK_INIT(sc); + + return (0); +} + +static int +ft5406ts_detach(device_t dev) +{ + struct ft5406ts_softc *sc; + + sc = device_get_softc(dev); + + FT5406_LOCK(sc); + if (sc->sc_worker) + sc->sc_detaching = 1; + + if (sc->sc_evdev) + evdev_free(sc->sc_evdev); + FT5406_UNLOCK(sc); + + FT5406_LOCK_DESTROY(sc); + + return (0); +} + +static device_method_t ft5406ts_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, ft5406ts_probe), + DEVMETHOD(device_attach, ft5406ts_attach), + DEVMETHOD(device_detach, ft5406ts_detach), + + DEVMETHOD_END +}; + +static devclass_t ft5406ts_devclass; +static driver_t ft5406ts_driver = { + "ft5406ts", + ft5406ts_methods, + sizeof(struct ft5406ts_softc), +}; + +DRIVER_MODULE(ft5406ts, ofwbus, ft5406ts_driver, ft5406ts_devclass, 0, 0); Property changes on: head/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/sys/arm/broadcom/bcm2835/files.bcm283x =================================================================== --- head/sys/arm/broadcom/bcm2835/files.bcm283x (revision 306429) +++ head/sys/arm/broadcom/bcm2835/files.bcm283x (revision 306430) @@ -1,45 +1,46 @@ # $FreeBSD$ arm/broadcom/bcm2835/bcm2835_bsc.c optional bcm2835_bsc arm/broadcom/bcm2835/bcm2835_common.c optional fdt arm/broadcom/bcm2835/bcm2835_cpufreq.c standard arm/broadcom/bcm2835/bcm2835_dma.c standard arm/broadcom/bcm2835/bcm2835_fb.c optional sc arm/broadcom/bcm2835/bcm2835_fbd.c optional vt +arm/broadcom/bcm2835/bcm2835_ft5406.c optional evdev bcm2835_ft5406 arm/broadcom/bcm2835/bcm2835_gpio.c optional gpio arm/broadcom/bcm2835/bcm2835_intr.c standard arm/broadcom/bcm2835/bcm2835_machdep.c standard arm/broadcom/bcm2835/bcm2835_mbox.c standard arm/broadcom/bcm2835/bcm2835_rng.c optional random arm/broadcom/bcm2835/bcm2835_sdhci.c optional sdhci arm/broadcom/bcm2835/bcm2835_spi.c optional bcm2835_spi arm/broadcom/bcm2835/bcm2835_vcio.c standard arm/broadcom/bcm2835/bcm2835_wdog.c standard arm/broadcom/bcm2835/bcm283x_dwc_fdt.c optional dwcotg fdt kern/kern_clocksource.c standard dev/mbox/mbox_if.m standard arm/broadcom/bcm2835/bcm2835_audio.c optional sound vchiq \ compile-with "${NORMAL_C} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -I$S/contrib/vchiq" # VideoCore driver contrib/vchiq/interface/compat/vchi_bsd.c optional vchiq \ compile-with "${NORMAL_C} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -I$S/contrib/vchiq" contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c optional vchiq \ compile-with "${NORMAL_C} -Wno-unused -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -I$S/contrib/vchiq" contrib/vchiq/interface/vchiq_arm/vchiq_arm.c optional vchiq \ compile-with "${NORMAL_C} -Wno-unused -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -I$S/contrib/vchiq" contrib/vchiq/interface/vchiq_arm/vchiq_connected.c optional vchiq \ compile-with "${NORMAL_C} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -I$S/contrib/vchiq" contrib/vchiq/interface/vchiq_arm/vchiq_core.c optional vchiq \ compile-with "${NORMAL_C} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -I$S/contrib/vchiq" contrib/vchiq/interface/vchiq_arm/vchiq_kern_lib.c optional vchiq \ compile-with "${NORMAL_C} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -I$S/contrib/vchiq" contrib/vchiq/interface/vchiq_arm/vchiq_kmod.c optional vchiq \ compile-with "${NORMAL_C} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -I$S/contrib/vchiq" contrib/vchiq/interface/vchiq_arm/vchiq_shim.c optional vchiq \ compile-with "${NORMAL_C} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -I$S/contrib/vchiq" contrib/vchiq/interface/vchiq_arm/vchiq_util.c optional vchiq \ compile-with "${NORMAL_C} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -I$S/contrib/vchiq" Index: head/sys/boot/fdt/dts/arm/rpi.dts =================================================================== --- head/sys/boot/fdt/dts/arm/rpi.dts (revision 306429) +++ head/sys/boot/fdt/dts/arm/rpi.dts (revision 306430) @@ -1,395 +1,400 @@ /* * Copyright (c) 2012 Oleksandr Tymoshenko * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ /dts-v1/; /include/ "bcm2835.dtsi" / { model = "Raspberry Pi (BCM2835)"; compatible = "raspberrypi,model-a", "raspberrypi,model-b", "broadcom,bcm2835-vc", "broadcom,bcm2708-vc"; memreserve = <0x08000000 0x08000000>; /* Set by VideoCore */ cpus { #address-cells = <1>; #size-cells = <0>; cpu@0 { compatible = "arm,1176jzf-s"; device_type = "cpu"; reg = <0>; /* CPU ID=0 */ clock-frequency = <700000000>; /* 700MHz */ }; }; memory { device_type = "memory"; reg = <0 0x8000000>; /* 128MB, Set by VideoCore */ }; system { revision = <0>; /* Set by VideoCore */ serial = <0 0>; /* Set by VideoCore */ }; axi { gpio: gpio { /* BSC0 */ pins_bsc0_a: bsc0_a { broadcom,function = "ALT0"; }; pins_bsc0_b: bsc0_b { broadcom,function = "ALT0"; }; pins_bsc0_c: bsc0_c { broadcom,function = "ALT1"; }; /* BSC1 */ pins_bsc1_a: bsc1_a { broadcom,function = "ALT0"; }; pins_bsc1_b: bsc1_b { broadcom,function = "ALT2"; }; /* GPCLK0 */ pins_gpclk0_a: gpclk0_a { broadcom,function = "ALT0"; }; pins_gpclk0_b: gpclk0_b { broadcom,function = "ALT5"; }; pins_gpclk0_c: gpclk0_c { broadcom,function = "ALT0"; }; pins_gpclk0_d: gpclk0_d { broadcom,function = "ALT0"; }; /* GPCLK1 */ pins_gpclk1_a: gpclk1_a { broadcom,function = "ALT0"; }; pins_gpclk1_b: gpclk1_b { broadcom,function = "ALT5"; }; pins_gpclk1_c: gpclk1_c { broadcom,function = "ALT0"; }; pins_gpclk1_d: gpclk1_d { broadcom,function = "ALT0"; }; /* GPCLK2 */ pins_gpclk2_a: gpclk2_a { broadcom,function = "ALT0"; }; pins_gpclk2_b: gpclk2_b { broadcom,function = "ALT0"; }; /* SPI0 */ pins_spi0_a: spi0_a { broadcom,function = "ALT0"; }; pins_spi0_b: spi0_b { broadcom,function = "ALT0"; }; /* PWM */ pins_pwm0_a: pwm0_a { broadcom,function = "ALT0"; }; pins_pwm0_b: pwm0_b { broadcom,function = "ALT5"; }; pins_pwm0_c: pwm0_c { broadcom,function = "ALT0"; }; pins_pwm1_a: pwm1_a { broadcom,function = "ALT0"; }; pins_pwm1_b: pwm1_b { broadcom,function = "ALT5"; }; pins_pwm1_c: pwm1_c { broadcom,function = "ALT0"; }; pins_pwm1_d: pwm1_d { broadcom,function = "ALT0"; }; /* UART0 */ pins_uart0_a: uart0_a { broadcom,function = "ALT0"; }; pins_uart0_b: uart0_b { broadcom,function = "ALT3"; }; pins_uart0_c: uart0_c { broadcom,function = "ALT2"; }; pins_uart0_fc_a: uart0_fc_a { broadcom,function = "ALT3"; }; pins_uart0_fc_b: uart0_fc_b { broadcom,function = "ALT3"; }; pins_uart0_fc_c: uart0_fc_c { broadcom,function = "ALT2"; }; /* PCM */ pins_pcm_a: pcm_a { broadcom,function = "ALT0"; }; pins_pcm_b: pcm_b { broadcom,function = "ALT2"; }; /* Secondary Address Bus */ pins_sm_addr_a: sm_addr_a { broadcom,function = "ALT1"; }; pins_sm_addr_b: sm_addr_b { broadcom,function = "ALT1"; }; pins_sm_ctl_a: sm_ctl_a { broadcom,function = "ALT1"; }; pins_sm_ctl_b: sm_ctl_b { broadcom,function = "ALT1"; }; pins_sm_data_8bit_a: sm_data_8bit_a { broadcom,function = "ALT1"; }; pins_sm_data_8bit_b: sm_data_8bit_b { broadcom,function = "ALT1"; }; pins_sm_data_16bit: sm_data_16bit { broadcom,function = "ALT1"; }; pins_sm_data_18bit: sm_data_18bit { broadcom,function = "ALT1"; }; /* BSCSL */ pins_bscsl: bscsl { broadcom,function = "ALT3"; }; /* SPISL */ pins_spisl: spisl { broadcom,function = "ALT3"; }; /* SPI1 */ pins_spi1: spi1 { broadcom,function = "ALT4"; }; /* UART1 */ pins_uart1_a: uart1_a { broadcom,function = "ALT5"; }; pins_uart1_b: uart1_b { broadcom,function = "ALT5"; }; pins_uart1_c: uart1_c { broadcom,function = "ALT5"; }; pins_uart1_fc_a: uart1_fc_a { broadcom,function = "ALT5"; }; pins_uart1_fc_b: uart1_fc_b { broadcom,function = "ALT5"; }; pins_uart1_fc_c: uart1_fc_c { broadcom,function = "ALT5"; }; /* SPI2 */ pins_spi2: spi2 { broadcom,function = "ALT4"; }; /* ARM JTAG */ pins_arm_jtag_trst: arm_jtag_trst { broadcom,function = "ALT4"; }; pins_arm_jtag_a: arm_jtag_a { broadcom,function = "ALT5"; }; pins_arm_jtag_b: arm_jtag_b { broadcom,function = "ALT4"; }; /* Reserved */ pins_reserved: reserved { broadcom,function = "ALT3"; }; }; usb { hub { compatible = "usb,hub", "usb,device"; reg = <0x00000001>; #address-cells = <1>; #size-cells = <0>; ethernet { compatible = "net,ethernet", "usb,device"; reg = <0x00000001>; mac-address = [00 00 00 00 00 00]; }; }; }; }; display { compatible = "broadcom,bcm2835-fb", "broadcom,bcm2708-fb"; broadcom,vc-mailbox = <&vc_mbox>; broadcom,vc-channel = <1>; broadcom,width = <0>; /* Set by VideoCore */ broadcom,height = <0>; /* Set by VideoCore */ broadcom,depth = <0>; /* Set by VideoCore */ }; + rpi_ft5406 { + compatible = "rpi,rpi-ft5406"; + status = "okay"; + }; + leds { compatible = "gpio-leds"; ok { label = "ok"; gpios = <&gpio 16 1>; /* Don't change this - it configures * how the led driver determines if * the led is on or off when it loads. */ default-state = "keep"; /* This is the real default state. */ linux,default-trigger = "default-on"; }; }; power: regulator { compatible = "broadcom,bcm2835-power-mgr", "broadcom,bcm2708-power-mgr", "simple-bus"; #address-cells = <1>; #size-cells = <0>; broadcom,vc-mailbox = <&vc_mbox>; broadcom,vc-channel = <0>; regulator-name = "VideoCore"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; regulator-always-on = <1>; sd_card_power: regulator@0 { compatible = "broadcom,bcm2835-power-dev", "broadcom,bcm2708-power-dev"; reg = <0>; vin-supply = <&power>; regulator-name = "SD Card"; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; }; /* This is for the controller itself, not the root port */ usb_hcd_power: regulator@3 { compatible = "broadcom,bcm2835-power-dev", "broadcom,bcm2708-power-dev"; reg = <3>; vin-supply = <&power>; regulator-name = "USB HCD"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; }; }; aliases { uart0 = &uart0; }; chosen { bootargs = ""; /* Set by VideoCore */ stdin = "uart0"; stdout = "uart0"; }; __overrides__ { cache_line_size = <&vchiq>, "cache-line-size:0"; }; }; Index: head/sys/boot/fdt/dts/arm/rpi2.dts =================================================================== --- head/sys/boot/fdt/dts/arm/rpi2.dts (revision 306429) +++ head/sys/boot/fdt/dts/arm/rpi2.dts (revision 306430) @@ -1,406 +1,411 @@ /* * Copyright (c) 2012 Oleksandr Tymoshenko * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ /dts-v1/; /include/ "bcm2836.dtsi" / { model = "Raspberry Pi 2 Model B"; compatible = "brcm,bcm2709"; memreserve = <0x08000000 0x08000000>; /* Set by VideoCore */ cpus { #address-cells = <1>; #size-cells = <0>; cpu@0 { compatible = "arm,cortex-a7"; device_type = "cpu"; reg = <0xf00>; /* CPU ID=0xf00 */ clock-frequency = <800000000>; /* 800MHz */ }; cpu@1 { compatible = "arm,cortex-a7"; device_type = "cpu"; reg = <0xf01>; /* CPU ID=0xf01 */ clock-frequency = <800000000>; /* 800MHz */ }; cpu@2 { compatible = "arm,cortex-a7"; device_type = "cpu"; reg = <0xf02>; /* CPU ID=0xf02 */ clock-frequency = <800000000>; /* 800MHz */ }; cpu@3 { compatible = "arm,cortex-a7"; device_type = "cpu"; reg = <0xf03>; /* CPU ID=0xf03 */ clock-frequency = <800000000>; /* 800MHz */ }; }; memory { device_type = "memory"; reg = <0 0x8000000>; /* 128MB, Set by VideoCore */ }; system { revision = <0>; /* Set by VideoCore */ serial = <0 0>; /* Set by VideoCore */ }; axi { gpio: gpio { /* BSC0 */ pins_bsc0_a: bsc0_a { broadcom,function = "ALT0"; }; pins_bsc0_b: bsc0_b { broadcom,function = "ALT0"; }; pins_bsc0_c: bsc0_c { broadcom,function = "ALT1"; }; /* BSC1 */ pins_bsc1_a: bsc1_a { broadcom,function = "ALT0"; }; pins_bsc1_b: bsc1_b { broadcom,function = "ALT2"; }; /* GPCLK0 */ pins_gpclk0_a: gpclk0_a { broadcom,function = "ALT0"; }; pins_gpclk0_b: gpclk0_b { broadcom,function = "ALT5"; }; pins_gpclk0_c: gpclk0_c { broadcom,function = "ALT0"; }; pins_gpclk0_d: gpclk0_d { broadcom,function = "ALT0"; }; /* GPCLK1 */ pins_gpclk1_a: gpclk1_a { broadcom,function = "ALT0"; }; pins_gpclk1_b: gpclk1_b { broadcom,function = "ALT5"; }; pins_gpclk1_c: gpclk1_c { broadcom,function = "ALT0"; }; pins_gpclk1_d: gpclk1_d { broadcom,function = "ALT0"; }; /* GPCLK2 */ pins_gpclk2_a: gpclk2_a { broadcom,function = "ALT0"; }; pins_gpclk2_b: gpclk2_b { broadcom,function = "ALT0"; }; /* SPI0 */ pins_spi0_a: spi0_a { broadcom,function = "ALT0"; }; pins_spi0_b: spi0_b { broadcom,function = "ALT0"; }; /* PWM */ pins_pwm0_a: pwm0_a { broadcom,function = "ALT0"; }; pins_pwm0_b: pwm0_b { broadcom,function = "ALT5"; }; pins_pwm0_c: pwm0_c { broadcom,function = "ALT0"; }; pins_pwm1_a: pwm1_a { broadcom,function = "ALT0"; }; pins_pwm1_b: pwm1_b { broadcom,function = "ALT5"; }; pins_pwm1_c: pwm1_c { broadcom,function = "ALT0"; }; pins_pwm1_d: pwm1_d { broadcom,function = "ALT0"; }; /* UART0 */ pins_uart0_a: uart0_a { broadcom,function = "ALT0"; }; pins_uart0_b: uart0_b { broadcom,function = "ALT3"; }; pins_uart0_c: uart0_c { broadcom,function = "ALT2"; }; pins_uart0_fc_a: uart0_fc_a { broadcom,function = "ALT3"; }; pins_uart0_fc_b: uart0_fc_b { broadcom,function = "ALT3"; }; pins_uart0_fc_c: uart0_fc_c { broadcom,function = "ALT2"; }; /* PCM */ pins_pcm_a: pcm_a { broadcom,function = "ALT0"; }; pins_pcm_b: pcm_b { broadcom,function = "ALT2"; }; /* Secondary Address Bus */ pins_sm_addr_a: sm_addr_a { broadcom,function = "ALT1"; }; pins_sm_addr_b: sm_addr_b { broadcom,function = "ALT1"; }; pins_sm_ctl_a: sm_ctl_a { broadcom,function = "ALT1"; }; pins_sm_ctl_b: sm_ctl_b { broadcom,function = "ALT1"; }; pins_sm_data_8bit_a: sm_data_8bit_a { broadcom,function = "ALT1"; }; pins_sm_data_8bit_b: sm_data_8bit_b { broadcom,function = "ALT1"; }; pins_sm_data_16bit: sm_data_16bit { broadcom,function = "ALT1"; }; pins_sm_data_18bit: sm_data_18bit { broadcom,function = "ALT1"; }; /* BSCSL */ pins_bscsl: bscsl { broadcom,function = "ALT3"; }; /* SPISL */ pins_spisl: spisl { broadcom,function = "ALT3"; }; /* SPI1 */ pins_spi1: spi1 { broadcom,function = "ALT4"; }; /* UART1 */ pins_uart1_a: uart1_a { broadcom,function = "ALT5"; }; pins_uart1_b: uart1_b { broadcom,function = "ALT5"; }; pins_uart1_c: uart1_c { broadcom,function = "ALT5"; }; pins_uart1_fc_a: uart1_fc_a { broadcom,function = "ALT5"; }; pins_uart1_fc_b: uart1_fc_b { broadcom,function = "ALT5"; }; pins_uart1_fc_c: uart1_fc_c { broadcom,function = "ALT5"; }; /* SPI2 */ pins_spi2: spi2 { broadcom,function = "ALT4"; }; /* ARM JTAG */ pins_arm_jtag_trst: arm_jtag_trst { broadcom,function = "ALT4"; }; pins_arm_jtag_a: arm_jtag_a { broadcom,function = "ALT5"; }; pins_arm_jtag_b: arm_jtag_b { broadcom,function = "ALT4"; }; /* Reserved */ pins_reserved: reserved { broadcom,function = "ALT3"; }; }; usb { hub { compatible = "usb,hub", "usb,device"; reg = <0x00000001>; #address-cells = <1>; #size-cells = <0>; ethernet { compatible = "net,ethernet", "usb,device"; reg = <0x00000001>; mac-address = [00 00 00 00 00 00]; }; }; }; }; display { compatible = "broadcom,bcm2835-fb", "broadcom,bcm2708-fb"; broadcom,vc-mailbox = <&vc_mbox>; broadcom,vc-channel = <1>; broadcom,width = <0>; /* Set by VideoCore */ broadcom,height = <0>; /* Set by VideoCore */ broadcom,depth = <0>; /* Set by VideoCore */ }; + rpi_ft5406 { + compatible = "rpi,rpi-ft5406"; + status = "okay"; + }; + leds { compatible = "gpio-leds"; pwr { label = "pwr"; gpios = <&gpio 35 0>; }; act { label = "act"; gpios = <&gpio 47 0>; }; }; power: regulator { compatible = "broadcom,bcm2835-power-mgr", "broadcom,bcm2708-power-mgr", "simple-bus"; #address-cells = <1>; #size-cells = <0>; broadcom,vc-mailbox = <&vc_mbox>; broadcom,vc-channel = <0>; regulator-name = "VideoCore"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; regulator-always-on = <1>; sd_card_power: regulator@0 { compatible = "broadcom,bcm2835-power-dev", "broadcom,bcm2708-power-dev"; reg = <0>; vin-supply = <&power>; regulator-name = "SD Card"; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; }; /* This is for the controller itself, not the root port */ usb_hcd_power: regulator@3 { compatible = "broadcom,bcm2835-power-dev", "broadcom,bcm2708-power-dev"; reg = <3>; vin-supply = <&power>; regulator-name = "USB HCD"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; }; }; aliases { uart0 = &uart0; }; chosen { bootargs = ""; /* Set by VideoCore */ stdin = "uart0"; stdout = "uart0"; }; __overrides__ { cache_line_size = <&vchiq>, "cache-line-size:0"; }; };