็็How to build OpenWrt 18 with SATA support for BPI-R2

Hi,

I have BPI-R2 board and my goal is running by current stable version of OpenWrt.

I had tried both images, OpenWrt (LEDE) of SINOVOIP and official image of OpenWrt but they are different ssues.

OpenWrt (LEDE) of SINOVOIP detect SATA Controller but many problems such as can’t install mostly packages.

Official OpenWrt not detect SATA controller.

So if anyone know how to build official openwrt with SATA support please tell me

Thanks.

In fact, there is not SATA issue, it is a PCI problem. Last LEDE 19.07.0 is not up pci bus at all. Not works mini-pcie port, sata controller and onboard wlan, but switch and usb works perfect.

All PCI patches already applyed, but kernel not see any pci-e controllers. Somebody know what to do with it?

which kernel,which patches? Have you added all options to config?

You can compare code,dts and config with my repo to find whats missing

Btw. Internal wifi is not easy to get into openwrt due size and backported Patches of openwrt

Try to use master branch with kernel 4.19 instead. It has some patches which not exist in 19.07 stable branch, thanks.

Im already use https://git.openwrt.org/openwrt/openwrt.git branch. It make latest version of lede.

What options are needed? What im do: kernel_menuconfig - bootargs ‘earlyprintk console=ttyS0,115200 block2mtd.block2mtd=/dev/mmcblk1,65536,RootFs,5 mtdparts=RootFs:512k(mbr)ro,512k(uboot)ro,512k(config)ro,512k(factory)ro,32M(kernel),32M(recovery),1024M(rootfs),2048M(usrdata),-(bmtpool) rootfstype=squashfs,jffs2’ and enable overriding uboot’s bootarg. menuconfig - add block2mtd and several ata, scsi, usb and iwlwifi packages.

Again…which kernel do you use…i see only defconfig for 4.14

https://git.openwrt.org/?p=openwrt/openwrt.git;a=tree;f=target/linux/mediatek/mt7623;h=c636338b865551c240b61e97461a3f634ac4d5e5;hb=HEAD

Here is tphy and pcie_mediatek set…but if you use 4.19 i guess it’s not

And you need to compare dts in your sourcetree with mine regarding pcie/sata

So look in your kernelconfig if these are set:

CONFIG_PHY_MTK_TPHY
CONFIG_PCIE_MEDIATEK

For sata additional these (not found in openwrt config)

CONFIG_ATA=y
CONFIG_SATA_AHCI=y
CONFIG_AHCI_MTK=m

Kernel 4.14.162 Tomorrow i will compare kernelconfig files.

I meant master branch with kernel 4.19 not 4.14 because related patches are in patches-4.19 folder, thanks.

Afair in 4.14 the pcie dts nodes were missing…but it looks they are added with patch.

https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/linux/mediatek/patches-4.14/0225-arm-dts-Add-missing-mt7623-pcie-nodes.patch;h=c5eb54ae445ae059d65a21052f7038e31366f2fb;hb=HEAD

But they are disabled…and i don’t see patch/dts enabling them…

Are you mean status = "disabled"; in the code? What if i comment out that lines or change it to ‘enabled’?

Right,but they have to “okay”. You can test in running system too

[07:58] [email protected]:~$ cat /sys/firmware/devicetree/base/pcie-*/status
okayokayokay[07:58] [email protected]:~$

But maybe you need pinctrl too…

Seems that sata has no additional dts definition…it uses one of the pcie with an pcie2sata converter

I have 3 dts files on different places. Witch one i must edit with ‘status=‘okay’’ openwrt/build_dir/host/u-boot-2019.07/arch/arm/dts openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mediatek_mt7623/linux-4.14.167/arch/arm/boot/dts openwrt/build_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-8.3.0_musl_eabi/linux-4.14.167/arch/arm/boot/dts

mt7623n-bananapi-bpi-r2.dts (3.9 КБ) mt7623n-bananapi-bpi-r2-1.dts (10.3 КБ) mt7623n-bananapi-bpi-r2-2.dts (9.7 КБ) In all there my files no pci sections!

