Device Tree Information

制作 BananaPi M1+ 能用的 DTB 文件

 * 从 https://github.com/igorpecovnik/lib 下载 0010-bananapi_m1_plus_dts.patch 文件


 * 从 https://github.com/torvalds/linux 下载 Linux Mainline 的代码

[luoyi@x1c ~/BananaPi/linux/linux-master]$ wget 'https://raw.githubusercontent.com/igorpecovnik/lib/master/patch/kernel/sunxi-next/0010-bananapi_m1_plus_dts.patch' [luoyi@x1c ~/BananaPi/linux/linux-master]$ patch -t -p1 <0010-bananapi_m1_plus_dts.patch patching file arch/arm/boot/dts/Makefile Hunk #1 succeeded at 698 with fuzz 1 (offset 106 lines). patching file arch/arm/boot/dts/sun7i-a20-bananapi-m1-plus.dts


 * 编辑 dtb 脚本


 * 1) !/bin/bash

IDE=$1 SRC=$IDE.dts TMP=$IDE.tmp.dts DST=$IDE.dtb

cpp -nostdinc -I include -undef -x assembler-with-cpp $SRC > $TMP dtc -O dtb -b 0 -o $DST $TMP rm $TMP


 * Compile dts file

[luoyi@x1c ~/BananaPi/linux/linux-master/arch/arm/boot/dts]$ bash -x ~/dtb sun7i-a20-bananapi-m1-plus + IDE=sun7i-a20-bananapi-m1-plus + SRC=sun7i-a20-bananapi-m1-plus.dts + TMP=sun7i-a20-bananapi-m1-plus.tmp.dts + DST=sun7i-a20-bananapi-m1-plus.dtb + cpp -nostdinc -I include -undef -x assembler-with-cpp sun7i-a20-bananapi-m1-plus.dts + dtc -O dtb -b 0 -o sun7i-a20-bananapi-m1-plus.dtb sun7i-a20-bananapi-m1-plus.tmp.dts + rm sun7i-a20-bananapi-m1-plus.tmp.dts


 * 比较自己做的 dtb 和 armbian 的 dtb

[luoyi@x1c ~/BananaPi/linux/linux-master/arch/arm/boot/dts]$ md5sum sun7i-a20-bananapi-m1-plus.dtb 3abfe2bb08c0b4280d7f8f2d29ffe804 sun7i-a20-bananapi-m1-plus.dtb root@x1c:/# md5sum /boot/dtb/sun7i-a20-bananapi-m1-plus.dtb 3abfe2bb08c0b4280d7f8f2d29ffe804 /boot/dtb/sun7i-a20-bananapi-m1-plus.dtb

修改 Bananapi M1+ 的 DTS 文件，让 wifi 正常工作
brcmf: bcrmf@1 { reg = <1>; compatible = "brcm,bcm4329-fmac"; interrupt-parent = <&pio>; interrupts = <7 10 IRQ_TYPE_LEVEL_LOW>; /* PH10 / EINT10 */ interrupt-names = "host-wake"; };
 * 从 https://github.com/torvalds/linux/blob/master/arch/arm/boot/dts/sun7i-a20-cubietruck.dts 拿到 brcm4329 网卡的 dts 描述文件:

其中 interrupts 这一行表示的是 Out Of Band Interruputs, 也就是 oob 中断. 在 schematic 文件中，可以直接查到对应的引角：



Bpi M1+ 中，oob 引角从 PH10 改到了 PH15 ，如下图所示：



所以， Bpi M1+ 的 dts 文件中对应部分应该是：

interrupts = <7 15 IRQ_TYPE_LEVEL_LOW>; /* PH15 / EINT15 */