arm64: dts: Use separate dtb for Khadas vim3 usb3 and pcie controller
Subsystems (2)
RFC PATCH 1/1 arm64: dts: Use separate dtb for Khadas vim3 usb3 and pcie controller
Although the plan is to make the bootloader (U-boot) to load overlay for the device, but currently the board doesn't have the upstream support yet.
This means even upstream kernel supports all the needed drivers, we still can't initialize the pcie controller.
As a workaround, make seperate device trees for pcie controller and usb3 controller.
Now user still need to go into the factory bootloader to switch the mux, but they can easily boot the kernel with PCIE support by just swithcing to the pcie device tree.
And since we didn't modify the original dtb, the future upstream uboot can still use overlay to switch mode using the same dtb file. The added new pcie dtb will just be a workaround.
Tested on my VIM3 pro board, now I can boot the root fs on the NVME drive, with upstream kernel with the new pcie dtb.
--- arch/arm64/boot/dts/amlogic/Makefile | 1 + .../meson-g12b-a311d-khadas-vim3-pcie.dts | 39 +++++++++++++++++++ .../amlogic/meson-g12b-a311d-khadas-vim3.dts | 23 +---------- 3 files changed, 41 insertions(+), 22 deletions(-) create mode 100644 arch/arm64/boot/dts/amlogic/meson-g12b-a311d-khadas-vim3-pcie.dts
arch/arm64/boot/dts/amlogic/Makefile +1 -0
@@ -6,6 +6,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-g12a-x96-max.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gtking.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gtking-pro.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-a311d-khadas-vim3.dtb +dtb-$(CONFIG_ARCH_MESON) += meson-g12b-a311d-khadas-vim3-pcie.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-s922x-khadas-vim3.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2-plus.dtb
arch/arm64/boot/dts/amlogic/meson-g12b-a311d-khadas-vim3-pcie.dts new file +39 -0
@@ -0,0 +1,39 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 BayLibre, SAS + * Author: Neil Armstrong <[email protected]> + * Copyright (c) 2019 Christian Hewitt <[email protected]> + */ + +/dts-v1/; + +#include "meson-g12b-a311d.dtsi" +#include "meson-khadas-vim3.dtsi" +#include "meson-g12b-khadas-vim3.dtsi" + +/ { + compatible = "khadas,vim3", "amlogic,a311d", "amlogic,g12b"; +}; + +/* + * The VIM3 on-board MCU can mux the PCIe/USB3.0 shared differential + * lines using a FUSB340TMX USB 3.1 SuperSpeed Data Switch between + * an USB3.0 Type A connector and a M.2 Key M slot. + * The PHY driving these differential lines is shared between + * the USB3.0 controller and the PCIe Controller, thus only + * a single controller can use it. + * + * This is the PCIE device tree. + * + * Until upstream uboot can boot the board and modify the nodes before booting + * It's much easier to just choose this device tree file to use PCIE controller. + */ + +&pcie { + status = "okay"; +}; + +&usb { + phys = <&usb2_phy0>, <&usb2_phy1>; + phy-names = "usb2-phy0", "usb2-phy1"; +};
arch/arm64/boot/dts/amlogic/meson-g12b-a311d-khadas-vim3.dts +1 -22
@@ -16,26 +16,5 @@ / { }; /* - * The VIM3 on-board MCU can mux the PCIe/USB3.0 shared differential - * lines using a FUSB340TMX USB 3.1 SuperSpeed Data Switch between - * an USB3.0 Type A connector and a M.2 Key M slot. - * The PHY driving these differential lines is shared between - * the USB3.0 controller and the PCIe Controller, thus only - * a single controller can use it. - * If the MCU is configured to mux the PCIe/USB3.0 differential lines - * to the M.2 Key M slot, uncomment the following block to disable - * USB3.0 from the USB Complex and enable the PCIe controller. - * The End User is not expected to uncomment the following except for - * testing purposes, but instead rely on the firmware/bootloader to - * update these nodes accordingly if PCIe mode is selected by the MCU. - */ -/* -&pcie { - status = "okay"; -}; - -&usb { - phys = <&usb2_phy0>, <&usb2_phy1>; - phy-names = "usb2-phy0", "usb2-phy1"; -}; + * Vim3 default to USB3.0 instead of PCIE controller. */
Signature · 7 lines
2.29.2 _______________________________________________ linux-amlogic mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-amlogic
Hi,
Quoted 3 lines · Qu Wenruo
Although the plan is to make the bootloader (U-boot) to load overlay for the device, but currently the board doesn't have the upstream support yet.
No need for that, automatic PCIe enable is now support on upstream U-Boot for VIM3 & VIM3L:
https://github.com/u-boot/u-boot/commit/adbff64af7b7cee3e0007b75df2644090edaafcb
Neil
Quoted 106 lines
This means even upstream kernel supports all the needed drivers, we still can't initialize the pcie controller.
As a workaround, make seperate device trees for pcie controller and usb3 controller.
Now user still need to go into the factory bootloader to switch the mux, but they can easily boot the kernel with PCIE support by just swithcing to the pcie device tree.
And since we didn't modify the original dtb, the future upstream uboot can still use overlay to switch mode using the same dtb file. The added new pcie dtb will just be a workaround.
Tested on my VIM3 pro board, now I can boot the root fs on the NVME drive, with upstream kernel with the new pcie dtb.
Signed-off-by Qu Wenruo <[email protected]>--- arch/arm64/boot/dts/amlogic/Makefile | 1 + .../meson-g12b-a311d-khadas-vim3-pcie.dts | 39 +++++++++++++++++++ .../amlogic/meson-g12b-a311d-khadas-vim3.dts | 23 +---------- 3 files changed, 41 insertions(+), 22 deletions(-) create mode 100644 arch/arm64/boot/dts/amlogic/meson-g12b-a311d-khadas-vim3-pcie.dtsarch/arm64/boot/dts/amlogic/Makefile +1
-0@@ -6,6 +6,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-g12a-x96-max.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gtking.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gtking-pro.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-a311d-khadas-vim3.dtb +dtb-$(CONFIG_ARCH_MESON) += meson-g12b-a311d-khadas-vim3-pcie.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-s922x-khadas-vim3.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2-plus.dtbarch/arm64/boot/dts/amlogic/meson-g12b-a311d-khadas-vim3-pcie.dts new file +39
-0@@ -0,0 +1,39 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 BayLibre, SAS + * Author: Neil Armstrong <[email protected]> + * Copyright (c) 2019 Christian Hewitt <[email protected]> + */ + +/dts-v1/; + +#include "meson-g12b-a311d.dtsi" +#include "meson-khadas-vim3.dtsi" +#include "meson-g12b-khadas-vim3.dtsi" + +/ { + compatible = "khadas,vim3", "amlogic,a311d", "amlogic,g12b"; +}; + +/* + * The VIM3 on-board MCU can mux the PCIe/USB3.0 shared differential + * lines using a FUSB340TMX USB 3.1 SuperSpeed Data Switch between + * an USB3.0 Type A connector and a M.2 Key M slot. + * The PHY driving these differential lines is shared between + * the USB3.0 controller and the PCIe Controller, thus only + * a single controller can use it. + * + * This is the PCIE device tree. + * + * Until upstream uboot can boot the board and modify the nodes before booting + * It's much easier to just choose this device tree file to use PCIE controller. + */ + +&pcie { + status = "okay"; +}; + +&usb { + phys = <&usb2_phy0>, <&usb2_phy1>; + phy-names = "usb2-phy0", "usb2-phy1"; +};arch/arm64/boot/dts/amlogic/meson-g12b-a311d-khadas-vim3.dts +0
-14@@ -16,26 +16,5 @@ / { }; /* - * The VIM3 on-board MCU can mux the PCIe/USB3.0 shared differential - * lines using a FUSB340TMX USB 3.1 SuperSpeed Data Switch between - * an USB3.0 Type A connector and a M.2 Key M slot. - * The PHY driving these differential lines is shared between - * the USB3.0 controller and the PCIe Controller, thus only - * a single controller can use it. - * If the MCU is configured to mux the PCIe/USB3.0 differential lines - * to the M.2 Key M slot, uncomment the following block to disable - * USB3.0 from the USB Complex and enable the PCIe controller. - * The End User is not expected to uncomment the following except for - * testing purposes, but instead rely on the firmware/bootloader to - * update these nodes accordingly if PCIe mode is selected by the MCU. - */ -/*
arch/arm64/boot/dts/amlogic/meson-g12b-a311d-khadas-vim3.dts / { · line 20
Quoted 10 lines
arch/arm64/boot/dts/amlogic/meson-g12b-a311d-khadas-vim3.dts +1
-8-&pcie { - status = "okay"; -}; - -&usb { - phys = <&usb2_phy0>, <&usb2_phy1>; - phy-names = "usb2-phy0", "usb2-phy1"; -}; + * Vim3 default to USB3.0 instead of PCIE controller. */
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Quoted 10 lines · Neil Armstrong
Hi,
Quoted 3 lines · Qu Wenruo
Although the plan is to make the bootloader (U-boot) to load overlay for the device, but currently the board doesn't have the upstream support yet.
No need for that, automatic PCIe enable is now support on upstream U-Boot for VIM3 & VIM3L:
https://github.com/u-boot/u-boot/commit/adbff64af7b7cee3e0007b75df2644090edaafcb
Great.
BTW, the upstream U-boot is supposed to replace the factory Uboot compeletely, or just to be chainloaded from SDcard?
Thanks,
Qu
Quoted 111 lines
Neil
Quoted 108 lines
This means even upstream kernel supports all the needed drivers, we still can't initialize the pcie controller.
As a workaround, make seperate device trees for pcie controller and usb3 controller.
Now user still need to go into the factory bootloader to switch the mux, but they can easily boot the kernel with PCIE support by just swithcing to the pcie device tree.
And since we didn't modify the original dtb, the future upstream uboot can still use overlay to switch mode using the same dtb file. The added new pcie dtb will just be a workaround.
Tested on my VIM3 pro board, now I can boot the root fs on the NVME drive, with upstream kernel with the new pcie dtb.
Signed-off-by Qu Wenruo <[email protected]>--- arch/arm64/boot/dts/amlogic/Makefile | 1 + .../meson-g12b-a311d-khadas-vim3-pcie.dts | 39 +++++++++++++++++++ .../amlogic/meson-g12b-a311d-khadas-vim3.dts | 23 +---------- 3 files changed, 41 insertions(+), 22 deletions(-) create mode 100644 arch/arm64/boot/dts/amlogic/meson-g12b-a311d-khadas-vim3-pcie.dtsarch/arm64/boot/dts/amlogic/Makefile +1
-0@@ -6,6 +6,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-g12a-x96-max.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gtking.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gtking-pro.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-a311d-khadas-vim3.dtb +dtb-$(CONFIG_ARCH_MESON) += meson-g12b-a311d-khadas-vim3-pcie.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-s922x-khadas-vim3.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2-plus.dtbarch/arm64/boot/dts/amlogic/meson-g12b-a311d-khadas-vim3-pcie.dts new file +39
-0@@ -0,0 +1,39 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 BayLibre, SAS + * Author: Neil Armstrong <[email protected]> + * Copyright (c) 2019 Christian Hewitt <[email protected]> + */ + +/dts-v1/; + +#include "meson-g12b-a311d.dtsi" +#include "meson-khadas-vim3.dtsi" +#include "meson-g12b-khadas-vim3.dtsi" + +/ { + compatible = "khadas,vim3", "amlogic,a311d", "amlogic,g12b"; +}; + +/* + * The VIM3 on-board MCU can mux the PCIe/USB3.0 shared differential + * lines using a FUSB340TMX USB 3.1 SuperSpeed Data Switch between + * an USB3.0 Type A connector and a M.2 Key M slot. + * The PHY driving these differential lines is shared between + * the USB3.0 controller and the PCIe Controller, thus only + * a single controller can use it. + * + * This is the PCIE device tree. + * + * Until upstream uboot can boot the board and modify the nodes before booting + * It's much easier to just choose this device tree file to use PCIE controller. + */ + +&pcie { + status = "okay"; +}; + +&usb { + phys = <&usb2_phy0>, <&usb2_phy1>; + phy-names = "usb2-phy0", "usb2-phy1"; +};arch/arm64/boot/dts/amlogic/meson-g12b-a311d-khadas-vim3.dts +0
-17@@ -16,26 +16,5 @@ / { }; /* - * The VIM3 on-board MCU can mux the PCIe/USB3.0 shared differential - * lines using a FUSB340TMX USB 3.1 SuperSpeed Data Switch between - * an USB3.0 Type A connector and a M.2 Key M slot. - * The PHY driving these differential lines is shared between - * the USB3.0 controller and the PCIe Controller, thus only - * a single controller can use it. - * If the MCU is configured to mux the PCIe/USB3.0 differential lines - * to the M.2 Key M slot, uncomment the following block to disable - * USB3.0 from the USB Complex and enable the PCIe controller. - * The End User is not expected to uncomment the following except for - * testing purposes, but instead rely on the firmware/bootloader to - * update these nodes accordingly if PCIe mode is selected by the MCU. - */ -/* -&pcie { - status = "okay"; -};
Quoted 9 lines
arch/arm64/boot/dts/amlogic/meson-g12b-a311d-khadas-vim3.dts / { · line 20
Quoted 8 lines
arch/arm64/boot/dts/amlogic/meson-g12b-a311d-khadas-vim3.dts +1
-5- -&usb { - phys = <&usb2_phy0>, <&usb2_phy1>; - phy-names = "usb2-phy0", "usb2-phy1"; -}; + * Vim3 default to USB3.0 instead of PCIE controller. */
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Quoted 10 lines · Qu Wenruo
Quoted 7 lines · Neil Armstrong
Hi,
Quoted 3 lines · Qu Wenruo
Although the plan is to make the bootloader (U-boot) to load overlay for the device, but currently the board doesn't have the upstream support yet.
Quoted 8 lines
Quoted 3 lines
No need for that, automatic PCIe enable is now support on upstream U-Boot for VIM3 & VIM3L:
https://github.com/u-boot/u-boot/commit/adbff64af7b7cee3e0007b75df2644090edaafcbGreat.
BTW, the upstream U-boot is supposed to replace the factory Uboot compeletely, or just to be chainloaded from SDcard?
Both, but you should replace the factory u-boot.
You can easily boot to MaskROM by pressing the F button 3 times and boot from USB, so you can't brick the device and recover to the factory image whatever the state of the device.
Neil
Quoted 124 lines
Thanks,
QuQuoted 120 lines
Neil
Quoted 116 lines
This means even upstream kernel supports all the needed drivers, we still can't initialize the pcie controller.
As a workaround, make seperate device trees for pcie controller and usb3 controller.
Now user still need to go into the factory bootloader to switch the mux, but they can easily boot the kernel with PCIE support by just swithcing to the pcie device tree.
And since we didn't modify the original dtb, the future upstream uboot can still use overlay to switch mode using the same dtb file. The added new pcie dtb will just be a workaround.
Tested on my VIM3 pro board, now I can boot the root fs on the NVME drive, with upstream kernel with the new pcie dtb.
Signed-off-by Qu Wenruo <[email protected]>--- arch/arm64/boot/dts/amlogic/Makefile | 1 + .../meson-g12b-a311d-khadas-vim3-pcie.dts | 39 +++++++++++++++++++ .../amlogic/meson-g12b-a311d-khadas-vim3.dts | 23 +---------- 3 files changed, 41 insertions(+), 22 deletions(-) create mode 100644 arch/arm64/boot/dts/amlogic/meson-g12b-a311d-khadas-vim3-pcie.dtsarch/arm64/boot/dts/amlogic/Makefile +1
-0@@ -6,6 +6,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-g12a-x96-max.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gtking.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gtking-pro.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-a311d-khadas-vim3.dtb +dtb-$(CONFIG_ARCH_MESON) += meson-g12b-a311d-khadas-vim3-pcie.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-s922x-khadas-vim3.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2-plus.dtbarch/arm64/boot/dts/amlogic/meson-g12b-a311d-khadas-vim3-pcie.dts new file +39
-0@@ -0,0 +1,39 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 BayLibre, SAS + * Author: Neil Armstrong <[email protected]> + * Copyright (c) 2019 Christian Hewitt <[email protected]> + */ + +/dts-v1/; + +#include "meson-g12b-a311d.dtsi" +#include "meson-khadas-vim3.dtsi" +#include "meson-g12b-khadas-vim3.dtsi" + +/ { + compatible = "khadas,vim3", "amlogic,a311d", "amlogic,g12b"; +}; + +/* + * The VIM3 on-board MCU can mux the PCIe/USB3.0 shared differential + * lines using a FUSB340TMX USB 3.1 SuperSpeed Data Switch between + * an USB3.0 Type A connector and a M.2 Key M slot. + * The PHY driving these differential lines is shared between + * the USB3.0 controller and the PCIe Controller, thus only + * a single controller can use it. + * + * This is the PCIE device tree. + * + * Until upstream uboot can boot the board and modify the nodes before booting + * It's much easier to just choose this device tree file to use PCIE controller. + */ + +&pcie { + status = "okay"; +}; + +&usb { + phys = <&usb2_phy0>, <&usb2_phy1>; + phy-names = "usb2-phy0", "usb2-phy1"; +};arch/arm64/boot/dts/amlogic/meson-g12b-a311d-khadas-vim3.dts +1
-22@@ -16,26 +16,5 @@ / { }; /* - * The VIM3 on-board MCU can mux the PCIe/USB3.0 shared differential - * lines using a FUSB340TMX USB 3.1 SuperSpeed Data Switch between - * an USB3.0 Type A connector and a M.2 Key M slot. - * The PHY driving these differential lines is shared between - * the USB3.0 controller and the PCIe Controller, thus only - * a single controller can use it. - * If the MCU is configured to mux the PCIe/USB3.0 differential lines - * to the M.2 Key M slot, uncomment the following block to disable - * USB3.0 from the USB Complex and enable the PCIe controller. - * The End User is not expected to uncomment the following except for - * testing purposes, but instead rely on the firmware/bootloader to - * update these nodes accordingly if PCIe mode is selected by the MCU. - */ -/* -&pcie { - status = "okay"; -}; - -&usb { - phys = <&usb2_phy0>, <&usb2_phy1>; - phy-names = "usb2-phy0", "usb2-phy1"; -}; + * Vim3 default to USB3.0 instead of PCIE controller. */
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic