Add latest U-boot support for BPI R2 & BPI R64 (not yet)

You digging too deep to tell me your current position by few words :slight_smile:

resets are not found by ryders code…because they are deleted…i added them this way:

281         resets = <&hifsys HIFSYS_PCIE0_RST>,
282              <&hifsys HIFSYS_PCIE1_RST>,
283              <&hifsys HIFSYS_PCIE2_RST>;

but now nothing is printed on pci-enum (not the debug-messages i see before)

https://github.com/frank-w/u-boot/commits/sata_test_ryder

accidentaly removed my debug-messages by “git reset”

now i see much more, but resets still 0

DEBUG: Passed mtk_pcie_probe 247                                                                                                     
DEBUG: Passed mtk_pcie_probe 252                                                                                                     
DEBUG: Passed mtk_pcie_probe 258                                                                                                     
DEBUG: Passed mtk_pcie_probe 264                                                                                                     
DEBUG: Passed mtk_pcie_probe 269                                                                                                     
DEBUG: Passed mtk_pcie_probe 273                                                                                                     
DEBUG: Passed mtk_pcie_probe 278                                                                                                     
DEBUG: Passed mtk_pcie_parse_port 207                                                                                                
DEBUG: Passed mtk_pcie_parse_port 211                                                                                                
DEBUG: Passed mtk_pcie_parse_port 216                                                                                                
DEBUG: Passed mtk_pcie_parse_port 221 0,0,0                                                                                          
DEBUG: Passed mtk_pcie_parse_port 225                                                                                                
DEBUG: Passed mtk_pcie_parse_port 229                                                                                                
DEBUG: Passed mtk_pcie_parse_port 232                                                                                                
DEBUG: Passed mtk_pcie_parse_port 235                                                                                                
DEBUG: Passed mtk_pcie_probe 269                                                                                                     
DEBUG: Passed mtk_pcie_probe 273                                                                                                     
DEBUG: Passed mtk_pcie_probe 278                                                                                                     
DEBUG: Passed mtk_pcie_parse_port 207                                                                                                
DEBUG: Passed mtk_pcie_parse_port 211                                                                                                
DEBUG: Passed mtk_pcie_parse_port 216                                                                                                
DEBUG: Passed mtk_pcie_parse_port 221 0,0,0                                                                                          
DEBUG: Passed mtk_pcie_parse_port 225                                                                                                
DEBUG: Passed mtk_pcie_parse_port 229                                                                                                
DEBUG: Passed mtk_pcie_parse_port 232                                                                                                
DEBUG: Passed mtk_pcie_parse_port 235                                                                                                
DEBUG: Passed mtk_pcie_probe 269                                                                                                     
DEBUG: Passed mtk_pcie_probe 273                                                                                                     
DEBUG: Passed mtk_pcie_probe 278                                                                                                     
DEBUG: Passed mtk_pcie_parse_port 207                                                                                                
DEBUG: Passed mtk_pcie_parse_port 211                                                                                                
DEBUG: Passed mtk_pcie_parse_port 216                                                                                                
DEBUG: Passed mtk_pcie_parse_port 221 0,0,0                                                                                          
DEBUG: Passed mtk_pcie_parse_port 225                                                                                                
DEBUG: Passed mtk_pcie_parse_port 229                                                                                                
DEBUG: Passed mtk_pcie_parse_port 232                                                                                                
DEBUG: Passed mtk_pcie_parse_port 235                                                                                                
DEBUG: Passed mtk_pcie_probe 285                                                                                                     
DEBUG: Passed mtk_pcie_enable_port 172                                                                                               
DEBUG: Passed mtk_pcie_enable_port 184                                                                                               
DEBUG: Passed mtk_pcie_enable_port 192                                                                                               
DEBUG: Passed mtk_pcie_enable_port 172                                                                                               
DEBUG: Passed mtk_pcie_enable_port 184                                                                                               
DEBUG: Passed mtk_pcie_enable_port 192                                                                                               
DEBUG: Passed mtk_pcie_enable_port 172                                                                                               
DEBUG: Passed mtk_pcie_enable_port 184                                                                                               
DEBUG: Passed mtk_pcie_enable_port 192

ok let’s look at pinmux in dts…

should be this: https://github.com/frank-w/BPI-R2-4.14/blob/6a8cd4974ab40922aa8320f7eee1c8cc26b084de/arch/arm/boot/dts/mt7623.dtsi#L1469

seems dt-bindings for pinctrl are not there…

dt-bindings/pinctrl/mt7623-pinfunc.h

$ ls -1 ./arch/arm/dts/include/dt-bindings/pinctrl/
am33xx.h
am43xx.h
at91.h
bcm2835.h
dra.h
hisi.h
k3.h
omap.h
pads-imx8qm.h
pads-imx8qxp.h
pinctrl-snapdragon.h
pinctrl-tegra.h
pinctrl-tegra-xusb.h
pins-imx8mq.h
r7s72100-pinctrl.h
rockchip.h
stm32-pinfunc.h
sun4i-a10.h

because you lack of pinmux setting in dts and phy driver

and if i read the PCI core correctly - pci_uclass_pre_probe() in pci-uclass.c will parse range automatically.

