I looked at the sxiccmu and it seems to be set up for H3 in both the dtb and
driver.   There is a " sxiccmu1 at simplebus0" in dmesg (attached). What
does the message " sxiccmu_ccu_enable: 0x0000003b" in dmesg mean?

I would like to continue with the sxitwi driver as almost all the bits and
bytes in the driver match the H3 datasheet for TWI. The only exception I see
are two enhanced feature registers that I don't think will make any
difference.  The default is for the features to be off.

Can someone point me to code that does iic attach, detach, read and write
that I could use as an example to follow. I can't seem to get my head around
iic(9), setting up the parameters. Copying some existing code is much more
what I can handle.

-----Original Message-----
From: owner-...@openbsd.org [mailto:owner-...@openbsd.org] On Behalf Of
Artturi Alm
Sent: Wednesday, September 13, 2017 11:23 AM
To: Stephen Graf <s_g...@telus.net>
Cc: Patrick Wildt <patr...@blueri.se>; arm@openbsd.org
Subject: Re: help with sxitwi on allwinner H3

On Wed, Sep 13, 2017 at 10:50:28AM -0700, Stephen Graf wrote:
> I am trying to get an i2c driver working on orange pi one (H3).
> Reading the H3 datasheet would lead me to believe that the 
> driver should work.  The H3 data is the same except for 2 additional 
> extended feature registers that should not be needed.
> 
> I modified the dtb and the sxitwi driver to set up H3 compatibility, 
> rebuilt the kernel and got the following in the dmesg:
> 
> sxitwi0 at simplebus0sxiccmu_ccu_enable: 0x0000003b
> 
> iic0 at sxitwi0
> sxitwi1 at simplebus0sxiccmu_ccu_enable: 0x0000003c
> 
> iic1 at sxitwi1
> sxitwi2 at simplebus0sxiccmu_ccu_enable: 0x0000003d
> 
> iic2 at sxitwi2
> 
> Now I am stuck trying to write some code to test the driver. I have a 
> device on the i2c bus iic1 at address 76, a bme280 temperature, 
> pressure and humidity sensor.
> I am not an accomplished c programmer and would dearly like to see an 
> example of using iic to read and write a device on the i2c bus.
> 
> Note: I do not see nor can create iicx or switwi devices.  
> 

Hi,

after you've finished what patrick@ wrote about, you might want to take a
look at i/sys/dev/fdt/axp20x.c, it could very well be the simplest driver on
iic-bus in tree, and consequently it does attach to sxitwi* :)

-Artturi

OpenBSD 6.2-beta (GENERIC) #0: Tue Sep 12 21:33:15 PDT 2017
    sysad...@openbsdop1.home:/usr/src/sys/arch/armv7/compile/GENERIC
real mem  = 536870912 (512MB)
avail mem = 517316608 (493MB)
mainbus0 at root: Xunlong Orange Pi One
cpu0 at mainbus0: ARM Cortex-A7 r0p5 (ARMv7)
cpu0: DC enabled IC enabled WB disabled EABT branch prediction enabled
cpu0: 32KB(32b/l,2way) I-cache, 32KB(64b/l,4way) wr-back D-cache
cortex0 at mainbus0
sxiccmu0 at mainbus0
psci0 at mainbus0
simplebus0 at mainbus0: "soc"
sxiccmu1 at simplebus0
sxipio0 at simplebus0: 94 pins
sxipio1 at simplebus0: 12 pins
sximmc0 at simplebus0
sdmmc0 at sximmc0: 4-bit, sd high-speed, mmc high-speed, dma
ehci0 at simplebus0
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 configuration 1 interface 0 "Generic EHCI root hub" rev 2.00/1.00 
addr 1
ehci1 at simplebus0
usb1 at ehci1: USB revision 2.0
uhub1 at usb1 configuration 1 interface 0 "Generic EHCI root hub" rev 2.00/1.00 
addr 1
sxidog0 at simplebus0
com0 at simplebus0: ns16550, no working fifo
com0: console
sxitwi0 at simplebus0sxiccmu_ccu_enable: 0x0000003b

iic0 at sxitwi0
sxitwi1 at simplebus0sxiccmu_ccu_enable: 0x0000003c

