mediatek: add support for the NAND-ePHY board
authorJohn Crispin <john@phrozen.org>
Fri, 21 Apr 2017 07:38:52 +0000 (09:38 +0200)
committerJohn Crispin <john@phrozen.org>
Mon, 24 Apr 2017 09:11:52 +0000 (11:11 +0200)
This is the same as the NAND board but gmac1 is wired to an external phy.

Signed-off-by: John Crispin <john@phrozen.org>
target/linux/mediatek/base-files/etc/board.d/02_network
target/linux/mediatek/files/arch/arm/boot/dts/mt7623-NAND-ePHY.dts [new file with mode: 0644]
target/linux/mediatek/image/Makefile
target/linux/mediatek/patches-4.9/0200-devicetree.patch

index d772ab013f825c590650fbf777c82273f9bd9a78..361771199f099ae53add773d0c57b95d628868f9 100755 (executable)
@@ -10,8 +10,12 @@ mediatek_setup_interfaces()
 
        case $board in
        'mediatek,mt7623-rfb-emmc' | \
+       'mediatek,mt7623-rfb-nand-ephy')
+               ucidef_set_interface_lan "lan0 lan1 lan2 lan3"
+               ucidef_set_interface_wan eth1
+               ;;
        'mediatek,mt7623-rfb-nand')
-               ucidef_set_interface_lan "lan1 lan2 lan3 lan4"
+               ucidef_set_interface_lan "lan0 lan1 lan2 lan3"
                ucidef_set_interface_wan wan
                ;;
        esac
