Skip to content

Commit 8103f79

Browse files
committed
CAINIAO CNIoT-CORE: switch USB 2.0 access from the Type-C port to the four contacts on the side of the host
1 parent 6b2d0bd commit 8103f79

File tree

3 files changed

+56
-5
lines changed

3 files changed

+56
-5
lines changed

patch/kernel/archive/meson64-6.12/dt/meson-g12b-a311d-cainiao-cniot-core.dts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,23 @@
176176
vin-supply = <&dc_in>;
177177
};
178178

179+
/*
180+
* The Type-C port on the host is switched with the four USB contacts on the side of the host via GPIOA_14.
181+
* Since the Type-C port on the host is either used for power supply or blocked by the dock,
182+
* switching USB 2.0 access to the four contacts on the side of the host is a better choice.
183+
* To use the Type-C port for data transmission,
184+
* you only need to set GPIOA_14 in the node below to a high level.
185+
*/
186+
usb_switch: regulator-usb-switch {
187+
compatible = "regulator-fixed";
188+
enable-active-low;
189+
gpio = <&gpio GPIOA_14 GPIO_ACTIVE_LOW>;
190+
regulator-name = "usb_switch";
191+
regulator-always-on;
192+
regulator-boot-on;
193+
vin-supply = <&dc_in>;
194+
};
195+
179196
vdd_amp: regulator-vdd-amp {
180197
compatible = "regulator-fixed";
181198
enable-active-high;
@@ -558,7 +575,7 @@
558575
};
559576

560577
&usb2_phy1 {
561-
phy-supply = <&amp_power>;
578+
phy-supply = <&usb_switch>;
562579
};
563580

564581
&usb3_pcie_phy {

patch/kernel/archive/meson64-6.15/dt/meson-g12b-a311d-cainiao-cniot-core.dts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,23 @@
176176
vin-supply = <&dc_in>;
177177
};
178178

179+
/*
180+
* The Type-C port on the host is switched with the four USB contacts on the side of the host via GPIOA_14.
181+
* Since the Type-C port on the host is either used for power supply or blocked by the dock,
182+
* switching USB 2.0 access to the four contacts on the side of the host is a better choice.
183+
* To use the Type-C port for data transmission,
184+
* you only need to set GPIOA_14 in the node below to a high level.
185+
*/
186+
usb_switch: regulator-usb-switch {
187+
compatible = "regulator-fixed";
188+
enable-active-low;
189+
gpio = <&gpio GPIOA_14 GPIO_ACTIVE_LOW>;
190+
regulator-name = "usb_switch";
191+
regulator-always-on;
192+
regulator-boot-on;
193+
vin-supply = <&dc_in>;
194+
};
195+
179196
vdd_amp: regulator-vdd-amp {
180197
compatible = "regulator-fixed";
181198
enable-active-high;
@@ -558,7 +575,7 @@
558575
};
559576

560577
&usb2_phy1 {
561-
phy-supply = <&amp_power>;
578+
phy-supply = <&usb_switch>;
562579
};
563580

564581
&usb3_pcie_phy {

patch/u-boot/v2025.04/board_cainiao-cniot-core/add-board-cainiao-cniot-core.patch

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ index 00000000..345d9b86
128128
+CONFIG_ZSTD=y
129129
diff --git a/dts/upstream/src/arm64/amlogic/meson-g12b-a311d-cainiao-cniot-core.dts b/dts/upstream/src/arm64/amlogic/meson-g12b-a311d-cainiao-cniot-core.dts
130130
new file mode 100644
131-
index 00000000..40b81e87
131+
index 00000000..53318e9d
132132
--- /dev/null
133133
+++ b/dts/upstream/src/arm64/amlogic/meson-g12b-a311d-cainiao-cniot-core.dts
134-
@@ -0,0 +1,571 @@
134+
@@ -0,0 +1,588 @@
135135
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
136136
+/*
137137
+ * Copyright (c) 2019 BayLibre, SAS
@@ -310,6 +310,23 @@ index 00000000..40b81e87
310310
+ vin-supply = <&dc_in>;
311311
+ };
312312
+
313+
+ /*
314+
+ * The Type-C port on the host is switched with the four USB contacts on the side of the host via GPIOA_14.
315+
+ * Since the Type-C port on the host is either used for power supply or blocked by the dock,
316+
+ * switching USB 2.0 access to the four contacts on the side of the host is a better choice.
317+
+ * To use the Type-C port for data transmission,
318+
+ * you only need to set GPIOA_14 in the node below to a high level.
319+
+ */
320+
+ usb_switch: regulator-usb-switch {
321+
+ compatible = "regulator-fixed";
322+
+ enable-active-low;
323+
+ gpio = <&gpio GPIOA_14 GPIO_ACTIVE_LOW>;
324+
+ regulator-name = "usb_switch";
325+
+ regulator-always-on;
326+
+ regulator-boot-on;
327+
+ vin-supply = <&dc_in>;
328+
+ };
329+
+
313330
+ vdd_amp: regulator-vdd-amp {
314331
+ compatible = "regulator-fixed";
315332
+ enable-active-high;
@@ -692,7 +709,7 @@ index 00000000..40b81e87
692709
+};
693710
+
694711
+&usb2_phy1 {
695-
+ phy-supply = <&amp_power>;
712+
+ phy-supply = <&usb_switch>;
696713
+};
697714
+
698715
+&usb3_pcie_phy {

0 commit comments

Comments
 (0)