iic1 at sxitwi1
sxitwi2 at simplebus0sxiccmu_ccu_enable: 0x0000003d

iic2 at sxitwi2
ampintc0 at simplebus0 nirq 160, ncpu 4
sxirtc0 at simplebus0
gpio0 at sxipio0: 32 pins
gpio1 at sxipio0: 32 pins
gpio2 at sxipio0: 32 pins
gpio3 at sxipio0: 32 pins
gpio4 at sxipio0: 32 pins
gpio5 at sxipio0: 32 pins
gpio6 at sxipio0: 32 pins
gpio7 at sxipio1: 32 pins
agtimer0 at mainbus0: tick rate 24000 KHz
scsibus0 at sdmmc0: 2 targets, initiator 0
sd0 at scsibus0 targ 1 lun 0: <SD/MMC, SL16G, 0080> SCSI2 0/direct removable
sd0: 15193MB, 512 bytes/sector, 31116288 sectors
uhub2 at uhub1 port 1 configuration 1 interface 0 "Terminus Technology USB 2.0 
Hub" rev 2.00/1.11 addr 2
run0 at uhub2 port 2 configuration 1 interface 0 "Ralink 802.11 n WLAN" rev 
2.00/1.01 addr 3
run0: MAC/BBP RT3070 (rev 0x0201), RF RT3020 (MIMO 1T1R), address 
00:1f:cf:52:86:52
umass0 at uhub2 port 4 configuration 1 interface 0 "VIA Labs,Inc. USB3.0 SATA 
Bridge" rev 2.10/4.14 addr 4
umass0: using SCSI over Bulk-Only
scsibus1 at umass0: 2 targets, initiator 0
sd1 at scsibus1 targ 1 lun 0: <ST310005, 28AS, CC38> SCSI4 0/direct fixed 
serial.21090711000000000025
sd1: 953869MB, 512 bytes/sector, 1953525164 sectors
vscsi0 at root
scsibus2 at vscsi0: 256 targets
softraid0 at root
scsibus3 at softraid0: 256 targets
boot device: sd0
root on sd0a (1267496224926671.a) swap on sd0b dump on sd0b
/dts-v1/;