Also i have 3 files in different places with name ‘mt7623.dtsi’ and in all that files disabled pci sections present. May be i must edit that files instead of mt.7623n-bananapi-bpi-r2.dts files?

the first one is for uboot…there i think you don’t need pcie atm.

i see no difference in last 2 dts…but i guess you need to add the pcie-section like in my dts


&pcie {
	pinctrl-names = "default";
	pinctrl-0 = <&pcie_default>;
	status = "okay";


	[email protected],0 {
		status = "okay";
	};


	[email protected],0 {
		status = "okay";
	};
};

and this in the &pio {} section:

	pcie_default: pcie_pin_default {
		pins_cmd_dat {
			pinmux = <MT7623_PIN_208_AUD_EXT_CK1_FUNC_PCIE0_PERST_N>,
				 <MT7623_PIN_209_AUD_EXT_CK2_FUNC_PCIE1_PERST_N>;
			bias-disable;
		};
	};

like it’s done here

U-Boot 2014.04-rc1 (Mar 05 2019 - 02:09:09)

g_nr_bank = 1.
g_total_rank_size = 0x80000000
DRAM:  2 GiB
WARNING: Caches not enabled
MMC:     emmc: 0,  sdcard: 1
booting from SD card
dev_num = 1
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
bootargs = board=bpi-r2 earlyprintk console=tty1 fbcon=map:0 console=ttyS0,115200 vmalloc=496M debug=7 initcall_debug=0 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait
Net:   Eth0
Uip activated
Hit any key to stop autoboot:  0 
dev_num = 1
mmc1 is current device
dev_num = 1

