Merge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell
authorTom Rini <trini@konsulko.com>
Mon, 4 May 2020 15:05:48 +0000 (11:05 -0400)
committerTom Rini <trini@konsulko.com>
Mon, 4 May 2020 15:05:48 +0000 (11:05 -0400)
- 2 MVEBU related fixes

161 files changed:
README
arch/arm/dts/Makefile
arch/arm/dts/cros-ec-keyboard.dtsi
arch/arm/dts/cros-ec-sbs.dtsi
arch/arm/dts/imx8mm-evk-u-boot.dtsi
arch/arm/dts/imx8mm-verdin-u-boot.dtsi
arch/arm/dts/imx8mm.dtsi
arch/arm/dts/imx8mn-ddr4-evk-u-boot.dtsi
arch/arm/dts/imx8mp-evk-u-boot.dtsi
arch/arm/dts/imx8mq-phanbell.dts [new file with mode: 0644]
arch/arm/dts/px30-evb-u-boot.dtsi
arch/arm/dts/px30-evb.dts
arch/arm/dts/px30-firefly-u-boot.dtsi
arch/arm/dts/px30-u-boot.dtsi [new file with mode: 0644]
arch/arm/dts/rk3328-evb-u-boot.dtsi
arch/arm/dts/rk3328-evb.dts
arch/arm/dts/rk3328-roc-cc-u-boot.dtsi [new file with mode: 0644]
arch/arm/dts/rk3328-roc-cc.dts [new file with mode: 0644]
arch/arm/dts/rk3328-rock64-u-boot.dtsi
arch/arm/dts/rk3328-rock64.dts
arch/arm/dts/rk3328-u-boot.dtsi
arch/arm/dts/rk3328.dtsi
arch/arm/dts/rk3399-evb-u-boot.dtsi
arch/arm/dts/rk3399-evb.dts
arch/arm/dts/rk3399-ficus.dts
arch/arm/dts/rk3399-firefly.dts
arch/arm/dts/rk3399-gru-bob.dts
arch/arm/dts/rk3399-gru-chromebook.dtsi
arch/arm/dts/rk3399-gru-kevin.dts
arch/arm/dts/rk3399-gru.dtsi
arch/arm/dts/rk3399-khadas-edge.dtsi
arch/arm/dts/rk3399-leez-p710.dts
arch/arm/dts/rk3399-nanopc-t4.dts
arch/arm/dts/rk3399-nanopi-m4-2gb-u-boot.dtsi [new file with mode: 0644]
arch/arm/dts/rk3399-nanopi-m4-2gb.dts [new file with mode: 0644]
arch/arm/dts/rk3399-nanopi4.dtsi
arch/arm/dts/rk3399-orangepi.dts
arch/arm/dts/rk3399-puma-u-boot.dtsi
arch/arm/dts/rk3399-puma.dtsi
arch/arm/dts/rk3399-roc-pc-mezzanine-u-boot.dtsi [new file with mode: 0644]
arch/arm/dts/rk3399-roc-pc-mezzanine.dts [new file with mode: 0644]
arch/arm/dts/rk3399-roc-pc-u-boot.dtsi
arch/arm/dts/rk3399-roc-pc.dts
arch/arm/dts/rk3399-roc-pc.dtsi
arch/arm/dts/rk3399-rock-pi-4.dts
arch/arm/dts/rk3399-rock960.dts
arch/arm/dts/rk3399-rock960.dtsi
arch/arm/dts/rk3399-rockpro64.dts
arch/arm/dts/rk3399-rockpro64.dtsi [new file with mode: 0644]
arch/arm/dts/rk3399-u-boot.dtsi
arch/arm/dts/rk3399.dtsi
arch/arm/include/asm/arch-imx/cpu.h
arch/arm/include/asm/arch-imx8/sci/rpc.h
arch/arm/include/asm/arch-imx8/sci/sci.h
arch/arm/include/asm/arch-imx8/sci/svc/pad/api.h
arch/arm/include/asm/arch-imx8/sci/types.h
arch/arm/include/asm/arch-imx8/snvs_security_sc.h [new file with mode: 0644]
arch/arm/include/asm/arch-imx8m/clock_imx8mm.h
arch/arm/include/asm/arch-imx8m/clock_imx8mq.h
arch/arm/include/asm/mach-imx/sys_proto.h
arch/arm/lib/Makefile
arch/arm/mach-imx/cpu.c
arch/arm/mach-imx/imx8/Kconfig
arch/arm/mach-imx/imx8/Makefile
arch/arm/mach-imx/imx8/ahab.c
arch/arm/mach-imx/imx8/misc.c
arch/arm/mach-imx/imx8/parse-container.c
arch/arm/mach-imx/imx8/snvs_security_sc.c [new file with mode: 0644]
arch/arm/mach-imx/imx8m/Kconfig
arch/arm/mach-imx/imx8m/clock_imx8mm.c
arch/arm/mach-imx/imx8m/clock_imx8mq.c
arch/arm/mach-imx/imx8m/clock_slice.c
arch/arm/mach-imx/imx8m/soc.c
arch/arm/mach-imx/spl.c
board/firefly/roc-pc-rk3399/MAINTAINERS
board/firefly/roc-pc-rk3399/roc-pc-rk3399.c
board/freescale/imx8mm_evk/spl.c
board/freescale/imx8mn_evk/spl.c
board/freescale/imx8mp_evk/spl.c
board/freescale/imx8mq_evk/spl.c
board/freescale/imx8qxp_mek/imx8qxp_mek.c
board/freescale/imxrt1020-evk/README
board/freescale/imxrt1050-evk/README
board/google/imx8mq_phanbell/Kconfig [new file with mode: 0644]
board/google/imx8mq_phanbell/MAINTAINERS [new file with mode: 0644]
board/google/imx8mq_phanbell/Makefile [new file with mode: 0644]
board/google/imx8mq_phanbell/README [new file with mode: 0644]
board/google/imx8mq_phanbell/imx8mq_phanbell.c [new file with mode: 0644]
board/google/imx8mq_phanbell/lpddr4_timing_1g.c [new file with mode: 0644]
board/google/imx8mq_phanbell/spl.c [new file with mode: 0644]
board/rockchip/evb_rk3328/MAINTAINERS
board/rockchip/evb_rk3399/MAINTAINERS
board/toradex/apalis_imx6/apalis_imx6.c
board/toradex/verdin-imx8mm/spl.c
board/toradex/verdin-imx8mm/verdin-imx8mm.c
common/spl/Kconfig
configs/deneb_defconfig
configs/display5_defconfig
configs/evb-px30_defconfig
configs/evb-rk3328_defconfig
configs/evb-rk3399_defconfig
configs/giedi_defconfig
configs/imx28_xea_defconfig
configs/imx8mm_evk_defconfig
configs/imx8mn_ddr4_evk_defconfig
configs/imx8mp_evk_defconfig
configs/imx8mq_evk_defconfig
configs/imx8mq_phanbell_defconfig [new file with mode: 0644]
configs/imx8qm_mek_defconfig
configs/imx8qm_rom7720_a1_4G_defconfig
configs/imx8qxp_mek_defconfig
configs/nanopi-m4-2gb-rk3399_defconfig [new file with mode: 0644]
configs/roc-cc-rk3328_defconfig [new file with mode: 0644]
configs/roc-pc-mezzanine-rk3399_defconfig [new file with mode: 0644]
configs/rock64-rk3328_defconfig
configs/verdin-imx8mm_defconfig
doc/README.rockchip
doc/imx/ahab/csf_examples/csf_enc_boot_image.txt [new file with mode: 0644]
doc/imx/ahab/guides/mx8_mx8x_encrypted_boot.txt [new file with mode: 0644]
drivers/clk/imx/clk-imxrt1050.c
drivers/clk/rockchip/clk_rk3399.c
drivers/misc/imx8/scu_api.c
drivers/net/Kconfig
drivers/net/dc2114x.c
drivers/net/dwc_eth_qos.c
drivers/net/fec_mxc.c
drivers/net/fec_mxc.h
drivers/net/pcnet.c
drivers/net/phy/micrel_ksz90x1.c
drivers/net/rtl8139.c
drivers/net/smc911x.c
drivers/net/smc911x.h
drivers/rng/Kconfig
drivers/rng/Makefile
drivers/rng/rockchip_rng.c [new file with mode: 0644]
drivers/video/mxsfb.c
drivers/video/rockchip/rk3288_mipi.c
drivers/video/rockchip/rk3399_mipi.c
drivers/video/rockchip/rk_edp.c
drivers/video/rockchip/rk_lvds.c
drivers/video/rockchip/rk_mipi.c
examples/standalone/Makefile
examples/standalone/smc911x_eeprom.c
include/configs/apalis-imx8.h
include/configs/imx8mq_phanbell.h [new file with mode: 0644]
include/configs/malta.h
include/configs/mx6sxsabreauto.h
include/configs/mx6sxsabresd.h
include/configs/mx6ul_14x14_evk.h
include/configs/mx6ullevk.h
include/configs/mx7dsabresd.h
include/configs/pcm052.h
include/configs/vf610twr.h
include/dt-bindings/clock/rk3328-cru.h
include/dt-bindings/pinctrl/pins-imxrt1020.h
include/dt-bindings/power/rk3328-power.h [new file with mode: 0644]
include/imx_sip.h
include/micrel.h
include/netdev.h
scripts/config_whitelist.txt
tools/fit_image.c

diff --git a/README b/README
index 083485067654c319b7f7b84227ae23c689467b1d..2e8ad3bc0cb1f18a983da5eb0d525a66bb26d0e2 100644 (file)
--- a/README
+++ b/README
@@ -896,8 +896,6 @@ The following options need to be configured:
 
                CONFIG_TULIP
                Support for Digital 2114x chips.
-               Optional CONFIG_TULIP_SELECT_MEDIA for board specific
-               modem chip initialisation (KS8761/QS6611).
 
                CONFIG_NATSEMI
                Support for National dp83815 chips.
index 2c123bd6da6eccf1a0b2580ae16d8dc517c2d7a0..559d3ab6a7ad92555cabcdbc9d7a732d728e617b 100644 (file)
@@ -106,6 +106,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3308) += \
 
 dtb-$(CONFIG_ROCKCHIP_RK3328) += \
        rk3328-evb.dtb \
+       rk3328-roc-cc.dtb \
        rk3328-rock64.dtb
 
 dtb-$(CONFIG_ROCKCHIP_RK3368) += \
@@ -125,12 +126,14 @@ dtb-$(CONFIG_ROCKCHIP_RK3399) += \
        rk3399-leez-p710.dtb \
        rk3399-nanopc-t4.dtb \
        rk3399-nanopi-m4.dtb \
+       rk3399-nanopi-m4-2gb.dtb \
        rk3399-nanopi-neo4.dtb \
        rk3399-orangepi.dtb \
        rk3399-puma-ddr1333.dtb \
        rk3399-puma-ddr1600.dtb \
        rk3399-puma-ddr1866.dtb \
        rk3399-roc-pc.dtb \
+       rk3399-roc-pc-mezzanine.dtb \
        rk3399-rock-pi-4.dtb \
        rk3399-rock960.dtb \
        rk3399-rockpro64.dtb
@@ -733,6 +736,7 @@ dtb-$(CONFIG_ARCH_IMX8M) += \
        imx8mm-verdin.dtb \
        imx8mn-ddr4-evk.dtb \
        imx8mq-evk.dtb \
+       imx8mq-phanbell.dtb \
        imx8mp-evk.dtb
 
 dtb-$(CONFIG_ARCH_IMXRT) += imxrt1050-evk.dtb \
index 9c7fb0acae79c9d3c34f58e1acca360057d0c43e..4a0c1037fbc06336513a99f73ca0e3f4827553e7 100644 (file)
@@ -1,11 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Keyboard dts fragment for devices that use cros-ec-keyboard
  *
  * Copyright (c) 2014 Google, Inc
- *
- * 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.
 */
 
 #include <dt-bindings/input/input.h>
@@ -22,6 +19,7 @@
                        MATRIX_KEY(0x00, 0x02, KEY_F1)
                        MATRIX_KEY(0x00, 0x03, KEY_B)
                        MATRIX_KEY(0x00, 0x04, KEY_F10)
+                       MATRIX_KEY(0x00, 0x05, KEY_RO)
                        MATRIX_KEY(0x00, 0x06, KEY_N)
                        MATRIX_KEY(0x00, 0x08, KEY_EQUAL)
                        MATRIX_KEY(0x00, 0x0a, KEY_RIGHTALT)
@@ -34,6 +32,7 @@
                        MATRIX_KEY(0x01, 0x08, KEY_APOSTROPHE)
                        MATRIX_KEY(0x01, 0x09, KEY_F9)
                        MATRIX_KEY(0x01, 0x0b, KEY_BACKSPACE)
+                       MATRIX_KEY(0x01, 0x0c, KEY_HENKAN)
 
                        MATRIX_KEY(0x02, 0x00, KEY_LEFTCTRL)
                        MATRIX_KEY(0x02, 0x01, KEY_TAB)
@@ -45,6 +44,7 @@
                        MATRIX_KEY(0x02, 0x07, KEY_102ND)
                        MATRIX_KEY(0x02, 0x08, KEY_LEFTBRACE)
                        MATRIX_KEY(0x02, 0x09, KEY_F8)
+                       MATRIX_KEY(0x02, 0x0a, KEY_YEN)
 
                        MATRIX_KEY(0x03, 0x01, KEY_GRAVE)
                        MATRIX_KEY(0x03, 0x02, KEY_F2)
@@ -52,7 +52,9 @@
                        MATRIX_KEY(0x03, 0x04, KEY_F5)
                        MATRIX_KEY(0x03, 0x06, KEY_6)
                        MATRIX_KEY(0x03, 0x08, KEY_MINUS)
+                       MATRIX_KEY(0x03, 0x09, KEY_F13)
                        MATRIX_KEY(0x03, 0x0b, KEY_BACKSLASH)
+                       MATRIX_KEY(0x03, 0x0c, KEY_MUHENKAN)
 
                        MATRIX_KEY(0x04, 0x00, KEY_RIGHTCTRL)
                        MATRIX_KEY(0x04, 0x01, KEY_A)
index dfe5ea6ca2c271b09b5f2394bcbd6890dec3bf3a..71f5c5ecce46905b0b0faf6f5d36f90d8cb92487 100644 (file)
@@ -1,8 +1,45 @@
-// SPDX-License-Identifier: GPL-2.0
 /*
  * Smart battery dts fragment for devices that use cros-ec-sbs
  *
  * Copyright (c) 2015 Google, Inc
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This file 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.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
  */
 
 &i2c_tunnel {
index 3502602fbb86e9ed22343cfd444fe490988843fe..b5c12105a9d103d40c4237c9a1c60cc3dc1c8af5 100644 (file)
@@ -3,6 +3,14 @@
  * Copyright 2019 NXP
  */
 
+/ {
+       wdt-reboot {
+               compatible = "wdt-reboot";
+               wdt = <&wdog1>;
+               u-boot,dm-spl;
+       };
+};
+
 &{/soc@0} {
        u-boot,dm-pre-reloc;
        u-boot,dm-spl;
 &fec1 {
        phy-reset-gpios = <&gpio4 22 GPIO_ACTIVE_LOW>;
 };
+
+&wdog1 {
+       u-boot,dm-spl;
+};
index e60b9faee442f77dcb10f8e0494f5283b8400b2b..fe6bb9bf03cf32918caeaca1827bcfa7618a8755 100644 (file)
@@ -3,6 +3,14 @@
  * Copyright 2020 Toradex
  */
 
+/ {
+       wdt-reboot {
+               compatible = "wdt-reboot";
+               wdt = <&wdog1>;
+               u-boot,dm-spl;
+       };
+};
+
 &aips1 {
        u-boot,dm-spl;
        u-boot,dm-pre-reloc;
 &usdhc3 {
        u-boot,dm-spl;
 };
+
+&wdog1 {
+       u-boot,dm-spl;
+};
index 8aafad24494f15e93d959df7b1f449c4b519c458..1e5e11592f7bc57c949736cb3247eb44e7878305 100644 (file)
@@ -12,7 +12,6 @@
 #include "imx8mm-pinfunc.h"
 
 / {
-       compatible = "fsl,imx8mm";
        interrupt-parent = <&gic>;
        #address-cells = <2>;
        #size-cells = <2>;
                };
        };
 
-       memory@40000000 {
-               device_type = "memory";
-               reg = <0x0 0x40000000 0 0x80000000>;
-       };
-
        osc_32k: clock-osc-32k {
                compatible = "fixed-clock";
                #clock-cells = <0>;
                ranges = <0x0 0x0 0x0 0x3e000000>;
 
                aips1: bus@30000000 {
-                       compatible = "fsl,aips-bus", "simple-bus";
+                       compatible = "simple-bus";
                        #address-cells = <1>;
                        #size-cells = <1>;
                        ranges = <0x30000000 0x30000000 0x400000>;
                        };
 
                        sdma2: dma-controller@302c0000 {
-                               compatible = "fsl,imx8mm-sdma", "fsl,imx7d-sdma";
+                               compatible = "fsl,imx8mm-sdma", "fsl,imx8mq-sdma";
                                reg = <0x302c0000 0x10000>;
                                interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clk IMX8MM_CLK_SDMA2_ROOT>,
                        };
 
                        sdma3: dma-controller@302b0000 {
-                               compatible = "fsl,imx8mm-sdma", "fsl,imx7d-sdma";
+                               compatible = "fsl,imx8mm-sdma", "fsl,imx8mq-sdma";
                                reg = <0x302b0000 0x10000>;
                                interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clk IMX8MM_CLK_SDMA3_ROOT>,
                        };
 
                        anatop: anatop@30360000 {
-                               compatible = "fsl,imx8mm-anatop", "syscon", "simple-bus";
+                               compatible = "fsl,imx8mm-anatop", "syscon";
                                reg = <0x30360000 0x10000>;
                        };
 
                                                <&clk IMX8MM_CLK_AUDIO_AHB>,
                                                <&clk IMX8MM_CLK_IPG_AUDIO_ROOT>,
                                                <&clk IMX8MM_SYS_PLL3>,
-                                               <&clk IMX8MM_VIDEO_PLL1>;
+                                               <&clk IMX8MM_VIDEO_PLL1>,
+                                               <&clk IMX8MM_AUDIO_PLL1>,
+                                               <&clk IMX8MM_AUDIO_PLL2>;
                                assigned-clock-parents = <&clk IMX8MM_SYS_PLL3_OUT>,
                                                         <&clk IMX8MM_SYS_PLL1_800M>;
                                assigned-clock-rates = <0>,
                                                        <400000000>,
                                                        <400000000>,
                                                        <750000000>,
-                                                       <594000000>;
+                                                       <594000000>,
+                                                       <393216000>,
+                                                       <361267200>;
                        };
 
                        src: reset-controller@30390000 {
                };
 
                aips2: bus@30400000 {
-                       compatible = "fsl,aips-bus", "simple-bus";
+                       compatible = "simple-bus";
                        #address-cells = <1>;
                        #size-cells = <1>;
                        ranges = <0x30400000 0x30400000 0x400000>;
                };
 
                aips3: bus@30800000 {
-                       compatible = "fsl,aips-bus", "simple-bus";
+                       compatible = "simple-bus";
                        #address-cells = <1>;
                        #size-cells = <1>;
                        ranges = <0x30800000 0x30800000 0x400000>;
                                status = "disabled";
                        };
 
+                       crypto: crypto@30900000 {
+                               compatible = "fsl,sec-v4.0";
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+                               reg = <0x30900000 0x40000>;
+                               ranges = <0 0x30900000 0x40000>;
+                               interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MM_CLK_AHB>,
+                                        <&clk IMX8MM_CLK_IPG_ROOT>;
+                               clock-names = "aclk", "ipg";
+
+                               sec_jr0: jr@1000 {
+                                       compatible = "fsl,sec-v4.0-job-ring";
+                                       reg = <0x1000 0x1000>;
+                                       interrupts = <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>;
+                               };
+
+                               sec_jr1: jr@2000 {
+                                       compatible = "fsl,sec-v4.0-job-ring";
+                                       reg = <0x2000 0x1000>;
+                                       interrupts = <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>;
+                               };
+
+                               sec_jr2: jr@3000 {
+                                       compatible = "fsl,sec-v4.0-job-ring";
+                                       reg = <0x3000 0x1000>;
+                                       interrupts = <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>;
+                               };
+                       };
+
                        i2c1: i2c@30a20000 {
                                compatible = "fsl,imx8mm-i2c", "fsl,imx21-i2c";
                                #address-cells = <1>;
                                         <&clk IMX8MM_CLK_NAND_USDHC_BUS>,
                                         <&clk IMX8MM_CLK_USDHC1_ROOT>;
                                clock-names = "ipg", "ahb", "per";
-                               assigned-clocks = <&clk IMX8MM_CLK_USDHC1>;
-                               assigned-clock-rates = <400000000>;
                                fsl,tuning-start-tap = <20>;
                                fsl,tuning-step= <2>;
                                bus-width = <4>;
                                         <&clk IMX8MM_CLK_NAND_USDHC_BUS>,
                                         <&clk IMX8MM_CLK_USDHC3_ROOT>;
                                clock-names = "ipg", "ahb", "per";
-                               assigned-clocks = <&clk IMX8MM_CLK_USDHC3_ROOT>;
-                               assigned-clock-rates = <400000000>;
                                fsl,tuning-start-tap = <20>;
                                fsl,tuning-step= <2>;
                                bus-width = <4>;
                        };
 
                        sdma1: dma-controller@30bd0000 {
-                               compatible = "fsl,imx8mm-sdma", "fsl,imx7d-sdma";
+                               compatible = "fsl,imx8mm-sdma", "fsl,imx8mq-sdma";
                                reg = <0x30bd0000 0x10000>;
                                interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clk IMX8MM_CLK_SDMA1_ROOT>,
-                                        <&clk IMX8MM_CLK_SDMA1_ROOT>;
+                                        <&clk IMX8MM_CLK_AHB>;
                                clock-names = "ipg", "ahb";
                                #dma-cells = <3>;
                                fsl,sdma-ram-script-name = "imx/sdma/sdma-imx7d.bin";
                };
 
                aips4: bus@32c00000 {
-                       compatible = "fsl,aips-bus", "simple-bus";
+                       compatible = "simple-bus";
                        #address-cells = <1>;
                        #size-cells = <1>;
                        ranges = <0x32c00000 0x32c00000 0x400000>;
                        interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>;
                };
 
+               ddrc: memory-controller@3d400000 {
+                       compatible = "fsl,imx8mm-ddrc", "fsl,imx8m-ddrc";
+                       reg = <0x3d400000 0x400000>;
+                       clock-names = "core", "pll", "alt", "apb";
+                       clocks = <&clk IMX8MM_CLK_DRAM_CORE>,
+                                <&clk IMX8MM_DRAM_PLL>,
+                                <&clk IMX8MM_CLK_DRAM_ALT>,
+                                <&clk IMX8MM_CLK_DRAM_APB>;
+               };
+
                ddr-pmu@3d800000 {
                        compatible = "fsl,imx8mm-ddr-pmu", "fsl,imx8m-ddr-pmu";
                        reg = <0x3d800000 0x400000>;
index 8d61597e0ce053f436440ea3e8b254466862ac60..4419679d4c66907054fb840b9456c68fdbe75c88 100644 (file)
@@ -3,6 +3,14 @@
  * Copyright 2019 NXP
  */
 
+/ {
+       wdt-reboot {
+               compatible = "wdt-reboot";
+               wdt = <&wdog1>;
+               u-boot,dm-spl;
+       };
+};
+
 &{/soc@0} {
        u-boot,dm-pre-reloc;
        u-boot,dm-spl;
@@ -90,3 +98,7 @@
 &usdhc3 {
        u-boot,dm-spl;
 };
+
+&wdog1 {
+       u-boot,dm-spl;
+};
index 4675ada0a0a927b6a3b2639019e0c3a4fe09aa63..24a93ac2d6906abe5ae71a5eaa655a3e303519be 100644 (file)
@@ -3,6 +3,14 @@
  * Copyright 2019 NXP
  */
 
+/ {
+       wdt-reboot {
+               compatible = "wdt-reboot";
+               wdt = <&wdog1>;
+               u-boot,dm-spl;
+       };
+};
+
 &{/soc@0} {
        u-boot,dm-pre-reloc;
        u-boot,dm-spl;
 &usdhc3 {
        u-boot,dm-spl;
 };
+
+&wdog1 {
+       u-boot,dm-spl;
+};
diff --git a/arch/arm/dts/imx8mq-phanbell.dts b/arch/arm/dts/imx8mq-phanbell.dts
new file mode 100644 (file)
index 0000000..4892ad5
--- /dev/null
@@ -0,0 +1,417 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright 2020 NXP
+ */
+
+/dts-v1/;
+
+#include "imx8mq.dtsi"
+
+/ {
+       model = "Google i.MX8MQ Phanbell";
+       compatible = "google,imx8mq-phanbell", "fsl,imx8mq";
+
+       chosen {
+               stdout-path = &uart1;
+       };
+
+       memory@40000000 {
+               device_type = "memory";
+               reg = <0x00000000 0x40000000 0 0x40000000>;
+       };
+
+       pmic_osc: clock-pmic {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <32768>;
+               clock-output-names = "pmic_osc";
+       };
+
+       reg_usdhc2_vmmc: regulator-usdhc2-vmmc {
+               compatible = "regulator-fixed";
+               regulator-name = "VSD_3V3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+};
+
+&A53_0 {
+       cpu-supply = <&buck2>;
+};
+
+&A53_1 {
+       cpu-supply = <&buck2>;
+};
+
+&A53_2 {
+       cpu-supply = <&buck2>;
+};
+
+&A53_3 {
+       cpu-supply = <&buck2>;
+};
+
+&i2c1 {
+       clock-frequency = <400000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       pmic: pmic@4b {
+               compatible = "rohm,bd71837";
+               reg = <0x4b>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_pmic>;
+               #clock-cells = <0>;
+               clocks = <&pmic_osc>;
+               clock-output-names = "pmic_clk";
+               interrupt-parent = <&gpio1>;
+               interrupts = <3 GPIO_ACTIVE_LOW>;
+
+               regulators {
+                       buck1: BUCK1 {
+                               regulator-name = "buck1";
+                               regulator-min-microvolt = <700000>;
+                               regulator-max-microvolt = <1300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                               regulator-ramp-delay = <1250>;
+                               rohm,dvs-run-voltage = <900000>;
+                               rohm,dvs-idle-voltage = <900000>;
+                               rohm,dvs-suspend-voltage = <800000>;
+                       };
+
+                       buck2: BUCK2 {
+                               regulator-name = "buck2";
+                               regulator-min-microvolt = <850000>;
+                               regulator-max-microvolt = <1000000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                               rohm,dvs-run-voltage = <1000000>;
+                               rohm,dvs-idle-voltage = <900000>;
+                       };
+
+                       buck3: BUCK3 {
+                               regulator-name = "buck3";
+                               regulator-min-microvolt = <700000>;
+                               regulator-max-microvolt = <1300000>;
+                               regulator-boot-on;
+                               rohm,dvs-run-voltage = <900000>;
+                       };
+
+                       buck4: BUCK4 {
+                               regulator-name = "buck4";
+                               regulator-min-microvolt = <700000>;
+                               regulator-max-microvolt = <1300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                               rohm,dvs-run-voltage = <900000>;
+                       };
+
+                       buck5: BUCK5 {
+                               regulator-name = "buck5";
+                               regulator-min-microvolt = <700000>;
+                               regulator-max-microvolt = <1350000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       buck6: BUCK6 {
+                               regulator-name = "buck6";
+                               regulator-min-microvolt = <3000000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       buck7: BUCK7 {
+                               regulator-name = "buck7";
+                               regulator-min-microvolt = <1605000>;
+                               regulator-max-microvolt = <1995000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       buck8: BUCK8 {
+                               regulator-name = "buck8";
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <1400000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo1: LDO1 {
+                               regulator-name = "ldo1";
+                               regulator-min-microvolt = <3000000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo2: LDO2 {
+                               regulator-name = "ldo2";
+                               regulator-min-microvolt = <900000>;
+                               regulator-max-microvolt = <900000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo3: LDO3 {
+                               regulator-name = "ldo3";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo4: LDO4 {
+                               regulator-name = "ldo4";
+                               regulator-min-microvolt = <900000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo5: LDO5 {
+                               regulator-name = "ldo5";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo6: LDO6 {
+                               regulator-name = "ldo6";
+                               regulator-min-microvolt = <900000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo7: LDO7 {
+                               regulator-name = "ldo7";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+               };
+       };
+};
+
+&fec1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_fec1>;
+       phy-mode = "rgmii-id";
+       phy-handle = <&ethphy0>;
+       phy-reset-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
+       phy-reset-duration = <10>;
+       phy-reset-post-delay = <50>;
+       fsl,magic-packet;
+       status = "okay";
+
+       mdio {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               ethphy0: ethernet-phy@0 {
+                       compatible = "ethernet-phy-ieee802.3-c22";
+                       reg = <0>;
+               };
+       };
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       status = "okay";
+};
+
+&usdhc1 {
+       pinctrl-names = "default", "state_100mhz", "state_200mhz";
+       pinctrl-0 = <&pinctrl_usdhc1>;
+       pinctrl-1 = <&pinctrl_usdhc1_100mhz>;
+       pinctrl-2 = <&pinctrl_usdhc1_200mhz>;
+       bus-width = <8>;
+       non-removable;
+       status = "okay";
+};
+
+&usdhc2 {
+       pinctrl-names = "default", "state_100mhz", "state_200mhz";
+       pinctrl-0 = <&pinctrl_usdhc2>, <&pinctrl_usdhc2_gpio>;
+       pinctrl-1 = <&pinctrl_usdhc2_100mhz>, <&pinctrl_usdhc2_gpio>;
+       pinctrl-2 = <&pinctrl_usdhc2_200mhz>, <&pinctrl_usdhc2_gpio>;
+       bus-width = <4>;
+       cd-gpios = <&gpio2 12 GPIO_ACTIVE_LOW>;
+       vmmc-supply = <&reg_usdhc2_vmmc>;
+       status = "okay";
+};
+
+&usb3_phy0 {
+       status = "okay";
+};
+
+&usb_dwc3_0 {
+       dr_mode = "otg";
+       status = "okay";
+};
+
+&usb3_phy1 {
+       status = "okay";
+};
+
+&usb_dwc3_1 {
+       dr_mode = "host";
+       status = "okay";
+};
+
+&wdog1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_wdog>;
+       fsl,ext-reset-output;
+       status = "okay";
+};
+
+&iomuxc {
+       pinctrl_fec1: fec1grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_ENET_MDC_ENET1_MDC                 0x3
+                       MX8MQ_IOMUXC_ENET_MDIO_ENET1_MDIO               0x23
+                       MX8MQ_IOMUXC_ENET_TD3_ENET1_RGMII_TD3           0x1f
+                       MX8MQ_IOMUXC_ENET_TD2_ENET1_RGMII_TD2           0x1f
+                       MX8MQ_IOMUXC_ENET_TD1_ENET1_RGMII_TD1           0x1f
+                       MX8MQ_IOMUXC_ENET_TD0_ENET1_RGMII_TD0           0x1f
+                       MX8MQ_IOMUXC_ENET_RD3_ENET1_RGMII_RD3           0x91
+                       MX8MQ_IOMUXC_ENET_RD2_ENET1_RGMII_RD2           0x91
+                       MX8MQ_IOMUXC_ENET_RD1_ENET1_RGMII_RD1           0x91
+                       MX8MQ_IOMUXC_ENET_RD0_ENET1_RGMII_RD0           0x91
+                       MX8MQ_IOMUXC_ENET_TXC_ENET1_RGMII_TXC           0x1f
+                       MX8MQ_IOMUXC_ENET_RXC_ENET1_RGMII_RXC           0x91
+                       MX8MQ_IOMUXC_ENET_RX_CTL_ENET1_RGMII_RX_CTL     0x91
+                       MX8MQ_IOMUXC_ENET_TX_CTL_ENET1_RGMII_TX_CTL     0x1f
+                       MX8MQ_IOMUXC_GPIO1_IO09_GPIO1_IO9               0x19
+               >;
+       };
+
+       pinctrl_i2c1: i2c1grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_I2C1_SCL_I2C1_SCL                  0x4000007f
+                       MX8MQ_IOMUXC_I2C1_SDA_I2C1_SDA                  0x4000007f
+               >;
+       };
+
+       pinctrl_pmic: pmicirq {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_GPIO1_IO03_GPIO1_IO3       0x41
+               >;
+       };
+
+       pinctrl_uart1: uart1grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_UART1_RXD_UART1_DCE_RX             0x49
+                       MX8MQ_IOMUXC_UART1_TXD_UART1_DCE_TX             0x49
+               >;
+       };
+
+       pinctrl_usdhc1: usdhc1grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_SD1_CLK_USDHC1_CLK                 0x83
+                       MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD                 0xc3
+                       MX8MQ_IOMUXC_SD1_DATA0_USDHC1_DATA0             0xc3
+                       MX8MQ_IOMUXC_SD1_DATA1_USDHC1_DATA1             0xc3
+                       MX8MQ_IOMUXC_SD1_DATA2_USDHC1_DATA2             0xc3
+                       MX8MQ_IOMUXC_SD1_DATA3_USDHC1_DATA3             0xc3
+                       MX8MQ_IOMUXC_SD1_DATA4_USDHC1_DATA4             0xc3
+                       MX8MQ_IOMUXC_SD1_DATA5_USDHC1_DATA5             0xc3
+                       MX8MQ_IOMUXC_SD1_DATA6_USDHC1_DATA6             0xc3
+                       MX8MQ_IOMUXC_SD1_DATA7_USDHC1_DATA7             0xc3
+                       MX8MQ_IOMUXC_SD1_STROBE_USDHC1_STROBE           0x83
+                       MX8MQ_IOMUXC_SD1_RESET_B_USDHC1_RESET_B         0xc1
+               >;
+       };
+
+       pinctrl_usdhc1_100mhz: usdhc1grp100mhz {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_SD1_CLK_USDHC1_CLK                 0x85
+                       MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD                 0xc5
+                       MX8MQ_IOMUXC_SD1_DATA0_USDHC1_DATA0             0xc5
+                       MX8MQ_IOMUXC_SD1_DATA1_USDHC1_DATA1             0xc5
+                       MX8MQ_IOMUXC_SD1_DATA2_USDHC1_DATA2             0xc5
+                       MX8MQ_IOMUXC_SD1_DATA3_USDHC1_DATA3             0xc5
+                       MX8MQ_IOMUXC_SD1_DATA4_USDHC1_DATA4             0xc5
+                       MX8MQ_IOMUXC_SD1_DATA5_USDHC1_DATA5             0xc5
+                       MX8MQ_IOMUXC_SD1_DATA6_USDHC1_DATA6             0xc5
+                       MX8MQ_IOMUXC_SD1_DATA7_USDHC1_DATA7             0xc5
+                       MX8MQ_IOMUXC_SD1_STROBE_USDHC1_STROBE           0x85
+                       MX8MQ_IOMUXC_SD1_RESET_B_USDHC1_RESET_B         0xc1
+               >;
+       };
+
+       pinctrl_usdhc1_200mhz: usdhc1grp200mhz {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_SD1_CLK_USDHC1_CLK                 0x87
+                       MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD                 0xc7
+                       MX8MQ_IOMUXC_SD1_DATA0_USDHC1_DATA0             0xc7
+                       MX8MQ_IOMUXC_SD1_DATA1_USDHC1_DATA1             0xc7
+                       MX8MQ_IOMUXC_SD1_DATA2_USDHC1_DATA2             0xc7
+                       MX8MQ_IOMUXC_SD1_DATA3_USDHC1_DATA3             0xc7
+                       MX8MQ_IOMUXC_SD1_DATA4_USDHC1_DATA4             0xc7
+                       MX8MQ_IOMUXC_SD1_DATA5_USDHC1_DATA5             0xc7
+                       MX8MQ_IOMUXC_SD1_DATA6_USDHC1_DATA6             0xc7
+                       MX8MQ_IOMUXC_SD1_DATA7_USDHC1_DATA7             0xc7
+                       MX8MQ_IOMUXC_SD1_STROBE_USDHC1_STROBE           0x87
+                       MX8MQ_IOMUXC_SD1_RESET_B_USDHC1_RESET_B         0xc1
+               >;
+       };
+
+       pinctrl_usdhc2_gpio: usdhc2grpgpio {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_SD2_CD_B_GPIO2_IO12        0x41
+                       MX8MQ_IOMUXC_SD2_RESET_B_GPIO2_IO19     0x41
+               >;
+       };
+
+       pinctrl_usdhc2: usdhc2grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK                 0x83
+                       MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD                 0xc3
+                       MX8MQ_IOMUXC_SD2_DATA0_USDHC2_DATA0             0xc3
+                       MX8MQ_IOMUXC_SD2_DATA1_USDHC2_DATA1             0xc3
+                       MX8MQ_IOMUXC_SD2_DATA2_USDHC2_DATA2             0xc3
+                       MX8MQ_IOMUXC_SD2_DATA3_USDHC2_DATA3             0xc3
+                       MX8MQ_IOMUXC_GPIO1_IO04_USDHC2_VSELECT          0xc1
+               >;
+       };
+
+       pinctrl_usdhc2_100mhz: usdhc2grp100mhz {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK                 0x85
+                       MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD                 0xc5
+                       MX8MQ_IOMUXC_SD2_DATA0_USDHC2_DATA0             0xc5
+                       MX8MQ_IOMUXC_SD2_DATA1_USDHC2_DATA1             0xc5
+                       MX8MQ_IOMUXC_SD2_DATA2_USDHC2_DATA2             0xc5
+                       MX8MQ_IOMUXC_SD2_DATA3_USDHC2_DATA3             0xc5
+                       MX8MQ_IOMUXC_GPIO1_IO04_USDHC2_VSELECT          0xc1
+               >;
+       };
+
+       pinctrl_usdhc2_200mhz: usdhc2grp200mhz {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK                 0x87
+                       MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD                 0xc7
+                       MX8MQ_IOMUXC_SD2_DATA0_USDHC2_DATA0             0xc7
+                       MX8MQ_IOMUXC_SD2_DATA1_USDHC2_DATA1             0xc7
+                       MX8MQ_IOMUXC_SD2_DATA2_USDHC2_DATA2             0xc7
+                       MX8MQ_IOMUXC_SD2_DATA3_USDHC2_DATA3             0xc7
+                       MX8MQ_IOMUXC_GPIO1_IO04_USDHC2_VSELECT          0xc1
+               >;
+       };
+
+       pinctrl_wdog: wdoggrp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_GPIO1_IO02_WDOG1_WDOG_B 0xc6
+               >;
+       };
+};
index a2a2c07dcc1f8c97408a95b78fb1749b73c13ceb..61b1433af9192044a34ccf66763f2142a44288ab 100644 (file)
@@ -1,84 +1,10 @@
 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
- * (C) Copyright 2017 Rockchip Electronics Co., Ltd
+ * (C) Copyright 2020 Rockchip Electronics Co., Ltd
  */
 
-/ {
-       aliases {
-               mmc0 = &emmc;
-               mmc1 = &sdmmc;
-       };
+#include "px30-u-boot.dtsi"
 
-       chosen {
-               u-boot,spl-boot-order = &emmc, &sdmmc;
-       };
-};
-
-&dmc {
-       u-boot,dm-pre-reloc;
-};
-
-&uart2 {
-       clock-frequency = <24000000>;
-       u-boot,dm-pre-reloc;
-};
-
-&uart5 {
-       clock-frequency = <24000000>;
-       u-boot,dm-pre-reloc;
-};
-
-&sdmmc {
-       u-boot,dm-pre-reloc;
-
-       /* mmc to sram can't do dma, prevent aborts transfering TF-A parts */
-       u-boot,spl-fifo-mode;
-};
-
-&emmc {
-       u-boot,dm-pre-reloc;
-
-       /* mmc to sram can't do dma, prevent aborts transfering TF-A parts */
-       u-boot,spl-fifo-mode;
-};
-
-&grf {
-       u-boot,dm-pre-reloc;
-};
-
-&pmugrf {
-       u-boot,dm-pre-reloc;
-};
-
-&xin24m {
-       u-boot,dm-pre-reloc;
-};
-
-&cru {
-       u-boot,dm-pre-reloc;
-};
-
-&pmucru {
-       u-boot,dm-pre-reloc;
-};
-
-&saradc {
-       u-boot,dm-pre-reloc;
+&rng {
        status = "okay";
 };
-
-&gpio0 {
-       u-boot,dm-pre-reloc;
-};
-
-&gpio1 {
-       u-boot,dm-pre-reloc;
-};
-
-&gpio2 {
-       u-boot,dm-pre-reloc;
-};
-
-&gpio3 {
-       u-boot,dm-pre-reloc;
-};
index d886f17242fcb17aa3f06cbb540ddcbed287212c..4134e2ee13d8e39097dffce63c4efb63863885db 100644 (file)
@@ -8,7 +8,6 @@
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/pinctrl/rockchip.h>
 #include "px30.dtsi"
-#include "px30-evb-u-boot.dtsi"
 
 / {
        model = "Rockchip PX30 EVB";
index bb782b4e2df138afb9425806c71e4b5dfe882d40..aea9f4d6e51f35600676c6815d82f55b1ec64613 100644 (file)
@@ -1,84 +1,6 @@
 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
- * (C) Copyright 2019 Rockchip Electronics Co., Ltd
+ * (C) Copyright 2020 Rockchip Electronics Co., Ltd
  */
 
-/ {
-       aliases {
-               mmc0 = &emmc;
-               mmc1 = &sdmmc;
-       };
-
-       chosen {
-               u-boot,spl-boot-order = &emmc, &sdmmc;
-       };
-};
-
-&dmc {
-       u-boot,dm-pre-reloc;
-};
-
-&uart2 {
-       clock-frequency = <24000000>;
-       u-boot,dm-pre-reloc;
-};
-
-&uart5 {
-       clock-frequency = <24000000>;
-       u-boot,dm-pre-reloc;
-};
-
-&sdmmc {
-       u-boot,dm-pre-reloc;
-
-       /* mmc to sram can't do dma, prevent aborts transferring TF-A parts */
-       u-boot,spl-fifo-mode;
-};
-
-&emmc {
-       u-boot,dm-pre-reloc;
-
-       /* mmc to sram can't do dma, prevent aborts transferring TF-A parts */
-       u-boot,spl-fifo-mode;
-};
-
-&grf {
-       u-boot,dm-pre-reloc;
-};
-
-&pmugrf {
-       u-boot,dm-pre-reloc;
-};
-
-&xin24m {
-       u-boot,dm-pre-reloc;
-};
-
-&cru {
-       u-boot,dm-pre-reloc;
-};
-
-&pmucru {
-       u-boot,dm-pre-reloc;
-};
-
-&saradc {
-       u-boot,dm-pre-reloc;
-       status = "okay";
-};
-
-&gpio0 {
-       u-boot,dm-pre-reloc;
-};
-
-&gpio1 {
-       u-boot,dm-pre-reloc;
-};
-
-&gpio2 {
-       u-boot,dm-pre-reloc;
-};
-
-&gpio3 {
-       u-boot,dm-pre-reloc;
-};
+#include "px30-u-boot.dtsi"
diff --git a/arch/arm/dts/px30-u-boot.dtsi b/arch/arm/dts/px30-u-boot.dtsi
new file mode 100644 (file)
index 0000000..029c8fb
--- /dev/null
@@ -0,0 +1,90 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * (C) Copyright 2019 Rockchip Electronics Co., Ltd
+ */
+
+/ {
+       aliases {
+               mmc0 = &emmc;
+               mmc1 = &sdmmc;
+       };
+
+       chosen {
+               u-boot,spl-boot-order = &emmc, &sdmmc;
+       };
+
+       rng: rng@ff0b0000 {
+               compatible = "rockchip,cryptov2-rng";
+               reg = <0x0 0xff0b0000 0x0 0x4000>;
+               status = "disabled";
+       };
+};
+
+&dmc {
+       u-boot,dm-pre-reloc;
+};
+
+&uart2 {
+       clock-frequency = <24000000>;
+       u-boot,dm-pre-reloc;
+};
+
+&uart5 {
+       clock-frequency = <24000000>;
+       u-boot,dm-pre-reloc;
+};
+
+&sdmmc {
+       u-boot,dm-pre-reloc;
+
+       /* mmc to sram can't do dma, prevent aborts transferring TF-A parts */
+       u-boot,spl-fifo-mode;
+};
+
+&emmc {
+       u-boot,dm-pre-reloc;
+
+       /* mmc to sram can't do dma, prevent aborts transferring TF-A parts */
+       u-boot,spl-fifo-mode;
+};
+
+&grf {
+       u-boot,dm-pre-reloc;
+};
+
+&pmugrf {
+       u-boot,dm-pre-reloc;
+};
+
+&xin24m {
+       u-boot,dm-pre-reloc;
+};
+
+&cru {
+       u-boot,dm-pre-reloc;
+};
+
+&pmucru {
+       u-boot,dm-pre-reloc;
+};
+
+&saradc {
+       u-boot,dm-pre-reloc;
+       status = "okay";
+};
+
+&gpio0 {
+       u-boot,dm-pre-reloc;
+};
+
+&gpio1 {
+       u-boot,dm-pre-reloc;
+};
+
+&gpio2 {
+       u-boot,dm-pre-reloc;
+};
+
+&gpio3 {
+       u-boot,dm-pre-reloc;
+};
index 4a827063c55571f3ef50139890e590464c9b0674..4bfa0c2330ba436c0a45bfca0a7d04e640c8bca2 100644 (file)
@@ -6,6 +6,45 @@
 #include "rk3328-u-boot.dtsi"
 #include "rk3328-sdram-ddr3-666.dtsi"
 
+/{
+       gmac_clkin: external-gmac-clock {
+               compatible = "fixed-clock";
+               clock-frequency = <125000000>;
+               clock-output-names = "gmac_clkin";
+               #clock-cells = <0>;
+       };
+
+       vcc5v0_host_xhci: vcc5v0-host-xhci-drv {
+               compatible = "regulator-fixed";
+               enable-active-high;
+               gpio = <&gpio0 0 GPIO_ACTIVE_HIGH>;
+               regulator-name = "vcc5v0_host_xhci";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+       };
+};
+
+&gmac2io {
+       phy-supply = <&vcc_phy>;
+       phy-mode = "rgmii";
+       clock_in_out = "input";
+       snps,reset-gpio = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>;
+       snps,reset-active-low;
+       snps,reset-delays-us = <0 10000 50000>;
+       assigned-clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_EXT>;
+       assigned-clock-parents = <&gmac_clkin>, <&gmac_clkin>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&rgmiim1_pins>;
+       tx_delay = <0x26>;
+       rx_delay = <0x11>;
+       status = "okay";
+};
+
+&gmac2phy {
+       /* Integrated PHY unsupported by U-boot */
+       status = "broken";
+};
+
 &usb_host0_xhci {
        vbus-supply = <&vcc5v0_host_xhci>;
        status = "okay";
index a2ee838fcd6baeed47d81577afdf9cee59383cd2..6abc6f4a86cfbf38bf2c7c9411a8a4fecb6426b1 100644 (file)
@@ -1,6 +1,6 @@
-// SPDX-License-Identifier: GPL-2.0+
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
- * (C) Copyright 2016 Rockchip Electronics Co., Ltd
+ * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd
  */
 
 /dts-v1/;
        compatible = "rockchip,rk3328-evb", "rockchip,rk3328";
 
        chosen {
-               stdout-path = &uart2;
+               stdout-path = "serial2:1500000n8";
        };
 
-       gmac_clkin: external-gmac-clock {
-               compatible = "fixed-clock";
-               clock-frequency = <125000000>;
-               clock-output-names = "gmac_clkin";
-               #clock-cells = <0>;
-       };
-
-       vcc3v3_sdmmc: sdmmc-pwren {
+       dc_12v: dc-12v {
                compatible = "regulator-fixed";
-               regulator-name = "vcc3v3";
-               gpio = <&gpio0 30 GPIO_ACTIVE_LOW>;
+               regulator-name = "dc_12v";
                regulator-always-on;
                regulator-boot-on;
+               regulator-min-microvolt = <12000000>;
+               regulator-max-microvolt = <12000000>;
+       };
+
+       sdio_pwrseq: sdio-pwrseq {
+               compatible = "mmc-pwrseq-simple";
+               pinctrl-names = "default";
+               pinctrl-0 = <&wifi_enable_h>;
+
+               /*
+                * On the module itself this is one of these (depending
+                * on the actual card populated):
+                * - SDIO_RESET_L_WL_REG_ON
+                * - PDN (power down when low)
+                */
+               reset-gpios = <&gpio1 18 GPIO_ACTIVE_LOW>;
        };
 
-       vcc5v0_otg: vcc5v0-otg-drv {
+       vcc_sd: sdmmc-regulator {
                compatible = "regulator-fixed";
-               enable-active-high;
-               regulator-name = "vcc5v0_otg";
-               gpio = <&gpio0 27 GPIO_ACTIVE_HIGH>;
-               regulator-min-microvolt = <5000000>;
-               regulator-max-microvolt = <5000000>;
+               gpio = <&gpio0 30 GPIO_ACTIVE_LOW>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&sdmmc0m1_gpio>;
+               regulator-name = "vcc_sd";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               vin-supply = <&vcc_io>;
        };
 
-       vcc5v0_host_xhci: vcc5v0-host-xhci-drv {
+       vcc_sys: vcc-sys {
                compatible = "regulator-fixed";
-               enable-active-high;
-               regulator-name = "vcc5v0_host_xhci";
-               gpio = <&gpio0 0 GPIO_ACTIVE_HIGH>;
+               regulator-name = "vcc_sys";
+               regulator-always-on;
+               regulator-boot-on;
                regulator-min-microvolt = <5000000>;
                regulator-max-microvolt = <5000000>;
+               vin-supply = <&dc_12v>;
        };
 
        vcc_phy: vcc-phy-regulator {
        };
 };
 
-&saradc {
-       status = "okay";
-};
-
-&uart2 {
-       status = "okay";
-};
-
-&sdmmc {
-       bus-width = <4>;
-       cap-mmc-highspeed;
-       cap-sd-highspeed;
-       card-detect-delay = <200>;
-       disable-wp;
-       num-slots = <1>;
-       pinctrl-names = "default";
-       pinctrl-0 = <&sdmmc0_clk>, <&sdmmc0_cmd>, <&sdmmc0_dectn>, <&sdmmc0_bus4>;
-       status = "okay";
+&cpu0 {
+       cpu-supply = <&vdd_arm>;
 };
 
 &emmc {
        bus-width = <8>;
        cap-mmc-highspeed;
-       supports-emmc;
-       disable-wp;
        non-removable;
-       num-slots = <1>;
        pinctrl-names = "default";
        pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>;
        status = "okay";
 };
 
-&gmac2io {
+&gmac2phy {
        phy-supply = <&vcc_phy>;
-       phy-mode = "rgmii";
-       clock_in_out = "input";
-       snps,reset-gpio = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>;
-       snps,reset-active-low;
-       snps,reset-delays-us = <0 10000 50000>;
-       assigned-clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_EXT>;
-       assigned-clock-parents = <&gmac_clkin>, <&gmac_clkin>;
-       pinctrl-names = "default";
-       pinctrl-0 = <&rgmiim1_pins>;
-       tx_delay = <0x26>;
-       rx_delay = <0x11>;
-       status = "okay";
-};
-
-&usb_host0_ehci {
-       status = "okay";
-};
+       clock_in_out = "output";
+       assigned-clocks = <&cru SCLK_MAC2PHY_SRC>;
+       assigned-clock-rate = <50000000>;
+       assigned-clocks = <&cru SCLK_MAC2PHY>;
+       assigned-clock-parents = <&cru SCLK_MAC2PHY_SRC>;
 
-&usb_host0_ohci {
-       status = "okay";
-};
-
-&usb20_otg {
-       vbus-supply = <&vcc5v0_otg>;
-       status = "okay";
 };
 
 &i2c1 {
-       clock-frequency = <400000>;
-       i2c-scl-rising-time-ns = <168>;
-       i2c-scl-falling-time-ns = <4>;
        status = "okay";
 
        rk805: pmic@18 {
                compatible = "rockchip,rk805";
-               status = "okay";
                reg = <0x18>;
                interrupt-parent = <&gpio2>;
                interrupts = <6 IRQ_TYPE_LEVEL_LOW>;
+               #clock-cells = <1>;
+               clock-output-names = "xin32k", "rk805-clkout2";
+               gpio-controller;
+               #gpio-cells = <2>;
                pinctrl-names = "default";
                pinctrl-0 = <&pmic_int_l>;
                rockchip,system-power-controller;
                wakeup-source;
-               gpio-controller;
-               #gpio-cells = <2>;
-               #clock-cells = <1>;
-               clock-output-names = "xin32k", "rk805-clkout2";
+
+               vcc1-supply = <&vcc_sys>;
+               vcc2-supply = <&vcc_sys>;
+               vcc3-supply = <&vcc_sys>;
+               vcc4-supply = <&vcc_sys>;
+               vcc5-supply = <&vcc_io>;
+               vcc6-supply = <&vcc_io>;
 
                regulators {
                        vdd_logic: DCDC_REG1 {
                                regulator-name = "vdd_logic";
                                regulator-min-microvolt = <712500>;
                                regulator-max-microvolt = <1450000>;
-                               regulator-ramp-delay = <6001>;
-                               regulator-boot-on;
                                regulator-always-on;
+                               regulator-boot-on;
                                regulator-state-mem {
                                        regulator-on-in-suspend;
                                        regulator-suspend-microvolt = <1000000>;
                                regulator-name = "vdd_arm";
                                regulator-min-microvolt = <712500>;
                                regulator-max-microvolt = <1450000>;
-                               regulator-ramp-delay = <6001>;
-                               regulator-boot-on;
                                regulator-always-on;
+                               regulator-boot-on;
                                regulator-state-mem {
                                        regulator-on-in-suspend;
-                                       regulator-suspend-microvolt = <1000000>;
+                                       regulator-suspend-microvolt = <950000>;
                                };
                        };
 
                        vcc_ddr: DCDC_REG3 {
                                regulator-name = "vcc_ddr";
-                               regulator-boot-on;
                                regulator-always-on;
+                               regulator-boot-on;
                                regulator-state-mem {
                                        regulator-on-in-suspend;
                                };
                                regulator-name = "vcc_io";
                                regulator-min-microvolt = <3300000>;
                                regulator-max-microvolt = <3300000>;
-                               regulator-boot-on;
                                regulator-always-on;
+                               regulator-boot-on;
                                regulator-state-mem {
                                        regulator-on-in-suspend;
                                        regulator-suspend-microvolt = <3300000>;
                                };
                        };
 
-                       vdd_18: LDO_REG1 {
-                               regulator-name = "vdd_18";
+                       vcc_18: LDO_REG1 {
+                               regulator-name = "vcc_18";
                                regulator-min-microvolt = <1800000>;
                                regulator-max-microvolt = <1800000>;
-                               regulator-boot-on;
                                regulator-always-on;
+                               regulator-boot-on;
                                regulator-state-mem {
                                        regulator-on-in-suspend;
                                        regulator-suspend-microvolt = <1800000>;
                                };
                        };
 
-                       vcc_18emmc: LDO_REG2 {
-                               regulator-name = "vcc_18emmc";
+                       vcc18_emmc: LDO_REG2 {
+                               regulator-name = "vcc18_emmc";
                                regulator-min-microvolt = <1800000>;
                                regulator-max-microvolt = <1800000>;
-                               regulator-boot-on;
                                regulator-always-on;
+                               regulator-boot-on;
                                regulator-state-mem {
                                        regulator-on-in-suspend;
                                        regulator-suspend-microvolt = <1800000>;
                                regulator-name = "vdd_10";
                                regulator-min-microvolt = <1000000>;
                                regulator-max-microvolt = <1000000>;
-                               regulator-boot-on;
                                regulator-always-on;
+                               regulator-boot-on;
                                regulator-state-mem {
                                        regulator-on-in-suspend;
                                        regulator-suspend-microvolt = <1000000>;
 &pinctrl {
        pmic {
                pmic_int_l: pmic-int-l {
+                       rockchip,pins = <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>;
+               };
+       };
+
+       sdio-pwrseq {
+               wifi_enable_h: wifi-enable-h {
                rockchip,pins =
-                       <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>;  /* gpio2_a6 */
+                       <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
 
+&sdio {
+       bus-width = <4>;
+       cap-sd-highspeed;
+       cap-sdio-irq;
+       keep-power-in-suspend;
+       max-frequency = <150000000>;
+       mmc-pwrseq = <&sdio_pwrseq>;
+       non-removable;
+       pinctrl-names = "default";
+       pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_cmd &sdmmc1_clk>;
+       status = "okay";
+};
+
+&sdmmc {
+       bus-width = <4>;
+       cap-mmc-highspeed;
+       cap-sd-highspeed;
+       disable-wp;
+       max-frequency = <150000000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_dectn &sdmmc0_bus4>;
+       vmmc-supply = <&vcc_sd>;
+       status = "okay";
+};
+
+&tsadc {
+       status = "okay";
+};
+
+&uart2 {
+       status = "okay";
+};
+
+&u2phy {
+       status = "okay";
+};
+
+&u2phy_host {
+       status = "okay";
+};
+
+&u2phy_otg {
+       status = "okay";
+};
+
+&usb20_otg {
+       status = "okay";
+};
+
+&usb_host0_ehci {
+       status = "okay";
+};
+
+&usb_host0_ohci {
+       status = "okay";
+};
diff --git a/arch/arm/dts/rk3328-roc-cc-u-boot.dtsi b/arch/arm/dts/rk3328-roc-cc-u-boot.dtsi
new file mode 100644 (file)
index 0000000..e929d86
--- /dev/null
@@ -0,0 +1,47 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2018-2019 Rockchip Electronics Co., Ltd
+ */
+
+#include "rk3328-u-boot.dtsi"
+#include "rk3328-sdram-ddr4-666.dtsi"
+/ {
+       chosen {
+               u-boot,spl-boot-order = "same-as-spl", &sdmmc, &emmc;
+       };
+};
+
+&gpio0 {
+       u-boot,dm-spl;
+};
+
+&pinctrl {
+       u-boot,dm-spl;
+};
+
+&sdmmc0m1_gpio {
+       u-boot,dm-spl;
+};
+
+&pcfg_pull_up_4ma {
+       u-boot,dm-spl;
+};
+
+&usb_host0_xhci {
+       vbus-supply = <&vcc_host1_5v>;
+       status = "okay";
+};
+
+/*
+ * This makes XHCI responsible for toggling VBUS. This is needed to work
+ * around an issue where either XHCI only works with USB 2.0 or OTG doesn't
+ * work, depending on how VBUS is configured. Having USB 3.0 seems better.
+ */
+&vcc_host1_5v {
+       /delete-property/ regulator-always-on;
+};
+
+/* Need this and all the pinctrl/gpio stuff above to set pinmux */
+&vcc_sd {
+       u-boot,dm-spl;
+};
diff --git a/arch/arm/dts/rk3328-roc-cc.dts b/arch/arm/dts/rk3328-roc-cc.dts
new file mode 100644 (file)
index 0000000..8d553c9
--- /dev/null
@@ -0,0 +1,354 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2017 T-Chip Intelligent Technology Co., Ltd
+ */
+
+/dts-v1/;
+#include "rk3328.dtsi"
+
+/ {
+       model = "Firefly roc-rk3328-cc";
+       compatible = "firefly,roc-rk3328-cc", "rockchip,rk3328";
+
+       chosen {
+               stdout-path = "serial2:1500000n8";
+       };
+
+       gmac_clkin: external-gmac-clock {
+               compatible = "fixed-clock";
+               clock-frequency = <125000000>;
+               clock-output-names = "gmac_clkin";
+               #clock-cells = <0>;
+       };
+
+       dc_12v: dc-12v {
+               compatible = "regulator-fixed";
+               regulator-name = "dc_12v";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <12000000>;
+               regulator-max-microvolt = <12000000>;
+       };
+
+       vcc_sd: sdmmc-regulator {
+               compatible = "regulator-fixed";
+               gpio = <&gpio0 RK_PD6 GPIO_ACTIVE_LOW>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&sdmmc0m1_gpio>;
+               regulator-boot-on;
+               regulator-name = "vcc_sd";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               vin-supply = <&vcc_io>;
+       };
+
+       vcc_sdio: sdmmcio-regulator {
+               compatible = "regulator-gpio";
+               gpios = <&grf_gpio 0 GPIO_ACTIVE_HIGH>;
+               states = <1800000 0x1
+                         3300000 0x0>;
+               regulator-name = "vcc_sdio";
+               regulator-type = "voltage";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-always-on;
+               vin-supply = <&vcc_sys>;
+       };
+
+       vcc_host1_5v: vcc_otg_5v: vcc-host1-5v-regulator {
+               compatible = "regulator-fixed";
+               enable-active-high;
+               gpio = <&gpio1 RK_PD2 GPIO_ACTIVE_HIGH>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&usb20_host_drv>;
+               regulator-name = "vcc_host1_5v";
+               regulator-always-on;
+               vin-supply = <&vcc_sys>;
+       };
+
+       vcc_sys: vcc-sys {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc_sys";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               vin-supply = <&dc_12v>;
+       };
+
+       vcc_phy: vcc-phy-regulator {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc_phy";
+               regulator-always-on;
+               regulator-boot-on;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               power {
+                       label = "firefly:blue:power";
+                       linux,default-trigger = "heartbeat";
+                       gpios = <&rk805 1 GPIO_ACTIVE_LOW>;
+                       default-state = "on";
+                       mode = <0x23>;
+               };
+
+               user {
+                       label = "firefly:yellow:user";
+                       linux,default-trigger = "mmc1";
+                       gpios = <&rk805 0 GPIO_ACTIVE_LOW>;
+                       default-state = "off";
+                       mode = <0x05>;
+               };
+       };
+};
+
+&cpu0 {
+       cpu-supply = <&vdd_arm>;
+};
+
+&cpu1 {
+       cpu-supply = <&vdd_arm>;
+};
+
+&cpu2 {
+       cpu-supply = <&vdd_arm>;
+};
+
+&cpu3 {
+       cpu-supply = <&vdd_arm>;
+};
+
+&emmc {
+       bus-width = <8>;
+       cap-mmc-highspeed;
+       max-frequency = <150000000>;
+       mmc-ddr-1_8v;
+       mmc-hs200-1_8v;
+       non-removable;
+       pinctrl-names = "default";
+       pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>;
+       vmmc-supply = <&vcc_io>;
+       vqmmc-supply = <&vcc18_emmc>;
+       status = "okay";
+};
+
+&gmac2io {
+       assigned-clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_EXT>;
+       assigned-clock-parents = <&gmac_clkin>, <&gmac_clkin>;
+       clock_in_out = "input";
+       phy-supply = <&vcc_phy>;
+       phy-mode = "rgmii";
+       pinctrl-names = "default";
+       pinctrl-0 = <&rgmiim1_pins>;
+       snps,aal;
+       snps,reset-gpio = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>;
+       snps,reset-active-low;
+       snps,reset-delays-us = <0 10000 50000>;
+       snps,rxpbl = <0x4>;
+       snps,txpbl = <0x4>;
+       tx_delay = <0x24>;
+       rx_delay = <0x18>;
+       status = "okay";
+};
+
+&hdmi {
+       status = "okay";
+};
+
+&hdmiphy {
+       status = "okay";
+};
+
+&i2c1 {
+       status = "okay";
+
+       rk805: pmic@18 {
+               compatible = "rockchip,rk805";
+               reg = <0x18>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <24 IRQ_TYPE_LEVEL_LOW>;
+               #clock-cells = <1>;
+               clock-output-names = "xin32k", "rk805-clkout2";
+               gpio-controller;
+               #gpio-cells = <2>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pmic_int_l>;
+               rockchip,system-power-controller;
+               wakeup-source;
+
+               vcc1-supply = <&vcc_sys>;
+               vcc2-supply = <&vcc_sys>;
+               vcc3-supply = <&vcc_sys>;
+               vcc4-supply = <&vcc_sys>;
+               vcc5-supply = <&vcc_io>;
+               vcc6-supply = <&vcc_io>;
+
+               regulators {
+                       vdd_logic: DCDC_REG1 {
+                               regulator-name = "vdd_logic";
+                               regulator-min-microvolt = <712500>;
+                               regulator-max-microvolt = <1450000>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <1000000>;
+                               };
+                       };
+
+                       vdd_arm: DCDC_REG2 {
+                               regulator-name = "vdd_arm";
+                               regulator-min-microvolt = <712500>;
+                               regulator-max-microvolt = <1450000>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <950000>;
+                               };
+                       };
+
+                       vcc_ddr: DCDC_REG3 {
+                               regulator-name = "vcc_ddr";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                               };
+                       };
+
+                       vcc_io: DCDC_REG4 {
+                               regulator-name = "vcc_io";
+                               regulator-min-microvolt = <3300000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <3300000>;
+                               };
+                       };
+
+                       vcc_18: LDO_REG1 {
+                               regulator-name = "vcc_18";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <1800000>;
+                               };
+                       };
+
+                       vcc18_emmc: LDO_REG2 {
+                               regulator-name = "vcc18_emmc";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <1800000>;
+                               };
+                       };
+
+                       vdd_10: LDO_REG3 {
+                               regulator-name = "vdd_10";
+                               regulator-min-microvolt = <1000000>;
+                               regulator-max-microvolt = <1000000>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <1000000>;
+                               };
+                       };
+               };
+       };
+};
+
+&io_domains {
+       status = "okay";
+
+       vccio1-supply = <&vcc_io>;
+       vccio2-supply = <&vcc18_emmc>;
+       vccio3-supply = <&vcc_sdio>;
+       vccio4-supply = <&vcc_18>;
+       vccio5-supply = <&vcc_io>;
+       vccio6-supply = <&vcc_io>;
+       pmuio-supply = <&vcc_io>;
+};
+
+&pinctrl {
+       pmic {
+               pmic_int_l: pmic-int-l {
+                       rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>;
+               };
+       };
+
+       usb2 {
+               usb20_host_drv: usb20-host-drv {
+                       rockchip,pins = <1 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+};
+
+&sdmmc {
+       bus-width = <4>;
+       cap-mmc-highspeed;
+       cap-sd-highspeed;
+       disable-wp;
+       max-frequency = <150000000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_dectn &sdmmc0_bus4>;
+       sd-uhs-sdr12;
+       sd-uhs-sdr25;
+       sd-uhs-sdr50;
+       sd-uhs-sdr104;
+       vmmc-supply = <&vcc_sd>;
+       vqmmc-supply = <&vcc_sdio>;
+       status = "okay";
+};
+
+&tsadc {
+       status = "okay";
+};
+
+&u2phy {
+       status = "okay";
+};
+
+&u2phy_host {
+       status = "okay";
+};
+
+&u2phy_otg {
+       status = "okay";
+};
+
+&uart2 {
+       status = "okay";
+};
+
+&usb20_otg {
+       status = "okay";
+};
+
+&usb_host0_ehci {
+       status = "okay";
+};
+
+&usb_host0_ohci {
+       status = "okay";
+};
+
+&vop {
+       status = "okay";
+};
+
+&vop_mmu {
+       status = "okay";
+};
index e5946d2d2dc7c487077331f21380bdc54127139f..8318bf4e6030182e7d2c2f8ae39f62ee428d745f 100644 (file)
 };
 
 &usb_host0_xhci {
+       vbus-supply = <&vcc_host_5v>;
        status = "okay";
 };
+
+/*
+ * This makes XHCI responsible for toggling VBUS. This is needed to work
+ * around an issue where either XHCI only works with USB 2.0 or OTG doesn't
+ * work, depending on how VBUS is configured. Having USB 3.0 seems better.
+ */
+&vcc_host_5v {
+       /delete-property/ regulator-always-on;
+       /delete-property/ regulator-boot-on;
+};
index a78eb4ac6fff0082f5b1391ff5333a70778d96ba..ebf3eb222e1fc73a8fead2caf5aba55be2486cb7 100644 (file)
                vin-supply = <&vcc_sys>;
        };
 
+       vcc_host1_5v: vcc_otg_5v: vcc-host1-5v-regulator {
+               compatible = "regulator-fixed";
+               gpio = <&gpio0 RK_PA2 GPIO_ACTIVE_LOW>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&usb20_host_drv>;
+               regulator-name = "vcc_host1_5v";
+               regulator-always-on;
+               regulator-boot-on;
+               vin-supply = <&vcc_sys>;
+       };
+
        vcc_sys: vcc-sys {
                compatible = "regulator-fixed";
                regulator-name = "vcc_sys";
                regulator-min-microvolt = <5000000>;
                regulator-max-microvolt = <5000000>;
        };
+
+       ir-receiver {
+               compatible = "gpio-ir-receiver";
+               gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>;
+               pinctrl-0 = <&ir_int>;
+               pinctrl-names = "default";
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               power {
+                       gpios = <&rk805 1 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "mmc0";
+               };
+
+               standby {
+                       gpios = <&rk805 0 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "heartbeat";
+               };
+       };
+
+       sound {
+               compatible = "audio-graph-card";
+               label = "rockchip,rk3328";
+               dais = <&i2s1_p0
+                       &spdif_p0>;
+       };
+
+       spdif-dit {
+               compatible = "linux,spdif-dit";
+               #sound-dai-cells = <0>;
+
+               port {
+                       dit_p0_0: endpoint {
+                               remote-endpoint = <&spdif_p0_0>;
+                       };
+               };
+       };
+};
+
+&codec {
+       mute-gpios = <&grf_gpio 0 GPIO_ACTIVE_LOW>;
+       status = "okay";
+
+       port@0 {
+               codec_p0_0: endpoint {
+                       remote-endpoint = <&i2s1_p0_0>;
+               };
+       };
 };
 
 &cpu0 {
        status = "okay";
 };
 
+&hdmi {
+       status = "okay";
+};
+
+&hdmiphy {
+       status = "okay";
+};
+
 &i2c1 {
        status = "okay";
 
-       rk805: rk805@18 {
+       rk805: pmic@18 {
                compatible = "rockchip,rk805";
                reg = <0x18>;
                interrupt-parent = <&gpio2>;
                interrupts = <6 IRQ_TYPE_LEVEL_LOW>;
                #clock-cells = <1>;
                clock-output-names = "xin32k", "rk805-clkout2";
+               gpio-controller;
+               #gpio-cells = <2>;
                pinctrl-names = "default";
                pinctrl-0 = <&pmic_int_l>;
                rockchip,system-power-controller;
                        };
 
                        vcc_18: LDO_REG1 {
-                               regulator-name = "vdd_18";
+                               regulator-name = "vcc_18";
                                regulator-min-microvolt = <1800000>;
                                regulator-max-microvolt = <1800000>;
                                regulator-always-on;
                        };
 
                        vcc18_emmc: LDO_REG2 {
-                               regulator-name = "vcc_18emmc";
+                               regulator-name = "vcc18_emmc";
                                regulator-min-microvolt = <1800000>;
                                regulator-max-microvolt = <1800000>;
                                regulator-always-on;
        };
 };
 
+&i2s1 {
+       status = "okay";
+
+       i2s1_p0: port {
+               i2s1_p0_0: endpoint {
+                       dai-format = "i2s";
+                       mclk-fs = <256>;
+                       remote-endpoint = <&codec_p0_0>;
+               };
+       };
+};
+
 &io_domains {
        status = "okay";
 
 };
 
 &pinctrl {
+       ir {
+               ir_int: ir-int {
+                       rockchip,pins = <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
        pmic {
                pmic_int_l: pmic-int-l {
                        rockchip,pins = <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>;
        status = "okay";
 };
 
+&spdif {
+       pinctrl-0 = <&spdifm0_tx>;
+       status = "okay";
+
+       spdif_p0: port {
+               spdif_p0_0: endpoint {
+                       remote-endpoint = <&dit_p0_0>;
+               };
+       };
+};
+
 &spi0 {
        status = "okay";
 
        };
 };
 
+&tsadc {
+       rockchip,hw-tshut-mode = <0>;
+       rockchip,hw-tshut-polarity = <0>;
+       status = "okay";
+};
+
 &uart2 {
        status = "okay";
 };
 
+&u2phy {
+       status = "okay";
+
+       u2phy_host: host-port {
+               status = "okay";
+       };
+
+       u2phy_otg: otg-port {
+               status = "okay";
+       };
+};
+
 &usb20_otg {
        dr_mode = "host";
        status = "okay";
 &usb_host0_ohci {
        status = "okay";
 };
+
+&vop {
+       status = "okay";
+};
+
+&vop_mmu {
+       status = "okay";
+};
index 6d5b3ec06e072e31e9c1afe76fccb6bbbc02bea0..c69e13e11efe7e53ed7f9e4a64b99629ec3bb1c9 100644 (file)
@@ -62,3 +62,7 @@
        /* mmc to sram can't do dma, prevent aborts transfering TF-A parts */
        u-boot,spl-fifo-mode;
 };
+
+&usb20_otg {
+       hnp-srp-disable;
+};
index 060c84e6c0cfc38cd710da04d941c5b2f9d21a73..945387e579f0e4dca9fe7e7a2551bb850b5a40b1 100644 (file)
@@ -1,6 +1,6 @@
-// SPDX-License-Identifier: GPL-2.0+
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
- * (C) Copyright 2016 Rockchip Electronics Co., Ltd
+ * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd
  */
 
 #include <dt-bindings/clock/rk3328-cru.h>
@@ -8,6 +8,9 @@
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/pinctrl/rockchip.h>
+#include <dt-bindings/power/rk3328-power.h>
+#include <dt-bindings/soc/rockchip,boot-mode.h>
+#include <dt-bindings/thermal/thermal.h>
 
 / {
        compatible = "rockchip,rk3328";
@@ -24,9 +27,8 @@
                i2c1 = &i2c1;
                i2c2 = &i2c2;
                i2c3 = &i2c3;
-               mmc0 = &emmc;
-               mmc1 = &sdmmc;
-               mmc2 = &sdmmc_ext;
+               ethernet0 = &gmac2io;
+               ethernet1 = &gmac2phy;
        };
 
        cpus {
 
                cpu0: cpu@0 {
                        device_type = "cpu";
-                       compatible = "arm,cortex-a53", "arm,armv8";
+                       compatible = "arm,cortex-a53";
                        reg = <0x0 0x0>;
+                       clocks = <&cru ARMCLK>;
+                       #cooling-cells = <2>;
+                       cpu-idle-states = <&CPU_SLEEP>;
+                       dynamic-power-coefficient = <120>;
                        enable-method = "psci";
-//                     clocks = <&cru ARMCLK>;
+                       next-level-cache = <&l2>;
                        operating-points-v2 = <&cpu0_opp_table>;
                };
+
                cpu1: cpu@1 {
                        device_type = "cpu";
-                       compatible = "arm,cortex-a53", "arm,armv8";
+                       compatible = "arm,cortex-a53";
                        reg = <0x0 0x1>;
+                       clocks = <&cru ARMCLK>;
+                       #cooling-cells = <2>;
+                       cpu-idle-states = <&CPU_SLEEP>;
+                       dynamic-power-coefficient = <120>;
                        enable-method = "psci";
+                       next-level-cache = <&l2>;
+                       operating-points-v2 = <&cpu0_opp_table>;
                };
+
                cpu2: cpu@2 {
                        device_type = "cpu";
-                       compatible = "arm,cortex-a53", "arm,armv8";
+                       compatible = "arm,cortex-a53";
                        reg = <0x0 0x2>;
+                       clocks = <&cru ARMCLK>;
+                       #cooling-cells = <2>;
+                       cpu-idle-states = <&CPU_SLEEP>;
+                       dynamic-power-coefficient = <120>;
                        enable-method = "psci";
+                       next-level-cache = <&l2>;
+                       operating-points-v2 = <&cpu0_opp_table>;
                };
+
                cpu3: cpu@3 {
                        device_type = "cpu";
-                       compatible = "arm,cortex-a53", "arm,armv8";
+                       compatible = "arm,cortex-a53";
                        reg = <0x0 0x3>;
+                       clocks = <&cru ARMCLK>;
+                       #cooling-cells = <2>;
+                       cpu-idle-states = <&CPU_SLEEP>;
+                       dynamic-power-coefficient = <120>;
                        enable-method = "psci";
+                       next-level-cache = <&l2>;
+                       operating-points-v2 = <&cpu0_opp_table>;
+               };
+
+               idle-states {
+                       entry-method = "psci";
+
+                       CPU_SLEEP: cpu-sleep {
+                               compatible = "arm,idle-state";
+                               local-timer-stop;
+                               arm,psci-suspend-param = <0x0010000>;
+                               entry-latency-us = <120>;
+                               exit-latency-us = <250>;
+                               min-residency-us = <900>;
+                       };
+               };
+
+               l2: l2-cache0 {
+                       compatible = "cache";
                };
        };
 
                compatible = "operating-points-v2";
                opp-shared;
 
-               opp@408000000 {
+               opp-408000000 {
                        opp-hz = /bits/ 64 <408000000>;
                        opp-microvolt = <950000>;
                        clock-latency-ns = <40000>;
                        opp-suspend;
                };
-               opp@600000000 {
+               opp-600000000 {
                        opp-hz = /bits/ 64 <600000000>;
                        opp-microvolt = <950000>;
                        clock-latency-ns = <40000>;
                };
-               opp@816000000 {
+               opp-816000000 {
                        opp-hz = /bits/ 64 <816000000>;
                        opp-microvolt = <1000000>;
                        clock-latency-ns = <40000>;
                };
-               opp@1008000000 {
+               opp-1008000000 {
                        opp-hz = /bits/ 64 <1008000000>;
                        opp-microvolt = <1100000>;
                        clock-latency-ns = <40000>;
                };
-               opp@1200000000 {
+               opp-1200000000 {
                        opp-hz = /bits/ 64 <1200000000>;
                        opp-microvolt = <1225000>;
                        clock-latency-ns = <40000>;
                };
-               opp@1296000000 {
+               opp-1296000000 {
                        opp-hz = /bits/ 64 <1296000000>;
                        opp-microvolt = <1300000>;
                        clock-latency-ns = <40000>;
                };
        };
 
+       amba: bus {
+               compatible = "simple-bus";
+               #address-cells = <2>;
+               #size-cells = <2>;
+               ranges;
+
+               dmac: dmac@ff1f0000 {
+                       compatible = "arm,pl330", "arm,primecell";
+                       reg = <0x0 0xff1f0000 0x0 0x4000>;
+                       interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cru ACLK_DMAC>;
+                       clock-names = "apb_pclk";
+                       #dma-cells = <1>;
+               };
+       };
+
+       analog_sound: analog-sound {
+               compatible = "simple-audio-card";
+               simple-audio-card,format = "i2s";
+               simple-audio-card,mclk-fs = <256>;
+               simple-audio-card,name = "Analog";
+               status = "disabled";
+
+               simple-audio-card,cpu {
+                       sound-dai = <&i2s1>;
+               };
+
+               simple-audio-card,codec {
+                       sound-dai = <&codec>;
+               };
+       };
+
        arm-pmu {
                compatible = "arm,cortex-a53-pmu";
                interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>,
                interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>;
        };
 
+       display_subsystem: display-subsystem {
+               compatible = "rockchip,display-subsystem";
+               ports = <&vop_out>;
+       };
+
+       hdmi_sound: hdmi-sound {
+               compatible = "simple-audio-card";
+               simple-audio-card,format = "i2s";
+               simple-audio-card,mclk-fs = <128>;
+               simple-audio-card,name = "HDMI";
+               status = "disabled";
+
+               simple-audio-card,cpu {
+                       sound-dai = <&i2s0>;
+               };
+
+               simple-audio-card,codec {
+                       sound-dai = <&hdmi>;
+               };
+       };
+
        psci {
-               compatible = "arm,psci-1.0";
+               compatible = "arm,psci-1.0", "arm,psci-0.2";
                method = "smc";
        };
 
                clocks = <&cru SCLK_I2S0>, <&cru HCLK_I2S0_8CH>;
                clock-names = "i2s_clk", "i2s_hclk";
                dmas = <&dmac 11>, <&dmac 12>;
-               #dma-cells = <2>;
                dma-names = "tx", "rx";
+               #sound-dai-cells = <0>;
                status = "disabled";
        };
 
                clocks = <&cru SCLK_I2S1>, <&cru HCLK_I2S1_8CH>;
                clock-names = "i2s_clk", "i2s_hclk";
                dmas = <&dmac 14>, <&dmac 15>;
-               #dma-cells = <2>;
                dma-names = "tx", "rx";
+               #sound-dai-cells = <0>;
                status = "disabled";
        };
 
                clocks = <&cru SCLK_I2S2>, <&cru HCLK_I2S2_2CH>;
                clock-names = "i2s_clk", "i2s_hclk";
                dmas = <&dmac 0>, <&dmac 1>;
-               #dma-cells = <2>;
                dma-names = "tx", "rx";
-               pinctrl-names = "default", "sleep";
-               pinctrl-0 = <&i2s2m0_mclk
-                            &i2s2m0_sclk
-                            &i2s2m0_lrcktx
-                            &i2s2m0_lrckrx
-                            &i2s2m0_sdo
-                            &i2s2m0_sdi>;
-               pinctrl-1 = <&i2s2m0_sleep>;
+               #sound-dai-cells = <0>;
                status = "disabled";
        };
 
                clocks = <&cru SCLK_SPDIF>, <&cru HCLK_SPDIF_8CH>;
                clock-names = "mclk", "hclk";
                dmas = <&dmac 10>;
-               #dma-cells = <1>;
                dma-names = "tx";
                pinctrl-names = "default";
                pinctrl-0 = <&spdifm2_tx>;
+               #sound-dai-cells = <0>;
+               status = "disabled";
+       };
+
+       pdm: pdm@ff040000 {
+               compatible = "rockchip,pdm";
+               reg = <0x0 0xff040000 0x0 0x1000>;
+               clocks = <&cru SCLK_PDM>, <&cru HCLK_PDM>;
+               clock-names = "pdm_clk", "pdm_hclk";
+               dmas = <&dmac 16>;
+               dma-names = "rx";
+               pinctrl-names = "default", "sleep";
+               pinctrl-0 = <&pdmm0_clk
+                            &pdmm0_sdi0
+                            &pdmm0_sdi1
+                            &pdmm0_sdi2
+                            &pdmm0_sdi3>;
+               pinctrl-1 = <&pdmm0_clk_sleep
+                            &pdmm0_sdi0_sleep
+                            &pdmm0_sdi1_sleep
+                            &pdmm0_sdi2_sleep
+                            &pdmm0_sdi3_sleep>;
                status = "disabled";
        };
 
                        compatible = "rockchip,rk3328-io-voltage-domain";
                        status = "disabled";
                };
+
+               grf_gpio: grf-gpio {
+                       compatible = "rockchip,rk3328-grf-gpio";
+                       gpio-controller;
+                       #gpio-cells = <2>;
+               };
+
+               power: power-controller {
+                       compatible = "rockchip,rk3328-power-controller";
+                       #power-domain-cells = <1>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       pd_hevc@RK3328_PD_HEVC {
+                               reg = <RK3328_PD_HEVC>;
+                       };
+                       pd_video@RK3328_PD_VIDEO {
+                               reg = <RK3328_PD_VIDEO>;
+                       };
+                       pd_vpu@RK3328_PD_VPU {
+                               reg = <RK3328_PD_VPU>;
+                               clocks = <&cru ACLK_VPU>, <&cru HCLK_VPU>;
+                       };
+               };
+
+               reboot-mode {
+                       compatible = "syscon-reboot-mode";
+                       offset = <0x5c8>;
+                       mode-normal = <BOOT_NORMAL>;
+                       mode-recovery = <BOOT_RECOVERY>;
+                       mode-bootloader = <BOOT_FASTBOOT>;
+                       mode-loader = <BOOT_BL_DOWNLOAD>;
+               };
        };
 
        uart0: serial@ff110000 {
                interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&cru SCLK_UART0>, <&cru PCLK_UART0>;
                clock-names = "baudclk", "apb_pclk";
-               reg-shift = <2>;
-               reg-io-width = <4>;
                dmas = <&dmac 2>, <&dmac 3>;
-               #dma-cells = <2>;
+               dma-names = "tx", "rx";
                pinctrl-names = "default";
                pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>;
+               reg-io-width = <4>;
+               reg-shift = <2>;
                status = "disabled";
        };
 
                reg = <0x0 0xff120000 0x0 0x100>;
                interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&cru SCLK_UART1>, <&cru PCLK_UART1>;
-               clock-names = "sclk_uart", "pclk_uart";
-               reg-shift = <2>;
-               reg-io-width = <4>;
+               clock-names = "baudclk", "apb_pclk";
                dmas = <&dmac 4>, <&dmac 5>;
-               #dma-cells = <2>;
+               dma-names = "tx", "rx";
                pinctrl-names = "default";
                pinctrl-0 = <&uart1_xfer &uart1_cts &uart1_rts>;
+               reg-io-width = <4>;
+               reg-shift = <2>;
                status = "disabled";
        };
 
                interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&cru SCLK_UART2>, <&cru PCLK_UART2>;
                clock-names = "baudclk", "apb_pclk";
-               reg-shift = <2>;
-               reg-io-width = <4>;
                dmas = <&dmac 6>, <&dmac 7>;
-               #dma-cells = <2>;
+               dma-names = "tx", "rx";
                pinctrl-names = "default";
                pinctrl-0 = <&uart2m1_xfer>;
+               reg-io-width = <4>;
+               reg-shift = <2>;
                status = "disabled";
        };
 
-       pmu: power-management@ff140000 {
-               compatible = "rockchip,rk3328-pmu", "syscon", "simple-mfd";
-               reg = <0x0 0xff140000 0x0 0x1000>;
-       };
-
        i2c0: i2c@ff150000 {
-               compatible = "rockchip,rk3328-i2c";
+               compatible = "rockchip,rk3328-i2c", "rockchip,rk3399-i2c";
                reg = <0x0 0xff150000 0x0 0x1000>;
                interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
                #address-cells = <1>;
        };
 
        i2c1: i2c@ff160000 {
-               compatible = "rockchip,rk3328-i2c";
+               compatible = "rockchip,rk3328-i2c", "rockchip,rk3399-i2c";
                reg = <0x0 0xff160000 0x0 0x1000>;
                interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
                #address-cells = <1>;
        };
 
        i2c2: i2c@ff170000 {
-               compatible = "rockchip,rk3328-i2c";
+               compatible = "rockchip,rk3328-i2c", "rockchip,rk3399-i2c";
                reg = <0x0 0xff170000 0x0 0x1000>;
                interrupts = <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>;
                #address-cells = <1>;
        };
 
        i2c3: i2c@ff180000 {
-               compatible = "rockchip,rk3328-i2c";
+               compatible = "rockchip,rk3328-i2c", "rockchip,rk3399-i2c";
                reg = <0x0 0xff180000 0x0 0x1000>;
                interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
                #address-cells = <1>;
                clocks = <&cru SCLK_SPI>, <&cru PCLK_SPI>;
                clock-names = "spiclk", "apb_pclk";
                dmas = <&dmac 8>, <&dmac 9>;
-               #dma-cells = <2>;
                dma-names = "tx", "rx";
                pinctrl-names = "default";
                pinctrl-0 = <&spi0m2_clk &spi0m2_tx &spi0m2_rx &spi0m2_cs0>;
                compatible = "snps,dw-wdt";
                reg = <0x0 0xff1a0000 0x0 0x100>;
                interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&cru PCLK_WDT>;
+       };
+
+       pwm0: pwm@ff1b0000 {
+               compatible = "rockchip,rk3328-pwm";
+               reg = <0x0 0xff1b0000 0x0 0x10>;
+               clocks = <&cru SCLK_PWM>, <&cru PCLK_PWM>;
+               clock-names = "pwm", "pclk";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pwm0_pin>;
+               #pwm-cells = <3>;
                status = "disabled";
        };
 
-       amba {
-               compatible = "simple-bus";
-               #address-cells = <2>;
-               #size-cells = <2>;
-               ranges;
+       pwm1: pwm@ff1b0010 {
+               compatible = "rockchip,rk3328-pwm";
+               reg = <0x0 0xff1b0010 0x0 0x10>;
+               clocks = <&cru SCLK_PWM>, <&cru PCLK_PWM>;
+               clock-names = "pwm", "pclk";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pwm1_pin>;
+               #pwm-cells = <3>;
+               status = "disabled";
+       };
 
-               dmac: dmac@ff1f0000 {
-                       compatible = "arm,pl330", "arm,primecell";
-                       reg = <0x0 0xff1f0000 0x0 0x4000>;
-                       interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>,
-                                    <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&cru ACLK_DMAC>;
-                       clock-names = "apb_pclk";
-                       #dma-cells = <1>;
+       pwm2: pwm@ff1b0020 {
+               compatible = "rockchip,rk3328-pwm";
+               reg = <0x0 0xff1b0020 0x0 0x10>;
+               clocks = <&cru SCLK_PWM>, <&cru PCLK_PWM>;
+               clock-names = "pwm", "pclk";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pwm2_pin>;
+               #pwm-cells = <3>;
+               status = "disabled";
+       };
+
+       pwm3: pwm@ff1b0030 {
+               compatible = "rockchip,rk3328-pwm";
+               reg = <0x0 0xff1b0030 0x0 0x10>;
+               interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&cru SCLK_PWM>, <&cru PCLK_PWM>;
+               clock-names = "pwm", "pclk";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pwmir_pin>;
+               #pwm-cells = <3>;
+               status = "disabled";
+       };
+
+       thermal-zones {
+               soc_thermal: soc-thermal {
+                       polling-delay-passive = <20>;
+                       polling-delay = <1000>;
+                       sustainable-power = <1000>;
+
+                       thermal-sensors = <&tsadc 0>;
+
+                       trips {
+                               threshold: trip-point0 {
+                                       temperature = <70000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+                               target: trip-point1 {
+                                       temperature = <85000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+                               soc_crit: soc-crit {
+                                       temperature = <95000>;
+                                       hysteresis = <2000>;
+                                       type = "critical";
+                               };
+                       };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&target>;
+                                       cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                                       contribution = <4096>;
+                               };
+                       };
+               };
+
+       };
+
+       tsadc: tsadc@ff250000 {
+               compatible = "rockchip,rk3328-tsadc";
+               reg = <0x0 0xff250000 0x0 0x100>;
+               interrupts = <GIC_SPI 58 IRQ_TYPE_LEVEL_HIGH>;
+               assigned-clocks = <&cru SCLK_TSADC>;
+               assigned-clock-rates = <50000>;
+               clocks = <&cru SCLK_TSADC>, <&cru PCLK_TSADC>;
+               clock-names = "tsadc", "apb_pclk";
+               pinctrl-names = "init", "default", "sleep";
+               pinctrl-0 = <&otp_gpio>;
+               pinctrl-1 = <&otp_out>;
+               pinctrl-2 = <&otp_gpio>;
+               resets = <&cru SRST_TSADC>;
+               reset-names = "tsadc-apb";
+               rockchip,grf = <&grf>;
+               rockchip,hw-tshut-temp = <100000>;
+               #thermal-sensor-cells = <1>;
+               status = "disabled";
+       };
+
+       efuse: efuse@ff260000 {
+               compatible = "rockchip,rk3328-efuse";
+               reg = <0x0 0xff260000 0x0 0x50>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               clocks = <&cru SCLK_EFUSE>;
+               clock-names = "pclk_efuse";
+               rockchip,efuse-size = <0x20>;
+
+               /* Data cells */
+               efuse_id: id@7 {
+                       reg = <0x07 0x10>;
+               };
+               cpu_leakage: cpu-leakage@17 {
+                       reg = <0x17 0x1>;
+               };
+               logic_leakage: logic-leakage@19 {
+                       reg = <0x19 0x1>;
+               };
+               efuse_cpu_version: cpu-version@1a {
+                       reg = <0x1a 0x1>;
+                       bits = <3 3>;
                };
        };
 
-       saradc: saradc@ff280000 {
-               compatible = "rockchip,rk3328-saradc", "rockchip,saradc";
+       saradc: adc@ff280000 {
+               compatible = "rockchip,rk3328-saradc", "rockchip,rk3399-saradc";
                reg = <0x0 0xff280000 0x0 0x100>;
                interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>;
                #io-channel-cells = <1>;
                status = "disabled";
        };
 
+       gpu: gpu@ff300000 {
+               compatible = "rockchip,rk3328-mali", "arm,mali-450";
+               reg = <0x0 0xff300000 0x0 0x40000>;
+               interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 92 IRQ_TYPE_LEVEL_HIGH>;
+               interrupt-names = "gp",
+                                 "gpmmu",
+                                 "pp",
+                                 "pp0",
+                                 "ppmmu0",
+                                 "pp1",
+                                 "ppmmu1";
+               clocks = <&cru ACLK_GPU>, <&cru ACLK_GPU>;
+               clock-names = "bus", "core";
+               resets = <&cru SRST_GPU_A>;
+       };
+
+       h265e_mmu: iommu@ff330200 {
+               compatible = "rockchip,iommu";
+               reg = <0x0 0xff330200 0 0x100>;
+               interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
+               interrupt-names = "h265e_mmu";
+               clocks = <&cru ACLK_H265>, <&cru PCLK_H265>;
+               clock-names = "aclk", "iface";
+               #iommu-cells = <0>;
+               status = "disabled";
+       };
+
+       vepu_mmu: iommu@ff340800 {
+               compatible = "rockchip,iommu";
+               reg = <0x0 0xff340800 0x0 0x40>;
+               interrupts = <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>;
+               interrupt-names = "vepu_mmu";
+               clocks = <&cru ACLK_VPU>, <&cru HCLK_VPU>;
+               clock-names = "aclk", "iface";
+               #iommu-cells = <0>;
+               status = "disabled";
+       };
+
+       vpu: video-codec@ff350000 {
+               compatible = "rockchip,rk3328-vpu";
+               reg = <0x0 0xff350000 0x0 0x800>;
+               interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;
+               interrupt-names = "vdpu";
+               clocks = <&cru ACLK_VPU>, <&cru HCLK_VPU>;
+               clock-names = "aclk", "hclk";
+               iommus = <&vpu_mmu>;
+               power-domains = <&power RK3328_PD_VPU>;
+       };
+
+       vpu_mmu: iommu@ff350800 {
+               compatible = "rockchip,iommu";
+               reg = <0x0 0xff350800 0x0 0x40>;
+               interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
+               interrupt-names = "vpu_mmu";
+               clocks = <&cru ACLK_VPU>, <&cru HCLK_VPU>;
+               clock-names = "aclk", "iface";
+               #iommu-cells = <0>;
+               power-domains = <&power RK3328_PD_VPU>;
+       };
+
+       rkvdec_mmu: iommu@ff360480 {
+               compatible = "rockchip,iommu";
+               reg = <0x0 0xff360480 0x0 0x40>, <0x0 0xff3604c0 0x0 0x40>;
+               interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
+               interrupt-names = "rkvdec_mmu";
+               clocks = <&cru ACLK_RKVDEC>, <&cru HCLK_RKVDEC>;
+               clock-names = "aclk", "iface";
+               #iommu-cells = <0>;
+               status = "disabled";
+       };
+
+       vop: vop@ff370000 {
+               compatible = "rockchip,rk3328-vop";
+               reg = <0x0 0xff370000 0x0 0x3efc>;
+               interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&cru ACLK_VOP>, <&cru DCLK_LCDC>, <&cru HCLK_VOP>;
+               clock-names = "aclk_vop", "dclk_vop", "hclk_vop";
+               resets = <&cru SRST_VOP_A>, <&cru SRST_VOP_H>, <&cru SRST_VOP_D>;
+               reset-names = "axi", "ahb", "dclk";
+               iommus = <&vop_mmu>;
+               status = "disabled";
+
+               vop_out: port {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       vop_out_hdmi: endpoint@0 {
+                               reg = <0>;
+                               remote-endpoint = <&hdmi_in_vop>;
+                       };
+               };
+       };
+
+       vop_mmu: iommu@ff373f00 {
+               compatible = "rockchip,iommu";
+               reg = <0x0 0xff373f00 0x0 0x100>;
+               interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
+               interrupt-names = "vop_mmu";
+               clocks = <&cru ACLK_VOP>, <&cru HCLK_VOP>;
+               clock-names = "aclk", "iface";
+               #iommu-cells = <0>;
+               status = "disabled";
+       };
+
+       hdmi: hdmi@ff3c0000 {
+               compatible = "rockchip,rk3328-dw-hdmi";
+               reg = <0x0 0xff3c0000 0x0 0x20000>;
+               reg-io-width = <4>;
+               interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&cru PCLK_HDMI>,
+                        <&cru SCLK_HDMI_SFC>,
+                        <&cru SCLK_RTC32K>;
+               clock-names = "iahb",
+                             "isfr",
+                             "cec";
+               phys = <&hdmiphy>;
+               phy-names = "hdmi";
+               pinctrl-names = "default";
+               pinctrl-0 = <&hdmi_cec &hdmii2c_xfer &hdmi_hpd>;
+               rockchip,grf = <&grf>;
+               #sound-dai-cells = <0>;
+               status = "disabled";
+
+               ports {
+                       hdmi_in: port {
+                               hdmi_in_vop: endpoint {
+                                       remote-endpoint = <&vop_out_hdmi>;
+                               };
+                       };
+               };
+       };
+
+       codec: codec@ff410000 {
+               compatible = "rockchip,rk3328-codec";
+               reg = <0x0 0xff410000 0x0 0x1000>;
+               clocks = <&cru PCLK_ACODECPHY>, <&cru SCLK_I2S1>;
+               clock-names = "pclk", "mclk";
+               rockchip,grf = <&grf>;
+               #sound-dai-cells = <0>;
+               status = "disabled";
+       };
+
+       hdmiphy: phy@ff430000 {
+               compatible = "rockchip,rk3328-hdmi-phy";
+               reg = <0x0 0xff430000 0x0 0x10000>;
+               interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&cru PCLK_HDMIPHY>, <&xin24m>, <&cru DCLK_HDMIPHY>;
+               clock-names = "sysclk", "refoclk", "refpclk";
+               clock-output-names = "hdmi_phy";
+               #clock-cells = <0>;
+               nvmem-cells = <&efuse_cpu_version>;
+               nvmem-cell-names = "cpu-version";
+               #phy-cells = <0>;
+               status = "disabled";
+       };
+
        cru: clock-controller@ff440000 {
                compatible = "rockchip,rk3328-cru", "rockchip,cru", "syscon";
                reg = <0x0 0xff440000 0x0 0x1000>;
                #clock-cells = <1>;
                #reset-cells = <1>;
                assigned-clocks =
+                       /*
+                        * CPLL should run at 1200, but that is to high for
+                        * the initial dividers of most of its children.
+                        * We need set cpll child clk div first,
+                        * and then set the cpll frequency.
+                        */
                        <&cru DCLK_LCDC>, <&cru SCLK_PDM>,
                        <&cru SCLK_RTC32K>, <&cru SCLK_UART0>,
                        <&cru SCLK_UART1>, <&cru SCLK_UART2>,
                        <&cru ACLK_BUS_PRE>, <&cru HCLK_BUS_PRE>,
                        <&cru PCLK_BUS_PRE>, <&cru ACLK_PERI_PRE>,
                        <&cru HCLK_PERI>, <&cru PCLK_PERI>,
-                       <&cru ACLK_VIO_PRE>, <&cru HCLK_VIO_PRE>,
-                       <&cru ACLK_RGA_PRE>, <&cru SCLK_RGA>,
-                       <&cru ACLK_VOP_PRE>, <&cru ACLK_RKVDEC_PRE>,
-                       <&cru ACLK_RKVENC>, <&cru ACLK_VPU_PRE>,
-                       <&cru SCLK_VDEC_CABAC>, <&cru SCLK_VDEC_CORE>,
-                       <&cru SCLK_VENC_CORE>, <&cru SCLK_VENC_DSP>,
-                       <&cru SCLK_EFUSE>, <&cru PCLK_DDR>,
-                       <&cru ACLK_GMAC>, <&cru PCLK_GMAC>,
-                       <&cru SCLK_RTC32K>, <&cru SCLK_USB3OTG_SUSPEND>;
+                       <&cru SCLK_RTC32K>;
                assigned-clock-parents =
                        <&cru HDMIPHY>, <&cru PLL_APLL>,
                        <&cru PLL_GPLL>, <&xin24m>,
                        <150000000>, <75000000>,
                        <75000000>, <150000000>,
                        <75000000>, <75000000>,
-                       <300000000>, <100000000>,
-                       <300000000>, <200000000>,
-                       <400000000>, <500000000>,
-                       <200000000>, <300000000>,
-                       <300000000>, <250000000>,
-                       <200000000>, <100000000>,
-                       <24000000>, <100000000>,
-                       <150000000>, <50000000>,
-                       <32768>, <32768>;
+                       <32768>;
        };
 
-       sdmmc: rksdmmc@ff500000 {
+       usb2phy_grf: syscon@ff450000 {
+               compatible = "rockchip,rk3328-usb2phy-grf", "syscon",
+                            "simple-mfd";
+               reg = <0x0 0xff450000 0x0 0x10000>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+
+               u2phy: usb2-phy@100 {
+                       compatible = "rockchip,rk3328-usb2phy";
+                       reg = <0x100 0x10>;
+                       clocks = <&xin24m>;
+                       clock-names = "phyclk";
+                       clock-output-names = "usb480m_phy";
+                       #clock-cells = <0>;
+                       assigned-clocks = <&cru USB480M>;
+                       assigned-clock-parents = <&u2phy>;
+                       status = "disabled";
+
+                       u2phy_otg: otg-port {
+                               #phy-cells = <0>;
+                               interrupts = <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>,
+                                            <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>,
+                                            <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>;
+                               interrupt-names = "otg-bvalid", "otg-id",
+                                                 "linestate";
+                               status = "disabled";
+                       };
+
+                       u2phy_host: host-port {
+                               #phy-cells = <0>;
+                               interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
+                               interrupt-names = "linestate";
+                               status = "disabled";
+                       };
+               };
+       };
+
+       sdmmc: mmc@ff500000 {
                compatible = "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc";
                reg = <0x0 0xff500000 0x0 0x4000>;
-               max-frequency = <150000000>;
-               clocks = <&cru HCLK_SDMMC>, <&cru SCLK_SDMMC>;
-               clock-names = "biu", "ciu";
-               fifo-depth = <0x100>;
                interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&cru HCLK_SDMMC>, <&cru SCLK_SDMMC>,
+                        <&cru SCLK_SDMMC_DRV>, <&cru SCLK_SDMMC_SAMPLE>;
+               clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
+               fifo-depth = <0x100>;
+               max-frequency = <150000000>;
                status = "disabled";
        };
 
-       sdio: dwmmc@ff510000 {
+       sdio: mmc@ff510000 {
                compatible = "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc";
                reg = <0x0 0xff510000 0x0 0x4000>;
-               max-frequency = <150000000>;
+               interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&cru HCLK_SDIO>, <&cru SCLK_SDIO>,
                         <&cru SCLK_SDIO_DRV>, <&cru SCLK_SDIO_SAMPLE>;
-               clock-names = "biu", "ciu", "ciu_drv", "ciu_sample";
+               clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
                fifo-depth = <0x100>;
-               interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
+               max-frequency = <150000000>;
                status = "disabled";
        };
 
-       emmc: rksdmmc@ff520000 {
+       emmc: mmc@ff520000 {
                compatible = "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc";
                reg = <0x0 0xff520000 0x0 0x4000>;
-               max-frequency = <150000000>;
-               clocks = <&cru HCLK_EMMC>, <&cru SCLK_EMMC>;
-               clock-names = "biu", "ciu";
-               fifo-depth = <0x100>;
                interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&cru HCLK_EMMC>, <&cru SCLK_EMMC>,
+                        <&cru SCLK_EMMC_DRV>, <&cru SCLK_EMMC_SAMPLE>;
+               clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
+               fifo-depth = <0x100>;
+               max-frequency = <150000000>;
                status = "disabled";
        };
 
        gmac2io: ethernet@ff540000 {
                compatible = "rockchip,rk3328-gmac";
                reg = <0x0 0xff540000 0x0 0x10000>;
-               rockchip,grf = <&grf>;
                interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
                interrupt-names = "macirq";
                clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_RX>,
                              "pclk_mac";
                resets = <&cru SRST_GMAC2IO_A>;
                reset-names = "stmmaceth";
+               rockchip,grf = <&grf>;
+               snps,txpbl = <0x4>;
                status = "disabled";
        };
 
+       gmac2phy: ethernet@ff550000 {
+               compatible = "rockchip,rk3328-gmac";
+               reg = <0x0 0xff550000 0x0 0x10000>;
+               rockchip,grf = <&grf>;
+               interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
+               interrupt-names = "macirq";
+               clocks = <&cru SCLK_MAC2PHY_SRC>, <&cru SCLK_MAC2PHY_RXTX>,
+                        <&cru SCLK_MAC2PHY_RXTX>, <&cru SCLK_MAC2PHY_REF>,
+                        <&cru ACLK_MAC2PHY>, <&cru PCLK_MAC2PHY>,
+                        <&cru SCLK_MAC2PHY_OUT>;
+               clock-names = "stmmaceth", "mac_clk_rx",
+                             "mac_clk_tx", "clk_mac_ref",
+                             "aclk_mac", "pclk_mac",
+                             "clk_macphy";
+               resets = <&cru SRST_GMAC2PHY_A>, <&cru SRST_MACPHY>;
+               reset-names = "stmmaceth", "mac-phy";
+               phy-mode = "rmii";
+               phy-handle = <&phy>;
+               snps,txpbl = <0x4>;
+               status = "disabled";
+
+               mdio {
+                       compatible = "snps,dwmac-mdio";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       phy: phy@0 {
+                               compatible = "ethernet-phy-id1234.d400", "ethernet-phy-ieee802.3-c22";
+                               reg = <0>;
+                               clocks = <&cru SCLK_MAC2PHY_OUT>;
+                               resets = <&cru SRST_MACPHY>;
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&fephyled_rxm1 &fephyled_linkm1>;
+                               phy-is-integrated;
+                       };
+               };
+       };
+
        usb_host0_ehci: usb@ff5c0000 {
                compatible = "generic-ehci";
                reg = <0x0 0xff5c0000 0x0 0x10000>;
                interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&cru HCLK_HOST0>, <&u2phy>;
+               phys = <&u2phy_host>;
+               phy-names = "usb";
                status = "disabled";
        };
 
                compatible = "generic-ohci";
                reg = <0x0 0xff5d0000 0x0 0x10000>;
                interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&cru HCLK_HOST0>, <&u2phy>;
+               phys = <&u2phy_host>;
+               phy-names = "usb";
                status = "disabled";
        };
 
+       /*
+        * U-boot Specific Change
+        *
+        * The OTG controller must come after the USB host pair for it
+        * to work. This is likely due to lack of support for the USB
+        * PHYs. This must be manually changed after each device tree
+        * sync. There is no clean way to handle this in -u-boot.dtsi
+        * files.
+        */
        usb20_otg: usb@ff580000 {
                compatible = "rockchip,rk3328-usb", "rockchip,rk3066-usb",
                             "snps,dwc2";
                reg = <0x0 0xff580000 0x0 0x40000>;
                interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>;
-               hnp-srp-disable;
+               clocks = <&cru HCLK_OTG>;
+               clock-names = "otg";
                dr_mode = "otg";
+               g-np-tx-fifo-size = <16>;
+               g-rx-fifo-size = <280>;
+               g-tx-fifo-size = <256 128 128 64 32 16>;
+               phys = <&u2phy_otg>;
+               phy-names = "usb2-phy";
                status = "disabled";
        };
 
-       sdmmc_ext: rksdmmc@ff5f0000 {
-               compatible = "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc";
-               reg = <0x0 0xff5f0000 0x0 0x4000>;
-               max-frequency = <150000000>;
-               clocks = <&cru HCLK_SDMMC>, <&cru SCLK_SDMMC>;
-               clock-names = "biu", "ciu";
-               fifo-depth = <0x100>;
-               interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
-               status = "disabled";
-       };
-
-       gic: interrupt-controller@ffb70000 {
+       gic: interrupt-controller@ff811000 {
                compatible = "arm,gic-400";
                #interrupt-cells = <3>;
                #address-cells = <0>;
 
                i2c0 {
                        i2c0_xfer: i2c0-xfer {
-                               rockchip,pins =
-                                       <2 24 RK_FUNC_1 &pcfg_pull_none>,
-                                       <2 25 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PD0 1 &pcfg_pull_none>,
+                                               <2 RK_PD1 1 &pcfg_pull_none>;
                        };
                };
 
                i2c1 {
                        i2c1_xfer: i2c1-xfer {
-                               rockchip,pins =
-                                       <2 4 RK_FUNC_2 &pcfg_pull_none>,
-                                       <2 5 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PA4 2 &pcfg_pull_none>,
+                                               <2 RK_PA5 2 &pcfg_pull_none>;
                        };
                };
 
                i2c2 {
                        i2c2_xfer: i2c2-xfer {
-                               rockchip,pins =
-                                       <2 13 RK_FUNC_1 &pcfg_pull_none>,
-                                       <2 14 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PB5 1 &pcfg_pull_none>,
+                                               <2 RK_PB6 1 &pcfg_pull_none>;
                        };
                };
 
                i2c3 {
                        i2c3_xfer: i2c3-xfer {
-                               rockchip,pins =
-                                       <0 5 RK_FUNC_2 &pcfg_pull_none>,
-                                       <0 6 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PA5 2 &pcfg_pull_none>,
+                                               <0 RK_PA6 2 &pcfg_pull_none>;
                        };
                        i2c3_gpio: i2c3-gpio {
                                rockchip,pins =
-                                       <0 5 RK_FUNC_GPIO &pcfg_pull_none>,
-                                       <0 6 RK_FUNC_GPIO &pcfg_pull_none>;
+                                       <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>,
+                                       <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
                        };
                };
 
                hdmi_i2c {
                        hdmii2c_xfer: hdmii2c-xfer {
+                               rockchip,pins = <0 RK_PA5 1 &pcfg_pull_none>,
+                                               <0 RK_PA6 1 &pcfg_pull_none>;
+                       };
+               };
+
+               pdm-0 {
+                       pdmm0_clk: pdmm0-clk {
+                               rockchip,pins = <2 RK_PC2 2 &pcfg_pull_none>;
+                       };
+
+                       pdmm0_fsync: pdmm0-fsync {
+                               rockchip,pins = <2 RK_PC7 2 &pcfg_pull_none>;
+                       };
+
+                       pdmm0_sdi0: pdmm0-sdi0 {
+                               rockchip,pins = <2 RK_PC3 2 &pcfg_pull_none>;
+                       };
+
+                       pdmm0_sdi1: pdmm0-sdi1 {
+                               rockchip,pins = <2 RK_PC4 2 &pcfg_pull_none>;
+                       };
+
+                       pdmm0_sdi2: pdmm0-sdi2 {
+                               rockchip,pins = <2 RK_PC5 2 &pcfg_pull_none>;
+                       };
+
+                       pdmm0_sdi3: pdmm0-sdi3 {
+                               rockchip,pins = <2 RK_PC6 2 &pcfg_pull_none>;
+                       };
+
+                       pdmm0_clk_sleep: pdmm0-clk-sleep {
+                               rockchip,pins =
+                                       <2 RK_PC2 RK_FUNC_GPIO &pcfg_input_high>;
+                       };
+
+                       pdmm0_sdi0_sleep: pdmm0-sdi0-sleep {
+                               rockchip,pins =
+                                       <2 RK_PC3 RK_FUNC_GPIO &pcfg_input_high>;
+                       };
+
+                       pdmm0_sdi1_sleep: pdmm0-sdi1-sleep {
+                               rockchip,pins =
+                                       <2 RK_PC4 RK_FUNC_GPIO &pcfg_input_high>;
+                       };
+
+                       pdmm0_sdi2_sleep: pdmm0-sdi2-sleep {
+                               rockchip,pins =
+                                       <2 RK_PC5 RK_FUNC_GPIO &pcfg_input_high>;
+                       };
+
+                       pdmm0_sdi3_sleep: pdmm0-sdi3-sleep {
+                               rockchip,pins =
+                                       <2 RK_PC6 RK_FUNC_GPIO &pcfg_input_high>;
+                       };
+
+                       pdmm0_fsync_sleep: pdmm0-fsync-sleep {
                                rockchip,pins =
-                                       <0 5 RK_FUNC_1 &pcfg_pull_none>,
-                                       <0 6 RK_FUNC_1 &pcfg_pull_none>;
+                                       <2 RK_PC7 RK_FUNC_GPIO &pcfg_input_high>;
+                       };
+               };
+
+               tsadc {
+                       otp_gpio: otp-gpio {
+                               rockchip,pins = <2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
+                       };
+
+                       otp_out: otp-out {
+                               rockchip,pins = <2 RK_PB5 1 &pcfg_pull_none>;
                        };
                };
 
                uart0 {
                        uart0_xfer: uart0-xfer {
-                               rockchip,pins =
-                                       <1 9 RK_FUNC_1 &pcfg_pull_up>,
-                                       <1 8 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PB1 1 &pcfg_pull_up>,
+                                               <1 RK_PB0 1 &pcfg_pull_none>;
                        };
 
                        uart0_cts: uart0-cts {
-                               rockchip,pins =
-                                       <1 11 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PB3 1 &pcfg_pull_none>;
                        };
 
                        uart0_rts: uart0-rts {
-                               rockchip,pins =
-                                       <1 10 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PB2 1 &pcfg_pull_none>;
                        };
 
                        uart0_rts_gpio: uart0-rts-gpio {
-                               rockchip,pins =
-                                       <1 10 RK_FUNC_GPIO &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
                        };
                };
 
                uart1 {
                        uart1_xfer: uart1-xfer {
-                               rockchip,pins =
-                                       <3 4 RK_FUNC_4 &pcfg_pull_up>,
-                                       <3 6 RK_FUNC_4 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PA4 4 &pcfg_pull_up>,
+                                               <3 RK_PA6 4 &pcfg_pull_none>;
                        };
 
                        uart1_cts: uart1-cts {
-                               rockchip,pins =
-                                       <3 7 RK_FUNC_4 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PA7 4 &pcfg_pull_none>;
                        };
 
                        uart1_rts: uart1-rts {
-                               rockchip,pins =
-                                       <3 5 RK_FUNC_4 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PA5 4 &pcfg_pull_none>;
                        };
 
                        uart1_rts_gpio: uart1-rts-gpio {
-                               rockchip,pins =
-                                       <3 5 RK_FUNC_GPIO &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>;
                        };
                };
 
                uart2-0 {
                        uart2m0_xfer: uart2m0-xfer {
-                               rockchip,pins =
-                                       <1 0 RK_FUNC_2 &pcfg_pull_up>,
-                                       <1 1 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PA0 2 &pcfg_pull_up>,
+                                               <1 RK_PA1 2 &pcfg_pull_none>;
                        };
                };
 
                uart2-1 {
                        uart2m1_xfer: uart2m1-xfer {
-                               rockchip,pins =
-                                       <2 0 RK_FUNC_1 &pcfg_pull_up>,
-                                       <2 1 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PA0 1 &pcfg_pull_up>,
+                                               <2 RK_PA1 1 &pcfg_pull_none>;
                        };
                };
 
                spi0-0 {
                        spi0m0_clk: spi0m0-clk {
-                               rockchip,pins =
-                                       <2 8 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <2 RK_PB0 1 &pcfg_pull_up>;
                        };
 
                        spi0m0_cs0: spi0m0-cs0 {
-                               rockchip,pins =
-                                       <2 11 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <2 RK_PB3 1 &pcfg_pull_up>;
                        };
 
                        spi0m0_tx: spi0m0-tx {
-                               rockchip,pins =
-                                       <2 9 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <2 RK_PB1 1 &pcfg_pull_up>;
                        };
 
                        spi0m0_rx: spi0m0-rx {
-                               rockchip,pins =
-                                       <2 10 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <2 RK_PB2 1 &pcfg_pull_up>;
                        };
 
                        spi0m0_cs1: spi0m0-cs1 {
-                               rockchip,pins =
-                                       <2 12 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <2 RK_PB4 1 &pcfg_pull_up>;
                        };
                };
 
                spi0-1 {
                        spi0m1_clk: spi0m1-clk {
-                               rockchip,pins =
-                                       <3 23 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <3 RK_PC7 2 &pcfg_pull_up>;
                        };
 
                        spi0m1_cs0: spi0m1-cs0 {
-                               rockchip,pins =
-                                       <3 26 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <3 RK_PD2 2 &pcfg_pull_up>;
                        };
 
                        spi0m1_tx: spi0m1-tx {
-                               rockchip,pins =
-                                       <3 25 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <3 RK_PD1 2 &pcfg_pull_up>;
                        };
 
                        spi0m1_rx: spi0m1-rx {
-                               rockchip,pins =
-                                       <3 24 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <3 RK_PD0 2 &pcfg_pull_up>;
                        };
 
                        spi0m1_cs1: spi0m1-cs1 {
-                               rockchip,pins =
-                                       <3 27 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <3 RK_PD3 2 &pcfg_pull_up>;
                        };
                };
 
                spi0-2 {
                        spi0m2_clk: spi0m2-clk {
-                               rockchip,pins =
-                                       <3 0 RK_FUNC_4 &pcfg_pull_up>;
+                               rockchip,pins = <3 RK_PA0 4 &pcfg_pull_up>;
                        };
 
                        spi0m2_cs0: spi0m2-cs0 {
-                               rockchip,pins =
-                                       <3 8 RK_FUNC_3 &pcfg_pull_up>;
+                               rockchip,pins = <3 RK_PB0 3 &pcfg_pull_up>;
                        };
 
                        spi0m2_tx: spi0m2-tx {
-                               rockchip,pins =
-                                       <3 1 RK_FUNC_4 &pcfg_pull_up>;
+                               rockchip,pins = <3 RK_PA1 4 &pcfg_pull_up>;
                        };
 
                        spi0m2_rx: spi0m2-rx {
-                               rockchip,pins =
-                                       <3 2 RK_FUNC_4 &pcfg_pull_up>;
+                               rockchip,pins = <3 RK_PA2 4 &pcfg_pull_up>;
                        };
                };
 
                i2s1 {
                        i2s1_mclk: i2s1-mclk {
-                               rockchip,pins =
-                                       <2 15 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PB7 1 &pcfg_pull_none>;
                        };
 
                        i2s1_sclk: i2s1-sclk {
-                               rockchip,pins =
-                                       <2 18 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PC2 1 &pcfg_pull_none>;
                        };
 
                        i2s1_lrckrx: i2s1-lrckrx {
-                               rockchip,pins =
-                                       <2 16 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PC0 1 &pcfg_pull_none>;
                        };
 
                        i2s1_lrcktx: i2s1-lrcktx {
-                               rockchip,pins =
-                                       <2 17 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PC1 1 &pcfg_pull_none>;
                        };
 
                        i2s1_sdi: i2s1-sdi {
-                               rockchip,pins =
-                                       <2 19 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PC3 1 &pcfg_pull_none>;
                        };
 
                        i2s1_sdo: i2s1-sdo {
-                               rockchip,pins =
-                                       <2 23 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PC7 1 &pcfg_pull_none>;
                        };
 
                        i2s1_sdio1: i2s1-sdio1 {
-                               rockchip,pins =
-                                       <2 20 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PC4 1 &pcfg_pull_none>;
                        };
 
                        i2s1_sdio2: i2s1-sdio2 {
-                               rockchip,pins =
-                                       <2 21 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PC5 1 &pcfg_pull_none>;
                        };
 
                        i2s1_sdio3: i2s1-sdio3 {
-                               rockchip,pins =
-                                       <2 22 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PC6 1 &pcfg_pull_none>;
                        };
 
                        i2s1_sleep: i2s1-sleep {
                                rockchip,pins =
-                                       <2 15 RK_FUNC_GPIO &pcfg_input_high>,
-                                       <2 16 RK_FUNC_GPIO &pcfg_input_high>,
-                                       <2 17 RK_FUNC_GPIO &pcfg_input_high>,
-                                       <2 18 RK_FUNC_GPIO &pcfg_input_high>,
-                                       <2 19 RK_FUNC_GPIO &pcfg_input_high>,
-                                       <2 20 RK_FUNC_GPIO &pcfg_input_high>,
-                                       <2 21 RK_FUNC_GPIO &pcfg_input_high>,
-                                       <2 22 RK_FUNC_GPIO &pcfg_input_high>,
-                                       <2 23 RK_FUNC_GPIO &pcfg_input_high>;
+                                       <2 RK_PB7 RK_FUNC_GPIO &pcfg_input_high>,
+                                       <2 RK_PC0 RK_FUNC_GPIO &pcfg_input_high>,
+                                       <2 RK_PC1 RK_FUNC_GPIO &pcfg_input_high>,
+                                       <2 RK_PC2 RK_FUNC_GPIO &pcfg_input_high>,
+                                       <2 RK_PC3 RK_FUNC_GPIO &pcfg_input_high>,
+                                       <2 RK_PC4 RK_FUNC_GPIO &pcfg_input_high>,
+                                       <2 RK_PC5 RK_FUNC_GPIO &pcfg_input_high>,
+                                       <2 RK_PC6 RK_FUNC_GPIO &pcfg_input_high>,
+                                       <2 RK_PC7 RK_FUNC_GPIO &pcfg_input_high>;
                        };
                };
 
                i2s2-0 {
                        i2s2m0_mclk: i2s2m0-mclk {
-                               rockchip,pins =
-                                       <1 21 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PC5 1 &pcfg_pull_none>;
                        };
 
                        i2s2m0_sclk: i2s2m0-sclk {
-                               rockchip,pins =
-                                       <1 22 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PC6 1 &pcfg_pull_none>;
                        };
 
                        i2s2m0_lrckrx: i2s2m0-lrckrx {
-                               rockchip,pins =
-                                       <1 26 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PD2 1 &pcfg_pull_none>;
                        };
 
                        i2s2m0_lrcktx: i2s2m0-lrcktx {
-                               rockchip,pins =
-                                       <1 23 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PC7 1 &pcfg_pull_none>;
                        };
 
                        i2s2m0_sdi: i2s2m0-sdi {
-                               rockchip,pins =
-                                       <1 24 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PD0 1 &pcfg_pull_none>;
                        };
 
                        i2s2m0_sdo: i2s2m0-sdo {
-                               rockchip,pins =
-                                       <1 25 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PD1 1 &pcfg_pull_none>;
                        };
 
                        i2s2m0_sleep: i2s2m0-sleep {
                                rockchip,pins =
-                                       <1 21 RK_FUNC_GPIO &pcfg_input_high>,
-                                       <1 22 RK_FUNC_GPIO &pcfg_input_high>,
-                                       <1 26 RK_FUNC_GPIO &pcfg_input_high>,
-                                       <1 23 RK_FUNC_GPIO &pcfg_input_high>,
-                                       <1 24 RK_FUNC_GPIO &pcfg_input_high>,
-                                       <1 25 RK_FUNC_GPIO &pcfg_input_high>;
+                                       <1 RK_PC5 RK_FUNC_GPIO &pcfg_input_high>,
+                                       <1 RK_PC6 RK_FUNC_GPIO &pcfg_input_high>,
+                                       <1 RK_PD2 RK_FUNC_GPIO &pcfg_input_high>,
+                                       <1 RK_PC7 RK_FUNC_GPIO &pcfg_input_high>,
+                                       <1 RK_PD0 RK_FUNC_GPIO &pcfg_input_high>,
+                                       <1 RK_PD1 RK_FUNC_GPIO &pcfg_input_high>;
                        };
                };
 
                i2s2-1 {
                        i2s2m1_mclk: i2s2m1-mclk {
-                               rockchip,pins =
-                                       <1 21 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PC5 1 &pcfg_pull_none>;
                        };
 
                        i2s2m1_sclk: i2s2m1-sclk {
-                               rockchip,pins =
-                                       <3 0 RK_FUNC_6 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PA0 6 &pcfg_pull_none>;
                        };
 
                        i2s2m1_lrckrx: i2sm1-lrckrx {
-                               rockchip,pins =
-                                       <3 8 RK_FUNC_6 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PB0 6 &pcfg_pull_none>;
                        };
 
                        i2s2m1_lrcktx: i2s2m1-lrcktx {
-                               rockchip,pins =
-                                       <3 8 RK_FUNC_4 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PB0 4 &pcfg_pull_none>;
                        };
 
                        i2s2m1_sdi: i2s2m1-sdi {
-                               rockchip,pins =
-                                       <3 2 RK_FUNC_6 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PA2 6 &pcfg_pull_none>;
                        };
 
                        i2s2m1_sdo: i2s2m1-sdo {
-                               rockchip,pins =
-                                       <3 1 RK_FUNC_6 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PA1 6 &pcfg_pull_none>;
                        };
 
                        i2s2m1_sleep: i2s2m1-sleep {
                                rockchip,pins =
-                                       <1 21 RK_FUNC_GPIO &pcfg_input_high>,
-                                       <3 0 RK_FUNC_GPIO &pcfg_input_high>,
-                                       <3 8 RK_FUNC_GPIO &pcfg_input_high>,
-                                       <3 2 RK_FUNC_GPIO &pcfg_input_high>,
-                                       <3 1 RK_FUNC_GPIO &pcfg_input_high>;
+                                       <1 RK_PC5 RK_FUNC_GPIO &pcfg_input_high>,
+                                       <3 RK_PA0 RK_FUNC_GPIO &pcfg_input_high>,
+                                       <3 RK_PB0 RK_FUNC_GPIO &pcfg_input_high>,
+                                       <3 RK_PA2 RK_FUNC_GPIO &pcfg_input_high>,
+                                       <3 RK_PA1 RK_FUNC_GPIO &pcfg_input_high>;
                        };
                };
 
                spdif-0 {
                        spdifm0_tx: spdifm0-tx {
-                               rockchip,pins =
-                                       <0 27 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PD3 1 &pcfg_pull_none>;
                        };
                };
 
                spdif-1 {
                        spdifm1_tx: spdifm1-tx {
-                               rockchip,pins =
-                                       <2 17 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PC1 2 &pcfg_pull_none>;
                        };
                };
 
                spdif-2 {
                        spdifm2_tx: spdifm2-tx {
-                               rockchip,pins =
-                                       <0 2 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PA2 2 &pcfg_pull_none>;
                        };
                };
 
                sdmmc0-0 {
                        sdmmc0m0_pwren: sdmmc0m0-pwren {
-                               rockchip,pins =
-                                       <2 7 RK_FUNC_1 &pcfg_pull_up_4ma>;
+                               rockchip,pins = <2 RK_PA7 1 &pcfg_pull_up_4ma>;
                        };
 
                        sdmmc0m0_gpio: sdmmc0m0-gpio {
-                               rockchip,pins =
-                                       <2 7 RK_FUNC_GPIO &pcfg_pull_up_4ma>;
+                               rockchip,pins = <2 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up_4ma>;
                        };
                };
 
                sdmmc0-1 {
                        sdmmc0m1_pwren: sdmmc0m1-pwren {
-                               rockchip,pins =
-                                       <0 30 RK_FUNC_3 &pcfg_pull_up_4ma>;
+                               rockchip,pins = <0 RK_PD6 3 &pcfg_pull_up_4ma>;
                        };
 
                        sdmmc0m1_gpio: sdmmc0m1-gpio {
-                               rockchip,pins =
-                                       <0 30 RK_FUNC_GPIO &pcfg_pull_up_4ma>;
+                               rockchip,pins = <0 RK_PD6 RK_FUNC_GPIO &pcfg_pull_up_4ma>;
                        };
                };
 
                sdmmc0 {
                        sdmmc0_clk: sdmmc0-clk {
-                               rockchip,pins =
-                                       <1 6 RK_FUNC_1 &pcfg_pull_none_4ma>;
+                               rockchip,pins = <1 RK_PA6 1 &pcfg_pull_none_8ma>;
                        };
 
                        sdmmc0_cmd: sdmmc0-cmd {
-                               rockchip,pins =
-                                       <1 4 RK_FUNC_1 &pcfg_pull_up_4ma>;
+                               rockchip,pins = <1 RK_PA4 1 &pcfg_pull_up_8ma>;
                        };
 
                        sdmmc0_dectn: sdmmc0-dectn {
-                               rockchip,pins =
-                                       <1 5 RK_FUNC_1 &pcfg_pull_up_4ma>;
+                               rockchip,pins = <1 RK_PA5 1 &pcfg_pull_up_4ma>;
                        };
 
                        sdmmc0_wrprt: sdmmc0-wrprt {
-                               rockchip,pins =
-                                       <1 7 RK_FUNC_1 &pcfg_pull_up_4ma>;
+                               rockchip,pins = <1 RK_PA7 1 &pcfg_pull_up_4ma>;
                        };
 
                        sdmmc0_bus1: sdmmc0-bus1 {
-                               rockchip,pins =
-                                       <1 0 RK_FUNC_1 &pcfg_pull_up_4ma>;
+                               rockchip,pins = <1 RK_PA0 1 &pcfg_pull_up_8ma>;
                        };
 
                        sdmmc0_bus4: sdmmc0-bus4 {
-                               rockchip,pins =
-                                       <1 0 RK_FUNC_1 &pcfg_pull_up_4ma>,
-                                       <1 1 RK_FUNC_1 &pcfg_pull_up_4ma>,
-                                       <1 2 RK_FUNC_1 &pcfg_pull_up_4ma>,
-                                       <1 3 RK_FUNC_1 &pcfg_pull_up_4ma>;
+                               rockchip,pins = <1 RK_PA0 1 &pcfg_pull_up_8ma>,
+                                               <1 RK_PA1 1 &pcfg_pull_up_8ma>,
+                                               <1 RK_PA2 1 &pcfg_pull_up_8ma>,
+                                               <1 RK_PA3 1 &pcfg_pull_up_8ma>;
                        };
 
                        sdmmc0_gpio: sdmmc0-gpio {
                                rockchip,pins =
-                                       <1 6 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
-                                       <1 4 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
-                                       <1 5 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
-                                       <1 7 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
-                                       <1 3 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
-                                       <1 2 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
-                                       <1 1 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
-                                       <1 0 RK_FUNC_GPIO &pcfg_pull_up_4ma>;
+                                       <1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
+                                       <1 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
+                                       <1 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
+                                       <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
+                                       <1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
+                                       <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
+                                       <1 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
+                                       <1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up_4ma>;
                        };
                };
 
                sdmmc0ext {
                        sdmmc0ext_clk: sdmmc0ext-clk {
-                               rockchip,pins =
-                                       <3 2 RK_FUNC_3 &pcfg_pull_none_4ma>;
+                               rockchip,pins = <3 RK_PA2 3 &pcfg_pull_none_4ma>;
                        };
 
                        sdmmc0ext_cmd: sdmmc0ext-cmd {
-                               rockchip,pins =
-                                       <3 0 RK_FUNC_3 &pcfg_pull_up_4ma>;
+                               rockchip,pins = <3 RK_PA0 3 &pcfg_pull_up_4ma>;
                        };
 
                        sdmmc0ext_wrprt: sdmmc0ext-wrprt {
-                               rockchip,pins =
-                                       <3 3 RK_FUNC_3 &pcfg_pull_up_4ma>;
+                               rockchip,pins = <3 RK_PA3 3 &pcfg_pull_up_4ma>;
                        };
 
                        sdmmc0ext_dectn: sdmmc0ext-dectn {
-                               rockchip,pins =
-                                       <3 1 RK_FUNC_3 &pcfg_pull_up_4ma>;
+                               rockchip,pins = <3 RK_PA1 3 &pcfg_pull_up_4ma>;
                        };
 
                        sdmmc0ext_bus1: sdmmc0ext-bus1 {
-                               rockchip,pins =
-                                       <3 4 RK_FUNC_3 &pcfg_pull_up_4ma>;
+                               rockchip,pins = <3 RK_PA4 3 &pcfg_pull_up_4ma>;
                        };
 
                        sdmmc0ext_bus4: sdmmc0ext-bus4 {
                                rockchip,pins =
-                                       <3 4 RK_FUNC_3 &pcfg_pull_up_4ma>,
-                                       <3 5 RK_FUNC_3 &pcfg_pull_up_4ma>,
-                                       <3 6 RK_FUNC_3 &pcfg_pull_up_4ma>,
-                                       <3 7 RK_FUNC_3 &pcfg_pull_up_4ma>;
+                                       <3 RK_PA4 3 &pcfg_pull_up_4ma>,
+                                       <3 RK_PA5 3 &pcfg_pull_up_4ma>,
+                                       <3 RK_PA6 3 &pcfg_pull_up_4ma>,
+                                       <3 RK_PA7 3 &pcfg_pull_up_4ma>;
                        };
 
                        sdmmc0ext_gpio: sdmmc0ext-gpio {
                                rockchip,pins =
-                                       <3 0 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
-                                       <3 1 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
-                                       <3 2 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
-                                       <3 3 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
-                                       <3 4 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
-                                       <3 5 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
-                                       <3 6 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
-                                       <3 7 RK_FUNC_GPIO &pcfg_pull_up_4ma>;
+                                       <3 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
+                                       <3 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
+                                       <3 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
+                                       <3 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
+                                       <3 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
+                                       <3 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
+                                       <3 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
+                                       <3 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up_4ma>;
                        };
                };
 
                sdmmc1 {
                        sdmmc1_clk: sdmmc1-clk {
-                               rockchip,pins =
-                                       <1 12 RK_FUNC_1 &pcfg_pull_none_8ma>;
+                               rockchip,pins = <1 RK_PB4 1 &pcfg_pull_none_8ma>;
                        };
 
                        sdmmc1_cmd: sdmmc1-cmd {
-                               rockchip,pins =
-                                       <1 13 RK_FUNC_1 &pcfg_pull_up_8ma>;
+                               rockchip,pins = <1 RK_PB5 1 &pcfg_pull_up_8ma>;
                        };
 
                        sdmmc1_pwren: sdmmc1-pwren {
-                               rockchip,pins =
-                                       <1 18 RK_FUNC_1 &pcfg_pull_up_8ma>;
+                               rockchip,pins = <1 RK_PC2 1 &pcfg_pull_up_8ma>;
                        };
 
                        sdmmc1_wrprt: sdmmc1-wrprt {
-                               rockchip,pins =
-                                       <1 20 RK_FUNC_1 &pcfg_pull_up_8ma>;
+                               rockchip,pins = <1 RK_PC4 1 &pcfg_pull_up_8ma>;
                        };
 
                        sdmmc1_dectn: sdmmc1-dectn {
-                               rockchip,pins =
-                                       <1 19 RK_FUNC_1 &pcfg_pull_up_8ma>;
+                               rockchip,pins = <1 RK_PC3 1 &pcfg_pull_up_8ma>;
                        };
 
                        sdmmc1_bus1: sdmmc1-bus1 {
-                               rockchip,pins =
-                                       <1 14 RK_FUNC_1 &pcfg_pull_up_8ma>;
+                               rockchip,pins = <1 RK_PB6 1 &pcfg_pull_up_8ma>;
                        };
 
                        sdmmc1_bus4: sdmmc1-bus4 {
-                               rockchip,pins =
-                                       <1 12 RK_FUNC_1 &pcfg_pull_up_8ma>,
-                                       <1 13 RK_FUNC_1 &pcfg_pull_up_8ma>,
-                                       <1 16 RK_FUNC_1 &pcfg_pull_up_8ma>,
-                                       <1 17 RK_FUNC_1 &pcfg_pull_up_8ma>;
+                               rockchip,pins = <1 RK_PB6 1 &pcfg_pull_up_8ma>,
+                                               <1 RK_PB7 1 &pcfg_pull_up_8ma>,
+                                               <1 RK_PC0 1 &pcfg_pull_up_8ma>,
+                                               <1 RK_PC1 1 &pcfg_pull_up_8ma>;
                        };
 
                        sdmmc1_gpio: sdmmc1-gpio {
                                rockchip,pins =
-                                       <1 12 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
-                                       <1 13 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
-                                       <1 14 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
-                                       <1 15 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
-                                       <1 16 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
-                                       <1 17 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
-                                       <1 18 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
-                                       <1 19 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
-                                       <1 20 RK_FUNC_GPIO &pcfg_pull_up_4ma>;
+                                       <1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
+                                       <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
+                                       <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
+                                       <1 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
+                                       <1 RK_PC0 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
+                                       <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
+                                       <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
+                                       <1 RK_PC3 RK_FUNC_GPIO &pcfg_pull_up_4ma>,
+                                       <1 RK_PC4 RK_FUNC_GPIO &pcfg_pull_up_4ma>;
                        };
                };
 
                emmc {
                        emmc_clk: emmc-clk {
-                               rockchip,pins =
-                                       <3 21 RK_FUNC_2 &pcfg_pull_none_12ma>;
+                               rockchip,pins = <3 RK_PC5 2 &pcfg_pull_none_12ma>;
                        };
 
                        emmc_cmd: emmc-cmd {
-                               rockchip,pins =
-                                       <3 19 RK_FUNC_2 &pcfg_pull_up_12ma>;
+                               rockchip,pins = <3 RK_PC3 2 &pcfg_pull_up_12ma>;
                        };
 
                        emmc_pwren: emmc-pwren {
-                               rockchip,pins =
-                                       <3 22 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PC6 2 &pcfg_pull_none>;
                        };
 
                        emmc_rstnout: emmc-rstnout {
-                               rockchip,pins =
-                                       <3 20 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PC4 2 &pcfg_pull_none>;
                        };
 
                        emmc_bus1: emmc-bus1 {
-                               rockchip,pins =
-                                       <0 7 RK_FUNC_2 &pcfg_pull_up_12ma>;
+                               rockchip,pins = <0 RK_PA7 2 &pcfg_pull_up_12ma>;
                        };
 
                        emmc_bus4: emmc-bus4 {
                                rockchip,pins =
-                                       <0 7 RK_FUNC_2 &pcfg_pull_up_12ma>,
-                                       <2 28 RK_FUNC_2 &pcfg_pull_up_12ma>,
-                                       <2 29 RK_FUNC_2 &pcfg_pull_up_12ma>,
-                                       <2 30 RK_FUNC_2 &pcfg_pull_up_12ma>;
+                                       <0 RK_PA7 2 &pcfg_pull_up_12ma>,
+                                       <2 RK_PD4 2 &pcfg_pull_up_12ma>,
+                                       <2 RK_PD5 2 &pcfg_pull_up_12ma>,
+                                       <2 RK_PD6 2 &pcfg_pull_up_12ma>;
                        };
 
                        emmc_bus8: emmc-bus8 {
                                rockchip,pins =
-                                       <0 7 RK_FUNC_2 &pcfg_pull_up_12ma>,
-                                       <2 28 RK_FUNC_2 &pcfg_pull_up_12ma>,
-                                       <2 29 RK_FUNC_2 &pcfg_pull_up_12ma>,
-                                       <2 30 RK_FUNC_2 &pcfg_pull_up_12ma>,
-                                       <2 31 RK_FUNC_2 &pcfg_pull_up_12ma>,
-                                       <3 16 RK_FUNC_2 &pcfg_pull_up_12ma>,
-                                       <3 17 RK_FUNC_2 &pcfg_pull_up_12ma>,
-                                       <3 18 RK_FUNC_2 &pcfg_pull_up_12ma>;
+                                       <0 RK_PA7 2 &pcfg_pull_up_12ma>,
+                                       <2 RK_PD4 2 &pcfg_pull_up_12ma>,
+                                       <2 RK_PD5 2 &pcfg_pull_up_12ma>,
+                                       <2 RK_PD6 2 &pcfg_pull_up_12ma>,
+                                       <2 RK_PD7 2 &pcfg_pull_up_12ma>,
+                                       <3 RK_PC0 2 &pcfg_pull_up_12ma>,
+                                       <3 RK_PC1 2 &pcfg_pull_up_12ma>,
+                                       <3 RK_PC2 2 &pcfg_pull_up_12ma>;
                        };
                };
 
                pwm0 {
                        pwm0_pin: pwm0-pin {
-                               rockchip,pins =
-                                       <2 4 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PA4 1 &pcfg_pull_none>;
                        };
                };
 
                pwm1 {
                        pwm1_pin: pwm1-pin {
-                               rockchip,pins =
-                                       <2 5 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PA5 1 &pcfg_pull_none>;
                        };
                };
 
                pwm2 {
                        pwm2_pin: pwm2-pin {
-                               rockchip,pins =
-                                       <2 6 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PA6 1 &pcfg_pull_none>;
                        };
                };
 
                pwmir {
                        pwmir_pin: pwmir-pin {
-                               rockchip,pins =
-                                       <2 2 RK_FUNC_1 &pcfg_pull_none>;
-                       };
-               };
-
-               gmac-0 {
-                       rgmiim0_pins: rgmiim0-pins {
-                               rockchip,pins =
-                                       /* mac_txclk */
-                                       <0 8 RK_FUNC_1 &pcfg_pull_none_12ma>,
-                                       /* mac_rxclk */
-                                       <0 10 RK_FUNC_1 &pcfg_pull_none>,
-                                       /* mac_mdio */
-                                       <0 11 RK_FUNC_1 &pcfg_pull_none>,
-                                       /* mac_txen */
-                                       <0 12 RK_FUNC_1 &pcfg_pull_none_12ma>,
-                                       /* mac_clk */
-                                       <0 24 RK_FUNC_1 &pcfg_pull_none>,
-                                       /* mac_rxdv */
-                                       <0 25 RK_FUNC_1 &pcfg_pull_none>,
-                                       /* mac_mdc */
-                                       <0 19 RK_FUNC_1 &pcfg_pull_none>,
-                                       /* mac_rxd1 */
-                                       <0 14 RK_FUNC_1 &pcfg_pull_none>,
-                                       /* mac_rxd0 */
-                                       <0 15 RK_FUNC_1 &pcfg_pull_none>,
-                                       /* mac_txd1 */
-                                       <0 16 RK_FUNC_1 &pcfg_pull_none_12ma>,
-                                       /* mac_txd0 */
-                                       <0 17 RK_FUNC_1 &pcfg_pull_none_12ma>,
-                                       /* mac_rxd3 */
-                                       <0 20 RK_FUNC_1 &pcfg_pull_none>,
-                                       /* mac_rxd2 */
-                                       <0 21 RK_FUNC_1 &pcfg_pull_none>,
-                                       /* mac_txd3 */
-                                       <0 23 RK_FUNC_1 &pcfg_pull_none_12ma>,
-                                       /* mac_txd2 */
-                                       <0 22 RK_FUNC_1 &pcfg_pull_none_12ma>;
-                       };
-
-                       rmiim0_pins: rmiim0-pins {
-                               rockchip,pins =
-                                       /* mac_mdio */
-                                       <0 11 RK_FUNC_1 &pcfg_pull_none>,
-                                       /* mac_txen */
-                                       <0 12 RK_FUNC_1 &pcfg_pull_none_12ma>,
-                                       /* mac_clk */
-                                       <0 24 RK_FUNC_1 &pcfg_pull_none>,
-                                       /* mac_rxer */
-                                       <0 13 RK_FUNC_1 &pcfg_pull_none>,
-                                       /* mac_rxdv */
-                                       <0 25 RK_FUNC_1 &pcfg_pull_none>,
-                                       /* mac_mdc */
-                                       <0 19 RK_FUNC_1 &pcfg_pull_none>,
-                                       /* mac_rxd1 */
-                                       <0 14 RK_FUNC_1 &pcfg_pull_none>,
-                                       /* mac_rxd0 */
-                                       <0 15 RK_FUNC_1 &pcfg_pull_none>,
-                                       /* mac_txd1 */
-                                       <0 16 RK_FUNC_1 &pcfg_pull_none_12ma>,
-                                       /* mac_txd0 */
-                                       <0 17 RK_FUNC_1 &pcfg_pull_none_12ma>;
+                               rockchip,pins = <2 RK_PA2 1 &pcfg_pull_none>;
                        };
                };
 
                        rgmiim1_pins: rgmiim1-pins {
                                rockchip,pins =
                                        /* mac_txclk */
-                                       <1 12 RK_FUNC_2 &pcfg_pull_none_12ma>,
+                                       <1 RK_PB4 2 &pcfg_pull_none_8ma>,
                                        /* mac_rxclk */
-                                       <1 13 RK_FUNC_2 &pcfg_pull_none_2ma>,
+                                       <1 RK_PB5 2 &pcfg_pull_none_4ma>,
                                        /* mac_mdio */
-                                       <1 19 RK_FUNC_2 &pcfg_pull_none_2ma>,
+                                       <1 RK_PC3 2 &pcfg_pull_none_4ma>,
                                        /* mac_txen */
-                                       <1 25 RK_FUNC_2 &pcfg_pull_none_12ma>,
+                                       <1 RK_PD1 2 &pcfg_pull_none_8ma>,
                                        /* mac_clk */
-                                       <1 21 RK_FUNC_2 &pcfg_pull_none_2ma>,
+                                       <1 RK_PC5 2 &pcfg_pull_none_4ma>,
                                        /* mac_rxdv */
-                                       <1 22 RK_FUNC_2 &pcfg_pull_none_2ma>,
+                                       <1 RK_PC6 2 &pcfg_pull_none_4ma>,
                                        /* mac_mdc */
-                                       <1 23 RK_FUNC_2 &pcfg_pull_none_2ma>,
+                                       <1 RK_PC7 2 &pcfg_pull_none_4ma>,
                                        /* mac_rxd1 */
-                                       <1 10 RK_FUNC_2 &pcfg_pull_none_2ma>,
+                                       <1 RK_PB2 2 &pcfg_pull_none_4ma>,
                                        /* mac_rxd0 */
-                                       <1 11 RK_FUNC_2 &pcfg_pull_none_2ma>,
+                                       <1 RK_PB3 2 &pcfg_pull_none_4ma>,
                                        /* mac_txd1 */
-                                       <1 8 RK_FUNC_2 &pcfg_pull_none_12ma>,
+                                       <1 RK_PB0 2 &pcfg_pull_none_8ma>,
                                        /* mac_txd0 */
-                                       <1 9 RK_FUNC_2 &pcfg_pull_none_12ma>,
+                                       <1 RK_PB1 2 &pcfg_pull_none_8ma>,
                                        /* mac_rxd3 */
-                                       <1 14 RK_FUNC_2 &pcfg_pull_none_2ma>,
+                                       <1 RK_PB6 2 &pcfg_pull_none_4ma>,
                                        /* mac_rxd2 */
-                                       <1 15 RK_FUNC_2 &pcfg_pull_none_2ma>,
+                                       <1 RK_PB7 2 &pcfg_pull_none_4ma>,
                                        /* mac_txd3 */
-                                       <1 16 RK_FUNC_2 &pcfg_pull_none_12ma>,
+                                       <1 RK_PC0 2 &pcfg_pull_none_8ma>,
                                        /* mac_txd2 */
-                                       <1 17 RK_FUNC_2 &pcfg_pull_none_12ma>,
+                                       <1 RK_PC1 2 &pcfg_pull_none_8ma>,
 
                                        /* mac_txclk */
-                                       <0 8 RK_FUNC_1 &pcfg_pull_none>,
+                                       <0 RK_PB0 1 &pcfg_pull_none_8ma>,
                                        /* mac_txen */
-                                       <0 12 RK_FUNC_1 &pcfg_pull_none>,
+                                       <0 RK_PB4 1 &pcfg_pull_none_8ma>,
                                        /* mac_clk */
-                                       <0 24 RK_FUNC_1 &pcfg_pull_none>,
+                                       <0 RK_PD0 1 &pcfg_pull_none_4ma>,
                                        /* mac_txd1 */
-                                       <0 16 RK_FUNC_1 &pcfg_pull_none>,
+                                       <0 RK_PC0 1 &pcfg_pull_none_8ma>,
                                        /* mac_txd0 */
-                                       <0 17 RK_FUNC_1 &pcfg_pull_none>,
+                                       <0 RK_PC1 1 &pcfg_pull_none_8ma>,
                                        /* mac_txd3 */
-                                       <0 23 RK_FUNC_1 &pcfg_pull_none>,
+                                       <0 RK_PC7 1 &pcfg_pull_none_8ma>,
                                        /* mac_txd2 */
-                                       <0 22 RK_FUNC_1 &pcfg_pull_none>;
+                                       <0 RK_PC6 1 &pcfg_pull_none_8ma>;
                        };
 
                        rmiim1_pins: rmiim1-pins {
                                rockchip,pins =
                                        /* mac_mdio */
-                                       <1 19 RK_FUNC_2 &pcfg_pull_none_2ma>,
+                                       <1 RK_PC3 2 &pcfg_pull_none_2ma>,
                                        /* mac_txen */
-                                       <1 25 RK_FUNC_2 &pcfg_pull_none_12ma>,
+                                       <1 RK_PD1 2 &pcfg_pull_none_12ma>,
                                        /* mac_clk */
-                                       <1 21 RK_FUNC_2 &pcfg_pull_none_2ma>,
+                                       <1 RK_PC5 2 &pcfg_pull_none_2ma>,
                                        /* mac_rxer */
-                                       <1 24 RK_FUNC_2 &pcfg_pull_none_2ma>,
+                                       <1 RK_PD0 2 &pcfg_pull_none_2ma>,
                                        /* mac_rxdv */
-                                       <1 22 RK_FUNC_2 &pcfg_pull_none_2ma>,
+                                       <1 RK_PC6 2 &pcfg_pull_none_2ma>,
                                        /* mac_mdc */
-                                       <1 23 RK_FUNC_2 &pcfg_pull_none_2ma>,
+                                       <1 RK_PC7 2 &pcfg_pull_none_2ma>,
                                        /* mac_rxd1 */
-                                       <1 10 RK_FUNC_2 &pcfg_pull_none_2ma>,
+                                       <1 RK_PB2 2 &pcfg_pull_none_2ma>,
                                        /* mac_rxd0 */
-                                       <1 11 RK_FUNC_2 &pcfg_pull_none_2ma>,
+                                       <1 RK_PB3 2 &pcfg_pull_none_2ma>,
                                        /* mac_txd1 */
-                                       <1 8 RK_FUNC_2 &pcfg_pull_none_12ma>,
+                                       <1 RK_PB0 2 &pcfg_pull_none_12ma>,
                                        /* mac_txd0 */
-                                       <1 9 RK_FUNC_2 &pcfg_pull_none_12ma>,
+                                       <1 RK_PB1 2 &pcfg_pull_none_12ma>,
 
                                        /* mac_mdio */
-                                       <0 11 RK_FUNC_1 &pcfg_pull_none>,
+                                       <0 RK_PB3 1 &pcfg_pull_none>,
                                        /* mac_txen */
-                                       <0 12 RK_FUNC_1 &pcfg_pull_none>,
+                                       <0 RK_PB4 1 &pcfg_pull_none>,
                                        /* mac_clk */
-                                       <0 24 RK_FUNC_1 &pcfg_pull_none>,
+                                       <0 RK_PD0 1 &pcfg_pull_none>,
                                        /* mac_mdc */
-                                       <0 19 RK_FUNC_1 &pcfg_pull_none>,
+                                       <0 RK_PC3 1 &pcfg_pull_none>,
                                        /* mac_txd1 */
-                                       <0 16 RK_FUNC_1 &pcfg_pull_none>,
+                                       <0 RK_PC0 1 &pcfg_pull_none>,
                                        /* mac_txd0 */
-                                       <0 17 RK_FUNC_1 &pcfg_pull_none>;
+                                       <0 RK_PC1 1 &pcfg_pull_none>;
                        };
                };
 
                gmac2phy {
-                       fephyled_speed100: fephyled-speed100 {
-                               rockchip,pins =
-                                       <0 31 RK_FUNC_1 &pcfg_pull_none>;
-                       };
-
                        fephyled_speed10: fephyled-speed10 {
-                               rockchip,pins =
-                                       <0 30 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PD6 1 &pcfg_pull_none>;
                        };
 
                        fephyled_duplex: fephyled-duplex {
-                               rockchip,pins =
-                                       <0 30 RK_FUNC_2 &pcfg_pull_none>;
-                       };
-
-                       fephyled_rxm0: fephyled-rxm0 {
-                               rockchip,pins =
-                                       <0 29 RK_FUNC_1 &pcfg_pull_none>;
-                       };
-
-                       fephyled_txm0: fephyled-txm0 {
-                               rockchip,pins =
-                                       <0 29 RK_FUNC_2 &pcfg_pull_none>;
-                       };
-
-                       fephyled_linkm0: fephyled-linkm0 {
-                               rockchip,pins =
-                                       <0 28 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PD6 2 &pcfg_pull_none>;
                        };
 
                        fephyled_rxm1: fephyled-rxm1 {
-                               rockchip,pins =
-                                       <2 25 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PD1 2 &pcfg_pull_none>;
                        };
 
                        fephyled_txm1: fephyled-txm1 {
-                               rockchip,pins =
-                                       <2 25 RK_FUNC_3 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PD1 3 &pcfg_pull_none>;
                        };
 
                        fephyled_linkm1: fephyled-linkm1 {
-                               rockchip,pins =
-                                       <2 24 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PD0 2 &pcfg_pull_none>;
                        };
                };
 
                tsadc_pin {
                        tsadc_int: tsadc-int {
-                               rockchip,pins =
-                                       <2 13 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PB5 2 &pcfg_pull_none>;
                        };
                        tsadc_gpio: tsadc-gpio {
-                               rockchip,pins =
-                                       <2 13 RK_FUNC_GPIO &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
                        };
                };
 
                hdmi_pin {
                        hdmi_cec: hdmi-cec {
-                               rockchip,pins =
-                                       <0 3 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PA3 1 &pcfg_pull_none>;
                        };
 
                        hdmi_hpd: hdmi-hpd {
-                               rockchip,pins =
-                                       <0 4 RK_FUNC_1 &pcfg_pull_down>;
+                               rockchip,pins = <0 RK_PA4 1 &pcfg_pull_down>;
                        };
                };
 
                        dvp_d2d9_m0:dvp-d2d9-m0 {
                                rockchip,pins =
                                        /* cif_d0 */
-                                       <3 4 RK_FUNC_2 &pcfg_pull_none>,
+                                       <3 RK_PA4 2 &pcfg_pull_none>,
                                        /* cif_d1 */
-                                       <3 5 RK_FUNC_2 &pcfg_pull_none>,
+                                       <3 RK_PA5 2 &pcfg_pull_none>,
                                        /* cif_d2 */
-                                       <3 6 RK_FUNC_2 &pcfg_pull_none>,
+                                       <3 RK_PA6 2 &pcfg_pull_none>,
                                        /* cif_d3 */
-                                       <3 7 RK_FUNC_2 &pcfg_pull_none>,
+                                       <3 RK_PA7 2 &pcfg_pull_none>,
                                        /* cif_d4 */
-                                       <3 8 RK_FUNC_2 &pcfg_pull_none>,
+                                       <3 RK_PB0 2 &pcfg_pull_none>,
                                        /* cif_d5m0 */
-                                       <3 9 RK_FUNC_2 &pcfg_pull_none>,
+                                       <3 RK_PB1 2 &pcfg_pull_none>,
                                        /* cif_d6m0 */
-                                       <3 10 RK_FUNC_2 &pcfg_pull_none>,
+                                       <3 RK_PB2 2 &pcfg_pull_none>,
                                        /* cif_d7m0 */
-                                       <3 11 RK_FUNC_2 &pcfg_pull_none>,
+                                       <3 RK_PB3 2 &pcfg_pull_none>,
                                        /* cif_href */
-                                       <3 1 RK_FUNC_2 &pcfg_pull_none>,
+                                       <3 RK_PA1 2 &pcfg_pull_none>,
                                        /* cif_vsync */
-                                       <3 0 RK_FUNC_2 &pcfg_pull_none>,
+                                       <3 RK_PA0 2 &pcfg_pull_none>,
                                        /* cif_clkoutm0 */
-                                       <3 3 RK_FUNC_2 &pcfg_pull_none>,
+                                       <3 RK_PA3 2 &pcfg_pull_none>,
                                        /* cif_clkin */
-                                       <3 2 RK_FUNC_2 &pcfg_pull_none>;
+                                       <3 RK_PA2 2 &pcfg_pull_none>;
                        };
                };
 
                        dvp_d2d9_m1:dvp-d2d9-m1 {
                                rockchip,pins =
                                        /* cif_d0 */
-                                       <3 4 RK_FUNC_2 &pcfg_pull_none>,
+                                       <3 RK_PA4 2 &pcfg_pull_none>,
                                        /* cif_d1 */
-                                       <3 5 RK_FUNC_2 &pcfg_pull_none>,
+                                       <3 RK_PA5 2 &pcfg_pull_none>,
                                        /* cif_d2 */
-                                       <3 6 RK_FUNC_2 &pcfg_pull_none>,
+                                       <3 RK_PA6 2 &pcfg_pull_none>,
                                        /* cif_d3 */
-                                       <3 7 RK_FUNC_2 &pcfg_pull_none>,
+                                       <3 RK_PA7 2 &pcfg_pull_none>,
                                        /* cif_d4 */
-                                       <3 8 RK_FUNC_2 &pcfg_pull_none>,
+                                       <3 RK_PB0 2 &pcfg_pull_none>,
                                        /* cif_d5m1 */
-                                       <2 16 RK_FUNC_4 &pcfg_pull_none>,
+                                       <2 RK_PC0 4 &pcfg_pull_none>,
                                        /* cif_d6m1 */
-                                       <2 17 RK_FUNC_4 &pcfg_pull_none>,
+                                       <2 RK_PC1 4 &pcfg_pull_none>,
                                        /* cif_d7m1 */
-                                       <2 18 RK_FUNC_4 &pcfg_pull_none>,
+                                       <2 RK_PC2 4 &pcfg_pull_none>,
                                        /* cif_href */
-                                       <3 1 RK_FUNC_2 &pcfg_pull_none>,
+                                       <3 RK_PA1 2 &pcfg_pull_none>,
                                        /* cif_vsync */
-                                       <3 0 RK_FUNC_2 &pcfg_pull_none>,
+                                       <3 RK_PA0 2 &pcfg_pull_none>,
                                        /* cif_clkoutm1 */
-                                       <2 15 RK_FUNC_4 &pcfg_pull_none>,
+                                       <2 RK_PB7 4 &pcfg_pull_none>,
                                        /* cif_clkin */
-                                       <3 2 RK_FUNC_2 &pcfg_pull_none>;
+                                       <3 RK_PA2 2 &pcfg_pull_none>;
                        };
                };
        };
index ccb33d34d12d0ed20856b0c042a37d80a8962e0e..e5659d79995d13c06b89e743b54459803bc4b0fb 100644 (file)
                u-boot,spl-boot-order = &sdhci, &sdmmc;
        };
 };
+
+&rng {
+       status = "okay";
+};
+
+&i2c0 {
+       u-boot,dm-pre-reloc;
+};
+
+&rk808 {
+       u-boot,dm-pre-reloc;
+};
index 4129e902a81822556c5f39b31641ca5986385620..694b0d08d644aeee1015d33d30f192d624a2a4a6 100644 (file)
@@ -1,86 +1,18 @@
-// SPDX-License-Identifier: GPL-2.0+
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
- * (C) Copyright 2016 Rockchip Electronics Co., Ltd
+ * Copyright (c) 2016 Fuzhou Rockchip Electronics Co., Ltd
  */
 
 /dts-v1/;
 #include <dt-bindings/pwm/pwm.h>
-#include <dt-bindings/pinctrl/rockchip.h>
 #include "rk3399.dtsi"
 
 / {
        model = "Rockchip RK3399 Evaluation Board";
-       compatible = "rockchip,rk3399-evb", "rockchip,rk3399",
-                    "google,rk3399evb-rev2";
-
-       chosen {
-               stdout-path = &uart2;
-       };
-
-       vdd_center: vdd-center {
-               compatible = "pwm-regulator";
-               pwms = <&pwm3 0 25000 1>;
-               regulator-name = "vdd_center";
-               regulator-min-microvolt = <800000>;
-               regulator-max-microvolt = <1400000>;
-               regulator-init-microvolt = <950000>;
-               regulator-always-on;
-               regulator-boot-on;
-               status = "okay";
-       };
-
-       vccsys: vccsys {
-               compatible = "regulator-fixed";
-               regulator-name = "vccsys";
-               regulator-boot-on;
-               regulator-always-on;
-       };
-
-       vcc3v3_sys: vcc3v3-sys {
-               compatible = "regulator-fixed";
-               regulator-name = "vcc3v3_sys";
-               regulator-always-on;
-               regulator-boot-on;
-               regulator-min-microvolt = <3300000>;
-               regulator-max-microvolt = <3300000>;
-       };
-
-       vcc_phy: vcc-phy-regulator {
-               compatible = "regulator-fixed";
-               regulator-name = "vcc_phy";
-               regulator-always-on;
-               regulator-boot-on;
-       };
-
-       vcc5v0_host: vcc5v0-host-en {
-               compatible = "regulator-fixed";
-               regulator-name = "vcc5v0_host";
-               gpio = <&gpio4 25 GPIO_ACTIVE_HIGH>;
-       };
-
-       vcc5v0_typec0: vcc5v0-typec0-en {
-               compatible = "regulator-fixed";
-               regulator-name = "vcc5v0_typec0";
-               gpio = <&gpio1 3 GPIO_ACTIVE_HIGH>;
-       };
-
-       vcc5v0_typec1: vcc5v0-typec1-en {
-               compatible = "regulator-fixed";
-               regulator-name = "vcc5v0_typec1";
-               gpio = <&gpio1 4 GPIO_ACTIVE_HIGH>;
-       };
-
-       clkin_gmac: external-gmac-clock {
-               compatible = "fixed-clock";
-               clock-frequency = <125000000>;
-               clock-output-names = "clkin_gmac";
-               #clock-cells = <0>;
-       };
+       compatible = "rockchip,rk3399-evb", "rockchip,rk3399";
 
        backlight: backlight {
                compatible = "pwm-backlight";
-               power-supply = <&vccsys>;
-               enable-gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>;
                brightness-levels = <
                          0   1   2   3   4   5   6   7
                          8   9  10  11  12  13  14  15
                        248 249 250 251 252 253 254 255>;
                default-brightness-level = <200>;
                pwms = <&pwm0 0 25000 0>;
-               pinctrl-names = "default";
-               pinctrl-0 = <&pwm0_pin>;
-               pwm-delay-us = <10000>;
-               status = "disabled";
        };
 
-       panel:panel {
-               compatible = "simple-panel";
-               power-supply = <&vcc33_lcd>;
+       edp_panel: edp-panel {
+               compatible ="lg,lp079qx1-sp0v";
                backlight = <&backlight>;
-               /*enable-gpios = <&gpio4 18 GPIO_ACTIVE_HIGH>;*/
-               status = "disabled";
+               enable-gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_HIGH>;
+               power-supply = <&vcc3v3_s0>;
+
+               port {
+                       panel_in_edp: endpoint {
+                               remote-endpoint = <&edp_out_panel>;
+                       };
+               };
+       };
+
+       clkin_gmac: external-gmac-clock {
+               compatible = "fixed-clock";
+               clock-frequency = <125000000>;
+               clock-output-names = "clkin_gmac";
+               #clock-cells = <0>;
+       };
+
+       vdd_center: vdd-center {
+               compatible = "pwm-regulator";
+               pwms = <&pwm3 0 25000 0>;
+               regulator-name = "vdd_center";
+               regulator-min-microvolt = <800000>;
+               regulator-max-microvolt = <1400000>;
+               regulator-always-on;
+               regulator-boot-on;
+               status = "okay";
+       };
+
+       vcc3v3_sys: vcc3v3-sys {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc3v3_sys";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+       };
+
+       vcc5v0_sys: vcc5v0-sys {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc5v0_sys";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+       };
+
+       vcc5v0_host: vcc5v0-host-regulator {
+               compatible = "regulator-fixed";
+               enable-active-high;
+               gpio = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&vcc5v0_host_en>;
+               regulator-name = "vcc5v0_host";
+               vin-supply = <&vcc5v0_sys>;
+       };
+
+       vcc_phy: vcc-phy-regulator {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc_phy";
+               regulator-always-on;
+               regulator-boot-on;
+       };
+
+       vcc_phy: vcc-phy-regulator {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc_phy";
+               regulator-always-on;
+               regulator-boot-on;
+       };
+
+};
+
+&edp {
+       status = "okay";
+       force-hpd;
+
+       ports {
+               edp_out: port@1 {
+                       reg = <1>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       edp_out_panel: endpoint@0 {
+                               reg = <0>;
+                               remote-endpoint = <&panel_in_edp>;
+                       };
+               };
        };
 };
 
        status = "okay";
 };
 
-&pwm0 {
+&gmac {
+       assigned-clocks = <&cru SCLK_RMII_SRC>;
+       assigned-clock-parents = <&clkin_gmac>;
+       clock_in_out = "input";
+       phy-supply = <&vcc_phy>;
+       phy-mode = "rgmii";
+       pinctrl-names = "default";
+       pinctrl-0 = <&rgmii_pins>;
+       snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
+       snps,reset-active-low;
+       snps,reset-delays-us = <0 10000 50000>;
+       tx_delay = <0x28>;
+       rx_delay = <0x11>;
        status = "okay";
 };
 
-&pwm2 {
+&i2c0 {
        status = "okay";
+
+       rk808: pmic@1b {
+               compatible = "rockchip,rk808";
+               reg = <0x1b>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <21 IRQ_TYPE_LEVEL_LOW>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pmic_int_l>;
+               rockchip,system-power-controller;
+               wakeup-source;
+               #clock-cells = <1>;
+               clock-output-names = "rk808-clkout1", "rk808-clkout2";
+
+               vcc1-supply = <&vcc3v3_sys>;
+               vcc2-supply = <&vcc3v3_sys>;
+               vcc3-supply = <&vcc3v3_sys>;
+               vcc4-supply = <&vcc3v3_sys>;
+               vcc6-supply = <&vcc3v3_sys>;
+               vcc7-supply = <&vcc3v3_sys>;
+               vcc8-supply = <&vcc3v3_sys>;
+               vcc9-supply = <&vcc3v3_sys>;
+               vcc10-supply = <&vcc3v3_sys>;
+               vcc11-supply = <&vcc3v3_sys>;
+               vcc12-supply = <&vcc3v3_sys>;
+               vddio-supply = <&vcc1v8_pmu>;
+
+               regulators {
+                       vdd_log: DCDC_REG1 {
+                               regulator-name = "vdd_log";
+                               regulator-min-microvolt = <750000>;
+                               regulator-max-microvolt = <1350000>;
+                               regulator-ramp-delay = <6001>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <900000>;
+                               };
+                       };
+
+                       vdd_cpu_l: DCDC_REG2 {
+                               regulator-name = "vdd_cpu_l";
+                               regulator-min-microvolt = <750000>;
+                               regulator-max-microvolt = <1350000>;
+                               regulator-ramp-delay = <6001>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vcc_ddr: DCDC_REG3 {
+                               regulator-name = "vcc_ddr";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                               };
+                       };
+
+                       vcc_1v8: DCDC_REG4 {
+                               regulator-name = "vcc_1v8";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <1800000>;
+                               };
+                       };
+
+                       vcc1v8_dvp: LDO_REG1 {
+                               regulator-name = "vcc1v8_dvp";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vcc3v0_tp: LDO_REG2 {
+                               regulator-name = "vcc3v0_tp";
+                               regulator-min-microvolt = <3000000>;
+                               regulator-max-microvolt = <3000000>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vcc1v8_pmu: LDO_REG3 {
+                               regulator-name = "vcc1v8_pmu";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <1800000>;
+                               };
+                       };
+
+                       vcc_sd: LDO_REG4 {
+                               regulator-name = "vcc_sd";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3000000>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <3000000>;
+                               };
+                       };
+
+                       vcca3v0_codec: LDO_REG5 {
+                               regulator-name = "vcca3v0_codec";
+                               regulator-min-microvolt = <3000000>;
+                               regulator-max-microvolt = <3000000>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vcc_1v5: LDO_REG6 {
+                               regulator-name = "vcc_1v5";
+                               regulator-min-microvolt = <1500000>;
+                               regulator-max-microvolt = <1500000>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <1500000>;
+                               };
+                       };
+
+                       vcca1v8_codec: LDO_REG7 {
+                               regulator-name = "vcca1v8_codec";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vcc_3v0: LDO_REG8 {
+                               regulator-name = "vcc_3v0";
+                               regulator-min-microvolt = <3000000>;
+                               regulator-max-microvolt = <3000000>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <3000000>;
+                               };
+                       };
+
+                       vcc3v3_s3: SWITCH_REG1 {
+                               regulator-name = "vcc3v3_s3";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                               };
+                       };
+
+                       vcc3v3_s0: SWITCH_REG2 {
+                               regulator-name = "vcc3v3_s0";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+               };
+       };
+
+       vdd_cpu_b: regulator@40 {
+               compatible = "silergy,syr827";
+               reg = <0x40>;
+               fcs,suspend-voltage-selector = <1>;
+               regulator-name = "vdd_cpu_b";
+               regulator-min-microvolt = <712500>;
+               regulator-max-microvolt = <1500000>;
+               regulator-ramp-delay = <1000>;
+               regulator-always-on;
+               regulator-boot-on;
+               vin-supply = <&vcc5v0_sys>;
+
+               regulator-state-mem {
+                       regulator-off-in-suspend;
+               };
+       };
+
+       vdd_gpu: regulator@41 {
+               compatible = "silergy,syr828";
+               reg = <0x41>;
+               fcs,suspend-voltage-selector = <1>;
+               regulator-name = "vdd_gpu";
+               regulator-min-microvolt = <712500>;
+               regulator-max-microvolt = <1500000>;
+               regulator-ramp-delay = <1000>;
+               regulator-always-on;
+               regulator-boot-on;
+               vin-supply = <&vcc5v0_sys>;
+
+               regulator-state-mem {
+                       regulator-off-in-suspend;
+               };
+       };
 };
 
-&pwm3 {
+&pwm0 {
        status = "okay";
 };
 
-&saradc {
+&pwm2 {
        status = "okay";
 };
 
-&sdmmc {
-       bus-width = <4>;
+&pwm3 {
        status = "okay";
 };
 
        status = "okay";
 };
 
-&uart2 {
-       status = "okay";
+&pcie_phy {
+       status = "disabled";
 };
 
-&usb_host0_ehci {
-       status = "okay";
+&pcie0 {
+       ep-gpios = <&gpio3 RK_PB5 GPIO_ACTIVE_HIGH>;
+       num-lanes = <4>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pcie_clkreqn_cpm>;
+       status = "disabled";
 };
 
-&usb_host0_ohci {
+&u2phy0 {
        status = "okay";
 };
 
-&usbdrd3_0 {
-       vbus-supply = <&vcc5v0_typec0>;
+&u2phy0_host {
+       phy-supply = <&vcc5v0_host>;
        status = "okay";
 };
 
-&usb_host1_ehci {
+&u2phy1 {
        status = "okay";
 };
 
-&usb_host1_ohci {
+&u2phy1_host {
+       phy-supply = <&vcc5v0_host>;
        status = "okay";
 };
 
-&usbdrd3_1 {
-       vbus-supply = <&vcc5v0_typec1>;
+&uart2 {
        status = "okay";
 };
 
-&i2c0 {
+&usb_host0_ehci {
        status = "okay";
-       clock-frequency = <400000>;
-       i2c-scl-falling-time-ns = <50>;
-       i2c-scl-rising-time-ns = <100>;
-       u-boot,dm-pre-reloc;
-
-       rk808: pmic@1b {
-               compatible = "rockchip,rk808";
-               clock-output-names = "xin32k", "wifibt_32kin";
-               interrupt-parent = <&gpio0>;
-               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
-               pinctrl-names = "default";
-               pinctrl-0 = <&pmic_int_l>;
-               reg = <0x1b>;
-               rockchip,system-power-controller;
-               #clock-cells = <1>;
-               u-boot,dm-pre-reloc;
-               status = "okay";
+};
 
-               vcc12-supply = <&vcc3v3_sys>;
+&usb_host0_ohci {
+       status = "okay";
+};
 
-               regulators {
-                       vcc33_lcd: SWITCH_REG2 {
-                               regulator-always-on;
-                               regulator-boot-on;
-                               regulator-name = "vcc33_lcd";
-                       };
-               };
-       };
+&usb_host1_ehci {
+       status = "okay";
 };
 
-&mipi_dsi {
-       status = "disabled";
-       rockchip,panel = <&panel>;
-       display-timings {
-               timing0 {
-               bits-per-pixel = <24>;
-               clock-frequency = <160000000>;
-               hfront-porch = <120>;
-               hsync-len = <20>;
-               hback-porch = <21>;
-               hactive = <1200>;
-               vfront-porch = <21>;
-               vsync-len = <3>;
-               vback-porch = <18>;
-               vactive = <1920>;
-               hsync-active = <0>;
-               vsync-active = <0>;
-               de-active = <1>;
-               pixelclk-active = <0>;
-               };
-       };
+&usb_host1_ohci {
+       status = "okay";
 };
 
 &pinctrl {
        pmic {
                pmic_int_l: pmic-int-l {
                        rockchip,pins =
-                               <1 21 RK_FUNC_GPIO &pcfg_pull_up>;
+                               <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>;
                };
+       };
 
-               pmic_dvs2: pmic-dvs2 {
+       usb2 {
+               vcc5v0_host_en: vcc5v0-host-en {
                        rockchip,pins =
-                               <1 18 RK_FUNC_GPIO &pcfg_pull_down>;
+                               <4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
 
-&gmac {
-        phy-supply = <&vcc_phy>;
-       phy-mode = "rgmii";
-       clock_in_out = "input";
-       snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
-       snps,reset-active-low;
-       snps,reset-delays-us = <0 10000 50000>;
-       assigned-clocks = <&cru SCLK_RMII_SRC>;
-       assigned-clock-parents = <&clkin_gmac>;
-       pinctrl-names = "default";
-       pinctrl-0 = <&rgmii_pins>;
-       tx_delay = <0x28>;
-       rx_delay = <0x11>;
+&vopb {
+       status = "okay";
+};
+
+&vopb_mmu {
        status = "okay";
 };
index 6b059bd7a04fe2ee2acbb7c67507064ad64c0155..ebe2ee77ba1f60aaeec9914b7158c83a90cb23e7 100644 (file)
        };
 };
 
+&spi1 {
+       /* On both Low speed and High speed expansion */
+       cs-gpios = <0>, <&gpio4 RK_PA6 0>, <&gpio4 RK_PA7 0>;
+       status = "okay";
+};
+
 &usbdrd_dwc3_0 {
        dr_mode = "host";
 };
index 89c67fd24cc93894ef354f3480bce3398818c786..d63faf38cc81a8e2b38ef282e204c4280256316a 100644 (file)
@@ -1,19 +1,20 @@
-// SPDX-License-Identifier: GPL-2.0+
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
  * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd.
  */
 
 /dts-v1/;
+#include <dt-bindings/input/linux-event-codes.h>
 #include <dt-bindings/pwm/pwm.h>
-#include <dt-bindings/pinctrl/rockchip.h>
 #include "rk3399.dtsi"
+#include "rk3399-opp.dtsi"
 
 / {
        model = "Firefly-RK3399 Board";
        compatible = "firefly,firefly-rk3399", "rockchip,rk3399";
 
        chosen {
-               stdout-path = &uart2;
+               stdout-path = "serial2:1500000n8";
        };
 
        backlight: backlight {
                #clock-cells = <0>;
        };
 
+       dc_12v: dc-12v {
+               compatible = "regulator-fixed";
+               regulator-name = "dc_12v";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <12000000>;
+               regulator-max-microvolt = <12000000>;
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+               autorepeat;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pwrbtn>;
+
+               power {
+                       debounce-interval = <100>;
+                       gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>;
+                       label = "GPIO Key Power";
+                       linux,code = <KEY_POWER>;
+                       wakeup-source;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&work_led_gpio>, <&diy_led_gpio>;
+
+               work-led {
+                       label = "work";
+                       default-state = "on";
+                       gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>;
+               };
+
+               diy-led {
+                       label = "diy";
+                       default-state = "off";
+                       gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
        rt5640-sound {
                compatible = "simple-audio-card";
                simple-audio-card,name = "rockchip,rt5640-codec";
                reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>;
        };
 
+       /* switched by pmic_sleep */
+       vcc1v8_s3: vcca1v8_s3: vcc1v8-s3 {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc1v8_s3";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               vin-supply = <&vcc_1v8>;
+       };
+
        vcc3v3_pcie: vcc3v3-pcie-regulator {
                compatible = "regulator-fixed";
                enable-active-high;
                gpio = <&gpio1 RK_PC1 GPIO_ACTIVE_HIGH>;
                pinctrl-names = "default";
-               pinctrl-0 = <&pcie_drv>;
+               pinctrl-0 = <&pcie_pwr_en>;
                regulator-name = "vcc3v3_pcie";
                regulator-always-on;
                regulator-boot-on;
+               vin-supply = <&dc_12v>;
        };
 
        vcc3v3_sys: vcc3v3-sys {
                regulator-boot-on;
                regulator-min-microvolt = <3300000>;
                regulator-max-microvolt = <3300000>;
+               vin-supply = <&vcc_sys>;
        };
 
+       /* Actually 3 regulators (host0, 1, 2) controlled by the same gpio */
        vcc5v0_host: vcc5v0-host-regulator {
                compatible = "regulator-fixed";
                enable-active-high;
                gpio = <&gpio1 RK_PA0 GPIO_ACTIVE_HIGH>;
                pinctrl-names = "default";
-               pinctrl-0 = <&host_vbus_drv>;
+               pinctrl-0 = <&vcc5v0_host_en>;
                regulator-name = "vcc5v0_host";
                regulator-always-on;
+               vin-supply = <&vcc_sys>;
        };
 
-       vcc5v0_sys: vcc5v0-sys {
+       vcc_sys: vcc-sys {
                compatible = "regulator-fixed";
-               regulator-name = "vcc5v0_sys";
+               regulator-name = "vcc_sys";
                regulator-always-on;
                regulator-boot-on;
                regulator-min-microvolt = <5000000>;
                regulator-max-microvolt = <5000000>;
-       };
-
-       vcc_phy: vcc-phy-regulator {
-               compatible = "regulator-fixed";
-               regulator-name = "vcc_phy";
-               regulator-always-on;
-               regulator-boot-on;
+               vin-supply = <&dc_12v>;
        };
 
        vdd_log: vdd-log {
                regulator-boot-on;
                regulator-min-microvolt = <430000>;
                regulator-max-microvolt = <1400000>;
-               regulator-init-microvolt = <950000>;
-       };
-
-       vccadc_ref: vccadc-ref {
-               compatible = "regulator-fixed";
-               regulator-name = "vcc1v8_sys";
-               regulator-always-on;
-               regulator-boot-on;
-               regulator-min-microvolt = <1800000>;
-               regulator-max-microvolt = <1800000>;
+               vin-supply = <&vcc_sys>;
        };
 };
 
        assigned-clocks = <&cru SCLK_RMII_SRC>;
        assigned-clock-parents = <&clkin_gmac>;
        clock_in_out = "input";
-       phy-supply = <&vcc_phy>;
+       phy-supply = <&vcc_lan>;
        phy-mode = "rgmii";
        pinctrl-names = "default";
        pinctrl-0 = <&rgmii_pins>;
        snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
        snps,reset-active-low;
        snps,reset-delays-us = <0 10000 50000>;
-       tx_delay = <0x33>;
-       rx_delay = <0x45>;
+       tx_delay = <0x28>;
+       rx_delay = <0x11>;
+       status = "okay";
+};
+
+&hdmi {
+       ddc-i2c-bus = <&i2c3>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&hdmi_cec>;
        status = "okay";
 };
 
                rockchip,system-power-controller;
                wakeup-source;
 
-               vcc1-supply = <&vcc3v3_sys>;
-               vcc2-supply = <&vcc3v3_sys>;
-               vcc3-supply = <&vcc3v3_sys>;
-               vcc4-supply = <&vcc3v3_sys>;
-               vcc6-supply = <&vcc3v3_sys>;
-               vcc7-supply = <&vcc3v3_sys>;
+               vcc1-supply = <&vcc_sys>;
+               vcc2-supply = <&vcc_sys>;
+               vcc3-supply = <&vcc_sys>;
+               vcc4-supply = <&vcc_sys>;
+               vcc6-supply = <&vcc_sys>;
+               vcc7-supply = <&vcc_sys>;
                vcc8-supply = <&vcc3v3_sys>;
-               vcc9-supply = <&vcc3v3_sys>;
-               vcc10-supply = <&vcc3v3_sys>;
-               vcc11-supply = <&vcc3v3_sys>;
+               vcc9-supply = <&vcc_sys>;
+               vcc10-supply = <&vcc_sys>;
+               vcc11-supply = <&vcc_sys>;
                vcc12-supply = <&vcc3v3_sys>;
                vddio-supply = <&vcc1v8_pmu>;
 
                                };
                        };
 
-                       vcc3v0_tp: LDO_REG2 {
-                               regulator-name = "vcc3v0_tp";
+                       vcc2v8_dvp: LDO_REG2 {
+                               regulator-name = "vcc2v8_dvp";
                                regulator-always-on;
                                regulator-boot-on;
-                               regulator-min-microvolt = <3000000>;
-                               regulator-max-microvolt = <3000000>;
+                               regulator-min-microvolt = <2800000>;
+                               regulator-max-microvolt = <2800000>;
                                regulator-state-mem {
                                        regulator-off-in-suspend;
                                };
                                };
                        };
 
-                       vcc_sd: LDO_REG4 {
-                               regulator-name = "vcc_sd";
+                       vcc_sdio: LDO_REG4 {
+                               regulator-name = "vcc_sdio";
                                regulator-always-on;
                                regulator-boot-on;
                                regulator-min-microvolt = <1800000>;
                                };
                        };
 
-                       vcc3v3_s3: SWITCH_REG1 {
+                       vcc3v3_s3: vcc_lan: SWITCH_REG1 {
                                regulator-name = "vcc3v3_s3";
                                regulator-always-on;
                                regulator-boot-on;
                regulator-ramp-delay = <1000>;
                regulator-always-on;
                regulator-boot-on;
-               vin-supply = <&vcc5v0_sys>;
+               vin-supply = <&vcc_sys>;
 
                regulator-state-mem {
                        regulator-off-in-suspend;
                regulator-ramp-delay = <1000>;
                regulator-always-on;
                regulator-boot-on;
-               vin-supply = <&vcc5v0_sys>;
+               vin-supply = <&vcc_sys>;
 
                regulator-state-mem {
                        regulator-off-in-suspend;
 &i2s0 {
        rockchip,playback-channels = <8>;
        rockchip,capture-channels = <8>;
-       #sound-dai-cells = <0>;
        status = "okay";
 };
 
 &i2s1 {
        rockchip,playback-channels = <2>;
        rockchip,capture-channels = <2>;
-       #sound-dai-cells = <0>;
        status = "okay";
 };
 
 &i2s2 {
-       #sound-dai-cells = <0>;
        status = "okay";
 };
 
 
        bt656-supply = <&vcc1v8_dvp>;
        audio-supply = <&vcca1v8_codec>;
-       sdmmc-supply = <&vcc_sd>;
+       sdmmc-supply = <&vcc_sdio>;
        gpio1830-supply = <&vcc_3v0>;
 };
 
        ep-gpios = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>;
        num-lanes = <4>;
        pinctrl-names = "default";
-       pinctrl-0 = <&pcie_clkreqn>;
+       pinctrl-0 = <&pcie_clkreqn_cpm>;
        status = "okay";
 };
 
        };
 
        pcie {
-               pcie_drv: pcie-drv {
+               pcie_pwr_en: pcie-pwr-en {
                        rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
        };
 
        usb2 {
-               host_vbus_drv: host-vbus-drv {
+               vcc5v0_host_en: vcc5v0-host-en {
                        rockchip,pins = <1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
+
+       wifi {
+               wifi_host_wake_l: wifi-host-wake-l {
+                       rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
+       leds {
+               work_led_gpio: work_led-gpio {
+                       rockchip,pins = <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+
+               diy_led_gpio: diy_led-gpio {
+                       rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
 };
 
 &pwm0 {
 };
 
 &saradc {
-       vref-supply = <&vccadc_ref>;
+       vref-supply = <&vcca1v8_s3>;
        status = "okay";
 };
 
+&sdio0 {
+       /* WiFi & BT combo module Ampak AP6356S */
+       bus-width = <4>;
+       cap-sdio-irq;
+       cap-sd-highspeed;
+       keep-power-in-suspend;
+       mmc-pwrseq = <&sdio_pwrseq>;
+       non-removable;
+       pinctrl-names = "default";
+       pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>;
+       sd-uhs-sdr104;
+
+       /* Power supply */
+       vqmmc-supply = &vcc1v8_s3;      /* IO line */
+       vmmc-supply = &vcc_sdio;        /* card's power */
+
+       #address-cells = <1>;
+       #size-cells = <0>;
+       status = "okay";
+
+       brcmf: wifi@1 {
+               reg = <1>;
+               compatible = "brcm,bcm4329-fmac";
+               interrupt-parent = <&gpio0>;
+               interrupts = <RK_PA3 GPIO_ACTIVE_HIGH>;
+               interrupt-names = "host-wake";
+               brcm,drive-strength = <5>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&wifi_host_wake_l>;
+       };
+};
+
 &sdmmc {
        bus-width = <4>;
+       cap-mmc-highspeed;
+       cap-sd-highspeed;
+       cd-gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
+       disable-wp;
+       max-frequency = <150000000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_bus4>;
        status = "okay";
 };
 
 &sdhci {
        bus-width = <8>;
-       keep-power-in-suspend;
        mmc-hs400-1_8v;
        mmc-hs400-enhanced-strobe;
        non-removable;
        status = "okay";
 };
 
+&tcphy0 {
+       status = "okay";
+};
+
+&tcphy1 {
+       status = "okay";
+};
+
 &tsadc {
        /* tshut mode 0:CRU 1:GPIO */
        rockchip,hw-tshut-mode = <1>;
 &usb_host1_ohci {
        status = "okay";
 };
+
+&usbdrd3_0 {
+       status = "okay";
+};
+
+&usbdrd_dwc3_0 {
+       status = "okay";
+       dr_mode = "otg";
+};
+
+&usbdrd3_1 {
+       status = "okay";
+};
+
+&usbdrd_dwc3_1 {
+       status = "okay";
+       dr_mode = "host";
+};
+
+&vopb {
+       status = "okay";
+};
+
+&vopb_mmu {
+       status = "okay";
+};
+
+&vopl {
+       status = "okay";
+};
+
+&vopl_mmu {
+       status = "okay";
+};
index 1ee0dc0d9f10ff9641f02bdad4aae75fc225d078..e6c1c94c8d69c5e4be895b4d91d7ec38c3c37f22 100644 (file)
                     "google,bob", "google,gru", "rockchip,rk3399";
 
        edp_panel: edp-panel {
-               compatible = "boe,nv101wxmn51", "simple-panel";
+               compatible = "boe,nv101wxmn51";
                backlight = <&backlight>;
                power-supply = <&pp3300_disp>;
 
-               ports {
+               port {
                        panel_in_edp: endpoint {
                                remote-endpoint = <&edp_out_panel>;
                        };
 
 &spi0 {
        status = "okay";
+
+       cr50@0 {
+               compatible = "google,cr50";
+               reg = <0>;
+               interrupt-parent = <&gpio0>;
+               interrupts = <5 IRQ_TYPE_EDGE_RISING>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&h1_int_od_l>;
+               spi-max-frequency = <800000>;
+       };
 };
 
 &pinctrl {
        tpm {
                h1_int_od_l: h1-int-od-l {
-                       rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 };
index c6495adccae2b2f27662630864223085e871469a..1384dabbdf4067b38af92ccf017f6afc9c6fec11 100644 (file)
 
        backlight: backlight {
                compatible = "pwm-backlight";
-               brightness-levels = <0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
-                                    17 18 19 20 21 22 23 24 25 26 27 28 29 30
-                                    31 32 33 34 35 36 37 38 39 40 41 42 43 44
-                                    45 46 47 48 49 50 51 52 53 54 55 56 57 58
-                                    59 60 61 62 63 64 65 66 67 68 69 70 71 72
-                                    73 74 75 76 77 78 79 80 81 82 83 84 85 86
-                                    87 88 89 90 91 92 93 94 95 96 97 98 99 100>;
-               default-brightness-level = <51>;
                enable-gpios = <&gpio1 17 GPIO_ACTIVE_HIGH>;
                power-supply = <&pp3300_disp>;
                pinctrl-names = "default";
                pinctrl-0 = <&bl_en>;
                pwm-delay-us = <10000>;
        };
+
+       gpio_keys: gpio-keys {
+               compatible = "gpio-keys";
+               pinctrl-names = "default";
+               pinctrl-0 = <&bt_host_wake_l>;
+
+               wake_on_bt: wake-on-bt {
+                       label = "Wake-on-Bluetooth";
+                       gpios = <&gpio0 3 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_WAKEUP>;
+                       wakeup-source;
+               };
+       };
 };
 
 &ppvar_bigcpu {
 &edp {
        status = "okay";
 
-       rockchip,panel = <&edp_panel>;
        ports {
                edp_out: port@1 {
                        reg = <1>;
@@ -287,11 +291,9 @@ ap_i2c_tp: &i2c5 {
                #pwm-cells = <1>;
        };
 
-       usbc_extcon1: extcon@1 {
+       usbc_extcon1: extcon1 {
                compatible = "google,extcon-usbc-cros-ec";
                google,usb-port-id = <1>;
-
-               #extcon-cells = <0>;
        };
 };
 
@@ -361,27 +363,27 @@ ap_i2c_tp: &i2c5 {
 &pinctrl {
        discrete-regulators {
                pp1500_en: pp1500-en {
-                       rockchip,pins = <RK_GPIO0 10 RK_FUNC_GPIO
+                       rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO
                                         &pcfg_pull_none>;
                };
 
                pp1800_audio_en: pp1800-audio-en {
-                       rockchip,pins = <RK_GPIO0 2 RK_FUNC_GPIO
+                       rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO
                                         &pcfg_pull_down>;
                };
 
                pp3000_en: pp3000-en {
-                       rockchip,pins = <RK_GPIO0 12 RK_FUNC_GPIO
+                       rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO
                                         &pcfg_pull_none>;
                };
 
                pp3300_disp_en: pp3300-disp-en {
-                       rockchip,pins = <RK_GPIO4 27 RK_FUNC_GPIO
+                       rockchip,pins = <4 RK_PD3 RK_FUNC_GPIO
                                         &pcfg_pull_none>;
                };
 
                wlan_module_pd_l: wlan-module-pd-l {
-                       rockchip,pins = <RK_GPIO0 4 RK_FUNC_GPIO
+                       rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO
                                         &pcfg_pull_down>;
                };
        };
@@ -389,10 +391,10 @@ ap_i2c_tp: &i2c5 {
 
 &wifi {
        wifi_perst_l: wifi-perst-l {
-               rockchip,pins = <2 27 RK_FUNC_GPIO &pcfg_pull_none>;
+               rockchip,pins = <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>;
        };
 
        wlan_host_wake_l: wlan-host-wake-l {
-               rockchip,pins = <0 8 RK_FUNC_GPIO &pcfg_pull_none>;
+               rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
        };
 };
index 2cc7c47d6a85d79312a519dd0a0c02964f9223ff..2bbef9fcbe2704065b2999d0b113b4cf34b318a2 100644 (file)
        };
 
        edp_panel: edp-panel {
-               compatible = "sharp,lq123p1jx31", "simple-panel";
+               compatible = "sharp,lq123p1jx31";
                backlight = <&backlight>;
                power-supply = <&pp3300_disp>;
 
-               ports {
+               panel-timing {
+                       clock-frequency = <266666667>;
+                       hactive = <2400>;
+                       hfront-porch = <48>;
+                       hback-porch = <84>;
+                       hsync-len = <32>;
+                       hsync-active = <0>;
+                       vactive = <1600>;
+                       vfront-porch = <3>;
+                       vback-porch = <120>;
+                       vsync-len = <10>;
+                       vsync-active = <0>;
+               };
+
+               port {
                        panel_in_edp: endpoint {
                                remote-endpoint = <&edp_out_panel>;
                        };
                        map0 {
                                trip = <&ppvar_bigcpu_alert>;
                                cooling-device =
-                                       <&cpu_l0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                                       <&cpu_l0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                       <&cpu_l1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                       <&cpu_l2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                       <&cpu_l3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
                                contribution = <4096>;
                        };
                        map1 {
                                trip = <&ppvar_bigcpu_alert>;
                                cooling-device =
-                                       <&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                                       <&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                       <&cpu_b1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
                                contribution = <1024>;
                        };
                };
@@ -286,24 +304,24 @@ ap_i2c_dig: &i2c2 {
        digitizer {
                /* Has external pullup */
                cpu1_dig_irq_l: cpu1-dig-irq-l {
-                       rockchip,pins = <2 4 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                /* Has external pullup */
                cpu1_dig_pdct_l: cpu1-dig-pdct-l {
-                       rockchip,pins = <2 5 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        discrete-regulators {
                cpu3_pen_pwr_en: cpu3-pen-pwr-en {
-                       rockchip,pins = <4 30 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <4 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        pen {
                cpu1_pen_eject: cpu1-pen-eject {
-                       rockchip,pins = <0 13 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 };
index 0e2e0471808d5dc78c3857b8132314f99d9e3213..7ac88392f2c2ddf877007b0ff28c08def08c002b 100644 (file)
 
 / {
        chosen {
-               u-boot,dm-pre-reloc;
                stdout-path = "serial2:115200n8";
-               u-boot,spl-boot-order = &spi_flash;
-       };
-
-       config {
-               u-boot,spl-payload-offset = <0x40000>;
        };
 
        /*
        pp5000_usb_a_vbus: pp5000 {
        };
 
-       gpio_keys: gpio-keys {
-               compatible = "gpio-keys";
-               pinctrl-names = "default";
-               pinctrl-0 = <&bt_host_wake_l>;
-
-               wake_on_bt: wake-on-bt {
-                       label = "Wake-on-Bluetooth";
-                       gpios = <&gpio0 3 GPIO_ACTIVE_LOW>;
-                       linux,code = <KEY_WAKEUP>;
-                       wakeup-source;
-               };
+       ap_rtc_clk: ap-rtc-clk {
+               compatible = "fixed-clock";
+               clock-frequency = <32768>;
+               clock-output-names = "xin32k";
+               #clock-cells = <0>;
        };
 
        max98357a: max98357a {
@@ -549,8 +537,7 @@ ap_i2c_audio: &i2c8 {
        pinctrl-names = "default", "sleep";
        pinctrl-1 = <&spi1_sleep>;
 
-       spi_flash: spiflash@0 {
-               u-boot,dm-pre-reloc;
+       spiflash@0 {
                compatible = "jedec,spi-nor";
                reg = <0>;
 
@@ -565,16 +552,12 @@ ap_i2c_audio: &i2c8 {
 
 &spi5 {
        status = "okay";
-       spi-activate-delay = <100>;
-       spi-max-frequency = <3000000>;
-       spi-deactivate-delay = <200>;
 
        cros_ec: ec@0 {
                compatible = "google,cros-ec-spi";
                reg = <0>;
                interrupt-parent = <&gpio0>;
                interrupts = <1 IRQ_TYPE_LEVEL_LOW>;
-               ec-interrupt = <&gpio0 1 GPIO_ACTIVE_LOW>;
                pinctrl-names = "default";
                pinctrl-0 = <&ec_ap_int_l>;
                spi-max-frequency = <3000000>;
@@ -586,11 +569,9 @@ ap_i2c_audio: &i2c8 {
                        #size-cells = <0>;
                };
 
-               usbc_extcon0: extcon@0 {
+               usbc_extcon0: extcon0 {
                        compatible = "google,extcon-usbc-cros-ec";
                        google,usb-port-id = <0>;
-
-                       #extcon-cells = <0>;
                };
        };
 };
@@ -692,29 +673,29 @@ ap_i2c_audio: &i2c8 {
 
        backlight-enable {
                bl_en: bl-en {
-                       rockchip,pins = <1 17 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        cros-ec {
                ec_ap_int_l: ec-ap-int-l {
-                       rockchip,pins = <RK_GPIO0 1 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        discrete-regulators {
                sd_io_pwr_en: sd-io-pwr-en {
-                       rockchip,pins = <RK_GPIO2 2 RK_FUNC_GPIO
+                       rockchip,pins = <2 RK_PA2 RK_FUNC_GPIO
                                         &pcfg_pull_none>;
                };
 
                sd_pwr_1800_sel: sd-pwr-1800-sel {
-                       rockchip,pins = <RK_GPIO2 28 RK_FUNC_GPIO
+                       rockchip,pins = <2 RK_PD4 RK_FUNC_GPIO
                                         &pcfg_pull_none>;
                };
 
                sd_slot_pwr_en: sd-slot-pwr-en {
-                       rockchip,pins = <RK_GPIO4 29 RK_FUNC_GPIO
+                       rockchip,pins = <4 RK_PD5 RK_FUNC_GPIO
                                         &pcfg_pull_none>;
                };
        };
@@ -722,17 +703,17 @@ ap_i2c_audio: &i2c8 {
        codec {
                /* Has external pullup */
                headset_int_l: headset-int-l {
-                       rockchip,pins = <1 23 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <1 RK_PC7 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                mic_int: mic-int {
-                       rockchip,pins = <1 13 RK_FUNC_GPIO &pcfg_pull_down>;
+                       rockchip,pins = <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_down>;
                };
        };
 
        max98357a {
                sdmode_en: sdmode-en {
-                       rockchip,pins = <1 2 RK_FUNC_GPIO &pcfg_pull_down>;
+                       rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_down>;
                };
        };
 
@@ -743,7 +724,7 @@ ap_i2c_audio: &i2c8 {
                         * to hack this as gpio, so the EP could be able to
                         * de-assert it along and make ClockPM(CPM) work.
                         */
-                       rockchip,pins = <2 26 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
@@ -754,20 +735,20 @@ ap_i2c_audio: &i2c8 {
                 */
                sdmmc_bus4: sdmmc-bus4 {
                        rockchip,pins =
-                               <4 8 RK_FUNC_1 &pcfg_pull_none_8ma>,
-                               <4 9 RK_FUNC_1 &pcfg_pull_none_8ma>,
-                               <4 10 RK_FUNC_1 &pcfg_pull_none_8ma>,
-                               <4 11 RK_FUNC_1 &pcfg_pull_none_8ma>;
+                               <4 RK_PB0 1 &pcfg_pull_none_8ma>,
+                               <4 RK_PB1 1 &pcfg_pull_none_8ma>,
+                               <4 RK_PB2 1 &pcfg_pull_none_8ma>,
+                               <4 RK_PB3 1 &pcfg_pull_none_8ma>;
                };
 
                sdmmc_clk: sdmmc-clk {
                        rockchip,pins =
-                               <4 12 RK_FUNC_1 &pcfg_pull_none_8ma>;
+                               <4 RK_PB4 1 &pcfg_pull_none_8ma>;
                };
 
                sdmmc_cmd: sdmmc-cmd {
                        rockchip,pins =
-                               <4 13 RK_FUNC_1 &pcfg_pull_none_8ma>;
+                               <4 RK_PB5 1 &pcfg_pull_none_8ma>;
                };
 
                /*
@@ -781,12 +762,12 @@ ap_i2c_audio: &i2c8 {
                 */
                sdmmc_cd: sdmmc-cd {
                        rockchip,pins =
-                               <0 7 RK_FUNC_1 &pcfg_pull_none>;
+                               <0 RK_PA7 1 &pcfg_pull_none>;
                };
 
                /* This is where we actually hook up CD; has external pull */
                sdmmc_cd_gpio: sdmmc-cd-gpio {
-                       rockchip,pins = <4 24 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <4 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
@@ -796,47 +777,47 @@ ap_i2c_audio: &i2c8 {
                         * Pull down SPI1 CLK/CS/RX/TX during suspend, to
                         * prevent leakage.
                         */
-                       rockchip,pins = <1 9 RK_FUNC_GPIO &pcfg_pull_down>,
-                                       <1 10 RK_FUNC_GPIO &pcfg_pull_down>,
-                                       <1 7 RK_FUNC_GPIO &pcfg_pull_down>,
-                                       <1 8 RK_FUNC_GPIO &pcfg_pull_down>;
+                       rockchip,pins = <1 RK_PB1 RK_FUNC_GPIO &pcfg_pull_down>,
+                                       <1 RK_PB2 RK_FUNC_GPIO &pcfg_pull_down>,
+                                       <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_down>,
+                                       <1 RK_PB0 RK_FUNC_GPIO &pcfg_pull_down>;
                };
        };
 
        touchscreen {
                touch_int_l: touch-int-l {
-                       rockchip,pins = <3 13 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <3 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>;
                };
 
                touch_reset_l: touch-reset-l {
-                       rockchip,pins = <4 26 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <4 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        trackpad {
                ap_i2c_tp_pu_en: ap-i2c-tp-pu-en {
-                       rockchip,pins = <3 12 RK_FUNC_GPIO &pcfg_output_high>;
+                       rockchip,pins = <3 RK_PB4 RK_FUNC_GPIO &pcfg_output_high>;
                };
 
                trackpad_int_l: trackpad-int-l {
-                       rockchip,pins = <1 4 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <1 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        wifi: wifi {
                wlan_module_reset_l: wlan-module-reset-l {
-                       rockchip,pins = <1 11 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <1 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                bt_host_wake_l: bt-host-wake-l {
                        /* Kevin has an external pull up, but Gru does not */
-                       rockchip,pins = <0 3 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        write-protect {
                ap_fw_wp: ap-fw-wp {
-                       rockchip,pins = <1 18 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 };
index 4944d78a0a1cbb44013e261c275de6074d5d836d..e87a04477440e29d2adbb144e66b1cbd48a38aed 100644 (file)
        sd-uhs-sdr104;
        vqmmc-supply = <&vcc1v8_s3>;
        vmmc-supply = <&vccio_sd>;
+       #address-cells = <1>;
+       #size-cells = <0>;
        status = "okay";
 
        brcmf: wifi@1 {
+               reg = <1>;
                compatible = "brcm,bcm4329-fmac";
                interrupt-parent = <&gpio0>;
                interrupts = <RK_PA3 GPIO_ACTIVE_HIGH>;
index 32baa57b94819912d8ac554eed9eac9e0789162a..73be38a537960ed9d551a453e81d26c7d2c89126 100644 (file)
                regulator-max-microvolt = <5000000>;
        };
 
-       vcc5v0_sys: vcc5v0-sys {
+       vcc3v3_lan: vcc3v3-lan {
                compatible = "regulator-fixed";
-               regulator-name = "vcc5v0_sys";
+               regulator-name = "vcc3v3_lan";
                regulator-always-on;
                regulator-boot-on;
-               regulator-min-microvolt = <5000000>;
-               regulator-max-microvolt = <5000000>;
-               vin-supply = <&dc5v_adp>;
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               vim-supply = <&vcc3v3_sys>;
        };
 
        vcc3v3_sys: vcc3v3-sys {
                vin-supply = <&vcc5v0_sys>;
        };
 
-       vcc3v3_lan: vcc3v3-lan {
+       vcc5v0_sys: vcc5v0-sys {
                compatible = "regulator-fixed";
-               regulator-name = "vcc3v3_lan";
+               regulator-name = "vcc5v0_sys";
                regulator-always-on;
                regulator-boot-on;
-               regulator-min-microvolt = <3300000>;
-               regulator-max-microvolt = <3300000>;
-               vim-supply = <&vcc3v3_sys>;
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               vin-supply = <&dc5v_adp>;
        };
 
        vdd_log: vdd-log {
        };
 };
 
+&sdhci {
+       bus-width = <8>;
+       mmc-hs400-1_8v;
+       mmc-hs400-enhanced-strobe;
+       non-removable;
+       status = "okay";
+};
+
 &sdmmc {
        bus-width = <4>;
        cap-mmc-highspeed;
        status = "okay";
 };
 
-&sdhci {
-       bus-width = <8>;
-       mmc-hs400-1_8v;
-       mmc-hs400-enhanced-strobe;
-       non-removable;
-       status = "okay";
-};
-
 &tcphy0 {
        status = "okay";
 };
index 84433cf02be98c75d5e6d378cac6dc5860a614f5..e0d75617bb7e2b9d25656d762bee8902d2ac8f32 100644 (file)
                pinctrl-names = "default";
                pinctrl-0 = <&ir_rx>;
        };
+
+       fan: pwm-fan {
+               compatible = "pwm-fan";
+               /*
+                * With 20KHz PWM and an EVERCOOL EC4007H12SA fan, these levels
+                * work out to 0, ~1200, ~3000, and 5000RPM respectively.
+                */
+               cooling-levels = <0 12 18 255>;
+               #cooling-cells = <2>;
+               fan-supply = <&vcc12v0_sys>;
+               pwms = <&pwm1 0 50000 0>;
+       };
+};
+
+&cpu_thermal {
+       trips {
+               cpu_warm: cpu_warm {
+                       temperature = <55000>;
+                       hysteresis = <2000>;
+                       type = "active";
+               };
+
+               cpu_hot: cpu_hot {
+                       temperature = <65000>;
+                       hysteresis = <2000>;
+                       type = "active";
+               };
+       };
+
+       cooling-maps {
+               map2 {
+                       trip = <&cpu_warm>;
+                       cooling-device = <&fan THERMAL_NO_LIMIT 1>;
+               };
+
+               map3 {
+                       trip = <&cpu_hot>;
+                       cooling-device = <&fan 2 THERMAL_NO_LIMIT>;
+               };
+       };
+};
+
+&pcie0 {
+       num-lanes = <4>;
+       vpcie3v3-supply = <&vcc3v3_sys>;
 };
 
 &pinctrl {
        ir {
                ir_rx: ir-rx {
                        /* external pullup to VCC3V3_SYS, despite being 1.8V :/ */
-                       rockchip,pins = <0 RK_PA6 RK_FUNC_1 &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PA6 1 &pcfg_pull_none>;
                };
        };
 };
diff --git a/arch/arm/dts/rk3399-nanopi-m4-2gb-u-boot.dtsi b/arch/arm/dts/rk3399-nanopi-m4-2gb-u-boot.dtsi
new file mode 100644 (file)
index 0000000..a2f9786
--- /dev/null
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Jagan Teki <jagan@amarulasolutions.com>
+ * Copyright (C) 2020 Deepak Das <deepakdas.linux@gmail.com>
+ */
+
+#include "rk3399-nanopi4-u-boot.dtsi"
+#include "rk3399-sdram-ddr3-1866.dtsi"
diff --git a/arch/arm/dts/rk3399-nanopi-m4-2gb.dts b/arch/arm/dts/rk3399-nanopi-m4-2gb.dts
new file mode 100644 (file)
index 0000000..60358ab
--- /dev/null
@@ -0,0 +1,66 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * FriendlyElec NanoPi M4 board device tree source
+ *
+ * Copyright (c) 2018 FriendlyElec Computer Tech. Co., Ltd.
+ * (http://www.friendlyarm.com)
+ *
+ * Copyright (c) 2018 Collabora Ltd.
+ * Copyright (c) 2019 Arm Ltd.
+ */
+
+/dts-v1/;
+#include "rk3399-nanopi4.dtsi"
+
+/ {
+       model = "FriendlyElec NanoPi M4";
+       compatible = "friendlyarm,nanopi-m4", "rockchip,rk3399";
+
+       vdd_5v: vdd-5v {
+               compatible = "regulator-fixed";
+               regulator-name = "vdd_5v";
+               regulator-always-on;
+               regulator-boot-on;
+       };
+
+       vcc5v0_core: vcc5v0-core {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc5v0_core";
+               regulator-always-on;
+               regulator-boot-on;
+               vin-supply = <&vdd_5v>;
+       };
+
+       vcc5v0_usb1: vcc5v0-usb1 {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc5v0_usb1";
+               regulator-always-on;
+               regulator-boot-on;
+               vin-supply = <&vcc5v0_sys>;
+       };
+
+       vcc5v0_usb2: vcc5v0-usb2 {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc5v0_usb2";
+               regulator-always-on;
+               regulator-boot-on;
+               vin-supply = <&vcc5v0_sys>;
+       };
+};
+
+&vcc3v3_sys {
+       vin-supply = <&vcc5v0_core>;
+};
+
+&u2phy0_host {
+       phy-supply = <&vcc5v0_usb1>;
+};
+
+&u2phy1_host {
+       phy-supply = <&vcc5v0_usb2>;
+};
+
+&vbus_typec {
+       regulator-always-on;
+       vin-supply = <&vdd_5v>;
+};
index d325e117287ba38d5c2b6a6e731fbce7bf11543c..c88018a0ef35dbd148db089da3e9790d3f5f3572 100644 (file)
@@ -48,7 +48,7 @@
        };
 
        /* switched by pmic_sleep */
-       vcc1v8_s3: vcca1v8_s3: vcc1v8-s3 {
+       vcc1v8_s3: vcc1v8-s3 {
                compatible = "regulator-fixed";
                regulator-always-on;
                regulator-boot-on;
                vin-supply = <&vcc3v3_sys>;
        };
 
+       /*
+        * Really, this is supplied by vcc_1v8, and vcc1v8_s3 only
+        * drives the enable pin, but we can't quite model that.
+        */
+       vcca0v9_s3: vcca0v9-s3 {
+               compatible = "regulator-fixed";
+               regulator-min-microvolt = <900000>;
+               regulator-max-microvolt = <900000>;
+               regulator-name = "vcca0v9_s3";
+               vin-supply = <&vcc1v8_s3>;
+       };
+
+       /* As above, actually supplied by vcc3v3_sys */
+       vcca1v8_s3: vcca1v8-s3 {
+               compatible = "regulator-fixed";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               regulator-name = "vcca1v8_s3";
+               vin-supply = <&vcc1v8_s3>;
+       };
+
        vbus_typec: vbus-typec {
                compatible = "regulator-fixed";
                regulator-min-microvolt = <5000000>;
        assigned-clocks = <&cru SCLK_RMII_SRC>;
        clock_in_out = "input";
        pinctrl-names = "default";
-       pinctrl-0 = <&rgmii_pins>;
+       pinctrl-0 = <&rgmii_pins>, <&phy_intb>, <&phy_rstb>;
+       phy-handle = <&rtl8211e>;
        phy-mode = "rgmii";
        phy-supply = <&vcc3v3_s3>;
-       snps,reset-active-low;
-       snps,reset-delays-us = <0 10000 50000>;
-       snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
        tx_delay = <0x28>;
        rx_delay = <0x11>;
        status = "okay";
+
+       mdio {
+               compatible = "snps,dwmac-mdio";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               rtl8211e: phy@1 {
+                       reg = <1>;
+                       interrupt-parent = <&gpio3>;
+                       interrupts = <RK_PB2 IRQ_TYPE_LEVEL_LOW>;
+                       reset-assert-us = <10000>;
+                       reset-deassert-us = <30000>;
+                       reset-gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
+               };
+       };
 };
 
 &gpu {
        status = "okay";
 };
 
+&hdmi_sound {
+       status = "okay";
+};
+
 &i2c0 {
        clock-frequency = <400000>;
        i2c-scl-rising-time-ns = <160>;
        status = "okay";
 };
 
+&i2s2 {
+       status = "okay";
+};
+
 &io_domains {
        bt656-supply = <&vcc_1v8>;
        audio-supply = <&vcca1v8_codec>;
 &pcie0 {
        ep-gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_HIGH>;
        max-link-speed = <2>;
-       num-lanes = <4>;
+       num-lanes = <2>;
+       vpcie0v9-supply = <&vcca0v9_s3>;
+       vpcie1v8-supply = <&vcca1v8_s3>;
        status = "okay";
 };
 
                };
        };
 
+       phy {
+               phy_intb: phy-intb {
+                       rockchip,pins = <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>;
+               };
+
+               phy_rstb: phy-rstb {
+                       rockchip,pins = <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
        pmic {
                cpu_b_sleep: cpu-b-sleep {
                        rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>;
index cf37b96a6b77ebab29939d19ad7677722f0594ab..f9f7246d4d2f3b3b7ba697e33f354a06ba8ff512 100644 (file)
                vin-supply = <&vcc_sys>;
        };
 
-       vcc5v0_typec0: vcc5v0-typec0-regulator {
+       vbus_typec: vbus-typec-regulator {
                compatible = "regulator-fixed";
                enable-active-high;
                gpio = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>;
                pinctrl-names = "default";
-               pinctrl-0 = <&vcc5v0_typec0_en>;
-               regulator-name = "vcc5v0_typec0";
+               pinctrl-0 = <&vcc5v0_typec_en>;
+               regulator-name = "vbus_typec";
                vin-supply = <&vcc_sys>;
        };
 
        clock_in_out = "input";
        phy-supply = <&vcc3v3_s3>;
        phy-mode = "rgmii";
+       phy-handle = <&rtl8211e>;
        pinctrl-names = "default";
-       pinctrl-0 = <&rgmii_pins>;
-       snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
-       snps,reset-active-low;
-       snps,reset-delays-us = <0 10000 50000>;
+       pinctrl-0 = <&rgmii_pins>, <&phy_intb>, <&phy_rstb>;
        tx_delay = <0x28>;
        rx_delay = <0x11>;
        status = "okay";
+
+       mdio {
+               compatible = "snps,dwmac-mdio";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               rtl8211e: phy@1 {
+                       reg = <1>;
+                       interrupt-parent = <&gpio3>;
+                       interrupts = <RK_PB2 IRQ_TYPE_LEVEL_LOW>;
+                       reset-assert-us = <10000>;
+                       reset-deassert-us = <30000>;
+                       reset-gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
+               };
+       };
 };
 
 &gpu {
                compatible = "silergy,syr827";
                reg = <0x40>;
                fcs,suspend-voltage-selector = <1>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&cpu_b_sleep>;
                regulator-name = "vdd_cpu_b";
                regulator-min-microvolt = <712500>;
                regulator-max-microvolt = <1500000>;
                compatible = "silergy,syr828";
                reg = <0x41>;
                fcs,suspend-voltage-selector = <1>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&gpu_sleep>;
                regulator-name = "vdd_gpu";
                regulator-min-microvolt = <712500>;
                regulator-max-microvolt = <1500000>;
                compatible = "asahi-kasei,ak09911";
                reg = <0x0c>;
                vdd-supply = <&vcc3v3_s3>;
+               vid-supply = <&vcc3v3_s3>;
        };
 
        mpu6500@68 {
                pinctrl-0 = <&light_int_l>;
                vdd-supply = <&vcc3v3_s3>;
        };
+
+       fusb302@22 {
+               compatible = "fcs,fusb302";
+               reg = <0x22>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <RK_PA2 IRQ_TYPE_LEVEL_LOW>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&chg_cc_int_l>;
+               vbus-supply = <&vbus_typec>;
+       };
 };
 
 &io_domains {
                };
        };
 
+       phy {
+               phy_intb: phy-intb {
+                       rockchip,pins = <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>;
+               };
+
+               phy_rstb: phy-rstb {
+                       rockchip,pins = <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
        pmic {
+               cpu_b_sleep: cpu-b-sleep {
+                       rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>;
+               };
+
+               gpu_sleep: gpu-sleep {
+                       rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>;
+               };
+
                pmic_int_l: pmic-int-l {
                        rockchip,pins =
                                <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>;
        sd {
                sdmmc0_pwr_h: sdmmc0-pwr-h {
                        rockchip,pins =
-                               <RK_GPIO0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
+                               <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
                                <4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
-               vcc5v0_typec0_en: vcc5v0-typec0-en {
+               vcc5v0_typec_en: vcc5v0-typec-en {
                        rockchip,pins =
                                <1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
                        rockchip,pins = <4 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
+
+       fusb302 {
+               chg_cc_int_l: chg-cc-int-l {
+                       rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>;
+               };
+       };
 };
 
 &pwm0 {
        pinctrl-names = "default";
        pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>;
        sd-uhs-sdr104;
+       #address-cells = <1>;
+       #size-cells = <0>;
        status = "okay";
 
        brcmf: wifi@1 {
+               reg = <1>;
                compatible = "brcm,bcm4329-fmac";
                interrupt-parent = <&gpio0>;
                interrupts = <RK_PA3 GPIO_ACTIVE_HIGH>;
        status = "okay";
 
        u2phy0_otg: otg-port {
-               phy-supply = <&vcc5v0_typec0>;
+               phy-supply = <&vbus_typec>;
                status = "okay";
        };
 
        bluetooth {
                compatible = "brcm,bcm43438-bt";
                clocks = <&rk808 1>;
-               clock-names = "ext_clock";
+               clock-names = "lpo";
                device-wakeup-gpios = <&gpio2 RK_PD2 GPIO_ACTIVE_HIGH>;
                host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>;
                shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>;
                pinctrl-names = "default";
                pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_reg_on_h>;
+               vbat-supply = <&vcc3v3_sys>;
+               vddio-supply = <&vcc_1v8>;
        };
 };
 
index 52f62b5d39ed2399718a0e91f5fc51fd1d8cb2d2..3ad113983323f3875741985a549516c434e6112e 100644 (file)
@@ -13,7 +13,7 @@
        chosen {
                stdout-path = "serial0:115200n8";
                u-boot,spl-boot-order = \
-                       "same-as-spl", &spiflash, &sdhci, &sdmmc;
+                       "same-as-spl", &norflash, &sdhci, &sdmmc;
        };
 
        aliases {
                spi1 = &spi5;
        };
 
+       /*
+        * The Qseven BIOS_DISABLE signal on the RK3399-Q7 keeps the on-module
+        * eMMC and SPI flash powered-down initially (in fact it keeps the
+        * reset signal asserted).  Even though it is an enable signal, we
+        * model this as a regulator.
+        */
+       bios_enable: bios_enable {
+               compatible = "regulator-fixed";
+               u-boot,dm-pre-reloc;
+               regulator-name = "bios_enable";
+               enable-active-high;
+               gpio = <&gpio3 RK_PD5 GPIO_ACTIVE_LOW>;
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+       };
+};
+
+&gpio1 {
+       u-boot,dm-pre-reloc;
+};
+
+&gpio3 {
+       u-boot,dm-pre-reloc;
+};
+
+&norflash {
+       u-boot,dm-pre-reloc;
 };
index 558b6337dfeca20d89c65d27b8b2cb5c84a2f463..07694b196fdbedcfb9f0171ebb52fd598589f5cc 100644 (file)
@@ -1,30 +1,74 @@
-// SPDX-License-Identifier: GPL-2.0+ OR X11
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
- * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH
+ * Copyright (c) 2017 Theobroma Systems Design und Consulting GmbH
  */
 
 #include <dt-bindings/pwm/pwm.h>
 #include "rk3399.dtsi"
+#include "rk3399-opp.dtsi"
 
 / {
-       model = "Theobroma Systems RK3399-Q7 SoM";
-       compatible = "tsd,rk3399-q7", "tsd,puma", "rockchip,rk3399";
-
        leds {
                compatible = "gpio-leds";
                pinctrl-names = "default";
-               pinctrl-0 = <&leds_pins_puma>;
+               pinctrl-0 = <&led_pin_module>;
 
-               module_led {
+               module-led {
                        label = "module_led";
                        gpios = <&gpio2 RK_PD1 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "heartbeat";
+                       panic-indicator;
                };
+       };
 
-               sd_card_led {
-                       label = "sd_card_led";
-                       gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_HIGH>;
-                       linux,default-trigger = "mmc0";
+       /*
+        * Overwrite the opp-table for CPUB as this board uses a different
+        * regulator (FAN53555) that only allows 10mV steps and therefore
+        * can't reach the operation point target voltages from rk3399-opp.dtsi
+        */
+       /delete-node/ opp-table1;
+       cluster1_opp: opp-table1 {
+               compatible = "operating-points-v2";
+               opp-shared;
+
+               opp00 {
+                       opp-hz = /bits/ 64 <408000000>;
+                       opp-microvolt = <800000>;
+                       clock-latency-ns = <40000>;
+               };
+               opp01 {
+                       opp-hz = /bits/ 64 <600000000>;
+                       opp-microvolt = <800000>;
+               };
+               opp02 {
+                       opp-hz = /bits/ 64 <816000000>;
+                       opp-microvolt = <830000>;
+                       opp-suspend;
+               };
+               opp03 {
+                       opp-hz = /bits/ 64 <1008000000>;
+                       opp-microvolt = <880000>;
+               };
+               opp04 {
+                       opp-hz = /bits/ 64 <1200000000>;
+                       opp-microvolt = <950000>;
+               };
+               opp05 {
+                       opp-hz = /bits/ 64 <1416000000>;
+                       opp-microvolt = <1030000>;
+               };
+               opp06 {
+                       opp-hz = /bits/ 64 <1608000000>;
+                       opp-microvolt = <1100000>;
+               };
+               opp07 {
+                       opp-hz = /bits/ 64 <1800000000>;
+                       opp-microvolt = <1200000>;
+               };
+               opp08 {
+                       opp-hz = /bits/ 64 <1992000000>;
+                       opp-microvolt = <1230000>;
+                       turbo-mode;
                };
        };
 
                #clock-cells = <0>;
        };
 
-       dw_hdmi_audio: dw-hdmi-audio {
-               status = "enabled";
-               compatible = "rockchip,dw-hdmi-audio";
-               #sound-dai-cells = <0>;
-       };
-
-       hdmi_codec: hdmi-codec {
-               compatible = "simple-audio-card";
-               simple-audio-card,format = "i2s";
-               simple-audio-card,mclk-fs = <256>;
-               simple-audio-card,name = "HDMI-CODEC";
-
-               simple-audio-card,cpu {
-                       sound-dai = <&i2s2>;
-               };
-
-               simple-audio-card,codec {
-                       sound-dai = <&hdmi>;
-               };
-       };
-
-       hdmi_sound: hdmi-sound {
-               status = "disabled";
-               compatible = "simple-audio-card";
-               simple-audio-card,format = "i2s";
-               simple-audio-card,mclk-fs = <256>;
-               simple-audio-card,name = "rockchip,hdmi";
-
-               simple-audio-card,cpu {
-                       sound-dai = <&i2s2>;
-               };
-               simple-audio-card,codec {
-                       sound-dai = <&hdmi>;
-               };
-       };
-
-       usbhub_enable: usbhub_enable {
-               compatible = "regulator-fixed";
-               regulator-name = "usbhub_enable";
-               enable-active-low;
-               gpio = <&gpio4 RK_PA3 GPIO_ACTIVE_LOW>;
-               pinctrl-names = "default";
-               pinctrl-0 = <&host_vbus_drv>;
-               regulator-boot-on;
-               regulator-min-microvolt = <3300000>;
-               regulator-max-microvolt = <3300000>;
-       };
-
-       /*
-        * The Qseven BIOS_DISABLE signal on the RK3399-Q7 keeps the on-module
-        * eMMC and SPI flash powered-down initially (in fact it keeps the
-        * reset signal asserted).  Even though it is an enable signal, we
-        * model this as a regulator.
-        */
-       bios_enable: bios_enable {
-               compatible = "regulator-fixed";
-               u-boot,dm-pre-reloc;
-               regulator-name = "bios_enable";
-               enable-active-high;
-               gpio = <&gpio3 RK_PD5 GPIO_ACTIVE_LOW>;
-               regulator-always-on;
-               regulator-boot-on;
-               regulator-min-microvolt = <1800000>;
-               regulator-max-microvolt = <1800000>;
-       };
-
-       vccadc_ref: vccadc-ref {
+       vcc1v2_phy: vcc1v2-phy {
                compatible = "regulator-fixed";
-               regulator-name = "vcc1v8_sys";
+               regulator-name = "vcc1v2_phy";
                regulator-always-on;
                regulator-boot-on;
-               regulator-min-microvolt = <1800000>;
-               regulator-max-microvolt = <1800000>;
+               regulator-min-microvolt = <1200000>;
+               regulator-max-microvolt = <1200000>;
+               vin-supply = <&vcc5v0_sys>;
        };
 
        vcc3v3_sys: vcc3v3-sys {
                regulator-boot-on;
                regulator-min-microvolt = <3300000>;
                regulator-max-microvolt = <3300000>;
+               vin-supply = <&vcc5v0_sys>;
        };
 
-       vcc5v0_otg: vcc5v0-otg-regulator {
+       vcc5v0_host: vcc5v0-host-regulator {
                compatible = "regulator-fixed";
-               enable-active-high;
-               gpio = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>;
+               gpio = <&gpio4 RK_PA3 GPIO_ACTIVE_HIGH>;
+               enable-active-low;
                pinctrl-names = "default";
-               pinctrl-0 = <&otg_vbus_drv>;
-               regulator-name = "vcc5v0_otg";
+               pinctrl-0 = <&vcc5v0_host_en>;
+               regulator-name = "vcc5v0_host";
                regulator-always-on;
+               vin-supply = <&vcc5v0_sys>;
        };
 
        vcc5v0_sys: vcc5v0-sys {
                regulator-min-microvolt = <5000000>;
                regulator-max-microvolt = <5000000>;
        };
+};
 
-       vcc_phy: vcc-phy-regulator {
-               compatible = "regulator-fixed";
-               regulator-name = "vcc_phy";
-               regulator-always-on;
-               regulator-boot-on;
-       };
+&cpu_b0 {
+       cpu-supply = <&vdd_cpu_b>;
+};
 
-       vdd_log: vdd-log {
-               compatible = "pwm-regulator";
-               pwms = <&pwm2 0 25000 1>;
-               regulator-name = "vdd_log";
-               regulator-min-microvolt = <800000>;
-               regulator-max-microvolt = <1400000>;
-               regulator-always-on;
-               regulator-boot-on;
-               regulator-init-microvolt = <950000>;
-       };
+&cpu_b1 {
+       cpu-supply = <&vdd_cpu_b>;
+};
+
+&cpu_l0 {
+       cpu-supply = <&vdd_cpu_l>;
+};
+
+&cpu_l1 {
+       cpu-supply = <&vdd_cpu_l>;
+};
+
+&cpu_l2 {
+       cpu-supply = <&vdd_cpu_l>;
+};
+
+&cpu_l3 {
+       cpu-supply = <&vdd_cpu_l>;
 };
 
 &emmc_phy {
        status = "okay";
+       drive-impedance-ohm = <33>;
 };
 
 &gmac {
-       phy-supply = <&vcc_phy>;
-       phy-mode = "rgmii";
-       clock_in_out = "input";
-       snps,reset-gpio = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>;
-       snps,reset-active-low;
-       snps,reset-delays-us = <2 10000 50000>;
        assigned-clocks = <&cru SCLK_RMII_SRC>;
        assigned-clock-parents = <&clkin_gmac>;
+       clock_in_out = "input";
+       phy-supply = <&vcc1v2_phy>;
+       phy-mode = "rgmii";
        pinctrl-names = "default";
        pinctrl-0 = <&rgmii_pins>;
+       snps,reset-gpio = <&gpio3 RK_PC0 GPIO_ACTIVE_HIGH>;
+       snps,reset-active-low;
+       snps,reset-delays-us = <0 10000 50000>;
        tx_delay = <0x10>;
        rx_delay = <0x10>;
        status = "okay";
 };
 
-&hdmi {
-       #sound-dai-cells = <0>;
+&gpu {
+       mali-supply = <&vdd_gpu>;
        status = "okay";
 };
 
        i2c-scl-falling-time-ns = <4>;
        clock-frequency = <400000>;
 
-       vdd_gpu: vdd_gpu {
-               status = "okay";
-               compatible = "fcs,fan53555";
-               reg = <0x60>;
-               vsel-gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_HIGH>;
-               vin-supply = <&vcc5v0_sys>;
-               regulator-compatible = "fan53555-reg";
-               regulator-name = "vdd_gpu";
-               regulator-min-microvolt = <600000>;
-               regulator-max-microvolt = <1230000>;
-               regulator-ramp-delay = <1000>;
-               fcs,suspend-voltage-selector = <1>;
-               regulator-always-on;
-               regulator-boot-on;
-               regulator-initial-state = <3>;
-                       regulator-state-mem {
-                       regulator-off-in-suspend;
-               };
-       };
-
        rk808: pmic@1b {
                compatible = "rockchip,rk808";
                reg = <0x1b>;
                interrupt-parent = <&gpio1>;
-               interrupts = <22 IRQ_TYPE_LEVEL_LOW>;  // TODO check interrupt?
+               interrupts = <22 IRQ_TYPE_LEVEL_LOW>;
+               #clock-cells = <1>;
+               clock-output-names = "xin32k", "rk808-clkout2";
                pinctrl-names = "default";
                pinctrl-0 = <&pmic_int_l>;
                rockchip,system-power-controller;
                wakeup-source;
-               #clock-cells = <1>;
-               clock-output-names = "xin32k", "rk808-clkout2";
 
                vcc1-supply = <&vcc5v0_sys>;
                vcc2-supply = <&vcc5v0_sys>;
 
                regulators {
                        vdd_center: DCDC_REG1 {
-                               regulator-always-on;
-                               regulator-boot-on;
+                               regulator-name = "vdd_center";
                                regulator-min-microvolt = <750000>;
                                regulator-max-microvolt = <1350000>;
                                regulator-ramp-delay = <6001>;
-                               regulator-name = "vdd_center";
+                               regulator-always-on;
+                               regulator-boot-on;
                                regulator-state-mem {
                                        regulator-off-in-suspend;
                                };
                        };
 
                        vdd_cpu_l: DCDC_REG2 {
-                               regulator-always-on;
-                               regulator-boot-on;
+                               regulator-name = "vdd_cpu_l";
                                regulator-min-microvolt = <750000>;
                                regulator-max-microvolt = <1350000>;
                                regulator-ramp-delay = <6001>;
-                               regulator-name = "vdd_cpu_l";
+                               regulator-always-on;
+                               regulator-boot-on;
                                regulator-state-mem {
                                        regulator-off-in-suspend;
                                };
                        };
 
                        vcc_ddr: DCDC_REG3 {
+                               regulator-name = "vcc_ddr";
                                regulator-always-on;
                                regulator-boot-on;
-                               regulator-name = "vcc_ddr";
                                regulator-state-mem {
                                        regulator-on-in-suspend;
                                };
                        };
 
                        vcc_1v8: DCDC_REG4 {
-                               regulator-always-on;
-                               regulator-boot-on;
+                               regulator-name = "vcc_1v8";
                                regulator-min-microvolt = <1800000>;
                                regulator-max-microvolt = <1800000>;
-                               regulator-name = "vcc_1v8";
+                               regulator-always-on;
+                               regulator-boot-on;
                                regulator-state-mem {
                                        regulator-on-in-suspend;
                                        regulator-suspend-microvolt = <1800000>;
                        };
 
                        vcc_ldo1: LDO_REG1 {
-                               regulator-boot-on;
+                               regulator-name = "vcc_ldo1";
                                regulator-min-microvolt = <1800000>;
                                regulator-max-microvolt = <1800000>;
-                               regulator-name = "vcc_ldo1";
+                               regulator-boot-on;
                                regulator-state-mem {
                                        regulator-off-in-suspend;
                                };
                        };
 
                        vcc1v8_hdmi: LDO_REG2 {
-                               regulator-always-on;
-                               regulator-boot-on;
+                               regulator-name = "vcc1v8_hdmi";
                                regulator-min-microvolt = <1800000>;
                                regulator-max-microvolt = <1800000>;
-                               regulator-name = "vcc1v8_hdmi";
+                               regulator-always-on;
+                               regulator-boot-on;
                                regulator-state-mem {
                                        regulator-off-in-suspend;
                                };
                        };
 
                        vcc1v8_pmu: LDO_REG3 {
-                               regulator-always-on;
-                               regulator-boot-on;
+                               regulator-name = "vcc1v8_pmu";
                                regulator-min-microvolt = <1800000>;
                                regulator-max-microvolt = <1800000>;
-                               regulator-name = "vcc1v8_pmu";
+                               regulator-always-on;
+                               regulator-boot-on;
                                regulator-state-mem {
                                        regulator-on-in-suspend;
                                        regulator-suspend-microvolt = <1800000>;
                        };
 
                        vcc_sd: LDO_REG4 {
-                               regulator-always-on;
-                               regulator-boot-on;
+                               regulator-name = "vcc_sd";
                                regulator-min-microvolt = <1800000>;
                                regulator-max-microvolt = <3000000>;
-                               regulator-name = "vcc_sd";
+                               regulator-always-on;
+                               regulator-boot-on;
                                regulator-state-mem {
                                        regulator-on-in-suspend;
                                        regulator-suspend-microvolt = <3000000>;
                        };
 
                        vcc_ldo5: LDO_REG5 {
-                               regulator-boot-on;
+                               regulator-name = "vcc_ldo5";
                                regulator-min-microvolt = <3000000>;
                                regulator-max-microvolt = <3000000>;
-                               regulator-name = "vcc_ldo5";
+                               regulator-boot-on;
                                regulator-state-mem {
                                        regulator-off-in-suspend;
                                };
                        };
 
                        vcc_ldo6: LDO_REG6 {
-                               regulator-boot-on;
+                               regulator-name = "vcc_ldo6";
                                regulator-min-microvolt = <1500000>;
                                regulator-max-microvolt = <1500000>;
-                               regulator-name = "vcc_ldo6";
+                               regulator-boot-on;
                                regulator-state-mem {
                                        regulator-off-in-suspend;
                                };
                        };
 
                        vcc0v9_hdmi: LDO_REG7 {
-                               regulator-always-on;
-                               regulator-boot-on;
+                               regulator-name = "vcc0v9_hdmi";
                                regulator-min-microvolt = <900000>;
                                regulator-max-microvolt = <900000>;
-                               regulator-name = "vcc0v9_hdmi";
+                               regulator-always-on;
+                               regulator-boot-on;
                                regulator-state-mem {
                                        regulator-off-in-suspend;
                                };
                        };
 
                        vcc_efuse: LDO_REG8 {
-                               regulator-always-on;
-                               regulator-boot-on;
+                               regulator-name = "vcc_efuse";
                                regulator-min-microvolt = <1800000>;
                                regulator-max-microvolt = <1800000>;
-                               regulator-name = "vcc_efuse";
+                               regulator-always-on;
+                               regulator-boot-on;
                                regulator-state-mem {
                                        regulator-off-in-suspend;
                                };
                        };
 
                        vcc3v3_s3: SWITCH_REG1 {
+                               regulator-name = "vcc3v3_s3";
                                regulator-always-on;
                                regulator-boot-on;
-                               regulator-name = "vcc3v3_s3";
                                regulator-state-mem {
                                        regulator-off-in-suspend;
                                };
                        };
 
                        vcc3v3_s0: SWITCH_REG2 {
+                               regulator-name = "vcc3v3_s0";
                                regulator-always-on;
                                regulator-boot-on;
-                               regulator-name = "vcc3v3_s0";
                                regulator-state-mem {
                                        regulator-off-in-suspend;
                                };
                        };
                };
        };
+
+       vdd_gpu: regulator@60 {
+               compatible = "fcs,fan53555";
+               reg = <0x60>;
+               fcs,suspend-voltage-selector = <1>;
+               regulator-name = "vdd_gpu";
+               regulator-min-microvolt = <600000>;
+               regulator-max-microvolt = <1230000>;
+               regulator-ramp-delay = <1000>;
+               regulator-always-on;
+               regulator-boot-on;
+               vin-supply = <&vcc5v0_sys>;
+       };
+};
+
+&i2c7 {
+       status = "okay";
+       clock-frequency = <400000>;
+
+       fan: fan@18 {
+               compatible = "ti,amc6821";
+               reg = <0x18>;
+               #cooling-cells = <2>;
+       };
+
+       rtc_twi: rtc@6f {
+               compatible = "isil,isl1208";
+               reg = <0x6f>;
+       };
 };
 
 &i2c8 {
        status = "okay";
        clock-frequency = <400000>;
 
-       vdd_cpu_b: vdd_cpu_b {
-               status = "okay";
+       vdd_cpu_b: regulator@60 {
                compatible = "fcs,fan53555";
                reg = <0x60>;
-               vsel-gpios = <&gpio1 RK_PA4 GPIO_ACTIVE_HIGH>;
                vin-supply = <&vcc5v0_sys>;
-               regulator-compatible = "fan53555-reg";
                regulator-name = "vdd_cpu_b";
                regulator-min-microvolt = <600000>;
                regulator-max-microvolt = <1230000>;
                fcs,suspend-voltage-selector = <1>;
                regulator-always-on;
                regulator-boot-on;
-               regulator-initial-state = <3>;
-                       regulator-state-mem {
-                       regulator-off-in-suspend;
-               };
        };
 };
 
 &i2s0 {
+       pinctrl-0 = <&i2s0_2ch_bus>;
+       rockchip,playback-channels = <2>;
+       rockchip,capture-channels = <2>;
        status = "okay";
-       rockchip,i2s-broken-burst-len;
-       rockchip,playback-channels = <8>;
-       rockchip,capture-channels = <8>;
-       #sound-dai-cells = <0>;
 };
 
-&i2s2 {
-       #sound-dai-cells = <0>;
-       status = "okay";
+/*
+ * As Q7 does not specify neither a global nor a RX clock for I2S these
+ * signals are not used. Furthermore I2S0_LRCK_RX is used as GPIO.
+ * Therefore we have to redefine the i2s0_2ch_bus definition to prevent
+ * conflicts.
+ */
+&i2s0_2ch_bus {
+       rockchip,pins =
+               <3 RK_PD0 1 &pcfg_pull_none>,
+               <3 RK_PD2 1 &pcfg_pull_none>,
+               <3 RK_PD3 1 &pcfg_pull_none>,
+               <3 RK_PD7 1 &pcfg_pull_none>;
 };
 
 &io_domains {
        status = "okay";
-
-       bt656-supply = <&vcc_1v8>;      /* bt656_gpio2ab_ms */
-       audio-supply = <&vcc_1v8>;      /* audio_gpio3d4a_ms */
-       sdmmc-supply = <&vcc_sd>;       /* sdmmc_gpio4b_ms */
-       gpio1830-supply = <&vcc_1v8>;   /* gpio1833_gpio4cd_ms */
-};
-
-&pcie0 {
-       assigned-clocks = <&cru SCLK_PCIEPHY_REF>;
-       assigned-clock-parents = <&cru SCLK_PCIEPHY_REF100M>;
-       assigned-clock-rates = <100000000>;
-       ep-gpios = <&gpio4 RK_PC6 GPIO_ACTIVE_HIGH>;
-       num-lanes = <4>;
-       pinctrl-names = "default";
-       pinctrl-0 = <&pcie_clkreqn>;
-       status = "okay";
-};
-
-&pcie_phy {
-               status = "okay";
+       bt656-supply = <&vcc_1v8>;
+       audio-supply = <&vcc_1v8>;
+       sdmmc-supply = <&vcc_sd>;
+       gpio1830-supply = <&vcc_1v8>;
 };
 
 &pmu_io_domains {
        pmu1830-supply = <&vcc_1v8>;
 };
 
-&pwm0 {
-       status = "okay";
-};
-
 &pwm2 {
        status = "okay";
 };
 
-&sdhci {
-       bus-width = <8>;
-       mmc-hs400-1_8v;
-       supports-emmc;
-       non-removable;
-       keep-power-in-suspend;
-       mmc-hs400-enhanced-strobe;
-       status = "okay";
-};
-
-&sdmmc {
-       clock-frequency = <150000000>;
-       max-frequency = <40000000>;
-       supports-sd;
-       bus-width = <4>;
-       cap-mmc-highspeed;
-       cap-sd-highspeed;
-       disable-wp;
-       num-slots = <1>;
-       vqmmc-supply = <&vcc_sd>;
-       pinctrl-names = "default";
-       pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
-       status = "okay";
-};
-
-&uart2 {
-       status = "okay";
-};
-
-&usb_host0_ehci {
-       status = "disabled";
-};
-
-&usb_host0_ohci {
-       status = "disabled";
-};
-
-&usbdrd3_0 {
-       status = "okay";
-};
-
-&usb_host1_ehci {
-       status = "disabled";
-};
-
-&usb_host1_ohci {
-       status = "disabled";
-};
-
-&usbdrd3_1 {
-       status = "okay";
-       tsd,usb-port-power = "usbhub_enable";
-};
-
-&vopb {
-       status = "okay";
-};
-
-&gpio1 {
-       u-boot,dm-pre-reloc;
-};
-
-&gpio3 {
-       u-boot,dm-pre-reloc;
-};
-
 &pinctrl {
-       /* Pins that are not explicitely used by any devices */
-       pinctrl-names = "default";
-       pinctrl-0 = <&puma_pin_hog>;
-
-       hog {
-               puma_pin_hog: puma_pin_hog {
+       i2c8 {
+               i2c8_xfer_a: i2c8-xfer {
                        rockchip,pins =
-                               /* We need pull-ups on Q7 buttons */
-                               <RK_GPIO0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>, /* LID_BTN# */
-                               <RK_GPIO0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>, /* BATLOW# */
-                               <RK_GPIO0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_up>, /* SLP_BTN# */
-                               <RK_GPIO0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>; /* BIOS_DISABLE# */
+                         <1 RK_PC4 1 &pcfg_pull_up>,
+                         <1 RK_PC5 1 &pcfg_pull_up>;
                };
        };
 
-       pmic {
-               pmic_int_l: pmic-int-l {
+       leds {
+               led_pin_module: led-module-gpio {
                        rockchip,pins =
-                               <RK_GPIO1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_up>;
+                         <2 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
-       leds_pins_puma: led_pins@0 {
-                       rockchip,pins =
-                               <RK_GPIO2 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>,
-                               <RK_GPIO1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
-       };
-
-       usb2 {
-               otg_vbus_drv: otg-vbus-drv {
-                       rockchip,pins =
-                               <RK_GPIO0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
-               };
-
-               host_vbus_drv: host-vbus-drv {
+       pmic {
+               pmic_int_l: pmic-int-l {
                        rockchip,pins =
-                               <RK_GPIO4 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
+                         <1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
-       i2c8 {
-               i2c8_xfer_a: i2c8-xfer {
+       usb2 {
+               vcc5v0_host_en: vcc5v0-host-en {
                        rockchip,pins =
-                               <RK_GPIO1 RK_PC5 RK_FUNC_1 &pcfg_pull_up>,
-                               <RK_GPIO1 RK_PC4 RK_FUNC_1 &pcfg_pull_up>;
+                         <4 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
 
-&i2c1 {
+&sdhci {
+       bus-width = <8>;
+       mmc-hs400-1_8v;
+       mmc-hs400-enhanced-strobe;
+       non-removable;
        status = "okay";
-       clock-frequency = <400000>;
 };
-&i2c2 {
-       status = "okay";
-       clock-frequency = <400000>;
+
+&sdmmc {
+       vqmmc-supply = <&vcc_sd>;
 };
-&i2c4 {
+
+&spi1 {
        status = "okay";
-       clock-frequency = <400000>;
+
+       norflash: flash@0 {
+               compatible = "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <50000000>;
+       };
 };
-&i2c6 {
+
+&tcphy1 {
        status = "okay";
-       clock-frequency = <400000>;
 };
 
-&i2c6_xfer {
-       /* Enable pull-ups, the pins would float otherwise. */
-       rockchip,pins =
-               <RK_GPIO2 RK_PB2 RK_FUNC_2 &pcfg_pull_up>,
-               <RK_GPIO2 RK_PB1 RK_FUNC_2 &pcfg_pull_up>;
+&tsadc {
+       rockchip,hw-tshut-mode = <1>;
+       rockchip,hw-tshut-polarity = <1>;
+       status = "okay";
 };
 
-&i2c7 {
+&u2phy1 {
        status = "okay";
-       clock-frequency = <400000>;
 
-       rtc_twi: rtc@6f {
-               compatible = "isil,isl1208";
-               reg = <0x6f>;
+       u2phy1_otg: otg-port {
+               status = "okay";
        };
-       fan: fan@18 {
-               compatible = "ti,amc6821";
-               reg = <0x18>;
-               cooling-min-state = <0>;
-               cooling-max-state = <9>;
-               #cooling-cells = <2>;
+
+       u2phy1_host: host-port {
+               phy-supply = <&vcc5v0_host>;
+               status = "okay";
        };
 };
 
-&uart0 {
-       pinctrl-names = "default";
-       pinctrl-0 = <&uart0_xfer &uart0_cts>;
+&usbdrd3_1 {
        status = "okay";
 };
 
-
-&spi1 {
+&usbdrd_dwc3_1 {
        status = "okay";
+       dr_mode = "host";
+};
 
-       #address-cells = <1>;
-       #size-cells = <0>;
-
-       spiflash: w25q32dw@0 {
-               u-boot,dm-pre-reloc;
-
-               compatible = "jedec,spi-nor";
-               reg = <0>;
-               spi-max-frequency = <49500000>;
-               spi-cpol;
-               spi-cpha;
-       };
+&usb_host1_ehci {
+       status = "okay";
 };
 
-&spi5 {
+&usb_host1_ohci {
        status = "okay";
 };
diff --git a/arch/arm/dts/rk3399-roc-pc-mezzanine-u-boot.dtsi b/arch/arm/dts/rk3399-roc-pc-mezzanine-u-boot.dtsi
new file mode 100644 (file)
index 0000000..f50c18d
--- /dev/null
@@ -0,0 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2020 Amarula Solutions(India)
+ */
+
+#include "rk3399-roc-pc-u-boot.dtsi"
diff --git a/arch/arm/dts/rk3399-roc-pc-mezzanine.dts b/arch/arm/dts/rk3399-roc-pc-mezzanine.dts
new file mode 100644 (file)
index 0000000..2acb3d5
--- /dev/null
@@ -0,0 +1,93 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2017 T-Chip Intelligent Technology Co., Ltd
+ * Copyright (c) 2019 Markus Reichl <m.reichl@fivetechno.de>
+ */
+
+/dts-v1/;
+#include "rk3399-roc-pc.dtsi"
+
+/ {
+       model = "Firefly ROC-RK3399-PC Mezzanine Board";
+       compatible = "firefly,roc-rk3399-pc-mezzanine", "rockchip,rk3399";
+
+       vcc3v3_ngff: vcc3v3-ngff {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc3v3_ngff";
+               enable-active-high;
+               gpio = <&gpio4 RK_PD3 GPIO_ACTIVE_HIGH>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&vcc3v3_ngff_en>;
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               vin-supply = <&dc_12v>;
+       };
+
+       vcc3v3_pcie: vcc3v3-pcie {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc3v3_pcie";
+               enable-active-high;
+               gpio = <&gpio1 RK_PC1 GPIO_ACTIVE_HIGH>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&vcc3v3_pcie_en>;
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               vin-supply = <&dc_12v>;
+       };
+};
+
+&pcie_phy {
+       status = "okay";
+};
+
+&pcie0 {
+       ep-gpios = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>;
+       num-lanes = <4>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pcie_perst>;
+       vpcie3v3-supply = <&vcc3v3_pcie>;
+       vpcie1v8-supply = <&vcc1v8_pmu>;
+       vpcie0v9-supply = <&vcca_0v9>;
+       status = "okay";
+};
+
+&pinctrl {
+       ngff {
+               vcc3v3_ngff_en: vcc3v3-ngff-en {
+                       rockchip,pins = <4 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
+       pcie {
+               vcc3v3_pcie_en: vcc3v3-pcie-en {
+                       rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+
+               pcie_perst: pcie-perst {
+                       rockchip,pins = <4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+};
+
+&sdio0 {
+       bus-width = <4>;
+       cap-sd-highspeed;
+       cap-sdio-irq;
+       keep-power-in-suspend;
+       mmc-pwrseq = <&sdio_pwrseq>;
+       non-removable;
+       pinctrl-names = "default";
+       pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>;
+       sd-uhs-sdr104;
+       vmmc-supply = <&vcc3v3_ngff>;
+       vqmmc-supply = <&vcc_1v8>;
+       status = "okay";
+};
+
+&uart0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>;
+       status = "okay";
+};
index 574644298112e5b1fab709b9f2871ab67acd2235..141dd0b30672f27c79de491c83e424b20537159d 100644 (file)
        chosen {
                u-boot,spl-boot-order = "same-as-spl", &sdhci, &sdmmc;
        };
+
+       vcc_hub_en: vcc_hub_en-regulator {
+               compatible = "regulator-fixed";
+               enable-active-high;
+               gpio = <&gpio2 RK_PA4 GPIO_ACTIVE_HIGH>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&hub_rst>;
+               regulator-name = "vcc_hub_en";
+               regulator-always-on;
+       };
+};
+
+/*
+ * should be placed inside mp8859, but not until mp8859 has
+ * its own dt-binding.
+ */
+&dc_12v {
+       compatible = "regulator-fixed";
+       regulator-name = "dc_12v";
+       regulator-always-on;
+       regulator-boot-on;
+       regulator-min-microvolt = <12000000>;
+       regulator-max-microvolt = <12000000>;
+       vin-supply = <&vcc_vbus_typec0>;
 };
 
 &vdd_log {
        regulator-min-microvolt = <430000>;
        regulator-init-microvolt = <950000>;
 };
+
+&vcc5v0_host {
+       regulator-always-on;
+};
+
+&vcc_sys {
+       regulator-always-on;
+};
+
+&vcc_sdio {
+       regulator-always-on;
+};
index 6a909e4eefd23492c5eeda52b4b257e36fb3f364..cd419542530973450975ecfdb64eec2ddce229ae 100644 (file)
@@ -8,6 +8,5 @@
 
 / {
        model = "Firefly ROC-RK3399-PC Board";
-       compatible = "libretech,roc-rk3399-pc", "firefly,roc-rk3399-pc",
-                    "rockchip,rk3399";
+       compatible = "firefly,roc-rk3399-pc", "rockchip,rk3399";
 };
index 9a1ce3a4ae12881b1d8d68f2fad30d87a500123c..9f225e9c3d545dd8784ea81faadb16d5597474bf 100644 (file)
                regulator-max-microvolt = <5000000>;
        };
 
-       /*
-        * should be placed inside mp8859, but not until mp8859 has
-        * its own dt-binding.
-        */
-       dc_12v: mp8859-dcdc1 {
-               compatible = "regulator-fixed";
-               regulator-name = "dc_12v";
-               regulator-always-on;
-               regulator-boot-on;
-               regulator-min-microvolt = <12000000>;
-               regulator-max-microvolt = <12000000>;
-               vin-supply = <&vcc_vbus_typec0>;
-       };
-
        /* switched by pmic_sleep */
        vcc1v8_s3: vcca1v8_s3: vcc1v8-s3 {
                compatible = "regulator-fixed";
                pinctrl-names = "default";
                pinctrl-0 = <&vcc5v0_host_en &hub_rst>;
                regulator-name = "vcc5v0_host";
-               regulator-always-on;
                vin-supply = <&vcc_sys>;
        };
 
                pinctrl-names = "default";
                pinctrl-0 = <&vcc_sys_en>;
                regulator-name = "vcc_sys";
-               regulator-always-on;
                regulator-boot-on;
                regulator-min-microvolt = <5000000>;
                regulator-max-microvolt = <5000000>;
 
                        vcc_sdio: LDO_REG4 {
                                regulator-name = "vcc_sdio";
-                               regulator-always-on;
                                regulator-boot-on;
                                regulator-min-microvolt = <1800000>;
                                regulator-max-microvolt = <3000000>;
                vbus-supply = <&vcc_vbus_typec0>;
                status = "okay";
        };
+
+       mp8859: regulator@66 {
+               compatible = "mps,mp8859";
+               reg = <0x66>;
+               dc_12v: mp8859_dcdc {
+                       regulator-name = "dc_12v";
+                       regulator-min-microvolt = <12000000>;
+                       regulator-max-microvolt = <12000000>;
+                       regulator-always-on;
+                       regulator-boot-on;
+                       vin-supply = <&vcc_vbus_typec0>;
+
+                       regulator-state-mem {
+                               regulator-on-in-suspend;
+                               regulator-suspend-microvolt = <12000000>;
+                       };
+               };
+       };
 };
 
 &i2s0 {
index 4a543f2117d4212b9e26578a64db9ad982ff5c59..3923ec01ef66f3ba7172354c418aa5cf12651801 100644 (file)
                #clock-cells = <0>;
        };
 
+       sdio_pwrseq: sdio-pwrseq {
+               compatible = "mmc-pwrseq-simple";
+               clocks = <&rk808 1>;
+               clock-names = "ext_clock";
+               pinctrl-names = "default";
+               pinctrl-0 = <&wifi_enable_h>;
+               reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>;
+       };
+
        vcc12v_dcin: dc-12v {
                compatible = "regulator-fixed";
                regulator-name = "vcc12v_dcin";
                vin-supply = <&vcc12v_dcin>;
        };
 
+       vcc_0v9: vcc-0v9 {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc_0v9";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <900000>;
+               regulator-max-microvolt = <900000>;
+               vin-supply = <&vcc3v3_sys>;
+       };
+
        vcc3v3_pcie: vcc3v3-pcie-regulator {
                compatible = "regulator-fixed";
                enable-active-high;
        status = "okay";
 };
 
+&gpu {
+       mali-supply = <&vdd_gpu>;
+       status = "okay";
+};
+
 &hdmi {
+       ddc-i2c-bus = <&i2c3>;
        pinctrl-names = "default";
        pinctrl-0 = <&hdmi_cec>;
        status = "okay";
 };
 
+&hdmi_sound {
+       status = "okay";
+};
+
 &i2c0 {
        clock-frequency = <400000>;
        i2c-scl-rising-time-ns = <168>;
        pmu1830-supply = <&vcc_3v0>;
 };
 
+&pcie_phy {
+       status = "okay";
+};
+
+&pcie0 {
+       ep-gpios = <&gpio4 RK_PD3 GPIO_ACTIVE_HIGH>;
+       max-link-speed = <2>;
+       num-lanes = <4>;
+       pinctrl-0 = <&pcie_clkreqnb_cpm>;
+       pinctrl-names = "default";
+       vpcie0v9-supply = <&vcc_0v9>;
+       vpcie1v8-supply = <&vcc_1v8>;
+       vpcie3v3-supply = <&vcc3v3_pcie>;
+       status = "okay";
+};
+
 &pinctrl {
+       bt {
+               bt_enable_h: bt-enable-h {
+                       rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+
+               bt_host_wake_l: bt-host-wake-l {
+                       rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+
+               bt_wake_l: bt-wake-l {
+                       rockchip,pins = <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
        pcie {
                pcie_pwr_en: pcie-pwr-en {
                        rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
+       sdio0 {
+               sdio0_bus4: sdio0-bus4 {
+                       rockchip,pins = <2 RK_PC4 1 &pcfg_pull_up_20ma>,
+                                       <2 RK_PC5 1 &pcfg_pull_up_20ma>,
+                                       <2 RK_PC6 1 &pcfg_pull_up_20ma>,
+                                       <2 RK_PC7 1 &pcfg_pull_up_20ma>;
+               };
+
+               sdio0_cmd: sdio0-cmd {
+                       rockchip,pins = <2 RK_PD0 1 &pcfg_pull_up_20ma>;
+               };
+
+               sdio0_clk: sdio0-clk {
+                       rockchip,pins = <2 RK_PD1 1 &pcfg_pull_none_20ma>;
+               };
+       };
+
        pmic {
                pmic_int_l: pmic-int-l {
                        rockchip,pins = <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>;
                        rockchip,pins = <4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
+
+       wifi {
+               wifi_enable_h: wifi-enable-h {
+                       rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+
+               wifi_host_wake_l: wifi-host-wake-l {
+                       rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
 };
 
 &pwm2 {
        vref-supply = <&vcc_1v8>;
 };
 
+&sdio0 {
+       #address-cells = <1>;
+       #size-cells = <0>;
+       bus-width = <4>;
+       clock-frequency = <50000000>;
+       cap-sdio-irq;
+       cap-sd-highspeed;
+       keep-power-in-suspend;
+       mmc-pwrseq = <&sdio_pwrseq>;
+       non-removable;
+       pinctrl-names = "default";
+       pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>;
+       sd-uhs-sdr104;
+       status = "okay";
+
+       brcmf: wifi@1 {
+               compatible = "brcm,bcm4329-fmac";
+               reg = <1>;
+               interrupt-parent = <&gpio0>;
+               interrupts = <RK_PA3 GPIO_ACTIVE_HIGH>;
+               interrupt-names = "host-wake";
+               pinctrl-names = "default";
+               pinctrl-0 = <&wifi_host_wake_l>;
+       };
+};
+
 &sdmmc {
        bus-width = <4>;
        cap-mmc-highspeed;
        };
 };
 
+&uart0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>;
+       status = "okay";
+
+       bluetooth {
+               compatible = "brcm,bcm43438-bt";
+               clocks = <&rk808 1>;
+               clock-names = "ext_clock";
+               device-wakeup-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>;
+               host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>;
+               shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>;
+       };
+};
+
 &uart2 {
        status = "okay";
 };
index 12285c51cceb6efaac4f43f80d8e3b4525154979..437a75f31ad4db29e5b021aeb84944741bb1494a 100644 (file)
        };
 };
 
+&spi0 {
+       /* On Low speed expansion (LS-SPI0) */
+       status = "okay";
+};
+
+&spi4 {
+       /* On High speed expansion (HS-SPI1) */
+       status = "okay";
+};
+
+&thermal_zones {
+       cpu_thermal: cpu {
+               polling-delay-passive = <100>;
+               polling-delay = <1000>;
+               thermal-sensors = <&tsadc 0>;
+               sustainable-power = <1550>;
+
+               trips {
+                       cpu_alert0: cpu_alert0 {
+                                   temperature = <65000>;
+                                   hysteresis = <2000>;
+                                   type = "passive";
+                       };
+
+                       cpu_alert1: cpu_alert1 {
+                                   temperature = <75000>;
+                                   hysteresis = <2000>;
+                                   type = "passive";
+                       };
+
+                       cpu_crit: cpu_crit {
+                                 temperature = <95000>;
+                                 hysteresis = <2000>;
+                                 type = "critical";
+                       };
+               };
+
+               cooling-maps {
+                            map0 {
+
+                            trip = <&cpu_alert1>;
+                            cooling-device =
+                                       <&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                       <&cpu_b1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                       };
+               };
+       };
+};
+
 &usbdrd_dwc3_0 {
        dr_mode = "otg";
 };
index c7d48d41e184ee6f00dc82875a6178d894e22752..ba7c75c9f2a19ee243fe266414840b18311b4081 100644 (file)
                regulator-always-on;
                vin-supply = <&vcc5v0_sys>;
        };
+
+       vcc_0v9: vcc-0v9 {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc_0v9";
+               regulator-always-on;
+               regulator-min-microvolt = <900000>;
+               regulator-max-microvolt = <900000>;
+               vin-supply = <&vcc3v3_sys>;
+       };
 };
 
 &cpu_l0 {
        num-lanes = <4>;
        pinctrl-names = "default";
        pinctrl-0 = <&pcie_clkreqn_cpm>;
+       vpcie0v9-supply = <&vcc_0v9>;
+       vpcie1v8-supply = <&vcca_1v8>;
        vpcie3v3-supply = <&vcc3v3_pcie>;
        status = "okay";
 };
        cap-mmc-highspeed;
        cap-sd-highspeed;
        clock-frequency = <100000000>;
-       clock-freq-min-max = <100000 100000000>;
+       max-frequency = <100000000>;
        cd-gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
        disable-wp;
        sd-uhs-sdr104;
index e544deb61d288285610a2d28aea8ecf1a40adc17..4b42717800f777278802941f743c681c5c4c8465 100644 (file)
 /*
  * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd.
  * Copyright (c) 2018 Akash Gajjar <Akash_Gajjar@mentor.com>
+ * Copyright (c) 2019 Katsuhiro Suzuki <katsuhiro@katsuster.net>
  */
 
 /dts-v1/;
-#include <dt-bindings/input/linux-event-codes.h>
-#include <dt-bindings/pwm/pwm.h>
-#include "rk3399.dtsi"
-#include "rk3399-opp.dtsi"
+#include "rk3399-rockpro64.dtsi"
 
 / {
-       model = "Pine64 RockPro64";
-       compatible = "pine64,rockpro64", "rockchip,rk3399";
-
-       chosen {
-               stdout-path = "serial2:1500000n8";
-       };
-
-       clkin_gmac: external-gmac-clock {
-               compatible = "fixed-clock";
-               clock-frequency = <125000000>;
-               clock-output-names = "clkin_gmac";
-               #clock-cells = <0>;
-       };
-
-       gpio-keys {
-               compatible = "gpio-keys";
-               autorepeat;
-               pinctrl-names = "default";
-               pinctrl-0 = <&pwrbtn>;
-
-               power {
-                       debounce-interval = <100>;
-                       gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>;
-                       label = "GPIO Key Power";
-                       linux,code = <KEY_POWER>;
-                       wakeup-source;
-               };
-       };
-
-       leds {
-               compatible = "gpio-leds";
-               pinctrl-names = "default";
-               pinctrl-0 = <&work_led_gpio>, <&diy_led_gpio>;
-
-               work-led {
-                       label = "work";
-                       default-state = "on";
-                       gpios = <&gpio0 RK_PB3 GPIO_ACTIVE_HIGH>;
-               };
-
-               diy-led {
-                       label = "diy";
-                       default-state = "off";
-                       gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>;
-               };
-       };
-
-       fan: pwm-fan {
-               compatible = "pwm-fan";
-               #cooling-cells = <2>;
-               fan-supply = <&vcc12v_dcin>;
-               pwms = <&pwm1 0 50000 0>;
-       };
-
-       sdio_pwrseq: sdio-pwrseq {
-               compatible = "mmc-pwrseq-simple";
-               clocks = <&rk808 1>;
-               clock-names = "ext_clock";
-               pinctrl-names = "default";
-               pinctrl-0 = <&wifi_enable_h>;
-
-               /*
-                * On the module itself this is one of these (depending
-                * on the actual card populated):
-                * - SDIO_RESET_L_WL_REG_ON
-                * - PDN (power down when low)
-                */
-               reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>;
-       };
-
-       vcc12v_dcin: vcc12v-dcin {
-               compatible = "regulator-fixed";
-               regulator-name = "vcc12v_dcin";
-               regulator-always-on;
-               regulator-boot-on;
-               regulator-min-microvolt = <12000000>;
-               regulator-max-microvolt = <12000000>;
-       };
-
-       /* switched by pmic_sleep */
-       vcc1v8_s3: vcca1v8_s3: vcc1v8-s3 {
-               compatible = "regulator-fixed";
-               regulator-name = "vcc1v8_s3";
-               regulator-always-on;
-               regulator-boot-on;
-               regulator-min-microvolt = <1800000>;
-               regulator-max-microvolt = <1800000>;
-               vin-supply = <&vcc_1v8>;
-       };
-
-       vcc3v3_pcie: vcc3v3-pcie-regulator {
-               compatible = "regulator-fixed";
-               enable-active-high;
-               gpio = <&gpio1 RK_PD0 GPIO_ACTIVE_HIGH>;
-               pinctrl-names = "default";
-               pinctrl-0 = <&pcie_pwr_en>;
-               regulator-name = "vcc3v3_pcie";
-               regulator-always-on;
-               regulator-boot-on;
-               vin-supply = <&vcc12v_dcin>;
-       };
-
-       vcc3v3_sys: vcc3v3-sys {
-               compatible = "regulator-fixed";
-               regulator-name = "vcc3v3_sys";
-               regulator-always-on;
-               regulator-boot-on;
-               regulator-min-microvolt = <3300000>;
-               regulator-max-microvolt = <3300000>;
-               vin-supply = <&vcc5v0_sys>;
-       };
-
-       /* Actually 3 regulators (host0, 1, 2) controlled by the same gpio */
-       vcc5v0_host: vcc5v0-host-regulator {
-               compatible = "regulator-fixed";
-               enable-active-high;
-               gpio = <&gpio4 RK_PD2 GPIO_ACTIVE_HIGH>;
-               pinctrl-names = "default";
-               pinctrl-0 = <&vcc5v0_host_en>;
-               regulator-name = "vcc5v0_host";
-               regulator-always-on;
-               vin-supply = <&vcc5v0_usb>;
-       };
-
-       vcc5v0_typec: vcc5v0-typec-regulator {
-               compatible = "regulator-fixed";
-               enable-active-high;
-               gpio = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>;
-               pinctrl-names = "default";
-               pinctrl-0 = <&vcc5v0_typec_en>;
-               regulator-name = "vcc5v0_typec";
-               regulator-always-on;
-               vin-supply = <&vcc5v0_usb>;
-       };
-
-       vcc5v0_sys: vcc5v0-sys {
-               compatible = "regulator-fixed";
-               regulator-name = "vcc5v0_sys";
-               regulator-always-on;
-               regulator-boot-on;
-               regulator-min-microvolt = <5000000>;
-               regulator-max-microvolt = <5000000>;
-               vin-supply = <&vcc12v_dcin>;
-       };
-
-       vcc5v0_usb: vcc5v0-usb {
-               compatible = "regulator-fixed";
-               regulator-name = "vcc5v0_usb";
-               regulator-always-on;
-               regulator-boot-on;
-               regulator-min-microvolt = <5000000>;
-               regulator-max-microvolt = <5000000>;
-               vin-supply = <&vcc12v_dcin>;
-       };
-
-       vdd_log: vdd-log {
-               compatible = "pwm-regulator";
-               pwms = <&pwm2 0 25000 1>;
-               regulator-name = "vdd_log";
-               regulator-always-on;
-               regulator-boot-on;
-               regulator-min-microvolt = <800000>;
-               regulator-max-microvolt = <1700000>;
-               vin-supply = <&vcc5v0_sys>;
-       };
-};
-
-&cpu_l0 {
-       cpu-supply = <&vdd_cpu_l>;
-};
-
-&cpu_l1 {
-       cpu-supply = <&vdd_cpu_l>;
-};
-
-&cpu_l2 {
-       cpu-supply = <&vdd_cpu_l>;
-};
-
-&cpu_l3 {
-       cpu-supply = <&vdd_cpu_l>;
-};
-
-&cpu_b0 {
-       cpu-supply = <&vdd_cpu_b>;
-};
-
-&cpu_b1 {
-       cpu-supply = <&vdd_cpu_b>;
-};
-
-&emmc_phy {
-       status = "okay";
-};
-
-&gmac {
-       assigned-clocks = <&cru SCLK_RMII_SRC>;
-       assigned-clock-parents = <&clkin_gmac>;
-       clock_in_out = "input";
-       phy-supply = <&vcc_lan>;
-       phy-mode = "rgmii";
-       pinctrl-names = "default";
-       pinctrl-0 = <&rgmii_pins>;
-       snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
-       snps,reset-active-low;
-       snps,reset-delays-us = <0 10000 50000>;
-       tx_delay = <0x28>;
-       rx_delay = <0x11>;
-       status = "okay";
-};
-
-&hdmi {
-       ddc-i2c-bus = <&i2c3>;
-       pinctrl-names = "default";
-       pinctrl-0 = <&hdmi_cec>;
-       status = "okay";
-};
-
-&hdmi_sound {
-       status = "okay";
-};
-
-&gpu {
-       mali-supply = <&vdd_gpu>;
-       status = "okay";
-};
-
-&i2c0 {
-       clock-frequency = <400000>;
-       i2c-scl-rising-time-ns = <168>;
-       i2c-scl-falling-time-ns = <4>;
-       status = "okay";
-
-       rk808: pmic@1b {
-               compatible = "rockchip,rk808";
-               reg = <0x1b>;
-               interrupt-parent = <&gpio3>;
-               interrupts = <10 IRQ_TYPE_LEVEL_LOW>;
-               #clock-cells = <1>;
-               clock-output-names = "xin32k", "rk808-clkout2";
-               pinctrl-names = "default";
-               pinctrl-0 = <&pmic_int_l>;
-               rockchip,system-power-controller;
-               wakeup-source;
-
-               vcc1-supply = <&vcc5v0_sys>;
-               vcc2-supply = <&vcc5v0_sys>;
-               vcc3-supply = <&vcc5v0_sys>;
-               vcc4-supply = <&vcc5v0_sys>;
-               vcc6-supply = <&vcc5v0_sys>;
-               vcc7-supply = <&vcc5v0_sys>;
-               vcc8-supply = <&vcc3v3_sys>;
-               vcc9-supply = <&vcc5v0_sys>;
-               vcc10-supply = <&vcc5v0_sys>;
-               vcc11-supply = <&vcc5v0_sys>;
-               vcc12-supply = <&vcc3v3_sys>;
-               vddio-supply = <&vcca_1v8>;
-
-               regulators {
-                       vdd_center: DCDC_REG1 {
-                               regulator-name = "vdd_center";
-                               regulator-always-on;
-                               regulator-boot-on;
-                               regulator-min-microvolt = <750000>;
-                               regulator-max-microvolt = <1350000>;
-                               regulator-ramp-delay = <6001>;
-                               regulator-state-mem {
-                                       regulator-off-in-suspend;
-                               };
-                       };
-
-                       vdd_cpu_l: DCDC_REG2 {
-                               regulator-name = "vdd_cpu_l";
-                               regulator-always-on;
-                               regulator-boot-on;
-                               regulator-min-microvolt = <750000>;
-                               regulator-max-microvolt = <1350000>;
-                               regulator-ramp-delay = <6001>;
-                               regulator-state-mem {
-                                       regulator-off-in-suspend;
-                               };
-                       };
-
-                       vcc_ddr: DCDC_REG3 {
-                               regulator-name = "vcc_ddr";
-                               regulator-always-on;
-                               regulator-boot-on;
-                               regulator-state-mem {
-                                       regulator-on-in-suspend;
-                               };
-                       };
-
-                       vcc_1v8: DCDC_REG4 {
-                               regulator-name = "vcc_1v8";
-                               regulator-always-on;
-                               regulator-boot-on;
-                               regulator-min-microvolt = <1800000>;
-                               regulator-max-microvolt = <1800000>;
-                               regulator-state-mem {
-                                       regulator-on-in-suspend;
-                                       regulator-suspend-microvolt = <1800000>;
-                               };
-                       };
-
-                       vcc1v8_dvp: LDO_REG1 {
-                               regulator-name = "vcc1v8_dvp";
-                               regulator-always-on;
-                               regulator-boot-on;
-                               regulator-min-microvolt = <1800000>;
-                               regulator-max-microvolt = <1800000>;
-                               regulator-state-mem {
-                                       regulator-off-in-suspend;
-                               };
-                       };
-
-                       vcc3v0_touch: LDO_REG2 {
-                               regulator-name = "vcc3v0_touch";
-                               regulator-always-on;
-                               regulator-boot-on;
-                               regulator-min-microvolt = <3000000>;
-                               regulator-max-microvolt = <3000000>;
-                               regulator-state-mem {
-                                       regulator-off-in-suspend;
-                               };
-                       };
-
-                       vcca_1v8: LDO_REG3 {
-                               regulator-name = "vcca_1v8";
-                               regulator-always-on;
-                               regulator-boot-on;
-                               regulator-min-microvolt = <1800000>;
-                               regulator-max-microvolt = <1800000>;
-                               regulator-state-mem {
-                                       regulator-on-in-suspend;
-                                       regulator-suspend-microvolt = <1800000>;
-                               };
-                       };
-
-                       vcc_sdio: LDO_REG4 {
-                               regulator-name = "vcc_sdio";
-                               regulator-always-on;
-                               regulator-boot-on;
-                               regulator-min-microvolt = <1800000>;
-                               regulator-max-microvolt = <3000000>;
-                               regulator-state-mem {
-                                       regulator-on-in-suspend;
-                                       regulator-suspend-microvolt = <3000000>;
-                               };
-                       };
-
-                       vcca3v0_codec: LDO_REG5 {
-                               regulator-name = "vcca3v0_codec";
-                               regulator-always-on;
-                               regulator-boot-on;
-                               regulator-min-microvolt = <3000000>;
-                               regulator-max-microvolt = <3000000>;
-                               regulator-state-mem {
-                                       regulator-off-in-suspend;
-                               };
-                       };
-
-                       vcc_1v5: LDO_REG6 {
-                               regulator-name = "vcc_1v5";
-                               regulator-always-on;
-                               regulator-boot-on;
-                               regulator-min-microvolt = <1500000>;
-                               regulator-max-microvolt = <1500000>;
-                               regulator-state-mem {
-                                       regulator-on-in-suspend;
-                                       regulator-suspend-microvolt = <1500000>;
-                               };
-                       };
-
-                       vcca1v8_codec: LDO_REG7 {
-                               regulator-name = "vcca1v8_codec";
-                               regulator-always-on;
-                               regulator-boot-on;
-                               regulator-min-microvolt = <1800000>;
-                               regulator-max-microvolt = <1800000>;
-                               regulator-state-mem {
-                                       regulator-off-in-suspend;
-                               };
-                       };
-
-                       vcc_3v0: LDO_REG8 {
-                               regulator-name = "vcc_3v0";
-                               regulator-always-on;
-                               regulator-boot-on;
-                               regulator-min-microvolt = <3000000>;
-                               regulator-max-microvolt = <3000000>;
-                               regulator-state-mem {
-                                       regulator-on-in-suspend;
-                                       regulator-suspend-microvolt = <3000000>;
-                               };
-                       };
-
-                       vcc3v3_s3: vcc_lan: SWITCH_REG1 {
-                               regulator-name = "vcc3v3_s3";
-                               regulator-always-on;
-                               regulator-boot-on;
-                               regulator-state-mem {
-                                       regulator-off-in-suspend;
-                               };
-                       };
-
-                       vcc3v3_s0: SWITCH_REG2 {
-                               regulator-name = "vcc3v3_s0";
-                               regulator-always-on;
-                               regulator-boot-on;
-                               regulator-state-mem {
-                                       regulator-off-in-suspend;
-                               };
-                       };
-               };
-       };
-
-       vdd_cpu_b: regulator@40 {
-               compatible = "silergy,syr827";
-               reg = <0x40>;
-               fcs,suspend-voltage-selector = <1>;
-               pinctrl-names = "default";
-               pinctrl-0 = <&vsel1_gpio>;
-               regulator-name = "vdd_cpu_b";
-               regulator-min-microvolt = <712500>;
-               regulator-max-microvolt = <1500000>;
-               regulator-ramp-delay = <1000>;
-               regulator-always-on;
-               regulator-boot-on;
-               vin-supply = <&vcc5v0_sys>;
-
-               regulator-state-mem {
-                       regulator-off-in-suspend;
-               };
-       };
-
-       vdd_gpu: regulator@41 {
-               compatible = "silergy,syr828";
-               reg = <0x41>;
-               fcs,suspend-voltage-selector = <1>;
-               pinctrl-names = "default";
-               pinctrl-0 = <&vsel2_gpio>;
-               regulator-name = "vdd_gpu";
-               regulator-min-microvolt = <712500>;
-               regulator-max-microvolt = <1500000>;
-               regulator-ramp-delay = <1000>;
-               regulator-always-on;
-               regulator-boot-on;
-               vin-supply = <&vcc5v0_sys>;
-
-               regulator-state-mem {
-                       regulator-off-in-suspend;
-               };
-       };
+       model = "Pine64 RockPro64 v2.1";
+       compatible = "pine64,rockpro64-v2.1", "pine64,rockpro64", "rockchip,rk3399";
 };
 
 &i2c1 {
-       i2c-scl-rising-time-ns = <300>;
-       i2c-scl-falling-time-ns = <15>;
-       status = "okay";
-};
-
-&i2c3 {
-       i2c-scl-rising-time-ns = <450>;
-       i2c-scl-falling-time-ns = <15>;
-       status = "okay";
-};
-
-&i2c4 {
-       i2c-scl-rising-time-ns = <600>;
-       i2c-scl-falling-time-ns = <20>;
-       status = "okay";
-
-       fusb0: typec-portc@22 {
-               compatible = "fcs,fusb302";
-               reg = <0x22>;
-               interrupt-parent = <&gpio1>;
-               interrupts = <RK_PA2 IRQ_TYPE_LEVEL_LOW>;
-               pinctrl-names = "default";
-               pinctrl-0 = <&fusb0_int>;
-               vbus-supply = <&vcc5v0_typec>;
-               status = "okay";
-       };
-};
+       es8316: codec@11 {
+               compatible = "everest,es8316";
+               reg = <0x11>;
+               clocks = <&cru SCLK_I2S_8CH_OUT>;
+               clock-names = "mclk";
+               #sound-dai-cells = <0>;
 
-&i2s0 {
-       rockchip,playback-channels = <8>;
-       rockchip,capture-channels = <8>;
-       status = "okay";
-};
-
-&i2s1 {
-       rockchip,playback-channels = <2>;
-       rockchip,capture-channels = <2>;
-       status = "okay";
-};
-
-&i2s2 {
-       status = "okay";
-};
-
-&io_domains {
-       status = "okay";
-
-       bt656-supply = <&vcc1v8_dvp>;
-       audio-supply = <&vcc_3v0>;
-       sdmmc-supply = <&vcc_sdio>;
-       gpio1830-supply = <&vcc_3v0>;
-};
-
-&pcie0 {
-       ep-gpios = <&gpio2 RK_PD4 GPIO_ACTIVE_HIGH>;
-       num-lanes = <4>;
-       pinctrl-names = "default";
-       pinctrl-0 = <&pcie_perst>;
-       vpcie12v-supply = <&vcc12v_dcin>;
-       vpcie3v3-supply = <&vcc3v3_pcie>;
-       status = "okay";
-};
-
-&pcie_phy {
-       status = "okay";
-};
-
-&pmu_io_domains {
-       pmu1830-supply = <&vcc_3v0>;
-       status = "okay";
-};
-
-&pinctrl {
-       buttons {
-               pwrbtn: pwrbtn {
-                       rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
-               };
-       };
-
-       fusb302x {
-               fusb0_int: fusb0-int {
-                       rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>;
-               };
-       };
-
-       leds {
-               work_led_gpio: work_led-gpio {
-                       rockchip,pins = <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
-               };
-
-               diy_led_gpio: diy_led-gpio {
-                       rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
-               };
-       };
-
-       pcie {
-               pcie_perst: pcie-perst {
-                       rockchip,pins = <2 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>;
-               };
-
-               pcie_pwr_en: pcie-pwr-en {
-                       rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>;
-               };
-       };
-
-       pmic {
-               pmic_int_l: pmic-int-l {
-                       rockchip,pins = <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>;
-               };
-
-               vsel1_gpio: vsel1-gpio {
-                       rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>;
-               };
-
-               vsel2_gpio: vsel2-gpio {
-                       rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>;
-               };
-       };
-
-       sdio-pwrseq {
-               wifi_enable_h: wifi-enable-h {
-                       rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
-               };
-       };
-
-       usb-typec {
-               vcc5v0_typec_en: vcc5v0_typec_en {
-                       rockchip,pins = <1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>;
-               };
-       };
-
-       usb2 {
-               vcc5v0_host_en: vcc5v0-host-en {
-                       rockchip,pins = <4 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
+               port {
+                       es8316_p0_0: endpoint {
+                               remote-endpoint = <&i2s1_p0_0>;
+                       };
                };
        };
 };
-
-&pwm0 {
-       status = "okay";
-};
-
-&pwm1 {
-       status = "okay";
-};
-
-&pwm2 {
-       status = "okay";
-};
-
-&saradc {
-       vref-supply = <&vcca1v8_s3>;
-       status = "okay";
-};
-
-&sdmmc {
-       bus-width = <4>;
-       cap-sd-highspeed;
-       cd-gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
-       disable-wp;
-       max-frequency = <150000000>;
-       pinctrl-names = "default";
-       pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_bus4>;
-       status = "okay";
-};
-
-&sdhci {
-       bus-width = <8>;
-       mmc-hs200-1_8v;
-       non-removable;
-       status = "okay";
-};
-
-&spi1 {
-       status = "okay";
-
-       flash@0 {
-               compatible = "jedec,spi-nor";
-               reg = <0>;
-               spi-max-frequency = <10000000>;
-       };
-};
-
-&tcphy0 {
-       status = "okay";
-};
-
-&tcphy1 {
-       status = "okay";
-};
-
-&tsadc {
-       /* tshut mode 0:CRU 1:GPIO */
-       rockchip,hw-tshut-mode = <1>;
-       /* tshut polarity 0:LOW 1:HIGH */
-       rockchip,hw-tshut-polarity = <1>;
-       status = "okay";
-};
-
-&u2phy0 {
-       status = "okay";
-
-       u2phy0_otg: otg-port {
-               status = "okay";
-       };
-
-       u2phy0_host: host-port {
-               phy-supply = <&vcc5v0_host>;
-               status = "okay";
-       };
-};
-
-&u2phy1 {
-       status = "okay";
-
-       u2phy1_otg: otg-port {
-               status = "okay";
-       };
-
-       u2phy1_host: host-port {
-               phy-supply = <&vcc5v0_host>;
-               status = "okay";
-       };
-};
-
-&uart0 {
-       pinctrl-names = "default";
-       pinctrl-0 = <&uart0_xfer &uart0_cts>;
-       status = "okay";
-};
-
-&uart2 {
-       status = "okay";
-};
-
-&usb_host0_ehci {
-       status = "okay";
-};
-
-&usb_host0_ohci {
-       status = "okay";
-};
-
-&usb_host1_ehci {
-       status = "okay";
-};
-
-&usb_host1_ohci {
-       status = "okay";
-};
-
-&usbdrd3_0 {
-       status = "okay";
-};
-
-&usbdrd_dwc3_0 {
-       status = "okay";
-       dr_mode = "otg";
-};
-
-&usbdrd3_1 {
-       status = "okay";
-};
-
-&usbdrd_dwc3_1 {
-       status = "okay";
-       dr_mode = "host";
-};
-
-&vopb {
-       status = "okay";
-};
-
-&vopb_mmu {
-       status = "okay";
-};
-
-&vopl {
-       status = "okay";
-};
-
-&vopl_mmu {
-       status = "okay";
-};
diff --git a/arch/arm/dts/rk3399-rockpro64.dtsi b/arch/arm/dts/rk3399-rockpro64.dtsi
new file mode 100644 (file)
index 0000000..9bca258
--- /dev/null
@@ -0,0 +1,797 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd.
+ * Copyright (c) 2018 Akash Gajjar <Akash_Gajjar@mentor.com>
+ */
+
+#include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/pwm/pwm.h>
+#include "rk3399.dtsi"
+#include "rk3399-opp.dtsi"
+
+/ {
+       chosen {
+               stdout-path = "serial2:1500000n8";
+       };
+
+       clkin_gmac: external-gmac-clock {
+               compatible = "fixed-clock";
+               clock-frequency = <125000000>;
+               clock-output-names = "clkin_gmac";
+               #clock-cells = <0>;
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+               autorepeat;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pwrbtn>;
+
+               power {
+                       debounce-interval = <100>;
+                       gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>;
+                       label = "GPIO Key Power";
+                       linux,code = <KEY_POWER>;
+                       wakeup-source;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&work_led_gpio>, <&diy_led_gpio>;
+
+               work-led {
+                       label = "work";
+                       default-state = "on";
+                       gpios = <&gpio0 RK_PB3 GPIO_ACTIVE_HIGH>;
+               };
+
+               diy-led {
+                       label = "diy";
+                       default-state = "off";
+                       gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       fan: pwm-fan {
+               compatible = "pwm-fan";
+               #cooling-cells = <2>;
+               fan-supply = <&vcc12v_dcin>;
+               pwms = <&pwm1 0 50000 0>;
+       };
+
+       sdio_pwrseq: sdio-pwrseq {
+               compatible = "mmc-pwrseq-simple";
+               clocks = <&rk808 1>;
+               clock-names = "ext_clock";
+               pinctrl-names = "default";
+               pinctrl-0 = <&wifi_enable_h>;
+               reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>;
+       };
+
+       sound {
+               compatible = "audio-graph-card";
+               label = "rockchip,rk3399";
+               dais = <&i2s1_p0>;
+       };
+
+       vcc12v_dcin: vcc12v-dcin {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc12v_dcin";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <12000000>;
+               regulator-max-microvolt = <12000000>;
+       };
+
+       /* switched by pmic_sleep */
+       vcc1v8_s3: vcca1v8_s3: vcc1v8-s3 {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc1v8_s3";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               vin-supply = <&vcc_1v8>;
+       };
+
+       vcc3v3_pcie: vcc3v3-pcie-regulator {
+               compatible = "regulator-fixed";
+               enable-active-high;
+               gpio = <&gpio1 RK_PD0 GPIO_ACTIVE_HIGH>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pcie_pwr_en>;
+               regulator-name = "vcc3v3_pcie";
+               regulator-always-on;
+               regulator-boot-on;
+               vin-supply = <&vcc12v_dcin>;
+       };
+
+       vcc3v3_sys: vcc3v3-sys {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc3v3_sys";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               vin-supply = <&vcc5v0_sys>;
+       };
+
+       /* Actually 3 regulators (host0, 1, 2) controlled by the same gpio */
+       vcc5v0_host: vcc5v0-host-regulator {
+               compatible = "regulator-fixed";
+               enable-active-high;
+               gpio = <&gpio4 RK_PD2 GPIO_ACTIVE_HIGH>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&vcc5v0_host_en>;
+               regulator-name = "vcc5v0_host";
+               regulator-always-on;
+               vin-supply = <&vcc5v0_usb>;
+       };
+
+       vcc5v0_typec: vcc5v0-typec-regulator {
+               compatible = "regulator-fixed";
+               enable-active-high;
+               gpio = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&vcc5v0_typec_en>;
+               regulator-name = "vcc5v0_typec";
+               regulator-always-on;
+               vin-supply = <&vcc5v0_usb>;
+       };
+
+       vcc5v0_sys: vcc5v0-sys {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc5v0_sys";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               vin-supply = <&vcc12v_dcin>;
+       };
+
+       vcc5v0_usb: vcc5v0-usb {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc5v0_usb";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               vin-supply = <&vcc12v_dcin>;
+       };
+
+       vdd_log: vdd-log {
+               compatible = "pwm-regulator";
+               pwms = <&pwm2 0 25000 1>;
+               regulator-name = "vdd_log";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <800000>;
+               regulator-max-microvolt = <1700000>;
+               vin-supply = <&vcc5v0_sys>;
+       };
+};
+
+&cpu_l0 {
+       cpu-supply = <&vdd_cpu_l>;
+};
+
+&cpu_l1 {
+       cpu-supply = <&vdd_cpu_l>;
+};
+
+&cpu_l2 {
+       cpu-supply = <&vdd_cpu_l>;
+};
+
+&cpu_l3 {
+       cpu-supply = <&vdd_cpu_l>;
+};
+
+&cpu_b0 {
+       cpu-supply = <&vdd_cpu_b>;
+};
+
+&cpu_b1 {
+       cpu-supply = <&vdd_cpu_b>;
+};
+
+&emmc_phy {
+       status = "okay";
+};
+
+&gmac {
+       assigned-clocks = <&cru SCLK_RMII_SRC>;
+       assigned-clock-parents = <&clkin_gmac>;
+       clock_in_out = "input";
+       phy-supply = <&vcc_lan>;
+       phy-mode = "rgmii";
+       pinctrl-names = "default";
+       pinctrl-0 = <&rgmii_pins>;
+       snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
+       snps,reset-active-low;
+       snps,reset-delays-us = <0 10000 50000>;
+       tx_delay = <0x28>;
+       rx_delay = <0x11>;
+       status = "okay";
+};
+
+&hdmi {
+       ddc-i2c-bus = <&i2c3>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&hdmi_cec>;
+       status = "okay";
+};
+
+&hdmi_sound {
+       status = "okay";
+};
+
+&gpu {
+       mali-supply = <&vdd_gpu>;
+       status = "okay";
+};
+
+&i2c0 {
+       clock-frequency = <400000>;
+       i2c-scl-rising-time-ns = <168>;
+       i2c-scl-falling-time-ns = <4>;
+       status = "okay";
+
+       rk808: pmic@1b {
+               compatible = "rockchip,rk808";
+               reg = <0x1b>;
+               interrupt-parent = <&gpio3>;
+               interrupts = <10 IRQ_TYPE_LEVEL_LOW>;
+               #clock-cells = <1>;
+               clock-output-names = "xin32k", "rk808-clkout2";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pmic_int_l>;
+               rockchip,system-power-controller;
+               wakeup-source;
+
+               vcc1-supply = <&vcc5v0_sys>;
+               vcc2-supply = <&vcc5v0_sys>;
+               vcc3-supply = <&vcc5v0_sys>;
+               vcc4-supply = <&vcc5v0_sys>;
+               vcc6-supply = <&vcc5v0_sys>;
+               vcc7-supply = <&vcc5v0_sys>;
+               vcc8-supply = <&vcc3v3_sys>;
+               vcc9-supply = <&vcc5v0_sys>;
+               vcc10-supply = <&vcc5v0_sys>;
+               vcc11-supply = <&vcc5v0_sys>;
+               vcc12-supply = <&vcc3v3_sys>;
+               vddio-supply = <&vcca_1v8>;
+
+               regulators {
+                       vdd_center: DCDC_REG1 {
+                               regulator-name = "vdd_center";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <750000>;
+                               regulator-max-microvolt = <1350000>;
+                               regulator-ramp-delay = <6001>;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vdd_cpu_l: DCDC_REG2 {
+                               regulator-name = "vdd_cpu_l";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <750000>;
+                               regulator-max-microvolt = <1350000>;
+                               regulator-ramp-delay = <6001>;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vcc_ddr: DCDC_REG3 {
+                               regulator-name = "vcc_ddr";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                               };
+                       };
+
+                       vcc_1v8: DCDC_REG4 {
+                               regulator-name = "vcc_1v8";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <1800000>;
+                               };
+                       };
+
+                       vcc1v8_dvp: LDO_REG1 {
+                               regulator-name = "vcc1v8_dvp";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vcc3v0_touch: LDO_REG2 {
+                               regulator-name = "vcc3v0_touch";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <3000000>;
+                               regulator-max-microvolt = <3000000>;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vcca_1v8: LDO_REG3 {
+                               regulator-name = "vcca_1v8";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <1800000>;
+                               };
+                       };
+
+                       vcc_sdio: LDO_REG4 {
+                               regulator-name = "vcc_sdio";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3000000>;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <3000000>;
+                               };
+                       };
+
+                       vcca3v0_codec: LDO_REG5 {
+                               regulator-name = "vcca3v0_codec";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <3000000>;
+                               regulator-max-microvolt = <3000000>;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vcc_1v5: LDO_REG6 {
+                               regulator-name = "vcc_1v5";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <1500000>;
+                               regulator-max-microvolt = <1500000>;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <1500000>;
+                               };
+                       };
+
+                       vcca1v8_codec: LDO_REG7 {
+                               regulator-name = "vcca1v8_codec";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vcc_3v0: LDO_REG8 {
+                               regulator-name = "vcc_3v0";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <3000000>;
+                               regulator-max-microvolt = <3000000>;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <3000000>;
+                               };
+                       };
+
+                       vcc3v3_s3: vcc_lan: SWITCH_REG1 {
+                               regulator-name = "vcc3v3_s3";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vcc3v3_s0: SWITCH_REG2 {
+                               regulator-name = "vcc3v3_s0";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+               };
+       };
+
+       vdd_cpu_b: regulator@40 {
+               compatible = "silergy,syr827";
+               reg = <0x40>;
+               fcs,suspend-voltage-selector = <1>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&vsel1_gpio>;
+               regulator-name = "vdd_cpu_b";
+               regulator-min-microvolt = <712500>;
+               regulator-max-microvolt = <1500000>;
+               regulator-ramp-delay = <1000>;
+               regulator-always-on;
+               regulator-boot-on;
+               vin-supply = <&vcc5v0_sys>;
+
+               regulator-state-mem {
+                       regulator-off-in-suspend;
+               };
+       };
+
+       vdd_gpu: regulator@41 {
+               compatible = "silergy,syr828";
+               reg = <0x41>;
+               fcs,suspend-voltage-selector = <1>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&vsel2_gpio>;
+               regulator-name = "vdd_gpu";
+               regulator-min-microvolt = <712500>;
+               regulator-max-microvolt = <1500000>;
+               regulator-ramp-delay = <1000>;
+               regulator-always-on;
+               regulator-boot-on;
+               vin-supply = <&vcc5v0_sys>;
+
+               regulator-state-mem {
+                       regulator-off-in-suspend;
+               };
+       };
+};
+
+&i2c1 {
+       i2c-scl-rising-time-ns = <300>;
+       i2c-scl-falling-time-ns = <15>;
+       status = "okay";
+};
+
+&i2c3 {
+       i2c-scl-rising-time-ns = <450>;
+       i2c-scl-falling-time-ns = <15>;
+       status = "okay";
+};
+
+&i2c4 {
+       i2c-scl-rising-time-ns = <600>;
+       i2c-scl-falling-time-ns = <20>;
+       status = "okay";
+
+       fusb0: typec-portc@22 {
+               compatible = "fcs,fusb302";
+               reg = <0x22>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <RK_PA2 IRQ_TYPE_LEVEL_LOW>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&fusb0_int>;
+               vbus-supply = <&vcc5v0_typec>;
+               status = "okay";
+       };
+};
+
+&i2s0 {
+       rockchip,playback-channels = <8>;
+       rockchip,capture-channels = <8>;
+       status = "okay";
+};
+
+&i2s1 {
+       rockchip,playback-channels = <2>;
+       rockchip,capture-channels = <2>;
+       status = "okay";
+
+       i2s1_p0: port {
+               i2s1_p0_0: endpoint {
+                       dai-format = "i2s";
+                       mclk-fs = <256>;
+                       remote-endpoint = <&es8316_p0_0>;
+               };
+       };
+};
+
+&i2s2 {
+       status = "okay";
+};
+
+&io_domains {
+       status = "okay";
+
+       bt656-supply = <&vcc1v8_dvp>;
+       audio-supply = <&vcc_3v0>;
+       sdmmc-supply = <&vcc_sdio>;
+       gpio1830-supply = <&vcc_3v0>;
+};
+
+&pcie0 {
+       ep-gpios = <&gpio2 RK_PD4 GPIO_ACTIVE_HIGH>;
+       num-lanes = <4>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pcie_perst>;
+       vpcie12v-supply = <&vcc12v_dcin>;
+       vpcie3v3-supply = <&vcc3v3_pcie>;
+       status = "okay";
+};
+
+&pcie_phy {
+       status = "okay";
+};
+
+&pmu_io_domains {
+       pmu1830-supply = <&vcc_3v0>;
+       status = "okay";
+};
+
+&pinctrl {
+       bt {
+               bt_enable_h: bt-enable-h {
+                       rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+
+               bt_host_wake_l: bt-host-wake-l {
+                       rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_down>;
+               };
+
+               bt_wake_l: bt-wake-l {
+                       rockchip,pins = <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
+       buttons {
+               pwrbtn: pwrbtn {
+                       rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
+               };
+       };
+
+       fusb302x {
+               fusb0_int: fusb0-int {
+                       rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>;
+               };
+       };
+
+       leds {
+               work_led_gpio: work_led-gpio {
+                       rockchip,pins = <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+
+               diy_led_gpio: diy_led-gpio {
+                       rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
+       pcie {
+               pcie_perst: pcie-perst {
+                       rockchip,pins = <2 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+
+               pcie_pwr_en: pcie-pwr-en {
+                       rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
+       pmic {
+               pmic_int_l: pmic-int-l {
+                       rockchip,pins = <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>;
+               };
+
+               vsel1_gpio: vsel1-gpio {
+                       rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>;
+               };
+
+               vsel2_gpio: vsel2-gpio {
+                       rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>;
+               };
+       };
+
+       sdio-pwrseq {
+               wifi_enable_h: wifi-enable-h {
+                       rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
+       usb-typec {
+               vcc5v0_typec_en: vcc5v0_typec_en {
+                       rockchip,pins = <1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>;
+               };
+       };
+
+       usb2 {
+               vcc5v0_host_en: vcc5v0-host-en {
+                       rockchip,pins = <4 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+};
+
+&pwm0 {
+       status = "okay";
+};
+
+&pwm1 {
+       status = "okay";
+};
+
+&pwm2 {
+       status = "okay";
+};
+
+&saradc {
+       vref-supply = <&vcca1v8_s3>;
+       status = "okay";
+};
+
+&sdio0 {
+       bus-width = <4>;
+       cap-sd-highspeed;
+       cap-sdio-irq;
+       disable-wp;
+       keep-power-in-suspend;
+       mmc-pwrseq = <&sdio_pwrseq>;
+       non-removable;
+       pinctrl-names = "default";
+       pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>;
+       sd-uhs-sdr104;
+       status = "okay";
+};
+
+&sdmmc {
+       bus-width = <4>;
+       cap-sd-highspeed;
+       cd-gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
+       disable-wp;
+       max-frequency = <150000000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_bus4>;
+       status = "okay";
+};
+
+&sdhci {
+       bus-width = <8>;
+       mmc-hs200-1_8v;
+       non-removable;
+       status = "okay";
+};
+
+&spi1 {
+       status = "okay";
+
+       flash@0 {
+               compatible = "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <10000000>;
+       };
+};
+
+&tcphy0 {
+       status = "okay";
+};
+
+&tcphy1 {
+       status = "okay";
+};
+
+&tsadc {
+       /* tshut mode 0:CRU 1:GPIO */
+       rockchip,hw-tshut-mode = <1>;
+       /* tshut polarity 0:LOW 1:HIGH */
+       rockchip,hw-tshut-polarity = <1>;
+       status = "okay";
+};
+
+&u2phy0 {
+       status = "okay";
+
+       u2phy0_otg: otg-port {
+               status = "okay";
+       };
+
+       u2phy0_host: host-port {
+               phy-supply = <&vcc5v0_host>;
+               status = "okay";
+       };
+};
+
+&u2phy1 {
+       status = "okay";
+
+       u2phy1_otg: otg-port {
+               status = "okay";
+       };
+
+       u2phy1_host: host-port {
+               phy-supply = <&vcc5v0_host>;
+               status = "okay";
+       };
+};
+
+&uart0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>;
+       status = "okay";
+
+       bluetooth {
+               compatible = "brcm,bcm43438-bt";
+               clocks = <&rk808 1>;
+               clock-names = "lpo";
+               device-wakeup-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>;
+               host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>;
+               shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>;
+               vbat-supply = <&vcc3v3_sys>;
+               vddio-supply = <&vcc_1v8>;
+       };
+};
+
+&uart2 {
+       status = "okay";
+};
+
+&usb_host0_ehci {
+       status = "okay";
+};
+
+&usb_host0_ohci {
+       status = "okay";
+};
+
+&usb_host1_ehci {
+       status = "okay";
+};
+
+&usb_host1_ohci {
+       status = "okay";
+};
+
+&usbdrd3_0 {
+       status = "okay";
+};
+
+&usbdrd_dwc3_0 {
+       status = "okay";
+       dr_mode = "otg";
+};
+
+&usbdrd3_1 {
+       status = "okay";
+};
+
+&usbdrd_dwc3_1 {
+       status = "okay";
+       dr_mode = "host";
+};
+
+&vopb {
+       status = "okay";
+};
+
+&vopb_mmu {
+       status = "okay";
+};
+
+&vopl {
+       status = "okay";
+};
+
+&vopl_mmu {
+       status = "okay";
+};
index 8b857ccfc79726b76dbfa2f4e5effa30635c7fe8..9bb130a92a962689bd993d40f4377e3910c05726 100644 (file)
                clock-names = "pclk_ddr_mon";
        };
 
+       rng: rng@ff8b8000 {
+               compatible = "rockchip,cryptov1-rng";
+               reg = <0x0 0xff8b8000 0x0 0x1000>;
+               status = "disabled";
+       };
+
        dmc: dmc {
                u-boot,dm-pre-reloc;
                compatible = "rockchip,rk3399-dmc";
@@ -79,6 +85,7 @@
 };
 
 &sdhci {
+       max-frequency = <200000000>;
        u-boot,dm-pre-reloc;
 };
 
index 6b7c136ab8cb8bdad4b871b773ba75cfb9272c1e..74f2c3d490953770e22b1ec8f92fbb949c2a9141 100644 (file)
@@ -1,6 +1,6 @@
-// SPDX-License-Identifier: GPL-2.0+
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
- * Copyright (c) 2016-2017 Fuzhou Rockchip Electronics Co., Ltd.
+ * Copyright (c) 2016 Fuzhou Rockchip Electronics Co., Ltd
  */
 
 #include <dt-bindings/clock/rk3399-cru.h>
@@ -19,6 +19,7 @@
        #size-cells = <2>;
 
        aliases {
+               ethernet0 = &gmac;
                i2c0 = &i2c0;
                i2c1 = &i2c1;
                i2c2 = &i2c2;
 
                cpu_l0: cpu@0 {
                        device_type = "cpu";
-                       compatible = "arm,cortex-a53", "arm,armv8";
+                       compatible = "arm,cortex-a53";
                        reg = <0x0 0x0>;
                        enable-method = "psci";
-                       #cooling-cells = <2>; /* min followed by max */
+                       capacity-dmips-mhz = <485>;
                        clocks = <&cru ARMCLKL>;
+                       #cooling-cells = <2>; /* min followed by max */
+                       dynamic-power-coefficient = <100>;
+                       cpu-idle-states = <&CPU_SLEEP &CLUSTER_SLEEP>;
                };
 
                cpu_l1: cpu@1 {
                        device_type = "cpu";
-                       compatible = "arm,cortex-a53", "arm,armv8";
+                       compatible = "arm,cortex-a53";
                        reg = <0x0 0x1>;
                        enable-method = "psci";
+                       capacity-dmips-mhz = <485>;
                        clocks = <&cru ARMCLKL>;
+                       #cooling-cells = <2>; /* min followed by max */
+                       dynamic-power-coefficient = <100>;
+                       cpu-idle-states = <&CPU_SLEEP &CLUSTER_SLEEP>;
                };
 
                cpu_l2: cpu@2 {
                        device_type = "cpu";
-                       compatible = "arm,cortex-a53", "arm,armv8";
+                       compatible = "arm,cortex-a53";
                        reg = <0x0 0x2>;
                        enable-method = "psci";
+                       capacity-dmips-mhz = <485>;
                        clocks = <&cru ARMCLKL>;
+                       #cooling-cells = <2>; /* min followed by max */
+                       dynamic-power-coefficient = <100>;
+                       cpu-idle-states = <&CPU_SLEEP &CLUSTER_SLEEP>;
                };
 
                cpu_l3: cpu@3 {
                        device_type = "cpu";
-                       compatible = "arm,cortex-a53", "arm,armv8";
+                       compatible = "arm,cortex-a53";
                        reg = <0x0 0x3>;
                        enable-method = "psci";
+                       capacity-dmips-mhz = <485>;
                        clocks = <&cru ARMCLKL>;
+                       #cooling-cells = <2>; /* min followed by max */
+                       dynamic-power-coefficient = <100>;
+                       cpu-idle-states = <&CPU_SLEEP &CLUSTER_SLEEP>;
                };
 
                cpu_b0: cpu@100 {
                        device_type = "cpu";
-                       compatible = "arm,cortex-a72", "arm,armv8";
+                       compatible = "arm,cortex-a72";
                        reg = <0x0 0x100>;
                        enable-method = "psci";
-                       #cooling-cells = <2>; /* min followed by max */
+                       capacity-dmips-mhz = <1024>;
                        clocks = <&cru ARMCLKB>;
+                       #cooling-cells = <2>; /* min followed by max */
+                       dynamic-power-coefficient = <436>;
+                       cpu-idle-states = <&CPU_SLEEP &CLUSTER_SLEEP>;
                };
 
                cpu_b1: cpu@101 {
                        device_type = "cpu";
-                       compatible = "arm,cortex-a72", "arm,armv8";
+                       compatible = "arm,cortex-a72";
                        reg = <0x0 0x101>;
                        enable-method = "psci";
+                       capacity-dmips-mhz = <1024>;
                        clocks = <&cru ARMCLKB>;
+                       #cooling-cells = <2>; /* min followed by max */
+                       dynamic-power-coefficient = <436>;
+                       cpu-idle-states = <&CPU_SLEEP &CLUSTER_SLEEP>;
                };
+
+               idle-states {
+                       entry-method = "psci";
+
+                       CPU_SLEEP: cpu-sleep {
+                               compatible = "arm,idle-state";
+                               local-timer-stop;
+                               arm,psci-suspend-param = <0x0010000>;
+                               entry-latency-us = <120>;
+                               exit-latency-us = <250>;
+                               min-residency-us = <900>;
+                       };
+
+                       CLUSTER_SLEEP: cluster-sleep {
+                               compatible = "arm,idle-state";
+                               local-timer-stop;
+                               arm,psci-suspend-param = <0x1010000>;
+                               entry-latency-us = <400>;
+                               exit-latency-us = <500>;
+                               min-residency-us = <2000>;
+                       };
+               };
+       };
+
+       display-subsystem {
+               compatible = "rockchip,display-subsystem";
+               ports = <&vopl_out>, <&vopb_out>;
        };
 
        pmu_a53 {
                #clock-cells = <0>;
        };
 
-       amba {
+       amba: bus {
                compatible = "simple-bus";
                #address-cells = <2>;
                #size-cells = <2>;
                #size-cells = <2>;
                #interrupt-cells = <1>;
                aspm-no-l0s;
-               bus-range = <0x0 0x1>;
+               bus-range = <0x0 0x1f>;
                clocks = <&cru ACLK_PCIE>, <&cru ACLK_PERF_PCIE>,
                         <&cru PCLK_PCIE>, <&cru SCLK_PCIE_PM>;
                clock-names = "aclk", "aclk-perf",
                linux,pci-domain = <0>;
                max-link-speed = <1>;
                msi-map = <0x0 &its 0x0 0x1000>;
-               phys = <&pcie_phy>;
-               phy-names = "pcie-phy";
-               ranges = <0x83000000 0x0 0xfa000000 0x0 0xfa000000 0x0 0x600000
-                         0x81000000 0x0 0xfa600000 0x0 0xfa600000 0x0 0x100000>;
+               phys = <&pcie_phy 0>, <&pcie_phy 1>,
+                      <&pcie_phy 2>, <&pcie_phy 3>;
+               phy-names = "pcie-phy-0", "pcie-phy-1",
+                           "pcie-phy-2", "pcie-phy-3";
+               ranges = <0x83000000 0x0 0xfa000000 0x0 0xfa000000 0x0 0x1e00000
+                         0x81000000 0x0 0xfbe00000 0x0 0xfbe00000 0x0 0x100000>;
                resets = <&cru SRST_PCIE_CORE>, <&cru SRST_PCIE_MGMT>,
                         <&cru SRST_PCIE_MGMT_STICKY>, <&cru SRST_PCIE_PIPE>,
                         <&cru SRST_PCIE_PM>, <&cru SRST_P_PCIE>,
                resets = <&cru SRST_A_GMAC>;
                reset-names = "stmmaceth";
                rockchip,grf = <&grf>;
+               snps,txpbl = <0x4>;
                status = "disabled";
        };
 
-       sdio0: dwmmc@fe310000 {
+       sdio0: mmc@fe310000 {
                compatible = "rockchip,rk3399-dw-mshc",
                             "rockchip,rk3288-dw-mshc";
                reg = <0x0 0xfe310000 0x0 0x4000>;
                status = "disabled";
        };
 
-       sdmmc: dwmmc@fe320000 {
+       sdmmc: mmc@fe320000 {
                compatible = "rockchip,rk3399-dw-mshc",
                             "rockchip,rk3288-dw-mshc";
                reg = <0x0 0xfe320000 0x0 0x4000>;
                interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH 0>;
                max-frequency = <150000000>;
+               assigned-clocks = <&cru HCLK_SD>;
+               assigned-clock-rates = <200000000>;
                clocks = <&cru HCLK_SDMMC>, <&cru SCLK_SDMMC>,
                         <&cru SCLK_SDMMC_DRV>, <&cru SCLK_SDMMC_SAMPLE>;
                clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
                arasan,soc-ctl-syscon = <&grf>;
                assigned-clocks = <&cru SCLK_EMMC>;
                assigned-clock-rates = <200000000>;
-               max-frequency = <200000000>;
                clocks = <&cru SCLK_EMMC>, <&cru ACLK_EMMC>;
                clock-names = "clk_xin", "clk_ahb";
                clock-output-names = "emmc_cardclock";
                phys = <&emmc_phy>;
                phy-names = "phy_arasan";
                power-domains = <&power RK3399_PD_EMMC>;
+               disable-cqe-dcmd;
                status = "disabled";
        };
 
                interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH 0>;
                clocks = <&cru HCLK_HOST0>, <&cru HCLK_HOST0_ARB>,
                         <&u2phy0>;
-               clock-names = "usbhost", "arbiter",
-                             "utmi";
                phys = <&u2phy0_host>;
                phy-names = "usb";
-               power-domains = <&power RK3399_PD_PERIHP>;
                status = "disabled";
        };
 
                interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH 0>;
                clocks = <&cru HCLK_HOST0>, <&cru HCLK_HOST0_ARB>,
                         <&u2phy0>;
-               clock-names = "usbhost", "arbiter",
-                             "utmi";
                phys = <&u2phy0_host>;
                phy-names = "usb";
-               power-domains = <&power RK3399_PD_PERIHP>;
                status = "disabled";
        };
 
                interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH 0>;
                clocks = <&cru HCLK_HOST1>, <&cru HCLK_HOST1_ARB>,
                         <&u2phy1>;
-               clock-names = "usbhost", "arbiter",
-                             "utmi";
                phys = <&u2phy1_host>;
                phy-names = "usb";
-               power-domains = <&power RK3399_PD_PERIHP>;
                status = "disabled";
        };
 
                interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH 0>;
                clocks = <&cru HCLK_HOST1>, <&cru HCLK_HOST1_ARB>,
                         <&u2phy1>;
-               clock-names = "usbhost", "arbiter",
-                             "utmi";
                phys = <&u2phy1_host>;
                phy-names = "usb";
-               power-domains = <&power RK3399_PD_PERIHP>;
                status = "disabled";
        };
 
-       usbdrd3_0: dwc3_typec0: usb@fe800000 {
+       usbdrd3_0: usb@fe800000 {
                compatible = "rockchip,rk3399-dwc3";
                #address-cells = <2>;
                #size-cells = <2>;
                        compatible = "snps,dwc3";
                        reg = <0x0 0xfe800000 0x0 0x100000>;
                        interrupts = <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH 0>;
+                       clocks = <&cru SCLK_USB3OTG0_REF>, <&cru ACLK_USB3OTG0>,
+                                <&cru SCLK_USB3OTG0_SUSPEND>;
+                       clock-names = "ref", "bus_early", "suspend";
                        dr_mode = "otg";
                        phys = <&u2phy0_otg>, <&tcphy0_usb3>;
                        phy-names = "usb2-phy", "usb3-phy";
                };
        };
 
-       dwc3_typec1: usbdrd3_1: usb@fe900000 {
+       usbdrd3_1: usb@fe900000 {
                compatible = "rockchip,rk3399-dwc3";
                #address-cells = <2>;
                #size-cells = <2>;
                        compatible = "snps,dwc3";
                        reg = <0x0 0xfe900000 0x0 0x100000>;
                        interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH 0>;
+                       clocks = <&cru SCLK_USB3OTG1_REF>, <&cru ACLK_USB3OTG1>,
+                                <&cru SCLK_USB3OTG1_SUSPEND>;
+                       clock-names = "ref", "bus_early", "suspend";
                        dr_mode = "otg";
                        phys = <&u2phy1_otg>, <&tcphy1_usb3>;
                        phy-names = "usb2-phy", "usb3-phy";
                its: interrupt-controller@fee20000 {
                        compatible = "arm,gic-v3-its";
                        msi-controller;
+                       #msi-cells = <1>;
                        reg = <0x0 0xfee20000 0x0 0x20000>;
                };
 
                clocks = <&cru SCLK_UART2>, <&cru PCLK_UART2>;
                clock-names = "baudclk", "apb_pclk";
                interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH 0>;
-               clock-frequency = <24000000>;
                reg-shift = <2>;
                reg-io-width = <4>;
                pinctrl-names = "default";
                clocks = <&cru SCLK_SPI0>, <&cru PCLK_SPI0>;
                clock-names = "spiclk", "apb_pclk";
                interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH 0>;
+               dmas = <&dmac_peri 10>, <&dmac_peri 11>;
+               dma-names = "tx", "rx";
                pinctrl-names = "default";
                pinctrl-0 = <&spi0_clk &spi0_tx &spi0_rx &spi0_cs0>;
                #address-cells = <1>;
                clocks = <&cru SCLK_SPI1>, <&cru PCLK_SPI1>;
                clock-names = "spiclk", "apb_pclk";
                interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH 0>;
+               dmas = <&dmac_peri 12>, <&dmac_peri 13>;
+               dma-names = "tx", "rx";
                pinctrl-names = "default";
                pinctrl-0 = <&spi1_clk &spi1_tx &spi1_rx &spi1_cs0>;
                #address-cells = <1>;
                clocks = <&cru SCLK_SPI2>, <&cru PCLK_SPI2>;
                clock-names = "spiclk", "apb_pclk";
                interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH 0>;
+               dmas = <&dmac_peri 14>, <&dmac_peri 15>;
+               dma-names = "tx", "rx";
                pinctrl-names = "default";
                pinctrl-0 = <&spi2_clk &spi2_tx &spi2_rx &spi2_cs0>;
                #address-cells = <1>;
                clocks = <&cru SCLK_SPI4>, <&cru PCLK_SPI4>;
                clock-names = "spiclk", "apb_pclk";
                interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH 0>;
+               dmas = <&dmac_peri 18>, <&dmac_peri 19>;
+               dma-names = "tx", "rx";
                pinctrl-names = "default";
                pinctrl-0 = <&spi4_clk &spi4_tx &spi4_rx &spi4_cs0>;
                #address-cells = <1>;
                clocks = <&cru SCLK_SPI5>, <&cru PCLK_SPI5>;
                clock-names = "spiclk", "apb_pclk";
                interrupts = <GIC_SPI 132 IRQ_TYPE_LEVEL_HIGH 0>;
+               dmas = <&dmac_bus 8>, <&dmac_bus 9>;
+               dma-names = "tx", "rx";
                pinctrl-names = "default";
                pinctrl-0 = <&spi5_clk &spi5_tx &spi5_rx &spi5_cs0>;
+               power-domains = <&power RK3399_PD_SDIOAUDIO>;
                #address-cells = <1>;
                #size-cells = <0>;
                status = "disabled";
                                map0 {
                                        trip = <&cpu_alert0>;
                                        cooling-device =
-                                               <&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                                               <&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                               <&cpu_b1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
                                };
                                map1 {
                                        trip = <&cpu_alert1>;
                                        cooling-device =
                                                <&cpu_l0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-                                               <&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                                               <&cpu_l1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                               <&cpu_l2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                               <&cpu_l3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                               <&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                               <&cpu_b1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
                                };
                        };
                };
                                map0 {
                                        trip = <&gpu_alert0>;
                                        cooling-device =
-                                               <&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                                               <&gpu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
                                };
                        };
                };
                                         <&cru PCLK_GMAC>;
                                pm_qos = <&qos_gmac>;
                        };
-                       pd_perihp@RK3399_PD_PERIHP {
-                               reg = <RK3399_PD_PERIHP>;
-                               #address-cells = <1>;
-                               #size-cells = <0>;
-                               clocks = <&cru ACLK_PERIHP>;
-                               pm_qos = <&qos_perihp>,
-                                        <&qos_pcie>,
-                                        <&qos_usb_host0>,
-                                        <&qos_usb_host1>;
-
-                               pd_sd@RK3399_PD_SD {
-                                       reg = <RK3399_PD_SD>;
-                                       clocks = <&cru HCLK_SDMMC>,
-                                                <&cru SCLK_SDMMC>;
-                                       pm_qos = <&qos_sd>;
-                               };
+                       pd_sd@RK3399_PD_SD {
+                               reg = <RK3399_PD_SD>;
+                               clocks = <&cru HCLK_SDMMC>,
+                                        <&cru SCLK_SDMMC>;
+                               pm_qos = <&qos_sd>;
                        };
                        pd_sdioaudio@RK3399_PD_SDIOAUDIO {
                                reg = <RK3399_PD_SDIOAUDIO>;
        pmugrf: syscon@ff320000 {
                compatible = "rockchip,rk3399-pmugrf", "syscon", "simple-mfd";
                reg = <0x0 0xff320000 0x0 0x1000>;
+               #address-cells = <1>;
+               #size-cells = <1>;
 
                pmu_io_domains: io-domains {
                        compatible = "rockchip,rk3399-pmu-io-voltage-domain";
                status = "disabled";
        };
 
+       vpu: video-codec@ff650000 {
+               compatible = "rockchip,rk3399-vpu";
+               reg = <0x0 0xff650000 0x0 0x800>;
+               interrupts = <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH 0>,
+                            <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH 0>;
+               interrupt-names = "vepu", "vdpu";
+               clocks = <&cru ACLK_VCODEC>, <&cru HCLK_VCODEC>;
+               clock-names = "aclk", "hclk";
+               iommus = <&vpu_mmu>;
+               power-domains = <&power RK3399_PD_VCODEC>;
+       };
+
+       vpu_mmu: iommu@ff650800 {
+               compatible = "rockchip,iommu";
+               reg = <0x0 0xff650800 0x0 0x40>;
+               interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH 0>;
+               interrupt-names = "vpu_mmu";
+               clocks = <&cru ACLK_VCODEC>, <&cru HCLK_VCODEC>;
+               clock-names = "aclk", "iface";
+               #iommu-cells = <0>;
+               power-domains = <&power RK3399_PD_VCODEC>;
+       };
+
+       vdec_mmu: iommu@ff660480 {
+               compatible = "rockchip,iommu";
+               reg = <0x0 0xff660480 0x0 0x40>, <0x0 0xff6604c0 0x0 0x40>;
+               interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH 0>;
+               interrupt-names = "vdec_mmu";
+               clocks = <&cru ACLK_VDU>, <&cru HCLK_VDU>;
+               clock-names = "aclk", "iface";
+               #iommu-cells = <0>;
+               status = "disabled";
+       };
+
+       iep_mmu: iommu@ff670800 {
+               compatible = "rockchip,iommu";
+               reg = <0x0 0xff670800 0x0 0x40>;
+               interrupts = <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH 0>;
+               interrupt-names = "iep_mmu";
+               clocks = <&cru ACLK_IEP>, <&cru HCLK_IEP>;
+               clock-names = "aclk", "iface";
+               #iommu-cells = <0>;
+               status = "disabled";
+       };
+
+       rga: rga@ff680000 {
+               compatible = "rockchip,rk3399-rga";
+               reg = <0x0 0xff680000 0x0 0x10000>;
+               interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH 0>;
+               clocks = <&cru ACLK_RGA>, <&cru HCLK_RGA>, <&cru SCLK_RGA_CORE>;
+               clock-names = "aclk", "hclk", "sclk";
+               resets = <&cru SRST_RGA_CORE>, <&cru SRST_A_RGA>, <&cru SRST_H_RGA>;
+               reset-names = "core", "axi", "ahb";
+               power-domains = <&power RK3399_PD_RGA>;
+       };
+
        efuse0: efuse@ff690000 {
                compatible = "rockchip,rk3399-efuse";
                reg = <0x0 0xff690000 0x0 0x80>;
                        compatible = "rockchip,rk3399-pcie-phy";
                        clocks = <&cru SCLK_PCIEPHY_REF>;
                        clock-names = "refclk";
-                       #phy-cells = <0>;
+                       #phy-cells = <1>;
                        resets = <&cru SRST_PCIEPHY>;
+                       drive-impedance-ohm = <50>;
                        reset-names = "phy";
                        status = "disabled";
                };
                reg = <0x0 0xff914000 0x0 0x100>, <0x0 0xff915000 0x0 0x100>;
                interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH 0>;
                interrupt-names = "isp0_mmu";
-               clocks = <&cru ACLK_ISP0_NOC>, <&cru HCLK_ISP0_NOC>;
+               clocks = <&cru ACLK_ISP0_WRAPPER>, <&cru HCLK_ISP0_WRAPPER>;
                clock-names = "aclk", "iface";
                #iommu-cells = <0>;
+               power-domains = <&power RK3399_PD_ISP0>;
                rockchip,disable-mmu-reset;
-               status = "disabled";
        };
 
        isp1_mmu: iommu@ff924000 {
                reg = <0x0 0xff924000 0x0 0x100>, <0x0 0xff925000 0x0 0x100>;
                interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH 0>;
                interrupt-names = "isp1_mmu";
-               clocks = <&cru ACLK_ISP1_NOC>, <&cru HCLK_ISP1_NOC>;
+               clocks = <&cru ACLK_ISP1_WRAPPER>, <&cru HCLK_ISP1_WRAPPER>;
                clock-names = "aclk", "iface";
                #iommu-cells = <0>;
+               power-domains = <&power RK3399_PD_ISP1>;
                rockchip,disable-mmu-reset;
-               status = "disabled";
        };
 
        hdmi_sound: hdmi-sound {
        };
 
        mipi_dsi: mipi@ff960000 {
-               compatible = "rockchip,rk3399_mipi_dsi";
+               compatible = "rockchip,rk3399-mipi-dsi", "snps,dw-mipi-dsi";
                reg = <0x0 0xff960000 0x0 0x8000>;
                interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH 0>;
-               clocks = <&cru SCLK_MIPIDPHY_REF>, <&cru PCLK_MIPI_DSI0>,
-                        <&cru SCLK_DPHY_TX0_CFG>;
-               clock-names = "ref", "pclk", "phy_cfg";
+               clocks = <&cru SCLK_DPHY_PLL>, <&cru PCLK_MIPI_DSI0>,
+                        <&cru SCLK_DPHY_TX0_CFG>, <&cru PCLK_VIO_GRF>;
+               clock-names = "ref", "pclk", "phy_cfg", "grf";
+               power-domains = <&power RK3399_PD_VIO>;
+               resets = <&cru SRST_P_MIPI_DSI0>;
+               reset-names = "apb";
                rockchip,grf = <&grf>;
                #address-cells = <1>;
                #size-cells = <0>;
                status = "disabled";
+
                ports {
-                       reg = <1>;
-                       mipi_in: port {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       mipi_in: port@0 {
+                               reg = <0>;
                                #address-cells = <1>;
                                #size-cells = <0>;
+
                                mipi_in_vopb: endpoint@0 {
                                        reg = <0>;
                                        remote-endpoint = <&vopb_out_mipi>;
                resets = <&cru SRST_P_MIPI_DSI1>;
                reset-names = "apb";
                rockchip,grf = <&grf>;
+               #address-cells = <1>;
+               #size-cells = <0>;
                status = "disabled";
 
                ports {
                             <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH 0>;
                interrupt-names = "gpu", "job", "mmu";
                clocks = <&cru ACLK_GPU>;
+               #cooling-cells = <2>;
                power-domains = <&power RK3399_PD_GPU>;
                status = "disabled";
        };
 
                clock {
                        clk_32k: clk-32k {
-                               rockchip,pins = <0 RK_PA0 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PA0 2 &pcfg_pull_none>;
                        };
                };
 
                edp {
                        edp_hpd: edp-hpd {
                                rockchip,pins =
-                                       <4 RK_PC7 RK_FUNC_2 &pcfg_pull_none>;
+                                       <4 RK_PC7 2 &pcfg_pull_none>;
                        };
                };
 
                        rgmii_pins: rgmii-pins {
                                rockchip,pins =
                                        /* mac_txclk */
-                                       <3 RK_PC1 RK_FUNC_1 &pcfg_pull_none_13ma>,
+                                       <3 RK_PC1 1 &pcfg_pull_none_13ma>,
                                        /* mac_rxclk */
-                                       <3 RK_PB6 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PB6 1 &pcfg_pull_none>,
                                        /* mac_mdio */
-                                       <3 RK_PB5 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PB5 1 &pcfg_pull_none>,
                                        /* mac_txen */
-                                       <3 RK_PB4 RK_FUNC_1 &pcfg_pull_none_13ma>,
+                                       <3 RK_PB4 1 &pcfg_pull_none_13ma>,
                                        /* mac_clk */
-                                       <3 RK_PB3 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PB3 1 &pcfg_pull_none>,
                                        /* mac_rxdv */
-                                       <3 RK_PB1 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PB1 1 &pcfg_pull_none>,
                                        /* mac_mdc */
-                                       <3 RK_PB0 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PB0 1 &pcfg_pull_none>,
                                        /* mac_rxd1 */
-                                       <3 RK_PA7 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PA7 1 &pcfg_pull_none>,
                                        /* mac_rxd0 */
-                                       <3 RK_PA6 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PA6 1 &pcfg_pull_none>,
                                        /* mac_txd1 */
-                                       <3 RK_PA5 RK_FUNC_1 &pcfg_pull_none_13ma>,
+                                       <3 RK_PA5 1 &pcfg_pull_none_13ma>,
                                        /* mac_txd0 */
-                                       <3 RK_PA4 RK_FUNC_1 &pcfg_pull_none_13ma>,
+                                       <3 RK_PA4 1 &pcfg_pull_none_13ma>,
                                        /* mac_rxd3 */
-                                       <3 RK_PA3 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PA3 1 &pcfg_pull_none>,
                                        /* mac_rxd2 */
-                                       <3 RK_PA2 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PA2 1 &pcfg_pull_none>,
                                        /* mac_txd3 */
-                                       <3 RK_PA1 RK_FUNC_1 &pcfg_pull_none_13ma>,
+                                       <3 RK_PA1 1 &pcfg_pull_none_13ma>,
                                        /* mac_txd2 */
-                                       <3 RK_PA0 RK_FUNC_1 &pcfg_pull_none_13ma>;
+                                       <3 RK_PA0 1 &pcfg_pull_none_13ma>;
                        };
 
                        rmii_pins: rmii-pins {
                                rockchip,pins =
                                        /* mac_mdio */
-                                       <3 RK_PB5 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PB5 1 &pcfg_pull_none>,
                                        /* mac_txen */
-                                       <3 RK_PB4 RK_FUNC_1 &pcfg_pull_none_13ma>,
+                                       <3 RK_PB4 1 &pcfg_pull_none_13ma>,
                                        /* mac_clk */
-                                       <3 RK_PB3 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PB3 1 &pcfg_pull_none>,
                                        /* mac_rxer */
-                                       <3 RK_PB2 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PB2 1 &pcfg_pull_none>,
                                        /* mac_rxdv */
-                                       <3 RK_PB1 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PB1 1 &pcfg_pull_none>,
                                        /* mac_mdc */
-                                       <3 RK_PB0 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PB0 1 &pcfg_pull_none>,
                                        /* mac_rxd1 */
-                                       <3 RK_PA7 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PA7 1 &pcfg_pull_none>,
                                        /* mac_rxd0 */
-                                       <3 RK_PA6 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PA6 1 &pcfg_pull_none>,
                                        /* mac_txd1 */
-                                       <3 RK_PA5 RK_FUNC_1 &pcfg_pull_none_13ma>,
+                                       <3 RK_PA5 1 &pcfg_pull_none_13ma>,
                                        /* mac_txd0 */
-                                       <3 RK_PA4 RK_FUNC_1 &pcfg_pull_none_13ma>;
+                                       <3 RK_PA4 1 &pcfg_pull_none_13ma>;
                        };
                };
 
                i2c0 {
                        i2c0_xfer: i2c0-xfer {
                                rockchip,pins =
-                                       <1 RK_PB7 RK_FUNC_2 &pcfg_pull_none>,
-                                       <1 RK_PC0 RK_FUNC_2 &pcfg_pull_none>;
+                                       <1 RK_PB7 2 &pcfg_pull_none>,
+                                       <1 RK_PC0 2 &pcfg_pull_none>;
                        };
                };
 
                i2c1 {
                        i2c1_xfer: i2c1-xfer {
                                rockchip,pins =
-                                       <4 RK_PA2 RK_FUNC_1 &pcfg_pull_none>,
-                                       <4 RK_PA1 RK_FUNC_1 &pcfg_pull_none>;
+                                       <4 RK_PA2 1 &pcfg_pull_none>,
+                                       <4 RK_PA1 1 &pcfg_pull_none>;
                        };
                };
 
                i2c2 {
                        i2c2_xfer: i2c2-xfer {
                                rockchip,pins =
-                                       <2 RK_PA1 RK_FUNC_2 &pcfg_pull_none_12ma>,
-                                       <2 RK_PA0 RK_FUNC_2 &pcfg_pull_none_12ma>;
+                                       <2 RK_PA1 2 &pcfg_pull_none_12ma>,
+                                       <2 RK_PA0 2 &pcfg_pull_none_12ma>;
                        };
                };
 
                i2c3 {
                        i2c3_xfer: i2c3-xfer {
                                rockchip,pins =
-                                       <4 RK_PC1 RK_FUNC_1 &pcfg_pull_none>,
-                                       <4 RK_PC0 RK_FUNC_1 &pcfg_pull_none>;
+                                       <4 RK_PC1 1 &pcfg_pull_none>,
+                                       <4 RK_PC0 1 &pcfg_pull_none>;
                        };
                };
 
                i2c4 {
                        i2c4_xfer: i2c4-xfer {
                                rockchip,pins =
-                                       <1 RK_PB4 RK_FUNC_1 &pcfg_pull_none>,
-                                       <1 RK_PB3 RK_FUNC_1 &pcfg_pull_none>;
+                                       <1 RK_PB4 1 &pcfg_pull_none>,
+                                       <1 RK_PB3 1 &pcfg_pull_none>;
                        };
                };
 
                i2c5 {
                        i2c5_xfer: i2c5-xfer {
                                rockchip,pins =
-                                       <3 RK_PB3 RK_FUNC_2 &pcfg_pull_none>,
-                                       <3 RK_PB2 RK_FUNC_2 &pcfg_pull_none>;
+                                       <3 RK_PB3 2 &pcfg_pull_none>,
+                                       <3 RK_PB2 2 &pcfg_pull_none>;
                        };
                };
 
                i2c6 {
                        i2c6_xfer: i2c6-xfer {
                                rockchip,pins =
-                                       <2 RK_PB2 RK_FUNC_2 &pcfg_pull_none>,
-                                       <2 RK_PB1 RK_FUNC_2 &pcfg_pull_none>;
+                                       <2 RK_PB2 2 &pcfg_pull_none>,
+                                       <2 RK_PB1 2 &pcfg_pull_none>;
                        };
                };
 
                i2c7 {
                        i2c7_xfer: i2c7-xfer {
                                rockchip,pins =
-                                       <2 RK_PB0 RK_FUNC_2 &pcfg_pull_none>,
-                                       <2 RK_PA7 RK_FUNC_2 &pcfg_pull_none>;
+                                       <2 RK_PB0 2 &pcfg_pull_none>,
+                                       <2 RK_PA7 2 &pcfg_pull_none>;
                        };
                };
 
                i2c8 {
                        i2c8_xfer: i2c8-xfer {
                                rockchip,pins =
-                                       <1 RK_PC5 RK_FUNC_1 &pcfg_pull_none>,
-                                       <1 RK_PC4 RK_FUNC_1 &pcfg_pull_none>;
+                                       <1 RK_PC5 1 &pcfg_pull_none>,
+                                       <1 RK_PC4 1 &pcfg_pull_none>;
                        };
                };
 
                i2s0 {
+                       i2s0_2ch_bus: i2s0-2ch-bus {
+                               rockchip,pins =
+                                       <3 RK_PD0 1 &pcfg_pull_none>,
+                                       <3 RK_PD1 1 &pcfg_pull_none>,
+                                       <3 RK_PD2 1 &pcfg_pull_none>,
+                                       <3 RK_PD3 1 &pcfg_pull_none>,
+                                       <3 RK_PD7 1 &pcfg_pull_none>,
+                                       <4 RK_PA0 1 &pcfg_pull_none>;
+                       };
+
                        i2s0_8ch_bus: i2s0-8ch-bus {
                                rockchip,pins =
-                                       <3 RK_PD0 RK_FUNC_1 &pcfg_pull_none>,
-                                       <3 RK_PD1 RK_FUNC_1 &pcfg_pull_none>,
-                                       <3 RK_PD2 RK_FUNC_1 &pcfg_pull_none>,
-                                       <3 RK_PD3 RK_FUNC_1 &pcfg_pull_none>,
-                                       <3 RK_PD4 RK_FUNC_1 &pcfg_pull_none>,
-                                       <3 RK_PD5 RK_FUNC_1 &pcfg_pull_none>,
-                                       <3 RK_PD6 RK_FUNC_1 &pcfg_pull_none>,
-                                       <3 RK_PD7 RK_FUNC_1 &pcfg_pull_none>,
-                                       <4 RK_PA0 RK_FUNC_1 &pcfg_pull_none>;
+                                       <3 RK_PD0 1 &pcfg_pull_none>,
+                                       <3 RK_PD1 1 &pcfg_pull_none>,
+                                       <3 RK_PD2 1 &pcfg_pull_none>,
+                                       <3 RK_PD3 1 &pcfg_pull_none>,
+                                       <3 RK_PD4 1 &pcfg_pull_none>,
+                                       <3 RK_PD5 1 &pcfg_pull_none>,
+                                       <3 RK_PD6 1 &pcfg_pull_none>,
+                                       <3 RK_PD7 1 &pcfg_pull_none>,
+                                       <4 RK_PA0 1 &pcfg_pull_none>;
                        };
                };
 
                i2s1 {
                        i2s1_2ch_bus: i2s1-2ch-bus {
                                rockchip,pins =
-                                       <4 RK_PA3 RK_FUNC_1 &pcfg_pull_none>,
-                                       <4 RK_PA4 RK_FUNC_1 &pcfg_pull_none>,
-                                       <4 RK_PA5 RK_FUNC_1 &pcfg_pull_none>,
-                                       <4 RK_PA6 RK_FUNC_1 &pcfg_pull_none>,
-                                       <4 RK_PA7 RK_FUNC_1 &pcfg_pull_none>;
+                                       <4 RK_PA3 1 &pcfg_pull_none>,
+                                       <4 RK_PA4 1 &pcfg_pull_none>,
+                                       <4 RK_PA5 1 &pcfg_pull_none>,
+                                       <4 RK_PA6 1 &pcfg_pull_none>,
+                                       <4 RK_PA7 1 &pcfg_pull_none>;
                        };
                };
 
                sdio0 {
                        sdio0_bus1: sdio0-bus1 {
                                rockchip,pins =
-                                       <2 RK_PC4 RK_FUNC_1 &pcfg_pull_up>;
+                                       <2 RK_PC4 1 &pcfg_pull_up>;
                        };
 
                        sdio0_bus4: sdio0-bus4 {
                                rockchip,pins =
-                                       <2 RK_PC4 RK_FUNC_1 &pcfg_pull_up>,
-                                       <2 RK_PC5 RK_FUNC_1 &pcfg_pull_up>,
-                                       <2 RK_PC6 RK_FUNC_1 &pcfg_pull_up>,
-                                       <2 RK_PC7 RK_FUNC_1 &pcfg_pull_up>;
+                                       <2 RK_PC4 1 &pcfg_pull_up>,
+                                       <2 RK_PC5 1 &pcfg_pull_up>,
+                                       <2 RK_PC6 1 &pcfg_pull_up>,
+                                       <2 RK_PC7 1 &pcfg_pull_up>;
                        };
 
                        sdio0_cmd: sdio0-cmd {
                                rockchip,pins =
-                                       <2 RK_PD0 RK_FUNC_1 &pcfg_pull_up>;
+                                       <2 RK_PD0 1 &pcfg_pull_up>;
                        };
 
                        sdio0_clk: sdio0-clk {
                                rockchip,pins =
-                                       <2 RK_PD1 RK_FUNC_1 &pcfg_pull_none>;
+                                       <2 RK_PD1 1 &pcfg_pull_none>;
                        };
 
                        sdio0_cd: sdio0-cd {
                                rockchip,pins =
-                                       <2 RK_PD2 RK_FUNC_1 &pcfg_pull_up>;
+                                       <2 RK_PD2 1 &pcfg_pull_up>;
                        };
 
                        sdio0_pwr: sdio0-pwr {
                                rockchip,pins =
-                                       <2 RK_PD3 RK_FUNC_1 &pcfg_pull_up>;
+                                       <2 RK_PD3 1 &pcfg_pull_up>;
                        };
 
                        sdio0_bkpwr: sdio0-bkpwr {
                                rockchip,pins =
-                                       <2 RK_PD4 RK_FUNC_1 &pcfg_pull_up>;
+                                       <2 RK_PD4 1 &pcfg_pull_up>;
                        };
 
                        sdio0_wp: sdio0-wp {
                                rockchip,pins =
-                                       <0 RK_PA3 RK_FUNC_1 &pcfg_pull_up>;
+                                       <0 RK_PA3 1 &pcfg_pull_up>;
                        };
 
                        sdio0_int: sdio0-int {
                                rockchip,pins =
-                                       <0 RK_PA4 RK_FUNC_1 &pcfg_pull_up>;
+                                       <0 RK_PA4 1 &pcfg_pull_up>;
                        };
                };
 
                sdmmc {
                        sdmmc_bus1: sdmmc-bus1 {
                                rockchip,pins =
-                                       <4 RK_PB0 RK_FUNC_1 &pcfg_pull_up>;
+                                       <4 RK_PB0 1 &pcfg_pull_up>;
                        };
 
                        sdmmc_bus4: sdmmc-bus4 {
                                rockchip,pins =
-                                       <4 RK_PB0 RK_FUNC_1 &pcfg_pull_up>,
-                                       <4 RK_PB1 RK_FUNC_1 &pcfg_pull_up>,
-                                       <4 RK_PB2 RK_FUNC_1 &pcfg_pull_up>,
-                                       <4 RK_PB3 RK_FUNC_1 &pcfg_pull_up>;
+                                       <4 RK_PB0 1 &pcfg_pull_up>,
+                                       <4 RK_PB1 1 &pcfg_pull_up>,
+                                       <4 RK_PB2 1 &pcfg_pull_up>,
+                                       <4 RK_PB3 1 &pcfg_pull_up>;
                        };
 
                        sdmmc_clk: sdmmc-clk {
                                rockchip,pins =
-                                       <4 RK_PB4 RK_FUNC_1 &pcfg_pull_none>;
+                                       <4 RK_PB4 1 &pcfg_pull_none>;
                        };
 
                        sdmmc_cmd: sdmmc-cmd {
                                rockchip,pins =
-                                       <4 RK_PB5 RK_FUNC_1 &pcfg_pull_up>;
+                                       <4 RK_PB5 1 &pcfg_pull_up>;
                        };
 
                        sdmmc_cd: sdmmc-cd {
                                rockchip,pins =
-                                       <0 RK_PA7 RK_FUNC_1 &pcfg_pull_up>;
+                                       <0 RK_PA7 1 &pcfg_pull_up>;
                        };
 
                        sdmmc_wp: sdmmc-wp {
                                rockchip,pins =
-                                       <0 RK_PB0 RK_FUNC_1 &pcfg_pull_up>;
+                                       <0 RK_PB0 1 &pcfg_pull_up>;
                        };
                };
 
                sleep {
                        ap_pwroff: ap-pwroff {
-                               rockchip,pins = <1 RK_PA5 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PA5 1 &pcfg_pull_none>;
                        };
 
                        ddrio_pwroff: ddrio-pwroff {
-                               rockchip,pins = <0 RK_PA1 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PA1 1 &pcfg_pull_none>;
                        };
                };
 
                spdif {
                        spdif_bus: spdif-bus {
                                rockchip,pins =
-                                       <4 RK_PC5 RK_FUNC_1 &pcfg_pull_none>;
+                                       <4 RK_PC5 1 &pcfg_pull_none>;
                        };
 
                        spdif_bus_1: spdif-bus-1 {
                                rockchip,pins =
-                                       <3 RK_PC0 RK_FUNC_3 &pcfg_pull_none>;
+                                       <3 RK_PC0 3 &pcfg_pull_none>;
                        };
                };
 
                spi0 {
                        spi0_clk: spi0-clk {
                                rockchip,pins =
-                                       <3 RK_PA6 RK_FUNC_2 &pcfg_pull_up>;
+                                       <3 RK_PA6 2 &pcfg_pull_up>;
                        };
                        spi0_cs0: spi0-cs0 {
                                rockchip,pins =
-                                       <3 RK_PA7 RK_FUNC_2 &pcfg_pull_up>;
+                                       <3 RK_PA7 2 &pcfg_pull_up>;
                        };
                        spi0_cs1: spi0-cs1 {
                                rockchip,pins =
-                                       <3 RK_PB0 RK_FUNC_2 &pcfg_pull_up>;
+                                       <3 RK_PB0 2 &pcfg_pull_up>;
                        };
                        spi0_tx: spi0-tx {
                                rockchip,pins =
-                                       <3 RK_PA5 RK_FUNC_2 &pcfg_pull_up>;
+                                       <3 RK_PA5 2 &pcfg_pull_up>;
                        };
                        spi0_rx: spi0-rx {
                                rockchip,pins =
-                                       <3 RK_PA4 RK_FUNC_2 &pcfg_pull_up>;
+                                       <3 RK_PA4 2 &pcfg_pull_up>;
                        };
                };
 
                spi1 {
                        spi1_clk: spi1-clk {
                                rockchip,pins =
-                                       <1 RK_PB1 RK_FUNC_2 &pcfg_pull_up>;
+                                       <1 RK_PB1 2 &pcfg_pull_up>;
                        };
                        spi1_cs0: spi1-cs0 {
                                rockchip,pins =
-                                       <1 RK_PB2 RK_FUNC_2 &pcfg_pull_up>;
+                                       <1 RK_PB2 2 &pcfg_pull_up>;
                        };
                        spi1_rx: spi1-rx {
                                rockchip,pins =
-                                       <1 RK_PA7 RK_FUNC_2 &pcfg_pull_up>;
+                                       <1 RK_PA7 2 &pcfg_pull_up>;
                        };
                        spi1_tx: spi1-tx {
                                rockchip,pins =
-                                       <1 RK_PB0 RK_FUNC_2 &pcfg_pull_up>;
+                                       <1 RK_PB0 2 &pcfg_pull_up>;
                        };
                };
 
                spi2 {
                        spi2_clk: spi2-clk {
                                rockchip,pins =
-                                       <2 RK_PB3 RK_FUNC_1 &pcfg_pull_up>;
+                                       <2 RK_PB3 1 &pcfg_pull_up>;
                        };
                        spi2_cs0: spi2-cs0 {
                                rockchip,pins =
-                                       <2 RK_PB4 RK_FUNC_1 &pcfg_pull_up>;
+                                       <2 RK_PB4 1 &pcfg_pull_up>;
                        };
                        spi2_rx: spi2-rx {
                                rockchip,pins =
-                                       <2 RK_PB1 RK_FUNC_1 &pcfg_pull_up>;
+                                       <2 RK_PB1 1 &pcfg_pull_up>;
                        };
                        spi2_tx: spi2-tx {
                                rockchip,pins =
-                                       <2 RK_PB2 RK_FUNC_1 &pcfg_pull_up>;
+                                       <2 RK_PB2 1 &pcfg_pull_up>;
                        };
                };
 
                spi3 {
                        spi3_clk: spi3-clk {
                                rockchip,pins =
-                                       <1 RK_PC1 RK_FUNC_1 &pcfg_pull_up>;
+                                       <1 RK_PC1 1 &pcfg_pull_up>;
                        };
                        spi3_cs0: spi3-cs0 {
                                rockchip,pins =
-                                       <1 RK_PC2 RK_FUNC_1 &pcfg_pull_up>;
+                                       <1 RK_PC2 1 &pcfg_pull_up>;
                        };
                        spi3_rx: spi3-rx {
                                rockchip,pins =
-                                       <1 RK_PB7 RK_FUNC_1 &pcfg_pull_up>;
+                                       <1 RK_PB7 1 &pcfg_pull_up>;
                        };
                        spi3_tx: spi3-tx {
                                rockchip,pins =
-                                       <1 RK_PC0 RK_FUNC_1 &pcfg_pull_up>;
+                                       <1 RK_PC0 1 &pcfg_pull_up>;
                        };
                };
 
                spi4 {
                        spi4_clk: spi4-clk {
                                rockchip,pins =
-                                       <3 RK_PA2 RK_FUNC_2 &pcfg_pull_up>;
+                                       <3 RK_PA2 2 &pcfg_pull_up>;
                        };
                        spi4_cs0: spi4-cs0 {
                                rockchip,pins =
-                                       <3 RK_PA3 RK_FUNC_2 &pcfg_pull_up>;
+                                       <3 RK_PA3 2 &pcfg_pull_up>;
                        };
                        spi4_rx: spi4-rx {
                                rockchip,pins =
-                                       <3 RK_PA0 RK_FUNC_2 &pcfg_pull_up>;
+                                       <3 RK_PA0 2 &pcfg_pull_up>;
                        };
                        spi4_tx: spi4-tx {
                                rockchip,pins =
-                                       <3 RK_PA1 RK_FUNC_2 &pcfg_pull_up>;
+                                       <3 RK_PA1 2 &pcfg_pull_up>;
                        };
                };
 
                spi5 {
                        spi5_clk: spi5-clk {
                                rockchip,pins =
-                                       <2 RK_PC6 RK_FUNC_2 &pcfg_pull_up>;
+                                       <2 RK_PC6 2 &pcfg_pull_up>;
                        };
                        spi5_cs0: spi5-cs0 {
                                rockchip,pins =
-                                       <2 RK_PC7 RK_FUNC_2 &pcfg_pull_up>;
+                                       <2 RK_PC7 2 &pcfg_pull_up>;
                        };
                        spi5_rx: spi5-rx {
                                rockchip,pins =
-                                       <2 RK_PC4 RK_FUNC_2 &pcfg_pull_up>;
+                                       <2 RK_PC4 2 &pcfg_pull_up>;
                        };
                        spi5_tx: spi5-tx {
                                rockchip,pins =
-                                       <2 RK_PC5 RK_FUNC_2 &pcfg_pull_up>;
+                                       <2 RK_PC5 2 &pcfg_pull_up>;
+                       };
+               };
+
+               testclk {
+                       test_clkout0: test-clkout0 {
+                               rockchip,pins =
+                                       <0 RK_PA0 1 &pcfg_pull_none>;
+                       };
+
+                       test_clkout1: test-clkout1 {
+                               rockchip,pins =
+                                       <2 RK_PD1 2 &pcfg_pull_none>;
+                       };
+
+                       test_clkout2: test-clkout2 {
+                               rockchip,pins =
+                                       <0 RK_PB0 3 &pcfg_pull_none>;
                        };
                };
 
                        };
 
                        otp_out: otp-out {
-                               rockchip,pins = <1 RK_PA6 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PA6 1 &pcfg_pull_none>;
                        };
                };
 
                uart0 {
                        uart0_xfer: uart0-xfer {
                                rockchip,pins =
-                                       <2 RK_PC0 RK_FUNC_1 &pcfg_pull_up>,
-                                       <2 RK_PC1 RK_FUNC_1 &pcfg_pull_none>;
+                                       <2 RK_PC0 1 &pcfg_pull_up>,
+                                       <2 RK_PC1 1 &pcfg_pull_none>;
                        };
 
                        uart0_cts: uart0-cts {
                                rockchip,pins =
-                                       <2 RK_PC2 RK_FUNC_1 &pcfg_pull_none>;
+                                       <2 RK_PC2 1 &pcfg_pull_none>;
                        };
 
                        uart0_rts: uart0-rts {
                                rockchip,pins =
-                                       <2 RK_PC3 RK_FUNC_1 &pcfg_pull_none>;
+                                       <2 RK_PC3 1 &pcfg_pull_none>;
                        };
                };
 
                uart1 {
                        uart1_xfer: uart1-xfer {
                                rockchip,pins =
-                                       <3 RK_PB4 RK_FUNC_2 &pcfg_pull_up>,
-                                       <3 RK_PB5 RK_FUNC_2 &pcfg_pull_none>;
+                                       <3 RK_PB4 2 &pcfg_pull_up>,
+                                       <3 RK_PB5 2 &pcfg_pull_none>;
                        };
                };
 
                uart2a {
                        uart2a_xfer: uart2a-xfer {
                                rockchip,pins =
-                                       <4 RK_PB0 RK_FUNC_2 &pcfg_pull_up>,
-                                       <4 RK_PB1 RK_FUNC_2 &pcfg_pull_none>;
+                                       <4 RK_PB0 2 &pcfg_pull_up>,
+                                       <4 RK_PB1 2 &pcfg_pull_none>;
                        };
                };
 
                uart2b {
                        uart2b_xfer: uart2b-xfer {
                                rockchip,pins =
-                                       <4 RK_PC0 RK_FUNC_2 &pcfg_pull_up>,
-                                       <4 RK_PC1 RK_FUNC_2 &pcfg_pull_none>;
+                                       <4 RK_PC0 2 &pcfg_pull_up>,
+                                       <4 RK_PC1 2 &pcfg_pull_none>;
                        };
                };
 
                uart2c {
                        uart2c_xfer: uart2c-xfer {
                                rockchip,pins =
-                                       <4 RK_PC3 RK_FUNC_1 &pcfg_pull_up>,
-                                       <4 RK_PC4 RK_FUNC_1 &pcfg_pull_none>;
+                                       <4 RK_PC3 1 &pcfg_pull_up>,
+                                       <4 RK_PC4 1 &pcfg_pull_none>;
                        };
                };
 
                uart3 {
                        uart3_xfer: uart3-xfer {
                                rockchip,pins =
-                                       <3 RK_PB6 RK_FUNC_2 &pcfg_pull_up>,
-                                       <3 RK_PB7 RK_FUNC_2 &pcfg_pull_none>;
+                                       <3 RK_PB6 2 &pcfg_pull_up>,
+                                       <3 RK_PB7 2 &pcfg_pull_none>;
                        };
 
                        uart3_cts: uart3-cts {
                                rockchip,pins =
-                                       <3 RK_PC2 RK_FUNC_2 &pcfg_pull_none>;
+                                       <3 RK_PC2 &pcfg_pull_none>;
                        };
 
                        uart3_rts: uart3-rts {
                                rockchip,pins =
-                                       <3 RK_PC3 RK_FUNC_2 &pcfg_pull_none>;
+                                       <3 RK_PC2 &pcfg_pull_none>;
                        };
                };
 
                uart4 {
                        uart4_xfer: uart4-xfer {
                                rockchip,pins =
-                                       <1 RK_PA7 RK_FUNC_1 &pcfg_pull_up>,
-                                       <1 RK_PB0 RK_FUNC_1 &pcfg_pull_none>;
+                                       <1 RK_PA7 1 &pcfg_pull_up>,
+                                       <1 RK_PB0 1 &pcfg_pull_none>;
                        };
                };
 
                uarthdcp {
                        uarthdcp_xfer: uarthdcp-xfer {
                                rockchip,pins =
-                                       <4 RK_PC5 RK_FUNC_2 &pcfg_pull_up>,
-                                       <4 RK_PC6 RK_FUNC_2 &pcfg_pull_none>;
+                                       <4 RK_PC5 2 &pcfg_pull_up>,
+                                       <4 RK_PC6 2 &pcfg_pull_none>;
                        };
                };
 
                pwm0 {
                        pwm0_pin: pwm0-pin {
                                rockchip,pins =
-                                       <4 RK_PC2 RK_FUNC_1 &pcfg_pull_none>;
+                                       <4 RK_PC2 1 &pcfg_pull_none>;
+                       };
+
+                       pwm0_pin_pull_down: pwm0-pin-pull-down {
+                               rockchip,pins =
+                                       <4 RK_PC2 1 &pcfg_pull_down>;
                        };
 
                        vop0_pwm_pin: vop0-pwm-pin {
                                rockchip,pins =
-                                       <4 RK_PC2 RK_FUNC_2 &pcfg_pull_none>;
+                                       <4 RK_PC2 2 &pcfg_pull_none>;
+                       };
+
+                       vop1_pwm_pin: vop1-pwm-pin {
+                               rockchip,pins =
+                                       <4 RK_PC2 3 &pcfg_pull_none>;
                        };
                };
 
                pwm1 {
                        pwm1_pin: pwm1-pin {
                                rockchip,pins =
-                                       <4 RK_PC6 RK_FUNC_1 &pcfg_pull_none>;
+                                       <4 RK_PC6 1 &pcfg_pull_none>;
                        };
 
-                       vop1_pwm_pin: vop1-pwm-pin {
+                       pwm1_pin_pull_down: pwm1-pin-pull-down {
                                rockchip,pins =
-                                       <4 RK_PC2 RK_FUNC_3 &pcfg_pull_none>;
+                                       <4 RK_PC6 1 &pcfg_pull_down>;
                        };
                };
 
                pwm2 {
                        pwm2_pin: pwm2-pin {
                                rockchip,pins =
-                                       <1 RK_PC3 RK_FUNC_1 &pcfg_pull_none>;
+                                       <1 RK_PC3 1 &pcfg_pull_none>;
                        };
 
                        pwm2_pin_pull_down: pwm2-pin-pull-down {
                                rockchip,pins =
-                                       <1 RK_PC3 RK_FUNC_1 &pcfg_pull_down>;
+                                       <1 RK_PC3 1 &pcfg_pull_down>;
                        };
                };
 
                pwm3a {
                        pwm3a_pin: pwm3a-pin {
                                rockchip,pins =
-                                       <0 RK_PA6 RK_FUNC_1 &pcfg_pull_none>;
+                                       <0 RK_PA6 1 &pcfg_pull_none>;
                        };
                };
 
                pwm3b {
                        pwm3b_pin: pwm3b-pin {
                                rockchip,pins =
-                                       <1 RK_PB6 RK_FUNC_1 &pcfg_pull_none>;
+                                       <1 RK_PB6 1 &pcfg_pull_none>;
                        };
                };
 
                hdmi {
                        hdmi_i2c_xfer: hdmi-i2c-xfer {
                                rockchip,pins =
-                                       <4 RK_PC1 RK_FUNC_3 &pcfg_pull_none>,
-                                       <4 RK_PC0 RK_FUNC_3 &pcfg_pull_none>;
+                                       <4 RK_PC1 3 &pcfg_pull_none>,
+                                       <4 RK_PC0 3 &pcfg_pull_none>;
                        };
 
                        hdmi_cec: hdmi-cec {
                                rockchip,pins =
-                                       <4 RK_PC7 RK_FUNC_1 &pcfg_pull_none>;
+                                       <4 RK_PC7 1 &pcfg_pull_none>;
                        };
                };
 
                pcie {
-                       pcie_clkreqn: pci-clkreqn {
-                               rockchip,pins =
-                                       <2 RK_PD2 RK_FUNC_2 &pcfg_pull_none>;
-                       };
-
-                       pcie_clkreqnb: pci-clkreqnb {
-                               rockchip,pins =
-                                       <4 RK_PD0 RK_FUNC_1 &pcfg_pull_none>;
-                       };
-
                        pcie_clkreqn_cpm: pci-clkreqn-cpm {
                                rockchip,pins =
                                        <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
index 5ade63665ab03c43f147cc8662224327b6161403..b52565473d59aab6699b98e0ae9040b90f326fd6 100644 (file)
@@ -26,6 +26,8 @@
 #define MXC_CPU_MX7S           0x71 /* dummy ID */
 #define MXC_CPU_MX7D           0x72
 #define MXC_CPU_IMX8MQ         0x82
+#define MXC_CPU_IMX8MD         0x83 /* dummy ID */
+#define MXC_CPU_IMX8MQL     0x84 /* dummy ID */
 #define MXC_CPU_IMX8MM         0x85 /* dummy ID */
 #define MXC_CPU_IMX8MML                0x86 /* dummy ID */
 #define MXC_CPU_IMX8MMD                0x87 /* dummy ID */
 #define MXC_CPU_IMX8MMS                0x89 /* dummy ID */
 #define MXC_CPU_IMX8MMSL       0x8a /* dummy ID */
 #define MXC_CPU_IMX8MN         0x8b /* dummy ID */
+#define MXC_CPU_IMX8MND                0x8c /* dummy ID */
+#define MXC_CPU_IMX8MNS                0x8d /* dummy ID */
+#define MXC_CPU_IMX8MNL                0x8e /* dummy ID */
+#define MXC_CPU_IMX8MNDL               0x8f /* dummy ID */
+#define MXC_CPU_IMX8MNSL               0x181 /* dummy ID */
 #define MXC_CPU_IMX8MP         0x182/* dummy ID */
 #define MXC_CPU_IMX8QXP_A0     0x90 /* dummy ID */
 #define MXC_CPU_IMX8QM         0x91 /* dummy ID */
index 8e1e9bbf4375c6739b67627a10ee4b923371a9e7..c1a9c353ba0fc62cb07b9c7d273fa93592457e7b 100644 (file)
@@ -8,6 +8,11 @@
 #define SC_RPC_H
 
 /* Note: Check SCFW API Released DOC before you want to modify something */
+/* Defines */
+
+#define SCFW_API_VERSION_MAJOR  1U
+#define SCFW_API_VERSION_MINOR  15U
+
 #define SC_RPC_VERSION          1U
 
 #define SC_RPC_MAX_MSG          8U
 #define RPC_SVC(MSG)            ((MSG)->svc)
 #define RPC_FUNC(MSG)           ((MSG)->func)
 #define RPC_R8(MSG)             ((MSG)->func)
+#define RPC_I64(MSG, IDX)       ((s64)(RPC_U32((MSG), (IDX))) << 32ULL) | \
+                                 (s64)(RPC_U32((MSG), (IDX) + 4U))
 #define RPC_I32(MSG, IDX)       ((MSG)->DATA.i32[(IDX) / 4U])
 #define RPC_I16(MSG, IDX)       ((MSG)->DATA.i16[(IDX) / 2U])
 #define RPC_I8(MSG, IDX)        ((MSG)->DATA.i8[(IDX)])
+#define RPC_U64(MSG, IDX)       ((u64)(RPC_U32((MSG), (IDX))) << 32ULL) | \
+                                 (u64)(RPC_U32((MSG), (IDX) + 4U))
 #define RPC_U32(MSG, IDX)       ((MSG)->DATA.u32[(IDX) / 4U])
 #define RPC_U16(MSG, IDX)       ((MSG)->DATA.u16[(IDX) / 2U])
 #define RPC_U8(MSG, IDX)        ((MSG)->DATA.u8[(IDX)])
@@ -76,6 +85,8 @@ struct sc_rpc_msg_s {
 #define PM_FUNC_REBOOT                         9U
 #define PM_FUNC_REBOOT_PARTITION               12U
 #define PM_FUNC_CPU_START                      11U
+#define PM_FUNC_CPU_RESET                      23U
+#define PM_FUNC_RESOURCE_RESET                 29U
 #define PM_FUNC_IS_PARTITION_STARTED 24U
 
 /* MISC RPC */
@@ -160,26 +171,59 @@ struct sc_rpc_msg_s {
 #define RM_FUNC_DUMP                           27U
 
 /* SECO RPC */
-#define SECO_FUNC_UNKNOWN                      0
-#define SECO_FUNC_IMAGE_LOAD                   1U
-#define SECO_FUNC_AUTHENTICATE                 2U
-#define SECO_FUNC_FORWARD_LIFECYCLE            3U
-#define SECO_FUNC_RETURN_LIFECYCLE             4U
-#define SECO_FUNC_COMMIT                       5U
-#define SECO_FUNC_ATTEST_MODE                  6U
-#define SECO_FUNC_ATTEST                       7U
-#define SECO_FUNC_GET_ATTEST_PKEY              8U
-#define SECO_FUNC_GET_ATTEST_SIGN              9U
-#define SECO_FUNC_ATTEST_VERIFY                        10U
-#define SECO_FUNC_GEN_KEY_BLOB                 11U
-#define SECO_FUNC_LOAD_KEY                     12U
-#define SECO_FUNC_GET_MP_KEY                   13U
-#define SECO_FUNC_UPDATE_MPMR                  14U
-#define SECO_FUNC_GET_MP_SIGN                  15U
-#define SECO_FUNC_BUILD_INFO                   16U
-#define SECO_FUNC_CHIP_INFO                    17U
-#define SECO_FUNC_ENABLE_DEBUG                 18U
-#define SECO_FUNC_GET_EVENT                    19U
-#define SECO_FUNC_FUSE_WRITE                   20U
+#define SECO_FUNC_UNKNOWN 0 /* Unknown function */
+#define SECO_FUNC_IMAGE_LOAD 1U /* Index for seco_image_load() RPC call */
+#define SECO_FUNC_AUTHENTICATE 2U /* Index for seco_authenticate() RPC call */
+#define SECO_FUNC_ENH_AUTHENTICATE 24U /* Index for sc_seco_enh_authenticate() RPC call */
+#define SECO_FUNC_FORWARD_LIFECYCLE 3U /* Index for seco_forward_lifecycle() RPC call */
+#define SECO_FUNC_RETURN_LIFECYCLE 4U /* Index for seco_return_lifecycle() RPC call */
+#define SECO_FUNC_COMMIT 5U /* Index for seco_commit() RPC call */
+#define SECO_FUNC_ATTEST_MODE 6U /* Index for seco_attest_mode() RPC call */
+#define SECO_FUNC_ATTEST 7U /* Index for seco_attest() RPC call */
+#define SECO_FUNC_GET_ATTEST_PKEY 8U /* Index for seco_get_attest_pkey() RPC call */
+#define SECO_FUNC_GET_ATTEST_SIGN 9U /* Index for seco_get_attest_sign() RPC call */
+#define SECO_FUNC_ATTEST_VERIFY 10U /* Index for seco_attest_verify() RPC call */
+#define SECO_FUNC_GEN_KEY_BLOB 11U /* Index for seco_gen_key_blob() RPC call */
+#define SECO_FUNC_LOAD_KEY 12U /* Index for seco_load_key() RPC call */
+#define SECO_FUNC_GET_MP_KEY 13U /* Index for seco_get_mp_key() RPC call */
+#define SECO_FUNC_UPDATE_MPMR 14U /* Index for seco_update_mpmr() RPC call */
+#define SECO_FUNC_GET_MP_SIGN 15U /* Index for seco_get_mp_sign() RPC call */
+#define SECO_FUNC_BUILD_INFO 16U /* Index for seco_build_info() RPC call */
+#define SECO_FUNC_CHIP_INFO 17U /* Index for seco_chip_info() RPC call */
+#define SECO_FUNC_ENABLE_DEBUG 18U /* Index for seco_enable_debug() RPC call */
+#define SECO_FUNC_GET_EVENT 19U /* Index for seco_get_event() RPC call */
+#define SECO_FUNC_FUSE_WRITE 20U /* Index for seco_fuse_write() RPC call */
+#define SECO_FUNC_PATCH 21U /* Index for sc_seco_patch() RPC call */
+#define SECO_FUNC_START_RNG 22U /* Index for sc_seco_start_rng() RPC call */
+#define SECO_FUNC_SAB_MSG 23U /* Index for sc_seco_sab_msg() RPC call */
+#define SECO_FUNC_SECVIO_ENABLE 25U /* Index for sc_seco_secvio_enable() RPC call */
+#define SECO_FUNC_SECVIO_CONFIG 26U /* Index for sc_seco_secvio_config() RPC call */
+#define SECO_FUNC_SECVIO_DGO_CONFIG 27U /* Index for sc_seco_secvio_dgo_config() RPC call */
+
+/* IRQ RPC */
+#define IRQ_FUNC_UNKNOWN 0 /* Unknown function */
+#define IRQ_FUNC_ENABLE 1U /* Index for sc_irq_enable() RPC call */
+#define IRQ_FUNC_STATUS 2U /* Index for sc_irq_status() RPC call */
+
+/* TIMER RPC */
+#define TIMER_FUNC_UNKNOWN 0 /* Unknown function */
+#define TIMER_FUNC_SET_WDOG_TIMEOUT 1U /* Index for sc_timer_set_wdog_timeout() RPC call */
+#define TIMER_FUNC_SET_WDOG_PRE_TIMEOUT 12U /* Index for sc_timer_set_wdog_pre_timeout() RPC call */
+#define TIMER_FUNC_START_WDOG 2U /* Index for sc_timer_start_wdog() RPC call */
+#define TIMER_FUNC_STOP_WDOG 3U /* Index for sc_timer_stop_wdog() RPC call */
+#define TIMER_FUNC_PING_WDOG 4U /* Index for sc_timer_ping_wdog() RPC call */
+#define TIMER_FUNC_GET_WDOG_STATUS 5U /* Index for sc_timer_get_wdog_status() RPC call */
+#define TIMER_FUNC_PT_GET_WDOG_STATUS 13U /* Index for sc_timer_pt_get_wdog_status() RPC call */
+#define TIMER_FUNC_SET_WDOG_ACTION 10U /* Index for sc_timer_set_wdog_action() RPC call */
+#define TIMER_FUNC_SET_RTC_TIME 6U /* Index for sc_timer_set_rtc_time() RPC call */
+#define TIMER_FUNC_GET_RTC_TIME 7U /* Index for sc_timer_get_rtc_time() RPC call */
+#define TIMER_FUNC_GET_RTC_SEC1970 9U /* Index for sc_timer_get_rtc_sec1970() RPC call */
+#define TIMER_FUNC_SET_RTC_ALARM 8U /* Index for sc_timer_set_rtc_alarm() RPC call */
+#define TIMER_FUNC_SET_RTC_PERIODIC_ALARM 14U /* Index for sc_timer_set_rtc_periodic_alarm() RPC call */
+#define TIMER_FUNC_CANCEL_RTC_ALARM 15U /* Index for sc_timer_cancel_rtc_alarm() RPC call */
+#define TIMER_FUNC_SET_RTC_CALB 11U /* Index for sc_timer_set_rtc_calb() RPC call */
+#define TIMER_FUNC_SET_SYSCTR_ALARM 16U /* Index for sc_timer_set_sysctr_alarm() RPC call */
+#define TIMER_FUNC_SET_SYSCTR_PERIODIC_ALARM 17U /* Index for sc_timer_set_sysctr_periodic_alarm() RPC call */
+#define TIMER_FUNC_CANCEL_SYSCTR_ALARM 18U /* Index for sc_timer_cancel_sysctr_alarm() RPC call */
 
 #endif /* SC_RPC_H */
index 14ee6f999bacec50d386e672051fe3407356d8fa..05f736f14f0f1babae863482302736fc609cb5d2 100644 (file)
@@ -72,6 +72,7 @@ int sc_pm_set_clock_parent(sc_ipc_t ipc, sc_rsrc_t resource, sc_pm_clk_t clk,
 int sc_pm_cpu_start(sc_ipc_t ipc, sc_rsrc_t resource, sc_bool_t enable,
                    sc_faddr_t address);
 sc_bool_t sc_pm_is_partition_started(sc_ipc_t ipc, sc_rm_pt_t pt);
+int sc_pm_resource_reset(sc_ipc_t ipc, sc_rsrc_t resource);
 
 /* MISC API */
 int sc_misc_set_control(sc_ipc_t ipc, sc_rsrc_t resource,
@@ -108,6 +109,7 @@ int sc_rm_get_resource_owner(sc_ipc_t ipc, sc_rsrc_t resource,
 
 /* PAD API */
 int sc_pad_set(sc_ipc_t ipc, sc_pad_t pad, u32 val);
+int sc_pad_get(sc_ipc_t ipc, sc_pad_t pad, uint32_t *val);
 
 /* SMMU API */
 int sc_rm_set_master_sid(sc_ipc_t ipc, sc_rsrc_t resource, sc_rm_sid_t sid);
@@ -122,5 +124,13 @@ void sc_seco_build_info(sc_ipc_t ipc, u32 *version, u32 *commit);
 int sc_seco_get_event(sc_ipc_t ipc, u8 idx, u32 *event);
 int sc_seco_gen_key_blob(sc_ipc_t ipc, u32 id, sc_faddr_t load_addr,
                         sc_faddr_t export_addr, u16 max_size);
+int sc_seco_get_mp_key(sc_ipc_t ipc, sc_faddr_t dst_addr, u16 dst_size);
+int sc_seco_update_mpmr(sc_ipc_t ipc, sc_faddr_t addr, u8 size, u8 lock);
+int sc_seco_get_mp_sign(sc_ipc_t ipc, sc_faddr_t msg_addr,
+                       u16 msg_size, sc_faddr_t dst_addr, u16 dst_size);
+int sc_seco_secvio_dgo_config(sc_ipc_t ipc, u8 id, u8 access, u32 *data);
+int sc_seco_secvio_config(sc_ipc_t ipc, u8 id, u8 access,
+                         u32 *data0, u32 *data1, u32 *data2, u32 *data3,
+                         u32 *data4, u8 size);
 
 #endif
index 905c56834e1e59dcaf1fc8ffc7fb3a7e0d06720f..df368e8c8b57753a053c550bbac7313234198a2f 100644 (file)
@@ -6,6 +6,9 @@
 #ifndef SC_PAD_API_H
 #define SC_PAD_API_H
 
+/* Defines for type widths */
+#define SC_PAD_MUX_W            3U    /* Width of mux parameter */
+
 /* Defines for sc_pad_config_t */
 #define SC_PAD_CONFIG_NORMAL   0U      /* Normal */
 #define SC_PAD_CONFIG_OD       1U      /* Open Drain */
index 9eadc885923278776daab9db4afd1f8c12ba46d9..adfed13e330f30103867fbd47713ce15a21883ea 100644 (file)
@@ -32,6 +32,7 @@ typedef u64 sc_ipc_t;
 #define SC_83MHZ         83333333U   /* 83MHz */
 #define SC_84MHZ         84375000U   /* 84.37MHz */
 #define SC_100MHZ       100000000U   /* 100MHz */
+#define SC_114MHZ       114000000U   /* 114MHz */
 #define SC_125MHZ       125000000U   /* 125MHz */
 #define SC_133MHZ       133333333U   /* 133MHz */
 #define SC_135MHZ       135000000U   /* 135MHz */
@@ -52,6 +53,7 @@ typedef u64 sc_ipc_t;
 #define SC_372MHZ       372000000U   /* 372MHz */
 #define SC_375MHZ       375000000U   /* 375MHz */
 #define SC_400MHZ       400000000U   /* 400MHz */
+#define SC_465MHZ       465000000U   /* 465MHz */
 #define SC_500MHZ       500000000U   /* 500MHz */
 #define SC_594MHZ       594000000U   /* 594MHz */
 #define SC_625MHZ       625000000U   /* 625MHz */
@@ -75,6 +77,7 @@ typedef u64 sc_ipc_t;
 #define SC_1500MHZ     1500000000U   /* 1.5GHz */
 #define SC_1600MHZ     1600000000U   /* 1.6GHz */
 #define SC_1800MHZ     1800000000U   /* 1.8GHz */
+#define SC_1860MHZ     1860000000U   /* 1.86GHz */
 #define SC_2000MHZ     2000000000U   /* 2.0GHz */
 #define SC_2112MHZ     2112000000U   /* 2.12GHz */
 
@@ -89,6 +92,7 @@ typedef u64 sc_ipc_t;
 #define SC_144MHZ       144000000U   /* 144MHz */
 #define SC_192MHZ       192000000U   /* 192MHz */
 #define SC_211MHZ       211200000U   /* 211.2MHz */
+#define SC_228MHZ       228000000U   /* 233MHz */
 #define SC_240MHZ       240000000U   /* 240MHz */
 #define SC_264MHZ       264000000U   /* 264MHz */
 #define SC_352MHZ       352000000U   /* 352MHz */
@@ -96,11 +100,13 @@ typedef u64 sc_ipc_t;
 #define SC_384MHZ       384000000U   /* 384MHz */
 #define SC_396MHZ       396000000U   /* 396MHz */
 #define SC_432MHZ       432000000U   /* 432MHz */
+#define SC_456MHZ       456000000U   /* 466MHz */
 #define SC_480MHZ       480000000U   /* 480MHz */
 #define SC_600MHZ       600000000U   /* 600MHz */
 #define SC_744MHZ       744000000U   /* 744MHz */
 #define SC_792MHZ       792000000U   /* 792MHz */
 #define SC_864MHZ       864000000U   /* 864MHz */
+#define SC_912MHZ       912000000U   /* 912MHz */
 #define SC_960MHZ       960000000U   /* 960MHz */
 #define SC_1056MHZ     1056000000U   /* 1056MHz */
 #define SC_1104MHZ     1104000000U   /* 1104MHz */
diff --git a/arch/arm/include/asm/arch-imx8/snvs_security_sc.h b/arch/arm/include/asm/arch-imx8/snvs_security_sc.h
new file mode 100644 (file)
index 0000000..0b7ded7
--- /dev/null
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2018 NXP
+ */
+
+#ifndef _SNVS_SECURITY_SC_H
+#define _SNVS_SECURITY_SC_H
+
+int snvs_security_sc_init(void);
+
+#endif /* _SNVS_SECURITY_SC_H */
index debed6bac7c08b7ee4f7596b5fec2e743ad3d7fb..140e8bbabd7b7252cd00884f75c381e6aad5bea7 100644 (file)
@@ -19,7 +19,7 @@
 
 #define LOCK_STATUS    BIT(31)
 #define LOCK_SEL_MASK  BIT(29)
-#define CLKE_MASK      BIT(11)
+#define CLKE_MASK      BIT(13)
 #define RST_MASK       BIT(9)
 #define BYPASS_MASK    BIT(4)
 #define        MDIV_SHIFT      12
@@ -363,7 +363,8 @@ enum clk_root_src {
        EXT_CLK_2,
        EXT_CLK_3,
        EXT_CLK_4,
-       OSC_HDMI_CLK
+       OSC_HDMI_CLK,
+       ARM_A53_ALT_CLK,
 };
 
 enum clk_ccgr_index {
index 38a6f5966b684d60adf5ea9bb55a99b8ae66e473..9dda6ddc8cdf877852de15e78e3952aceccece05 100644 (file)
@@ -153,6 +153,7 @@ enum clk_root_src {
        EXT_CLK_3,
        EXT_CLK_4,
        OSC_27M_CLK,
+       ARM_A53_ALT_CLK,
 };
 
 /* CCGR index */
@@ -419,7 +420,7 @@ enum clk_src_index {
 
 enum frac_pll_out_val {
        FRAC_PLL_OUT_1000M,
-       FRAC_PLL_OUT_1600M,
+       FRAC_PLL_OUT_800M,
 };
 
 void init_nand_clk(void);
index 35b39b1f86c05c8618a81c004575a7ebbe8ce13c..2a997f280d7de37854aeb54c4edd722b2e9d9ff9 100644 (file)
@@ -16,7 +16,7 @@
 #define is_soc_rev(rev) (soc_rev() == rev)
 
 /* returns MXC_CPU_ value */
-#define cpu_type(rev) (((rev) >> 12) & 0xff)
+#define cpu_type(rev) (((rev) >> 12) & 0x1ff)
 #define soc_type(rev) (((rev) >> 12) & 0xf0)
 /* both macros return/take MXC_CPU_ constants */
 #define get_cpu_type() (cpu_type(get_cpu_rev()))
 #define is_mx6sl() (is_cpu_type(MXC_CPU_MX6SL))
 #define is_mx6solo() (is_cpu_type(MXC_CPU_MX6SOLO))
 #define is_mx6ul() (is_cpu_type(MXC_CPU_MX6UL))
-#define is_mx6ull() (is_cpu_type(MXC_CPU_MX6ULL))
+#define is_mx6ull() (is_cpu_type(MXC_CPU_MX6ULL) || is_cpu_type(MXC_CPU_MX6ULZ))
 #define is_mx6ulz() (is_cpu_type(MXC_CPU_MX6ULZ))
 #define is_mx6sll() (is_cpu_type(MXC_CPU_MX6SLL))
 
 #define is_mx7ulp() (is_cpu_type(MXC_CPU_MX7ULP))
 
-#define is_imx8mq() (is_cpu_type(MXC_CPU_IMX8MQ))
+#define is_imx8mq() (is_cpu_type(MXC_CPU_IMX8MQ) || is_cpu_type(MXC_CPU_IMX8MD) || is_cpu_type(MXC_CPU_IMX8MQL))
+#define is_imx8md() (is_cpu_type(MXC_CPU_IMX8MD))
+#define is_imx8mql() (is_cpu_type(MXC_CPU_IMX8MQL))
 #define is_imx8qm() (is_cpu_type(MXC_CPU_IMX8QM))
 #define is_imx8mm() (is_cpu_type(MXC_CPU_IMX8MM) || is_cpu_type(MXC_CPU_IMX8MML) ||\
        is_cpu_type(MXC_CPU_IMX8MMD) || is_cpu_type(MXC_CPU_IMX8MMDL) || \
 #define is_imx8mmdl() (is_cpu_type(MXC_CPU_IMX8MMDL))
 #define is_imx8mms() (is_cpu_type(MXC_CPU_IMX8MMS))
 #define is_imx8mmsl() (is_cpu_type(MXC_CPU_IMX8MMSL))
-#define is_imx8mn() (is_cpu_type(MXC_CPU_IMX8MN))
+#define is_imx8mn() (is_cpu_type(MXC_CPU_IMX8MN) || is_cpu_type(MXC_CPU_IMX8MND) || \
+       is_cpu_type(MXC_CPU_IMX8MNS) || is_cpu_type(MXC_CPU_IMX8MNL) || \
+       is_cpu_type(MXC_CPU_IMX8MNDL) || is_cpu_type(MXC_CPU_IMX8MNSL))
+#define is_imx8mnd() (is_cpu_type(MXC_CPU_IMX8MND))
+#define is_imx8mns() (is_cpu_type(MXC_CPU_IMX8MNS))
+#define is_imx8mnl() (is_cpu_type(MXC_CPU_IMX8MNL))
+#define is_imx8mndl() (is_cpu_type(MXC_CPU_IMX8MNDL))
+#define is_imx8mnsl() (is_cpu_type(MXC_CPU_IMX8MNSL))
 #define is_imx8mp() (is_cpu_type(MXC_CPU_IMX8MP))
 
 #define is_imx8qxp() (is_cpu_type(MXC_CPU_IMX8QXP))
index 8482f5446c5c3d64f9b7fa8b50c3ce556958d674..b839aa7a50967b622c6a126db02c274fbb460b22 100644 (file)
@@ -57,7 +57,7 @@ obj-y += interrupts_64.o
 else
 obj-y  += interrupts.o
 endif
-ifndef CONFIG_SYSRESET
+ifndef CONFIG_$(SPL_TPL_)SYSRESET
 obj-y  += reset.o
 endif
 
index bfa85c64c6afb68c295752a1373f4ac142e73bfb..e83f6934cd2a43f2bd04f4eb34f944ba8fcf7ede 100644 (file)
@@ -95,7 +95,17 @@ const char *get_imx_type(u32 imxtype)
        case MXC_CPU_IMX8MP:
                return "8MP";   /* Quad-core version of the imx8mp */
        case MXC_CPU_IMX8MN:
-               return "8MNano";/* Quad-core version of the imx8mn */
+               return "8MNano Quad"; /* Quad-core version */
+       case MXC_CPU_IMX8MND:
+               return "8MNano Dual"; /* Dual-core version */
+       case MXC_CPU_IMX8MNS:
+               return "8MNano Solo"; /* Single-core version */
+       case MXC_CPU_IMX8MNL:
+               return "8MNano QuadLite"; /* Quad-core Lite version */
+       case MXC_CPU_IMX8MNDL:
+               return "8MNano DualLite"; /* Dual-core Lite version */
+       case MXC_CPU_IMX8MNSL:
+               return "8MNano SoloLite"; /* Single-core Lite version */
        case MXC_CPU_IMX8MM:
                return "8MMQ";  /* Quad-core version of the imx8mm */
        case MXC_CPU_IMX8MML:
@@ -109,7 +119,11 @@ const char *get_imx_type(u32 imxtype)
        case MXC_CPU_IMX8MMSL:
                return "8MMSL"; /* Single-core Lite version of the imx8mm */
        case MXC_CPU_IMX8MQ:
-               return "8MQ";   /* Quad-core version of the imx8m */
+               return "8MQ";   /* Quad-core version of the imx8mq */
+       case MXC_CPU_IMX8MQL:
+               return "8MQLite";       /* Quad-core Lite version of the imx8mq */
+       case MXC_CPU_IMX8MD:
+               return "8MD";   /* Dual-core version of the imx8mq */
        case MXC_CPU_MX7S:
                return "7S";    /* Single-core version of the mx7 */
        case MXC_CPU_MX7D:
@@ -314,6 +328,7 @@ enum cpu_speed {
        OCOTP_TESTER3_SPEED_GRADE1,
        OCOTP_TESTER3_SPEED_GRADE2,
        OCOTP_TESTER3_SPEED_GRADE3,
+       OCOTP_TESTER3_SPEED_GRADE4,
 };
 
 u32 get_cpu_speed_grade_hz(void)
@@ -326,17 +341,28 @@ u32 get_cpu_speed_grade_hz(void)
 
        val = readl(&fuse->tester3);
        val >>= OCOTP_TESTER3_SPEED_SHIFT;
-       val &= 0x3;
+
+       if (is_imx8mn() || is_imx8mp()) {
+               val &= 0xf;
+               return 2300000000 - val * 100000000;
+       }
+
+       if (is_imx8mm())
+               val &= 0x7;
+       else
+               val &= 0x3;
 
        switch(val) {
        case OCOTP_TESTER3_SPEED_GRADE0:
                return 800000000;
        case OCOTP_TESTER3_SPEED_GRADE1:
-               return is_mx7() ? 500000000 : 1000000000;
+               return (is_mx7() ? 500000000 : (is_imx8mq() ? 1000000000 : 1200000000));
        case OCOTP_TESTER3_SPEED_GRADE2:
-               return is_mx7() ? 1000000000 : 1300000000;
+               return (is_mx7() ? 1000000000 : (is_imx8mq() ? 1300000000 : 1600000000));
        case OCOTP_TESTER3_SPEED_GRADE3:
-               return is_mx7() ? 1200000000 : 1500000000;
+               return (is_mx7() ? 1200000000 : (is_imx8mq() ? 1500000000 : 1800000000));
+       case OCOTP_TESTER3_SPEED_GRADE4:
+               return 2000000000;
        }
 
        return 0;
index 5827ab334f6f446af8edfb66f25f9defa773017e..1f8add015f4eb752470173430327207240130433 100644 (file)
@@ -90,4 +90,17 @@ source "board/toradex/apalis-imx8/Kconfig"
 source "board/toradex/colibri-imx8x/Kconfig"
 source "board/siemens/capricorn/Kconfig"
 
+config IMX_SNVS_SEC_SC
+       bool "Support SNVS configuration"
+       help
+         Allow to configure the SNVS via SCU API to configure tampers and secure
+         violation.
+
+config IMX_SNVS_SEC_SC_AUTO
+       bool "Support SNVS configuration command"
+       depends on IMX_SNVS_SEC_SC
+       help
+         This configuration will apply the selected configurations automatically
+         at boot.
+
 endif
index 7ffb7e95b2512ef8278a10beeee3a4b4e03dd990..bbb41adbe43c54503c956eb992d87ae12a5d130a 100644 (file)
@@ -11,3 +11,4 @@ obj-$(CONFIG_AHAB_BOOT) += ahab.o
 ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_SPL_LOAD_IMX_CONTAINER) += image.o parse-container.o
 endif
+obj-$(CONFIG_IMX_SNVS_SEC_SC) += snvs_security_sc.o
index cf3c7d762a74c3946ec8c74f459ce18a0144dc00..6d25abe5cec88b49ac269624d11580afe7f5a85b 100644 (file)
@@ -75,7 +75,7 @@ int authenticate_os_container(ulong addr)
        memcpy((void *)SEC_SECURE_RAM_BASE, (const void *)addr,
               ALIGN(length, CONFIG_SYS_CACHELINE_SIZE));
 
-       err = sc_seco_authenticate(-1, SC_MISC_AUTH_CONTAINER,
+       err = sc_seco_authenticate(-1, SC_SECO_AUTH_CONTAINER,
                                   SECO_LOCAL_SEC_SEC_SECURE_RAM_BASE);
        if (err) {
                printf("Authenticate container hdr failed, return %d\n",
@@ -90,22 +90,21 @@ int authenticate_os_container(ulong addr)
                                            sizeof(struct container_hdr) +
                                            i * sizeof(struct boot_img_t));
 
-               debug("img %d, dst 0x%llx, src 0x%lx, size 0x%x\n",
-                     i, img->dst, img->offset + addr, img->size);
+               debug("img %d, dst 0x%x, src 0x%x, size 0x%x\n",
+                     i, (uint32_t) img->dst, img->offset + addr, img->size);
 
                memcpy((void *)img->dst, (const void *)(img->offset + addr),
                       img->size);
 
                s = img->dst & ~(CONFIG_SYS_CACHELINE_SIZE - 1);
-               e = ALIGN(img->dst + img->size, CONFIG_SYS_CACHELINE_SIZE);
+               e = ALIGN(img->dst + img->size, CONFIG_SYS_CACHELINE_SIZE) - 1;
 
                flush_dcache_range(s, e);
 
                /* Find the memreg and set permission for seco pt */
                err = sc_rm_find_memreg(-1, &mr, s, e);
                if (err) {
-                       printf("Not found memreg for image: %d, error %d\n",
-                              i, err);
+                       printf("Error: can't find memreg for image load address 0x%x, error %d\n", img->dst, err);
                        ret = -ENOMEM;
                        goto exit;
                }
@@ -123,7 +122,7 @@ int authenticate_os_container(ulong addr)
                        goto exit;
                }
 
-               err = sc_seco_authenticate(-1, SC_MISC_VERIFY_IMAGE,
+               err = sc_seco_authenticate(-1, SC_SECO_VERIFY_IMAGE,
                                           (1 << i));
                if (err) {
                        printf("Authenticate img %d failed, return %d\n",
@@ -144,7 +143,7 @@ int authenticate_os_container(ulong addr)
        }
 
 exit:
-       if (sc_seco_authenticate(-1, SC_MISC_REL_CONTAINER, 0) != SC_ERR_NONE)
+       if (sc_seco_authenticate(-1, SC_SECO_REL_CONTAINER, 0) != SC_ERR_NONE)
                printf("Error: release container failed!\n");
 
        return ret;
index 00fe4670bbc10a28b1625e284493fb9ff00dbb36..76d6571d8bfa760811939d05e0f85f94171411d7 100644 (file)
@@ -2,6 +2,7 @@
 #include <common.h>
 #include <asm/arch/sci/sci.h>
 #include <asm/mach-imx/sys_proto.h>
+#include <imx_sip.h>
 
 int sc_pm_setup_uart(sc_rsrc_t uart_rsrc, sc_pm_clock_rate_t clk_rate)
 {
@@ -26,9 +27,6 @@ int sc_pm_setup_uart(sc_rsrc_t uart_rsrc, sc_pm_clock_rate_t clk_rate)
        return 0;
 }
 
-#define FSL_SIP_BUILDINFO                      0xC2000003
-#define FSL_SIP_BUILDINFO_GET_COMMITHASH       0x00
-
 void build_info(void)
 {
        u32 seco_build = 0, seco_commit = 0;
@@ -51,8 +49,8 @@ void build_info(void)
        }
 
        /* Get ARM Trusted Firmware commit id */
-       atf_commit = call_imx_sip(FSL_SIP_BUILDINFO,
-                                 FSL_SIP_BUILDINFO_GET_COMMITHASH, 0, 0, 0);
+       atf_commit = call_imx_sip(IMX_SIP_BUILDINFO,
+                                 IMX_SIP_BUILDINFO_GET_COMMITHASH, 0, 0, 0);
        if (atf_commit == 0xffffffff) {
                debug("ATF does not support build info\n");
                atf_commit = 0x30; /* Display 0 */
index b57e68e412495428358eae1105e9dbe6125cd1dc..cc8a51ad5545b0e3463fb02a4419080beb146ebf 100644 (file)
@@ -23,23 +23,23 @@ static int authenticate_image(struct boot_img_t *img, int image_index)
        int err;
        int ret = 0;
 
-       debug("img %d, dst 0x%llx, src 0x%x, size 0x%x\n",
-             image_index, img->dst, img->offset, img->size);
+       debug("img %d, dst 0x%x, src 0x%x, size 0x%x\n",
+             image_index, (uint32_t)img->dst, img->offset, img->size);
 
        /* Find the memreg and set permission for seco pt */
        err = sc_rm_find_memreg(-1, &mr,
                                img->dst & ~(CONFIG_SYS_CACHELINE_SIZE - 1),
-                               ALIGN(img->dst + img->size, CONFIG_SYS_CACHELINE_SIZE));
+                               ALIGN(img->dst + img->size, CONFIG_SYS_CACHELINE_SIZE) - 1);
 
        if (err) {
-               printf("can't find memreg for image: %d, err %d\n",
-                      image_index, err);
+               printf("can't find memreg for image %d load address 0x%x, error %d\n",
+                      image_index, img->dst & ~(CONFIG_SYS_CACHELINE_SIZE - 1), err);
                return -ENOMEM;
        }
 
        err = sc_rm_get_memreg_info(-1, mr, &start, &end);
        if (!err)
-               debug("memreg %u 0x%llx -- 0x%llx\n", mr, start, end);
+               debug("memreg %u 0x%x -- 0x%x\n", mr, start, end);
 
        err = sc_rm_set_memreg_permissions(-1, mr,
                                           SECO_PT, SC_RM_PERM_FULL);
@@ -49,7 +49,7 @@ static int authenticate_image(struct boot_img_t *img, int image_index)
                return -EPERM;
        }
 
-       err = sc_seco_authenticate(-1, SC_MISC_VERIFY_IMAGE,
+       err = sc_seco_authenticate(-1, SC_SECO_VERIFY_IMAGE,
                                   1 << image_index);
        if (err) {
                printf("authenticate img %d failed, return %d\n",
@@ -168,7 +168,7 @@ static int read_auth_container(struct spl_image_info *spl_image,
        memcpy((void *)SEC_SECURE_RAM_BASE, (const void *)container,
               ALIGN(length, CONFIG_SYS_CACHELINE_SIZE));
 
-       ret = sc_seco_authenticate(-1, SC_MISC_AUTH_CONTAINER,
+       ret = sc_seco_authenticate(-1, SC_SECO_AUTH_CONTAINER,
                                   SECO_LOCAL_SEC_SEC_SECURE_RAM_BASE);
        if (ret) {
                printf("authenticate container hdr failed, return %d\n", ret);
@@ -194,7 +194,7 @@ static int read_auth_container(struct spl_image_info *spl_image,
 
 end_auth:
 #ifdef CONFIG_AHAB_BOOT
-       if (sc_seco_authenticate(-1, SC_MISC_REL_CONTAINER, 0))
+       if (sc_seco_authenticate(-1, SC_SECO_REL_CONTAINER, 0))
                printf("Error: release container failed!\n");
 #endif
        return ret;
diff --git a/arch/arm/mach-imx/imx8/snvs_security_sc.c b/arch/arm/mach-imx/imx8/snvs_security_sc.c
new file mode 100644 (file)
index 0000000..73f5651
--- /dev/null
@@ -0,0 +1,923 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2019-2020 NXP.
+ */
+
+/*
+ * Configuration of the Tamper pins in different mode:
+ *  - default (no tamper pins): _default_
+ *  - passive mode expecting VCC on the line: "_passive_vcc_"
+ *  - passive mode expecting VCC on the line: "_passive_gnd_"
+ *  - active mode: "_active_"
+ */
+
+#include <command.h>
+#include <log.h>
+#include <stddef.h>
+#include <common.h>
+#include <asm/arch/sci/sci.h>
+#include <asm/arch-imx8/imx8-pins.h>
+#include <asm/arch-imx8/snvs_security_sc.h>
+
+/* Access to gd */
+DECLARE_GLOBAL_DATA_PTR;
+
+#define SC_WRITE_CONF 1
+
+#define PGD_HEX_VALUE 0x41736166
+#define SRTC_EN 0x1
+#define DP_EN BIT(5)
+
+struct snvs_security_sc_conf {
+       struct snvs_hp_conf {
+               u32 lock;               /* HPLR - HP Lock */
+               u32 __cmd;              /* HPCOMR - HP Command */
+               u32 __ctl;              /* HPCR - HP Control */
+               u32 secvio_intcfg;      /* HPSICR - Security Violation Int
+                                        * Config
+                                        */
+               u32 secvio_ctl;         /* HPSVCR - Security Violation Control*/
+               u32 status;             /* HPSR - HP Status */
+               u32 secvio_status;      /* HPSVSR - Security Violation Status */
+               u32 __ha_counteriv;     /* High Assurance Counter IV */
+               u32 __ha_counter;               /* High Assurance Counter */
+               u32 __rtc_msb;          /* Real Time Clock/Counter MSB */
+               u32 __rtc_lsb;          /* Real Time Counter LSB */
+               u32 __time_alarm_msb;   /* Time Alarm MSB */
+               u32 __time_alarm_lsb;   /* Time Alarm LSB */
+       } hp;
+       struct snvs_lp_conf {
+               u32 lock;
+               u32 __ctl;
+               u32 __mstr_key_ctl;     /* Master Key Control */
+               u32 secvio_ctl;         /* Security Violation Control */
+               u32 tamper_filt_cfg;    /* Tamper Glitch Filters Configuration*/
+               u32 tamper_det_cfg;     /* Tamper Detectors Configuration */
+               u32 status;
+               u32 __srtc_msb;         /* Secure Real Time Clock/Counter MSB */
+               u32 __srtc_lsb;         /* Secure Real Time Clock/Counter LSB */
+               u32 __time_alarm;               /* Time Alarm */
+               u32 __smc_msb;          /* Secure Monotonic Counter MSB */
+               u32 __smc_lsb;          /* Secure Monotonic Counter LSB */
+               u32 __pwr_glitch_det;   /* Power Glitch Detector */
+               u32 __gen_purpose;
+               u8 __zmk[32];           /* Zeroizable Master Key */
+               u32 __rsvd0;
+               u32 __gen_purposes[4];  /* gp0_30 to gp0_33 */
+               u32 tamper_det_cfg2;    /* Tamper Detectors Configuration2 */
+               u32 tamper_det_status;  /* Tamper Detectors status */
+               u32 tamper_filt1_cfg;   /* Tamper Glitch Filter1 Configuration*/
+               u32 tamper_filt2_cfg;   /* Tamper Glitch Filter2 Configuration*/
+               u32 __rsvd1[4];
+               u32 act_tamper1_cfg;    /* Active Tamper1 Configuration */
+               u32 act_tamper2_cfg;    /* Active Tamper2 Configuration */
+               u32 act_tamper3_cfg;    /* Active Tamper3 Configuration */
+               u32 act_tamper4_cfg;    /* Active Tamper4 Configuration */
+               u32 act_tamper5_cfg;    /* Active Tamper5 Configuration */
+               u32 __rsvd2[3];
+               u32 act_tamper_ctl;     /* Active Tamper Control */
+               u32 act_tamper_clk_ctl; /* Active Tamper Clock Control */
+               u32 act_tamper_routing_ctl1;/* Active Tamper Routing Control1 */
+               u32 act_tamper_routing_ctl2;/* Active Tamper Routing Control2 */
+       } lp;
+};
+
+static struct snvs_security_sc_conf snvs_default_config = {
+       .hp = {
+               .lock = 0x1f0703ff,
+               .secvio_ctl = 0x3000007f,
+       },
+       .lp = {
+               .lock = 0x1f0003ff,
+               .secvio_ctl = 0x36,
+               .tamper_filt_cfg = 0,
+               .tamper_det_cfg = 0x76, /* analogic tampers
+                                        * + rollover tampers
+                                        */
+               .tamper_det_cfg2 = 0,
+               .tamper_filt1_cfg = 0,
+               .tamper_filt2_cfg = 0,
+               .act_tamper1_cfg = 0,
+               .act_tamper2_cfg = 0,
+               .act_tamper3_cfg = 0,
+               .act_tamper4_cfg = 0,
+               .act_tamper5_cfg = 0,
+               .act_tamper_ctl = 0,
+               .act_tamper_clk_ctl = 0,
+               .act_tamper_routing_ctl1 = 0,
+               .act_tamper_routing_ctl2 = 0,
+       }
+};
+
+static struct snvs_security_sc_conf snvs_passive_vcc_config = {
+       .hp = {
+               .lock = 0x1f0703ff,
+               .secvio_ctl = 0x3000007f,
+       },
+       .lp = {
+               .lock = 0x1f0003ff,
+               .secvio_ctl = 0x36,
+               .tamper_filt_cfg = 0,
+               .tamper_det_cfg = 0x276, /* ET1 will trig on line at GND
+                                         *  + analogic tampers
+                                         *  + rollover tampers
+                                         */
+               .tamper_det_cfg2 = 0,
+               .tamper_filt1_cfg = 0,
+               .tamper_filt2_cfg = 0,
+               .act_tamper1_cfg = 0,
+               .act_tamper2_cfg = 0,
+               .act_tamper3_cfg = 0,
+               .act_tamper4_cfg = 0,
+               .act_tamper5_cfg = 0,
+               .act_tamper_ctl = 0,
+               .act_tamper_clk_ctl = 0,
+               .act_tamper_routing_ctl1 = 0,
+               .act_tamper_routing_ctl2 = 0,
+       }
+};
+
+static struct snvs_security_sc_conf snvs_passive_gnd_config = {
+       .hp = {
+               .lock = 0x1f0703ff,
+               .secvio_ctl = 0x3000007f,
+       },
+       .lp = {
+               .lock = 0x1f0003ff,
+               .secvio_ctl = 0x36,
+               .tamper_filt_cfg = 0,
+               .tamper_det_cfg = 0xa76, /* ET1 will trig on line at VCC
+                                         *  + analogic tampers
+                                         *  + rollover tampers
+                                         */
+               .tamper_det_cfg2 = 0,
+               .tamper_filt1_cfg = 0,
+               .tamper_filt2_cfg = 0,
+               .act_tamper1_cfg = 0,
+               .act_tamper2_cfg = 0,
+               .act_tamper3_cfg = 0,
+               .act_tamper4_cfg = 0,
+               .act_tamper5_cfg = 0,
+               .act_tamper_ctl = 0,
+               .act_tamper_clk_ctl = 0,
+               .act_tamper_routing_ctl1 = 0,
+               .act_tamper_routing_ctl2 = 0,
+       }
+};
+
+static struct snvs_security_sc_conf snvs_active_config = {
+       .hp = {
+               .lock = 0x1f0703ff,
+               .secvio_ctl = 0x3000007f,
+       },
+       .lp = {
+               .lock = 0x1f0003ff,
+               .secvio_ctl = 0x36,
+               .tamper_filt_cfg = 0x00800000, /* Enable filtering */
+               .tamper_det_cfg = 0x276, /* ET1 enabled + analogic tampers
+                                         *  + rollover tampers
+                                         */
+               .tamper_det_cfg2 = 0,
+               .tamper_filt1_cfg = 0,
+               .tamper_filt2_cfg = 0,
+               .act_tamper1_cfg = 0x84001111,
+               .act_tamper2_cfg = 0,
+               .act_tamper3_cfg = 0,
+               .act_tamper4_cfg = 0,
+               .act_tamper5_cfg = 0,
+               .act_tamper_ctl = 0x00010001,
+               .act_tamper_clk_ctl = 0,
+               .act_tamper_routing_ctl1 = 0x1,
+               .act_tamper_routing_ctl2 = 0,
+       }
+};
+
+static struct snvs_security_sc_conf *get_snvs_config(void)
+{
+       return &snvs_default_config;
+}
+
+struct snvs_dgo_conf {
+       u32 tamper_offset_ctl;
+       u32 tamper_pull_ctl;
+       u32 tamper_ana_test_ctl;
+       u32 tamper_sensor_trim_ctl;
+       u32 tamper_misc_ctl;
+       u32 tamper_core_volt_mon_ctl;
+};
+
+static struct snvs_dgo_conf snvs_dgo_default_config = {
+       .tamper_misc_ctl = 0x80000000, /* Lock the DGO */
+};
+
+static struct snvs_dgo_conf snvs_dgo_passive_vcc_config = {
+       .tamper_misc_ctl = 0x80000000, /* Lock the DGO */
+       .tamper_pull_ctl = 0x00000001, /* Pull down ET1 */
+       .tamper_ana_test_ctl = 0x20000000, /* Enable tamper */
+};
+
+static struct snvs_dgo_conf snvs_dgo_passive_gnd_config = {
+       .tamper_misc_ctl = 0x80000000, /* Lock the DGO */
+       .tamper_pull_ctl = 0x00000401, /* Pull up ET1 */
+       .tamper_ana_test_ctl = 0x20000000, /* Enable tamper */
+};
+
+static struct snvs_dgo_conf snvs_dgo_active_config = {
+       .tamper_misc_ctl = 0x80000000, /* Lock the DGO */
+       .tamper_ana_test_ctl = 0x20000000, /* Enable tamper */
+};
+
+static struct snvs_dgo_conf *get_snvs_dgo_config(void)
+{
+       return &snvs_dgo_default_config;
+}
+
+struct tamper_pin_cfg {
+       u32 pad;
+       u32 mux_conf;
+};
+
+static struct tamper_pin_cfg tamper_pin_list_default_config[] = {
+       {SC_P_CSI_D00, 0}, /* Tamp_Out0 */
+       {SC_P_CSI_D01, 0}, /* Tamp_Out1 */
+       {SC_P_CSI_D02, 0}, /* Tamp_Out2 */
+       {SC_P_CSI_D03, 0}, /* Tamp_Out3 */
+       {SC_P_CSI_D04, 0}, /* Tamp_Out4 */
+       {SC_P_CSI_D05, 0}, /* Tamp_In0 */
+       {SC_P_CSI_D06, 0}, /* Tamp_In1 */
+       {SC_P_CSI_D07, 0}, /* Tamp_In2 */
+       {SC_P_CSI_HSYNC, 0}, /* Tamp_In3 */
+       {SC_P_CSI_VSYNC, 0}, /* Tamp_In4 */
+};
+
+static struct tamper_pin_cfg tamper_pin_list_passive_vcc_config[] = {
+       {SC_P_CSI_D05, 0x1c000060}, /* Tamp_In0 */ /* Sel tamper + OD input */
+};
+
+static struct tamper_pin_cfg tamper_pin_list_passive_gnd_config[] = {
+       {SC_P_CSI_D05, 0x1c000060}, /* Tamp_In0 */ /* Sel tamper + OD input */
+};
+
+static struct tamper_pin_cfg tamper_pin_list_active_config[] = {
+       {SC_P_CSI_D00, 0x1a000060}, /* Tamp_Out0 */ /* Sel tamper + OD */
+       {SC_P_CSI_D05, 0x1c000060}, /* Tamp_In0 */ /* Sel tamper + OD input */
+};
+
+#define TAMPER_PIN_LIST_CHOSEN tamper_pin_list_default_config
+
+static struct tamper_pin_cfg *get_tamper_pin_cfg_list(u32 *size)
+{
+       *size = sizeof(TAMPER_PIN_LIST_CHOSEN) /
+               sizeof(TAMPER_PIN_LIST_CHOSEN[0]);
+
+       return TAMPER_PIN_LIST_CHOSEN;
+}
+
+#define SC_CONF_OFFSET_OF(_field) \
+       (offsetof(struct snvs_security_sc_conf, _field))
+
+static u32 ptr_value(u32 *_p)
+{
+       return (_p) ? *_p : 0xdeadbeef;
+}
+
+static int check_write_secvio_config(u32 id, u32 *_p1, u32 *_p2,
+                                    u32 *_p3, u32 *_p4, u32 *_p5,
+                                    u32 _cnt)
+{
+       int scierr = 0;
+       u32 d1 = ptr_value(_p1);
+       u32 d2 = ptr_value(_p2);
+       u32 d3 = ptr_value(_p3);
+       u32 d4 = ptr_value(_p4);
+       u32 d5 = ptr_value(_p5);
+
+       scierr = sc_seco_secvio_config(-1, id, SC_WRITE_CONF, &d1, &d2, &d3,
+                                      &d4, &d4, _cnt);
+       if (scierr != SC_ERR_NONE) {
+               printf("Failed to set secvio configuration\n");
+               debug("Failed to set conf id 0x%x with values ", id);
+               debug("0x%.8x 0x%.8x 0x%.8x 0x%.8x 0x%.8x (cnt: %d)\n",
+                     d1, d2, d3, d4, d5, _cnt);
+               goto exit;
+       }
+
+       if (_p1)
+               *(u32 *)_p1 = d1;
+       if (_p2)
+               *(u32 *)_p2 = d2;
+       if (_p3)
+               *(u32 *)_p3 = d3;
+       if (_p4)
+               *(u32 *)_p4 = d4;
+       if (_p5)
+               *(u32 *)_p5 = d5;
+
+exit:
+       return scierr;
+}
+
+#define SC_CHECK_WRITE1(id, _p1) \
+       check_write_secvio_config(id, _p1, NULL, NULL, NULL, NULL, 1)
+
+static int apply_snvs_config(struct snvs_security_sc_conf *cnf)
+{
+       int scierr = 0;
+
+       debug("%s\n", __func__);
+
+       debug("Applying config:\n"
+                 "\thp.lock = 0x%.8x\n"
+                 "\thp.secvio_ctl = 0x%.8x\n"
+                 "\tlp.lock = 0x%.8x\n"
+                 "\tlp.secvio_ctl = 0x%.8x\n"
+                 "\tlp.tamper_filt_cfg = 0x%.8x\n"
+                 "\tlp.tamper_det_cfg = 0x%.8x\n"
+                 "\tlp.tamper_det_cfg2 = 0x%.8x\n"
+                 "\tlp.tamper_filt1_cfg = 0x%.8x\n"
+                 "\tlp.tamper_filt2_cfg = 0x%.8x\n"
+                 "\tlp.act_tamper1_cfg = 0x%.8x\n"
+                 "\tlp.act_tamper2_cfg = 0x%.8x\n"
+                 "\tlp.act_tamper3_cfg = 0x%.8x\n"
+                 "\tlp.act_tamper4_cfg = 0x%.8x\n"
+                 "\tlp.act_tamper5_cfg = 0x%.8x\n"
+                 "\tlp.act_tamper_ctl = 0x%.8x\n"
+                 "\tlp.act_tamper_clk_ctl = 0x%.8x\n"
+                 "\tlp.act_tamper_routing_ctl1 = 0x%.8x\n"
+                 "\tlp.act_tamper_routing_ctl2 = 0x%.8x\n",
+                       cnf->hp.lock,
+                       cnf->hp.secvio_ctl,
+                       cnf->lp.lock,
+                       cnf->lp.secvio_ctl,
+                       cnf->lp.tamper_filt_cfg,
+                       cnf->lp.tamper_det_cfg,
+                       cnf->lp.tamper_det_cfg2,
+                       cnf->lp.tamper_filt1_cfg,
+                       cnf->lp.tamper_filt2_cfg,
+                       cnf->lp.act_tamper1_cfg,
+                       cnf->lp.act_tamper2_cfg,
+                       cnf->lp.act_tamper3_cfg,
+                       cnf->lp.act_tamper4_cfg,
+                       cnf->lp.act_tamper5_cfg,
+                       cnf->lp.act_tamper_ctl,
+                       cnf->lp.act_tamper_clk_ctl,
+                       cnf->lp.act_tamper_routing_ctl1,
+                       cnf->lp.act_tamper_routing_ctl2);
+
+       scierr = check_write_secvio_config(SC_CONF_OFFSET_OF(lp.tamper_filt_cfg),
+                                          &cnf->lp.tamper_filt_cfg,
+                                          &cnf->lp.tamper_filt1_cfg,
+                                          &cnf->lp.tamper_filt2_cfg, NULL,
+                                          NULL, 3);
+       if (scierr != SC_ERR_NONE)
+               goto exit;
+
+       /* Configure AT */
+       scierr = check_write_secvio_config(SC_CONF_OFFSET_OF(lp.act_tamper1_cfg),
+                                          &cnf->lp.act_tamper1_cfg,
+                                          &cnf->lp.act_tamper2_cfg,
+                                          &cnf->lp.act_tamper2_cfg,
+                                          &cnf->lp.act_tamper2_cfg,
+                                          &cnf->lp.act_tamper2_cfg, 5);
+       if (scierr != SC_ERR_NONE)
+               goto exit;
+
+       /* Configure AT routing */
+       scierr = check_write_secvio_config(SC_CONF_OFFSET_OF(lp.act_tamper_routing_ctl1),
+                                          &cnf->lp.act_tamper_routing_ctl1,
+                                          &cnf->lp.act_tamper_routing_ctl2,
+                                          NULL, NULL, NULL, 2);
+       if (scierr != SC_ERR_NONE)
+               goto exit;
+
+       /* Configure AT frequency */
+       scierr = SC_CHECK_WRITE1(SC_CONF_OFFSET_OF(lp.act_tamper_clk_ctl),
+                                &cnf->lp.act_tamper_clk_ctl);
+       if (scierr != SC_ERR_NONE)
+               goto exit;
+
+       /* Activate the ATs */
+       scierr = SC_CHECK_WRITE1(SC_CONF_OFFSET_OF(lp.act_tamper_ctl),
+                                &cnf->lp.act_tamper_ctl);
+       if (scierr != SC_ERR_NONE)
+               goto exit;
+
+       /* Activate the detectors */
+       scierr = check_write_secvio_config(SC_CONF_OFFSET_OF(lp.tamper_det_cfg),
+                                          &cnf->lp.tamper_det_cfg,
+                                          &cnf->lp.tamper_det_cfg2, NULL, NULL,
+                                          NULL, 2);
+       if (scierr != SC_ERR_NONE)
+               goto exit;
+
+       /* Configure LP secvio */
+       scierr = SC_CHECK_WRITE1(SC_CONF_OFFSET_OF(lp.secvio_ctl),
+                                &cnf->lp.secvio_ctl);
+       if (scierr != SC_ERR_NONE)
+               goto exit;
+
+       /* Configure HP secvio */
+       scierr = SC_CHECK_WRITE1(SC_CONF_OFFSET_OF(hp.secvio_ctl),
+                                &cnf->hp.secvio_ctl);
+       if (scierr != SC_ERR_NONE)
+               goto exit;
+
+       /* Lock access */
+       scierr = SC_CHECK_WRITE1(SC_CONF_OFFSET_OF(hp.lock), &cnf->hp.lock);
+       if (scierr != SC_ERR_NONE)
+               goto exit;
+
+       scierr = SC_CHECK_WRITE1(SC_CONF_OFFSET_OF(lp.lock), &cnf->lp.lock);
+       if (scierr != SC_ERR_NONE)
+               goto exit;
+
+exit:
+       return (scierr == SC_ERR_NONE) ? 0 : -EIO;
+}
+
+static int dgo_write(u32 _id, u8 _access, u32 *_pdata)
+{
+       int scierr = sc_seco_secvio_dgo_config(-1, _id, _access, _pdata);
+
+       if (scierr != SC_ERR_NONE) {
+               printf("Failed to set dgo configuration\n");
+               debug("Failed to set conf id 0x%x : 0x%.8x", _id, *_pdata);
+       }
+
+       return scierr;
+}
+
+static int apply_snvs_dgo_config(struct snvs_dgo_conf *cnf)
+{
+       int scierr = 0;
+
+       debug("%s\n", __func__);
+
+       debug("Applying config:\n"
+               "\ttamper_offset_ctl = 0x%.8x\n"
+               "\ttamper_pull_ctl = 0x%.8x\n"
+               "\ttamper_ana_test_ctl = 0x%.8x\n"
+               "\ttamper_sensor_trim_ctl = 0x%.8x\n"
+               "\ttamper_misc_ctl = 0x%.8x\n"
+               "\ttamper_core_volt_mon_ctl = 0x%.8x\n",
+                       cnf->tamper_offset_ctl,
+                       cnf->tamper_pull_ctl,
+                       cnf->tamper_ana_test_ctl,
+                       cnf->tamper_sensor_trim_ctl,
+                       cnf->tamper_misc_ctl,
+                       cnf->tamper_core_volt_mon_ctl);
+
+       dgo_write(0x04, 1, &cnf->tamper_offset_ctl);
+       if (scierr != SC_ERR_NONE)
+               goto exit;
+
+       dgo_write(0x14, 1, &cnf->tamper_pull_ctl);
+       if (scierr != SC_ERR_NONE)
+               goto exit;
+
+       dgo_write(0x24, 1, &cnf->tamper_ana_test_ctl);
+       if (scierr != SC_ERR_NONE)
+               goto exit;
+
+       dgo_write(0x34, 1, &cnf->tamper_sensor_trim_ctl);
+       if (scierr != SC_ERR_NONE)
+               goto exit;
+
+       dgo_write(0x54, 1, &cnf->tamper_core_volt_mon_ctl);
+       if (scierr != SC_ERR_NONE)
+               goto exit;
+
+       /* Last as it could lock the writes */
+       dgo_write(0x44, 1, &cnf->tamper_misc_ctl);
+       if (scierr != SC_ERR_NONE)
+               goto exit;
+
+exit:
+       return (scierr == SC_ERR_NONE) ? 0 : -EIO;
+}
+
+static int pad_write(u32 _pad, u32 _value)
+{
+       int scierr = sc_pad_set(-1, _pad, _value);
+
+       if (scierr != SC_ERR_NONE) {
+               printf("Failed to set pad configuration\n");
+               debug("Failed to set conf pad 0x%x : 0x%.8x", _pad, _value);
+       }
+
+       return scierr;
+}
+
+static int apply_tamper_pin_list_config(struct tamper_pin_cfg *confs, u32 size)
+{
+       int scierr = 0;
+       u32 idx;
+
+       debug("%s\n", __func__);
+
+       for (idx = 0; idx < size; idx++) {
+               debug("\t idx %d: pad %d: 0x%.8x\n", idx, confs[idx].pad,
+                     confs[idx].mux_conf);
+               pad_write(confs[idx].pad, 3 << 30 | confs[idx].mux_conf);
+               if (scierr != SC_ERR_NONE)
+                       goto exit;
+       }
+
+exit:
+       return (scierr == SC_ERR_NONE) ? 0 : -EIO;
+}
+
+int examples(void)
+{
+       u32 size;
+       struct snvs_security_sc_conf *snvs_conf;
+       struct snvs_dgo_conf *snvs_dgo_conf;
+       struct tamper_pin_cfg *tamper_pin_conf;
+
+       /* Caller */
+       snvs_conf = get_snvs_config();
+       snvs_dgo_conf = get_snvs_dgo_config();
+       tamper_pin_conf = get_tamper_pin_cfg_list(&size);
+
+       /* Default */
+       snvs_conf = &snvs_default_config;
+       snvs_dgo_conf = &snvs_dgo_default_config;
+       tamper_pin_conf = tamper_pin_list_default_config;
+
+       /* Passive tamper expecting VCC on the line */
+       snvs_conf = &snvs_passive_vcc_config;
+       snvs_dgo_conf = &snvs_dgo_passive_vcc_config;
+       tamper_pin_conf = tamper_pin_list_passive_vcc_config;
+
+       /* Passive tamper expecting GND on the line */
+       snvs_conf = &snvs_passive_gnd_config;
+       snvs_dgo_conf = &snvs_dgo_passive_gnd_config;
+       tamper_pin_conf = tamper_pin_list_passive_gnd_config;
+
+       /* Active tamper */
+       snvs_conf = &snvs_active_config;
+       snvs_dgo_conf = &snvs_dgo_active_config;
+       tamper_pin_conf = tamper_pin_list_active_config;
+
+       return !snvs_conf + !snvs_dgo_conf + !tamper_pin_conf;
+}
+
+#ifdef CONFIG_IMX_SNVS_SEC_SC_AUTO
+int snvs_security_sc_init(void)
+{
+       int err = 0;
+
+       struct snvs_security_sc_conf *snvs_conf;
+       struct snvs_dgo_conf *snvs_dgo_conf;
+       struct tamper_pin_cfg *tamper_pin_conf;
+       u32 size;
+
+       debug("%s\n", __func__);
+
+       snvs_conf = get_snvs_config();
+       snvs_dgo_conf = get_snvs_dgo_config();
+
+       tamper_pin_conf = get_tamper_pin_cfg_list(&size);
+
+       err = apply_tamper_pin_list_config(tamper_pin_conf, size);
+       if (err) {
+               debug("Failed to set pins\n");
+               goto exit;
+       }
+
+       err = apply_snvs_dgo_config(snvs_dgo_conf);
+       if (err) {
+               debug("Failed to set dgo\n");
+               goto exit;
+       }
+
+       err = apply_snvs_config(snvs_conf);
+       if (err) {
+               debug("Failed to set snvs\n");
+               goto exit;
+       }
+
+exit:
+       return err;
+}
+#endif /* CONFIG_IMX_SNVS_SEC_SC_AUTO */
+
+static char snvs_cfg_help_text[] =
+       "snvs_cfg\n"
+       "\thp.lock\n"
+       "\thp.secvio_ctl\n"
+       "\tlp.lock\n"
+       "\tlp.secvio_ctl\n"
+       "\tlp.tamper_filt_cfg\n"
+       "\tlp.tamper_det_cfg\n"
+       "\tlp.tamper_det_cfg2\n"
+       "\tlp.tamper_filt1_cfg\n"
+       "\tlp.tamper_filt2_cfg\n"
+       "\tlp.act_tamper1_cfg\n"
+       "\tlp.act_tamper2_cfg\n"
+       "\tlp.act_tamper3_cfg\n"
+       "\tlp.act_tamper4_cfg\n"
+       "\tlp.act_tamper5_cfg\n"
+       "\tlp.act_tamper_ctl\n"
+       "\tlp.act_tamper_clk_ctl\n"
+       "\tlp.act_tamper_routing_ctl1\n"
+       "\tlp.act_tamper_routing_ctl2\n"
+       "\n"
+       "ALL values should be in hexadecimal format";
+
+#define NB_REGISTERS 18
+static int do_snvs_cfg(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+{
+       int err = 0;
+       u32 idx = 0;
+
+       struct snvs_security_sc_conf conf = {0};
+
+       if (argc != (NB_REGISTERS + 1))
+               return CMD_RET_USAGE;
+
+       conf.hp.lock = simple_strtoul(argv[++idx], NULL, 16);
+       conf.hp.secvio_ctl = simple_strtoul(argv[++idx], NULL, 16);
+       conf.lp.lock = simple_strtoul(argv[++idx], NULL, 16);
+       conf.lp.secvio_ctl = simple_strtoul(argv[++idx], NULL, 16);
+       conf.lp.tamper_filt_cfg = simple_strtoul(argv[++idx], NULL, 16);
+       conf.lp.tamper_det_cfg = simple_strtoul(argv[++idx], NULL, 16);
+       conf.lp.tamper_det_cfg2 = simple_strtoul(argv[++idx], NULL, 16);
+       conf.lp.tamper_filt1_cfg = simple_strtoul(argv[++idx], NULL, 16);
+       conf.lp.tamper_filt2_cfg = simple_strtoul(argv[++idx], NULL, 16);
+       conf.lp.act_tamper1_cfg = simple_strtoul(argv[++idx], NULL, 16);
+       conf.lp.act_tamper2_cfg = simple_strtoul(argv[++idx], NULL, 16);
+       conf.lp.act_tamper3_cfg = simple_strtoul(argv[++idx], NULL, 16);
+       conf.lp.act_tamper4_cfg = simple_strtoul(argv[++idx], NULL, 16);
+       conf.lp.act_tamper5_cfg = simple_strtoul(argv[++idx], NULL, 16);
+       conf.lp.act_tamper_ctl = simple_strtoul(argv[++idx], NULL, 16);
+       conf.lp.act_tamper_clk_ctl = simple_strtoul(argv[++idx], NULL, 16);
+       conf.lp.act_tamper_routing_ctl1 = simple_strtoul(argv[++idx], NULL, 16);
+       conf.lp.act_tamper_routing_ctl2 = simple_strtoul(argv[++idx], NULL, 16);
+
+       err = apply_snvs_config(&conf);
+
+       return err;
+}
+
+U_BOOT_CMD(snvs_cfg,
+          NB_REGISTERS + 1, 1, do_snvs_cfg,
+          "Security violation configuration",
+          snvs_cfg_help_text
+);
+
+static char snvs_dgo_cfg_help_text[] =
+       "snvs_dgo_cfg\n"
+       "\ttamper_offset_ctl\n"
+       "\ttamper_pull_ctl\n"
+       "\ttamper_ana_test_ctl\n"
+       "\ttamper_sensor_trim_ctl\n"
+       "\ttamper_misc_ctl\n"
+       "\ttamper_core_volt_mon_ctl\n"
+       "\n"
+       "ALL values should be in hexadecimal format";
+
+static int do_snvs_dgo_cfg(cmd_tbl_t *cmdtp, int flag, int argc,
+                          char *const argv[])
+{
+       int err = 0;
+       u32 idx = 0;
+
+       struct snvs_dgo_conf conf = {0};
+
+       if (argc != (6 + 1))
+               return CMD_RET_USAGE;
+
+       conf.tamper_offset_ctl = simple_strtoul(argv[++idx], NULL, 16);
+       conf.tamper_pull_ctl = simple_strtoul(argv[++idx], NULL, 16);
+       conf.tamper_ana_test_ctl = simple_strtoul(argv[++idx], NULL, 16);
+       conf.tamper_sensor_trim_ctl = simple_strtoul(argv[++idx], NULL, 16);
+       conf.tamper_misc_ctl = simple_strtoul(argv[++idx], NULL, 16);
+       conf.tamper_core_volt_mon_ctl = simple_strtoul(argv[++idx], NULL, 16);
+
+       err = apply_snvs_dgo_config(&conf);
+
+       return err;
+}
+
+U_BOOT_CMD(snvs_dgo_cfg,
+          7, 1, do_snvs_dgo_cfg,
+          "SNVS DGO configuration",
+          snvs_dgo_cfg_help_text
+);
+
+static char tamper_pin_cfg_help_text[] =
+       "snvs_dgo_cfg\n"
+       "\tpad\n"
+       "\tvalue\n"
+       "\n"
+       "ALL values should be in hexadecimal format";
+
+static int do_tamper_pin_cfg(cmd_tbl_t *cmdtp, int flag, int argc,
+                            char *const argv[])
+{
+       int err = 0;
+       u32 idx = 0;
+
+       struct tamper_pin_cfg conf = {0};
+
+       if (argc != (2 + 1))
+               return CMD_RET_USAGE;
+
+       conf.pad = simple_strtoul(argv[++idx], NULL, 10);
+       conf.mux_conf = simple_strtoul(argv[++idx], NULL, 16);
+
+       err = apply_tamper_pin_list_config(&conf, 1);
+
+       return err;
+}
+
+U_BOOT_CMD(tamper_pin_cfg,
+          3, 1, do_tamper_pin_cfg,
+          "tamper pin configuration",
+          tamper_pin_cfg_help_text
+);
+
+static char snvs_clear_status_help_text[] =
+       "snvs_clear_status\n"
+       "\tHPSR\n"
+       "\tHPSVSR\n"
+       "\tLPSR\n"
+       "\tLPTDSR\n"
+       "\n"
+       "Write the status registers with the value provided,"
+       " clearing the status";
+
+static int do_snvs_clear_status(cmd_tbl_t *cmdtp, int flag, int argc,
+                                 char *const argv[])
+{
+       int scierr = 0;
+       u32 idx = 0;
+
+       struct snvs_security_sc_conf conf = {0};
+
+       if (argc != (2 + 1))
+               return CMD_RET_USAGE;
+
+       conf.lp.status = simple_strtoul(argv[++idx], NULL, 16);
+       conf.lp.tamper_det_status = simple_strtoul(argv[++idx], NULL, 16);
+
+       scierr = check_write_secvio_config(SC_CONF_OFFSET_OF(lp.status),
+                                          &conf.lp.status, NULL, NULL, NULL,
+                                          NULL, 1);
+       if (scierr != SC_ERR_NONE)
+               goto exit;
+
+       scierr = check_write_secvio_config(SC_CONF_OFFSET_OF(lp.tamper_det_status),
+                                          &conf.lp.tamper_det_status, NULL,
+                                          NULL, NULL, NULL, 1);
+       if (scierr != SC_ERR_NONE)
+               goto exit;
+
+exit:
+       return (scierr == SC_ERR_NONE) ? 0 : 1;
+}
+
+U_BOOT_CMD(snvs_clear_status,
+          3, 1, do_snvs_clear_status,
+          "snvs clear status",
+          snvs_clear_status_help_text
+);
+
+static char snvs_sec_status_help_text[] =
+       "snvs_sec_status\n"
+       "Display information about the security related to tamper and secvio";
+
+static int do_snvs_sec_status(cmd_tbl_t *cmdtp, int flag, int argc,
+                             char *const argv[])
+{
+       int scierr;
+       u32 idx;
+
+       u32 data[5];
+
+       u32 pads[] = {
+               SC_P_CSI_D00,
+               SC_P_CSI_D01,
+               SC_P_CSI_D02,
+               SC_P_CSI_D03,
+               SC_P_CSI_D04,
+               SC_P_CSI_D05,
+               SC_P_CSI_D06,
+               SC_P_CSI_D07,
+               SC_P_CSI_HSYNC,
+               SC_P_CSI_VSYNC,
+       };
+
+       u32 fuses[] = {
+               14,
+               30,
+               31,
+               260,
+               261,
+               262,
+               263,
+               768,
+       };
+
+       struct snvs_reg {
+               u32 id;
+               u32 nb;
+       } snvs[] = {
+               /* Locks */
+               {0x0,  1},
+               {0x34, 1},
+               /* Security violation */
+               {0xc,  1},
+               {0x10, 1},
+               {0x18, 1},
+               {0x40, 1},
+               /* Temper detectors */
+               {0x48, 2},
+               {0x4c, 1},
+               {0xa4, 1},
+               /* */
+               {0x44, 3},
+               {0xe0, 1},
+               {0xe4, 1},
+               {0xe8, 2},
+               /* Misc */
+               {0x3c, 1},
+               {0x5c, 2},
+               {0x64, 1},
+               {0xf8, 2},
+       };
+
+       u32 dgo[] = {
+               0x0,
+               0x10,
+               0x20,
+               0x30,
+               0x40,
+               0x50,
+       };
+
+       /* Pins */
+       printf("Pins:\n");
+       for (idx = 0; idx < ARRAY_SIZE(pads); idx++) {
+               u8 pad_id = pads[idx];
+
+               scierr = sc_pad_get(-1, pad_id, &data[0]);
+               if (scierr == 0)
+                       printf("\t- Pin %d: %.8x\n", pad_id, data[0]);
+               else
+                       printf("Failed to read Pin %d\n", pad_id);
+       }
+
+       /* Fuses */
+       printf("Fuses:\n");
+       for (idx = 0; idx < ARRAY_SIZE(fuses); idx++) {
+               u32 fuse_id = fuses[idx];
+
+               scierr = sc_misc_otp_fuse_read(-1, fuse_id, &data[0]);
+               if (scierr == 0)
+                       printf("\t- Fuse %d: %.8x\n", fuse_id, data[0]);
+               else
+                       printf("Failed to read Fuse %d\n", fuse_id);
+       }
+
+       /* SNVS */
+       printf("SNVS:\n");
+       for (idx = 0; idx < ARRAY_SIZE(snvs); idx++) {
+               struct snvs_reg *reg = &snvs[idx];
+
+               scierr = sc_seco_secvio_config(-1, reg->id, 0, &data[0],
+                                              &data[1], &data[2], &data[3],
+                                              &data[4], reg->nb);
+               if (scierr == 0) {
+                       int subidx;
+
+                       printf("\t- SNVS %.2x(%d):", reg->id, reg->nb);
+                       for (subidx = 0; subidx < reg->nb; subidx++)
+                               printf(" %.8x", data[subidx]);
+                       printf("\n");
+               } else {
+                       printf("Failed to read SNVS %d\n", reg->id);
+               }
+       }
+
+       /* DGO */
+       printf("DGO:\n");
+       for (idx = 0; idx < ARRAY_SIZE(dgo); idx++) {
+               u8 dgo_id = dgo[idx];
+
+               scierr = sc_seco_secvio_dgo_config(-1, dgo_id, 0, &data[0]);
+               if (scierr == 0)
+                       printf("\t- DGO %.2x: %.8x\n", dgo_id, data[0]);
+               else
+                       printf("Failed to read DGO %d\n", dgo_id);
+       }
+
+       return 0;
+}
+
+U_BOOT_CMD(snvs_sec_status,
+          1, 1, do_snvs_sec_status,
+          "tamper pin configuration",
+          snvs_sec_status_help_text
+);
index 58f1758ab6f6cafe82d12c30773e30146cb68bbf..895f9037809f57ceeaeb2b788b2bcb69073f6e43 100644 (file)
@@ -32,6 +32,11 @@ config TARGET_IMX8MQ_EVK
        select IMX8MQ
        select IMX8M_LPDDR4
 
+config TARGET_IMX8MQ_PHANBELL
+        bool "imx8mq_phanbell"
+        select IMX8MQ
+        select IMX8M_LPDDR4
+
 config TARGET_IMX8MM_EVK
        bool "imx8mm LPDDR4 EVK board"
        select IMX8MM
@@ -62,6 +67,7 @@ source "board/freescale/imx8mq_evk/Kconfig"
 source "board/freescale/imx8mm_evk/Kconfig"
 source "board/freescale/imx8mn_evk/Kconfig"
 source "board/freescale/imx8mp_evk/Kconfig"
+source "board/google/imx8mq_phanbell/Kconfig"
 source "board/toradex/verdin-imx8mm/Kconfig"
 
 endif
index c423ac0058d03f0739df792d59a6e6002d7c4e26..91c827f6c01fdcd255b057ffbede5f11be98f9c7 100644 (file)
@@ -447,34 +447,34 @@ static u32 decode_fracpll(enum clk_root_src frac_pll)
        }
 
        /* Only support SYS_XTAL 24M, PAD_CLK not take into consideration */
-       if ((pll_gnrl_ctl & INTPLL_REF_CLK_SEL_MASK) != 0)
+       if ((pll_gnrl_ctl & GENMASK(1, 0)) != 0)
                return 0;
 
-       if ((pll_gnrl_ctl & INTPLL_RST_MASK) == 0)
+       if ((pll_gnrl_ctl & RST_MASK) == 0)
                return 0;
        /*
         * When BYPASS is equal to 1, PLL enters the bypass mode
         * regardless of the values of RESETB
         */
-       if (pll_gnrl_ctl & INTPLL_BYPASS_MASK)
+       if (pll_gnrl_ctl & BYPASS_MASK)
                return 24000000u;
 
-       if (!(pll_gnrl_ctl & INTPLL_LOCK_MASK)) {
+       if (!(pll_gnrl_ctl & LOCK_STATUS)) {
                puts("pll not locked\n");
                return 0;
        }
 
-       if (!(pll_gnrl_ctl & INTPLL_CLKE_MASK))
+       if (!(pll_gnrl_ctl & CLKE_MASK))
                return 0;
 
-       main_div = (pll_fdiv_ctl0 & INTPLL_MAIN_DIV_MASK) >>
-               INTPLL_MAIN_DIV_SHIFT;
-       pre_div = (pll_fdiv_ctl0 & INTPLL_PRE_DIV_MASK) >>
-               INTPLL_PRE_DIV_SHIFT;
-       post_div = (pll_fdiv_ctl0 & INTPLL_POST_DIV_MASK) >>
-               INTPLL_POST_DIV_SHIFT;
+       main_div = (pll_fdiv_ctl0 & MDIV_MASK) >>
+               MDIV_SHIFT;
+       pre_div = (pll_fdiv_ctl0 & PDIV_MASK) >>
+               PDIV_SHIFT;
+       post_div = (pll_fdiv_ctl0 & SDIV_MASK) >>
+               SDIV_SHIFT;
 
-       k = pll_fdiv_ctl1 & GENMASK(15, 0);
+       k = pll_fdiv_ctl1 & KDIV_MASK;
 
        return lldiv((main_div * 65536 + k) * 24000000ULL,
                     65536 * pre_div * (1 << post_div));
@@ -578,3 +578,52 @@ u32 mxc_get_clock(enum mxc_clock clk)
 
        return 0;
 }
+
+#ifdef CONFIG_FEC_MXC
+int set_clk_enet(enum enet_freq type)
+{
+       u32 target;
+       u32 enet1_ref;
+
+       switch (type) {
+       case ENET_125MHZ:
+               enet1_ref = ENET1_REF_CLK_ROOT_FROM_PLL_ENET_MAIN_125M_CLK;
+               break;
+       case ENET_50MHZ:
+               enet1_ref = ENET1_REF_CLK_ROOT_FROM_PLL_ENET_MAIN_50M_CLK;
+               break;
+       case ENET_25MHZ:
+               enet1_ref = ENET1_REF_CLK_ROOT_FROM_PLL_ENET_MAIN_25M_CLK;
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       /* disable the clock first */
+       clock_enable(CCGR_ENET1, 0);
+       clock_enable(CCGR_SIM_ENET, 0);
+
+       /* set enet axi clock 266Mhz */
+       target = CLK_ROOT_ON | ENET_AXI_CLK_ROOT_FROM_SYS1_PLL_266M |
+                CLK_ROOT_PRE_DIV(CLK_ROOT_PRE_DIV1) |
+                CLK_ROOT_POST_DIV(CLK_ROOT_POST_DIV1);
+       clock_set_target_val(ENET_AXI_CLK_ROOT, target);
+
+       target = CLK_ROOT_ON | enet1_ref |
+                CLK_ROOT_PRE_DIV(CLK_ROOT_PRE_DIV1) |
+                CLK_ROOT_POST_DIV(CLK_ROOT_POST_DIV1);
+       clock_set_target_val(ENET_REF_CLK_ROOT, target);
+
+       target = CLK_ROOT_ON |
+               ENET1_TIME_CLK_ROOT_FROM_PLL_ENET_MAIN_100M_CLK |
+               CLK_ROOT_PRE_DIV(CLK_ROOT_PRE_DIV1) |
+               CLK_ROOT_POST_DIV(CLK_ROOT_POST_DIV4);
+       clock_set_target_val(ENET_TIMER_CLK_ROOT, target);
+
+       /* enable clock */
+       clock_enable(CCGR_SIM_ENET, 1);
+       clock_enable(CCGR_ENET1, 1);
+
+       return 0;
+}
+#endif
index aad9cf13ef230443be61a2096278ac52cdf6e9f7..ee18cdee507d223c8e1080ba3b26371fd97c5739 100644 (file)
@@ -15,6 +15,8 @@
 
 static struct anamix_pll *ana_pll = (struct anamix_pll *)ANATOP_BASE_ADDR;
 
+static u32 get_root_clk(enum clk_root_index clock_id);
+
 static u32 decode_frac_pll(enum clk_root_src frac_pll)
 {
        u32 pll_cfg0, pll_cfg1, pllout;
@@ -275,6 +277,8 @@ static u32 get_root_src_clk(enum clk_root_src root_src)
        case SYSTEM_PLL2_50M_CLK:
        case SYSTEM_PLL3_CLK:
                return decode_sscg_pll(root_src);
+       case ARM_A53_ALT_CLK:
+               return get_root_clk(ARM_A53_CLK_ROOT);
        default:
                return 0;
        }
@@ -322,13 +326,26 @@ int enable_i2c_clk(unsigned char enable, unsigned int i2c_num)
        return 0;
 }
 
+u32 get_arm_core_clk(void)
+{
+       enum clk_root_src root_src;
+       u32 root_src_clk;
+
+       if (clock_get_src(CORE_SEL_CFG, &root_src) < 0)
+               return 0;
+
+       root_src_clk = get_root_src_clk(root_src);
+
+       return root_src_clk;
+}
+
 unsigned int mxc_get_clock(enum mxc_clock clk)
 {
        u32 val;
 
-       switch(clk) {
+       switch (clk) {
        case MXC_ARM_CLK:
-               return get_root_clk(ARM_A53_CLK_ROOT);
+               return get_arm_core_clk();
        case MXC_IPG_CLK:
                clock_get_target_val(IPG_CLK_ROOT, &val);
                val = val & 0x3;
@@ -428,15 +445,13 @@ void init_clk_usdhc(u32 index)
        case 0:
                clock_enable(CCGR_USDHC1, 0);
                clock_set_target_val(USDHC1_CLK_ROOT, CLK_ROOT_ON |
-                                    CLK_ROOT_SOURCE_SEL(1) |
-                                    CLK_ROOT_POST_DIV(CLK_ROOT_POST_DIV2));
+                                    CLK_ROOT_SOURCE_SEL(1));
                clock_enable(CCGR_USDHC1, 1);
                return;
        case 1:
                clock_enable(CCGR_USDHC2, 0);
                clock_set_target_val(USDHC2_CLK_ROOT, CLK_ROOT_ON |
-                                    CLK_ROOT_SOURCE_SEL(1) |
-                                    CLK_ROOT_POST_DIV(CLK_ROOT_POST_DIV2));
+                                    CLK_ROOT_SOURCE_SEL(1));
                clock_enable(CCGR_USDHC2, 1);
                return;
        default:
@@ -639,7 +654,7 @@ void dram_pll_init(ulong pll_val)
 static int frac_pll_init(u32 pll, enum frac_pll_out_val val)
 {
        void __iomem *pll_cfg0, __iomem *pll_cfg1;
-       u32 val_cfg0, val_cfg1;
+       u32 val_cfg0, val_cfg1, divq;
        int ret;
 
        switch (pll) {
@@ -647,14 +662,17 @@ static int frac_pll_init(u32 pll, enum frac_pll_out_val val)
                pll_cfg0 = &ana_pll->arm_pll_cfg0;
                pll_cfg1 = &ana_pll->arm_pll_cfg1;
 
-               if (val == FRAC_PLL_OUT_1000M)
+               if (val == FRAC_PLL_OUT_1000M) {
                        val_cfg1 = FRAC_PLL_INT_DIV_CTL_VAL(49);
-               else
+                       divq = 0;
+               } else {
                        val_cfg1 = FRAC_PLL_INT_DIV_CTL_VAL(79);
+                       divq = 1;
+               }
                val_cfg0 = FRAC_PLL_CLKE_MASK | FRAC_PLL_REFCLK_SEL_OSC_25M |
                        FRAC_PLL_LOCK_SEL_MASK | FRAC_PLL_NEWDIV_VAL_MASK |
                        FRAC_PLL_REFCLK_DIV_VAL(4) |
-                       FRAC_PLL_OUTPUT_DIV_VAL(0);
+                       FRAC_PLL_OUTPUT_DIV_VAL(divq);
                break;
        default:
                return -EINVAL;
@@ -690,17 +708,14 @@ int clock_init(void)
         * We set ARM clock to 1Ghz for consumer, 800Mhz for industrial
         */
        grade = get_cpu_temp_grade(NULL, NULL);
-       if (!grade) {
+       if (!grade)
                frac_pll_init(ANATOP_ARM_PLL, FRAC_PLL_OUT_1000M);
-               clock_set_target_val(ARM_A53_CLK_ROOT, CLK_ROOT_ON |
-                            CLK_ROOT_SOURCE_SEL(1) |
-                            CLK_ROOT_POST_DIV(CLK_ROOT_POST_DIV1));
-       } else {
-               frac_pll_init(ANATOP_ARM_PLL, FRAC_PLL_OUT_1600M);
-               clock_set_target_val(ARM_A53_CLK_ROOT, CLK_ROOT_ON |
-                            CLK_ROOT_SOURCE_SEL(1) |
-                            CLK_ROOT_POST_DIV(CLK_ROOT_POST_DIV2));
-       }
+       else
+               frac_pll_init(ANATOP_ARM_PLL, FRAC_PLL_OUT_800M);
+
+       /* Bypass CCM A53 ROOT, Switch to ARM PLL -> MUX-> CPU */
+       clock_set_target_val(CORE_SEL_CFG, CLK_ROOT_SOURCE_SEL(1));
+
        /*
         * According to ANAMIX SPEC
         * sys pll1 fixed at 800MHz
@@ -747,6 +762,8 @@ static int do_imx8m_showclocks(cmd_tbl_t *cmdtp, int flag, int argc,
 
        freq = decode_frac_pll(ARM_PLL_CLK);
        printf("ARM_PLL    %8d MHz\n", freq / 1000000);
+       freq = decode_sscg_pll(DRAM_PLL1_CLK);
+       printf("DRAM_PLL    %8d MHz\n", freq / 1000000);
        freq = decode_sscg_pll(SYSTEM_PLL1_800M_CLK);
        printf("SYS_PLL1_800    %8d MHz\n", freq / 1000000);
        freq = decode_sscg_pll(SYSTEM_PLL1_400M_CLK);
index 8b7a4dad65c9ace24b402454e4f8a8bb06756954..b5ed27a923e07c323b5730c25df8553ebd9f4842 100644 (file)
@@ -472,33 +472,545 @@ static struct clk_root_map root_array[] = {
         {DRAM_PLL1_CLK}
        },
        {CORE_SEL_CFG, CORE_SEL_CLOCK_SLICE, 0,
+        {ARM_A53_ALT_CLK, ARM_PLL_CLK}
+       },
+};
+#elif defined(CONFIG_IMX8MM)
+static struct clk_root_map root_array[] = {
+       {ARM_A53_CLK_ROOT, CORE_CLOCK_SLICE, 0,
+        {OSC_24M_CLK, ARM_PLL_CLK, SYSTEM_PLL2_500M_CLK,
+         SYSTEM_PLL2_1000M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL1_400M_CLK, AUDIO_PLL1_CLK, SYSTEM_PLL3_CLK}
+       },
+       {ARM_M4_CLK_ROOT, CORE_CLOCK_SLICE, 1,
+        {OSC_24M_CLK, SYSTEM_PLL2_200M_CLK, SYSTEM_PLL2_250M_CLK,
+         SYSTEM_PLL1_266M_CLK, SYSTEM_PLL1_800M_CLK,
+         AUDIO_PLL1_CLK, VIDEO_PLL_CLK, SYSTEM_PLL3_CLK}
+       },
+       {VPU_A53_CLK_ROOT, CORE_CLOCK_SLICE, 2,
+        {OSC_24M_CLK, ARM_PLL_CLK, SYSTEM_PLL2_500M_CLK,
+         SYSTEM_PLL2_1000M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL1_400M_CLK, AUDIO_PLL1_CLK, VPU_PLL_CLK}
+       },
+       {GPU3D_CLK_ROOT, CORE_CLOCK_SLICE, 3,
+        {OSC_24M_CLK, GPU_PLL_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL2_1000M_CLK,
+         AUDIO_PLL1_CLK, VIDEO_PLL_CLK, AUDIO_PLL2_CLK}
+       },
+       {GPU2D_CLK_ROOT, CORE_CLOCK_SLICE, 4,
+        {OSC_24M_CLK, GPU_PLL_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL2_1000M_CLK,
+         AUDIO_PLL1_CLK, VIDEO_PLL_CLK, AUDIO_PLL2_CLK}
+       },
+       {MAIN_AXI_CLK_ROOT, BUS_CLOCK_SLICE, 0,
+        {OSC_24M_CLK, SYSTEM_PLL2_333M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL2_250M_CLK, SYSTEM_PLL2_1000M_CLK,
+         AUDIO_PLL1_CLK, VIDEO_PLL_CLK, SYSTEM_PLL1_100M_CLK}
+       },
+       {ENET_AXI_CLK_ROOT, BUS_CLOCK_SLICE, 1,
+        {OSC_24M_CLK, SYSTEM_PLL1_266M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL2_250M_CLK, SYSTEM_PLL2_200M_CLK,
+         AUDIO_PLL1_CLK, VIDEO_PLL_CLK, SYSTEM_PLL3_CLK}
+       },
+       {NAND_USDHC_BUS_CLK_ROOT, BUS_CLOCK_SLICE, 2,
+        {OSC_24M_CLK, SYSTEM_PLL1_266M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL2_200M_CLK, SYSTEM_PLL1_133M_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL2_250M_CLK, AUDIO_PLL1_CLK}
+       },
+       {VPU_BUS_CLK_ROOT, BUS_CLOCK_SLICE, 3,
+        {OSC_24M_CLK, SYSTEM_PLL1_800M_CLK, VPU_PLL_CLK,
+         AUDIO_PLL2_CLK, SYSTEM_PLL3_CLK, SYSTEM_PLL2_1000M_CLK,
+         SYSTEM_PLL2_200M_CLK, SYSTEM_PLL1_100M_CLK}
+       },
+       {DISPLAY_AXI_CLK_ROOT, BUS_CLOCK_SLICE, 4,
+        {OSC_24M_CLK, SYSTEM_PLL2_1000M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL1_40M_CLK, AUDIO_PLL2_CLK,
+         EXT_CLK_1, EXT_CLK_4}
+       },
+       {DISPLAY_APB_CLK_ROOT, BUS_CLOCK_SLICE, 5,
+        {OSC_24M_CLK, SYSTEM_PLL2_125M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL1_40M_CLK, AUDIO_PLL2_CLK,
+         EXT_CLK_1, EXT_CLK_3}
+       },
+       {DISPLAY_RTRM_CLK_ROOT, BUS_CLOCK_SLICE, 6,
+        {OSC_24M_CLK, SYSTEM_PLL1_800M_CLK, SYSTEM_PLL2_200M_CLK,
+         SYSTEM_PLL2_1000M_CLK, AUDIO_PLL1_CLK, VIDEO_PLL_CLK,
+         EXT_CLK_2, EXT_CLK_3}
+       },
+       {USB_BUS_CLK_ROOT, BUS_CLOCK_SLICE, 7,
+        {OSC_24M_CLK, SYSTEM_PLL2_500M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL2_100M_CLK, SYSTEM_PLL2_200M_CLK,
+         EXT_CLK_2, EXT_CLK_4, AUDIO_PLL2_CLK}
+       },
+       {GPU_AXI_CLK_ROOT, BUS_CLOCK_SLICE, 8,
+        {OSC_24M_CLK, SYSTEM_PLL1_800M_CLK, GPU_PLL_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL2_1000M_CLK,
+         AUDIO_PLL1_CLK, VIDEO_PLL_CLK, AUDIO_PLL2_CLK}
+       },
+       {GPU_AHB_CLK_ROOT, BUS_CLOCK_SLICE, 9,
+        {OSC_24M_CLK, SYSTEM_PLL1_800M_CLK, GPU_PLL_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL2_1000M_CLK,
+         AUDIO_PLL1_CLK, VIDEO_PLL_CLK, AUDIO_PLL2_CLK}
+       },
+       {NOC_CLK_ROOT, BUS_CLOCK_SLICE, 10,
+        {OSC_24M_CLK, SYSTEM_PLL1_800M_CLK, SYSTEM_PLL3_CLK,
+         SYSTEM_PLL2_1000M_CLK, SYSTEM_PLL2_500M_CLK,
+         AUDIO_PLL1_CLK, VIDEO_PLL_CLK, AUDIO_PLL2_CLK}
+       },
+       {NOC_APB_CLK_ROOT, BUS_CLOCK_SLICE, 11,
+        {OSC_24M_CLK, SYSTEM_PLL1_400M_CLK, SYSTEM_PLL3_CLK,
+         SYSTEM_PLL2_333M_CLK, SYSTEM_PLL2_200M_CLK,
+         SYSTEM_PLL1_800M_CLK, AUDIO_PLL1_CLK, VIDEO_PLL_CLK}
+       },
+       {AHB_CLK_ROOT, AHB_CLOCK_SLICE, 0,
+        {OSC_24M_CLK, SYSTEM_PLL1_133M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL1_400M_CLK, SYSTEM_PLL2_125M_CLK,
+         SYSTEM_PLL3_CLK, AUDIO_PLL1_CLK, VIDEO_PLL_CLK}
+       },
+       {AUDIO_AHB_CLK_ROOT, AHB_CLOCK_SLICE, 1,
+        {OSC_24M_CLK, SYSTEM_PLL2_500M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL2_1000M_CLK, SYSTEM_PLL2_166M_CLK,
+         SYSTEM_PLL3_CLK, AUDIO_PLL1_CLK, VIDEO_PLL_CLK}
+       },
+       {MIPI_DSI_ESC_RX_CLK_ROOT, AHB_CLOCK_SLICE, 2,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_80M_CLK,
+         SYSTEM_PLL1_800M_CLK, SYSTEM_PLL2_1000M_CLK,
+         SYSTEM_PLL3_CLK, EXT_CLK_3, AUDIO_PLL2_CLK}
+       },
+       {DRAM_ALT_CLK_ROOT, IP_CLOCK_SLICE, 0,
+        {OSC_24M_CLK, SYSTEM_PLL1_800M_CLK, SYSTEM_PLL1_100M_CLK,
+         SYSTEM_PLL2_500M_CLK, SYSTEM_PLL2_1000M_CLK,
+         SYSTEM_PLL3_CLK, AUDIO_PLL1_CLK, SYSTEM_PLL1_266M_CLK}
+       },
+       {DRAM_APB_CLK_ROOT, IP_CLOCK_SLICE, 1,
+        {OSC_24M_CLK, SYSTEM_PLL2_200M_CLK, SYSTEM_PLL1_40M_CLK,
+         SYSTEM_PLL1_160M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL2_250M_CLK, AUDIO_PLL2_CLK}
+       },
+       {VPU_G1_CLK_ROOT, IP_CLOCK_SLICE, 2,
+        {OSC_24M_CLK, VPU_PLL_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL2_1000M_CLK, SYSTEM_PLL1_100M_CLK,
+         SYSTEM_PLL2_125M_CLK, SYSTEM_PLL3_CLK, AUDIO_PLL1_CLK}
+       },
+       {VPU_G2_CLK_ROOT, IP_CLOCK_SLICE, 3,
+        {OSC_24M_CLK, VPU_PLL_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL2_1000M_CLK, SYSTEM_PLL1_100M_CLK,
+         SYSTEM_PLL2_125M_CLK, SYSTEM_PLL3_CLK, AUDIO_PLL1_CLK}
+       },
+       {DISPLAY_DTRC_CLK_ROOT, IP_CLOCK_SLICE, 4,
+        {OSC_24M_CLK, VIDEO_PLL2_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL2_1000M_CLK, SYSTEM_PLL1_160M_CLK,
+         VIDEO_PLL_CLK, SYSTEM_PLL3_CLK, AUDIO_PLL2_CLK}
+       },
+       {DISPLAY_DC8000_CLK_ROOT, IP_CLOCK_SLICE, 5,
+        {OSC_24M_CLK, VIDEO_PLL2_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL2_1000M_CLK, SYSTEM_PLL1_160M_CLK,
+         VIDEO_PLL_CLK, SYSTEM_PLL3_CLK, AUDIO_PLL2_CLK}
+       },
+       {PCIE_CTRL_CLK_ROOT, IP_CLOCK_SLICE, 6,
+        {OSC_24M_CLK, SYSTEM_PLL2_250M_CLK, SYSTEM_PLL2_200M_CLK,
+         SYSTEM_PLL1_266M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL2_500M_CLK, SYSTEM_PLL2_333M_CLK, SYSTEM_PLL3_CLK}
+       },
+       {PCIE_PHY_CLK_ROOT, IP_CLOCK_SLICE, 7,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, SYSTEM_PLL2_500M_CLK,
+         EXT_CLK_1, EXT_CLK_2, EXT_CLK_3, EXT_CLK_4,
+         SYSTEM_PLL1_400M_CLK}
+       },
+       {PCIE_AUX_CLK_ROOT, IP_CLOCK_SLICE, 8,
+        {OSC_24M_CLK, SYSTEM_PLL2_200M_CLK, SYSTEM_PLL2_50M_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_80M_CLK,
+         SYSTEM_PLL1_160M_CLK, SYSTEM_PLL1_200M_CLK}
+       },
+       {DC_PIXEL_CLK_ROOT, IP_CLOCK_SLICE, 9,
+        {OSC_24M_CLK, VIDEO_PLL_CLK, AUDIO_PLL2_CLK,
+         AUDIO_PLL1_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL2_1000M_CLK, SYSTEM_PLL3_CLK, EXT_CLK_4}
+       },
+       {LCDIF_PIXEL_CLK_ROOT, IP_CLOCK_SLICE, 10,
+        {OSC_24M_CLK, VIDEO_PLL_CLK, AUDIO_PLL2_CLK,
+         AUDIO_PLL1_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL2_1000M_CLK, SYSTEM_PLL3_CLK, EXT_CLK_4}
+       },
+       {SAI1_CLK_ROOT, IP_CLOCK_SLICE, 11,
+        {OSC_24M_CLK, AUDIO_PLL1_CLK, AUDIO_PLL2_CLK,
+         VIDEO_PLL_CLK, SYSTEM_PLL1_133M_CLK,
+         OSC_HDMI_CLK, EXT_CLK_1, EXT_CLK_2}
+       },
+       {SAI2_CLK_ROOT, IP_CLOCK_SLICE, 12,
+        {OSC_24M_CLK, AUDIO_PLL1_CLK, AUDIO_PLL2_CLK,
+         VIDEO_PLL_CLK, SYSTEM_PLL1_133M_CLK,
+         OSC_HDMI_CLK, EXT_CLK_2, EXT_CLK_3}
+       },
+       {SAI3_CLK_ROOT, IP_CLOCK_SLICE, 13,
+        {OSC_24M_CLK, AUDIO_PLL1_CLK, AUDIO_PLL2_CLK,
+         VIDEO_PLL_CLK, SYSTEM_PLL1_133M_CLK,
+         OSC_HDMI_CLK, EXT_CLK_3, EXT_CLK_4}
+       },
+       {SAI4_CLK_ROOT, IP_CLOCK_SLICE, 14,
+        {OSC_24M_CLK, AUDIO_PLL1_CLK, AUDIO_PLL2_CLK,
+         VIDEO_PLL_CLK, SYSTEM_PLL1_133M_CLK,
+         OSC_HDMI_CLK, EXT_CLK_1, EXT_CLK_2}
+       },
+       {SAI5_CLK_ROOT, IP_CLOCK_SLICE, 15,
+        {OSC_24M_CLK, AUDIO_PLL1_CLK, AUDIO_PLL2_CLK,
+         VIDEO_PLL_CLK, SYSTEM_PLL1_133M_CLK,
+         OSC_HDMI_CLK, EXT_CLK_2, EXT_CLK_3}
+       },
+       {SAI6_CLK_ROOT, IP_CLOCK_SLICE, 16,
+        {OSC_24M_CLK, AUDIO_PLL1_CLK, AUDIO_PLL2_CLK,
+         VIDEO_PLL_CLK, SYSTEM_PLL1_133M_CLK,
+         OSC_HDMI_CLK, EXT_CLK_3, EXT_CLK_4}
+       },
+       {SPDIF1_CLK_ROOT, IP_CLOCK_SLICE, 17,
+        {OSC_24M_CLK, AUDIO_PLL1_CLK, AUDIO_PLL2_CLK,
+         VIDEO_PLL_CLK, SYSTEM_PLL1_133M_CLK,
+         OSC_HDMI_CLK, EXT_CLK_2, EXT_CLK_3}
+       },
+       {SPDIF2_CLK_ROOT, IP_CLOCK_SLICE, 18,
+        {OSC_24M_CLK, AUDIO_PLL1_CLK, AUDIO_PLL2_CLK,
+         VIDEO_PLL_CLK, SYSTEM_PLL1_133M_CLK,
+         OSC_HDMI_CLK, EXT_CLK_3, EXT_CLK_4}
+       },
+       {ENET_REF_CLK_ROOT, IP_CLOCK_SLICE, 19,
+        {OSC_24M_CLK, SYSTEM_PLL2_125M_CLK, SYSTEM_PLL2_50M_CLK,
+         SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_160M_CLK,
+         AUDIO_PLL1_CLK, VIDEO_PLL_CLK, EXT_CLK_4}
+       },
+       {ENET_TIMER_CLK_ROOT, IP_CLOCK_SLICE, 20,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, AUDIO_PLL1_CLK,
+         EXT_CLK_1, EXT_CLK_2, EXT_CLK_3, EXT_CLK_4,
+         VIDEO_PLL_CLK}
+       },
+       {ENET_PHY_REF_CLK_ROOT, IP_CLOCK_SLICE, 21,
+        {OSC_24M_CLK, SYSTEM_PLL2_50M_CLK, SYSTEM_PLL2_125M_CLK,
+         SYSTEM_PLL2_200M_CLK, SYSTEM_PLL2_500M_CLK,
+         AUDIO_PLL1_CLK, VIDEO_PLL_CLK, AUDIO_PLL2_CLK}
+       },
+       {NAND_CLK_ROOT, IP_CLOCK_SLICE, 22,
+        {OSC_24M_CLK, SYSTEM_PLL2_500M_CLK, AUDIO_PLL1_CLK,
+         SYSTEM_PLL1_400M_CLK, AUDIO_PLL2_CLK, SYSTEM_PLL3_CLK,
+         SYSTEM_PLL2_250M_CLK, VIDEO_PLL_CLK}
+       },
+       {QSPI_CLK_ROOT, IP_CLOCK_SLICE, 23,
+        {OSC_24M_CLK, SYSTEM_PLL1_400M_CLK, SYSTEM_PLL2_333M_CLK,
+         SYSTEM_PLL2_500M_CLK, AUDIO_PLL2_CLK,
+         SYSTEM_PLL1_266M_CLK, SYSTEM_PLL3_CLK, SYSTEM_PLL1_100M_CLK}
+       },
+       {USDHC1_CLK_ROOT, IP_CLOCK_SLICE, 24,
+        {OSC_24M_CLK, SYSTEM_PLL1_400M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL2_500M_CLK, SYSTEM_PLL3_CLK,
+         SYSTEM_PLL1_266M_CLK, AUDIO_PLL2_CLK, SYSTEM_PLL1_100M_CLK}
+       },
+       {USDHC2_CLK_ROOT, IP_CLOCK_SLICE, 25,
+        {OSC_24M_CLK, SYSTEM_PLL1_400M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL2_500M_CLK, SYSTEM_PLL3_CLK,
+         SYSTEM_PLL1_266M_CLK, AUDIO_PLL2_CLK, SYSTEM_PLL1_100M_CLK}
+       },
+       {I2C1_CLK_ROOT, IP_CLOCK_SLICE, 26,
+        {OSC_24M_CLK, SYSTEM_PLL1_160M_CLK, SYSTEM_PLL2_50M_CLK,
+         SYSTEM_PLL3_CLK, AUDIO_PLL1_CLK, VIDEO_PLL_CLK,
+         AUDIO_PLL2_CLK, SYSTEM_PLL1_133M_CLK}
+       },
+       {I2C2_CLK_ROOT, IP_CLOCK_SLICE, 27,
+        {OSC_24M_CLK, SYSTEM_PLL1_160M_CLK, SYSTEM_PLL2_50M_CLK,
+         SYSTEM_PLL3_CLK, AUDIO_PLL1_CLK, VIDEO_PLL_CLK,
+         AUDIO_PLL2_CLK, SYSTEM_PLL1_133M_CLK}
+       },
+       {I2C3_CLK_ROOT, IP_CLOCK_SLICE, 28,
+        {OSC_24M_CLK, SYSTEM_PLL1_160M_CLK, SYSTEM_PLL2_50M_CLK,
+         SYSTEM_PLL3_CLK, AUDIO_PLL1_CLK, VIDEO_PLL_CLK,
+         AUDIO_PLL2_CLK, SYSTEM_PLL1_133M_CLK}
+       },
+       {I2C4_CLK_ROOT, IP_CLOCK_SLICE, 29,
+        {OSC_24M_CLK, SYSTEM_PLL1_160M_CLK, SYSTEM_PLL2_50M_CLK,
+         SYSTEM_PLL3_CLK, AUDIO_PLL1_CLK, VIDEO_PLL_CLK,
+         AUDIO_PLL2_CLK, SYSTEM_PLL1_133M_CLK}
+       },
+       {UART1_CLK_ROOT, IP_CLOCK_SLICE, 30,
+        {OSC_24M_CLK, SYSTEM_PLL1_80M_CLK, SYSTEM_PLL2_200M_CLK,
+         SYSTEM_PLL2_100M_CLK, SYSTEM_PLL3_CLK,
+         EXT_CLK_2, EXT_CLK_4, AUDIO_PLL2_CLK}
+       },
+       {UART2_CLK_ROOT, IP_CLOCK_SLICE, 31,
+        {OSC_24M_CLK, SYSTEM_PLL1_80M_CLK, SYSTEM_PLL2_200M_CLK,
+         SYSTEM_PLL2_100M_CLK, SYSTEM_PLL3_CLK,
+         EXT_CLK_2, EXT_CLK_3, AUDIO_PLL2_CLK}
+       },
+       {UART3_CLK_ROOT, IP_CLOCK_SLICE, 32,
+        {OSC_24M_CLK, SYSTEM_PLL1_80M_CLK, SYSTEM_PLL2_200M_CLK,
+         SYSTEM_PLL2_100M_CLK, SYSTEM_PLL3_CLK,
+         EXT_CLK_2, EXT_CLK_4, AUDIO_PLL2_CLK}
+       },
+       {UART4_CLK_ROOT, IP_CLOCK_SLICE, 33,
+        {OSC_24M_CLK, SYSTEM_PLL1_80M_CLK, SYSTEM_PLL2_200M_CLK,
+         SYSTEM_PLL2_100M_CLK, SYSTEM_PLL3_CLK,
+         EXT_CLK_2, EXT_CLK_3, AUDIO_PLL2_CLK}
+       },
+       {USB_CORE_REF_CLK_ROOT, IP_CLOCK_SLICE, 34,
+        {OSC_24M_CLK, SYSTEM_PLL1_100M_CLK, SYSTEM_PLL1_40M_CLK,
+         SYSTEM_PLL2_100M_CLK, SYSTEM_PLL2_200M_CLK,
+         EXT_CLK_2, EXT_CLK_3, AUDIO_PLL2_CLK}
+       },
+       {USB_PHY_REF_CLK_ROOT, IP_CLOCK_SLICE, 35,
+        {OSC_24M_CLK, SYSTEM_PLL1_100M_CLK, SYSTEM_PLL1_40M_CLK,
+         SYSTEM_PLL2_100M_CLK, SYSTEM_PLL2_200M_CLK,
+         EXT_CLK_2, EXT_CLK_3, AUDIO_PLL2_CLK}
+       },
+       {GIC_CLK_ROOT, IP_CLOCK_SLICE, 36,
+        {OSC_24M_CLK, SYSTEM_PLL2_200M_CLK, SYSTEM_PLL1_40M_CLK,
+         SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_800M_CLK,
+         EXT_CLK_2, EXT_CLK_4, AUDIO_PLL2_CLK}
+       },
+       {ECSPI1_CLK_ROOT, IP_CLOCK_SLICE, 37,
+        {OSC_24M_CLK, SYSTEM_PLL2_200M_CLK, SYSTEM_PLL1_40M_CLK,
+         SYSTEM_PLL1_160M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL2_250M_CLK, AUDIO_PLL2_CLK}
+       },
+       {ECSPI2_CLK_ROOT, IP_CLOCK_SLICE, 38,
+        {OSC_24M_CLK, SYSTEM_PLL2_200M_CLK, SYSTEM_PLL1_40M_CLK,
+         SYSTEM_PLL1_160M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL2_250M_CLK, AUDIO_PLL2_CLK}
+       },
+       {PWM1_CLK_ROOT, IP_CLOCK_SLICE, 39,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_160M_CLK,
+         SYSTEM_PLL1_40M_CLK, SYSTEM_PLL3_CLK, EXT_CLK_1,
+         SYSTEM_PLL1_80M_CLK, VIDEO_PLL_CLK}
+       },
+       {PWM2_CLK_ROOT, IP_CLOCK_SLICE, 40,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_160M_CLK,
+         SYSTEM_PLL1_40M_CLK, SYSTEM_PLL3_CLK, EXT_CLK_1,
+         SYSTEM_PLL1_80M_CLK, VIDEO_PLL_CLK}
+       },
+       {PWM3_CLK_ROOT, IP_CLOCK_SLICE, 41,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_160M_CLK,
+         SYSTEM_PLL1_40M_CLK, SYSTEM_PLL3_CLK, EXT_CLK_2,
+         SYSTEM_PLL1_80M_CLK, VIDEO_PLL_CLK}
+       },
+       {PWM4_CLK_ROOT, IP_CLOCK_SLICE, 42,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_160M_CLK,
+         SYSTEM_PLL1_40M_CLK, SYSTEM_PLL3_CLK, EXT_CLK_2,
+         SYSTEM_PLL1_80M_CLK, VIDEO_PLL_CLK}
+       },
+       {GPT1_CLK_ROOT, IP_CLOCK_SLICE, 43,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_400M_CLK,
+         SYSTEM_PLL1_40M_CLK, VIDEO_PLL_CLK,
+         SYSTEM_PLL1_80M_CLK, AUDIO_PLL1_CLK, EXT_CLK_1}
+       },
+       {GPT2_CLK_ROOT, IP_CLOCK_SLICE, 44,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_400M_CLK,
+         SYSTEM_PLL1_40M_CLK, VIDEO_PLL_CLK,
+         SYSTEM_PLL1_80M_CLK, AUDIO_PLL1_CLK, EXT_CLK_2}
+       },
+       {GPT3_CLK_ROOT, IP_CLOCK_SLICE, 45,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_400M_CLK,
+         SYSTEM_PLL1_40M_CLK, VIDEO_PLL_CLK,
+         SYSTEM_PLL1_80M_CLK, AUDIO_PLL1_CLK, EXT_CLK_3}
+       },
+       {GPT4_CLK_ROOT, IP_CLOCK_SLICE, 46,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_400M_CLK,
+         SYSTEM_PLL1_40M_CLK, VIDEO_PLL_CLK,
+         SYSTEM_PLL1_80M_CLK, AUDIO_PLL1_CLK, EXT_CLK_1}
+       },
+       {GPT5_CLK_ROOT, IP_CLOCK_SLICE, 47,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_400M_CLK,
+         SYSTEM_PLL1_40M_CLK, VIDEO_PLL_CLK,
+         SYSTEM_PLL1_80M_CLK, AUDIO_PLL1_CLK, EXT_CLK_2}
+       },
+       {GPT6_CLK_ROOT, IP_CLOCK_SLICE, 48,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_400M_CLK,
+         SYSTEM_PLL1_40M_CLK, VIDEO_PLL_CLK,
+         SYSTEM_PLL1_80M_CLK, AUDIO_PLL1_CLK, EXT_CLK_3}
+       },
+       {TRACE_CLK_ROOT, IP_CLOCK_SLICE, 49,
+        {OSC_24M_CLK, SYSTEM_PLL1_133M_CLK, SYSTEM_PLL1_160M_CLK,
+         VPU_PLL_CLK, SYSTEM_PLL2_125M_CLK,
+         SYSTEM_PLL3_CLK, EXT_CLK_1, EXT_CLK_3}
+       },
+       {WDOG_CLK_ROOT, IP_CLOCK_SLICE, 50,
+        {OSC_24M_CLK, SYSTEM_PLL1_133M_CLK, SYSTEM_PLL1_160M_CLK,
+         VPU_PLL_CLK, SYSTEM_PLL2_125M_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL1_80M_CLK, SYSTEM_PLL2_166M_CLK}
+       },
+       {WRCLK_CLK_ROOT, IP_CLOCK_SLICE, 51,
+        {OSC_24M_CLK, SYSTEM_PLL1_40M_CLK, VPU_PLL_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL2_200M_CLK,
+         SYSTEM_PLL1_266M_CLK, SYSTEM_PLL2_500M_CLK, SYSTEM_PLL1_100M_CLK}
+       },
+       {IPP_DO_CLKO1, IP_CLOCK_SLICE, 52,
+        {OSC_24M_CLK, SYSTEM_PLL1_800M_CLK, OSC_HDMI_CLK,
+         SYSTEM_PLL1_200M_CLK, AUDIO_PLL2_CLK,
+         SYSTEM_PLL2_500M_CLK, VPU_PLL_CLK, SYSTEM_PLL1_80M_CLK}
+       },
+       {IPP_DO_CLKO2, IP_CLOCK_SLICE, 53,
+        {OSC_24M_CLK, SYSTEM_PLL2_200M_CLK, SYSTEM_PLL1_400M_CLK,
+         SYSTEM_PLL2_166M_CLK, SYSTEM_PLL3_CLK,
+         AUDIO_PLL1_CLK, VIDEO_PLL_CLK, OSC_32K_CLK}
+       },
+       {MIPI_DSI_CORE_CLK_ROOT, IP_CLOCK_SLICE, 54,
+        {OSC_24M_CLK, SYSTEM_PLL1_266M_CLK, SYSTEM_PLL2_250M_CLK,
+         SYSTEM_PLL1_800M_CLK, SYSTEM_PLL2_1000M_CLK,
+         SYSTEM_PLL3_CLK, AUDIO_PLL2_CLK, VIDEO_PLL_CLK}
+       },
+       {MIPI_DSI_PHY_REF_CLK_ROOT, IP_CLOCK_SLICE, 55,
+        {OSC_24M_CLK, SYSTEM_PLL2_125M_CLK, SYSTEM_PLL2_100M_CLK,
+         SYSTEM_PLL1_800M_CLK, SYSTEM_PLL2_1000M_CLK,
+         EXT_CLK_2, AUDIO_PLL2_CLK, VIDEO_PLL_CLK}
+       },
+       {MIPI_DSI_DBI_CLK_ROOT, IP_CLOCK_SLICE, 56,
+        {OSC_24M_CLK, SYSTEM_PLL1_266M_CLK, SYSTEM_PLL2_100M_CLK,
+         SYSTEM_PLL1_800M_CLK, SYSTEM_PLL2_1000M_CLK,
+         SYSTEM_PLL3_CLK, AUDIO_PLL2_CLK, VIDEO_PLL_CLK}
+       },
+       {USDHC3_CLK_ROOT, IP_CLOCK_SLICE, 57,
+        {OSC_24M_CLK, SYSTEM_PLL1_400M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL2_500M_CLK, SYSTEM_PLL3_CLK,
+         SYSTEM_PLL1_266M_CLK, AUDIO_PLL2_CLK, SYSTEM_PLL1_100M_CLK}
+       },
+       {MIPI_CSI1_CORE_CLK_ROOT, IP_CLOCK_SLICE, 58,
+        {OSC_24M_CLK, SYSTEM_PLL1_266M_CLK, SYSTEM_PLL2_250M_CLK,
+         SYSTEM_PLL1_800M_CLK, SYSTEM_PLL2_1000M_CLK,
+         SYSTEM_PLL3_CLK, AUDIO_PLL2_CLK, VIDEO_PLL_CLK}
+       },
+       {MIPI_CSI1_PHY_REF_CLK_ROOT, IP_CLOCK_SLICE, 59,
+        {OSC_24M_CLK, SYSTEM_PLL2_333M_CLK, SYSTEM_PLL2_100M_CLK,
+         SYSTEM_PLL1_800M_CLK, SYSTEM_PLL2_1000M_CLK,
+         EXT_CLK_2, AUDIO_PLL2_CLK, VIDEO_PLL_CLK}
+       },
+       {MIPI_CSI1_ESC_CLK_ROOT, IP_CLOCK_SLICE, 60,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_80M_CLK,
+         SYSTEM_PLL1_800M_CLK, SYSTEM_PLL2_1000M_CLK,
+         SYSTEM_PLL3_CLK, EXT_CLK_3, AUDIO_PLL2_CLK}
+       },
+       {MIPI_CSI2_CORE_CLK_ROOT, IP_CLOCK_SLICE, 61,
+        {OSC_24M_CLK, SYSTEM_PLL1_266M_CLK, SYSTEM_PLL2_250M_CLK,
+         SYSTEM_PLL1_800M_CLK, SYSTEM_PLL2_1000M_CLK,
+         SYSTEM_PLL3_CLK, AUDIO_PLL2_CLK, VIDEO_PLL_CLK}
+       },
+       {MIPI_CSI2_PHY_REF_CLK_ROOT, IP_CLOCK_SLICE, 62,
+        {OSC_24M_CLK, SYSTEM_PLL2_333M_CLK, SYSTEM_PLL2_100M_CLK,
+         SYSTEM_PLL1_800M_CLK, SYSTEM_PLL2_1000M_CLK,
+         EXT_CLK_2, AUDIO_PLL2_CLK, VIDEO_PLL_CLK}
+       },
+       {MIPI_CSI2_ESC_CLK_ROOT, IP_CLOCK_SLICE, 63,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_80M_CLK,
+         SYSTEM_PLL1_800M_CLK, SYSTEM_PLL2_1000M_CLK,
+         SYSTEM_PLL3_CLK, EXT_CLK_3, AUDIO_PLL2_CLK}
+       },
+       {PCIE2_CTRL_CLK_ROOT, IP_CLOCK_SLICE, 64,
+        {OSC_24M_CLK, SYSTEM_PLL2_250M_CLK, SYSTEM_PLL2_200M_CLK,
+         SYSTEM_PLL1_266M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL2_500M_CLK, SYSTEM_PLL2_333M_CLK, SYSTEM_PLL3_CLK}
+       },
+       {PCIE2_PHY_CLK_ROOT, IP_CLOCK_SLICE, 65,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, SYSTEM_PLL2_500M_CLK,
+         EXT_CLK_1, EXT_CLK_2, EXT_CLK_3,
+         EXT_CLK_4, SYSTEM_PLL1_400M_CLK}
+       },
+       {PCIE2_AUX_CLK_ROOT, IP_CLOCK_SLICE, 66,
+        {OSC_24M_CLK, SYSTEM_PLL2_200M_CLK, SYSTEM_PLL2_50M_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL2_100M_CLK,
+         SYSTEM_PLL1_80M_CLK, SYSTEM_PLL1_160M_CLK, SYSTEM_PLL1_200M_CLK}
+       },
+       {ECSPI3_CLK_ROOT, IP_CLOCK_SLICE, 67,
+        {OSC_24M_CLK, SYSTEM_PLL2_200M_CLK, SYSTEM_PLL1_40M_CLK,
+         SYSTEM_PLL1_160M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL2_250M_CLK, AUDIO_PLL2_CLK}
+       },
+       {PDM_CLK_ROOT, IP_CLOCK_SLICE, 68,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, AUDIO_PLL1_CLK,
+         SYSTEM_PLL1_800M_CLK, SYSTEM_PLL2_1000M_CLK,
+         SYSTEM_PLL3_CLK, EXT_CLK_3, AUDIO_PLL2_CLK},
+       },
+       {VPU_H1_CLK_ROOT, IP_CLOCK_SLICE, 69,
+        {OSC_24M_CLK, VPU_PLL_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL2_1000M_CLK, AUDIO_PLL2_CLK,
+         SYSTEM_PLL2_125M_CLK, SYSTEM_PLL3_CLK, AUDIO_PLL1_CLK}
+       },
+       {DRAM_SEL_CFG, DRAM_SEL_CLOCK_SLICE, 0,
         {DRAM_PLL1_CLK}
        },
+       {CORE_SEL_CFG, CORE_SEL_CLOCK_SLICE, 0,
+        {ARM_A53_ALT_CLK, ARM_PLL_CLK}
+       },
 };
-#elif defined(CONFIG_IMX8MM) || defined(CONFIG_IMX8MN)
+#elif defined(CONFIG_IMX8MN)
 static struct clk_root_map root_array[] = {
        {ARM_A53_CLK_ROOT, CORE_CLOCK_SLICE, 0,
         {OSC_24M_CLK, ARM_PLL_CLK, SYSTEM_PLL2_500M_CLK,
          SYSTEM_PLL2_1000M_CLK, SYSTEM_PLL1_800M_CLK,
          SYSTEM_PLL1_400M_CLK, AUDIO_PLL1_CLK, SYSTEM_PLL3_CLK}
        },
-       {NAND_USDHC_BUS_CLK_ROOT, BUS_CLOCK_SLICE, 2,
-        {OSC_24M_CLK, SYSTEM_PLL1_266M_CLK, SYSTEM_PLL1_800M_CLK,
-         SYSTEM_PLL2_200M_CLK, SYSTEM_PLL1_133M_CLK,
-         SYSTEM_PLL3_CLK, SYSTEM_PLL2_250M_CLK, AUDIO_PLL1_CLK}
+       {ARM_M7_CLK_ROOT, CORE_CLOCK_SLICE, 1,
+        {OSC_24M_CLK, SYSTEM_PLL2_200M_CLK, SYSTEM_PLL2_250M_CLK,
+         VPU_PLL_CLK, SYSTEM_PLL1_800M_CLK,
+         AUDIO_PLL1_CLK, VIDEO_PLL_CLK, SYSTEM_PLL3_CLK}
+       },
+       {GPU_CORE_CLK_ROOT, CORE_CLOCK_SLICE, 3,
+        {OSC_24M_CLK, GPU_PLL_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL2_1000M_CLK,
+         AUDIO_PLL1_CLK, VIDEO_PLL_CLK, AUDIO_PLL2_CLK}
+       },
+       {GPU_SHADER_CLK_ROOT, CORE_CLOCK_SLICE, 4,
+        {OSC_24M_CLK, GPU_PLL_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL2_1000M_CLK,
+         AUDIO_PLL1_CLK, VIDEO_PLL_CLK, AUDIO_PLL2_CLK}
+       },
+       {MAIN_AXI_CLK_ROOT, BUS_CLOCK_SLICE, 0,
+        {OSC_24M_CLK, SYSTEM_PLL2_333M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL2_250M_CLK, SYSTEM_PLL2_1000M_CLK,
+         AUDIO_PLL1_CLK, VIDEO_PLL_CLK, SYSTEM_PLL1_100M_CLK}
+       },
+       {ENET_AXI_CLK_ROOT, BUS_CLOCK_SLICE, 1,
+        {OSC_24M_CLK, SYSTEM_PLL1_266M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL2_250M_CLK, SYSTEM_PLL2_200M_CLK,
+         AUDIO_PLL1_CLK, VIDEO_PLL_CLK, SYSTEM_PLL3_CLK}
+       },
+       {NAND_USDHC_BUS_CLK_ROOT, BUS_CLOCK_SLICE, 2,
+        {OSC_24M_CLK, SYSTEM_PLL1_266M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL2_200M_CLK, SYSTEM_PLL1_133M_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL2_250M_CLK, AUDIO_PLL1_CLK}
+       },
+       {DISPLAY_AXI_CLK_ROOT, BUS_CLOCK_SLICE, 4,
+        {OSC_24M_CLK, SYSTEM_PLL2_1000M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL1_40M_CLK, AUDIO_PLL2_CLK,
+         EXT_CLK_1, EXT_CLK_4}
+       },
+       {DISPLAY_APB_CLK_ROOT, BUS_CLOCK_SLICE, 5,
+        {OSC_24M_CLK, SYSTEM_PLL2_125M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL1_40M_CLK, AUDIO_PLL2_CLK,
+         EXT_CLK_1, EXT_CLK_3}
+       },
+       {USB_BUS_CLK_ROOT, BUS_CLOCK_SLICE, 7,
+        {OSC_24M_CLK, SYSTEM_PLL2_500M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL2_100M_CLK, SYSTEM_PLL2_200M_CLK,
+         EXT_CLK_2, EXT_CLK_4, AUDIO_PLL2_CLK}
+       },
+       {GPU_AXI_CLK_ROOT, BUS_CLOCK_SLICE, 8,
+        {OSC_24M_CLK, SYSTEM_PLL1_800M_CLK, GPU_PLL_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL2_1000M_CLK,
+         AUDIO_PLL1_CLK, VIDEO_PLL_CLK, AUDIO_PLL2_CLK}
+       },
+       {GPU_AHB_CLK_ROOT, BUS_CLOCK_SLICE, 9,
+        {OSC_24M_CLK, SYSTEM_PLL1_800M_CLK, GPU_PLL_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL2_1000M_CLK,
+         AUDIO_PLL1_CLK, VIDEO_PLL_CLK, AUDIO_PLL2_CLK}
        },
        {NOC_CLK_ROOT, BUS_CLOCK_SLICE, 10,
         {OSC_24M_CLK, SYSTEM_PLL1_800M_CLK, SYSTEM_PLL3_CLK,
          SYSTEM_PLL2_1000M_CLK, SYSTEM_PLL2_500M_CLK,
          AUDIO_PLL1_CLK, VIDEO_PLL_CLK, AUDIO_PLL2_CLK}
        },
-#ifdef CONFIG_IMX8MM
-       {NOC_APB_CLK_ROOT, BUS_CLOCK_SLICE, 11,
-        {OSC_24M_CLK, SYSTEM_PLL1_400M_CLK, SYSTEM_PLL3_CLK,
-         SYSTEM_PLL2_333M_CLK, SYSTEM_PLL2_200M_CLK,
-         SYSTEM_PLL1_800M_CLK, AUDIO_PLL1_CLK, VIDEO_PLL_CLK}
+       {AHB_CLK_ROOT, AHB_CLOCK_SLICE, 0,
+        {OSC_24M_CLK, SYSTEM_PLL1_133M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL1_400M_CLK, SYSTEM_PLL2_125M_CLK,
+         SYSTEM_PLL3_CLK, AUDIO_PLL1_CLK, VIDEO_PLL_CLK}
+       },
+       {AUDIO_AHB_CLK_ROOT, AHB_CLOCK_SLICE, 1,
+        {OSC_24M_CLK, SYSTEM_PLL2_500M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL2_1000M_CLK, SYSTEM_PLL2_166M_CLK,
+         SYSTEM_PLL3_CLK, AUDIO_PLL1_CLK, VIDEO_PLL_CLK}
        },
-#endif
        {DRAM_ALT_CLK_ROOT, IP_CLOCK_SLICE, 0,
         {OSC_24M_CLK, SYSTEM_PLL1_800M_CLK, SYSTEM_PLL1_100M_CLK,
          SYSTEM_PLL2_500M_CLK, SYSTEM_PLL2_1000M_CLK,
@@ -509,6 +1021,91 @@ static struct clk_root_map root_array[] = {
          SYSTEM_PLL1_160M_CLK, SYSTEM_PLL1_800M_CLK,
          SYSTEM_PLL3_CLK, SYSTEM_PLL2_250M_CLK, AUDIO_PLL2_CLK}
        },
+       {DISPLAY_PIXEL_CLK_ROOT, IP_CLOCK_SLICE, 10,
+        {OSC_24M_CLK, VIDEO_PLL_CLK, AUDIO_PLL2_CLK,
+         AUDIO_PLL1_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL2_1000M_CLK, SYSTEM_PLL3_CLK, EXT_CLK_4}
+       },
+       {SAI2_CLK_ROOT, IP_CLOCK_SLICE, 12,
+        {OSC_24M_CLK, AUDIO_PLL1_CLK, AUDIO_PLL2_CLK,
+         VIDEO_PLL_CLK, SYSTEM_PLL1_133M_CLK,
+         OSC_HDMI_CLK, EXT_CLK_2, EXT_CLK_3}
+       },
+       {SAI3_CLK_ROOT, IP_CLOCK_SLICE, 13,
+        {OSC_24M_CLK, AUDIO_PLL1_CLK, AUDIO_PLL2_CLK,
+         VIDEO_PLL_CLK, SYSTEM_PLL1_133M_CLK,
+         OSC_HDMI_CLK, EXT_CLK_3, EXT_CLK_4}
+       },
+       {SAI5_CLK_ROOT, IP_CLOCK_SLICE, 15,
+        {OSC_24M_CLK, AUDIO_PLL1_CLK, AUDIO_PLL2_CLK,
+         VIDEO_PLL_CLK, SYSTEM_PLL1_133M_CLK,
+         OSC_HDMI_CLK, EXT_CLK_2, EXT_CLK_3}
+       },
+       {SAI6_CLK_ROOT, IP_CLOCK_SLICE, 16,
+        {OSC_24M_CLK, AUDIO_PLL1_CLK, AUDIO_PLL2_CLK,
+         VIDEO_PLL_CLK, SYSTEM_PLL1_133M_CLK,
+         OSC_HDMI_CLK, EXT_CLK_3, EXT_CLK_4}
+       },
+       {SPDIF1_CLK_ROOT, IP_CLOCK_SLICE, 17,
+        {OSC_24M_CLK, AUDIO_PLL1_CLK, AUDIO_PLL2_CLK,
+         VIDEO_PLL_CLK, SYSTEM_PLL1_133M_CLK,
+         OSC_HDMI_CLK, EXT_CLK_2, EXT_CLK_3}
+       },
+       {ENET_REF_CLK_ROOT, IP_CLOCK_SLICE, 19,
+        {OSC_24M_CLK, SYSTEM_PLL2_125M_CLK, SYSTEM_PLL2_50M_CLK,
+         SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_160M_CLK,
+         AUDIO_PLL1_CLK, VIDEO_PLL_CLK, EXT_CLK_4}
+       },
+       {ENET_TIMER_CLK_ROOT, IP_CLOCK_SLICE, 20,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, AUDIO_PLL1_CLK,
+         EXT_CLK_1, EXT_CLK_2, EXT_CLK_3, EXT_CLK_4,
+         VIDEO_PLL_CLK}
+       },
+       {ENET_PHY_REF_CLK_ROOT, IP_CLOCK_SLICE, 21,
+        {OSC_24M_CLK, SYSTEM_PLL2_50M_CLK, SYSTEM_PLL2_125M_CLK,
+         SYSTEM_PLL2_200M_CLK, SYSTEM_PLL2_500M_CLK,
+         AUDIO_PLL1_CLK, VIDEO_PLL_CLK, AUDIO_PLL2_CLK}
+       },
+       {NAND_CLK_ROOT, IP_CLOCK_SLICE, 22,
+        {OSC_24M_CLK, SYSTEM_PLL2_500M_CLK, AUDIO_PLL1_CLK,
+         SYSTEM_PLL1_400M_CLK, AUDIO_PLL2_CLK, SYSTEM_PLL3_CLK,
+         SYSTEM_PLL2_250M_CLK, VIDEO_PLL_CLK}
+       },
+       {QSPI_CLK_ROOT, IP_CLOCK_SLICE, 23,
+        {OSC_24M_CLK, SYSTEM_PLL1_400M_CLK, SYSTEM_PLL2_333M_CLK,
+         SYSTEM_PLL2_500M_CLK, AUDIO_PLL2_CLK,
+         SYSTEM_PLL1_266M_CLK, SYSTEM_PLL3_CLK, SYSTEM_PLL1_100M_CLK}
+       },
+       {USDHC1_CLK_ROOT, IP_CLOCK_SLICE, 24,
+        {OSC_24M_CLK, SYSTEM_PLL1_400M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL2_500M_CLK, SYSTEM_PLL3_CLK,
+         SYSTEM_PLL1_266M_CLK, AUDIO_PLL2_CLK, SYSTEM_PLL1_100M_CLK}
+       },
+       {USDHC2_CLK_ROOT, IP_CLOCK_SLICE, 25,
+        {OSC_24M_CLK, SYSTEM_PLL1_400M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL2_500M_CLK, SYSTEM_PLL3_CLK,
+         SYSTEM_PLL1_266M_CLK, AUDIO_PLL2_CLK, SYSTEM_PLL1_100M_CLK}
+       },
+       {I2C1_CLK_ROOT, IP_CLOCK_SLICE, 26,
+        {OSC_24M_CLK, SYSTEM_PLL1_160M_CLK, SYSTEM_PLL2_50M_CLK,
+         SYSTEM_PLL3_CLK, AUDIO_PLL1_CLK, VIDEO_PLL_CLK,
+         AUDIO_PLL2_CLK, SYSTEM_PLL1_133M_CLK}
+       },
+       {I2C2_CLK_ROOT, IP_CLOCK_SLICE, 27,
+        {OSC_24M_CLK, SYSTEM_PLL1_160M_CLK, SYSTEM_PLL2_50M_CLK,
+         SYSTEM_PLL3_CLK, AUDIO_PLL1_CLK, VIDEO_PLL_CLK,
+         AUDIO_PLL2_CLK, SYSTEM_PLL1_133M_CLK}
+       },
+       {I2C3_CLK_ROOT, IP_CLOCK_SLICE, 28,
+        {OSC_24M_CLK, SYSTEM_PLL1_160M_CLK, SYSTEM_PLL2_50M_CLK,
+         SYSTEM_PLL3_CLK, AUDIO_PLL1_CLK, VIDEO_PLL_CLK,
+         AUDIO_PLL2_CLK, SYSTEM_PLL1_133M_CLK}
+       },
+       {I2C4_CLK_ROOT, IP_CLOCK_SLICE, 29,
+        {OSC_24M_CLK, SYSTEM_PLL1_160M_CLK, SYSTEM_PLL2_50M_CLK,
+         SYSTEM_PLL3_CLK, AUDIO_PLL1_CLK, VIDEO_PLL_CLK,
+         AUDIO_PLL2_CLK, SYSTEM_PLL1_133M_CLK}
+       },
        {UART1_CLK_ROOT, IP_CLOCK_SLICE, 30,
         {OSC_24M_CLK, SYSTEM_PLL1_80M_CLK, SYSTEM_PLL2_200M_CLK,
          SYSTEM_PLL2_100M_CLK, SYSTEM_PLL3_CLK,
@@ -529,19 +1126,167 @@ static struct clk_root_map root_array[] = {
          SYSTEM_PLL2_100M_CLK, SYSTEM_PLL3_CLK,
          EXT_CLK_2, EXT_CLK_3, AUDIO_PLL2_CLK}
        },
+       {USB_CORE_REF_CLK_ROOT, IP_CLOCK_SLICE, 34,
+        {OSC_24M_CLK, SYSTEM_PLL1_100M_CLK, SYSTEM_PLL1_40M_CLK,
+         SYSTEM_PLL2_100M_CLK, SYSTEM_PLL2_200M_CLK,
+         EXT_CLK_2, EXT_CLK_3, AUDIO_PLL2_CLK}
+       },
+       {USB_PHY_REF_CLK_ROOT, IP_CLOCK_SLICE, 35,
+        {OSC_24M_CLK, SYSTEM_PLL1_100M_CLK, SYSTEM_PLL1_40M_CLK,
+         SYSTEM_PLL2_100M_CLK, SYSTEM_PLL2_200M_CLK,
+         EXT_CLK_2, EXT_CLK_3, AUDIO_PLL2_CLK}
+       },
        {GIC_CLK_ROOT, IP_CLOCK_SLICE, 36,
         {OSC_24M_CLK, SYSTEM_PLL2_200M_CLK, SYSTEM_PLL1_40M_CLK,
          SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_800M_CLK,
          EXT_CLK_2, EXT_CLK_4, AUDIO_PLL2_CLK}
        },
+       {ECSPI1_CLK_ROOT, IP_CLOCK_SLICE, 37,
+        {OSC_24M_CLK, SYSTEM_PLL2_200M_CLK, SYSTEM_PLL1_40M_CLK,
+         SYSTEM_PLL1_160M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL2_250M_CLK, AUDIO_PLL2_CLK}
+       },
+       {ECSPI2_CLK_ROOT, IP_CLOCK_SLICE, 38,
+        {OSC_24M_CLK, SYSTEM_PLL2_200M_CLK, SYSTEM_PLL1_40M_CLK,
+         SYSTEM_PLL1_160M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL2_250M_CLK, AUDIO_PLL2_CLK}
+       },
+       {PWM1_CLK_ROOT, IP_CLOCK_SLICE, 39,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_160M_CLK,
+         SYSTEM_PLL1_40M_CLK, SYSTEM_PLL3_CLK, EXT_CLK_1,
+         SYSTEM_PLL1_80M_CLK, VIDEO_PLL_CLK}
+       },
+       {PWM2_CLK_ROOT, IP_CLOCK_SLICE, 40,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_160M_CLK,
+         SYSTEM_PLL1_40M_CLK, SYSTEM_PLL3_CLK, EXT_CLK_1,
+         SYSTEM_PLL1_80M_CLK, VIDEO_PLL_CLK}
+       },
+       {PWM3_CLK_ROOT, IP_CLOCK_SLICE, 41,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_160M_CLK,
+         SYSTEM_PLL1_40M_CLK, SYSTEM_PLL3_CLK, EXT_CLK_2,
+         SYSTEM_PLL1_80M_CLK, VIDEO_PLL_CLK}
+       },
+       {PWM4_CLK_ROOT, IP_CLOCK_SLICE, 42,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_160M_CLK,
+         SYSTEM_PLL1_40M_CLK, SYSTEM_PLL3_CLK, EXT_CLK_2,
+         SYSTEM_PLL1_80M_CLK, VIDEO_PLL_CLK}
+       },
+       {GPT1_CLK_ROOT, IP_CLOCK_SLICE, 43,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_400M_CLK,
+         SYSTEM_PLL1_40M_CLK, VIDEO_PLL_CLK,
+         SYSTEM_PLL1_80M_CLK, AUDIO_PLL1_CLK, EXT_CLK_1}
+       },
+       {GPT2_CLK_ROOT, IP_CLOCK_SLICE, 44,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_400M_CLK,
+         SYSTEM_PLL1_40M_CLK, VIDEO_PLL_CLK,
+         SYSTEM_PLL1_80M_CLK, AUDIO_PLL1_CLK, EXT_CLK_2}
+       },
+       {GPT3_CLK_ROOT, IP_CLOCK_SLICE, 45,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_400M_CLK,
+         SYSTEM_PLL1_40M_CLK, VIDEO_PLL_CLK,
+         SYSTEM_PLL1_80M_CLK, AUDIO_PLL1_CLK, EXT_CLK_3}
+       },
+       {GPT4_CLK_ROOT, IP_CLOCK_SLICE, 46,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_400M_CLK,
+         SYSTEM_PLL1_40M_CLK, VIDEO_PLL_CLK,
+         SYSTEM_PLL1_80M_CLK, AUDIO_PLL1_CLK, EXT_CLK_1}
+       },
+       {GPT5_CLK_ROOT, IP_CLOCK_SLICE, 47,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_400M_CLK,
+         SYSTEM_PLL1_40M_CLK, VIDEO_PLL_CLK,
+         SYSTEM_PLL1_80M_CLK, AUDIO_PLL1_CLK, EXT_CLK_2}
+       },
+       {GPT6_CLK_ROOT, IP_CLOCK_SLICE, 48,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_400M_CLK,
+         SYSTEM_PLL1_40M_CLK, VIDEO_PLL_CLK,
+         SYSTEM_PLL1_80M_CLK, AUDIO_PLL1_CLK, EXT_CLK_3}
+       },
+       {TRACE_CLK_ROOT, IP_CLOCK_SLICE, 49,
+        {OSC_24M_CLK, SYSTEM_PLL1_133M_CLK, SYSTEM_PLL1_160M_CLK,
+         VPU_PLL_CLK, SYSTEM_PLL2_125M_CLK,
+         SYSTEM_PLL3_CLK, EXT_CLK_1, EXT_CLK_3}
+       },
        {WDOG_CLK_ROOT, IP_CLOCK_SLICE, 50,
         {OSC_24M_CLK, SYSTEM_PLL1_133M_CLK, SYSTEM_PLL1_160M_CLK,
          VPU_PLL_CLK, SYSTEM_PLL2_125M_CLK,
          SYSTEM_PLL3_CLK, SYSTEM_PLL1_80M_CLK, SYSTEM_PLL2_166M_CLK}
        },
+       {WRCLK_CLK_ROOT, IP_CLOCK_SLICE, 51,
+        {OSC_24M_CLK, SYSTEM_PLL1_40M_CLK, VPU_PLL_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL2_200M_CLK,
+         SYSTEM_PLL1_266M_CLK, SYSTEM_PLL2_500M_CLK, SYSTEM_PLL1_100M_CLK}
+       },
+       {IPP_DO_CLKO1, IP_CLOCK_SLICE, 52,
+        {OSC_24M_CLK, SYSTEM_PLL1_800M_CLK, OSC_HDMI_CLK,
+         SYSTEM_PLL1_200M_CLK, AUDIO_PLL2_CLK,
+         SYSTEM_PLL2_500M_CLK, VPU_PLL_CLK, SYSTEM_PLL1_80M_CLK}
+       },
+       {IPP_DO_CLKO2, IP_CLOCK_SLICE, 53,
+        {OSC_24M_CLK, SYSTEM_PLL2_200M_CLK, SYSTEM_PLL1_400M_CLK,
+         SYSTEM_PLL2_166M_CLK, SYSTEM_PLL3_CLK,
+         AUDIO_PLL1_CLK, VIDEO_PLL_CLK, OSC_32K_CLK}
+       },
+       {MIPI_DSI_CORE_CLK_ROOT, IP_CLOCK_SLICE, 54,
+        {OSC_24M_CLK, SYSTEM_PLL1_266M_CLK, SYSTEM_PLL2_250M_CLK,
+         SYSTEM_PLL1_800M_CLK, SYSTEM_PLL2_1000M_CLK,
+         SYSTEM_PLL3_CLK, AUDIO_PLL2_CLK, VIDEO_PLL_CLK}
+       },
+       {DISPLAY_DSI_PHY_REF_CLK_ROOT, IP_CLOCK_SLICE, 55,
+        {OSC_24M_CLK, SYSTEM_PLL2_125M_CLK, SYSTEM_PLL2_100M_CLK,
+         SYSTEM_PLL1_800M_CLK, SYSTEM_PLL2_1000M_CLK,
+         EXT_CLK_2, AUDIO_PLL2_CLK, VIDEO_PLL_CLK}
+       },
+       {MIPI_DSI_DBI_CLK_ROOT, IP_CLOCK_SLICE, 56,
+        {OSC_24M_CLK, SYSTEM_PLL1_266M_CLK, SYSTEM_PLL2_100M_CLK,
+         SYSTEM_PLL1_800M_CLK, SYSTEM_PLL2_1000M_CLK,
+         SYSTEM_PLL3_CLK, AUDIO_PLL2_CLK, VIDEO_PLL_CLK}
+       },
+       {USDHC3_CLK_ROOT, IP_CLOCK_SLICE, 57,
+        {OSC_24M_CLK, SYSTEM_PLL1_400M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL2_500M_CLK, SYSTEM_PLL3_CLK,
+         SYSTEM_PLL1_266M_CLK, AUDIO_PLL2_CLK, SYSTEM_PLL1_100M_CLK}
+       },
+       {DISPLAY_CAMERA_PIXEL_CLK_ROOT, IP_CLOCK_SLICE, 58,
+        {OSC_24M_CLK, SYSTEM_PLL1_266M_CLK, SYSTEM_PLL2_250M_CLK,
+         SYSTEM_PLL1_800M_CLK, SYSTEM_PLL2_1000M_CLK,
+         SYSTEM_PLL3_CLK, AUDIO_PLL2_CLK, VIDEO_PLL_CLK}
+       },
+       {MIPI_CSI1_PHY_REF_CLK_ROOT, IP_CLOCK_SLICE, 59,
+        {OSC_24M_CLK, SYSTEM_PLL2_333M_CLK, SYSTEM_PLL2_100M_CLK,
+         SYSTEM_PLL1_800M_CLK, SYSTEM_PLL2_1000M_CLK,
+         EXT_CLK_2, AUDIO_PLL2_CLK, VIDEO_PLL_CLK}
+       },
+       {MIPI_CSI2_PHY_REF_CLK_ROOT, IP_CLOCK_SLICE, 62,
+        {OSC_24M_CLK, SYSTEM_PLL2_333M_CLK, SYSTEM_PLL2_100M_CLK,
+         SYSTEM_PLL1_800M_CLK, SYSTEM_PLL2_1000M_CLK,
+         EXT_CLK_2, AUDIO_PLL2_CLK, VIDEO_PLL_CLK}
+       },
+       {MIPI_CSI2_ESC_CLK_ROOT, IP_CLOCK_SLICE, 63,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_80M_CLK,
+         SYSTEM_PLL1_800M_CLK, SYSTEM_PLL2_1000M_CLK,
+         SYSTEM_PLL3_CLK, EXT_CLK_3, AUDIO_PLL2_CLK}
+       },
+       {ECSPI3_CLK_ROOT, IP_CLOCK_SLICE, 67,
+        {OSC_24M_CLK, SYSTEM_PLL2_200M_CLK, SYSTEM_PLL1_40M_CLK,
+         SYSTEM_PLL1_160M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL2_250M_CLK, AUDIO_PLL2_CLK}
+       },
+       {PDM_CLK_ROOT, IP_CLOCK_SLICE, 68,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, AUDIO_PLL1_CLK,
+         SYSTEM_PLL1_800M_CLK, SYSTEM_PLL2_1000M_CLK,
+         SYSTEM_PLL3_CLK, EXT_CLK_3, AUDIO_PLL2_CLK},
+       },
+       {SAI7_CLK_ROOT, IP_CLOCK_SLICE, 70,
+        {OSC_24M_CLK, AUDIO_PLL1_CLK, AUDIO_PLL2_CLK,
+         VIDEO_PLL_CLK, SYSTEM_PLL1_133M_CLK,
+         OSC_HDMI_CLK, EXT_CLK_3, EXT_CLK_4}
+       },
        {DRAM_SEL_CFG, DRAM_SEL_CLOCK_SLICE, 0,
         {DRAM_PLL1_CLK}
        },
+       {CORE_SEL_CFG, CORE_SEL_CLOCK_SLICE, 0,
+        {ARM_A53_ALT_CLK, ARM_PLL_CLK}
+       },
 };
 #elif defined(CONFIG_IMX8MP)
 static struct clk_root_map root_array[] = {
@@ -580,6 +1325,26 @@ static struct clk_root_map root_array[] = {
          SYSTEM_PLL2_200M_CLK, SYSTEM_PLL1_133M_CLK,
          SYSTEM_PLL3_CLK, SYSTEM_PLL2_250M_CLK, AUDIO_PLL1_CLK}
        },
+       {MEDIA_AXI_CLK_ROOT, BUS_CLOCK_SLICE, 4,
+        {OSC_24M_CLK, SYSTEM_PLL2_1000M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL1_40M_CLK,
+         AUDIO_PLL2_CLK, EXT_CLK_1, SYSTEM_PLL2_500M_CLK}
+       },
+       {MEDIA_APB_CLK_ROOT, BUS_CLOCK_SLICE, 5,
+        {OSC_24M_CLK, SYSTEM_PLL2_125M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL1_40M_CLK,
+         AUDIO_PLL2_CLK, EXT_CLK_1, SYSTEM_PLL1_133M_CLK}
+       },
+       {HDMI_APB_CLK_ROOT, BUS_CLOCK_SLICE, 6,
+        {OSC_24M_CLK, SYSTEM_PLL2_125M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL1_40M_CLK,
+         AUDIO_PLL2_CLK, EXT_CLK_1, SYSTEM_PLL1_133M_CLK}
+       },
+       {HDMI_AXI_CLK_ROOT, BUS_CLOCK_SLICE, 7,
+        {OSC_24M_CLK, SYSTEM_PLL2_1000M_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL3_CLK, SYSTEM_PLL1_40M_CLK,
+         AUDIO_PLL2_CLK, EXT_CLK_1, SYSTEM_PLL2_500M_CLK}
+       },
        {NOC_CLK_ROOT, BUS_CLOCK_SLICE, 10,
         {OSC_24M_CLK, SYSTEM_PLL1_800M_CLK, SYSTEM_PLL3_CLK,
          SYSTEM_PLL2_1000M_CLK, SYSTEM_PLL2_500M_CLK,
@@ -605,6 +1370,11 @@ static struct clk_root_map root_array[] = {
          SYSTEM_PLL1_400M_CLK, SYSTEM_PLL2_125M_CLK,
          SYSTEM_PLL3_CLK, AUDIO_PLL1_CLK, VIDEO_PLL_CLK}
        },
+       {MEDIA_DISP2_CLK_ROOT, AHB_CLOCK_SLICE, 3,
+        {OSC_24M_CLK, VIDEO_PLL_CLK, AUDIO_PLL2_CLK,
+         AUDIO_PLL1_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL2_1000M_CLK, SYSTEM_PLL3_CLK, EXT_CLK_4}
+       },
        {DRAM_ALT_CLK_ROOT, IP_CLOCK_SLICE, 0,
         {OSC_24M_CLK, SYSTEM_PLL1_800M_CLK, SYSTEM_PLL1_100M_CLK,
          SYSTEM_PLL2_500M_CLK, SYSTEM_PLL2_1000M_CLK,
@@ -615,11 +1385,6 @@ static struct clk_root_map root_array[] = {
          SYSTEM_PLL1_160M_CLK, SYSTEM_PLL1_800M_CLK,
          SYSTEM_PLL3_CLK, SYSTEM_PLL2_250M_CLK, AUDIO_PLL2_CLK}
        },
-       {MEMREPAIR_CLK_ROOT, IP_CLOCK_SLICE, 6,
-        {OSC_24M_CLK, SYSTEM_PLL1_160M_CLK, SYSTEM_PLL2_50M_CLK,
-         SYSTEM_PLL3_CLK, AUDIO_PLL1_CLK, VIDEO_PLL_CLK, AUDIO_PLL2_CLK,
-         SYSTEM_PLL1_133M_CLK}
-       },
        {I2C5_CLK_ROOT, IP_CLOCK_SLICE, 9,
         {OSC_24M_CLK, SYSTEM_PLL1_160M_CLK, SYSTEM_PLL2_50M_CLK,
          SYSTEM_PLL3_CLK, AUDIO_PLL1_CLK, VIDEO_PLL_CLK, AUDIO_PLL2_CLK,
@@ -798,11 +1563,36 @@ static struct clk_root_map root_array[] = {
          SYSTEM_PLL3_CLK, SYSTEM_PLL2_200M_CLK,
          SYSTEM_PLL1_266M_CLK, SYSTEM_PLL2_500M_CLK, SYSTEM_PLL1_100M_CLK}
        },
+       {HDMI_REF_266M_CLK_ROOT, IP_CLOCK_SLICE, 56,
+        {OSC_24M_CLK, SYSTEM_PLL1_400M_CLK, SYSTEM_PLL3_CLK,
+         SYSTEM_PLL2_333M_CLK, SYSTEM_PLL1_266M_CLK,
+         SYSTEM_PLL2_200M_CLK, AUDIO_PLL1_CLK, VIDEO_PLL_CLK}
+       },
        {USDHC3_CLK_ROOT, IP_CLOCK_SLICE, 57,
         {OSC_24M_CLK, SYSTEM_PLL1_400M_CLK, SYSTEM_PLL1_800M_CLK,
          SYSTEM_PLL2_500M_CLK, SYSTEM_PLL3_CLK,
          SYSTEM_PLL1_266M_CLK, AUDIO_PLL2_CLK, SYSTEM_PLL1_100M_CLK}
        },
+       {MEDIA_MIPI_PHY1_REF_CLK_ROOT, IP_CLOCK_SLICE, 59,
+        {OSC_24M_CLK, SYSTEM_PLL2_333M_CLK, SYSTEM_PLL2_100M_CLK,
+         SYSTEM_PLL1_800M_CLK, SYSTEM_PLL2_1000M_CLK,
+         EXT_CLK_2, AUDIO_PLL2_CLK, VIDEO_PLL_CLK}
+       },
+       {MEDIA_DISP1_PIX_CLK_ROOT, IP_CLOCK_SLICE, 60,
+        {OSC_24M_CLK, VIDEO_PLL_CLK, AUDIO_PLL2_CLK,
+         AUDIO_PLL1_CLK, SYSTEM_PLL1_800M_CLK,
+         SYSTEM_PLL2_1000M_CLK, SYSTEM_PLL3_CLK, EXT_CLK_4}
+       },
+       {MEDIA_LDB_CLK_ROOT, IP_CLOCK_SLICE, 62,
+        {OSC_24M_CLK, SYSTEM_PLL2_333M_CLK, SYSTEM_PLL2_100M_CLK,
+         SYSTEM_PLL1_800M_CLK, SYSTEM_PLL2_1000M_CLK,
+         EXT_CLK_2, AUDIO_PLL2_CLK, VIDEO_PLL_CLK}
+       },
+       {MEMREPAIR_CLK_ROOT, IP_CLOCK_SLICE, 63,
+        {OSC_24M_CLK, SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_80M_CLK,
+         SYSTEM_PLL1_800M_CLK, SYSTEM_PLL2_1000M_CLK,
+         SYSTEM_PLL3_CLK, EXT_CLK_3, AUDIO_PLL2_CLK}
+       },
        {ECSPI3_CLK_ROOT, IP_CLOCK_SLICE, 67,
         {OSC_24M_CLK, SYSTEM_PLL2_200M_CLK, SYSTEM_PLL1_40M_CLK,
          SYSTEM_PLL1_160M_CLK, SYSTEM_PLL1_800M_CLK,
@@ -812,7 +1602,7 @@ static struct clk_root_map root_array[] = {
         {DRAM_PLL1_CLK}
        },
        {CORE_SEL_CFG, CORE_SEL_CLOCK_SLICE, 0,
-        {DRAM_PLL1_CLK}
+        {ARM_A53_ALT_CLK, ARM_PLL_CLK}
        },
 };
 #endif
index 7fcbd53f3020644d422c0bf4b30317f430866b6b..89229da3b62ac131a651711164a3178b40f11e11 100644 (file)
@@ -165,7 +165,13 @@ static u32 get_cpu_variant_type(u32 type)
 
        u32 value = readl(&fuse->tester4);
 
-       if (type == MXC_CPU_IMX8MM) {
+       if (type == MXC_CPU_IMX8MQ) {
+               if ((value & 0x3) == 0x2)
+                       return MXC_CPU_IMX8MD;
+               else if (value & 0x200000)
+                       return MXC_CPU_IMX8MQL;
+
+       } else if (type == MXC_CPU_IMX8MM) {
                switch (value & 0x3) {
                case 2:
                        if (value & 0x1c0000)
@@ -182,6 +188,23 @@ static u32 get_cpu_variant_type(u32 type)
                                return MXC_CPU_IMX8MML;
                        break;
                }
+       } else if (type == MXC_CPU_IMX8MN) {
+               switch (value & 0x3) {
+               case 2:
+                       if (value & 0x1000000)
+                               return MXC_CPU_IMX8MNDL;
+                       else
+                               return MXC_CPU_IMX8MND;
+               case 3:
+                       if (value & 0x1000000)
+                               return MXC_CPU_IMX8MNSL;
+                       else
+                               return MXC_CPU_IMX8MNS;
+               default:
+                       if (value & 0x1000000)
+                               return MXC_CPU_IMX8MNL;
+                       break;
+               }
        }
 
        return type;
@@ -202,7 +225,7 @@ u32 get_cpu_rev(void)
                return (MXC_CPU_IMX8MP << 12) | reg;
        } else if (major_low == 0x42) {
                /* iMX8MN */
-               return (MXC_CPU_IMX8MN << 12) | reg;
+               type = get_cpu_variant_type(MXC_CPU_IMX8MN);
        } else if (major_low == 0x41) {
                type = get_cpu_variant_type(MXC_CPU_IMX8MM);
        } else {
@@ -226,6 +249,8 @@ u32 get_cpu_rev(void)
                                }
                        }
                }
+
+               type = get_cpu_variant_type(type);
        }
 
        return (type << 12) | reg;
@@ -364,16 +389,18 @@ int ft_system_setup(void *blob, bd_t *bd)
                        if (nodeoff < 0)
                                continue; /* Not found, skip it */
 
-                       printf("Found %s node\n", nodes_path[i]);
+                       debug("Found %s node\n", nodes_path[i]);
 
                        rc = fdt_delprop(blob, nodeoff, "cpu-idle-states");
+                       if (rc == -FDT_ERR_NOTFOUND)
+                               continue;
                        if (rc) {
                                printf("Unable to update property %s:%s, err=%s\n",
                                       nodes_path[i], "status", fdt_strerror(rc));
                                return rc;
                        }
 
-                       printf("Remove %s:%s\n", nodes_path[i],
+                       debug("Remove %s:%s\n", nodes_path[i],
                               "cpu-idle-states");
                }
        }
@@ -382,21 +409,42 @@ int ft_system_setup(void *blob, bd_t *bd)
 }
 #endif
 
-#if defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SYSRESET)
+#if !CONFIG_IS_ENABLED(SYSRESET)
 void reset_cpu(ulong addr)
 {
-       struct watchdog_regs *wdog = (struct watchdog_regs *)addr;
+       struct watchdog_regs *wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR;
 
-       if (!addr)
-              wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR;
+       /* Clear WDA to trigger WDOG_B immediately */
+       writew((SET_WCR_WT(1) | WCR_WDT | WCR_WDE | WCR_SRS), &wdog->wcr);
 
-       /* Clear WDA to trigger WDOG_B immediately */
-       writew((WCR_WDE | WCR_SRS), &wdog->wcr);
+       while (1) {
+               /*
+                * spin for .5 seconds before reset
+                */
+       }
+}
+#endif
+
+#if defined(CONFIG_ARCH_MISC_INIT)
+static void acquire_buildinfo(void)
+{
+       u64 atf_commit = 0;
+
+       /* Get ARM Trusted Firmware commit id */
+       atf_commit = call_imx_sip(IMX_SIP_BUILDINFO,
+                                 IMX_SIP_BUILDINFO_GET_COMMITHASH, 0, 0, 0);
+       if (atf_commit == 0xffffffff) {
+               debug("ATF does not support build info\n");
+               atf_commit = 0x30; /* Display 0, 0 ascii is 0x30 */
+       }
 
-       while (1) {
-               /*
-                * spin for .5 seconds before reset
-                */
-       }
+       printf("\n BuildInfo:\n  - ATF %s\n\n", (char *)&atf_commit);
+}
+
+int arch_misc_init(void)
+{
+       acquire_buildinfo();
+
+       return 0;
 }
 #endif
index 49bb3b928da1582e98600f472321866678bb1ecb..fd3fa046002a279e059138ae51337919fde73035 100644 (file)
@@ -197,52 +197,35 @@ u32 spl_mmc_boot_mode(const u32 boot_device)
        case SD1_BOOT:
        case SD2_BOOT:
        case SD3_BOOT:
-#if defined(CONFIG_SPL_FAT_SUPPORT)
-               return MMCSD_MODE_FS;
-#else
-               return MMCSD_MODE_RAW;
-#endif
-               break;
+               if (IS_ENABLED(CONFIG_SPL_FS_FAT))
+                       return MMCSD_MODE_FS;
+               else
+                       return MMCSD_MODE_RAW;
        case MMC1_BOOT:
        case MMC2_BOOT:
        case MMC3_BOOT:
-#if defined(CONFIG_SPL_FAT_SUPPORT)
-               return MMCSD_MODE_FS;
-#elif defined(CONFIG_SUPPORT_EMMC_BOOT)
-               return MMCSD_MODE_EMMCBOOT;
-#else
-               return MMCSD_MODE_RAW;
-#endif
-               break;
+               if (IS_ENABLED(CONFIG_SPL_FS_FAT))
+                       return MMCSD_MODE_FS;
+               else if (IS_ENABLED(CONFIG_SUPPORT_EMMC_BOOT))
+                       return MMCSD_MODE_EMMCBOOT;
+               else
+                       return MMCSD_MODE_RAW;
        default:
                puts("spl: ERROR:  unsupported device\n");
                hang();
        }
 #else
-/*
- * When CONFIG_SPL_FORCE_MMC_BOOT is defined the 'boot_device' is used
- * unconditionally to decide about device to use for booting.
- * This is crucial for falcon boot mode, when board boots up (i.e. ROM
- * loads SPL) from slow SPI-NOR memory and afterwards the SPL's 'falcon' boot
- * mode is used to load Linux OS from eMMC partition.
- */
-#ifdef CONFIG_SPL_FORCE_MMC_BOOT
        switch (boot_device) {
-#else
-       switch (spl_boot_device()) {
-#endif
        /* for MMC return either RAW or FAT mode */
        case BOOT_DEVICE_MMC1:
        case BOOT_DEVICE_MMC2:
        case BOOT_DEVICE_MMC2_2:
-#if defined(CONFIG_SPL_FS_FAT)
-               return MMCSD_MODE_FS;
-#elif defined(CONFIG_SUPPORT_EMMC_BOOT)
-               return MMCSD_MODE_EMMCBOOT;
-#else
-               return MMCSD_MODE_RAW;
-#endif
-               break;
+               if (IS_ENABLED(CONFIG_SPL_FS_FAT))
+                       return MMCSD_MODE_FS;
+               else if (IS_ENABLED(CONFIG_SUPPORT_EMMC_BOOT))
+                       return MMCSD_MODE_EMMCBOOT;
+               else
+                       return MMCSD_MODE_RAW;
        default:
                puts("spl: ERROR:  unsupported device\n");
                hang();
index 7564dd252ded67d4008cfcdde934d07bfd269381..68a5b757d1dfc4c4447e7856fdd5c251b56f9575 100644 (file)
@@ -1,6 +1,8 @@
 ROC-RK3399-PC
 M:     Levin Du <djw@t-chip.com.cn>
+M:     Suniel Mahesh <sunil@amarulasolutions.com>
 S:     Maintained
 F:     board/firefly/roc-pc-rk3399
 F:     include/configs/roc-pc-rk3399.h
 F:     configs/roc-pc-rk3399_defconfig
+F:     configs/roc-pc-mezzanine-rk3399_defconfig
index de9185a7cee0f6c51048c185b5ea158cb8f44396..0fe1914c0fc857d9b8844e4036e54da6d37d7164 100644 (file)
@@ -10,7 +10,6 @@
 #include <spl_gpio.h>
 #include <asm/io.h>
 #include <asm/arch-rockchip/gpio.h>
-#include <asm/arch-rockchip/grf_rk3399.h>
 
 #ifndef CONFIG_SPL_BUILD
 int board_early_init_f(void)
@@ -34,26 +33,13 @@ out:
 
 #if defined(CONFIG_TPL_BUILD)
 
-#define PMUGRF_BASE     0xff320000
 #define GPIO0_BASE      0xff720000
 
 int board_early_init_f(void)
 {
        struct rockchip_gpio_regs * const gpio0 = (void *)GPIO0_BASE;
-       struct rk3399_pmugrf_regs * const pmugrf = (void *)PMUGRF_BASE;
 
-       /**
-        * 1. Glow yellow LED, termed as low power
-        * 2. Poll for on board power key press
-        * 3. Once 2 done, off yellow and glow red LED, termed as full power
-        * 4. Continue booting...
-        */
-       spl_gpio_output(gpio0, GPIO(BANK_A, 2), 1);
-
-       spl_gpio_set_pull(&pmugrf->gpio0_p, GPIO(BANK_A, 5), GPIO_PULL_NORMAL);
-       while (readl(&gpio0->ext_port) & 0x20);
-
-       spl_gpio_output(gpio0, GPIO(BANK_A, 2), 0);
+       /* Turn on red LED, indicating full power mode */
        spl_gpio_output(gpio0, GPIO(BANK_B, 5), 1);
 
        return 0;
index 5d17f397cb68a04d64e66afa81cde51d351a98a1..4d34622465b39f2ad37f502348e9577a7a920477 100644 (file)
@@ -161,12 +161,3 @@ void board_init_f(ulong dummy)
 
        board_init_r(NULL, 0);
 }
-
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-       puts ("resetting ...\n");
-
-       reset_cpu(WDOG1_BASE_ADDR);
-
-       return 0;
-}
index 7aed14c52b684ce8b3a58a116c5736464394fc08..45417b24464d026fb78ed8072a406c6cd5876ee1 100644 (file)
@@ -114,12 +114,3 @@ void board_init_f(ulong dummy)
 
        board_init_r(NULL, 0);
 }
-
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-       puts("resetting ...\n");
-
-       reset_cpu(WDOG1_BASE_ADDR);
-
-       return 0;
-}
index 0b20668e2b30a234a1f36c6315bab5345e946a4d..c5f640dc7b76253813a3a849c2a6611ecce90331 100644 (file)
@@ -139,7 +139,6 @@ void board_init_f(ulong dummy)
 
        enable_tzc380();
 
-       /* Adjust pmic voltage to 1.0V for 800M */
        setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1);
 
        power_init_board();
@@ -149,12 +148,3 @@ void board_init_f(ulong dummy)
 
        board_init_r(NULL, 0);
 }
-
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-       puts("resetting ...\n");
-
-       reset_cpu(WDOG1_BASE_ADDR);
-
-       return 0;
-}
index e442510f44d5023ae50055fb97d00078813ea597..6ba6a52ebb60e9695f170d1e21ec2191ffd21304 100644 (file)
@@ -235,7 +235,6 @@ void board_init_f(ulong dummy)
 
        enable_tzc380();
 
-       /* Adjust pmic voltage to 1.0V for 800M */
        setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1);
 
        power_init_board();
index b96f0da21efb636656a83825a463f6c123c7512c..93f0cd827c31557dc2c8c4f3b8ddedef922d453d 100644 (file)
@@ -16,6 +16,7 @@
 #include <asm/arch/clock.h>
 #include <asm/arch/sci/sci.h>
 #include <asm/arch/imx8-pins.h>
+#include <asm/arch/snvs_security_sc.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/sys_proto.h>
 
@@ -111,6 +112,15 @@ int board_init(void)
 {
        board_gpio_init();
 
+#ifdef CONFIG_IMX_SNVS_SEC_SC_AUTO
+       {
+               int ret = snvs_security_sc_init();
+
+               if (ret)
+                       return ret;
+       }
+#endif
+
        return 0;
 }
 
index 3da72fdad279f9c89bccb7bfec15342d30c0f297..abee7ca5f3d7786368650638b7bc2290850cedbc 100644 (file)
@@ -11,11 +11,11 @@ This will generate the SPL image called SPL and the u-boot.img.
 
 - Flash the SPL image into the micro SD card:
 
-sudo dd if=SPL of=/dev/mmcblk0 bs=1k seek=1; sync
+sudo dd if=SPL of=/dev/sdX bs=1k seek=1; sync
 
 - Flash the u-boot.img image into the micro SD card:
 
-sudo dd if=u-boot.img of=/dev/sdb bs=1k seek=128; sync
+sudo dd if=u-boot.img of=/dev/sdX bs=1k seek=128; sync
 
 - Jumper settings:
 
index f7e289402568ad3a865d9415973ee168b190b97d..a7e68fa9b32be500a69142879ccae6d52bbdaf50 100644 (file)
@@ -11,11 +11,11 @@ This will generate the SPL image called SPL and the u-boot.img.
 
 - Flash the SPL image into the micro SD card:
 
-sudo dd if=SPL of=/dev/mmcblk0 bs=1k seek=1; sync
+sudo dd if=SPL of=/dev/sdX bs=1k seek=1; sync
 
 - Flash the u-boot.img image into the micro SD card:
 
-sudo dd if=u-boot.img of=/dev/sdb bs=1k seek=128; sync
+sudo dd if=u-boot.img of=/dev/sdX bs=1k seek=128; sync
 
 - Jumper settings:
 
diff --git a/board/google/imx8mq_phanbell/Kconfig b/board/google/imx8mq_phanbell/Kconfig
new file mode 100644 (file)
index 0000000..fba2e9c
--- /dev/null
@@ -0,0 +1,12 @@
+if TARGET_IMX8MQ_PHANBELL
+
+config SYS_BOARD
+       default "imx8mq_phanbell"
+
+config SYS_VENDOR
+       default "google"
+
+config SYS_CONFIG_NAME
+       default "imx8mq_phanbell"
+
+endif
diff --git a/board/google/imx8mq_phanbell/MAINTAINERS b/board/google/imx8mq_phanbell/MAINTAINERS
new file mode 100644 (file)
index 0000000..b233e6b
--- /dev/null
@@ -0,0 +1,8 @@
+i.MX 8MQ PHANBELL BOARD
+M:     Fabio Estevam <festevam@gmail.com>
+M:     Marco Franchi <marcofrk@gmail.com>
+M:     Alifer Moraes <alifer.wsdm@gmail.com>
+S:     Maintained
+F:     board/google/imx8mq_phanbell/
+F:     include/configs/imx8mq_phanbell.h
+F:     configs/imx8mq_phanbell_defconfig
diff --git a/board/google/imx8mq_phanbell/Makefile b/board/google/imx8mq_phanbell/Makefile
new file mode 100644 (file)
index 0000000..d6427cf
--- /dev/null
@@ -0,0 +1,11 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright 2020 NXP
+#
+
+obj-y += imx8mq_phanbell.o
+
+ifdef CONFIG_SPL_BUILD
+obj-y += spl.o
+obj-$(CONFIG_IMX8M_LPDDR4) += lpddr4_timing_1g.o
+endif
diff --git a/board/google/imx8mq_phanbell/README b/board/google/imx8mq_phanbell/README
new file mode 100644 (file)
index 0000000..88a136b
--- /dev/null
@@ -0,0 +1,37 @@
+U-Boot for Google's i.MX8MQ Phanbell board
+
+Quick Start
+===========
+- Build the ARM Trusted firmware binary
+- Get ddr and hdmi firmware
+- Build U-Boot
+- Boot
+
+Get and Build the ARM Trusted firmware
+======================================
+Note: srctree is U-Boot source directory
+Get ATF from: https://source.codeaurora.org/external/imx/imx-atf
+branch: imx_4.19.35_1.0.0
+$ make PLAT=imx8mq bl31
+$ cp build/imx8mq/release/bl31.bin $(builddir)
+
+Get the ddr and hdmi firmware
+=============================
+$ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-7.9.bin
+$ chmod +x firmware-imx-7.9.bin
+$ ./firmware-imx-7.9.bin
+$ cp firmware-imx-7.9/firmware/hdmi/cadence/signed_hdmi_imx8m.bin $(builddir)
+$ cp firmware-imx-7.9/firmware/ddr/synopsys/lpddr4*.bin $(builddir)
+
+Build U-Boot
+============
+$ export CROSS_COMPILE=aarch64-linux-gnu-
+$ make imx8mq_phanbell_defconfig
+$ make flash.bin
+
+Burn the flash.bin to MicroSD card offset 33KB
+$sudo dd if=flash.bin of=/dev/sd[x] bs=1K seek=33
+
+Boot
+====
+Set Boot switch SW1: 1011 to boot from Micro SD.
diff --git a/board/google/imx8mq_phanbell/imx8mq_phanbell.c b/board/google/imx8mq_phanbell/imx8mq_phanbell.c
new file mode 100644 (file)
index 0000000..c0cc3e9
--- /dev/null
@@ -0,0 +1,100 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2020 NXP
+ */
+
+#include <common.h>
+#include <env.h>
+#include <init.h>
+#include <malloc.h>
+#include <errno.h>
+#include <asm/io.h>
+#include <miiphy.h>
+#include <netdev.h>
+#include <asm/mach-imx/iomux-v3.h>
+#include <asm-generic/gpio.h>
+#include <fsl_esdhc_imx.h>
+#include <mmc.h>
+#include <asm/arch/imx8mq_pins.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/mach-imx/gpio.h>
+#include <asm/arch/clock.h>
+#include <spl.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define UART_PAD_CTRL  (PAD_CTL_DSE6 | PAD_CTL_FSEL1)
+
+#define WDOG_PAD_CTRL  (PAD_CTL_DSE6 | PAD_CTL_HYS | PAD_CTL_PUE)
+
+static iomux_v3_cfg_t const wdog_pads[] = {
+       IMX8MQ_PAD_GPIO1_IO02__WDOG1_WDOG_B | MUX_PAD_CTRL(WDOG_PAD_CTRL),
+};
+
+static iomux_v3_cfg_t const uart_pads[] = {
+       IMX8MQ_PAD_UART1_RXD__UART1_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
+       IMX8MQ_PAD_UART1_TXD__UART1_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
+};
+
+int board_early_init_f(void)
+{
+       struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR;
+
+       imx_iomux_v3_setup_multiple_pads(wdog_pads, ARRAY_SIZE(wdog_pads));
+       set_wdog_reset(wdog);
+
+       imx_iomux_v3_setup_multiple_pads(uart_pads, ARRAY_SIZE(uart_pads));
+
+       return 0;
+}
+
+int dram_init(void)
+{
+       /* rom_pointer[1] contains the size of TEE occupies */
+       if (rom_pointer[1])
+               gd->ram_size = PHYS_SDRAM_SIZE - rom_pointer[1];
+       else
+               gd->ram_size = PHYS_SDRAM_SIZE;
+
+       return 0;
+}
+
+#ifdef CONFIG_FEC_MXC
+static int setup_fec(void)
+{
+       struct iomuxc_gpr_base_regs *gpr =
+               (struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR;
+
+       /* Use 125M anatop REF_CLK1 for ENET1, not from external */
+       clrsetbits_le32(&gpr->gpr[1], BIT(13) | BIT(17), 0);
+       return set_clk_enet(ENET_125MHZ);
+}
+
+int board_phy_config(struct phy_device *phydev)
+{
+       /* enable rgmii rxc skew and phy mode select to RGMII copper */
+       phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x1f);
+       phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x8);
+
+       phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x05);
+       phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x100);
+
+       if (phydev->drv->config)
+               phydev->drv->config(phydev);
+       return 0;
+}
+#endif
+
+int board_init(void)
+{
+#ifdef CONFIG_FEC_MXC
+       setup_fec();
+#endif
+
+       return 0;
+}
+
+int board_mmc_get_env_dev(int devno)
+{
+       return devno;
+}
diff --git a/board/google/imx8mq_phanbell/lpddr4_timing_1g.c b/board/google/imx8mq_phanbell/lpddr4_timing_1g.c
new file mode 100644 (file)
index 0000000..7800011
--- /dev/null
@@ -0,0 +1,1731 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2020 NXP
+ *
+ * Generated code from MX8M_DDR_tool
+ * Align with uboot-imx_v2018.03_4.14.78_1.0.0_ga
+ */
+
+#include <linux/kernel.h>
+#include <asm/arch/ddr.h>
+
+static struct dram_cfg_param ddr_ddrc_cfg[] = {
+       /** Initialize DDRC registers **/
+       {0x3d400304, 0x1},
+       {0x3d400030, 0x1},
+       {0x3d400000, 0xa1080020},
+       {0x3d400028, 0x0},
+       {0x3d400020, 0x203},
+       {0x3d400024, 0x3e800},
+       {0x3d400064, 0x610090},
+       {0x3d4000d0, 0xc003061c},
+       {0x3d4000d4, 0x9e0000},
+       {0x3d4000dc, 0xd4002d},
+       {0x3d4000e0, 0x310008},
+       {0x3d4000e8, 0x66004a},
+       {0x3d4000ec, 0x16004a},
+       {0x3d400100, 0x1a201b22},
+       {0x3d400104, 0x60633},
+       {0x3d40010c, 0xc0c000},
+       {0x3d400110, 0xf04080f},
+       {0x3d400114, 0x2040c0c},
+       {0x3d400118, 0x1010007},
+       {0x3d40011c, 0x401},
+       {0x3d400130, 0x20600},
+       {0x3d400134, 0xc100002},
+       {0x3d400138, 0x96},
+       {0x3d400144, 0xa00050},
+       {0x3d400180, 0xc3200018},
+       {0x3d400184, 0x28061a8},
+       {0x3d400188, 0x0},
+       {0x3d400190, 0x497820a},
+       {0x3d400194, 0x80303},
+       {0x3d4001a0, 0xe0400018},
+       {0x3d4001a4, 0xdf00e4},
+       {0x3d4001a8, 0x80000000},
+       {0x3d4001b0, 0x11},
+       {0x3d4001b4, 0x170a},
+       {0x3d4001c0, 0x1},
+       {0x3d4001c4, 0x1},
+       {0x3d4000f4, 0x639},
+       {0x3d400108, 0x70e1617},
+       {0x3d400200, 0x1f},
+       {0x3d40020c, 0x0},
+       {0x3d400210, 0x1f1f},
+       {0x3d400204, 0x80808},
+       {0x3d400214, 0x7070707},
+       {0x3d400218, 0xf070707},
+       {0x3d402020, 0x1},
+       {0x3d402024, 0xd0c0},
+       {0x3d402050, 0x20d040},
+       {0x3d402064, 0x14001f},
+       {0x3d4020dc, 0x940009},
+       {0x3d4020e0, 0x310000},
+       {0x3d4020e8, 0x66004a},
+       {0x3d4020ec, 0x16004a},
+       {0x3d402100, 0xb070508},
+       {0x3d402104, 0x3040b},
+       {0x3d402108, 0x305090c},
+       {0x3d40210c, 0x505000},
+       {0x3d402110, 0x4040204},
+       {0x3d402114, 0x2030303},
+       {0x3d402118, 0x1010004},
+       {0x3d40211c, 0x301},
+       {0x3d402130, 0x20300},
+       {0x3d402134, 0xa100002},
+       {0x3d402138, 0x20},
+       {0x3d402144, 0x220011},
+       {0x3d402180, 0xc0a70006},
+       {0x3d402190, 0x3858202},
+       {0x3d402194, 0x80303},
+       {0x3d4021b4, 0x502},
+       {0x3d400244, 0x0},
+       {0x3d400250, 0x29001505},
+       {0x3d400254, 0x2c},
+       {0x3d40025c, 0x5900575b},
+       {0x3d400264, 0x90000096},
+       {0x3d40026c, 0x1000012c},
+       {0x3d400300, 0x16},
+       {0x3d400304, 0x0},
+       {0x3d40030c, 0x0},
+       {0x3d400320, 0x1},
+       {0x3d40036c, 0x11},
+       {0x3d400400, 0x111},
+       {0x3d400404, 0x10f3},
+       {0x3d400408, 0x72ff},
+       {0x3d400490, 0x1},
+       {0x3d400494, 0xe00},
+       {0x3d400498, 0x62ffff},
+       {0x3d40049c, 0xe00},
+       {0x3d4004a0, 0xffff},
+};
+
+/* PHY Initialize Configuration */
+static struct dram_cfg_param ddr_ddrphy_cfg[] = {
+       {0x100a0, 0x0},
+       {0x100a1, 0x1},
+       {0x100a2, 0x2},
+       {0x100a3, 0x3},
+       {0x100a4, 0x4},
+       {0x100a5, 0x5},
+       {0x100a6, 0x6},
+       {0x100a7, 0x7},
+       {0x110a0, 0x0},
+       {0x110a1, 0x1},
+       {0x110a2, 0x2},
+       {0x110a3, 0x3},
+       {0x110a4, 0x4},
+       {0x110a5, 0x5},
+       {0x110a6, 0x6},
+       {0x110a7, 0x7},
+       {0x120a0, 0x0},
+       {0x120a1, 0x1},
+       {0x120a2, 0x2},
+       {0x120a3, 0x3},
+       {0x120a4, 0x4},
+       {0x120a5, 0x5},
+       {0x120a6, 0x6},
+       {0x120a7, 0x7},
+       {0x130a0, 0x0},
+       {0x130a1, 0x1},
+       {0x130a2, 0x2},
+       {0x130a3, 0x3},
+       {0x130a4, 0x4},
+       {0x130a5, 0x5},
+       {0x130a6, 0x6},
+       {0x130a7, 0x7},
+       {0x20110, 0x2},
+       {0x20111, 0x3},
+       {0x20112, 0x4},
+       {0x20113, 0x5},
+       {0x20114, 0x0},
+       {0x20115, 0x1},
+       {0x1005f, 0x1ff},
+       {0x1015f, 0x1ff},
+       {0x1105f, 0x1ff},
+       {0x1115f, 0x1ff},
+       {0x1205f, 0x1ff},
+       {0x1215f, 0x1ff},
+       {0x1305f, 0x1ff},
+       {0x1315f, 0x1ff},
+       {0x11005f, 0x1ff},
+       {0x11015f, 0x1ff},
+       {0x11105f, 0x1ff},
+       {0x11115f, 0x1ff},
+       {0x11205f, 0x1ff},
+       {0x11215f, 0x1ff},
+       {0x11305f, 0x1ff},
+       {0x11315f, 0x1ff},
+       {0x55, 0x1ff},
+       {0x1055, 0x1ff},
+       {0x2055, 0x1ff},
+       {0x3055, 0x1ff},
+       {0x4055, 0x1ff},
+       {0x5055, 0x1ff},
+       {0x6055, 0x1ff},
+       {0x7055, 0x1ff},
+       {0x8055, 0x1ff},
+       {0x9055, 0x1ff},
+       {0x200c5, 0x19},
+       {0x1200c5, 0x7},
+       {0x2002e, 0x2},
+       {0x12002e, 0x1},
+       {0x90204, 0x0},
+       {0x190204, 0x0},
+       {0x20024, 0x1ab},
+       {0x2003a, 0x0},
+       {0x120024, 0x1ab},
+       {0x2003a, 0x0},
+       {0x20056, 0x3},
+       {0x120056, 0xa},
+       {0x1004d, 0xe00},
+       {0x1014d, 0xe00},
+       {0x1104d, 0xe00},
+       {0x1114d, 0xe00},
+       {0x1204d, 0xe00},
+       {0x1214d, 0xe00},
+       {0x1304d, 0xe00},
+       {0x1314d, 0xe00},
+       {0x11004d, 0xe00},
+       {0x11014d, 0xe00},
+       {0x11104d, 0xe00},
+       {0x11114d, 0xe00},
+       {0x11204d, 0xe00},
+       {0x11214d, 0xe00},
+       {0x11304d, 0xe00},
+       {0x11314d, 0xe00},
+       {0x10049, 0xeba},
+       {0x10149, 0xeba},
+       {0x11049, 0xeba},
+       {0x11149, 0xeba},
+       {0x12049, 0xeba},
+       {0x12149, 0xeba},
+       {0x13049, 0xeba},
+       {0x13149, 0xeba},
+       {0x110049, 0xeba},
+       {0x110149, 0xeba},
+       {0x111049, 0xeba},
+       {0x111149, 0xeba},
+       {0x112049, 0xeba},
+       {0x112149, 0xeba},
+       {0x113049, 0xeba},
+       {0x113149, 0xeba},
+       {0x43, 0xe7},
+       {0x1043, 0xe7},
+       {0x2043, 0xe7},
+       {0x3043, 0xe7},
+       {0x4043, 0xe7},
+       {0x5043, 0xe7},
+       {0x6043, 0xe7},
+       {0x7043, 0xe7},
+       {0x8043, 0xe7},
+       {0x9043, 0xe7},
+       {0x20018, 0x3},
+       {0x20075, 0x4},
+       {0x20050, 0x0},
+       {0x20008, 0x320},
+       {0x120008, 0xa7},
+       {0x20088, 0x9},
+       {0x200b2, 0xdc},
+       {0x10043, 0x5a1},
+       {0x10143, 0x5a1},
+       {0x11043, 0x5a1},
+       {0x11143, 0x5a1},
+       {0x12043, 0x5a1},
+       {0x12143, 0x5a1},
+       {0x13043, 0x5a1},
+       {0x13143, 0x5a1},
+       {0x1200b2, 0xdc},
+       {0x110043, 0x5a1},
+       {0x110143, 0x5a1},
+       {0x111043, 0x5a1},
+       {0x111143, 0x5a1},
+       {0x112043, 0x5a1},
+       {0x112143, 0x5a1},
+       {0x113043, 0x5a1},
+       {0x113143, 0x5a1},
+       {0x200fa, 0x1},
+       {0x1200fa, 0x1},
+       {0x20019, 0x1},
+       {0x120019, 0x1},
+       {0x200f0, 0x0},
+       {0x200f1, 0x0},
+       {0x200f2, 0x4444},
+       {0x200f3, 0x8888},
+       {0x200f4, 0x5555},
+       {0x200f5, 0x0},
+       {0x200f6, 0x0},
+       {0x200f7, 0xf000},
+       {0x20025, 0x0},
+       {0x2002d, 0x0},
+       {0x12002d, 0x0},
+       {0x200c7, 0x80},
+       {0x1200c7, 0x80},
+       {0x200ca, 0x106},
+       {0x1200ca, 0x106},
+};
+
+/* ddr phy trained csr */
+static struct dram_cfg_param ddr_ddrphy_trained_csr[] = {
+       { 0x200b2, 0x0 },
+       { 0x1200b2, 0x0 },
+       { 0x2200b2, 0x0 },
+       { 0x200cb, 0x0 },
+       { 0x10043, 0x0 },
+       { 0x110043, 0x0 },
+       { 0x210043, 0x0 },
+       { 0x10143, 0x0 },
+       { 0x110143, 0x0 },
+       { 0x210143, 0x0 },
+       { 0x11043, 0x0 },
+       { 0x111043, 0x0 },
+       { 0x211043, 0x0 },
+       { 0x11143, 0x0 },
+       { 0x111143, 0x0 },
+       { 0x211143, 0x0 },
+       { 0x12043, 0x0 },
+       { 0x112043, 0x0 },
+       { 0x212043, 0x0 },
+       { 0x12143, 0x0 },
+       { 0x112143, 0x0 },
+       { 0x212143, 0x0 },
+       { 0x13043, 0x0 },
+       { 0x113043, 0x0 },
+       { 0x213043, 0x0 },
+       { 0x13143, 0x0 },
+       { 0x113143, 0x0 },
+       { 0x213143, 0x0 },
+       { 0x80, 0x0 },
+       { 0x100080, 0x0 },
+       { 0x200080, 0x0 },
+       { 0x1080, 0x0 },
+       { 0x101080, 0x0 },
+       { 0x201080, 0x0 },
+       { 0x2080, 0x0 },
+       { 0x102080, 0x0 },
+       { 0x202080, 0x0 },
+       { 0x3080, 0x0 },
+       { 0x103080, 0x0 },
+       { 0x203080, 0x0 },
+       { 0x4080, 0x0 },
+       { 0x104080, 0x0 },
+       { 0x204080, 0x0 },
+       { 0x5080, 0x0 },
+       { 0x105080, 0x0 },
+       { 0x205080, 0x0 },
+       { 0x6080, 0x0 },
+       { 0x106080, 0x0 },
+       { 0x206080, 0x0 },
+       { 0x7080, 0x0 },
+       { 0x107080, 0x0 },
+       { 0x207080, 0x0 },
+       { 0x8080, 0x0 },
+       { 0x108080, 0x0 },
+       { 0x208080, 0x0 },
+       { 0x9080, 0x0 },
+       { 0x109080, 0x0 },
+       { 0x209080, 0x0 },
+       { 0x10080, 0x0 },
+       { 0x110080, 0x0 },
+       { 0x210080, 0x0 },
+       { 0x10180, 0x0 },
+       { 0x110180, 0x0 },
+       { 0x210180, 0x0 },
+       { 0x11080, 0x0 },
+       { 0x111080, 0x0 },
+       { 0x211080, 0x0 },
+       { 0x11180, 0x0 },
+       { 0x111180, 0x0 },
+       { 0x211180, 0x0 },
+       { 0x12080, 0x0 },
+       { 0x112080, 0x0 },
+       { 0x212080, 0x0 },
+       { 0x12180, 0x0 },
+       { 0x112180, 0x0 },
+       { 0x212180, 0x0 },
+       { 0x13080, 0x0 },
+       { 0x113080, 0x0 },
+       { 0x213080, 0x0 },
+       { 0x13180, 0x0 },
+       { 0x113180, 0x0 },
+       { 0x213180, 0x0 },
+       { 0x10081, 0x0 },
+       { 0x110081, 0x0 },
+       { 0x210081, 0x0 },
+       { 0x10181, 0x0 },
+       { 0x110181, 0x0 },
+       { 0x210181, 0x0 },
+       { 0x11081, 0x0 },
+       { 0x111081, 0x0 },
+       { 0x211081, 0x0 },
+       { 0x11181, 0x0 },
+       { 0x111181, 0x0 },
+       { 0x211181, 0x0 },
+       { 0x12081, 0x0 },
+       { 0x112081, 0x0 },
+       { 0x212081, 0x0 },
+       { 0x12181, 0x0 },
+       { 0x112181, 0x0 },
+       { 0x212181, 0x0 },
+       { 0x13081, 0x0 },
+       { 0x113081, 0x0 },
+       { 0x213081, 0x0 },
+       { 0x13181, 0x0 },
+       { 0x113181, 0x0 },
+       { 0x213181, 0x0 },
+       { 0x100d0, 0x0 },
+       { 0x1100d0, 0x0 },
+       { 0x2100d0, 0x0 },
+       { 0x101d0, 0x0 },
+       { 0x1101d0, 0x0 },
+       { 0x2101d0, 0x0 },
+       { 0x110d0, 0x0 },
+       { 0x1110d0, 0x0 },
+       { 0x2110d0, 0x0 },
+       { 0x111d0, 0x0 },
+       { 0x1111d0, 0x0 },
+       { 0x2111d0, 0x0 },
+       { 0x120d0, 0x0 },
+       { 0x1120d0, 0x0 },
+       { 0x2120d0, 0x0 },
+       { 0x121d0, 0x0 },
+       { 0x1121d0, 0x0 },
+       { 0x2121d0, 0x0 },
+       { 0x130d0, 0x0 },
+       { 0x1130d0, 0x0 },
+       { 0x2130d0, 0x0 },
+       { 0x131d0, 0x0 },
+       { 0x1131d0, 0x0 },
+       { 0x2131d0, 0x0 },
+       { 0x100d1, 0x0 },
+       { 0x1100d1, 0x0 },
+       { 0x2100d1, 0x0 },
+       { 0x101d1, 0x0 },
+       { 0x1101d1, 0x0 },
+       { 0x2101d1, 0x0 },
+       { 0x110d1, 0x0 },
+       { 0x1110d1, 0x0 },
+       { 0x2110d1, 0x0 },
+       { 0x111d1, 0x0 },
+       { 0x1111d1, 0x0 },
+       { 0x2111d1, 0x0 },
+       { 0x120d1, 0x0 },
+       { 0x1120d1, 0x0 },
+       { 0x2120d1, 0x0 },
+       { 0x121d1, 0x0 },
+       { 0x1121d1, 0x0 },
+       { 0x2121d1, 0x0 },
+       { 0x130d1, 0x0 },
+       { 0x1130d1, 0x0 },
+       { 0x2130d1, 0x0 },
+       { 0x131d1, 0x0 },
+       { 0x1131d1, 0x0 },
+       { 0x2131d1, 0x0 },
+       { 0x10068, 0x0 },
+       { 0x10168, 0x0 },
+       { 0x10268, 0x0 },
+       { 0x10368, 0x0 },
+       { 0x10468, 0x0 },
+       { 0x10568, 0x0 },
+       { 0x10668, 0x0 },
+       { 0x10768, 0x0 },
+       { 0x10868, 0x0 },
+       { 0x11068, 0x0 },
+       { 0x11168, 0x0 },
+       { 0x11268, 0x0 },
+       { 0x11368, 0x0 },
+       { 0x11468, 0x0 },
+       { 0x11568, 0x0 },
+       { 0x11668, 0x0 },
+       { 0x11768, 0x0 },
+       { 0x11868, 0x0 },
+       { 0x12068, 0x0 },
+       { 0x12168, 0x0 },
+       { 0x12268, 0x0 },
+       { 0x12368, 0x0 },
+       { 0x12468, 0x0 },
+       { 0x12568, 0x0 },
+       { 0x12668, 0x0 },
+       { 0x12768, 0x0 },
+       { 0x12868, 0x0 },
+       { 0x13068, 0x0 },
+       { 0x13168, 0x0 },
+       { 0x13268, 0x0 },
+       { 0x13368, 0x0 },
+       { 0x13468, 0x0 },
+       { 0x13568, 0x0 },
+       { 0x13668, 0x0 },
+       { 0x13768, 0x0 },
+       { 0x13868, 0x0 },
+       { 0x10069, 0x0 },
+       { 0x10169, 0x0 },
+       { 0x10269, 0x0 },
+       { 0x10369, 0x0 },
+       { 0x10469, 0x0 },
+       { 0x10569, 0x0 },
+       { 0x10669, 0x0 },
+       { 0x10769, 0x0 },
+       { 0x10869, 0x0 },
+       { 0x11069, 0x0 },
+       { 0x11169, 0x0 },
+       { 0x11269, 0x0 },
+       { 0x11369, 0x0 },
+       { 0x11469, 0x0 },
+       { 0x11569, 0x0 },
+       { 0x11669, 0x0 },
+       { 0x11769, 0x0 },
+       { 0x11869, 0x0 },
+       { 0x12069, 0x0 },
+       { 0x12169, 0x0 },
+       { 0x12269, 0x0 },
+       { 0x12369, 0x0 },
+       { 0x12469, 0x0 },
+       { 0x12569, 0x0 },
+       { 0x12669, 0x0 },
+       { 0x12769, 0x0 },
+       { 0x12869, 0x0 },
+       { 0x13069, 0x0 },
+       { 0x13169, 0x0 },
+       { 0x13269, 0x0 },
+       { 0x13369, 0x0 },
+       { 0x13469, 0x0 },
+       { 0x13569, 0x0 },
+       { 0x13669, 0x0 },
+       { 0x13769, 0x0 },
+       { 0x13869, 0x0 },
+       { 0x1008c, 0x0 },
+       { 0x11008c, 0x0 },
+       { 0x21008c, 0x0 },
+       { 0x1018c, 0x0 },
+       { 0x11018c, 0x0 },
+       { 0x21018c, 0x0 },
+       { 0x1108c, 0x0 },
+       { 0x11108c, 0x0 },
+       { 0x21108c, 0x0 },
+       { 0x1118c, 0x0 },
+       { 0x11118c, 0x0 },
+       { 0x21118c, 0x0 },
+       { 0x1208c, 0x0 },
+       { 0x11208c, 0x0 },
+       { 0x21208c, 0x0 },
+       { 0x1218c, 0x0 },
+       { 0x11218c, 0x0 },
+       { 0x21218c, 0x0 },
+       { 0x1308c, 0x0 },
+       { 0x11308c, 0x0 },
+       { 0x21308c, 0x0 },
+       { 0x1318c, 0x0 },
+       { 0x11318c, 0x0 },
+       { 0x21318c, 0x0 },
+       { 0x1008d, 0x0 },
+       { 0x11008d, 0x0 },
+       { 0x21008d, 0x0 },
+       { 0x1018d, 0x0 },
+       { 0x11018d, 0x0 },
+       { 0x21018d, 0x0 },
+       { 0x1108d, 0x0 },
+       { 0x11108d, 0x0 },
+       { 0x21108d, 0x0 },
+       { 0x1118d, 0x0 },
+       { 0x11118d, 0x0 },
+       { 0x21118d, 0x0 },
+       { 0x1208d, 0x0 },
+       { 0x11208d, 0x0 },
+       { 0x21208d, 0x0 },
+       { 0x1218d, 0x0 },
+       { 0x11218d, 0x0 },
+       { 0x21218d, 0x0 },
+       { 0x1308d, 0x0 },
+       { 0x11308d, 0x0 },
+       { 0x21308d, 0x0 },
+       { 0x1318d, 0x0 },
+       { 0x11318d, 0x0 },
+       { 0x21318d, 0x0 },
+       { 0x100c0, 0x0 },
+       { 0x1100c0, 0x0 },
+       { 0x2100c0, 0x0 },
+       { 0x101c0, 0x0 },
+       { 0x1101c0, 0x0 },
+       { 0x2101c0, 0x0 },
+       { 0x102c0, 0x0 },
+       { 0x1102c0, 0x0 },
+       { 0x2102c0, 0x0 },
+       { 0x103c0, 0x0 },
+       { 0x1103c0, 0x0 },
+       { 0x2103c0, 0x0 },
+       { 0x104c0, 0x0 },
+       { 0x1104c0, 0x0 },
+       { 0x2104c0, 0x0 },
+       { 0x105c0, 0x0 },
+       { 0x1105c0, 0x0 },
+       { 0x2105c0, 0x0 },
+       { 0x106c0, 0x0 },
+       { 0x1106c0, 0x0 },
+       { 0x2106c0, 0x0 },
+       { 0x107c0, 0x0 },
+       { 0x1107c0, 0x0 },
+       { 0x2107c0, 0x0 },
+       { 0x108c0, 0x0 },
+       { 0x1108c0, 0x0 },
+       { 0x2108c0, 0x0 },
+       { 0x110c0, 0x0 },
+       { 0x1110c0, 0x0 },
+       { 0x2110c0, 0x0 },
+       { 0x111c0, 0x0 },
+       { 0x1111c0, 0x0 },
+       { 0x2111c0, 0x0 },
+       { 0x112c0, 0x0 },
+       { 0x1112c0, 0x0 },
+       { 0x2112c0, 0x0 },
+       { 0x113c0, 0x0 },
+       { 0x1113c0, 0x0 },
+       { 0x2113c0, 0x0 },
+       { 0x114c0, 0x0 },
+       { 0x1114c0, 0x0 },
+       { 0x2114c0, 0x0 },
+       { 0x115c0, 0x0 },
+       { 0x1115c0, 0x0 },
+       { 0x2115c0, 0x0 },
+       { 0x116c0, 0x0 },
+       { 0x1116c0, 0x0 },
+       { 0x2116c0, 0x0 },
+       { 0x117c0, 0x0 },
+       { 0x1117c0, 0x0 },
+       { 0x2117c0, 0x0 },
+       { 0x118c0, 0x0 },
+       { 0x1118c0, 0x0 },
+       { 0x2118c0, 0x0 },
+       { 0x120c0, 0x0 },
+       { 0x1120c0, 0x0 },
+       { 0x2120c0, 0x0 },
+       { 0x121c0, 0x0 },
+       { 0x1121c0, 0x0 },
+       { 0x2121c0, 0x0 },
+       { 0x122c0, 0x0 },
+       { 0x1122c0, 0x0 },
+       { 0x2122c0, 0x0 },
+       { 0x123c0, 0x0 },
+       { 0x1123c0, 0x0 },
+       { 0x2123c0, 0x0 },
+       { 0x124c0, 0x0 },
+       { 0x1124c0, 0x0 },
+       { 0x2124c0, 0x0 },
+       { 0x125c0, 0x0 },
+       { 0x1125c0, 0x0 },
+       { 0x2125c0, 0x0 },
+       { 0x126c0, 0x0 },
+       { 0x1126c0, 0x0 },
+       { 0x2126c0, 0x0 },
+       { 0x127c0, 0x0 },
+       { 0x1127c0, 0x0 },
+       { 0x2127c0, 0x0 },
+       { 0x128c0, 0x0 },
+       { 0x1128c0, 0x0 },
+       { 0x2128c0, 0x0 },
+       { 0x130c0, 0x0 },
+       { 0x1130c0, 0x0 },
+       { 0x2130c0, 0x0 },
+       { 0x131c0, 0x0 },
+       { 0x1131c0, 0x0 },
+       { 0x2131c0, 0x0 },
+       { 0x132c0, 0x0 },
+       { 0x1132c0, 0x0 },
+       { 0x2132c0, 0x0 },
+       { 0x133c0, 0x0 },
+       { 0x1133c0, 0x0 },
+       { 0x2133c0, 0x0 },
+       { 0x134c0, 0x0 },
+       { 0x1134c0, 0x0 },
+       { 0x2134c0, 0x0 },
+       { 0x135c0, 0x0 },
+       { 0x1135c0, 0x0 },
+       { 0x2135c0, 0x0 },
+       { 0x136c0, 0x0 },
+       { 0x1136c0, 0x0 },
+       { 0x2136c0, 0x0 },
+       { 0x137c0, 0x0 },
+       { 0x1137c0, 0x0 },
+       { 0x2137c0, 0x0 },
+       { 0x138c0, 0x0 },
+       { 0x1138c0, 0x0 },
+       { 0x2138c0, 0x0 },
+       { 0x100c1, 0x0 },
+       { 0x1100c1, 0x0 },
+       { 0x2100c1, 0x0 },
+       { 0x101c1, 0x0 },
+       { 0x1101c1, 0x0 },
+       { 0x2101c1, 0x0 },
+       { 0x102c1, 0x0 },
+       { 0x1102c1, 0x0 },
+       { 0x2102c1, 0x0 },
+       { 0x103c1, 0x0 },
+       { 0x1103c1, 0x0 },
+       { 0x2103c1, 0x0 },
+       { 0x104c1, 0x0 },
+       { 0x1104c1, 0x0 },
+       { 0x2104c1, 0x0 },
+       { 0x105c1, 0x0 },
+       { 0x1105c1, 0x0 },
+       { 0x2105c1, 0x0 },
+       { 0x106c1, 0x0 },
+       { 0x1106c1, 0x0 },
+       { 0x2106c1, 0x0 },
+       { 0x107c1, 0x0 },
+       { 0x1107c1, 0x0 },
+       { 0x2107c1, 0x0 },
+       { 0x108c1, 0x0 },
+       { 0x1108c1, 0x0 },
+       { 0x2108c1, 0x0 },
+       { 0x110c1, 0x0 },
+       { 0x1110c1, 0x0 },
+       { 0x2110c1, 0x0 },
+       { 0x111c1, 0x0 },
+       { 0x1111c1, 0x0 },
+       { 0x2111c1, 0x0 },
+       { 0x112c1, 0x0 },
+       { 0x1112c1, 0x0 },
+       { 0x2112c1, 0x0 },
+       { 0x113c1, 0x0 },
+       { 0x1113c1, 0x0 },
+       { 0x2113c1, 0x0 },
+       { 0x114c1, 0x0 },
+       { 0x1114c1, 0x0 },
+       { 0x2114c1, 0x0 },
+       { 0x115c1, 0x0 },
+       { 0x1115c1, 0x0 },
+       { 0x2115c1, 0x0 },
+       { 0x116c1, 0x0 },
+       { 0x1116c1, 0x0 },
+       { 0x2116c1, 0x0 },
+       { 0x117c1, 0x0 },
+       { 0x1117c1, 0x0 },
+       { 0x2117c1, 0x0 },
+       { 0x118c1, 0x0 },
+       { 0x1118c1, 0x0 },
+       { 0x2118c1, 0x0 },
+       { 0x120c1, 0x0 },
+       { 0x1120c1, 0x0 },
+       { 0x2120c1, 0x0 },
+       { 0x121c1, 0x0 },
+       { 0x1121c1, 0x0 },
+       { 0x2121c1, 0x0 },
+       { 0x122c1, 0x0 },
+       { 0x1122c1, 0x0 },
+       { 0x2122c1, 0x0 },
+       { 0x123c1, 0x0 },
+       { 0x1123c1, 0x0 },
+       { 0x2123c1, 0x0 },
+       { 0x124c1, 0x0 },
+       { 0x1124c1, 0x0 },
+       { 0x2124c1, 0x0 },
+       { 0x125c1, 0x0 },
+       { 0x1125c1, 0x0 },
+       { 0x2125c1, 0x0 },
+       { 0x126c1, 0x0 },
+       { 0x1126c1, 0x0 },
+       { 0x2126c1, 0x0 },
+       { 0x127c1, 0x0 },
+       { 0x1127c1, 0x0 },
+       { 0x2127c1, 0x0 },
+       { 0x128c1, 0x0 },
+       { 0x1128c1, 0x0 },
+       { 0x2128c1, 0x0 },
+       { 0x130c1, 0x0 },
+       { 0x1130c1, 0x0 },
+       { 0x2130c1, 0x0 },
+       { 0x131c1, 0x0 },
+       { 0x1131c1, 0x0 },
+       { 0x2131c1, 0x0 },
+       { 0x132c1, 0x0 },
+       { 0x1132c1, 0x0 },
+       { 0x2132c1, 0x0 },
+       { 0x133c1, 0x0 },
+       { 0x1133c1, 0x0 },
+       { 0x2133c1, 0x0 },
+       { 0x134c1, 0x0 },
+       { 0x1134c1, 0x0 },
+       { 0x2134c1, 0x0 },
+       { 0x135c1, 0x0 },
+       { 0x1135c1, 0x0 },
+       { 0x2135c1, 0x0 },
+       { 0x136c1, 0x0 },
+       { 0x1136c1, 0x0 },
+       { 0x2136c1, 0x0 },
+       { 0x137c1, 0x0 },
+       { 0x1137c1, 0x0 },
+       { 0x2137c1, 0x0 },
+       { 0x138c1, 0x0 },
+       { 0x1138c1, 0x0 },
+       { 0x2138c1, 0x0 },
+       { 0x10020, 0x0 },
+       { 0x110020, 0x0 },
+       { 0x210020, 0x0 },
+       { 0x11020, 0x0 },
+       { 0x111020, 0x0 },
+       { 0x211020, 0x0 },
+       { 0x12020, 0x0 },
+       { 0x112020, 0x0 },
+       { 0x212020, 0x0 },
+       { 0x13020, 0x0 },
+       { 0x113020, 0x0 },
+       { 0x213020, 0x0 },
+       { 0x20072, 0x0 },
+       { 0x20073, 0x0 },
+       { 0x20074, 0x0 },
+       { 0x100aa, 0x0 },
+       { 0x110aa, 0x0 },
+       { 0x120aa, 0x0 },
+       { 0x130aa, 0x0 },
+       { 0x20010, 0x0 },
+       { 0x120010, 0x0 },
+       { 0x220010, 0x0 },
+       { 0x20011, 0x0 },
+       { 0x120011, 0x0 },
+       { 0x220011, 0x0 },
+       { 0x100ae, 0x0 },
+       { 0x1100ae, 0x0 },
+       { 0x2100ae, 0x0 },
+       { 0x100af, 0x0 },
+       { 0x1100af, 0x0 },
+       { 0x2100af, 0x0 },
+       { 0x110ae, 0x0 },
+       { 0x1110ae, 0x0 },
+       { 0x2110ae, 0x0 },
+       { 0x110af, 0x0 },
+       { 0x1110af, 0x0 },
+       { 0x2110af, 0x0 },
+       { 0x120ae, 0x0 },
+       { 0x1120ae, 0x0 },
+       { 0x2120ae, 0x0 },
+       { 0x120af, 0x0 },
+       { 0x1120af, 0x0 },
+       { 0x2120af, 0x0 },
+       { 0x130ae, 0x0 },
+       { 0x1130ae, 0x0 },
+       { 0x2130ae, 0x0 },
+       { 0x130af, 0x0 },
+       { 0x1130af, 0x0 },
+       { 0x2130af, 0x0 },
+       { 0x20020, 0x0 },
+       { 0x120020, 0x0 },
+       { 0x220020, 0x0 },
+       { 0x100a0, 0x0 },
+       { 0x100a1, 0x0 },
+       { 0x100a2, 0x0 },
+       { 0x100a3, 0x0 },
+       { 0x100a4, 0x0 },
+       { 0x100a5, 0x0 },
+       { 0x100a6, 0x0 },
+       { 0x100a7, 0x0 },
+       { 0x110a0, 0x0 },
+       { 0x110a1, 0x0 },
+       { 0x110a2, 0x0 },
+       { 0x110a3, 0x0 },
+       { 0x110a4, 0x0 },
+       { 0x110a5, 0x0 },
+       { 0x110a6, 0x0 },
+       { 0x110a7, 0x0 },
+       { 0x120a0, 0x0 },
+       { 0x120a1, 0x0 },
+       { 0x120a2, 0x0 },
+       { 0x120a3, 0x0 },
+       { 0x120a4, 0x0 },
+       { 0x120a5, 0x0 },
+       { 0x120a6, 0x0 },
+       { 0x120a7, 0x0 },
+       { 0x130a0, 0x0 },
+       { 0x130a1, 0x0 },
+       { 0x130a2, 0x0 },
+       { 0x130a3, 0x0 },
+       { 0x130a4, 0x0 },
+       { 0x130a5, 0x0 },
+       { 0x130a6, 0x0 },
+       { 0x130a7, 0x0 },
+       { 0x2007c, 0x0 },
+       { 0x12007c, 0x0 },
+       { 0x22007c, 0x0 },
+       { 0x2007d, 0x0 },
+       { 0x12007d, 0x0 },
+       { 0x22007d, 0x0 },
+       { 0x400fd, 0x0 },
+       { 0x400c0, 0x0 },
+       { 0x90201, 0x0 },
+       { 0x190201, 0x0 },
+       { 0x290201, 0x0 },
+       { 0x90202, 0x0 },
+       { 0x190202, 0x0 },
+       { 0x290202, 0x0 },
+       { 0x90203, 0x0 },
+       { 0x190203, 0x0 },
+       { 0x290203, 0x0 },
+       { 0x90204, 0x0 },
+       { 0x190204, 0x0 },
+       { 0x290204, 0x0 },
+       { 0x90205, 0x0 },
+       { 0x190205, 0x0 },
+       { 0x290205, 0x0 },
+       { 0x90206, 0x0 },
+       { 0x190206, 0x0 },
+       { 0x290206, 0x0 },
+       { 0x90207, 0x0 },
+       { 0x190207, 0x0 },
+       { 0x290207, 0x0 },
+       { 0x90208, 0x0 },
+       { 0x190208, 0x0 },
+       { 0x290208, 0x0 },
+       { 0x10062, 0x0 },
+       { 0x10162, 0x0 },
+       { 0x10262, 0x0 },
+       { 0x10362, 0x0 },
+       { 0x10462, 0x0 },
+       { 0x10562, 0x0 },
+       { 0x10662, 0x0 },
+       { 0x10762, 0x0 },
+       { 0x10862, 0x0 },
+       { 0x11062, 0x0 },
+       { 0x11162, 0x0 },
+       { 0x11262, 0x0 },
+       { 0x11362, 0x0 },
+       { 0x11462, 0x0 },
+       { 0x11562, 0x0 },
+       { 0x11662, 0x0 },
+       { 0x11762, 0x0 },
+       { 0x11862, 0x0 },
+       { 0x12062, 0x0 },
+       { 0x12162, 0x0 },
+       { 0x12262, 0x0 },
+       { 0x12362, 0x0 },
+       { 0x12462, 0x0 },
+       { 0x12562, 0x0 },
+       { 0x12662, 0x0 },
+       { 0x12762, 0x0 },
+       { 0x12862, 0x0 },
+       { 0x13062, 0x0 },
+       { 0x13162, 0x0 },
+       { 0x13262, 0x0 },
+       { 0x13362, 0x0 },
+       { 0x13462, 0x0 },
+       { 0x13562, 0x0 },
+       { 0x13662, 0x0 },
+       { 0x13762, 0x0 },
+       { 0x13862, 0x0 },
+       { 0x20077, 0x0 },
+       { 0x10001, 0x0 },
+       { 0x11001, 0x0 },
+       { 0x12001, 0x0 },
+       { 0x13001, 0x0 },
+       { 0x10040, 0x0 },
+       { 0x10140, 0x0 },
+       { 0x10240, 0x0 },
+       { 0x10340, 0x0 },
+       { 0x10440, 0x0 },
+       { 0x10540, 0x0 },
+       { 0x10640, 0x0 },
+       { 0x10740, 0x0 },
+       { 0x10840, 0x0 },
+       { 0x10030, 0x0 },
+       { 0x10130, 0x0 },
+       { 0x10230, 0x0 },
+       { 0x10330, 0x0 },
+       { 0x10430, 0x0 },
+       { 0x10530, 0x0 },
+       { 0x10630, 0x0 },
+       { 0x10730, 0x0 },
+       { 0x10830, 0x0 },
+       { 0x11040, 0x0 },
+       { 0x11140, 0x0 },
+       { 0x11240, 0x0 },
+       { 0x11340, 0x0 },
+       { 0x11440, 0x0 },
+       { 0x11540, 0x0 },
+       { 0x11640, 0x0 },
+       { 0x11740, 0x0 },
+       { 0x11840, 0x0 },
+       { 0x11030, 0x0 },
+       { 0x11130, 0x0 },
+       { 0x11230, 0x0 },
+       { 0x11330, 0x0 },
+       { 0x11430, 0x0 },
+       { 0x11530, 0x0 },
+       { 0x11630, 0x0 },
+       { 0x11730, 0x0 },
+       { 0x11830, 0x0 },
+       { 0x12040, 0x0 },
+       { 0x12140, 0x0 },
+       { 0x12240, 0x0 },
+       { 0x12340, 0x0 },
+       { 0x12440, 0x0 },
+       { 0x12540, 0x0 },
+       { 0x12640, 0x0 },
+       { 0x12740, 0x0 },
+       { 0x12840, 0x0 },
+       { 0x12030, 0x0 },
+       { 0x12130, 0x0 },
+       { 0x12230, 0x0 },
+       { 0x12330, 0x0 },
+       { 0x12430, 0x0 },
+       { 0x12530, 0x0 },
+       { 0x12630, 0x0 },
+       { 0x12730, 0x0 },
+       { 0x12830, 0x0 },
+       { 0x13040, 0x0 },
+       { 0x13140, 0x0 },
+       { 0x13240, 0x0 },
+       { 0x13340, 0x0 },
+       { 0x13440, 0x0 },
+       { 0x13540, 0x0 },
+       { 0x13640, 0x0 },
+       { 0x13740, 0x0 },
+       { 0x13840, 0x0 },
+       { 0x13030, 0x0 },
+       { 0x13130, 0x0 },
+       { 0x13230, 0x0 },
+       { 0x13330, 0x0 },
+       { 0x13430, 0x0 },
+       { 0x13530, 0x0 },
+       { 0x13630, 0x0 },
+       { 0x13730, 0x0 },
+       { 0x13830, 0x0 },
+};
+
+/* P0 message block paremeter for training firmware */
+static struct dram_cfg_param ddr_fsp0_cfg[] = {
+       {0xd0000, 0x0},
+       {0x54003, 0xc80},
+       {0x54004, 0x2},
+       {0x54005, 0x2228},
+       {0x54006, 0x11},
+       {0x54008, 0x131f},
+       {0x54009, 0xc8},
+       {0x5400b, 0x2},
+       {0x5400d, 0x100},
+       {0x54012, 0x110},
+       {0x54019, 0x2dd4},
+       {0x5401a, 0x31},
+       {0x5401b, 0x4a66},
+       {0x5401c, 0x4a08},
+       {0x5401e, 0x16},
+       {0x5401f, 0x2dd4},
+       {0x54020, 0x31},
+       {0x54021, 0x4a66},
+       {0x54022, 0x4a08},
+       {0x54024, 0x16},
+       {0x5402b, 0x1000},
+       {0x5402c, 0x1},
+       {0x54032, 0xd400},
+       {0x54033, 0x312d},
+       {0x54034, 0x6600},
+       {0x54035, 0x84a},
+       {0x54036, 0x4a},
+       {0x54037, 0x1600},
+       {0x54038, 0xd400},
+       {0x54039, 0x312d},
+       {0x5403a, 0x6600},
+       {0x5403b, 0x84a},
+       {0x5403c, 0x4a},
+       {0x5403d, 0x1600},
+       {0xd0000, 0x1},
+};
+
+/* P1 message block paremeter for training firmware */
+static struct dram_cfg_param ddr_fsp1_cfg[] = {
+       {0xd0000, 0x0},
+       {0x54002, 0x1},
+       {0x54003, 0x29c},
+       {0x54004, 0x2},
+       {0x54005, 0x2228},
+       {0x54006, 0x11},
+       {0x54008, 0x121f},
+       {0x54009, 0xc8},
+       {0x5400b, 0x2},
+       {0x5400d, 0x100},
+       {0x54012, 0x110},
+       {0x54019, 0x994},
+       {0x5401a, 0x31},
+       {0x5401b, 0x4a66},
+       {0x5401c, 0x4a08},
+       {0x5401e, 0x16},
+       {0x5401f, 0x994},
+       {0x54020, 0x31},
+       {0x54021, 0x4a66},
+       {0x54022, 0x4a08},
+       {0x54024, 0x16},
+       {0x5402b, 0x1000},
+       {0x5402c, 0x1},
+       {0x54032, 0x9400},
+       {0x54033, 0x3109},
+       {0x54034, 0x6600},
+       {0x54035, 0x84a},
+       {0x54036, 0x4a},
+       {0x54037, 0x1600},
+       {0x54038, 0x9400},
+       {0x54039, 0x3109},
+       {0x5403a, 0x6600},
+       {0x5403b, 0x84a},
+       {0x5403c, 0x4a},
+       {0x5403d, 0x1600},
+       {0xd0000, 0x1},
+};
+
+/* P0 2D message block paremeter for training firmware */
+static struct dram_cfg_param ddr_fsp0_2d_cfg[] = {
+       {0xd0000, 0x0},
+       {0x54003, 0xc80},
+       {0x54004, 0x2},
+       {0x54005, 0x2228},
+       {0x54006, 0x11},
+       {0x54008, 0x61},
+       {0x54009, 0xc8},
+       {0x5400b, 0x2},
+       {0x5400f, 0x100},
+       {0x54010, 0x1f7f},
+       {0x54012, 0x110},
+       {0x54019, 0x2dd4},
+       {0x5401a, 0x31},
+       {0x5401b, 0x4a66},
+       {0x5401c, 0x4a08},
+       {0x5401e, 0x16},
+       {0x5401f, 0x2dd4},
+       {0x54020, 0x31},
+       {0x54021, 0x4a66},
+       {0x54022, 0x4a08},
+       {0x54024, 0x16},
+       {0x5402b, 0x1000},
+       {0x5402c, 0x1},
+       {0x54032, 0xd400},
+       {0x54033, 0x312d},
+       {0x54034, 0x6600},
+       {0x54035, 0x84a},
+       {0x54036, 0x4a},
+       {0x54037, 0x1600},
+       {0x54038, 0xd400},
+       {0x54039, 0x312d},
+       {0x5403a, 0x6600},
+       {0x5403b, 0x84a},
+       {0x5403c, 0x4a},
+       {0x5403d, 0x1600},
+       { 0xd0000, 0x1 },
+};
+
+/* DRAM PHY init engine image */
+static struct dram_cfg_param ddr_phy_pie[] = {
+       {0xd0000, 0x0},
+       {0x90000, 0x10},
+       {0x90001, 0x400},
+       {0x90002, 0x10e},
+       {0x90003, 0x0},
+       {0x90004, 0x0},
+       {0x90005, 0x8},
+       {0x90029, 0xb},
+       {0x9002a, 0x480},
+       {0x9002b, 0x109},
+       {0x9002c, 0x8},
+       {0x9002d, 0x448},
+       {0x9002e, 0x139},
+       {0x9002f, 0x8},
+       {0x90030, 0x478},
+       {0x90031, 0x109},
+       {0x90032, 0x0},
+       {0x90033, 0xe8},
+       {0x90034, 0x109},
+       {0x90035, 0x2},
+       {0x90036, 0x10},
+       {0x90037, 0x139},
+       {0x90038, 0xf},
+       {0x90039, 0x7c0},
+       {0x9003a, 0x139},
+       {0x9003b, 0x44},
+       {0x9003c, 0x630},
+       {0x9003d, 0x159},
+       {0x9003e, 0x14f},
+       {0x9003f, 0x630},
+       {0x90040, 0x159},
+       {0x90041, 0x47},
+       {0x90042, 0x630},
+       {0x90043, 0x149},
+       {0x90044, 0x4f},
+       {0x90045, 0x630},
+       {0x90046, 0x179},
+       {0x90047, 0x8},
+       {0x90048, 0xe0},
+       {0x90049, 0x109},
+       {0x9004a, 0x0},
+       {0x9004b, 0x7c8},
+       {0x9004c, 0x109},
+       {0x9004d, 0x0},
+       {0x9004e, 0x1},
+       {0x9004f, 0x8},
+       {0x90050, 0x0},
+       {0x90051, 0x45a},
+       {0x90052, 0x9},
+       {0x90053, 0x0},
+       {0x90054, 0x448},
+       {0x90055, 0x109},
+       {0x90056, 0x40},
+       {0x90057, 0x630},
+       {0x90058, 0x179},
+       {0x90059, 0x1},
+       {0x9005a, 0x618},
+       {0x9005b, 0x109},
+       {0x9005c, 0x40c0},
+       {0x9005d, 0x630},
+       {0x9005e, 0x149},
+       {0x9005f, 0x8},
+       {0x90060, 0x4},
+       {0x90061, 0x48},
+       {0x90062, 0x4040},
+       {0x90063, 0x630},
+       {0x90064, 0x149},
+       {0x90065, 0x0},
+       {0x90066, 0x4},
+       {0x90067, 0x48},
+       {0x90068, 0x40},
+       {0x90069, 0x630},
+       {0x9006a, 0x149},
+       {0x9006b, 0x10},
+       {0x9006c, 0x4},
+       {0x9006d, 0x18},
+       {0x9006e, 0x0},
+       {0x9006f, 0x4},
+       {0x90070, 0x78},
+       {0x90071, 0x549},
+       {0x90072, 0x630},
+       {0x90073, 0x159},
+       {0x90074, 0xd49},
+       {0x90075, 0x630},
+       {0x90076, 0x159},
+       {0x90077, 0x94a},
+       {0x90078, 0x630},
+       {0x90079, 0x159},
+       {0x9007a, 0x441},
+       {0x9007b, 0x630},
+       {0x9007c, 0x149},
+       {0x9007d, 0x42},
+       {0x9007e, 0x630},
+       {0x9007f, 0x149},
+       {0x90080, 0x1},
+       {0x90081, 0x630},
+       {0x90082, 0x149},
+       {0x90083, 0x0},
+       {0x90084, 0xe0},
+       {0x90085, 0x109},
+       {0x90086, 0xa},
+       {0x90087, 0x10},
+       {0x90088, 0x109},
+       {0x90089, 0x9},
+       {0x9008a, 0x3c0},
+       {0x9008b, 0x149},
+       {0x9008c, 0x9},
+       {0x9008d, 0x3c0},
+       {0x9008e, 0x159},
+       {0x9008f, 0x18},
+       {0x90090, 0x10},
+       {0x90091, 0x109},
+       {0x90092, 0x0},
+       {0x90093, 0x3c0},
+       {0x90094, 0x109},
+       {0x90095, 0x18},
+       {0x90096, 0x4},
+       {0x90097, 0x48},
+       {0x90098, 0x18},
+       {0x90099, 0x4},
+       {0x9009a, 0x58},
+       {0x9009b, 0xa},
+       {0x9009c, 0x10},
+       {0x9009d, 0x109},
+       {0x9009e, 0x2},
+       {0x9009f, 0x10},
+       {0x900a0, 0x109},
+       {0x900a1, 0x5},
+       {0x900a2, 0x7c0},
+       {0x900a3, 0x109},
+       {0x900a4, 0x10},
+       {0x900a5, 0x10},
+       {0x900a6, 0x109},
+       {0x40000, 0x811},
+       {0x40020, 0x880},
+       {0x40040, 0x0},
+       {0x40060, 0x0},
+       {0x40001, 0x4008},
+       {0x40021, 0x83},
+       {0x40041, 0x4f},
+       {0x40061, 0x0},
+       {0x40002, 0x4040},
+       {0x40022, 0x83},
+       {0x40042, 0x51},
+       {0x40062, 0x0},
+       {0x40003, 0x811},
+       {0x40023, 0x880},
+       {0x40043, 0x0},
+       {0x40063, 0x0},
+       {0x40004, 0x720},
+       {0x40024, 0xf},
+       {0x40044, 0x1740},
+       {0x40064, 0x0},
+       {0x40005, 0x16},
+       {0x40025, 0x83},
+       {0x40045, 0x4b},
+       {0x40065, 0x0},
+       {0x40006, 0x716},
+       {0x40026, 0xf},
+       {0x40046, 0x2001},
+       {0x40066, 0x0},
+       {0x40007, 0x716},
+       {0x40027, 0xf},
+       {0x40047, 0x2800},
+       {0x40067, 0x0},
+       {0x40008, 0x716},
+       {0x40028, 0xf},
+       {0x40048, 0xf00},
+       {0x40068, 0x0},
+       {0x40009, 0x720},
+       {0x40029, 0xf},
+       {0x40049, 0x1400},
+       {0x40069, 0x0},
+       {0x4000a, 0xe08},
+       {0x4002a, 0xc15},
+       {0x4004a, 0x0},
+       {0x4006a, 0x0},
+       {0x4000b, 0x623},
+       {0x4002b, 0x15},
+       {0x4004b, 0x0},
+       {0x4006b, 0x0},
+       {0x4000c, 0x4028},
+       {0x4002c, 0x80},
+       {0x4004c, 0x0},
+       {0x4006c, 0x0},
+       {0x4000d, 0xe08},
+       {0x4002d, 0xc1a},
+       {0x4004d, 0x0},
+       {0x4006d, 0x0},
+       {0x4000e, 0x623},
+       {0x4002e, 0x1a},
+       {0x4004e, 0x0},
+       {0x4006e, 0x0},
+       {0x4000f, 0x4040},
+       {0x4002f, 0x80},
+       {0x4004f, 0x0},
+       {0x4006f, 0x0},
+       {0x40010, 0x2604},
+       {0x40030, 0x15},
+       {0x40050, 0x0},
+       {0x40070, 0x0},
+       {0x40011, 0x708},
+       {0x40031, 0x5},
+       {0x40051, 0x0},
+       {0x40071, 0x2002},
+       {0x40012, 0x8},
+       {0x40032, 0x80},
+       {0x40052, 0x0},
+       {0x40072, 0x0},
+       {0x40013, 0x2604},
+       {0x40033, 0x1a},
+       {0x40053, 0x0},
+       {0x40073, 0x0},
+       {0x40014, 0x708},
+       {0x40034, 0xa},
+       {0x40054, 0x0},
+       {0x40074, 0x2002},
+       {0x40015, 0x4040},
+       {0x40035, 0x80},
+       {0x40055, 0x0},
+       {0x40075, 0x0},
+       {0x40016, 0x60a},
+       {0x40036, 0x15},
+       {0x40056, 0x1200},
+       {0x40076, 0x0},
+       {0x40017, 0x61a},
+       {0x40037, 0x15},
+       {0x40057, 0x1300},
+       {0x40077, 0x0},
+       {0x40018, 0x60a},
+       {0x40038, 0x1a},
+       {0x40058, 0x1200},
+       {0x40078, 0x0},
+       {0x40019, 0x642},
+       {0x40039, 0x1a},
+       {0x40059, 0x1300},
+       {0x40079, 0x0},
+       {0x4001a, 0x4808},
+       {0x4003a, 0x880},
+       {0x4005a, 0x0},
+       {0x4007a, 0x0},
+       {0x900a7, 0x0},
+       {0x900a8, 0x790},
+       {0x900a9, 0x11a},
+       {0x900aa, 0x8},
+       {0x900ab, 0x7aa},
+       {0x900ac, 0x2a},
+       {0x900ad, 0x10},
+       {0x900ae, 0x7b2},
+       {0x900af, 0x2a},
+       {0x900b0, 0x0},
+       {0x900b1, 0x7c8},
+       {0x900b2, 0x109},
+       {0x900b3, 0x10},
+       {0x900b4, 0x2a8},
+       {0x900b5, 0x129},
+       {0x900b6, 0x8},
+       {0x900b7, 0x370},
+       {0x900b8, 0x129},
+       {0x900b9, 0xa},
+       {0x900ba, 0x3c8},
+       {0x900bb, 0x1a9},
+       {0x900bc, 0xc},
+       {0x900bd, 0x408},
+       {0x900be, 0x199},
+       {0x900bf, 0x14},
+       {0x900c0, 0x790},
+       {0x900c1, 0x11a},
+       {0x900c2, 0x8},
+       {0x900c3, 0x4},
+       {0x900c4, 0x18},
+       {0x900c5, 0xe},
+       {0x900c6, 0x408},
+       {0x900c7, 0x199},
+       {0x900c8, 0x8},
+       {0x900c9, 0x8568},
+       {0x900ca, 0x108},
+       {0x900cb, 0x18},
+       {0x900cc, 0x790},
+       {0x900cd, 0x16a},
+       {0x900ce, 0x8},
+       {0x900cf, 0x1d8},
+       {0x900d0, 0x169},
+       {0x900d1, 0x10},
+       {0x900d2, 0x8558},
+       {0x900d3, 0x168},
+       {0x900d4, 0x70},
+       {0x900d5, 0x788},
+       {0x900d6, 0x16a},
+       {0x900d7, 0x1ff8},
+       {0x900d8, 0x85a8},
+       {0x900d9, 0x1e8},
+       {0x900da, 0x50},
+       {0x900db, 0x798},
+       {0x900dc, 0x16a},
+       {0x900dd, 0x60},
+       {0x900de, 0x7a0},
+       {0x900df, 0x16a},
+       {0x900e0, 0x8},
+       {0x900e1, 0x8310},
+       {0x900e2, 0x168},
+       {0x900e3, 0x8},
+       {0x900e4, 0xa310},
+       {0x900e5, 0x168},
+       {0x900e6, 0xa},
+       {0x900e7, 0x408},
+       {0x900e8, 0x169},
+       {0x900e9, 0x6e},
+       {0x900ea, 0x0},
+       {0x900eb, 0x68},
+       {0x900ec, 0x0},
+       {0x900ed, 0x408},
+       {0x900ee, 0x169},
+       {0x900ef, 0x0},
+       {0x900f0, 0x8310},
+       {0x900f1, 0x168},
+       {0x900f2, 0x0},
+       {0x900f3, 0xa310},
+       {0x900f4, 0x168},
+       {0x900f5, 0x1ff8},
+       {0x900f6, 0x85a8},
+       {0x900f7, 0x1e8},
+       {0x900f8, 0x68},
+       {0x900f9, 0x798},
+       {0x900fa, 0x16a},
+       {0x900fb, 0x78},
+       {0x900fc, 0x7a0},
+       {0x900fd, 0x16a},
+       {0x900fe, 0x68},
+       {0x900ff, 0x790},
+       {0x90100, 0x16a},
+       {0x90101, 0x8},
+       {0x90102, 0x8b10},
+       {0x90103, 0x168},
+       {0x90104, 0x8},
+       {0x90105, 0xab10},
+       {0x90106, 0x168},
+       {0x90107, 0xa},
+       {0x90108, 0x408},
+       {0x90109, 0x169},
+       {0x9010a, 0x58},
+       {0x9010b, 0x0},
+       {0x9010c, 0x68},
+       {0x9010d, 0x0},
+       {0x9010e, 0x408},
+       {0x9010f, 0x169},
+       {0x90110, 0x0},
+       {0x90111, 0x8b10},
+       {0x90112, 0x168},
+       {0x90113, 0x0},
+       {0x90114, 0xab10},
+       {0x90115, 0x168},
+       {0x90116, 0x0},
+       {0x90117, 0x1d8},
+       {0x90118, 0x169},
+       {0x90119, 0x80},
+       {0x9011a, 0x790},
+       {0x9011b, 0x16a},
+       {0x9011c, 0x18},
+       {0x9011d, 0x7aa},
+       {0x9011e, 0x6a},
+       {0x9011f, 0xa},
+       {0x90120, 0x0},
+       {0x90121, 0x1e9},
+       {0x90122, 0x8},
+       {0x90123, 0x8080},
+       {0x90124, 0x108},
+       {0x90125, 0xf},
+       {0x90126, 0x408},
+       {0x90127, 0x169},
+       {0x90128, 0xc},
+       {0x90129, 0x0},
+       {0x9012a, 0x68},
+       {0x9012b, 0x9},
+       {0x9012c, 0x0},
+       {0x9012d, 0x1a9},
+       {0x9012e, 0x0},
+       {0x9012f, 0x408},
+       {0x90130, 0x169},
+       {0x90131, 0x0},
+       {0x90132, 0x8080},
+       {0x90133, 0x108},
+       {0x90134, 0x8},
+       {0x90135, 0x7aa},
+       {0x90136, 0x6a},
+       {0x90137, 0x0},
+       {0x90138, 0x8568},
+       {0x90139, 0x108},
+       {0x9013a, 0xb7},
+       {0x9013b, 0x790},
+       {0x9013c, 0x16a},
+       {0x9013d, 0x1f},
+       {0x9013e, 0x0},
+       {0x9013f, 0x68},
+       {0x90140, 0x8},
+       {0x90141, 0x8558},
+       {0x90142, 0x168},
+       {0x90143, 0xf},
+       {0x90144, 0x408},
+       {0x90145, 0x169},
+       {0x90146, 0xc},
+       {0x90147, 0x0},
+       {0x90148, 0x68},
+       {0x90149, 0x0},
+       {0x9014a, 0x408},
+       {0x9014b, 0x169},
+       {0x9014c, 0x0},
+       {0x9014d, 0x8558},
+       {0x9014e, 0x168},
+       {0x9014f, 0x8},
+       {0x90150, 0x3c8},
+       {0x90151, 0x1a9},
+       {0x90152, 0x3},
+       {0x90153, 0x370},
+       {0x90154, 0x129},
+       {0x90155, 0x20},
+       {0x90156, 0x2aa},
+       {0x90157, 0x9},
+       {0x90158, 0x0},
+       {0x90159, 0x400},
+       {0x9015a, 0x10e},
+       {0x9015b, 0x8},
+       {0x9015c, 0xe8},
+       {0x9015d, 0x109},
+       {0x9015e, 0x0},
+       {0x9015f, 0x8140},
+       {0x90160, 0x10c},
+       {0x90161, 0x10},
+       {0x90162, 0x8138},
+       {0x90163, 0x10c},
+       {0x90164, 0x8},
+       {0x90165, 0x7c8},
+       {0x90166, 0x101},
+       {0x90167, 0x8},
+       {0x90168, 0x0},
+       {0x90169, 0x8},
+       {0x9016a, 0x8},
+       {0x9016b, 0x448},
+       {0x9016c, 0x109},
+       {0x9016d, 0xf},
+       {0x9016e, 0x7c0},
+       {0x9016f, 0x109},
+       {0x90170, 0x0},
+       {0x90171, 0xe8},
+       {0x90172, 0x109},
+       {0x90173, 0x47},
+       {0x90174, 0x630},
+       {0x90175, 0x109},
+       {0x90176, 0x8},
+       {0x90177, 0x618},
+       {0x90178, 0x109},
+       {0x90179, 0x8},
+       {0x9017a, 0xe0},
+       {0x9017b, 0x109},
+       {0x9017c, 0x0},
+       {0x9017d, 0x7c8},
+       {0x9017e, 0x109},
+       {0x9017f, 0x8},
+       {0x90180, 0x8140},
+       {0x90181, 0x10c},
+       {0x90182, 0x0},
+       {0x90183, 0x1},
+       {0x90184, 0x8},
+       {0x90185, 0x8},
+       {0x90186, 0x4},
+       {0x90187, 0x8},
+       {0x90188, 0x8},
+       {0x90189, 0x7c8},
+       {0x9018a, 0x101},
+       {0x90006, 0x0},
+       {0x90007, 0x0},
+       {0x90008, 0x8},
+       {0x90009, 0x0},
+       {0x9000a, 0x0},
+       {0x9000b, 0x0},
+       {0xd00e7, 0x400},
+       {0x90017, 0x0},
+       {0x9001f, 0x2a},
+       {0x90026, 0x6a},
+       {0x400d0, 0x0},
+       {0x400d1, 0x101},
+       {0x400d2, 0x105},
+       {0x400d3, 0x107},
+       {0x400d4, 0x10f},
+       {0x400d5, 0x202},
+       {0x400d6, 0x20a},
+       {0x400d7, 0x20b},
+       {0x2003a, 0x2},
+       {0x2000b, 0x64},
+       {0x2000c, 0xc8},
+       {0x2000d, 0x7d0},
+       {0x2000e, 0x2c},
+       {0x12000b, 0x14},
+       {0x12000c, 0x29},
+       {0x12000d, 0x1a1},
+       {0x12000e, 0x10},
+       {0x9000c, 0x0},
+       {0x9000d, 0x173},
+       {0x9000e, 0x60},
+       {0x9000f, 0x6110},
+       {0x90010, 0x2152},
+       {0x90011, 0xdfbd},
+       {0x90012, 0x60},
+       {0x90013, 0x6152},
+       {0x20010, 0x5a},
+       {0x20011, 0x3},
+       {0x120010, 0x5a},
+       {0x120011, 0x3},
+       {0x40080, 0xe0},
+       {0x40081, 0x12},
+       {0x40082, 0xe0},
+       {0x40083, 0x12},
+       {0x40084, 0xe0},
+       {0x40085, 0x12},
+       {0x140080, 0xe0},
+       {0x140081, 0x12},
+       {0x140082, 0xe0},
+       {0x140083, 0x12},
+       {0x140084, 0xe0},
+       {0x140085, 0x12},
+       {0x400fd, 0xf},
+       {0x10011, 0x1},
+       {0x10012, 0x1},
+       {0x10013, 0x180},
+       {0x10018, 0x1},
+       {0x10002, 0x6209},
+       {0x100b2, 0x1},
+       {0x101b4, 0x1},
+       {0x102b4, 0x1},
+       {0x103b4, 0x1},
+       {0x104b4, 0x1},
+       {0x105b4, 0x1},
+       {0x106b4, 0x1},
+       {0x107b4, 0x1},
+       {0x108b4, 0x1},
+       {0x11011, 0x1},
+       {0x11012, 0x1},
+       {0x11013, 0x180},
+       {0x11018, 0x1},
+       {0x11002, 0x6209},
+       {0x110b2, 0x1},
+       {0x111b4, 0x1},
+       {0x112b4, 0x1},
+       {0x113b4, 0x1},
+       {0x114b4, 0x1},
+       {0x115b4, 0x1},
+       {0x116b4, 0x1},
+       {0x117b4, 0x1},
+       {0x118b4, 0x1},
+       {0x12011, 0x1},
+       {0x12012, 0x1},
+       {0x12013, 0x180},
+       {0x12018, 0x1},
+       {0x12002, 0x6209},
+       {0x120b2, 0x1},
+       {0x121b4, 0x1},
+       {0x122b4, 0x1},
+       {0x123b4, 0x1},
+       {0x124b4, 0x1},
+       {0x125b4, 0x1},
+       {0x126b4, 0x1},
+       {0x127b4, 0x1},
+       {0x128b4, 0x1},
+       {0x13011, 0x1},
+       {0x13012, 0x1},
+       {0x13013, 0x180},
+       {0x13018, 0x1},
+       {0x13002, 0x6209},
+       {0x130b2, 0x1},
+       {0x131b4, 0x1},
+       {0x132b4, 0x1},
+       {0x133b4, 0x1},
+       {0x134b4, 0x1},
+       {0x135b4, 0x1},
+       {0x136b4, 0x1},
+       {0x137b4, 0x1},
+       {0x138b4, 0x1},
+       {0x2003a, 0x2},
+       {0xc0080, 0x2},
+       {0xd0000, 0x1}
+};
+
+static struct dram_fsp_msg ddr_dram_fsp_msg[] = {
+       {
+               /* P0 3200mts 1D */
+               .drate = 3200,
+               .fw_type = FW_1D_IMAGE,
+               .fsp_cfg = ddr_fsp0_cfg,
+               .fsp_cfg_num = ARRAY_SIZE(ddr_fsp0_cfg),
+       },
+       {
+               /* P1 667mts 1D */
+               .drate = 667,
+               .fw_type = FW_1D_IMAGE,
+               .fsp_cfg = ddr_fsp1_cfg,
+               .fsp_cfg_num = ARRAY_SIZE(ddr_fsp1_cfg),
+       },
+       {
+               /* P0 3200mts 2D */
+               .drate = 3200,
+               .fw_type = FW_2D_IMAGE,
+               .fsp_cfg = ddr_fsp0_2d_cfg,
+               .fsp_cfg_num = ARRAY_SIZE(ddr_fsp0_2d_cfg),
+       },
+};
+
+/* ddr timing config params */
+struct dram_timing_info dram_timing = {
+       .ddrc_cfg = ddr_ddrc_cfg,
+       .ddrc_cfg_num = ARRAY_SIZE(ddr_ddrc_cfg),
+       .ddrphy_cfg = ddr_ddrphy_cfg,
+       .ddrphy_cfg_num = ARRAY_SIZE(ddr_ddrphy_cfg),
+       .fsp_msg = ddr_dram_fsp_msg,
+       .fsp_msg_num = ARRAY_SIZE(ddr_dram_fsp_msg),
+       .ddrphy_trained_csr = ddr_ddrphy_trained_csr,
+       .ddrphy_trained_csr_num = ARRAY_SIZE(ddr_ddrphy_trained_csr),
+       .ddrphy_pie = ddr_phy_pie,
+       .ddrphy_pie_num = ARRAY_SIZE(ddr_phy_pie),
+       .fsp_table = { 3200, 667, },
+};
diff --git a/board/google/imx8mq_phanbell/spl.c b/board/google/imx8mq_phanbell/spl.c
new file mode 100644 (file)
index 0000000..b6afdfc
--- /dev/null
@@ -0,0 +1,180 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2020 NXP
+ *
+ */
+
+#include <common.h>
+#include <hang.h>
+#include <asm/io.h>
+#include <errno.h>
+#include <asm/io.h>
+#include <asm/arch/ddr.h>
+#include <asm/arch/imx8mq_pins.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/arch/clock.h>
+#include <asm/mach-imx/iomux-v3.h>
+#include <asm/mach-imx/gpio.h>
+#include <asm/mach-imx/mxc_i2c.h>
+#include <asm/sections.h>
+#include <fsl_esdhc_imx.h>
+#include <mmc.h>
+#include <spl.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static void spl_dram_init(void)
+{
+       /* ddr init */
+       ddr_init(&dram_timing);
+}
+
+#define USDHC2_CD_GPIO IMX_GPIO_NR(2, 12)
+#define USDHC1_PWR_GPIO IMX_GPIO_NR(2, 10)
+#define USDHC2_PWR_GPIO IMX_GPIO_NR(2, 19)
+
+int board_mmc_getcd(struct mmc *mmc)
+{
+       struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
+       int ret = 0;
+
+       switch (cfg->esdhc_base) {
+       case USDHC1_BASE_ADDR:
+               ret = 1;
+               break;
+       case USDHC2_BASE_ADDR:
+               ret = !gpio_get_value(USDHC2_CD_GPIO);
+               return ret;
+       }
+
+       return 1;
+}
+
+#define USDHC_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_HYS | PAD_CTL_PUE | \
+                        PAD_CTL_FSEL2)
+#define USDHC_GPIO_PAD_CTRL (PAD_CTL_PUE | PAD_CTL_DSE1)
+
+static iomux_v3_cfg_t const usdhc1_pads[] = {
+       IMX8MQ_PAD_SD1_CLK__USDHC1_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+       IMX8MQ_PAD_SD1_CMD__USDHC1_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+       IMX8MQ_PAD_SD1_DATA0__USDHC1_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+       IMX8MQ_PAD_SD1_DATA1__USDHC1_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+       IMX8MQ_PAD_SD1_DATA2__USDHC1_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+       IMX8MQ_PAD_SD1_DATA3__USDHC1_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+       IMX8MQ_PAD_SD1_DATA4__USDHC1_DATA4 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+       IMX8MQ_PAD_SD1_DATA5__USDHC1_DATA5 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+       IMX8MQ_PAD_SD1_DATA6__USDHC1_DATA6 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+       IMX8MQ_PAD_SD1_DATA7__USDHC1_DATA7 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+       IMX8MQ_PAD_SD1_RESET_B__GPIO2_IO10 | MUX_PAD_CTRL(NO_PAD_CTRL),
+};
+
+static iomux_v3_cfg_t const usdhc2_pads[] = {
+       IMX8MQ_PAD_SD2_CLK__USDHC2_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL), /* 0xd6 */
+       IMX8MQ_PAD_SD2_CMD__USDHC2_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL), /* 0xd6 */
+       IMX8MQ_PAD_SD2_DATA0__USDHC2_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL), /* 0xd6 */
+       IMX8MQ_PAD_SD2_DATA1__USDHC2_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL), /* 0xd6 */
+       IMX8MQ_PAD_SD2_DATA2__USDHC2_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL), /* 0x16 */
+       IMX8MQ_PAD_SD2_DATA3__USDHC2_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL), /* 0xd6 */
+       IMX8MQ_PAD_SD2_CD_B__GPIO2_IO12 | MUX_PAD_CTRL(USDHC_GPIO_PAD_CTRL),
+       IMX8MQ_PAD_SD2_RESET_B__GPIO2_IO19 | MUX_PAD_CTRL(USDHC_GPIO_PAD_CTRL),
+};
+
+static struct fsl_esdhc_cfg usdhc_cfg[2] = {
+       {USDHC1_BASE_ADDR},
+       {USDHC2_BASE_ADDR},
+};
+
+int board_mmc_init(bd_t *bis)
+{
+       int i, ret;
+       /*
+        * According to the board_mmc_init() the following map is done:
+        * (U-Boot device node)    (Physical Port)
+        * mmc0                    USDHC1
+        * mmc1                    USDHC2
+        */
+       for (i = 0; i < CONFIG_SYS_FSL_USDHC_NUM; i++) {
+               switch (i) {
+               case 0:
+                       init_clk_usdhc(0);
+                       usdhc_cfg[0].sdhc_clk = mxc_get_clock(USDHC1_CLK_ROOT);
+                       usdhc_cfg[0].max_bus_width = 8;
+                       imx_iomux_v3_setup_multiple_pads(usdhc1_pads,
+                                                        ARRAY_SIZE(usdhc1_pads));
+                       gpio_request(USDHC1_PWR_GPIO, "usdhc1_reset");
+                       gpio_direction_output(USDHC1_PWR_GPIO, 0);
+                       udelay(500);
+                       gpio_direction_output(USDHC1_PWR_GPIO, 1);
+                       break;
+               case 1:
+                       init_clk_usdhc(1);
+                       usdhc_cfg[1].sdhc_clk = mxc_get_clock(USDHC2_CLK_ROOT);
+                       usdhc_cfg[1].max_bus_width = 4;
+                       imx_iomux_v3_setup_multiple_pads(usdhc2_pads,
+                                                        ARRAY_SIZE(usdhc2_pads));
+                       gpio_request(USDHC2_PWR_GPIO, "usdhc2_reset");
+                       gpio_direction_output(USDHC2_PWR_GPIO, 0);
+                       udelay(500);
+                       gpio_direction_output(USDHC2_PWR_GPIO, 1);
+                       break;
+               default:
+                       printf("Warning: you configured more USDHC controllers(%d) than supported by the board\n", i + 1);
+                       return -EINVAL;
+               }
+
+               ret = fsl_esdhc_initialize(bis, &usdhc_cfg[i]);
+               if (ret)
+                       return ret;
+       }
+
+       return 0;
+}
+
+void spl_board_init(void)
+{
+       puts("Normal Boot\n");
+}
+
+#ifdef CONFIG_SPL_LOAD_FIT
+int board_fit_config_name_match(const char *name)
+{
+       /* Just empty function now - can't decide what to choose */
+       debug("%s: %s\n", __func__, name);
+
+       return 0;
+}
+#endif
+
+void board_init_f(ulong dummy)
+{
+       int ret;
+
+       /* Clear global data */
+       memset((void *)gd, 0, sizeof(gd_t));
+
+       arch_cpu_init();
+
+       init_uart_clk(0);
+
+       board_early_init_f();
+
+       timer_init();
+
+       preloader_console_init();
+
+       /* Clear the BSS. */
+       memset(__bss_start, 0, __bss_end - __bss_start);
+
+       ret = spl_init();
+       if (ret) {
+               debug("spl_init() failed: %d\n", ret);
+               hang();
+       }
+
+       enable_tzc380();
+
+       /* DDR initialization */
+       spl_dram_init();
+
+       board_init_r(NULL, 0);
+}
index c661d2e06ae3d2ff8998b14bc77034bbf9fc9765..89becf41c50f7930535fd040bade52e7f304140a 100644 (file)
@@ -5,6 +5,13 @@ F:      board/rockchip/evb_rk3328
 F:      include/configs/evb_rk3328.h
 F:      configs/evb-rk3328_defconfig
 
+ROC-RK3328-CC
+M:      Loic Devulder <ldevulder@suse.com>
+M:      Chen-Yu Tsai <wens@csie.org>
+S:      Maintained
+F:      configs/roc-cc-rk3328_defconfig
+F:      arch/arm/dts/rk3328-roc-cc-u-boot.dtsi
+
 ROCK64-RK3328
 M:      Matwey V. Kornilov <matwey.kornilov@gmail.com>
 S:      Maintained
index 0834254f6de19f63293a5d9dcb0a92aa6e936cd1..792df1087f5b30bbbcf1ef7f78034092c2d0b6f9 100644 (file)
@@ -42,6 +42,13 @@ S:   Maintained
 F:     configs/nanopi-m4-rk3399_defconfig
 F:     arch/arm/dts/rk3399-nanopi-m4-u-boot.dtsi
 
+NANOPI-M4-2GB
+M:     Jagan Teki <jagan@amarulasolutions.com>
+M:     Deepak Das <deepakdas.linux@gmail.com>
+S:     Maintained
+F:     configs/nanopi-m4-2gb-rk3399_defconfig
+F:     arch/arm/dts/rk3399-nanopi-m4-2gb-u-boot.dtsi
+
 NANOPI-NEO4
 M:     Jagan Teki <jagan@amarulasolutions.com>
 S:     Maintained
index 3f85f1ac89b5b18d08371e248df086f31dba64cf..8c4a359c75029cfdd7cd3e11796d29c97421753e 100644 (file)
@@ -137,22 +137,79 @@ iomux_v3_cfg_t const usdhc3_pads[] = {
 
 int mx6_rgmii_rework(struct phy_device *phydev)
 {
-       /* control data pad skew - devaddr = 0x02, register = 0x04 */
-       ksz9031_phy_extended_write(phydev, 0x02,
-                                  MII_KSZ9031_EXT_RGMII_CTRL_SIG_SKEW,
-                                  MII_KSZ9031_MOD_DATA_NO_POST_INC, 0x0000);
-       /* rx data pad skew - devaddr = 0x02, register = 0x05 */
-       ksz9031_phy_extended_write(phydev, 0x02,
-                                  MII_KSZ9031_EXT_RGMII_RX_DATA_SKEW,
-                                  MII_KSZ9031_MOD_DATA_NO_POST_INC, 0x0000);
-       /* tx data pad skew - devaddr = 0x02, register = 0x05 */
-       ksz9031_phy_extended_write(phydev, 0x02,
-                                  MII_KSZ9031_EXT_RGMII_TX_DATA_SKEW,
-                                  MII_KSZ9031_MOD_DATA_NO_POST_INC, 0x0000);
-       /* gtx and rx clock pad skew - devaddr = 0x02, register = 0x08 */
-       ksz9031_phy_extended_write(phydev, 0x02,
-                                  MII_KSZ9031_EXT_RGMII_CLOCK_SKEW,
-                                  MII_KSZ9031_MOD_DATA_NO_POST_INC, 0x03FF);
+       int tmp;
+
+       switch (ksz9xx1_phy_get_id(phydev) & MII_KSZ9x31_SILICON_REV_MASK) {
+       case PHY_ID_KSZ9131:
+               /* read rxc dll control - devaddr = 0x02, register = 0x4c */
+               tmp = ksz9031_phy_extended_read(phydev, 0x02,
+                                          MII_KSZ9131_EXT_RGMII_2NS_SKEW_RXDLL,
+                                          MII_KSZ9031_MOD_DATA_NO_POST_INC);
+               /* disable rxdll bypass (enable 2ns skew delay on RXC) */
+               tmp &= ~MII_KSZ9131_RXTXDLL_BYPASS;
+               /* rxc data pad skew 2ns - devaddr = 0x02, register = 0x4c */
+               ksz9031_phy_extended_write(phydev, 0x02,
+                                          MII_KSZ9131_EXT_RGMII_2NS_SKEW_RXDLL,
+                                          MII_KSZ9031_MOD_DATA_NO_POST_INC,
+                                          tmp);
+               /* read txc dll control - devaddr = 0x02, register = 0x4d */
+               tmp = ksz9031_phy_extended_read(phydev, 0x02,
+                                          MII_KSZ9131_EXT_RGMII_2NS_SKEW_TXDLL,
+                                          MII_KSZ9031_MOD_DATA_NO_POST_INC);
+               /* disable rxdll bypass (enable 2ns skew delay on TXC) */
+               tmp &= ~MII_KSZ9131_RXTXDLL_BYPASS;
+               /* txc data pad skew 2ns - devaddr = 0x02, register = 0x4d */
+               ksz9031_phy_extended_write(phydev, 0x02,
+                                          MII_KSZ9131_EXT_RGMII_2NS_SKEW_TXDLL,
+                                          MII_KSZ9031_MOD_DATA_NO_POST_INC,
+                                          tmp);
+
+               /* control data pad skew - devaddr = 0x02, register = 0x04 */
+               ksz9031_phy_extended_write(phydev, 0x02,
+                                          MII_KSZ9031_EXT_RGMII_CTRL_SIG_SKEW,
+                                          MII_KSZ9031_MOD_DATA_NO_POST_INC,
+                                          0x007d);
+               /* rx data pad skew - devaddr = 0x02, register = 0x05 */
+               ksz9031_phy_extended_write(phydev, 0x02,
+                                          MII_KSZ9031_EXT_RGMII_RX_DATA_SKEW,
+                                          MII_KSZ9031_MOD_DATA_NO_POST_INC,
+                                          0x7777);
+               /* tx data pad skew - devaddr = 0x02, register = 0x05 */
+               ksz9031_phy_extended_write(phydev, 0x02,
+                                          MII_KSZ9031_EXT_RGMII_TX_DATA_SKEW,
+                                          MII_KSZ9031_MOD_DATA_NO_POST_INC,
+                                          0xdddd);
+               /* gtx and rx clock pad skew - devaddr = 0x02,register = 0x08 */
+               ksz9031_phy_extended_write(phydev, 0x02,
+                                          MII_KSZ9031_EXT_RGMII_CLOCK_SKEW,
+                                          MII_KSZ9031_MOD_DATA_NO_POST_INC,
+                                          0x0007);
+               break;
+       case PHY_ID_KSZ9031:
+       default:
+               /* control data pad skew - devaddr = 0x02, register = 0x04 */
+               ksz9031_phy_extended_write(phydev, 0x02,
+                                          MII_KSZ9031_EXT_RGMII_CTRL_SIG_SKEW,
+                                          MII_KSZ9031_MOD_DATA_NO_POST_INC,
+                                          0x0000);
+               /* rx data pad skew - devaddr = 0x02, register = 0x05 */
+               ksz9031_phy_extended_write(phydev, 0x02,
+                                          MII_KSZ9031_EXT_RGMII_RX_DATA_SKEW,
+                                          MII_KSZ9031_MOD_DATA_NO_POST_INC,
+                                          0x0000);
+               /* tx data pad skew - devaddr = 0x02, register = 0x05 */
+               ksz9031_phy_extended_write(phydev, 0x02,
+                                          MII_KSZ9031_EXT_RGMII_TX_DATA_SKEW,
+                                          MII_KSZ9031_MOD_DATA_NO_POST_INC,
+                                          0x0000);
+               /* gtx and rx clock pad skew - devaddr = 0x02,register = 0x08 */
+               ksz9031_phy_extended_write(phydev, 0x02,
+                                          MII_KSZ9031_EXT_RGMII_CLOCK_SKEW,
+                                          MII_KSZ9031_MOD_DATA_NO_POST_INC,
+                                          0x03FF);
+               break;
+       }
+
        return 0;
 }
 
index a5dc540820545af275cee3b0c1ab4c027e9246e6..dc5bd84f332e40eb542cb47abc1b4650ead764f5 100644 (file)
@@ -169,12 +169,3 @@ void board_init_f(ulong dummy)
 
        board_init_r(NULL, 0);
 }
-
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-       puts("resetting ...\n");
-
-       reset_cpu(WDOG1_BASE_ADDR);
-
-       return 0;
-}
index cb9b4e3b0a9f95429f690ae0cd419915e979469e..35866e096a3294ada1e285687d01062dd00daf50 100644 (file)
@@ -9,6 +9,7 @@
 #include <asm/io.h>
 #include <miiphy.h>
 #include <netdev.h>
+#include <micrel.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -37,14 +38,62 @@ static int setup_fec(void)
 
 int board_phy_config(struct phy_device *phydev)
 {
-       /* enable rgmii rxc skew and phy mode select to RGMII copper */
-       phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x1f);
-       phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x8);
+       int tmp;
 
-       phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x00);
-       phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x82ee);
-       phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x05);
-       phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x100);
+       switch (ksz9xx1_phy_get_id(phydev) & MII_KSZ9x31_SILICON_REV_MASK) {
+       case PHY_ID_KSZ9031:
+               /*
+                * The PHY adds 1.2ns for the RXC and 0ns for TXC clock by
+                * default. The MAC and the layout don't add a skew between
+                * clock and data.
+                * Add 0.3ns for the RXC path and 0.96 + 0.42 ns (1.38 ns) for
+                * the TXC path to get the required clock skews.
+                */
+               /* control data pad skew - devaddr = 0x02, register = 0x04 */
+               ksz9031_phy_extended_write(phydev, 0x02,
+                                          MII_KSZ9031_EXT_RGMII_CTRL_SIG_SKEW,
+                                          MII_KSZ9031_MOD_DATA_NO_POST_INC,
+                                          0x0070);
+               /* rx data pad skew - devaddr = 0x02, register = 0x05 */
+               ksz9031_phy_extended_write(phydev, 0x02,
+                                          MII_KSZ9031_EXT_RGMII_RX_DATA_SKEW,
+                                          MII_KSZ9031_MOD_DATA_NO_POST_INC,
+                                          0x7777);
+               /* tx data pad skew - devaddr = 0x02, register = 0x06 */
+               ksz9031_phy_extended_write(phydev, 0x02,
+                                          MII_KSZ9031_EXT_RGMII_TX_DATA_SKEW,
+                                          MII_KSZ9031_MOD_DATA_NO_POST_INC,
+                                          0x0000);
+               /* gtx and rx clock pad skew - devaddr = 0x02,register = 0x08 */
+               ksz9031_phy_extended_write(phydev, 0x02,
+                                          MII_KSZ9031_EXT_RGMII_CLOCK_SKEW,
+                                          MII_KSZ9031_MOD_DATA_NO_POST_INC,
+                                          0x03f4);
+               break;
+       case PHY_ID_KSZ9131:
+       default:
+               /* read rxc dll control - devaddr = 0x2, register = 0x4c */
+               tmp = ksz9031_phy_extended_read(phydev, 0x02,
+                                       MII_KSZ9131_EXT_RGMII_2NS_SKEW_RXDLL,
+                                       MII_KSZ9031_MOD_DATA_NO_POST_INC);
+               /* disable rxdll bypass (enable 2ns skew delay on RXC) */
+               tmp &= ~MII_KSZ9131_RXTXDLL_BYPASS;
+               /* rxc data pad skew 2ns - devaddr = 0x02, register = 0x4c */
+               tmp = ksz9031_phy_extended_write(phydev, 0x02,
+                                       MII_KSZ9131_EXT_RGMII_2NS_SKEW_RXDLL,
+                                       MII_KSZ9031_MOD_DATA_NO_POST_INC, tmp);
+               /* read txc dll control - devaddr = 0x02, register = 0x4d */
+               tmp = ksz9031_phy_extended_read(phydev, 0x02,
+                                       MII_KSZ9131_EXT_RGMII_2NS_SKEW_TXDLL,
+                                       MII_KSZ9031_MOD_DATA_NO_POST_INC);
+               /* disable txdll bypass (enable 2ns skew delay on TXC) */
+               tmp &= ~MII_KSZ9131_RXTXDLL_BYPASS;
+               /* rxc data pad skew 2ns - devaddr = 0x02, register = 0x4d */
+               tmp = ksz9031_phy_extended_write(phydev, 0x02,
+                                       MII_KSZ9131_EXT_RGMII_2NS_SKEW_TXDLL,
+                                       MII_KSZ9031_MOD_DATA_NO_POST_INC, tmp);
+               break;
+       }
 
        if (phydev->drv->config)
                phydev->drv->config(phydev);
index ef5bf666964f5680ca7982844f896c1a634aa55d..9feadb5e43e7078268086d08af76c0c963422537 100644 (file)
@@ -663,15 +663,6 @@ config SPL_MMC_SUPPORT
          this option to build the drivers in drivers/mmc as part of an SPL
          build.
 
-config SPL_FORCE_MMC_BOOT
-       bool "Force SPL booting from MMC"
-       depends on SPL_MMC_SUPPORT
-       default n
-       help
-         Force SPL to use MMC device for Linux kernel booting even when the
-         SoC ROM recognized boot medium is not eMMC/SD. This is crucial for
-         factory or 'falcon mode' booting.
-
 config SPL_MMC_TINY
        bool "Tiny MMC framework in SPL"
        depends on SPL_MMC_SUPPORT
index 388330afc4149b8ae5598194732ec6e74a3e891d..628b3516a8c53e38b2c876b6efa1cab08cf28408 100644 (file)
@@ -1,6 +1,4 @@
 CONFIG_ARM=y
-CONFIG_SPL_SYS_ICACHE_OFF=y
-CONFIG_SPL_SYS_DCACHE_OFF=y
 CONFIG_ARCH_IMX8=y
 CONFIG_SYS_TEXT_BASE=0x80020000
 CONFIG_SPL_GPIO_SUPPORT=y
index 4e10efd758713fb1fadd2368c4fa3b662c3cb5ec..6241375c4c783046d6ea2762143c92db014029cb 100644 (file)
@@ -39,7 +39,6 @@ CONFIG_SPL_DMA=y
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_SAVEENV=y
 CONFIG_SPL_I2C_SUPPORT=y
-CONFIG_SPL_FORCE_MMC_BOOT=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SPL_WATCHDOG_SUPPORT=y
index f8d66745dc34c8f8005704928ee1451328ae68a0..b2fda44ec26c2dd69b39bdfbb1063481709b9206 100644 (file)
@@ -85,6 +85,8 @@ CONFIG_SPL_RAM=y
 CONFIG_TPL_RAM=y
 CONFIG_ROCKCHIP_SDRAM_COMMON=y
 CONFIG_DM_RESET=y
+CONFIG_DM_RNG=y
+CONFIG_RNG_ROCKCHIP=y
 # CONFIG_SPECIFY_CONSOLE_INDEX is not set
 CONFIG_DEBUG_UART_SHIFT=2
 CONFIG_DEBUG_UART_SKIP_INIT=y
index 5bbdc002148c1d24d72472ea902e404d8feaec4a..7667bb037b3d28dcec2d58e3a29237eaf408c086 100644 (file)
@@ -61,7 +61,6 @@ CONFIG_SF_DEFAULT_SPEED=20000000
 CONFIG_DM_ETH=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_GMAC_ROCKCHIP=y
-CONFIG_PHY=y
 CONFIG_PINCTRL=y
 CONFIG_SPL_PINCTRL=y
 CONFIG_DM_PMIC=y
index 3f74be3b3c4c316162b8fff701649b21999c1f6d..7f14e18b1b31966a5c79390cd9b88ec7c276b6a2 100644 (file)
@@ -39,6 +39,8 @@ CONFIG_PMIC_RK8XX=y
 CONFIG_REGULATOR_PWM=y
 CONFIG_REGULATOR_RK8XX=y
 CONFIG_PWM_ROCKCHIP=y
+CONFIG_DM_RNG=y
+CONFIG_RNG_ROCKCHIP=y
 CONFIG_BAUDRATE=1500000
 CONFIG_DEBUG_UART_SHIFT=2
 CONFIG_SYSRESET=y
index 957875f782c3da105a3669a2f86ce5d66b57281d..3cae981a61d3487d528fb3211f22d742d76eb857 100644 (file)
@@ -1,6 +1,4 @@
 CONFIG_ARM=y
-CONFIG_SPL_SYS_ICACHE_OFF=y
-CONFIG_SPL_SYS_DCACHE_OFF=y
 CONFIG_ARCH_IMX8=y
 CONFIG_SYS_TEXT_BASE=0x80020000
 CONFIG_SPL_GPIO_SUPPORT=y
index e23d77d9f829704202b8eab364b45039faedb760..d4feb661629f3b5d1bf2594411399f9fbf11804f 100644 (file)
@@ -30,7 +30,6 @@ CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0
 CONFIG_SUPPORT_EMMC_BOOT_OVERRIDE_PART_CONFIG=y
 CONFIG_SPL_DMA=y
-CONFIG_SPL_FORCE_MMC_BOOT=y
 CONFIG_SPL_MMC_TINY=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SPL_SPI_LOAD=y
index d988507bc3300522a960ec510f65fa42e86b6be3..9a72f46f276ff01ba51438bbd3429833a3a3b434 100644 (file)
@@ -1,6 +1,4 @@
 CONFIG_ARM=y
-CONFIG_SPL_SYS_ICACHE_OFF=y
-CONFIG_SPL_SYS_DCACHE_OFF=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
 CONFIG_SPL_GPIO_SUPPORT=y
@@ -30,6 +28,7 @@ CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SEPARATE_BSS=y
 CONFIG_SPL_I2C_SUPPORT=y
 CONFIG_SPL_POWER_SUPPORT=y
+CONFIG_SPL_WATCHDOG_SUPPORT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PROMPT="u-boot=> "
 # CONFIG_CMD_EXPORTENV is not set
@@ -82,5 +81,9 @@ CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_GPIO=y
 CONFIG_MXC_UART=y
 CONFIG_SYSRESET=y
+CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_PSCI=y
+CONFIG_SYSRESET_WATCHDOG=y
 CONFIG_DM_THERMAL=y
+# CONFIG_WATCHDOG is not set
+CONFIG_IMX_WATCHDOG=y
index f7485ab27270e2fc54d966c07cdbdacadddc23e8..bc6014d73ae60b529e00500527722b76203b1851 100644 (file)
@@ -1,6 +1,4 @@
 CONFIG_ARM=y
-CONFIG_SPL_SYS_ICACHE_OFF=y
-CONFIG_SPL_SYS_DCACHE_OFF=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
 CONFIG_SPL_GPIO_SUPPORT=y
@@ -32,6 +30,7 @@ CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_BOOTROM_SUPPORT=y
 CONFIG_SPL_SEPARATE_BSS=y
 CONFIG_SPL_I2C_SUPPORT=y
+CONFIG_SPL_WATCHDOG_SUPPORT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PROMPT="u-boot=> "
 # CONFIG_CMD_EXPORTENV is not set
@@ -76,5 +75,9 @@ CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_GPIO=y
 CONFIG_MXC_UART=y
 CONFIG_SYSRESET=y
+CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_PSCI=y
+CONFIG_SYSRESET_WATCHDOG=y
 CONFIG_DM_THERMAL=y
+# CONFIG_WATCHDOG is not set
+CONFIG_IMX_WATCHDOG=y
index ce6b342c36729c4baf8e2fdacd65491415f5f08b..44b2935f6998bff4f7a7bccea86c3b0981363dd6 100644 (file)
@@ -1,6 +1,4 @@
 CONFIG_ARM=y
-CONFIG_SPL_SYS_ICACHE_OFF=y
-CONFIG_SPL_SYS_DCACHE_OFF=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
 CONFIG_SPL_GPIO_SUPPORT=y
@@ -81,4 +79,8 @@ CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_GPIO=y
 CONFIG_MXC_UART=y
 CONFIG_SYSRESET=y
+CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_PSCI=y
+CONFIG_SYSRESET_WATCHDOG=y
+# CONFIG_WATCHDOG is not set
+CONFIG_IMX_WATCHDOG=y
index 23fdb3f92525235e4b894cf9ea6456d8fcb9f153..1504ecbbd647591670677e84e1678bce5ff9780c 100644 (file)
@@ -1,6 +1,4 @@
 CONFIG_ARM=y
-CONFIG_SPL_SYS_ICACHE_OFF=y
-CONFIG_SPL_SYS_DCACHE_OFF=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
 CONFIG_ENV_SIZE=0x1000
diff --git a/configs/imx8mq_phanbell_defconfig b/configs/imx8mq_phanbell_defconfig
new file mode 100644 (file)
index 0000000..5be02a3
--- /dev/null
@@ -0,0 +1,52 @@
+CONFIG_ARM=y
+CONFIG_SPL_SYS_ICACHE_OFF=y
+CONFIG_SPL_SYS_DCACHE_OFF=y
+CONFIG_ARCH_IMX8M=y
+CONFIG_SYS_TEXT_BASE=0x40200000
+CONFIG_ENV_SIZE=0x1000
+CONFIG_ENV_OFFSET=0x400000
+CONFIG_SYS_MALLOC_F_LEN=0x4000
+CONFIG_DM_GPIO=y
+CONFIG_TARGET_IMX8MQ_PHANBELL=y
+CONFIG_SPL_SERIAL_SUPPORT=y
+CONFIG_SPL=y
+CONFIG_CSF_SIZE=0x2000
+CONFIG_SPL_TEXT_BASE=0x7E1000
+CONFIG_FIT=y
+CONFIG_FIT_EXTERNAL_OFFSET=0x3000
+CONFIG_SPL_LOAD_FIT=y
+CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-imx/mkimage_fit_atf.sh"
+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/imx8m/imximage.cfg"
+CONFIG_SPL_BOARD_INIT=y
+CONFIG_HUSH_PARSER=y
+# CONFIG_BOOTM_NETBSD is not set
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_REGULATOR=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_FAT=y
+CONFIG_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="imx8mq-phanbell"
+CONFIG_ENV_IS_IN_MMC=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SAVED_DRAM_TIMING_BASE=0x40000000
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_MXC=y
+CONFIG_DM_MMC=y
+CONFIG_SUPPORT_EMMC_BOOT=y
+CONFIG_FSL_USDHC=y
+CONFIG_DM_ETH=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_IMX8M=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_IMX8M_POWER_DOMAIN=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_DM_RESET=y
+CONFIG_DM_THERMAL=y
+CONFIG_SD_BOOT=y
+# CONFIG_SPL_DOS_PARTITION is not set
index f7debfbe7b1247073892c36ca32ea0c752fa62a0..428c7c47cdf24e3946fedc6470943de0b17b200b 100644 (file)
@@ -1,6 +1,4 @@
 CONFIG_ARM=y
-CONFIG_SPL_SYS_ICACHE_OFF=y
-CONFIG_SPL_SYS_DCACHE_OFF=y
 CONFIG_ARCH_IMX8=y
 CONFIG_SYS_TEXT_BASE=0x80020000
 CONFIG_SPL_GPIO_SUPPORT=y
index 301747a56c799035ad10f5299df09cb05a77cde6..35191447aee20833abde6bc1e7a496006f73e1de 100644 (file)
@@ -1,6 +1,4 @@
 CONFIG_ARM=y
-CONFIG_SPL_SYS_ICACHE_OFF=y
-CONFIG_SPL_SYS_DCACHE_OFF=y
 CONFIG_ARCH_IMX8=y
 CONFIG_SYS_TEXT_BASE=0x80020000
 CONFIG_SPL_GPIO_SUPPORT=y
index 8a7e9ee9c74f132670c104677236fecceeedaeae..4cc37f5de7671aa01dc5e01919e951d866d79fa6 100644 (file)
@@ -1,6 +1,4 @@
 CONFIG_ARM=y
-CONFIG_SPL_SYS_ICACHE_OFF=y
-CONFIG_SPL_SYS_DCACHE_OFF=y
 CONFIG_ARCH_IMX8=y
 CONFIG_SYS_TEXT_BASE=0x80020000
 CONFIG_SPL_GPIO_SUPPORT=y
@@ -28,7 +26,6 @@ CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SEPARATE_BSS=y
 CONFIG_SPL_POWER_SUPPORT=y
 CONFIG_SPL_POWER_DOMAIN=y
-CONFIG_SPL_WATCHDOG_SUPPORT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_CMD_CPU=y
 # CONFIG_BOOTM_NETBSD is not set
diff --git a/configs/nanopi-m4-2gb-rk3399_defconfig b/configs/nanopi-m4-2gb-rk3399_defconfig
new file mode 100644 (file)
index 0000000..93c8db9
--- /dev/null
@@ -0,0 +1,63 @@
+CONFIG_ARM=y
+CONFIG_ARCH_ROCKCHIP=y
+CONFIG_SYS_TEXT_BASE=0x00200000
+CONFIG_ENV_OFFSET=0x3F8000
+CONFIG_ROCKCHIP_RK3399=y
+CONFIG_TARGET_EVB_RK3399=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_DEBUG_UART_BASE=0xFF1A0000
+CONFIG_DEBUG_UART_CLOCK=24000000
+CONFIG_DEBUG_UART=y
+CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-nanopi-m4-2gb.dtb"
+CONFIG_DISPLAY_BOARDINFO_LATE=y
+# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
+CONFIG_SPL_STACK_R=y
+CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000
+CONFIG_TPL=y
+CONFIG_CMD_BOOTZ=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_USB=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_TIME=y
+CONFIG_SPL_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="rk3399-nanopi-m4-2gb"
+CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
+CONFIG_ENV_IS_IN_MMC=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_ROCKCHIP_GPIO=y
+CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_MMC_DW=y
+CONFIG_MMC_DW_ROCKCHIP=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_ROCKCHIP=y
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_GMAC_ROCKCHIP=y
+CONFIG_PMIC_RK8XX=y
+CONFIG_REGULATOR_PWM=y
+CONFIG_REGULATOR_RK8XX=y
+CONFIG_PWM_ROCKCHIP=y
+CONFIG_BAUDRATE=1500000
+CONFIG_DEBUG_UART_SHIFT=2
+CONFIG_SYSRESET=y
+CONFIG_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_GENERIC=y
+CONFIG_USB_HOST_ETHER=y
+CONFIG_USB_ETHER_ASIX=y
+CONFIG_USB_ETHER_ASIX88179=y
+CONFIG_USB_ETHER_MCS7830=y
+CONFIG_USB_ETHER_RTL8152=y
+CONFIG_USB_ETHER_SMSC95XX=y
+CONFIG_USB_KEYBOARD=y
+CONFIG_SPL_TINY_MEMSET=y
+CONFIG_ERRNO_STR=y
+CONFIG_DM_VIDEO=y
+CONFIG_VIDEO_BPP16=y
+CONFIG_VIDEO_BPP32=y
+CONFIG_DISPLAY=y
+CONFIG_VIDEO_ROCKCHIP=y
+CONFIG_DISPLAY_ROCKCHIP_HDMI=y
diff --git a/configs/roc-cc-rk3328_defconfig b/configs/roc-cc-rk3328_defconfig
new file mode 100644 (file)
index 0000000..933a1c6
--- /dev/null
@@ -0,0 +1,102 @@
+CONFIG_ARM=y
+CONFIG_ARCH_ROCKCHIP=y
+CONFIG_SYS_TEXT_BASE=0x00200000
+CONFIG_SPL_GPIO_SUPPORT=y
+CONFIG_ENV_OFFSET=0x3F8000
+CONFIG_ROCKCHIP_RK3328=y
+CONFIG_TPL_ROCKCHIP_COMMON_BOARD=y
+CONFIG_TPL_LIBCOMMON_SUPPORT=y
+CONFIG_TPL_LIBGENERIC_SUPPORT=y
+CONFIG_SPL_DRIVERS_MISC_SUPPORT=y
+CONFIG_SPL_STACK_R_ADDR=0x600000
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_DEBUG_UART_BASE=0xFF130000
+CONFIG_DEBUG_UART_CLOCK=24000000
+CONFIG_SMBIOS_PRODUCT_NAME="roc-rk3328-cc"
+CONFIG_DEBUG_UART=y
+CONFIG_TPL_SYS_MALLOC_F_LEN=0x800
+# CONFIG_ANDROID_BOOT_IMAGE is not set
+CONFIG_FIT=y
+CONFIG_FIT_VERBOSE=y
+CONFIG_SPL_LOAD_FIT=y
+CONFIG_DEFAULT_FDT_FILE="rockchip/rk3328-roc-cc.dtb"
+CONFIG_MISC_INIT_R=y
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_DISPLAY_BOARDINFO_LATE=y
+# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
+CONFIG_TPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_STACK_R=y
+CONFIG_SPL_I2C_SUPPORT=y
+CONFIG_SPL_POWER_SUPPORT=y
+CONFIG_SPL_ATF=y
+CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
+CONFIG_CMD_BOOTZ=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_USB=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_TIME=y
+CONFIG_SPL_OF_CONTROL=y
+CONFIG_TPL_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="rk3328-roc-cc"
+CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
+CONFIG_TPL_OF_PLATDATA=y
+CONFIG_ENV_IS_IN_MMC=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_TPL_DM=y
+CONFIG_REGMAP=y
+CONFIG_SPL_REGMAP=y
+CONFIG_TPL_REGMAP=y
+CONFIG_SYSCON=y
+CONFIG_SPL_SYSCON=y
+CONFIG_TPL_SYSCON=y
+CONFIG_CLK=y
+CONFIG_SPL_CLK=y
+CONFIG_FASTBOOT_BUF_ADDR=0x800800
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
+CONFIG_ROCKCHIP_GPIO=y
+CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_MMC_DW=y
+CONFIG_MMC_DW_ROCKCHIP=y
+CONFIG_SF_DEFAULT_SPEED=20000000
+CONFIG_PHY_REALTEK=y
+CONFIG_DM_ETH=y
+CONFIG_PHY_GIGE=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_GMAC_ROCKCHIP=y
+CONFIG_PINCTRL=y
+CONFIG_SPL_PINCTRL=y
+CONFIG_DM_PMIC=y
+CONFIG_PMIC_RK8XX=y
+CONFIG_SPL_DM_REGULATOR=y
+CONFIG_REGULATOR_PWM=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_SPL_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_REGULATOR_RK8XX=y
+CONFIG_PWM_ROCKCHIP=y
+CONFIG_RAM=y
+CONFIG_SPL_RAM=y
+CONFIG_TPL_RAM=y
+CONFIG_DM_RESET=y
+CONFIG_BAUDRATE=1500000
+CONFIG_DEBUG_UART_SHIFT=2
+CONFIG_SYSRESET=y
+# CONFIG_TPL_SYSRESET is not set
+CONFIG_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_GENERIC=y
+CONFIG_USB_OHCI_HCD=y
+CONFIG_USB_OHCI_GENERIC=y
+CONFIG_USB_DWC2=y
+CONFIG_USB_DWC3=y
+# CONFIG_USB_DWC3_GADGET is not set
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_DWC2_OTG=y
+CONFIG_SPL_TINY_MEMSET=y
+CONFIG_TPL_TINY_MEMSET=y
+CONFIG_ERRNO_STR=y
+CONFIG_SMBIOS_MANUFACTURER="firefly"
diff --git a/configs/roc-pc-mezzanine-rk3399_defconfig b/configs/roc-pc-mezzanine-rk3399_defconfig
new file mode 100644 (file)
index 0000000..5a694ed
--- /dev/null
@@ -0,0 +1,67 @@
+CONFIG_ARM=y
+CONFIG_ARCH_ROCKCHIP=y
+CONFIG_SYS_TEXT_BASE=0x00200000
+CONFIG_ENV_OFFSET=0x3F8000
+CONFIG_ROCKCHIP_RK3399=y
+CONFIG_TARGET_ROC_PC_RK3399=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_DEBUG_UART_BASE=0xFF1A0000
+CONFIG_DEBUG_UART_CLOCK=24000000
+CONFIG_DEBUG_UART=y
+CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-roc-pc-mezzanine.dtb"
+CONFIG_DISPLAY_BOARDINFO_LATE=y
+# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
+CONFIG_SPL_STACK_R=y
+CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000
+CONFIG_TPL=y
+CONFIG_TPL_GPIO_SUPPORT=y
+CONFIG_CMD_BOOTZ=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_USB=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_TIME=y
+CONFIG_SPL_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="rk3399-roc-pc-mezzanine"
+CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
+CONFIG_ENV_IS_IN_MMC=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_ROCKCHIP_GPIO=y
+CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_MMC_DW=y
+CONFIG_MMC_DW_ROCKCHIP=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_ROCKCHIP=y
+CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_GMAC_ROCKCHIP=y
+CONFIG_PMIC_RK8XX=y
+CONFIG_REGULATOR_PWM=y
+CONFIG_REGULATOR_RK8XX=y
+CONFIG_PWM_ROCKCHIP=y
+CONFIG_RAM_RK3399_LPDDR4=y
+CONFIG_BAUDRATE=1500000
+CONFIG_DEBUG_UART_SHIFT=2
+CONFIG_ROCKCHIP_SPI=y
+CONFIG_SYSRESET=y
+CONFIG_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_GENERIC=y
+CONFIG_USB_HOST_ETHER=y
+CONFIG_USB_ETHER_ASIX=y
+CONFIG_USB_ETHER_ASIX88179=y
+CONFIG_USB_ETHER_MCS7830=y
+CONFIG_USB_ETHER_RTL8152=y
+CONFIG_USB_ETHER_SMSC95XX=y
+CONFIG_USB_KEYBOARD=y
+CONFIG_SPL_TINY_MEMSET=y
+CONFIG_ERRNO_STR=y
+CONFIG_DM_VIDEO=y
+CONFIG_VIDEO_BPP16=y
+CONFIG_VIDEO_BPP32=y
+CONFIG_DISPLAY=y
+CONFIG_VIDEO_ROCKCHIP=y
+CONFIG_DISPLAY_ROCKCHIP_HDMI=y
index 826c7a691742c564fc0d3487651467492b6b876f..7d096d38c6d0c8f4f77cafde330f347f1ce63d07 100644 (file)
@@ -60,7 +60,6 @@ CONFIG_SF_DEFAULT_SPEED=20000000
 CONFIG_DM_ETH=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_GMAC_ROCKCHIP=y
-CONFIG_PHY=y
 CONFIG_PINCTRL=y
 CONFIG_SPL_PINCTRL=y
 CONFIG_DM_PMIC=y
index 590750e9b2d10321ffd94a5074edf6a8587004d1..c852ad26237c629e98c9b13582e618b304806337 100644 (file)
@@ -1,6 +1,4 @@
 CONFIG_ARM=y
-CONFIG_SPL_SYS_ICACHE_OFF=y
-CONFIG_SPL_SYS_DCACHE_OFF=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
 CONFIG_SPL_GPIO_SUPPORT=y
@@ -38,6 +36,7 @@ CONFIG_SPL_SEPARATE_BSS=y
 CONFIG_SPL_I2C_SUPPORT=y
 CONFIG_SPL_POWER_SUPPORT=y
 CONFIG_SPL_USB_HOST_SUPPORT=y
+CONFIG_SPL_WATCHDOG_SUPPORT=y
 CONFIG_SYS_PROMPT="Verdin iMX8MM # "
 # CONFIG_BOOTM_NETBSD is not set
 CONFIG_CMD_ASKENV=y
@@ -94,5 +93,9 @@ CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_GPIO=y
 CONFIG_MXC_UART=y
 CONFIG_SYSRESET=y
+CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_PSCI=y
+CONFIG_SYSRESET_WATCHDOG=y
 CONFIG_DM_THERMAL=y
+# CONFIG_WATCHDOG is not set
+CONFIG_IMX_WATCHDOG=y
index 9b699b9ae5d35ae3e53045e0c296c77124360cb6..70c8798ed2d07de58f09d8cfe3d681151e729d91 100644 (file)
@@ -52,10 +52,12 @@ Two RK3308 boards are supported:
    - EVB RK3308 - use evb-rk3308 configuration
    - ROC-CC-RK3308 - use roc-cc-rk3308 configuration
 
-Two RK3328 board are supported:
+Three RK3328 boards are supported:
 
    - EVB RK3328 - use evb-rk3328_defconfig
    - Pine64 Rock64 board - use rock64-rk3328_defconfig
+   - Firefly / Libre Computer Project ROC-RK3328-CC board -
+     use roc-cc-rk3328_defconfig
 
 Size RK3399 boards are supported (aarch64):
 
diff --git a/doc/imx/ahab/csf_examples/csf_enc_boot_image.txt b/doc/imx/ahab/csf_examples/csf_enc_boot_image.txt
new file mode 100644 (file)
index 0000000..6c70db6
--- /dev/null
@@ -0,0 +1,27 @@
+[Header]
+Target = AHAB
+Version = 1.0
+
+[Install SRK]
+# SRK table generated by srktool
+File = "./release/crts/SRK_1_2_3_4_table.bin"
+# Public key certificate in PEM format
+Source = "./release/crts/SRK1_sha384_secp384r1_v3_usr_crt.pem"
+# Index of the public key certificate within the SRK table (0 .. 3)
+Source index = 0
+# Type of SRK set (NXP or OEM)
+Source set = OEM
+# bitmask of the revoked SRKs
+Revocations = 0x0
+
+[Authenticate Data]
+# Binary to be signed generated by mkimage
+File = "flash.bin"
+# Offsets = Container header  Signature block (printed out by mkimage)
+Offsets   = 0x400             0x590
+
+[Install Secret Key]
+Key = "dek.bin"
+Key Length = 128
+#Key Identifier = 0x1234CAFE
+Image Indexes = 0xFFFFFFFE
diff --git a/doc/imx/ahab/guides/mx8_mx8x_encrypted_boot.txt b/doc/imx/ahab/guides/mx8_mx8x_encrypted_boot.txt
new file mode 100644 (file)
index 0000000..dfea4c8
--- /dev/null
@@ -0,0 +1,293 @@
+         +=========================================================+
+         +      i.MX 8, i.MX 8X Encrypted Boot guide using AHAB    +
+         +=========================================================+
+
+1. AHAB Encrypted Boot process
+-------------------------------
+
+This document describes a step-by-step procedure on how to encrypt and sign a
+bootloader image for i.MX8/8x family devices. It is assumed that the reader
+is familiar with basic AHAB concepts and has already closed the device,
+step-by-step procedure can be found in mx8_mx8x_secure_boot.txt and
+mx8_mx8x_spl_secure_boot.txt guides.
+
+The steps described in this document were based in i.MX8QM device, the same
+concept can be applied to others processors in i.MX8/8X family devices.
+
+1.1 Understanding the encrypted image signature block
+------------------------------------------------------
+
+As described in mx8_mx8x_secure_boot.txt guide a single binary is used to boot
+the device. The imx-mkimage tool combines all the input images in a container
+structure, generating a flash.bin binary.
+
+AHAB is able to decrypt image containers by calling SECO authentication
+functions, the image must be encrypted by CST and the resulting DEK (Data
+Encryption Key) must be encapsulated and included into the container signature
+block:
+
+                +----------------------------+
+                |                            |  ^
+                |                            |  |
+                |      Container header      |  |
+                |                            |  |
+                |                            |  |
+                +---+------------------------+  |
+                | S | Signature block header |  | Signed
+                | i +------------------------+  |
+                | g |                        |  |
+                | n |                        |  |
+                | a |        SRK table       |  |
+                | t |                        |  |
+                | u |                        |  v
+                | r +------------------------+
+                | e |       Signature        |
+                |   +------------------------+
+                | B |                        |
+                | l |        SGK Key         |
+                | o | Certificate (optional) |
+                | c |                        |
+                | k +------------------------+
+                |   |        DEK Blob        |
+                +---+------------------------+
+
+1.1.1 Understanding and generating the DEK blob
+------------------------------------------------
+
+The encrypted boot image requires a DEK blob on each time AHAB is used to
+decrypt an image. The DEK blob is used as a security layer to wrap and store
+the DEK off-chip using the OTPMK which is unique per device.
+
+On i.MX8/8x devices the DEK blob is generated using the SECO API, the following
+funtion is available in U-Boot and can be executed through dek_blob command:
+
+- sc_seco_gen_key_blob(sc_ipc_t ipc, uint32_t id, sc_faddr_t load_addr,
+                      sc_faddr_t export_addr, uint16_t max_size)
+
+Details in API usage can be found in SCFW API guide [1].
+
+1.2 Enabling the encrypted boot support in U-Boot
+--------------------------------------------------
+
+For deploying an encrypted boot image additional U-Boot tools are needed,
+please be sure to have the following features enabled, this can be achieved
+by following one of the methods below:
+
+- Defconfig:
+
+  CONFIG_AHAB_BOOT=y
+  CONFIG_CMD_DEKBLOB=y
+  CONFIG_IMX_SECO_DEK_ENCAP=y
+  CONFIG_FAT_WRITE=y
+
+- Kconfig:
+
+  ARM architecture -> Support i.MX8 AHAB features
+  ARM architecture -> Support the 'dek_blob' command
+  File systems -> Enable FAT filesystem support-> Enable FAT filesystem
+  write support
+
+1.3 Enabling the encrypted boot support in CST
+-----------------------------------------------
+
+The encryption feature is not enabled by default in Code Signing tools (CST).
+The CST backend must be recompiled, execute the following commands to enable
+encryption support in CST:
+
+  $ sudo apt-get install libssl-dev openssl
+  $ cd <CST install directory>/code/back_end/src
+  $ gcc -o cst_encrypted -I ../hdr -L ../../../linux64/lib *.c
+    -lfrontend -lcrypto
+  $ cp cst_encrypted ../../../linux64/bin/
+
+1.4 Preparing the image container
+----------------------------------
+
+The container generation is explained in and mx8_mx8x_secure_boot.txt and
+mx8_mx8x_spl_secure_boot.txt guides. This document is based in imx-mkimage
+flash target (2 containers in flash.bin).
+
+- Assembly flash.bin binary:
+
+  $ make SOC=<SoC Name> flash
+
+The mkimage log is used during the encrypted boot procedure to create the
+Command Sequence File (CSF):
+
+  CST: CONTAINER 0 offset: 0x400
+  CST: CONTAINER 0: Signature Block: offset is at 0x590
+  DONE.
+  Note: Please copy image to offset: IVT_OFFSET + IMAGE_OFFSET
+
+1.6 Creating the CSF description to encrypt the 2nd container
+--------------------------------------------------------------
+
+The csf_enc_boot_image.txt available under ahab/csf_examples/ can be used as
+example for encrypting the flash.bin binary, the main change is the Install
+Secret Key command that must be added after Authenticate Data command.
+
+  [Install Secret Key]
+  Key = "dek.bin"
+  Key Length = 128
+  #Key Identifier = 0x1234CAFE
+  Image Indexes = 0xFFFFFFFE
+
+By default all images are encrypted and image indexes parameter can be used
+to mask the images indexes that must be encrypted, on this example only the
+2nd container will be encrypted.
+
+Optionally users can provide a key identifier that must match the value
+provided during the blob generation, by default its value is zero.
+
+1.7 Encrypting the 2nd container
+---------------------------------
+
+The image is encrypted using the Code Signing Tool. The tool generates the
+encrypted image and a random dek.bin file.
+
+- Encrypt flash.bin binary:
+
+  $ ./cst_encrypted -i csf_enc_boot_image.txt -o enc_flash.bin
+   The DEK BLOB must be inserted at offset 0x7c0 (its expected size is 72 bytes)
+   CSF Processed successfully and signed image available in enc_boot_image.bin
+
+The output log will be used in a later step to insert the DEK blob into the
+signature block.
+
+1.8 Generating the DEK Blob
+----------------------------
+
+The DEK must be encapsulated into a CAAM blob so it can be included into the
+final encrypted binary. The U-Boot provides a tool called dek_blob which is
+calling the SECO blob encapsulation API.
+
+Copy the dek.bin in SDCard FAT partition and run the following commands from
+U-Boot prompt:
+
+  => mmc list
+     FSL_SDHC: 1 (SD)
+     FSL_SDHC: 2
+  => fatload mmc 1:1 0x80280000 dek.bin
+  => dek_blob 0x80280000 0x80280100 128
+  => fatwrite mmc 1:1 0x80280100 dek_blob.bin 0x48
+
+In host PC copy the generated dek_blob.bin to the CST directory.
+
+1.9 Assembling the encrypted image
+-----------------------------------
+
+The DEK blob generated in the step above have to be inserted into the container
+signature block.
+
+The CSF log is used to determine the DEK Blob offset:
+
+  The DEK BLOB must be inserted at offset 0x7c0 (its expected size is 72 bytes)
+  CSF Processed successfully and signed image available in enc_boot_image.bin
+
+- Insert DEK Blob into container signature block:
+
+  $ dd if=dek_blob.bin of=enc_flash.bin bs=1 seek=$((0x7c0)) conv=notrunc
+
+1.10 Flashing the encrypted boot image
+---------------------------------------
+
+The same offset is used for encrypted boot images, in case booting from
+eMMC/SDCard the offset is 32K.
+
+- Flash encrypted image in SDCard:
+
+  $ sudo dd if=enc_flash.bin of=/dev/sd<x> bs=1K seek=32 && sync
+
+2.0 Encrypting a standalone container
+--------------------------------------
+
+CST is also able to encrypt additional images containers, the steps documented
+in this section are based in OS container but can be also applied to SPL
+targets and 3rd containers.
+
+2.1 Creating the OS container
+------------------------------
+
+As explained in mx8_mx8x_secure_boot.txt guide the imx-mkimage tool is used to
+generate an image container for OS images, the mkimage log is used during the
+encrypted boot procedure to create the Command Sequence File (CSF).
+
+- Creating OS container:
+
+  $ make SOC=<SoC Name> flash_kernel
+   ...
+   CST: CONTAINER 0 offset: 0x0
+   CST: CONTAINER 0: Signature Block: offset is at 0x110
+
+2.2 Creating the CSF description file for standalone container
+---------------------------------------------------------------
+
+The Image Indexes parameter is used to mask the images that are encrypted by
+CST, as a single container is used for OS images the Image Indexes command can
+be commented or set to 0xFFFFFFFF.
+
+  [Install Secret Key]
+  Key = "dek_os.bin"
+  Key Length = 128
+  #Key Identifier = 0x1234CAFE
+  Image Indexes = 0xFFFFFFFF
+
+2.3 Encrypting the standalone container
+----------------------------------------
+
+As explained in section 1.7 the CST generates the encrypted image and a random
+dek.bin file.
+
+- Encrypt the standalone container:
+
+  $ ./cst_encrypted -i csf_linux_img.txt -o enc_flash_os.bin
+   The DEK BLOB must be inserted at offset 0x340 (its expected size is 72 bytes)
+   CSF Processed successfully and signed image available in enc_flash_os.bin
+
+The output log will be used in a later step to insert the DEK blob into the
+signature block.
+
+2.4 Generating the DEK Blob for standalone container
+----------------------------------------------------
+
+Similar to section 1.8 the DEK must be encapsulated into a CAAM blob so it can
+be included into the final encrypted binary.
+
+Copy the dek_os.bin in SDCard FAT partition and run the following commands from
+U-Boot prompt:
+
+  => mmc list
+     FSL_SDHC: 1 (SD)
+     FSL_SDHC: 2
+  => fatload mmc 1:1 0x80280000 dek_os.bin
+  => dek_blob 0x80280000 0x80280100 128
+  => fatwrite mmc 1:1 0x80280100 dek_blob_os.bin 0x48
+
+In host PC copy the generated dek_blob_os.bin to the CST directory.
+
+2.5 Assembling the encrypted image
+-----------------------------------
+
+The DEK blob generated in the step above have to be inserted into the container
+signature block.
+
+The CSF log is used to determine the DEK Blob offset:
+
+   The DEK BLOB must be inserted at offset 0x340 (its expected size is 72 bytes)
+   CSF Processed successfully and signed image available in enc_flash_os.bin
+
+- Insert DEK Blob into container signature block:
+
+  $ dd if=dek_blob_os.bin of=enc_flash_os.bin bs=1 seek=$((0x340)) conv=notrunc
+
+2.6 Copy encrypted image to SDCard
+-----------------------------------
+
+The encrypted container can be copied to SDCard FAT partition, please note
+that U-Boot requires signed and encrypted containers to be named as
+os_cntr_signed.bin.
+
+  $ sudo cp enc_flash_os.bin /media/UserID/Boot\ imx8/os_cntr_signed.bin
+
+References:
+[1] SCFW API guide: "System Controller Firmware API Reference Guide - Rev 1.5"
index 329f4580c5a01d0deb12837213e57c58df65acd2..8279e784fede0b303635b8faaccd528496c8437c 100644 (file)
@@ -255,7 +255,7 @@ static int imxrt1050_clk_probe(struct udevice *dev)
        clk_dm(IMXRT1050_CLK_SEMC,
               imx_clk_gate2("semc", "semc_podf", base + 0x74, 4));
        clk_dm(IMXRT1050_CLK_LCDIF,
-              imx_clk_gate2("lcdif", "lcdif_podf", base + 0x70, 28));
+              imx_clk_gate2("lcdif", "lcdif_podf", base + 0x74, 10));
 
        struct clk *clk, *clk1;
 
index 1f623765956b861328fee4a965fbd1cbe66aeb01..d822acace14be9ba955c96f1c484e14ee0e8137f 100644 (file)
@@ -996,6 +996,7 @@ static ulong rk3399_clk_set_rate(struct clk *clk, ulong rate)
                break;
        case ACLK_VOP1:
        case HCLK_VOP1:
+       case HCLK_SD:
                /**
                 * assigned-clocks handling won't require for vopl, so
                 * return 0 to satisfy clk_set_defaults during device probe.
index 3ad21c1ea0a4a4a9c518206caffb7f766e7e23d2..3e38edbf5dc3499a6db2c1928304e0af9259f94d 100644 (file)
@@ -174,6 +174,28 @@ sc_bool_t sc_pm_is_partition_started(sc_ipc_t ipc, sc_rm_pt_t pt)
        return !!result;
 }
 
+int sc_pm_resource_reset(sc_ipc_t ipc, sc_rsrc_t resource)
+{
+       struct udevice *dev = gd->arch.scu_dev;
+       int size = sizeof(struct sc_rpc_msg_s);
+       struct sc_rpc_msg_s msg;
+       int ret;
+
+       RPC_VER(&msg) = SC_RPC_VERSION;
+       RPC_SIZE(&msg) = 2U;
+       RPC_SVC(&msg) = (u8)(SC_RPC_SVC_PM);
+       RPC_FUNC(&msg) = (u8)(PM_FUNC_RESOURCE_RESET);
+
+       RPC_U16(&msg, 0U) = (u16)(resource);
+
+       ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size);
+       if (ret)
+               printf("%s: resource:%d res:%d\n",
+                      __func__, resource, RPC_R8(&msg));
+
+       return ret;
+}
+
 /* PAD */
 int sc_pad_set(sc_ipc_t ipc, sc_pad_t pad, u32 val)
 {
@@ -200,6 +222,34 @@ int sc_pad_set(sc_ipc_t ipc, sc_pad_t pad, u32 val)
        return ret;
 }
 
+int sc_pad_get(sc_ipc_t ipc, sc_pad_t pad, u32 *val)
+{
+       struct udevice *dev = gd->arch.scu_dev;
+       int size = sizeof(struct sc_rpc_msg_s);
+       struct sc_rpc_msg_s msg;
+       int ret;
+
+       if (!dev)
+               hang();
+
+       RPC_VER(&msg) = SC_RPC_VERSION;
+       RPC_SIZE(&msg) = 2U;
+       RPC_SVC(&msg) = (u8)(SC_RPC_SVC_PAD);
+       RPC_FUNC(&msg) = (u8)(PAD_FUNC_GET);
+
+       RPC_U16(&msg, 0U) = (u16)(pad);
+
+       ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size);
+       if (ret)
+               printf("%s: pad:%d: res:%d\n",
+                      __func__, pad, RPC_R8(&msg));
+
+       if (val)
+               *val = (u32)RPC_U32(&msg, 0U);
+
+       return ret;
+}
+
 /* MISC */
 int sc_misc_set_control(sc_ipc_t ipc, sc_rsrc_t resource,
                        sc_ctrl_t ctrl, u32 val)
@@ -948,3 +998,147 @@ int sc_seco_gen_key_blob(sc_ipc_t ipc, u32 id, sc_faddr_t load_addr,
 
        return ret;
 }
+
+int sc_seco_get_mp_key(sc_ipc_t ipc, sc_faddr_t dst_addr,
+                       u16 dst_size)
+{
+       struct udevice *dev = gd->arch.scu_dev;
+       struct sc_rpc_msg_s msg;
+       int size = sizeof(struct sc_rpc_msg_s);
+       int ret;
+
+       RPC_VER(&msg) = SC_RPC_VERSION;
+       RPC_SIZE(&msg) = 4U;
+       RPC_SVC(&msg) = (u8)(SC_RPC_SVC_SECO);
+       RPC_FUNC(&msg) = (u8)(SECO_FUNC_GET_MP_KEY);
+
+       RPC_U32(&msg, 0U) = (u32)(dst_addr >> 32ULL);
+       RPC_U32(&msg, 4U) = (u32)(dst_addr);
+       RPC_U16(&msg, 8U) = (u16)(dst_size);
+
+       ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size);
+       if (ret)
+               printf("%s, dst_addr:0x%llx, res:%d\n",
+                      __func__, dst_addr, RPC_R8(&msg));
+
+       return ret;
+}
+
+int sc_seco_update_mpmr(sc_ipc_t ipc, sc_faddr_t addr, u8 size_m,
+                       u8 lock)
+{
+       struct udevice *dev = gd->arch.scu_dev;
+       struct sc_rpc_msg_s msg;
+       int size = sizeof(struct sc_rpc_msg_s);
+       int ret;
+
+       RPC_VER(&msg) = SC_RPC_VERSION;
+       RPC_SIZE(&msg) = 4U;
+       RPC_SVC(&msg) = (u8)(SC_RPC_SVC_SECO);
+       RPC_FUNC(&msg) = (u8)(SECO_FUNC_UPDATE_MPMR);
+
+       RPC_U32(&msg, 0U) = (u32)(addr >> 32ULL);
+       RPC_U32(&msg, 4U) = (u32)(addr);
+       RPC_U8(&msg, 8U) = (u8)(size_m);
+       RPC_U8(&msg, 9U) = (u8)(lock);
+
+       ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size);
+       if (ret)
+               printf("%s, addr:0x%llx, size_m:%x, lock:0x%x, res:%d\n",
+                      __func__, addr, size_m, lock, RPC_R8(&msg));
+       return ret;
+}
+
+int sc_seco_get_mp_sign(sc_ipc_t ipc, sc_faddr_t msg_addr,
+                       u16 msg_size, sc_faddr_t dst_addr,
+                       u16 dst_size)
+{
+       struct udevice *dev = gd->arch.scu_dev;
+       struct sc_rpc_msg_s msg;
+       int size = sizeof(struct sc_rpc_msg_s);
+       int ret;
+
+       RPC_VER(&msg) = SC_RPC_VERSION;
+       RPC_SIZE(&msg) = 6U;
+       RPC_SVC(&msg) = (u8)(SC_RPC_SVC_SECO);
+       RPC_FUNC(&msg) = (u8)(SECO_FUNC_GET_MP_SIGN);
+
+       RPC_U32(&msg, 0U) = (u32)(msg_addr >> 32ULL);
+       RPC_U32(&msg, 4U) = (u32)(msg_addr);
+       RPC_U32(&msg, 8U) = (u32)(dst_addr >> 32ULL);
+       RPC_U32(&msg, 12U) = (u32)(dst_addr);
+       RPC_U16(&msg, 16U) = (u16)(msg_size);
+       RPC_U16(&msg, 18U) = (u16)(dst_size);
+
+       ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size);
+       if (ret)
+               printf("%s, msg_addr:0x%llx, msg_size:%x, dst_addr:0x%llx,"
+                      "dst_size:%x, res:%d\n", __func__, msg_addr, msg_size,
+                      dst_addr, dst_size, RPC_R8(&msg));
+
+       return ret;
+}
+
+int sc_seco_secvio_config(sc_ipc_t ipc, u8 id, u8 access,
+                         u32 *data0, u32 *data1, u32 *data2, u32 *data3,
+                         u32 *data4, u8 size)
+{
+       struct udevice *dev = gd->arch.scu_dev;
+       struct sc_rpc_msg_s msg;
+       int msg_size = sizeof(struct sc_rpc_msg_s);
+       int ret;
+
+       RPC_VER(&msg) = SC_RPC_VERSION;
+       RPC_SIZE(&msg) = 7U;
+       RPC_SVC(&msg) = (u8)(SC_RPC_SVC_SECO);
+       RPC_FUNC(&msg) = (u8)(SECO_FUNC_SECVIO_CONFIG);
+
+       RPC_U32(&msg, 0U) = (u32)(*data0);
+       RPC_U32(&msg, 4U) = (u32)(*data1);
+       RPC_U32(&msg, 8U) = (u32)(*data2);
+       RPC_U32(&msg, 12U) = (u32)(*data3);
+       RPC_U32(&msg, 16U) = (u32)(*data4);
+       RPC_U8(&msg, 20U) = (u8)(id);
+       RPC_U8(&msg, 21U) = (u8)(access);
+       RPC_U8(&msg, 22U) = (u8)(size);
+
+       ret = misc_call(dev, SC_FALSE, &msg, msg_size, &msg, msg_size);
+       if (ret)
+               printf("%s, id:0x%x, access:%x, res:%d\n",
+                      __func__, id, access, RPC_R8(&msg));
+
+       *data0 = (u32)RPC_U32(&msg, 0U);
+       *data1 = (u32)RPC_U32(&msg, 4U);
+       *data2 = (u32)RPC_U32(&msg, 8U);
+       *data3 = (u32)RPC_U32(&msg, 12U);
+       *data4 = (u32)RPC_U32(&msg, 16U);
+
+       return ret;
+}
+
+int sc_seco_secvio_dgo_config(sc_ipc_t ipc, u8 id, u8 access, u32 *data)
+{
+       struct udevice *dev = gd->arch.scu_dev;
+       struct sc_rpc_msg_s msg;
+       int size = sizeof(struct sc_rpc_msg_s);
+       int ret;
+
+       RPC_VER(&msg) = SC_RPC_VERSION;
+       RPC_SIZE(&msg) = 3U;
+       RPC_SVC(&msg) = (u8)(SC_RPC_SVC_SECO);
+       RPC_FUNC(&msg) = (u8)(SECO_FUNC_SECVIO_DGO_CONFIG);
+
+       RPC_U32(&msg, 0U) = (u32)(*data);
+       RPC_U8(&msg, 4U) = (u8)(id);
+       RPC_U8(&msg, 5U) = (u8)(access);
+
+       ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size);
+       if (ret)
+               printf("%s, id:0x%x, access:%x, res:%d\n",
+                      __func__, id, access, RPC_R8(&msg));
+
+       if (data)
+               *data = RPC_U32(&msg, 0U);
+
+       return ret;
+}
index bc518f218da6827bf3efa1ffa37e55bf8cdfb8e5..a2587a29e16513aada0ccdd8faf89cfd5538fcf5 100644 (file)
@@ -388,11 +388,13 @@ config SMC911X
 
 if SMC911X
 
+if !DM_ETH
 config SMC911X_BASE
        hex "SMC911X Base Address"
        help
          Define this to hold the physical address
          of the device (I/O space)
+endif #DM_ETH
 
 choice
        prompt "SMC911X bus width"
index 43c2253f10d2d163ed02b014b976aec5281dfa9f..d008696b0ffb1918af21121067cfed53481d598d 100644 (file)
@@ -7,24 +7,21 @@
 #include <netdev.h>
 #include <pci.h>
 
-#undef DEBUG_SROM
-#undef DEBUG_SROM2
+#define SROM_DLEVEL    0
 
 #undef UPDATE_SROM
 
-/* PCI Registers.
- */
-#define PCI_CFDA_PSM           0x43
+/* PCI Registers. */
+#define PCI_CFDA_PSM   0x43
 
 #define CFRV_RN                0x000000f0      /* Revision Number */
 
 #define WAKEUP         0x00            /* Power Saving Wakeup */
 #define SLEEP          0x80            /* Power Saving Sleep Mode */
 
-#define DC2114x_BRK    0x0020          /* CFRV break between DC21142 & DC21143 */
+#define DC2114x_BRK    0x0020  /* CFRV break between DC21142 & DC21143 */
 
-/* Ethernet chip registers.
- */
+/* Ethernet chip registers. */
 #define DE4X5_BMR      0x000           /* Bus Mode Register */
 #define DE4X5_TPD      0x008           /* Transmit Poll Demand Reg */
 #define DE4X5_RRBA     0x018           /* RX Ring Base Address Reg */
@@ -34,8 +31,7 @@
 #define DE4X5_SICR     0x068           /* SIA Connectivity Register */
 #define DE4X5_APROM    0x048           /* Ethernet Address PROM */
 
-/* Register bits.
- */
+/* Register bits. */
 #define BMR_SWR                0x00000001      /* Software Reset */
 #define STS_TS         0x00700000      /* Transmit Process State */
 #define STS_RS         0x000e0000      /* Receive Process State */
@@ -45,8 +41,7 @@
 #define OMR_SDP                0x02000000      /* SD Polarity - MUST BE ASSERTED */
 #define OMR_PM         0x00000080      /* Pass All Multicast */
 
-/* Descriptor bits.
- */
+/* Descriptor bits. */
 #define R_OWN          0x80000000      /* Own Bit */
 #define RD_RER         0x02000000      /* Receive End Of Ring */
 #define RD_LS          0x00000100      /* Last Descriptor */
 #define SROM_READ_CMD  6
 #define SROM_ERASE_CMD 7
 
-#define SROM_HWADD         0x0014      /* Hardware Address offset in SROM */
+#define SROM_HWADD     0x0014          /* Hardware Address offset in SROM */
 #define SROM_RD                0x00004000      /* Read from Boot ROM */
-#define EE_DATA_WRITE        0x04      /* EEPROM chip data in. */
-#define EE_WRITE_0         0x4801
-#define EE_WRITE_1         0x4805
-#define EE_DATA_READ         0x08      /* EEPROM chip data out. */
+#define EE_DATA_WRITE  0x04            /* EEPROM chip data in. */
+#define EE_WRITE_0     0x4801
+#define EE_WRITE_1     0x4805
+#define EE_DATA_READ   0x08            /* EEPROM chip data out. */
 #define SROM_SR                0x00000800      /* Select Serial ROM when set */
 
 #define DT_IN          0x00000004      /* Serial Data In */
 
 #define POLL_DEMAND    1
 
-#ifdef CONFIG_TULIP_FIX_DAVICOM
-#define RESET_DM9102(dev) {\
-    unsigned long i;\
-    i=INL(dev, 0x0);\
-    udelay(1000);\
-    OUTL(dev, i | BMR_SWR, DE4X5_BMR);\
-    udelay(1000);\
-}
+#if defined(CONFIG_E500)
+#define phys_to_bus(a) (a)
 #else
-#define RESET_DE4X5(dev) {\
-    int i;\
-    i=INL(dev, DE4X5_BMR);\
-    udelay(1000);\
-    OUTL(dev, i | BMR_SWR, DE4X5_BMR);\
-    udelay(1000);\
-    OUTL(dev, i, DE4X5_BMR);\
-    udelay(1000);\
-    for (i=0;i<5;i++) {INL(dev, DE4X5_BMR); udelay(10000);}\
-    udelay(1000);\
-}
+#define phys_to_bus(a) pci_phys_to_mem((pci_dev_t)dev->priv, a)
 #endif
 
-#define START_DE4X5(dev) {\
-    s32 omr; \
-    omr = INL(dev, DE4X5_OMR);\
-    omr |= OMR_ST | OMR_SR;\
-    OUTL(dev, omr, DE4X5_OMR);         /* Enable the TX and/or RX */\
-}
-
-#define STOP_DE4X5(dev) {\
-    s32 omr; \
-    omr = INL(dev, DE4X5_OMR);\
-    omr &= ~(OMR_ST|OMR_SR);\
-    OUTL(dev, omr, DE4X5_OMR);         /* Disable the TX and/or RX */ \
-}
-
 #define NUM_RX_DESC PKTBUFSRX
-#ifndef CONFIG_TULIP_FIX_DAVICOM
-       #define NUM_TX_DESC 1                   /* Number of TX descriptors   */
-#else
-       #define NUM_TX_DESC 4
-#endif
+#define NUM_TX_DESC 1                  /* Number of TX descriptors   */
 #define RX_BUFF_SZ  PKTSIZE_ALIGN
 
 #define TOUT_LOOP   1000000
@@ -132,455 +93,117 @@ struct de4x5_desc {
        u32 next;
 };
 
-static struct de4x5_desc rx_ring[NUM_RX_DESC] __attribute__ ((aligned(32))); /* RX descriptor ring         */
-static struct de4x5_desc tx_ring[NUM_TX_DESC] __attribute__ ((aligned(32))); /* TX descriptor ring         */
-static int rx_new;                             /* RX descriptor ring pointer */
-static int tx_new;                             /* TX descriptor ring pointer */
+/* RX and TX descriptor ring */
+static struct de4x5_desc rx_ring[NUM_RX_DESC] __aligned(32);
+static struct de4x5_desc tx_ring[NUM_TX_DESC] __aligned(32);
+static int rx_new;     /* RX descriptor ring pointer */
+static int tx_new;     /* TX descriptor ring pointer */
 
-static char rxRingSize;
-static char txRingSize;
+static char rx_ring_size;
+static char tx_ring_size;
 
-#if defined(UPDATE_SROM) || !defined(CONFIG_TULIP_FIX_DAVICOM)
-static void  sendto_srom(struct eth_device* dev, u_int command, u_long addr);
-static int   getfrom_srom(struct eth_device* dev, u_long addr);
-static int   do_eeprom_cmd(struct eth_device *dev, u_long ioaddr,int cmd,int cmd_len);
-static int   do_read_eeprom(struct eth_device *dev,u_long ioaddr,int location,int addr_len);
-#endif /* UPDATE_SROM || !CONFIG_TULIP_FIX_DAVICOM */
-#ifdef UPDATE_SROM
-static int   write_srom(struct eth_device *dev, u_long ioaddr, int index, int new_value);
-static void  update_srom(struct eth_device *dev, bd_t *bis);
-#endif
-#ifndef CONFIG_TULIP_FIX_DAVICOM
-static int   read_srom(struct eth_device *dev, u_long ioaddr, int index);
-static void  read_hw_addr(struct eth_device* dev, bd_t * bis);
-#endif /* CONFIG_TULIP_FIX_DAVICOM */
-static void  send_setup_frame(struct eth_device* dev, bd_t * bis);
-
-static int   dc21x4x_init(struct eth_device* dev, bd_t* bis);
-static int   dc21x4x_send(struct eth_device *dev, void *packet, int length);
-static int   dc21x4x_recv(struct eth_device* dev);
-static void  dc21x4x_halt(struct eth_device* dev);
-#ifdef CONFIG_TULIP_SELECT_MEDIA
-extern void  dc21x4x_select_media(struct eth_device* dev);
-#endif
-
-#if defined(CONFIG_E500)
-#define phys_to_bus(a) (a)
-#else
-#define phys_to_bus(a) pci_phys_to_mem((pci_dev_t)dev->priv, a)
-#endif
-
-static int INL(struct eth_device* dev, u_long addr)
+static u32 dc2114x_inl(struct eth_device *dev, u32 addr)
 {
-       return le32_to_cpu(*(volatile u_long *)(addr + dev->iobase));
+       return le32_to_cpu(*(volatile u32 *)(addr + dev->iobase));
 }
 
-static void OUTL(struct eth_device* dev, int command, u_long addr)
+static void dc2114x_outl(struct eth_device *dev, u32 command, u32 addr)
 {
-       *(volatile u_long *)(addr + dev->iobase) = cpu_to_le32(command);
+       *(volatile u32 *)(addr + dev->iobase) = cpu_to_le32(command);
 }
 
-static struct pci_device_id supported[] = {
-       { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP_FAST },
-       { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21142 },
-#ifdef CONFIG_TULIP_FIX_DAVICOM
-       { PCI_VENDOR_ID_DAVICOM, PCI_DEVICE_ID_DAVICOM_DM9102A },
-#endif
-       { }
-};
-
-int dc21x4x_initialize(bd_t *bis)
+static void reset_de4x5(struct eth_device *dev)
 {
-       int                     idx=0;
-       int                     card_number = 0;
-       unsigned int            cfrv;
-       unsigned char           timer;
-       pci_dev_t               devbusfn;
-       unsigned int            iobase;
-       unsigned short          status;
-       struct eth_device*      dev;
-
-       while(1) {
-               devbusfn =  pci_find_devices(supported, idx++);
-               if (devbusfn == -1) {
-                       break;
-               }
-
-               /* Get the chip configuration revision register. */
-               pci_read_config_dword(devbusfn, PCI_REVISION_ID, &cfrv);
-
-#ifndef CONFIG_TULIP_FIX_DAVICOM
-               if ((cfrv & CFRV_RN) < DC2114x_BRK ) {
-                       printf("Error: The chip is not DC21143.\n");
-                       continue;
-               }
-#endif
-
-               pci_read_config_word(devbusfn, PCI_COMMAND, &status);
-               status |=
-#ifdef CONFIG_TULIP_USE_IO
-                 PCI_COMMAND_IO |
-#else
-                 PCI_COMMAND_MEMORY |
-#endif
-                 PCI_COMMAND_MASTER;
-               pci_write_config_word(devbusfn, PCI_COMMAND, status);
-
-               pci_read_config_word(devbusfn, PCI_COMMAND, &status);
-#ifdef CONFIG_TULIP_USE_IO
-               if (!(status & PCI_COMMAND_IO)) {
-                       printf("Error: Can not enable I/O access.\n");
-                       continue;
-               }
-#else
-               if (!(status & PCI_COMMAND_MEMORY)) {
-                       printf("Error: Can not enable MEMORY access.\n");
-                       continue;
-               }
-#endif
-
-               if (!(status & PCI_COMMAND_MASTER)) {
-                       printf("Error: Can not enable Bus Mastering.\n");
-                       continue;
-               }
-
-               /* Check the latency timer for values >= 0x60. */
-               pci_read_config_byte(devbusfn, PCI_LATENCY_TIMER, &timer);
-
-               if (timer < 0x60) {
-                       pci_write_config_byte(devbusfn, PCI_LATENCY_TIMER, 0x60);
-               }
-
-#ifdef CONFIG_TULIP_USE_IO
-               /* read BAR for memory space access */
-               pci_read_config_dword(devbusfn, PCI_BASE_ADDRESS_0, &iobase);
-               iobase &= PCI_BASE_ADDRESS_IO_MASK;
-#else
-               /* read BAR for memory space access */
-               pci_read_config_dword(devbusfn, PCI_BASE_ADDRESS_1, &iobase);
-               iobase &= PCI_BASE_ADDRESS_MEM_MASK;
-#endif
-               debug ("dc21x4x: DEC 21142 PCI Device @0x%x\n", iobase);
-
-               dev = (struct eth_device*) malloc(sizeof *dev);
-
-               if (!dev) {
-                       printf("Can not allocalte memory of dc21x4x\n");
-                       break;
-               }
-               memset(dev, 0, sizeof(*dev));
-
-#ifdef CONFIG_TULIP_FIX_DAVICOM
-               sprintf(dev->name, "Davicom#%d", card_number);
-#else
-               sprintf(dev->name, "dc21x4x#%d", card_number);
-#endif
-
-#ifdef CONFIG_TULIP_USE_IO
-               dev->iobase = pci_io_to_phys(devbusfn, iobase);
-#else
-               dev->iobase = pci_mem_to_phys(devbusfn, iobase);
-#endif
-               dev->priv   = (void*) devbusfn;
-               dev->init   = dc21x4x_init;
-               dev->halt   = dc21x4x_halt;
-               dev->send   = dc21x4x_send;
-               dev->recv   = dc21x4x_recv;
-
-               /* Ensure we're not sleeping. */
-               pci_write_config_byte(devbusfn, PCI_CFDA_PSM, WAKEUP);
-
-               udelay(10 * 1000);
-
-#ifndef CONFIG_TULIP_FIX_DAVICOM
-               read_hw_addr(dev, bis);
-#endif
-               eth_register(dev);
-
-               card_number++;
+       u32 i;
+
+       i = dc2114x_inl(dev, DE4X5_BMR);
+       mdelay(1);
+       dc2114x_outl(dev, i | BMR_SWR, DE4X5_BMR);
+       mdelay(1);
+       dc2114x_outl(dev, i, DE4X5_BMR);
+       mdelay(1);
+
+       for (i = 0; i < 5; i++) {
+               dc2114x_inl(dev, DE4X5_BMR);
+               mdelay(10);
        }
 
-       return card_number;
+       mdelay(1);
 }
 
-static int dc21x4x_init(struct eth_device* dev, bd_t* bis)
+static void start_de4x5(struct eth_device *dev)
 {
-       int             i;
-       int             devbusfn = (int) dev->priv;
+       u32 omr;
 
-       /* Ensure we're not sleeping. */
-       pci_write_config_byte(devbusfn, PCI_CFDA_PSM, WAKEUP);
-
-#ifdef CONFIG_TULIP_FIX_DAVICOM
-       RESET_DM9102(dev);
-#else
-       RESET_DE4X5(dev);
-#endif
-
-       if ((INL(dev, DE4X5_STS) & (STS_TS | STS_RS)) != 0) {
-               printf("Error: Cannot reset ethernet controller.\n");
-               return -1;
-       }
-
-#ifdef CONFIG_TULIP_SELECT_MEDIA
-       dc21x4x_select_media(dev);
-#else
-       OUTL(dev, OMR_SDP | OMR_PS | OMR_PM, DE4X5_OMR);
-#endif
-
-       for (i = 0; i < NUM_RX_DESC; i++) {
-               rx_ring[i].status = cpu_to_le32(R_OWN);
-               rx_ring[i].des1 = cpu_to_le32(RX_BUFF_SZ);
-               rx_ring[i].buf = cpu_to_le32(
-                       phys_to_bus((u32)net_rx_packets[i]));
-#ifdef CONFIG_TULIP_FIX_DAVICOM
-               rx_ring[i].next = cpu_to_le32(
-                       phys_to_bus((u32)&rx_ring[(i + 1) % NUM_RX_DESC]));
-#else
-               rx_ring[i].next = 0;
-#endif
-       }
-
-       for (i=0; i < NUM_TX_DESC; i++) {
-               tx_ring[i].status = 0;
-               tx_ring[i].des1 = 0;
-               tx_ring[i].buf = 0;
-
-#ifdef CONFIG_TULIP_FIX_DAVICOM
-       tx_ring[i].next = cpu_to_le32(phys_to_bus((u32) &tx_ring[(i+1) % NUM_TX_DESC]));
-#else
-               tx_ring[i].next = 0;
-#endif
-       }
-
-       rxRingSize = NUM_RX_DESC;
-       txRingSize = NUM_TX_DESC;
-
-       /* Write the end of list marker to the descriptor lists. */
-       rx_ring[rxRingSize - 1].des1 |= cpu_to_le32(RD_RER);
-       tx_ring[txRingSize - 1].des1 |= cpu_to_le32(TD_TER);
-
-       /* Tell the adapter where the TX/RX rings are located. */
-       OUTL(dev, phys_to_bus((u32) &rx_ring), DE4X5_RRBA);
-       OUTL(dev, phys_to_bus((u32) &tx_ring), DE4X5_TRBA);
-
-       START_DE4X5(dev);
-
-       tx_new = 0;
-       rx_new = 0;
-
-       send_setup_frame(dev, bis);
-
-       return 0;
+       omr = dc2114x_inl(dev, DE4X5_OMR);
+       omr |= OMR_ST | OMR_SR;
+       dc2114x_outl(dev, omr, DE4X5_OMR);      /* Enable the TX and/or RX */
 }
 
-static int dc21x4x_send(struct eth_device *dev, void *packet, int length)
+static void stop_de4x5(struct eth_device *dev)
 {
-       int             status = -1;
-       int             i;
+       u32 omr;
 
-       if (length <= 0) {
-               printf("%s: bad packet size: %d\n", dev->name, length);
-               goto Done;
-       }
-
-       for(i = 0; tx_ring[tx_new].status & cpu_to_le32(T_OWN); i++) {
-               if (i >= TOUT_LOOP) {
-                       printf("%s: tx error buffer not ready\n", dev->name);
-                       goto Done;
-               }
-       }
-
-       tx_ring[tx_new].buf    = cpu_to_le32(phys_to_bus((u32) packet));
-       tx_ring[tx_new].des1   = cpu_to_le32(TD_TER | TD_LS | TD_FS | length);
-       tx_ring[tx_new].status = cpu_to_le32(T_OWN);
-
-       OUTL(dev, POLL_DEMAND, DE4X5_TPD);
-
-       for(i = 0; tx_ring[tx_new].status & cpu_to_le32(T_OWN); i++) {
-               if (i >= TOUT_LOOP) {
-                       printf(".%s: tx buffer not ready\n", dev->name);
-                       goto Done;
-               }
-       }
-
-       if (le32_to_cpu(tx_ring[tx_new].status) & TD_ES) {
-#if 0 /* test-only */
-               printf("TX error status = 0x%08X\n",
-                       le32_to_cpu(tx_ring[tx_new].status));
-#endif
-               tx_ring[tx_new].status = 0x0;
-               goto Done;
-       }
-
-       status = length;
-
- Done:
-    tx_new = (tx_new+1) % NUM_TX_DESC;
-       return status;
+       omr = dc2114x_inl(dev, DE4X5_OMR);
+       omr &= ~(OMR_ST | OMR_SR);
+       dc2114x_outl(dev, omr, DE4X5_OMR);      /* Disable the TX and/or RX */
 }
 
-static int dc21x4x_recv(struct eth_device* dev)
+/* SROM Read and write routines. */
+static void sendto_srom(struct eth_device *dev, u_int command, u_long addr)
 {
-       s32             status;
-       int             length    = 0;
-
-       for ( ; ; ) {
-               status = (s32)le32_to_cpu(rx_ring[rx_new].status);
-
-               if (status & R_OWN) {
-                       break;
-               }
-
-               if (status & RD_LS) {
-                       /* Valid frame status.
-                        */
-                       if (status & RD_ES) {
-
-                               /* There was an error.
-                                */
-                               printf("RX error status = 0x%08X\n", status);
-                       } else {
-                               /* A valid frame received.
-                                */
-                               length = (le32_to_cpu(rx_ring[rx_new].status) >> 16);
-
-                               /* Pass the packet up to the protocol
-                                * layers.
-                                */
-                               net_process_received_packet(
-                                       net_rx_packets[rx_new], length - 4);
-                       }
-
-                       /* Change buffer ownership for this frame, back
-                        * to the adapter.
-                        */
-                       rx_ring[rx_new].status = cpu_to_le32(R_OWN);
-               }
-
-               /* Update entry information.
-                */
-               rx_new = (rx_new + 1) % rxRingSize;
-       }
-
-       return length;
-}
-
-static void dc21x4x_halt(struct eth_device* dev)
-{
-       int             devbusfn = (int) dev->priv;
-
-       STOP_DE4X5(dev);
-       OUTL(dev, 0, DE4X5_SICR);
-
-       pci_write_config_byte(devbusfn, PCI_CFDA_PSM, SLEEP);
-}
-
-static void send_setup_frame(struct eth_device* dev, bd_t *bis)
-{
-       int             i;
-       char    setup_frame[SETUP_FRAME_LEN];
-       char    *pa = &setup_frame[0];
-
-       memset(pa, 0xff, SETUP_FRAME_LEN);
-
-       for (i = 0; i < ETH_ALEN; i++) {
-               *(pa + (i & 1)) = dev->enetaddr[i];
-               if (i & 0x01) {
-                       pa += 4;
-               }
-       }
-
-       for(i = 0; tx_ring[tx_new].status & cpu_to_le32(T_OWN); i++) {
-               if (i >= TOUT_LOOP) {
-                       printf("%s: tx error buffer not ready\n", dev->name);
-                       goto Done;
-               }
-       }
-
-       tx_ring[tx_new].buf = cpu_to_le32(phys_to_bus((u32) &setup_frame[0]));
-       tx_ring[tx_new].des1 = cpu_to_le32(TD_TER | TD_SET| SETUP_FRAME_LEN);
-       tx_ring[tx_new].status = cpu_to_le32(T_OWN);
-
-       OUTL(dev, POLL_DEMAND, DE4X5_TPD);
-
-       for(i = 0; tx_ring[tx_new].status & cpu_to_le32(T_OWN); i++) {
-               if (i >= TOUT_LOOP) {
-                       printf("%s: tx buffer not ready\n", dev->name);
-                       goto Done;
-               }
-       }
-
-       if (le32_to_cpu(tx_ring[tx_new].status) != 0x7FFFFFFF) {
-               printf("TX error status2 = 0x%08X\n", le32_to_cpu(tx_ring[tx_new].status));
-       }
-       tx_new = (tx_new+1) % NUM_TX_DESC;
-
-Done:
-       return;
-}
-
-#if defined(UPDATE_SROM) || !defined(CONFIG_TULIP_FIX_DAVICOM)
-/* SROM Read and write routines.
- */
-static void
-sendto_srom(struct eth_device* dev, u_int command, u_long addr)
-{
-       OUTL(dev, command, addr);
+       dc2114x_outl(dev, command, addr);
        udelay(1);
 }
 
-static int
-getfrom_srom(struct eth_device* dev, u_long addr)
+static int getfrom_srom(struct eth_device *dev, u_long addr)
 {
-       s32 tmp;
+       u32 tmp = dc2114x_inl(dev, addr);
 
-       tmp = INL(dev, addr);
        udelay(1);
-
        return tmp;
 }
 
 /* Note: this routine returns extra data bits for size detection. */
-static int do_read_eeprom(struct eth_device *dev, u_long ioaddr, int location, int addr_len)
+static int do_read_eeprom(struct eth_device *dev, u_long ioaddr, int location,
+                         int addr_len)
 {
-       int i;
-       unsigned retval = 0;
        int read_cmd = location | (SROM_READ_CMD << addr_len);
+       unsigned int retval = 0;
+       int i;
 
        sendto_srom(dev, SROM_RD | SROM_SR, ioaddr);
        sendto_srom(dev, SROM_RD | SROM_SR | DT_CS, ioaddr);
 
-#ifdef DEBUG_SROM
-       printf(" EEPROM read at %d ", location);
-#endif
+       debug_cond(SROM_DLEVEL >= 1, " EEPROM read at %d ", location);
 
        /* Shift the read command bits out. */
        for (i = 4 + addr_len; i >= 0; i--) {
                short dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0;
-               sendto_srom(dev, SROM_RD | SROM_SR | DT_CS | dataval, ioaddr);
+
+               sendto_srom(dev, SROM_RD | SROM_SR | DT_CS | dataval,
+                           ioaddr);
                udelay(10);
-               sendto_srom(dev, SROM_RD | SROM_SR | DT_CS | dataval | DT_CLK, ioaddr);
+               sendto_srom(dev, SROM_RD | SROM_SR | DT_CS | dataval | DT_CLK,
+                           ioaddr);
                udelay(10);
-#ifdef DEBUG_SROM2
-               printf("%X", getfrom_srom(dev, ioaddr) & 15);
-#endif
-               retval = (retval << 1) | ((getfrom_srom(dev, ioaddr) & EE_DATA_READ) ? 1 : 0);
+               debug_cond(SROM_DLEVEL >= 2, "%X",
+                          getfrom_srom(dev, ioaddr) & 15);
+               retval = (retval << 1) |
+                        !!(getfrom_srom(dev, ioaddr) & EE_DATA_READ);
        }
 
        sendto_srom(dev, SROM_RD | SROM_SR | DT_CS, ioaddr);
 
-#ifdef DEBUG_SROM2
-       printf(" :%X:", getfrom_srom(dev, ioaddr) & 15);
-#endif
+       debug_cond(SROM_DLEVEL >= 2, " :%X:", getfrom_srom(dev, ioaddr) & 15);
 
        for (i = 16; i > 0; i--) {
                sendto_srom(dev, SROM_RD | SROM_SR | DT_CS | DT_CLK, ioaddr);
                udelay(10);
-#ifdef DEBUG_SROM2
-               printf("%X", getfrom_srom(dev, ioaddr) & 15);
-#endif
-               retval = (retval << 1) | ((getfrom_srom(dev, ioaddr) & EE_DATA_READ) ? 1 : 0);
+               debug_cond(SROM_DLEVEL >= 2, "%X",
+                          getfrom_srom(dev, ioaddr) & 15);
+               retval = (retval << 1) |
+                        !!(getfrom_srom(dev, ioaddr) & EE_DATA_READ);
                sendto_srom(dev, SROM_RD | SROM_SR | DT_CS, ioaddr);
                udelay(10);
        }
@@ -588,145 +211,115 @@ static int do_read_eeprom(struct eth_device *dev, u_long ioaddr, int location, i
        /* Terminate the EEPROM access. */
        sendto_srom(dev, SROM_RD | SROM_SR, ioaddr);
 
-#ifdef DEBUG_SROM2
-       printf(" EEPROM value at %d is %5.5x.\n", location, retval);
-#endif
+       debug_cond(SROM_DLEVEL >= 2, " EEPROM value at %d is %5.5x.\n",
+                  location, retval);
 
        return retval;
 }
-#endif /* UPDATE_SROM || !CONFIG_TULIP_FIX_DAVICOM */
 
-/* This executes a generic EEPROM command, typically a write or write
+/*
+ * This executes a generic EEPROM command, typically a write or write
  * enable. It returns the data output from the EEPROM, and thus may
  * also be used for reads.
  */
-#if defined(UPDATE_SROM) || !defined(CONFIG_TULIP_FIX_DAVICOM)
-static int do_eeprom_cmd(struct eth_device *dev, u_long ioaddr, int cmd, int cmd_len)
+static int do_eeprom_cmd(struct eth_device *dev, u_long ioaddr, int cmd,
+                        int cmd_len)
 {
-       unsigned retval = 0;
+       unsigned int retval = 0;
 
-#ifdef DEBUG_SROM
-       printf(" EEPROM op 0x%x: ", cmd);
-#endif
+       debug_cond(SROM_DLEVEL >= 1, " EEPROM op 0x%x: ", cmd);
 
-       sendto_srom(dev,SROM_RD | SROM_SR | DT_CS | DT_CLK, ioaddr);
+       sendto_srom(dev, SROM_RD | SROM_SR | DT_CS | DT_CLK, ioaddr);
 
        /* Shift the command bits out. */
        do {
-               short dataval = (cmd & (1 << cmd_len)) ? EE_WRITE_1 : EE_WRITE_0;
-               sendto_srom(dev,dataval, ioaddr);
+               short dataval = (cmd & BIT(cmd_len)) ? EE_WRITE_1 : EE_WRITE_0;
+
+               sendto_srom(dev, dataval, ioaddr);
                udelay(10);
 
-#ifdef DEBUG_SROM2
-               printf("%X", getfrom_srom(dev,ioaddr) & 15);
-#endif
+               debug_cond(SROM_DLEVEL >= 2, "%X",
+                          getfrom_srom(dev, ioaddr) & 15);
 
-               sendto_srom(dev,dataval | DT_CLK, ioaddr);
+               sendto_srom(dev, dataval | DT_CLK, ioaddr);
                udelay(10);
-               retval = (retval << 1) | ((getfrom_srom(dev,ioaddr) & EE_DATA_READ) ? 1 : 0);
+               retval = (retval << 1) |
+                        !!(getfrom_srom(dev, ioaddr) & EE_DATA_READ);
        } while (--cmd_len >= 0);
-       sendto_srom(dev,SROM_RD | SROM_SR | DT_CS, ioaddr);
+
+       sendto_srom(dev, SROM_RD | SROM_SR | DT_CS, ioaddr);
 
        /* Terminate the EEPROM access. */
-       sendto_srom(dev,SROM_RD | SROM_SR, ioaddr);
+       sendto_srom(dev, SROM_RD | SROM_SR, ioaddr);
 
-#ifdef DEBUG_SROM
-       printf(" EEPROM result is 0x%5.5x.\n", retval);
-#endif
+       debug_cond(SROM_DLEVEL >= 1, " EEPROM result is 0x%5.5x.\n", retval);
 
        return retval;
 }
-#endif /* UPDATE_SROM || !CONFIG_TULIP_FIX_DAVICOM */
 
-#ifndef CONFIG_TULIP_FIX_DAVICOM
 static int read_srom(struct eth_device *dev, u_long ioaddr, int index)
 {
-       int ee_addr_size = do_read_eeprom(dev, ioaddr, 0xff, 8) & 0x40000 ? 8 : 6;
+       int ee_addr_size;
 
-       return do_eeprom_cmd(dev, ioaddr,
-                            (((SROM_READ_CMD << ee_addr_size) | index) << 16)
-                            | 0xffff, 3 + ee_addr_size + 16);
+       ee_addr_size = (do_read_eeprom(dev, ioaddr, 0xff, 8) & BIT(18)) ? 8 : 6;
+
+       return do_eeprom_cmd(dev, ioaddr, 0xffff |
+                            (((SROM_READ_CMD << ee_addr_size) | index) << 16),
+                            3 + ee_addr_size + 16);
 }
-#endif /* CONFIG_TULIP_FIX_DAVICOM */
 
 #ifdef UPDATE_SROM
-static int write_srom(struct eth_device *dev, u_long ioaddr, int index, int new_value)
+static int write_srom(struct eth_device *dev, u_long ioaddr, int index,
+                     int new_value)
 {
-       int ee_addr_size = do_read_eeprom(dev, ioaddr, 0xff, 8) & 0x40000 ? 8 : 6;
-       int i;
        unsigned short newval;
+       int ee_addr_size;
+       int i;
 
-       udelay(10*1000); /* test-only */
+       ee_addr_size = (do_read_eeprom(dev, ioaddr, 0xff, 8) & BIT(18)) ? 8 : 6;
 
-#ifdef DEBUG_SROM
-       printf("ee_addr_size=%d.\n", ee_addr_size);
-       printf("Writing new entry 0x%4.4x to offset %d.\n", new_value, index);
-#endif
+       udelay(10 * 1000); /* test-only */
+
+       debug_cond(SROM_DLEVEL >= 1, "ee_addr_size=%d.\n", ee_addr_size);
+       debug_cond(SROM_DLEVEL >= 1,
+                  "Writing new entry 0x%4.4x to offset %d.\n",
+                  new_value, index);
 
        /* Enable programming modes. */
-       do_eeprom_cmd(dev, ioaddr, (0x4f << (ee_addr_size-4)), 3+ee_addr_size);
+       do_eeprom_cmd(dev, ioaddr, 0x4f << (ee_addr_size - 4),
+                     3 + ee_addr_size);
 
        /* Do the actual write. */
-       do_eeprom_cmd(dev, ioaddr,
-                     (((SROM_WRITE_CMD<<ee_addr_size)|index) << 16) | new_value,
+       do_eeprom_cmd(dev, ioaddr, new_value |
+                     (((SROM_WRITE_CMD << ee_addr_size) | index) << 16),
                      3 + ee_addr_size + 16);
 
        /* Poll for write finished. */
        sendto_srom(dev, SROM_RD | SROM_SR | DT_CS, ioaddr);
-       for (i = 0; i < 10000; i++)                     /* Typical 2000 ticks */
+       for (i = 0; i < 10000; i++) {   /* Typical 2000 ticks */
                if (getfrom_srom(dev, ioaddr) & EE_DATA_READ)
                        break;
+       }
 
-#ifdef DEBUG_SROM
-       printf(" Write finished after %d ticks.\n", i);
-#endif
+       debug_cond(SROM_DLEVEL >= 1, " Write finished after %d ticks.\n", i);
 
        /* Disable programming. */
-       do_eeprom_cmd(dev, ioaddr, (0x40 << (ee_addr_size-4)), 3 + ee_addr_size);
+       do_eeprom_cmd(dev, ioaddr, (0x40 << (ee_addr_size - 4)),
+                     3 + ee_addr_size);
 
        /* And read the result. */
        newval = do_eeprom_cmd(dev, ioaddr,
-                              (((SROM_READ_CMD<<ee_addr_size)|index) << 16)
+                              (((SROM_READ_CMD << ee_addr_size) | index) << 16)
                               | 0xffff, 3 + ee_addr_size + 16);
-#ifdef DEBUG_SROM
-       printf("  New value at offset %d is %4.4x.\n", index, newval);
-#endif
-       return 1;
-}
-#endif
-
-#ifndef CONFIG_TULIP_FIX_DAVICOM
-static void read_hw_addr(struct eth_device *dev, bd_t *bis)
-{
-       u_short tmp, *p = (u_short *)(&dev->enetaddr[0]);
-       int i, j = 0;
 
-       for (i = 0; i < (ETH_ALEN >> 1); i++) {
-               tmp = read_srom(dev, DE4X5_APROM, ((SROM_HWADD >> 1) + i));
-               *p = le16_to_cpu(tmp);
-               j += *p++;
-       }
+       debug_cond(SROM_DLEVEL >= 1, "  New value at offset %d is %4.4x.\n",
+                  index, newval);
 
-       if ((j == 0) || (j == 0x2fffd)) {
-               memset (dev->enetaddr, 0, ETH_ALEN);
-               debug ("Warning: can't read HW address from SROM.\n");
-               goto Done;
-       }
-
-       return;
-
-Done:
-#ifdef UPDATE_SROM
-       update_srom(dev, bis);
-#endif
-       return;
+       return 1;
 }
-#endif /* CONFIG_TULIP_FIX_DAVICOM */
 
-#ifdef UPDATE_SROM
 static void update_srom(struct eth_device *dev, bd_t *bis)
 {
-       int i;
        static unsigned short eeprom[0x40] = {
                0x140b, 0x6610, 0x0000, 0x0000, /* 00 */
                0x0000, 0x0000, 0x0000, 0x0000, /* 04 */
@@ -746,16 +339,318 @@ static void update_srom(struct eth_device *dev, bd_t *bis)
                0x0000, 0x0000, 0x0000, 0x4e07, /* 3c */
        };
        uchar enetaddr[6];
+       int i;
 
        /* Ethernet Addr... */
        if (!eth_env_get_enetaddr("ethaddr", enetaddr))
                return;
+
        eeprom[0x0a] = (enetaddr[1] << 8) | enetaddr[0];
        eeprom[0x0b] = (enetaddr[3] << 8) | enetaddr[2];
        eeprom[0x0c] = (enetaddr[5] << 8) | enetaddr[4];
 
-       for (i=0; i<0x40; i++) {
+       for (i = 0; i < 0x40; i++)
                write_srom(dev, DE4X5_APROM, i, eeprom[i]);
+}
+#endif /* UPDATE_SROM */
+
+static void send_setup_frame(struct eth_device *dev, bd_t *bis)
+{
+       char setup_frame[SETUP_FRAME_LEN];
+       char *pa = &setup_frame[0];
+       int i;
+
+       memset(pa, 0xff, SETUP_FRAME_LEN);
+
+       for (i = 0; i < ETH_ALEN; i++) {
+               *(pa + (i & 1)) = dev->enetaddr[i];
+               if (i & 0x01)
+                       pa += 4;
+       }
+
+       for (i = 0; tx_ring[tx_new].status & cpu_to_le32(T_OWN); i++) {
+               if (i < TOUT_LOOP)
+                       continue;
+
+               printf("%s: tx error buffer not ready\n", dev->name);
+               return;
+       }
+
+       tx_ring[tx_new].buf = cpu_to_le32(phys_to_bus((u32)&setup_frame[0]));
+       tx_ring[tx_new].des1 = cpu_to_le32(TD_TER | TD_SET | SETUP_FRAME_LEN);
+       tx_ring[tx_new].status = cpu_to_le32(T_OWN);
+
+       dc2114x_outl(dev, POLL_DEMAND, DE4X5_TPD);
+
+       for (i = 0; tx_ring[tx_new].status & cpu_to_le32(T_OWN); i++) {
+               if (i < TOUT_LOOP)
+                       continue;
+
+               printf("%s: tx buffer not ready\n", dev->name);
+               return;
+       }
+
+       if (le32_to_cpu(tx_ring[tx_new].status) != 0x7FFFFFFF) {
+               printf("TX error status2 = 0x%08X\n",
+                      le32_to_cpu(tx_ring[tx_new].status));
+       }
+
+       tx_new = (tx_new + 1) % NUM_TX_DESC;
+}
+
+static int dc21x4x_send(struct eth_device *dev, void *packet, int length)
+{
+       int status = -1;
+       int i;
+
+       if (length <= 0) {
+               printf("%s: bad packet size: %d\n", dev->name, length);
+               goto done;
+       }
+
+       for (i = 0; tx_ring[tx_new].status & cpu_to_le32(T_OWN); i++) {
+               if (i < TOUT_LOOP)
+                       continue;
+
+               printf("%s: tx error buffer not ready\n", dev->name);
+               goto done;
+       }
+
+       tx_ring[tx_new].buf = cpu_to_le32(phys_to_bus((u32)packet));
+       tx_ring[tx_new].des1 = cpu_to_le32(TD_TER | TD_LS | TD_FS | length);
+       tx_ring[tx_new].status = cpu_to_le32(T_OWN);
+
+       dc2114x_outl(dev, POLL_DEMAND, DE4X5_TPD);
+
+       for (i = 0; tx_ring[tx_new].status & cpu_to_le32(T_OWN); i++) {
+               if (i < TOUT_LOOP)
+                       continue;
+
+               printf(".%s: tx buffer not ready\n", dev->name);
+               goto done;
+       }
+
+       if (le32_to_cpu(tx_ring[tx_new].status) & TD_ES) {
+               tx_ring[tx_new].status = 0x0;
+               goto done;
+       }
+
+       status = length;
+
+done:
+       tx_new = (tx_new + 1) % NUM_TX_DESC;
+       return status;
+}
+
+static int dc21x4x_recv(struct eth_device *dev)
+{
+       int length = 0;
+       u32 status;
+
+       while (true) {
+               status = le32_to_cpu(rx_ring[rx_new].status);
+
+               if (status & R_OWN)
+                       break;
+
+               if (status & RD_LS) {
+                       /* Valid frame status. */
+                       if (status & RD_ES) {
+                               /* There was an error. */
+                               printf("RX error status = 0x%08X\n", status);
+                       } else {
+                               /* A valid frame received. */
+                               length = (le32_to_cpu(rx_ring[rx_new].status)
+                                         >> 16);
+
+                               /* Pass the packet up to the protocol layers */
+                               net_process_received_packet
+                                       (net_rx_packets[rx_new], length - 4);
+                       }
+
+                       /*
+                        * Change buffer ownership for this frame,
+                        * back to the adapter.
+                        */
+                       rx_ring[rx_new].status = cpu_to_le32(R_OWN);
+               }
+
+               /* Update entry information. */
+               rx_new = (rx_new + 1) % rx_ring_size;
+       }
+
+       return length;
+}
+
+static int dc21x4x_init(struct eth_device *dev, bd_t *bis)
+{
+       int i;
+       int devbusfn = (int)dev->priv;
+
+       /* Ensure we're not sleeping. */
+       pci_write_config_byte(devbusfn, PCI_CFDA_PSM, WAKEUP);
+
+       reset_de4x5(dev);
+
+       if (dc2114x_inl(dev, DE4X5_STS) & (STS_TS | STS_RS)) {
+               printf("Error: Cannot reset ethernet controller.\n");
+               return -1;
+       }
+
+       dc2114x_outl(dev, OMR_SDP | OMR_PS | OMR_PM, DE4X5_OMR);
+
+       for (i = 0; i < NUM_RX_DESC; i++) {
+               rx_ring[i].status = cpu_to_le32(R_OWN);
+               rx_ring[i].des1 = cpu_to_le32(RX_BUFF_SZ);
+               rx_ring[i].buf =
+                       cpu_to_le32(phys_to_bus((u32)net_rx_packets[i]));
+               rx_ring[i].next = 0;
+       }
+
+       for (i = 0; i < NUM_TX_DESC; i++) {
+               tx_ring[i].status = 0;
+               tx_ring[i].des1 = 0;
+               tx_ring[i].buf = 0;
+               tx_ring[i].next = 0;
        }
+
+       rx_ring_size = NUM_RX_DESC;
+       tx_ring_size = NUM_TX_DESC;
+
+       /* Write the end of list marker to the descriptor lists. */
+       rx_ring[rx_ring_size - 1].des1 |= cpu_to_le32(RD_RER);
+       tx_ring[tx_ring_size - 1].des1 |= cpu_to_le32(TD_TER);
+
+       /* Tell the adapter where the TX/RX rings are located. */
+       dc2114x_outl(dev, phys_to_bus((u32)&rx_ring), DE4X5_RRBA);
+       dc2114x_outl(dev, phys_to_bus((u32)&tx_ring), DE4X5_TRBA);
+
+       start_de4x5(dev);
+
+       tx_new = 0;
+       rx_new = 0;
+
+       send_setup_frame(dev, bis);
+
+       return 0;
+}
+
+static void dc21x4x_halt(struct eth_device *dev)
+{
+       int devbusfn = (int)dev->priv;
+
+       stop_de4x5(dev);
+       dc2114x_outl(dev, 0, DE4X5_SICR);
+
+       pci_write_config_byte(devbusfn, PCI_CFDA_PSM, SLEEP);
+}
+
+static void read_hw_addr(struct eth_device *dev, bd_t *bis)
+{
+       u_short tmp, *p = (u_short *)(&dev->enetaddr[0]);
+       int i, j = 0;
+
+       for (i = 0; i < (ETH_ALEN >> 1); i++) {
+               tmp = read_srom(dev, DE4X5_APROM, (SROM_HWADD >> 1) + i);
+               *p = le16_to_cpu(tmp);
+               j += *p++;
+       }
+
+       if (!j || j == 0x2fffd) {
+               memset(dev->enetaddr, 0, ETH_ALEN);
+               debug("Warning: can't read HW address from SROM.\n");
+#ifdef UPDATE_SROM
+               update_srom(dev, bis);
+#endif
+       }
+}
+
+static struct pci_device_id supported[] = {
+       { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP_FAST },
+       { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21142 },
+       { }
+};
+
+int dc21x4x_initialize(bd_t *bis)
+{
+       struct eth_device *dev;
+       unsigned short status;
+       unsigned char timer;
+       unsigned int iobase;
+       int card_number = 0;
+       pci_dev_t devbusfn;
+       unsigned int cfrv;
+       int idx = 0;
+
+       while (1) {
+               devbusfn = pci_find_devices(supported, idx++);
+               if (devbusfn == -1)
+                       break;
+
+               /* Get the chip configuration revision register. */
+               pci_read_config_dword(devbusfn, PCI_REVISION_ID, &cfrv);
+
+               if ((cfrv & CFRV_RN) < DC2114x_BRK) {
+                       printf("Error: The chip is not DC21143.\n");
+                       continue;
+               }
+
+               pci_read_config_word(devbusfn, PCI_COMMAND, &status);
+               status |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER;
+               pci_write_config_word(devbusfn, PCI_COMMAND, status);
+
+               pci_read_config_word(devbusfn, PCI_COMMAND, &status);
+               if (!(status & PCI_COMMAND_MEMORY)) {
+                       printf("Error: Can not enable MEMORY access.\n");
+                       continue;
+               }
+
+               if (!(status & PCI_COMMAND_MASTER)) {
+                       printf("Error: Can not enable Bus Mastering.\n");
+                       continue;
+               }
+
+               /* Check the latency timer for values >= 0x60. */
+               pci_read_config_byte(devbusfn, PCI_LATENCY_TIMER, &timer);
+
+               if (timer < 0x60) {
+                       pci_write_config_byte(devbusfn, PCI_LATENCY_TIMER,
+                                             0x60);
+               }
+
+               /* read BAR for memory space access */
+               pci_read_config_dword(devbusfn, PCI_BASE_ADDRESS_1, &iobase);
+               iobase &= PCI_BASE_ADDRESS_MEM_MASK;
+               debug("dc21x4x: DEC 21142 PCI Device @0x%x\n", iobase);
+
+               dev = (struct eth_device *)malloc(sizeof(*dev));
+               if (!dev) {
+                       printf("Can not allocalte memory of dc21x4x\n");
+                       break;
+               }
+
+               memset(dev, 0, sizeof(*dev));
+
+               sprintf(dev->name, "dc21x4x#%d", card_number);
+
+               dev->iobase = pci_mem_to_phys(devbusfn, iobase);
+               dev->priv = (void *)devbusfn;
+               dev->init = dc21x4x_init;
+               dev->halt = dc21x4x_halt;
+               dev->send = dc21x4x_send;
+               dev->recv = dc21x4x_recv;
+
+               /* Ensure we're not sleeping. */
+               pci_write_config_byte(devbusfn, PCI_CFDA_PSM, WAKEUP);
+
+               udelay(10 * 1000);
+
+               read_hw_addr(dev, bis);
+
+               eth_register(dev);
+
+               card_number++;
+       }
+
+       return card_number;
 }
-#endif /* UPDATE_SROM */
index 63f2086dece4a726f72abb830c9bab06cdb8f2d6..60dfd17a74d31d55c9f4a4bd3d1f687d970ed3f9 100644 (file)
@@ -1288,9 +1288,9 @@ static int eqos_start(struct udevice *dev)
                struct eqos_desc *rx_desc = &(eqos->rx_descs[i]);
                rx_desc->des0 = (u32)(ulong)(eqos->rx_dma_buf +
                                             (i * EQOS_MAX_PACKET_SIZE));
-               rx_desc->des3 |= EQOS_DESC3_OWN | EQOS_DESC3_BUF1V;
+               rx_desc->des3 = EQOS_DESC3_OWN | EQOS_DESC3_BUF1V;
+               eqos->config->ops->eqos_flush_desc(rx_desc);
        }
-       eqos->config->ops->eqos_flush_desc(eqos->descs);
 
        writel(0, &eqos->dma_regs->ch0_txdesc_list_haddress);
        writel((ulong)eqos->tx_descs, &eqos->dma_regs->ch0_txdesc_list_address);
@@ -1419,7 +1419,8 @@ static int eqos_send(struct udevice *dev, void *packet, int length)
        tx_desc->des3 = EQOS_DESC3_OWN | EQOS_DESC3_FD | EQOS_DESC3_LD | length;
        eqos->config->ops->eqos_flush_desc(tx_desc);
 
-       writel((ulong)(tx_desc + 1), &eqos->dma_regs->ch0_txdesc_tail_pointer);
+       writel((ulong)(&(eqos->tx_descs[eqos->tx_desc_idx])),
+               &eqos->dma_regs->ch0_txdesc_tail_pointer);
 
        for (i = 0; i < 1000000; i++) {
                eqos->config->ops->eqos_inval_desc(tx_desc);
@@ -1442,6 +1443,7 @@ static int eqos_recv(struct udevice *dev, int flags, uchar **packetp)
        debug("%s(dev=%p, flags=%x):\n", __func__, dev, flags);
 
        rx_desc = &(eqos->rx_descs[eqos->rx_desc_idx]);
+       eqos->config->ops->eqos_inval_desc(rx_desc);
        if (rx_desc->des3 & EQOS_DESC3_OWN) {
                debug("%s: RX packet not available\n", __func__);
                return -EAGAIN;
@@ -1474,6 +1476,11 @@ static int eqos_free_pkt(struct udevice *dev, uchar *packet, int length)
        }
 
        rx_desc = &(eqos->rx_descs[eqos->rx_desc_idx]);
+
+       rx_desc->des0 = 0;
+       mb();
+       eqos->config->ops->eqos_flush_desc(rx_desc);
+       eqos->config->ops->eqos_inval_buffer(packet, length);
        rx_desc->des0 = (u32)(ulong)packet;
        rx_desc->des1 = 0;
        rx_desc->des2 = 0;
@@ -1482,7 +1489,7 @@ static int eqos_free_pkt(struct udevice *dev, uchar *packet, int length)
         * writes to the rest of the descriptor too.
         */
        mb();
-       rx_desc->des3 |= EQOS_DESC3_OWN | EQOS_DESC3_BUF1V;
+       rx_desc->des3 = EQOS_DESC3_OWN | EQOS_DESC3_BUF1V;
        eqos->config->ops->eqos_flush_desc(rx_desc);
 
        writel((ulong)rx_desc, &eqos->dma_regs->ch0_rxdesc_tail_pointer);
@@ -1536,6 +1543,9 @@ static int eqos_probe_resources_core(struct udevice *dev)
        }
        debug("%s: rx_pkt=%p\n", __func__, eqos->rx_pkt);
 
+       eqos->config->ops->eqos_inval_buffer(eqos->rx_dma_buf,
+                       EQOS_MAX_PACKET_SIZE * EQOS_DESCRIPTORS_RX);
+
        debug("%s: OK\n", __func__);
        return 0;
 
index bc5b63d78814979347988ea85fd08ea4223209fd..345d37be4e825ddde165b033c47142a499b8e592 100644 (file)
@@ -503,6 +503,16 @@ static int fec_open(struct eth_device *edev)
        writel(readl(&fec->eth->ecntrl) | FEC_ECNTRL_ETHER_EN,
               &fec->eth->ecntrl);
 
+#ifdef FEC_ENET_ENABLE_TXC_DELAY
+       writel(readl(&fec->eth->ecntrl) | FEC_ECNTRL_TXC_DLY,
+              &fec->eth->ecntrl);
+#endif
+
+#ifdef FEC_ENET_ENABLE_RXC_DELAY
+       writel(readl(&fec->eth->ecntrl) | FEC_ECNTRL_RXC_DLY,
+              &fec->eth->ecntrl);
+#endif
+
 #if defined(CONFIG_MX25) || defined(CONFIG_MX53) || defined(CONFIG_MX6SL)
        udelay(100);
 
index 159aec896796c3a2218de68f3e5f15c462d391a5..3c8fdda263804f07dbf3a1c0397b509cde1151f0 100644 (file)
@@ -188,6 +188,8 @@ struct ethernet_regs {
 #define FEC_ECNTRL_ETHER_EN            0x00000002      /* enable the FEC */
 #define FEC_ECNTRL_SPEED               0x00000020
 #define FEC_ECNTRL_DBSWAP              0x00000100
+#define FEC_ECNTRL_TXC_DLY             0x00010000      /* TXC delayed */
+#define FEC_ECNTRL_RXC_DLY             0x00020000      /* RXC delayed */
 
 #define FEC_X_WMRK_STRFWD              0x00000100
 
index b4ad11d3fa583262c080662c5cebf8ccab88c01a..f97e7f8c6a38e3e9668f3ae10fb8df485d0e859c 100644 (file)
 #define PCNET_DEBUG2(fmt,args...)      \
        debug_cond(PCNET_DEBUG_LEVEL > 1, fmt ,##args)
 
-#if !defined(CONF_PCNET_79C973) && defined(CONF_PCNET_79C975)
-#error "Macro for PCnet chip version is not defined!"
-#endif
-
 /*
  * Set the number of Tx and Rx buffers, using Log_2(# buffers).
  * Reasonable default values are 4 Tx buffers, and 16 Rx buffers.
@@ -95,37 +91,49 @@ static pcnet_priv_t *lp;
 
 static u16 pcnet_read_csr(struct eth_device *dev, int index)
 {
-       outw(index, dev->iobase + PCNET_RAP);
-       return inw(dev->iobase + PCNET_RDP);
+       void __iomem *base = (void __iomem *)dev->iobase;
+
+       writew(index, base + PCNET_RAP);
+       return readw(base + PCNET_RDP);
 }
 
 static void pcnet_write_csr(struct eth_device *dev, int index, u16 val)
 {
-       outw(index, dev->iobase + PCNET_RAP);
-       outw(val, dev->iobase + PCNET_RDP);
+       void __iomem *base = (void __iomem *)dev->iobase;
+
+       writew(index, base + PCNET_RAP);
+       writew(val, base + PCNET_RDP);
 }
 
 static u16 pcnet_read_bcr(struct eth_device *dev, int index)
 {
-       outw(index, dev->iobase + PCNET_RAP);
-       return inw(dev->iobase + PCNET_BDP);
+       void __iomem *base = (void __iomem *)dev->iobase;
+
+       writew(index, base + PCNET_RAP);
+       return readw(base + PCNET_BDP);
 }
 
 static void pcnet_write_bcr(struct eth_device *dev, int index, u16 val)
 {
-       outw(index, dev->iobase + PCNET_RAP);
-       outw(val, dev->iobase + PCNET_BDP);
+       void __iomem *base = (void __iomem *)dev->iobase;
+
+       writew(index, base + PCNET_RAP);
+       writew(val, base + PCNET_BDP);
 }
 
 static void pcnet_reset(struct eth_device *dev)
 {
-       inw(dev->iobase + PCNET_RESET);
+       void __iomem *base = (void __iomem *)dev->iobase;
+
+       readw(base + PCNET_RESET);
 }
 
 static int pcnet_check(struct eth_device *dev)
 {
-       outw(88, dev->iobase + PCNET_RAP);
-       return inw(dev->iobase + PCNET_RAP) == 88;
+       void __iomem *base = (void __iomem *)dev->iobase;
+
+       writew(88, base + PCNET_RAP);
+       return readw(base + PCNET_RAP) == 88;
 }
 
 static int pcnet_init (struct eth_device *dev, bd_t * bis);
@@ -183,14 +191,14 @@ int pcnet_initialize(bd_t *bis)
                /*
                 * Setup the PCI device.
                 */
-               pci_read_config_dword(devbusfn, PCI_BASE_ADDRESS_0, &bar);
-               dev->iobase = pci_io_to_phys(devbusfn, bar);
+               pci_read_config_dword(devbusfn, PCI_BASE_ADDRESS_1, &bar);
+               dev->iobase = pci_mem_to_phys(devbusfn, bar);
                dev->iobase &= ~0xf;
 
                PCNET_DEBUG1("%s: devbusfn=0x%x iobase=0x%lx: ",
                             dev->name, devbusfn, (unsigned long)dev->iobase);
 
-               command = PCI_COMMAND_IO | PCI_COMMAND_MASTER;
+               command = PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER;
                pci_write_config_word(devbusfn, PCI_COMMAND, command);
                pci_read_config_word(devbusfn, PCI_COMMAND, &status);
                if ((status & command) != command) {
@@ -254,16 +262,12 @@ static int pcnet_probe(struct eth_device *dev, bd_t *bis, int dev_nr)
        case 0x2621:
                chipname = "PCnet/PCI II 79C970A";      /* PCI */
                break;
-#ifdef CONFIG_PCNET_79C973
        case 0x2625:
                chipname = "PCnet/FAST III 79C973";     /* PCI */
                break;
-#endif
-#ifdef CONFIG_PCNET_79C975
        case 0x2627:
                chipname = "PCnet/FAST III 79C975";     /* PCI */
                break;
-#endif
        default:
                printf("%s: PCnet version %#x not supported\n",
                       dev->name, chip_version);
@@ -340,7 +344,9 @@ static int pcnet_init(struct eth_device *dev, bd_t *bis)
                addr = (unsigned long)memalign(ARCH_DMA_MINALIGN,
                                               sizeof(*lp->uc));
                flush_dcache_range(addr, addr + sizeof(*lp->uc));
-               addr = UNCACHED_SDRAM(addr);
+               addr = (unsigned long)map_physmem(addr,
+                               roundup(sizeof(*lp->uc), ARCH_DMA_MINALIGN),
+                               MAP_NOCACHE);
                lp->uc = (struct pcnet_uncached_priv *)addr;
 
                addr = (unsigned long)memalign(ARCH_DMA_MINALIGN,
index 0105fc5af1ea3a3fc012b689536617607002b5ed..f0032e8ce166813f9fe58afa380064df3f27537e 100644 (file)
@@ -383,8 +383,8 @@ static int ksz9031_config(struct phy_device *phydev)
 
 static struct phy_driver ksz9031_driver = {
        .name = "Micrel ksz9031",
-       .uid  = 0x221620,
-       .mask = 0xfffff0,
+       .uid  = PHY_ID_KSZ9031,
+       .mask = MII_KSZ9x31_SILICON_REV_MASK,
        .features = PHY_GBIT_FEATURES,
        .config   = &ksz9031_config,
        .startup  = &ksz90xx_startup,
@@ -393,9 +393,67 @@ static struct phy_driver ksz9031_driver = {
        .readext = &ksz9031_phy_extread,
 };
 
+/*
+ * KSZ9131
+ */
+static int ksz9131_config(struct phy_device *phydev)
+{
+       /* TBD: Implement Skew values for dts */
+
+       /* add an option to disable the gigabit feature of this PHY */
+       if (env_get("disable_giga")) {
+               unsigned features;
+               unsigned bmcr;
+
+               /* disable speed 1000 in features supported by the PHY */
+               features = phydev->drv->features;
+               features &= ~(SUPPORTED_1000baseT_Half |
+                               SUPPORTED_1000baseT_Full);
+               phydev->advertising = phydev->supported = features;
+
+               /* disable speed 1000 in Basic Control Register */
+               bmcr = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR);
+               bmcr &= ~(1 << 6);
+               phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, bmcr);
+
+               /* disable speed 1000 in 1000Base-T Control Register */
+               phy_write(phydev, MDIO_DEVAD_NONE, MII_CTRL1000, 0);
+
+               /* start autoneg */
+               genphy_config_aneg(phydev);
+               genphy_restart_aneg(phydev);
+
+               return 0;
+       }
+
+       return genphy_config(phydev);
+}
+
+static struct phy_driver ksz9131_driver = {
+       .name = "Micrel ksz9031",
+       .uid  = PHY_ID_KSZ9131,
+       .mask = MII_KSZ9x31_SILICON_REV_MASK,
+       .features = PHY_GBIT_FEATURES,
+       .config   = &ksz9131_config,
+       .startup  = &ksz90xx_startup,
+       .shutdown = &genphy_shutdown,
+       .writeext = &ksz9031_phy_extwrite,
+       .readext = &ksz9031_phy_extread,
+};
+
+int ksz9xx1_phy_get_id(struct phy_device *phydev)
+{
+       unsigned int phyid;
+
+       get_phy_id(phydev->bus, phydev->addr, MDIO_DEVAD_NONE, &phyid);
+
+       return phyid;
+}
+
 int phy_micrel_ksz90x1_init(void)
 {
        phy_register(&ksz9021_driver);
        phy_register(&ksz9031_driver);
+       phy_register(&ksz9131_driver);
        return 0;
 }
index bb59629f81cb737f13520ad9708f8f58c7aca37e..1f083972917780bbf986b44c9c6eb92fdeb206d4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * rtl8139.c : U-Boot driver for the RealTek RTL8139
  *
@@ -8,71 +9,68 @@
  */
 
 /* rtl8139.c - etherboot driver for the Realtek 8139 chipset
-
-  ported from the linux driver written by Donald Becker
-  by Rainer Bawidamann (Rainer.Bawidamann@informatik.uni-ulm.de) 1999
-
-  This software may be used and distributed according to the terms
-  of the GNU Public License, incorporated herein by reference.
-
-  changes to the original driver:
-  - removed support for interrupts, switching to polling mode (yuck!)
-  - removed support for the 8129 chip (external MII)
-
-*/
+ *
+ * ported from the linux driver written by Donald Becker
+ * by Rainer Bawidamann (Rainer.Bawidamann@informatik.uni-ulm.de) 1999
+ *
+ * changes to the original driver:
+ * - removed support for interrupts, switching to polling mode (yuck!)
+ * - removed support for the 8129 chip (external MII)
+ */
 
 /*********************************************************************/
 /* Revision History                                                 */
 /*********************************************************************/
 
 /*
 28 Dec 2002  ken_yap@users.sourceforge.net (Ken Yap)
-     Put in virt_to_bus calls to allow Etherboot relocation.
-
 06 Apr 2001  ken_yap@users.sourceforge.net (Ken Yap)
-     Following email from Hyun-Joon Cha, added a disable routine, otherwise
-     NIC remains live and can crash the kernel later.
-
 4 Feb 2000   espenlaub@informatik.uni-ulm.de (Klaus Espenlaub)
-     Shuffled things around, removed the leftovers from the 8129 support
-     that was in the Linux driver and added a bit more 8139 definitions.
-     Moved the 8K receive buffer to a fixed, available address outside the
    0x98000-0x9ffff range.  This is a bit of a hack, but currently the only
-     way to make room for the Etherboot features that need substantial amounts
    of code like the ANSI console support.  Currently the buffer is just below
-     0x10000, so this even conforms to the tagged boot image specification,
    which reserves the ranges 0x00000-0x10000 and 0x98000-0xA0000.  My
-     interpretation of this "reserved" is that Etherboot may do whatever it
-     likes, as long as its environment is kept intact (like the BIOS
    variables).  Hopefully fixed rtl_poll() once and for all. The symptoms
-     were that if Etherboot was left at the boot menu for several minutes, the
    first eth_poll failed.  Seems like I am the only person who does this.
-     First of all I fixed the debugging code and then set out for a long bug
    hunting session.  It took me about a week full time work - poking around
-     various places in the driver, reading Don Becker's and Jeff Garzik's Linux
-     driver and even the FreeBSD driver (what a piece of crap!) - and
-     eventually spotted the nasty thing: the transmit routine was acknowledging
-     each and every interrupt pending, including the RxOverrun and RxFIFIOver
    interrupts.  This confused the RTL8139 thoroughly.         It destroyed the
-     Rx ring contents by dumping the 2K FIFO contents right where we wanted to
    get the next packet.  Oh well, what fun.
-
 18 Jan 2000  mdc@thinguin.org (Marty Connor)
    Drastically simplified error handling.  Basically, if any error
-     in transmission or reception occurs, the card is reset.
-     Also, pointed all transmit descriptors to the same buffer to
    save buffer space.         This should decrease driver size and avoid
-     corruption because of exceeding 32K during runtime.
-
 28 Jul 1999  (Matthias Meixner - meixner@rbg.informatik.tu-darmstadt.de)
    rtl_poll was quite broken: it used the RxOK interrupt flag instead
-     of the RxBufferEmpty flag which often resulted in very bad
-     transmission performace - below 1kBytes/s.
-
-*/
* 28 Dec 2002 ken_yap@users.sourceforge.net (Ken Yap)
*    Put in virt_to_bus calls to allow Etherboot relocation.
+ *
* 06 Apr 2001 ken_yap@users.sourceforge.net (Ken Yap)
*    Following email from Hyun-Joon Cha, added a disable routine, otherwise
*    NIC remains live and can crash the kernel later.
+ *
* 4 Feb 2000 espenlaub@informatik.uni-ulm.de (Klaus Espenlaub)
*    Shuffled things around, removed the leftovers from the 8129 support
*    that was in the Linux driver and added a bit more 8139 definitions.
*    Moved the 8K receive buffer to a fixed, available address outside the
*    0x98000-0x9ffff range. This is a bit of a hack, but currently the only
*    way to make room for the Etherboot features that need substantial amounts
*    of code like the ANSI console support. Currently the buffer is just below
*    0x10000, so this even conforms to the tagged boot image specification,
*    which reserves the ranges 0x00000-0x10000 and 0x98000-0xA0000. My
*    interpretation of this "reserved" is that Etherboot may do whatever it
*    likes, as long as its environment is kept intact (like the BIOS
*    variables). Hopefully fixed rtl8139_recv() once and for all. The symptoms
*    were that if Etherboot was left at the boot menu for several minutes, the
*    first eth_poll failed. Seems like I am the only person who does this.
*    First of all I fixed the debugging code and then set out for a long bug
*    hunting session. It took me about a week full time work - poking around
*    various places in the driver, reading Don Becker's and Jeff Garzik's Linux
*    driver and even the FreeBSD driver (what a piece of crap!) - and
*    eventually spotted the nasty thing: the transmit routine was acknowledging
*    each and every interrupt pending, including the RxOverrun and RxFIFIOver
*    interrupts. This confused the RTL8139 thoroughly. It destroyed the
*    Rx ring contents by dumping the 2K FIFO contents right where we wanted to
*    get the next packet. Oh well, what fun.
+ *
* 18 Jan 2000 mdc@thinguin.org (Marty Connor)
*    Drastically simplified error handling. Basically, if any error
*    in transmission or reception occurs, the card is reset.
*    Also, pointed all transmit descriptors to the same buffer to
*    save buffer space. This should decrease driver size and avoid
*    corruption because of exceeding 32K during runtime.
+ *
* 28 Jul 1999 (Matthias Meixner - meixner@rbg.informatik.tu-darmstadt.de)
*    rtl8139_recv was quite broken: it used the RxOK interrupt flag instead
*    of the RxBufferEmpty flag which often resulted in very bad
*    transmission performace - below 1kBytes/s.
+ *
+ */
 
 #include <common.h>
 #include <cpu_func.h>
+#include <linux/types.h>
 #include <malloc.h>
 #include <net.h>
 #include <netdev.h>
@@ -81,8 +79,8 @@
 
 #define RTL_TIMEOUT    100000
 
-/* PCI Tuning Parameters
-   Threshold is bytes transferred to chip before transmission starts. */
+/* PCI Tuning Parameters */
+/* Threshold is bytes transferred to chip before transmission starts. */
 #define TX_FIFO_THRESH 256     /* In bytes, rounded down to 32 byte units. */
 #define RX_FIFO_THRESH 4       /* Rx buffer level before first PCI xfer.  */
 #define RX_DMA_BURST   4       /* Maximum PCI burst, '4' is 256 bytes */
 #define phys_to_bus(a) pci_phys_to_mem((pci_dev_t)dev->priv, a)
 
 /* Symbolic offsets to registers. */
-enum RTL8139_registers {
-       MAC0=0,                 /* Ethernet hardware address. */
-       MAR0=8,                 /* Multicast filter. */
-       TxStatus0=0x10,         /* Transmit status (four 32bit registers). */
-       TxAddr0=0x20,           /* Tx descriptors (also four 32bit). */
-       RxBuf=0x30, RxEarlyCnt=0x34, RxEarlyStatus=0x36,
-       ChipCmd=0x37, RxBufPtr=0x38, RxBufAddr=0x3A,
-       IntrMask=0x3C, IntrStatus=0x3E,
-       TxConfig=0x40, RxConfig=0x44,
-       Timer=0x48,             /* general-purpose counter. */
-       RxMissed=0x4C,          /* 24 bits valid, write clears. */
-       Cfg9346=0x50, Config0=0x51, Config1=0x52,
-       TimerIntrReg=0x54,      /* intr if gp counter reaches this value */
-       MediaStatus=0x58,
-       Config3=0x59,
-       MultiIntr=0x5C,
-       RevisionID=0x5E,        /* revision of the RTL8139 chip */
-       TxSummary=0x60,
-       MII_BMCR=0x62, MII_BMSR=0x64, NWayAdvert=0x66, NWayLPAR=0x68,
-       NWayExpansion=0x6A,
-       DisconnectCnt=0x6C, FalseCarrierCnt=0x6E,
-       NWayTestReg=0x70,
-       RxCnt=0x72,             /* packet received counter */
-       CSCR=0x74,              /* chip status and configuration register */
-       PhyParm1=0x78,TwisterParm=0x7c,PhyParm2=0x80,   /* undocumented */
-       /* from 0x84 onwards are a number of power management/wakeup frame
-        * definitions we will probably never need to know about.  */
-};
-
-enum ChipCmdBits {
-       CmdReset=0x10, CmdRxEnb=0x08, CmdTxEnb=0x04, RxBufEmpty=0x01, };
-
-/* Interrupt register bits, using my own meaningful names. */
-enum IntrStatusBits {
-       PCIErr=0x8000, PCSTimeout=0x4000, CableLenChange= 0x2000,
-       RxFIFOOver=0x40, RxUnderrun=0x20, RxOverflow=0x10,
-       TxErr=0x08, TxOK=0x04, RxErr=0x02, RxOK=0x01,
-};
-enum TxStatusBits {
-       TxHostOwns=0x2000, TxUnderrun=0x4000, TxStatOK=0x8000,
-       TxOutOfWindow=0x20000000, TxAborted=0x40000000,
-       TxCarrierLost=0x80000000,
-};
-enum RxStatusBits {
-       RxMulticast=0x8000, RxPhysical=0x4000, RxBroadcast=0x2000,
-       RxBadSymbol=0x0020, RxRunt=0x0010, RxTooLong=0x0008, RxCRCErr=0x0004,
-       RxBadAlign=0x0002, RxStatusOK=0x0001,
-};
-
-enum MediaStatusBits {
-       MSRTxFlowEnable=0x80, MSRRxFlowEnable=0x40, MSRSpeed10=0x08,
-       MSRLinkFail=0x04, MSRRxPauseFlag=0x02, MSRTxPauseFlag=0x01,
-};
-
-enum MIIBMCRBits {
-       BMCRReset=0x8000, BMCRSpeed100=0x2000, BMCRNWayEnable=0x1000,
-       BMCRRestartNWay=0x0200, BMCRDuplex=0x0100,
-};
-
-enum CSCRBits {
-       CSCR_LinkOKBit=0x0400, CSCR_LinkChangeBit=0x0800,
-       CSCR_LinkStatusBits=0x0f000, CSCR_LinkDownOffCmd=0x003c0,
-       CSCR_LinkDownCmd=0x0f3c0,
-};
-
-/* Bits in RxConfig. */
-enum rx_mode_bits {
-       RxCfgWrap=0x80,
-       AcceptErr=0x20, AcceptRunt=0x10, AcceptBroadcast=0x08,
-       AcceptMulticast=0x04, AcceptMyPhys=0x02, AcceptAllPhys=0x01,
-};
+/* Ethernet hardware address. */
+#define RTL_REG_MAC0                           0x00
+/* Multicast filter. */
+#define RTL_REG_MAR0                           0x08
+/* Transmit status (four 32bit registers). */
+#define RTL_REG_TXSTATUS0                      0x10
+/* Tx descriptors (also four 32bit). */
+#define RTL_REG_TXADDR0                                0x20
+#define RTL_REG_RXBUF                          0x30
+#define RTL_REG_RXEARLYCNT                     0x34
+#define RTL_REG_RXEARLYSTATUS                  0x36
+#define RTL_REG_CHIPCMD                                0x37
+#define RTL_REG_CHIPCMD_CMDRESET               BIT(4)
+#define RTL_REG_CHIPCMD_CMDRXENB               BIT(3)
+#define RTL_REG_CHIPCMD_CMDTXENB               BIT(2)
+#define RTL_REG_CHIPCMD_RXBUFEMPTY             BIT(0)
+#define RTL_REG_RXBUFPTR                       0x38
+#define RTL_REG_RXBUFADDR                      0x3A
+#define RTL_REG_INTRMASK                       0x3C
+#define RTL_REG_INTRSTATUS                     0x3E
+#define RTL_REG_INTRSTATUS_PCIERR              BIT(15)
+#define RTL_REG_INTRSTATUS_PCSTIMEOUT          BIT(14)
+#define RTL_REG_INTRSTATUS_CABLELENCHANGE      BIT(13)
+#define RTL_REG_INTRSTATUS_RXFIFOOVER          BIT(6)
+#define RTL_REG_INTRSTATUS_RXUNDERRUN          BIT(5)
+#define RTL_REG_INTRSTATUS_RXOVERFLOW          BIT(4)
+#define RTL_REG_INTRSTATUS_TXERR               BIT(3)
+#define RTL_REG_INTRSTATUS_TXOK                        BIT(2)
+#define RTL_REG_INTRSTATUS_RXERR               BIT(1)
+#define RTL_REG_INTRSTATUS_RXOK                        BIT(0)
+#define RTL_REG_TXCONFIG                       0x40
+#define RTL_REG_RXCONFIG                       0x44
+#define RTL_REG_RXCONFIG_RXCFGWRAP             BIT(7)
+#define RTL_REG_RXCONFIG_ACCEPTERR             BIT(5)
+#define RTL_REG_RXCONFIG_ACCEPTRUNT            BIT(4)
+#define RTL_REG_RXCONFIG_ACCEPTBROADCAST       BIT(3)
+#define RTL_REG_RXCONFIG_ACCEPTMULTICAST       BIT(2)
+#define RTL_REG_RXCONFIG_ACCEPTMYPHYS          BIT(1)
+#define RTL_REG_RXCONFIG_ACCEPTALLPHYS         BIT(0)
+/* general-purpose counter. */
+#define RTL_REG_TIMER                          0x48
+/* 24 bits valid, write clears. */
+#define RTL_REG_RXMISSED                       0x4C
+#define RTL_REG_CFG9346                                0x50
+#define RTL_REG_CONFIG0                                0x51
+#define RTL_REG_CONFIG1                                0x52
+/* intr if gp counter reaches this value */
+#define RTL_REG_TIMERINTRREG                   0x54
+#define RTL_REG_MEDIASTATUS                    0x58
+#define RTL_REG_MEDIASTATUS_MSRTXFLOWENABLE    BIT(7)
+#define RTL_REG_MEDIASTATUS_MSRRXFLOWENABLE    BIT(6)
+#define RTL_REG_MEDIASTATUS_MSRSPEED10         BIT(3)
+#define RTL_REG_MEDIASTATUS_MSRLINKFAIL                BIT(2)
+#define RTL_REG_MEDIASTATUS_MSRRXPAUSEFLAG     BIT(1)
+#define RTL_REG_MEDIASTATUS_MSRTXPAUSEFLAG     BIT(0)
+#define RTL_REG_CONFIG3                                0x59
+#define RTL_REG_MULTIINTR                      0x5C
+/* revision of the RTL8139 chip */
+#define RTL_REG_REVISIONID                     0x5E
+#define RTL_REG_TXSUMMARY                      0x60
+#define RTL_REG_MII_BMCR                       0x62
+#define RTL_REG_MII_BMSR                       0x64
+#define RTL_REG_NWAYADVERT                     0x66
+#define RTL_REG_NWAYLPAR                       0x68
+#define RTL_REG_NWAYEXPANSION                  0x6A
+#define RTL_REG_DISCONNECTCNT                  0x6C
+#define RTL_REG_FALSECARRIERCNT                        0x6E
+#define RTL_REG_NWAYTESTREG                    0x70
+/* packet received counter */
+#define RTL_REG_RXCNT                          0x72
+/* chip status and configuration register */
+#define RTL_REG_CSCR                           0x74
+#define RTL_REG_PHYPARM1                       0x78
+#define RTL_REG_TWISTERPARM                    0x7c
+/* undocumented */
+#define RTL_REG_PHYPARM2                       0x80
+/*
+ * from 0x84 onwards are a number of power management/wakeup frame
+ * definitions we will probably never need to know about.
+ */
 
+#define RTL_STS_RXMULTICAST                    BIT(15)
+#define RTL_STS_RXPHYSICAL                     BIT(14)
+#define RTL_STS_RXBROADCAST                    BIT(13)
+#define RTL_STS_RXBADSYMBOL                    BIT(5)
+#define RTL_STS_RXRUNT                         BIT(4)
+#define RTL_STS_RXTOOLONG                      BIT(3)
+#define RTL_STS_RXCRCERR                       BIT(2)
+#define RTL_STS_RXBADALIGN                     BIT(1)
+#define RTL_STS_RXSTATUSOK                     BIT(0)
+
+static unsigned int cur_rx, cur_tx;
 static int ioaddr;
-static unsigned int cur_rx,cur_tx;
 
 /* The RTL8139 can only transmit from a contiguous, aligned memory block.  */
-static unsigned char tx_buffer[TX_BUF_SIZE] __attribute__((aligned(4)));
-static unsigned char rx_ring[RX_BUF_LEN+16] __attribute__((aligned(4)));
-
-static int rtl8139_probe(struct eth_device *dev, bd_t *bis);
-static int read_eeprom(int location, int addr_len);
-static void rtl_reset(struct eth_device *dev);
-static int rtl_transmit(struct eth_device *dev, void *packet, int length);
-static int rtl_poll(struct eth_device *dev);
-static void rtl_disable(struct eth_device *dev);
-static int rtl_bcast_addr(struct eth_device *dev, const u8 *bcast_mac, int join)
-{
-       return (0);
-}
-
-static struct pci_device_id supported[] = {
-       {PCI_VENDOR_ID_REALTEK, PCI_DEVICE_ID_REALTEK_8139},
-       {PCI_VENDOR_ID_DLINK, PCI_DEVICE_ID_DLINK_8139},
-       {}
-};
-
-int rtl8139_initialize(bd_t *bis)
-{
-       pci_dev_t devno;
-       int card_number = 0;
-       struct eth_device *dev;
-       u32 iobase;
-       int idx=0;
-
-       while(1){
-               /* Find RTL8139 */
-               if ((devno = pci_find_devices(supported, idx++)) < 0)
-                       break;
-
-               pci_read_config_dword(devno, PCI_BASE_ADDRESS_1, &iobase);
-               iobase &= ~0xf;
-
-               debug ("rtl8139: REALTEK RTL8139 @0x%x\n", iobase);
-
-               dev = (struct eth_device *)malloc(sizeof *dev);
-               if (!dev) {
-                       printf("Can not allocate memory of rtl8139\n");
-                       break;
-               }
-               memset(dev, 0, sizeof(*dev));
-
-               sprintf (dev->name, "RTL8139#%d", card_number);
-
-               dev->priv = (void *) devno;
-               dev->iobase = (int)bus_to_phys(iobase);
-               dev->init = rtl8139_probe;
-               dev->halt = rtl_disable;
-               dev->send = rtl_transmit;
-               dev->recv = rtl_poll;
-               dev->mcast = rtl_bcast_addr;
-
-               eth_register (dev);
-
-               card_number++;
-
-               pci_write_config_byte (devno, PCI_LATENCY_TIMER, 0x20);
-
-               udelay (10 * 1000);
-       }
-
-       return card_number;
-}
-
-static int rtl8139_probe(struct eth_device *dev, bd_t *bis)
-{
-       int i;
-       int addr_len;
-       unsigned short *ap = (unsigned short *)dev->enetaddr;
-
-       ioaddr = dev->iobase;
-
-       /* Bring the chip out of low-power mode. */
-       outb(0x00, ioaddr + Config1);
-
-       addr_len = read_eeprom(0,8) == 0x8129 ? 8 : 6;
-       for (i = 0; i < 3; i++)
-               *ap++ = le16_to_cpu (read_eeprom(i + 7, addr_len));
-
-       rtl_reset(dev);
-
-       if (inb(ioaddr + MediaStatus) & MSRLinkFail) {
-               printf("Cable not connected or other link failure\n");
-               return -1 ;
-       }
-
-       return 0;
-}
+static unsigned char tx_buffer[TX_BUF_SIZE] __aligned(4);
+static unsigned char rx_ring[RX_BUF_LEN + 16] __aligned(4);
 
 /* Serial EEPROM section. */
 
@@ -278,51 +206,57 @@ static int rtl8139_probe(struct eth_device *dev, bd_t *bis)
 #define EE_DATA_READ   0x01    /* EEPROM chip data out. */
 #define EE_ENB         (0x80 | EE_CS)
 
-/*
-       Delay between EEPROM clock transitions.
-       No extra delay is needed with 33MHz PCI, but 66MHz may change this.
-*/
-
-#define eeprom_delay() inl(ee_addr)
-
 /* The EEPROM commands include the alway-set leading bit. */
-#define EE_WRITE_CMD   (5)
-#define EE_READ_CMD    (6)
-#define EE_ERASE_CMD   (7)
+#define EE_WRITE_CMD   5
+#define EE_READ_CMD    6
+#define EE_ERASE_CMD   7
 
-static int read_eeprom(int location, int addr_len)
+static void rtl8139_eeprom_delay(uintptr_t regbase)
 {
-       int i;
+       /*
+        * Delay between EEPROM clock transitions.
+        * No extra delay is needed with 33MHz PCI, but 66MHz may change this.
+        */
+       inl(regbase + RTL_REG_CFG9346);
+}
+
+static int rtl8139_read_eeprom(unsigned int location, unsigned int addr_len)
+{
+       unsigned int read_cmd = location | (EE_READ_CMD << addr_len);
+       uintptr_t ee_addr = ioaddr + RTL_REG_CFG9346;
        unsigned int retval = 0;
-       long ee_addr = ioaddr + Cfg9346;
-       int read_cmd = location | (EE_READ_CMD << addr_len);
+       u8 dataval;
+       int i;
 
        outb(EE_ENB & ~EE_CS, ee_addr);
        outb(EE_ENB, ee_addr);
-       eeprom_delay();
+       rtl8139_eeprom_delay(ioaddr);
 
        /* Shift the read command bits out. */
        for (i = 4 + addr_len; i >= 0; i--) {
-               int dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0;
+               dataval = (read_cmd & BIT(i)) ? EE_DATA_WRITE : 0;
                outb(EE_ENB | dataval, ee_addr);
-               eeprom_delay();
+               rtl8139_eeprom_delay(ioaddr);
                outb(EE_ENB | dataval | EE_SHIFT_CLK, ee_addr);
-               eeprom_delay();
+               rtl8139_eeprom_delay(ioaddr);
        }
+
        outb(EE_ENB, ee_addr);
-       eeprom_delay();
+       rtl8139_eeprom_delay(ioaddr);
 
        for (i = 16; i > 0; i--) {
                outb(EE_ENB | EE_SHIFT_CLK, ee_addr);
-               eeprom_delay();
-               retval = (retval << 1) | ((inb(ee_addr) & EE_DATA_READ) ? 1 : 0);
+               rtl8139_eeprom_delay(ioaddr);
+               retval <<= 1;
+               retval |= inb(ee_addr) & EE_DATA_READ;
                outb(EE_ENB, ee_addr);
-               eeprom_delay();
+               rtl8139_eeprom_delay(ioaddr);
        }
 
        /* Terminate the EEPROM access. */
        outb(~EE_CS, ee_addr);
-       eeprom_delay();
+       rtl8139_eeprom_delay(ioaddr);
+
        return retval;
 }
 
@@ -331,149 +265,174 @@ static const unsigned int rtl8139_rx_config =
        (RX_FIFO_THRESH << 13) |
        (RX_DMA_BURST << 8);
 
-static void set_rx_mode(struct eth_device *dev) {
-       unsigned int mc_filter[2];
-       int rx_mode;
+static void rtl8139_set_rx_mode(struct eth_device *dev)
+{
        /* !IFF_PROMISC */
-       rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys;
-       mc_filter[1] = mc_filter[0] = 0xffffffff;
+       unsigned int rx_mode = RTL_REG_RXCONFIG_ACCEPTBROADCAST |
+                              RTL_REG_RXCONFIG_ACCEPTMULTICAST |
+                              RTL_REG_RXCONFIG_ACCEPTMYPHYS;
 
-       outl(rtl8139_rx_config | rx_mode, ioaddr + RxConfig);
+       outl(rtl8139_rx_config | rx_mode, ioaddr + RTL_REG_RXCONFIG);
 
-       outl(mc_filter[0], ioaddr + MAR0 + 0);
-       outl(mc_filter[1], ioaddr + MAR0 + 4);
+       outl(0xffffffff, ioaddr + RTL_REG_MAR0 + 0);
+       outl(0xffffffff, ioaddr + RTL_REG_MAR0 + 4);
 }
 
-static void rtl_reset(struct eth_device *dev)
+static void rtl8139_hw_reset(struct eth_device *dev)
 {
+       u8 reg;
        int i;
 
-       outb(CmdReset, ioaddr + ChipCmd);
-
-       cur_rx = 0;
-       cur_tx = 0;
+       outb(RTL_REG_CHIPCMD_CMDRESET, ioaddr + RTL_REG_CHIPCMD);
 
        /* Give the chip 10ms to finish the reset. */
-       for (i=0; i<100; ++i){
-               if ((inb(ioaddr + ChipCmd) & CmdReset) == 0) break;
-               udelay (100); /* wait 100us */
+       for (i = 0; i < 100; i++) {
+               reg = inb(ioaddr + RTL_REG_CHIPCMD);
+               if (!(reg & RTL_REG_CHIPCMD_CMDRESET))
+                       break;
+
+               udelay(100);
        }
+}
+
+static void rtl8139_reset(struct eth_device *dev)
+{
+       int i;
+
+       cur_rx = 0;
+       cur_tx = 0;
 
+       rtl8139_hw_reset(dev);
 
        for (i = 0; i < ETH_ALEN; i++)
-               outb(dev->enetaddr[i], ioaddr + MAC0 + i);
+               outb(dev->enetaddr[i], ioaddr + RTL_REG_MAC0 + i);
 
        /* Must enable Tx/Rx before setting transfer thresholds! */
-       outb(CmdRxEnb | CmdTxEnb, ioaddr + ChipCmd);
-       outl((RX_FIFO_THRESH<<13) | (RX_BUF_LEN_IDX<<11) | (RX_DMA_BURST<<8),
-               ioaddr + RxConfig);             /* accept no frames yet!  */
-       outl((TX_DMA_BURST<<8)|0x03000000, ioaddr + TxConfig);
-
-       /* The Linux driver changes Config1 here to use a different LED pattern
-        * for half duplex or full/autodetect duplex (for full/autodetect, the
-        * outputs are TX/RX, Link10/100, FULL, while for half duplex it uses
-        * TX/RX, Link100, Link10).  This is messy, because it doesn't match
-        * the inscription on the mounting bracket.  It should not be changed
-        * from the configuration EEPROM default, because the card manufacturer
-        * should have set that to match the card.  */
-
-       debug_cond(DEBUG_RX,
-               "rx ring address is %lX\n",(unsigned long)rx_ring);
-       flush_cache((unsigned long)rx_ring, RX_BUF_LEN);
-       outl(phys_to_bus((int)rx_ring), ioaddr + RxBuf);
+       outb(RTL_REG_CHIPCMD_CMDRXENB | RTL_REG_CHIPCMD_CMDTXENB,
+            ioaddr + RTL_REG_CHIPCMD);
+
+       /* accept no frames yet! */
+       outl(rtl8139_rx_config, ioaddr + RTL_REG_RXCONFIG);
+       outl((TX_DMA_BURST << 8) | 0x03000000, ioaddr + RTL_REG_TXCONFIG);
+
+       /*
+        * The Linux driver changes RTL_REG_CONFIG1 here to use a different
+        * LED pattern for half duplex or full/autodetect duplex (for
+        * full/autodetect, the outputs are TX/RX, Link10/100, FULL, while
+        * for half duplex it uses TX/RX, Link100, Link10).  This is messy,
+        * because it doesn't match the inscription on the mounting bracket.
+        * It should not be changed from the configuration EEPROM default,
+        * because the card manufacturer should have set that to match the
+        * card.
+        */
+       debug_cond(DEBUG_RX, "rx ring address is %p\n", rx_ring);
 
-       /* If we add multicast support, the MAR0 register would have to be
-        * initialized to 0xffffffffffffffff (two 32 bit accesses).  Etherboot
-        * only needs broadcast (for ARP/RARP/BOOTP/DHCP) and unicast.  */
+       flush_cache((unsigned long)rx_ring, RX_BUF_LEN);
+       outl(phys_to_bus((int)rx_ring), ioaddr + RTL_REG_RXBUF);
 
-       outb(CmdRxEnb | CmdTxEnb, ioaddr + ChipCmd);
+       /*
+        * If we add multicast support, the RTL_REG_MAR0 register would have
+        * to be initialized to 0xffffffffffffffff (two 32 bit accesses).
+        * Etherboot only needs broadcast (for ARP/RARP/BOOTP/DHCP) and
+        * unicast.
+        */
+       outb(RTL_REG_CHIPCMD_CMDRXENB | RTL_REG_CHIPCMD_CMDTXENB,
+            ioaddr + RTL_REG_CHIPCMD);
 
-       outl(rtl8139_rx_config, ioaddr + RxConfig);
+       outl(rtl8139_rx_config, ioaddr + RTL_REG_RXCONFIG);
 
        /* Start the chip's Tx and Rx process. */
-       outl(0, ioaddr + RxMissed);
+       outl(0, ioaddr + RTL_REG_RXMISSED);
 
-       /* set_rx_mode */
-       set_rx_mode(dev);
+       rtl8139_set_rx_mode(dev);
 
        /* Disable all known interrupts by setting the interrupt mask. */
-       outw(0, ioaddr + IntrMask);
+       outw(0, ioaddr + RTL_REG_INTRMASK);
 }
 
-static int rtl_transmit(struct eth_device *dev, void *packet, int length)
+static int rtl8139_send(struct eth_device *dev, void *packet, int length)
 {
-       unsigned int status;
-       unsigned long txstatus;
        unsigned int len = length;
+       unsigned long txstatus;
+       unsigned int status;
        int i = 0;
 
        ioaddr = dev->iobase;
 
-       memcpy((char *)tx_buffer, (char *)packet, (int)length);
+       memcpy(tx_buffer, packet, length);
 
        debug_cond(DEBUG_TX, "sending %d bytes\n", len);
 
-       /* Note: RTL8139 doesn't auto-pad, send minimum payload (another 4
-        * bytes are sent automatically for the FCS, totalling to 64 bytes). */
-       while (len < ETH_ZLEN) {
+       /*
+        * Note: RTL8139 doesn't auto-pad, send minimum payload (another 4
+        * bytes are sent automatically for the FCS, totalling to 64 bytes).
+        */
+       while (len < ETH_ZLEN)
                tx_buffer[len++] = '\0';
-       }
 
        flush_cache((unsigned long)tx_buffer, length);
-       outl(phys_to_bus((int)tx_buffer), ioaddr + TxAddr0 + cur_tx*4);
-       outl(((TX_FIFO_THRESH<<11) & 0x003f0000) | len,
-               ioaddr + TxStatus0 + cur_tx*4);
+       outl(phys_to_bus((unsigned long)tx_buffer),
+            ioaddr + RTL_REG_TXADDR0 + cur_tx * 4);
+       outl(((TX_FIFO_THRESH << 11) & 0x003f0000) | len,
+            ioaddr + RTL_REG_TXSTATUS0 + cur_tx * 4);
 
        do {
-               status = inw(ioaddr + IntrStatus);
-               /* Only acknlowledge interrupt sources we can properly handle
-                * here - the RxOverflow/RxFIFOOver MUST be handled in the
-                * rtl_poll() function.  */
-               outw(status & (TxOK | TxErr | PCIErr), ioaddr + IntrStatus);
-               if ((status & (TxOK | TxErr | PCIErr)) != 0) break;
+               status = inw(ioaddr + RTL_REG_INTRSTATUS);
+               /*
+                * Only acknlowledge interrupt sources we can properly
+                * handle here - the RTL_REG_INTRSTATUS_RXOVERFLOW/
+                * RTL_REG_INTRSTATUS_RXFIFOOVER MUST be handled in the
+                * rtl8139_recv() function.
+                */
+               status &= RTL_REG_INTRSTATUS_TXOK | RTL_REG_INTRSTATUS_TXERR |
+                         RTL_REG_INTRSTATUS_PCIERR;
+               outw(status, ioaddr + RTL_REG_INTRSTATUS);
+               if (status)
+                       break;
+
                udelay(10);
        } while (i++ < RTL_TIMEOUT);
 
-       txstatus = inl(ioaddr + TxStatus0 + cur_tx*4);
-
-       if (status & TxOK) {
-               cur_tx = (cur_tx + 1) % NUM_TX_DESC;
+       txstatus = inl(ioaddr + RTL_REG_TXSTATUS0 + cur_tx * 4);
 
+       if (!(status & RTL_REG_INTRSTATUS_TXOK)) {
                debug_cond(DEBUG_TX,
-                       "tx done, status %hX txstatus %lX\n",
-                       status, txstatus);
+                          "tx timeout/error (%d usecs), status %hX txstatus %lX\n",
+                          10 * i, status, txstatus);
 
-               return length;
-       } else {
-
-               debug_cond(DEBUG_TX,
-                       "tx timeout/error (%d usecs), status %hX txstatus %lX\n",
-                       10*i, status, txstatus);
-
-               rtl_reset(dev);
+               rtl8139_reset(dev);
 
                return 0;
        }
+
+       cur_tx = (cur_tx + 1) % NUM_TX_DESC;
+
+       debug_cond(DEBUG_TX, "tx done, status %hX txstatus %lX\n",
+                  status, txstatus);
+
+       return length;
 }
 
-static int rtl_poll(struct eth_device *dev)
+static int rtl8139_recv(struct eth_device *dev)
 {
-       unsigned int status;
-       unsigned int ring_offs;
+       const unsigned int rxstat = RTL_REG_INTRSTATUS_RXFIFOOVER |
+                                   RTL_REG_INTRSTATUS_RXOVERFLOW |
+                                   RTL_REG_INTRSTATUS_RXOK;
        unsigned int rx_size, rx_status;
-       int length=0;
+       unsigned int ring_offs;
+       unsigned int status;
+       int length = 0;
 
        ioaddr = dev->iobase;
 
-       if (inb(ioaddr + ChipCmd) & RxBufEmpty) {
+       if (inb(ioaddr + RTL_REG_CHIPCMD) & RTL_REG_CHIPCMD_RXBUFEMPTY)
                return 0;
-       }
 
-       status = inw(ioaddr + IntrStatus);
+       status = inw(ioaddr + RTL_REG_INTRSTATUS);
        /* See below for the rest of the interrupt acknowledges.  */
-       outw(status & ~(RxFIFOOver | RxOverflow | RxOK), ioaddr + IntrStatus);
+       outw(status & ~rxstat, ioaddr + RTL_REG_INTRSTATUS);
 
-       debug_cond(DEBUG_RX, "rtl_poll: int %hX ", status);
+       debug_cond(DEBUG_RX, "%s: int %hX ", __func__, status);
 
        ring_offs = cur_rx % RX_BUF_LEN;
        /* ring_offs is guaranteed being 4-byte aligned */
@@ -481,52 +440,137 @@ static int rtl_poll(struct eth_device *dev)
        rx_size = rx_status >> 16;
        rx_status &= 0xffff;
 
-       if ((rx_status & (RxBadSymbol|RxRunt|RxTooLong|RxCRCErr|RxBadAlign)) ||
-           (rx_size < ETH_ZLEN) || (rx_size > ETH_FRAME_LEN + 4)) {
+       if ((rx_status & (RTL_STS_RXBADSYMBOL | RTL_STS_RXRUNT |
+                         RTL_STS_RXTOOLONG | RTL_STS_RXCRCERR |
+                         RTL_STS_RXBADALIGN)) ||
+           (rx_size < ETH_ZLEN) ||
+           (rx_size > ETH_FRAME_LEN + 4)) {
                printf("rx error %hX\n", rx_status);
-               rtl_reset(dev); /* this clears all interrupts still pending */
+               /* this clears all interrupts still pending */
+               rtl8139_reset(dev);
                return 0;
        }
 
        /* Received a good packet */
        length = rx_size - 4;   /* no one cares about the FCS */
-       if (ring_offs+4+rx_size-4 > RX_BUF_LEN) {
-               int semi_count = RX_BUF_LEN - ring_offs - 4;
+       if (ring_offs + 4 + rx_size - 4 > RX_BUF_LEN) {
                unsigned char rxdata[RX_BUF_LEN];
+               int semi_count = RX_BUF_LEN - ring_offs - 4;
 
                memcpy(rxdata, rx_ring + ring_offs + 4, semi_count);
-               memcpy(&(rxdata[semi_count]), rx_ring, rx_size-4-semi_count);
+               memcpy(&rxdata[semi_count], rx_ring,
+                      rx_size - 4 - semi_count);
 
                net_process_received_packet(rxdata, length);
                debug_cond(DEBUG_RX, "rx packet %d+%d bytes",
-                       semi_count, rx_size-4-semi_count);
+                          semi_count, rx_size - 4 - semi_count);
        } else {
                net_process_received_packet(rx_ring + ring_offs + 4, length);
-               debug_cond(DEBUG_RX, "rx packet %d bytes", rx_size-4);
+               debug_cond(DEBUG_RX, "rx packet %d bytes", rx_size - 4);
        }
        flush_cache((unsigned long)rx_ring, RX_BUF_LEN);
 
-       cur_rx = (cur_rx + rx_size + 4 + 3) & ~3;
-       outw(cur_rx - 16, ioaddr + RxBufPtr);
-       /* See RTL8139 Programming Guide V0.1 for the official handling of
-        * Rx overflow situations.  The document itself contains basically no
-        * usable information, except for a few exception handling rules.  */
-       outw(status & (RxFIFOOver | RxOverflow | RxOK), ioaddr + IntrStatus);
+       cur_rx = ROUND(cur_rx + rx_size + 4, 4);
+       outw(cur_rx - 16, ioaddr + RTL_REG_RXBUFPTR);
+       /*
+        * See RTL8139 Programming Guide V0.1 for the official handling of
+        * Rx overflow situations. The document itself contains basically
+        * no usable information, except for a few exception handling rules.
+        */
+       outw(status & rxstat, ioaddr + RTL_REG_INTRSTATUS);
+
        return length;
 }
 
-static void rtl_disable(struct eth_device *dev)
+static int rtl8139_init(struct eth_device *dev, bd_t *bis)
 {
-       int i;
+       unsigned short *ap = (unsigned short *)dev->enetaddr;
+       int addr_len, i;
+       u8 reg;
 
        ioaddr = dev->iobase;
 
-       /* reset the chip */
-       outb(CmdReset, ioaddr + ChipCmd);
+       /* Bring the chip out of low-power mode. */
+       outb(0x00, ioaddr + RTL_REG_CONFIG1);
 
-       /* Give the chip 10ms to finish the reset. */
-       for (i=0; i<100; ++i){
-               if ((inb(ioaddr + ChipCmd) & CmdReset) == 0) break;
-               udelay (100); /* wait 100us */
+       addr_len = rtl8139_read_eeprom(0, 8) == 0x8129 ? 8 : 6;
+       for (i = 0; i < 3; i++)
+               *ap++ = le16_to_cpu(rtl8139_read_eeprom(i + 7, addr_len));
+
+       rtl8139_reset(dev);
+
+       reg = inb(ioaddr + RTL_REG_MEDIASTATUS);
+       if (reg & RTL_REG_MEDIASTATUS_MSRLINKFAIL) {
+               printf("Cable not connected or other link failure\n");
+               return -1;
        }
+
+       return 0;
+}
+
+static void rtl8139_stop(struct eth_device *dev)
+{
+       ioaddr = dev->iobase;
+
+       rtl8139_hw_reset(dev);
+}
+
+static int rtl8139_bcast_addr(struct eth_device *dev, const u8 *bcast_mac,
+                             int join)
+{
+       return 0;
+}
+
+static struct pci_device_id supported[] = {
+       { PCI_VENDOR_ID_REALTEK, PCI_DEVICE_ID_REALTEK_8139 },
+       { PCI_VENDOR_ID_DLINK, PCI_DEVICE_ID_DLINK_8139 },
+       { }
+};
+
+int rtl8139_initialize(bd_t *bis)
+{
+       struct eth_device *dev;
+       int card_number = 0;
+       pci_dev_t devno;
+       int idx = 0;
+       u32 iobase;
+
+       while (1) {
+               /* Find RTL8139 */
+               devno = pci_find_devices(supported, idx++);
+               if (devno < 0)
+                       break;
+
+               pci_read_config_dword(devno, PCI_BASE_ADDRESS_1, &iobase);
+               iobase &= ~0xf;
+
+               debug("rtl8139: REALTEK RTL8139 @0x%x\n", iobase);
+
+               dev = (struct eth_device *)malloc(sizeof(*dev));
+               if (!dev) {
+                       printf("Can not allocate memory of rtl8139\n");
+                       break;
+               }
+               memset(dev, 0, sizeof(*dev));
+
+               sprintf(dev->name, "RTL8139#%d", card_number);
+
+               dev->priv = (void *)devno;
+               dev->iobase = (int)bus_to_phys(iobase);
+               dev->init = rtl8139_init;
+               dev->halt = rtl8139_stop;
+               dev->send = rtl8139_send;
+               dev->recv = rtl8139_recv;
+               dev->mcast = rtl8139_bcast_addr;
+
+               eth_register(dev);
+
+               card_number++;
+
+               pci_write_config_byte(devno, PCI_LATENCY_TIMER, 0x20);
+
+               udelay(10 * 1000);
+       }
+
+       return card_number;
 }
index 257b0385c2a927dcde1465d7dad5476473086bc3..45ecd6a263382cb5c2a70dec92b6b8c455147887 100644 (file)
 #include <malloc.h>
 #include <net.h>
 #include <miiphy.h>
+#include <linux/io.h>
+#include <linux/types.h>
 
 #include "smc911x.h"
 
-u32 pkt_data_pull(struct eth_device *dev, u32 addr) \
-       __attribute__ ((weak, alias ("smc911x_reg_read")));
-void pkt_data_push(struct eth_device *dev, u32 addr, u32 val) \
-       __attribute__ ((weak, alias ("smc911x_reg_write")));
+struct chip_id {
+       u16 id;
+       char *name;
+};
 
-static void smc911x_handle_mac_address(struct eth_device *dev)
+struct smc911x_priv {
+#ifndef CONFIG_DM_ETH
+       struct eth_device       dev;
+#endif
+       phys_addr_t             iobase;
+       const struct chip_id    *chipid;
+       unsigned char           enetaddr[6];
+};
+
+static const struct chip_id chip_ids[] =  {
+       { CHIP_89218, "LAN89218" },
+       { CHIP_9115, "LAN9115" },
+       { CHIP_9116, "LAN9116" },
+       { CHIP_9117, "LAN9117" },
+       { CHIP_9118, "LAN9118" },
+       { CHIP_9211, "LAN9211" },
+       { CHIP_9215, "LAN9215" },
+       { CHIP_9216, "LAN9216" },
+       { CHIP_9217, "LAN9217" },
+       { CHIP_9218, "LAN9218" },
+       { CHIP_9220, "LAN9220" },
+       { CHIP_9221, "LAN9221" },
+       { 0, NULL },
+};
+
+#define DRIVERNAME "smc911x"
+
+#if defined (CONFIG_SMC911X_32_BIT) && \
+       defined (CONFIG_SMC911X_16_BIT)
+#error "SMC911X: Only one of CONFIG_SMC911X_32_BIT and \
+       CONFIG_SMC911X_16_BIT shall be set"
+#endif
+
+#if defined (CONFIG_SMC911X_32_BIT)
+static u32 smc911x_reg_read(struct smc911x_priv *priv, u32 offset)
+{
+       return readl(priv->iobase + offset);
+}
+
+static void smc911x_reg_write(struct smc911x_priv *priv, u32 offset, u32 val)
+{
+       writel(val, priv->iobase + offset);
+}
+#elif defined (CONFIG_SMC911X_16_BIT)
+static u32 smc911x_reg_read(struct smc911x_priv *priv, u32 offset)
+{
+       return (readw(priv->iobase + offset) & 0xffff) |
+              (readw(priv->iobase + offset + 2) << 16);
+}
+static void smc911x_reg_write(struct smc911x_priv *priv, u32 offset, u32 val)
+{
+       writew(val & 0xffff, priv->iobase + offset);
+       writew(val >> 16, priv->iobase + offset + 2);
+}
+#else
+#error "SMC911X: undefined bus width"
+#endif /* CONFIG_SMC911X_16_BIT */
+
+static u32 smc911x_get_mac_csr(struct smc911x_priv *priv, u8 reg)
+{
+       while (smc911x_reg_read(priv, MAC_CSR_CMD) & MAC_CSR_CMD_CSR_BUSY)
+               ;
+       smc911x_reg_write(priv, MAC_CSR_CMD,
+                       MAC_CSR_CMD_CSR_BUSY | MAC_CSR_CMD_R_NOT_W | reg);
+       while (smc911x_reg_read(priv, MAC_CSR_CMD) & MAC_CSR_CMD_CSR_BUSY)
+               ;
+
+       return smc911x_reg_read(priv, MAC_CSR_DATA);
+}
+
+static void smc911x_set_mac_csr(struct smc911x_priv *priv, u8 reg, u32 data)
+{
+       while (smc911x_reg_read(priv, MAC_CSR_CMD) & MAC_CSR_CMD_CSR_BUSY)
+               ;
+       smc911x_reg_write(priv, MAC_CSR_DATA, data);
+       smc911x_reg_write(priv, MAC_CSR_CMD, MAC_CSR_CMD_CSR_BUSY | reg);
+       while (smc911x_reg_read(priv, MAC_CSR_CMD) & MAC_CSR_CMD_CSR_BUSY)
+               ;
+}
+
+static int smc911x_detect_chip(struct smc911x_priv *priv)
+{
+       unsigned long val, i;
+
+       val = smc911x_reg_read(priv, BYTE_TEST);
+       if (val == 0xffffffff) {
+               /* Special case -- no chip present */
+               return -1;
+       } else if (val != 0x87654321) {
+               printf(DRIVERNAME ": Invalid chip endian 0x%08lx\n", val);
+               return -1;
+       }
+
+       val = smc911x_reg_read(priv, ID_REV) >> 16;
+       for (i = 0; chip_ids[i].id != 0; i++) {
+               if (chip_ids[i].id == val) break;
+       }
+       if (!chip_ids[i].id) {
+               printf(DRIVERNAME ": Unknown chip ID %04lx\n", val);
+               return -1;
+       }
+
+       priv->chipid = &chip_ids[i];
+
+       return 0;
+}
+
+static void smc911x_reset(struct smc911x_priv *priv)
+{
+       int timeout;
+
+       /*
+        *  Take out of PM setting first
+        *  Device is already wake up if PMT_CTRL_READY bit is set
+        */
+       if ((smc911x_reg_read(priv, PMT_CTRL) & PMT_CTRL_READY) == 0) {
+               /* Write to the bytetest will take out of powerdown */
+               smc911x_reg_write(priv, BYTE_TEST, 0x0);
+
+               timeout = 10;
+
+               while (timeout-- &&
+                       !(smc911x_reg_read(priv, PMT_CTRL) & PMT_CTRL_READY))
+                       udelay(10);
+               if (timeout < 0) {
+                       printf(DRIVERNAME
+                               ": timeout waiting for PM restore\n");
+                       return;
+               }
+       }
+
+       /* Disable interrupts */
+       smc911x_reg_write(priv, INT_EN, 0);
+
+       smc911x_reg_write(priv, HW_CFG, HW_CFG_SRST);
+
+       timeout = 1000;
+       while (timeout-- && smc911x_reg_read(priv, E2P_CMD) & E2P_CMD_EPC_BUSY)
+               udelay(10);
+
+       if (timeout < 0) {
+               printf(DRIVERNAME ": reset timeout\n");
+               return;
+       }
+
+       /* Reset the FIFO level and flow control settings */
+       smc911x_set_mac_csr(priv, FLOW, FLOW_FCPT | FLOW_FCEN);
+       smc911x_reg_write(priv, AFC_CFG, 0x0050287F);
+
+       /* Set to LED outputs */
+       smc911x_reg_write(priv, GPIO_CFG, 0x70070000);
+}
+
+static void smc911x_handle_mac_address(struct smc911x_priv *priv)
 {
        unsigned long addrh, addrl;
-       uchar *m = dev->enetaddr;
+       unsigned char *m = priv->enetaddr;
 
        addrl = m[0] | (m[1] << 8) | (m[2] << 16) | (m[3] << 24);
        addrh = m[4] | (m[5] << 8);
-       smc911x_set_mac_csr(dev, ADDRL, addrl);
-       smc911x_set_mac_csr(dev, ADDRH, addrh);
+       smc911x_set_mac_csr(priv, ADDRL, addrl);
+       smc911x_set_mac_csr(priv, ADDRH, addrh);
 
        printf(DRIVERNAME ": MAC %pM\n", m);
 }
 
-static int smc911x_eth_phy_read(struct eth_device *dev,
+static int smc911x_eth_phy_read(struct smc911x_priv *priv,
                                u8 phy, u8 reg, u16 *val)
 {
-       while (smc911x_get_mac_csr(dev, MII_ACC) & MII_ACC_MII_BUSY)
+       while (smc911x_get_mac_csr(priv, MII_ACC) & MII_ACC_MII_BUSY)
                ;
 
-       smc911x_set_mac_csr(dev, MII_ACC, phy << 11 | reg << 6 |
+       smc911x_set_mac_csr(priv, MII_ACC, phy << 11 | reg << 6 |
                                MII_ACC_MII_BUSY);
 
-       while (smc911x_get_mac_csr(dev, MII_ACC) & MII_ACC_MII_BUSY)
+       while (smc911x_get_mac_csr(priv, MII_ACC) & MII_ACC_MII_BUSY)
                ;
 
-       *val = smc911x_get_mac_csr(dev, MII_DATA);
+       *val = smc911x_get_mac_csr(priv, MII_DATA);
 
        return 0;
 }
 
-static int smc911x_eth_phy_write(struct eth_device *dev,
+static int smc911x_eth_phy_write(struct smc911x_priv *priv,
                                u8 phy, u8 reg, u16  val)
 {
-       while (smc911x_get_mac_csr(dev, MII_ACC) & MII_ACC_MII_BUSY)
+       while (smc911x_get_mac_csr(priv, MII_ACC) & MII_ACC_MII_BUSY)
                ;
 
-       smc911x_set_mac_csr(dev, MII_DATA, val);
-       smc911x_set_mac_csr(dev, MII_ACC,
+       smc911x_set_mac_csr(priv, MII_DATA, val);
+       smc911x_set_mac_csr(priv, MII_ACC,
                phy << 11 | reg << 6 | MII_ACC_MII_BUSY | MII_ACC_MII_WRITE);
 
-       while (smc911x_get_mac_csr(dev, MII_ACC) & MII_ACC_MII_BUSY)
+       while (smc911x_get_mac_csr(priv, MII_ACC) & MII_ACC_MII_BUSY)
                ;
        return 0;
 }
 
-static int smc911x_phy_reset(struct eth_device *dev)
+static int smc911x_phy_reset(struct smc911x_priv *priv)
 {
        u32 reg;
 
-       reg = smc911x_reg_read(dev, PMT_CTRL);
+       reg = smc911x_reg_read(priv, PMT_CTRL);
        reg &= ~0xfffff030;
        reg |= PMT_CTRL_PHY_RST;
-       smc911x_reg_write(dev, PMT_CTRL, reg);
+       smc911x_reg_write(priv, PMT_CTRL, reg);
 
        mdelay(100);
 
        return 0;
 }
 
-static void smc911x_phy_configure(struct eth_device *dev)
+static void smc911x_phy_configure(struct smc911x_priv *priv)
 {
        int timeout;
        u16 status;
 
-       smc911x_phy_reset(dev);
+       smc911x_phy_reset(priv);
 
-       smc911x_eth_phy_write(dev, 1, MII_BMCR, BMCR_RESET);
+       smc911x_eth_phy_write(priv, 1, MII_BMCR, BMCR_RESET);
        mdelay(1);
-       smc911x_eth_phy_write(dev, 1, MII_ADVERTISE, 0x01e1);
-       smc911x_eth_phy_write(dev, 1, MII_BMCR, BMCR_ANENABLE |
+       smc911x_eth_phy_write(priv, 1, MII_ADVERTISE, 0x01e1);
+       smc911x_eth_phy_write(priv, 1, MII_BMCR, BMCR_ANENABLE |
                                BMCR_ANRESTART);
 
        timeout = 5000;
@@ -96,7 +251,7 @@ static void smc911x_phy_configure(struct eth_device *dev)
                if ((timeout--) == 0)
                        goto err_out;
 
-               if (smc911x_eth_phy_read(dev, 1, MII_BMSR, &status) != 0)
+               if (smc911x_eth_phy_read(priv, 1, MII_BMSR, &status) != 0)
                        goto err_out;
        } while (!(status & BMSR_LSTATUS));
 
@@ -108,65 +263,65 @@ err_out:
        printf(DRIVERNAME ": autonegotiation timed out\n");
 }
 
-static void smc911x_enable(struct eth_device *dev)
+static void smc911x_enable(struct smc911x_priv *priv)
 {
        /* Enable TX */
-       smc911x_reg_write(dev, HW_CFG, 8 << 16 | HW_CFG_SF);
+       smc911x_reg_write(priv, HW_CFG, 8 << 16 | HW_CFG_SF);
 
-       smc911x_reg_write(dev, GPT_CFG, GPT_CFG_TIMER_EN | 10000);
+       smc911x_reg_write(priv, GPT_CFG, GPT_CFG_TIMER_EN | 10000);
 
-       smc911x_reg_write(dev, TX_CFG, TX_CFG_TX_ON);
+       smc911x_reg_write(priv, TX_CFG, TX_CFG_TX_ON);
 
        /* no padding to start of packets */
-       smc911x_reg_write(dev, RX_CFG, 0);
+       smc911x_reg_write(priv, RX_CFG, 0);
 
-       smc911x_set_mac_csr(dev, MAC_CR, MAC_CR_TXEN | MAC_CR_RXEN |
+       smc911x_set_mac_csr(priv, MAC_CR, MAC_CR_TXEN | MAC_CR_RXEN |
                                MAC_CR_HBDIS);
-
 }
 
-static int smc911x_init(struct eth_device *dev, bd_t * bd)
+static int smc911x_init_common(struct smc911x_priv *priv)
 {
-       struct chip_id *id = dev->priv;
+       const struct chip_id *id = priv->chipid;
 
        printf(DRIVERNAME ": detected %s controller\n", id->name);
 
-       smc911x_reset(dev);
+       smc911x_reset(priv);
 
        /* Configure the PHY, initialize the link state */
-       smc911x_phy_configure(dev);
+       smc911x_phy_configure(priv);
 
-       smc911x_handle_mac_address(dev);
+       smc911x_handle_mac_address(priv);
 
        /* Turn on Tx + Rx */
-       smc911x_enable(dev);
+       smc911x_enable(priv);
 
        return 0;
 }
 
-static int smc911x_send(struct eth_device *dev, void *packet, int length)
+static int smc911x_send_common(struct smc911x_priv *priv,
+                              void *packet, int length)
 {
        u32 *data = (u32*)packet;
        u32 tmplen;
        u32 status;
 
-       smc911x_reg_write(dev, TX_DATA_FIFO, TX_CMD_A_INT_FIRST_SEG |
+       smc911x_reg_write(priv, TX_DATA_FIFO, TX_CMD_A_INT_FIRST_SEG |
                                TX_CMD_A_INT_LAST_SEG | length);
-       smc911x_reg_write(dev, TX_DATA_FIFO, length);
+       smc911x_reg_write(priv, TX_DATA_FIFO, length);
 
        tmplen = (length + 3) / 4;
 
        while (tmplen--)
-               pkt_data_push(dev, TX_DATA_FIFO, *data++);
+               smc911x_reg_write(priv, TX_DATA_FIFO, *data++);
 
        /* wait for transmission */
-       while (!((smc911x_reg_read(dev, TX_FIFO_INF) &
+       while (!((smc911x_reg_read(priv, TX_FIFO_INF) &
                                        TX_FIFO_INF_TSUSED) >> 16));
 
        /* get status. Ignore 'no carrier' error, it has no meaning for
         * full duplex operation
         */
-       status = smc911x_reg_read(dev, TX_STATUS_FIFO) &
+       status = smc911x_reg_read(priv, TX_STATUS_FIFO) &
                        (TX_STS_LOC | TX_STS_LATE_COLL | TX_STS_MANY_COLL |
                        TX_STS_MANY_DEFER | TX_STS_UNDERRUN);
 
@@ -183,117 +338,296 @@ static int smc911x_send(struct eth_device *dev, void *packet, int length)
        return -1;
 }
 
-static void smc911x_halt(struct eth_device *dev)
+static void smc911x_halt_common(struct smc911x_priv *priv)
 {
-       smc911x_reset(dev);
-       smc911x_handle_mac_address(dev);
+       smc911x_reset(priv);
+       smc911x_handle_mac_address(priv);
 }
 
-static int smc911x_rx(struct eth_device *dev)
+static int smc911x_recv_common(struct smc911x_priv *priv, u32 *data)
 {
-       u32 *data = (u32 *)net_rx_packets[0];
        u32 pktlen, tmplen;
        u32 status;
 
-       if ((smc911x_reg_read(dev, RX_FIFO_INF) & RX_FIFO_INF_RXSUSED) >> 16) {
-               status = smc911x_reg_read(dev, RX_STATUS_FIFO);
-               pktlen = (status & RX_STS_PKT_LEN) >> 16;
+       status = smc911x_reg_read(priv, RX_FIFO_INF);
+       if (!(status & RX_FIFO_INF_RXSUSED))
+               return 0;
 
-               smc911x_reg_write(dev, RX_CFG, 0);
+       status = smc911x_reg_read(priv, RX_STATUS_FIFO);
+       pktlen = (status & RX_STS_PKT_LEN) >> 16;
 
-               tmplen = (pktlen + 3) / 4;
-               while (tmplen--)
-                       *data++ = pkt_data_pull(dev, RX_DATA_FIFO);
+       smc911x_reg_write(priv, RX_CFG, 0);
 
-               if (status & RX_STS_ES)
-                       printf(DRIVERNAME
-                               ": dropped bad packet. Status: 0x%08x\n",
-                               status);
-               else
-                       net_process_received_packet(net_rx_packets[0], pktlen);
+       tmplen = (pktlen + 3) / 4;
+       while (tmplen--)
+               *data++ = smc911x_reg_read(priv, RX_DATA_FIFO);
+
+       if (status & RX_STS_ES) {
+               printf(DRIVERNAME
+                       ": dropped bad packet. Status: 0x%08x\n",
+                       status);
+               return 0;
        }
 
-       return 0;
+       return pktlen;
 }
 
+#ifndef CONFIG_DM_ETH
+
 #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
 /* wrapper for smc911x_eth_phy_read */
 static int smc911x_miiphy_read(struct mii_dev *bus, int phy, int devad,
                               int reg)
 {
-       u16 val = 0;
        struct eth_device *dev = eth_get_dev_by_name(bus->name);
-       if (dev) {
-               int retval = smc911x_eth_phy_read(dev, phy, reg, &val);
-               if (retval < 0)
-                       return retval;
-               return val;
-       }
-       return -ENODEV;
+       struct smc911x_priv *priv = container_of(dev, struct smc911x_priv, dev);
+       u16 val = 0;
+       int ret;
+
+       if (!dev || !priv)
+               return -ENODEV;
+
+       ret = smc911x_eth_phy_read(priv, phy, reg, &val);
+       if (ret < 0)
+               return ret;
+
+       return val;
 }
+
 /* wrapper for smc911x_eth_phy_write */
 static int smc911x_miiphy_write(struct mii_dev *bus, int phy, int devad,
                                int reg, u16 val)
 {
        struct eth_device *dev = eth_get_dev_by_name(bus->name);
-       if (dev)
-               return smc911x_eth_phy_write(dev, phy, reg, val);
-       return -ENODEV;
+       struct smc911x_priv *priv = container_of(dev, struct smc911x_priv, dev);
+
+       if (!dev || !priv)
+               return -ENODEV;
+
+       return smc911x_eth_phy_write(priv, phy, reg, val);
+}
+
+static int smc911x_initialize_mii(struct smc911x_priv *priv)
+{
+       struct mii_dev *mdiodev = mdio_alloc();
+       int ret;
+
+       if (!mdiodev)
+               return -ENOMEM;
+
+       strncpy(mdiodev->name, priv->dev.name, MDIO_NAME_LEN);
+       mdiodev->read = smc911x_miiphy_read;
+       mdiodev->write = smc911x_miiphy_write;
+
+       ret = mdio_register(mdiodev);
+       if (ret < 0) {
+               mdio_free(mdiodev);
+               return ret;
+       }
+
+       return 0;
+}
+#else
+static int smc911x_initialize_mii(struct smc911x_priv *priv)
+{
+       return 0;
 }
 #endif
 
+static int smc911x_init(struct eth_device *dev, bd_t *bd)
+{
+       struct smc911x_priv *priv = container_of(dev, struct smc911x_priv, dev);
+
+       return smc911x_init_common(priv);
+}
+
+static void smc911x_halt(struct eth_device *dev)
+{
+       struct smc911x_priv *priv = container_of(dev, struct smc911x_priv, dev);
+
+       smc911x_halt_common(priv);
+}
+
+static int smc911x_send(struct eth_device *dev, void *packet, int length)
+{
+       struct smc911x_priv *priv = container_of(dev, struct smc911x_priv, dev);
+
+       return smc911x_send_common(priv, packet, length);
+}
+
+static int smc911x_recv(struct eth_device *dev)
+{
+       struct smc911x_priv *priv = container_of(dev, struct smc911x_priv, dev);
+       u32 *data = (u32 *)net_rx_packets[0];
+       int ret;
+
+       ret = smc911x_recv_common(priv, data);
+       if (ret)
+               net_process_received_packet(net_rx_packets[0], ret);
+
+       return ret;
+}
+
 int smc911x_initialize(u8 dev_num, int base_addr)
 {
        unsigned long addrl, addrh;
-       struct eth_device *dev;
+       struct smc911x_priv *priv;
+       int ret;
 
-       dev = malloc(sizeof(*dev));
-       if (!dev) {
-               return -1;
-       }
-       memset(dev, 0, sizeof(*dev));
+       priv = calloc(1, sizeof(*priv));
+       if (!priv)
+               return -ENOMEM;
 
-       dev->iobase = base_addr;
+       priv->iobase = base_addr;
+       priv->dev.iobase = base_addr;
 
        /* Try to detect chip. Will fail if not present. */
-       if (smc911x_detect_chip(dev)) {
-               free(dev);
-               return 0;
+       ret = smc911x_detect_chip(priv);
+       if (ret) {
+               ret = 0;        /* Card not detected is not an error */
+               goto err_detect;
        }
 
-       addrh = smc911x_get_mac_csr(dev, ADDRH);
-       addrl = smc911x_get_mac_csr(dev, ADDRL);
+       addrh = smc911x_get_mac_csr(priv, ADDRH);
+       addrl = smc911x_get_mac_csr(priv, ADDRL);
        if (!(addrl == 0xffffffff && addrh == 0x0000ffff)) {
                /* address is obtained from optional eeprom */
-               dev->enetaddr[0] = addrl;
-               dev->enetaddr[1] = addrl >>  8;
-               dev->enetaddr[2] = addrl >> 16;
-               dev->enetaddr[3] = addrl >> 24;
-               dev->enetaddr[4] = addrh;
-               dev->enetaddr[5] = addrh >> 8;
+               priv->enetaddr[0] = addrl;
+               priv->enetaddr[1] = addrl >>  8;
+               priv->enetaddr[2] = addrl >> 16;
+               priv->enetaddr[3] = addrl >> 24;
+               priv->enetaddr[4] = addrh;
+               priv->enetaddr[5] = addrh >> 8;
+               memcpy(priv->dev.enetaddr, priv->enetaddr, 6);
        }
 
-       dev->init = smc911x_init;
-       dev->halt = smc911x_halt;
-       dev->send = smc911x_send;
-       dev->recv = smc911x_rx;
-       sprintf(dev->name, "%s-%hu", DRIVERNAME, dev_num);
+       priv->dev.init = smc911x_init;
+       priv->dev.halt = smc911x_halt;
+       priv->dev.send = smc911x_send;
+       priv->dev.recv = smc911x_recv;
+       sprintf(priv->dev.name, "%s-%hu", DRIVERNAME, dev_num);
 
-       eth_register(dev);
+       eth_register(&priv->dev);
 
-#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
-       int retval;
-       struct mii_dev *mdiodev = mdio_alloc();
-       if (!mdiodev)
-               return -ENOMEM;
-       strncpy(mdiodev->name, dev->name, MDIO_NAME_LEN);
-       mdiodev->read = smc911x_miiphy_read;
-       mdiodev->write = smc911x_miiphy_write;
-
-       retval = mdio_register(mdiodev);
-       if (retval < 0)
-               return retval;
-#endif
+       ret = smc911x_initialize_mii(priv);
+       if (ret)
+               goto err_mii;
 
        return 1;
+
+err_mii:
+       eth_unregister(&priv->dev);
+err_detect:
+       free(priv);
+       return ret;
+}
+
+#else  /* ifdef CONFIG_DM_ETH */
+
+static int smc911x_start(struct udevice *dev)
+{
+       struct eth_pdata *plat = dev_get_platdata(dev);
+       struct smc911x_priv *priv = dev_get_priv(dev);
+
+       memcpy(priv->enetaddr, plat->enetaddr, sizeof(plat->enetaddr));
+
+       return smc911x_init_common(priv);
+}
+
+static void smc911x_stop(struct udevice *dev)
+{
+       struct smc911x_priv *priv = dev_get_priv(dev);
+
+       smc911x_halt_common(priv);
+}
+
+static int smc911x_send(struct udevice *dev, void *packet, int length)
+{
+       struct smc911x_priv *priv = dev_get_priv(dev);
+       int ret;
+
+       ret = smc911x_send_common(priv, packet, length);
+
+       return ret ? 0 : -ETIMEDOUT;
+}
+
+static int smc911x_recv(struct udevice *dev, int flags, uchar **packetp)
+{
+       struct smc911x_priv *priv = dev_get_priv(dev);
+       u32 *data = (u32 *)net_rx_packets[0];
+       int ret;
+
+       ret = smc911x_recv_common(priv, data);
+       if (ret)
+               *packetp = (void *)data;
+
+       return ret ? ret : -EAGAIN;
+}
+
+static int smc911x_bind(struct udevice *dev)
+{
+       return device_set_name(dev, dev->name);
 }
+
+static int smc911x_probe(struct udevice *dev)
+{
+       struct smc911x_priv *priv = dev_get_priv(dev);
+       unsigned long addrh, addrl;
+       int ret;
+
+       /* Try to detect chip. Will fail if not present. */
+       ret = smc911x_detect_chip(priv);
+       if (ret)
+               return ret;
+
+       addrh = smc911x_get_mac_csr(priv, ADDRH);
+       addrl = smc911x_get_mac_csr(priv, ADDRL);
+       if (!(addrl == 0xffffffff && addrh == 0x0000ffff)) {
+               /* address is obtained from optional eeprom */
+               priv->enetaddr[0] = addrl;
+               priv->enetaddr[1] = addrl >>  8;
+               priv->enetaddr[2] = addrl >> 16;
+               priv->enetaddr[3] = addrl >> 24;
+               priv->enetaddr[4] = addrh;
+               priv->enetaddr[5] = addrh >> 8;
+       }
+
+       return 0;
+}
+
+static int smc911x_ofdata_to_platdata(struct udevice *dev)
+{
+       struct smc911x_priv *priv = dev_get_priv(dev);
+       struct eth_pdata *pdata = dev_get_platdata(dev);
+
+       pdata->iobase = devfdt_get_addr(dev);
+       priv->iobase = pdata->iobase;
+
+       return 0;
+}
+
+static const struct eth_ops smc911x_ops = {
+       .start  = smc911x_start,
+       .send   = smc911x_send,
+       .recv   = smc911x_recv,
+       .stop   = smc911x_stop,
+};
+
+static const struct udevice_id smc911x_ids[] = {
+       { .compatible = "smsc,lan9115" },
+       { }
+};
+
+U_BOOT_DRIVER(smc911x) = {
+       .name           = "eth_smc911x",
+       .id             = UCLASS_ETH,
+       .of_match       = smc911x_ids,
+       .bind           = smc911x_bind,
+       .ofdata_to_platdata = smc911x_ofdata_to_platdata,
+       .probe          = smc911x_probe,
+       .ops            = &smc911x_ops,
+       .priv_auto_alloc_size = sizeof(struct smc911x_priv),
+       .platdata_auto_alloc_size = sizeof(struct eth_pdata),
+       .flags          = DM_FLAG_ALLOC_PRIV_DMA,
+};
+#endif
index 3145fbde2bd9251f82822e2818faf0ae88acaf54..ce66900f4cf9e0ed1978223d84c4120d787fffa4 100644 (file)
@@ -8,47 +8,6 @@
 #ifndef _SMC911X_H_
 #define _SMC911X_H_
 
-#include <linux/types.h>
-
-#define DRIVERNAME "smc911x"
-
-#if defined (CONFIG_SMC911X_32_BIT) && \
-       defined (CONFIG_SMC911X_16_BIT)
-#error "SMC911X: Only one of CONFIG_SMC911X_32_BIT and \
-       CONFIG_SMC911X_16_BIT shall be set"
-#endif
-
-#if defined (CONFIG_SMC911X_32_BIT)
-static inline u32 __smc911x_reg_read(struct eth_device *dev, u32 offset)
-{
-       return *(volatile u32*)(dev->iobase + offset);
-}
-u32 smc911x_reg_read(struct eth_device *dev, u32 offset)
-       __attribute__((weak, alias("__smc911x_reg_read")));
-
-static inline void __smc911x_reg_write(struct eth_device *dev,
-                                       u32 offset, u32 val)
-{
-       *(volatile u32*)(dev->iobase + offset) = val;
-}
-void smc911x_reg_write(struct eth_device *dev, u32 offset, u32 val)
-       __attribute__((weak, alias("__smc911x_reg_write")));
-#elif defined (CONFIG_SMC911X_16_BIT)
-static inline u32 smc911x_reg_read(struct eth_device *dev, u32 offset)
-{
-       volatile u16 *addr_16 = (u16 *)(dev->iobase + offset);
-       return ((*addr_16 & 0x0000ffff) | (*(addr_16 + 1) << 16));
-}
-static inline void smc911x_reg_write(struct eth_device *dev,
-                                       u32 offset, u32 val)
-{
-       *(volatile u16 *)(dev->iobase + offset) = (u16)val;
-       *(volatile u16 *)(dev->iobase + offset + 2) = (u16)(val >> 16);
-}
-#else
-#error "SMC911X: undefined bus width"
-#endif /* CONFIG_SMC911X_16_BIT */
-
 /* Below are the register offsets and bit definitions
  * of the Lan911x memory space
  */
@@ -380,120 +339,4 @@ static inline void smc911x_reg_write(struct eth_device *dev,
 #define CHIP_9220      0x9220
 #define CHIP_9221      0x9221
 
-struct chip_id {
-       u16 id;
-       char *name;
-};
-
-static const struct chip_id chip_ids[] =  {
-       { CHIP_89218, "LAN89218" },
-       { CHIP_9115, "LAN9115" },
-       { CHIP_9116, "LAN9116" },
-       { CHIP_9117, "LAN9117" },
-       { CHIP_9118, "LAN9118" },
-       { CHIP_9211, "LAN9211" },
-       { CHIP_9215, "LAN9215" },
-       { CHIP_9216, "LAN9216" },
-       { CHIP_9217, "LAN9217" },
-       { CHIP_9218, "LAN9218" },
-       { CHIP_9220, "LAN9220" },
-       { CHIP_9221, "LAN9221" },
-       { 0, NULL },
-};
-
-static u32 smc911x_get_mac_csr(struct eth_device *dev, u8 reg)
-{
-       while (smc911x_reg_read(dev, MAC_CSR_CMD) & MAC_CSR_CMD_CSR_BUSY)
-               ;
-       smc911x_reg_write(dev, MAC_CSR_CMD,
-                       MAC_CSR_CMD_CSR_BUSY | MAC_CSR_CMD_R_NOT_W | reg);
-       while (smc911x_reg_read(dev, MAC_CSR_CMD) & MAC_CSR_CMD_CSR_BUSY)
-               ;
-
-       return smc911x_reg_read(dev, MAC_CSR_DATA);
-}
-
-static void smc911x_set_mac_csr(struct eth_device *dev, u8 reg, u32 data)
-{
-       while (smc911x_reg_read(dev, MAC_CSR_CMD) & MAC_CSR_CMD_CSR_BUSY)
-               ;
-       smc911x_reg_write(dev, MAC_CSR_DATA, data);
-       smc911x_reg_write(dev, MAC_CSR_CMD, MAC_CSR_CMD_CSR_BUSY | reg);
-       while (smc911x_reg_read(dev, MAC_CSR_CMD) & MAC_CSR_CMD_CSR_BUSY)
-               ;
-}
-
-static int smc911x_detect_chip(struct eth_device *dev)
-{
-       unsigned long val, i;
-
-       val = smc911x_reg_read(dev, BYTE_TEST);
-       if (val == 0xffffffff) {
-               /* Special case -- no chip present */
-               return -1;
-       } else if (val != 0x87654321) {
-               printf(DRIVERNAME ": Invalid chip endian 0x%08lx\n", val);
-               return -1;
-       }
-
-       val = smc911x_reg_read(dev, ID_REV) >> 16;
-       for (i = 0; chip_ids[i].id != 0; i++) {
-               if (chip_ids[i].id == val) break;
-       }
-       if (!chip_ids[i].id) {
-               printf(DRIVERNAME ": Unknown chip ID %04lx\n", val);
-               return -1;
-       }
-
-       dev->priv = (void *)&chip_ids[i];
-
-       return 0;
-}
-
-static void smc911x_reset(struct eth_device *dev)
-{
-       int timeout;
-
-       /*
-        *  Take out of PM setting first
-        *  Device is already wake up if PMT_CTRL_READY bit is set
-        */
-       if ((smc911x_reg_read(dev, PMT_CTRL) & PMT_CTRL_READY) == 0) {
-               /* Write to the bytetest will take out of powerdown */
-               smc911x_reg_write(dev, BYTE_TEST, 0x0);
-
-               timeout = 10;
-
-               while (timeout-- &&
-                       !(smc911x_reg_read(dev, PMT_CTRL) & PMT_CTRL_READY))
-                       udelay(10);
-               if (timeout < 0) {
-                       printf(DRIVERNAME
-                               ": timeout waiting for PM restore\n");
-                       return;
-               }
-       }
-
-       /* Disable interrupts */
-       smc911x_reg_write(dev, INT_EN, 0);
-
-       smc911x_reg_write(dev, HW_CFG, HW_CFG_SRST);
-
-       timeout = 1000;
-       while (timeout-- && smc911x_reg_read(dev, E2P_CMD) & E2P_CMD_EPC_BUSY)
-               udelay(10);
-
-       if (timeout < 0) {
-               printf(DRIVERNAME ": reset timeout\n");
-               return;
-       }
-
-       /* Reset the FIFO level and flow control settings */
-       smc911x_set_mac_csr(dev, FLOW, FLOW_FCPT | FLOW_FCEN);
-       smc911x_reg_write(dev, AFC_CFG, 0x0050287F);
-
-       /* Set to LED outputs */
-       smc911x_reg_write(dev, GPIO_CFG, 0x70070000);
-}
-
 #endif
index edb6152bb9d43ee8ef95d379a76d0a9b1af595de..e4b22d79ebcfb1f692213358f8094050ec1934e8 100644 (file)
@@ -31,4 +31,12 @@ config RNG_STM32MP1
        help
          Enable STM32MP1 rng driver.
 
+config RNG_ROCKCHIP
+       bool "Enable random number generator for rockchip crypto rng"
+       depends on ARCH_ROCKCHIP && DM_RNG
+       default n
+       help
+         Enable random number generator for rockchip.This driver is
+         support rng module of crypto v1 and crypto v2.
+
 endif
index 6a8a66779b5b30e4a077612d10e7eb6578d30a0a..44a00039173531d0cb7dad05c65561cf7b1303a3 100644 (file)
@@ -7,3 +7,4 @@ obj-$(CONFIG_DM_RNG) += rng-uclass.o
 obj-$(CONFIG_RNG_MESON) += meson-rng.o
 obj-$(CONFIG_RNG_SANDBOX) += sandbox_rng.o
 obj-$(CONFIG_RNG_STM32MP1) += stm32mp1_rng.o
+obj-$(CONFIG_RNG_ROCKCHIP) += rockchip_rng.o
diff --git a/drivers/rng/rockchip_rng.c b/drivers/rng/rockchip_rng.c
new file mode 100644 (file)
index 0000000..47fb140
--- /dev/null
@@ -0,0 +1,224 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2020 Fuzhou Rockchip Electronics Co., Ltd
+ */
+#include <asm/arch-rockchip/hardware.h>
+#include <asm/io.h>
+#include <common.h>
+#include <dm.h>
+#include <linux/iopoll.h>
+#include <linux/string.h>
+#include <rng.h>
+
+#define RK_HW_RNG_MAX 32
+
+#define _SBF(s, v)     ((v) << (s))
+
+/* start of CRYPTO V1 register define */
+#define CRYPTO_V1_CTRL                         0x0008
+#define CRYPTO_V1_RNG_START                    BIT(8)
+#define CRYPTO_V1_RNG_FLUSH                    BIT(9)
+
+#define CRYPTO_V1_TRNG_CTRL                    0x0200
+#define CRYPTO_V1_OSC_ENABLE                   BIT(16)
+#define CRYPTO_V1_TRNG_SAMPLE_PERIOD(x)                (x)
+
+#define CRYPTO_V1_TRNG_DOUT_0                  0x0204
+/* end of CRYPTO V1 register define */
+
+/* start of CRYPTO V2 register define */
+#define CRYPTO_V2_RNG_CTL                      0x0400
+#define CRYPTO_V2_RNG_64_BIT_LEN               _SBF(4, 0x00)
+#define CRYPTO_V2_RNG_128_BIT_LEN              _SBF(4, 0x01)
+#define CRYPTO_V2_RNG_192_BIT_LEN              _SBF(4, 0x02)
+#define CRYPTO_V2_RNG_256_BIT_LEN              _SBF(4, 0x03)
+#define CRYPTO_V2_RNG_FATESY_SOC_RING          _SBF(2, 0x00)
+#define CRYPTO_V2_RNG_SLOWER_SOC_RING_0                _SBF(2, 0x01)
+#define CRYPTO_V2_RNG_SLOWER_SOC_RING_1                _SBF(2, 0x02)
+#define CRYPTO_V2_RNG_SLOWEST_SOC_RING         _SBF(2, 0x03)
+#define CRYPTO_V2_RNG_ENABLE                   BIT(1)
+#define CRYPTO_V2_RNG_START                    BIT(0)
+#define CRYPTO_V2_RNG_SAMPLE_CNT               0x0404
+#define CRYPTO_V2_RNG_DOUT_0                   0x0410
+/* end of CRYPTO V2 register define */
+
+#define RK_RNG_TIME_OUT        50000  /* max 50ms */
+
+struct rk_rng_soc_data {
+       int (*rk_rng_read)(struct udevice *dev, void *data, size_t len);
+};
+
+struct rk_rng_platdata {
+       fdt_addr_t base;
+       struct rk_rng_soc_data *soc_data;
+};
+
+static int rk_rng_read_regs(fdt_addr_t addr, void *buf, size_t size)
+{
+       u32 count = RK_HW_RNG_MAX / sizeof(u32);
+       u32 reg, tmp_len;
+
+       if (size > RK_HW_RNG_MAX)
+               return -EINVAL;
+
+       while (size && count) {
+               reg = readl(addr);
+               tmp_len = min(size, sizeof(u32));
+               memcpy(buf, &reg, tmp_len);
+               addr += sizeof(u32);
+               buf += tmp_len;
+               size -= tmp_len;
+               count--;
+       }
+
+       return 0;
+}
+
+static int rk_v1_rng_read(struct udevice *dev, void *data, size_t len)
+{
+       struct rk_rng_platdata *pdata = dev_get_priv(dev);
+       u32 reg = 0;
+       int retval;
+
+       if (len > RK_HW_RNG_MAX)
+               return -EINVAL;
+
+       /* enable osc_ring to get entropy, sample period is set as 100 */
+       writel(CRYPTO_V1_OSC_ENABLE | CRYPTO_V1_TRNG_SAMPLE_PERIOD(100),
+              pdata->base + CRYPTO_V1_TRNG_CTRL);
+
+       rk_clrsetreg(pdata->base + CRYPTO_V1_CTRL, CRYPTO_V1_RNG_START,
+                    CRYPTO_V1_RNG_START);
+
+       retval = readl_poll_timeout(pdata->base + CRYPTO_V1_CTRL, reg,
+                                   !(reg & CRYPTO_V1_RNG_START),
+                                   RK_RNG_TIME_OUT);
+       if (retval)
+               goto exit;
+
+       rk_rng_read_regs(pdata->base + CRYPTO_V1_TRNG_DOUT_0, data, len);
+
+exit:
+       /* close TRNG */
+       rk_clrreg(pdata->base + CRYPTO_V1_CTRL, CRYPTO_V1_RNG_START);
+
+       return 0;
+}
+
+static int rk_v2_rng_read(struct udevice *dev, void *data, size_t len)
+{
+       struct rk_rng_platdata *pdata = dev_get_priv(dev);
+       u32 reg = 0;
+       int retval;
+
+       if (len > RK_HW_RNG_MAX)
+               return -EINVAL;
+
+       /* enable osc_ring to get entropy, sample period is set as 100 */
+       writel(100, pdata->base + CRYPTO_V2_RNG_SAMPLE_CNT);
+
+       reg |= CRYPTO_V2_RNG_256_BIT_LEN;
+       reg |= CRYPTO_V2_RNG_SLOWER_SOC_RING_0;
+       reg |= CRYPTO_V2_RNG_ENABLE;
+       reg |= CRYPTO_V2_RNG_START;
+
+       rk_clrsetreg(pdata->base + CRYPTO_V2_RNG_CTL, 0xffff, reg);
+
+       retval = readl_poll_timeout(pdata->base + CRYPTO_V2_RNG_CTL, reg,
+                                   !(reg & CRYPTO_V2_RNG_START),
+                                   RK_RNG_TIME_OUT);
+       if (retval)
+               goto exit;
+
+       rk_rng_read_regs(pdata->base + CRYPTO_V2_RNG_DOUT_0, data, len);
+
+exit:
+       /* close TRNG */
+       rk_clrreg(pdata->base + CRYPTO_V2_RNG_CTL, 0xffff);
+
+       return retval;
+}
+
+static int rockchip_rng_read(struct udevice *dev, void *data, size_t len)
+{
+       unsigned char *buf = data;
+       unsigned int i;
+       int ret = -EIO;
+
+       struct rk_rng_platdata *pdata = dev_get_priv(dev);
+
+       if (!len)
+               return 0;
+
+       if (!pdata->soc_data || !pdata->soc_data->rk_rng_read)
+               return -EINVAL;
+
+       for (i = 0; i < len / RK_HW_RNG_MAX; i++, buf += RK_HW_RNG_MAX) {
+               ret = pdata->soc_data->rk_rng_read(dev, buf, RK_HW_RNG_MAX);
+               if (ret)
+                       goto exit;
+       }
+
+       if (len % RK_HW_RNG_MAX)
+               ret = pdata->soc_data->rk_rng_read(dev, buf,
+                                                  len % RK_HW_RNG_MAX);
+
+exit:
+       return ret;
+}
+
+static int rockchip_rng_ofdata_to_platdata(struct udevice *dev)
+{
+       struct rk_rng_platdata *pdata = dev_get_priv(dev);
+
+       memset(pdata, 0x00, sizeof(*pdata));
+
+       pdata->base = (fdt_addr_t)dev_read_addr_ptr(dev);
+       if (!pdata->base)
+               return -ENOMEM;
+
+       return 0;
+}
+
+static int rockchip_rng_probe(struct udevice *dev)
+{
+       struct rk_rng_platdata *pdata = dev_get_priv(dev);
+
+       pdata->soc_data = (struct rk_rng_soc_data *)dev_get_driver_data(dev);
+
+       return 0;
+}
+
+static const struct rk_rng_soc_data rk_rng_v1_soc_data = {
+       .rk_rng_read = rk_v1_rng_read,
+};
+
+static const struct rk_rng_soc_data rk_rng_v2_soc_data = {
+       .rk_rng_read = rk_v2_rng_read,
+};
+
+static const struct dm_rng_ops rockchip_rng_ops = {
+       .read = rockchip_rng_read,
+};
+
+static const struct udevice_id rockchip_rng_match[] = {
+       {
+               .compatible = "rockchip,cryptov1-rng",
+               .data = (ulong)&rk_rng_v1_soc_data,
+       },
+       {
+               .compatible = "rockchip,cryptov2-rng",
+               .data = (ulong)&rk_rng_v2_soc_data,
+       },
+       {},
+};
+
+U_BOOT_DRIVER(rockchip_rng) = {
+       .name = "rockchip-rng",
+       .id = UCLASS_RNG,
+       .of_match = rockchip_rng_match,
+       .ops = &rockchip_rng_ops,
+       .probe = rockchip_rng_probe,
+       .ofdata_to_platdata = rockchip_rng_ofdata_to_platdata,
+       .priv_auto_alloc_size = sizeof(struct rk_rng_platdata),
+};
index 8a5a61c9fb7c88043d6868414c92dccf26f62b8c..12d00b468948d87084238a26848e3b7aabca0e17 100644 (file)
@@ -77,6 +77,12 @@ static void mxs_lcd_init(struct udevice *dev, u32 fb_addr,
                dev_err(dev, "Failed to set mxs clk: %d\n", ret);
                return;
        }
+
+       ret = clk_enable(&per_clk);
+       if (ret < 0) {
+               dev_err(dev, "Failed to enable mxs clk: %d\n", ret);
+               return;
+       }
 #else
        /* Kick in the LCDIF clock */
        mxs_set_lcdclk(MXS_LCDIF_BASE, timings->pixelclock.typ / 1000);
index f4444b9c3487494d20ef524967ea512d3bd354b1..71d3faf169dec23b4e9801a91736ddcbac3a1b80 100644 (file)
@@ -8,7 +8,6 @@
 #include <clk.h>
 #include <display.h>
 #include <dm.h>
-#include <fdtdec.h>
 #include <panel.h>
 #include <regmap.h>
 #include "rk_mipi.h"
index 74ebe770a9521b13d7b515aa79592de404fb3fed..cfaa37797eda6f1f3bd70a5cf21a64999e0e1083 100644 (file)
@@ -8,7 +8,6 @@
 #include <clk.h>
 #include <display.h>
 #include <dm.h>
-#include <fdtdec.h>
 #include <panel.h>
 #include <regmap.h>
 #include "rk_mipi.h"
index cf84b886e72d2dc700cda202bec250f122309e16..99b16cd95edc021fe96f9481d31807a3497340c9 100644 (file)
@@ -997,7 +997,7 @@ static int rk_edp_ofdata_to_platdata(struct udevice *dev)
 {
        struct rk_edp_priv *priv = dev_get_priv(dev);
 
-       priv->regs = (struct rk3288_edp *)devfdt_get_addr(dev);
+       priv->regs = dev_read_addr_ptr(dev);
        priv->grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
 
        return 0;
index 79e24baf53bd6459bd702d3ffea2e43258fc148b..c92c2e3c6c0eaaa9de020d96ec3b60b3bb4386d0 100644 (file)
@@ -161,8 +161,7 @@ int rk_lvds_enable(struct udevice *dev, int panel_bpp,
 
 int rk_lvds_read_timing(struct udevice *dev, struct display_timing *timing)
 {
-       if (fdtdec_decode_display_timing
-           (gd->fdt_blob, dev_of_offset(dev), 0, timing)) {
+       if (ofnode_decode_display_timing(dev_ofnode(dev), 0, timing)) {
                debug("%s: Failed to decode display timing\n", __func__);
                return -EINVAL;
        }
@@ -173,13 +172,11 @@ int rk_lvds_read_timing(struct udevice *dev, struct display_timing *timing)
 static int rk_lvds_ofdata_to_platdata(struct udevice *dev)
 {
        struct rk_lvds_priv *priv = dev_get_priv(dev);
-       const void *blob = gd->fdt_blob;
-       int node = dev_of_offset(dev);
        int ret;
-       priv->regs = (void *)devfdt_get_addr(dev);
+       priv->regs = dev_read_addr_ptr(dev);
        priv->grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
 
-       ret = fdtdec_get_int(blob, node, "rockchip,output", -1);
+       ret = dev_read_s32_default(dev, "rockchip,output", -1);
        if (ret != -1) {
                priv->output = ret;
                debug("LVDS output : %d\n", ret);
@@ -188,7 +185,7 @@ static int rk_lvds_ofdata_to_platdata(struct udevice *dev)
                priv->output = LVDS_OUTPUT_RGB;
        }
 
-       ret = fdtdec_get_int(blob, node, "rockchip,data-mapping", -1);
+       ret = dev_read_s32_default(dev, "rockchip,data-mapping", -1);
        if (ret != -1) {
                priv->format = ret;
                debug("LVDS data-mapping : %d\n", ret);
@@ -197,7 +194,7 @@ static int rk_lvds_ofdata_to_platdata(struct udevice *dev)
                priv->format = LVDS_FORMAT_JEIDA;
        }
 
-       ret = fdtdec_get_int(blob, node, "rockchip,data-width", -1);
+       ret = dev_read_s32_default(dev, "rockchip,data-width", -1);
        if (ret != -1) {
                debug("LVDS data-width : %d\n", ret);
                if (ret == 24) {
index f9280e860705a65c5dd646cdab6deaa1e98dce02..f1c21bb8d7e436d1743f77675afbaf783f59df4e 100644 (file)
@@ -8,7 +8,6 @@
 #include <clk.h>
 #include <display.h>
 #include <dm.h>
-#include <fdtdec.h>
 #include <panel.h>
 #include <regmap.h>
 #include "rk_mipi.h"
@@ -29,8 +28,7 @@ int rk_mipi_read_timing(struct udevice *dev,
 {
        int ret;
 
-       ret = fdtdec_decode_display_timing(gd->fdt_blob, dev_of_offset(dev),
-                                        0, timing);
+       ret = ofnode_decode_display_timing(dev_ofnode(dev), 0, timing);
        if (ret) {
                debug("%s: Failed to decode display timing (ret=%d)\n",
                      __func__, ret);
@@ -77,7 +75,7 @@ static void rk_mipi_dsi_write(uintptr_t regs, u32 reg, u32 val)
 int rk_mipi_dsi_enable(struct udevice *dev,
                       const struct display_timing *timing)
 {
-       int node, timing_node;
+       ofnode node, timing_node;
        int val;
        struct rk_mipi_priv *priv = dev_get_priv(dev);
        uintptr_t regs = priv->regs;
@@ -120,10 +118,10 @@ int rk_mipi_dsi_enable(struct udevice *dev,
        rk_mipi_dsi_write(regs, VID_PKT_SIZE, 0x4b0);
 
        /* Set dpi color coding depth 24 bit */
-       timing_node = fdt_subnode_offset(gd->fdt_blob, dev_of_offset(dev),
-                                                                        "display-timings");
-       node = fdt_first_subnode(gd->fdt_blob, timing_node);
-       val = fdtdec_get_int(gd->fdt_blob, node, "bits-per-pixel", -1);
+       timing_node = ofnode_find_subnode(dev->node, "display-timings");
+       node = ofnode_first_subnode(timing_node);
+
+       val = ofnode_read_u32_default(node, "bits-per-pixel", -1);
        switch (val) {
        case 16:
                rk_mipi_dsi_write(regs, DPI_COLOR_CODING, DPI_16BIT_CFG_1);
index 779e2528b77e8a8494855d639d85479ed4552731..4a34813804f634741c7f9896b8c6572de8a69750 100644 (file)
@@ -5,10 +5,13 @@
 
 extra-y        := hello_world
 extra-$(CONFIG_SMC91111)           += smc91111_eeprom
-extra-$(CONFIG_SMC911X)            += smc911x_eeprom
 extra-$(CONFIG_SPI_FLASH_ATMEL)    += atmel_df_pow2
 extra-$(CONFIG_PPC)                += sched
 
+ifndef CONFIG_DM_ETH
+extra-$(CONFIG_SMC911X)            += smc911x_eeprom
+endif
+
 #
 # Some versions of make do not handle trailing white spaces properly;
 # leading to build failures. The problem was found with GNU Make 3.80.
index 2c05ed902d0c55734fc6f13784eaed4de9e93105..270588bcf5ea66d4bb2ba65785dbb6b6e1a37c2a 100644 (file)
 #include <console.h>
 #include <exports.h>
 #include <linux/ctype.h>
+#include <linux/types.h>
 #include "../drivers/net/smc911x.h"
 
+#define DRIVERNAME "smc911x"
+
+#if defined (CONFIG_SMC911X_32_BIT) && \
+       defined (CONFIG_SMC911X_16_BIT)
+#error "SMC911X: Only one of CONFIG_SMC911X_32_BIT and \
+       CONFIG_SMC911X_16_BIT shall be set"
+#endif
+
+struct chip_id {
+       u16 id;
+       char *name;
+};
+
+static const struct chip_id chip_ids[] =  {
+       { CHIP_89218, "LAN89218" },
+       { CHIP_9115, "LAN9115" },
+       { CHIP_9116, "LAN9116" },
+       { CHIP_9117, "LAN9117" },
+       { CHIP_9118, "LAN9118" },
+       { CHIP_9211, "LAN9211" },
+       { CHIP_9215, "LAN9215" },
+       { CHIP_9216, "LAN9216" },
+       { CHIP_9217, "LAN9217" },
+       { CHIP_9218, "LAN9218" },
+       { CHIP_9220, "LAN9220" },
+       { CHIP_9221, "LAN9221" },
+       { 0, NULL },
+};
+
+#if defined (CONFIG_SMC911X_32_BIT)
+static u32 smc911x_reg_read(struct eth_device *dev, u32 offset)
+{
+       return *(volatile u32*)(dev->iobase + offset);
+}
+
+static void smc911x_reg_write(struct eth_device *dev, u32 offset, u32 val)
+{
+       *(volatile u32*)(dev->iobase + offset) = val;
+}
+#elif defined (CONFIG_SMC911X_16_BIT)
+static u32 smc911x_reg_read(struct eth_device *dev, u32 offset)
+{
+       volatile u16 *addr_16 = (u16 *)(dev->iobase + offset);
+       return (*addr_16 & 0x0000ffff) | (*(addr_16 + 1) << 16);
+}
+static void smc911x_reg_write(struct eth_device *dev, u32 offset, u32 val)
+{
+       *(volatile u16 *)(dev->iobase + offset) = (u16)val;
+       *(volatile u16 *)(dev->iobase + offset + 2) = (u16)(val >> 16);
+}
+#else
+#error "SMC911X: undefined bus width"
+#endif /* CONFIG_SMC911X_16_BIT */
+
+static u32 smc911x_get_mac_csr(struct eth_device *dev, u8 reg)
+{
+       while (smc911x_reg_read(dev, MAC_CSR_CMD) & MAC_CSR_CMD_CSR_BUSY)
+               ;
+       smc911x_reg_write(dev, MAC_CSR_CMD,
+                       MAC_CSR_CMD_CSR_BUSY | MAC_CSR_CMD_R_NOT_W | reg);
+       while (smc911x_reg_read(dev, MAC_CSR_CMD) & MAC_CSR_CMD_CSR_BUSY)
+               ;
+
+       return smc911x_reg_read(dev, MAC_CSR_DATA);
+}
+
+static void smc911x_set_mac_csr(struct eth_device *dev, u8 reg, u32 data)
+{
+       while (smc911x_reg_read(dev, MAC_CSR_CMD) & MAC_CSR_CMD_CSR_BUSY)
+               ;
+       smc911x_reg_write(dev, MAC_CSR_DATA, data);
+       smc911x_reg_write(dev, MAC_CSR_CMD, MAC_CSR_CMD_CSR_BUSY | reg);
+       while (smc911x_reg_read(dev, MAC_CSR_CMD) & MAC_CSR_CMD_CSR_BUSY)
+               ;
+}
+
+static int smc911x_detect_chip(struct eth_device *dev)
+{
+       unsigned long val, i;
+
+       val = smc911x_reg_read(dev, BYTE_TEST);
+       if (val == 0xffffffff) {
+               /* Special case -- no chip present */
+               return -1;
+       } else if (val != 0x87654321) {
+               printf(DRIVERNAME ": Invalid chip endian 0x%08lx\n", val);
+               return -1;
+       }
+
+       val = smc911x_reg_read(dev, ID_REV) >> 16;
+       for (i = 0; chip_ids[i].id != 0; i++) {
+               if (chip_ids[i].id == val) break;
+       }
+       if (!chip_ids[i].id) {
+               printf(DRIVERNAME ": Unknown chip ID %04lx\n", val);
+               return -1;
+       }
+
+       dev->priv = (void *)&chip_ids[i];
+
+       return 0;
+}
+
+static void smc911x_reset(struct eth_device *dev)
+{
+       int timeout;
+
+       /*
+        *  Take out of PM setting first
+        *  Device is already wake up if PMT_CTRL_READY bit is set
+        */
+       if ((smc911x_reg_read(dev, PMT_CTRL) & PMT_CTRL_READY) == 0) {
+               /* Write to the bytetest will take out of powerdown */
+               smc911x_reg_write(dev, BYTE_TEST, 0x0);
+
+               timeout = 10;
+
+               while (timeout-- &&
+                       !(smc911x_reg_read(dev, PMT_CTRL) & PMT_CTRL_READY))
+                       udelay(10);
+               if (timeout < 0) {
+                       printf(DRIVERNAME
+                               ": timeout waiting for PM restore\n");
+                       return;
+               }
+       }
+
+       /* Disable interrupts */
+       smc911x_reg_write(dev, INT_EN, 0);
+
+       smc911x_reg_write(dev, HW_CFG, HW_CFG_SRST);
+
+       timeout = 1000;
+       while (timeout-- && smc911x_reg_read(dev, E2P_CMD) & E2P_CMD_EPC_BUSY)
+               udelay(10);
+
+       if (timeout < 0) {
+               printf(DRIVERNAME ": reset timeout\n");
+               return;
+       }
+
+       /* Reset the FIFO level and flow control settings */
+       smc911x_set_mac_csr(dev, FLOW, FLOW_FCPT | FLOW_FCEN);
+       smc911x_reg_write(dev, AFC_CFG, 0x0050287F);
+
+       /* Set to LED outputs */
+       smc911x_reg_write(dev, GPIO_CFG, 0x70070000);
+}
+
 /**
  *     smsc_ctrlc - detect press of CTRL+C (common ctrlc() isnt exported!?)
  */
index bea035c3e23ba8d30777fec8bfc5c0a8cd108589..4003715733958c6b1b97a256f7272a4ef7ebb818 100644 (file)
@@ -24,6 +24,7 @@
 
 /* Networking */
 #define FEC_QUIRK_ENET_MAC
+#define FEC_ENET_ENABLE_TXC_DELAY
 
 #define CONFIG_TFTP_TSIZE
 
diff --git a/include/configs/imx8mq_phanbell.h b/include/configs/imx8mq_phanbell.h
new file mode 100644 (file)
index 0000000..4fa48c0
--- /dev/null
@@ -0,0 +1,216 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2020 NXP
+ */
+
+#ifndef __IMX8M_PHANBELL_H
+#define __IMX8M_PHANBELL_H
+
+#include <linux/sizes.h>
+#include <asm/arch/imx-regs.h>
+
+#define CONFIG_SPL_MAX_SIZE            (172 * 1024)
+#define CONFIG_SYS_MONITOR_LEN         (512 * 1024)
+#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
+#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR        0x300
+#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION     1
+
+#ifdef CONFIG_SPL_BUILD
+/*#define CONFIG_ENABLE_DDR_TRAINING_DEBUG*/
+#define CONFIG_SPL_WATCHDOG_SUPPORT
+#define CONFIG_SPL_DRIVERS_MISC_SUPPORT
+#define CONFIG_SPL_POWER_SUPPORT
+#define CONFIG_SPL_I2C_SUPPORT
+#define CONFIG_SPL_LDSCRIPT            "arch/arm/cpu/armv8/u-boot-spl.lds"
+#define CONFIG_SPL_STACK               0x187FF0
+#define CONFIG_SPL_LIBCOMMON_SUPPORT
+#define CONFIG_SPL_LIBGENERIC_SUPPORT
+#define CONFIG_SPL_GPIO_SUPPORT
+#define CONFIG_SPL_MMC_SUPPORT
+#define CONFIG_SPL_BSS_START_ADDR      0x00180000
+#define CONFIG_SPL_BSS_MAX_SIZE        0x2000  /* 8 KB */
+#define CONFIG_SYS_SPL_MALLOC_START    0x42200000
+#define CONFIG_SYS_SPL_MALLOC_SIZE    0x80000  /* 512 KB */
+#define CONFIG_SYS_SPL_PTE_RAM_BASE    0x41580000
+
+/* malloc f used before GD_FLG_FULL_MALLOC_INIT set */
+#define CONFIG_MALLOC_F_ADDR           0x182000
+/* For RAW image gives a error info not panic */
+#define CONFIG_SPL_ABORT_ON_RAW_IMAGE
+
+#undef CONFIG_DM_MMC
+#undef CONFIG_DM_PMIC
+#undef CONFIG_DM_PMIC_PFUZE100
+
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_MXC_I2C1                /* enable I2C bus 1 */
+#define CONFIG_SYS_I2C_MXC_I2C2                /* enable I2C bus 2 */
+#define CONFIG_SYS_I2C_MXC_I2C3                /* enable I2C bus 3 */
+
+#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
+
+#define CONFIG_POWER
+#define CONFIG_POWER_I2C
+#endif
+
+#define CONFIG_REMAKE_ELF
+
+#define CONFIG_BOARD_EARLY_INIT_F
+
+#undef CONFIG_CMD_EXPORTENV
+#undef CONFIG_CMD_IMPORTENV
+#undef CONFIG_CMD_IMLS
+
+#undef CONFIG_CMD_CRC32
+
+/* ENET Config */
+/* ENET1 */
+#if defined(CONFIG_CMD_NET)
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_MII
+#define CONFIG_MII
+#define CONFIG_ETHPRIME                 "FEC"
+
+#define CONFIG_FEC_MXC
+#define CONFIG_FEC_XCV_TYPE             RGMII
+#define CONFIG_FEC_MXC_PHYADDR          0
+#define FEC_QUIRK_ENET_MAC
+
+#define CONFIG_PHY_GIGE
+#define IMX_FEC_BASE                   0x30BE0000
+
+#define CONFIG_PHYLIB
+#endif
+
+#define CONFIG_MFG_ENV_SETTINGS \
+       "initrd_addr=0x43800000\0" \
+       "initrd_high=0xffffffff\0" \
+
+/* Initial environment variables */
+#define CONFIG_EXTRA_ENV_SETTINGS              \
+       CONFIG_MFG_ENV_SETTINGS \
+       "script=boot.scr\0" \
+       "image=Image\0" \
+       "console=ttymxc0,115200\0" \
+       "fdt_addr=0x43000000\0"                 \
+       "fdt_high=0xffffffffffffffff\0"         \
+       "boot_fdt=try\0" \
+       "fdt_file=imx8mq-phanbell.dtb\0" \
+       "initrd_addr=0x43800000\0"              \
+       "initrd_high=0xffffffffffffffff\0" \
+       "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
+       "mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
+       "mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
+       "mmcautodetect=yes\0" \
+       "mmcargs=setenv bootargs console=${console} root=${mmcroot}\0 " \
+       "loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
+       "bootscript=echo Running bootscript from mmc ...; " \
+               "source\0" \
+       "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
+       "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
+       "mmcboot=echo Booting from mmc ...; " \
+               "run mmcargs; " \
+               "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
+                       "if run loadfdt; then " \
+                               "booti ${loadaddr} - ${fdt_addr}; " \
+                       "else " \
+                               "echo WARN: Cannot load the DT; " \
+                       "fi; " \
+               "else " \
+                       "echo wait for boot; " \
+               "fi;\0" \
+       "netargs=setenv bootargs console=${console} " \
+               "root=/dev/nfs " \
+               "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
+       "netboot=echo Booting from net ...; " \
+               "run netargs;  " \
+               "if test ${ip_dyn} = yes; then " \
+                       "setenv get_cmd dhcp; " \
+               "else " \
+                       "setenv get_cmd tftp; " \
+               "fi; " \
+               "${get_cmd} ${loadaddr} ${image}; " \
+               "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
+                       "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
+                               "booti ${loadaddr} - ${fdt_addr}; " \
+                       "else " \
+                               "echo WARN: Cannot load the DT; " \
+                       "fi; " \
+               "else " \
+                       "booti; " \
+               "fi;\0"
+
+#define CONFIG_BOOTCOMMAND \
+          "mmc dev ${mmcdev}; if mmc rescan; then " \
+                  "if run loadbootscript; then " \
+                          "run bootscript; " \
+                  "else " \
+                          "if run loadimage; then " \
+                                  "run mmcboot; " \
+                          "else run netboot; " \
+                          "fi; " \
+                  "fi; " \
+          "else booti ${loadaddr} - ${fdt_addr}; fi"
+
+/* Link Definitions */
+#define CONFIG_LOADADDR                        0x40480000
+
+#define CONFIG_SYS_LOAD_ADDR           CONFIG_LOADADDR
+
+#define CONFIG_SYS_INIT_RAM_ADDR        0x40000000
+#define CONFIG_SYS_INIT_RAM_SIZE        0x80000
+#define CONFIG_SYS_INIT_SP_OFFSET \
+       (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
+#define CONFIG_SYS_INIT_SP_ADDR \
+       (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
+
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_SYS_MMC_ENV_DEV         1   /* USDHC2 */
+#define CONFIG_MMCROOT                 "/dev/mmcblk1p2"  /* USDHC2 */
+
+/* Size of malloc() pool */
+#define CONFIG_SYS_MALLOC_LEN          ((CONFIG_ENV_SIZE + (2 * 1024)) * 1024)
+
+#define CONFIG_SYS_SDRAM_BASE           0x40000000
+#define PHYS_SDRAM                      0x40000000
+#define PHYS_SDRAM_SIZE                        0x40000000 /* 1GB DDR */
+
+#define CONFIG_SYS_MEMTEST_START       PHYS_SDRAM
+#define CONFIG_SYS_MEMTEST_END         (CONFIG_SYS_MEMTEST_START + \
+                                       (PHYS_SDRAM_SIZE >> 1))
+
+#define CONFIG_MXC_UART
+#define CONFIG_MXC_UART_BASE           UART1_BASE_ADDR
+
+/* Monitor Command Prompt */
+#define CONFIG_SYS_PROMPT_HUSH_PS2     "> "
+#define CONFIG_SYS_CBSIZE              1024
+#define CONFIG_SYS_MAXARGS             64
+#define CONFIG_SYS_BARGSIZE            CONFIG_SYS_CBSIZE
+#define CONFIG_SYS_PBSIZE              (CONFIG_SYS_CBSIZE + \
+                                       sizeof(CONFIG_SYS_PROMPT) + 16)
+
+#define CONFIG_IMX_BOOTAUX
+
+#define CONFIG_CMD_MMC
+
+#define CONFIG_SYS_FSL_USDHC_NUM       2
+#define CONFIG_SYS_FSL_ESDHC_ADDR       0
+
+#define CONFIG_SYS_MMC_IMG_LOAD_PART   1
+
+#define CONFIG_MXC_GPIO
+
+#define CONFIG_CMD_FUSE
+
+/* I2C Configs */
+#define CONFIG_SYS_I2C_SPEED             100000
+
+#define CONFIG_OF_SYSTEM_SETUP
+
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_DM_PMIC
+#endif
+
+#endif
index bb8a44433eba4471ec5588b015fc58f03659cef5..d41b80c7dc23c5b1ef1fafbd12155e49360c5bc6 100644 (file)
@@ -16,7 +16,6 @@
 #define CONFIG_PCI_GT64120
 #define CONFIG_PCI_MSC01
 #define CONFIG_PCNET
-#define CONFIG_PCNET_79C973
 #define PCNET_HAS_PROM
 
 #define CONFIG_SYS_ISA_IO_BASE_ADDRESS 0
index 984cf611f4c30c6e6613d70a5663d475af25051a..dc5e81844316ea8faac1fba314da885edaa2ae75 100644 (file)
 
 #define CONFIG_IMX_THERMAL
 
-#ifdef CONFIG_FSL_QSPI
-#define CONFIG_SYS_FSL_QSPI_AHB
-#define FSL_QSPI_FLASH_SIZE            SZ_32M
-#define FSL_QSPI_FLASH_NUM             2
-#endif
-
 #define CONFIG_SYS_FSL_USDHC_NUM       2
 #if defined(CONFIG_ENV_IS_IN_MMC)
 #define CONFIG_SYS_MMC_ENV_DEV         0  /*USDHC3*/
index 86007a2d36feeeace4385ed6fee097975328105a..3bff496bad2633b003659ed7ab2881ebb631d92c 100644 (file)
 
 #define CONFIG_IMX_THERMAL
 
-#ifdef CONFIG_FSL_QSPI
-#define CONFIG_SYS_FSL_QSPI_LE
-#define CONFIG_SYS_FSL_QSPI_AHB
-#ifdef CONFIG_MX6SX_SABRESD_REVA
-#define FSL_QSPI_FLASH_SIZE            SZ_16M
-#else
-#define FSL_QSPI_FLASH_SIZE            SZ_32M
-#endif
-#define FSL_QSPI_FLASH_NUM             2
-#endif
-
 #ifndef CONFIG_SPL_BUILD
 #ifdef CONFIG_VIDEO
 #define CONFIG_VIDEO_MXS
index a30d2c087999f6b39a5fc45b94e17a0b056e2eb2..1bdd5779403bbeed5ce96f2b456b4be8f089fbde 100644 (file)
 #define CONFIG_SYS_MMC_ENV_PART                0       /* user area */
 #define CONFIG_MMCROOT                 "/dev/mmcblk1p2"  /* USDHC2 */
 
-#ifdef CONFIG_FSL_QSPI
-#define CONFIG_SYS_FSL_QSPI_AHB
-#define FSL_QSPI_FLASH_NUM             1
-#define FSL_QSPI_FLASH_SIZE            SZ_32M
-#endif
-
 /* USB Configs */
 #ifdef CONFIG_CMD_USB
 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
index af335bcfff482c96ff32dcecd5cd572c8755619e..3d42d26aa4943e2474c93aec4d68b5059a4355d7 100644 (file)
 
 #define CONFIG_SOFT_SPI
 
-#ifdef CONFIG_FSL_QSPI
-#define CONFIG_SYS_FSL_QSPI_AHB
-#define FSL_QSPI_FLASH_NUM             1
-#define FSL_QSPI_FLASH_SIZE            SZ_32M
-#endif
-
 #ifdef CONFIG_CMD_NET
 #define CONFIG_FEC_ENET_DEV            1
 #if (CONFIG_FEC_ENET_DEV == 0)
index e7d35ed648088f84a5bffb19945fb7720ea1514c..fa59748776db3ea099eb2f7c0d0f8e3ca5c80a0b 100644 (file)
 #define CONFIG_VIDEO_BMP_LOGO
 #endif
 
-#ifdef CONFIG_FSL_QSPI
-#define CONFIG_SYS_FSL_QSPI_AHB
-#define FSL_QSPI_FLASH_NUM             1
-#define FSL_QSPI_FLASH_SIZE            SZ_64M
-#define QSPI0_BASE_ADDR                        QSPI1_IPS_BASE_ADDR
-#define QSPI0_AMBA_BASE                        QSPI0_ARB_BASE_ADDR
-#endif
-
 #endif /* __CONFIG_H */
index 72f8d08a665c8fcd4aa60d47447012e36e28bd8d..d4d6ad2143f220b1e68071422e1fcf5a3d5812d8 100644 (file)
 #define CONFIG_SYS_NAND_ONFI_DETECTION
 
 #define CONFIG_SYS_MAX_NAND_DEVICE     1
-/* QSPI Configs*/
-#ifdef CONFIG_FSL_QSPI
-#define FSL_QSPI_FLASH_SIZE            (SZ_16M)
-#define FSL_QSPI_FLASH_NUM             2
-#define CONFIG_SYS_FSL_QSPI_LE
-#endif
-
 
 #define CONFIG_LOADADDR                        0x82000000
 
index 3ab3231943877d9f836eb38c1b26f6d03525fc85..d52a5a7e833ca799d3d5cc74e5d8a0c485deeb81 100644 (file)
 #define CONFIG_FEC_XCV_TYPE            RMII
 #define CONFIG_FEC_MXC_PHYADDR          0
 
-/* QSPI Configs*/
-
-#ifdef CONFIG_FSL_QSPI
-#define FSL_QSPI_FLASH_SIZE            (1 << 24)
-#define FSL_QSPI_FLASH_NUM             2
-#define CONFIG_SYS_FSL_QSPI_LE
-#endif
-
 /* I2C Configs */
 #define CONFIG_SYS_I2C
 #define CONFIG_SYS_I2C_MXC
index cde61ed8830bbb6912125f649cdba01856fcd21b..555b4ff660ae6d3fa5b53bbf27d3b28a99d6a6c2 100644 (file)
@@ -1,6 +1,7 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
- * (C) Copyright 2016 Rockchip Electronics Co., Ltd
+ * Copyright (c) 2016 Rockchip Electronics Co. Ltd.
+ * Author: Elaine <zhangqing@rock-chips.com>
  */
 
 #ifndef _DT_BINDINGS_CLK_ROCKCHIP_RK3328_H
 #define SCLK_MAC2IO_EXT                102
 
 /* dclk gates */
-#define DCLK_LCDC              180
-#define DCLK_HDMIPHY           181
-#define HDMIPHY                        182
-#define USB480M                        183
-#define DCLK_LCDC_SRC          184
+#define DCLK_LCDC              120
+#define DCLK_HDMIPHY           121
+#define HDMIPHY                        122
+#define USB480M                        123
+#define DCLK_LCDC_SRC          124
 
 /* aclk gates */
-#define ACLK_AXISRAM           190
-#define ACLK_VOP_PRE           191
-#define ACLK_USB3OTG           192
-#define ACLK_RGA_PRE           193
-#define ACLK_DMAC              194
-#define ACLK_GPU               195
-#define ACLK_BUS_PRE           196
-#define ACLK_PERI_PRE          197
-#define ACLK_RKVDEC_PRE                198
-#define ACLK_RKVDEC            199
-#define ACLK_RKVENC            200
-#define ACLK_VPU_PRE           201
-#define ACLK_VIO_PRE           202
-#define ACLK_VPU               203
-#define ACLK_VIO               204
-#define ACLK_VOP               205
-#define ACLK_GMAC              206
-#define ACLK_H265              207
-#define ACLK_H264              208
-#define ACLK_MAC2PHY           209
-#define ACLK_MAC2IO            210
-#define ACLK_DCF               211
-#define ACLK_TSP               212
-#define ACLK_PERI              213
-#define ACLK_RGA               214
-#define ACLK_IEP               215
-#define ACLK_CIF               216
-#define ACLK_HDCP              217
+#define ACLK_AXISRAM           130
+#define ACLK_VOP_PRE           131
+#define ACLK_USB3OTG           132
+#define ACLK_RGA_PRE           133
+#define ACLK_DMAC              134
+#define ACLK_GPU               135
+#define ACLK_BUS_PRE           136
+#define ACLK_PERI_PRE          137
+#define ACLK_RKVDEC_PRE                138
+#define ACLK_RKVDEC            139
+#define ACLK_RKVENC            140
+#define ACLK_VPU_PRE           141
+#define ACLK_VIO_PRE           142
+#define ACLK_VPU               143
+#define ACLK_VIO               144
+#define ACLK_VOP               145
+#define ACLK_GMAC              146
+#define ACLK_H265              147
+#define ACLK_H264              148
+#define ACLK_MAC2PHY           149
+#define ACLK_MAC2IO            150
+#define ACLK_DCF               151
+#define ACLK_TSP               152
+#define ACLK_PERI              153
+#define ACLK_RGA               154
+#define ACLK_IEP               155
+#define ACLK_CIF               156
+#define ACLK_HDCP              157
 
 /* pclk gates */
-#define PCLK_GPIO0             300
-#define PCLK_GPIO1             301
-#define PCLK_GPIO2             302
-#define PCLK_GPIO3             303
-#define PCLK_GRF               304
-#define PCLK_I2C0              305
-#define PCLK_I2C1              306
-#define PCLK_I2C2              307
-#define PCLK_I2C3              308
-#define PCLK_SPI               309
-#define PCLK_UART0             310
-#define PCLK_UART1             311
-#define PCLK_UART2             312
-#define PCLK_TSADC             313
-#define PCLK_PWM               314
-#define PCLK_TIMER             315
-#define PCLK_BUS_PRE           316
-#define PCLK_PERI_PRE          317
-#define PCLK_HDMI_CTRL         318
-#define PCLK_HDMI_PHY          319
-#define PCLK_GMAC              320
-#define PCLK_H265              321
-#define PCLK_MAC2PHY           322
-#define PCLK_MAC2IO            323
-#define PCLK_USB3PHY_OTG       324
-#define PCLK_USB3PHY_PIPE      325
-#define PCLK_USB3_GRF          326
-#define PCLK_USB2_GRF          327
-#define PCLK_HDMIPHY           328
-#define PCLK_DDR               329
-#define PCLK_PERI              330
-#define PCLK_HDMI              331
-#define PCLK_HDCP              332
-#define PCLK_DCF               333
-#define PCLK_SARADC            334
+#define PCLK_GPIO0             200
+#define PCLK_GPIO1             201
+#define PCLK_GPIO2             202
+#define PCLK_GPIO3             203
+#define PCLK_GRF               204
+#define PCLK_I2C0              205
+#define PCLK_I2C1              206
+#define PCLK_I2C2              207
+#define PCLK_I2C3              208
+#define PCLK_SPI               209
+#define PCLK_UART0             210
+#define PCLK_UART1             211
+#define PCLK_UART2             212
+#define PCLK_TSADC             213
+#define PCLK_PWM               214
+#define PCLK_TIMER             215
+#define PCLK_BUS_PRE           216
+#define PCLK_PERI_PRE          217
+#define PCLK_HDMI_CTRL         218
+#define PCLK_HDMI_PHY          219
+#define PCLK_GMAC              220
+#define PCLK_H265              221
+#define PCLK_MAC2PHY           222
+#define PCLK_MAC2IO            223
+#define PCLK_USB3PHY_OTG       224
+#define PCLK_USB3PHY_PIPE      225
+#define PCLK_USB3_GRF          226
+#define PCLK_USB2_GRF          227
+#define PCLK_HDMIPHY           228
+#define PCLK_DDR               229
+#define PCLK_PERI              230
+#define PCLK_HDMI              231
+#define PCLK_HDCP              232
+#define PCLK_DCF               233
+#define PCLK_SARADC            234
+#define PCLK_ACODECPHY         235
+#define PCLK_WDT               236
 
 /* hclk gates */
-#define HCLK_PERI              408
-#define HCLK_TSP               409
-#define HCLK_GMAC              410
-#define HCLK_I2S0_8CH          411
-#define HCLK_I2S1_8CH          413
-#define HCLK_I2S2_2CH          413
-#define HCLK_SPDIF_8CH         414
-#define HCLK_VOP               415
-#define HCLK_NANDC             416
-#define HCLK_SDMMC             417
-#define HCLK_SDIO              418
-#define HCLK_EMMC              419
-#define HCLK_SDMMC_EXT         420
-#define HCLK_RKVDEC_PRE                421
-#define HCLK_RKVDEC            422
-#define HCLK_RKVENC            423
-#define HCLK_VPU_PRE           424
-#define HCLK_VIO_PRE           425
-#define HCLK_VPU               426
-#define HCLK_VIO               427
-#define HCLK_BUS_PRE           428
-#define HCLK_PERI_PRE          429
-#define HCLK_H264              430
-#define HCLK_CIF               431
-#define HCLK_OTG_PMU           432
-#define HCLK_OTG               433
-#define HCLK_HOST0             434
-#define HCLK_HOST0_ARB         435
-#define HCLK_CRYPTO_MST                436
-#define HCLK_CRYPTO_SLV                437
-#define HCLK_PDM               438
-#define HCLK_IEP               439
-#define HCLK_RGA               440
-#define HCLK_HDCP              441
+#define HCLK_PERI              308
+#define HCLK_TSP               309
+#define HCLK_GMAC              310
+#define HCLK_I2S0_8CH          311
+#define HCLK_I2S1_8CH          312
+#define HCLK_I2S2_2CH          313
+#define HCLK_SPDIF_8CH         314
+#define HCLK_VOP               315
+#define HCLK_NANDC             316
+#define HCLK_SDMMC             317
+#define HCLK_SDIO              318
+#define HCLK_EMMC              319
+#define HCLK_SDMMC_EXT         320
+#define HCLK_RKVDEC_PRE                321
+#define HCLK_RKVDEC            322
+#define HCLK_RKVENC            323
+#define HCLK_VPU_PRE           324
+#define HCLK_VIO_PRE           325
+#define HCLK_VPU               326
+#define HCLK_BUS_PRE           328
+#define HCLK_PERI_PRE          329
+#define HCLK_H264              330
+#define HCLK_CIF               331
+#define HCLK_OTG_PMU           332
+#define HCLK_OTG               333
+#define HCLK_HOST0             334
+#define HCLK_HOST0_ARB         335
+#define HCLK_CRYPTO_MST                336
+#define HCLK_CRYPTO_SLV                337
+#define HCLK_PDM               338
+#define HCLK_IEP               339
+#define HCLK_RGA               340
+#define HCLK_HDCP              341
 
 #define CLK_NR_CLKS            (HCLK_HDCP + 1)
 
-#define CLKGRF_NR_CLKS         (SCLK_MAC2PHY + 1)
-
 /* soft-reset indices */
 #define SRST_CORE0_PO          0
 #define SRST_CORE1_PO          1
index c6bacb7378595943bf77020c9d39930a81061d59..b3a833bde29d2bd6797eeb76aa897d606bfef6f9 100644 (file)
@@ -7,8 +7,6 @@
 #ifndef _DT_BINDINGS_PINCTRL_IMXRT1020_PINFUNC_H
 #define _DT_BINDINGS_PINCTRL_IMXRT1020_PINFUNC_H
 
-/* TODO: continue from LPI2C4_SDA_SELECT_INPUT */
-
 #define IMX_PAD_SION   0x40000000
 
 /*
diff --git a/include/dt-bindings/power/rk3328-power.h b/include/dt-bindings/power/rk3328-power.h
new file mode 100644 (file)
index 0000000..02e3d7f
--- /dev/null
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __DT_BINDINGS_POWER_RK3328_POWER_H__
+#define __DT_BINDINGS_POWER_RK3328_POWER_H__
+
+/**
+ * RK3328 idle id Summary.
+ */
+#define RK3328_PD_CORE         0
+#define RK3328_PD_GPU          1
+#define RK3328_PD_BUS          2
+#define RK3328_PD_MSCH         3
+#define RK3328_PD_PERI         4
+#define RK3328_PD_VIDEO                5
+#define RK3328_PD_HEVC         6
+#define RK3328_PD_SYS          7
+#define RK3328_PD_VPU          8
+#define RK3328_PD_VIO          9
+
+#endif
index 139ff61b8acf1e3b0d007782c9d953367ca731ff..26dbe0421a078ced6e6e675107e5f53ea9ed3637 100644 (file)
@@ -7,7 +7,10 @@
 #define _IMX_SIP_H_
 
 #define IMX_SIP_GPC            0xC2000000
-#define  IMX_SIP_GPC_PM_DOMAIN 0x03
+#define IMX_SIP_GPC_PM_DOMAIN  0x03
+
+#define IMX_SIP_BUILDINFO                      0xC2000003
+#define IMX_SIP_BUILDINFO_GET_COMMITHASH       0x00
 
 #define IMX_SIP_SRC            0xC2000005
 #define IMX_SIP_SRC_M4_START   0x00
index 3e6b5312d85a2f8f7edc488dbb54dbc76368d708..a2593c5b10c5dd0479a09dc066fe59785cfbf747 100644 (file)
 #define MII_KSZ9031_FLP_BURST_TX_LO            0x3
 #define MII_KSZ9031_FLP_BURST_TX_HI            0x4
 
+#define MII_KSZ9x31_SILICON_REV_MASK           0xfffff0
+
+#define MII_KSZ9131_RXTXDLL_BYPASS             BIT(12)
+#define MII_KSZ9131_EXT_RGMII_2NS_SKEW_RXDLL   0x4c
+#define MII_KSZ9131_EXT_RGMII_2NS_SKEW_TXDLL   0x4d
+
+#define PHY_ID_KSZ9031                         0x00221620
+#define PHY_ID_KSZ9131                         0x00221640
+
+
 /* Registers */
 #define MMD_ACCESS_CONTROL     0xd
 #define MMD_ACCESS_REG_DATA    0xe
@@ -35,5 +45,6 @@ int ksz9031_phy_extended_write(struct phy_device *phydev, int devaddr,
                               int regnum, u16 mode, u16 val);
 int ksz9031_phy_extended_read(struct phy_device *phydev, int devaddr,
                              int regnum, u16 mode);
+int ksz9xx1_phy_get_id(struct phy_device *phydev);
 
 #endif
index 68a3fceab663415ca4c51318cd4a92a54ae490ce..f2d21c45d0f3bd037543ce668db698ef74239dbc 100644 (file)
@@ -125,6 +125,7 @@ int fec_probe(bd_t *bd, int dev_id, uint32_t base_addr,
 /*
  * Allow FEC to fine-tune MII configuration on boards which require this.
  */
+struct eth_device;
 int fecmxc_register_mii_postcall(struct eth_device *dev, int (*cb)(int));
 #endif
 
index 7a5da9d822a4073797627de4d63ab7edd309414b..19c921806092dc5c154c7f01c383267d40362daa 100644 (file)
@@ -1292,8 +1292,6 @@ CONFIG_PCI_SYS_BUS
 CONFIG_PCI_SYS_PHYS
 CONFIG_PCI_SYS_SIZE
 CONFIG_PCNET
-CONFIG_PCNET_79C973
-CONFIG_PCNET_79C975
 CONFIG_PEN_ADDR_BIG_ENDIAN
 CONFIG_PERIF1_FREQ
 CONFIG_PERIF2_FREQ
@@ -4077,9 +4075,6 @@ CONFIG_TSECV2_1
 CONFIG_TSEC_TBI
 CONFIG_TSEC_TBICR_SETTINGS
 CONFIG_TULIP
-CONFIG_TULIP_FIX_DAVICOM
-CONFIG_TULIP_SELECT_MEDIA
-CONFIG_TULIP_USE_IO
 CONFIG_TWL6030_INPUT
 CONFIG_TWL6030_POWER
 CONFIG_TWR
index 88ff093d05bed6f5da152dbbad8428eec219e4d7..1e0f1e9fce8b47b90094f9ef9f9067009de5d5ef 100644 (file)
@@ -435,7 +435,7 @@ static int fit_extract_data(struct image_tool_params *params, const char *fname)
        int image_number;
        int align_size;
 
-       align_size = params->bl_len ? params->bl_len : 4;
+       align_size = params->bl_len ? params->bl_len : 1;
        fd = mmap_fdt(params->cmdname, fname, 0, &fdt, &sbuf, false, false);
        if (fd < 0)
                return -EIO;
@@ -493,7 +493,6 @@ static int fit_extract_data(struct image_tool_params *params, const char *fname)
        fdt_pack(fdt);
 
        new_size = fdt_totalsize(fdt);
-       new_size = ALIGN(new_size, align_size);
        fdt_set_totalsize(fdt, new_size);
        debug("Size reduced from %x to %x\n", fit_size, fdt_totalsize(fdt));
        debug("External data size %x\n", buf_ptr);