--- a/arch/arm/dts/mt7623n-bananapi-bpi-r2.dts
+++ b/arch/arm/dts/mt7623n-bananapi-bpi-r2.dts
@@ -172,6 +172,13 @@
                };
        };

+       pcie_default: pcie-default {
+               mux {
+                       function = "pcie";
+                       groups =  "pcie0_0_perst", "pcie1_0_perst";
+               };
+       };
+
        uart0_pins_a: uart0-default {
                mux {
                        function = "uart";
@@ -201,6 +208,28 @@
        };
 };

+&pcie {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pcie_default>;
+       status = "okay";
+
+       pcie@0,0 {
+               status = "okay";
+       };
+
+       pcie@1,0 {
+               status = "okay";
+       };
+};
+
+&pcie0_phy {
+       status = "okay";
+};
+
+&pcie1_phy {
+       status = "okay";
+};

Just note that the form of uboot pinmux is different than linux mt7623 dts since we wrote a new pinctrl core after 4.19, and this new format is adopted by uboot 7623 at that time.

2 Likes

it’s time to copy complete DTS with all dependencies :slight_smile:

that brings nothing… i tried to copy relavant parts an hung on dt-bindings…

that was the point i hung :wink: maybe we should make a separate thread for pcie/ahci?

that was the point i hung :wink: maybe we should make a separate thread for pcie/ahci?

use the version i posted and add a phy driver

i have started new thread to outsource discussion about this

http://forum.banana-pi.org/t/bpi-r2-uboot-pcie-sata-ahaci/9613

Hi,there was released an mtk xhci driver for uboot and i need help to port dts-nodes for r2 and r64

https://patchwork.ozlabs.org/patch/1252654/

Linux:

My start on r2/mt7623:

https://github.com/frank-w/u-boot/commit/09a9b9dabf067ce71b46171bf0982cc4982ca47c

Compiles,but crashes on “usb start”

There are 2 main differences between linux and uboot driver:

  • uboot seems to use relative addresses for ports where linux uses absolute addresses
  • uboot uses ranges in phy where linux defines reg

Anyone can help?

1 Like

you can ask chunfeng.yun@mediatek.com for help.

Already done…r2 has xhci v0.96 which is not yet supported by driver,but dts works. On r64 my dts is still broken…don’t get the xhci version info

Please feel free to ask him for any xhci problems.

Chunfeng yun is currently busy because of debugging clock-issue for mt7629.

Any idea about emmc-issue on r64? I’ve wrote to weijie gao and chaotian jing,but no response yet

they’re all busy. Maybe loop this guys along with wenbin.mei and cc me

try this patch https://pastebin.com/QfrszyV2 then provide full uart log to me (email)

2 Likes

looks like your change to the mt7622_compat-struct fixes the problem, i do not get any error on mount. i only see some errors in log while booting mt7622_mmctest.log (29,8 KB)

[    1.367124] mtk-msdc 11230000.mmc: msdc_cmd_done: cmd=52 arg=00000C00; rsp 00000000; cmd_error=-110
[    1.376165] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=52 arg=00000C00; host->error=0x00000002

same for 11240000

#define ETIMEDOUT       110     /* Connection timed out */

so i guess the timeout happens here:

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/mmc/host/mtk-sd.c?h=v5.4.42#n1096

Just to link original error-message: Bpi-r64 quick start (boot from eMMC)

The previous patch was workaround and this error is normal. We need to figure out the root cause, so can you apply this kernel patch to print more details https://pastebin.com/va8s8hr0

I need two full uart logs and email to me - (old uboot + kernel) and (upstream uboot + kernel)

looks like the new patch causes bootloop…booting now for 200s…maybe i need to include initrd? i guess reads from sdcard are also recorded…

boot with initrd (buildroot) takes 8 seconds :slight_smile: i need to revert the prior patch, is this right? or should leave the compat-struct values?

mt7622_mmctest.log (186,1 KB)

only apply this patch.

legacy uboot (uboot 2014 (not upstream version you’re using)) + kernel

upstream uboot + kernel

same kernel with 2014-04 uboot (my environment)

without mmc init 0: mt7622_mmctest_2014.log (166,2 KB)

with mmc init 0: mt7622_mmctest_2014_2.log (176,6 KB)

looks like with old uboot directly flashed there is no mount-issue now

forgot the mounting with uboot 2020-xx

mt7622_mmctest_2020.tar.gz (32,4 KB)

it looks like for the emmc-mount issue there is a working Patch: https://github.com/frank-w/BPI-R2-4.14/commit/1ab1bcdb71b2ba02dce30c826827cc015f4bb4f5 after rebasing (to split debug+dts) it becomes this: https://github.com/frank-w/BPI-R2-4.14/commit/f644b6766b28c72fb6ccef5832201032808dc2ca

basicly the patches are applied to this branch:

https://github.com/frank-w/BPI-R2-4.14/commits/5.4-mmctest

in my quick test i do not get a error on mounting, can anybody else test this too?

got a new patch which seems fine too and should be the final solution which will be posted to patchwork, added it to my 5.4-main branch to include it into kernel-images built by travis-ci in my repo