MMC read: dev # 1, block # 4096, count 24576 ... 24576 blocks read: OK
bootm flag=0, states=70f
## Booting kernel from Legacy Image at 84000000 ...
   Image Name:   ARM OpenWrt Linux-4.14.167
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    8565365 Bytes = 8.2 MiB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.14.167 ([email protected]) (gcc version 8.3.0 (OpenWrt GCC 8.3.0 r12138-1e3bfbafd3)) #0 SMP PREEMPT Sun Jan 26 22:00:26 2020
[    0.000000] CPU: ARMv7 Processor [410fc073] revision 3 (ARMv7), cr=10c5387d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: Bananapi BPI-R2
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] random: get_random_bytes called from start_kernel+0x8c/0x3f0 with crng_init=0
[    0.000000] percpu: Embedded 15 pages/cpu s29708 r8192 d23540 u61440
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 260416
[    0.000000] Kernel command line: earlyprintk console=ttyS0,115200 block2mtd.block2mtd=/dev/mmcblk1,65536,RootFs,5 mtdparts=RootFs:512k(mbr)ro,512k(uboot)ro,512k(config)ro,512k(factory)ro,32M(kernel),32M(reco2
[    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Memory: 1008052K/1048576K available (6144K kernel code, 177K rwdata, 1392K rodata, 21504K init, 234K bss, 40524K reserved, 0K cma-reserved, 262144K highmem)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xf0800000 - 0xff800000   ( 240 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xf0000000   ( 768 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0008000 - 0xc0700000   (7136 kB)
[    0.000000]       .init : 0xc0900000 - 0xc1e00000   (21504 kB)
[    0.000000]       .data : 0xc1e00000 - 0xc1e2c400   ( 177 kB)
[    0.000000]        .bss : 0xc1e31410 - 0xc1e6bc58   ( 235 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000]  Tasks RCU enabled.
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] arch_timer: cp15 timer(s) running at 13.00MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x2ff89eacb, max_idle_ns: 440795202429 ns
[    0.000005] sched_clock: 56 bits at 13MHz, resolution 76ns, wraps every 4398046511101ns
[    0.000017] Switching to timer-based delay loop, resolution 76ns
[    0.000147] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 147020034397 ns
[    0.000162] sched_clock: 32 bits at 13MHz, resolution 76ns, wraps every 165191050201ns
[    0.000376] Calibrating delay loop (skipped), value calculated using timer frequency.. 26.00 BogoMIPS (lpj=130000)
[    0.000391] pid_max: default: 32768 minimum: 301
[    0.000517] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000534] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.001114] CPU: Testing write buffer coherency: ok
[    0.040017] Setting up static identity map for 0x80100000 - 0x80100060
[    0.060010] Hierarchical SRCU implementation.
[    0.100069] smp: Bringing up secondary CPUs ...
[    0.310504] smp: Brought up 1 node, 4 CPUs
[    0.310518] SMP: Total of 4 processors activated (104.00 BogoMIPS).
[    0.310525] CPU: All CPU(s) started in SVC mode.
[    0.320507] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 3
[    0.320716] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.320736] futex hash table entries: 1024 (order: 4, 65536 bytes)
[    0.320909] pinctrl core: initialized pinctrl subsystem
[    0.321552] NET: Registered protocol family 16
[    0.321814] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.322488] No ATAGs?
[    0.383752] usbcore: registered new interface driver usbfs
[    0.383808] usbcore: registered new interface driver hub
[    0.383869] usbcore: registered new device driver usb
[    0.384986] clocksource: Switched to clocksource arch_sys_counter
[    0.386019] NET: Registered protocol family 2
[    0.386467] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[    0.386538] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[    0.386650] TCP: Hash tables configured (established 8192 bind 8192)
[    0.386751] UDP hash table entries: 512 (order: 2, 16384 bytes)
[    0.386799] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[    0.386985] NET: Registered protocol family 1
[    0.525398] No memory allocated for crashlog
[    0.525592] workingset: timestamp_bits=14 max_order=18 bucket_order=4
[    0.529572] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.529583] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.534192] bounce: pool size: 64 pages
[    0.534219] io scheduler noop registered
[    0.534228] io scheduler deadline registered (default)
[    0.539895] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.540731] console [ttyS0] disabled
[    0.561135] 11004000.serial: ttyS0 at MMIO 0x11004000 (irq = 194, base_baud = 1625000) is a ST16650V2
[    1.044646] console [ttyS0] enabled
[    1.048673] mtk_rng 1020f000.rng: registered RNG driver
[    1.048816] random: fast init done
[    1.057471] random: crng init done
[    1.060814] loop: module loaded
[    1.064619] mt6323-regulator mt6323-regulator: Chip ID = 0x2023
[    1.079954] libphy: Fixed MDIO Bus: probed
[    1.107390] mtk_soc_eth 1b100000.ethernet: chip id = 7623
[    1.112946] libphy: mdio: probed
[    1.116186] drivers/net/ethernet/mediatek/mtk_eth_soc.c:mtk_mdio_init[412]0 ee957000
[    1.123892] mtk_soc_eth 1b100000.ethernet: generated random MAC address 76:88:b0:a7:51:d0
[    1.141925] mtk_soc_eth 1b100000.ethernet: connected mac 0 to PHY at fixed-0:00 [uid=00000000, driver=Generic PHY]
[    1.152641] mtk_soc_eth 1b100000.ethernet eth0: mediatek frame engine at 0xf08e0000, irq 204
[    1.161062] mtk_soc_eth 1b100000.ethernet: generated random MAC address 22:30:f7:36:52:2c
[    1.179670] mtk_soc_eth 1b100000.ethernet: connected mac 1 to PHY at fixed-0:01 [uid=00000000, driver=Generic PHY]
[    1.190359] mtk_soc_eth 1b100000.ethernet eth1: mediatek frame engine at 0xf08e0000, irq 204
[    1.199800] xhci-mtk 1a1c0000.usb: xHCI Host Controller
[    1.205026] xhci-mtk 1a1c0000.usb: new USB bus registered, assigned bus number 1
[    1.215409] xhci-mtk 1a1c0000.usb: hcc params 0x01401198 hci version 0x96 quirks 0x0000000000210010
[    1.224447] xhci-mtk 1a1c0000.usb: irq 202, io mem 0x1a1c0000
[    1.230713] hub 1-0:1.0: USB hub found
[    1.234464] hub 1-0:1.0: 1 port detected
[    1.238705] xhci-mtk 1a1c0000.usb: xHCI Host Controller
[    1.243896] xhci-mtk 1a1c0000.usb: new USB bus registered, assigned bus number 2
[    1.251261] xhci-mtk 1a1c0000.usb: Host supports USB 3.0  SuperSpeed
[    1.257647] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[    1.266138] hub 2-0:1.0: USB hub found
[    1.269885] hub 2-0:1.0: 1 port detected
[    1.274520] xhci-mtk 1a240000.usb: xHCI Host Controller
[    1.279743] xhci-mtk 1a240000.usb: new USB bus registered, assigned bus number 3
[    1.290114] xhci-mtk 1a240000.usb: hcc params 0x01401198 hci version 0x96 quirks 0x0000000000210010
[    1.299161] xhci-mtk 1a240000.usb: irq 203, io mem 0x1a240000
[    1.305368] hub 3-0:1.0: USB hub found
[    1.309117] hub 3-0:1.0: 1 port detected
[    1.313305] xhci-mtk 1a240000.usb: xHCI Host Controller
[    1.318532] xhci-mtk 1a240000.usb: new USB bus registered, assigned bus number 4
[    1.325891] xhci-mtk 1a240000.usb: Host supports USB 3.0  SuperSpeed
[    1.332255] usb usb4: We don't know the algorithms for LPM for this host, disabling LPM.
[    1.340726] hub 4-0:1.0: USB hub found
[    1.344471] hub 4-0:1.0: 1 port detected
[    1.348799] i2c /dev entries driver
[    1.353644] mtk-thermal 1100b000.thermal: Device not calibrated, using default calibration values
[    1.363179] mtk-wdt 10007000.watchdog: Watchdog enabled (timeout=31 sec, nowayout=0)
[    1.371271] cpu cpu0: dummy supplies not allowed for exclusive requests
[    1.378791] sdhci: Secure Digital Host Controller Interface driver
[    1.384919] sdhci: Copyright(c) Pierre Ossman
[    1.445515] mtk-msdc 11240000.mmc: Got CD GPIO
[    1.500346] mmc0: new high speed MMC card at address 0001
[    1.506340] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.512124] mmcblk0: mmc0:0001 8GTF4R 0 B 
[    1.516508] mmcblk0boot0: mmc0:0001 8GTF4R partition 1 4.00 MiB
[    1.522696] mmcblk0boot1: mmc0:0001 8GTF4R partition 2 4.00 MiB
[    1.530700] NET: Registered protocol family 10
[    1.535893] mmcblk0gp0: mmc0:0001 8GTF4R partition 4 3.64 GiB
[    1.536051] Segment Routing with IPv6
[    1.543693] mmcblk0rpmb: mmc0:0001 8GTF4R partition 3 512 KiB, chardev (250:0)
[    1.545287] NET: Registered protocol family 17
[    1.553487]  mmcblk0gp0: p1
[    1.557126] 8021q: 802.1Q VLAN Support v1.8
[    1.563798] ThumbEE CPU extension supported.
[    1.568061] Registering SWP/SWPB emulation handler
[    1.582629] mmc1: host does not support reading read-only switch, assuming write-enable
[    1.592966] mmc1: new high speed SDHC card at address 0002
[    1.598852] mmcblk1: mmc1:0002 N/A   7.44 GiB 
[   22.644976] INFO: rcu_preempt detected stalls on CPUs/tasks:
[   22.650601]  1-...: (0 ticks this GP) idle=97e/140000000000000/0 softirq=75/75 fqs=1050 
[   22.658621]  (detected by 2, t=2102 jiffies, g=-276, c=-277, q=1)
[   22.664669] Sending NMI from CPU 2 to CPUs 1:
[   85.694974] INFO: rcu_preempt detected stalls on

hang on booting after add that lines

strange because i see no info that pcie is already probed…have you had any compiletime warnings/infos?

Nothing. Now i try rm-rf openwrt dir, gitclone again and start from beginning. What i must check in kernel_menuconfig?