[][dts: mt7986: Fix & isolate pinctrl & flash partition]
[Description]
Fix and isolate pinctrl & flash partition:
1. There are common parts for pinctrl, which we used to
put them in dts. Isolate them into dtsi to avoid lots of
repetition.
2. Isolate flash fixed-partitions so we could modify
easily.
[Release-log]
N/A
Change-Id: Ie4c8add82924445bd00b9139ff4f1a0177eb55ec
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/5053659
diff --git a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986-snfi-nand-partition.dtsi b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986-snfi-nand-partition.dtsi
new file mode 100644
index 0000000..b88e1c1
--- /dev/null
+++ b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986-snfi-nand-partition.dtsi
@@ -0,0 +1,44 @@
+/ {
+ nmbm_snfi {
+ compatible = "generic,nmbm";
+
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ lower-mtd-device = <&snand>;
+ forced-create;
+ empty-page-ecc-protected;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ label = "BL2";
+ reg = <0x00000 0x0100000>;
+ read-only;
+ };
+
+ partition@100000 {
+ label = "u-boot-env";
+ reg = <0x0100000 0x0080000>;
+ };
+
+ factory: partition@180000 {
+ label = "Factory";
+ reg = <0x180000 0x0200000>;
+ };
+
+ partition@380000 {
+ label = "FIP";
+ reg = <0x380000 0x0200000>;
+ };
+
+ partition@580000 {
+ label = "ubi";
+ reg = <0x580000 0x4000000>;
+ };
+ };
+ };
+};
diff --git a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986-spim-nand-partition.dtsi b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986-spim-nand-partition.dtsi
new file mode 100644
index 0000000..4cc7961
--- /dev/null
+++ b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986-spim-nand-partition.dtsi
@@ -0,0 +1,43 @@
+/ {
+ nmbm_spim_nand {
+ compatible = "generic,nmbm";
+
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ lower-mtd-device = <&spi_nand>;
+ forced-create;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ label = "BL2";
+ reg = <0x00000 0x0100000>;
+ read-only;
+ };
+
+ partition@100000 {
+ label = "u-boot-env";
+ reg = <0x0100000 0x0080000>;
+ };
+
+ factory: partition@180000 {
+ label = "Factory";
+ reg = <0x180000 0x0200000>;
+ };
+
+ partition@380000 {
+ label = "FIP";
+ reg = <0x380000 0x0200000>;
+ };
+
+ partition@580000 {
+ label = "ubi";
+ reg = <0x580000 0x4000000>;
+ };
+ };
+ };
+};
diff --git a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986-spim-nor-partition.dtsi b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986-spim-nor-partition.dtsi
new file mode 100644
index 0000000..dcdde5a
--- /dev/null
+++ b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986-spim-nor-partition.dtsi
@@ -0,0 +1,30 @@
+&spi0 {
+ spi_nor@0 {
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@00000 {
+ label = "BL2";
+ reg = <0x00000 0x0040000>;
+ };
+ partition@40000 {
+ label = "u-boot-env";
+ reg = <0x40000 0x0010000>;
+ };
+ factory: partition@50000 {
+ label = "Factory";
+ reg = <0x50000 0x00B0000>;
+ };
+ partition@100000 {
+ label = "FIP";
+ reg = <0x100000 0x0080000>;
+ };
+ partition@180000 {
+ label = "firmware";
+ reg = <0x180000 0xE00000>;
+ };
+ };
+ };
+};
diff --git a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986a-pinctrl.dtsi b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986a-pinctrl.dtsi
new file mode 100644
index 0000000..42619a1
--- /dev/null
+++ b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986a-pinctrl.dtsi
@@ -0,0 +1,141 @@
+&pio {
+ wifi_led_pins: wifi_led-pins-1-2 {
+ mux {
+ function = "led";
+ groups = "wifi_led";
+ };
+ };
+
+ i2c_pins: i2c-pins-3-4 {
+ mux {
+ function = "i2c";
+ groups = "i2c";
+ };
+ };
+
+ uart1_pins_g0: uart1-pins-7-to-10 {
+ mux {
+ function = "uart";
+ groups = "uart1_0";
+ };
+ };
+
+ pcie0_pins: pcie0-pins-9-10-41 {
+ mux {
+ function = "pcie";
+ groups = "pcie_clk", "pcie_wake", "pcie_pereset";
+ };
+ };
+
+ jtag_pins: jtag-pins-11-to-14 {
+ mux {
+ function = "jtag";
+ groups = "jtag";
+ };
+ };
+
+ spic_pins_g0: spic-pins-11-to-14 {
+ mux {
+ function = "spi";
+ groups = "spi1_0";
+ };
+ };
+
+ pwm1_pin_g0: pwm1-pin-20 {
+ mux {
+ function = "pwm";
+ groups = "pwm1_1";
+ };
+ };
+
+ pwm0_pin: pwm0-pin-21 {
+ mux {
+ function = "pwm";
+ groups = "pwm0";
+ };
+ };
+
+ pwm1_pin_g1: pwm1-pin-22 {
+ mux {
+ function = "pwm";
+ groups = "pwm1_0";
+ };
+ };
+
+ spic_pins_g1: spic-pins-23-to-26 {
+ mux {
+ function = "spi";
+ groups = "spi1_1";
+ };
+ };
+
+ uart1_pins_g1: uart1-pins-23-to-26 {
+ mux {
+ function = "uart";
+ groups = "uart1_1";
+ };
+ };
+
+ spic_pins_g2: spic-pins-29-to-32 {
+ mux {
+ function = "spi";
+ groups = "spi1_2";
+ };
+ };
+
+ uart1_pins_g2: uart1-pins-29-to-32 {
+ mux {
+ function = "uart";
+ groups = "uart1_2";
+ };
+ };
+
+ uart2_pins_g0: uart1-pins-29-to-32 {
+ mux {
+ function = "uart";
+ groups = "uart1_2";
+ };
+ };
+
+ uart2_pins_g1: uart1-pins-23-to-36 {
+ mux {
+ function = "uart";
+ groups = "uart2_1";
+ };
+ };
+
+ spic_pins_g3: spic-pins-33-to-36 {
+ mux {
+ function = "spi";
+ groups = "spi1_3";
+ };
+ };
+
+ uart1_pins_g3: uart1-pins-35-to-38 {
+ mux {
+ function = "uart";
+ groups = "uart1_3_rx_tx", "uart1_3_cts_rts";
+ };
+ };
+
+ uart1_pins: uart1-pins-42-to-45 {
+ mux {
+ function = "uart";
+ groups = "uart1";
+ };
+ };
+
+ uart2_pins: uart1-pins-46-to-49 {
+ mux {
+ function = "uart";
+ groups = "uart2";
+ };
+ };
+
+ pcm_pins: pcm-pins-62-to-65 {
+ mux {
+ function = "pcm";
+ groups = "pcm";
+ };
+ };
+};
diff --git a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986b-pinctrl.dtsi b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986b-pinctrl.dtsi
new file mode 100644
index 0000000..de8e325
--- /dev/null
+++ b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986b-pinctrl.dtsi
@@ -0,0 +1,29 @@
+&pio {
+ i2c_pins: i2c-pins-3-4 {
+ mux {
+ function = "i2c";
+ groups = "i2c";
+ };
+ };
+
+ uart1_pins: uart1-pins-23-to-26 {
+ mux {
+ function = "uart";
+ groups = "uart1_1";
+ };
+ };
+
+ uart2_pins: uart1-pins-29-to-32 {
+ mux {
+ function = "uart";
+ groups = "uart2_0";
+ };
+ };
+
+ spic_pins: spi1-pins-29-to-32 {
+ mux {
+ function = "spi";
+ groups = "spi1_2";
+ };
+ };
+};