Artur Posted January 6, 2018 Posted January 6, 2018 hi, i've been trying to get the SC16IS752/I2C UARTs working on opi-zero using DT Overlays. Here is my .dts: /dts-v1/; /plugin/; / { compatible = "allwinner,sun8i-h2", "allwinner,sun8i-h3"; fragment@0 { target = <&i2c0>; __overlay__ { #address-cells = <1>; #size-cells = <0>; status = "okay"; sc16is752: sc16is752@4D { compatible = "nxp,sc16is752"; reg = <0x4D>; clocks = <&sc16is752_clk>; interrupt-parent = <&pio>; interrupts = <0 10 2>; gpio-controller; #gpio-cells = <2>; sc16is752_clk: sc16is752_clk { compatible = "fixed-clock"; #clock-cells = <0>; clock-frequency = <14745600>; }; }; }; }; }; it compiles with no errors. root@orangepizero:/boot/overlay-user# fdtdump ./sc16is752-i2c.dtbo /dts-v1/; // magic: 0xd00dfeed // totalsize: 0x435 (1077) // off_dt_struct: 0x38 // off_dt_strings: 0x36c // off_mem_rsvmap: 0x28 // version: 17 // last_comp_version: 16 // boot_cpuid_phys: 0x0 // size_dt_strings: 0xc9 // size_dt_struct: 0x334 / { compatible = "allwinner,sun8i-h2", "allwinner,sun8i-h3"; fragment@0 { target = <0xdeadbeef>; __overlay__ { #address-cells = <0x00000001>; #size-cells = <0x00000000>; status = "okay"; sc16is752@4D { compatible = "nxp,sc16is752"; reg = <0x0000004d>; clocks = <0x00000001>; interrupt-parent = <0xdeadbeef>; interrupts = <0x00000000 0x0000000a 0x00000002>; gpio-controller; #gpio-cells = <0x00000002>; linux,phandle = <0x00000002>; phandle = <0x00000002>; sc16is752_clk { compatible = "fixed-clock"; #clock-cells = <0x00000000>; clock-frequency = <0x00e10000>; linux,phandle = <0x00000001>; phandle = <0x00000001>; }; }; }; }; __symbols__ { sc16is752 = "/fragment@0/__overlay__/sc16is752@4D"; sc16is752_clk = "/fragment@0/__overlay__/sc16is752@4D/sc16is752_clk"; }; __fixups__ { i2c0 = "/fragment@0:target:0"; pio = "/fragment@0/__overlay__/sc16is752@4D:interrupt-parent:0"; }; __local_fixups__ { fixup = "/fragment@0/__overlay__/sc16is752@4D:clocks:0"; }; }; more info on the system: root@orangepizero:~# uname -a Linux orangepizero 4.14.12-sunxi #6 SMP Sat Jan 6 11:23:44 CET 2018 armv7l GNU/Linux root@orangepizero:/boot# cat config-4.14.12-sunxi | grep "SC16IS" CONFIG_SERIAL_SC16IS7XX_CORE=m CONFIG_SERIAL_SC16IS7XX=m CONFIG_SERIAL_SC16IS7XX_I2C=y # CONFIG_SERIAL_SC16IS7XX_SPI is not set root@orangepizero:/boot# lsmod Module Size Used by sc16is7xx 20480 0 xradio_wlan 94208 1 mac80211 446464 1 xradio_wlan cfg80211 376832 2 mac80211,xradio_wlan sun8i_codec_analog 24576 0 rfkill 20480 3 cfg80211 snd_soc_core 118784 1 sun8i_codec_analog snd_pcm_dmaengine 16384 1 snd_soc_core snd_pcm 65536 2 snd_pcm_dmaengine,snd_soc_core snd_timer 24576 1 snd_pcm snd 45056 3 snd_timer,snd_soc_core,snd_pcm soundcore 16384 1 snd sun4i_gpadc_iio 16384 0 uio_pdrv_genirq 16384 0 uio 16384 1 uio_pdrv_genirq usb_f_acm 16384 1 u_serial 20480 3 usb_f_acm g_serial 16384 0 libcomposite 40960 2 g_serial,usb_f_acm ip_tables 20480 0 x_tables 20480 1 ip_tables pwrseq_simple 16384 1 the problem is that the overlay is not loaded on boot-up: Applying user provided DT overlay sc16is752-i2c.dtbo failed on fdt_overlay_apply(): FDT_ERR_BADOVERLAY Error applying DT overlays, restoring original DT of course the chip is connected and visible on the I2C0 bus under 0x4D address. what is wrong with the overlay? regards A.
martinayotte Posted January 6, 2018 Posted January 6, 2018 4 hours ago, Artur said: target = <0xdeadbeef>; Where this comes from ? It's probably that i2c overlays isn't loaded before your overlay ?
Artur Posted January 6, 2018 Author Posted January 6, 2018 as far as I understood from https://www.raspberrypi.org/documentation/configuration/device-tree.md - this comes from unresolved at the compilation time symbol, which is later taken from the target
martinayotte Posted January 6, 2018 Posted January 6, 2018 Did you tried to add the stuff in the main dtb (of course, after doing a backup) ?
Recommended Posts