diff --git a/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-NAND-ePHY.dts b/target/linux/mediatek/files/arch/arm/boot/dts/mt7623-NAND-ePHY.dts
new file mode 100644 (file)
index 0000000..035bdf5
--- /dev/null
@@ -0,0 +1,527 @@
+/*
+ * Copyright (c) 2016 MediaTek Inc.
+ * Author: John Crispin <blogic@openwrt.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+/dts-v1/;
+
+#include "_mt7623.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+       model = "MediaTek MT7623 NAND reference board";
+       compatible = "mediatek,mt7623-rfb-nand-ephy", "mediatek,mt7623";
+
+       chosen {
+               stdout-path = &uart2;
+       };
+
+       memory {
+               reg = <0 0x80000000 0 0x20000000>;
+       };
+
+       usb_p1_vbus: regulator@0 {
+               compatible = "regulator-fixed";
+               regulator-name = "usb_vbus";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               gpio = <&pio 135 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+};
+
+&cpu0 {
+       proc-supply = <&mt6323_vproc_reg>;
+};
+
+&cpu1 {
+       proc-supply = <&mt6323_vproc_reg>;
+};
+
+&cpu2 {
+       proc-supply = <&mt6323_vproc_reg>;
+};
+
+&cpu3 {
+       proc-supply = <&mt6323_vproc_reg>;
+};
+
+&pwrap {
+       pmic: mt6323 {
+               compatible = "mediatek,mt6323";
+               interrupt-parent = <&pio>;
+               interrupts = <150 IRQ_TYPE_LEVEL_HIGH>;
+               interrupt-controller;
+               #interrupt-cells = <2>;
+
+               mt6323regulator: mt6323regulator{
+                       compatible = "mediatek,mt6323-regulator";
+
+                       mt6323_vproc_reg: buck_vproc{
+                               regulator-name = "vproc";
+                               regulator-min-microvolt = < 700000>;
+                               regulator-max-microvolt = <1350000>;
+                               regulator-ramp-delay = <12500>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                       };
+
+                       mt6323_vsys_reg: buck_vsys{
+                               regulator-name = "vsys";
+                               regulator-min-microvolt = <1400000>;
+                               regulator-max-microvolt = <2987500>;
+                               regulator-ramp-delay = <25000>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                       };
+
+                       mt6323_vpa_reg: buck_vpa{
+                               regulator-name = "vpa";
+                               regulator-min-microvolt = < 500000>;
+                               regulator-max-microvolt = <3650000>;
+                       };
+
+                       mt6323_vtcxo_reg: ldo_vtcxo{
+                               regulator-name = "vtcxo";
+                               regulator-min-microvolt = <2800000>;
+                               regulator-max-microvolt = <2800000>;
+                               regulator-enable-ramp-delay = <90>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                       };
+
+                       mt6323_vcn28_reg: ldo_vcn28{
+                               regulator-name = "vcn28";
+                               regulator-min-microvolt = <2800000>;
+                               regulator-max-microvolt = <2800000>;
+                               regulator-enable-ramp-delay = <185>;
+                       };
+
+                       mt6323_vcn33_bt_reg: ldo_vcn33_bt{
+                               regulator-name = "vcn33_bt";
+                               regulator-min-microvolt = <3300000>;
+                               regulator-max-microvolt = <3600000>;
+                               regulator-enable-ramp-delay = <185>;
+                       };
+
+                       mt6323_vcn33_wifi_reg: ldo_vcn33_wifi{
+                               regulator-name = "vcn33_wifi";
+                               regulator-min-microvolt = <3300000>;
+                               regulator-max-microvolt = <3600000>;
+                               regulator-enable-ramp-delay = <185>;
+                       };
+
+                       mt6323_va_reg: ldo_va{
+                               regulator-name = "va";
+                               regulator-min-microvolt = <2800000>;
+                               regulator-max-microvolt = <2800000>;
+                               regulator-enable-ramp-delay = <216>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                       };
+
+                       mt6323_vcama_reg: ldo_vcama{
+                               regulator-name = "vcama";
+                               regulator-min-microvolt = <1500000>;
+                               regulator-max-microvolt = <2800000>;
+                               regulator-enable-ramp-delay = <216>;
+                       };
+
+                       mt6323_vio28_reg: ldo_vio28{
+                               regulator-name = "vio28";
+                               regulator-min-microvolt = <2800000>;
+                               regulator-max-microvolt = <2800000>;
+                               regulator-enable-ramp-delay = <216>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                       };
+
+                       mt6323_vusb_reg: ldo_vusb{
+                               regulator-name = "vusb";
+                               regulator-min-microvolt = <3300000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-enable-ramp-delay = <216>;
+                               regulator-boot-on;
+                       };
+
+                       mt6323_vmc_reg: ldo_vmc{
+                               regulator-name = "vmc";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-enable-ramp-delay = <36>;
+                               regulator-boot-on;
+                       };
+
+                       mt6323_vmch_reg: ldo_vmch{
+                               regulator-name = "vmch";
+                               regulator-min-microvolt = <3000000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-enable-ramp-delay = <36>;
+                               regulator-boot-on;
+                       };
+
+                       mt6323_vemc3v3_reg: ldo_vemc3v3{
+                               regulator-name = "vemc3v3";
+                               regulator-min-microvolt = <3000000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-enable-ramp-delay = <36>;
+                               regulator-boot-on;
+                       };
+
+                       mt6323_vgp1_reg: ldo_vgp1{
+                               regulator-name = "vgp1";
+                               regulator-min-microvolt = <1200000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-enable-ramp-delay = <216>;
+                       };
+
+                       mt6323_vgp2_reg: ldo_vgp2{
+                               regulator-name = "vgp2";
+                               regulator-min-microvolt = <1200000>;
+                               regulator-max-microvolt = <3000000>;
+                               regulator-enable-ramp-delay = <216>;
+                       };
+
+                       mt6323_vgp3_reg: ldo_vgp3{
+                               regulator-name = "vgp3";
+                               regulator-min-microvolt = <1200000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-enable-ramp-delay = <216>;
+                       };
+
+                       mt6323_vcn18_reg: ldo_vcn18{
+                               regulator-name = "vcn18";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-enable-ramp-delay = <216>;
+                       };
+
+                       mt6323_vsim1_reg: ldo_vsim1{
+                               regulator-name = "vsim1";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3000000>;
+                               regulator-enable-ramp-delay = <216>;
+                       };
+
+                       mt6323_vsim2_reg: ldo_vsim2{
+                               regulator-name = "vsim2";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3000000>;
+                               regulator-enable-ramp-delay = <216>;
+                       };
+
+                       mt6323_vrtc_reg: ldo_vrtc{
+                               regulator-name = "vrtc";
+                               regulator-min-microvolt = <2800000>;
+                               regulator-max-microvolt = <2800000>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                       };
+
+                       mt6323_vcamaf_reg: ldo_vcamaf{
+                               regulator-name = "vcamaf";
+                               regulator-min-microvolt = <1200000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-enable-ramp-delay = <216>;
+                       };
+
+                       mt6323_vibr_reg: ldo_vibr{
+                               regulator-name = "vibr";
+                               regulator-min-microvolt = <1200000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-enable-ramp-delay = <36>;
+                       };
+
+                       mt6323_vrf18_reg: ldo_vrf18{
+                               regulator-name = "vrf18";
+                               regulator-min-microvolt = <1825000>;
+                               regulator-max-microvolt = <1825000>;
+                               regulator-enable-ramp-delay = <187>;
+                       };
+
+                       mt6323_vm_reg: ldo_vm{
+                               regulator-name = "vm";
+                               regulator-min-microvolt = <1200000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-enable-ramp-delay = <216>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                       };
+
+                       mt6323_vio18_reg: ldo_vio18{
+                               regulator-name = "vio18";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-enable-ramp-delay = <216>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                       };
+
+                       mt6323_vcamd_reg: ldo_vcamd{
+                               regulator-name = "vcamd";
+                               regulator-min-microvolt = <1200000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-enable-ramp-delay = <216>;
+                       };
+
+                       mt6323_vcamio_reg: ldo_vcamio{
+                               regulator-name = "vcamio";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-enable-ramp-delay = <216>;
+                       };
+               };
+
+               mt6323led: leds {
+                       compatible = "mediatek,mt6323-led";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       led@0 {
+                               reg = <0>;
+                               label = "LED0";
+                               linux,default-trigger = "timer";
+                               default-state = "on";
+                       };
+                       led@1 {
+                               reg = <1>;
+                               label = "LED1";
+                               default-state = "off";
+                       };
+                       led@2 {
+                               reg = <2>;
+                               label = "LED2";
+                               default-state = "on";
+                       };
+                       led@3 {
+                               reg = <3>;
+                               label = "LED3";
+                               default-state = "on";
+                       };
+               };
+       };
+};
+
+&uart2 {
+       status = "okay";
+};
+
+&pio {
+       nand_pins_default: nanddefault {
+               pins_dat {
+                       pinmux = <MT7623_PIN_111_MSDC0_DAT7_FUNC_NLD7>,
+                                <MT7623_PIN_112_MSDC0_DAT6_FUNC_NLD6>,
+                                <MT7623_PIN_114_MSDC0_DAT4_FUNC_NLD4>,
+                                <MT7623_PIN_118_MSDC0_DAT3_FUNC_NLD3>,
+                                <MT7623_PIN_121_MSDC0_DAT0_FUNC_NLD0>,
+                                <MT7623_PIN_120_MSDC0_DAT1_FUNC_NLD1>,
+                                <MT7623_PIN_113_MSDC0_DAT5_FUNC_NLD5>,
+                                <MT7623_PIN_115_MSDC0_RSTB_FUNC_NLD8>,
+                                <MT7623_PIN_119_MSDC0_DAT2_FUNC_NLD2>;
+                               input-enable;
+                               drive-strength = <MTK_DRIVE_8mA>;
+                               bias-pull-up;
+               };
+
+               pins_we {
+                       pinmux = <MT7623_PIN_117_MSDC0_CLK_FUNC_NWEB>;
+                       drive-strength = <MTK_DRIVE_8mA>;
+                       bias-pull-up = <MTK_PUPD_SET_R1R0_10>;
+               };
+
+               pins_ale {
+                       pinmux = <MT7623_PIN_116_MSDC0_CMD_FUNC_NALE>;
+                       drive-strength = <MTK_DRIVE_8mA>;
+                       bias-pull-down = <MTK_PUPD_SET_R1R0_10>;
+               };
+       };
+
+       eth_default: eth {
+               pins_eth {
+                       pinmux = <MT7623_PIN_275_G2_MDC_FUNC_MDC>,
+                                <MT7623_PIN_276_G2_MDIO_FUNC_MDIO>,
+                                <MT7623_PIN_262_G2_TXEN_FUNC_G2_TXEN>,
+                                <MT7623_PIN_263_G2_TXD3_FUNC_G2_TXD3>,
+                                <MT7623_PIN_264_G2_TXD2_FUNC_G2_TXD2>,
+                                <MT7623_PIN_265_G2_TXD1_FUNC_G2_TXD1>,
+                                <MT7623_PIN_266_G2_TXD0_FUNC_G2_TXD0>,
+                                <MT7623_PIN_267_G2_TXCLK_FUNC_G2_TXC>,
+                                <MT7623_PIN_268_G2_RXCLK_FUNC_G2_RXC>,
+                                <MT7623_PIN_269_G2_RXD0_FUNC_G2_RXD0>,
+                                <MT7623_PIN_270_G2_RXD1_FUNC_G2_RXD1>,
+                                <MT7623_PIN_271_G2_RXD2_FUNC_G2_RXD2>,
+                                <MT7623_PIN_272_G2_RXD3_FUNC_G2_RXD3>,
+                                <MT7623_PIN_274_G2_RXDV_FUNC_G2_RXDV>;
+               };
+
+               pins_eth_esw {
+                       pinmux = <MT7623_PIN_273_ESW_INT_FUNC_ESW_INT>;
+                       input-enable;
+                       drive-strength = <MTK_DRIVE_8mA>;
+                       bias-pull-up;
+               };
+
+               pins_eth_rst {
+                       pinmux = <MT7623_PIN_15_GPIO15_FUNC_GPIO15>;
+                       output-low;
+               };
+       };
+
+       pwm_pins: pwm {
+               pins_pwm1 {
+                       pinmux = <MT7623_PIN_204_PWM1_FUNC_PWM1>;
+               };
+
+               pins_pwm2 {
+                       pinmux = <MT7623_PIN_205_PWM2_FUNC_PWM2>;
+               };
+       };
+};
+
+&nandc {
+       status = "okay";
+       pinctrl-names = "default";
+       pinctrl-0 = <&nand_pins_default>;
+       nand@0 {
+               reg = <0>;
+               spare_per_sector = <64>;
+               nand-ecc-mode = "hw";
+               nand-ecc-strength = <12>;
+               nand-ecc-step-size = <1024>;
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       partition@C0000 {
+                               label = "uboot-env";
+                               reg = <0xC0000 0x40000>;
+                       };
+
+                       partition@100000 {
+                               label = "factory";
+                               reg = <0x100000 0x40000>;
+                       };
+
+                       partition@140000 {
+                               label = "kernel";
+                               reg = <0x140000 0x2000000>;
+                       };
+
+                       partition@2140000 {
+                               label = "recovery";
+                               reg = <0x2140000 0x2000000>;
+                       };
+
+                       partition@4140000 {
+                               label = "ubi";
+                               reg = <0x4140000 0x1000000>;
+                       };
+               };
+       };
+};
+&bch {
+       status = "okay";
+};
+
+&usb1 {
+       vusb33-supply = <&mt6323_vusb_reg>;
+       vbus-supply = <&usb_p1_vbus>;
+       status = "okay";
+};
+
+&u3phy1 {
+       status = "okay";
+};
+
+&pcie {
+       status = "okay";
+};
+
+&eth {
+       status = "okay";
+};
+
+&gmac1 {
+       mac-address = [00 11 22 33 44 56];
+       status = "okay";
+};
+
+&gmac2 {
+       mac-address = [00 11 22 33 44 55];
+       status = "okay";
+
+       phy-handle = <&phy5>;
+};
+
+&mdio0 {
+       switch@0 {
+               compatible = "mediatek,mt7530";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               reg = <0>;
+
+               pinctrl-names = "default";
+               pinctrl-0 = <&eth_default>;
+
+               core-supply = <&mt6323_vpa_reg>;
+               io-supply = <&mt6323_vemc3v3_reg>;
+               reset-gpios = <&pio 33 0>;
+
+               ports {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0>;
+                       port@0 {
+                               reg = <0>;
+                               label = "lan0";
+                       };
+
+                       port@1 {
+                               reg = <1>;
+                               label = "lan1";
+                       };
+
+                       port@2 {
+                               reg = <2>;
+                               label = "lan2";
+                       };
+
+                       port@3 {
+                               reg = <3>;
+                               label = "lan3";
+                       };
+
+                       port@6 {
+                               reg = <6>;
+                               label = "cpu";
+                               ethernet = <&gmac1>;
+                               phy-mode = "trgmii";
+                               fixed-link {
+                                       speed = <1000>;
+                                       full-duplex;
+                               };
+                       };
+               };
+       };
+
+       phy5: ethernet-phy@5 {
+               reg = <5>;
+               phy-mode = "rgmii-rxid";
+       };
+};
+
+&pwm {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pwm_pins>;
+       status = "okay";
+};
index 3139197dd33b3dc7a55acaa23ea9e3873642f897..ac42691261df4fcf301b4f3f072f796ad92c8ca7 100644 (file)
@@ -32,11 +32,15 @@ define Image/Build/squashfs
        $(call Image/Build/SysupgradeCombined,eMMC,squashfs)
 
        $(call Image/BuilduImage,NAND)
+       $(call Image/BuilduImage,NAND-ePHY)
 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
        $(call Image/BuilduImage,NAND,-initramfs)
+       $(call Image/BuilduImage,NAND-ePHY,-initramfs)
        $(CP) $(KDIR)/uImage-NAND-initramfs $(BIN_DIR)/$(IMG_PREFIX)-uImage-NAND-initramfs
+       $(CP) $(KDIR)/uImage-NAND-ePHY-initramfs $(BIN_DIR)/$(IMG_PREFIX)-uImage-NAND-ePHY-initramfs
 endif
        $(call Image/Build/SysupgradeNAND,NAND,$(1),$(KDIR)/uImage-NAND)
+       $(call Image/Build/SysupgradeNAND,NAND-ePHY,$(1),$(KDIR)/uImage-NAND-ePHY)
 endef
 
 define Image/Build
index 50b54f456dfb644c5abc734ae82e128f3ca46fe6..4eca20a7bd59742556c5da37e84b57ee0d57cce9 100644 (file)
@@ -1,11 +1,12 @@
 --- a/arch/arm/boot/dts/Makefile
 +++ b/arch/arm/boot/dts/Makefile
-@@ -950,6 +950,8 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
+@@ -950,6 +950,9 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
        mt6589-aquaris5.dtb \
        mt6592-evb.dtb \
        mt7623-evb.dtb \
 +      mt7623-eMMC.dtb \
 +      mt7623-NAND.dtb \
++      mt7623-NAND-ePHY.dtb \
        mt8127-moose.dtb \
        mt8135-evbp1.dtb
  dtb-$(CONFIG_ARCH_ZX) += zx296702-ad1.dtb