/ {
        interrupt-parent = <0x1>;
        #address-cells = <0x1>;
        #size-cells = <0x1>;
        model = "Xunlong Orange Pi One";
        compatible = "xunlong,orangepi-one", "allwinner,sun8i-h3";

        clocks {
                #address-cells = <0x1>;
                #size-cells = <0x1>;
                ranges;

                osc24M_clk {
                        #clock-cells = <0x0>;
                        compatible = "fixed-clock";
                        clock-frequency = <0x16e3600>;
                        clock-output-names = "osc24M";
                        linux,phandle = <0x9>;
                        phandle = <0x9>;
                };

                osc32k_clk {
                        #clock-cells = <0x0>;
                        compatible = "fixed-clock";
                        clock-frequency = <0x8000>;
                        clock-output-names = "osc32k";
                        linux,phandle = <0xa>;
                        phandle = <0xa>;
                };

                internal-osc-clk {
                        #clock-cells = <0x0>;
                        compatible = "fixed-clock";
                        clock-frequency = <0xf42400>;
                        clock-accuracy = <0x11e1a300>;
                        clock-output-names = "iosc";
                        linux,phandle = <0x16>;
                        phandle = <0x16>;
                };
        };

        soc {
                compatible = "simple-bus";
                #address-cells = <0x1>;
                #size-cells = <0x1>;
                ranges;

                syscon@1c00000 {
                        compatible = "allwinner,sun8i-h3-system-controller", 
"syscon";
                        reg = <0x1c00000 0x1000>;
                };

                ethernet@1c30000 {
                        compatible = "allwinner,sun8i-h3-emac";
                        syscon = <0x6>;
                        reg = <0x1c30000 0x104>;
                        interrupts = <0x0 0x52 0x4>;
                        resets = <0x2 0xc>;
                        reset-names = "ahb";
                        clocks = <0x2 0x1b>;
                        clock-names = "ahb";
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                        status = "okay";
                        phy-handle = <0x7>;
                        phy-mode = "mii";
                        allwinner,leds-active-low;
                        linux,phandle = <0x31>;
                        phandle = <0x31>;

                        mdio {
                                #address-cells = <0x1>;
                                #size-cells = <0x0>;
                                linux,phandle = <0x32>;
                                phandle = <0x32>;

                                ethernet-phy@1 {
                                        reg = <0x1>;
                                        clocks = <0x2 0x43>;
                                        resets = <0x2 0x27>;
                                        linux,phandle = <0x4f>;
                                        phandle = <0x4f>;
                                };
                        };
                };

                dma-controller@01c02000 {
                        compatible = "allwinner,sun8i-h3-dma";
                        reg = <0x1c02000 0x1000>;
                        interrupts = <0x0 0x32 0x4>;
                        clocks = <0x2 0x15>;
                        resets = <0x2 0x6>;
                        #dma-cells = <0x1>;
                        linux,phandle = <0xb>;
                        phandle = <0xb>;
                };

                mmc@01c0f000 {
                        reg = <0x1c0f000 0x1000>;
                        resets = <0x2 0x7>;
                        reset-names = "ahb";
                        interrupts = <0x0 0x3c 0x4>;
                        status = "okay";
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                        compatible = "allwinner,sun7i-a20-mmc";
                        clocks = <0x2 0x16 0x2 0x47 0x2 0x49 0x2 0x48>;
                        clock-names = "ahb", "mmc", "output", "sample";
                        pinctrl-names = "default";
                        pinctrl-0 = <0x3 0x4>;
                        vmmc-supply = <0x5>;
                        bus-width = <0x4>;
                        cd-gpios = <0x6 0x5 0x6 0x0>;
                        cd-inverted;
                };

                mmc@01c10000 {
                        reg = <0x1c10000 0x1000>;
                        resets = <0x2 0x8>;
                        reset-names = "ahb";
                        interrupts = <0x0 0x3d 0x4>;
                        status = "disabled";
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                        compatible = "allwinner,sun7i-a20-mmc";
                        clocks = <0x2 0x17 0x2 0x4a 0x2 0x4c 0x2 0x4b>;
                        clock-names = "ahb", "mmc", "output", "sample";
                };

                mmc@01c11000 {
                        reg = <0x1c11000 0x1000>;
                        resets = <0x2 0x9>;
                        reset-names = "ahb";
                        interrupts = <0x0 0x3e 0x4>;
                        status = "disabled";
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                        compatible = "allwinner,sun7i-a20-mmc";
                        clocks = <0x2 0x18 0x2 0x4d 0x2 0x4f 0x2 0x4e>;
                        clock-names = "ahb", "mmc", "output", "sample";
                };

                usb@01c19000 {
                        compatible = "allwinner,sun8i-h3-musb";
                        reg = <0x1c19000 0x400>;
                        clocks = <0x2 0x20>;
                        resets = <0x2 0x11>;
                        interrupts = <0x0 0x47 0x4>;
                        interrupt-names = "mc";
                        phys = <0x7 0x0>;
                        phy-names = "usb";
                        extcon = <0x7 0x0>;
                        status = "okay";
                        dr_mode = "otg";
                };

                phy@01c19400 {
                        compatible = "allwinner,sun8i-h3-usb-phy";
                        reg = <0x1c19400 0x2c 0x1c1a800 0x4 0x1c1b800 0x4 
0x1c1c800 0x4 0x1c1d800 0x4>;
                        reg-names = "phy_ctrl", "pmu0", "pmu1", "pmu2", "pmu3";
                        clocks = <0x2 0x58 0x2 0x59 0x2 0x5a 0x2 0x5b>;
                        clock-names = "usb0_phy", "usb1_phy", "usb2_phy", 
"usb3_phy";
                        resets = <0x2 0x0 0x2 0x1 0x2 0x2 0x2 0x3>;
                        reset-names = "usb0_reset", "usb1_reset", "usb2_reset", 
"usb3_reset";
                        status = "okay";
                        #phy-cells = <0x1>;
                        usb0_id_det-gpios = <0x6 0x6 0xc 0x0>;
                        usb0_vbus-supply = <0x8>;
                        linux,phandle = <0x7>;
                        phandle = <0x7>;
                };

                usb@01c1a000 {
                        compatible = "allwinner,sun8i-h3-ehci", "generic-ehci";
                        reg = <0x1c1a000 0x100>;
                        interrupts = <0x0 0x48 0x4>;
                        clocks = <0x2 0x21 0x2 0x25>;
                        resets = <0x2 0x12 0x2 0x16>;
                        status = "okay";
                };

                usb@01c1a400 {
                        compatible = "allwinner,sun8i-h3-ohci", "generic-ohci";
                        reg = <0x1c1a400 0x100>;
                        interrupts = <0x0 0x49 0x4>;
                        clocks = <0x2 0x21 0x2 0x25 0x2 0x5c>;
                        resets = <0x2 0x12 0x2 0x16>;
                        status = "okay";
                };

                usb@01c1b000 {
                        compatible = "allwinner,sun8i-h3-ehci", "generic-ehci";
                        reg = <0x1c1b000 0x100>;
                        interrupts = <0x0 0x4a 0x4>;
                        clocks = <0x2 0x22 0x2 0x26>;
                        resets = <0x2 0x13 0x2 0x17>;
                        phys = <0x7 0x1>;
                        phy-names = "usb";
                        status = "okay";
                };

                usb@01c1b400 {
                        compatible = "allwinner,sun8i-h3-ohci", "generic-ohci";
                        reg = <0x1c1b400 0x100>;
                        interrupts = <0x0 0x4b 0x4>;
                        clocks = <0x2 0x22 0x2 0x26 0x2 0x5d>;
                        resets = <0x2 0x13 0x2 0x17>;
                        phys = <0x7 0x1>;
                        phy-names = "usb";
                        status = "okay";
                };

                usb@01c1c000 {
                        compatible = "allwinner,sun8i-h3-ehci", "generic-ehci";
                        reg = <0x1c1c000 0x100>;
                        interrupts = <0x0 0x4c 0x4>;
                        clocks = <0x2 0x23 0x2 0x27>;
                        resets = <0x2 0x14 0x2 0x18>;
                        phys = <0x7 0x2>;
                        phy-names = "usb";
                        status = "disabled";
                };

                usb@01c1c400 {
                        compatible = "allwinner,sun8i-h3-ohci", "generic-ohci";
                        reg = <0x1c1c400 0x100>;
                        interrupts = <0x0 0x4d 0x4>;
                        clocks = <0x2 0x23 0x2 0x27 0x2 0x5e>;
                        resets = <0x2 0x14 0x2 0x18>;
                        phys = <0x7 0x2>;
                        phy-names = "usb";
                        status = "disabled";
                };

                usb@01c1d000 {
                        compatible = "allwinner,sun8i-h3-ehci", "generic-ehci";
                        reg = <0x1c1d000 0x100>;
                        interrupts = <0x0 0x4e 0x4>;
                        clocks = <0x2 0x24 0x2 0x28>;
                        resets = <0x2 0x15 0x2 0x19>;
                        phys = <0x7 0x3>;
                        phy-names = "usb";
                        status = "disabled";
                };

                usb@01c1d400 {
                        compatible = "allwinner,sun8i-h3-ohci", "generic-ohci";
                        reg = <0x1c1d400 0x100>;
                        interrupts = <0x0 0x4f 0x4>;
                        clocks = <0x2 0x24 0x2 0x28 0x2 0x5f>;
                        resets = <0x2 0x15 0x2 0x19>;
                        phys = <0x7 0x3>;
                        phy-names = "usb";
                        status = "disabled";
                };

                clock@01c20000 {
                        reg = <0x1c20000 0x400>;
                        clocks = <0x9 0xa>;
                        clock-names = "hosc", "losc";
                        #clock-cells = <0x1>;
                        #reset-cells = <0x1>;
                        compatible = "allwinner,sun8i-h3-ccu";
                        linux,phandle = <0x2>;
                        phandle = <0x2>;
                };

                pinctrl@01c20800 {
                        reg = <0x1c20800 0x400>;
                        interrupts = <0x0 0xb 0x4 0x0 0x11 0x4>;
                        clocks = <0x2 0x36 0x9 0xa>;
                        clock-names = "apb", "hosc", "losc";
                        gpio-controller;
                        #gpio-cells = <0x3>;
                        interrupt-controller;
                        #interrupt-cells = <0x3>;
                        compatible = "allwinner,sun8i-h3-pinctrl";
                        linux,phandle = <0x6>;
                        phandle = <0x6>;

                        emac0 {
                                pins = "PD0", "PD1", "PD2", "PD3", "PD4", 
"PD5", "PD7", "PD8", "PD9", "PD10", "PD12", "PD13", "PD15", "PD16", "PD17";
                                function = "emac";
                                drive-strength = <0x28>;
                        };

                        i2c0 {
                                pins = "PA11", "PA12";
                                function = "i2c0";
                                linux,phandle = <0x13>;
                                phandle = <0x13>;
                        };

                        i2c1 {
                                pins = "PA18", "PA19";
                                function = "i2c1";
                                linux,phandle = <0x14>;
                                phandle = <0x14>;
                        };

                        i2c2 {
                                pins = "PE12", "PE13";
                                function = "i2c2";
                                linux,phandle = <0x15>;
                                phandle = <0x15>;
                        };

                        mmc0@0 {
                                pins = "PF0", "PF1", "PF2", "PF3", "PF4", "PF5";
                                function = "mmc0";
                                drive-strength = <0x1e>;
                                bias-pull-up;
                                linux,phandle = <0x3>;
                                phandle = <0x3>;
                        };

                        mmc0_cd_pin@0 {
                                pins = "PF6";
                                function = "gpio_in";
                                bias-pull-up;
                                linux,phandle = <0x4>;
                                phandle = <0x4>;
                        };

                        mmc1@0 {
                                pins = "PG0", "PG1", "PG2", "PG3", "PG4", "PG5";
                                function = "mmc1";
                                drive-strength = <0x1e>;
                                bias-pull-up;
                        };

                        mmc2_8bit {
                                pins = "PC5", "PC6", "PC8", "PC9", "PC10", 
"PC11", "PC12", "PC13", "PC14", "PC15", "PC16";
                                function = "mmc2";
                                drive-strength = <0x1e>;
                                bias-pull-up;
                        };

                        spdif@0 {
                                pins = "PA17";
                                function = "spdif";
                        };

                        spi0 {
                                pins = "PC0", "PC1", "PC2", "PC3";
                                function = "spi0";
                                linux,phandle = <0xc>;
                                phandle = <0xc>;
                        };

                        spi1 {
                                pins = "PA15", "PA16", "PA14", "PA13";
                                function = "spi1";
                                linux,phandle = <0xd>;
                                phandle = <0xd>;
                        };

                        uart0@0 {
                                pins = "PA4", "PA5";
                                function = "uart0";
                                linux,phandle = <0xf>;
                                phandle = <0xf>;
                        };

                        uart1 {
                                pins = "PG6", "PG7";
                                function = "uart1";
                                linux,phandle = <0x10>;
                                phandle = <0x10>;
                        };

                        uart1_rts_cts {
                                pins = "PG8", "PG9";
                                function = "uart1";
                        };

                        uart2 {
                                pins = "PA0", "PA1";
                                function = "uart2";
                                linux,phandle = <0x11>;
                                phandle = <0x11>;
                        };

                        uart3 {
                                pins = "PA13", "PA14";
                                function = "uart3";
                                linux,phandle = <0x12>;
                                phandle = <0x12>;
                        };

                        led_pins@0 {
                                pins = "PA15";
                                function = "gpio_out";
                                linux,phandle = <0x19>;
                                phandle = <0x19>;
                        };
                };

                timer@01c20c00 {
                        compatible = "allwinner,sun4i-a10-timer";
                        reg = <0x1c20c00 0xa0>;
                        interrupts = <0x0 0x12 0x4 0x0 0x13 0x4>;
                        clocks = <0x9>;
                };

                spi@01c68000 {
                        compatible = "allwinner,sun8i-h3-spi";
                        reg = <0x1c68000 0x1000>;
                        interrupts = <0x0 0x41 0x4>;
                        clocks = <0x2 0x1e 0x2 0x52>;
                        clock-names = "ahb", "mod";
                        dmas = <0xb 0x17 0xb 0x17>;
                        dma-names = "rx", "tx";
                        pinctrl-names = "default";
                        pinctrl-0 = <0xc>;
                        resets = <0x2 0xf>;
                        status = "disabled";
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                };

                spi@01c69000 {
                        compatible = "allwinner,sun8i-h3-spi";
                        reg = <0x1c69000 0x1000>;
                        interrupts = <0x0 0x42 0x4>;
                        clocks = <0x2 0x1f 0x2 0x53>;
                        clock-names = "ahb", "mod";
                        dmas = <0xb 0x18 0xb 0x18>;
                        dma-names = "rx", "tx";
                        pinctrl-names = "default";
                        pinctrl-0 = <0xd>;
                        resets = <0x2 0x10>;
                        status = "disabled";
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                };

                watchdog@01c20ca0 {
                        compatible = "allwinner,sun6i-a31-wdt";
                        reg = <0x1c20ca0 0x20>;
                        interrupts = <0x0 0x19 0x4>;
                };

                spdif@01c21000 {
                        #sound-dai-cells = <0x0>;
                        compatible = "allwinner,sun8i-h3-spdif";
                        reg = <0x1c21000 0x400>;
                        interrupts = <0x0 0xc 0x4>;
                        clocks = <0x2 0x35 0x2 0x57>;
                        resets = <0x2 0x29>;
                        clock-names = "apb", "spdif";
                        dmas = <0xb 0x2>;
                        dma-names = "tx";
                        status = "disabled";
                };

                pwm@01c21400 {
                        compatible = "allwinner,sun8i-h3-pwm";
                        reg = <0x1c21400 0x8>;
                        clocks = <0x9>;
                        #pwm-cells = <0x3>;
                        status = "disabled";
                };

                codec@01c22c00 {
                        #sound-dai-cells = <0x0>;
                        compatible = "allwinner,sun8i-h3-codec";
                        reg = <0x1c22c00 0x400>;
                        interrupts = <0x0 0x1d 0x4>;
                        clocks = <0x2 0x34 0x2 0x6d>;
                        clock-names = "apb", "codec";
                        resets = <0x2 0x28>;
                        dmas = <0xb 0xf 0xb 0xf>;
                        dma-names = "rx", "tx";
                        allwinner,codec-analog-controls = <0xe>;
                        status = "disabled";
                };

                serial@01c28000 {
                        compatible = "snps,dw-apb-uart";
                        reg = <0x1c28000 0x400>;
                        interrupts = <0x0 0x0 0x4>;
                        reg-shift = <0x2>;
                        reg-io-width = <0x4>;
                        clocks = <0x2 0x3e>;
                        resets = <0x2 0x31>;
                        dmas = <0xb 0x6 0xb 0x6>;
                        dma-names = "rx", "tx";
                        status = "okay";
                        pinctrl-names = "default";
                        pinctrl-0 = <0xf>;
                };

                serial@01c28400 {
                        compatible = "snps,dw-apb-uart";
                        reg = <0x1c28400 0x400>;
                        interrupts = <0x0 0x1 0x4>;
                        reg-shift = <0x2>;
                        reg-io-width = <0x4>;
                        clocks = <0x2 0x3f>;
                        resets = <0x2 0x32>;
                        dmas = <0xb 0x7 0xb 0x7>;
                        dma-names = "rx", "tx";
                        status = "disabled";
                        pinctrl-names = "default";
                        pinctrl-0 = <0x10>;
                };

                serial@01c28800 {
                        compatible = "snps,dw-apb-uart";
                        reg = <0x1c28800 0x400>;
                        interrupts = <0x0 0x2 0x4>;
                        reg-shift = <0x2>;
                        reg-io-width = <0x4>;
                        clocks = <0x2 0x40>;
                        resets = <0x2 0x33>;
                        dmas = <0xb 0x8 0xb 0x8>;
                        dma-names = "rx", "tx";
                        status = "disabled";
                        pinctrl-names = "default";
                        pinctrl-0 = <0x11>;
                };

                serial@01c28c00 {
                        compatible = "snps,dw-apb-uart";
                        reg = <0x1c28c00 0x400>;
                        interrupts = <0x0 0x3 0x4>;
                        reg-shift = <0x2>;
                        reg-io-width = <0x4>;
                        clocks = <0x2 0x41>;
                        resets = <0x2 0x34>;
                        dmas = <0xb 0x9 0xb 0x9>;
                        dma-names = "rx", "tx";
                        status = "disabled";
                        pinctrl-names = "default";
                        pinctrl-0 = <0x12>;
                };

                i2c@01c2ac00 {
                        compatible = "allwinner,sun8i-h3-i2c";
                        reg = <0x1c2ac00 0x400>;
                        interrupts = <0x0 0x6 0x4>;
                        clocks = <0x2 0x3b>;
                        resets = <0x2 0x2e>;
                        pinctrl-names = "default";
                        pinctrl-0 = <0x13>;
                        status = "okay";
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                };

                i2c@01c2b000 {
                        compatible = "allwinner,sun8i-h3-i2c";
                        reg = <0x1c2b000 0x400>;
                        interrupts = <0x0 0x7 0x4>;
                        clocks = <0x2 0x3c>;
                        resets = <0x2 0x2f>;
                        pinctrl-names = "default";
                        pinctrl-0 = <0x14>;
                        status = "okay";
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                };

                i2c@01c2b400 {
                        compatible = "allwinner,sun8i-h3-i2c";
                        reg = <0x1c2b000 0x400>;
                        interrupts = <0x0 0x8 0x4>;
                        clocks = <0x2 0x3d>;
                        resets = <0x2 0x30>;
                        pinctrl-names = "default";
                        pinctrl-0 = <0x15>;
                        status = "okay";
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                };

                interrupt-controller@01c81000 {
                        compatible = "arm,gic-400";
                        reg = <0x1c81000 0x1000 0x1c82000 0x2000 0x1c84000 
0x2000 0x1c86000 0x2000>;
                        interrupt-controller;
                        #interrupt-cells = <0x3>;
                        interrupts = <0x1 0x9 0xf04>;
                        linux,phandle = <0x1>;
                        phandle = <0x1>;
                };

                rtc@01f00000 {
                        compatible = "allwinner,sun6i-a31-rtc";
                        reg = <0x1f00000 0x54>;
                        interrupts = <0x0 0x28 0x4 0x0 0x29 0x4>;
                };

                clock@1f01400 {
                        compatible = "allwinner,sun8i-h3-r-ccu";
                        reg = <0x1f01400 0x100>;
                        clocks = <0x9 0xa 0x16 0x2 0x9>;
                        clock-names = "hosc", "losc", "iosc", "pll-periph";
                        #clock-cells = <0x1>;
                        #reset-cells = <0x1>;
                        linux,phandle = <0x17>;
                        phandle = <0x17>;
                };

                codec-analog@01f015c0 {
                        compatible = "allwinner,sun8i-h3-codec-analog";
                        reg = <0x1f015c0 0x4>;
                        linux,phandle = <0xe>;
                        phandle = <0xe>;
                };

                ir@01f02000 {
                        compatible = "allwinner,sun5i-a13-ir";
                        clocks = <0x17 0x4 0x17 0xb>;
                        clock-names = "apb", "ir";
                        resets = <0x17 0x0>;
                        interrupts = <0x0 0x25 0x4>;
                        reg = <0x1f02000 0x40>;
                        status = "disabled";
                };

                pinctrl@01f02c00 {
                        compatible = "allwinner,sun8i-h3-r-pinctrl";
                        reg = <0x1f02c00 0x400>;
                        interrupts = <0x0 0x2d 0x4>;
                        clocks = <0x17 0x3 0x9 0xa>;
                        clock-names = "apb", "hosc", "losc";
                        gpio-controller;
                        #gpio-cells = <0x3>;
                        interrupt-controller;
                        #interrupt-cells = <0x3>;
                        linux,phandle = <0x18>;
                        phandle = <0x18>;

                        ir@0 {
                                pins = "PL11";
                                function = "s_cir_rx";
                        };

                        led_pins@0 {
                                pins = "PL10";
                                function = "gpio_out";
                                linux,phandle = <0x1a>;
                                phandle = <0x1a>;
                        };

                        key_pins@0 {
                                pins = "PL3";
                                function = "gpio_in";
                                linux,phandle = <0x1b>;
                                phandle = <0x1b>;
                        };
                };
        };

        cpus {
                #address-cells = <0x1>;
                #size-cells = <0x0>;

                cpu@0 {
                        compatible = "arm,cortex-a7";
                        device_type = "cpu";
                        reg = <0x0>;
                };

                cpu@1 {
                        compatible = "arm,cortex-a7";
                        device_type = "cpu";
                        reg = <0x1>;
                };

                cpu@2 {
                        compatible = "arm,cortex-a7";
                        device_type = "cpu";
                        reg = <0x2>;
                };

                cpu@3 {
                        compatible = "arm,cortex-a7";
                        device_type = "cpu";
                        reg = <0x3>;
                };
        };

        timer {
                compatible = "arm,armv7-timer";
                interrupts = <0x1 0xd 0xf08 0x1 0xe 0xf08 0x1 0xb 0xf08 0x1 0xa 
0xf08>;
        };

        ahci-5v {
                compatible = "regulator-fixed";
                regulator-name = "ahci-5v";
                regulator-min-microvolt = <0x4c4b40>;
                regulator-max-microvolt = <0x4c4b40>;
                regulator-boot-on;
                enable-active-high;
                gpio = <0x6 0x1 0x8 0x0>;
                status = "disabled";
        };

        usb0-vbus {
                compatible = "regulator-fixed";
                regulator-name = "usb0-vbus";
                regulator-min-microvolt = <0x4c4b40>;
                regulator-max-microvolt = <0x4c4b40>;
                enable-active-high;
                gpio = <0x18 0x0 0x2 0x0>;
                status = "okay";
                linux,phandle = <0x8>;
                phandle = <0x8>;
        };

        usb1-vbus {
                compatible = "regulator-fixed";
                regulator-name = "usb1-vbus";
                regulator-min-microvolt = <0x4c4b40>;
                regulator-max-microvolt = <0x4c4b40>;
                regulator-boot-on;
                enable-active-high;
                gpio = <0x6 0x7 0x6 0x0>;
                status = "disabled";
        };

        usb2-vbus {
                compatible = "regulator-fixed";
                regulator-name = "usb2-vbus";
                regulator-min-microvolt = <0x4c4b40>;
                regulator-max-microvolt = <0x4c4b40>;
                regulator-boot-on;
                enable-active-high;
                gpio = <0x6 0x7 0x3 0x0>;
                status = "disabled";
        };

        vcc3v0 {
                compatible = "regulator-fixed";
                regulator-name = "vcc3v0";
                regulator-min-microvolt = <0x2dc6c0>;
                regulator-max-microvolt = <0x2dc6c0>;
        };

        vcc3v3 {
                compatible = "regulator-fixed";
                regulator-name = "vcc3v3";
                regulator-min-microvolt = <0x325aa0>;
                regulator-max-microvolt = <0x325aa0>;
                linux,phandle = <0x5>;
                phandle = <0x5>;
        };

        vcc5v0 {
                compatible = "regulator-fixed";
                regulator-name = "vcc5v0";
                regulator-min-microvolt = <0x4c4b40>;
                regulator-max-microvolt = <0x4c4b40>;
        };

        aliases {
                serial0 = "/soc/serial@01c28000";
        };

        chosen {
                stdout-path = "serial0:115200n8";
        };

        leds {
                compatible = "gpio-leds";
                pinctrl-names = "default";
                pinctrl-0 = <0x19 0x1a>;

                pwr_led {
                        label = "orangepi:green:pwr";
                        gpios = <0x18 0x0 0xa 0x0>;
                        default-state = "on";
                };

                status_led {
                        label = "orangepi:red:status";
                        gpios = <0x6 0x0 0xf 0x0>;
                };
        };

        r_gpio_keys {
                compatible = "gpio-keys";
                pinctrl-names = "default";
                pinctrl-0 = <0x1b>;

                sw4 {
                        label = "sw4";
                        linux,code = <0x100>;
                        gpios = <0x18 0x0 0x3 0x1>;
                };
        };
};

Reply via email to