Merge branch 'master' of git://git.denx.de/u-boot-socfpga
authorTom Rini <trini@konsulko.com>
Fri, 26 Apr 2019 17:49:58 +0000 (13:49 -0400)
committerTom Rini <trini@konsulko.com>
Fri, 26 Apr 2019 17:49:58 +0000 (13:49 -0400)
179 files changed:
MAINTAINERS
arch/arm/dts/Makefile
arch/arm/dts/meson-g12a-u200.dts [new file with mode: 0644]
arch/arm/dts/meson-g12a.dtsi [new file with mode: 0644]
arch/arm/dts/meson-gxbb-p200-u-boot.dtsi [new file with mode: 0644]
arch/arm/dts/meson-gxbb-p200.dts [new file with mode: 0644]
arch/arm/dts/meson-gxbb-p201-u-boot.dtsi [new file with mode: 0644]
arch/arm/dts/meson-gxbb-p201.dts [new file with mode: 0644]
arch/arm/dts/meson-gxbb-p20x.dtsi [new file with mode: 0644]
arch/arm/dts/meson-gxl-s805x-libretech-ac.dts [new file with mode: 0644]
arch/arm/dts/meson-gxl.dtsi
arch/arm/dts/stm32746g-eval-u-boot.dtsi [new file with mode: 0644]
arch/arm/dts/stm32746g-eval.dts
arch/arm/dts/stm32f4-pinctrl.dtsi
arch/arm/dts/stm32f429-disco-u-boot.dtsi
arch/arm/dts/stm32f429-disco.dts
arch/arm/dts/stm32f429-pinctrl.dtsi
arch/arm/dts/stm32f429.dtsi
arch/arm/dts/stm32f469-disco-u-boot.dtsi
arch/arm/dts/stm32f469-disco.dts
arch/arm/dts/stm32f469-pinctrl.dtsi
arch/arm/dts/stm32f469.dtsi [new file with mode: 0644]
arch/arm/dts/stm32f7-pinctrl.dtsi [new file with mode: 0644]
arch/arm/dts/stm32f7-u-boot.dtsi
arch/arm/dts/stm32f746-disco-u-boot.dtsi [new file with mode: 0644]
arch/arm/dts/stm32f746-disco.dts
arch/arm/dts/stm32f746-pinctrl.dtsi [new file with mode: 0644]
arch/arm/dts/stm32f746.dtsi
arch/arm/dts/stm32f769-disco-u-boot.dtsi [new file with mode: 0644]
arch/arm/dts/stm32f769-disco.dts
arch/arm/dts/stm32f769-pinctrl.dtsi [new file with mode: 0644]
arch/arm/dts/stm32h7-u-boot.dtsi
arch/arm/dts/stm32h743-pinctrl.dtsi
arch/arm/dts/stm32h743.dtsi
arch/arm/dts/stm32h743i-disco-u-boot.dtsi [new file with mode: 0644]
arch/arm/dts/stm32h743i-disco.dts
arch/arm/dts/stm32h743i-eval-u-boot.dtsi [new file with mode: 0644]
arch/arm/dts/stm32h743i-eval.dts
arch/arm/dts/stm32mp157c-ed1.dts
arch/arm/include/asm/arch-meson/clock-g12a.h [new file with mode: 0644]
arch/arm/include/asm/arch-meson/g12a.h [new file with mode: 0644]
arch/arm/mach-meson/Kconfig
arch/arm/mach-meson/Makefile
arch/arm/mach-meson/board-g12a.c [new file with mode: 0644]
arch/arm/mach-meson/board-info.c [new file with mode: 0644]
arch/arm/mach-mvebu/Kconfig
arch/arm/mach-mvebu/spl.c
arch/sandbox/cpu/os.c
arch/sandbox/cpu/start.c
arch/sandbox/include/asm/global_data.h
arch/sandbox/include/asm/test.h
board/amlogic/odroid-c2/MAINTAINERS [deleted file]
board/amlogic/odroid-c2/Makefile [deleted file]
board/amlogic/odroid-c2/README.nanopi-k2 [deleted file]
board/amlogic/odroid-c2/README.odroid-c2 [deleted file]
board/amlogic/odroid-c2/odroid-c2.c [deleted file]
board/amlogic/p200/MAINTAINERS [new file with mode: 0644]
board/amlogic/p200/Makefile [new file with mode: 0644]
board/amlogic/p200/README.nanopi-k2 [new file with mode: 0644]
board/amlogic/p200/README.odroid-c2 [new file with mode: 0644]
board/amlogic/p200/README.p200 [new file with mode: 0644]
board/amlogic/p200/p200.c [new file with mode: 0644]
board/amlogic/p201/MAINTAINERS [new file with mode: 0644]
board/amlogic/p201/Makefile [new file with mode: 0644]
board/amlogic/p201/README.p201 [new file with mode: 0644]
board/amlogic/p201/p201.c [new file with mode: 0644]
board/amlogic/p212/MAINTAINERS
board/amlogic/p212/README.libretech-ac [new file with mode: 0644]
board/amlogic/q200/README.khadas-vim2
board/amlogic/u200/MAINTAINERS [new file with mode: 0644]
board/amlogic/u200/Makefile [new file with mode: 0644]
board/amlogic/u200/README [new file with mode: 0644]
board/amlogic/u200/u200.c [new file with mode: 0644]
board/sandbox/README.sandbox
board/sandbox/sandbox.c
board/st/stm32f746-disco/stm32f746-disco.c
cmd/Kconfig
cmd/bootefi.c
cmd/efidebug.c
common/board_f.c
common/bootstage.c
common/command.c
common/image-fdt.c
configs/khadas-vim2_defconfig
configs/khadas-vim_defconfig
configs/libretech-ac_defconfig [new file with mode: 0644]
configs/libretech-cc_defconfig
configs/nanopi-k2_defconfig
configs/odroid-c2_defconfig
configs/p200_defconfig [new file with mode: 0644]
configs/p201_defconfig [new file with mode: 0644]
configs/p212_defconfig
configs/s400_defconfig
configs/sandbox_defconfig
configs/stm32f746-disco_defconfig
configs/u200_defconfig [new file with mode: 0644]
configs/vexpress_ca15_tc2_defconfig
configs/vexpress_ca9x4_defconfig
drivers/clk/Kconfig
drivers/clk/Makefile
drivers/clk/clk_meson.c [deleted file]
drivers/clk/clk_meson.h [deleted file]
drivers/clk/clk_meson_axg.c [deleted file]
drivers/clk/meson/Kconfig [new file with mode: 0644]
drivers/clk/meson/Makefile [new file with mode: 0644]
drivers/clk/meson/axg.c [new file with mode: 0644]
drivers/clk/meson/clk_meson.h [new file with mode: 0644]
drivers/clk/meson/g12a.c [new file with mode: 0644]
drivers/clk/meson/gxbb.c [new file with mode: 0644]
drivers/core/Kconfig
drivers/core/fdtaddr.c
drivers/core/root.c
drivers/core/simple-bus.c
drivers/i2c/meson_i2c.c
drivers/mmc/arm_pl180_mmci.c
drivers/mmc/arm_pl180_mmci.h
drivers/mmc/stm32_sdmmc2.c
drivers/net/sandbox.c
drivers/pinctrl/meson/Kconfig
drivers/pinctrl/meson/Makefile
drivers/pinctrl/meson/pinctrl-meson-axg.c
drivers/pinctrl/meson/pinctrl-meson-g12a.c [new file with mode: 0644]
drivers/pinctrl/meson/pinctrl-meson.c
drivers/pinctrl/meson/pinctrl-meson.h
drivers/pinctrl/pinctrl_stm32.c
drivers/reset/reset-meson.c
drivers/timer/sandbox_timer.c
include/asm-generic/global_data.h
include/configs/libretech-ac.h [new file with mode: 0644]
include/configs/sandbox.h
include/configs/stm32f746-disco.h
include/div64.h
include/dm/fdtaddr.h
include/dt-bindings/clock/g12a-aoclkc.h [new file with mode: 0644]
include/dt-bindings/clock/g12a-clkc.h [new file with mode: 0644]
include/dt-bindings/clock/stm32fx-clock.h
include/dt-bindings/gpio/meson-g12a-gpio.h [new file with mode: 0644]
include/dt-bindings/pinctrl/stm32f746-pinfunc.h [deleted file]
include/dt-bindings/pinctrl/stm32h7-pinfunc.h [deleted file]
include/dt-bindings/reset/amlogic,meson-g12a-reset.h [new file with mode: 0644]
include/dt-bindings/reset/g12a-aoclkc.h [new file with mode: 0644]
include/efi.h
include/efi_api.h
include/efi_loader.h
include/fdtdec.h
include/initcall.h
include/os.h
include/pci.h
include/regmap.h
include/time.h
lib/Kconfig
lib/div64.c
lib/efi/efi.c
lib/efi/efi_stub.c
lib/efi_loader/efi_bootmgr.c
lib/efi_loader/efi_boottime.c
lib/efi_loader/efi_device_path.c
lib/efi_loader/efi_disk.c
lib/efi_loader/efi_gop.c
lib/efi_loader/efi_image_loader.c
lib/efi_loader/efi_memory.c
lib/efi_loader/efi_net.c
lib/efi_loader/efi_root_node.c
lib/efi_loader/helloworld.c
lib/efi_selftest/Makefile
lib/efi_selftest/efi_selftest_bitblt.c
lib/efi_selftest/efi_selftest_block_device.c
lib/efi_selftest/efi_selftest_devicepath.c
lib/efi_selftest/efi_selftest_fdt.c
lib/efi_selftest/efi_selftest_gop.c
lib/efi_selftest/efi_selftest_loadimage.c
lib/efi_selftest/efi_selftest_miniapp_exit.c
lib/efi_selftest/efi_selftest_snp.c
lib/fdtdec.c
lib/trace.c
scripts/config_whitelist.txt
test/py/README.md
test/py/conftest.py
test/py/tests/test_efi_selftest.py

index d293cc6f7f3df3065bf6f48ea4c1d163a23ce0b5..8a7f0cc370884c100157654f1e1ddb9a33a201a8 100644 (file)
@@ -102,7 +102,7 @@ L:  u-boot-amlogic@groups.io
 T:     git git://git.denx.de/u-boot-amlogic.git
 F:     arch/arm/mach-meson/
 F:     arch/arm/include/asm/arch-meson/
-F:     drivers/clk/clk_meson*
+F:     drivers/clk/meson/
 F:     drivers/serial/serial_meson.c
 F:     drivers/reset/reset-meson.c
 F:     drivers/i2c/meson_i2c.c
index 5fe998914ad55ac10bce0c86a645d9624c9f543b..1452fd21898852d52ebb115742abe3999a31b159 100644 (file)
@@ -97,11 +97,15 @@ dtb-$(CONFIG_ARCH_MESON) += \
        meson-gxbb-nanopi-k2.dtb \
        meson-gxbb-odroidc2.dtb \
        meson-gxbb-nanopi-k2.dtb \
+       meson-gxbb-p200.dtb \
+       meson-gxbb-p201.dtb \
        meson-gxl-s905x-p212.dtb \
+       meson-gxl-s805x-libretech-ac.dtb \
        meson-gxl-s905x-libretech-cc.dtb \
        meson-gxl-s905x-khadas-vim.dtb \
        meson-gxm-khadas-vim2.dtb \
-       meson-axg-s400.dtb
+       meson-axg-s400.dtb \
+       meson-g12a-u200.dtb
 dtb-$(CONFIG_TEGRA) += tegra20-harmony.dtb \
        tegra20-medcom-wide.dtb \
        tegra20-paz00.dtb \
diff --git a/arch/arm/dts/meson-g12a-u200.dts b/arch/arm/dts/meson-g12a-u200.dts
new file mode 100644 (file)
index 0000000..c44dbdd
--- /dev/null
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2018 Amlogic, Inc. All rights reserved.
+ */
+
+/dts-v1/;
+
+#include "meson-g12a.dtsi"
+
+/ {
+       compatible = "amlogic,u200", "amlogic,g12a";
+       model = "Amlogic Meson G12A U200 Development Board";
+
+       aliases {
+               serial0 = &uart_AO;
+       };
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+       memory@0 {
+               device_type = "memory";
+               reg = <0x0 0x0 0x0 0x40000000>;
+       };
+};
+
+&uart_AO {
+       status = "okay";
+};
+
diff --git a/arch/arm/dts/meson-g12a.dtsi b/arch/arm/dts/meson-g12a.dtsi
new file mode 100644 (file)
index 0000000..17c6217
--- /dev/null
@@ -0,0 +1,192 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2018 Amlogic, Inc. All rights reserved.
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
+/ {
+       compatible = "amlogic,g12a";
+
+       interrupt-parent = <&gic>;
+       #address-cells = <2>;
+       #size-cells = <2>;
+
+       cpus {
+               #address-cells = <0x2>;
+               #size-cells = <0x0>;
+
+               cpu0: cpu@0 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a53";
+                       reg = <0x0 0x0>;
+                       enable-method = "psci";
+                       next-level-cache = <&l2>;
+               };
+
+               cpu1: cpu@1 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a53";
+                       reg = <0x0 0x1>;
+                       enable-method = "psci";
+                       next-level-cache = <&l2>;
+               };
+
+               cpu2: cpu@2 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a53";
+                       reg = <0x0 0x2>;
+                       enable-method = "psci";
+                       next-level-cache = <&l2>;
+               };
+
+               cpu3: cpu@3 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a53";
+                       reg = <0x0 0x3>;
+                       enable-method = "psci";
+                       next-level-cache = <&l2>;
+               };
+
+               l2: l2-cache0 {
+                       compatible = "cache";
+               };
+       };
+
+       psci {
+               compatible = "arm,psci-1.0";
+               method = "smc";
+       };
+
+       reserved-memory {
+               #address-cells = <2>;
+               #size-cells = <2>;
+               ranges;
+
+               /* 3 MiB reserved for ARM Trusted Firmware (BL31) */
+               secmon_reserved: secmon@5000000 {
+                       reg = <0x0 0x05000000 0x0 0x300000>;
+                       no-map;
+               };
+       };
+
+       soc {
+               compatible = "simple-bus";
+               #address-cells = <2>;
+               #size-cells = <2>;
+               ranges;
+
+               apb: bus@ff600000 {
+                       compatible = "simple-bus";
+                       reg = <0x0 0xff600000 0x0 0x200000>;
+                       #address-cells = <2>;
+                       #size-cells = <2>;
+                       ranges = <0x0 0x0 0x0 0xff600000 0x0 0x200000>;
+
+                       periphs: bus@34400 {
+                               compatible = "simple-bus";
+                               reg = <0x0 0x34400 0x0 0x400>;
+                               #address-cells = <2>;
+                               #size-cells = <2>;
+                               ranges = <0x0 0x0 0x0 0x34400 0x0 0x400>;
+                       };
+
+                       hiu: bus@3c000 {
+                               compatible = "simple-bus";
+                               reg = <0x0 0x3c000 0x0 0x1400>;
+                               #address-cells = <2>;
+                               #size-cells = <2>;
+                               ranges = <0x0 0x0 0x0 0x3c000 0x0 0x1400>;
+
+                               hhi: system-controller@0 {
+                                       compatible = "amlogic,meson-gx-hhi-sysctrl",
+                                                    "simple-mfd", "syscon";
+                                       reg = <0 0 0 0x400>;
+
+                                       clkc: clock-controller {
+                                               compatible = "amlogic,g12a-clkc";
+                                               #clock-cells = <1>;
+                                               clocks = <&xtal>;
+                                               clock-names = "xtal";
+                                       };
+                               };
+                       };
+               };
+
+               aobus: bus@ff800000 {
+                       compatible = "simple-bus";
+                       reg = <0x0 0xff800000 0x0 0x100000>;
+                       #address-cells = <2>;
+                       #size-cells = <2>;
+                       ranges = <0x0 0x0 0x0 0xff800000 0x0 0x100000>;
+
+                       uart_AO: serial@3000 {
+                               compatible = "amlogic,meson-gx-uart",
+                                            "amlogic,meson-ao-uart";
+                               reg = <0x0 0x3000 0x0 0x18>;
+                               interrupts = <GIC_SPI 193 IRQ_TYPE_EDGE_RISING>;
+                               clocks = <&xtal>, <&xtal>, <&xtal>;
+                               clock-names = "xtal", "pclk", "baud";
+                               status = "disabled";
+                       };
+
+                       uart_AO_B: serial@4000 {
+                               compatible = "amlogic,meson-gx-uart",
+                                            "amlogic,meson-ao-uart";
+                               reg = <0x0 0x4000 0x0 0x18>;
+                               interrupts = <GIC_SPI 197 IRQ_TYPE_EDGE_RISING>;
+                               clocks = <&xtal>, <&xtal>, <&xtal>;
+                               clock-names = "xtal", "pclk", "baud";
+                               status = "disabled";
+                       };
+               };
+
+               gic: interrupt-controller@ffc01000 {
+                       compatible = "arm,gic-400";
+                       reg = <0x0 0xffc01000 0 0x1000>,
+                             <0x0 0xffc02000 0 0x2000>,
+                             <0x0 0xffc04000 0 0x2000>,
+                             <0x0 0xffc06000 0 0x2000>;
+                       interrupt-controller;
+                       interrupts = <GIC_PPI 9
+                               (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_HIGH)>;
+                       #interrupt-cells = <3>;
+                       #address-cells = <0>;
+               };
+
+               cbus: bus@ffd00000 {
+                       compatible = "simple-bus";
+                       reg = <0x0 0xffd00000 0x0 0x100000>;
+                       #address-cells = <2>;
+                       #size-cells = <2>;
+                       ranges = <0x0 0x0 0x0 0xffd00000 0x0 0x100000>;
+
+                       clk_msr: clock-measure@18000 {
+                               compatible = "amlogic,meson-g12a-clk-measure";
+                               reg = <0x0 0x18000 0x0 0x10>;
+                       };
+               };
+       };
+
+       timer {
+               compatible = "arm,armv8-timer";
+               interrupts = <GIC_PPI 13
+                       (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>,
+                            <GIC_PPI 14
+                       (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>,
+                            <GIC_PPI 11
+                       (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>,
+                            <GIC_PPI 10
+                       (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>;
+       };
+
+       xtal: xtal-clk {
+               compatible = "fixed-clock";
+               clock-frequency = <24000000>;
+               clock-output-names = "xtal";
+               #clock-cells = <0>;
+       };
+
+};
diff --git a/arch/arm/dts/meson-gxbb-p200-u-boot.dtsi b/arch/arm/dts/meson-gxbb-p200-u-boot.dtsi
new file mode 100644 (file)
index 0000000..c35158d
--- /dev/null
@@ -0,0 +1,7 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre, SAS.
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#include "meson-gx-u-boot.dtsi"
diff --git a/arch/arm/dts/meson-gxbb-p200.dts b/arch/arm/dts/meson-gxbb-p200.dts
new file mode 100644 (file)
index 0000000..9d2406a
--- /dev/null
@@ -0,0 +1,99 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2016 Andreas Färber
+ * Copyright (c) 2016 BayLibre, Inc.
+ * Author: Kevin Hilman <khilman@kernel.org>
+ */
+
+/dts-v1/;
+
+#include "meson-gxbb-p20x.dtsi"
+#include <dt-bindings/input/input.h>
+
+/ {
+       compatible = "amlogic,p200", "amlogic,meson-gxbb";
+       model = "Amlogic Meson GXBB P200 Development Board";
+
+       avdd18_usb_adc: regulator-avdd18_usb_adc {
+               compatible = "regulator-fixed";
+               regulator-name = "AVDD18_USB_ADC";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+       };
+
+       adc_keys {
+               compatible = "adc-keys";
+               io-channels = <&saradc 0>;
+               io-channel-names = "buttons";
+               keyup-threshold-microvolt = <1800000>;
+
+               button-home {
+                       label = "Home";
+                       linux,code = <KEY_HOME>;
+                       press-threshold-microvolt = <900000>; /* 50% */
+               };
+
+               button-esc {
+                       label = "Esc";
+                       linux,code = <KEY_ESC>;
+                       press-threshold-microvolt = <684000>; /* 38% */
+               };
+
+               button-up {
+                       label = "Volume Up";
+                       linux,code = <KEY_VOLUMEUP>;
+                       press-threshold-microvolt = <468000>; /* 26% */
+               };
+
+               button-down {
+                       label = "Volume Down";
+                       linux,code = <KEY_VOLUMEDOWN>;
+                       press-threshold-microvolt = <252000>; /* 14% */
+               };
+
+               button-menu {
+                       label = "Menu";
+                       linux,code = <KEY_MENU>;
+                       press-threshold-microvolt = <0>; /* 0% */
+               };
+       };
+};
+
+&ethmac {
+       status = "okay";
+       pinctrl-0 = <&eth_rgmii_pins>;
+       pinctrl-names = "default";
+       phy-handle = <&eth_phy0>;
+       phy-mode = "rgmii";
+
+       amlogic,tx-delay-ns = <2>;
+
+       snps,reset-gpio = <&gpio GPIOZ_14 0>;
+       snps,reset-delays-us = <0 10000 1000000>;
+       snps,reset-active-low;
+
+       mdio {
+               compatible = "snps,dwmac-mdio";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               eth_phy0: ethernet-phy@3 {
+                       /* Micrel KSZ9031 (0x00221620) */
+                       reg = <3>;
+                       interrupt-parent = <&gpio_intc>;
+                       /* MAC_INTR on GPIOZ_15 */
+                       interrupts = <29 IRQ_TYPE_LEVEL_LOW>;
+               };
+       };
+};
+
+&i2c_B {
+       status = "okay";
+       pinctrl-0 = <&i2c_b_pins>;
+       pinctrl-names = "default";
+};
+
+&saradc {
+       status = "okay";
+       vref-supply = <&avdd18_usb_adc>;
+};
diff --git a/arch/arm/dts/meson-gxbb-p201-u-boot.dtsi b/arch/arm/dts/meson-gxbb-p201-u-boot.dtsi
new file mode 100644 (file)
index 0000000..c35158d
--- /dev/null
@@ -0,0 +1,7 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre, SAS.
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#include "meson-gx-u-boot.dtsi"
diff --git a/arch/arm/dts/meson-gxbb-p201.dts b/arch/arm/dts/meson-gxbb-p201.dts
new file mode 100644 (file)
index 0000000..56e0dd1
--- /dev/null
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2016 Andreas Färber
+ * Copyright (c) 2016 BayLibre, Inc.
+ * Author: Kevin Hilman <khilman@kernel.org>
+ */
+
+/dts-v1/;
+
+#include "meson-gxbb-p20x.dtsi"
+
+/ {
+       compatible = "amlogic,p201", "amlogic,meson-gxbb";
+       model = "Amlogic Meson GXBB P201 Development Board";
+};
+
+&ethmac {
+       status = "okay";
+       pinctrl-0 = <&eth_rmii_pins>;
+       pinctrl-names = "default";
+       phy-mode = "rmii";
+
+       snps,reset-gpio = <&gpio GPIOZ_14 0>;
+       snps,reset-delays-us = <0 10000 1000000>;
+       snps,reset-active-low;
+};
diff --git a/arch/arm/dts/meson-gxbb-p20x.dtsi b/arch/arm/dts/meson-gxbb-p20x.dtsi
new file mode 100644 (file)
index 0000000..0be0f2a
--- /dev/null
@@ -0,0 +1,247 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2016 Andreas Färber
+ * Copyright (c) 2016 BayLibre, Inc.
+ * Author: Kevin Hilman <khilman@kernel.org>
+ */
+
+#include "meson-gxbb.dtsi"
+
+/ {
+       aliases {
+               serial0 = &uart_AO;
+               ethernet0 = &ethmac;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       memory@0 {
+               device_type = "memory";
+               reg = <0x0 0x0 0x0 0x40000000>;
+       };
+
+       usb_pwr: regulator-usb-pwrs {
+               compatible = "regulator-fixed";
+
+               regulator-name = "USB_PWR";
+
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+
+               /* signal name in schematic: USB_PWR_EN */
+               gpio = <&gpio GPIODV_24 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       vddio_card: gpio-regulator {
+               compatible = "regulator-gpio";
+
+               regulator-name = "VDDIO_CARD";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <3300000>;
+
+               gpios = <&gpio_ao GPIOAO_5 GPIO_ACTIVE_HIGH>;
+               gpios-states = <1>;
+
+               /* Based on P200 schematics, signal CARD_1.8V/3.3V_CTR */
+               states = <1800000 0
+                         3300000 1>;
+
+               regulator-settling-time-up-us = <10000>;
+               regulator-settling-time-down-us = <150000>;
+       };
+
+       vddio_boot: regulator-vddio_boot {
+               compatible = "regulator-fixed";
+               regulator-name = "VDDIO_BOOT";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+       };
+
+       vddao_3v3: regulator-vddao_3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "VDDAO_3V3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+       };
+
+       vcc_3v3: regulator-vcc_3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "VCC_3V3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+       };
+
+       emmc_pwrseq: emmc-pwrseq {
+               compatible = "mmc-pwrseq-emmc";
+               reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
+       };
+
+       wifi32k: wifi32k {
+               compatible = "pwm-clock";
+               #clock-cells = <0>;
+               clock-frequency = <32768>;
+               pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
+       };
+
+       sdio_pwrseq: sdio-pwrseq {
+               compatible = "mmc-pwrseq-simple";
+               reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
+               clocks = <&wifi32k>;
+               clock-names = "ext_clock";
+       };
+
+       cvbs_connector: cvbs-connector {
+               compatible = "composite-video-connector";
+
+               port {
+                       cvbs_connector_in: endpoint {
+                               remote-endpoint = <&cvbs_vdac_out>;
+                       };
+               };
+       };
+
+       hdmi-connector {
+               compatible = "hdmi-connector";
+               type = "a";
+
+               port {
+                       hdmi_connector_in: endpoint {
+                               remote-endpoint = <&hdmi_tx_tmds_out>;
+                       };
+               };
+       };
+};
+
+&cec_AO {
+       status = "okay";
+       pinctrl-0 = <&ao_cec_pins>;
+       pinctrl-names = "default";
+       hdmi-phandle = <&hdmi_tx>;
+};
+
+&cvbs_vdac_port {
+       cvbs_vdac_out: endpoint {
+               remote-endpoint = <&cvbs_connector_in>;
+       };
+};
+
+&hdmi_tx {
+       status = "okay";
+       pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
+       pinctrl-names = "default";
+};
+
+&hdmi_tx_tmds_port {
+       hdmi_tx_tmds_out: endpoint {
+               remote-endpoint = <&hdmi_connector_in>;
+       };
+};
+
+&ir {
+       status = "okay";
+       pinctrl-0 = <&remote_input_ao_pins>;
+       pinctrl-names = "default";
+};
+
+&pwm_ef {
+       status = "okay";
+       pinctrl-0 = <&pwm_e_pins>;
+       pinctrl-names = "default";
+       clocks = <&clkc CLKID_FCLK_DIV4>;
+       clock-names = "clkin0";
+};
+
+/* Wireless SDIO Module */
+&sd_emmc_a {
+       status = "okay";
+       pinctrl-0 = <&sdio_pins>;
+       pinctrl-1 = <&sdio_clk_gate_pins>;
+       pinctrl-names = "default", "clk-gate";
+       #address-cells = <1>;
+       #size-cells = <0>;
+
+       bus-width = <4>;
+       cap-sd-highspeed;
+       max-frequency = <100000000>;
+
+       non-removable;
+       disable-wp;
+
+       mmc-pwrseq = <&sdio_pwrseq>;
+
+       vmmc-supply = <&vddao_3v3>;
+       vqmmc-supply = <&vddio_boot>;
+
+       brcmf: wifi@1 {
+               reg = <1>;
+               compatible = "brcm,bcm4329-fmac";
+       };
+};
+
+/* SD card */
+&sd_emmc_b {
+       status = "okay";
+       pinctrl-0 = <&sdcard_pins>;
+       pinctrl-1 = <&sdcard_clk_gate_pins>;
+       pinctrl-names = "default", "clk-gate";
+
+       bus-width = <4>;
+       cap-sd-highspeed;
+       sd-uhs-sdr12;
+       sd-uhs-sdr25;
+       sd-uhs-sdr50;
+       max-frequency = <100000000>;
+       disable-wp;
+
+       cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>;
+
+       vmmc-supply = <&vddao_3v3>;
+       vqmmc-supply = <&vddio_card>;
+};
+
+/* eMMC */
+&sd_emmc_c {
+       status = "okay";
+       pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
+       pinctrl-1 = <&emmc_clk_gate_pins>;
+       pinctrl-names = "default", "clk-gate";
+
+       bus-width = <8>;
+       cap-mmc-highspeed;
+       max-frequency = <200000000>;
+       non-removable;
+       disable-wp;
+       mmc-ddr-1_8v;
+       mmc-hs200-1_8v;
+
+       mmc-pwrseq = <&emmc_pwrseq>;
+       vmmc-supply = <&vcc_3v3>;
+       vqmmc-supply = <&vddio_boot>;
+};
+
+/* This UART is brought out to the DB9 connector */
+&uart_AO {
+       status = "okay";
+       pinctrl-0 = <&uart_ao_a_pins>;
+       pinctrl-names = "default";
+};
+
+&usb0_phy {
+       status = "okay";
+       phy-supply = <&usb_pwr>;
+};
+
+&usb1_phy {
+       status = "okay";
+};
+
+&usb0 {
+       status = "okay";
+};
+
+&usb1 {
+       status = "okay";
+};
diff --git a/arch/arm/dts/meson-gxl-s805x-libretech-ac.dts b/arch/arm/dts/meson-gxl-s805x-libretech-ac.dts
new file mode 100644 (file)
index 0000000..82b1c48
--- /dev/null
@@ -0,0 +1,248 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2018 BayLibre, SAS.
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ * Author: Jerome Brunet <jbrunet@baylibre.com>
+ */
+
+/dts-v1/;
+
+#include <dt-bindings/input/input.h>
+
+#include "meson-gxl-s905x.dtsi"
+
+/ {
+       compatible = "libretech,aml-s805x-ac", "amlogic,s805x",
+                    "amlogic,meson-gxl";
+       model = "Libre Computer Board AML-S805X-AC";
+
+       aliases {
+               serial0 = &uart_AO;
+               ethernet0 = &ethmac;
+               spi0 = &spifc;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       cvbs-connector {
+               /*
+                * The pads are present but no connector is soldered on
+                * 2J2, so keep this off by default.
+                */
+               status = "disabled";
+               compatible = "composite-video-connector";
+
+               port {
+                       cvbs_connector_in: endpoint {
+                               remote-endpoint = <&cvbs_vdac_out>;
+                       };
+               };
+       };
+
+       dc_5v: regulator-dc_5v {
+               compatible = "regulator-fixed";
+               regulator-name = "DC_5V";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-always-on;
+       };
+
+       emmc_pwrseq: emmc-pwrseq {
+               compatible = "mmc-pwrseq-emmc";
+               reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
+       };
+
+       hdmi-connector {
+               compatible = "hdmi-connector";
+               type = "a";
+
+               port {
+                       hdmi_connector_in: endpoint {
+                               remote-endpoint = <&hdmi_tx_tmds_out>;
+                       };
+               };
+       };
+
+       memory@0 {
+               device_type = "memory";
+               reg = <0x0 0x0 0x0 0x20000000>;
+       };
+
+       vcck: regulator-vcck {
+               compatible = "regulator-fixed";
+               regulator-name = "VCCK";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               vin-supply = <&dc_5v>;
+
+               /*
+                * This is controlled by GPIOAO_9 we reserve this but
+                * claiming it as done below reset the board anyway
+                * Need to investigate this
+                *
+                * gpio = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
+                * enable-active-high;
+                */
+               regulator-always-on;
+       };
+
+       vcc_3v3: regulator-vcc_3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "VCC_3V3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               vin-supply = <&dc_5v>;
+               regulator-always-on;
+       };
+
+       vddio_boot: regulator-vddio_boot {
+               compatible = "regulator-fixed";
+               regulator-name = "VDDIO_BOOT";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               vin-supply = <&vcc_3v3>;
+               regulator-always-on;
+       };
+};
+
+&cec_AO {
+       status = "okay";
+       pinctrl-0 = <&ao_cec_pins>;
+       pinctrl-names = "default";
+       hdmi-phandle = <&hdmi_tx>;
+};
+
+&cvbs_vdac_port {
+       cvbs_vdac_out: endpoint {
+               remote-endpoint = <&cvbs_connector_in>;
+       };
+};
+
+&ethmac {
+       status = "okay";
+};
+
+&internal_phy {
+       pinctrl-0 = <&eth_link_led_pins>, <&eth_act_led_pins>;
+       pinctrl-names = "default";
+};
+
+&ir {
+       status = "okay";
+       pinctrl-0 = <&remote_input_ao_pins>;
+       pinctrl-names = "default";
+};
+
+&hdmi_tx {
+       status = "okay";
+       pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
+       pinctrl-names = "default";
+};
+
+&hdmi_tx_tmds_port {
+       hdmi_tx_tmds_out: endpoint {
+               remote-endpoint = <&hdmi_connector_in>;
+       };
+};
+
+&gpio_ao {
+       gpio-line-names = "UART TX",
+                         "UART RX",
+                         "7J1 Header Pin31",
+                         "", "", "", "",
+                         "IR In",
+                         "HDMI CEC",
+                         "5V VCCK Regulator",
+                         /* GPIO_TEST_N */
+                         "";
+};
+
+&gpio {
+       gpio-line-names = /* Bank GPIOZ */
+                         "", "", "", "", "", "", "",
+                         "", "", "", "", "", "", "",
+                         "Eth Link LED", "Eth Activity LED",
+                         /* Bank GPIOH */
+                         "HDMI HPD", "HDMI SDA", "HDMI SCL",
+                         "", "7J1 Header Pin13",
+                         "7J1 Header Pin15",
+                         "7J1 Header Pin7",
+                         "7J1 Header Pin12",
+                         "7J1 Header Pin16",
+                         "7J1 Header Pin18",
+                         /* Bank BOOT */
+                         "eMMC D0", "eMMC D1", "eMMC D2", "eMMC D3",
+                         "eMMC D4", "eMMC D5", "eMMC D6", "eMMC D7",
+                         "eMMC Clk", "eMMC Reset", "eMMC CMD",
+                         "SPI NOR MOSI", "SPI NOR MISO", "SPI NOR Clk",
+                         "", "SPI NOR Chip Select",
+                         /* Bank CARD */
+                         "", "", "", "", "", "", "",
+                         /* Bank GPIODV */
+                         "", "", "", "", "", "", "", "", "", "", "", "",
+                         "", "", "", "", "", "", "", "", "", "", "", "",
+                         "7J1 Header Pin27", "7J1 Header Pin28", "",
+                         "7J1 Header Pin29",
+                         "VCCK Regulator", "VDDEE Regulator",
+                         /* Bank GPIOX */
+                         "7J1 Header Pin22", "7J1 Header Pin26",
+                         "7J1 Header Pin36", "7J1 Header Pin38",
+                         "7J1 Header Pin40", "7J1 Header Pin37",
+                         "7J1 Header Pin33", "7J1 Header Pin35",
+                         "7J1 Header Pin19", "7J1 Header Pin21",
+                         "7J1 Header Pin24", "7J1 Header Pin23",
+                         "7J1 Header Pin8", "7J1 Header Pin10",
+                         "", "", "7J1 Header Pin32", "", "",
+                         /* Bank GPIOCLK */
+                         "", "";
+};
+
+&saradc {
+       status = "okay";
+       vref-supply = <&vddio_boot>;
+};
+
+/* eMMC */
+&sd_emmc_c {
+       status = "okay";
+       pinctrl-0 = <&emmc_pins>;
+       pinctrl-1 = <&emmc_clk_gate_pins>;
+       pinctrl-names = "default", "clk-gate";
+
+       bus-width = <8>;
+       cap-mmc-highspeed;
+       mmc-ddr-1_8v;
+       mmc-hs200-1_8v;
+       max-frequency = <200000000>;
+       disable-wp;
+
+       mmc-pwrseq = <&emmc_pwrseq>;
+       vmmc-supply = <&vcc_3v3>;
+       vqmmc-supply = <&vddio_boot>;
+};
+
+&spifc {
+       status = "okay";
+       pinctrl-0 = <&nor_pins>;
+       pinctrl-names = "default";
+
+       w25q32: spi-flash@0 {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <3000000>;
+       };
+};
+
+&uart_AO {
+       status = "okay";
+       pinctrl-0 = <&uart_ao_a_pins>;
+       pinctrl-names = "default";
+};
+
+&usb0 {
+       status = "okay";
+};
index 8f0bb3c44bd6d05a11e6dea2ed390f0c88bdc9cc..d5c3d78aafeb5d97d69eb5cd788f1957a8c2538b 100644 (file)
        };
 };
 
+&efuse {
+       clocks = <&clkc CLKID_EFUSE>;
+};
+
 &ethmac {
        reg = <0x0 0xc9410000 0x0 0x10000
               0x0 0xc8834540 0x0 0x4>;
                        mux {
                                groups = "uart_tx_ao_a", "uart_rx_ao_a";
                                function = "uart_ao";
+                               bias-disable;
                        };
                };
 
                                groups = "uart_cts_ao_a",
                                       "uart_rts_ao_a";
                                function = "uart_ao";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "uart_tx_ao_b", "uart_rx_ao_b";
                                function = "uart_ao_b";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "uart_tx_ao_b_0", "uart_rx_ao_b_1";
                                function = "uart_ao_b";
+                               bias-disable;
                        };
                };
 
                                groups = "uart_cts_ao_b",
                                       "uart_rts_ao_b";
                                function = "uart_ao_b";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "remote_input_ao";
                                function = "remote_input_ao";
+                               bias-disable;
                        };
                };
 
                                groups = "i2c_sck_ao",
                                       "i2c_sda_ao";
                                function = "i2c_ao";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "pwm_ao_a_3";
                                function = "pwm_ao_a";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "pwm_ao_a_8";
                                function = "pwm_ao_a";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "pwm_ao_b";
                                function = "pwm_ao_b";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "pwm_ao_b_6";
                                function = "pwm_ao_b";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "i2s_out_ch23_ao";
                                function = "i2s_out_ao";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "i2s_out_ch45_ao";
                                function = "i2s_out_ao";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "spdif_out_ao_6";
                                function = "spdif_out_ao";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "spdif_out_ao_9";
                                function = "spdif_out_ao";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "ao_cec";
                                function = "cec_ao";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "ee_cec";
                                function = "cec_ao";
+                               bias-disable;
                        };
                };
        };
 
 &clkc_AO {
        compatible = "amlogic,meson-gxl-aoclkc", "amlogic,meson-gx-aoclkc";
+       clocks = <&xtal>, <&clkc CLKID_CLK81>;
+       clock-names = "xtal", "mpeg-clk";
 };
 
 &gpio_intc {
        clkc: clock-controller {
                compatible = "amlogic,gxl-clkc";
                #clock-cells = <1>;
+               clocks = <&xtal>;
+               clock-names = "xtal";
        };
 };
 
                                       "emmc_cmd",
                                       "emmc_clk";
                                function = "emmc";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "emmc_ds";
                                function = "emmc";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "BOOT_8";
                                function = "gpio_periphs";
-                       };
-                       cfg-pull-down {
-                               pins = "BOOT_8";
                                bias-pull-down;
                        };
                };
                                       "nor_c",
                                       "nor_cs";
                                function = "nor";
+                               bias-disable;
                        };
                };
 
                                        "spi_mosi",
                                        "spi_sclk";
                                function = "spi";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "spi_ss0";
                                function = "spi";
+                               bias-disable;
                        };
                };
 
                                       "sdcard_cmd",
                                       "sdcard_clk";
                                function = "sdcard";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "CARD_2";
                                function = "gpio_periphs";
-                       };
-                       cfg-pull-down {
-                               pins = "CARD_2";
                                bias-pull-down;
                        };
                };
                                       "sdio_cmd",
                                       "sdio_clk";
                                function = "sdio";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "GPIOX_4";
                                function = "gpio_periphs";
-                       };
-                       cfg-pull-down {
-                               pins = "GPIOX_4";
                                bias-pull-down;
                        };
                };
                        mux {
                                groups = "sdio_irq";
                                function = "sdio";
+                               bias-disable;
                        };
                };
 
                                groups = "uart_tx_a",
                                       "uart_rx_a";
                                function = "uart_a";
+                               bias-disable;
                        };
                };
 
                                groups = "uart_cts_a",
                                       "uart_rts_a";
                                function = "uart_a";
+                               bias-disable;
                        };
                };
 
                                groups = "uart_tx_b",
                                       "uart_rx_b";
                                function = "uart_b";
+                               bias-disable;
                        };
                };
 
                                groups = "uart_cts_b",
                                       "uart_rts_b";
                                function = "uart_b";
+                               bias-disable;
                        };
                };
 
                                groups = "uart_tx_c",
                                       "uart_rx_c";
                                function = "uart_c";
+                               bias-disable;
                        };
                };
 
                                groups = "uart_cts_c",
                                       "uart_rts_c";
                                function = "uart_c";
+                               bias-disable;
                        };
                };
 
                                groups = "i2c_sck_a",
                                     "i2c_sda_a";
                                function = "i2c_a";
+                               bias-disable;
                        };
                };
 
                                groups = "i2c_sck_b",
                                      "i2c_sda_b";
                                function = "i2c_b";
+                               bias-disable;
                        };
                };
 
                                groups = "i2c_sck_c",
                                      "i2c_sda_c";
                                function = "i2c_c";
+                               bias-disable;
                        };
                };
 
                                       "eth_txd2",
                                       "eth_txd3";
                                function = "eth";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "eth_link_led";
                                function = "eth_led";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "pwm_a";
                                function = "pwm_a";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "pwm_b";
                                function = "pwm_b";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "pwm_c";
                                function = "pwm_c";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "pwm_d";
                                function = "pwm_d";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "pwm_e";
                                function = "pwm_e";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "pwm_f_clk";
                                function = "pwm_f";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "pwm_f_x";
                                function = "pwm_f";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "hdmi_hpd";
                                function = "hdmi_hpd";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "hdmi_sda", "hdmi_scl";
                                function = "hdmi_i2c";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "i2s_am_clk";
                                function = "i2s_out";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "i2s_out_ao_clk";
                                function = "i2s_out";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "i2s_out_lr_clk";
                                function = "i2s_out";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "i2s_out_ch01";
                                function = "i2s_out";
+                               bias-disable;
                        };
                };
                i2sout_ch23_z_pins: i2sout_ch23_z {
                        mux {
                                groups = "i2sout_ch23_z";
                                function = "i2s_out";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "i2sout_ch45_z";
                                function = "i2s_out";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "i2sout_ch67_z";
                                function = "i2s_out";
+                               bias-disable;
                        };
                };
 
                        mux {
                                groups = "spdif_out_h";
                                function = "spdif_out";
+                               bias-disable;
                        };
                };
        };
diff --git a/arch/arm/dts/stm32746g-eval-u-boot.dtsi b/arch/arm/dts/stm32746g-eval-u-boot.dtsi
new file mode 100644 (file)
index 0000000..9b55bb7
--- /dev/null
@@ -0,0 +1,188 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include <stm32f7-u-boot.dtsi>
+/{
+       chosen {
+               bootargs = "root=/dev/mmcblk0p1 rw rootwait";
+       };
+
+       aliases {
+               /* Aliases for gpios so as to use sequence */
+               gpio0 = &gpioa;
+               gpio1 = &gpiob;
+               gpio2 = &gpioc;
+               gpio3 = &gpiod;
+               gpio4 = &gpioe;
+               gpio5 = &gpiof;
+               gpio6 = &gpiog;
+               gpio7 = &gpioh;
+               gpio8 = &gpioi;
+               gpio9 = &gpioj;
+               gpio10 = &gpiok;
+               mmc0 = &sdio1;
+               spi0 = &qspi;
+       };
+
+       button1 {
+               compatible = "st,button1";
+               button-gpio = <&gpioc 13 0>;
+       };
+
+       led1 {
+               compatible = "st,led1";
+               led-gpio = <&gpiof 10 0>;
+       };
+};
+
+&fmc {
+       /*
+        * Memory configuration from sdram datasheet IS42S32800G-6BLI
+        */
+       bank1: bank@0 {
+               u-boot,dm-pre-reloc;
+               st,sdram-control = /bits/ 8 <NO_COL_9
+                                            NO_ROW_12
+                                            MWIDTH_32
+                                            BANKS_4
+                                            CAS_2
+                                            SDCLK_3
+                                            RD_BURST_EN
+                                            RD_PIPE_DL_0>;
+               st,sdram-timing = /bits/ 8 <TMRD_1
+                                           TXSR_1
+                                           TRAS_1
+                                           TRC_6
+                                           TRP_2
+                                           TWR_1
+                                           TRCD_1>;
+               st,sdram-refcount = <1539>;
+       };
+};
+
+&mac {
+       phy-mode = "mii";
+};
+
+&pinctrl {
+       ethernet_mii: mii@0 {
+               pins {
+                       pinmux = <STM32_PINMUX('A', 0, AF11)>, /*ETH_MII_CRS */
+                                <STM32_PINMUX('A', 1, AF11)>, /*ETH_MII_RX_CLK */
+                                <STM32_PINMUX('A', 7, AF11)>, /*ETH_MII_RX_DV */
+                                <STM32_PINMUX('A', 8, AF0)>, /*ETH_MII_MCO1 */
+                                <STM32_PINMUX('G',13, AF11)>, /*ETH_MII_TXD0 */
+                                <STM32_PINMUX('G',14, AF11)>, /*ETH_MII_TXD1 */
+                                <STM32_PINMUX('C', 2, AF11)>, /*ETH_MII_TXD2 */
+                                <STM32_PINMUX('E', 2, AF11)>, /*ETH_MII_TXD3 */
+                                <STM32_PINMUX('C', 3, AF11)>, /*ETH_MII_TX_CLK */
+                                <STM32_PINMUX('C', 4, AF11)>, /*ETH_MII_RXD0 */
+                                <STM32_PINMUX('C', 5, AF11)>, /*ETH_MII_RXD1 */
+                                <STM32_PINMUX('H', 6, AF11)>, /*ETH_MII_RXD2 */
+                                <STM32_PINMUX('H', 7, AF11)>, /*ETH_MII_RXD3 */
+                                <STM32_PINMUX('G',11, AF11)>, /*ETH_MII_TX_EN */
+                                <STM32_PINMUX('C', 1, AF11)>, /*ETH_MII_MDC */
+                                <STM32_PINMUX('A', 2, AF11)>; /*ETH_MII_MDIO */
+                       slew-rate = <2>;
+               };
+       };
+
+       fmc_pins: fmc@0 {
+               pins {
+                       pinmux = <STM32_PINMUX('I',10, AF12)>, /* D31 */
+                                <STM32_PINMUX('I', 9, AF12)>, /* D30 */
+                                <STM32_PINMUX('I', 7, AF12)>, /* D29 */
+                                <STM32_PINMUX('I', 6, AF12)>, /* D28 */
+                                <STM32_PINMUX('I', 3, AF12)>, /* D27 */
+                                <STM32_PINMUX('I', 2, AF12)>, /* D26 */
+                                <STM32_PINMUX('I', 1, AF12)>, /* D25 */
+                                <STM32_PINMUX('I', 0, AF12)>, /* D24 */
+                                <STM32_PINMUX('H',15, AF12)>, /* D23 */
+                                <STM32_PINMUX('H',14, AF12)>, /* D22 */
+                                <STM32_PINMUX('H',13, AF12)>, /* D21 */
+                                <STM32_PINMUX('H',12, AF12)>, /* D20 */
+                                <STM32_PINMUX('H',11, AF12)>, /* D19 */
+                                <STM32_PINMUX('H',10, AF12)>, /* D18 */
+                                <STM32_PINMUX('H', 9, AF12)>, /* D17 */
+                                <STM32_PINMUX('H', 8, AF12)>, /* D16 */
+
+                                <STM32_PINMUX('D',10, AF12)>, /* D15 */
+                                <STM32_PINMUX('D', 9, AF12)>, /* D14 */
+                                <STM32_PINMUX('D', 8, AF12)>, /* D13 */
+                                <STM32_PINMUX('E',15, AF12)>, /* D12 */
+                                <STM32_PINMUX('E',14, AF12)>, /* D11 */
+                                <STM32_PINMUX('E',13, AF12)>, /* D10 */
+                                <STM32_PINMUX('E',12, AF12)>, /* D9 */
+                                <STM32_PINMUX('E',11, AF12)>, /* D8 */
+                                <STM32_PINMUX('E',10, AF12)>, /* D7 */
+                                <STM32_PINMUX('E', 9, AF12)>, /* D6 */
+                                <STM32_PINMUX('E', 8, AF12)>, /* D5 */
+                                <STM32_PINMUX('E', 7, AF12)>, /* D4 */
+                                <STM32_PINMUX('D', 1, AF12)>, /* D3 */
+                                <STM32_PINMUX('D', 0, AF12)>, /* D2 */
+                                <STM32_PINMUX('D',15, AF12)>, /* D1 */
+                                <STM32_PINMUX('D',14, AF12)>, /* D0 */
+
+                                <STM32_PINMUX('I', 5, AF12)>, /* NBL3 */
+                                <STM32_PINMUX('I', 4, AF12)>, /* NBL2 */
+                                <STM32_PINMUX('E', 1, AF12)>, /* NBL1 */
+                                <STM32_PINMUX('E', 0, AF12)>, /* NBL0 */
+
+                                <STM32_PINMUX('G', 5, AF12)>, /* BA1 */
+                                <STM32_PINMUX('G', 4, AF12)>, /* BA0 */
+
+                                <STM32_PINMUX('G', 1, AF12)>, /* A11 */
+                                <STM32_PINMUX('G', 0, AF12)>, /* A10 */
+                                <STM32_PINMUX('F',15, AF12)>, /* A9 */
+                                <STM32_PINMUX('F',14, AF12)>, /* A8 */
+                                <STM32_PINMUX('F',13, AF12)>, /* A7 */
+                                <STM32_PINMUX('F',12, AF12)>, /* A6 */
+                                <STM32_PINMUX('F', 5, AF12)>, /* A5 */
+                                <STM32_PINMUX('F', 4, AF12)>, /* A4 */
+                                <STM32_PINMUX('F', 3, AF12)>, /* A3 */
+                                <STM32_PINMUX('F', 2, AF12)>, /* A2 */
+                                <STM32_PINMUX('F', 1, AF12)>, /* A1 */
+                                <STM32_PINMUX('F', 0, AF12)>, /* A0 */
+
+                                <STM32_PINMUX('H', 3, AF12)>, /* SDNE0 */
+                                <STM32_PINMUX('H', 5, AF12)>, /* SDNWE */
+                                <STM32_PINMUX('F',11, AF12)>, /* SDNRAS */
+                                <STM32_PINMUX('G',15, AF12)>, /* SDNCAS */
+                                <STM32_PINMUX('C', 3, AF12)>, /* SDCKE0 */
+                                <STM32_PINMUX('G', 8, AF12)>; /* SDCLK> */
+                       slew-rate = <2>;
+               };
+       };
+
+       qspi_pins: qspi@0 {
+               pins {
+                       pinmux = <STM32_PINMUX('B', 2, AF9)>, /* _FUNC_QUADSPI_CLK */
+                                <STM32_PINMUX('B', 6, AF10)>, /*_FUNC_QUADSPI_BK1_NCS */
+                                <STM32_PINMUX('F', 8, AF10)>, /* _FUNC_QUADSPI_BK1_IO0 */
+                                <STM32_PINMUX('F', 9, AF10)>, /* _FUNC_QUADSPI_BK1_IO1 */
+                                <STM32_PINMUX('F', 6, AF9)>, /* AF_FUNC_QUADSPI_BK1_IO3 */
+                                <STM32_PINMUX('F', 7, AF9)>; /* _FUNC_QUADSPI_BK1_IO2 */
+                       slew-rate = <2>;
+               };
+       };
+
+       usart1_pins_a: usart1@0 {
+               u-boot,dm-pre-reloc;
+               pins1 {
+                       u-boot,dm-pre-reloc;
+               };
+               pins2 {
+                       u-boot,dm-pre-reloc;
+               };
+       };
+};
+
+&qspi {
+       qflash0: n25q512a {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               spi-max-frequency = <108000000>;
+               spi-tx-bus-width = <1>;
+               spi-rx-bus-width = <1>;
+               reg = <0>;
+       };
+};
index 4f6d38acccd764e9c21c456837863920ff0561fd..8c081eaf20fea20e69282215d24b8d7d88912748 100644 (file)
@@ -1,9 +1,5 @@
 /*
- * Copyright 2018 - Christophe Priouzeau <christophe.priouzeau@st.com>
- *
- * Based on:
- * stm32f746-disco.dts from U-boot 2018.01
- * Copyright 2016 - Lee Jones <lee.jones@linaro.org>
+ * Copyright 2015 - Maxime Coquelin <mcoquelin.stm32@gmail.com>
  *
  * 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
 
 /dts-v1/;
 #include "stm32f746.dtsi"
-#include <dt-bindings/memory/stm32-sdram.h>
+#include "stm32f746-pinctrl.dtsi"
+#include <dt-bindings/input/input.h>
 
 / {
-       model = "STMicroelectronics STM32F746G-EVAL board";
-       compatible = "st,stm32f746g-eval", "st,stm32f746";
+       model = "STMicroelectronics STM32746g-EVAL board";
+       compatible = "st,stm32746g-eval", "st,stm32f746";
 
        chosen {
-               bootargs = "root=/dev/mmcblk0p1 rw rootwait";
+               bootargs = "root=/dev/ram";
                stdout-path = "serial0:115200n8";
        };
 
        memory {
-               reg = <0xC0000000 0x2000000>;
+               reg = <0xc0000000 0x2000000>;
        };
 
        aliases {
                serial0 = &usart1;
-               spi0 = &qspi;
-               mmc0 = &sdio;
-               /* Aliases for gpios so as to use sequence */
-               gpio0 = &gpioa;
-               gpio1 = &gpiob;
-               gpio2 = &gpioc;
-               gpio3 = &gpiod;
-               gpio4 = &gpioe;
-               gpio5 = &gpiof;
-               gpio6 = &gpiog;
-               gpio7 = &gpioh;
-               gpio8 = &gpioi;
-               gpio9 = &gpioj;
-               gpio10 = &gpiok;
        };
 
-       led1 {
-               compatible = "st,led1";
-               led-gpio = <&gpiof 10 0>;
+       leds {
+               compatible = "gpio-leds";
+               green {
+                       gpios = <&gpiof 10 1>;
+                       linux,default-trigger = "heartbeat";
+               };
+               red {
+                       gpios = <&gpiob 7 1>;
+               };
+       };
+
+       gpio_keys {
+               compatible = "gpio-keys";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               autorepeat;
+               button@0 {
+                       label = "Wake up";
+                       linux,code = <KEY_WAKEUP>;
+                       gpios = <&gpioc 13 0>;
+               };
+       };
+
+       usbotg_hs_phy: usb-phy {
+               #phy-cells = <0>;
+               compatible = "usb-nop-xceiv";
+               clocks = <&rcc 0 STM32F7_AHB1_CLOCK(OTGHSULPI)>;
+               clock-names = "main_clk";
        };
 
-       button1 {
-               compatible = "st,button1";
-               button-gpio = <&gpioc 13 0>;
+       mmc_vcard: mmc_vcard {
+               compatible = "regulator-fixed";
+               regulator-name = "mmc_vcard";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
        };
 };
 
        clock-frequency = <25000000>;
 };
 
-&pinctrl {
-       usart1_pins_a: usart1@0 {
-               pins1 {
-                      pinmux = <STM32F746_PA9_FUNC_USART1_TX>;
-                               bias-disable;
-                               drive-push-pull;
-                               slew-rate = <2>;
-               };
-               pins2 {
-                       pinmux = <STM32F746_PA10_FUNC_USART1_RX>;
-                       bias-disable;
-               };
-       };
-
-       ethernet_mii: mii@0 {
-             pins {
-                     pinmux = <STM32F746_PG13_FUNC_ETH_MII_TXD0_ETH_RMII_TXD0>,
-                            <STM32F746_PG14_FUNC_ETH_MII_TXD1_ETH_RMII_TXD1>,
-                            <STM32F746_PG11_FUNC_ETH_MII_TX_EN_ETH_RMII_TX_EN>,
-                            <STM32F746_PA2_FUNC_ETH_MDIO>,
-                            <STM32F746_PC1_FUNC_ETH_MDC>,
-                            <STM32F746_PA1_FUNC_ETH_MII_RX_CLK_ETH_RMII_REF_CLK>,
-                            <STM32F746_PA7_FUNC_ETH_MII_RX_DV_ETH_RMII_CRS_DV>,
-                            <STM32F746_PC4_FUNC_ETH_MII_RXD0_ETH_RMII_RXD0>,
-                            <STM32F746_PC5_FUNC_ETH_MII_RXD1_ETH_RMII_RXD1>;
-                     slew-rate = <2>;
-             };
-       };
-
-       fmc_pins: fmc@0 {
-               pins {
-                       pinmux = <STM32F746_PI10_FUNC_FMC_D31>, /* FMC_D31 */
-                                <STM32F746_PI9_FUNC_FMC_D30>,  /* FMC_D30*/
-                                <STM32F746_PI7_FUNC_FMC_D29>,  /* FMC_D29 */
-                                <STM32F746_PI6_FUNC_FMC_D28>,  /* FMC_D28 */
-                                <STM32F746_PI3_FUNC_FMC_D27>,  /* FMC_D27 */
-                                <STM32F746_PI2_FUNC_FMC_D26>,  /* FMC_D26 */
-                                <STM32F746_PI1_FUNC_FMC_D25>,  /* FMC_D25 */
-                                <STM32F746_PI0_FUNC_FMC_D24>,  /* FMC_D24 */
-                                <STM32F746_PH15_FUNC_FMC_D23>, /* FMC_D23 */
-                                <STM32F746_PH14_FUNC_FMC_D22>, /* FMC_D22 */
-                                <STM32F746_PH13_FUNC_FMC_D21>, /* FMC_D21 */
-                                <STM32F746_PH12_FUNC_FMC_D20>, /* FMC_D20 */
-                                <STM32F746_PH11_FUNC_FMC_D19>, /* FMC_D19 */
-                                <STM32F746_PH10_FUNC_FMC_D18>, /* FMC_D18 */
-                                <STM32F746_PH9_FUNC_FMC_D17>,  /* FMC_D17 */
-                                <STM32F746_PH8_FUNC_FMC_D16>,  /* FMC_D16 */
-
-                                <STM32F746_PD10_FUNC_FMC_D15>, /* FMC_D15 */
-                                <STM32F746_PD9_FUNC_FMC_D14>, /* FMC_D14*/
-                                <STM32F746_PD8_FUNC_FMC_D13>, /* FMC_D13 */
-                                <STM32F746_PE15_FUNC_FMC_D12>,/* FMC_D12 */
-                                <STM32F746_PE14_FUNC_FMC_D11>,/* FMC_D11 */
-                                <STM32F746_PE13_FUNC_FMC_D10>,/* FMC_D10 */
-                                <STM32F746_PE12_FUNC_FMC_D9>, /* FMC_D9 */
-                                <STM32F746_PE11_FUNC_FMC_D8>, /* FMC_D8 */
-                                <STM32F746_PE10_FUNC_FMC_D7>, /* FMC_D7 */
-                                <STM32F746_PE9_FUNC_FMC_D6>,  /* FMC_D6 */
-                                <STM32F746_PE8_FUNC_FMC_D5>,  /* FMC_D5*/
-                                <STM32F746_PE7_FUNC_FMC_D4>,  /* FMC_D4 */
-                                <STM32F746_PD1_FUNC_FMC_D3>,  /* FMC_D3 */
-                                <STM32F746_PD0_FUNC_FMC_D2>,  /* FMC_D2 */
-                                <STM32F746_PD15_FUNC_FMC_D1>, /* FMC_D1 */
-                                <STM32F746_PD14_FUNC_FMC_D0>, /* FMC_D0 */
-
-                                <STM32F746_PI5_FUNC_FMC_NBL3>, /* FMC_NBL3 */
-                                <STM32F746_PI4_FUNC_FMC_NBL2>, /* FMC_NBL2 */
-                                <STM32F746_PE1_FUNC_FMC_NBL1>, /* FMC_NBL1 */
-                                <STM32F746_PE0_FUNC_FMC_NBL0>, /* FMC_NBL0 */
-
-                                <STM32F746_PG5_FUNC_FMC_A15_FMC_BA1>, /* FMC_A15 FMC_BA1 */
-                                <STM32F746_PG4_FUNC_FMC_A14_FMC_BA0>, /* FMC_A14 FMC_BA0*/
-
-                                <STM32F746_PG1_FUNC_FMC_A11>, /* FMC_A11 */
-                                <STM32F746_PG0_FUNC_FMC_A10>, /* FMC_A10 */
-                                <STM32F746_PF15_FUNC_FMC_A9>, /* FMC_A9 */
-                                <STM32F746_PF14_FUNC_FMC_A8>, /* FMC_A8 */
-                                <STM32F746_PF13_FUNC_FMC_A7>, /* FMC_A7 */
-                                <STM32F746_PF12_FUNC_FMC_A6>, /* FMC_A6 */
-                                <STM32F746_PF5_FUNC_FMC_A5>,  /* FUNC_FMC_A5 */
-                                <STM32F746_PF4_FUNC_FMC_A4>,  /* FMC_A4 */
-                                <STM32F746_PF3_FUNC_FMC_A3>,  /* FMC_A3 */
-                                <STM32F746_PF2_FUNC_FMC_A2>,  /* FMC_A2 */
-                                <STM32F746_PF1_FUNC_FMC_A1>,  /* FMC_A1 */
-                                <STM32F746_PF0_FUNC_FMC_A0>,  /* FMC_A0 */
-
-                                <STM32F746_PH3_FUNC_FMC_SDNE0>,/* FMC_SDNE0 */
-                                <STM32F746_PH5_FUNC_FMC_SDNWE>, /* FMC_SDNWE */
-                                <STM32F746_PF11_FUNC_FMC_SDNRAS>, /* FMC_SDNRAS */
-                                <STM32F746_PG15_FUNC_FMC_SDNCAS>, /* FMC_SDNCAS */
-                                <STM32F746_PH2_FUNC_FMC_SDCKE0>, /* FMC_SDCKE0 */
-                                <STM32F746_PG8_FUNC_FMC_SDCLK>; /* FMC_SDCLK */
-                         slew-rate = <2>;
-               };
-       };
+&crc {
+       status = "okay";
 };
 
-&usart1 {
-       pinctrl-0 = <&usart1_pins_a>;
+&i2c1 {
+       pinctrl-0 = <&i2c1_pins_b>;
        pinctrl-names = "default";
+       i2c-scl-rising-time-ns = <185>;
+       i2c-scl-falling-time-ns = <20>;
        status = "okay";
 };
 
-&mac {
+&rtc {
        status = "okay";
-       pinctrl-0 = <&ethernet_mii>;
-       phy-mode = "rmii";
-       phy-handle = <&phy0>;
+};
 
-       mdio0 {
-               #address-cells = <1>;
-               #size-cells = <0>;
-               compatible = "snps,dwmac-mdio";
-               phy0: ethernet-phy@0 {
-                       reg = <0>;
-               };
-       };
+&sdio1 {
+       status = "okay";
+       vmmc-supply = <&mmc_vcard>;
+       broken-cd;
+       pinctrl-names = "default", "opendrain";
+       pinctrl-0 = <&sdio_pins_a>;
+       pinctrl-1 = <&sdio_pins_od_a>;
+       bus-width = <4>;
 };
 
-&fmc {
-       pinctrl-0 = <&fmc_pins>;
+&usart1 {
+       pinctrl-0 = <&usart1_pins_a>;
        pinctrl-names = "default";
        status = "okay";
-
-       /*
-        * Memory configuration from sdram datasheet IS42S32800G-6BLI
-        */
-       bank1: bank@0 {
-               st,sdram-control = /bits/ 8 <NO_COL_9 NO_ROW_12 MWIDTH_32 BANKS_4
-                                 CAS_2 SDCLK_3 RD_BURST_EN RD_PIPE_DL_0>;
-               st,sdram-timing = /bits/ 8 <TMRD_1 TXSR_1 TRAS_1 TRC_6 TRP_2
-                                 TWR_1 TRCD_1>;
-               st,sdram-refcount = <1539>;
-       };
 };
 
-&sdio {
+&usbotg_hs {
+       dr_mode = "otg";
+       phys = <&usbotg_hs_phy>;
+       phy-names = "usb2-phy";
+       pinctrl-0 = <&usbotg_hs_pins_a>;
+       pinctrl-names = "default";
        status = "okay";
-       pinctrl-names = "default", "opendrain";
-       pinctrl-0 = <&sdio_pins>;
-       pinctrl-1 = <&sdio_pins_od>;
-       bus-width = <4>;
-       max-frequency = <25000000>;
 };
index 736bca738d36214f110dd57c28024fbea91e7374..35202896c09350c3717f6507ca63f7d6e635aab1 100644 (file)
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
- * Author(s): Alexandre Torgue <alexandre.torgue@st.com> for STMicroelectronics.
+ * Copyright 2017 - Alexandre Torgue <alexandre.torgue@st.com>
  *
  * 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
 
                        sdio_pins: sdio_pins@0 {
                                pins {
-                                       pinmux = <STM32_PINMUX('C', 8, AF12)>,
-                                                <STM32_PINMUX('C', 9, AF12)>,
-                                                <STM32_PINMUX('C', 10, AF12)>,
-                                                <STM32_PINMUX('c', 11, AF12)>,
-                                                <STM32_PINMUX('C', 12, AF12)>,
-                                                <STM32_PINMUX('D', 2, AF12)>;
+                                       pinmux = <STM32_PINMUX('C', 8, AF12)>, /* SDIO_D0 */
+                                                <STM32_PINMUX('C', 9, AF12)>, /* SDIO_D1 */
+                                                <STM32_PINMUX('C', 10, AF12)>, /* SDIO_D2 */
+                                                <STM32_PINMUX('C', 11, AF12)>, /* SDIO_D3 */
+                                                <STM32_PINMUX('C', 12, AF12)>, /* SDIO_CK */
+                                                <STM32_PINMUX('D', 2, AF12)>; /* SDIO_CMD */
                                        drive-push-pull;
                                        slew-rate = <2>;
                                };
 
                        sdio_pins_od: sdio_pins_od@0 {
                                pins1 {
-                                       pinmux = <STM32_PINMUX('C', 8, AF12)>,
-                                                <STM32_PINMUX('C', 9, AF12)>,
-                                                <STM32_PINMUX('C', 10, AF12)>,
-                                                <STM32_PINMUX('C', 11, AF12)>,
-                                                <STM32_PINMUX('C', 12, AF12)>;
+                                       pinmux = <STM32_PINMUX('C', 8, AF12)>, /* SDIO_D0 */
+                                                <STM32_PINMUX('C', 9, AF12)>, /* SDIO_D1 */
+                                                <STM32_PINMUX('C', 10, AF12)>, /* SDIO_D2 */
+                                                <STM32_PINMUX('C', 11, AF12)>, /* SDIO_D3 */
+                                                <STM32_PINMUX('C', 12, AF12)>; /* SDIO_CK */
                                        drive-push-pull;
                                        slew-rate = <2>;
                                };
 
                                pins2 {
-                                       pinmux = <STM32_PINMUX('D', 2, AF12)>;
+                                       pinmux = <STM32_PINMUX('D', 2, AF12)>; /* SDIO_CMD */
                                        drive-open-drain;
                                        slew-rate = <2>;
                                };
index 10e09508aa213999990b19daf49bf797d7f0ddc6..0cc3100440c8d017b48fbe32c7e8ef8038b5fb9a 100644 (file)
        u-boot,dm-pre-reloc;
 };
 
-&clk_lse {
-       u-boot,dm-pre-reloc;
-};
-
 &clk_i2s_ckin {
        u-boot,dm-pre-reloc;
 };
 
-&pwrcfg {
-       u-boot,dm-pre-reloc;
-};
-
-&rcc {
+&clk_lse {
        u-boot,dm-pre-reloc;
 };
 
                };
        };
 };
+
+&pwrcfg {
+       u-boot,dm-pre-reloc;
+};
+
+&rcc {
+       u-boot,dm-pre-reloc;
+};
index 106db68b5b99123393e9dc8f76adc627d762793f..d99f47aa724ab50e8ff4470fae74cc35523f080e 100644 (file)
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2015, STMicroelectronics - All Rights Reserved
- * Author(s):  Maxime Coquelin <mcoquelin.stm32@gmail.com> for STMicroelectronics.
+ * Copyright 2015 - Maxime Coquelin <mcoquelin.stm32@gmail.com>
  *
  * 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
@@ -76,6 +75,7 @@
 
        gpio_keys {
                compatible = "gpio-keys";
+               #address-cells = <1>;
                #size-cells = <0>;
                autorepeat;
                button@0 {
index 77246b3d79eae1de5e14737f3e327c8baa2c05d7..3e7a17d9112e1cf90d7284f6f048a99bc88e0994 100644 (file)
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
- * Author(s): Alexandre Torgue <alexandre.torgue@st.com> for STMicroelectronics.
+ * Copyright 2017 - Alexandre Torgue <alexandre.torgue@st.com>
  *
  * 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
index 046aeff7cccab46a144f89a3199775700daa3f1d..c5c029b9e36c8240d698654b476b71ac64450156 100644 (file)
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2015, STMicroelectronics - All Rights Reserved
- * Author(s):  Maxime Coquelin <mcoquelin.stm32@gmail.com> for STMicroelectronics.
+ * Copyright 2015 - Maxime Coquelin <mcoquelin.stm32@gmail.com>
  *
  * 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
                };
 
                timers13: timers@40001c00 {
+                       #address-cells = <1>;
                        #size-cells = <0>;
                        compatible = "st,stm32-timers";
                        reg = <0x40001C00 0x400>;
                };
 
                timers14: timers@40002000 {
+                       #address-cells = <1>;
                        #size-cells = <0>;
                        compatible = "st,stm32-timers";
                        reg = <0x40002000 0x400>;
                        interrupt-parent = <&exti>;
                        interrupts = <17 1>;
                        interrupt-names = "alarm";
-                       st,syscfg = <&pwrcfg>;
+                       st,syscfg = <&pwrcfg 0x00 0x100>;
                        status = "disabled";
                };
 
                        compatible = "st,stm32-iwdg";
                        reg = <0x40003000 0x400>;
                        clocks = <&clk_lsi>;
+                       clock-names = "lsi";
                        status = "disabled";
                };
 
                        };
                };
 
+               sdio: sdio@40012c00 {
+                       compatible = "arm,pl180", "arm,primecell";
+                       arm,primecell-periphid = <0x00880180>;
+                       reg = <0x40012c00 0x400>;
+                       clocks = <&rcc 0 STM32F4_APB2_CLOCK(SDIO)>;
+                       clock-names = "apb_pclk";
+                       interrupts = <49>;
+                       max-frequency = <48000000>;
+                       status = "disabled";
+               };
+
                syscfg: system-config@40013800 {
                        compatible = "syscon";
                        reg = <0x40013800 0x400>;
                };
 
                timers10: timers@40014400 {
+                       #address-cells = <1>;
                        #size-cells = <0>;
                        compatible = "st,stm32-timers";
                        reg = <0x40014400 0x400>;
                };
 
                timers11: timers@40014800 {
+                       #address-cells = <1>;
                        #size-cells = <0>;
                        compatible = "st,stm32-timers";
                        reg = <0x40014800 0x400>;
                        reg = <0x40007000 0x400>;
                };
 
-               sdio: sdio@40012c00 {
-                       compatible = "st,stm32f4xx-sdio";
-                       reg = <0x40012c00 0x400>;
-                       clocks = <&rcc 0 171>;
-                       interrupts = <49>;
-                       status = "disabled";
-                       pinctrl-0 = <&sdio_pins>;
-                       pinctrl-1 = <&sdio_pins_od>;
-                       pinctrl-names = "default", "opendrain";
-                       max-frequency = <48000000>;
-               };
-
                ltdc: display-controller@40016800 {
                        compatible = "st,stm32-ltdc";
                        reg = <0x40016800 0x200>;
index 774f1b5e656e17c0599044bc431b91face9d0c68..a980ac46f5668b2dccd696fcb86701645bbc2af6 100644 (file)
        u-boot,dm-pre-reloc;
 };
 
-&clk_lse {
-       u-boot,dm-pre-reloc;
-};
-
 &clk_i2s_ckin {
        u-boot,dm-pre-reloc;
 };
 
-&pwrcfg {
-       u-boot,dm-pre-reloc;
-};
-
-&syscfg {
-       u-boot,dm-pre-reloc;
-};
-
-&rcc {
+&clk_lse {
        u-boot,dm-pre-reloc;
 };
 
 };
 
 &pinctrl {
-       usart3_pins_a: usart3@0 {
-               u-boot,dm-pre-reloc;
-               pins1 {
-                       u-boot,dm-pre-reloc;
-               };
-               pins2 {
-                       u-boot,dm-pre-reloc;
-               };
-       };
-
        fmc_pins_d32: fmc_d32@0 {
                u-boot,dm-pre-reloc;
                pins
                        u-boot,dm-pre-reloc;
                };
        };
+
+       usart3_pins_a: usart3@0 {
+               u-boot,dm-pre-reloc;
+               pins1 {
+                       u-boot,dm-pre-reloc;
+               };
+               pins2 {
+                       u-boot,dm-pre-reloc;
+               };
+       };
+};
+
+&pwrcfg {
+       u-boot,dm-pre-reloc;
+};
+
+&rcc {
+       u-boot,dm-pre-reloc;
+};
+
+&syscfg {
+       u-boot,dm-pre-reloc;
 };
index 3ecef2867366332e451d3a8038289d15134e6dde..3ceb84d8ba8aa0b2324433704019a7bb22a4e750 100644 (file)
  */
 
 /dts-v1/;
-#include "stm32f429.dtsi"
+#include "stm32f469.dtsi"
 #include "stm32f469-pinctrl.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
 
 / {
        model = "STMicroelectronics STM32F469i-DISCO board";
                dma-ranges = <0xc0000000 0x0 0x10000000>;
        };
 
+       leds {
+               compatible = "gpio-leds";
+               green {
+                       gpios = <&gpiog 6 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "heartbeat";
+               };
+               orange {
+                       gpios = <&gpiod 4 GPIO_ACTIVE_LOW>;
+               };
+               red {
+                       gpios = <&gpiod 5 GPIO_ACTIVE_LOW>;
+               };
+               blue {
+                       gpios = <&gpiok 3 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       gpio_keys {
+               compatible = "gpio-keys";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               autorepeat;
+               button@0 {
+                       label = "User";
+                       linux,code = <KEY_WAKEUP>;
+                       gpios = <&gpioa 0 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
        /* This turns on vbus for otg for host mode (dwc2) */
        vcc5v_otg: vcc5v-otg-regulator {
                compatible = "regulator-fixed";
                enable-active-high;
-               gpio = <&gpiob 2 0>;
+               gpio = <&gpiob 2 GPIO_ACTIVE_HIGH>;
                regulator-name = "vcc5_host1";
                regulator-always-on;
        };
        clock-frequency = <8000000>;
 };
 
+&dsi {
+       #address-cells = <1>;
+       #size-cells = <0>;
+       status = "okay";
+
+       ports {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               port@0 {
+                       reg = <0>;
+                       dsi_in: endpoint {
+                               remote-endpoint = <&ltdc_out_dsi>;
+                       };
+               };
+
+               port@1 {
+                       reg = <1>;
+                       dsi_out: endpoint {
+                               remote-endpoint = <&dsi_panel_in>;
+                       };
+               };
+       };
+
+       panel-dsi@0 {
+               compatible = "orisetech,otm8009a";
+               reg = <0>; /* dsi virtual channel (0..3) */
+               reset-gpios = <&gpioh 7 GPIO_ACTIVE_LOW>;
+               status = "okay";
+
+               port {
+                       dsi_panel_in: endpoint {
+                               remote-endpoint = <&dsi_out>;
+                       };
+               };
+       };
+};
+
+&ltdc {
+       dma-ranges;
+       status = "okay";
+
+       port {
+               ltdc_out_dsi: endpoint@0 {
+                       remote-endpoint = <&dsi_in>;
+               };
+       };
+};
+
 &rtc {
        status = "okay";
 };
 &sdio {
        status = "okay";
        vmmc-supply = <&mmc_vcard>;
+       cd-gpios = <&gpiog 2 GPIO_ACTIVE_LOW>;
+       broken-cd;
        pinctrl-names = "default", "opendrain";
        pinctrl-0 = <&sdio_pins>;
        pinctrl-1 = <&sdio_pins_od>;
index dd641580c9bd47f2b636c04c404d6755943a7c4e..fff542662eeaa3a917e95b628a58af0e39f81f0c 100644 (file)
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
- * Author(s): Alexandre Torgue <alexandre.torgue@st.com> for STMicroelectronics.
+ * Copyright 2017 - Alexandre Torgue <alexandre.torgue@st.com>
  *
  * 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
diff --git a/arch/arm/dts/stm32f469.dtsi b/arch/arm/dts/stm32f469.dtsi
new file mode 100644 (file)
index 0000000..0d58d40
--- /dev/null
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0+
+/* Copyright (C) STMicroelectronics 2017 - All Rights Reserved */
+
+#include "stm32f429.dtsi"
+
+/ {
+       soc {
+               dsi: dsi@40016c00 {
+                       compatible = "st,stm32-dsi";
+                       reg = <0x40016c00 0x800>;
+                       interrupts = <92>;
+                       resets = <&rcc STM32F4_APB2_RESET(DSI)>;
+                       reset-names = "apb";
+                       clocks = <&rcc 1 CLK_F469_DSI>, <&clk_hse>;
+                       clock-names = "pclk", "ref";
+                       status = "disabled";
+               };
+       };
+};
diff --git a/arch/arm/dts/stm32f7-pinctrl.dtsi b/arch/arm/dts/stm32f7-pinctrl.dtsi
new file mode 100644 (file)
index 0000000..9314128
--- /dev/null
@@ -0,0 +1,289 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+/*
+ * Copyright (C) STMicroelectronics 2017 - All Rights Reserved
+ * Author: Alexandre Torgue  <alexandre.torgue@st.com> for STMicroelectronics.
+ */
+
+#include <dt-bindings/pinctrl/stm32-pinfunc.h>
+#include <dt-bindings/mfd/stm32f7-rcc.h>
+
+/ {
+       soc {
+               pinctrl: pin-controller {
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0 0x40020000 0x3000>;
+                       interrupt-parent = <&exti>;
+                       st,syscfg = <&syscfg 0x8>;
+                       pins-are-numbered;
+
+                       gpioa: gpio@40020000 {
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                               reg = <0x0 0x400>;
+                               clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOA)>;
+                               st,bank-name = "GPIOA";
+                       };
+
+                       gpiob: gpio@40020400 {
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                               reg = <0x400 0x400>;
+                               clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOB)>;
+                               st,bank-name = "GPIOB";
+                       };
+
+                       gpioc: gpio@40020800 {
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                               reg = <0x800 0x400>;
+                               clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOC)>;
+                               st,bank-name = "GPIOC";
+                       };
+
+                       gpiod: gpio@40020c00 {
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                               reg = <0xc00 0x400>;
+                               clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOD)>;
+                               st,bank-name = "GPIOD";
+                       };
+
+                       gpioe: gpio@40021000 {
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                               reg = <0x1000 0x400>;
+                               clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOE)>;
+                               st,bank-name = "GPIOE";
+                       };
+
+                       gpiof: gpio@40021400 {
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                               reg = <0x1400 0x400>;
+                               clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOF)>;
+                               st,bank-name = "GPIOF";
+                       };
+
+                       gpiog: gpio@40021800 {
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                               reg = <0x1800 0x400>;
+                               clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOG)>;
+                               st,bank-name = "GPIOG";
+                       };
+
+                       gpioh: gpio@40021c00 {
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                               reg = <0x1c00 0x400>;
+                               clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOH)>;
+                               st,bank-name = "GPIOH";
+                       };
+
+                       gpioi: gpio@40022000 {
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                               reg = <0x2000 0x400>;
+                               clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOI)>;
+                               st,bank-name = "GPIOI";
+                       };
+
+                       gpioj: gpio@40022400 {
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                               reg = <0x2400 0x400>;
+                               clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOJ)>;
+                               st,bank-name = "GPIOJ";
+                       };
+
+                       gpiok: gpio@40022800 {
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                               reg = <0x2800 0x400>;
+                               clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOK)>;
+                               st,bank-name = "GPIOK";
+                       };
+
+                       cec_pins_a: cec@0 {
+                               pins {
+                                       pinmux = <STM32_PINMUX('A', 15, AF4)>; /* HDMI CEC */
+                                       slew-rate = <0>;
+                                       drive-open-drain;
+                                       bias-disable;
+                               };
+                       };
+
+                       usart1_pins_a: usart1@0 {
+                               pins1 {
+                                       pinmux = <STM32_PINMUX('A', 9, AF7)>; /* USART1_TX */
+                                       bias-disable;
+                                       drive-push-pull;
+                                       slew-rate = <0>;
+                               };
+                               pins2 {
+                                       pinmux = <STM32_PINMUX('A', 10, AF7)>; /* USART1_RX */
+                                       bias-disable;
+                               };
+                       };
+
+                       usart1_pins_b: usart1@1 {
+                               pins1 {
+                                       pinmux = <STM32_PINMUX('A', 9, AF7)>; /* USART1_TX */
+                                       bias-disable;
+                                       drive-push-pull;
+                                       slew-rate = <0>;
+                               };
+                               pins2 {
+                                       pinmux = <STM32_PINMUX('B', 7, AF7)>; /* USART1_RX */
+                                       bias-disable;
+                               };
+                       };
+
+                       i2c1_pins_b: i2c1@0 {
+                               pins {
+                                       pinmux = <STM32_PINMUX('B', 9, AF4)>, /* I2C1 SDA */
+                                                <STM32_PINMUX('B', 8, AF4)>; /* I2C1 SCL */
+                                       bias-disable;
+                                       drive-open-drain;
+                                       slew-rate = <0>;
+                               };
+                       };
+
+                       usbotg_hs_pins_a: usbotg-hs@0 {
+                               pins {
+                                       pinmux = <STM32_PINMUX('H', 4, AF10)>, /* OTG_HS_ULPI_NXT */
+                                                <STM32_PINMUX('I', 11, AF10)>, /* OTG_HS_ULPI_DIR */
+                                                <STM32_PINMUX('C', 0, AF10)>, /* OTG_HS_ULPI_STP */
+                                                <STM32_PINMUX('A', 5, AF10)>, /* OTG_HS_ULPI_CK */
+                                                <STM32_PINMUX('A', 3, AF10)>, /* OTG_HS_ULPI_D0 */
+                                                <STM32_PINMUX('B', 0, AF10)>, /* OTG_HS_ULPI_D1 */
+                                                <STM32_PINMUX('B', 1, AF10)>, /* OTG_HS_ULPI_D2 */
+                                                <STM32_PINMUX('B', 10, AF10)>, /* OTG_HS_ULPI_D3 */
+                                                <STM32_PINMUX('B', 11, AF10)>, /* OTG_HS_ULPI_D4 */
+                                                <STM32_PINMUX('B', 12, AF10)>, /* OTG_HS_ULPI_D5 */
+                                                <STM32_PINMUX('B', 13, AF10)>, /* OTG_HS_ULPI_D6 */
+                                                <STM32_PINMUX('B', 5, AF10)>; /* OTG_HS_ULPI_D7 */
+                                       bias-disable;
+                                       drive-push-pull;
+                                       slew-rate = <2>;
+                               };
+                       };
+
+                       usbotg_hs_pins_b: usbotg-hs@1 {
+                               pins {
+                                       pinmux = <STM32_PINMUX('H', 4, AF10)>, /* OTG_HS_ULPI_NXT */
+                                                <STM32_PINMUX('C', 2, AF10)>, /* OTG_HS_ULPI_DIR */
+                                                <STM32_PINMUX('C', 0, AF10)>, /* OTG_HS_ULPI_STP */
+                                                <STM32_PINMUX('A', 5, AF10)>, /* OTG_HS_ULPI_CK */
+                                                <STM32_PINMUX('A', 3, AF10)>, /* OTG_HS_ULPI_D0 */
+                                                <STM32_PINMUX('B', 0, AF10)>, /* OTG_HS_ULPI_D1 */
+                                                <STM32_PINMUX('B', 1, AF10)>, /* OTG_HS_ULPI_D2 */
+                                                <STM32_PINMUX('B', 10, AF10)>, /* OTG_HS_ULPI_D3 */
+                                                <STM32_PINMUX('B', 11, AF10)>, /* OTG_HS_ULPI_D4 */
+                                                <STM32_PINMUX('B', 12, AF10)>, /* OTG_HS_ULPI_D5 */
+                                                <STM32_PINMUX('B', 13, AF10)>, /* OTG_HS_ULPI_D6 */
+                                                <STM32_PINMUX('B', 5, AF10)>; /* OTG_HS_ULPI_D7 */
+                                       bias-disable;
+                                       drive-push-pull;
+                                       slew-rate = <2>;
+                               };
+                       };
+
+                       usbotg_fs_pins_a: usbotg-fs@0 {
+                               pins {
+                                       pinmux = <STM32_PINMUX('A', 10, AF10)>, /* OTG_FS_ID */
+                                                <STM32_PINMUX('A', 11, AF10)>, /* OTG_FS_DM */
+                                                <STM32_PINMUX('A', 12, AF10)>; /* OTG_FS_DP */
+                                       bias-disable;
+                                       drive-push-pull;
+                                       slew-rate = <2>;
+                               };
+                       };
+
+                       sdio_pins_a: sdio_pins_a@0 {
+                               pins {
+                                       pinmux = <STM32_PINMUX('C', 8, AF12)>, /* SDMMC1 D0 */
+                                                <STM32_PINMUX('C', 9, AF12)>, /* SDMMC1 D1 */
+                                                <STM32_PINMUX('C', 10, AF12)>, /* SDMMC1 D2 */
+                                                <STM32_PINMUX('C', 11, AF12)>, /* SDMMC1 D3 */
+                                                <STM32_PINMUX('C', 12, AF12)>, /* SDMMC1 CLK */
+                                                <STM32_PINMUX('D', 2, AF12)>; /* SDMMC1 CMD */
+                                       drive-push-pull;
+                                       slew-rate = <2>;
+                               };
+                       };
+
+                       sdio_pins_od_a: sdio_pins_od_a@0 {
+                               pins1 {
+                                       pinmux = <STM32_PINMUX('C', 8, AF12)>, /* SDMMC1 D0 */
+                                                <STM32_PINMUX('C', 9, AF12)>, /* SDMMC1 D1 */
+                                                <STM32_PINMUX('C', 10, AF12)>, /* SDMMC1 D2 */
+                                                <STM32_PINMUX('C', 11, AF12)>, /* SDMMC1 D3 */
+                                                <STM32_PINMUX('C', 12, AF12)>; /* SDMMC1 CLK */
+                                       drive-push-pull;
+                                       slew-rate = <2>;
+                               };
+
+                               pins2 {
+                                       pinmux = <STM32_PINMUX('D', 2, AF12)>; /* SDMMC1 CMD */
+                                       drive-open-drain;
+                                       slew-rate = <2>;
+                               };
+                       };
+
+                       sdio_pins_b: sdio_pins_b@0 {
+                               pins {
+                                       pinmux = <STM32_PINMUX('G', 9, AF11)>, /* SDMMC2 D0 */
+                                                <STM32_PINMUX('G', 10, AF11)>, /* SDMMC2 D1 */
+                                                <STM32_PINMUX('B', 3, AF10)>, /* SDMMC2 D2 */
+                                                <STM32_PINMUX('B', 4, AF10)>, /* SDMMC2 D3 */
+                                                <STM32_PINMUX('D', 6, AF11)>, /* SDMMC2 CLK */
+                                                <STM32_PINMUX('D', 7, AF11)>; /* SDMMC2 CMD */
+                                       drive-push-pull;
+                                       slew-rate = <2>;
+                               };
+                       };
+
+                       sdio_pins_od_b: sdio_pins_od_b@0 {
+                               pins1 {
+                                       pinmux = <STM32_PINMUX('G', 9, AF11)>, /* SDMMC2 D0 */
+                                                <STM32_PINMUX('G', 10, AF11)>, /* SDMMC2 D1 */
+                                                <STM32_PINMUX('B', 3, AF10)>, /* SDMMC2 D2 */
+                                                <STM32_PINMUX('B', 4, AF10)>, /* SDMMC2 D3 */
+                                                <STM32_PINMUX('D', 6, AF11)>; /* SDMMC2 CLK */
+                                       drive-push-pull;
+                                       slew-rate = <2>;
+                               };
+
+                               pins2 {
+                                       pinmux = <STM32_PINMUX('D', 7, AF11)>; /* SDMMC2 CMD */
+                                       drive-open-drain;
+                                       slew-rate = <2>;
+                               };
+                       };
+               };
+       };
+};
index 4a677192a2dd925b99c5ec36afeae3f46e51c708..29b157324e663609191e9b33b99ea7f11594ec8b 100644 (file)
+// SPDX-License-Identifier: GPL-2.0+
+
+#include <dt-bindings/memory/stm32-sdram.h>
 /{
        soc {
-               timer5: timer@40000c00 {
+               u-boot,dm-pre-reloc;
+
+               fmc: fmc@A0000000 {
+                       compatible = "st,stm32-fmc";
+                       reg = <0xA0000000 0x1000>;
+                       clocks = <&rcc 0 STM32F7_AHB3_CLOCK(FMC)>;
+                       pinctrl-0 = <&fmc_pins>;
+                       pinctrl-names = "default";
+                       status = "okay";
                        u-boot,dm-pre-reloc;
                };
-       };
-};
 
-&pinctrl {
-       usart1_pins_a: usart1@0 {
-               u-boot,dm-pre-reloc;
-               pins1 {
-                       u-boot,dm-pre-reloc;
+               mac: ethernet@40028000 {
+                       compatible = "st,stm32-dwmac";
+                       reg = <0x40028000 0x8000>;
+                       reg-names = "stmmaceth";
+                       clocks = <&rcc 0 STM32F7_AHB1_CLOCK(ETHMAC)>,
+                                <&rcc 0 STM32F7_AHB1_CLOCK(ETHMACTX)>,
+                                <&rcc 0 STM32F7_AHB1_CLOCK(ETHMACRX)>;
+                       interrupts = <61>, <62>;
+                       interrupt-names = "macirq", "eth_wake_irq";
+                       snps,pbl = <8>;
+                       snps,mixed-burst;
+                       dma-ranges;
+                       pinctrl-0 = <&ethernet_mii>;
+                       phy-mode = "rmii";
+                       phy-handle = <&phy0>;
+
+                       status = "okay";
+
+                       mdio0 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "snps,dwmac-mdio";
+                               phy0: ethernet-phy@0 {
+                                       reg = <0>;
+                               };
+                       };
                };
-               pins2 {
-                       u-boot,dm-pre-reloc;
+
+               qspi: quadspi@A0001000 {
+                       compatible = "st,stm32-qspi";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0xA0001000 0x1000>, <0x90000000 0x10000000>;
+                       reg-names = "qspi", "qspi_mm";
+                       interrupts = <92>;
+                       spi-max-frequency = <108000000>;
+                       clocks = <&rcc 0 STM32F7_AHB3_CLOCK(QSPI)>;
+                       resets = <&rcc STM32F7_AHB3_RESET(QSPI)>;
+                       pinctrl-0 = <&qspi_pins>;
+
+                       status = "okay";
                };
        };
+};
+
+&clk_hse {
+       u-boot,dm-pre-reloc;
+};
+
+&gpioa {
+       compatible = "st,stm32-gpio";
+       u-boot,dm-pre-reloc;
+};
+
+&gpiob {
+       compatible = "st,stm32-gpio";
+       u-boot,dm-pre-reloc;
+};
+
+&gpioc {
+       compatible = "st,stm32-gpio";
+       u-boot,dm-pre-reloc;
+};
+
+&gpiod {
+       compatible = "st,stm32-gpio";
+       u-boot,dm-pre-reloc;
+};
+
+&gpioe {
+       compatible = "st,stm32-gpio";
+       u-boot,dm-pre-reloc;
+};
+
+&gpiof {
+       compatible = "st,stm32-gpio";
+       u-boot,dm-pre-reloc;
+};
+
+&gpiog {
+       compatible = "st,stm32-gpio";
+       u-boot,dm-pre-reloc;
+};
+
+&gpioh {
+       compatible = "st,stm32-gpio";
+       u-boot,dm-pre-reloc;
+};
+
+&gpioi {
+       compatible = "st,stm32-gpio";
+       u-boot,dm-pre-reloc;
+};
+
+&gpioj {
+       compatible = "st,stm32-gpio";
+};
+
+&gpiok {
+       compatible = "st,stm32-gpio";
+};
+
+&pinctrl {
+       u-boot,dm-pre-reloc;
+
        fmc_pins: fmc@0 {
                u-boot,dm-pre-reloc;
                pins
        };
 };
 
-&fmc {
-       bank1: bank@0 {
-                u-boot,dm-pre-reloc;
-       };
+&pwrcfg {
+       u-boot,dm-pre-reloc;
 };
 
-&pwrcfg {
+&rcc {
        u-boot,dm-pre-reloc;
 };
 
-&clk_hse {
+&timer5 {
+       u-boot,dm-pre-reloc;
+};
+
+&usart1 {
        u-boot,dm-pre-reloc;
+       clocks = <&rcc 0 STM32F7_APB2_CLOCK(USART1)>;
 };
diff --git a/arch/arm/dts/stm32f746-disco-u-boot.dtsi b/arch/arm/dts/stm32f746-disco-u-boot.dtsi
new file mode 100644 (file)
index 0000000..bc337b1
--- /dev/null
@@ -0,0 +1,251 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include <stm32f7-u-boot.dtsi>
+/{
+       chosen {
+               bootargs = "root=/dev/ram rdinit=/linuxrc";
+       };
+
+       aliases {
+               /* Aliases for gpios so as to use sequence */
+               gpio0 = &gpioa;
+               gpio1 = &gpiob;
+               gpio2 = &gpioc;
+               gpio3 = &gpiod;
+               gpio4 = &gpioe;
+               gpio5 = &gpiof;
+               gpio6 = &gpiog;
+               gpio7 = &gpioh;
+               gpio8 = &gpioi;
+               gpio9 = &gpioj;
+               gpio10 = &gpiok;
+               mmc0 = &sdio1;
+               spi0 = &qspi;
+       };
+
+       backlight: backlight {
+               compatible = "gpio-backlight";
+               gpios = <&gpiok 3 0>;
+               status = "okay";
+       };
+
+       button1 {
+               compatible = "st,button1";
+               button-gpio = <&gpioi 11 0>;
+       };
+
+       led1 {
+               compatible = "st,led1";
+               led-gpio = <&gpioi 1 0>;
+       };
+
+       panel-rgb@0 {
+               compatible = "simple-panel";
+               backlight = <&backlight>;
+               enable-gpios = <&gpioi 12 0>;
+               status = "okay";
+
+               display-timings {
+                       timing@0 {
+                               clock-frequency = <9000000>;
+                               hactive = <480>;
+                               vactive = <272>;
+                               hfront-porch = <2>;
+                               hback-porch = <2>;
+                               hsync-len = <41>;
+                               vfront-porch = <2>;
+                               vback-porch = <2>;
+                               vsync-len = <10>;
+                               hsync-active = <0>;
+                               vsync-active = <0>;
+                               de-active = <0>;
+                               pixelclk-active = <1>;
+                       };
+               };
+       };
+
+       soc {
+               ltdc: display-controller@40016800 {
+                       compatible = "st,stm32-ltdc";
+                       reg = <0x40016800 0x200>;
+                       resets = <&rcc STM32F7_APB2_RESET(LTDC)>;
+                       clocks = <&rcc 0 STM32F7_APB2_CLOCK(LTDC)>;
+                       pinctrl-0 = <&ltdc_pins>;
+
+                       status = "okay";
+                       u-boot,dm-pre-reloc;
+               };
+       };
+};
+
+&clk_hse {
+       u-boot,dm-pre-reloc;
+};
+
+&fmc {
+       /* Memory configuration from sdram datasheet MT48LC_4M32_B2B5-6A */
+       bank1: bank@0 {
+               u-boot,dm-pre-reloc;
+               st,sdram-control = /bits/ 8 <NO_COL_8
+                                            NO_ROW_12
+                                            MWIDTH_16
+                                            BANKS_4
+                                            CAS_3
+                                            SDCLK_2
+                                            RD_BURST_EN
+                                            RD_PIPE_DL_0>;
+               st,sdram-timing = /bits/ 8 <TMRD_2
+                                           TXSR_6
+                                           TRAS_4
+                                           TRC_6
+                                           TWR_2
+                                           TRP_2
+                                           TRCD_2>;
+               /* refcount = (64msec/total_row_sdram)*freq - 20 */
+               st,sdram-refcount = < 1542 >;
+       };
+};
+
+&pinctrl {
+       ethernet_mii: mii@0 {
+               pins {
+                       pinmux = <STM32_PINMUX('G',13, AF11)>, /* ETH_RMII_TXD0 */
+                                <STM32_PINMUX('G',14, AF11)>, /* ETH_RMII_TXD1 */
+                                <STM32_PINMUX('G',11, AF11)>, /* ETH_RMII_TX_EN */
+                                <STM32_PINMUX('A', 2, AF11)>, /* ETH_MDIO */
+                                <STM32_PINMUX('C', 1, AF11)>, /* ETH_MDC */
+                                <STM32_PINMUX('A', 1, AF11)>, /* ETH_RMII_REF_CLK */
+                                <STM32_PINMUX('A', 7, AF11)>, /* ETH_RMII_CRS_DV */
+                                <STM32_PINMUX('C', 4, AF11)>, /* ETH_RMII_RXD0 */
+                                <STM32_PINMUX('C', 5, AF11)>; /* ETH_RMII_RXD1 */
+                       slew-rate = <2>;
+               };
+       };
+
+       fmc_pins: fmc@0 {
+               u-boot,dm-pre-reloc;
+               pins {
+                       u-boot,dm-pre-reloc;
+                       pinmux = <STM32_PINMUX('D',10, AF12)>, /* D15 */
+                                <STM32_PINMUX('D', 9, AF12)>, /* D14 */
+                                <STM32_PINMUX('D', 8, AF12)>, /* D13 */
+                                <STM32_PINMUX('E',15, AF12)>, /* D12 */
+                                <STM32_PINMUX('E',14, AF12)>, /* D11 */
+                                <STM32_PINMUX('E',13, AF12)>, /* D10 */
+                                <STM32_PINMUX('E',12, AF12)>, /* D9 */
+                                <STM32_PINMUX('E',11, AF12)>, /* D8 */
+                                <STM32_PINMUX('E',10, AF12)>, /* D7 */
+                                <STM32_PINMUX('E', 9, AF12)>, /* D6 */
+                                <STM32_PINMUX('E', 8, AF12)>, /* D5 */
+                                <STM32_PINMUX('E', 7, AF12)>, /* D4 */
+                                <STM32_PINMUX('D', 1, AF12)>, /* D3 */
+                                <STM32_PINMUX('D', 0, AF12)>, /* D2 */
+                                <STM32_PINMUX('D',15, AF12)>, /* D1 */
+                                <STM32_PINMUX('D',14, AF12)>, /* D0 */
+
+                                <STM32_PINMUX('E', 1, AF12)>, /* NBL1 */
+                                <STM32_PINMUX('E', 0, AF12)>, /* NBL0 */
+
+                                <STM32_PINMUX('G', 5, AF12)>, /* BA1 */
+                                <STM32_PINMUX('G', 4, AF12)>, /* BA0 */
+
+                                <STM32_PINMUX('G', 1, AF12)>, /* A11 */
+                                <STM32_PINMUX('G', 0, AF12)>, /* A10 */
+                                <STM32_PINMUX('F',15, AF12)>, /* A9 */
+                                <STM32_PINMUX('F',14, AF12)>, /* A8 */
+                                <STM32_PINMUX('F',13, AF12)>, /* A7 */
+                                <STM32_PINMUX('F',12, AF12)>, /* A6 */
+                                <STM32_PINMUX('F', 5, AF12)>, /* A5 */
+                                <STM32_PINMUX('F', 4, AF12)>, /* A4 */
+                                <STM32_PINMUX('F', 3, AF12)>, /* A3 */
+                                <STM32_PINMUX('F', 2, AF12)>, /* A2 */
+                                <STM32_PINMUX('F', 1, AF12)>, /* A1 */
+                                <STM32_PINMUX('F', 0, AF12)>, /* A0 */
+
+                                <STM32_PINMUX('H', 3, AF12)>, /* SDNE0 */
+                                <STM32_PINMUX('H', 5, AF12)>, /* SDNWE */
+                                <STM32_PINMUX('F',11, AF12)>, /* SDNRAS */
+                                <STM32_PINMUX('G',15, AF12)>, /* SDNCAS */
+                                <STM32_PINMUX('C', 3, AF12)>, /* SDCKE0 */
+                                <STM32_PINMUX('G', 8, AF12)>; /* SDCLK> */
+                       slew-rate = <2>;
+               };
+       };
+
+       ltdc_pins: ltdc@0 {
+               pins {
+                       pinmux = <STM32_PINMUX('E', 4, AF14)>, /* B0 */
+                                <STM32_PINMUX('G',12, AF14)>, /* B4 */
+                                <STM32_PINMUX('I', 9, AF14)>, /* VSYNC */
+                                <STM32_PINMUX('I',10, AF14)>, /* HSYNC */
+                                <STM32_PINMUX('I',14, AF14)>, /* CLK */
+                                <STM32_PINMUX('I',15, AF14)>, /* R0 */
+                                <STM32_PINMUX('J', 0, AF14)>, /* R1 */
+                                <STM32_PINMUX('J', 1, AF14)>, /* R2 */
+                                <STM32_PINMUX('J', 2, AF14)>, /* R3 */
+                                <STM32_PINMUX('J', 3, AF14)>, /* R4 */
+                                <STM32_PINMUX('J', 4, AF14)>, /* R5 */
+                                <STM32_PINMUX('J', 5, AF14)>, /* R6 */
+                                <STM32_PINMUX('J', 6, AF14)>, /* R7 */
+                                <STM32_PINMUX('J', 7, AF14)>, /* G0 */
+                                <STM32_PINMUX('J', 8, AF14)>, /* G1 */
+                                <STM32_PINMUX('J', 9, AF14)>, /* G2 */
+                                <STM32_PINMUX('J',10, AF14)>, /* G3 */
+                                <STM32_PINMUX('J',11, AF14)>, /* G4 */
+                                <STM32_PINMUX('J',13, AF14)>, /* B1 */
+                                <STM32_PINMUX('J',14, AF14)>, /* B2 */
+                                <STM32_PINMUX('J',15, AF14)>, /* B3 */
+                                <STM32_PINMUX('K', 0, AF14)>, /* G5 */
+                                <STM32_PINMUX('K', 1, AF14)>, /* G6 */
+                                <STM32_PINMUX('K', 2, AF14)>, /* G7 */
+                                <STM32_PINMUX('K', 4, AF14)>, /* B5 */
+                                <STM32_PINMUX('K', 5, AF14)>, /* B6 */
+                                <STM32_PINMUX('K', 6, AF14)>, /* B7 */
+                                <STM32_PINMUX('K', 7, AF14)>; /* DE */
+                       slew-rate = <2>;
+               };
+       };
+
+       qspi_pins: qspi@0 {
+               pins {
+                       pinmux = <STM32_PINMUX('B', 2, AF9)>, /* CLK */
+                                <STM32_PINMUX('B', 6, AF10)>, /* BK1_NCS */
+                                <STM32_PINMUX('D',11, AF9)>, /* BK1_IO0 */
+                                <STM32_PINMUX('D',12, AF9)>, /* BK1_IO1 */
+                                <STM32_PINMUX('D',13, AF9)>, /* BK1_IO3 */
+                                <STM32_PINMUX('E', 2, AF9)>; /* BK1_IO2 */
+                       slew-rate = <2>;
+               };
+       };
+
+       usart1_pins_b: usart1@1 {
+               u-boot,dm-pre-reloc;
+               pins1 {
+                       u-boot,dm-pre-reloc;
+               };
+               pins2 {
+                       u-boot,dm-pre-reloc;
+               };
+       };
+};
+
+&pwrcfg {
+       u-boot,dm-pre-reloc;
+};
+
+&qspi {
+       qflash0: n25q128a {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "micron,n25q128a13", "jedec,spi-nor";
+               spi-max-frequency = <108000000>;
+               spi-tx-bus-width = <1>;
+               spi-rx-bus-width = <1>;
+               memory-map = <0x90000000 0x1000000>;
+               reg = <0>;
+       };
+};
+
+&timer5 {
+       u-boot,dm-pre-reloc;
+};
index babd37f1c11b57c269e58e48ae70535eba6eb85d..e3a7bd338d61f0a8cc36dc4a1009e8660407d5e1 100644 (file)
@@ -1,10 +1,5 @@
 /*
- * Copyright 2016 - Michael Kurz <michi.kurz@gmail.com>
- * Copyright 2016 - Vikas MANOCHA <vikas.manocha@st.com>
- *
- * Based on:
- * stm32f469-disco.dts from Linux
- * Copyright 2016 - Lee Jones <lee.jones@linaro.org>
+ * Copyright 2017 - Vikas MANOCHA <vikas.manocha@st.com>
  *
  * 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
@@ -47,7 +42,8 @@
 
 /dts-v1/;
 #include "stm32f746.dtsi"
-#include <dt-bindings/memory/stm32-sdram.h>
+#include "stm32f746-pinctrl.dtsi"
+#include <dt-bindings/input/input.h>
 #include <dt-bindings/gpio/gpio.h>
 
 / {
@@ -55,7 +51,7 @@
        compatible = "st,stm32f746-disco", "st,stm32f746";
 
        chosen {
-               bootargs = "root=/dev/ram rdinit=/linuxrc";
+               bootargs = "root=/dev/ram";
                stdout-path = "serial0:115200n8";
        };
 
 
        aliases {
                serial0 = &usart1;
-               spi0 = &qspi;
-               mmc0 = &sdio;
-               /* Aliases for gpios so as to use sequence */
-               gpio0 = &gpioa;
-               gpio1 = &gpiob;
-               gpio2 = &gpioc;
-               gpio3 = &gpiod;
-               gpio4 = &gpioe;
-               gpio5 = &gpiof;
-               gpio6 = &gpiog;
-               gpio7 = &gpioh;
-               gpio8 = &gpioi;
-               gpio9 = &gpioj;
-               gpio10 = &gpiok;
        };
 
-       led1 {
-               compatible = "st,led1";
-               led-gpio = <&gpioi 1 0>;
+       usbotg_hs_phy: usb-phy {
+               #phy-cells = <0>;
+               compatible = "usb-nop-xceiv";
+               clocks = <&rcc 0 STM32F7_AHB1_CLOCK(OTGHSULPI)>;
+               clock-names = "main_clk";
        };
 
-       button1 {
-               compatible = "st,button1";
-               button-gpio = <&gpioi 11 0>;
+       /* This turns on vbus for otg fs for host mode (dwc2) */
+       vcc5v_otg_fs: vcc5v-otg-fs-regulator {
+               compatible = "regulator-fixed";
+               gpio = <&gpiod 5 0>;
+               regulator-name = "vcc5_host1";
+               regulator-always-on;
        };
 
-       backlight: backlight {
-               compatible = "gpio-backlight";
-               gpios = <&gpiok 3 0>;
-               status = "okay";
-       };
-
-       panel-rgb@0 {
-               compatible = "simple-panel";
-               backlight = <&backlight>;
-               enable-gpios = <&gpioi 12 0>;
-               status = "okay";
-
-               display-timings {
-                       timing@0 {
-                               clock-frequency = <9000000>;
-                               hactive = <480>;
-                               vactive = <272>;
-                               hfront-porch = <2>;
-                               hback-porch = <2>;
-                               hsync-len = <41>;
-                               vfront-porch = <2>;
-                               vback-porch = <2>;
-                               vsync-len = <10>;
-                               hsync-active = <0>;
-                               vsync-active = <0>;
-                               de-active = <0>;
-                               pixelclk-active = <1>;
-                       };
-               };
+       mmc_vcard: mmc_vcard {
+               compatible = "regulator-fixed";
+               regulator-name = "mmc_vcard";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
        };
 };
 
        clock-frequency = <25000000>;
 };
 
-&pinctrl {
-       usart1_pins_a: usart1@0 {
-               pins1 {
-                      pinmux = <STM32F746_PA9_FUNC_USART1_TX>;
-                               bias-disable;
-                               drive-push-pull;
-                               slew-rate = <2>;
-               };
-               pins2 {
-                       pinmux = <STM32F746_PB7_FUNC_USART1_RX>;
-                       bias-disable;
-               };
-       };
-
-       ethernet_mii: mii@0 {
-             pins {
-                     pinmux = <STM32F746_PG13_FUNC_ETH_MII_TXD0_ETH_RMII_TXD0>,
-                            <STM32F746_PG14_FUNC_ETH_MII_TXD1_ETH_RMII_TXD1>,
-                            <STM32F746_PG11_FUNC_ETH_MII_TX_EN_ETH_RMII_TX_EN>,
-                            <STM32F746_PA2_FUNC_ETH_MDIO>,
-                            <STM32F746_PC1_FUNC_ETH_MDC>,
-                            <STM32F746_PA1_FUNC_ETH_MII_RX_CLK_ETH_RMII_REF_CLK>,
-                            <STM32F746_PA7_FUNC_ETH_MII_RX_DV_ETH_RMII_CRS_DV>,
-                            <STM32F746_PC4_FUNC_ETH_MII_RXD0_ETH_RMII_RXD0>,
-                            <STM32F746_PC5_FUNC_ETH_MII_RXD1_ETH_RMII_RXD1>;
-                     slew-rate = <2>;
-             };
-       };
-
-       qspi_pins: qspi@0 {
-               pins {
-                       pinmux = <STM32F746_PB2_FUNC_QUADSPI_CLK>,
-                              <STM32F746_PB6_FUNC_QUADSPI_BK1_NCS>,
-                              <STM32F746_PD11_FUNC_QUADSPI_BK1_IO0>,
-                              <STM32F746_PD12_FUNC_QUADSPI_BK1_IO1>,
-                              <STM32F746_PD13_FUNC_QUADSPI_BK1_IO3>,
-                              <STM32F746_PE2_FUNC_QUADSPI_BK1_IO2>;
-                       slew-rate = <2>;
-               };
-       };
-
-       fmc_pins: fmc@0 {
-               pins {
-                       pinmux = <STM32F746_PD10_FUNC_FMC_D15>,
-                                <STM32F746_PD9_FUNC_FMC_D14>,
-                                <STM32F746_PD8_FUNC_FMC_D13>,
-                                <STM32F746_PE15_FUNC_FMC_D12>,
-                                <STM32F746_PE14_FUNC_FMC_D11>,
-                                <STM32F746_PE13_FUNC_FMC_D10>,
-                                <STM32F746_PE12_FUNC_FMC_D9>,
-                                <STM32F746_PE11_FUNC_FMC_D8>,
-                                <STM32F746_PE10_FUNC_FMC_D7>,
-                                <STM32F746_PE9_FUNC_FMC_D6>,
-                                <STM32F746_PE8_FUNC_FMC_D5>,
-                                <STM32F746_PE7_FUNC_FMC_D4>,
-                                <STM32F746_PD1_FUNC_FMC_D3>,
-                                <STM32F746_PD0_FUNC_FMC_D2>,
-                                <STM32F746_PD15_FUNC_FMC_D1>,
-                                <STM32F746_PD14_FUNC_FMC_D0>,
-
-                                <STM32F746_PE1_FUNC_FMC_NBL1>,
-                                <STM32F746_PE0_FUNC_FMC_NBL0>,
-
-                                <STM32F746_PG5_FUNC_FMC_A15_FMC_BA1>,
-                                <STM32F746_PG4_FUNC_FMC_A14_FMC_BA0>,
-
-                                <STM32F746_PG1_FUNC_FMC_A11>,
-                                <STM32F746_PG0_FUNC_FMC_A10>,
-                                <STM32F746_PF15_FUNC_FMC_A9>,
-                                <STM32F746_PF14_FUNC_FMC_A8>,
-                                <STM32F746_PF13_FUNC_FMC_A7>,
-                                <STM32F746_PF12_FUNC_FMC_A6>,
-                                <STM32F746_PF5_FUNC_FMC_A5>,
-                                <STM32F746_PF4_FUNC_FMC_A4>,
-                                <STM32F746_PF3_FUNC_FMC_A3>,
-                                <STM32F746_PF2_FUNC_FMC_A2>,
-                                <STM32F746_PF1_FUNC_FMC_A1>,
-                                <STM32F746_PF0_FUNC_FMC_A0>,
-
-                                <STM32F746_PH3_FUNC_FMC_SDNE0>,
-                                <STM32F746_PH5_FUNC_FMC_SDNWE>,
-                                <STM32F746_PF11_FUNC_FMC_SDNRAS>,
-                                <STM32F746_PG15_FUNC_FMC_SDNCAS>,
-                                <STM32F746_PC3_FUNC_FMC_SDCKE0>,
-                                <STM32F746_PG8_FUNC_FMC_SDCLK>;
-                         slew-rate = <2>;
-               };
-       };
-
-       ltdc_pins: ltdc@0 {
-               pins {
-                       pinmux = <STM32F746_PE4_FUNC_LCD_B0>,
-                              <STM32F746_PG12_FUNC_LCD_B4>,
-                              <STM32F746_PI9_FUNC_LCD_VSYNC>,
-                              <STM32F746_PI10_FUNC_LCD_HSYNC>,
-                              <STM32F746_PI14_FUNC_LCD_CLK>,
-                              <STM32F746_PI15_FUNC_LCD_R0>,
-                              <STM32F746_PJ0_FUNC_LCD_R1>,
-                              <STM32F746_PJ1_FUNC_LCD_R2>,
-                              <STM32F746_PJ2_FUNC_LCD_R3>,
-                              <STM32F746_PJ3_FUNC_LCD_R4>,
-                              <STM32F746_PJ4_FUNC_LCD_R5>,
-                              <STM32F746_PJ5_FUNC_LCD_R6>,
-                              <STM32F746_PJ6_FUNC_LCD_R7>,
-                              <STM32F746_PJ7_FUNC_LCD_G0>,
-                              <STM32F746_PJ8_FUNC_LCD_G1>,
-                              <STM32F746_PJ9_FUNC_LCD_G2>,
-                              <STM32F746_PJ10_FUNC_LCD_G3>,
-                              <STM32F746_PJ11_FUNC_LCD_G4>,
-                              <STM32F746_PJ13_FUNC_LCD_B1>,
-                              <STM32F746_PJ14_FUNC_LCD_B2>,
-                              <STM32F746_PJ15_FUNC_LCD_B3>,
-                              <STM32F746_PK0_FUNC_LCD_G5>,
-                              <STM32F746_PK1_FUNC_LCD_G6>,
-                              <STM32F746_PK2_FUNC_LCD_G7>,
-                              <STM32F746_PK4_FUNC_LCD_B5>,
-                              <STM32F746_PK5_FUNC_LCD_B6>,
-                              <STM32F746_PK6_FUNC_LCD_B7>,
-                              <STM32F746_PK7_FUNC_LCD_DE>;
-                       slew-rate = <2>;
-               };
-       };
-};
-
-&usart1 {
-       pinctrl-0 = <&usart1_pins_a>;
+&i2c1 {
+       pinctrl-0 = <&i2c1_pins_b>;
        pinctrl-names = "default";
+       i2c-scl-rising-time-ns = <185>;
+       i2c-scl-falling-time-ns = <20>;
        status = "okay";
 };
 
-&fmc {
-       pinctrl-0 = <&fmc_pins>;
-       pinctrl-names = "default";
-       status = "okay";
-
-       /* Memory configuration from sdram datasheet MT48LC_4M32_B2B5-6A */
-       bank1: bank@0 {
-              st,sdram-control = /bits/ 8 <NO_COL_8 NO_ROW_12 MWIDTH_16 BANKS_4
-                                           CAS_3 SDCLK_2 RD_BURST_EN
-                                           RD_PIPE_DL_0>;
-              st,sdram-timing = /bits/ 8 <TMRD_2 TXSR_6 TRAS_4 TRC_6 TWR_2
-                                          TRP_2 TRCD_2>;
-               /* refcount = (64msec/total_row_sdram)*freq - 20 */
-              st,sdram-refcount = < 1542 >;
-       };
-};
-
-&mac {
+&sdio1 {
        status = "okay";
-       pinctrl-0 = <&ethernet_mii>;
-       phy-mode = "rmii";
-       phy-handle = <&phy0>;
-
-       mdio0 {
-               #address-cells = <1>;
-               #size-cells = <0>;
-               compatible = "snps,dwmac-mdio";
-               phy0: ethernet-phy@0 {
-                       reg = <0>;
-               };
-       };
+       vmmc-supply = <&mmc_vcard>;
+       cd-gpios = <&gpioc 13 GPIO_ACTIVE_LOW>;
+       pinctrl-names = "default", "opendrain";
+       pinctrl-0 = <&sdio_pins_a>;
+       pinctrl-1 = <&sdio_pins_od_a>;
+       bus-width = <4>;
 };
 
-&qspi {
-       pinctrl-0 = <&qspi_pins>;
+&usart1 {
+       pinctrl-0 = <&usart1_pins_b>;
+       pinctrl-names = "default";
        status = "okay";
-
-       qflash0: n25q128a {
-                       #address-cells = <1>;
-                       #size-cells = <1>;
-                       compatible = "micron,n25q128a13", "jedec,spi-nor";
-                       spi-max-frequency = <108000000>;
-                       spi-tx-bus-width = <1>;
-                       spi-rx-bus-width = <1>;
-                       memory-map = <0x90000000 0x1000000>;
-                       reg = <0>;
-       };
 };
 
-&sdio {
+&usbotg_fs {
+       dr_mode = "host";
+       pinctrl-0 = <&usbotg_fs_pins_a>;
+       pinctrl-names = "default";
        status = "okay";
-       cd-gpios = <&gpioc 13 GPIO_ACTIVE_LOW>;
-       pinctrl-names = "default", "opendrain";
-       pinctrl-0 = <&sdio_pins>;
-       pinctrl-1 = <&sdio_pins_od>;
-       bus-width = <4>;
-       max-frequency = <25000000>;
 };
 
-&ltdc {
+&usbotg_hs {
+       dr_mode = "host";
+       phys = <&usbotg_hs_phy>;
+       phy-names = "usb2-phy";
+       pinctrl-0 = <&usbotg_hs_pins_b>;
+       pinctrl-names = "default";
        status = "okay";
-       pinctrl-0 = <&ltdc_pins>;
 };
diff --git a/arch/arm/dts/stm32f746-pinctrl.dtsi b/arch/arm/dts/stm32f746-pinctrl.dtsi
new file mode 100644 (file)
index 0000000..fcfd2ac
--- /dev/null
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+/*
+ * Copyright (C) STMicroelectronics 2017 - All Rights Reserved
+ * Author: Alexandre Torgue  <alexandre.torgue@st.com> for STMicroelectronics.
+ */
+
+#include "stm32f7-pinctrl.dtsi"
+
+&pinctrl{
+       compatible = "st,stm32f746-pinctrl";
+};
index afa7832f8936349817c8f36e812730a4cee828bd..f48d06a80d1d67e09cb2e0ba2a9873583df28947 100644 (file)
@@ -1,9 +1,4 @@
 /*
- * Copyright 2016 - Michael Kurz <michi.kurz@gmail.com>
- * Copyright 2016 - Vikas MANOCHA <vikas.manocha@st.com>
- *
- * Based on:
- * stm32f429.dtsi from Linux
  * Copyright 2015 - Maxime Coquelin <mcoquelin.stm32@gmail.com>
  *
  * This file is dual-licensed: you can use it either under the terms
@@ -45,8 +40,8 @@
  *     OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#include "skeleton.dtsi"
 #include "armv7-m.dtsi"
-#include <dt-bindings/pinctrl/stm32f746-pinfunc.h>
 #include <dt-bindings/clock/stm32fx-clock.h>
 #include <dt-bindings/mfd/stm32f7-rcc.h>
 
                        compatible = "fixed-clock";
                        clock-frequency = <0>;
                };
-};
+
+               clk-lse {
+                       #clock-cells = <0>;
+                       compatible = "fixed-clock";
+                       clock-frequency = <32768>;
+               };
+
+               clk-lsi {
+                       #clock-cells = <0>;
+                       compatible = "fixed-clock";
+                       clock-frequency = <32000>;
+               };
+
+               clk_i2s_ckin: clk-i2s-ckin {
+                       #clock-cells = <0>;
+                       compatible = "fixed-clock";
+                       clock-frequency = <48000000>;
+               };
+       };
 
        soc {
-               u-boot,dm-pre-reloc;
-               mac: ethernet@40028000 {
-                       compatible = "st,stm32-dwmac";
-                       reg = <0x40028000 0x8000>;
-                       reg-names = "stmmaceth";
-                       clocks = <&rcc 0 STM32F7_AHB1_CLOCK(ETHMAC)>,
-                                <&rcc 0 STM32F7_AHB1_CLOCK(ETHMACTX)>,
-                                <&rcc 0 STM32F7_AHB1_CLOCK(ETHMACRX)>;
-                       interrupts = <61>, <62>;
-                       interrupt-names = "macirq", "eth_wake_irq";
-                       snps,pbl = <8>;
-                       snps,mixed-burst;
-                       dma-ranges;
-                       status = "disabled";
-               };
-
-               fmc: fmc@A0000000 {
-                       compatible = "st,stm32-fmc";
-                       reg = <0xA0000000 0x1000>;
-                       clocks = <&rcc 0 STM32F7_AHB3_CLOCK(FMC)>;
-                       u-boot,dm-pre-reloc;
-               };
-
-               qspi: quadspi@A0001000 {
-                       compatible = "st,stm32-qspi";
+               timer2: timer@40000000 {
+                       compatible = "st,stm32-timer";
+                       reg = <0x40000000 0x400>;
+                       interrupts = <28>;
+                       clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM2)>;
+                       status = "disabled";
+               };
+
+               timers2: timers@40000000 {
                        #address-cells = <1>;
                        #size-cells = <0>;
-                       reg = <0xA0001000 0x1000>, <0x90000000 0x10000000>;
-                       reg-names = "qspi", "qspi_mm";
-                       interrupts = <92>;
-                       spi-max-frequency = <108000000>;
-                       clocks = <&rcc 0 STM32F7_AHB3_CLOCK(QSPI)>;
-                       resets = <&rcc STM32F7_AHB3_RESET(QSPI)>;
+                       compatible = "st,stm32-timers";
+                       reg = <0x40000000 0x400>;
+                       clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM2)>;
+                       clock-names = "int";
                        status = "disabled";
+
+                       pwm {
+                               compatible = "st,stm32-pwm";
+                               status = "disabled";
+                       };
+
+                       timer@1 {
+                               compatible = "st,stm32-timer-trigger";
+                               reg = <1>;
+                               status = "disabled";
+                       };
                };
-               usart1: serial@40011000 {
-                       compatible = "st,stm32f7-usart", "st,stm32f7-uart";
-                       reg = <0x40011000 0x400>;
-                       interrupts = <37>;
-                       clocks = <&rcc 0 STM32F7_APB2_CLOCK(USART1)>;
+
+               timer3: timer@40000400 {
+                       compatible = "st,stm32-timer";
+                       reg = <0x40000400 0x400>;
+                       interrupts = <29>;
+                       clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM3)>;
                        status = "disabled";
-                       u-boot,dm-pre-reloc;
                };
 
-               pwrcfg: power-config@58024800 {
-                       compatible = "syscon";
-                       reg = <0x40007000 0x400>;
+               timers3: timers@40000400 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "st,stm32-timers";
+                       reg = <0x40000400 0x400>;
+                       clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM3)>;
+                       clock-names = "int";
+                       status = "disabled";
+
+                       pwm {
+                               compatible = "st,stm32-pwm";
+                               status = "disabled";
+                       };
+
+                       timer@2 {
+                               compatible = "st,stm32-timer-trigger";
+                               reg = <2>;
+                               status = "disabled";
+                       };
                };
 
-               rcc: rcc@40023810 {
-                       #reset-cells = <1>;
-                       #clock-cells = <2>;
-                       compatible = "st,stm32f746-rcc", "st,stm32-rcc";
-                       reg = <0x40023800 0x400>;
-                       clocks = <&clk_hse>;
-                       st,syscfg = <&pwrcfg>;
-                       u-boot,dm-pre-reloc;
+               timer4: timer@40000800 {
+                       compatible = "st,stm32-timer";
+                       reg = <0x40000800 0x400>;
+                       interrupts = <30>;
+                       clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM4)>;
+                       status = "disabled";
                };
 
-               pinctrl: pin-controller {
+               timers4: timers@40000800 {
                        #address-cells = <1>;
-                       #size-cells = <1>;
-                       compatible = "st,stm32f746-pinctrl";
-                       ranges = <0 0x40020000 0x3000>;
-                       u-boot,dm-pre-reloc;
-                       pins-are-numbered;
-
-                       gpioa: gpio@40020000 {
-                               gpio-controller;
-                               #gpio-cells = <2>;
-                               compatible = "st,stm32-gpio";
-                               reg = <0x0 0x400>;
-                               clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOA)>;
-                               st,bank-name = "GPIOA";
-                               u-boot,dm-pre-reloc;
+                       #size-cells = <0>;
+                       compatible = "st,stm32-timers";
+                       reg = <0x40000800 0x400>;
+                       clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM4)>;
+                       clock-names = "int";
+                       status = "disabled";
+
+                       pwm {
+                               compatible = "st,stm32-pwm";
+                               status = "disabled";
                        };
 
-                       gpiob: gpio@40020400 {
-                               gpio-controller;
-                               #gpio-cells = <2>;
-                               compatible = "st,stm32-gpio";
-                               reg = <0x400 0x400>;
-                               clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOB)>;
-                               st,bank-name = "GPIOB";
-                               u-boot,dm-pre-reloc;
+                       timer@3 {
+                               compatible = "st,stm32-timer-trigger";
+                               reg = <3>;
+                               status = "disabled";
                        };
+               };
+
+               timer5: timer@40000c00 {
+                       compatible = "st,stm32-timer";
+                       reg = <0x40000c00 0x400>;
+                       interrupts = <50>;
+                       clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM5)>;
+               };
 
+               timers5: timers@40000c00 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "st,stm32-timers";
+                       reg = <0x40000C00 0x400>;
+                       clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM5)>;
+                       clock-names = "int";
+                       status = "disabled";
 
-                       gpioc: gpio@40020800 {
-                               gpio-controller;
-                               #gpio-cells = <2>;
-                               compatible = "st,stm32-gpio";
-                               reg = <0x800 0x400>;
-                               clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOC)>;
-                               st,bank-name = "GPIOC";
-                               u-boot,dm-pre-reloc;
+                       pwm {
+                               compatible = "st,stm32-pwm";
+                               status = "disabled";
                        };
 
-                       gpiod: gpio@40020c00 {
-                               gpio-controller;
-                               #gpio-cells = <2>;
-                               compatible = "st,stm32-gpio";
-                               reg = <0xc00 0x400>;
-                               clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOD)>;
-                               st,bank-name = "GPIOD";
-                               u-boot,dm-pre-reloc;
+                       timer@4 {
+                               compatible = "st,stm32-timer-trigger";
+                               reg = <4>;
+                               status = "disabled";
                        };
+               };
 
-                       gpioe: gpio@40021000 {
-                               gpio-controller;
-                               #gpio-cells = <2>;
-                               compatible = "st,stm32-gpio";
-                               reg = <0x1000 0x400>;
-                               clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOE)>;
-                               st,bank-name = "GPIOE";
-                               u-boot,dm-pre-reloc;
-                       };
+               timer6: timer@40001000 {
+                       compatible = "st,stm32-timer";
+                       reg = <0x40001000 0x400>;
+                       interrupts = <54>;
+                       clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM6)>;
+                       status = "disabled";
+               };
+
+               timers6: timers@40001000 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "st,stm32-timers";
+                       reg = <0x40001000 0x400>;
+                       clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM6)>;
+                       clock-names = "int";
+                       status = "disabled";
 
-                       gpiof: gpio@40021400 {
-                               gpio-controller;
-                               #gpio-cells = <2>;
-                               compatible = "st,stm32-gpio";
-                               reg = <0x1400 0x400>;
-                               clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOF)>;
-                               st,bank-name = "GPIOF";
-                               u-boot,dm-pre-reloc;
+                       timer@5 {
+                               compatible = "st,stm32-timer-trigger";
+                               reg = <5>;
+                               status = "disabled";
                        };
+               };
 
-                       gpiog: gpio@40021800 {
-                               gpio-controller;
-                               #gpio-cells = <2>;
-                               compatible = "st,stm32-gpio";
-                               reg = <0x1800 0x400>;
-                               clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOG)>;
-                               st,bank-name = "GPIOG";
-                               u-boot,dm-pre-reloc;
+               timer7: timer@40001400 {
+                       compatible = "st,stm32-timer";
+                       reg = <0x40001400 0x400>;
+                       interrupts = <55>;
+                       clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM7)>;
+                       status = "disabled";
+               };
+
+               timers7: timers@40001400 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "st,stm32-timers";
+                       reg = <0x40001400 0x400>;
+                       clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM7)>;
+                       clock-names = "int";
+                       status = "disabled";
+
+                       timer@6 {
+                               compatible = "st,stm32-timer-trigger";
+                               reg = <6>;
+                               status = "disabled";
                        };
+               };
+
+               timers12: timers@40001800 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "st,stm32-timers";
+                       reg = <0x40001800 0x400>;
+                       clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM12)>;
+                       clock-names = "int";
+                       status = "disabled";
 
-                       gpioh: gpio@40021c00 {
-                               gpio-controller;
-                               #gpio-cells = <2>;
-                               compatible = "st,stm32-gpio";
-                               reg = <0x1c00 0x400>;
-                               clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOH)>;
-                               st,bank-name = "GPIOH";
-                               u-boot,dm-pre-reloc;
+                       pwm {
+                               compatible = "st,stm32-pwm";
+                               status = "disabled";
                        };
 
-                       gpioi: gpio@40022000 {
-                               gpio-controller;
-                               #gpio-cells = <2>;
-                               compatible = "st,stm32-gpio";
-                               reg = <0x2000 0x400>;
-                               clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOI)>;
-                               st,bank-name = "GPIOI";
-                               u-boot,dm-pre-reloc;
+                       timer@11 {
+                               compatible = "st,stm32-timer-trigger";
+                               reg = <11>;
+                               status = "disabled";
                        };
+               };
 
-                       gpioj: gpio@40022400 {
-                               gpio-controller;
-                               #gpio-cells = <2>;
-                               compatible = "st,stm32-gpio";
-                               reg = <0x2400 0x400>;
-                               clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOJ)>;
-                               st,bank-name = "GPIOJ";
-                               u-boot,dm-pre-reloc;
+               timers13: timers@40001c00 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "st,stm32-timers";
+                       reg = <0x40001C00 0x400>;
+                       clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM13)>;
+                       clock-names = "int";
+                       status = "disabled";
+
+                       pwm {
+                               compatible = "st,stm32-pwm";
+                               status = "disabled";
                        };
+               };
 
-                       gpiok: gpio@40022800 {
-                               gpio-controller;
-                               #gpio-cells = <2>;
-                               compatible = "st,stm32-gpio";
-                               reg = <0x2800 0x400>;
-                               clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOK)>;
-                               st,bank-name = "GPIOK";
-                               u-boot,dm-pre-reloc;
+               timers14: timers@40002000 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "st,stm32-timers";
+                       reg = <0x40002000 0x400>;
+                       clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM14)>;
+                       clock-names = "int";
+                       status = "disabled";
+
+                       pwm {
+                               compatible = "st,stm32-pwm";
+                               status = "disabled";
                        };
+               };
+
+               rtc: rtc@40002800 {
+                       compatible = "st,stm32-rtc";
+                       reg = <0x40002800 0x400>;
+                       clocks = <&rcc 1 CLK_RTC>;
+                       clock-names = "ck_rtc";
+                       assigned-clocks = <&rcc 1 CLK_RTC>;
+                       assigned-clock-parents = <&rcc 1 CLK_LSE>;
+                       interrupt-parent = <&exti>;
+                       interrupts = <17 1>;
+                       interrupt-names = "alarm";
+                       st,syscfg = <&pwrcfg 0x00 0x100>;
+                       status = "disabled";
+               };
+
+               usart2: serial@40004400 {
+                       compatible = "st,stm32f7-uart";
+                       reg = <0x40004400 0x400>;
+                       interrupts = <38>;
+                       clocks = <&rcc 1 CLK_USART2>;
+                       status = "disabled";
+               };
+
+               usart3: serial@40004800 {
+                       compatible = "st,stm32f7-uart";
+                       reg = <0x40004800 0x400>;
+                       interrupts = <39>;
+                       clocks = <&rcc 1 CLK_USART3>;
+                       status = "disabled";
+               };
+
+               usart4: serial@40004c00 {
+                       compatible = "st,stm32f7-uart";
+                       reg = <0x40004c00 0x400>;
+                       interrupts = <52>;
+                       clocks = <&rcc 1 CLK_UART4>;
+                       status = "disabled";
+               };
+
+               usart5: serial@40005000 {
+                       compatible = "st,stm32f7-uart";
+                       reg = <0x40005000 0x400>;
+                       interrupts = <53>;
+                       clocks = <&rcc 1 CLK_UART5>;
+                       status = "disabled";
+               };
 
-                       sdio_pins: sdio_pins@0 {
-                               pins {
-                                       pinmux = <STM32F746_PC8_FUNC_SDMMC1_D0>,
-                                                <STM32F746_PC9_FUNC_SDMMC1_D1>,
-                                                <STM32F746_PC10_FUNC_SDMMC1_D2>,
-                                                <STM32F746_PC11_FUNC_SDMMC1_D3>,
-                                                <STM32F746_PC12_FUNC_SDMMC1_CK>,
-                                                <STM32F746_PD2_FUNC_SDMMC1_CMD>;
-                                       drive-push-pull;
-                                       slew-rate = <2>;
-                               };
+               i2c1: i2c@40005400 {
+                       compatible = "st,stm32f7-i2c";
+                       reg = <0x40005400 0x400>;
+                       interrupts = <31>,
+                                    <32>;
+                       resets = <&rcc STM32F7_APB1_RESET(I2C1)>;
+                       clocks = <&rcc 1 CLK_I2C1>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+               };
+
+               i2c2: i2c@40005800 {
+                       compatible = "st,stm32f7-i2c";
+                       reg = <0x40005800 0x400>;
+                       interrupts = <33>,
+                                    <34>;
+                       resets = <&rcc STM32F7_APB1_RESET(I2C2)>;
+                       clocks = <&rcc 1 CLK_I2C2>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+               };
+
+               i2c3: i2c@40005C00 {
+                       compatible = "st,stm32f7-i2c";
+                       reg = <0x40005C00 0x400>;
+                       interrupts = <72>,
+                                    <73>;
+                       resets = <&rcc STM32F7_APB1_RESET(I2C3)>;
+                       clocks = <&rcc 1 CLK_I2C3>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+               };
+
+               i2c4: i2c@40006000 {
+                       compatible = "st,stm32f7-i2c";
+                       reg = <0x40006000 0x400>;
+                       interrupts = <95>,
+                                    <96>;
+                       resets = <&rcc STM32F7_APB1_RESET(I2C4)>;
+                       clocks = <&rcc 1 CLK_I2C4>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+               };
+
+               cec: cec@40006c00 {
+                       compatible = "st,stm32-cec";
+                       reg = <0x40006C00 0x400>;
+                       interrupts = <94>;
+                       clocks = <&rcc 0 STM32F7_APB1_CLOCK(CEC)>, <&rcc 1 CLK_HDMI_CEC>;
+                       clock-names = "cec", "hdmi-cec";
+                       status = "disabled";
+               };
+
+               usart7: serial@40007800 {
+                       compatible = "st,stm32f7-uart";
+                       reg = <0x40007800 0x400>;
+                       interrupts = <82>;
+                       clocks = <&rcc 1 CLK_UART7>;
+                       status = "disabled";
+               };
+
+               usart8: serial@40007c00 {
+                       compatible = "st,stm32f7-uart";
+                       reg = <0x40007c00 0x400>;
+                       interrupts = <83>;
+                       clocks = <&rcc 1 CLK_UART8>;
+                       status = "disabled";
+               };
+
+               timers1: timers@40010000 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "st,stm32-timers";
+                       reg = <0x40010000 0x400>;
+                       clocks = <&rcc 0 STM32F7_APB2_CLOCK(TIM1)>;
+                       clock-names = "int";
+                       status = "disabled";
+
+                       pwm {
+                               compatible = "st,stm32-pwm";
+                               status = "disabled";
                        };
 
-                       sdio_pins_od: sdio_pins_od@0 {
-                               pins1 {
-                                       pinmux = <STM32F746_PC8_FUNC_SDMMC1_D0>,
-                                                <STM32F746_PC9_FUNC_SDMMC1_D1>,
-                                                <STM32F746_PC10_FUNC_SDMMC1_D2>,
-                                                <STM32F746_PC11_FUNC_SDMMC1_D3>,
-                                                <STM32F746_PC12_FUNC_SDMMC1_CK>;
-                                       drive-push-pull;
-                                       slew-rate = <2>;
-                               };
-
-                               pins2 {
-                                       pinmux = <STM32F746_PD2_FUNC_SDMMC1_CMD>;
-                                       drive-open-drain;
-                                       slew-rate = <2>;
-                               };
+                       timer@0 {
+                               compatible = "st,stm32-timer-trigger";
+                               reg = <0>;
+                               status = "disabled";
                        };
+               };
 
-                       sdio_pins_b: sdio_pins_b@0 {
-                               pins {
-                                       pinmux = <STM32F769_PG9_FUNC_SDMMC2_D0>,
-                                                <STM32F769_PG10_FUNC_SDMMC2_D1>,
-                                                <STM32F769_PB3_FUNC_SDMMC2_D2>,
-                                                <STM32F769_PB4_FUNC_SDMMC2_D3>,
-                                                <STM32F769_PD6_FUNC_SDMMC2_CLK>,
-                                                <STM32F769_PD7_FUNC_SDMMC2_CMD>;
-                                       drive-push-pull;
-                                       slew-rate = <2>;
-                               };
+               timers8: timers@40010400 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "st,stm32-timers";
+                       reg = <0x40010400 0x400>;
+                       clocks = <&rcc 0 STM32F7_APB2_CLOCK(TIM8)>;
+                       clock-names = "int";
+                       status = "disabled";
+
+                       pwm {
+                               compatible = "st,stm32-pwm";
+                               status = "disabled";
                        };
 
-                       sdio_pins_od_b: sdio_pins_od_b@0 {
-                               pins1 {
-                                       pinmux = <STM32F769_PG9_FUNC_SDMMC2_D0>,
-                                                <STM32F769_PG10_FUNC_SDMMC2_D1>,
-                                                <STM32F769_PB3_FUNC_SDMMC2_D2>,
-                                                <STM32F769_PB4_FUNC_SDMMC2_D3>,
-                                                <STM32F769_PD6_FUNC_SDMMC2_CLK>;
-                                       drive-push-pull;
-                                       slew-rate = <2>;
-                               };
-
-                               pins2 {
-                                       pinmux = <STM32F769_PD7_FUNC_SDMMC2_CMD>;
-                                       drive-open-drain;
-                                       slew-rate = <2>;
-                               };
+                       timer@7 {
+                               compatible = "st,stm32-timer-trigger";
+                               reg = <7>;
+                               status = "disabled";
                        };
+               };
 
+               usart1: serial@40011000 {
+                       compatible = "st,stm32f7-uart";
+                       reg = <0x40011000 0x400>;
+                       interrupts = <37>;
+                       clocks = <&rcc 1 CLK_USART1>;
+                       status = "disabled";
                };
-               sdio: sdio@40012c00 {
-                       compatible = "st,stm32f4xx-sdio";
-                       reg = <0x40012c00 0x400>;
-                       clocks = <&rcc 0 171>;
-                       interrupts = <49>;
+
+               usart6: serial@40011400 {
+                       compatible = "st,stm32f7-uart";
+                       reg = <0x40011400 0x400>;
+                       interrupts = <71>;
+                       clocks = <&rcc 1 CLK_USART6>;
                        status = "disabled";
-                       pinctrl-0 = <&sdio_pins>;
-                       pinctrl-1 = <&sdio_pins_od>;
-                       pinctrl-names = "default", "opendrain";
-                       max-frequency = <48000000>;
                };
 
                sdio2: sdio2@40011c00 {
-                       compatible = "st,stm32f4xx-sdio";
+                       compatible = "arm,pl180", "arm,primecell";
+                       arm,primecell-periphid = <0x00880180>;
                        reg = <0x40011c00 0x400>;
-                       clocks = <&rcc 0 167>;
+                       clocks = <&rcc 0 STM32F7_APB2_CLOCK(SDMMC2)>;
+                       clock-names = "apb_pclk";
                        interrupts = <103>;
+                       max-frequency = <48000000>;
                        status = "disabled";
-                       pinctrl-0 = <&sdio_pins_b>;
-                       pinctrl-1 = <&sdio_pins_od_b>;
-                       pinctrl-names = "default", "opendrain";
+               };
+
+               sdio1: sdio1@40012c00 {
+                       compatible = "arm,pl180", "arm,primecell";
+                       arm,primecell-periphid = <0x00880180>;
+                       reg = <0x40012c00 0x400>;
+                       clocks = <&rcc 0 STM32F7_APB2_CLOCK(SDMMC1)>;
+                       clock-names = "apb_pclk";
+                       interrupts = <49>;
                        max-frequency = <48000000>;
+                       status = "disabled";
                };
 
-               timer5: timer@40000c00 {
-                       compatible = "st,stm32-timer";
-                       reg = <0x40000c00 0x400>;
-                       interrupts = <50>;
-                       clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM5)>;
+               syscfg: system-config@40013800 {
+                       compatible = "syscon";
+                       reg = <0x40013800 0x400>;
+               };
+
+               exti: interrupt-controller@40013c00 {
+                       compatible = "st,stm32-exti";
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       reg = <0x40013C00 0x400>;
+                       interrupts = <1>, <2>, <3>, <6>, <7>, <8>, <9>, <10>, <23>, <40>, <41>, <42>, <62>, <76>;
+               };
+
+               timers9: timers@40014000 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "st,stm32-timers";
+                       reg = <0x40014000 0x400>;
+                       clocks = <&rcc 0 STM32F7_APB2_CLOCK(TIM9)>;
+                       clock-names = "int";
+                       status = "disabled";
+
+                       pwm {
+                               compatible = "st,stm32-pwm";
+                               status = "disabled";
+                       };
+
+                       timer@8 {
+                               compatible = "st,stm32-timer-trigger";
+                               reg = <8>;
+                               status = "disabled";
+                       };
+               };
+
+               timers10: timers@40014400 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "st,stm32-timers";
+                       reg = <0x40014400 0x400>;
+                       clocks = <&rcc 0 STM32F7_APB2_CLOCK(TIM10)>;
+                       clock-names = "int";
+                       status = "disabled";
+
+                       pwm {
+                               compatible = "st,stm32-pwm";
+                               status = "disabled";
+                       };
+               };
+
+               timers11: timers@40014800 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "st,stm32-timers";
+                       reg = <0x40014800 0x400>;
+                       clocks = <&rcc 0 STM32F7_APB2_CLOCK(TIM11)>;
+                       clock-names = "int";
+                       status = "disabled";
+
+                       pwm {
+                               compatible = "st,stm32-pwm";
+                               status = "disabled";
+                       };
+               };
+
+               pwrcfg: power-config@40007000 {
+                       compatible = "syscon";
+                       reg = <0x40007000 0x400>;
+               };
+
+               crc: crc@40023000 {
+                       compatible = "st,stm32f7-crc";
+                       reg = <0x40023000 0x400>;
+                       clocks = <&rcc 0 12>;
+                       status = "disabled";
+               };
+
+               rcc: rcc@40023800 {
+                       #reset-cells = <1>;
+                       #clock-cells = <2>;
+                       compatible = "st,stm32f746-rcc", "st,stm32-rcc";
+                       reg = <0x40023800 0x400>;
+                       clocks = <&clk_hse>, <&clk_i2s_ckin>;
+                       st,syscfg = <&pwrcfg>;
+                       assigned-clocks = <&rcc 1 CLK_HSE_RTC>;
+                       assigned-clock-rates = <1000000>;
+               };
+
+               dma1: dma@40026000 {
+                       compatible = "st,stm32-dma";
+                       reg = <0x40026000 0x400>;
+                       interrupts = <11>,
+                                    <12>,
+                                    <13>,
+                                    <14>,
+                                    <15>,
+                                    <16>,
+                                    <17>,
+                                    <47>;
+                       clocks = <&rcc 0 STM32F7_AHB1_CLOCK(DMA1)>;
+                       #dma-cells = <4>;
+                       status = "disabled";
+               };
+
+               dma2: dma@40026400 {
+                       compatible = "st,stm32-dma";
+                       reg = <0x40026400 0x400>;
+                       interrupts = <56>,
+                                    <57>,
+                                    <58>,
+                                    <59>,
+                                    <60>,
+                                    <68>,
+                                    <69>,
+                                    <70>;
+                       clocks = <&rcc 0 STM32F7_AHB1_CLOCK(DMA2)>;
+                       #dma-cells = <4>;
+                       st,mem2mem;
+                       status = "disabled";
+               };
+
+               usbotg_hs: usb@40040000 {
+                       compatible = "st,stm32f7-hsotg";
+                       reg = <0x40040000 0x40000>;
+                       interrupts = <77>;
+                       clocks = <&rcc 0 STM32F7_AHB1_CLOCK(OTGHS)>;
+                       clock-names = "otg";
+                       g-rx-fifo-size = <256>;
+                       g-np-tx-fifo-size = <32>;
+                       g-tx-fifo-size = <128 128 64 64 64 64 32 32>;
+                       status = "disabled";
                };
 
-               ltdc: display-controller@40016800 {
-                       compatible = "st,stm32-ltdc";
-                       reg = <0x40016800 0x200>;
-                       resets = <&rcc STM32F7_APB2_RESET(LTDC)>;
-                       clocks = <&rcc 0 STM32F7_APB2_CLOCK(LTDC)>;
-                       u-boot,dm-pre-reloc;
+               usbotg_fs: usb@50000000 {
+                       compatible = "st,stm32f4x9-fsotg";
+                       reg = <0x50000000 0x40000>;
+                       interrupts = <67>;
+                       clocks = <&rcc 0 STM32F7_AHB2_CLOCK(OTGFS)>;
+                       clock-names = "otg";
                        status = "disabled";
                };
        };
 };
 
 &systick {
+       clocks = <&rcc 1 0>;
        status = "okay";
 };
diff --git a/arch/arm/dts/stm32f769-disco-u-boot.dtsi b/arch/arm/dts/stm32f769-disco-u-boot.dtsi
new file mode 100644 (file)
index 0000000..e9e43cb
--- /dev/null
@@ -0,0 +1,165 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include <stm32f7-u-boot.dtsi>
+/{
+       chosen {
+               bootargs = "root=/dev/ram rdinit=/linuxrc";
+       };
+
+       aliases {
+               /* Aliases for gpios so as to use sequence */
+               gpio0 = &gpioa;
+               gpio1 = &gpiob;
+               gpio2 = &gpioc;
+               gpio3 = &gpiod;
+               gpio4 = &gpioe;
+               gpio5 = &gpiof;
+               gpio6 = &gpiog;
+               gpio7 = &gpioh;
+               gpio8 = &gpioi;
+               gpio9 = &gpioj;
+               gpio10 = &gpiok;
+               mmc0 = &sdio2;
+               spi0 = &qspi;
+       };
+
+       button1 {
+               compatible = "st,button1";
+               button-gpio = <&gpioa 0 0>;
+       };
+
+       led1 {
+               compatible = "st,led1";
+               led-gpio = <&gpioj 5 0>;
+       };
+};
+
+&fmc {
+       /* Memory configuration from sdram datasheet MT48LC_4M32_B2B5-6A */
+       bank1: bank@0 {
+               u-boot,dm-pre-reloc;
+               st,sdram-control = /bits/ 8 <NO_COL_8
+                                            NO_ROW_12
+                                            MWIDTH_32
+                                            BANKS_4
+                                            CAS_3
+                                            SDCLK_2
+                                            RD_BURST_EN
+                                            RD_PIPE_DL_0>;
+               st,sdram-timing = /bits/ 8 <TMRD_2
+                                           TXSR_6
+                                           TRAS_4
+                                           TRC_6
+                                           TWR_2
+                                           TRP_2
+                                           TRCD_2>;
+               /* refcount = (64msec/total_row_sdram)*freq - 20 */
+               st,sdram-refcount = < 1542 >;
+       };
+};
+
+&pinctrl {
+       ethernet_mii: mii@0 {
+               pins {
+                       pinmux = <STM32_PINMUX('G',13, AF11)>, /* ETH_RMII_TXD0 */
+                                <STM32_PINMUX('G',14, AF11)>, /* ETH_RMII_TXD1 */
+                                <STM32_PINMUX('G',11, AF11)>, /* ETH_RMII_TX_EN */
+                                <STM32_PINMUX('A', 2, AF11)>, /* ETH_MDIO */
+                                <STM32_PINMUX('C', 1, AF11)>, /* ETH_MDC */
+                                <STM32_PINMUX('A', 1, AF11)>, /* ETH_RMII_REF_CLK */
+                                <STM32_PINMUX('A', 7, AF11)>, /* ETH_RMII_CRS_DV */
+                                <STM32_PINMUX('C', 4, AF11)>, /* ETH_RMII_RXD0 */
+                                <STM32_PINMUX('C', 5, AF11)>; /* ETH_RMII_RXD1 */
+                       slew-rate = <2>;
+               };
+       };
+
+       fmc_pins: fmc@0 {
+               pins {
+                       pinmux = <STM32_PINMUX('I',10, AF12)>, /* D31 */
+                                <STM32_PINMUX('I', 9, AF12)>, /* D30 */
+                                <STM32_PINMUX('I', 7, AF12)>, /* D29 */
+                                <STM32_PINMUX('I', 6, AF12)>, /* D28 */
+                                <STM32_PINMUX('I', 3, AF12)>, /* D27 */
+                                <STM32_PINMUX('I', 2, AF12)>, /* D26 */
+                                <STM32_PINMUX('I', 1, AF12)>, /* D25 */
+                                <STM32_PINMUX('I', 0, AF12)>, /* D24 */
+                                <STM32_PINMUX('H',15, AF12)>, /* D23 */
+                                <STM32_PINMUX('H',14, AF12)>, /* D22 */
+                                <STM32_PINMUX('H',13, AF12)>, /* D21 */
+                                <STM32_PINMUX('H',12, AF12)>, /* D20 */
+                                <STM32_PINMUX('H',11, AF12)>, /* D19 */
+                                <STM32_PINMUX('H',10, AF12)>, /* D18 */
+                                <STM32_PINMUX('H', 9, AF12)>, /* D17 */
+                                <STM32_PINMUX('H', 8, AF12)>, /* D16 */
+
+                                <STM32_PINMUX('D',10, AF12)>, /* D15 */
+                                <STM32_PINMUX('D', 9, AF12)>, /* D14 */
+                                <STM32_PINMUX('D', 8, AF12)>, /* D13 */
+                                <STM32_PINMUX('E',15, AF12)>, /* D12 */
+                                <STM32_PINMUX('E',14, AF12)>, /* D11 */
+                                <STM32_PINMUX('E',13, AF12)>, /* D10 */
+                                <STM32_PINMUX('E',12, AF12)>, /* D9 */
+                                <STM32_PINMUX('E',11, AF12)>, /* D8 */
+                                <STM32_PINMUX('E',10, AF12)>, /* D7 */
+                                <STM32_PINMUX('E', 9, AF12)>, /* D6 */
+                                <STM32_PINMUX('E', 8, AF12)>, /* D5 */
+                                <STM32_PINMUX('E', 7, AF12)>, /* D4 */
+                                <STM32_PINMUX('D', 1, AF12)>, /* D3 */
+                                <STM32_PINMUX('D', 0, AF12)>, /* D2 */
+                                <STM32_PINMUX('D',15, AF12)>, /* D1 */
+                                <STM32_PINMUX('D',14, AF12)>, /* D0 */
+
+                                <STM32_PINMUX('I', 5, AF12)>, /* NBL3 */
+                                <STM32_PINMUX('I', 4, AF12)>, /* NBL2 */
+                                <STM32_PINMUX('E', 1, AF12)>, /* NBL1 */
+                                <STM32_PINMUX('E', 0, AF12)>, /* NBL0 */
+
+                                <STM32_PINMUX('G', 5, AF12)>, /* BA1 */
+                                <STM32_PINMUX('G', 4, AF12)>, /* BA0 */
+
+                                <STM32_PINMUX('G', 1, AF12)>, /* A11 */
+                                <STM32_PINMUX('G', 0, AF12)>, /* A10 */
+                                <STM32_PINMUX('F',15, AF12)>, /* A9 */
+                                <STM32_PINMUX('F',14, AF12)>, /* A8 */
+                                <STM32_PINMUX('F',13, AF12)>, /* A7 */
+                                <STM32_PINMUX('F',12, AF12)>, /* A6 */
+                                <STM32_PINMUX('F', 5, AF12)>, /* A5 */
+                                <STM32_PINMUX('F', 4, AF12)>, /* A4 */
+                                <STM32_PINMUX('F', 3, AF12)>, /* A3 */
+                                <STM32_PINMUX('F', 2, AF12)>, /* A2 */
+                                <STM32_PINMUX('F', 1, AF12)>, /* A1 */
+                                <STM32_PINMUX('F', 0, AF12)>, /* A0 */
+
+                                <STM32_PINMUX('H', 3, AF12)>, /* SDNE0 */
+                                <STM32_PINMUX('H', 5, AF12)>, /* SDNWE */
+                                <STM32_PINMUX('F',11, AF12)>, /* SDNRAS */
+                                <STM32_PINMUX('G',15, AF12)>, /* SDNCAS */
+                                <STM32_PINMUX('H', 2, AF12)>, /* SDCKE0 */
+                                <STM32_PINMUX('G', 8, AF12)>; /* SDCLK> */
+                       slew-rate = <2>;
+               };
+       };
+
+       qspi_pins: qspi@0 {
+               pins {
+                       pinmux = <STM32_PINMUX('B', 2, AF9)>, /* CLK */
+                                <STM32_PINMUX('B', 6, AF10)>, /* BK1_NCS */
+                                <STM32_PINMUX('C', 9, AF9)>, /* BK1_IO0 */
+                                <STM32_PINMUX('C',10, AF9)>, /* BK1_IO1 */
+                                <STM32_PINMUX('D',13, AF9)>, /* BK1_IO3 */
+                                <STM32_PINMUX('E', 2, AF9)>; /* BK1_IO2 */
+                       slew-rate = <2>;
+               };
+       };
+};
+
+&qspi {
+       flash0: mx66l51235l {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               spi-max-frequency = <108000000>;
+               spi-rx-bus-width = <4>;
+               reg = <0>;
+       };
+};
index a23d02d3008751570eb3026401c2efd4f8339360..483d896e2bc13376b0a261474ccdb6a56dcbf32d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 - Vikas Manocha <vikas.manocha@st.com>
+ * Copyright 2017 - Vikas MANOCHA <vikas.manocha@st.com>
  *
  * 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
 
 /dts-v1/;
 #include "stm32f746.dtsi"
-#include <dt-bindings/memory/stm32-sdram.h>
+#include "stm32f769-pinctrl.dtsi"
+#include <dt-bindings/input/input.h>
 #include <dt-bindings/gpio/gpio.h>
 
 / {
        model = "STMicroelectronics STM32F769-DISCO board";
-       compatible = "st,stm32f769-disco", "st,stm32f7";
+       compatible = "st,stm32f769-disco", "st,stm32f769";
 
        chosen {
-               bootargs = "root=/dev/ram rdinit=/linuxrc";
+               bootargs = "root=/dev/ram";
                stdout-path = "serial0:115200n8";
        };
 
 
        aliases {
                serial0 = &usart1;
-               spi0 = &qspi;
-               mmc0 = &sdio2;
-               /* Aliases for gpios so as to use sequence */
-               gpio0 = &gpioa;
-               gpio1 = &gpiob;
-               gpio2 = &gpioc;
-               gpio3 = &gpiod;
-               gpio4 = &gpioe;
-               gpio5 = &gpiof;
-               gpio6 = &gpiog;
-               gpio7 = &gpioh;
-               gpio8 = &gpioi;
-               gpio9 = &gpioj;
-               gpio10 = &gpiok;
        };
 
-       led1 {
-               compatible = "st,led1";
-               led-gpio = <&gpioj 5 0>;
-       };
-
-       button1 {
-               compatible = "st,button1";
-               button-gpio = <&gpioa 0 0>;
-       };
-};
-
-&clk_hse {
-       clock-frequency = <25000000>;
-};
-
-&pinctrl {
-       usart1_pins_a: usart1@0 {
-               pins1 {
-                      pinmux = <STM32F746_PA9_FUNC_USART1_TX>;
-                               bias-disable;
-                               drive-push-pull;
-                               slew-rate = <2>;
+       leds {
+               compatible = "gpio-leds";
+               green {
+                       gpios = <&gpioj 5 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "heartbeat";
                };
-               pins2 {
-                       pinmux = <STM32F746_PA10_FUNC_USART1_RX>;
-                       bias-disable;
+               red {
+                       gpios = <&gpioj 13 GPIO_ACTIVE_HIGH>;
                };
        };
 
-       ethernet_mii: mii@0 {
-             pins {
-                     pinmux = <STM32F746_PG13_FUNC_ETH_MII_TXD0_ETH_RMII_TXD0>,
-                            <STM32F746_PG14_FUNC_ETH_MII_TXD1_ETH_RMII_TXD1>,
-                            <STM32F746_PG11_FUNC_ETH_MII_TX_EN_ETH_RMII_TX_EN>,
-                            <STM32F746_PA2_FUNC_ETH_MDIO>,
-                            <STM32F746_PC1_FUNC_ETH_MDC>,
-                            <STM32F746_PA1_FUNC_ETH_MII_RX_CLK_ETH_RMII_REF_CLK>,
-                            <STM32F746_PA7_FUNC_ETH_MII_RX_DV_ETH_RMII_CRS_DV>,
-                            <STM32F746_PC4_FUNC_ETH_MII_RXD0_ETH_RMII_RXD0>,
-                            <STM32F746_PC5_FUNC_ETH_MII_RXD1_ETH_RMII_RXD1>;
-                     slew-rate = <2>;
-             };
-       };
-
-       qspi_pins: qspi@0 {
-               pins {
-                       pinmux = <STM32F746_PB2_FUNC_QUADSPI_CLK>,
-                              <STM32F746_PB6_FUNC_QUADSPI_BK1_NCS>,
-                              <STM32F746_PC9_FUNC_QUADSPI_BK1_IO0>,
-                              <STM32F746_PC10_FUNC_QUADSPI_BK1_IO1>,
-                              <STM32F746_PD13_FUNC_QUADSPI_BK1_IO3>,
-                              <STM32F746_PE2_FUNC_QUADSPI_BK1_IO2>;
-                       slew-rate = <2>;
+       gpio_keys {
+               compatible = "gpio-keys";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               autorepeat;
+               button@0 {
+                       label = "User";
+                       linux,code = <KEY_HOME>;
+                       gpios = <&gpioa 0 GPIO_ACTIVE_HIGH>;
                };
        };
 
-       fmc_pins: fmc@0 {
-                 pins {
-                         pinmux = <STM32F746_PI10_FUNC_FMC_D31>,
-                                <STM32F746_PI9_FUNC_FMC_D30>,
-                                <STM32F746_PI7_FUNC_FMC_D29>,
-                                <STM32F746_PI6_FUNC_FMC_D28>,
-                                <STM32F746_PI3_FUNC_FMC_D27>,
-                                <STM32F746_PI2_FUNC_FMC_D26>,
-                                <STM32F746_PI1_FUNC_FMC_D25>,
-                                <STM32F746_PI0_FUNC_FMC_D24>,
-                                <STM32F746_PH15_FUNC_FMC_D23>,
-                                <STM32F746_PH14_FUNC_FMC_D22>,
-                                <STM32F746_PH13_FUNC_FMC_D21>,
-                                <STM32F746_PH12_FUNC_FMC_D20>,
-                                <STM32F746_PH11_FUNC_FMC_D19>,
-                                <STM32F746_PH10_FUNC_FMC_D18>,
-                                <STM32F746_PH9_FUNC_FMC_D17>,
-                                <STM32F746_PH8_FUNC_FMC_D16>,
-
-                                <STM32F746_PD10_FUNC_FMC_D15>,
-                                <STM32F746_PD9_FUNC_FMC_D14>,
-                                <STM32F746_PD8_FUNC_FMC_D13>,
-                                <STM32F746_PE15_FUNC_FMC_D12>,
-                                <STM32F746_PE14_FUNC_FMC_D11>,
-                                <STM32F746_PE13_FUNC_FMC_D10>,
-                                <STM32F746_PE12_FUNC_FMC_D9>,
-                                <STM32F746_PE11_FUNC_FMC_D8>,
-                                <STM32F746_PE10_FUNC_FMC_D7>,
-                                <STM32F746_PE9_FUNC_FMC_D6>,
-                                <STM32F746_PE8_FUNC_FMC_D5>,
-                                <STM32F746_PE7_FUNC_FMC_D4>,
-                                <STM32F746_PD1_FUNC_FMC_D3>,
-                                <STM32F746_PD0_FUNC_FMC_D2>,
-                                <STM32F746_PD15_FUNC_FMC_D1>,
-                                <STM32F746_PD14_FUNC_FMC_D0>,
-
-                                <STM32F746_PI5_FUNC_FMC_NBL3>,
-                                <STM32F746_PI4_FUNC_FMC_NBL2>,
-                                <STM32F746_PE1_FUNC_FMC_NBL1>,
-                                <STM32F746_PE0_FUNC_FMC_NBL0>,
-
-                                <STM32F746_PG5_FUNC_FMC_A15_FMC_BA1>,
-                                <STM32F746_PG4_FUNC_FMC_A14_FMC_BA0>,
-
-                                <STM32F746_PG1_FUNC_FMC_A11>,
-                                <STM32F746_PG0_FUNC_FMC_A10>,
-                                <STM32F746_PF15_FUNC_FMC_A9>,
-                                <STM32F746_PF14_FUNC_FMC_A8>,
-                                <STM32F746_PF13_FUNC_FMC_A7>,
-                                <STM32F746_PF12_FUNC_FMC_A6>,
-                                <STM32F746_PF5_FUNC_FMC_A5>,
-                                <STM32F746_PF4_FUNC_FMC_A4>,
-                                <STM32F746_PF3_FUNC_FMC_A3>,
-                                <STM32F746_PF2_FUNC_FMC_A2>,
-                                <STM32F746_PF1_FUNC_FMC_A1>,
-                                <STM32F746_PF0_FUNC_FMC_A0>,
+       usbotg_hs_phy: usb-phy {
+               #phy-cells = <0>;
+               compatible = "usb-nop-xceiv";
+               clocks = <&rcc 0 STM32F7_AHB1_CLOCK(OTGHSULPI)>;
+               clock-names = "main_clk";
+       };
 
-                                <STM32F746_PH3_FUNC_FMC_SDNE0>,
-                                <STM32F746_PH5_FUNC_FMC_SDNWE>,
-                                <STM32F746_PF11_FUNC_FMC_SDNRAS>,
-                                <STM32F746_PG15_FUNC_FMC_SDNCAS>,
-                                <STM32F746_PH2_FUNC_FMC_SDCKE0>,
-                                <STM32F746_PG8_FUNC_FMC_SDCLK>;
-                         slew-rate = <2>;
-                 };
-         };
+       mmc_vcard: mmc_vcard {
+               compatible = "regulator-fixed";
+               regulator-name = "mmc_vcard";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+       };
 };
 
-&usart1 {
-       pinctrl-0 = <&usart1_pins_a>;
+&cec {
+       pinctrl-0 = <&cec_pins_a>;
        pinctrl-names = "default";
        status = "okay";
 };
 
-&fmc {
-       pinctrl-0 = <&fmc_pins>;
-       pinctrl-names = "default";
-       status = "okay";
-
-       /* Memory configuration from sdram datasheet MT48LC_4M32_B2B5-6A */
-       bank1: bank@0 {
-              st,sdram-control = /bits/ 8 <NO_COL_8 NO_ROW_12 MWIDTH_32 BANKS_4
-                                           CAS_3 SDCLK_2 RD_BURST_EN
-                                           RD_PIPE_DL_0>;
-              st,sdram-timing = /bits/ 8 <TMRD_2 TXSR_6 TRAS_4 TRC_6 TWR_2
-                                          TRP_2 TRCD_2>;
-               /* refcount = (64msec/total_row_sdram)*freq - 20 */
-              st,sdram-refcount = < 1542 >;
-       };
+&clk_hse {
+       clock-frequency = <25000000>;
 };
 
-&mac {
+&i2c1 {
+       pinctrl-0 = <&i2c1_pins_b>;
+       pinctrl-names = "default";
+       i2c-scl-rising-time-ns = <185>;
+       i2c-scl-falling-time-ns = <20>;
        status = "okay";
-       pinctrl-0 = <&ethernet_mii>;
-       phy-mode = "rmii";
-       phy-handle = <&phy0>;
-
-       mdio0 {
-               #address-cells = <1>;
-               #size-cells = <0>;
-               compatible = "snps,dwmac-mdio";
-               phy0: ethernet-phy@0 {
-                       reg = <0>;
-               };
-       };
 };
 
-&qspi {
-       pinctrl-0 = <&qspi_pins>;
+&rtc {
        status = "okay";
-
-       qflash0: n25q128a {
-                       #address-cells = <1>;
-                       #size-cells = <1>;
-                       compatible = "micron,n25q128a13", "jedec,spi-nor";
-                       spi-max-frequency = <108000000>;
-                       spi-tx-bus-width = <1>;
-                       spi-rx-bus-width = <1>;
-                       memory-map = <0x90000000 0x1000000>;
-                       reg = <0>;
-       };
 };
 
 &sdio2 {
        status = "okay";
+       vmmc-supply = <&mmc_vcard>;
        cd-gpios = <&gpioi 15 GPIO_ACTIVE_LOW>;
+       broken-cd;
        pinctrl-names = "default", "opendrain";
        pinctrl-0 = <&sdio_pins_b>;
        pinctrl-1 = <&sdio_pins_od_b>;
        bus-width = <4>;
-       max-frequency = <25000000>;
+};
+
+&usart1 {
+       pinctrl-0 = <&usart1_pins_a>;
+       pinctrl-names = "default";
+       status = "okay";
+};
+
+&usbotg_hs {
+       dr_mode = "otg";
+       phys = <&usbotg_hs_phy>;
+       phy-names = "usb2-phy";
+       pinctrl-0 = <&usbotg_hs_pins_a>;
+       pinctrl-names = "default";
+       status = "okay";
 };
diff --git a/arch/arm/dts/stm32f769-pinctrl.dtsi b/arch/arm/dts/stm32f769-pinctrl.dtsi
new file mode 100644 (file)
index 0000000..31005dd
--- /dev/null
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+/*
+ * Copyright (C) STMicroelectronics 2017 - All Rights Reserved
+ * Author: Alexandre Torgue  <alexandre.torgue@st.com> for STMicroelectronics.
+ */
+
+#include "stm32f7-pinctrl.dtsi"
+
+&pinctrl{
+       compatible = "st,stm32f769-pinctrl";
+};
index 2525035da19db61a166eada795f32c6b533df6ef..99fa0e673a11785c4995b9b1660dec8fee3901aa 100644 (file)
@@ -1,13 +1,77 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include <dt-bindings/memory/stm32-sdram.h>
+
 /{
        clocks {
                u-boot,dm-pre-reloc;
        };
 
+       aliases {
+               gpio0 = &gpioa;
+               gpio1 = &gpiob;
+               gpio2 = &gpioc;
+               gpio3 = &gpiod;
+               gpio4 = &gpioe;
+               gpio5 = &gpiof;
+               gpio6 = &gpiog;
+               gpio7 = &gpioh;
+               gpio8 = &gpioi;
+               gpio9 = &gpioj;
+               gpio10 = &gpiok;
+               mmc0 = &sdmmc1;
+       };
+
        soc {
                u-boot,dm-pre-reloc;
                pin-controller {
                        u-boot,dm-pre-reloc;
                };
+
+               fmc: fmc@52004000 {
+                       compatible = "st,stm32h7-fmc";
+                       reg = <0x52004000 0x1000>;
+                       clocks = <&rcc FMC_CK>;
+
+                       pinctrl-0 = <&fmc_pins>;
+                       pinctrl-names = "default";
+                       status = "okay";
+
+                       /*
+                        * Memory configuration from sdram datasheet IS42S32800G-6BLI
+                        * firsct bank is bank@0
+                        * second bank is bank@1
+                        */
+                       bank1: bank@1 {
+                               st,sdram-control = /bits/ 8 <NO_COL_9
+                                                            NO_ROW_12
+                                                            MWIDTH_32
+                                                            BANKS_4
+                                                            CAS_2
+                                                            SDCLK_3
+                                                            RD_BURST_EN
+                                                            RD_PIPE_DL_0>;
+                               st,sdram-timing = /bits/ 8 <TMRD_1
+                                                           TXSR_1
+                                                           TRAS_1
+                                                           TRC_6
+                                                           TRP_2
+                                                           TWR_1
+                                                           TRCD_1>;
+                               st,sdram-refcount = <1539>;
+                       };
+               };
+
+               sdmmc1: sdmmc@52007000 {
+                       compatible = "st,stm32-sdmmc2";
+                       reg = <0x52007000 0x1000>;
+                       interrupts = <49>;
+                       clocks = <&rcc SDMMC1_CK>;
+                       resets = <&rcc STM32H7_AHB3_RESET(SDMMC1)>;
+                       st,idma = <1>;
+                       cap-sd-highspeed;
+                       cap-mmc-highspeed;
+               };
        };
 };
 
        u-boot,dm-pre-reloc;
 };
 
-&clk_lse {
-       u-boot,dm-pre-reloc;
-};
-
 &clk_i2s {
        u-boot,dm-pre-reloc;
 };
 
-&pwrcfg {
+&clk_lse {
        u-boot,dm-pre-reloc;
 };
 
-&rcc {
-       u-boot,dm-pre-reloc;
-};
 
 &fmc {
        u-boot,dm-pre-reloc;
 };
 
-&clk_hsi {
-       u-boot,dm-pre-reloc;
-};
-
-&clk_csi {
-       u-boot,dm-pre-reloc;
-};
-
 &gpioa {
        u-boot,dm-pre-reloc;
+       compatible = "st,stm32-gpio";
 };
 
 &gpiob {
        u-boot,dm-pre-reloc;
+       compatible = "st,stm32-gpio";
 };
 
 &gpioc {
        u-boot,dm-pre-reloc;
+       compatible = "st,stm32-gpio";
 };
 
 &gpiod {
        u-boot,dm-pre-reloc;
+       compatible = "st,stm32-gpio";
 };
 
 &gpioe {
        u-boot,dm-pre-reloc;
+       compatible = "st,stm32-gpio";
 };
 
 &gpiof {
        u-boot,dm-pre-reloc;
+       compatible = "st,stm32-gpio";
 };
 
 &gpiog {
        u-boot,dm-pre-reloc;
+       compatible = "st,stm32-gpio";
 };
 
 &gpioh {
        u-boot,dm-pre-reloc;
+       compatible = "st,stm32-gpio";
 };
 
 &gpioi {
        u-boot,dm-pre-reloc;
+       compatible = "st,stm32-gpio";
 };
 
 &gpioj {
        u-boot,dm-pre-reloc;
+       compatible = "st,stm32-gpio";
 };
 
 &gpiok {
        u-boot,dm-pre-reloc;
+       compatible = "st,stm32-gpio";
+};
+
+&pinctrl {
+       fmc_pins: fmc@0 {
+               pins {
+                       pinmux = <STM32_PINMUX('D', 0, AF12)>,
+                                <STM32_PINMUX('D', 1, AF12)>,
+                                <STM32_PINMUX('D', 8, AF12)>,
+                                <STM32_PINMUX('D', 9, AF12)>,
+                                <STM32_PINMUX('D',10, AF12)>,
+                                <STM32_PINMUX('D',14, AF12)>,
+                                <STM32_PINMUX('D',15, AF12)>,
+
+                                <STM32_PINMUX('E', 0, AF12)>,
+                                <STM32_PINMUX('E', 1, AF12)>,
+                                <STM32_PINMUX('E', 7, AF12)>,
+                                <STM32_PINMUX('E', 8, AF12)>,
+                                <STM32_PINMUX('E', 9, AF12)>,
+                                <STM32_PINMUX('E',10, AF12)>,
+                                <STM32_PINMUX('E',11, AF12)>,
+                                <STM32_PINMUX('E',12, AF12)>,
+                                <STM32_PINMUX('E',13, AF12)>,
+                                <STM32_PINMUX('E',14, AF12)>,
+                                <STM32_PINMUX('E',15, AF12)>,
+
+                                <STM32_PINMUX('F', 0, AF12)>,
+                                <STM32_PINMUX('F', 1, AF12)>,
+                                <STM32_PINMUX('F', 2, AF12)>,
+                                <STM32_PINMUX('F', 3, AF12)>,
+                                <STM32_PINMUX('F', 4, AF12)>,
+                                <STM32_PINMUX('F', 5, AF12)>,
+                                <STM32_PINMUX('F',11, AF12)>,
+                                <STM32_PINMUX('F',12, AF12)>,
+                                <STM32_PINMUX('F',13, AF12)>,
+                                <STM32_PINMUX('F',14, AF12)>,
+                                <STM32_PINMUX('F',15, AF12)>,
+
+                                <STM32_PINMUX('G', 0, AF12)>,
+                                <STM32_PINMUX('G', 1, AF12)>,
+                                <STM32_PINMUX('G', 2, AF12)>,
+                                <STM32_PINMUX('G', 4, AF12)>,
+                                <STM32_PINMUX('G', 5, AF12)>,
+                                <STM32_PINMUX('G', 8, AF12)>,
+                                <STM32_PINMUX('G',15, AF12)>,
+
+                                <STM32_PINMUX('H', 5, AF12)>,
+                                <STM32_PINMUX('H', 6, AF12)>,
+                                <STM32_PINMUX('H', 7, AF12)>,
+                                <STM32_PINMUX('H', 8, AF12)>,
+                                <STM32_PINMUX('H', 9, AF12)>,
+                                <STM32_PINMUX('H',10, AF12)>,
+                                <STM32_PINMUX('H',11, AF12)>,
+                                <STM32_PINMUX('H',12, AF12)>,
+                                <STM32_PINMUX('H',13, AF12)>,
+                                <STM32_PINMUX('H',14, AF12)>,
+                                <STM32_PINMUX('H',15, AF12)>,
+
+                                <STM32_PINMUX('I', 0, AF12)>,
+                                <STM32_PINMUX('I', 1, AF12)>,
+                                <STM32_PINMUX('I', 2, AF12)>,
+                                <STM32_PINMUX('I', 3, AF12)>,
+                                <STM32_PINMUX('I', 4, AF12)>,
+                                <STM32_PINMUX('I', 5, AF12)>,
+                                <STM32_PINMUX('I', 6, AF12)>,
+                                <STM32_PINMUX('I', 7, AF12)>,
+                                <STM32_PINMUX('I', 9, AF12)>,
+                                <STM32_PINMUX('I',10, AF12)>;
+
+                       slew-rate = <3>;
+               };
+       };
+
+       pinctrl_sdmmc1_level_shifter: sdmmc0_ls@0 {
+               pins {
+                       pinmux = <STM32_PINMUX('B', 8, AF7)>,
+                                <STM32_PINMUX('B', 9, AF7)>,
+                                <STM32_PINMUX('C', 6, AF8)>,
+                                <STM32_PINMUX('C', 7, AF8)>;
+                       drive-push-pull;
+                       slew-rate = <3>;
+               };
+       };
+
+       sdmmc1_pins: sdmmc@0 {
+               pins {
+                       pinmux = <STM32_PINMUX('C', 8, AF12)>,
+                                <STM32_PINMUX('C', 9, AF12)>,
+                                <STM32_PINMUX('C',10, AF12)>,
+                                <STM32_PINMUX('C',11, AF12)>,
+                                <STM32_PINMUX('C',12, AF12)>,
+                                <STM32_PINMUX('D', 2, AF12)>;
+
+                       slew-rate = <3>;
+                       drive-push-pull;
+                       bias-disable;
+               };
+       };
+};
+
+&pwrcfg {
+       u-boot,dm-pre-reloc;
+};
+
+&rcc {
+       u-boot,dm-pre-reloc;
 };
index e4f4aa579bd46ce808f6dcd76bff9247ece0dbf7..c823541a0d8e27671e66b6118174cbad31bdaaac 100644 (file)
  *     OTHER DEALINGS IN THE SOFTWARE.
  */
 
-#include <dt-bindings/pinctrl/stm32h7-pinfunc.h>
+#include <dt-bindings/pinctrl/stm32-pinfunc.h>
 
 / {
        soc {
-               pin-controller {
+               pinctrl: pin-controller {
                        #address-cells = <1>;
                        #size-cells = <1>;
                        compatible = "st,stm32h743-pinctrl";
                        ranges = <0 0x58020000 0x3000>;
+                       interrupt-parent = <&exti>;
+                       st,syscfg = <&syscfg 0x8>;
                        pins-are-numbered;
 
                        gpioa: gpio@58020000 {
                                gpio-controller;
                                #gpio-cells = <2>;
-                               compatible = "st,stm32-gpio";
                                reg = <0x0 0x400>;
                                clocks = <&rcc GPIOA_CK>;
                                st,bank-name = "GPIOA";
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
                        };
 
                        gpiob: gpio@58020400 {
                                gpio-controller;
                                #gpio-cells = <2>;
-                               compatible = "st,stm32-gpio";
                                reg = <0x400 0x400>;
                                clocks = <&rcc GPIOB_CK>;
                                st,bank-name = "GPIOB";
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
                        };
 
                        gpioc: gpio@58020800 {
                                gpio-controller;
                                #gpio-cells = <2>;
-                               compatible = "st,stm32-gpio";
                                reg = <0x800 0x400>;
                                clocks = <&rcc GPIOC_CK>;
                                st,bank-name = "GPIOC";
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
                        };
 
                        gpiod: gpio@58020c00 {
                                gpio-controller;
                                #gpio-cells = <2>;
-                               compatible = "st,stm32-gpio";
                                reg = <0xc00 0x400>;
                                clocks = <&rcc GPIOD_CK>;
                                st,bank-name = "GPIOD";
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
                        };
 
                        gpioe: gpio@58021000 {
                                gpio-controller;
                                #gpio-cells = <2>;
-                               compatible = "st,stm32-gpio";
                                reg = <0x1000 0x400>;
                                clocks = <&rcc GPIOE_CK>;
                                st,bank-name = "GPIOE";
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
                        };
 
                        gpiof: gpio@58021400 {
                                gpio-controller;
                                #gpio-cells = <2>;
-                               compatible = "st,stm32-gpio";
                                reg = <0x1400 0x400>;
                                clocks = <&rcc GPIOF_CK>;
                                st,bank-name = "GPIOF";
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
                        };
 
                        gpiog: gpio@58021800 {
                                gpio-controller;
                                #gpio-cells = <2>;
-                               compatible = "st,stm32-gpio";
                                reg = <0x1800 0x400>;
                                clocks = <&rcc GPIOG_CK>;
                                st,bank-name = "GPIOG";
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
                        };
 
                        gpioh: gpio@58021c00 {
                                gpio-controller;
                                #gpio-cells = <2>;
-                               compatible = "st,stm32-gpio";
                                reg = <0x1c00 0x400>;
                                clocks = <&rcc GPIOH_CK>;
                                st,bank-name = "GPIOH";
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
                        };
 
                        gpioi: gpio@58022000 {
                                gpio-controller;
                                #gpio-cells = <2>;
-                               compatible = "st,stm32-gpio";
                                reg = <0x2000 0x400>;
                                clocks = <&rcc GPIOI_CK>;
                                st,bank-name = "GPIOI";
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
                        };
 
                        gpioj: gpio@58022400 {
                                gpio-controller;
                                #gpio-cells = <2>;
-                               compatible = "st,stm32-gpio";
                                reg = <0x2400 0x400>;
                                clocks = <&rcc GPIOJ_CK>;
                                st,bank-name = "GPIOJ";
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
                        };
 
                        gpiok: gpio@58022800 {
                                gpio-controller;
                                #gpio-cells = <2>;
-                               compatible = "st,stm32-gpio";
                                reg = <0x2800 0x400>;
                                clocks = <&rcc GPIOK_CK>;
                                st,bank-name = "GPIOK";
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                       };
+
+                       i2c1_pins_a: i2c1@0 {
+                               pins {
+                                       pinmux = <STM32_PINMUX('B', 6, AF4)>, /* I2C1_SCL */
+                                                <STM32_PINMUX('B', 7, AF4)>; /* I2C1_SDA */
+                                       bias-disable;
+                                       drive-open-drain;
+                                       slew-rate = <0>;
+                               };
                        };
 
                        usart1_pins: usart1@0 {
                                pins1 {
-                                       pinmux = <STM32H7_PB14_FUNC_USART1_TX>;
+                                       pinmux = <STM32_PINMUX('B', 14, AF4)>; /* USART1_TX */
                                        bias-disable;
                                        drive-push-pull;
                                        slew-rate = <0>;
                                };
                                pins2 {
-                                       pinmux = <STM32H7_PB15_FUNC_USART1_RX>;
+                                       pinmux = <STM32_PINMUX('B', 15, AF4)>; /* USART1_RX */
                                        bias-disable;
                                };
                        };
 
                        usart2_pins: usart2@0 {
                                pins1 {
-                                       pinmux = <STM32H7_PD5_FUNC_USART2_TX>;
+                                       pinmux = <STM32_PINMUX('D', 5, AF7)>; /* USART2_TX */
                                        bias-disable;
                                        drive-push-pull;
                                        slew-rate = <0>;
                                };
                                pins2 {
-                                       pinmux = <STM32H7_PD6_FUNC_USART2_RX>;
+                                       pinmux = <STM32_PINMUX('D', 6, AF7)>; /* USART2_RX */
                                        bias-disable;
                                };
                        };
 
-                       fmc_pins: fmc@0 {
-                                 pins {
-                                         pinmux = <STM32H7_PD0_FUNC_FMC_D2_FMC_DA2>,
-                                                 <STM32H7_PD1_FUNC_FMC_D3_FMC_DA3>,
-                                                 <STM32H7_PD8_FUNC_FMC_D13_FMC_DA13>,
-                                                 <STM32H7_PD9_FUNC_FMC_D14_FMC_DA14>,
-                                                 <STM32H7_PD10_FUNC_FMC_D15_FMC_DA15>,
-                                                 <STM32H7_PD14_FUNC_FMC_D0_FMC_DA0>,
-                                                 <STM32H7_PD15_FUNC_FMC_D1_FMC_DA1>,
-
-                                                 <STM32H7_PE0_FUNC_FMC_NBL0>,
-                                                 <STM32H7_PE1_FUNC_FMC_NBL1>,
-                                                 <STM32H7_PE7_FUNC_FMC_D4_FMC_DA4>,
-                                                 <STM32H7_PE8_FUNC_FMC_D5_FMC_DA5>,
-                                                 <STM32H7_PE9_FUNC_FMC_D6_FMC_DA6>,
-                                                 <STM32H7_PE10_FUNC_FMC_D7_FMC_DA7>,
-                                                 <STM32H7_PE11_FUNC_FMC_D8_FMC_DA8>,
-                                                 <STM32H7_PE12_FUNC_FMC_D9_FMC_DA9>,
-                                                 <STM32H7_PE13_FUNC_FMC_D10_FMC_DA10>,
-                                                 <STM32H7_PE14_FUNC_FMC_D11_FMC_DA11>,
-                                                 <STM32H7_PE15_FUNC_FMC_D12_FMC_DA12>,
-
-                                                 <STM32H7_PF0_FUNC_FMC_A0>,
-                                                 <STM32H7_PF1_FUNC_FMC_A1>,
-                                                 <STM32H7_PF2_FUNC_FMC_A2>,
-                                                 <STM32H7_PF3_FUNC_FMC_A3>,
-                                                 <STM32H7_PF4_FUNC_FMC_A4>,
-                                                 <STM32H7_PF5_FUNC_FMC_A5>,
-                                                 <STM32H7_PF11_FUNC_FMC_SDNRAS>,
-                                                 <STM32H7_PF12_FUNC_FMC_A6>,
-                                                 <STM32H7_PF13_FUNC_FMC_A7>,
-                                                 <STM32H7_PF14_FUNC_FMC_A8>,
-                                                 <STM32H7_PF15_FUNC_FMC_A9>,
-
-                                                 <STM32H7_PG0_FUNC_FMC_A10>,
-                                                 <STM32H7_PG1_FUNC_FMC_A11>,
-                                                 <STM32H7_PG2_FUNC_FMC_A12>,
-                                                 <STM32H7_PG4_FUNC_FMC_A14_FMC_BA0>,
-                                                 <STM32H7_PG5_FUNC_FMC_A15_FMC_BA1>,
-                                                 <STM32H7_PG8_FUNC_FMC_SDCLK>,
-                                                 <STM32H7_PG15_FUNC_FMC_SDNCAS>,
-
-                                                 <STM32H7_PH5_FUNC_FMC_SDNWE>,
-                                                 <STM32H7_PH6_FUNC_FMC_SDNE1>,
-                                                 <STM32H7_PH7_FUNC_FMC_SDCKE1>,
-                                                 <STM32H7_PH8_FUNC_FMC_D16>,
-                                                 <STM32H7_PH9_FUNC_FMC_D17>,
-                                                 <STM32H7_PH10_FUNC_FMC_D18>,
-                                                 <STM32H7_PH11_FUNC_FMC_D19>,
-                                                 <STM32H7_PH12_FUNC_FMC_D20>,
-                                                 <STM32H7_PH13_FUNC_FMC_D21>,
-                                                 <STM32H7_PH14_FUNC_FMC_D22>,
-                                                 <STM32H7_PH15_FUNC_FMC_D23>,
-
-                                                 <STM32H7_PI0_FUNC_FMC_D24>,
-                                                 <STM32H7_PI1_FUNC_FMC_D25>,
-                                                 <STM32H7_PI2_FUNC_FMC_D26>,
-                                                 <STM32H7_PI3_FUNC_FMC_D27>,
-                                                 <STM32H7_PI4_FUNC_FMC_NBL2>,
-                                                 <STM32H7_PI5_FUNC_FMC_NBL3>,
-                                                 <STM32H7_PI6_FUNC_FMC_D28>,
-                                                 <STM32H7_PI7_FUNC_FMC_D29>,
-                                                 <STM32H7_PI9_FUNC_FMC_D30>,
-                                                 <STM32H7_PI10_FUNC_FMC_D31>;
-
-                                         slew-rate = <3>;
-                               };
-                       };
-
-                       sdmmc1_pins: sdmmc@0 {
+                       usbotg_hs_pins_a: usbotg-hs@0 {
                                pins {
-                                       pinmux = <STM32H7_PC8_FUNC_SDMMC1_D0>,
-                                                <STM32H7_PC9_FUNC_SDMMC1_D1>,
-                                                <STM32H7_PC10_FUNC_SDMMC1_D2>,
-                                                <STM32H7_PC11_FUNC_SDMMC1_D3>,
-                                                <STM32H7_PC12_FUNC_SDMMC1_CK>,
-                                                <STM32H7_PD2_FUNC_SDMMC1_CMD>;
-
-                                       slew-rate = <3>;
-                                       drive-push-pull;
+                                       pinmux = <STM32_PINMUX('H', 4, AF10)>,  /* ULPI_NXT */
+                                                        <STM32_PINMUX('I', 11, AF10)>, /* ULPI_DIR> */
+                                                        <STM32_PINMUX('C', 0, AF10)>,  /* ULPI_STP> */
+                                                        <STM32_PINMUX('A', 5, AF10)>,  /* ULPI_CK> */
+                                                        <STM32_PINMUX('A', 3, AF10)>,  /* ULPI_D0> */
+                                                        <STM32_PINMUX('B', 0, AF10)>,  /* ULPI_D1> */
+                                                        <STM32_PINMUX('B', 1, AF10)>,  /* ULPI_D2> */
+                                                        <STM32_PINMUX('B', 10, AF10)>, /* ULPI_D3> */
+                                                        <STM32_PINMUX('B', 11, AF10)>, /* ULPI_D4> */
+                                                        <STM32_PINMUX('B', 12, AF10)>, /* ULPI_D5> */
+                                                        <STM32_PINMUX('B', 13, AF10)>, /* ULPI_D6> */
+                                                        <STM32_PINMUX('B', 5, AF10)>;  /* ULPI_D7> */
                                        bias-disable;
-                               };
-                       };
-
-                       pinctrl_sdmmc1_level_shifter: sdmmc0_ls@0 {
-                               pins {
-                                       pinmux = <STM32H7_PB8_FUNC_SDMMC1_CKIN>,
-                                                <STM32H7_PB9_FUNC_SDMMC1_CDIR>,
-                                                <STM32H7_PC6_FUNC_SDMMC1_D0DIR>,
-                                                <STM32H7_PC7_FUNC_SDMMC1_D123DIR>;
                                        drive-push-pull;
-                                       slew-rate = <3>;
+                                       slew-rate = <2>;
                                };
                        };
                };
index d5b8d879ee2ac112705504ac8032b411995aa9d4..cbdd69ca9e7a6e5c6215c646d6fa395ac6034dae 100644 (file)
 #include "armv7-m.dtsi"
 #include <dt-bindings/clock/stm32h7-clks.h>
 #include <dt-bindings/mfd/stm32h7-rcc.h>
+#include <dt-bindings/interrupt-controller/irq.h>
 
 / {
        clocks {
                clk_hse: clk-hse {
                        #clock-cells = <0>;
                        compatible = "fixed-clock";
-                       clock-frequency = <25000000>;
+                       clock-frequency = <0>;
                };
 
                clk_lse: clk-lse {
        };
 
        soc {
-               rcc: rcc@58024400 {
-                       #clock-cells = <1>;
-                       #reset-cells = <1>;
-                       compatible = "st,stm32h743-rcc", "st,stm32-rcc";
-                       reg = <0x58024400 0x400>;
-                       clocks = <&clk_hse>, <&clk_lse>, <&clk_i2s>, <&clk_hsi>, <&clk_csi>;
-                       st,syscfg = <&pwrcfg>;
+               timer5: timer@40000c00 {
+                       compatible = "st,stm32-timer";
+                       reg = <0x40000c00 0x400>;
+                       interrupts = <50>;
+                       clocks = <&rcc TIM5_CK>;
                };
 
-               usart1: serial@40011000 {
-                       compatible = "st,stm32h7-uart";
-                       reg = <0x40011000 0x400>;
-                       interrupts = <37>;
+               lptimer1: timer@40002400 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "st,stm32-lptimer";
+                       reg = <0x40002400 0x400>;
+                       clocks = <&rcc LPTIM1_CK>;
+                       clock-names = "mux";
+                       status = "disabled";
+
+                       pwm {
+                               compatible = "st,stm32-pwm-lp";
+                               #pwm-cells = <3>;
+                               status = "disabled";
+                       };
+
+                       trigger@0 {
+                               compatible = "st,stm32-lptimer-trigger";
+                               reg = <0>;
+                               status = "disabled";
+                       };
+
+                       counter {
+                               compatible = "st,stm32-lptimer-counter";
+                               status = "disabled";
+                       };
+               };
+
+               spi2: spi@40003800 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "st,stm32h7-spi";
+                       reg = <0x40003800 0x400>;
+                       interrupts = <36>;
+                       clocks = <&rcc SPI2_CK>;
+                       status = "disabled";
+
+               };
+
+               spi3: spi@40003c00 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "st,stm32h7-spi";
+                       reg = <0x40003c00 0x400>;
+                       interrupts = <51>;
+                       clocks = <&rcc SPI3_CK>;
                        status = "disabled";
-                       clocks = <&rcc USART1_CK>;
                };
 
                usart2: serial@40004400 {
-                       compatible = "st,stm32h7-uart";
+                       compatible = "st,stm32f7-uart";
                        reg = <0x40004400 0x400>;
                        interrupts = <38>;
                        status = "disabled";
                        clocks = <&rcc USART2_CK>;
                };
 
-               timer5: timer@40000c00 {
-                       compatible = "st,stm32-timer";
-                       reg = <0x40000c00 0x400>;
-                       interrupts = <50>;
-                       clocks = <&rcc TIM5_CK>;
+               i2c1: i2c@40005400 {
+                       compatible = "st,stm32f7-i2c";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0x40005400 0x400>;
+                       interrupts = <31>,
+                                    <32>;
+                       resets = <&rcc STM32H7_APB1L_RESET(I2C1)>;
+                       clocks = <&rcc I2C1_CK>;
+                       status = "disabled";
                };
 
-               pwrcfg: power-config@58024800 {
+               i2c2: i2c@40005800 {
+                       compatible = "st,stm32f7-i2c";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0x40005800 0x400>;
+                       interrupts = <33>,
+                                    <34>;
+                       resets = <&rcc STM32H7_APB1L_RESET(I2C2)>;
+                       clocks = <&rcc I2C2_CK>;
+                       status = "disabled";
+               };
+
+               i2c3: i2c@40005C00 {
+                       compatible = "st,stm32f7-i2c";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0x40005C00 0x400>;
+                       interrupts = <72>,
+                                    <73>;
+                       resets = <&rcc STM32H7_APB1L_RESET(I2C3)>;
+                       clocks = <&rcc I2C3_CK>;
+                       status = "disabled";
+               };
+
+               dac: dac@40007400 {
+                       compatible = "st,stm32h7-dac-core";
+                       reg = <0x40007400 0x400>;
+                       clocks = <&rcc DAC12_CK>;
+                       clock-names = "pclk";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+
+                       dac1: dac@1 {
+                               compatible = "st,stm32-dac";
+                               #io-channels-cells = <1>;
+                               reg = <1>;
+                               status = "disabled";
+                       };
+
+                       dac2: dac@2 {
+                               compatible = "st,stm32-dac";
+                               #io-channels-cells = <1>;
+                               reg = <2>;
+                               status = "disabled";
+                       };
+               };
+
+               usart1: serial@40011000 {
+                       compatible = "st,stm32f7-uart";
+                       reg = <0x40011000 0x400>;
+                       interrupts = <37>;
+                       status = "disabled";
+                       clocks = <&rcc USART1_CK>;
+               };
+
+               spi1: spi@40013000 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "st,stm32h7-spi";
+                       reg = <0x40013000 0x400>;
+                       interrupts = <35>;
+                       clocks = <&rcc SPI1_CK>;
+                       status = "disabled";
+               };
+
+               spi4: spi@40013400 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "st,stm32h7-spi";
+                       reg = <0x40013400 0x400>;
+                       interrupts = <84>;
+                       clocks = <&rcc SPI4_CK>;
+                       status = "disabled";
+               };
+
+               spi5: spi@40015000 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "st,stm32h7-spi";
+                       reg = <0x40015000 0x400>;
+                       interrupts = <85>;
+                       clocks = <&rcc SPI5_CK>;
+                       status = "disabled";
+               };
+
+               dma1: dma@40020000 {
+                       compatible = "st,stm32-dma";
+                       reg = <0x40020000 0x400>;
+                       interrupts = <11>,
+                                    <12>,
+                                    <13>,
+                                    <14>,
+                                    <15>,
+                                    <16>,
+                                    <17>,
+                                    <47>;
+                       clocks = <&rcc DMA1_CK>;
+                       #dma-cells = <4>;
+                       st,mem2mem;
+                       dma-requests = <8>;
+                       status = "disabled";
+               };
+
+               dma2: dma@40020400 {
+                       compatible = "st,stm32-dma";
+                       reg = <0x40020400 0x400>;
+                       interrupts = <56>,
+                                    <57>,
+                                    <58>,
+                                    <59>,
+                                    <60>,
+                                    <68>,
+                                    <69>,
+                                    <70>;
+                       clocks = <&rcc DMA2_CK>;
+                       #dma-cells = <4>;
+                       st,mem2mem;
+                       dma-requests = <8>;
+                       status = "disabled";
+               };
+
+               dmamux1: dma-router@40020800 {
+                       compatible = "st,stm32h7-dmamux";
+                       reg = <0x40020800 0x1c>;
+                       #dma-cells = <3>;
+                       dma-channels = <16>;
+                       dma-requests = <128>;
+                       dma-masters = <&dma1 &dma2>;
+                       clocks = <&rcc DMA1_CK>;
+               };
+
+               adc_12: adc@40022000 {
+                       compatible = "st,stm32h7-adc-core";
+                       reg = <0x40022000 0x400>;
+                       interrupts = <18>;
+                       clocks = <&rcc ADC12_CK>;
+                       clock-names = "bus";
+                       interrupt-controller;
+                       #interrupt-cells = <1>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+
+                       adc1: adc@0 {
+                               compatible = "st,stm32h7-adc";
+                               #io-channel-cells = <1>;
+                               reg = <0x0>;
+                               interrupt-parent = <&adc_12>;
+                               interrupts = <0>;
+                               status = "disabled";
+                       };
+
+                       adc2: adc@100 {
+                               compatible = "st,stm32h7-adc";
+                               #io-channel-cells = <1>;
+                               reg = <0x100>;
+                               interrupt-parent = <&adc_12>;
+                               interrupts = <1>;
+                               status = "disabled";
+                       };
+               };
+
+               usbotg_hs: usb@40040000 {
+                       compatible = "st,stm32f7-hsotg";
+                       reg = <0x40040000 0x40000>;
+                       interrupts = <77>;
+                       clocks = <&rcc USB1OTG_CK>;
+                       clock-names = "otg";
+                       g-rx-fifo-size = <256>;
+                       g-np-tx-fifo-size = <32>;
+                       g-tx-fifo-size = <128 128 64 64 64 64 32 32>;
+                       status = "disabled";
+               };
+
+               usbotg_fs: usb@40080000 {
+                       compatible = "st,stm32f4x9-fsotg";
+                       reg = <0x40080000 0x40000>;
+                       interrupts = <101>;
+                       clocks = <&rcc USB2OTG_CK>;
+                       clock-names = "otg";
+                       status = "disabled";
+               };
+
+               mdma1: dma@52000000 {
+                       compatible = "st,stm32h7-mdma";
+                       reg = <0x52000000 0x1000>;
+                       interrupts = <122>;
+                       clocks = <&rcc MDMA_CK>;
+                       #dma-cells = <5>;
+                       dma-channels = <16>;
+                       dma-requests = <32>;
+               };
+
+               exti: interrupt-controller@58000000 {
+                       compatible = "st,stm32h7-exti";
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       reg = <0x58000000 0x400>;
+                       interrupts = <1>, <2>, <3>, <6>, <7>, <8>, <9>, <10>, <23>, <40>, <41>, <62>, <76>;
+               };
+
+               syscfg: system-config@58000400 {
                        compatible = "syscon";
-                       reg = <0x58024800 0x400>;
+                       reg = <0x58000400 0x400>;
                };
 
-               fmc: fmc@52004000 {
-                       compatible = "st,stm32h7-fmc";
-                       reg = <0x52004000 0x1000>;
-                       clocks = <&rcc FMC_CK>;
+               spi6: spi@58001400 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "st,stm32h7-spi";
+                       reg = <0x58001400 0x400>;
+                       interrupts = <86>;
+                       clocks = <&rcc SPI6_CK>;
+                       status = "disabled";
                };
 
-               clk_hsi: clk-hsi {
-                       #clock-cells = <0>;
-                       compatible = "fixed-clock";
-                       clock-frequency = <64000000>;
+               i2c4: i2c@58001C00 {
+                       compatible = "st,stm32f7-i2c";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0x58001C00 0x400>;
+                       interrupts = <95>,
+                                    <96>;
+                       resets = <&rcc STM32H7_APB4_RESET(I2C4)>;
+                       clocks = <&rcc I2C4_CK>;
+                       status = "disabled";
                };
 
-               clk_csi: clk-csi {
-                       #clock-cells = <0>;
-                       compatible = "fixed-clock";
-                       clock-frequency = <4000000>;
+               lptimer2: timer@58002400 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "st,stm32-lptimer";
+                       reg = <0x58002400 0x400>;
+                       clocks = <&rcc LPTIM2_CK>;
+                       clock-names = "mux";
+                       status = "disabled";
+
+                       pwm {
+                               compatible = "st,stm32-pwm-lp";
+                               #pwm-cells = <3>;
+                               status = "disabled";
+                       };
+
+                       trigger@1 {
+                               compatible = "st,stm32-lptimer-trigger";
+                               reg = <1>;
+                               status = "disabled";
+                       };
+
+                       counter {
+                               compatible = "st,stm32-lptimer-counter";
+                               status = "disabled";
+                       };
+               };
+
+               lptimer3: timer@58002800 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "st,stm32-lptimer";
+                       reg = <0x58002800 0x400>;
+                       clocks = <&rcc LPTIM3_CK>;
+                       clock-names = "mux";
+                       status = "disabled";
+
+                       pwm {
+                               compatible = "st,stm32-pwm-lp";
+                               #pwm-cells = <3>;
+                               status = "disabled";
+                       };
+
+                       trigger@2 {
+                               compatible = "st,stm32-lptimer-trigger";
+                               reg = <2>;
+                               status = "disabled";
+                       };
+               };
+
+               lptimer4: timer@58002c00 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "st,stm32-lptimer";
+                       reg = <0x58002c00 0x400>;
+                       clocks = <&rcc LPTIM4_CK>;
+                       clock-names = "mux";
+                       status = "disabled";
+
+                       pwm {
+                               compatible = "st,stm32-pwm-lp";
+                               #pwm-cells = <3>;
+                               status = "disabled";
+                       };
                };
 
-               sdmmc1: sdmmc@52007000 {
-                       compatible = "st,stm32-sdmmc2";
-                       reg = <0x52007000 0x1000>;
-                       interrupts = <49>;
-                       clocks = <&rcc SDMMC1_CK>;
-                       resets = <&rcc STM32H7_AHB3_RESET(SDMMC1)>;
-                       st,idma = <1>;
-                       cap-sd-highspeed;
-                       cap-mmc-highspeed;
+               lptimer5: timer@58003000 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "st,stm32-lptimer";
+                       reg = <0x58003000 0x400>;
+                       clocks = <&rcc LPTIM5_CK>;
+                       clock-names = "mux";
                        status = "disabled";
+
+                       pwm {
+                               compatible = "st,stm32-pwm-lp";
+                               #pwm-cells = <3>;
+                               status = "disabled";
+                       };
+               };
+
+               vrefbuf: regulator@58003c00 {
+                       compatible = "st,stm32-vrefbuf";
+                       reg = <0x58003C00 0x8>;
+                       clocks = <&rcc VREF_CK>;
+                       regulator-min-microvolt = <1500000>;
+                       regulator-max-microvolt = <2500000>;
+                       status = "disabled";
+               };
+
+               rtc: rtc@58004000 {
+                       compatible = "st,stm32h7-rtc";
+                       reg = <0x58004000 0x400>;
+                       clocks = <&rcc RTCAPB_CK>, <&rcc RTC_CK>;
+                       clock-names = "pclk", "rtc_ck";
+                       assigned-clocks = <&rcc RTC_CK>;
+                       assigned-clock-parents = <&rcc LSE_CK>;
+                       interrupt-parent = <&exti>;
+                       interrupts = <17 IRQ_TYPE_EDGE_RISING>;
+                       interrupt-names = "alarm";
+                       st,syscfg = <&pwrcfg 0x00 0x100>;
+                       status = "disabled";
+               };
+
+               rcc: reset-clock-controller@58024400 {
+                       compatible = "st,stm32h743-rcc", "st,stm32-rcc";
+                       reg = <0x58024400 0x400>;
+                       #clock-cells = <1>;
+                       #reset-cells = <1>;
+                       clocks = <&clk_hse>, <&clk_lse>, <&clk_i2s>;
+                       st,syscfg = <&pwrcfg>;
+               };
+
+               pwrcfg: power-config@58024800 {
+                       compatible = "syscon";
+                       reg = <0x58024800 0x400>;
+               };
+
+               adc_3: adc@58026000 {
+                       compatible = "st,stm32h7-adc-core";
+                       reg = <0x58026000 0x400>;
+                       interrupts = <127>;
+                       clocks = <&rcc ADC3_CK>;
+                       clock-names = "bus";
+                       interrupt-controller;
+                       #interrupt-cells = <1>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+
+                       adc3: adc@0 {
+                               compatible = "st,stm32h7-adc";
+                               #io-channel-cells = <1>;
+                               reg = <0x0>;
+                               interrupt-parent = <&adc_3>;
+                               interrupts = <0>;
+                               status = "disabled";
+                       };
                };
        };
 };
diff --git a/arch/arm/dts/stm32h743i-disco-u-boot.dtsi b/arch/arm/dts/stm32h743i-disco-u-boot.dtsi
new file mode 100644 (file)
index 0000000..2d6b41b
--- /dev/null
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include <stm32h7-u-boot.dtsi>
+
+&sdmmc1 {
+       status = "okay";
+       pinctrl-0 = <&sdmmc1_pins>;
+       pinctrl-names = "default";
+       bus-width = <4>;
+       cd-gpios = <&gpioi 8 1>;
+};
index 917a859a09f0fc7341c7d0fe4867f044b550c33a..45e088c55741a86e65e4f2ed9344b01a6c7af6e6 100644 (file)
@@ -43,7 +43,6 @@
 /dts-v1/;
 #include "stm32h743.dtsi"
 #include "stm32h743-pinctrl.dtsi"
-#include <dt-bindings/memory/stm32-sdram.h>
 
 / {
        model = "STMicroelectronics STM32H743i-Discovery board";
 
        aliases {
                serial0 = &usart2;
-               mmc0 = &sdmmc1;
-               gpio0 = &gpioa;
-               gpio1 = &gpiob;
-               gpio2 = &gpioc;
-               gpio3 = &gpiod;
-               gpio4 = &gpioe;
-               gpio5 = &gpiof;
-               gpio6 = &gpiog;
-               gpio7 = &gpioh;
-               gpio8 = &gpioi;
-               gpio9 = &gpioj;
-               gpio10 = &gpiok;
        };
 };
 
-&usart2 {
-       pinctrl-0 = <&usart2_pins>;
-       pinctrl-names = "default";
-       status = "okay";
+&clk_hse {
+       clock-frequency = <25000000>;
 };
 
-&fmc {
-       pinctrl-0 = <&fmc_pins>;
+&usart2 {
+       pinctrl-0 = <&usart2_pins>;
        pinctrl-names = "default";
        status = "okay";
-
-       /*
-        * Memory configuration from sdram datasheet IS42S32800G-6BLI
-        * firsct bank is bank@0
-        * second bank is bank@1
-        */
-       bank1: bank@1 {
-               st,sdram-control = /bits/ 8 <NO_COL_9 NO_ROW_12 MWIDTH_32 BANKS_4
-                                 CAS_2 SDCLK_3 RD_BURST_EN RD_PIPE_DL_0>;
-               st,sdram-timing = /bits/ 8 <TMRD_1 TXSR_1 TRAS_1 TRC_6 TRP_2
-                                 TWR_1 TRCD_1>;
-               st,sdram-refcount = <1539>;
-       };
-};
-
-&sdmmc1 {
-       status = "okay";
-       pinctrl-0 = <&sdmmc1_pins>;
-       pinctrl-names = "default";
-       bus-width = <4>;
-       cd-gpios = <&gpioi 8 1>;
 };
diff --git a/arch/arm/dts/stm32h743i-eval-u-boot.dtsi b/arch/arm/dts/stm32h743i-eval-u-boot.dtsi
new file mode 100644 (file)
index 0000000..251977a
--- /dev/null
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include <stm32h7-u-boot.dtsi>
+
+&sdmmc1 {
+       status = "okay";
+       pinctrl-0 = <&sdmmc1_pins>,
+                   <&pinctrl_sdmmc1_level_shifter>;
+       pinctrl-names = "default";
+       bus-width = <4>;
+       st,sig-dir;
+};
index 28c876be27fc695da51644284f39589131073fd9..3f8e0c4a998d0cec39c592bc8f7688e9327bf12b 100644 (file)
@@ -43,7 +43,6 @@
 /dts-v1/;
 #include "stm32h743.dtsi"
 #include "stm32h743-pinctrl.dtsi"
-#include <dt-bindings/memory/stm32-sdram.h>
 
 / {
        model = "STMicroelectronics STM32H743i-EVAL board";
 
        aliases {
                serial0 = &usart1;
-               gpio0 = &gpioa;
-               gpio1 = &gpiob;
-               gpio2 = &gpioc;
-               gpio3 = &gpiod;
-               gpio4 = &gpioe;
-               gpio5 = &gpiof;
-               gpio6 = &gpiog;
-               gpio7 = &gpioh;
-               gpio8 = &gpioi;
-               gpio9 = &gpioj;
-               gpio10 = &gpiok;
        };
+
+       vdda: regulator-vdda {
+               compatible = "regulator-fixed";
+               regulator-name = "vdda";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-always-on;
+       };
+
+       usbotg_hs_phy: usb-phy {
+               #phy-cells = <0>;
+               compatible = "usb-nop-xceiv";
+               clocks = <&rcc USB1ULPI_CK>;
+               clock-names = "main_clk";
+       };
+
 };
 
-&usart1 {
-       pinctrl-0 = <&usart1_pins>;
-       pinctrl-names = "default";
+&adc_12 {
+       vref-supply = <&vdda>;
        status = "okay";
+       adc1: adc@0 {
+               /* potentiometer */
+               st,adc-channels = <0>;
+               status = "okay";
+       };
+};
+
+&clk_hse {
+       clock-frequency = <25000000>;
 };
 
-&fmc {
-       pinctrl-0 = <&fmc_pins>;
+&i2c1 {
+       pinctrl-0 = <&i2c1_pins_a>;
        pinctrl-names = "default";
+       i2c-scl-rising-time-ns = <185>;
+       i2c-scl-falling-time-ns = <20>;
        status = "okay";
+};
 
-       /*
-        * Memory configuration from sdram datasheet IS42S32800G-6BLI
-        * firsct bank is bank@0
-        * second bank is bank@1
-        */
-       bank2: bank@1 {
-               st,sdram-control = /bits/ 8 <NO_COL_9 NO_ROW_12 MWIDTH_32 BANKS_4
-                                 CAS_2 SDCLK_3 RD_BURST_EN RD_PIPE_DL_0>;
-               st,sdram-timing = /bits/ 8 <TMRD_1 TXSR_1 TRAS_1 TRC_6 TRP_2
-                                 TWR_1 TRCD_1>;
-               st,sdram-refcount = <1539>;
-       };
+&rtc {
+       status = "okay";
 };
 
-&sdmmc1 {
+&usart1 {
+       pinctrl-0 = <&usart1_pins>;
+       pinctrl-names = "default";
        status = "okay";
-       pinctrl-0 = <&sdmmc1_pins>,
-                   <&pinctrl_sdmmc1_level_shifter>;
+};
+
+&usbotg_hs {
+       pinctrl-0 = <&usbotg_hs_pins_a>;
        pinctrl-names = "default";
-       bus-width = <4>;
-       st,dirpol;
+       phys = <&usbotg_hs_phy>;
+       phy-names = "usb2-phy";
+       dr_mode = "otg";
+       status = "okay";
 };
index 0366782fda9b1b49b73a60d24798dcd400e03067..b10208f698765fb2b6e0268f2595dd35b64156c3 100644 (file)
 &sdmmc1 {
        pinctrl-0 = <&sdmmc1_b4_pins_a &sdmmc1_dir_pins_a>;
        broken-cd;
-       st,dirpol;
-       st,negedge;
-       st,pin-ckin;
+       st,sig-dir;
+       st,neg-edge;
+       st,use-ckin;
        bus-width = <4>;
        vmmc-supply = <&vdd_sd>;
        vqmmc-supply = <&sd_switch>;
        non-removable;
        no-sd;
        no-sdio;
-       st,dirpol;
-       st,negedge;
+       st,sig-dir;
+       st,neg-edge;
        bus-width = <8>;
        vmmc-supply = <&v3v3>;
        vqmmc-supply = <&vdd>;
diff --git a/arch/arm/include/asm/arch-meson/clock-g12a.h b/arch/arm/include/asm/arch-meson/clock-g12a.h
new file mode 100644 (file)
index 0000000..d52e27e
--- /dev/null
@@ -0,0 +1,104 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2016 - AmLogic, Inc.
+ * Copyright 2018 - Beniamino Galvani <b.galvani@gmail.com>
+ * Copyright 2018 - BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+#ifndef _ARCH_MESON_CLOCK_G12A_H_
+#define _ARCH_MESON_CLOCK_G12A_H_
+
+/*
+ * Clock controller register offsets
+ *
+ * Register offsets from the data sheet are listed in comment blocks below.
+ * Those offsets must be multiplied by 4 before adding them to the base address
+ * to get the right value
+ */
+
+#define HHI_MIPI_CNTL0                 0x000
+#define HHI_MIPI_CNTL1                 0x004
+#define HHI_MIPI_CNTL2                 0x008
+#define HHI_MIPI_STS                   0x00C
+#define HHI_GP0_PLL_CNTL0              0x040
+#define HHI_GP0_PLL_CNTL1              0x044
+#define HHI_GP0_PLL_CNTL2              0x048
+#define HHI_GP0_PLL_CNTL3              0x04C
+#define HHI_GP0_PLL_CNTL4              0x050
+#define HHI_GP0_PLL_CNTL5              0x054
+#define HHI_GP0_PLL_CNTL6              0x058
+#define HHI_GP0_PLL_STS                        0x05C
+#define HHI_PCIE_PLL_CNTL0             0x098
+#define HHI_PCIE_PLL_CNTL1             0x09C
+#define HHI_PCIE_PLL_CNTL2             0x0A0
+#define HHI_PCIE_PLL_CNTL3             0x0A4
+#define HHI_PCIE_PLL_CNTL4             0x0A8
+#define HHI_PCIE_PLL_CNTL5             0x0AC
+#define HHI_PCIE_PLL_STS               0x0B8
+#define HHI_HIFI_PLL_CNTL0             0x0D8
+#define HHI_HIFI_PLL_CNTL1             0x0DC
+#define HHI_HIFI_PLL_CNTL2             0x0E0
+#define HHI_HIFI_PLL_CNTL3             0x0E4
+#define HHI_HIFI_PLL_CNTL4             0x0E8
+#define HHI_HIFI_PLL_CNTL5             0x0EC
+#define HHI_HIFI_PLL_CNTL6             0x0F0
+#define HHI_VIID_CLK_DIV               0x128
+#define HHI_VIID_CLK_CNTL              0x12C
+#define HHI_GCLK_MPEG0                 0x140
+#define HHI_GCLK_MPEG1                 0x144
+#define HHI_GCLK_MPEG2                 0x148
+#define HHI_GCLK_OTHER                 0x150
+#define HHI_GCLK_OTHER2                        0x154
+#define HHI_VID_CLK_DIV                        0x164
+#define HHI_MPEG_CLK_CNTL              0x174
+#define HHI_AUD_CLK_CNTL               0x178
+#define HHI_VID_CLK_CNTL               0x17c
+#define HHI_TS_CLK_CNTL                        0x190
+#define HHI_VID_CLK_CNTL2              0x194
+#define HHI_SYS_CPU_CLK_CNTL0          0x19c
+#define HHI_VID_PLL_CLK_DIV            0x1A0
+#define HHI_MALI_CLK_CNTL              0x1b0
+#define HHI_VPU_CLKC_CNTL              0x1b4
+#define HHI_VPU_CLK_CNTL               0x1bC
+#define HHI_HDMI_CLK_CNTL              0x1CC
+#define HHI_VDEC_CLK_CNTL              0x1E0
+#define HHI_VDEC2_CLK_CNTL             0x1E4
+#define HHI_VDEC3_CLK_CNTL             0x1E8
+#define HHI_VDEC4_CLK_CNTL             0x1EC
+#define HHI_HDCP22_CLK_CNTL            0x1F0
+#define HHI_VAPBCLK_CNTL               0x1F4
+#define HHI_VPU_CLKB_CNTL              0x20C
+#define HHI_GEN_CLK_CNTL               0x228
+#define HHI_VDIN_MEAS_CLK_CNTL         0x250
+#define HHI_MIPIDSI_PHY_CLK_CNTL       0x254
+#define HHI_NAND_CLK_CNTL              0x25C
+#define HHI_SD_EMMC_CLK_CNTL           0x264
+#define HHI_MPLL_CNTL0                 0x278
+#define HHI_MPLL_CNTL1                 0x27C
+#define HHI_MPLL_CNTL2                 0x280
+#define HHI_MPLL_CNTL3                 0x284
+#define HHI_MPLL_CNTL4                 0x288
+#define HHI_MPLL_CNTL5                 0x28c
+#define HHI_MPLL_CNTL6                 0x290
+#define HHI_MPLL_CNTL7                 0x294
+#define HHI_MPLL_CNTL8                 0x298
+#define HHI_FIX_PLL_CNTL0              0x2A0
+#define HHI_FIX_PLL_CNTL1              0x2A4
+#define HHI_FIX_PLL_CNTL3              0x2AC
+#define HHI_SYS_PLL_CNTL0              0x2f4
+#define HHI_SYS_PLL_CNTL1              0x2f8
+#define HHI_SYS_PLL_CNTL2              0x2fc
+#define HHI_SYS_PLL_CNTL3              0x300
+#define HHI_SYS_PLL_CNTL4              0x304
+#define HHI_SYS_PLL_CNTL5              0x308
+#define HHI_SYS_PLL_CNTL6              0x30c
+#define HHI_HDMI_PLL_CNTL0             0x320
+#define HHI_HDMI_PLL_CNTL1             0x324
+#define HHI_HDMI_PLL_CNTL2             0x328
+#define HHI_HDMI_PLL_CNTL3             0x32c
+#define HHI_HDMI_PLL_CNTL4             0x330
+#define HHI_HDMI_PLL_CNTL5             0x334
+#define HHI_HDMI_PLL_CNTL6             0x338
+#define HHI_SPICC_CLK_CNTL             0x3dc
+
+#endif
diff --git a/arch/arm/include/asm/arch-meson/g12a.h b/arch/arm/include/asm/arch-meson/g12a.h
new file mode 100644 (file)
index 0000000..b806667
--- /dev/null
@@ -0,0 +1,66 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2018 BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#ifndef __G12A_H__
+#define __G12A_H__
+
+#define G12A_AOBUS_BASE                        0xff800000
+#define G12A_PERIPHS_BASE              0xff634400
+#define G12A_HIU_BASE                  0xff63c000
+#define G12A_ETH_PHY_BASE              0xff64c000
+#define G12A_ETH_BASE                  0xff3f0000
+
+/* Always-On Peripherals registers */
+#define G12A_AO_ADDR(off)      (G12A_AOBUS_BASE + ((off) << 2))
+
+#define G12A_AO_SEC_GP_CFG0            G12A_AO_ADDR(0x90)
+#define G12A_AO_SEC_GP_CFG3            G12A_AO_ADDR(0x93)
+#define G12A_AO_SEC_GP_CFG4            G12A_AO_ADDR(0x94)
+#define G12A_AO_SEC_GP_CFG5            G12A_AO_ADDR(0x95)
+
+#define G12A_AO_BOOT_DEVICE            0xF
+#define G12A_AO_MEM_SIZE_MASK          0xFFFF0000
+#define G12A_AO_MEM_SIZE_SHIFT         16
+#define G12A_AO_BL31_RSVMEM_SIZE_MASK  0xFFFF0000
+#define G12A_AO_BL31_RSVMEM_SIZE_SHIFT 16
+#define G12A_AO_BL32_RSVMEM_SIZE_MASK  0xFFFF
+
+/* Peripherals registers */
+#define G12A_PERIPHS_ADDR(off) (G12A_PERIPHS_BASE + ((off) << 2))
+
+#define G12A_ETH_REG_0                 G12A_PERIPHS_ADDR(0x50)
+#define G12A_ETH_REG_1                 G12A_PERIPHS_ADDR(0x51)
+
+#define G12A_ETH_REG_0_PHY_INTF_RGMII  BIT(0)
+#define G12A_ETH_REG_0_PHY_INTF_RMII   BIT(2)
+#define G12A_ETH_REG_0_TX_PHASE(x)     (((x) & 3) << 5)
+#define G12A_ETH_REG_0_TX_RATIO(x)     (((x) & 7) << 7)
+#define G12A_ETH_REG_0_PHY_CLK_EN      BIT(10)
+#define G12A_ETH_REG_0_INVERT_RMII_CLK BIT(11)
+#define G12A_ETH_REG_0_CLK_EN          BIT(12)
+
+#define G12A_ETH_PHY_ADDR(off) (G12A_ETH_PHY_BASE + ((off) << 2))
+#define ETH_PLL_CNTL0                  G12A_ETH_PHY_ADDR(0x11)
+#define ETH_PLL_CNTL1                  G12A_ETH_PHY_ADDR(0x12)
+#define ETH_PLL_CNTL2                  G12A_ETH_PHY_ADDR(0x13)
+#define ETH_PLL_CNTL3                  G12A_ETH_PHY_ADDR(0x14)
+#define ETH_PLL_CNTL4                  G12A_ETH_PHY_ADDR(0x15)
+#define ETH_PLL_CNTL5                  G12A_ETH_PHY_ADDR(0x16)
+#define ETH_PLL_CNTL6                  G12A_ETH_PHY_ADDR(0x17)
+#define ETH_PLL_CNTL7                  G12A_ETH_PHY_ADDR(0x18)
+#define ETH_PHY_CNTL0                  G12A_ETH_PHY_ADDR(0x20)
+#define ETH_PHY_CNTL1                  G12A_ETH_PHY_ADDR(0x21)
+#define ETH_PHY_CNTL2                  G12A_ETH_PHY_ADDR(0x22)
+
+/* HIU registers */
+#define G12A_HIU_ADDR(off)     (G12A_HIU_BASE + ((off) << 2))
+
+#define G12A_MEM_PD_REG_0              G12A_HIU_ADDR(0x40)
+
+/* Ethernet memory power domain */
+#define G12A_MEM_PD_REG_0_ETH_MASK     (BIT(2) | BIT(3))
+
+#endif /* __G12A_H__ */
index 11077bc6cc24ccf4c74c575192b2ef415430a4ba..e29e4c0acc06d0d843de16989a5ff80fe41d2f82 100644 (file)
@@ -41,7 +41,13 @@ config MESON_AXG
        bool "AXG"
        select MESON64_COMMON
        help
-               Select this if your SoC is an A113X/D
+         Select this if your SoC is an A113X/D
+
+config MESON_G12A
+       bool "G12A"
+       select MESON64_COMMON
+       help
+         Select this if your SoC is an S905X/D2
 
 endchoice
 
@@ -61,10 +67,11 @@ config SYS_VENDOR
 
 config SYS_BOARD
        string "Board name"
-       default "odroid-c2" if MESON_GXBB
+       default "p200" if MESON_GXBB
        default "p212" if MESON_GXL
        default "q200" if MESON_GXM
        default "s400" if MESON_AXG
+       default "u200" if MESON_G12A
        default ""
        help
          This option contains information about board name.
index b716e1a152903ae6922284455e35543a9827b35e..a9e4046f809407db5ae46f328496697fd554a800 100644 (file)
@@ -2,6 +2,7 @@
 #
 # Copyright (c) 2016 Beniamino Galvani <b.galvani@gmail.com>
 
-obj-y += board-common.o sm.o
+obj-y += board-common.o sm.o board-info.o
 obj-$(CONFIG_MESON_GX) += board-gx.o
 obj-$(CONFIG_MESON_AXG) += board-axg.o
+obj-$(CONFIG_MESON_G12A) += board-g12a.o
diff --git a/arch/arm/mach-meson/board-g12a.c b/arch/arm/mach-meson/board-g12a.c
new file mode 100644 (file)
index 0000000..fc3764b
--- /dev/null
@@ -0,0 +1,150 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2016 Beniamino Galvani <b.galvani@gmail.com>
+ * (C) Copyright 2018 Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#include <common.h>
+#include <asm/arch/boot.h>
+#include <asm/arch/eth.h>
+#include <asm/arch/g12a.h>
+#include <asm/arch/mem.h>
+#include <asm/io.h>
+#include <asm/armv8/mmu.h>
+#include <linux/sizes.h>
+#include <phy.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int meson_get_boot_device(void)
+{
+       return readl(G12A_AO_SEC_GP_CFG0) & G12A_AO_BOOT_DEVICE;
+}
+
+/* Configure the reserved memory zones exported by the secure registers
+ * into EFI and DTB reserved memory entries.
+ */
+void meson_init_reserved_memory(void *fdt)
+{
+       u64 bl31_size, bl31_start;
+       u64 bl32_size, bl32_start;
+       u32 reg;
+
+       /*
+        * Get ARM Trusted Firmware reserved memory zones in :
+        * - AO_SEC_GP_CFG3: bl32 & bl31 size in KiB, can be 0
+        * - AO_SEC_GP_CFG5: bl31 physical start address, can be NULL
+        * - AO_SEC_GP_CFG4: bl32 physical start address, can be NULL
+        */
+       reg = readl(G12A_AO_SEC_GP_CFG3);
+
+       bl31_size = ((reg & G12A_AO_BL31_RSVMEM_SIZE_MASK)
+                       >> G12A_AO_BL31_RSVMEM_SIZE_SHIFT) * SZ_1K;
+       bl32_size = (reg & G12A_AO_BL32_RSVMEM_SIZE_MASK) * SZ_1K;
+
+       bl31_start = readl(G12A_AO_SEC_GP_CFG5);
+       bl32_start = readl(G12A_AO_SEC_GP_CFG4);
+
+       /* Add BL31 reserved zone */
+       if (bl31_start && bl31_size)
+               meson_board_add_reserved_memory(fdt, bl31_start, bl31_size);
+
+       /* Add BL32 reserved zone */
+       if (bl32_start && bl32_size)
+               meson_board_add_reserved_memory(fdt, bl32_start, bl32_size);
+}
+
+phys_size_t get_effective_memsize(void)
+{
+       /* Size is reported in MiB, convert it in bytes */
+       return ((readl(G12A_AO_SEC_GP_CFG0) & G12A_AO_MEM_SIZE_MASK)
+                       >> G12A_AO_MEM_SIZE_SHIFT) * SZ_1M;
+}
+
+static struct mm_region g12a_mem_map[] = {
+       {
+               .virt = 0x0UL,
+               .phys = 0x0UL,
+               .size = 0x80000000UL,
+               .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+                        PTE_BLOCK_INNER_SHARE
+       }, {
+               .virt = 0xf0000000UL,
+               .phys = 0xf0000000UL,
+               .size = 0x10000000UL,
+               .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+                        PTE_BLOCK_NON_SHARE |
+                        PTE_BLOCK_PXN | PTE_BLOCK_UXN
+       }, {
+               /* List terminator */
+               0,
+       }
+};
+
+struct mm_region *mem_map = g12a_mem_map;
+
+static void g12a_enable_external_mdio(void)
+{
+       writel(0x0, ETH_PHY_CNTL2);
+}
+
+static void g12a_enable_internal_mdio(void)
+{
+       /* Fire up the PHY PLL */
+       writel(0x29c0040a, ETH_PLL_CNTL0);
+       writel(0x927e0000, ETH_PLL_CNTL1);
+       writel(0xac5f49e5, ETH_PLL_CNTL2);
+       writel(0x00000000, ETH_PLL_CNTL3);
+       writel(0x00000000, ETH_PLL_CNTL4);
+       writel(0x20200000, ETH_PLL_CNTL5);
+       writel(0x0000c002, ETH_PLL_CNTL6);
+       writel(0x00000023, ETH_PLL_CNTL7);
+       writel(0x39c0040a, ETH_PLL_CNTL0);
+       writel(0x19c0040a, ETH_PLL_CNTL0);
+
+       /* Select the internal MDIO */
+       writel(0x33000180, ETH_PHY_CNTL0);
+       writel(0x00074043, ETH_PHY_CNTL1);
+       writel(0x00000260, ETH_PHY_CNTL2);
+}
+
+/* Configure the Ethernet MAC with the requested interface mode
+ * with some optional flags.
+ */
+void meson_eth_init(phy_interface_t mode, unsigned int flags)
+{
+       switch (mode) {
+       case PHY_INTERFACE_MODE_RGMII:
+       case PHY_INTERFACE_MODE_RGMII_ID:
+       case PHY_INTERFACE_MODE_RGMII_RXID:
+       case PHY_INTERFACE_MODE_RGMII_TXID:
+               /* Set RGMII mode */
+               setbits_le32(G12A_ETH_REG_0, G12A_ETH_REG_0_PHY_INTF_RGMII |
+                            G12A_ETH_REG_0_TX_PHASE(1) |
+                            G12A_ETH_REG_0_TX_RATIO(4) |
+                            G12A_ETH_REG_0_PHY_CLK_EN |
+                            G12A_ETH_REG_0_CLK_EN);
+               break;
+
+       case PHY_INTERFACE_MODE_RMII:
+               /* Set RMII mode */
+               out_le32(G12A_ETH_REG_0, G12A_ETH_REG_0_PHY_INTF_RMII |
+                                       G12A_ETH_REG_0_INVERT_RMII_CLK |
+                                       G12A_ETH_REG_0_CLK_EN);
+
+               /* Use G12A RMII Internal PHY */
+               if (flags & MESON_USE_INTERNAL_RMII_PHY)
+                       g12a_enable_internal_mdio();
+               else
+                       g12a_enable_external_mdio();
+
+               break;
+
+       default:
+               printf("Invalid Ethernet interface mode\n");
+               return;
+       }
+
+       /* Enable power gate */
+       clrbits_le32(G12A_MEM_PD_REG_0, G12A_MEM_PD_REG_0_ETH_MASK);
+}
diff --git a/arch/arm/mach-meson/board-info.c b/arch/arm/mach-meson/board-info.c
new file mode 100644 (file)
index 0000000..ba248e8
--- /dev/null
@@ -0,0 +1,166 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2019 Julien Masson <jmasson@baylibre.com>
+ * (C) Copyright 2019 Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <dm.h>
+#include <linux/bitfield.h>
+#include <regmap.h>
+#include <syscon.h>
+
+#define AO_SEC_SD_CFG8         0xe0
+#define AO_SEC_SOCINFO_OFFSET  AO_SEC_SD_CFG8
+
+#define SOCINFO_MAJOR  GENMASK(31, 24)
+#define SOCINFO_PACK   GENMASK(23, 16)
+#define SOCINFO_MINOR  GENMASK(15, 8)
+#define SOCINFO_MISC   GENMASK(7, 0)
+
+static const struct meson_gx_soc_id {
+       const char *name;
+       unsigned int id;
+} soc_ids[] = {
+       { "GXBB",   0x1f },
+       { "GXTVBB", 0x20 },
+       { "GXL",    0x21 },
+       { "GXM",    0x22 },
+       { "TXL",    0x23 },
+       { "TXLX",   0x24 },
+       { "AXG",    0x25 },
+       { "GXLX",   0x26 },
+       { "TXHD",   0x27 },
+       { "G12A",   0x28 },
+       { "G12B",   0x29 },
+};
+
+static const struct meson_gx_package_id {
+       const char *name;
+       unsigned int major_id;
+       unsigned int pack_id;
+       unsigned int pack_mask;
+} soc_packages[] = {
+       { "S905",   0x1f, 0,    0x20 }, /* pack_id != 0x20 */
+       { "S905H",  0x1f, 0x3,  0xf },  /* pack_id & 0xf == 0x3 */
+       { "S905M",  0x1f, 0x20, 0xf0 }, /* pack_id == 0x20 */
+       { "S905D",  0x21, 0,    0xf0 },
+       { "S905X",  0x21, 0x80, 0xf0 },
+       { "S905W",  0x21, 0xa0, 0xf0 },
+       { "S905L",  0x21, 0xc0, 0xf0 },
+       { "S905M2", 0x21, 0xe0, 0xf0 },
+       { "S805X",  0x21, 0x30, 0xf0 },
+       { "S805Y",  0x21, 0xb0, 0xf0 },
+       { "S912",   0x22, 0,    0x0 },  /* Only S912 is known for GXM */
+       { "962X",   0x24, 0x10, 0xf0 },
+       { "962E",   0x24, 0x20, 0xf0 },
+       { "A113X",  0x25, 0x37, 0xff },
+       { "A113D",  0x25, 0x22, 0xff },
+       { "S905D2", 0x28, 0x10, 0xf0 },
+       { "S905X2", 0x28, 0x40, 0xf0 },
+       { "S922X",  0x29, 0x40, 0xf0 },
+};
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static inline unsigned int socinfo_to_major(u32 socinfo)
+{
+       return FIELD_GET(SOCINFO_MAJOR, socinfo);
+}
+
+static inline unsigned int socinfo_to_minor(u32 socinfo)
+{
+       return FIELD_GET(SOCINFO_MINOR, socinfo);
+}
+
+static inline unsigned int socinfo_to_pack(u32 socinfo)
+{
+       return FIELD_GET(SOCINFO_PACK, socinfo);
+}
+
+static inline unsigned int socinfo_to_misc(u32 socinfo)
+{
+       return FIELD_GET(SOCINFO_MISC, socinfo);
+}
+
+static const char *socinfo_to_package_id(u32 socinfo)
+{
+       unsigned int pack = socinfo_to_pack(socinfo);
+       unsigned int major = socinfo_to_major(socinfo);
+       int i;
+
+       for (i = 0 ; i < ARRAY_SIZE(soc_packages) ; ++i) {
+               if (soc_packages[i].major_id == major &&
+                   soc_packages[i].pack_id ==
+                   (pack & soc_packages[i].pack_mask))
+                       return soc_packages[i].name;
+       }
+
+       return "Unknown";
+}
+
+static const char *socinfo_to_soc_id(u32 socinfo)
+{
+       unsigned int id = socinfo_to_major(socinfo);
+       int i;
+
+       for (i = 0 ; i < ARRAY_SIZE(soc_ids) ; ++i) {
+               if (soc_ids[i].id == id)
+                       return soc_ids[i].name;
+       }
+
+       return "Unknown";
+}
+
+static void print_board_model(void)
+{
+       const char *model;
+       model = fdt_getprop(gd->fdt_blob, 0, "model", NULL);
+       printf("Model: %s\n", model ? model : "Unknown");
+}
+
+int show_board_info(void)
+{
+       struct regmap *regmap;
+       int nodeoffset, ret;
+       ofnode node;
+       unsigned int socinfo;
+
+       /* find the offset of compatible node */
+       nodeoffset = fdt_node_offset_by_compatible(gd->fdt_blob, -1,
+                                                  "amlogic,meson-gx-ao-secure");
+       if (nodeoffset < 0)
+               return 0;
+
+       /* check if chip-id is available */
+       if (!fdt_getprop(gd->fdt_blob, nodeoffset, "amlogic,has-chip-id", NULL))
+               return 0;
+
+       /* get regmap from the syscon node */
+       node = offset_to_ofnode(nodeoffset);
+       regmap = syscon_node_to_regmap(node);
+       if (IS_ERR(regmap)) {
+               printf("%s: failed to get regmap\n", __func__);
+               return 0;
+       }
+
+       /* read soc info */
+       ret = regmap_read(regmap, AO_SEC_SOCINFO_OFFSET, &socinfo);
+       if (ret && !socinfo) {
+               printf("%s: invalid chipid value\n", __func__);
+               return 0;
+       }
+
+       /* print board information */
+       print_board_model();
+       printf("Soc:   Amlogic Meson %s (%s) Revision %x:%x (%x:%x)\n",
+              socinfo_to_soc_id(socinfo),
+              socinfo_to_package_id(socinfo),
+              socinfo_to_major(socinfo),
+              socinfo_to_minor(socinfo),
+              socinfo_to_pack(socinfo),
+              socinfo_to_misc(socinfo));
+
+       return 0;
+}
index f5fd60d784560336ddd4170e10ffaff83f0c8f8c..f99bd3bf65672ee770ea10cd4d28fe7ad894e0bf 100644 (file)
@@ -14,6 +14,7 @@ config ARMADA_32BIT
        select SPL_OF_CONTROL if SPL
        select SPL_SIMPLE_BUS if SPL
        select SUPPORT_SPL
+       select TRANSLATION_OFFSET
 
 config ARMADA_64BIT
        bool
index 9dd7c84b6874d6ba09729279a2227276463e3c9a..530b98c1aa31e637b5f869323d28a77a3840295f 100644 (file)
@@ -93,15 +93,21 @@ void board_init_f(ulong dummy)
         */
 #endif
 
+       /*
+        * Use special translation offset for SPL. This needs to be
+        * configured *before* spl_init() is called as this function
+        * calls dm_init() which calls the bind functions of the
+        * device drivers. Here the base address needs to be configured
+        * (translated) correctly.
+        */
+       gd->translation_offset = 0xd0000000 - 0xf1000000;
+
        ret = spl_init();
        if (ret) {
                debug("spl_init() failed: %d\n", ret);
                hang();
        }
 
-       /* Use special translation offset for SPL */
-       dm_set_translation_offset(0xd0000000 - 0xf1000000);
-
        preloader_console_init();
 
        timer_init();
index a8d01e40011ac1d3119b5a3afe611597ab60e434..47dfb476d37d46625328f892986195ed746e3d3f 100644 (file)
@@ -209,8 +209,8 @@ void os_tty_raw(int fd, bool allow_sigs)
 
 void *os_malloc(size_t length)
 {
-       struct os_mem_hdr *hdr;
        int page_size = getpagesize();
+       struct os_mem_hdr *hdr;
 
        /*
         * Use an address that is hopefully available to us so that pointers
@@ -229,30 +229,34 @@ void *os_malloc(size_t length)
 
 void os_free(void *ptr)
 {
-       struct os_mem_hdr *hdr = ptr;
+       int page_size = getpagesize();
+       struct os_mem_hdr *hdr;
 
-       hdr--;
-       if (ptr)
-               munmap(hdr, hdr->length + sizeof(*hdr));
+       if (ptr) {
+               hdr = ptr - page_size;
+               munmap(hdr, hdr->length + page_size);
+       }
 }
 
 void *os_realloc(void *ptr, size_t length)
 {
-       struct os_mem_hdr *hdr = ptr;
+       int page_size = getpagesize();
+       struct os_mem_hdr *hdr;
        void *buf = NULL;
 
-       hdr--;
-       if (length != 0) {
+       if (length) {
                buf = os_malloc(length);
                if (!buf)
                        return buf;
                if (ptr) {
+                       hdr = ptr - page_size;
                        if (length > hdr->length)
                                length = hdr->length;
                        memcpy(buf, ptr, length);
                }
        }
-       os_free(ptr);
+       if (ptr)
+               os_free(ptr);
 
        return buf;
 }
@@ -786,3 +790,40 @@ int os_mprotect_allow(void *start, size_t len)
 
        return mprotect(start, len, PROT_READ | PROT_WRITE);
 }
+
+void *os_find_text_base(void)
+{
+       char line[500];
+       void *base = NULL;
+       int len;
+       int fd;
+
+       /*
+        * This code assumes that the first line of /proc/self/maps holds
+        * information about the text, for example:
+        *
+        * 5622d9907000-5622d9a55000 r-xp 00000000 08:01 15067168   u-boot
+        *
+        * The first hex value is assumed to be the address.
+        *
+        * This is tested in Linux 4.15.
+        */
+       fd = open("/proc/self/maps", O_RDONLY);
+       if (fd == -1)
+               return NULL;
+       len = read(fd, line, sizeof(line));
+       if (len > 0) {
+               char *end = memchr(line, '-', len);
+
+               if (end) {
+                       unsigned long long addr;
+
+                       *end = '\0';
+                       if (sscanf(line, "%llx", &addr) == 1)
+                               base = (void *)addr;
+               }
+       }
+       close(fd);
+
+       return base;
+}
index 2f5e6e95182631d7d2cfc03ea43edb5e1d46ecb1..82828f0c1d45f5dcbb7fa7e28c6656e468189a3b 100644 (file)
@@ -303,10 +303,8 @@ int board_run_command(const char *cmdline)
 static void setup_ram_buf(struct sandbox_state *state)
 {
        /* Zero the RAM buffer if we didn't read it, to keep valgrind happy */
-       if (!state->ram_buf_read) {
+       if (!state->ram_buf_read)
                memset(state->ram_buf, '\0', state->ram_size);
-               printf("clear %p %x\n", state->ram_buf, state->ram_size);
-       }
 
        gd->arch.ram_buf = state->ram_buf;
        gd->ram_size = state->ram_size;
@@ -328,6 +326,10 @@ int main(int argc, char *argv[])
        gd_t data;
        int ret;
 
+       memset(&data, '\0', sizeof(data));
+       gd = &data;
+       gd->arch.text_base = os_find_text_base();
+
        ret = state_init();
        if (ret)
                goto err;
@@ -340,8 +342,6 @@ int main(int argc, char *argv[])
        if (ret)
                goto err;
 
-       memset(&data, '\0', sizeof(data));
-       gd = &data;
 #if CONFIG_VAL(SYS_MALLOC_F_LEN)
        gd->malloc_base = CONFIG_MALLOC_F_ADDR;
 #endif
@@ -350,6 +350,12 @@ int main(int argc, char *argv[])
 #endif
        setup_ram_buf(state);
 
+       /*
+        * Set up the relocation offset here, since sandbox symbols are always
+        * relocated by the OS before sandbox is entered.
+        */
+       gd->reloc_off = (ulong)gd->arch.text_base;
+
        /* Do pre- and post-relocation init */
        board_init_f(0);
 
index f6a6a343d25d84fc8a877c7e9f0b8d01f6b39164..f4ce72d56602c0b166ccf9a0beaf61852c142c90 100644 (file)
@@ -12,6 +12,7 @@
 /* Architecture-specific global data */
 struct arch_global_data {
        uint8_t         *ram_buf;       /* emulated RAM buffer */
+       void            *text_base;     /* pointer to base of text region */
 };
 
 #include <asm-generic/global_data.h>
index fc52f47f821b76a38b7ea30f0aaac02ec1f33848..e956a05262f4a028dafe258818dcce625bebc970 100644 (file)
@@ -59,14 +59,6 @@ void sandbox_i2c_eeprom_set_test_mode(struct udevice *dev,
 
 void sandbox_i2c_eeprom_set_offset_len(struct udevice *dev, int offset_len);
 
-/*
- * sandbox_timer_add_offset()
- *
- * Allow tests to add to the time reported through lib/time.c functions
- * offset: number of milliseconds to advance the system time
- */
-void sandbox_timer_add_offset(unsigned long offset);
-
 /**
  * sandbox_i2c_rtc_set_offset() - set the time offset from system/base time
  *
diff --git a/board/amlogic/odroid-c2/MAINTAINERS b/board/amlogic/odroid-c2/MAINTAINERS
deleted file mode 100644 (file)
index 6a85306..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-ODROID-C2
-M:     Beniamino Galvani <b.galvani@gmail.com>
-M:     Neil Armstrong <narmstrong@baylibre.com>
-S:     Maintained
-F:     board/amlogic/odroid-c2/
-F:     include/configs/odroid-c2.h
-F:     configs/nanopi-k2_defconfig
-F:     configs/odroid-c2_defconfig
diff --git a/board/amlogic/odroid-c2/Makefile b/board/amlogic/odroid-c2/Makefile
deleted file mode 100644 (file)
index a6a3db7..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0+
-#
-# (C) Copyright 2016 Beniamino Galvani <b.galvani@gmail.com>
-
-obj-y  := odroid-c2.o
diff --git a/board/amlogic/odroid-c2/README.nanopi-k2 b/board/amlogic/odroid-c2/README.nanopi-k2
deleted file mode 100644 (file)
index d450d3c..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-U-Boot for NanoPi-K2
-====================
-
-NanoPi-K2 is a single board computer manufactured by FriendlyElec
-with the following specifications:
-
- - Amlogic S905 ARM Cortex-A53 quad-core SoC @ 1.5GHz
- - ARM Mali 450 GPU
- - 2GB DDR3 SDRAM
- - Gigabit Ethernet
- - HDMI 2.0 4K/60Hz display
- - 40-pin GPIO header
- - 4 x USB 2.0 Host, 1 x USB OTG
- - eMMC, microSD
- - Infrared receiver
-
-Schematics are available on the manufacturer website.
-
-Currently the u-boot port supports the following devices:
- - serial
- - eMMC, microSD
- - Ethernet
-
-u-boot compilation
-==================
-
- > export ARCH=arm
- > export CROSS_COMPILE=aarch64-none-elf-
- > make nanopi-k2_defconfig
- > make
-
-Image creation
-==============
-
-Amlogic doesn't provide sources for the firmware and for tools needed
-to create the bootloader image, so it is necessary to obtain them from
-the git tree published by the board vendor:
-
- > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
- > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
- > tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
- > tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
- > export PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
- > git clone https://github.com/BayLibre/u-boot.git -b libretech-cc amlogic-u-boot
- > git clone https://github.com/friendlyarm/u-boot.git -b nanopi-k2-v2015.01 amlogic-u-boot
- > cd amlogic-u-boot
- > sed -i 's/aarch64-linux-gnu-/aarch64-none-elf-/' Makefile
- > sed -i 's/arm-linux-/arm-none-eabi-/' arch/arm/cpu/armv8/gxb/firmware/scp_task/Makefile
- > make nanopi-k2_defconfig
- > make
- > export FIPDIR=$PWD/fip
-
-Go back to mainline U-Boot source tree then :
- > mkdir fip
-
- > cp $FIPDIR/gxb/bl2.bin fip/
- > cp $FIPDIR/gxb/acs.bin fip/
- > cp $FIPDIR/gxb/bl21.bin fip/
- > cp $FIPDIR/gxb/bl30.bin fip/
- > cp $FIPDIR/gxb/bl301.bin fip/
- > cp $FIPDIR/gxb/bl31.img fip/
- > cp u-boot.bin fip/bl33.bin
-
- > $FIPDIR/blx_fix.sh \
-       fip/bl30.bin \
-       fip/zero_tmp \
-       fip/bl30_zero.bin \
-       fip/bl301.bin \
-       fip/bl301_zero.bin \
-       fip/bl30_new.bin \
-       bl30
-
- > $FIPDIR/fip_create \
-        --bl30 fip/bl30_new.bin \
-        --bl31 fip/bl31.img \
-        --bl33 fip/bl33.bin \
-        fip/fip.bin
-
- > python $FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0
-
- > $FIPDIR/blx_fix.sh \
-       fip/bl2_acs.bin \
-       fip/zero_tmp \
-       fip/bl2_zero.bin \
-       fip/bl21.bin \
-       fip/bl21_zero.bin \
-       fip/bl2_new.bin \
-       bl2
-
- > cat fip/bl2_new.bin fip/fip.bin > fip/boot_new.bin
-
- > $FIPDIR/gxb/aml_encrypt_gxb --bootsig \
-               --input fip/boot_new.bin
-               --output fip/u-boot.bin
-
-and then write the image to SD with:
-
- > DEV=/dev/your_sd_device
- > dd if=fip/u-boot.bin of=$DEV conv=fsync,notrunc bs=512 seek=1
diff --git a/board/amlogic/odroid-c2/README.odroid-c2 b/board/amlogic/odroid-c2/README.odroid-c2
deleted file mode 100644 (file)
index bed48c5..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-U-Boot for ODROID-C2
-====================
-
-ODROID-C2 is a single board computer manufactured by Hardkernel
-Co. Ltd with the following specifications:
-
- - Amlogic S905 ARM Cortex-A53 quad-core SoC @ 2GHz
- - ARM Mali 450 GPU
- - 2GB DDR3 SDRAM
- - Gigabit Ethernet
- - HDMI 2.0 4K/60Hz display
- - 40-pin GPIO header
- - 4 x USB 2.0 Host, 1 x USB OTG
- - eMMC, microSD
- - Infrared receiver
-
-Schematics are available on the manufacturer website.
-
-Currently the u-boot port supports the following devices:
- - serial
- - eMMC, microSD
- - Ethernet
- - I2C
- - Regulators
- - Reset controller
- - Clock controller
- - ADC
-
-u-boot compilation
-==================
-
- > export ARCH=arm
- > export CROSS_COMPILE=aarch64-none-elf-
- > make odroid-c2_defconfig
- > make
-
-Image creation
-==============
-
-Amlogic doesn't provide sources for the firmware and for tools needed
-to create the bootloader image, so it is necessary to obtain them from
-the git tree published by the board vendor:
-
- > DIR=odroid-c2
- > git clone --depth 1 \
-       https://github.com/hardkernel/u-boot.git -b odroidc2-v2015.01 \
-       $DIR
- > $DIR/fip/fip_create --bl30  $DIR/fip/gxb/bl30.bin \
-                       --bl301 $DIR/fip/gxb/bl301.bin \
-                       --bl31  $DIR/fip/gxb/bl31.bin \
-                       --bl33  u-boot.bin \
-                       $DIR/fip.bin
- > $DIR/fip/fip_create --dump $DIR/fip.bin
- > cat $DIR/fip/gxb/bl2.package $DIR/fip.bin > $DIR/boot_new.bin
- > $DIR/fip/gxb/aml_encrypt_gxb --bootsig \
-                                --input $DIR/boot_new.bin \
-                                --output $DIR/u-boot.img
- > dd if=$DIR/u-boot.img of=$DIR/u-boot.gxbb bs=512 skip=96
-
-and then write the image to SD with:
-
- > DEV=/dev/your_sd_device
- > BL1=$DIR/sd_fuse/bl1.bin.hardkernel
- > dd if=$BL1 of=$DEV conv=fsync bs=1 count=442
- > dd if=$BL1 of=$DEV conv=fsync bs=512 skip=1 seek=1
- > dd if=$DIR/u-boot.gxbb of=$DEV conv=fsync bs=512 seek=97
diff --git a/board/amlogic/odroid-c2/odroid-c2.c b/board/amlogic/odroid-c2/odroid-c2.c
deleted file mode 100644 (file)
index 62f0f4c..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2016 Beniamino Galvani <b.galvani@gmail.com>
- */
-
-#include <common.h>
-#include <dm.h>
-#include <environment.h>
-#include <asm/io.h>
-#include <asm/arch/gx.h>
-#include <asm/arch/sm.h>
-#include <asm/arch/eth.h>
-#include <asm/arch/mem.h>
-
-#define EFUSE_SN_OFFSET                20
-#define EFUSE_SN_SIZE          16
-#define EFUSE_MAC_OFFSET       52
-#define EFUSE_MAC_SIZE         6
-
-int misc_init_r(void)
-{
-       u8 mac_addr[EFUSE_MAC_SIZE];
-       char serial[EFUSE_SN_SIZE];
-       ssize_t len;
-
-       meson_eth_init(PHY_INTERFACE_MODE_RGMII, 0);
-
-       if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
-               len = meson_sm_read_efuse(EFUSE_MAC_OFFSET,
-                                         mac_addr, EFUSE_MAC_SIZE);
-               if (len == EFUSE_MAC_SIZE && is_valid_ethaddr(mac_addr))
-                       eth_env_set_enetaddr("ethaddr", mac_addr);
-       }
-
-       if (!env_get("serial#")) {
-               len = meson_sm_read_efuse(EFUSE_SN_OFFSET, serial,
-                       EFUSE_SN_SIZE);
-               if (len == EFUSE_SN_SIZE)
-                       env_set("serial#", serial);
-       }
-
-       return 0;
-}
diff --git a/board/amlogic/p200/MAINTAINERS b/board/amlogic/p200/MAINTAINERS
new file mode 100644 (file)
index 0000000..96fe92d
--- /dev/null
@@ -0,0 +1,8 @@
+P200
+M:     Beniamino Galvani <b.galvani@gmail.com>
+M:     Neil Armstrong <narmstrong@baylibre.com>
+S:     Maintained
+F:     board/amlogic/p200/
+F:     configs/nanopi-k2_defconfig
+F:     configs/odroid-c2_defconfig
+F:     configs/p200_defconfig
diff --git a/board/amlogic/p200/Makefile b/board/amlogic/p200/Makefile
new file mode 100644 (file)
index 0000000..f82a7ea
--- /dev/null
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2016 Beniamino Galvani <b.galvani@gmail.com>
+
+obj-y  := p200.o
diff --git a/board/amlogic/p200/README.nanopi-k2 b/board/amlogic/p200/README.nanopi-k2
new file mode 100644 (file)
index 0000000..d450d3c
--- /dev/null
@@ -0,0 +1,99 @@
+U-Boot for NanoPi-K2
+====================
+
+NanoPi-K2 is a single board computer manufactured by FriendlyElec
+with the following specifications:
+
+ - Amlogic S905 ARM Cortex-A53 quad-core SoC @ 1.5GHz
+ - ARM Mali 450 GPU
+ - 2GB DDR3 SDRAM
+ - Gigabit Ethernet
+ - HDMI 2.0 4K/60Hz display
+ - 40-pin GPIO header
+ - 4 x USB 2.0 Host, 1 x USB OTG
+ - eMMC, microSD
+ - Infrared receiver
+
+Schematics are available on the manufacturer website.
+
+Currently the u-boot port supports the following devices:
+ - serial
+ - eMMC, microSD
+ - Ethernet
+
+u-boot compilation
+==================
+
+ > export ARCH=arm
+ > export CROSS_COMPILE=aarch64-none-elf-
+ > make nanopi-k2_defconfig
+ > make
+
+Image creation
+==============
+
+Amlogic doesn't provide sources for the firmware and for tools needed
+to create the bootloader image, so it is necessary to obtain them from
+the git tree published by the board vendor:
+
+ > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > export PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
+ > git clone https://github.com/BayLibre/u-boot.git -b libretech-cc amlogic-u-boot
+ > git clone https://github.com/friendlyarm/u-boot.git -b nanopi-k2-v2015.01 amlogic-u-boot
+ > cd amlogic-u-boot
+ > sed -i 's/aarch64-linux-gnu-/aarch64-none-elf-/' Makefile
+ > sed -i 's/arm-linux-/arm-none-eabi-/' arch/arm/cpu/armv8/gxb/firmware/scp_task/Makefile
+ > make nanopi-k2_defconfig
+ > make
+ > export FIPDIR=$PWD/fip
+
+Go back to mainline U-Boot source tree then :
+ > mkdir fip
+
+ > cp $FIPDIR/gxb/bl2.bin fip/
+ > cp $FIPDIR/gxb/acs.bin fip/
+ > cp $FIPDIR/gxb/bl21.bin fip/
+ > cp $FIPDIR/gxb/bl30.bin fip/
+ > cp $FIPDIR/gxb/bl301.bin fip/
+ > cp $FIPDIR/gxb/bl31.img fip/
+ > cp u-boot.bin fip/bl33.bin
+
+ > $FIPDIR/blx_fix.sh \
+       fip/bl30.bin \
+       fip/zero_tmp \
+       fip/bl30_zero.bin \
+       fip/bl301.bin \
+       fip/bl301_zero.bin \
+       fip/bl30_new.bin \
+       bl30
+
+ > $FIPDIR/fip_create \
+        --bl30 fip/bl30_new.bin \
+        --bl31 fip/bl31.img \
+        --bl33 fip/bl33.bin \
+        fip/fip.bin
+
+ > python $FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0
+
+ > $FIPDIR/blx_fix.sh \
+       fip/bl2_acs.bin \
+       fip/zero_tmp \
+       fip/bl2_zero.bin \
+       fip/bl21.bin \
+       fip/bl21_zero.bin \
+       fip/bl2_new.bin \
+       bl2
+
+ > cat fip/bl2_new.bin fip/fip.bin > fip/boot_new.bin
+
+ > $FIPDIR/gxb/aml_encrypt_gxb --bootsig \
+               --input fip/boot_new.bin
+               --output fip/u-boot.bin
+
+and then write the image to SD with:
+
+ > DEV=/dev/your_sd_device
+ > dd if=fip/u-boot.bin of=$DEV conv=fsync,notrunc bs=512 seek=1
diff --git a/board/amlogic/p200/README.odroid-c2 b/board/amlogic/p200/README.odroid-c2
new file mode 100644 (file)
index 0000000..bed48c5
--- /dev/null
@@ -0,0 +1,66 @@
+U-Boot for ODROID-C2
+====================
+
+ODROID-C2 is a single board computer manufactured by Hardkernel
+Co. Ltd with the following specifications:
+
+ - Amlogic S905 ARM Cortex-A53 quad-core SoC @ 2GHz
+ - ARM Mali 450 GPU
+ - 2GB DDR3 SDRAM
+ - Gigabit Ethernet
+ - HDMI 2.0 4K/60Hz display
+ - 40-pin GPIO header
+ - 4 x USB 2.0 Host, 1 x USB OTG
+ - eMMC, microSD
+ - Infrared receiver
+
+Schematics are available on the manufacturer website.
+
+Currently the u-boot port supports the following devices:
+ - serial
+ - eMMC, microSD
+ - Ethernet
+ - I2C
+ - Regulators
+ - Reset controller
+ - Clock controller
+ - ADC
+
+u-boot compilation
+==================
+
+ > export ARCH=arm
+ > export CROSS_COMPILE=aarch64-none-elf-
+ > make odroid-c2_defconfig
+ > make
+
+Image creation
+==============
+
+Amlogic doesn't provide sources for the firmware and for tools needed
+to create the bootloader image, so it is necessary to obtain them from
+the git tree published by the board vendor:
+
+ > DIR=odroid-c2
+ > git clone --depth 1 \
+       https://github.com/hardkernel/u-boot.git -b odroidc2-v2015.01 \
+       $DIR
+ > $DIR/fip/fip_create --bl30  $DIR/fip/gxb/bl30.bin \
+                       --bl301 $DIR/fip/gxb/bl301.bin \
+                       --bl31  $DIR/fip/gxb/bl31.bin \
+                       --bl33  u-boot.bin \
+                       $DIR/fip.bin
+ > $DIR/fip/fip_create --dump $DIR/fip.bin
+ > cat $DIR/fip/gxb/bl2.package $DIR/fip.bin > $DIR/boot_new.bin
+ > $DIR/fip/gxb/aml_encrypt_gxb --bootsig \
+                                --input $DIR/boot_new.bin \
+                                --output $DIR/u-boot.img
+ > dd if=$DIR/u-boot.img of=$DIR/u-boot.gxbb bs=512 skip=96
+
+and then write the image to SD with:
+
+ > DEV=/dev/your_sd_device
+ > BL1=$DIR/sd_fuse/bl1.bin.hardkernel
+ > dd if=$BL1 of=$DEV conv=fsync bs=1 count=442
+ > dd if=$BL1 of=$DEV conv=fsync bs=512 skip=1 seek=1
+ > dd if=$DIR/u-boot.gxbb of=$DEV conv=fsync bs=512 seek=97
diff --git a/board/amlogic/p200/README.p200 b/board/amlogic/p200/README.p200
new file mode 100644 (file)
index 0000000..01d82d1
--- /dev/null
@@ -0,0 +1,103 @@
+U-Boot for Amlogic P200
+=======================
+
+P200 is a reference board manufactured by Amlogic with the following
+specifications:
+
+ - Amlogic S905 ARM Cortex-A53 quad-core SoC @ 1.5GHz
+ - ARM Mali 450 GPU
+ - 2GB DDR3 SDRAM
+ - Gigabit Ethernet
+ - HDMI 2.0 4K/60Hz display
+ - 2 x USB 2.0 Host
+ - eMMC, microSD
+ - Infrared receiver
+ - SDIO WiFi Module
+ - CVBS+Stereo Audio Jack
+
+Schematics are available from Amlogic on demand.
+
+Currently the u-boot port supports the following devices:
+ - serial
+ - eMMC, microSD
+ - Ethernet
+ - I2C
+ - Regulators
+ - Reset controller
+ - Clock controller
+ - USB Host
+ - ADC
+
+u-boot compilation
+==================
+
+ > export ARCH=arm
+ > export CROSS_COMPILE=aarch64-none-elf-
+ > make p200_defconfig
+ > make
+
+Image creation
+==============
+
+Amlogic doesn't provide sources for the firmware and for tools needed
+to create the bootloader image, so it is necessary to obtain them from
+the git tree published by the board vendor:
+
+ > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > export PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
+ > git clone https://github.com/BayLibre/u-boot.git -b n-amlogic-openlinux-20170606 amlogic-u-boot
+ > cd amlogic-u-boot
+ > make gxb_p200_v1_defconfig
+ > make
+ > export FIPDIR=$PWD/fip
+
+Go back to mainline U-boot source tree then :
+ > mkdir fip
+
+ > cp $FIPDIR/gxl/bl2.bin fip/
+ > cp $FIPDIR/gxl/acs.bin fip/
+ > cp $FIPDIR/gxl/bl21.bin fip/
+ > cp $FIPDIR/gxl/bl30.bin fip/
+ > cp $FIPDIR/gxl/bl301.bin fip/
+ > cp $FIPDIR/gxl/bl31.img fip/
+ > cp u-boot.bin fip/bl33.bin
+
+ > $FIPDIR/blx_fix.sh \
+       fip/bl30.bin \
+       fip/zero_tmp \
+       fip/bl30_zero.bin \
+       fip/bl301.bin \
+       fip/bl301_zero.bin \
+       fip/bl30_new.bin \
+       bl30
+
+ > $FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0
+
+ > $FIPDIR/blx_fix.sh \
+       fip/bl2_acs.bin \
+       fip/zero_tmp \
+       fip/bl2_zero.bin \
+       fip/bl21.bin \
+       fip/bl21_zero.bin \
+       fip/bl2_new.bin \
+       bl2
+
+ > $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl30_new.bin
+ > $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl31.img
+ > $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl33.bin
+ > $FIPDIR/gxl/aml_encrypt_gxl --bl2sig --input fip/bl2_new.bin --output fip/bl2.n.bin.sig
+ > $FIPDIR/gxl/aml_encrypt_gxl --bootmk \
+               --output fip/u-boot.bin \
+               --bl2 fip/bl2.n.bin.sig \
+               --bl30 fip/bl30_new.bin.enc \
+               --bl31 fip/bl31.img.enc \
+               --bl33 fip/bl33.bin.enc
+
+and then write the image to SD with:
+
+ > DEV=/dev/your_sd_device
+ > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
+ > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
diff --git a/board/amlogic/p200/p200.c b/board/amlogic/p200/p200.c
new file mode 100644 (file)
index 0000000..62f0f4c
--- /dev/null
@@ -0,0 +1,43 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2016 Beniamino Galvani <b.galvani@gmail.com>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <environment.h>
+#include <asm/io.h>
+#include <asm/arch/gx.h>
+#include <asm/arch/sm.h>
+#include <asm/arch/eth.h>
+#include <asm/arch/mem.h>
+
+#define EFUSE_SN_OFFSET                20
+#define EFUSE_SN_SIZE          16
+#define EFUSE_MAC_OFFSET       52
+#define EFUSE_MAC_SIZE         6
+
+int misc_init_r(void)
+{
+       u8 mac_addr[EFUSE_MAC_SIZE];
+       char serial[EFUSE_SN_SIZE];
+       ssize_t len;
+
+       meson_eth_init(PHY_INTERFACE_MODE_RGMII, 0);
+
+       if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
+               len = meson_sm_read_efuse(EFUSE_MAC_OFFSET,
+                                         mac_addr, EFUSE_MAC_SIZE);
+               if (len == EFUSE_MAC_SIZE && is_valid_ethaddr(mac_addr))
+                       eth_env_set_enetaddr("ethaddr", mac_addr);
+       }
+
+       if (!env_get("serial#")) {
+               len = meson_sm_read_efuse(EFUSE_SN_OFFSET, serial,
+                       EFUSE_SN_SIZE);
+               if (len == EFUSE_SN_SIZE)
+                       env_set("serial#", serial);
+       }
+
+       return 0;
+}
diff --git a/board/amlogic/p201/MAINTAINERS b/board/amlogic/p201/MAINTAINERS
new file mode 100644 (file)
index 0000000..3e84a8e
--- /dev/null
@@ -0,0 +1,5 @@
+P201
+M:     Neil Armstrong <narmstrong@baylibre.com>
+S:     Maintained
+F:     board/amlogic/p201/
+F:     configs/p201_defconfig
diff --git a/board/amlogic/p201/Makefile b/board/amlogic/p201/Makefile
new file mode 100644 (file)
index 0000000..11de539
--- /dev/null
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2016 Beniamino Galvani <b.galvani@gmail.com>
+
+obj-y  := p201.o
diff --git a/board/amlogic/p201/README.p201 b/board/amlogic/p201/README.p201
new file mode 100644 (file)
index 0000000..c251096
--- /dev/null
@@ -0,0 +1,103 @@
+U-Boot for Amlogic P201
+=======================
+
+P201 is a reference board manufactured by Amlogic with the following
+specifications:
+
+ - Amlogic S905 ARM Cortex-A53 quad-core SoC @ 1.5GHz
+ - ARM Mali 450 GPU
+ - 2GB DDR3 SDRAM
+ - 10/100 Ethernet
+ - HDMI 2.0 4K/60Hz display
+ - 2 x USB 2.0 Host
+ - eMMC, microSD
+ - Infrared receiver
+ - SDIO WiFi Module
+ - CVBS+Stereo Audio Jack
+
+Schematics are available from Amlogic on demand.
+
+Currently the u-boot port supports the following devices:
+ - serial
+ - eMMC, microSD
+ - Ethernet
+ - I2C
+ - Regulators
+ - Reset controller
+ - Clock controller
+ - USB Host
+ - ADC
+
+u-boot compilation
+==================
+
+ > export ARCH=arm
+ > export CROSS_COMPILE=aarch64-none-elf-
+ > make p201_defconfig
+ > make
+
+Image creation
+==============
+
+Amlogic doesn't provide sources for the firmware and for tools needed
+to create the bootloader image, so it is necessary to obtain them from
+the git tree published by the board vendor:
+
+ > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > export PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
+ > git clone https://github.com/BayLibre/u-boot.git -b n-amlogic-openlinux-20170606 amlogic-u-boot
+ > cd amlogic-u-boot
+ > make gxb_p201_v1_defconfig
+ > make
+ > export FIPDIR=$PWD/fip
+
+Go back to mainline U-boot source tree then :
+ > mkdir fip
+
+ > cp $FIPDIR/gxl/bl2.bin fip/
+ > cp $FIPDIR/gxl/acs.bin fip/
+ > cp $FIPDIR/gxl/bl21.bin fip/
+ > cp $FIPDIR/gxl/bl30.bin fip/
+ > cp $FIPDIR/gxl/bl301.bin fip/
+ > cp $FIPDIR/gxl/bl31.img fip/
+ > cp u-boot.bin fip/bl33.bin
+
+ > $FIPDIR/blx_fix.sh \
+       fip/bl30.bin \
+       fip/zero_tmp \
+       fip/bl30_zero.bin \
+       fip/bl301.bin \
+       fip/bl301_zero.bin \
+       fip/bl30_new.bin \
+       bl30
+
+ > $FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0
+
+ > $FIPDIR/blx_fix.sh \
+       fip/bl2_acs.bin \
+       fip/zero_tmp \
+       fip/bl2_zero.bin \
+       fip/bl21.bin \
+       fip/bl21_zero.bin \
+       fip/bl2_new.bin \
+       bl2
+
+ > $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl30_new.bin
+ > $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl31.img
+ > $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl33.bin
+ > $FIPDIR/gxl/aml_encrypt_gxl --bl2sig --input fip/bl2_new.bin --output fip/bl2.n.bin.sig
+ > $FIPDIR/gxl/aml_encrypt_gxl --bootmk \
+               --output fip/u-boot.bin \
+               --bl2 fip/bl2.n.bin.sig \
+               --bl30 fip/bl30_new.bin.enc \
+               --bl31 fip/bl31.img.enc \
+               --bl33 fip/bl33.bin.enc
+
+and then write the image to SD with:
+
+ > DEV=/dev/your_sd_device
+ > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
+ > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
diff --git a/board/amlogic/p201/p201.c b/board/amlogic/p201/p201.c
new file mode 100644 (file)
index 0000000..ef0c65c
--- /dev/null
@@ -0,0 +1,43 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2016 Beniamino Galvani <b.galvani@gmail.com>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <environment.h>
+#include <asm/io.h>
+#include <asm/arch/gx.h>
+#include <asm/arch/sm.h>
+#include <asm/arch/eth.h>
+#include <asm/arch/mem.h>
+
+#define EFUSE_SN_OFFSET                20
+#define EFUSE_SN_SIZE          16
+#define EFUSE_MAC_OFFSET       52
+#define EFUSE_MAC_SIZE         6
+
+int misc_init_r(void)
+{
+       u8 mac_addr[EFUSE_MAC_SIZE];
+       char serial[EFUSE_SN_SIZE];
+       ssize_t len;
+
+       meson_eth_init(PHY_INTERFACE_MODE_RMII, 0);
+
+       if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
+               len = meson_sm_read_efuse(EFUSE_MAC_OFFSET,
+                                         mac_addr, EFUSE_MAC_SIZE);
+               if (len == EFUSE_MAC_SIZE && is_valid_ethaddr(mac_addr))
+                       eth_env_set_enetaddr("ethaddr", mac_addr);
+       }
+
+       if (!env_get("serial#")) {
+               len = meson_sm_read_efuse(EFUSE_SN_OFFSET, serial,
+                       EFUSE_SN_SIZE);
+               if (len == EFUSE_SN_SIZE)
+                       env_set("serial#", serial);
+       }
+
+       return 0;
+}
index 07ca6f204d500894b3728c31f32e544d4cba3dcc..74ad3716ec77dfb1caf96aaa9b40093f7f0127b8 100644 (file)
@@ -4,5 +4,6 @@ S:      Maintained
 F:     board/amlogic/p212/
 F:     include/configs/p212.h
 F:     configs/khadas-vim_defconfig
+F:     configs/libretech-ac_defconfig
 F:     configs/libretech-cc_defconfig
 F:     configs/p212_defconfig
diff --git a/board/amlogic/p212/README.libretech-ac b/board/amlogic/p212/README.libretech-ac
new file mode 100644 (file)
index 0000000..5386042
--- /dev/null
@@ -0,0 +1,103 @@
+U-Boot for LibreTech AC
+=======================
+
+LibreTech AC is a single board computer manufactured by Libre Technology
+with the following specifications:
+
+ - Amlogic S805X ARM Cortex-A53 quad-core SoC @ 1.2GHz
+ - ARM Mali 450 GPU
+ - 512MiB DDR4 SDRAM
+ - 10/100 Ethernet
+ - HDMI 2.0 4K/60Hz display
+ - 40-pin GPIO header
+ - 4 x USB 2.0 Host
+ - eMMC, SPI NOR Flash
+ - Infrared receiver
+
+Schematics are available on the manufacturer website.
+
+Currently the U-Boot port supports the following devices:
+ - serial
+ - eMMC
+ - Ethernet
+ - USB
+
+U-Boot compilation
+==================
+
+ > export ARCH=arm
+ > export CROSS_COMPILE=aarch64-none-elf-
+ > make libretech-ac_defconfig
+ > make
+
+Image creation
+==============
+
+Amlogic doesn't provide sources for the firmware and for tools needed
+to create the bootloader image, so it is necessary to obtain them from
+the git tree published by the board vendor:
+
+ > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > export PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
+ > git clone https://github.com/BayLibre/u-boot.git -b libretech-ac amlogic-u-boot
+ > cd amlogic-u-boot
+ > wget https://raw.githubusercontent.com/BayLibre/u-boot/libretech-cc/fip/blx_fix.sh
+ > make libretech_ac_defconfig
+ > make
+ > export UBOOTDIR=$PWD
+
+Download the latest Amlogic Buildroot package, and extract it :
+ > wget http://openlinux2.amlogic.com:8000/ARM/filesystem/Linux_BSP/buildroot_openlinux_kernel_4.9_fbdev_20180418.tar.gz
+ > tar xfz buildroot_openlinux_kernel_4.9_fbdev_20180418.tar.gz buildroot_openlinux_kernel_4.9_fbdev_20180418/bootloader
+ > export BRDIR=$PWD/buildroot_openlinux_kernel_4.9_fbdev_20180418
+
+Go back to mainline U-Boot source tree then :
+ > mkdir fip
+
+ > cp $UBOOTDIR/build/scp_task/bl301.bin fip/
+ > cp $UBOOTDIR/build/board/amlogic/libretech_ac/firmware/bl21.bin fip/
+ > cp $UBOOTDIR/build/board/amlogic/libretech_ac/firmware/acs.bin fip/
+ > cp $BRDIR/bootloader/uboot-repo/bl2/bin/gxl/bl2.bin fip/
+ > cp $BRDIR/bootloader/uboot-repo/bl30/bin/gxl/bl30.bin fip/
+ > cp $BRDIR/bootloader/uboot-repo/bl31/bin/gxl/bl31.img fip/
+ > cp u-boot.bin fip/bl33.bin
+
+ > sh $UBOOTDIR/blx_fix.sh \
+       fip/bl30.bin \
+       fip/zero_tmp \
+       fip/bl30_zero.bin \
+       fip/bl301.bin \
+       fip/bl301_zero.bin \
+       fip/bl30_new.bin \
+       bl30
+
+ > $BRDIR/bootloader/uboot-repo/fip/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0
+
+ > sh $UBOOTDIR/blx_fix.sh \
+       fip/bl2_acs.bin \
+       fip/zero_tmp \
+       fip/bl2_zero.bin \
+       fip/bl21.bin \
+       fip/bl21_zero.bin \
+       fip/bl2_new.bin \
+       bl2
+
+ > $BRDIR/bootloader/uboot-repo/fip/gxl/aml_encrypt_gxl --bl3enc --input fip/bl30_new.bin
+ > $BRDIR/bootloader/uboot-repo/fip/gxl/aml_encrypt_gxl --bl3enc --input fip/bl31.img
+ > $BRDIR/bootloader/uboot-repo/fip/gxl/aml_encrypt_gxl --bl3enc --input fip/bl33.bin
+ > $BRDIR/bootloader/uboot-repo/fip/gxl/aml_encrypt_gxl --bl2sig --input fip/bl2_new.bin --output fip/bl2.n.bin.sig
+ > $BRDIR/bootloader/uboot-repo/fip/gxl/aml_encrypt_gxl --bootmk \
+               --output fip/u-boot.bin \
+               --bl2 fip/bl2.n.bin.sig \
+               --bl30 fip/bl30_new.bin.enc \
+               --bl31 fip/bl31.img.enc \
+               --bl33 fip/bl33.bin.enc
+
+and then write the image to SD with:
+
+ > DEV=/dev/your_sd_device
+ > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
+ > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
index 578693fd2dba96493e65b68de49634a6e4cfbc27..8bcfc296f3e0966c976c9be954568e49a44d40ea 100644 (file)
@@ -48,9 +48,9 @@ the git tree published by the board vendor:
  > tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
  > tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
  > export PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
- > git clone https://github.com/khadas/u-boot -b Vim vim-u-boot
+ > git clone https://github.com/khadas/u-boot -b khadas-vim-v2015.01 vim-u-boot
  > cd vim-u-boot
- > make kvim_defconfig
+ > make kvim2_defconfig
  > make
  > export FIPDIR=$PWD/fip
 
diff --git a/board/amlogic/u200/MAINTAINERS b/board/amlogic/u200/MAINTAINERS
new file mode 100644 (file)
index 0000000..baf3813
--- /dev/null
@@ -0,0 +1,5 @@
+U200
+M:     Neil Armstrong <narmstrong@baylibre.com>
+S:     Maintained
+F:     board/amlogic/u200/
+F:     configs/u200_defconfig
diff --git a/board/amlogic/u200/Makefile b/board/amlogic/u200/Makefile
new file mode 100644 (file)
index 0000000..485791b
--- /dev/null
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2016 BayLibre, SAS
+# Author: Neil Armstrong <narmstrong@baylibre.com>
+
+obj-y  := u200.o
diff --git a/board/amlogic/u200/README b/board/amlogic/u200/README
new file mode 100644 (file)
index 0000000..bffac5e
--- /dev/null
@@ -0,0 +1,128 @@
+U-Boot for Amlogic U200
+=======================
+
+U200 is a reference board manufactured by Amlogic with the following
+specifications:
+
+ - Amlogic S905D2 ARM Cortex-A53 quad-core SoC
+ - 2GB DDR4 SDRAM
+ - 10/100 Ethernet (Internal PHY)
+ - 1 x USB 3.0 Host
+ - eMMC
+ - SDcard
+ - Infrared receiver
+ - SDIO WiFi Module
+ - MIPI DSI Connector
+ - Audio HAT Connector
+ - PCI-E M.2 Connector
+
+Schematics are available from Amlogic on demand.
+
+Currently the u-boot port supports the following devices:
+ - serial
+ - Ethernet
+ - Regulators
+ - Clock controller
+
+u-boot compilation
+==================
+
+ > export ARCH=arm
+ > export CROSS_COMPILE=aarch64-none-elf-
+ > make u200_defconfig
+ > make
+
+Image creation
+==============
+
+Amlogic doesn't provide sources for the firmware and for tools needed
+to create the bootloader image, so it is necessary to obtain them from
+the git tree published by the board vendor:
+
+ > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > export PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
+ > git clone https://github.com/BayLibre/u-boot.git -b buildroot-openlinux-20180418 amlogic-u-boot
+ > cd amlogic-u-boot
+ > make g12a_u200_v1_defconfig
+ > make
+ > export UBOOTDIR=$PWD
+
+Download the latest Amlogic Buildroot package, and extract it :
+ > wget http://openlinux2.amlogic.com:8000/ARM/filesystem/Linux_BSP/buildroot_openlinux_kernel_4.9_fbdev_20180706.tar.gz
+ > tar xfz buildroot_openlinux_kernel_4.9_fbdev_20180706.tar.gz buildroot_openlinux_kernel_4.9_fbdev_20180706/bootloader
+ > export BRDIR=$PWD/buildroot_openlinux_kernel_4.9_fbdev_20180706
+ > export FIPDIR=$BRDIR/bootloader/uboot-repo/fip
+
+Go back to mainline U-Boot source tree then :
+ > mkdir fip
+
+ > wget https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/blx_fix_g12a.sh -O fip/blx_fix.sh
+ > cp $UBOOTDIR/build/scp_task/bl301.bin fip/
+ > cp $UBOOTDIR/build/board/amlogic/g12a_u200_v1/firmware/acs.bin fip/
+ > cp $BRDIR/bootloader/uboot-repo/bl2/bin/g12a/bl2.bin fip/
+ > cp $BRDIR/bootloader/uboot-repo/bl30/bin/g12a/bl30.bin fip/
+ > cp $BRDIR/bootloader/uboot-repo/bl31_1.3/bin/g12a/bl31.img fip/
+ > cp $FIPDIR/g12a/ddr3_1d.fw fip/
+ > cp $FIPDIR/g12a/ddr4_1d.fw fip/
+ > cp $FIPDIR/g12a/ddr4_2d.fw fip/
+ > cp $FIPDIR/g12a/diag_lpddr4.fw fip/
+ > cp $FIPDIR/g12a/lpddr4_1d.fw fip/
+ > cp $FIPDIR/g12a/lpddr4_2d.fw fip/
+ > cp $FIPDIR/g12a/piei.fw fip/
+ > cp u-boot.bin fip/bl33.bin
+
+ > sh fip/blx_fix.sh \
+       fip/bl30.bin \
+       fip/zero_tmp \
+       fip/bl30_zero.bin \
+       fip/bl301.bin \
+       fip/bl301_zero.bin \
+       fip/bl30_new.bin \
+       bl30
+
+ > sh fip/blx_fix.sh \
+       fip/bl2.bin \
+       fip/zero_tmp \
+       fip/bl2_zero.bin \
+       fip/acs.bin \
+       fip/bl21_zero.bin \
+       fip/bl2_new.bin \
+       bl2
+
+ > $FIPDIR/g12a/aml_encrypt_g12a --bl30sig --input fip/bl30_new.bin \
+                                       --output fip/bl30_new.bin.g12a.enc \
+                                       --level v3
+ > $FIPDIR/g12a/aml_encrypt_g12a --bl3sig --input fip/bl30_new.bin.g12a.enc \
+                                       --output fip/bl30_new.bin.enc \
+                                       --level v3 --type bl30
+ > $FIPDIR/g12a/aml_encrypt_g12a --bl3sig --input fip/bl31.img \
+                                       --output fip/bl31.img.enc \
+                                       --level v3 --type bl31
+ > $FIPDIR/g12a/aml_encrypt_g12a --bl3sig --input fip/bl33.bin --compress lz4 \
+                                       --output fip/bl33.bin.enc \
+                                       --level v3 --type bl33
+ > $FIPDIR/g12a/aml_encrypt_g12a --bl2sig --input fip/bl2_new.bin \
+                                       --output fip/bl2.n.bin.sig
+ > $FIPDIR/g12a/aml_encrypt_g12a --bootmk \
+               --output fip/u-boot.bin \
+               --bl2 fip/bl2.n.bin.sig \
+               --bl30 fip/bl30_new.bin.enc \
+               --bl31 fip/bl31.img.enc \
+               --bl33 fip/bl33.bin.enc \
+               --ddrfw1 fip/ddr4_1d.fw \
+               --ddrfw2 fip/ddr4_2d.fw \
+               --ddrfw3 fip/ddr3_1d.fw \
+               --ddrfw4 fip/piei.fw \
+               --ddrfw5 fip/lpddr4_1d.fw \
+               --ddrfw6 fip/lpddr4_2d.fw \
+               --ddrfw7 fip/diag_lpddr4.fw \
+               --level v3
+
+and then write the image to SD with:
+
+ > DEV=/dev/your_sd_device
+ > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
+ > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
diff --git a/board/amlogic/u200/u200.c b/board/amlogic/u200/u200.c
new file mode 100644 (file)
index 0000000..94ee3ce
--- /dev/null
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2016 BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <environment.h>
+#include <asm/io.h>
+#include <asm/arch/axg.h>
+#include <asm/arch/sm.h>
+#include <asm/arch/eth.h>
+#include <asm/arch/mem.h>
+
+int misc_init_r(void)
+{
+       meson_eth_init(PHY_INTERFACE_MODE_RMII,
+                      MESON_USE_INTERNAL_RMII_PHY);
+
+       return 0;
+}
index 9b0940429431cbe3d7a5ba12c82fbb45cd354352..48c1e2b9e7b88d9b7055302d3c8c8975df594111 100644 (file)
@@ -392,6 +392,49 @@ state_setprop() which does this automatically and avoids running out of
 space. See existing code for examples.
 
 
+Debugging the init sequence
+---------------------------
+
+If you get a failure in the initcall sequence, like this:
+
+   initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)
+
+Then you use can use grep to see which init call failed, e.g.:
+
+   $ grep 0000000000048134 u-boot.map
+   stdio_add_devices
+
+Of course another option is to run it with a debugger such as gdb:
+
+   $ gdb u-boot
+   ...
+   (gdb) br initcall.h:41
+   Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)
+
+Note that two locations are reported, since this function is used in both
+board_init_f() and board_init_r().
+
+   (gdb) r
+   Starting program: /tmp/b/sandbox/u-boot
+   [Thread debugging using libthread_db enabled]
+   Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
+
+   U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)
+
+   DRAM:  128 MiB
+   MMC:
+
+   Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
+       at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
+   41                              printf("initcall sequence %p failed at call %p (err=%d)\n",
+   (gdb) print *init_fnc_ptr
+   $1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
+   (gdb)
+
+
+This approach can be used on normal boards as well as sandbox.
+
+
 Testing
 -------
 
@@ -434,6 +477,9 @@ that are mapped into that memory:
       0   CONFIG_SYS_FDT_LOAD_ADDR   Device tree
    e000   CONFIG_BLOBLIST_ADDR       Blob list
   10000   CONFIG_MALLOC_F_ADDR       Early memory allocation
+  f0000   CONFIG_PRE_CON_BUF_ADDR    Pre-console buffer
+ 100000   CONFIG_TRACE_EARLY_ADDR    Early trace buffer (if enabled)
+=
 
 
 --
index 397e7561d4d9a39ee0ad90b5331e2b723f7b702d..9ca1eca027add38ef3a41676d351c7edd739cad6 100644 (file)
@@ -31,7 +31,7 @@ void flush_cache(unsigned long start, unsigned long size)
 /* system timer offset in ms */
 static unsigned long sandbox_timer_offset;
 
-void sandbox_timer_add_offset(unsigned long offset)
+void timer_test_add_offset(unsigned long offset)
 {
        sandbox_timer_offset += offset;
 }
index 7c9b1ad82aa14a01df24a50366f113ab81aea686..e89ed2153bc3894148760da5d1f688dbf1489443 100644 (file)
@@ -7,6 +7,8 @@
 #include <common.h>
 #include <dm.h>
 #include <lcd.h>
+#include <miiphy.h>
+#include <phy_interface.h>
 #include <ram.h>
 #include <spl.h>
 #include <splash.h>
@@ -123,8 +125,25 @@ int board_init(void)
        gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100;
 
 #ifdef CONFIG_ETH_DESIGNWARE
-       /* Set >RMII mode */
-       STM32_SYSCFG->pmc |= SYSCFG_PMC_MII_RMII_SEL;
+       const char *phy_mode;
+       int node;
+
+       node = fdt_node_offset_by_compatible(gd->fdt_blob, 0, "st,stm32-dwmac");
+       if (node < 0)
+               return -1;
+
+       phy_mode = fdt_getprop(gd->fdt_blob, node, "phy-mode", NULL);
+
+       switch (phy_get_interface_by_name(phy_mode)) {
+       case PHY_INTERFACE_MODE_RMII:
+               STM32_SYSCFG->pmc |= SYSCFG_PMC_MII_RMII_SEL;
+               break;
+       case PHY_INTERFACE_MODE_MII:
+               STM32_SYSCFG->pmc &= ~SYSCFG_PMC_MII_RMII_SEL;
+               break;
+       default:
+               printf("PHY interface %s not supported !\n", phy_mode);
+       }
 #endif
 
 #if defined(CONFIG_CMD_BMP)
index 31ca7a2d0243e01655cb02680d4dd11df28f85c2..069e0ea7300bb0010b5b6e41e9163150c480e3fd 100644 (file)
@@ -53,6 +53,17 @@ config SYS_PROMPT
          This string is displayed in the command line to the left of the
          cursor.
 
+config SYS_XTRACE
+       string "Command execution tracer"
+       depends on CMDLINE
+       default y if CMDLINE
+       help
+         This option enables the possiblity to print all commands before
+         executing them and after all variables are evaluated (similar
+         to Bash's xtrace/'set -x' feature).
+         To enable the tracer a variable "xtrace" needs to be defined in
+         the environment.
+
 menu "Autoboot options"
 
 config AUTOBOOT
@@ -1899,7 +1910,7 @@ config CMD_TRACE
          Enables a command to control using of function tracing within
          U-Boot. This allows recording of call traces including timing
          information. The command can write data to memory for exporting
-         for analsys (e.g. using bootchart). See doc/README.trace for full
+         for analysis (e.g. using bootchart). See doc/README.trace for full
          details.
 
 config CMD_AVB
index 15ee4af45667d566c4aed23d3a56759f46571842..efaa548be4d84dd41bf7f4ee3ef78baf03e66ca3 100644 (file)
@@ -39,31 +39,53 @@ void __weak allow_unaligned(void)
 /*
  * Set the load options of an image from an environment variable.
  *
- * @loaded_image_info: the image
- * @env_var:           name of the environment variable
+ * @handle:    the image handle
+ * @env_var:   name of the environment variable
+ * Return:     status code
  */
-static void set_load_options(struct efi_loaded_image *loaded_image_info,
-                            const char *env_var)
+static efi_status_t set_load_options(efi_handle_t handle, const char *env_var)
 {
+       struct efi_loaded_image *loaded_image_info;
        size_t size;
        const char *env = env_get(env_var);
        u16 *pos;
+       efi_status_t ret;
+
+       ret = EFI_CALL(systab.boottime->open_protocol(
+                                       handle,
+                                       &efi_guid_loaded_image,
+                                       (void **)&loaded_image_info,
+                                       efi_root, NULL,
+                                       EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL));
+       if (ret != EFI_SUCCESS)
+               return EFI_INVALID_PARAMETER;
 
        loaded_image_info->load_options = NULL;
        loaded_image_info->load_options_size = 0;
        if (!env)
-               return;
+               goto out;
+
        size = utf8_utf16_strlen(env) + 1;
        loaded_image_info->load_options = calloc(size, sizeof(u16));
        if (!loaded_image_info->load_options) {
                printf("ERROR: Out of memory\n");
-               return;
+               EFI_CALL(systab.boottime->close_protocol(handle,
+                                                        &efi_guid_loaded_image,
+                                                        efi_root, NULL));
+               return EFI_OUT_OF_RESOURCES;
        }
        pos = loaded_image_info->load_options;
        utf8_utf16_strcpy(&pos, env);
        loaded_image_info->load_options_size = size * 2;
+
+out:
+       return EFI_CALL(systab.boottime->close_protocol(handle,
+                                                       &efi_guid_loaded_image,
+                                                       efi_root, NULL));
 }
 
+#if !CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE)
+
 /**
  * copy_fdt() - Copy the device tree to a new location available to EFI
  *
@@ -165,156 +187,327 @@ static void efi_carve_out_dt_rsv(void *fdt)
        }
 }
 
-static efi_status_t efi_install_fdt(ulong fdt_addr)
+/**
+ * get_config_table() - get configuration table
+ *
+ * @guid:      GUID of the configuration table
+ * Return:     pointer to configuration table or NULL
+ */
+static void *get_config_table(const efi_guid_t *guid)
+{
+       size_t i;
+
+       for (i = 0; i < systab.nr_tables; i++) {
+               if (!guidcmp(guid, &systab.tables[i].guid))
+                       return systab.tables[i].table;
+       }
+       return NULL;
+}
+
+#endif /* !CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE) */
+
+/**
+ * efi_install_fdt() - install fdt passed by a command argument
+ * @fdt_opt:   pointer to argument
+ * Return:     status code
+ *
+ * If specified, fdt will be installed as configuration table,
+ * otherwise no fdt will be passed.
+ */
+static efi_status_t efi_install_fdt(const char *fdt_opt)
 {
+       /*
+        * The EBBR spec requires that we have either an FDT or an ACPI table
+        * but not both.
+        */
+#if CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE)
+       if (fdt_opt) {
+               printf("ERROR: can't have ACPI table and device tree.\n");
+               return EFI_LOAD_ERROR;
+       }
+#else
+       unsigned long fdt_addr;
+       void *fdt;
        bootm_headers_t img = { 0 };
        efi_status_t ret;
-       void *fdt;
 
+       if (fdt_opt) {
+               fdt_addr = simple_strtoul(fdt_opt, NULL, 16);
+               if (!fdt_addr)
+                       return EFI_INVALID_PARAMETER;
+       } else {
+               /* Look for device tree that is already installed */
+               if (get_config_table(&efi_guid_fdt))
+                       return EFI_SUCCESS;
+               /* Use our own device tree as default */
+               fdt_opt = env_get("fdtcontroladdr");
+               if (!fdt_opt) {
+                       printf("ERROR: need device tree\n");
+                       return EFI_NOT_FOUND;
+               }
+               fdt_addr = simple_strtoul(fdt_opt, NULL, 16);
+               if (!fdt_addr) {
+                       printf("ERROR: invalid $fdtcontroladdr\n");
+                       return EFI_LOAD_ERROR;
+               }
+       }
+
+       /* Install device tree */
        fdt = map_sysmem(fdt_addr, 0);
        if (fdt_check_header(fdt)) {
                printf("ERROR: invalid device tree\n");
-               return EFI_INVALID_PARAMETER;
+               return EFI_LOAD_ERROR;
        }
 
-       /* Create memory reservation as indicated by the device tree */
+       /* Create memory reservations as indicated by the device tree */
        efi_carve_out_dt_rsv(fdt);
 
-       /* Prepare fdt for payload */
+       /* Prepare device tree for payload */
        ret = copy_fdt(&fdt);
-       if (ret)
-               return ret;
+       if (ret) {
+               printf("ERROR: out of memory\n");
+               return EFI_OUT_OF_RESOURCES;
+       }
 
        if (image_setup_libfdt(&img, fdt, 0, NULL)) {
                printf("ERROR: failed to process device tree\n");
                return EFI_LOAD_ERROR;
        }
 
-       /* Link to it in the efi tables */
+       /* Install device tree as UEFI table */
        ret = efi_install_configuration_table(&efi_guid_fdt, fdt);
-       if (ret != EFI_SUCCESS)
-               return EFI_OUT_OF_RESOURCES;
+       if (ret != EFI_SUCCESS) {
+               printf("ERROR: failed to install device tree\n");
+               return ret;
+       }
+#endif /* GENERATE_ACPI_TABLE */
 
-       return ret;
+       return EFI_SUCCESS;
 }
 
-static efi_status_t bootefi_run_prepare(const char *load_options_path,
-               struct efi_device_path *device_path,
-               struct efi_device_path *image_path,
-               struct efi_loaded_image_obj **image_objp,
-               struct efi_loaded_image **loaded_image_infop)
+/**
+ * do_bootefi_exec() - execute EFI binary
+ *
+ * @handle:            handle of loaded image
+ * Return:             status code
+ *
+ * Load the EFI binary into a newly assigned memory unwinding the relocation
+ * information, install the loaded image protocol, and call the binary.
+ */
+static efi_status_t do_bootefi_exec(efi_handle_t handle)
 {
        efi_status_t ret;
 
-       ret = efi_setup_loaded_image(device_path, image_path, image_objp,
-                                    loaded_image_infop);
+       /* Transfer environment variable as load options */
+       ret = set_load_options(handle, "bootargs");
        if (ret != EFI_SUCCESS)
                return ret;
 
-       /* Transfer environment variable as load options */
-       set_load_options(*loaded_image_infop, load_options_path);
+       /* we don't support much: */
+       env_set("efi_8be4df61-93ca-11d2-aa0d-00e098032b8c_OsIndicationsSupported",
+               "{ro,boot}(blob)0000000000000000");
+
+       /* Call our payload! */
+       ret = EFI_CALL(efi_start_image(handle, NULL, NULL));
 
-       return 0;
+       efi_restore_gd();
+
+       /*
+        * FIXME: Who is responsible for
+        *      free(loaded_image_info->load_options);
+        * Once efi_exit() is implemented correctly,
+        * handle itself doesn't exist here.
+        */
+
+       return ret;
 }
 
 /**
- * bootefi_run_finish() - finish up after running an EFI test
+ * do_efibootmgr() - execute EFI Boot Manager
  *
- * @loaded_image_info: Pointer to a struct which holds the loaded image info
- * @image_objj: Pointer to a struct which holds the loaded image object
+ * @fdt_opt:   string of fdt start address
+ * Return:     status code
+ *
+ * Execute EFI Boot Manager
  */
-static void bootefi_run_finish(struct efi_loaded_image_obj *image_obj,
-                              struct efi_loaded_image *loaded_image_info)
+static int do_efibootmgr(const char *fdt_opt)
 {
-       efi_restore_gd();
-       free(loaded_image_info->load_options);
-       efi_delete_handle(&image_obj->header);
+       efi_handle_t handle;
+       efi_status_t ret;
+
+       /* Allow unaligned memory access */
+       allow_unaligned();
+
+       switch_to_non_secure_mode();
+
+       /* Initialize EFI drivers */
+       ret = efi_init_obj_list();
+       if (ret != EFI_SUCCESS) {
+               printf("Error: Cannot initialize UEFI sub-system, r = %lu\n",
+                      ret & ~EFI_ERROR_MASK);
+               return CMD_RET_FAILURE;
+       }
+
+       ret = efi_install_fdt(fdt_opt);
+       if (ret == EFI_INVALID_PARAMETER)
+               return CMD_RET_USAGE;
+       else if (ret != EFI_SUCCESS)
+               return CMD_RET_FAILURE;
+
+       ret = efi_bootmgr_load(&handle);
+       if (ret != EFI_SUCCESS) {
+               printf("EFI boot manager: Cannot load any image\n");
+               return CMD_RET_FAILURE;
+       }
+
+       ret = do_bootefi_exec(handle);
+       printf("## Application terminated, r = %lu\n", ret & ~EFI_ERROR_MASK);
+
+       if (ret != EFI_SUCCESS)
+               return CMD_RET_FAILURE;
+
+       return CMD_RET_SUCCESS;
 }
 
-/**
- * do_bootefi_exec() - execute EFI binary
+/*
+ * do_bootefi_image() - execute EFI binary from command line
  *
- * @efi:               address of the binary
- * @device_path:       path of the device from which the binary was loaded
- * @image_path:                device path of the binary
- * Return:             status code
+ * @image_opt: string of image start address
+ * @fdt_opt:   string of fdt start address
+ * Return:     status code
  *
- * Load the EFI binary into a newly assigned memory unwinding the relocation
- * information, install the loaded image protocol, and call the binary.
+ * Set up memory image for the binary to be loaded, prepare
+ * device path and then call do_bootefi_exec() to execute it.
  */
-static efi_status_t do_bootefi_exec(void *efi,
-                                   struct efi_device_path *device_path,
-                                   struct efi_device_path *image_path)
+static int do_bootefi_image(const char *image_opt, const char *fdt_opt)
 {
-       efi_handle_t mem_handle = NULL;
-       struct efi_device_path *memdp = NULL;
+       void *image_buf;
+       struct efi_device_path *device_path, *image_path;
+       struct efi_device_path *file_path = NULL;
+       unsigned long addr, size;
+       const char *size_str;
+       efi_handle_t mem_handle = NULL, handle;
        efi_status_t ret;
-       struct efi_loaded_image_obj *image_obj = NULL;
-       struct efi_loaded_image *loaded_image_info = NULL;
 
-       /*
-        * Special case for efi payload not loaded from disk, such as
-        * 'bootefi hello' or for example payload loaded directly into
-        * memory via JTAG, etc:
-        */
+       /* Allow unaligned memory access */
+       allow_unaligned();
+
+       switch_to_non_secure_mode();
+
+       /* Initialize EFI drivers */
+       ret = efi_init_obj_list();
+       if (ret != EFI_SUCCESS) {
+               printf("Error: Cannot initialize UEFI sub-system, r = %lu\n",
+                      ret & ~EFI_ERROR_MASK);
+               return CMD_RET_FAILURE;
+       }
+
+       ret = efi_install_fdt(fdt_opt);
+       if (ret == EFI_INVALID_PARAMETER)
+               return CMD_RET_USAGE;
+       else if (ret != EFI_SUCCESS)
+               return CMD_RET_FAILURE;
+
+#ifdef CONFIG_CMD_BOOTEFI_HELLO
+       if (!strcmp(image_opt, "hello")) {
+               char *saddr;
+
+               saddr = env_get("loadaddr");
+               size = __efi_helloworld_end - __efi_helloworld_begin;
+
+               if (saddr)
+                       addr = simple_strtoul(saddr, NULL, 16);
+               else
+                       addr = CONFIG_SYS_LOAD_ADDR;
+
+               image_buf = map_sysmem(addr, size);
+               memcpy(image_buf, __efi_helloworld_begin, size);
+
+               device_path = NULL;
+               image_path = NULL;
+       } else
+#endif
+       {
+               size_str = env_get("filesize");
+               if (size_str)
+                       size = simple_strtoul(size_str, NULL, 16);
+               else
+                       size = 0;
+
+               addr = simple_strtoul(image_opt, NULL, 16);
+               /* Check that a numeric value was passed */
+               if (!addr && *image_opt != '0')
+                       return CMD_RET_USAGE;
+
+               image_buf = map_sysmem(addr, size);
+
+               device_path = bootefi_device_path;
+               image_path = bootefi_image_path;
+       }
+
        if (!device_path && !image_path) {
-               printf("WARNING: using memory device/image path, this may confuse some payloads!\n");
-               /* actual addresses filled in after efi_load_pe() */
-               memdp = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE, 0, 0);
-               device_path = image_path = memdp;
                /*
-                * Grub expects that the device path of the loaded image is
-                * installed on a handle.
+                * Special case for efi payload not loaded from disk,
+                * such as 'bootefi hello' or for example payload
+                * loaded directly into memory via JTAG, etc:
+                */
+               file_path = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE,
+                                           (uintptr_t)image_buf, size);
+               /*
+                * Make sure that device for device_path exist
+                * in load_image(). Otherwise, shell and grub will fail.
                 */
                ret = efi_create_handle(&mem_handle);
                if (ret != EFI_SUCCESS)
-                       return ret; /* TODO: leaks device_path */
+                       goto out;
+
                ret = efi_add_protocol(mem_handle, &efi_guid_device_path,
-                                      device_path);
+                                      file_path);
                if (ret != EFI_SUCCESS)
-                       goto err_add_protocol;
+                       goto out;
        } else {
                assert(device_path && image_path);
+               file_path = efi_dp_append(device_path, image_path);
        }
 
-       ret = bootefi_run_prepare("bootargs", device_path, image_path,
-                                 &image_obj, &loaded_image_info);
-       if (ret)
-               goto err_prepare;
-
-       /* Load the EFI payload */
-       ret = efi_load_pe(image_obj, efi, loaded_image_info);
+       ret = EFI_CALL(efi_load_image(false, efi_root,
+                                     file_path, image_buf, size, &handle));
        if (ret != EFI_SUCCESS)
-               goto err_prepare;
-
-       if (memdp) {
-               struct efi_device_path_memory *mdp = (void *)memdp;
-               mdp->memory_type = loaded_image_info->image_code_type;
-               mdp->start_address = (uintptr_t)loaded_image_info->image_base;
-               mdp->end_address = mdp->start_address +
-                               loaded_image_info->image_size;
-       }
-
-       /* we don't support much: */
-       env_set("efi_8be4df61-93ca-11d2-aa0d-00e098032b8c_OsIndicationsSupported",
-               "{ro,boot}(blob)0000000000000000");
+               goto out;
 
-       /* Call our payload! */
-       debug("%s: Jumping to 0x%p\n", __func__, image_obj->entry);
-       ret = EFI_CALL(efi_start_image(&image_obj->header, NULL, NULL));
+       ret = do_bootefi_exec(handle);
+       printf("## Application terminated, r = %lu\n", ret & ~EFI_ERROR_MASK);
 
-err_prepare:
-       /* image has returned, loaded-image obj goes *poof*: */
-       bootefi_run_finish(image_obj, loaded_image_info);
-
-err_add_protocol:
+out:
        if (mem_handle)
                efi_delete_handle(mem_handle);
+       if (file_path)
+               efi_free_pool(file_path);
 
-       return ret;
+       if (ret != EFI_SUCCESS)
+               return CMD_RET_FAILURE;
+
+       return CMD_RET_SUCCESS;
 }
 
 #ifdef CONFIG_CMD_BOOTEFI_SELFTEST
+static efi_status_t bootefi_run_prepare(const char *load_options_path,
+               struct efi_device_path *device_path,
+               struct efi_device_path *image_path,
+               struct efi_loaded_image_obj **image_objp,
+               struct efi_loaded_image **loaded_image_infop)
+{
+       efi_status_t ret;
+
+       ret = efi_setup_loaded_image(device_path, image_path, image_objp,
+                                    loaded_image_infop);
+       if (ret != EFI_SUCCESS)
+               return ret;
+
+       /* Transfer environment variable as load options */
+       return set_load_options((efi_handle_t)*image_objp, load_options_path);
+}
+
 /**
  * bootefi_test_prepare() - prepare to run an EFI test
  *
@@ -360,36 +553,33 @@ failure:
        return ret;
 }
 
-#endif /* CONFIG_CMD_BOOTEFI_SELFTEST */
-
-static int do_bootefi_bootmgr_exec(void)
+/**
+ * bootefi_run_finish() - finish up after running an EFI test
+ *
+ * @loaded_image_info: Pointer to a struct which holds the loaded image info
+ * @image_obj: Pointer to a struct which holds the loaded image object
+ */
+static void bootefi_run_finish(struct efi_loaded_image_obj *image_obj,
+                              struct efi_loaded_image *loaded_image_info)
 {
-       struct efi_device_path *device_path, *file_path;
-       void *addr;
-       efi_status_t r;
-
-       addr = efi_bootmgr_load(&device_path, &file_path);
-       if (!addr)
-               return 1;
-
-       printf("## Starting EFI application at %p ...\n", addr);
-       r = do_bootefi_exec(addr, device_path, file_path);
-       printf("## Application terminated, r = %lu\n",
-              r & ~EFI_ERROR_MASK);
-
-       if (r != EFI_SUCCESS)
-               return 1;
-
-       return 0;
+       efi_restore_gd();
+       free(loaded_image_info->load_options);
+       efi_delete_handle(&image_obj->header);
 }
 
-/* Interpreter command to boot an arbitrary EFI image from memory */
-static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+/**
+ * do_efi_selftest() - execute EFI Selftest
+ *
+ * @fdt_opt:   string of fdt start address
+ * Return:     status code
+ *
+ * Execute EFI Selftest
+ */
+static int do_efi_selftest(const char *fdt_opt)
 {
-       unsigned long addr;
-       char *saddr;
-       efi_status_t r;
-       unsigned long fdt_addr;
+       struct efi_loaded_image_obj *image_obj;
+       struct efi_loaded_image *loaded_image_info;
+       efi_status_t ret;
 
        /* Allow unaligned memory access */
        allow_unaligned();
@@ -397,81 +587,46 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        switch_to_non_secure_mode();
 
        /* Initialize EFI drivers */
-       r = efi_init_obj_list();
-       if (r != EFI_SUCCESS) {
-               printf("Error: Cannot set up EFI drivers, r = %lu\n",
-                      r & ~EFI_ERROR_MASK);
+       ret = efi_init_obj_list();
+       if (ret != EFI_SUCCESS) {
+               printf("Error: Cannot initialize UEFI sub-system, r = %lu\n",
+                      ret & ~EFI_ERROR_MASK);
                return CMD_RET_FAILURE;
        }
 
-       if (argc < 2)
+       ret = efi_install_fdt(fdt_opt);
+       if (ret == EFI_INVALID_PARAMETER)
                return CMD_RET_USAGE;
+       else if (ret != EFI_SUCCESS)
+               return CMD_RET_FAILURE;
 
-       if (argc > 2) {
-               fdt_addr = simple_strtoul(argv[2], NULL, 16);
-               if (!fdt_addr && *argv[2] != '0')
-                       return CMD_RET_USAGE;
-               /* Install device tree */
-               r = efi_install_fdt(fdt_addr);
-               if (r != EFI_SUCCESS) {
-                       printf("ERROR: failed to install device tree\n");
-                       return CMD_RET_FAILURE;
-               }
-       } else {
-               /* Remove device tree. EFI_NOT_FOUND can be ignored here */
-               efi_install_configuration_table(&efi_guid_fdt, NULL);
-               printf("WARNING: booting without device tree\n");
-       }
-#ifdef CONFIG_CMD_BOOTEFI_HELLO
-       if (!strcmp(argv[1], "hello")) {
-               ulong size = __efi_helloworld_end - __efi_helloworld_begin;
+       ret = bootefi_test_prepare(&image_obj, &loaded_image_info,
+                                  "\\selftest", "efi_selftest");
+       if (ret != EFI_SUCCESS)
+               return CMD_RET_FAILURE;
 
-               saddr = env_get("loadaddr");
-               if (saddr)
-                       addr = simple_strtoul(saddr, NULL, 16);
-               else
-                       addr = CONFIG_SYS_LOAD_ADDR;
-               memcpy(map_sysmem(addr, size), __efi_helloworld_begin, size);
-       } else
-#endif
-#ifdef CONFIG_CMD_BOOTEFI_SELFTEST
-       if (!strcmp(argv[1], "selftest")) {
-               struct efi_loaded_image_obj *image_obj;
-               struct efi_loaded_image *loaded_image_info;
-
-               r = bootefi_test_prepare(&image_obj, &loaded_image_info,
-                                        "\\selftest", "efi_selftest");
-               if (r != EFI_SUCCESS)
-                       return CMD_RET_FAILURE;
-
-               /* Execute the test */
-               r = EFI_CALL(efi_selftest(&image_obj->header, &systab));
-               bootefi_run_finish(image_obj, loaded_image_info);
-               return r != EFI_SUCCESS;
-       } else
-#endif
-       if (!strcmp(argv[1], "bootmgr")) {
-               return do_bootefi_bootmgr_exec();
-       } else {
-               saddr = argv[1];
+       /* Execute the test */
+       ret = EFI_CALL(efi_selftest(&image_obj->header, &systab));
+       bootefi_run_finish(image_obj, loaded_image_info);
 
-               addr = simple_strtoul(saddr, NULL, 16);
-               /* Check that a numeric value was passed */
-               if (!addr && *saddr != '0')
-                       return CMD_RET_USAGE;
+       return ret != EFI_SUCCESS;
+}
+#endif /* CONFIG_CMD_BOOTEFI_SELFTEST */
 
-       }
+/* Interpreter command to boot an arbitrary EFI image from memory */
+static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+       if (argc < 2)
+               return CMD_RET_USAGE;
 
-       printf("## Starting EFI application at %08lx ...\n", addr);
-       r = do_bootefi_exec(map_sysmem(addr, 0), bootefi_device_path,
-                           bootefi_image_path);
-       printf("## Application terminated, r = %lu\n",
-              r & ~EFI_ERROR_MASK);
+       if (!strcmp(argv[1], "bootmgr"))
+               return do_efibootmgr(argc > 2 ? argv[2] : NULL);
+#ifdef CONFIG_CMD_BOOTEFI_SELFTEST
+       else if (!strcmp(argv[1], "selftest"))
+               return do_efi_selftest(argc > 2 ? argv[2] : NULL);
+#endif
 
-       if (r != EFI_SUCCESS)
-               return 1;
-       else
-               return 0;
+       return do_bootefi_image(argv[1], argc > 2 ? argv[2] : NULL);
 }
 
 #ifdef CONFIG_SYS_LONGHELP
@@ -490,7 +645,7 @@ static char bootefi_help_text[] =
        "    Use environment variable efi_selftest to select a single test.\n"
        "    Use 'setenv efi_selftest list' to enumerate all tests.\n"
 #endif
-       "bootefi bootmgr [fdt addr]\n"
+       "bootefi bootmgr [fdt address]\n"
        "  - load and boot EFI payload based on BootOrder/BootXXXX variables.\n"
        "\n"
        "    If specified, the device tree located at <fdt address> gets\n"
@@ -515,6 +670,13 @@ void efi_set_bootdev(const char *dev, const char *devnr, const char *path)
        ret = efi_dp_from_name(dev, devnr, path, &device, &image);
        if (ret == EFI_SUCCESS) {
                bootefi_device_path = device;
+               if (image) {
+                       /* FIXME: image should not contain device */
+                       struct efi_device_path *image_tmp = image;
+
+                       efi_dp_split_file_path(image, &device, &image);
+                       efi_free_pool(image_tmp);
+               }
                bootefi_image_path = image;
        } else {
                bootefi_device_path = NULL;
index db96682c5a4ca9e0416643b83396aa88d13074a8..a40c4f4be286ba49142719a00cae482e22006e33 100644 (file)
@@ -185,7 +185,7 @@ static const struct {
 } guid_list[] = {
        {
                "Device Path",
-               DEVICE_PATH_GUID,
+               EFI_DEVICE_PATH_PROTOCOL_GUID,
        },
        {
                "Device Path To Text",
@@ -217,7 +217,7 @@ static const struct {
        },
        {
                "Block IO",
-               BLOCK_IO_GUID,
+               EFI_BLOCK_IO_PROTOCOL_GUID,
        },
        {
                "Simple File System",
@@ -225,11 +225,31 @@ static const struct {
        },
        {
                "Loaded Image",
-               LOADED_IMAGE_PROTOCOL_GUID,
+               EFI_LOADED_IMAGE_PROTOCOL_GUID,
        },
        {
-               "GOP",
-               EFI_GOP_GUID,
+               "Graphics Output",
+               EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID,
+       },
+       {
+               "HII String",
+               EFI_HII_STRING_PROTOCOL_GUID,
+       },
+       {
+               "HII Database",
+               EFI_HII_DATABASE_PROTOCOL_GUID,
+       },
+       {
+               "HII Config Routing",
+               EFI_HII_CONFIG_ROUTING_PROTOCOL_GUID,
+       },
+       {
+               "Simple Network",
+               EFI_SIMPLE_NETWORK_PROTOCOL_GUID,
+       },
+       {
+               "PXE Base Code",
+               EFI_PXE_BASE_CODE_PROTOCOL_GUID,
        },
 };
 
index 149a7229e8fa982d53ce003c67ddb2db7d45e2e1..7ef20f204231335088c0c8ec7f191987d7416b09 100644 (file)
@@ -714,7 +714,7 @@ static int setup_reloc(void)
         * just after the default vector table location, so at 0x400
         */
        gd->reloc_off = gd->relocaddr - (CONFIG_SYS_TEXT_BASE + 0x400);
-#else
+#elif !defined(CONFIG_SANDBOX)
        gd->reloc_off = gd->relocaddr - CONFIG_SYS_TEXT_BASE;
 #endif
 #endif
index 9793b85d4e42d481e677639e8aa8210391379efd..56ef91ad85995dde2addef0be43694e4ed3813f6 100644 (file)
@@ -99,6 +99,13 @@ ulong bootstage_add_record(enum bootstage_id id, const char *name,
        struct bootstage_data *data = gd->bootstage;
        struct bootstage_record *rec;
 
+       /*
+        * initf_bootstage() is called very early during boot but since hang()
+        * calls bootstage_error() we can be called before bootstage is set up.
+        * Add a check to avoid this.
+        */
+       if (!data)
+               return mark;
        if (flags & BOOTSTAGEF_ALLOC)
                id = data->next_id++;
 
index e14d1fa1d6b4c4425f9c5b74e65ada06a67524b5..e192bb2a619ec5dffe46f4bb0dee7275f8faf35c 100644 (file)
@@ -574,6 +574,20 @@ enum command_ret_t cmd_process(int flag, int argc, char * const argv[],
        enum command_ret_t rc = CMD_RET_SUCCESS;
        cmd_tbl_t *cmdtp;
 
+#if defined(CONFIG_SYS_XTRACE)
+       char *xtrace;
+
+       xtrace = env_get("xtrace");
+       if (xtrace) {
+               puts("+");
+               for (int i = 0; i < argc; i++) {
+                       puts(" ");
+                       puts(argv[i]);
+               }
+               puts("\n");
+       }
+#endif
+
        /* Look up command in command table */
        cmdtp = find_cmd(argv[0]);
        if (cmdtp == NULL) {
index 9ed00b7d5bfb9e47db3dbafbf5d1989b32c15bf6..eb552ca207ca03904068e6172f78931d9de42dc3 100644 (file)
@@ -279,7 +279,6 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
        int             fdt_noffset;
 #endif
        const char *select = NULL;
-       int             ok_no_fdt = 0;
 
        *of_flat_tree = NULL;
        *of_size = 0;
@@ -462,17 +461,24 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
                struct andr_img_hdr *hdr = buf;
                ulong fdt_data, fdt_len;
 
-               if (android_image_get_second(hdr, &fdt_data, &fdt_len) != 0)
-                       goto no_fdt;
+               if (!android_image_get_second(hdr, &fdt_data, &fdt_len) &&
+                   !fdt_check_header((char *)fdt_data)) {
+                       fdt_blob = (char *)fdt_data;
+                       if (fdt_totalsize(fdt_blob) != fdt_len)
+                               goto error;
 
-               fdt_blob = (char *)fdt_data;
-               if (fdt_check_header(fdt_blob) != 0)
-                       goto no_fdt;
+                       debug("## Using FDT in Android image second area\n");
+               } else {
+                       fdt_addr = env_get_hex("fdtaddr", 0);
+                       if (!fdt_addr)
+                               goto no_fdt;
 
-               if (fdt_totalsize(fdt_blob) != fdt_len)
-                       goto error;
+                       fdt_blob = map_sysmem(fdt_addr, 0);
+                       if (fdt_check_header(fdt_blob))
+                               goto no_fdt;
 
-               debug("## Using FDT found in Android image second area\n");
+                       debug("## Using FDT at ${fdtaddr}=Ox%lx\n", fdt_addr);
+               }
 #endif
        } else {
                debug("## No Flattened Device Tree\n");
@@ -487,14 +493,9 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
        return 0;
 
 no_fdt:
-       ok_no_fdt = 1;
+       debug("Continuing to boot without FDT\n");
+       return 0;
 error:
-       *of_flat_tree = NULL;
-       *of_size = 0;
-       if (!select && ok_no_fdt) {
-               debug("Continuing to boot without FDT\n");
-               return 0;
-       }
        return 1;
 }
 
index 080dd19590e34596bcb53eec762fe9e31274df09..d2d2967a8fdbb8263d4cee88297a3c2ddddbfe11 100644 (file)
@@ -11,7 +11,7 @@ CONFIG_OF_BOARD_SETUP=y
 CONFIG_CONSOLE_MUX=y
 CONFIG_MISC_INIT_R=y
 # CONFIG_DISPLAY_CPUINFO is not set
-# CONFIG_DISPLAY_BOARDINFO is not set
+CONFIG_DISPLAY_BOARDINFO=y
 # CONFIG_CMD_BDI is not set
 # CONFIG_CMD_IMI is not set
 CONFIG_CMD_ADC=y
@@ -31,6 +31,7 @@ CONFIG_MMC_MESON_GX=y
 CONFIG_MTD=y
 CONFIG_DM_ETH=y
 CONFIG_ETH_DESIGNWARE=y
+CONFIG_PHY_REALTEK=y
 CONFIG_PHY=y
 CONFIG_MESON_GXL_USB_PHY=y
 CONFIG_PINCTRL=y
index 6f1ad0e573b42115dd2b4f2035b6504d159b2f45..aeec2bece53e66145d8a520966fc7ab9e82a5ea7 100644 (file)
@@ -11,7 +11,7 @@ CONFIG_OF_BOARD_SETUP=y
 CONFIG_CONSOLE_MUX=y
 CONFIG_MISC_INIT_R=y
 # CONFIG_DISPLAY_CPUINFO is not set
-# CONFIG_DISPLAY_BOARDINFO is not set
+CONFIG_DISPLAY_BOARDINFO=y
 # CONFIG_CMD_BDI is not set
 # CONFIG_CMD_IMI is not set
 CONFIG_CMD_ADC=y
diff --git a/configs/libretech-ac_defconfig b/configs/libretech-ac_defconfig
new file mode 100644 (file)
index 0000000..2cdfcf4
--- /dev/null
@@ -0,0 +1,74 @@
+CONFIG_ARM=y
+CONFIG_SYS_CONFIG_NAME="libretech-ac"
+CONFIG_ARCH_MESON=y
+CONFIG_SYS_TEXT_BASE=0x01000000
+CONFIG_MESON_GXL=y
+CONFIG_DEBUG_UART_BASE=0xc81004c0
+CONFIG_DEBUG_UART_CLOCK=24000000
+CONFIG_IDENT_STRING=" libretech-ac"
+CONFIG_DEBUG_UART=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_OF_BOARD_SETUP=y
+CONFIG_MISC_INIT_R=y
+# CONFIG_DISPLAY_CPUINFO is not set
+# CONFIG_DISPLAY_BOARDINFO is not set
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_IMI is not set
+CONFIG_CMD_ADC=y
+CONFIG_CMD_GPIO=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_SF=y
+CONFIG_CMD_SF_TEST=y
+CONFIG_CMD_SPI=y
+CONFIG_CMD_USB=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_REGULATOR=y
+CONFIG_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="meson-gxl-s805x-libretech-ac"
+CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_SARADC_MESON=y
+CONFIG_DM_GPIO=y
+CONFIG_DM_MMC=y
+CONFIG_MMC_MESON_GX=y
+CONFIG_MTD=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_GIGADEVICE=y
+CONFIG_SPI_FLASH_SPANSION=y
+CONFIG_PHY_ADDR_ENABLE=y
+CONFIG_PHY_ADDR=8
+CONFIG_PHY_MESON_GXL=y
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_PHY=y
+CONFIG_MESON_GXL_USB_PHY=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_MESON_GXL=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_MESON_GX_VPU_POWER_DOMAIN=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_MESON=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_MESON_SPIFC=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_XHCI_DWC3_OF_SIMPLE=y
+CONFIG_USB_DWC3=y
+CONFIG_USB_KEYBOARD=y
+CONFIG_USB_STORAGE=y
+CONFIG_CONSOLE_MUX=y
+CONFIG_SYS_CONSOLE_IS_IN_ENV=y
+CONFIG_DM_VIDEO=y
+CONFIG_SYS_WHITE_ON_BLACK=y
+CONFIG_VIDEO_MESON=y
+CONFIG_VIDEO_DT_SIMPLEFB=y
+CONFIG_OF_LIBFDT_OVERLAY=y
index d28c7ab45ec820b55653f516d9659c102d55b6e9..a1b9fd91e388e678d4ae4c868638e9b72e6c5ad9 100644 (file)
@@ -10,7 +10,7 @@ CONFIG_NR_DRAM_BANKS=1
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_MISC_INIT_R=y
 # CONFIG_DISPLAY_CPUINFO is not set
-# CONFIG_DISPLAY_BOARDINFO is not set
+CONFIG_DISPLAY_BOARDINFO=y
 # CONFIG_CMD_BDI is not set
 # CONFIG_CMD_IMI is not set
 CONFIG_CMD_ADC=y
index 8bbf48f41f7dd922fbe0c410a75be5b7c2c0fabb..3e7979973b6a7261dd4f59d4618245b8331b12e9 100644 (file)
@@ -9,7 +9,7 @@ CONFIG_NR_DRAM_BANKS=1
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_MISC_INIT_R=y
 # CONFIG_DISPLAY_CPUINFO is not set
-# CONFIG_DISPLAY_BOARDINFO is not set
+CONFIG_DISPLAY_BOARDINFO=y
 # CONFIG_CMD_BDI is not set
 # CONFIG_CMD_IMI is not set
 CONFIG_CMD_GPIO=y
@@ -28,6 +28,7 @@ CONFIG_DM_MMC=y
 CONFIG_MMC_MESON_GX=y
 CONFIG_DM_ETH=y
 CONFIG_ETH_DESIGNWARE=y
+CONFIG_PHY_REALTEK=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_MESON_GXBB=y
 CONFIG_DM_REGULATOR=y
index 747da184b3adb6c1dcdcdb5dee539ddd1c7bccfc..66e59e5e27154103ca7e962bc7e59683443dccbc 100644 (file)
@@ -10,7 +10,7 @@ CONFIG_OF_BOARD_SETUP=y
 CONFIG_CONSOLE_MUX=y
 CONFIG_MISC_INIT_R=y
 # CONFIG_DISPLAY_CPUINFO is not set
-# CONFIG_DISPLAY_BOARDINFO is not set
+CONFIG_DISPLAY_BOARDINFO=y
 # CONFIG_CMD_BDI is not set
 # CONFIG_CMD_IMI is not set
 CONFIG_CMD_GPIO=y
@@ -29,6 +29,7 @@ CONFIG_DM_MMC=y
 CONFIG_MMC_MESON_GX=y
 CONFIG_DM_ETH=y
 CONFIG_ETH_DESIGNWARE=y
+CONFIG_PHY_REALTEK=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_MESON_GXBB=y
 CONFIG_DM_REGULATOR=y
diff --git a/configs/p200_defconfig b/configs/p200_defconfig
new file mode 100644 (file)
index 0000000..12f3415
--- /dev/null
@@ -0,0 +1,41 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MESON=y
+CONFIG_SYS_TEXT_BASE=0x01000000
+CONFIG_DEBUG_UART_BASE=0xc81004c0
+CONFIG_DEBUG_UART_CLOCK=24000000
+CONFIG_IDENT_STRING=" p200"
+CONFIG_DEBUG_UART=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_OF_BOARD_SETUP=y
+CONFIG_MISC_INIT_R=y
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_DISPLAY_BOARDINFO=y
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_IMI is not set
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_I2C=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_REGULATOR=y
+CONFIG_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-p200"
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_DM_GPIO=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_MESON=y
+CONFIG_DM_MMC=y
+CONFIG_MMC_MESON_GX=y
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_MESON_GXBB=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_MESON=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
+CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_SYS_BOARD="p200"
diff --git a/configs/p201_defconfig b/configs/p201_defconfig
new file mode 100644 (file)
index 0000000..6e0b2ec
--- /dev/null
@@ -0,0 +1,41 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MESON=y
+CONFIG_SYS_TEXT_BASE=0x01000000
+CONFIG_DEBUG_UART_BASE=0xc81004c0
+CONFIG_DEBUG_UART_CLOCK=24000000
+CONFIG_IDENT_STRING=" p201"
+CONFIG_DEBUG_UART=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_OF_BOARD_SETUP=y
+CONFIG_MISC_INIT_R=y
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_DISPLAY_BOARDINFO=y
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_IMI is not set
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_I2C=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_REGULATOR=y
+CONFIG_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-p201"
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_DM_GPIO=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_MESON=y
+CONFIG_DM_MMC=y
+CONFIG_MMC_MESON_GX=y
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_MESON_GXBB=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_MESON=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
+CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_SYS_BOARD="p201"
index b0488635fc70a5385a8f7cfe85ffa335bef8e277..042274016087ba0ff3780b2543a52d2a2a8f8c3f 100644 (file)
@@ -11,7 +11,7 @@ CONFIG_OF_BOARD_SETUP=y
 CONFIG_CONSOLE_MUX=y
 CONFIG_MISC_INIT_R=y
 # CONFIG_DISPLAY_CPUINFO is not set
-# CONFIG_DISPLAY_BOARDINFO is not set
+CONFIG_DISPLAY_BOARDINFO=y
 # CONFIG_CMD_BDI is not set
 # CONFIG_CMD_IMI is not set
 CONFIG_CMD_GPIO=y
index 1bd4b7127b1d63aa65dab308d5dc453af52122e5..db8f80a6d56b8ee5bf42017008cecb18665d1e55 100644 (file)
@@ -10,7 +10,7 @@ CONFIG_NR_DRAM_BANKS=1
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_MISC_INIT_R=y
 # CONFIG_DISPLAY_CPUINFO is not set
-# CONFIG_DISPLAY_BOARDINFO is not set
+CONFIG_DISPLAY_BOARDINFO=y
 # CONFIG_CMD_BDI is not set
 # CONFIG_CMD_IMI is not set
 CONFIG_CMD_GPIO=y
@@ -26,6 +26,7 @@ CONFIG_DM_MMC=y
 CONFIG_MMC_MESON_GX=y
 CONFIG_DM_ETH=y
 CONFIG_ETH_DESIGNWARE=y
+CONFIG_PHY_REALTEK=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_MESON_AXG=y
 CONFIG_DM_REGULATOR=y
index bb508a8d02e25ebc55a419ef2f6a6e705edbe4fb..ba28db6d2680cf5400260e49b2b45a9da14a4480 100644 (file)
@@ -16,7 +16,7 @@ CONFIG_CONSOLE_RECORD=y
 CONFIG_CONSOLE_RECORD_OUT_SIZE=0x1000
 CONFIG_SILENT_CONSOLE=y
 CONFIG_PRE_CONSOLE_BUFFER=y
-CONFIG_PRE_CON_BUF_ADDR=0x100000
+CONFIG_PRE_CON_BUF_ADDR=0xf0000
 CONFIG_LOG_MAX_LEVEL=6
 CONFIG_LOG_ERROR_RETURN=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
index 121e96280895462eab7e32c8141b8174baa4de8b..f03583d5808cad6d5d3469e02cbe90025cd7c2f5 100644 (file)
@@ -4,39 +4,32 @@ CONFIG_SYS_TEXT_BASE=0x08008000
 CONFIG_SYS_MALLOC_F_LEN=0xE00
 CONFIG_STM32F7=y
 CONFIG_TARGET_STM32F746_DISCO=y
-CONFIG_ENV_VARS_UBOOT_CONFIG=y
+CONFIG_DISTRO_DEFAULTS=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyS0,115200 earlyprintk consoleblank=0 ignore_loglevel"
+# CONFIG_USE_BOOTCOMMAND is not set
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_BOARD_EARLY_INIT_F=y
-CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PROMPT="U-Boot > "
 CONFIG_AUTOBOOT_KEYED=y
 CONFIG_AUTOBOOT_PROMPT="Hit SPACE in %d seconds to stop autoboot.\n"
 CONFIG_AUTOBOOT_STOP_STR=" "
-CONFIG_CMD_BOOTZ=y
 CONFIG_CMD_GPT=y
 # CONFIG_RANDOM_UUID is not set
 CONFIG_CMD_MMC=y
 CONFIG_CMD_SF=y
 # CONFIG_CMD_SETEXPR is not set
-CONFIG_CMD_DHCP=y
-CONFIG_CMD_MII=y
-CONFIG_CMD_PING=y
 CONFIG_CMD_SNTP=y
 CONFIG_CMD_DNS=y
 CONFIG_CMD_LINK_LOCAL=y
 CONFIG_CMD_BMP=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIMER=y
-CONFIG_CMD_EXT2=y
-CONFIG_CMD_EXT4=y
-CONFIG_CMD_FAT=y
-CONFIG_CMD_FS_GENERIC=y
 # CONFIG_SPL_DOS_PARTITION is not set
+# CONFIG_ISO_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="stm32f746-disco"
@@ -49,6 +42,7 @@ CONFIG_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_DM_ETH=y
 CONFIG_ETH_DESIGNWARE=y
diff --git a/configs/u200_defconfig b/configs/u200_defconfig
new file mode 100644 (file)
index 0000000..c351913
--- /dev/null
@@ -0,0 +1,40 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MESON=y
+CONFIG_SYS_TEXT_BASE=0x01000000
+CONFIG_MESON_G12A=y
+CONFIG_DEBUG_UART_BASE=0xff803000
+CONFIG_DEBUG_UART_CLOCK=24000000
+CONFIG_IDENT_STRING=" u200"
+CONFIG_DEBUG_UART=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_OF_BOARD_SETUP=y
+CONFIG_MISC_INIT_R=y
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_DISPLAY_BOARDINFO=y
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_IMI is not set
+CONFIG_CMD_GPIO=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_REGULATOR=y
+CONFIG_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="meson-g12a-u200"
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_DM_GPIO=y
+CONFIG_DM_MMC=y
+CONFIG_MMC_MESON_GX=y
+CONFIG_PHY_ADDR_ENABLE=y
+CONFIG_PHY_ADDR=8
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_MESON_G12A=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_MESON=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
+CONFIG_OF_LIBFDT_OVERLAY=y
index cabc0c45772ed269ef09291ac38271d36834f5cf..9bcbca5f244b3866af3e356069d6f6062fafdfaa 100644 (file)
@@ -32,3 +32,4 @@ CONFIG_SMC911X_32_BIT=y
 CONFIG_BAUDRATE=38400
 CONFIG_CONS_INDEX=0
 CONFIG_OF_LIBFDT=y
+# CONFIG_EFI_LOADER is not set
index 9390cf61d10770c9e06198413cab71f7c4e5f028..3350c88b20a637901acf8dc90fa1450e7e1031ad 100644 (file)
@@ -31,3 +31,4 @@ CONFIG_SMC911X_32_BIT=y
 CONFIG_BAUDRATE=38400
 CONFIG_CONS_INDEX=0
 CONFIG_OF_LIBFDT=y
+# CONFIG_EFI_LOADER is not set
index ff60fc5c45f5dfb3a4facc223a1e42812a864255..96969b9e30eca5dbc95ef566519354182baf8858 100644 (file)
@@ -101,6 +101,7 @@ config CLK_STM32MP1
 source "drivers/clk/at91/Kconfig"
 source "drivers/clk/exynos/Kconfig"
 source "drivers/clk/imx/Kconfig"
+source "drivers/clk/meson/Kconfig"
 source "drivers/clk/mvebu/Kconfig"
 source "drivers/clk/owl/Kconfig"
 source "drivers/clk/renesas/Kconfig"
index 1d9d725cae17a3ab79bea3115c5e61fbde64b65a..719b9b8e024334d4b60bae29c1c8aa6682834130 100644 (file)
@@ -12,7 +12,7 @@ obj-y += imx/
 obj-y += tegra/
 obj-$(CONFIG_ARCH_ASPEED) += aspeed/
 obj-$(CONFIG_ARCH_MEDIATEK) += mediatek/
-obj-$(CONFIG_ARCH_MESON) += clk_meson.o clk_meson_axg.o
+obj-$(CONFIG_ARCH_MESON) += meson/
 obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/
 obj-$(CONFIG_ARCH_SOCFPGA) += altera/
 obj-$(CONFIG_CLK_AT91) += at91/
diff --git a/drivers/clk/clk_meson.c b/drivers/clk/clk_meson.c
deleted file mode 100644 (file)
index 2cb53fb..0000000
+++ /dev/null
@@ -1,918 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2018 - Beniamino Galvani <b.galvani@gmail.com>
- * (C) Copyright 2018 - BayLibre, SAS
- * Author: Neil Armstrong <narmstrong@baylibre.com>
- */
-
-#include <common.h>
-#include <asm/arch/clock-gx.h>
-#include <asm/io.h>
-#include <clk-uclass.h>
-#include <div64.h>
-#include <dm.h>
-#include <regmap.h>
-#include <syscon.h>
-#include <dt-bindings/clock/gxbb-clkc.h>
-#include "clk_meson.h"
-
-/* This driver support only basic clock tree operations :
- * - Can calculate clock frequency on a limited tree
- * - Can Read muxes and basic dividers (0-based only)
- * - Can enable/disable gates with limited propagation
- * - Can reparent without propagation, only on muxes
- * - Can set rates without reparenting
- * This driver is adapted to what is actually supported by U-Boot
- */
-
-/* Only the clocks ids we don't want to expose, such as the internal muxes
- * and dividers of composite clocks, will remain defined here.
- */
-#define CLKID_MPEG_SEL           10
-#define CLKID_MPEG_DIV           11
-#define CLKID_SAR_ADC_DIV        99
-#define CLKID_MALI_0_DIV         101
-#define CLKID_MALI_1_DIV         104
-#define CLKID_CTS_AMCLK_SEL      108
-#define CLKID_CTS_AMCLK_DIV      109
-#define CLKID_CTS_MCLK_I958_SEL          111
-#define CLKID_CTS_MCLK_I958_DIV          112
-#define CLKID_32K_CLK_SEL        115
-#define CLKID_32K_CLK_DIV        116
-#define CLKID_SD_EMMC_A_CLK0_SEL  117
-#define CLKID_SD_EMMC_A_CLK0_DIV  118
-#define CLKID_SD_EMMC_B_CLK0_SEL  120
-#define CLKID_SD_EMMC_B_CLK0_DIV  121
-#define CLKID_SD_EMMC_C_CLK0_SEL  123
-#define CLKID_SD_EMMC_C_CLK0_DIV  124
-#define CLKID_VPU_0_DIV                  127
-#define CLKID_VPU_1_DIV                  130
-#define CLKID_VAPB_0_DIV         134
-#define CLKID_VAPB_1_DIV         137
-#define CLKID_HDMI_PLL_PRE_MULT          141
-#define CLKID_MPLL0_DIV                  142
-#define CLKID_MPLL1_DIV                  143
-#define CLKID_MPLL2_DIV                  144
-#define CLKID_MPLL_PREDIV        145
-#define CLKID_FCLK_DIV2_DIV      146
-#define CLKID_FCLK_DIV3_DIV      147
-#define CLKID_FCLK_DIV4_DIV      148
-#define CLKID_FCLK_DIV5_DIV      149
-#define CLKID_FCLK_DIV7_DIV      150
-#define CLKID_VDEC_1_SEL         151
-#define CLKID_VDEC_1_DIV         152
-#define CLKID_VDEC_HEVC_SEL      154
-#define CLKID_VDEC_HEVC_DIV      155
-
-#define XTAL_RATE 24000000
-
-struct meson_clk {
-       struct regmap *map;
-};
-
-static ulong meson_div_get_rate(struct clk *clk, unsigned long id);
-static ulong meson_div_set_rate(struct clk *clk, unsigned long id, ulong rate,
-                               ulong current_rate);
-static ulong meson_mux_set_parent(struct clk *clk, unsigned long id,
-                                 unsigned long parent_id);
-static ulong meson_mux_get_rate(struct clk *clk, unsigned long id);
-static ulong meson_clk_set_rate_by_id(struct clk *clk, unsigned long id,
-                                     ulong rate, ulong current_rate);
-static ulong meson_mux_get_parent(struct clk *clk, unsigned long id);
-static ulong meson_clk_get_rate_by_id(struct clk *clk, unsigned long id);
-
-static struct meson_gate gates[] = {
-       /* Everything Else (EE) domain gates */
-       MESON_GATE(CLKID_DDR, HHI_GCLK_MPEG0, 0),
-       MESON_GATE(CLKID_DOS, HHI_GCLK_MPEG0, 1),
-       MESON_GATE(CLKID_ISA, HHI_GCLK_MPEG0, 5),
-       MESON_GATE(CLKID_PL301, HHI_GCLK_MPEG0, 6),
-       MESON_GATE(CLKID_PERIPHS, HHI_GCLK_MPEG0, 7),
-       MESON_GATE(CLKID_SPICC, HHI_GCLK_MPEG0, 8),
-       MESON_GATE(CLKID_I2C, HHI_GCLK_MPEG0, 9),
-       MESON_GATE(CLKID_SAR_ADC, HHI_GCLK_MPEG0, 10),
-       MESON_GATE(CLKID_SMART_CARD, HHI_GCLK_MPEG0, 11),
-       MESON_GATE(CLKID_RNG0, HHI_GCLK_MPEG0, 12),
-       MESON_GATE(CLKID_UART0, HHI_GCLK_MPEG0, 13),
-       MESON_GATE(CLKID_SDHC, HHI_GCLK_MPEG0, 14),
-       MESON_GATE(CLKID_STREAM, HHI_GCLK_MPEG0, 15),
-       MESON_GATE(CLKID_ASYNC_FIFO, HHI_GCLK_MPEG0, 16),
-       MESON_GATE(CLKID_SDIO, HHI_GCLK_MPEG0, 17),
-       MESON_GATE(CLKID_ABUF, HHI_GCLK_MPEG0, 18),
-       MESON_GATE(CLKID_HIU_IFACE, HHI_GCLK_MPEG0, 19),
-       MESON_GATE(CLKID_ASSIST_MISC, HHI_GCLK_MPEG0, 23),
-       MESON_GATE(CLKID_SD_EMMC_A, HHI_GCLK_MPEG0, 24),
-       MESON_GATE(CLKID_SD_EMMC_B, HHI_GCLK_MPEG0, 25),
-       MESON_GATE(CLKID_SD_EMMC_C, HHI_GCLK_MPEG0, 26),
-       MESON_GATE(CLKID_SPI, HHI_GCLK_MPEG0, 30),
-
-       MESON_GATE(CLKID_I2S_SPDIF, HHI_GCLK_MPEG1, 2),
-       MESON_GATE(CLKID_ETH, HHI_GCLK_MPEG1, 3),
-       MESON_GATE(CLKID_DEMUX, HHI_GCLK_MPEG1, 4),
-       MESON_GATE(CLKID_AIU_GLUE, HHI_GCLK_MPEG1, 6),
-       MESON_GATE(CLKID_IEC958, HHI_GCLK_MPEG1, 7),
-       MESON_GATE(CLKID_I2S_OUT, HHI_GCLK_MPEG1, 8),
-       MESON_GATE(CLKID_AMCLK, HHI_GCLK_MPEG1, 9),
-       MESON_GATE(CLKID_AIFIFO2, HHI_GCLK_MPEG1, 10),
-       MESON_GATE(CLKID_MIXER, HHI_GCLK_MPEG1, 11),
-       MESON_GATE(CLKID_MIXER_IFACE, HHI_GCLK_MPEG1, 12),
-       MESON_GATE(CLKID_ADC, HHI_GCLK_MPEG1, 13),
-       MESON_GATE(CLKID_BLKMV, HHI_GCLK_MPEG1, 14),
-       MESON_GATE(CLKID_AIU, HHI_GCLK_MPEG1, 15),
-       MESON_GATE(CLKID_UART1, HHI_GCLK_MPEG1, 16),
-       MESON_GATE(CLKID_G2D, HHI_GCLK_MPEG1, 20),
-       MESON_GATE(CLKID_USB0, HHI_GCLK_MPEG1, 21),
-       MESON_GATE(CLKID_USB1, HHI_GCLK_MPEG1, 22),
-       MESON_GATE(CLKID_RESET, HHI_GCLK_MPEG1, 23),
-       MESON_GATE(CLKID_NAND, HHI_GCLK_MPEG1, 24),
-       MESON_GATE(CLKID_DOS_PARSER, HHI_GCLK_MPEG1, 25),
-       MESON_GATE(CLKID_USB, HHI_GCLK_MPEG1, 26),
-       MESON_GATE(CLKID_VDIN1, HHI_GCLK_MPEG1, 28),
-       MESON_GATE(CLKID_AHB_ARB0, HHI_GCLK_MPEG1, 29),
-       MESON_GATE(CLKID_EFUSE, HHI_GCLK_MPEG1, 30),
-       MESON_GATE(CLKID_BOOT_ROM, HHI_GCLK_MPEG1, 31),
-
-       MESON_GATE(CLKID_AHB_DATA_BUS, HHI_GCLK_MPEG2, 1),
-       MESON_GATE(CLKID_AHB_CTRL_BUS, HHI_GCLK_MPEG2, 2),
-       MESON_GATE(CLKID_HDMI_INTR_SYNC, HHI_GCLK_MPEG2, 3),
-       MESON_GATE(CLKID_HDMI_PCLK, HHI_GCLK_MPEG2, 4),
-       MESON_GATE(CLKID_USB1_DDR_BRIDGE, HHI_GCLK_MPEG2, 8),
-       MESON_GATE(CLKID_USB0_DDR_BRIDGE, HHI_GCLK_MPEG2, 9),
-       MESON_GATE(CLKID_MMC_PCLK, HHI_GCLK_MPEG2, 11),
-       MESON_GATE(CLKID_DVIN, HHI_GCLK_MPEG2, 12),
-       MESON_GATE(CLKID_UART2, HHI_GCLK_MPEG2, 15),
-       MESON_GATE(CLKID_SANA, HHI_GCLK_MPEG2, 22),
-       MESON_GATE(CLKID_VPU_INTR, HHI_GCLK_MPEG2, 25),
-       MESON_GATE(CLKID_SEC_AHB_AHB3_BRIDGE, HHI_GCLK_MPEG2, 26),
-       MESON_GATE(CLKID_CLK81_A53, HHI_GCLK_MPEG2, 29),
-
-       MESON_GATE(CLKID_VCLK2_VENCI0, HHI_GCLK_OTHER, 1),
-       MESON_GATE(CLKID_VCLK2_VENCI1, HHI_GCLK_OTHER, 2),
-       MESON_GATE(CLKID_VCLK2_VENCP0, HHI_GCLK_OTHER, 3),
-       MESON_GATE(CLKID_VCLK2_VENCP1, HHI_GCLK_OTHER, 4),
-       MESON_GATE(CLKID_GCLK_VENCI_INT0, HHI_GCLK_OTHER, 8),
-       MESON_GATE(CLKID_DAC_CLK, HHI_GCLK_OTHER, 10),
-       MESON_GATE(CLKID_AOCLK_GATE, HHI_GCLK_OTHER, 14),
-       MESON_GATE(CLKID_IEC958_GATE, HHI_GCLK_OTHER, 16),
-       MESON_GATE(CLKID_ENC480P, HHI_GCLK_OTHER, 20),
-       MESON_GATE(CLKID_RNG1, HHI_GCLK_OTHER, 21),
-       MESON_GATE(CLKID_GCLK_VENCI_INT1, HHI_GCLK_OTHER, 22),
-       MESON_GATE(CLKID_VCLK2_VENCLMCC, HHI_GCLK_OTHER, 24),
-       MESON_GATE(CLKID_VCLK2_VENCL, HHI_GCLK_OTHER, 25),
-       MESON_GATE(CLKID_VCLK_OTHER, HHI_GCLK_OTHER, 26),
-       MESON_GATE(CLKID_EDP, HHI_GCLK_OTHER, 31),
-
-       /* Always On (AO) domain gates */
-       MESON_GATE(CLKID_AO_MEDIA_CPU, HHI_GCLK_AO, 0),
-       MESON_GATE(CLKID_AO_AHB_SRAM, HHI_GCLK_AO, 1),
-       MESON_GATE(CLKID_AO_AHB_BUS, HHI_GCLK_AO, 2),
-       MESON_GATE(CLKID_AO_IFACE, HHI_GCLK_AO, 3),
-       MESON_GATE(CLKID_AO_I2C, HHI_GCLK_AO, 4),
-
-       /* PLL Gates */
-       /* CLKID_FCLK_DIV2 is critical for the SCPI Processor */
-       MESON_GATE(CLKID_FCLK_DIV3, HHI_MPLL_CNTL6, 28),
-       MESON_GATE(CLKID_FCLK_DIV4, HHI_MPLL_CNTL6, 29),
-       MESON_GATE(CLKID_FCLK_DIV5, HHI_MPLL_CNTL6, 30),
-       MESON_GATE(CLKID_FCLK_DIV7, HHI_MPLL_CNTL6, 31),
-       MESON_GATE(CLKID_MPLL0, HHI_MPLL_CNTL7, 14),
-       MESON_GATE(CLKID_MPLL1, HHI_MPLL_CNTL8, 14),
-       MESON_GATE(CLKID_MPLL2, HHI_MPLL_CNTL9, 14),
-       /* CLKID_CLK81 is critical for the system */
-
-       /* Peripheral Gates */
-       MESON_GATE(CLKID_SAR_ADC_CLK, HHI_SAR_CLK_CNTL, 8),
-       MESON_GATE(CLKID_SD_EMMC_A_CLK0, HHI_SD_EMMC_CLK_CNTL, 7),
-       MESON_GATE(CLKID_SD_EMMC_B_CLK0, HHI_SD_EMMC_CLK_CNTL, 23),
-       MESON_GATE(CLKID_SD_EMMC_C_CLK0, HHI_NAND_CLK_CNTL, 7),
-       MESON_GATE(CLKID_VPU_0, HHI_VPU_CLK_CNTL, 8),
-       MESON_GATE(CLKID_VPU_1, HHI_VPU_CLK_CNTL, 24),
-       MESON_GATE(CLKID_VAPB_0, HHI_VAPBCLK_CNTL, 8),
-       MESON_GATE(CLKID_VAPB_1, HHI_VAPBCLK_CNTL, 24),
-       MESON_GATE(CLKID_VAPB, HHI_VAPBCLK_CNTL, 30),
-};
-
-static int meson_set_gate_by_id(struct clk *clk, unsigned long id, bool on)
-{
-       struct meson_clk *priv = dev_get_priv(clk->dev);
-       struct meson_gate *gate;
-
-       debug("%s: %sabling %ld\n", __func__, on ? "en" : "dis", id);
-
-       /* Propagate through muxes */
-       switch (id) {
-       case CLKID_VPU:
-               return meson_set_gate_by_id(clk,
-                               meson_mux_get_parent(clk, CLKID_VPU), on);
-       case CLKID_VAPB_SEL:
-               return meson_set_gate_by_id(clk,
-                               meson_mux_get_parent(clk, CLKID_VAPB_SEL), on);
-       }
-
-       if (id >= ARRAY_SIZE(gates))
-               return -ENOENT;
-
-       gate = &gates[id];
-
-       if (gate->reg == 0)
-               return 0;
-
-       debug("%s: really %sabling %ld\n", __func__, on ? "en" : "dis", id);
-
-       regmap_update_bits(priv->map, gate->reg,
-                          BIT(gate->bit), on ? BIT(gate->bit) : 0);
-
-       /* Propagate to next gate(s) */
-       switch (id) {
-       case CLKID_VAPB:
-               return meson_set_gate_by_id(clk, CLKID_VAPB_SEL, on);
-       }
-
-       return 0;
-}
-
-static int meson_clk_enable(struct clk *clk)
-{
-       return meson_set_gate_by_id(clk, clk->id, true);
-}
-
-static int meson_clk_disable(struct clk *clk)
-{
-       return meson_set_gate_by_id(clk, clk->id, false);
-}
-
-static struct parm meson_vpu_0_div_parm = {
-       HHI_VPU_CLK_CNTL, 0, 7,
-};
-
-int meson_vpu_0_div_parent = CLKID_VPU_0_SEL;
-
-static struct parm meson_vpu_1_div_parm = {
-       HHI_VPU_CLK_CNTL, 16, 7,
-};
-
-int meson_vpu_1_div_parent = CLKID_VPU_1_SEL;
-
-static struct parm meson_vapb_0_div_parm = {
-       HHI_VAPBCLK_CNTL, 0, 7,
-};
-
-int meson_vapb_0_div_parent = CLKID_VAPB_0_SEL;
-
-static struct parm meson_vapb_1_div_parm = {
-       HHI_VAPBCLK_CNTL, 16, 7,
-};
-
-int meson_vapb_1_div_parent = CLKID_VAPB_1_SEL;
-
-static ulong meson_div_get_rate(struct clk *clk, unsigned long id)
-{
-       struct meson_clk *priv = dev_get_priv(clk->dev);
-       unsigned int rate, parent_rate;
-       struct parm *parm;
-       int parent;
-       uint reg;
-
-       switch (id) {
-       case CLKID_VPU_0_DIV:
-               parm = &meson_vpu_0_div_parm;
-               parent = meson_vpu_0_div_parent;
-               break;
-       case CLKID_VPU_1_DIV:
-               parm = &meson_vpu_1_div_parm;
-               parent = meson_vpu_1_div_parent;
-               break;
-       case CLKID_VAPB_0_DIV:
-               parm = &meson_vapb_0_div_parm;
-               parent = meson_vapb_0_div_parent;
-               break;
-       case CLKID_VAPB_1_DIV:
-               parm = &meson_vapb_1_div_parm;
-               parent = meson_vapb_1_div_parent;
-               break;
-       default:
-               return -ENOENT;
-       }
-
-       regmap_read(priv->map, parm->reg_off, &reg);
-       reg = PARM_GET(parm->width, parm->shift, reg);
-
-       debug("%s: div of %ld is %d\n", __func__, id, reg + 1);
-
-       parent_rate = meson_clk_get_rate_by_id(clk, parent);
-       if (IS_ERR_VALUE(parent_rate))
-               return parent_rate;
-
-       debug("%s: parent rate of %ld is %d\n", __func__, id, parent_rate);
-
-       rate = parent_rate / (reg + 1);
-
-       debug("%s: rate of %ld is %d\n", __func__, id, rate);
-
-       return rate;
-}
-
-static ulong meson_div_set_rate(struct clk *clk, unsigned long id, ulong rate,
-                               ulong current_rate)
-{
-       struct meson_clk *priv = dev_get_priv(clk->dev);
-       unsigned int new_div = -EINVAL;
-       unsigned long parent_rate;
-       struct parm *parm;
-       int parent;
-       int ret;
-
-       if (current_rate == rate)
-               return 0;
-
-       debug("%s: setting rate of %ld from %ld to %ld\n",
-             __func__, id, current_rate, rate);
-
-       switch (id) {
-       case CLKID_VPU_0_DIV:
-               parm = &meson_vpu_0_div_parm;
-               parent = meson_vpu_0_div_parent;
-               break;
-       case CLKID_VPU_1_DIV:
-               parm = &meson_vpu_1_div_parm;
-               parent = meson_vpu_1_div_parent;
-               break;
-       case CLKID_VAPB_0_DIV:
-               parm = &meson_vapb_0_div_parm;
-               parent = meson_vapb_0_div_parent;
-               break;
-       case CLKID_VAPB_1_DIV:
-               parm = &meson_vapb_1_div_parm;
-               parent = meson_vapb_1_div_parent;
-               break;
-       default:
-               return -ENOENT;
-       }
-
-       parent_rate = meson_clk_get_rate_by_id(clk, parent);
-       if (IS_ERR_VALUE(parent_rate))
-               return parent_rate;
-
-       debug("%s: parent rate of %ld is %ld\n", __func__, id, parent_rate);
-
-       /* If can't divide, set parent instead */
-       if (!parent_rate || rate > parent_rate)
-               return meson_clk_set_rate_by_id(clk, parent, rate,
-                                               current_rate);
-
-       new_div = DIV_ROUND_CLOSEST(parent_rate, rate);
-
-       debug("%s: new div of %ld is %d\n", __func__, id, new_div);
-
-       /* If overflow, try to set parent rate and retry */
-       if (!new_div || new_div > (1 << parm->width)) {
-               ret = meson_clk_set_rate_by_id(clk, parent, rate, current_rate);
-               if (IS_ERR_VALUE(ret))
-                       return ret;
-
-               parent_rate = meson_clk_get_rate_by_id(clk, parent);
-               if (IS_ERR_VALUE(parent_rate))
-                       return parent_rate;
-
-               new_div = DIV_ROUND_CLOSEST(parent_rate, rate);
-
-               debug("%s: new new div of %ld is %d\n", __func__, id, new_div);
-
-               if (!new_div || new_div > (1 << parm->width))
-                       return -EINVAL;
-       }
-
-       debug("%s: setting div of %ld to %d\n", __func__, id, new_div);
-
-       regmap_update_bits(priv->map, parm->reg_off, SETPMASK(parm->width, parm->shift),
-                          (new_div - 1) << parm->shift);
-
-       debug("%s: new rate of %ld is %ld\n",
-             __func__, id, meson_div_get_rate(clk, id));
-
-       return 0;
-}
-
-static struct parm meson_vpu_mux_parm = {
-       HHI_VPU_CLK_CNTL, 31, 1,
-};
-
-int meson_vpu_mux_parents[] = {
-       CLKID_VPU_0,
-       CLKID_VPU_1,
-};
-
-static struct parm meson_vpu_0_mux_parm = {
-       HHI_VPU_CLK_CNTL, 9, 2,
-};
-
-static struct parm meson_vpu_1_mux_parm = {
-       HHI_VPU_CLK_CNTL, 25, 2,
-};
-
-static int meson_vpu_0_1_mux_parents[] = {
-       CLKID_FCLK_DIV4,
-       CLKID_FCLK_DIV3,
-       CLKID_FCLK_DIV5,
-       CLKID_FCLK_DIV7,
-};
-
-static struct parm meson_vapb_sel_mux_parm = {
-       HHI_VAPBCLK_CNTL, 31, 1,
-};
-
-int meson_vapb_sel_mux_parents[] = {
-       CLKID_VAPB_0,
-       CLKID_VAPB_1,
-};
-
-static struct parm meson_vapb_0_mux_parm = {
-       HHI_VAPBCLK_CNTL, 9, 2,
-};
-
-static struct parm meson_vapb_1_mux_parm = {
-       HHI_VAPBCLK_CNTL, 25, 2,
-};
-
-static int meson_vapb_0_1_mux_parents[] = {
-       CLKID_FCLK_DIV4,
-       CLKID_FCLK_DIV3,
-       CLKID_FCLK_DIV5,
-       CLKID_FCLK_DIV7,
-};
-
-static ulong meson_mux_get_parent(struct clk *clk, unsigned long id)
-{
-       struct meson_clk *priv = dev_get_priv(clk->dev);
-       struct parm *parm;
-       int *parents;
-       uint reg;
-
-       switch (id) {
-       case CLKID_VPU:
-               parm = &meson_vpu_mux_parm;
-               parents = meson_vpu_mux_parents;
-               break;
-       case CLKID_VPU_0_SEL:
-               parm = &meson_vpu_0_mux_parm;
-               parents = meson_vpu_0_1_mux_parents;
-               break;
-       case CLKID_VPU_1_SEL:
-               parm = &meson_vpu_1_mux_parm;
-               parents = meson_vpu_0_1_mux_parents;
-               break;
-       case CLKID_VAPB_SEL:
-               parm = &meson_vapb_sel_mux_parm;
-               parents = meson_vapb_sel_mux_parents;
-               break;
-       case CLKID_VAPB_0_SEL:
-               parm = &meson_vapb_0_mux_parm;
-               parents = meson_vapb_0_1_mux_parents;
-               break;
-       case CLKID_VAPB_1_SEL:
-               parm = &meson_vapb_1_mux_parm;
-               parents = meson_vapb_0_1_mux_parents;
-               break;
-       default:
-               return -ENOENT;
-       }
-
-       regmap_read(priv->map, parm->reg_off, &reg);
-       reg = PARM_GET(parm->width, parm->shift, reg);
-
-       debug("%s: parent of %ld is %d (%d)\n",
-             __func__, id, parents[reg], reg);
-
-       return parents[reg];
-}
-
-static ulong meson_mux_set_parent(struct clk *clk, unsigned long id,
-                                 unsigned long parent_id)
-{
-       unsigned long cur_parent = meson_mux_get_parent(clk, id);
-       struct meson_clk *priv = dev_get_priv(clk->dev);
-       unsigned int new_index = -EINVAL;
-       struct parm *parm;
-       int *parents;
-       int i;
-
-       if (IS_ERR_VALUE(cur_parent))
-               return cur_parent;
-
-       debug("%s: setting parent of %ld from %ld to %ld\n",
-             __func__, id, cur_parent, parent_id);
-
-       if (cur_parent == parent_id)
-               return 0;
-
-       switch (id) {
-       case CLKID_VPU:
-               parm = &meson_vpu_mux_parm;
-               parents = meson_vpu_mux_parents;
-               break;
-       case CLKID_VPU_0_SEL:
-               parm = &meson_vpu_0_mux_parm;
-               parents = meson_vpu_0_1_mux_parents;
-               break;
-       case CLKID_VPU_1_SEL:
-               parm = &meson_vpu_1_mux_parm;
-               parents = meson_vpu_0_1_mux_parents;
-               break;
-       case CLKID_VAPB_SEL:
-               parm = &meson_vapb_sel_mux_parm;
-               parents = meson_vapb_sel_mux_parents;
-               break;
-       case CLKID_VAPB_0_SEL:
-               parm = &meson_vapb_0_mux_parm;
-               parents = meson_vapb_0_1_mux_parents;
-               break;
-       case CLKID_VAPB_1_SEL:
-               parm = &meson_vapb_1_mux_parm;
-               parents = meson_vapb_0_1_mux_parents;
-               break;
-       default:
-               /* Not a mux */
-               return -ENOENT;
-       }
-
-       for (i = 0 ; i < (1 << parm->width) ; ++i) {
-               if (parents[i] == parent_id)
-                       new_index = i;
-       }
-
-       if (IS_ERR_VALUE(new_index))
-               return new_index;
-
-       debug("%s: new index of %ld is %d\n", __func__, id, new_index);
-
-       regmap_update_bits(priv->map, parm->reg_off, SETPMASK(parm->width, parm->shift),
-                          new_index << parm->shift);
-
-       debug("%s: new parent of %ld is %ld\n",
-             __func__, id, meson_mux_get_parent(clk, id));
-
-       return 0;
-}
-
-static ulong meson_mux_get_rate(struct clk *clk, unsigned long id)
-{
-       int parent = meson_mux_get_parent(clk, id);
-
-       if (IS_ERR_VALUE(parent))
-               return parent;
-
-       return meson_clk_get_rate_by_id(clk, parent);
-}
-
-static unsigned long meson_clk81_get_rate(struct clk *clk)
-{
-       struct meson_clk *priv = dev_get_priv(clk->dev);
-       unsigned long parent_rate;
-       uint reg;
-       int parents[] = {
-               -1,
-               -1,
-               CLKID_FCLK_DIV7,
-               CLKID_MPLL1,
-               CLKID_MPLL2,
-               CLKID_FCLK_DIV4,
-               CLKID_FCLK_DIV3,
-               CLKID_FCLK_DIV5
-       };
-
-       /* mux */
-       regmap_read(priv->map, HHI_MPEG_CLK_CNTL, &reg);
-       reg = (reg >> 12) & 7;
-
-       switch (reg) {
-       case 0:
-               parent_rate = XTAL_RATE;
-               break;
-       case 1:
-               return -ENOENT;
-       default:
-               parent_rate = meson_clk_get_rate_by_id(clk, parents[reg]);
-       }
-
-       /* divider */
-       regmap_read(priv->map, HHI_MPEG_CLK_CNTL, &reg);
-       reg = reg & ((1 << 7) - 1);
-
-       /* clk81 divider is zero based */
-       return parent_rate / (reg + 1);
-}
-
-static long mpll_rate_from_params(unsigned long parent_rate,
-                                 unsigned long sdm,
-                                 unsigned long n2)
-{
-       unsigned long divisor = (SDM_DEN * n2) + sdm;
-
-       if (n2 < N2_MIN)
-               return -EINVAL;
-
-       return DIV_ROUND_UP_ULL((u64)parent_rate * SDM_DEN, divisor);
-}
-
-static struct parm meson_mpll0_parm[3] = {
-       {HHI_MPLL_CNTL7, 0, 14}, /* psdm */
-       {HHI_MPLL_CNTL7, 16, 9}, /* pn2 */
-};
-
-static struct parm meson_mpll1_parm[3] = {
-       {HHI_MPLL_CNTL8, 0, 14}, /* psdm */
-       {HHI_MPLL_CNTL8, 16, 9}, /* pn2 */
-};
-
-static struct parm meson_mpll2_parm[3] = {
-       {HHI_MPLL_CNTL9, 0, 14}, /* psdm */
-       {HHI_MPLL_CNTL9, 16, 9}, /* pn2 */
-};
-
-/*
- * MultiPhase Locked Loops are outputs from a PLL with additional frequency
- * scaling capabilities. MPLL rates are calculated as:
- *
- * f(N2_integer, SDM_IN ) = 2.0G/(N2_integer + SDM_IN/16384)
- */
-static ulong meson_mpll_get_rate(struct clk *clk, unsigned long id)
-{
-       struct meson_clk *priv = dev_get_priv(clk->dev);
-       struct parm *psdm, *pn2;
-       unsigned long sdm, n2;
-       unsigned long parent_rate;
-       uint reg;
-
-       switch (id) {
-       case CLKID_MPLL0:
-               psdm = &meson_mpll0_parm[0];
-               pn2 = &meson_mpll0_parm[1];
-               break;
-       case CLKID_MPLL1:
-               psdm = &meson_mpll1_parm[0];
-               pn2 = &meson_mpll1_parm[1];
-               break;
-       case CLKID_MPLL2:
-               psdm = &meson_mpll2_parm[0];
-               pn2 = &meson_mpll2_parm[1];
-               break;
-       default:
-               return -ENOENT;
-       }
-
-       parent_rate = meson_clk_get_rate_by_id(clk, CLKID_FIXED_PLL);
-       if (IS_ERR_VALUE(parent_rate))
-               return parent_rate;
-
-       regmap_read(priv->map, psdm->reg_off, &reg);
-       sdm = PARM_GET(psdm->width, psdm->shift, reg);
-
-       regmap_read(priv->map, pn2->reg_off, &reg);
-       n2 = PARM_GET(pn2->width, pn2->shift, reg);
-
-       return mpll_rate_from_params(parent_rate, sdm, n2);
-}
-
-static struct parm meson_fixed_pll_parm[3] = {
-       {HHI_MPLL_CNTL, 0, 9}, /* pm */
-       {HHI_MPLL_CNTL, 9, 5}, /* pn */
-       {HHI_MPLL_CNTL, 16, 2}, /* pod */
-};
-
-static struct parm meson_sys_pll_parm[3] = {
-       {HHI_SYS_PLL_CNTL, 0, 9}, /* pm */
-       {HHI_SYS_PLL_CNTL, 9, 5}, /* pn */
-       {HHI_SYS_PLL_CNTL, 10, 2}, /* pod */
-};
-
-static ulong meson_pll_get_rate(struct clk *clk, unsigned long id)
-{
-       struct meson_clk *priv = dev_get_priv(clk->dev);
-       struct parm *pm, *pn, *pod;
-       unsigned long parent_rate_mhz = XTAL_RATE / 1000000;
-       u16 n, m, od;
-       uint reg;
-
-       switch (id) {
-       case CLKID_FIXED_PLL:
-               pm = &meson_fixed_pll_parm[0];
-               pn = &meson_fixed_pll_parm[1];
-               pod = &meson_fixed_pll_parm[2];
-               break;
-       case CLKID_SYS_PLL:
-               pm = &meson_sys_pll_parm[0];
-               pn = &meson_sys_pll_parm[1];
-               pod = &meson_sys_pll_parm[2];
-               break;
-       default:
-               return -ENOENT;
-       }
-
-       regmap_read(priv->map, pn->reg_off, &reg);
-       n = PARM_GET(pn->width, pn->shift, reg);
-
-       regmap_read(priv->map, pm->reg_off, &reg);
-       m = PARM_GET(pm->width, pm->shift, reg);
-
-       regmap_read(priv->map, pod->reg_off, &reg);
-       od = PARM_GET(pod->width, pod->shift, reg);
-
-       return ((parent_rate_mhz * m / n) >> od) * 1000000;
-}
-
-static ulong meson_clk_get_rate_by_id(struct clk *clk, unsigned long id)
-{
-       ulong rate;
-
-       switch (id) {
-       case CLKID_FIXED_PLL:
-       case CLKID_SYS_PLL:
-               rate = meson_pll_get_rate(clk, id);
-               break;
-       case CLKID_FCLK_DIV2:
-               rate = meson_pll_get_rate(clk, CLKID_FIXED_PLL) / 2;
-               break;
-       case CLKID_FCLK_DIV3:
-               rate = meson_pll_get_rate(clk, CLKID_FIXED_PLL) / 3;
-               break;
-       case CLKID_FCLK_DIV4:
-               rate = meson_pll_get_rate(clk, CLKID_FIXED_PLL) / 4;
-               break;
-       case CLKID_FCLK_DIV5:
-               rate = meson_pll_get_rate(clk, CLKID_FIXED_PLL) / 5;
-               break;
-       case CLKID_FCLK_DIV7:
-               rate = meson_pll_get_rate(clk, CLKID_FIXED_PLL) / 7;
-               break;
-       case CLKID_MPLL0:
-       case CLKID_MPLL1:
-       case CLKID_MPLL2:
-               rate = meson_mpll_get_rate(clk, id);
-               break;
-       case CLKID_CLK81:
-               rate = meson_clk81_get_rate(clk);
-               break;
-       case CLKID_VPU_0:
-               rate = meson_div_get_rate(clk, CLKID_VPU_0_DIV);
-               break;
-       case CLKID_VPU_1:
-               rate = meson_div_get_rate(clk, CLKID_VPU_1_DIV);
-               break;
-       case CLKID_VAPB:
-               rate = meson_mux_get_rate(clk, CLKID_VAPB_SEL);
-               break;
-       case CLKID_VAPB_0:
-               rate = meson_div_get_rate(clk, CLKID_VAPB_0_DIV);
-               break;
-       case CLKID_VAPB_1:
-               rate = meson_div_get_rate(clk, CLKID_VAPB_1_DIV);
-               break;
-       case CLKID_VPU_0_DIV:
-       case CLKID_VPU_1_DIV:
-       case CLKID_VAPB_0_DIV:
-       case CLKID_VAPB_1_DIV:
-               rate = meson_div_get_rate(clk, id);
-               break;
-       case CLKID_VPU:
-       case CLKID_VPU_0_SEL:
-       case CLKID_VPU_1_SEL:
-       case CLKID_VAPB_SEL:
-       case CLKID_VAPB_0_SEL:
-       case CLKID_VAPB_1_SEL:
-               rate = meson_mux_get_rate(clk, id);
-               break;
-       default:
-               if (gates[id].reg != 0) {
-                       /* a clock gate */
-                       rate = meson_clk81_get_rate(clk);
-                       break;
-               }
-               return -ENOENT;
-       }
-
-       debug("clock %lu has rate %lu\n", id, rate);
-       return rate;
-}
-
-static ulong meson_clk_get_rate(struct clk *clk)
-{
-       return meson_clk_get_rate_by_id(clk, clk->id);
-}
-
-static int meson_clk_set_parent(struct clk *clk, struct clk *parent)
-{
-       return meson_mux_set_parent(clk, clk->id, parent->id);
-}
-
-static ulong meson_clk_set_rate_by_id(struct clk *clk, unsigned long id,
-                                     ulong rate, ulong current_rate)
-{
-       if (current_rate == rate)
-               return 0;
-
-       switch (id) {
-       /* Fixed clocks */
-       case CLKID_FIXED_PLL:
-       case CLKID_SYS_PLL:
-       case CLKID_FCLK_DIV2:
-       case CLKID_FCLK_DIV3:
-       case CLKID_FCLK_DIV4:
-       case CLKID_FCLK_DIV5:
-       case CLKID_FCLK_DIV7:
-       case CLKID_MPLL0:
-       case CLKID_MPLL1:
-       case CLKID_MPLL2:
-       case CLKID_CLK81:
-               if (current_rate != rate)
-                       return -EINVAL;
-
-               return 0;
-       case CLKID_VPU:
-               return meson_clk_set_rate_by_id(clk,
-                               meson_mux_get_parent(clk, CLKID_VPU), rate,
-                                                    current_rate);
-       case CLKID_VAPB:
-       case CLKID_VAPB_SEL:
-               return meson_clk_set_rate_by_id(clk,
-                               meson_mux_get_parent(clk, CLKID_VAPB_SEL),
-                               rate, current_rate);
-       case CLKID_VPU_0:
-               return meson_div_set_rate(clk, CLKID_VPU_0_DIV, rate,
-                                         current_rate);
-       case CLKID_VPU_1:
-               return meson_div_set_rate(clk, CLKID_VPU_1_DIV, rate,
-                                         current_rate);
-       case CLKID_VAPB_0:
-               return meson_div_set_rate(clk, CLKID_VAPB_0_DIV, rate,
-                                         current_rate);
-       case CLKID_VAPB_1:
-               return meson_div_set_rate(clk, CLKID_VAPB_1_DIV, rate,
-                                         current_rate);
-       case CLKID_VPU_0_DIV:
-       case CLKID_VPU_1_DIV:
-       case CLKID_VAPB_0_DIV:
-       case CLKID_VAPB_1_DIV:
-               return meson_div_set_rate(clk, id, rate, current_rate);
-       default:
-               return -ENOENT;
-       }
-
-       return -EINVAL;
-}
-
-static ulong meson_clk_set_rate(struct clk *clk, ulong rate)
-{
-       ulong current_rate = meson_clk_get_rate_by_id(clk, clk->id);
-       int ret;
-
-       if (IS_ERR_VALUE(current_rate))
-               return current_rate;
-
-       debug("%s: setting rate of %ld from %ld to %ld\n",
-             __func__, clk->id, current_rate, rate);
-
-       ret = meson_clk_set_rate_by_id(clk, clk->id, rate, current_rate);
-       if (IS_ERR_VALUE(ret))
-               return ret;
-
-       debug("clock %lu has new rate %lu\n", clk->id,
-             meson_clk_get_rate_by_id(clk, clk->id));
-
-       return 0;
-}
-
-static int meson_clk_probe(struct udevice *dev)
-{
-       struct meson_clk *priv = dev_get_priv(dev);
-
-       priv->map = syscon_node_to_regmap(dev_get_parent(dev)->node);
-       if (IS_ERR(priv->map))
-               return PTR_ERR(priv->map);
-
-       debug("meson-clk: probed\n");
-
-       return 0;
-}
-
-static struct clk_ops meson_clk_ops = {
-       .disable        = meson_clk_disable,
-       .enable         = meson_clk_enable,
-       .get_rate       = meson_clk_get_rate,
-       .set_parent     = meson_clk_set_parent,
-       .set_rate       = meson_clk_set_rate,
-};
-
-static const struct udevice_id meson_clk_ids[] = {
-       { .compatible = "amlogic,gxbb-clkc" },
-       { .compatible = "amlogic,gxl-clkc" },
-       { }
-};
-
-U_BOOT_DRIVER(meson_clk) = {
-       .name           = "meson_clk",
-       .id             = UCLASS_CLK,
-       .of_match       = meson_clk_ids,
-       .priv_auto_alloc_size = sizeof(struct meson_clk),
-       .ops            = &meson_clk_ops,
-       .probe          = meson_clk_probe,
-};
diff --git a/drivers/clk/clk_meson.h b/drivers/clk/clk_meson.h
deleted file mode 100644 (file)
index 7adc55a..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * (C) Copyright 2018 - Beniamino Galvani <b.galvani@gmail.com>
- * (C) Copyright 2018 - BayLibre, SAS
- * Author: Neil Armstrong <narmstrong@baylibre.com>
- */
-
-#ifndef CLK_MESON_H
-#define CLK_MESON_H
-
-/* Gate Structure */
-
-struct meson_gate {
-       unsigned int reg;
-       unsigned int bit;
-};
-
-#define MESON_GATE(id, _reg, _bit)             \
-       [id] = {                                \
-               .reg = (_reg),                  \
-               .bit = (_bit),                  \
-       }
-
-/* PLL Parameters */
-
-struct parm {
-       u16 reg_off;
-       u8 shift;
-       u8 width;
-};
-
-#define PMASK(width)                    GENMASK(width - 1, 0)
-#define SETPMASK(width, shift)          GENMASK(shift + width - 1, shift)
-#define CLRPMASK(width, shift)          (~SETPMASK(width, shift))
-
-#define PARM_GET(width, shift, reg)                                     \
-       (((reg) & SETPMASK(width, shift)) >> (shift))
-#define PARM_SET(width, shift, reg, val)                                \
-       (((reg) & CLRPMASK(width, shift)) | ((val) << (shift)))
-
-/* MPLL Parameters */
-
-#define SDM_DEN 16384
-#define N2_MIN  4
-#define N2_MAX  511
-
-#endif
diff --git a/drivers/clk/clk_meson_axg.c b/drivers/clk/clk_meson_axg.c
deleted file mode 100644 (file)
index 32cbf75..0000000
+++ /dev/null
@@ -1,316 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2018 - Beniamino Galvani <b.galvani@gmail.com>
- * (C) Copyright 2018 - BayLibre, SAS
- * Author: Neil Armstrong <narmstrong@baylibre.com>
- */
-
-#include <common.h>
-#include <asm/arch/clock-axg.h>
-#include <asm/io.h>
-#include <clk-uclass.h>
-#include <dm.h>
-#include <regmap.h>
-#include <syscon.h>
-#include <div64.h>
-#include <dt-bindings/clock/axg-clkc.h>
-#include "clk_meson.h"
-
-#define XTAL_RATE 24000000
-
-struct meson_clk {
-       struct regmap *map;
-};
-
-static ulong meson_clk_get_rate_by_id(struct clk *clk, unsigned long id);
-
-static struct meson_gate gates[] = {
-       /* Everything Else (EE) domain gates */
-       MESON_GATE(CLKID_SPICC0, HHI_GCLK_MPEG0, 8),
-       MESON_GATE(CLKID_I2C, HHI_GCLK_MPEG0, 9),
-       MESON_GATE(CLKID_UART0, HHI_GCLK_MPEG0, 13),
-       MESON_GATE(CLKID_SPICC1, HHI_GCLK_MPEG0, 15),
-       MESON_GATE(CLKID_SD_EMMC_B, HHI_GCLK_MPEG0, 25),
-       MESON_GATE(CLKID_SD_EMMC_C, HHI_GCLK_MPEG0, 26),
-       MESON_GATE(CLKID_ETH, HHI_GCLK_MPEG1, 3),
-       MESON_GATE(CLKID_UART1, HHI_GCLK_MPEG1, 16),
-
-       /* Always On (AO) domain gates */
-       MESON_GATE(CLKID_AO_I2C, HHI_GCLK_AO, 4),
-
-       /* PLL Gates */
-       /* CLKID_FCLK_DIV2 is critical for the SCPI Processor */
-       MESON_GATE(CLKID_MPLL2, HHI_MPLL_CNTL9, 14),
-       /* CLKID_CLK81 is critical for the system */
-
-       /* Peripheral Gates */
-       MESON_GATE(CLKID_SD_EMMC_B_CLK0, HHI_SD_EMMC_CLK_CNTL, 23),
-       MESON_GATE(CLKID_SD_EMMC_C_CLK0, HHI_NAND_CLK_CNTL, 7),
-};
-
-static int meson_set_gate(struct clk *clk, bool on)
-{
-       struct meson_clk *priv = dev_get_priv(clk->dev);
-       struct meson_gate *gate;
-
-       if (clk->id >= ARRAY_SIZE(gates))
-               return -ENOENT;
-
-       gate = &gates[clk->id];
-
-       if (gate->reg == 0)
-               return 0;
-
-       regmap_update_bits(priv->map, gate->reg,
-                          BIT(gate->bit), on ? BIT(gate->bit) : 0);
-
-       return 0;
-}
-
-static int meson_clk_enable(struct clk *clk)
-{
-       return meson_set_gate(clk, true);
-}
-
-static int meson_clk_disable(struct clk *clk)
-{
-       return meson_set_gate(clk, false);
-}
-
-static unsigned long meson_clk81_get_rate(struct clk *clk)
-{
-       struct meson_clk *priv = dev_get_priv(clk->dev);
-       unsigned long parent_rate;
-       uint reg;
-       int parents[] = {
-               -1,
-               -1,
-               CLKID_FCLK_DIV7,
-               CLKID_MPLL1,
-               CLKID_MPLL2,
-               CLKID_FCLK_DIV4,
-               CLKID_FCLK_DIV3,
-               CLKID_FCLK_DIV5
-       };
-
-       /* mux */
-       regmap_read(priv->map, HHI_MPEG_CLK_CNTL, &reg);
-       reg = (reg >> 12) & 7;
-
-       switch (reg) {
-       case 0:
-               parent_rate = XTAL_RATE;
-               break;
-       case 1:
-               return -ENOENT;
-       default:
-               parent_rate = meson_clk_get_rate_by_id(clk, parents[reg]);
-       }
-
-       /* divider */
-       regmap_read(priv->map, HHI_MPEG_CLK_CNTL, &reg);
-       reg = reg & ((1 << 7) - 1);
-
-       return parent_rate / reg;
-}
-
-static long mpll_rate_from_params(unsigned long parent_rate,
-                                 unsigned long sdm,
-                                 unsigned long n2)
-{
-       unsigned long divisor = (SDM_DEN * n2) + sdm;
-
-       if (n2 < N2_MIN)
-               return -EINVAL;
-
-       return DIV_ROUND_UP_ULL((u64)parent_rate * SDM_DEN, divisor);
-}
-
-static struct parm meson_mpll0_parm[3] = {
-       {HHI_MPLL_CNTL7, 0, 14}, /* psdm */
-       {HHI_MPLL_CNTL7, 16, 9}, /* pn2 */
-};
-
-static struct parm meson_mpll1_parm[3] = {
-       {HHI_MPLL_CNTL8, 0, 14}, /* psdm */
-       {HHI_MPLL_CNTL8, 16, 9}, /* pn2 */
-};
-
-static struct parm meson_mpll2_parm[3] = {
-       {HHI_MPLL_CNTL9, 0, 14}, /* psdm */
-       {HHI_MPLL_CNTL9, 16, 9}, /* pn2 */
-};
-
-/*
- * MultiPhase Locked Loops are outputs from a PLL with additional frequency
- * scaling capabilities. MPLL rates are calculated as:
- *
- * f(N2_integer, SDM_IN ) = 2.0G/(N2_integer + SDM_IN/16384)
- */
-static ulong meson_mpll_get_rate(struct clk *clk, unsigned long id)
-{
-       struct meson_clk *priv = dev_get_priv(clk->dev);
-       struct parm *psdm, *pn2;
-       unsigned long sdm, n2;
-       unsigned long parent_rate;
-       uint reg;
-
-       switch (id) {
-       case CLKID_MPLL0:
-               psdm = &meson_mpll0_parm[0];
-               pn2 = &meson_mpll0_parm[1];
-               break;
-       case CLKID_MPLL1:
-               psdm = &meson_mpll1_parm[0];
-               pn2 = &meson_mpll1_parm[1];
-               break;
-       case CLKID_MPLL2:
-               psdm = &meson_mpll2_parm[0];
-               pn2 = &meson_mpll2_parm[1];
-               break;
-       default:
-               return -ENOENT;
-       }
-
-       parent_rate = meson_clk_get_rate_by_id(clk, CLKID_FIXED_PLL);
-       if (IS_ERR_VALUE(parent_rate))
-               return parent_rate;
-
-       regmap_read(priv->map, psdm->reg_off, &reg);
-       sdm = PARM_GET(psdm->width, psdm->shift, reg);
-
-       regmap_read(priv->map, pn2->reg_off, &reg);
-       n2 = PARM_GET(pn2->width, pn2->shift, reg);
-
-       return mpll_rate_from_params(parent_rate, sdm, n2);
-}
-
-static struct parm meson_fixed_pll_parm[3] = {
-       {HHI_MPLL_CNTL, 0, 9}, /* pm */
-       {HHI_MPLL_CNTL, 9, 5}, /* pn */
-       {HHI_MPLL_CNTL, 16, 2}, /* pod */
-};
-
-static struct parm meson_sys_pll_parm[3] = {
-       {HHI_SYS_PLL_CNTL, 0, 9}, /* pm */
-       {HHI_SYS_PLL_CNTL, 9, 5}, /* pn */
-       {HHI_SYS_PLL_CNTL, 16, 2}, /* pod */
-};
-
-static ulong meson_pll_get_rate(struct clk *clk, unsigned long id)
-{
-       struct meson_clk *priv = dev_get_priv(clk->dev);
-       struct parm *pm, *pn, *pod;
-       unsigned long parent_rate_mhz = XTAL_RATE / 1000000;
-       u16 n, m, od;
-       uint reg;
-
-       switch (id) {
-       case CLKID_FIXED_PLL:
-               pm = &meson_fixed_pll_parm[0];
-               pn = &meson_fixed_pll_parm[1];
-               pod = &meson_fixed_pll_parm[2];
-               break;
-       case CLKID_SYS_PLL:
-               pm = &meson_sys_pll_parm[0];
-               pn = &meson_sys_pll_parm[1];
-               pod = &meson_sys_pll_parm[2];
-               break;
-       default:
-               return -ENOENT;
-       }
-
-       regmap_read(priv->map, pn->reg_off, &reg);
-       n = PARM_GET(pn->width, pn->shift, reg);
-
-       regmap_read(priv->map, pm->reg_off, &reg);
-       m = PARM_GET(pm->width, pm->shift, reg);
-
-       regmap_read(priv->map, pod->reg_off, &reg);
-       od = PARM_GET(pod->width, pod->shift, reg);
-
-       return ((parent_rate_mhz * m / n) >> od) * 1000000;
-}
-
-static ulong meson_clk_get_rate_by_id(struct clk *clk, unsigned long id)
-{
-       ulong rate;
-
-       switch (id) {
-       case CLKID_FIXED_PLL:
-       case CLKID_SYS_PLL:
-               rate = meson_pll_get_rate(clk, id);
-               break;
-       case CLKID_FCLK_DIV2:
-               rate = meson_pll_get_rate(clk, CLKID_FIXED_PLL) / 2;
-               break;
-       case CLKID_FCLK_DIV3:
-               rate = meson_pll_get_rate(clk, CLKID_FIXED_PLL) / 3;
-               break;
-       case CLKID_FCLK_DIV4:
-               rate = meson_pll_get_rate(clk, CLKID_FIXED_PLL) / 4;
-               break;
-       case CLKID_FCLK_DIV5:
-               rate = meson_pll_get_rate(clk, CLKID_FIXED_PLL) / 5;
-               break;
-       case CLKID_FCLK_DIV7:
-               rate = meson_pll_get_rate(clk, CLKID_FIXED_PLL) / 7;
-               break;
-       case CLKID_MPLL0:
-       case CLKID_MPLL1:
-       case CLKID_MPLL2:
-               rate = meson_mpll_get_rate(clk, id);
-               break;
-       case CLKID_CLK81:
-               rate = meson_clk81_get_rate(clk);
-               break;
-       default:
-               if (gates[id].reg != 0) {
-                       /* a clock gate */
-                       rate = meson_clk81_get_rate(clk);
-                       break;
-               }
-               return -ENOENT;
-       }
-
-       debug("clock %lu has rate %lu\n", id, rate);
-       return rate;
-}
-
-static ulong meson_clk_get_rate(struct clk *clk)
-{
-       return meson_clk_get_rate_by_id(clk, clk->id);
-}
-
-static int meson_clk_probe(struct udevice *dev)
-{
-       struct meson_clk *priv = dev_get_priv(dev);
-
-       priv->map = syscon_node_to_regmap(dev_get_parent(dev)->node);
-       if (IS_ERR(priv->map))
-               return PTR_ERR(priv->map);
-
-       debug("meson-clk-axg: probed\n");
-
-       return 0;
-}
-
-static struct clk_ops meson_clk_ops = {
-       .disable        = meson_clk_disable,
-       .enable         = meson_clk_enable,
-       .get_rate       = meson_clk_get_rate,
-};
-
-static const struct udevice_id meson_clk_ids[] = {
-       { .compatible = "amlogic,axg-clkc" },
-       { }
-};
-
-U_BOOT_DRIVER(meson_clk_axg) = {
-       .name           = "meson_clk_axg",
-       .id             = UCLASS_CLK,
-       .of_match       = meson_clk_ids,
-       .priv_auto_alloc_size = sizeof(struct meson_clk),
-       .ops            = &meson_clk_ops,
-       .probe          = meson_clk_probe,
-};
diff --git a/drivers/clk/meson/Kconfig b/drivers/clk/meson/Kconfig
new file mode 100644 (file)
index 0000000..994b44a
--- /dev/null
@@ -0,0 +1,23 @@
+config CLK_MESON_GX
+       bool "Enable clock support for Amlogic GX"
+       depends on CLK && ARCH_MESON
+       default MESON_GX
+       help
+         Enable clock support for the Amlogic GX SoC family, such as
+         the S905, S905X/D and S912.
+
+config CLK_MESON_AXG
+       bool "Enable clock support for Amlogic AXG"
+       depends on CLK && ARCH_MESON
+       default MESON_AXG
+       help
+         Enable clock support for the Amlogic AXG SoC family, such as
+         the A113X/D
+
+config CLK_MESON_G12A
+       bool "Enable clock support for Amlogic G12A"
+       depends on CLK && ARCH_MESON
+       default MESON_G12A
+       help
+         Enable clock support for the Amlogic G12A SoC family, such as
+         the S905X/D2
diff --git a/drivers/clk/meson/Makefile b/drivers/clk/meson/Makefile
new file mode 100644 (file)
index 0000000..c873d69
--- /dev/null
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (c) 2019 Baylibre, SAS
+# Jerome Brunet <jbrunet@baylibre.com>
+
+obj-$(CONFIG_CLK_MESON_GX) += gxbb.o
+obj-$(CONFIG_CLK_MESON_AXG) += axg.o
+obj-$(CONFIG_CLK_MESON_G12A) += g12a.o
+
diff --git a/drivers/clk/meson/axg.c b/drivers/clk/meson/axg.c
new file mode 100644 (file)
index 0000000..32cbf75
--- /dev/null
@@ -0,0 +1,316 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2018 - Beniamino Galvani <b.galvani@gmail.com>
+ * (C) Copyright 2018 - BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#include <common.h>
+#include <asm/arch/clock-axg.h>
+#include <asm/io.h>
+#include <clk-uclass.h>
+#include <dm.h>
+#include <regmap.h>
+#include <syscon.h>
+#include <div64.h>
+#include <dt-bindings/clock/axg-clkc.h>
+#include "clk_meson.h"
+
+#define XTAL_RATE 24000000
+
+struct meson_clk {
+       struct regmap *map;
+};
+
+static ulong meson_clk_get_rate_by_id(struct clk *clk, unsigned long id);
+
+static struct meson_gate gates[] = {
+       /* Everything Else (EE) domain gates */
+       MESON_GATE(CLKID_SPICC0, HHI_GCLK_MPEG0, 8),
+       MESON_GATE(CLKID_I2C, HHI_GCLK_MPEG0, 9),
+       MESON_GATE(CLKID_UART0, HHI_GCLK_MPEG0, 13),
+       MESON_GATE(CLKID_SPICC1, HHI_GCLK_MPEG0, 15),
+       MESON_GATE(CLKID_SD_EMMC_B, HHI_GCLK_MPEG0, 25),
+       MESON_GATE(CLKID_SD_EMMC_C, HHI_GCLK_MPEG0, 26),
+       MESON_GATE(CLKID_ETH, HHI_GCLK_MPEG1, 3),
+       MESON_GATE(CLKID_UART1, HHI_GCLK_MPEG1, 16),
+
+       /* Always On (AO) domain gates */
+       MESON_GATE(CLKID_AO_I2C, HHI_GCLK_AO, 4),
+
+       /* PLL Gates */
+       /* CLKID_FCLK_DIV2 is critical for the SCPI Processor */
+       MESON_GATE(CLKID_MPLL2, HHI_MPLL_CNTL9, 14),
+       /* CLKID_CLK81 is critical for the system */
+
+       /* Peripheral Gates */
+       MESON_GATE(CLKID_SD_EMMC_B_CLK0, HHI_SD_EMMC_CLK_CNTL, 23),
+       MESON_GATE(CLKID_SD_EMMC_C_CLK0, HHI_NAND_CLK_CNTL, 7),
+};
+
+static int meson_set_gate(struct clk *clk, bool on)
+{
+       struct meson_clk *priv = dev_get_priv(clk->dev);
+       struct meson_gate *gate;
+
+       if (clk->id >= ARRAY_SIZE(gates))
+               return -ENOENT;
+
+       gate = &gates[clk->id];
+
+       if (gate->reg == 0)
+               return 0;
+
+       regmap_update_bits(priv->map, gate->reg,
+                          BIT(gate->bit), on ? BIT(gate->bit) : 0);
+
+       return 0;
+}
+
+static int meson_clk_enable(struct clk *clk)
+{
+       return meson_set_gate(clk, true);
+}
+
+static int meson_clk_disable(struct clk *clk)
+{
+       return meson_set_gate(clk, false);
+}
+
+static unsigned long meson_clk81_get_rate(struct clk *clk)
+{
+       struct meson_clk *priv = dev_get_priv(clk->dev);
+       unsigned long parent_rate;
+       uint reg;
+       int parents[] = {
+               -1,
+               -1,
+               CLKID_FCLK_DIV7,
+               CLKID_MPLL1,
+               CLKID_MPLL2,
+               CLKID_FCLK_DIV4,
+               CLKID_FCLK_DIV3,
+               CLKID_FCLK_DIV5
+       };
+
+       /* mux */
+       regmap_read(priv->map, HHI_MPEG_CLK_CNTL, &reg);
+       reg = (reg >> 12) & 7;
+
+       switch (reg) {
+       case 0:
+               parent_rate = XTAL_RATE;
+               break;
+       case 1:
+               return -ENOENT;
+       default:
+               parent_rate = meson_clk_get_rate_by_id(clk, parents[reg]);
+       }
+
+       /* divider */
+       regmap_read(priv->map, HHI_MPEG_CLK_CNTL, &reg);
+       reg = reg & ((1 << 7) - 1);
+
+       return parent_rate / reg;
+}
+
+static long mpll_rate_from_params(unsigned long parent_rate,
+                                 unsigned long sdm,
+                                 unsigned long n2)
+{
+       unsigned long divisor = (SDM_DEN * n2) + sdm;
+
+       if (n2 < N2_MIN)
+               return -EINVAL;
+
+       return DIV_ROUND_UP_ULL((u64)parent_rate * SDM_DEN, divisor);
+}
+
+static struct parm meson_mpll0_parm[3] = {
+       {HHI_MPLL_CNTL7, 0, 14}, /* psdm */
+       {HHI_MPLL_CNTL7, 16, 9}, /* pn2 */
+};
+
+static struct parm meson_mpll1_parm[3] = {
+       {HHI_MPLL_CNTL8, 0, 14}, /* psdm */
+       {HHI_MPLL_CNTL8, 16, 9}, /* pn2 */
+};
+
+static struct parm meson_mpll2_parm[3] = {
+       {HHI_MPLL_CNTL9, 0, 14}, /* psdm */
+       {HHI_MPLL_CNTL9, 16, 9}, /* pn2 */
+};
+
+/*
+ * MultiPhase Locked Loops are outputs from a PLL with additional frequency
+ * scaling capabilities. MPLL rates are calculated as:
+ *
+ * f(N2_integer, SDM_IN ) = 2.0G/(N2_integer + SDM_IN/16384)
+ */
+static ulong meson_mpll_get_rate(struct clk *clk, unsigned long id)
+{
+       struct meson_clk *priv = dev_get_priv(clk->dev);
+       struct parm *psdm, *pn2;
+       unsigned long sdm, n2;
+       unsigned long parent_rate;
+       uint reg;
+
+       switch (id) {
+       case CLKID_MPLL0:
+               psdm = &meson_mpll0_parm[0];
+               pn2 = &meson_mpll0_parm[1];
+               break;
+       case CLKID_MPLL1:
+               psdm = &meson_mpll1_parm[0];
+               pn2 = &meson_mpll1_parm[1];
+               break;
+       case CLKID_MPLL2:
+               psdm = &meson_mpll2_parm[0];
+               pn2 = &meson_mpll2_parm[1];
+               break;
+       default:
+               return -ENOENT;
+       }
+
+       parent_rate = meson_clk_get_rate_by_id(clk, CLKID_FIXED_PLL);
+       if (IS_ERR_VALUE(parent_rate))
+               return parent_rate;
+
+       regmap_read(priv->map, psdm->reg_off, &reg);
+       sdm = PARM_GET(psdm->width, psdm->shift, reg);
+
+       regmap_read(priv->map, pn2->reg_off, &reg);
+       n2 = PARM_GET(pn2->width, pn2->shift, reg);
+
+       return mpll_rate_from_params(parent_rate, sdm, n2);
+}
+
+static struct parm meson_fixed_pll_parm[3] = {
+       {HHI_MPLL_CNTL, 0, 9}, /* pm */
+       {HHI_MPLL_CNTL, 9, 5}, /* pn */
+       {HHI_MPLL_CNTL, 16, 2}, /* pod */
+};
+
+static struct parm meson_sys_pll_parm[3] = {
+       {HHI_SYS_PLL_CNTL, 0, 9}, /* pm */
+       {HHI_SYS_PLL_CNTL, 9, 5}, /* pn */
+       {HHI_SYS_PLL_CNTL, 16, 2}, /* pod */
+};
+
+static ulong meson_pll_get_rate(struct clk *clk, unsigned long id)
+{
+       struct meson_clk *priv = dev_get_priv(clk->dev);
+       struct parm *pm, *pn, *pod;
+       unsigned long parent_rate_mhz = XTAL_RATE / 1000000;
+       u16 n, m, od;
+       uint reg;
+
+       switch (id) {
+       case CLKID_FIXED_PLL:
+               pm = &meson_fixed_pll_parm[0];
+               pn = &meson_fixed_pll_parm[1];
+               pod = &meson_fixed_pll_parm[2];
+               break;
+       case CLKID_SYS_PLL:
+               pm = &meson_sys_pll_parm[0];
+               pn = &meson_sys_pll_parm[1];
+               pod = &meson_sys_pll_parm[2];
+               break;
+       default:
+               return -ENOENT;
+       }
+
+       regmap_read(priv->map, pn->reg_off, &reg);
+       n = PARM_GET(pn->width, pn->shift, reg);
+
+       regmap_read(priv->map, pm->reg_off, &reg);
+       m = PARM_GET(pm->width, pm->shift, reg);
+
+       regmap_read(priv->map, pod->reg_off, &reg);
+       od = PARM_GET(pod->width, pod->shift, reg);
+
+       return ((parent_rate_mhz * m / n) >> od) * 1000000;
+}
+
+static ulong meson_clk_get_rate_by_id(struct clk *clk, unsigned long id)
+{
+       ulong rate;
+
+       switch (id) {
+       case CLKID_FIXED_PLL:
+       case CLKID_SYS_PLL:
+               rate = meson_pll_get_rate(clk, id);
+               break;
+       case CLKID_FCLK_DIV2:
+               rate = meson_pll_get_rate(clk, CLKID_FIXED_PLL) / 2;
+               break;
+       case CLKID_FCLK_DIV3:
+               rate = meson_pll_get_rate(clk, CLKID_FIXED_PLL) / 3;
+               break;
+       case CLKID_FCLK_DIV4:
+               rate = meson_pll_get_rate(clk, CLKID_FIXED_PLL) / 4;
+               break;
+       case CLKID_FCLK_DIV5:
+               rate = meson_pll_get_rate(clk, CLKID_FIXED_PLL) / 5;
+               break;
+       case CLKID_FCLK_DIV7:
+               rate = meson_pll_get_rate(clk, CLKID_FIXED_PLL) / 7;
+               break;
+       case CLKID_MPLL0:
+       case CLKID_MPLL1:
+       case CLKID_MPLL2:
+               rate = meson_mpll_get_rate(clk, id);
+               break;
+       case CLKID_CLK81:
+               rate = meson_clk81_get_rate(clk);
+               break;
+       default:
+               if (gates[id].reg != 0) {
+                       /* a clock gate */
+                       rate = meson_clk81_get_rate(clk);
+                       break;
+               }
+               return -ENOENT;
+       }
+
+       debug("clock %lu has rate %lu\n", id, rate);
+       return rate;
+}
+
+static ulong meson_clk_get_rate(struct clk *clk)
+{
+       return meson_clk_get_rate_by_id(clk, clk->id);
+}
+
+static int meson_clk_probe(struct udevice *dev)
+{
+       struct meson_clk *priv = dev_get_priv(dev);
+
+       priv->map = syscon_node_to_regmap(dev_get_parent(dev)->node);
+       if (IS_ERR(priv->map))
+               return PTR_ERR(priv->map);
+
+       debug("meson-clk-axg: probed\n");
+
+       return 0;
+}
+
+static struct clk_ops meson_clk_ops = {
+       .disable        = meson_clk_disable,
+       .enable         = meson_clk_enable,
+       .get_rate       = meson_clk_get_rate,
+};
+
+static const struct udevice_id meson_clk_ids[] = {
+       { .compatible = "amlogic,axg-clkc" },
+       { }
+};
+
+U_BOOT_DRIVER(meson_clk_axg) = {
+       .name           = "meson_clk_axg",
+       .id             = UCLASS_CLK,
+       .of_match       = meson_clk_ids,
+       .priv_auto_alloc_size = sizeof(struct meson_clk),
+       .ops            = &meson_clk_ops,
+       .probe          = meson_clk_probe,
+};
diff --git a/drivers/clk/meson/clk_meson.h b/drivers/clk/meson/clk_meson.h
new file mode 100644 (file)
index 0000000..7adc55a
--- /dev/null
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2018 - Beniamino Galvani <b.galvani@gmail.com>
+ * (C) Copyright 2018 - BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#ifndef CLK_MESON_H
+#define CLK_MESON_H
+
+/* Gate Structure */
+
+struct meson_gate {
+       unsigned int reg;
+       unsigned int bit;
+};
+
+#define MESON_GATE(id, _reg, _bit)             \
+       [id] = {                                \
+               .reg = (_reg),                  \
+               .bit = (_bit),                  \
+       }
+
+/* PLL Parameters */
+
+struct parm {
+       u16 reg_off;
+       u8 shift;
+       u8 width;
+};
+
+#define PMASK(width)                    GENMASK(width - 1, 0)
+#define SETPMASK(width, shift)          GENMASK(shift + width - 1, shift)
+#define CLRPMASK(width, shift)          (~SETPMASK(width, shift))
+
+#define PARM_GET(width, shift, reg)                                     \
+       (((reg) & SETPMASK(width, shift)) >> (shift))
+#define PARM_SET(width, shift, reg, val)                                \
+       (((reg) & CLRPMASK(width, shift)) | ((val) << (shift)))
+
+/* MPLL Parameters */
+
+#define SDM_DEN 16384
+#define N2_MIN  4
+#define N2_MAX  511
+
+#endif
diff --git a/drivers/clk/meson/g12a.c b/drivers/clk/meson/g12a.c
new file mode 100644 (file)
index 0000000..fedc9eb
--- /dev/null
@@ -0,0 +1,315 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2018 - Beniamino Galvani <b.galvani@gmail.com>
+ * (C) Copyright 2018 - BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#include <common.h>
+#include <asm/arch/clock-g12a.h>
+#include <asm/io.h>
+#include <clk-uclass.h>
+#include <dm.h>
+#include <regmap.h>
+#include <syscon.h>
+#include <div64.h>
+#include <dt-bindings/clock/g12a-clkc.h>
+#include "clk_meson.h"
+
+#define XTAL_RATE 24000000
+
+struct meson_clk {
+       struct regmap *map;
+};
+
+static ulong meson_clk_get_rate_by_id(struct clk *clk, unsigned long id);
+
+#define NUM_CLKS 178
+
+static struct meson_gate gates[NUM_CLKS] = {
+       /* Everything Else (EE) domain gates */
+       MESON_GATE(CLKID_SPICC0, HHI_GCLK_MPEG0, 8),
+       MESON_GATE(CLKID_I2C, HHI_GCLK_MPEG0, 9),
+       MESON_GATE(CLKID_UART0, HHI_GCLK_MPEG0, 13),
+       MESON_GATE(CLKID_SPICC1, HHI_GCLK_MPEG0, 14),
+       MESON_GATE(CLKID_SD_EMMC_B, HHI_GCLK_MPEG0, 25),
+       MESON_GATE(CLKID_SD_EMMC_C, HHI_GCLK_MPEG0, 26),
+       MESON_GATE(CLKID_ETH, HHI_GCLK_MPEG1, 3),
+       MESON_GATE(CLKID_UART1, HHI_GCLK_MPEG1, 16),
+
+       /* Peripheral Gates */
+       MESON_GATE(CLKID_SD_EMMC_B_CLK0, HHI_SD_EMMC_CLK_CNTL, 23),
+       MESON_GATE(CLKID_SD_EMMC_C_CLK0, HHI_NAND_CLK_CNTL, 7),
+};
+
+static int meson_set_gate(struct clk *clk, bool on)
+{
+       struct meson_clk *priv = dev_get_priv(clk->dev);
+       struct meson_gate *gate;
+
+       if (clk->id >= ARRAY_SIZE(gates))
+               return -ENOENT;
+
+       gate = &gates[clk->id];
+
+       if (gate->reg == 0)
+               return 0;
+
+       regmap_update_bits(priv->map, gate->reg,
+                          BIT(gate->bit), on ? BIT(gate->bit) : 0);
+
+       return 0;
+}
+
+static int meson_clk_enable(struct clk *clk)
+{
+       return meson_set_gate(clk, true);
+}
+
+static int meson_clk_disable(struct clk *clk)
+{
+       return meson_set_gate(clk, false);
+}
+
+static unsigned long meson_clk81_get_rate(struct clk *clk)
+{
+       struct meson_clk *priv = dev_get_priv(clk->dev);
+       unsigned long parent_rate;
+       uint reg;
+       int parents[] = {
+               -1,
+               -1,
+               CLKID_FCLK_DIV7,
+               CLKID_MPLL1,
+               CLKID_MPLL2,
+               CLKID_FCLK_DIV4,
+               CLKID_FCLK_DIV3,
+               CLKID_FCLK_DIV5
+       };
+
+       /* mux */
+       regmap_read(priv->map, HHI_MPEG_CLK_CNTL, &reg);
+       reg = (reg >> 12) & 7;
+
+       switch (reg) {
+       case 0:
+               parent_rate = XTAL_RATE;
+               break;
+       case 1:
+               return -ENOENT;
+       default:
+               parent_rate = meson_clk_get_rate_by_id(clk, parents[reg]);
+       }
+
+       /* divider */
+       regmap_read(priv->map, HHI_MPEG_CLK_CNTL, &reg);
+       reg = reg & ((1 << 7) - 1);
+
+       return parent_rate / reg;
+}
+
+static long mpll_rate_from_params(unsigned long parent_rate,
+                                 unsigned long sdm,
+                                 unsigned long n2)
+{
+       unsigned long divisor = (SDM_DEN * n2) + sdm;
+
+       if (n2 < N2_MIN)
+               return -EINVAL;
+
+       return DIV_ROUND_UP_ULL((u64)parent_rate * SDM_DEN, divisor);
+}
+
+static struct parm meson_mpll0_parm[2] = {
+       {HHI_MPLL_CNTL1, 0, 14}, /* psdm */
+       {HHI_MPLL_CNTL1, 20, 9}, /* pn2 */
+};
+
+static struct parm meson_mpll1_parm[2] = {
+       {HHI_MPLL_CNTL3, 0, 14}, /* psdm */
+       {HHI_MPLL_CNTL3, 20, 9}, /* pn2 */
+};
+
+static struct parm meson_mpll2_parm[2] = {
+       {HHI_MPLL_CNTL5, 0, 14}, /* psdm */
+       {HHI_MPLL_CNTL5, 20, 9}, /* pn2 */
+};
+
+/*
+ * MultiPhase Locked Loops are outputs from a PLL with additional frequency
+ * scaling capabilities. MPLL rates are calculated as:
+ *
+ * f(N2_integer, SDM_IN ) = 2.0G/(N2_integer + SDM_IN/16384)
+ */
+static ulong meson_mpll_get_rate(struct clk *clk, unsigned long id)
+{
+       struct meson_clk *priv = dev_get_priv(clk->dev);
+       struct parm *psdm, *pn2;
+       unsigned long sdm, n2;
+       unsigned long parent_rate;
+       uint reg;
+
+       switch (id) {
+       case CLKID_MPLL0:
+               psdm = &meson_mpll0_parm[0];
+               pn2 = &meson_mpll0_parm[1];
+               break;
+       case CLKID_MPLL1:
+               psdm = &meson_mpll1_parm[0];
+               pn2 = &meson_mpll1_parm[1];
+               break;
+       case CLKID_MPLL2:
+               psdm = &meson_mpll2_parm[0];
+               pn2 = &meson_mpll2_parm[1];
+               break;
+       default:
+               return -ENOENT;
+       }
+
+       parent_rate = meson_clk_get_rate_by_id(clk, CLKID_FIXED_PLL);
+       if (IS_ERR_VALUE(parent_rate))
+               return parent_rate;
+
+       regmap_read(priv->map, psdm->reg_off, &reg);
+       sdm = PARM_GET(psdm->width, psdm->shift, reg);
+
+       regmap_read(priv->map, pn2->reg_off, &reg);
+       n2 = PARM_GET(pn2->width, pn2->shift, reg);
+
+       return mpll_rate_from_params(parent_rate, sdm, n2);
+}
+
+static struct parm meson_fixed_pll_parm[3] = {
+       {HHI_FIX_PLL_CNTL0, 0, 8}, /* pm */
+       {HHI_FIX_PLL_CNTL0, 10, 5}, /* pn */
+       {HHI_FIX_PLL_CNTL0, 16, 2}, /* pod */
+};
+
+static struct parm meson_sys_pll_parm[3] = {
+       {HHI_SYS_PLL_CNTL0, 0, 8}, /* pm */
+       {HHI_SYS_PLL_CNTL0, 10, 5}, /* pn */
+       {HHI_SYS_PLL_CNTL0, 16, 2}, /* pod */
+};
+
+static ulong meson_pll_get_rate(struct clk *clk, unsigned long id)
+{
+       struct meson_clk *priv = dev_get_priv(clk->dev);
+       struct parm *pm, *pn, *pod;
+       unsigned long parent_rate_mhz = XTAL_RATE / 1000000;
+       u16 n, m, od;
+       uint reg;
+
+       /*
+        * FIXME: Between the unit conversion and the missing frac, we know
+        * rate will be slightly off ...
+       */
+
+       switch (id) {
+       case CLKID_FIXED_PLL:
+               pm = &meson_fixed_pll_parm[0];
+               pn = &meson_fixed_pll_parm[1];
+               pod = &meson_fixed_pll_parm[2];
+               break;
+       case CLKID_SYS_PLL:
+               pm = &meson_sys_pll_parm[0];
+               pn = &meson_sys_pll_parm[1];
+               pod = &meson_sys_pll_parm[2];
+               break;
+       default:
+               return -ENOENT;
+       }
+
+       regmap_read(priv->map, pn->reg_off, &reg);
+       n = PARM_GET(pn->width, pn->shift, reg);
+
+       regmap_read(priv->map, pm->reg_off, &reg);
+       m = PARM_GET(pm->width, pm->shift, reg);
+
+       regmap_read(priv->map, pod->reg_off, &reg);
+       od = PARM_GET(pod->width, pod->shift, reg);
+
+       return ((parent_rate_mhz * m / n) >> od) * 1000000;
+}
+
+static ulong meson_clk_get_rate_by_id(struct clk *clk, unsigned long id)
+{
+       ulong rate;
+
+       switch (id) {
+       case CLKID_FIXED_PLL:
+       case CLKID_SYS_PLL:
+               rate = meson_pll_get_rate(clk, id);
+               break;
+       case CLKID_FCLK_DIV2:
+               rate = meson_pll_get_rate(clk, CLKID_FIXED_PLL) / 2;
+               break;
+       case CLKID_FCLK_DIV3:
+               rate = meson_pll_get_rate(clk, CLKID_FIXED_PLL) / 3;
+               break;
+       case CLKID_FCLK_DIV4:
+               rate = meson_pll_get_rate(clk, CLKID_FIXED_PLL) / 4;
+               break;
+       case CLKID_FCLK_DIV5:
+               rate = meson_pll_get_rate(clk, CLKID_FIXED_PLL) / 5;
+               break;
+       case CLKID_FCLK_DIV7:
+               rate = meson_pll_get_rate(clk, CLKID_FIXED_PLL) / 7;
+               break;
+       case CLKID_MPLL0:
+       case CLKID_MPLL1:
+       case CLKID_MPLL2:
+               rate = meson_mpll_get_rate(clk, id);
+               break;
+       case CLKID_CLK81:
+               rate = meson_clk81_get_rate(clk);
+               break;
+       default:
+               if (gates[id].reg != 0) {
+                       /* a clock gate */
+                       rate = meson_clk81_get_rate(clk);
+                       break;
+               }
+               return -ENOENT;
+       }
+
+       debug("clock %lu has rate %lu\n", id, rate);
+       return rate;
+}
+
+static ulong meson_clk_get_rate(struct clk *clk)
+{
+       return meson_clk_get_rate_by_id(clk, clk->id);
+}
+
+static int meson_clk_probe(struct udevice *dev)
+{
+       struct meson_clk *priv = dev_get_priv(dev);
+
+       priv->map = syscon_node_to_regmap(dev_get_parent(dev)->node);
+       if (IS_ERR(priv->map))
+               return PTR_ERR(priv->map);
+
+       debug("meson-clk-g12a: probed\n");
+
+       return 0;
+}
+
+static struct clk_ops meson_clk_ops = {
+       .disable        = meson_clk_disable,
+       .enable         = meson_clk_enable,
+       .get_rate       = meson_clk_get_rate,
+};
+
+static const struct udevice_id meson_clk_ids[] = {
+       { .compatible = "amlogic,g12a-clkc" },
+       { }
+};
+
+U_BOOT_DRIVER(meson_clk_g12a) = {
+       .name           = "meson_clk_g12a",
+       .id             = UCLASS_CLK,
+       .of_match       = meson_clk_ids,
+       .priv_auto_alloc_size = sizeof(struct meson_clk),
+       .ops            = &meson_clk_ops,
+       .probe          = meson_clk_probe,
+};
diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c
new file mode 100644 (file)
index 0000000..2cb53fb
--- /dev/null
@@ -0,0 +1,918 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2018 - Beniamino Galvani <b.galvani@gmail.com>
+ * (C) Copyright 2018 - BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#include <common.h>
+#include <asm/arch/clock-gx.h>
+#include <asm/io.h>
+#include <clk-uclass.h>
+#include <div64.h>
+#include <dm.h>
+#include <regmap.h>
+#include <syscon.h>
+#include <dt-bindings/clock/gxbb-clkc.h>
+#include "clk_meson.h"
+
+/* This driver support only basic clock tree operations :
+ * - Can calculate clock frequency on a limited tree
+ * - Can Read muxes and basic dividers (0-based only)
+ * - Can enable/disable gates with limited propagation
+ * - Can reparent without propagation, only on muxes
+ * - Can set rates without reparenting
+ * This driver is adapted to what is actually supported by U-Boot
+ */
+
+/* Only the clocks ids we don't want to expose, such as the internal muxes
+ * and dividers of composite clocks, will remain defined here.
+ */
+#define CLKID_MPEG_SEL           10
+#define CLKID_MPEG_DIV           11
+#define CLKID_SAR_ADC_DIV        99
+#define CLKID_MALI_0_DIV         101
+#define CLKID_MALI_1_DIV         104
+#define CLKID_CTS_AMCLK_SEL      108
+#define CLKID_CTS_AMCLK_DIV      109
+#define CLKID_CTS_MCLK_I958_SEL          111
+#define CLKID_CTS_MCLK_I958_DIV          112
+#define CLKID_32K_CLK_SEL        115
+#define CLKID_32K_CLK_DIV        116
+#define CLKID_SD_EMMC_A_CLK0_SEL  117
+#define CLKID_SD_EMMC_A_CLK0_DIV  118
+#define CLKID_SD_EMMC_B_CLK0_SEL  120
+#define CLKID_SD_EMMC_B_CLK0_DIV  121
+#define CLKID_SD_EMMC_C_CLK0_SEL  123
+#define CLKID_SD_EMMC_C_CLK0_DIV  124
+#define CLKID_VPU_0_DIV                  127
+#define CLKID_VPU_1_DIV                  130
+#define CLKID_VAPB_0_DIV         134
+#define CLKID_VAPB_1_DIV         137
+#define CLKID_HDMI_PLL_PRE_MULT          141
+#define CLKID_MPLL0_DIV                  142
+#define CLKID_MPLL1_DIV                  143
+#define CLKID_MPLL2_DIV                  144
+#define CLKID_MPLL_PREDIV        145
+#define CLKID_FCLK_DIV2_DIV      146
+#define CLKID_FCLK_DIV3_DIV      147
+#define CLKID_FCLK_DIV4_DIV      148
+#define CLKID_FCLK_DIV5_DIV      149
+#define CLKID_FCLK_DIV7_DIV      150
+#define CLKID_VDEC_1_SEL         151
+#define CLKID_VDEC_1_DIV         152
+#define CLKID_VDEC_HEVC_SEL      154
+#define CLKID_VDEC_HEVC_DIV      155
+
+#define XTAL_RATE 24000000
+
+struct meson_clk {
+       struct regmap *map;
+};
+
+static ulong meson_div_get_rate(struct clk *clk, unsigned long id);
+static ulong meson_div_set_rate(struct clk *clk, unsigned long id, ulong rate,
+                               ulong current_rate);
+static ulong meson_mux_set_parent(struct clk *clk, unsigned long id,
+                                 unsigned long parent_id);
+static ulong meson_mux_get_rate(struct clk *clk, unsigned long id);
+static ulong meson_clk_set_rate_by_id(struct clk *clk, unsigned long id,
+                                     ulong rate, ulong current_rate);
+static ulong meson_mux_get_parent(struct clk *clk, unsigned long id);
+static ulong meson_clk_get_rate_by_id(struct clk *clk, unsigned long id);
+
+static struct meson_gate gates[] = {
+       /* Everything Else (EE) domain gates */
+       MESON_GATE(CLKID_DDR, HHI_GCLK_MPEG0, 0),
+       MESON_GATE(CLKID_DOS, HHI_GCLK_MPEG0, 1),
+       MESON_GATE(CLKID_ISA, HHI_GCLK_MPEG0, 5),
+       MESON_GATE(CLKID_PL301, HHI_GCLK_MPEG0, 6),
+       MESON_GATE(CLKID_PERIPHS, HHI_GCLK_MPEG0, 7),
+       MESON_GATE(CLKID_SPICC, HHI_GCLK_MPEG0, 8),
+       MESON_GATE(CLKID_I2C, HHI_GCLK_MPEG0, 9),
+       MESON_GATE(CLKID_SAR_ADC, HHI_GCLK_MPEG0, 10),
+       MESON_GATE(CLKID_SMART_CARD, HHI_GCLK_MPEG0, 11),
+       MESON_GATE(CLKID_RNG0, HHI_GCLK_MPEG0, 12),
+       MESON_GATE(CLKID_UART0, HHI_GCLK_MPEG0, 13),
+       MESON_GATE(CLKID_SDHC, HHI_GCLK_MPEG0, 14),
+       MESON_GATE(CLKID_STREAM, HHI_GCLK_MPEG0, 15),
+       MESON_GATE(CLKID_ASYNC_FIFO, HHI_GCLK_MPEG0, 16),
+       MESON_GATE(CLKID_SDIO, HHI_GCLK_MPEG0, 17),
+       MESON_GATE(CLKID_ABUF, HHI_GCLK_MPEG0, 18),
+       MESON_GATE(CLKID_HIU_IFACE, HHI_GCLK_MPEG0, 19),
+       MESON_GATE(CLKID_ASSIST_MISC, HHI_GCLK_MPEG0, 23),
+       MESON_GATE(CLKID_SD_EMMC_A, HHI_GCLK_MPEG0, 24),
+       MESON_GATE(CLKID_SD_EMMC_B, HHI_GCLK_MPEG0, 25),
+       MESON_GATE(CLKID_SD_EMMC_C, HHI_GCLK_MPEG0, 26),
+       MESON_GATE(CLKID_SPI, HHI_GCLK_MPEG0, 30),
+
+       MESON_GATE(CLKID_I2S_SPDIF, HHI_GCLK_MPEG1, 2),
+       MESON_GATE(CLKID_ETH, HHI_GCLK_MPEG1, 3),
+       MESON_GATE(CLKID_DEMUX, HHI_GCLK_MPEG1, 4),
+       MESON_GATE(CLKID_AIU_GLUE, HHI_GCLK_MPEG1, 6),
+       MESON_GATE(CLKID_IEC958, HHI_GCLK_MPEG1, 7),
+       MESON_GATE(CLKID_I2S_OUT, HHI_GCLK_MPEG1, 8),
+       MESON_GATE(CLKID_AMCLK, HHI_GCLK_MPEG1, 9),
+       MESON_GATE(CLKID_AIFIFO2, HHI_GCLK_MPEG1, 10),
+       MESON_GATE(CLKID_MIXER, HHI_GCLK_MPEG1, 11),
+       MESON_GATE(CLKID_MIXER_IFACE, HHI_GCLK_MPEG1, 12),
+       MESON_GATE(CLKID_ADC, HHI_GCLK_MPEG1, 13),
+       MESON_GATE(CLKID_BLKMV, HHI_GCLK_MPEG1, 14),
+       MESON_GATE(CLKID_AIU, HHI_GCLK_MPEG1, 15),
+       MESON_GATE(CLKID_UART1, HHI_GCLK_MPEG1, 16),
+       MESON_GATE(CLKID_G2D, HHI_GCLK_MPEG1, 20),
+       MESON_GATE(CLKID_USB0, HHI_GCLK_MPEG1, 21),
+       MESON_GATE(CLKID_USB1, HHI_GCLK_MPEG1, 22),
+       MESON_GATE(CLKID_RESET, HHI_GCLK_MPEG1, 23),
+       MESON_GATE(CLKID_NAND, HHI_GCLK_MPEG1, 24),
+       MESON_GATE(CLKID_DOS_PARSER, HHI_GCLK_MPEG1, 25),
+       MESON_GATE(CLKID_USB, HHI_GCLK_MPEG1, 26),
+       MESON_GATE(CLKID_VDIN1, HHI_GCLK_MPEG1, 28),
+       MESON_GATE(CLKID_AHB_ARB0, HHI_GCLK_MPEG1, 29),
+       MESON_GATE(CLKID_EFUSE, HHI_GCLK_MPEG1, 30),
+       MESON_GATE(CLKID_BOOT_ROM, HHI_GCLK_MPEG1, 31),
+
+       MESON_GATE(CLKID_AHB_DATA_BUS, HHI_GCLK_MPEG2, 1),
+       MESON_GATE(CLKID_AHB_CTRL_BUS, HHI_GCLK_MPEG2, 2),
+       MESON_GATE(CLKID_HDMI_INTR_SYNC, HHI_GCLK_MPEG2, 3),
+       MESON_GATE(CLKID_HDMI_PCLK, HHI_GCLK_MPEG2, 4),
+       MESON_GATE(CLKID_USB1_DDR_BRIDGE, HHI_GCLK_MPEG2, 8),
+       MESON_GATE(CLKID_USB0_DDR_BRIDGE, HHI_GCLK_MPEG2, 9),
+       MESON_GATE(CLKID_MMC_PCLK, HHI_GCLK_MPEG2, 11),
+       MESON_GATE(CLKID_DVIN, HHI_GCLK_MPEG2, 12),
+       MESON_GATE(CLKID_UART2, HHI_GCLK_MPEG2, 15),
+       MESON_GATE(CLKID_SANA, HHI_GCLK_MPEG2, 22),
+       MESON_GATE(CLKID_VPU_INTR, HHI_GCLK_MPEG2, 25),
+       MESON_GATE(CLKID_SEC_AHB_AHB3_BRIDGE, HHI_GCLK_MPEG2, 26),
+       MESON_GATE(CLKID_CLK81_A53, HHI_GCLK_MPEG2, 29),
+
+       MESON_GATE(CLKID_VCLK2_VENCI0, HHI_GCLK_OTHER, 1),
+       MESON_GATE(CLKID_VCLK2_VENCI1, HHI_GCLK_OTHER, 2),
+       MESON_GATE(CLKID_VCLK2_VENCP0, HHI_GCLK_OTHER, 3),
+       MESON_GATE(CLKID_VCLK2_VENCP1, HHI_GCLK_OTHER, 4),
+       MESON_GATE(CLKID_GCLK_VENCI_INT0, HHI_GCLK_OTHER, 8),
+       MESON_GATE(CLKID_DAC_CLK, HHI_GCLK_OTHER, 10),
+       MESON_GATE(CLKID_AOCLK_GATE, HHI_GCLK_OTHER, 14),
+       MESON_GATE(CLKID_IEC958_GATE, HHI_GCLK_OTHER, 16),
+       MESON_GATE(CLKID_ENC480P, HHI_GCLK_OTHER, 20),
+       MESON_GATE(CLKID_RNG1, HHI_GCLK_OTHER, 21),
+       MESON_GATE(CLKID_GCLK_VENCI_INT1, HHI_GCLK_OTHER, 22),
+       MESON_GATE(CLKID_VCLK2_VENCLMCC, HHI_GCLK_OTHER, 24),
+       MESON_GATE(CLKID_VCLK2_VENCL, HHI_GCLK_OTHER, 25),
+       MESON_GATE(CLKID_VCLK_OTHER, HHI_GCLK_OTHER, 26),
+       MESON_GATE(CLKID_EDP, HHI_GCLK_OTHER, 31),
+
+       /* Always On (AO) domain gates */
+       MESON_GATE(CLKID_AO_MEDIA_CPU, HHI_GCLK_AO, 0),
+       MESON_GATE(CLKID_AO_AHB_SRAM, HHI_GCLK_AO, 1),
+       MESON_GATE(CLKID_AO_AHB_BUS, HHI_GCLK_AO, 2),
+       MESON_GATE(CLKID_AO_IFACE, HHI_GCLK_AO, 3),
+       MESON_GATE(CLKID_AO_I2C, HHI_GCLK_AO, 4),
+
+       /* PLL Gates */
+       /* CLKID_FCLK_DIV2 is critical for the SCPI Processor */
+       MESON_GATE(CLKID_FCLK_DIV3, HHI_MPLL_CNTL6, 28),
+       MESON_GATE(CLKID_FCLK_DIV4, HHI_MPLL_CNTL6, 29),
+       MESON_GATE(CLKID_FCLK_DIV5, HHI_MPLL_CNTL6, 30),
+       MESON_GATE(CLKID_FCLK_DIV7, HHI_MPLL_CNTL6, 31),
+       MESON_GATE(CLKID_MPLL0, HHI_MPLL_CNTL7, 14),
+       MESON_GATE(CLKID_MPLL1, HHI_MPLL_CNTL8, 14),
+       MESON_GATE(CLKID_MPLL2, HHI_MPLL_CNTL9, 14),
+       /* CLKID_CLK81 is critical for the system */
+
+       /* Peripheral Gates */
+       MESON_GATE(CLKID_SAR_ADC_CLK, HHI_SAR_CLK_CNTL, 8),
+       MESON_GATE(CLKID_SD_EMMC_A_CLK0, HHI_SD_EMMC_CLK_CNTL, 7),
+       MESON_GATE(CLKID_SD_EMMC_B_CLK0, HHI_SD_EMMC_CLK_CNTL, 23),
+       MESON_GATE(CLKID_SD_EMMC_C_CLK0, HHI_NAND_CLK_CNTL, 7),
+       MESON_GATE(CLKID_VPU_0, HHI_VPU_CLK_CNTL, 8),
+       MESON_GATE(CLKID_VPU_1, HHI_VPU_CLK_CNTL, 24),
+       MESON_GATE(CLKID_VAPB_0, HHI_VAPBCLK_CNTL, 8),
+       MESON_GATE(CLKID_VAPB_1, HHI_VAPBCLK_CNTL, 24),
+       MESON_GATE(CLKID_VAPB, HHI_VAPBCLK_CNTL, 30),
+};
+
+static int meson_set_gate_by_id(struct clk *clk, unsigned long id, bool on)
+{
+       struct meson_clk *priv = dev_get_priv(clk->dev);
+       struct meson_gate *gate;
+
+       debug("%s: %sabling %ld\n", __func__, on ? "en" : "dis", id);
+
+       /* Propagate through muxes */
+       switch (id) {
+       case CLKID_VPU:
+               return meson_set_gate_by_id(clk,
+                               meson_mux_get_parent(clk, CLKID_VPU), on);
+       case CLKID_VAPB_SEL:
+               return meson_set_gate_by_id(clk,
+                               meson_mux_get_parent(clk, CLKID_VAPB_SEL), on);
+       }
+
+       if (id >= ARRAY_SIZE(gates))
+               return -ENOENT;
+
+       gate = &gates[id];
+
+       if (gate->reg == 0)
+               return 0;
+
+       debug("%s: really %sabling %ld\n", __func__, on ? "en" : "dis", id);
+
+       regmap_update_bits(priv->map, gate->reg,
+                          BIT(gate->bit), on ? BIT(gate->bit) : 0);
+
+       /* Propagate to next gate(s) */
+       switch (id) {
+       case CLKID_VAPB:
+               return meson_set_gate_by_id(clk, CLKID_VAPB_SEL, on);
+       }
+
+       return 0;
+}
+
+static int meson_clk_enable(struct clk *clk)
+{
+       return meson_set_gate_by_id(clk, clk->id, true);
+}
+
+static int meson_clk_disable(struct clk *clk)
+{
+       return meson_set_gate_by_id(clk, clk->id, false);
+}
+
+static struct parm meson_vpu_0_div_parm = {
+       HHI_VPU_CLK_CNTL, 0, 7,
+};
+
+int meson_vpu_0_div_parent = CLKID_VPU_0_SEL;
+
+static struct parm meson_vpu_1_div_parm = {
+       HHI_VPU_CLK_CNTL, 16, 7,
+};
+
+int meson_vpu_1_div_parent = CLKID_VPU_1_SEL;
+
+static struct parm meson_vapb_0_div_parm = {
+       HHI_VAPBCLK_CNTL, 0, 7,
+};
+
+int meson_vapb_0_div_parent = CLKID_VAPB_0_SEL;
+
+static struct parm meson_vapb_1_div_parm = {
+       HHI_VAPBCLK_CNTL, 16, 7,
+};
+
+int meson_vapb_1_div_parent = CLKID_VAPB_1_SEL;
+
+static ulong meson_div_get_rate(struct clk *clk, unsigned long id)
+{
+       struct meson_clk *priv = dev_get_priv(clk->dev);
+       unsigned int rate, parent_rate;
+       struct parm *parm;
+       int parent;
+       uint reg;
+
+       switch (id) {
+       case CLKID_VPU_0_DIV:
+               parm = &meson_vpu_0_div_parm;
+               parent = meson_vpu_0_div_parent;
+               break;
+       case CLKID_VPU_1_DIV:
+               parm = &meson_vpu_1_div_parm;
+               parent = meson_vpu_1_div_parent;
+               break;
+       case CLKID_VAPB_0_DIV:
+               parm = &meson_vapb_0_div_parm;
+               parent = meson_vapb_0_div_parent;
+               break;
+       case CLKID_VAPB_1_DIV:
+               parm = &meson_vapb_1_div_parm;
+               parent = meson_vapb_1_div_parent;
+               break;
+       default:
+               return -ENOENT;
+       }
+
+       regmap_read(priv->map, parm->reg_off, &reg);
+       reg = PARM_GET(parm->width, parm->shift, reg);
+
+       debug("%s: div of %ld is %d\n", __func__, id, reg + 1);
+
+       parent_rate = meson_clk_get_rate_by_id(clk, parent);
+       if (IS_ERR_VALUE(parent_rate))
+               return parent_rate;
+
+       debug("%s: parent rate of %ld is %d\n", __func__, id, parent_rate);
+
+       rate = parent_rate / (reg + 1);
+
+       debug("%s: rate of %ld is %d\n", __func__, id, rate);
+
+       return rate;
+}
+
+static ulong meson_div_set_rate(struct clk *clk, unsigned long id, ulong rate,
+                               ulong current_rate)
+{
+       struct meson_clk *priv = dev_get_priv(clk->dev);
+       unsigned int new_div = -EINVAL;
+       unsigned long parent_rate;
+       struct parm *parm;
+       int parent;
+       int ret;
+
+       if (current_rate == rate)
+               return 0;
+
+       debug("%s: setting rate of %ld from %ld to %ld\n",
+             __func__, id, current_rate, rate);
+
+       switch (id) {
+       case CLKID_VPU_0_DIV:
+               parm = &meson_vpu_0_div_parm;
+               parent = meson_vpu_0_div_parent;
+               break;
+       case CLKID_VPU_1_DIV:
+               parm = &meson_vpu_1_div_parm;
+               parent = meson_vpu_1_div_parent;
+               break;
+       case CLKID_VAPB_0_DIV:
+               parm = &meson_vapb_0_div_parm;
+               parent = meson_vapb_0_div_parent;
+               break;
+       case CLKID_VAPB_1_DIV:
+               parm = &meson_vapb_1_div_parm;
+               parent = meson_vapb_1_div_parent;
+               break;
+       default:
+               return -ENOENT;
+       }
+
+       parent_rate = meson_clk_get_rate_by_id(clk, parent);
+       if (IS_ERR_VALUE(parent_rate))
+               return parent_rate;
+
+       debug("%s: parent rate of %ld is %ld\n", __func__, id, parent_rate);
+
+       /* If can't divide, set parent instead */
+       if (!parent_rate || rate > parent_rate)
+               return meson_clk_set_rate_by_id(clk, parent, rate,
+                                               current_rate);
+
+       new_div = DIV_ROUND_CLOSEST(parent_rate, rate);
+
+       debug("%s: new div of %ld is %d\n", __func__, id, new_div);
+
+       /* If overflow, try to set parent rate and retry */
+       if (!new_div || new_div > (1 << parm->width)) {
+               ret = meson_clk_set_rate_by_id(clk, parent, rate, current_rate);
+               if (IS_ERR_VALUE(ret))
+                       return ret;
+
+               parent_rate = meson_clk_get_rate_by_id(clk, parent);
+               if (IS_ERR_VALUE(parent_rate))
+                       return parent_rate;
+
+               new_div = DIV_ROUND_CLOSEST(parent_rate, rate);
+
+               debug("%s: new new div of %ld is %d\n", __func__, id, new_div);
+
+               if (!new_div || new_div > (1 << parm->width))
+                       return -EINVAL;
+       }
+
+       debug("%s: setting div of %ld to %d\n", __func__, id, new_div);
+
+       regmap_update_bits(priv->map, parm->reg_off, SETPMASK(parm->width, parm->shift),
+                          (new_div - 1) << parm->shift);
+
+       debug("%s: new rate of %ld is %ld\n",
+             __func__, id, meson_div_get_rate(clk, id));
+
+       return 0;
+}
+
+static struct parm meson_vpu_mux_parm = {
+       HHI_VPU_CLK_CNTL, 31, 1,
+};
+
+int meson_vpu_mux_parents[] = {
+       CLKID_VPU_0,
+       CLKID_VPU_1,
+};
+
+static struct parm meson_vpu_0_mux_parm = {
+       HHI_VPU_CLK_CNTL, 9, 2,
+};
+
+static struct parm meson_vpu_1_mux_parm = {
+       HHI_VPU_CLK_CNTL, 25, 2,
+};
+
+static int meson_vpu_0_1_mux_parents[] = {
+       CLKID_FCLK_DIV4,
+       CLKID_FCLK_DIV3,
+       CLKID_FCLK_DIV5,
+       CLKID_FCLK_DIV7,
+};
+
+static struct parm meson_vapb_sel_mux_parm = {
+       HHI_VAPBCLK_CNTL, 31, 1,
+};
+
+int meson_vapb_sel_mux_parents[] = {
+       CLKID_VAPB_0,
+       CLKID_VAPB_1,
+};
+
+static struct parm meson_vapb_0_mux_parm = {
+       HHI_VAPBCLK_CNTL, 9, 2,
+};
+
+static struct parm meson_vapb_1_mux_parm = {
+       HHI_VAPBCLK_CNTL, 25, 2,
+};
+
+static int meson_vapb_0_1_mux_parents[] = {
+       CLKID_FCLK_DIV4,
+       CLKID_FCLK_DIV3,
+       CLKID_FCLK_DIV5,
+       CLKID_FCLK_DIV7,
+};
+
+static ulong meson_mux_get_parent(struct clk *clk, unsigned long id)
+{
+       struct meson_clk *priv = dev_get_priv(clk->dev);
+       struct parm *parm;
+       int *parents;
+       uint reg;
+
+       switch (id) {
+       case CLKID_VPU:
+               parm = &meson_vpu_mux_parm;
+               parents = meson_vpu_mux_parents;
+               break;
+       case CLKID_VPU_0_SEL:
+               parm = &meson_vpu_0_mux_parm;
+               parents = meson_vpu_0_1_mux_parents;
+               break;
+       case CLKID_VPU_1_SEL:
+               parm = &meson_vpu_1_mux_parm;
+               parents = meson_vpu_0_1_mux_parents;
+               break;
+       case CLKID_VAPB_SEL:
+               parm = &meson_vapb_sel_mux_parm;
+               parents = meson_vapb_sel_mux_parents;
+               break;
+       case CLKID_VAPB_0_SEL:
+               parm = &meson_vapb_0_mux_parm;
+               parents = meson_vapb_0_1_mux_parents;
+               break;
+       case CLKID_VAPB_1_SEL:
+               parm = &meson_vapb_1_mux_parm;
+               parents = meson_vapb_0_1_mux_parents;
+               break;
+       default:
+               return -ENOENT;
+       }
+
+       regmap_read(priv->map, parm->reg_off, &reg);
+       reg = PARM_GET(parm->width, parm->shift, reg);
+
+       debug("%s: parent of %ld is %d (%d)\n",
+             __func__, id, parents[reg], reg);
+
+       return parents[reg];
+}
+
+static ulong meson_mux_set_parent(struct clk *clk, unsigned long id,
+                                 unsigned long parent_id)
+{
+       unsigned long cur_parent = meson_mux_get_parent(clk, id);
+       struct meson_clk *priv = dev_get_priv(clk->dev);
+       unsigned int new_index = -EINVAL;
+       struct parm *parm;
+       int *parents;
+       int i;
+
+       if (IS_ERR_VALUE(cur_parent))
+               return cur_parent;
+
+       debug("%s: setting parent of %ld from %ld to %ld\n",
+             __func__, id, cur_parent, parent_id);
+
+       if (cur_parent == parent_id)
+               return 0;
+
+       switch (id) {
+       case CLKID_VPU:
+               parm = &meson_vpu_mux_parm;
+               parents = meson_vpu_mux_parents;
+               break;
+       case CLKID_VPU_0_SEL:
+               parm = &meson_vpu_0_mux_parm;
+               parents = meson_vpu_0_1_mux_parents;
+               break;
+       case CLKID_VPU_1_SEL:
+               parm = &meson_vpu_1_mux_parm;
+               parents = meson_vpu_0_1_mux_parents;
+               break;
+       case CLKID_VAPB_SEL:
+               parm = &meson_vapb_sel_mux_parm;
+               parents = meson_vapb_sel_mux_parents;
+               break;
+       case CLKID_VAPB_0_SEL:
+               parm = &meson_vapb_0_mux_parm;
+               parents = meson_vapb_0_1_mux_parents;
+               break;
+       case CLKID_VAPB_1_SEL:
+               parm = &meson_vapb_1_mux_parm;
+               parents = meson_vapb_0_1_mux_parents;
+               break;
+       default:
+               /* Not a mux */
+               return -ENOENT;
+       }
+
+       for (i = 0 ; i < (1 << parm->width) ; ++i) {
+               if (parents[i] == parent_id)
+                       new_index = i;
+       }
+
+       if (IS_ERR_VALUE(new_index))
+               return new_index;
+
+       debug("%s: new index of %ld is %d\n", __func__, id, new_index);
+
+       regmap_update_bits(priv->map, parm->reg_off, SETPMASK(parm->width, parm->shift),
+                          new_index << parm->shift);
+
+       debug("%s: new parent of %ld is %ld\n",
+             __func__, id, meson_mux_get_parent(clk, id));
+
+       return 0;
+}
+
+static ulong meson_mux_get_rate(struct clk *clk, unsigned long id)
+{
+       int parent = meson_mux_get_parent(clk, id);
+
+       if (IS_ERR_VALUE(parent))
+               return parent;
+
+       return meson_clk_get_rate_by_id(clk, parent);
+}
+
+static unsigned long meson_clk81_get_rate(struct clk *clk)
+{
+       struct meson_clk *priv = dev_get_priv(clk->dev);
+       unsigned long parent_rate;
+       uint reg;
+       int parents[] = {
+               -1,
+               -1,
+               CLKID_FCLK_DIV7,
+               CLKID_MPLL1,
+               CLKID_MPLL2,
+               CLKID_FCLK_DIV4,
+               CLKID_FCLK_DIV3,
+               CLKID_FCLK_DIV5
+       };
+
+       /* mux */
+       regmap_read(priv->map, HHI_MPEG_CLK_CNTL, &reg);
+       reg = (reg >> 12) & 7;
+
+       switch (reg) {
+       case 0:
+               parent_rate = XTAL_RATE;
+               break;
+       case 1:
+               return -ENOENT;
+       default:
+               parent_rate = meson_clk_get_rate_by_id(clk, parents[reg]);
+       }
+
+       /* divider */
+       regmap_read(priv->map, HHI_MPEG_CLK_CNTL, &reg);
+       reg = reg & ((1 << 7) - 1);
+
+       /* clk81 divider is zero based */
+       return parent_rate / (reg + 1);
+}
+
+static long mpll_rate_from_params(unsigned long parent_rate,
+                                 unsigned long sdm,
+                                 unsigned long n2)
+{
+       unsigned long divisor = (SDM_DEN * n2) + sdm;
+
+       if (n2 < N2_MIN)
+               return -EINVAL;
+
+       return DIV_ROUND_UP_ULL((u64)parent_rate * SDM_DEN, divisor);
+}
+
+static struct parm meson_mpll0_parm[3] = {
+       {HHI_MPLL_CNTL7, 0, 14}, /* psdm */
+       {HHI_MPLL_CNTL7, 16, 9}, /* pn2 */
+};
+
+static struct parm meson_mpll1_parm[3] = {
+       {HHI_MPLL_CNTL8, 0, 14}, /* psdm */
+       {HHI_MPLL_CNTL8, 16, 9}, /* pn2 */
+};
+
+static struct parm meson_mpll2_parm[3] = {
+       {HHI_MPLL_CNTL9, 0, 14}, /* psdm */
+       {HHI_MPLL_CNTL9, 16, 9}, /* pn2 */
+};
+
+/*
+ * MultiPhase Locked Loops are outputs from a PLL with additional frequency
+ * scaling capabilities. MPLL rates are calculated as:
+ *
+ * f(N2_integer, SDM_IN ) = 2.0G/(N2_integer + SDM_IN/16384)
+ */
+static ulong meson_mpll_get_rate(struct clk *clk, unsigned long id)
+{
+       struct meson_clk *priv = dev_get_priv(clk->dev);
+       struct parm *psdm, *pn2;
+       unsigned long sdm, n2;
+       unsigned long parent_rate;
+       uint reg;
+
+       switch (id) {
+       case CLKID_MPLL0:
+               psdm = &meson_mpll0_parm[0];
+               pn2 = &meson_mpll0_parm[1];
+               break;
+       case CLKID_MPLL1:
+               psdm = &meson_mpll1_parm[0];
+               pn2 = &meson_mpll1_parm[1];
+               break;
+       case CLKID_MPLL2:
+               psdm = &meson_mpll2_parm[0];
+               pn2 = &meson_mpll2_parm[1];
+               break;
+       default:
+               return -ENOENT;
+       }
+
+       parent_rate = meson_clk_get_rate_by_id(clk, CLKID_FIXED_PLL);
+       if (IS_ERR_VALUE(parent_rate))
+               return parent_rate;
+
+       regmap_read(priv->map, psdm->reg_off, &reg);
+       sdm = PARM_GET(psdm->width, psdm->shift, reg);
+
+       regmap_read(priv->map, pn2->reg_off, &reg);
+       n2 = PARM_GET(pn2->width, pn2->shift, reg);
+
+       return mpll_rate_from_params(parent_rate, sdm, n2);
+}
+
+static struct parm meson_fixed_pll_parm[3] = {
+       {HHI_MPLL_CNTL, 0, 9}, /* pm */
+       {HHI_MPLL_CNTL, 9, 5}, /* pn */
+       {HHI_MPLL_CNTL, 16, 2}, /* pod */
+};
+
+static struct parm meson_sys_pll_parm[3] = {
+       {HHI_SYS_PLL_CNTL, 0, 9}, /* pm */
+       {HHI_SYS_PLL_CNTL, 9, 5}, /* pn */
+       {HHI_SYS_PLL_CNTL, 10, 2}, /* pod */
+};
+
+static ulong meson_pll_get_rate(struct clk *clk, unsigned long id)
+{
+       struct meson_clk *priv = dev_get_priv(clk->dev);
+       struct parm *pm, *pn, *pod;
+       unsigned long parent_rate_mhz = XTAL_RATE / 1000000;
+       u16 n, m, od;
+       uint reg;
+
+       switch (id) {
+       case CLKID_FIXED_PLL:
+               pm = &meson_fixed_pll_parm[0];
+               pn = &meson_fixed_pll_parm[1];
+               pod = &meson_fixed_pll_parm[2];
+               break;
+       case CLKID_SYS_PLL:
+               pm = &meson_sys_pll_parm[0];
+               pn = &meson_sys_pll_parm[1];
+               pod = &meson_sys_pll_parm[2];
+               break;
+       default:
+               return -ENOENT;
+       }
+
+       regmap_read(priv->map, pn->reg_off, &reg);
+       n = PARM_GET(pn->width, pn->shift, reg);
+
+       regmap_read(priv->map, pm->reg_off, &reg);
+       m = PARM_GET(pm->width, pm->shift, reg);
+
+       regmap_read(priv->map, pod->reg_off, &reg);
+       od = PARM_GET(pod->width, pod->shift, reg);
+
+       return ((parent_rate_mhz * m / n) >> od) * 1000000;
+}
+
+static ulong meson_clk_get_rate_by_id(struct clk *clk, unsigned long id)
+{
+       ulong rate;
+
+       switch (id) {
+       case CLKID_FIXED_PLL:
+       case CLKID_SYS_PLL:
+               rate = meson_pll_get_rate(clk, id);
+               break;
+       case CLKID_FCLK_DIV2:
+               rate = meson_pll_get_rate(clk, CLKID_FIXED_PLL) / 2;
+               break;
+       case CLKID_FCLK_DIV3:
+               rate = meson_pll_get_rate(clk, CLKID_FIXED_PLL) / 3;
+               break;
+       case CLKID_FCLK_DIV4:
+               rate = meson_pll_get_rate(clk, CLKID_FIXED_PLL) / 4;
+               break;
+       case CLKID_FCLK_DIV5:
+               rate = meson_pll_get_rate(clk, CLKID_FIXED_PLL) / 5;
+               break;
+       case CLKID_FCLK_DIV7:
+               rate = meson_pll_get_rate(clk, CLKID_FIXED_PLL) / 7;
+               break;
+       case CLKID_MPLL0:
+       case CLKID_MPLL1:
+       case CLKID_MPLL2:
+               rate = meson_mpll_get_rate(clk, id);
+               break;
+       case CLKID_CLK81:
+               rate = meson_clk81_get_rate(clk);
+               break;
+       case CLKID_VPU_0:
+               rate = meson_div_get_rate(clk, CLKID_VPU_0_DIV);
+               break;
+       case CLKID_VPU_1:
+               rate = meson_div_get_rate(clk, CLKID_VPU_1_DIV);
+               break;
+       case CLKID_VAPB:
+               rate = meson_mux_get_rate(clk, CLKID_VAPB_SEL);
+               break;
+       case CLKID_VAPB_0:
+               rate = meson_div_get_rate(clk, CLKID_VAPB_0_DIV);
+               break;
+       case CLKID_VAPB_1:
+               rate = meson_div_get_rate(clk, CLKID_VAPB_1_DIV);
+               break;
+       case CLKID_VPU_0_DIV:
+       case CLKID_VPU_1_DIV:
+       case CLKID_VAPB_0_DIV:
+       case CLKID_VAPB_1_DIV:
+               rate = meson_div_get_rate(clk, id);
+               break;
+       case CLKID_VPU:
+       case CLKID_VPU_0_SEL:
+       case CLKID_VPU_1_SEL:
+       case CLKID_VAPB_SEL:
+       case CLKID_VAPB_0_SEL:
+       case CLKID_VAPB_1_SEL:
+               rate = meson_mux_get_rate(clk, id);
+               break;
+       default:
+               if (gates[id].reg != 0) {
+                       /* a clock gate */
+                       rate = meson_clk81_get_rate(clk);
+                       break;
+               }
+               return -ENOENT;
+       }
+
+       debug("clock %lu has rate %lu\n", id, rate);
+       return rate;
+}
+
+static ulong meson_clk_get_rate(struct clk *clk)
+{
+       return meson_clk_get_rate_by_id(clk, clk->id);
+}
+
+static int meson_clk_set_parent(struct clk *clk, struct clk *parent)
+{
+       return meson_mux_set_parent(clk, clk->id, parent->id);
+}
+
+static ulong meson_clk_set_rate_by_id(struct clk *clk, unsigned long id,
+                                     ulong rate, ulong current_rate)
+{
+       if (current_rate == rate)
+               return 0;
+
+       switch (id) {
+       /* Fixed clocks */
+       case CLKID_FIXED_PLL:
+       case CLKID_SYS_PLL:
+       case CLKID_FCLK_DIV2:
+       case CLKID_FCLK_DIV3:
+       case CLKID_FCLK_DIV4:
+       case CLKID_FCLK_DIV5:
+       case CLKID_FCLK_DIV7:
+       case CLKID_MPLL0:
+       case CLKID_MPLL1:
+       case CLKID_MPLL2:
+       case CLKID_CLK81:
+               if (current_rate != rate)
+                       return -EINVAL;
+
+               return 0;
+       case CLKID_VPU:
+               return meson_clk_set_rate_by_id(clk,
+                               meson_mux_get_parent(clk, CLKID_VPU), rate,
+                                                    current_rate);
+       case CLKID_VAPB:
+       case CLKID_VAPB_SEL:
+               return meson_clk_set_rate_by_id(clk,
+                               meson_mux_get_parent(clk, CLKID_VAPB_SEL),
+                               rate, current_rate);
+       case CLKID_VPU_0:
+               return meson_div_set_rate(clk, CLKID_VPU_0_DIV, rate,
+                                         current_rate);
+       case CLKID_VPU_1:
+               return meson_div_set_rate(clk, CLKID_VPU_1_DIV, rate,
+                                         current_rate);
+       case CLKID_VAPB_0:
+               return meson_div_set_rate(clk, CLKID_VAPB_0_DIV, rate,
+                                         current_rate);
+       case CLKID_VAPB_1:
+               return meson_div_set_rate(clk, CLKID_VAPB_1_DIV, rate,
+                                         current_rate);
+       case CLKID_VPU_0_DIV:
+       case CLKID_VPU_1_DIV:
+       case CLKID_VAPB_0_DIV:
+       case CLKID_VAPB_1_DIV:
+               return meson_div_set_rate(clk, id, rate, current_rate);
+       default:
+               return -ENOENT;
+       }
+
+       return -EINVAL;
+}
+
+static ulong meson_clk_set_rate(struct clk *clk, ulong rate)
+{
+       ulong current_rate = meson_clk_get_rate_by_id(clk, clk->id);
+       int ret;
+
+       if (IS_ERR_VALUE(current_rate))
+               return current_rate;
+
+       debug("%s: setting rate of %ld from %ld to %ld\n",
+             __func__, clk->id, current_rate, rate);
+
+       ret = meson_clk_set_rate_by_id(clk, clk->id, rate, current_rate);
+       if (IS_ERR_VALUE(ret))
+               return ret;
+
+       debug("clock %lu has new rate %lu\n", clk->id,
+             meson_clk_get_rate_by_id(clk, clk->id));
+
+       return 0;
+}
+
+static int meson_clk_probe(struct udevice *dev)
+{
+       struct meson_clk *priv = dev_get_priv(dev);
+
+       priv->map = syscon_node_to_regmap(dev_get_parent(dev)->node);
+       if (IS_ERR(priv->map))
+               return PTR_ERR(priv->map);
+
+       debug("meson-clk: probed\n");
+
+       return 0;
+}
+
+static struct clk_ops meson_clk_ops = {
+       .disable        = meson_clk_disable,
+       .enable         = meson_clk_enable,
+       .get_rate       = meson_clk_get_rate,
+       .set_parent     = meson_clk_set_parent,
+       .set_rate       = meson_clk_set_rate,
+};
+
+static const struct udevice_id meson_clk_ids[] = {
+       { .compatible = "amlogic,gxbb-clkc" },
+       { .compatible = "amlogic,gxl-clkc" },
+       { }
+};
+
+U_BOOT_DRIVER(meson_clk) = {
+       .name           = "meson_clk",
+       .id             = UCLASS_CLK,
+       .of_match       = meson_clk_ids,
+       .priv_auto_alloc_size = sizeof(struct meson_clk),
+       .ops            = &meson_clk_ops,
+       .probe          = meson_clk_probe,
+};
index ddf2fb3fb828d16e370513ae9e86b04259d98039..2d195ae35ed526b7a0d73b226278b494d3feaf51 100644 (file)
@@ -225,6 +225,15 @@ config SPL_OF_TRANSLATE
          used for the address translation. This function is faster and
          smaller in size than fdt_translate_address().
 
+config TRANSLATION_OFFSET
+       bool "Platforms specific translation offset"
+       depends on DM && OF_CONTROL
+       help
+         Some platforms need a special address translation. Those
+         platforms (e.g. mvebu in SPL) can configure a translation
+         offset by enabling this option and setting the translation_offset
+         variable in the GD in their platform- / board-specific code.
+
 config OF_ISA_BUS
        bool
        depends on OF_TRANSLATE
index e113f1dd39c7cb0263e94fdaf9271303ceac8e69..c2873861dacd0cc1acec92bf2b71ccd75d6c49fe 100644 (file)
@@ -74,13 +74,16 @@ fdt_addr_t devfdt_get_addr_index(struct udevice *dev, int index)
                }
        }
 
+#if defined(CONFIG_TRANSLATION_OFFSET)
        /*
         * Some platforms need a special address translation. Those
         * platforms (e.g. mvebu in SPL) can configure a translation
-        * offset in the DM by calling dm_set_translation_offset() that
-        * will get added to all addresses returned by devfdt_get_addr().
+        * offset by setting this value in the GD and enaling this
+        * feature via CONFIG_TRANSLATION_OFFSET. This value will
+        * get added to all addresses returned by devfdt_get_addr().
         */
-       addr += dm_get_translation_offset();
+       addr += gd->translation_offset;
+#endif
 
        return addr;
 #else
index e6ec7faf3792c55b428923f71f2d73e46222a94d..8fa096648ed343e3f4e01982f278f8788ce3de19 100644 (file)
 
 DECLARE_GLOBAL_DATA_PTR;
 
-struct root_priv {
-       fdt_addr_t translation_offset;  /* optional translation offset */
-};
-
 static const struct driver_info root_info = {
        .name           = "root_driver",
 };
@@ -52,22 +48,6 @@ void dm_fixup_for_gd_move(struct global_data *new_gd)
        }
 }
 
-fdt_addr_t dm_get_translation_offset(void)
-{
-       struct udevice *root = dm_root();
-       struct root_priv *priv = dev_get_priv(root);
-
-       return priv->translation_offset;
-}
-
-void dm_set_translation_offset(fdt_addr_t offs)
-{
-       struct udevice *root = dm_root();
-       struct root_priv *priv = dev_get_priv(root);
-
-       priv->translation_offset = offs;
-}
-
 #if defined(CONFIG_NEEDS_MANUAL_RELOC)
 void fix_drivers(void)
 {
@@ -420,7 +400,6 @@ int dm_init_and_scan(bool pre_reloc_only)
 U_BOOT_DRIVER(root_driver) = {
        .name   = "root_driver",
        .id     = UCLASS_ROOT,
-       .priv_auto_alloc_size = sizeof(struct root_priv),
 };
 
 /* This is the root uclass */
index e16d8a9ff4a9b6bb111e391d70792d7481c8c84d..7fc23ef82d8822a04f5c2070c2a96f9b387d1f3d 100644 (file)
@@ -60,4 +60,5 @@ U_BOOT_DRIVER(simple_bus_drv) = {
        .name   = "generic_simple_bus",
        .id     = UCLASS_SIMPLE_BUS,
        .of_match = generic_simple_bus_ids,
+       .flags  = DM_FLAG_PRE_RELOC,
 };
index 7d06d95cf38876092b982e3e4422eff2b446ee4f..ee59bac123628c6e2cb21a7a62d0d368d3791264 100644 (file)
@@ -41,7 +41,12 @@ struct i2c_regs {
        u32 tok_rdata1;
 };
 
+struct meson_i2c_data {
+       unsigned char div_factor;
+};
+
 struct meson_i2c {
+       const struct meson_i2c_data *data;
        struct clk clk;
        struct i2c_regs *regs;
        struct i2c_msg *msg;    /* Current I2C message */
@@ -229,7 +234,7 @@ static int meson_i2c_set_bus_speed(struct udevice *bus, unsigned int speed)
        if (IS_ERR_VALUE(clk_rate))
                return -EINVAL;
 
-       div = DIV_ROUND_UP(clk_rate, speed * 4);
+       div = DIV_ROUND_UP(clk_rate, speed * i2c->data->div_factor);
 
        /* clock divider has 12 bits */
        if (div >= (1 << 12)) {
@@ -253,6 +258,8 @@ static int meson_i2c_probe(struct udevice *bus)
        struct meson_i2c *i2c = dev_get_priv(bus);
        int ret;
 
+       i2c->data = (const struct meson_i2c_data *)dev_get_driver_data(bus);
+
        ret = clk_get_by_index(bus, 0, &i2c->clk);
        if (ret < 0)
                return ret;
@@ -272,11 +279,24 @@ static const struct dm_i2c_ops meson_i2c_ops = {
        .set_bus_speed = meson_i2c_set_bus_speed,
 };
 
+static const struct meson_i2c_data i2c_meson6_data = {
+       .div_factor = 4,
+};
+
+static const struct meson_i2c_data i2c_gxbb_data = {
+       .div_factor = 4,
+};
+
+static const struct meson_i2c_data i2c_axg_data = {
+       .div_factor = 3,
+};
+
 static const struct udevice_id meson_i2c_ids[] = {
-       { .compatible = "amlogic,meson6-i2c" },
-       { .compatible = "amlogic,meson-gx-i2c" },
-       { .compatible = "amlogic,meson-gxbb-i2c" },
-       { }
+       {.compatible = "amlogic,meson6-i2c", .data = (ulong)&i2c_meson6_data},
+       {.compatible = "amlogic,meson-gx-i2c", .data = (ulong)&i2c_gxbb_data},
+       {.compatible = "amlogic,meson-gxbb-i2c", .data = (ulong)&i2c_gxbb_data},
+       {.compatible = "amlogic,meson-axg-i2c", .data = (ulong)&i2c_axg_data},
+       {}
 };
 
 U_BOOT_DRIVER(i2c_meson) = {
index f71d79ecd6bae01bfa93700b42380d504da3b01e..ea8eb0d5091dcfa949b763ebf167bb5d6dc5d445 100644 (file)
@@ -422,6 +422,7 @@ static int arm_pl180_mmc_probe(struct udevice *dev)
        struct mmc_config *cfg = &pdata->cfg;
        struct clk clk;
        u32 bus_width;
+       u32 periphid;
        int ret;
 
        ret = clk_get_by_index(dev, 0, &clk);
@@ -439,7 +440,15 @@ static int arm_pl180_mmc_probe(struct udevice *dev)
        host->clkdiv_init = SDI_CLKCR_CLKDIV_INIT_V1 | SDI_CLKCR_CLKEN |
                            SDI_CLKCR_HWFC_EN;
        host->clock_in = clk_get_rate(&clk);
-       host->version2 = dev_get_driver_data(dev);
+
+       periphid = dev_read_u32_default(dev, "arm,primecell-periphid", 0);
+       switch (periphid) {
+       case STM32_MMCI_ID: /* stm32 variant */
+               host->version2 = false;
+               break;
+       default:
+               host->version2 = true;
+       }
 
        cfg->name = dev->name;
        cfg->voltages = VOLTAGE_WINDOW_SD;
@@ -526,7 +535,8 @@ static int arm_pl180_mmc_ofdata_to_platdata(struct udevice *dev)
 }
 
 static const struct udevice_id arm_pl180_mmc_match[] = {
-       { .compatible = "st,stm32f4xx-sdio", .data = VERSION1 },
+       { .compatible = "arm,pl180" },
+       { .compatible = "arm,primecell" },
        { /* sentinel */ }
 };
 
index 36487be288b2887a3b389a343731b7bbe095bf4a..61ee96a112d9daf84145eb30d522f1f6a09a61c7 100644 (file)
 
 #define SDI_FIFO_BURST_SIZE    8
 
-#define VERSION1       false
-#define VERSION2       true
+#define STM32_MMCI_ID          0x00880180
 
 struct sdi_registers {
        u32 power;              /* 0x00*/
index a36612dd937e72fe3182bff10b6bfb8c0ca189b5..ed31ca126e934011bbb55e9feb00dafa1e19561e 100644 (file)
@@ -190,6 +190,7 @@ struct stm32_sdmmc2_ctx {
 #define SDMMC_IDMACTRL_IDMAEN          BIT(0)
 
 #define SDMMC_CMD_TIMEOUT              0xFFFFFFFF
+#define SDMMC_BUSYD0END_TIMEOUT_US     1000000
 
 static void stm32_sdmmc2_start_data(struct stm32_sdmmc2_priv *priv,
                                    struct mmc_data *data,
@@ -209,9 +210,6 @@ static void stm32_sdmmc2_start_data(struct stm32_sdmmc2_priv *priv,
                idmabase0 = (u32)data->src;
        }
 
-       /* Set the SDMMC Data TimeOut value */
-       writel(SDMMC_CMD_TIMEOUT, priv->base + SDMMC_DTIMER);
-
        /* Set the SDMMC DataLength value */
        writel(ctx->data_length, priv->base + SDMMC_DLEN);
 
@@ -236,8 +234,11 @@ static void stm32_sdmmc2_start_data(struct stm32_sdmmc2_priv *priv,
 }
 
 static void stm32_sdmmc2_start_cmd(struct stm32_sdmmc2_priv *priv,
-                                  struct mmc_cmd *cmd, u32 cmd_param)
+                                  struct mmc_cmd *cmd, u32 cmd_param,
+                                  struct stm32_sdmmc2_ctx *ctx)
 {
+       u32 timeout = 0;
+
        if (readl(priv->base + SDMMC_CMD) & SDMMC_CMD_CPSMEN)
                writel(0, priv->base + SDMMC_CMD);
 
@@ -251,6 +252,26 @@ static void stm32_sdmmc2_start_cmd(struct stm32_sdmmc2_priv *priv,
                        cmd_param |= SDMMC_CMD_WAITRESP_1;
        }
 
+       /*
+        * SDMMC_DTIME must be set in two case:
+        * - on data transfert.
+        * - on busy request.
+        * If not done or too short, the dtimeout flag occurs and DPSM stays
+        * enabled/busy and waits for abort (stop transmission cmd).
+        * Next data command is not possible whereas DPSM is activated.
+        */
+       if (ctx->data_length) {
+               timeout = SDMMC_CMD_TIMEOUT;
+       } else {
+               writel(0, priv->base + SDMMC_DCTRL);
+
+               if (cmd->resp_type & MMC_RSP_BUSY)
+                       timeout = SDMMC_CMD_TIMEOUT;
+       }
+
+       /* Set the SDMMC Data TimeOut value */
+       writel(timeout, priv->base + SDMMC_DTIMER);
+
        /* Clear flags */
        writel(SDMMC_ICR_STATIC_FLAGS, priv->base + SDMMC_ICR);
 
@@ -309,6 +330,31 @@ static int stm32_sdmmc2_end_cmd(struct stm32_sdmmc2_priv *priv,
                        cmd->response[2] = readl(priv->base + SDMMC_RESP3);
                        cmd->response[3] = readl(priv->base + SDMMC_RESP4);
                }
+
+               /* Wait for BUSYD0END flag if busy status is detected */
+               if (cmd->resp_type & MMC_RSP_BUSY &&
+                   status & SDMMC_STA_BUSYD0) {
+                       mask = SDMMC_STA_DTIMEOUT | SDMMC_STA_BUSYD0END;
+
+                       /* Polling status register */
+                       ret = readl_poll_timeout(priv->base + SDMMC_STA,
+                                                status, status & mask,
+                                                SDMMC_BUSYD0END_TIMEOUT_US);
+
+                       if (ret < 0) {
+                               debug("%s: timeout reading SDMMC_STA\n",
+                                     __func__);
+                               ctx->dpsm_abort = true;
+                               return ret;
+                       }
+
+                       if (status & SDMMC_STA_DTIMEOUT) {
+                               debug("%s: error SDMMC_STA_DTIMEOUT (0x%x)\n",
+                                     __func__, status);
+                               ctx->dpsm_abort = true;
+                               return -ETIMEDOUT;
+                       }
+               }
        }
 
        return 0;
@@ -395,7 +441,7 @@ retry_cmd:
                stm32_sdmmc2_start_data(priv, data, &ctx);
        }
 
-       stm32_sdmmc2_start_cmd(priv, cmd, cmdat);
+       stm32_sdmmc2_start_cmd(priv, cmd, cmdat, &ctx);
 
        debug("%s: send cmd %d data: 0x%x @ 0x%x\n",
              __func__, cmd->cmdidx,
@@ -425,7 +471,10 @@ retry_cmd:
                debug("%s: send STOP command to abort dpsm treatments\n",
                      __func__);
 
-               stm32_sdmmc2_start_cmd(priv, &stop_cmd, SDMMC_CMD_CMDSTOP);
+               ctx.data_length = 0;
+
+               stm32_sdmmc2_start_cmd(priv, &stop_cmd,
+                                      SDMMC_CMD_CMDSTOP, &ctx);
                stm32_sdmmc2_end_cmd(priv, &stop_cmd, &ctx);
 
                writel(SDMMC_ICR_STATIC_FLAGS, priv->base + SDMMC_ICR);
@@ -585,11 +634,11 @@ static int stm32_sdmmc2_probe(struct udevice *dev)
        if (priv->base == FDT_ADDR_T_NONE)
                return -EINVAL;
 
-       if (dev_read_bool(dev, "st,negedge"))
+       if (dev_read_bool(dev, "st,neg-edge"))
                priv->clk_reg_msk |= SDMMC_CLKCR_NEGEDGE;
-       if (dev_read_bool(dev, "st,dirpol"))
+       if (dev_read_bool(dev, "st,sig-dir"))
                priv->pwr_reg_msk |= SDMMC_POWER_DIRPOL;
-       if (dev_read_bool(dev, "st,pin-ckin"))
+       if (dev_read_bool(dev, "st,use-ckin"))
                priv->clk_reg_msk |= SDMMC_CLKCR_SELCLKRX_CKIN;
 
        ret = clk_get_by_index(dev, 0, &priv->clk);
index decce2fa59c4c5c670b6db9c2bbecd761bbbb5ca..c1363923509d0438d31c1a76773b2babb8857a30 100644 (file)
@@ -350,7 +350,7 @@ static int sb_eth_recv(struct udevice *dev, int flags, uchar **packetp)
        struct eth_sandbox_priv *priv = dev_get_priv(dev);
 
        if (skip_timeout) {
-               sandbox_timer_add_offset(11000UL);
+               timer_test_add_offset(11000UL);
                skip_timeout = false;
        }
 
index 162642d7289bc3cbeb25bb7af9b17347b97d8f56..ef02087ed233f26a6f4e38c8b25f1a295e61de92 100644 (file)
@@ -25,4 +25,8 @@ config PINCTRL_MESON_AXG
        bool "Amlogic Meson AXG SoC pinctrl driver"
        select PINCTRL_MESON_AXG_PMX
 
+config PINCTRL_MESON_G12A
+       bool "Amlogic Meson G12a SoC pinctrl driver"
+       select PINCTRL_MESON_AXG_PMX
+
 endif
index 707287cd1d033dfea32624d8490fd1276eb8c22c..80dba65e1bdc9edf6a4f18d65841b5f8b35e3901 100644 (file)
@@ -6,3 +6,4 @@ obj-$(CONFIG_PINCTRL_MESON_AXG_PMX)     += pinctrl-meson-axg-pmx.o
 obj-$(CONFIG_PINCTRL_MESON_GXBB)       += pinctrl-meson-gxbb.o
 obj-$(CONFIG_PINCTRL_MESON_GXL)                += pinctrl-meson-gxl.o
 obj-$(CONFIG_PINCTRL_MESON_AXG)                += pinctrl-meson-axg.o
+obj-$(CONFIG_PINCTRL_MESON_G12A)       += pinctrl-meson-g12a.o
index 3bbbe817b4ad7a591461f0c0fa357c377ae53470..8f23c8cef1d6529f4f8a7d0bec3dcc3cd7370514 100644 (file)
 #define EE_OFF 15
 
 /* emmc */
-static const unsigned int emmc_nand_d0_pins[] = {BOOT_0};
-static const unsigned int emmc_nand_d1_pins[] = {BOOT_1};
-static const unsigned int emmc_nand_d2_pins[] = {BOOT_2};
-static const unsigned int emmc_nand_d3_pins[] = {BOOT_3};
-static const unsigned int emmc_nand_d4_pins[] = {BOOT_4};
-static const unsigned int emmc_nand_d5_pins[] = {BOOT_5};
-static const unsigned int emmc_nand_d6_pins[] = {BOOT_6};
-static const unsigned int emmc_nand_d7_pins[] = {BOOT_7};
-
-static const unsigned int emmc_clk_pins[] = {BOOT_8};
-static const unsigned int emmc_cmd_pins[] = {BOOT_10};
-static const unsigned int emmc_ds_pins[]  = {BOOT_13};
+static const unsigned int emmc_nand_d0_pins[] = { PIN(BOOT_0, EE_OFF) };
+static const unsigned int emmc_nand_d1_pins[] = { PIN(BOOT_1, EE_OFF) };
+static const unsigned int emmc_nand_d2_pins[] = { PIN(BOOT_2, EE_OFF) };
+static const unsigned int emmc_nand_d3_pins[] = { PIN(BOOT_3, EE_OFF) };
+static const unsigned int emmc_nand_d4_pins[] = { PIN(BOOT_4, EE_OFF) };
+static const unsigned int emmc_nand_d5_pins[] = { PIN(BOOT_5, EE_OFF) };
+static const unsigned int emmc_nand_d6_pins[] = { PIN(BOOT_6, EE_OFF) };
+static const unsigned int emmc_nand_d7_pins[] = { PIN(BOOT_7, EE_OFF) };
+
+static const unsigned int emmc_clk_pins[] = { PIN(BOOT_8, EE_OFF) };
+static const unsigned int emmc_cmd_pins[] = { PIN(BOOT_10, EE_OFF) };
+static const unsigned int emmc_ds_pins[]  = { PIN(BOOT_13, EE_OFF) };
 
 /* nand */
-static const unsigned int nand_ce0_pins[] = {BOOT_8};
-static const unsigned int nand_ale_pins[] = {BOOT_9};
-static const unsigned int nand_cle_pins[] = {BOOT_10};
-static const unsigned int nand_wen_clk_pins[] = {BOOT_11};
-static const unsigned int nand_ren_wr_pins[] = {BOOT_12};
-static const unsigned int nand_rb0_pins[] = {BOOT_13};
+static const unsigned int nand_ce0_pins[] = { PIN(BOOT_8, EE_OFF) };
+static const unsigned int nand_ale_pins[] = { PIN(BOOT_9, EE_OFF) };
+static const unsigned int nand_cle_pins[] = { PIN(BOOT_10, EE_OFF) };
+static const unsigned int nand_wen_clk_pins[] = { PIN(BOOT_11, EE_OFF) };
+static const unsigned int nand_ren_wr_pins[] = { PIN(BOOT_12, EE_OFF) };
+static const unsigned int nand_rb0_pins[] = { PIN(BOOT_13, EE_OFF) };
 
 /* nor */
-static const unsigned int nor_hold_pins[] = {BOOT_3};
-static const unsigned int nor_d_pins[] = {BOOT_4};
-static const unsigned int nor_q_pins[] = {BOOT_5};
-static const unsigned int nor_c_pins[] = {BOOT_6};
-static const unsigned int nor_wp_pins[] = {BOOT_9};
-static const unsigned int nor_cs_pins[] = {BOOT_14};
+static const unsigned int nor_hold_pins[] = { PIN(BOOT_3, EE_OFF) };
+static const unsigned int nor_d_pins[] = { PIN(BOOT_4, EE_OFF) };
+static const unsigned int nor_q_pins[] = { PIN(BOOT_5, EE_OFF) };
+static const unsigned int nor_c_pins[] = { PIN(BOOT_6, EE_OFF) };
+static const unsigned int nor_wp_pins[] = { PIN(BOOT_9, EE_OFF) };
+static const unsigned int nor_cs_pins[] = { PIN(BOOT_14, EE_OFF) };
 
 /* sdio */
-static const unsigned int sdio_d0_pins[] = {GPIOX_0};
-static const unsigned int sdio_d1_pins[] = {GPIOX_1};
-static const unsigned int sdio_d2_pins[] = {GPIOX_2};
-static const unsigned int sdio_d3_pins[] = {GPIOX_3};
-static const unsigned int sdio_clk_pins[] = {GPIOX_4};
-static const unsigned int sdio_cmd_pins[] = {GPIOX_5};
+static const unsigned int sdio_d0_pins[] = { PIN(GPIOX_0, EE_OFF) };
+static const unsigned int sdio_d1_pins[] = { PIN(GPIOX_1, EE_OFF) };
+static const unsigned int sdio_d2_pins[] = { PIN(GPIOX_2, EE_OFF) };
+static const unsigned int sdio_d3_pins[] = { PIN(GPIOX_3, EE_OFF) };
+static const unsigned int sdio_clk_pins[] = { PIN(GPIOX_4, EE_OFF) };
+static const unsigned int sdio_cmd_pins[] = { PIN(GPIOX_5, EE_OFF) };
 
 /* spi0 */
-static const unsigned int spi0_clk_pins[] = {GPIOZ_0};
-static const unsigned int spi0_mosi_pins[] = {GPIOZ_1};
-static const unsigned int spi0_miso_pins[] = {GPIOZ_2};
-static const unsigned int spi0_ss0_pins[] = {GPIOZ_3};
-static const unsigned int spi0_ss1_pins[] = {GPIOZ_4};
-static const unsigned int spi0_ss2_pins[] = {GPIOZ_5};
+static const unsigned int spi0_clk_pins[] = { PIN(GPIOZ_0, EE_OFF) };
+static const unsigned int spi0_mosi_pins[] = { PIN(GPIOZ_1, EE_OFF) };
+static const unsigned int spi0_miso_pins[] = { PIN(GPIOZ_2, EE_OFF) };
+static const unsigned int spi0_ss0_pins[] = { PIN(GPIOZ_3, EE_OFF) };
+static const unsigned int spi0_ss1_pins[] = { PIN(GPIOZ_4, EE_OFF) };
+static const unsigned int spi0_ss2_pins[] = { PIN(GPIOZ_5, EE_OFF) };
 
 /* spi1 */
-static const unsigned int spi1_clk_x_pins[] = {GPIOX_19};
-static const unsigned int spi1_mosi_x_pins[] = {GPIOX_17};
-static const unsigned int spi1_miso_x_pins[] = {GPIOX_18};
-static const unsigned int spi1_ss0_x_pins[] = {GPIOX_16};
+static const unsigned int spi1_clk_x_pins[] = { PIN(GPIOX_19, EE_OFF) };
+static const unsigned int spi1_mosi_x_pins[] = { PIN(GPIOX_17, EE_OFF) };
+static const unsigned int spi1_miso_x_pins[] = { PIN(GPIOX_18, EE_OFF) };
+static const unsigned int spi1_ss0_x_pins[] = { PIN(GPIOX_16, EE_OFF) };
 
-static const unsigned int spi1_clk_a_pins[] = {GPIOA_4};
-static const unsigned int spi1_mosi_a_pins[] = {GPIOA_2};
-static const unsigned int spi1_miso_a_pins[] = {GPIOA_3};
-static const unsigned int spi1_ss0_a_pins[] = {GPIOA_5};
-static const unsigned int spi1_ss1_pins[] = {GPIOA_6};
+static const unsigned int spi1_clk_a_pins[] = { PIN(GPIOA_4, EE_OFF) };
+static const unsigned int spi1_mosi_a_pins[] = { PIN(GPIOA_2, EE_OFF) };
+static const unsigned int spi1_miso_a_pins[] = { PIN(GPIOA_3, EE_OFF) };
+static const unsigned int spi1_ss0_a_pins[] = { PIN(GPIOA_5, EE_OFF) };
+static const unsigned int spi1_ss1_pins[] = { PIN(GPIOA_6, EE_OFF) };
 
 /* i2c0 */
-static const unsigned int i2c0_sck_pins[] = {GPIOZ_6};
-static const unsigned int i2c0_sda_pins[] = {GPIOZ_7};
+static const unsigned int i2c0_sck_pins[] = { PIN(GPIOZ_6, EE_OFF) };
+static const unsigned int i2c0_sda_pins[] = { PIN(GPIOZ_7, EE_OFF) };
 
 /* i2c1 */
-static const unsigned int i2c1_sck_z_pins[] = {GPIOZ_8};
-static const unsigned int i2c1_sda_z_pins[] = {GPIOZ_9};
+static const unsigned int i2c1_sck_z_pins[] = { PIN(GPIOZ_8, EE_OFF) };
+static const unsigned int i2c1_sda_z_pins[] = { PIN(GPIOZ_9, EE_OFF) };
 
-static const unsigned int i2c1_sck_x_pins[] = {GPIOX_16};
-static const unsigned int i2c1_sda_x_pins[] = {GPIOX_17};
+static const unsigned int i2c1_sck_x_pins[] = { PIN(GPIOX_16, EE_OFF) };
+static const unsigned int i2c1_sda_x_pins[] = { PIN(GPIOX_17, EE_OFF) };
 
 /* i2c2 */
-static const unsigned int i2c2_sck_x_pins[] = {GPIOX_18};
-static const unsigned int i2c2_sda_x_pins[] = {GPIOX_19};
+static const unsigned int i2c2_sck_x_pins[] = { PIN(GPIOX_18, EE_OFF) };
+static const unsigned int i2c2_sda_x_pins[] = { PIN(GPIOX_19, EE_OFF) };
 
-static const unsigned int i2c2_sda_a_pins[] = {GPIOA_17};
-static const unsigned int i2c2_sck_a_pins[] = {GPIOA_18};
+static const unsigned int i2c2_sda_a_pins[] = { PIN(GPIOA_17, EE_OFF) };
+static const unsigned int i2c2_sck_a_pins[] = { PIN(GPIOA_18, EE_OFF) };
 
 /* i2c3 */
-static const unsigned int i2c3_sda_a6_pins[] = {GPIOA_6};
-static const unsigned int i2c3_sck_a7_pins[] = {GPIOA_7};
+static const unsigned int i2c3_sda_a6_pins[] = { PIN(GPIOA_6, EE_OFF) };
+static const unsigned int i2c3_sck_a7_pins[] = { PIN(GPIOA_7, EE_OFF) };
 
-static const unsigned int i2c3_sda_a12_pins[] = {GPIOA_12};
-static const unsigned int i2c3_sck_a13_pins[] = {GPIOA_13};
+static const unsigned int i2c3_sda_a12_pins[] = { PIN(GPIOA_12, EE_OFF) };
+static const unsigned int i2c3_sck_a13_pins[] = { PIN(GPIOA_13, EE_OFF) };
 
-static const unsigned int i2c3_sda_a19_pins[] = {GPIOA_19};
-static const unsigned int i2c3_sck_a20_pins[] = {GPIOA_20};
+static const unsigned int i2c3_sda_a19_pins[] = { PIN(GPIOA_19, EE_OFF) };
+static const unsigned int i2c3_sck_a20_pins[] = { PIN(GPIOA_20, EE_OFF) };
 
 /* uart_a */
-static const unsigned int uart_rts_a_pins[] = {GPIOX_11};
-static const unsigned int uart_cts_a_pins[] = {GPIOX_10};
-static const unsigned int uart_tx_a_pins[] = {GPIOX_8};
-static const unsigned int uart_rx_a_pins[] = {GPIOX_9};
+static const unsigned int uart_rts_a_pins[] = { PIN(GPIOX_11, EE_OFF) };
+static const unsigned int uart_cts_a_pins[] = { PIN(GPIOX_10, EE_OFF) };
+static const unsigned int uart_tx_a_pins[] = { PIN(GPIOX_8, EE_OFF) };
+static const unsigned int uart_rx_a_pins[] = { PIN(GPIOX_9, EE_OFF) };
 
 /* uart_b */
-static const unsigned int uart_rts_b_z_pins[] = {GPIOZ_0};
-static const unsigned int uart_cts_b_z_pins[] = {GPIOZ_1};
-static const unsigned int uart_tx_b_z_pins[] = {GPIOZ_2};
-static const unsigned int uart_rx_b_z_pins[] = {GPIOZ_3};
+static const unsigned int uart_rts_b_z_pins[] = { PIN(GPIOZ_0, EE_OFF) };
+static const unsigned int uart_cts_b_z_pins[] = { PIN(GPIOZ_1, EE_OFF) };
+static const unsigned int uart_tx_b_z_pins[] = { PIN(GPIOZ_2, EE_OFF) };
+static const unsigned int uart_rx_b_z_pins[] = { PIN(GPIOZ_3, EE_OFF) };
 
-static const unsigned int uart_rts_b_x_pins[] = {GPIOX_18};
-static const unsigned int uart_cts_b_x_pins[] = {GPIOX_19};
-static const unsigned int uart_tx_b_x_pins[] = {GPIOX_16};
-static const unsigned int uart_rx_b_x_pins[] = {GPIOX_17};
+static const unsigned int uart_rts_b_x_pins[] = { PIN(GPIOX_18, EE_OFF) };
+static const unsigned int uart_cts_b_x_pins[] = { PIN(GPIOX_19, EE_OFF) };
+static const unsigned int uart_tx_b_x_pins[] = { PIN(GPIOX_16, EE_OFF) };
+static const unsigned int uart_rx_b_x_pins[] = { PIN(GPIOX_17, EE_OFF) };
 
 /* uart_ao_b */
-static const unsigned int uart_ao_tx_b_z_pins[] = {GPIOZ_8};
-static const unsigned int uart_ao_rx_b_z_pins[] = {GPIOZ_9};
-static const unsigned int uart_ao_cts_b_z_pins[] = {GPIOZ_6};
-static const unsigned int uart_ao_rts_b_z_pins[] = {GPIOZ_7};
+static const unsigned int uart_ao_tx_b_z_pins[] = { PIN(GPIOZ_8, EE_OFF) };
+static const unsigned int uart_ao_rx_b_z_pins[] = { PIN(GPIOZ_9, EE_OFF) };
+static const unsigned int uart_ao_cts_b_z_pins[] = { PIN(GPIOZ_6, EE_OFF) };
+static const unsigned int uart_ao_rts_b_z_pins[] = { PIN(GPIOZ_7, EE_OFF) };
 
 /* pwm_a */
-static const unsigned int pwm_a_z_pins[] = {GPIOZ_5};
+static const unsigned int pwm_a_z_pins[] = { PIN(GPIOZ_5, EE_OFF) };
 
-static const unsigned int pwm_a_x18_pins[] = {GPIOX_18};
-static const unsigned int pwm_a_x20_pins[] = {GPIOX_20};
+static const unsigned int pwm_a_x18_pins[] = { PIN(GPIOX_18, EE_OFF) };
+static const unsigned int pwm_a_x20_pins[] = { PIN(GPIOX_20, EE_OFF) };
 
-static const unsigned int pwm_a_a_pins[] = {GPIOA_14};
+static const unsigned int pwm_a_a_pins[] = { PIN(GPIOA_14, EE_OFF) };
 
 /* pwm_b */
-static const unsigned int pwm_b_z_pins[] = {GPIOZ_4};
+static const unsigned int pwm_b_z_pins[] = { PIN(GPIOZ_4, EE_OFF) };
 
-static const unsigned int pwm_b_x_pins[] = {GPIOX_19};
+static const unsigned int pwm_b_x_pins[] = { PIN(GPIOX_19, EE_OFF) };
 
-static const unsigned int pwm_b_a_pins[] = {GPIOA_15};
+static const unsigned int pwm_b_a_pins[] = { PIN(GPIOA_15, EE_OFF) };
 
 /* pwm_c */
-static const unsigned int pwm_c_x10_pins[] = {GPIOX_10};
-static const unsigned int pwm_c_x17_pins[] = {GPIOX_17};
+static const unsigned int pwm_c_x10_pins[] = { PIN(GPIOX_10, EE_OFF) };
+static const unsigned int pwm_c_x17_pins[] = { PIN(GPIOX_17, EE_OFF) };
 
-static const unsigned int pwm_c_a_pins[] = {GPIOA_16};
+static const unsigned int pwm_c_a_pins[] = { PIN(GPIOA_16, EE_OFF) };
 
 /* pwm_d */
-static const unsigned int pwm_d_x11_pins[] = {GPIOX_11};
-static const unsigned int pwm_d_x16_pins[] = {GPIOX_16};
+static const unsigned int pwm_d_x11_pins[] = { PIN(GPIOX_11, EE_OFF) };
+static const unsigned int pwm_d_x16_pins[] = { PIN(GPIOX_16, EE_OFF) };
 
 /* pwm_vs */
-static const unsigned int pwm_vs_pins[] = {GPIOA_0};
+static const unsigned int pwm_vs_pins[] = { PIN(GPIOA_0, EE_OFF) };
 
 /* spdif_in */
-static const unsigned int spdif_in_z_pins[] = {GPIOZ_4};
+static const unsigned int spdif_in_z_pins[] = { PIN(GPIOZ_4, EE_OFF) };
 
-static const unsigned int spdif_in_a1_pins[] = {GPIOA_1};
-static const unsigned int spdif_in_a7_pins[] = {GPIOA_7};
-static const unsigned int spdif_in_a19_pins[] = {GPIOA_19};
-static const unsigned int spdif_in_a20_pins[] = {GPIOA_20};
+static const unsigned int spdif_in_a1_pins[] = { PIN(GPIOA_1, EE_OFF) };
+static const unsigned int spdif_in_a7_pins[] = { PIN(GPIOA_7, EE_OFF) };
+static const unsigned int spdif_in_a19_pins[] = { PIN(GPIOA_19, EE_OFF) };
+static const unsigned int spdif_in_a20_pins[] = { PIN(GPIOA_20, EE_OFF) };
 
 /* spdif_out */
-static const unsigned int spdif_out_z_pins[] = {GPIOZ_5};
+static const unsigned int spdif_out_z_pins[] = { PIN(GPIOZ_5, EE_OFF) };
 
-static const unsigned int spdif_out_a1_pins[] = {GPIOA_1};
-static const unsigned int spdif_out_a11_pins[] = {GPIOA_11};
-static const unsigned int spdif_out_a19_pins[] = {GPIOA_19};
-static const unsigned int spdif_out_a20_pins[] = {GPIOA_20};
+static const unsigned int spdif_out_a1_pins[] = { PIN(GPIOA_1, EE_OFF) };
+static const unsigned int spdif_out_a11_pins[] = { PIN(GPIOA_11, EE_OFF) };
+static const unsigned int spdif_out_a19_pins[] = { PIN(GPIOA_19, EE_OFF) };
+static const unsigned int spdif_out_a20_pins[] = { PIN(GPIOA_20, EE_OFF) };
 
 /* jtag_ee */
-static const unsigned int jtag_tdo_x_pins[] = {GPIOX_0};
-static const unsigned int jtag_tdi_x_pins[] = {GPIOX_1};
-static const unsigned int jtag_clk_x_pins[] = {GPIOX_4};
-static const unsigned int jtag_tms_x_pins[] = {GPIOX_5};
+static const unsigned int jtag_tdo_x_pins[] = { PIN(GPIOX_0, EE_OFF) };
+static const unsigned int jtag_tdi_x_pins[] = { PIN(GPIOX_1, EE_OFF) };
+static const unsigned int jtag_clk_x_pins[] = { PIN(GPIOX_4, EE_OFF) };
+static const unsigned int jtag_tms_x_pins[] = { PIN(GPIOX_5, EE_OFF) };
 
 /* eth */
-static const unsigned int eth_txd0_x_pins[] = {GPIOX_8};
-static const unsigned int eth_txd1_x_pins[] = {GPIOX_9};
-static const unsigned int eth_txen_x_pins[] = {GPIOX_10};
-static const unsigned int eth_rgmii_rx_clk_x_pins[] = {GPIOX_12};
-static const unsigned int eth_rxd0_x_pins[] = {GPIOX_13};
-static const unsigned int eth_rxd1_x_pins[] = {GPIOX_14};
-static const unsigned int eth_rx_dv_x_pins[] = {GPIOX_15};
-static const unsigned int eth_mdio_x_pins[] = {GPIOX_21};
-static const unsigned int eth_mdc_x_pins[] = {GPIOX_22};
-
-static const unsigned int eth_txd0_y_pins[] = {GPIOY_10};
-static const unsigned int eth_txd1_y_pins[] = {GPIOY_11};
-static const unsigned int eth_txen_y_pins[] = {GPIOY_9};
-static const unsigned int eth_rgmii_rx_clk_y_pins[] = {GPIOY_2};
-static const unsigned int eth_rxd0_y_pins[] = {GPIOY_4};
-static const unsigned int eth_rxd1_y_pins[] = {GPIOY_5};
-static const unsigned int eth_rx_dv_y_pins[] = {GPIOY_3};
-static const unsigned int eth_mdio_y_pins[] = {GPIOY_0};
-static const unsigned int eth_mdc_y_pins[] = {GPIOY_1};
-
-static const unsigned int eth_rxd2_rgmii_pins[] = {GPIOY_6};
-static const unsigned int eth_rxd3_rgmii_pins[] = {GPIOY_7};
-static const unsigned int eth_rgmii_tx_clk_pins[] = {GPIOY_8};
-static const unsigned int eth_txd2_rgmii_pins[] = {GPIOY_12};
-static const unsigned int eth_txd3_rgmii_pins[] = {GPIOY_13};
+static const unsigned int eth_txd0_x_pins[] = { PIN(GPIOX_8, EE_OFF) };
+static const unsigned int eth_txd1_x_pins[] = { PIN(GPIOX_9, EE_OFF) };
+static const unsigned int eth_txen_x_pins[] = { PIN(GPIOX_10, EE_OFF) };
+static const unsigned int eth_rgmii_rx_clk_x_pins[] = { PIN(GPIOX_12, EE_OFF) };
+static const unsigned int eth_rxd0_x_pins[] = { PIN(GPIOX_13, EE_OFF) };
+static const unsigned int eth_rxd1_x_pins[] = { PIN(GPIOX_14, EE_OFF) };
+static const unsigned int eth_rx_dv_x_pins[] = { PIN(GPIOX_15, EE_OFF) };
+static const unsigned int eth_mdio_x_pins[] = { PIN(GPIOX_21, EE_OFF) };
+static const unsigned int eth_mdc_x_pins[] = { PIN(GPIOX_22, EE_OFF) };
+
+static const unsigned int eth_txd0_y_pins[] = { PIN(GPIOY_10, EE_OFF) };
+static const unsigned int eth_txd1_y_pins[] = { PIN(GPIOY_11, EE_OFF) };
+static const unsigned int eth_txen_y_pins[] = { PIN(GPIOY_9, EE_OFF) };
+static const unsigned int eth_rgmii_rx_clk_y_pins[] = { PIN(GPIOY_2, EE_OFF) };
+static const unsigned int eth_rxd0_y_pins[] = { PIN(GPIOY_4, EE_OFF) };
+static const unsigned int eth_rxd1_y_pins[] = { PIN(GPIOY_5, EE_OFF) };
+static const unsigned int eth_rx_dv_y_pins[] = { PIN(GPIOY_3, EE_OFF) };
+static const unsigned int eth_mdio_y_pins[] = { PIN(GPIOY_0, EE_OFF) };
+static const unsigned int eth_mdc_y_pins[] = { PIN(GPIOY_1, EE_OFF) };
+
+static const unsigned int eth_rxd2_rgmii_pins[] = { PIN(GPIOY_6, EE_OFF) };
+static const unsigned int eth_rxd3_rgmii_pins[] = { PIN(GPIOY_7, EE_OFF) };
+static const unsigned int eth_rgmii_tx_clk_pins[] = { PIN(GPIOY_8, EE_OFF) };
+static const unsigned int eth_txd2_rgmii_pins[] = { PIN(GPIOY_12, EE_OFF) };
+static const unsigned int eth_txd3_rgmii_pins[] = { PIN(GPIOY_13, EE_OFF) };
 
 /* pdm */
-static const unsigned int pdm_dclk_a14_pins[] = {GPIOA_14};
-static const unsigned int pdm_dclk_a19_pins[] = {GPIOA_19};
-static const unsigned int pdm_din0_pins[] = {GPIOA_15};
-static const unsigned int pdm_din1_pins[] = {GPIOA_16};
-static const unsigned int pdm_din2_pins[] = {GPIOA_17};
-static const unsigned int pdm_din3_pins[] = {GPIOA_18};
+static const unsigned int pdm_dclk_a14_pins[] = { PIN(GPIOA_14, EE_OFF) };
+static const unsigned int pdm_dclk_a19_pins[] = { PIN(GPIOA_19, EE_OFF) };
+static const unsigned int pdm_din0_pins[] = { PIN(GPIOA_15, EE_OFF) };
+static const unsigned int pdm_din1_pins[] = { PIN(GPIOA_16, EE_OFF) };
+static const unsigned int pdm_din2_pins[] = { PIN(GPIOA_17, EE_OFF) };
+static const unsigned int pdm_din3_pins[] = { PIN(GPIOA_18, EE_OFF) };
 
 /* mclk */
-static const unsigned int mclk_c_pins[] = {GPIOA_0};
-static const unsigned int mclk_b_pins[] = {GPIOA_1};
+static const unsigned int mclk_c_pins[] = { PIN(GPIOA_0, EE_OFF) };
+static const unsigned int mclk_b_pins[] = { PIN(GPIOA_1, EE_OFF) };
 
 /* tdm */
-static const unsigned int tdma_sclk_pins[] = {GPIOX_12};
-static const unsigned int tdma_sclk_slv_pins[] = {GPIOX_12};
-static const unsigned int tdma_fs_pins[] = {GPIOX_13};
-static const unsigned int tdma_fs_slv_pins[] = {GPIOX_13};
-static const unsigned int tdma_din0_pins[] = {GPIOX_14};
-static const unsigned int tdma_dout0_x14_pins[] = {GPIOX_14};
-static const unsigned int tdma_dout0_x15_pins[] = {GPIOX_15};
-static const unsigned int tdma_dout1_pins[] = {GPIOX_15};
-static const unsigned int tdma_din1_pins[] = {GPIOX_15};
-
-static const unsigned int tdmc_sclk_pins[] = {GPIOA_2};
-static const unsigned int tdmc_sclk_slv_pins[] = {GPIOA_2};
-static const unsigned int tdmc_fs_pins[] = {GPIOA_3};
-static const unsigned int tdmc_fs_slv_pins[] = {GPIOA_3};
-static const unsigned int tdmc_din0_pins[] = {GPIOA_4};
-static const unsigned int tdmc_dout0_pins[] = {GPIOA_4};
-static const unsigned int tdmc_din1_pins[] = {GPIOA_5};
-static const unsigned int tdmc_dout1_pins[] = {GPIOA_5};
-static const unsigned int tdmc_din2_pins[] = {GPIOA_6};
-static const unsigned int tdmc_dout2_pins[] = {GPIOA_6};
-static const unsigned int tdmc_din3_pins[] = {GPIOA_7};
-static const unsigned int tdmc_dout3_pins[] = {GPIOA_7};
-
-static const unsigned int tdmb_sclk_pins[] = {GPIOA_8};
-static const unsigned int tdmb_sclk_slv_pins[] = {GPIOA_8};
-static const unsigned int tdmb_fs_pins[] = {GPIOA_9};
-static const unsigned int tdmb_fs_slv_pins[] = {GPIOA_9};
-static const unsigned int tdmb_din0_pins[] = {GPIOA_10};
-static const unsigned int tdmb_dout0_pins[] = {GPIOA_10};
-static const unsigned int tdmb_din1_pins[] = {GPIOA_11};
-static const unsigned int tdmb_dout1_pins[] = {GPIOA_11};
-static const unsigned int tdmb_din2_pins[] = {GPIOA_12};
-static const unsigned int tdmb_dout2_pins[] = {GPIOA_12};
-static const unsigned int tdmb_din3_pins[] = {GPIOA_13};
-static const unsigned int tdmb_dout3_pins[] = {GPIOA_13};
+static const unsigned int tdma_sclk_pins[] = { PIN(GPIOX_12, EE_OFF) };
+static const unsigned int tdma_sclk_slv_pins[] = { PIN(GPIOX_12, EE_OFF) };
+static const unsigned int tdma_fs_pins[] = { PIN(GPIOX_13, EE_OFF) };
+static const unsigned int tdma_fs_slv_pins[] = { PIN(GPIOX_13, EE_OFF) };
+static const unsigned int tdma_din0_pins[] = { PIN(GPIOX_14, EE_OFF) };
+static const unsigned int tdma_dout0_x14_pins[] = { PIN(GPIOX_14, EE_OFF) };
+static const unsigned int tdma_dout0_x15_pins[] = { PIN(GPIOX_15, EE_OFF) };
+static const unsigned int tdma_dout1_pins[] = { PIN(GPIOX_15, EE_OFF) };
+static const unsigned int tdma_din1_pins[] = { PIN(GPIOX_15, EE_OFF) };
+
+static const unsigned int tdmc_sclk_pins[] = { PIN(GPIOA_2, EE_OFF) };
+static const unsigned int tdmc_sclk_slv_pins[] = { PIN(GPIOA_2, EE_OFF) };
+static const unsigned int tdmc_fs_pins[] = { PIN(GPIOA_3, EE_OFF) };
+static const unsigned int tdmc_fs_slv_pins[] = { PIN(GPIOA_3, EE_OFF) };
+static const unsigned int tdmc_din0_pins[] = { PIN(GPIOA_4, EE_OFF) };
+static const unsigned int tdmc_dout0_pins[] = { PIN(GPIOA_4, EE_OFF) };
+static const unsigned int tdmc_din1_pins[] = { PIN(GPIOA_5, EE_OFF) };
+static const unsigned int tdmc_dout1_pins[] = { PIN(GPIOA_5, EE_OFF) };
+static const unsigned int tdmc_din2_pins[] = { PIN(GPIOA_6, EE_OFF) };
+static const unsigned int tdmc_dout2_pins[] = { PIN(GPIOA_6, EE_OFF) };
+static const unsigned int tdmc_din3_pins[] = { PIN(GPIOA_7, EE_OFF) };
+static const unsigned int tdmc_dout3_pins[] = { PIN(GPIOA_7, EE_OFF) };
+
+static const unsigned int tdmb_sclk_pins[] = { PIN(GPIOA_8, EE_OFF) };
+static const unsigned int tdmb_sclk_slv_pins[] = { PIN(GPIOA_8, EE_OFF) };
+static const unsigned int tdmb_fs_pins[] = { PIN(GPIOA_9, EE_OFF) };
+static const unsigned int tdmb_fs_slv_pins[] = { PIN(GPIOA_9, EE_OFF) };
+static const unsigned int tdmb_din0_pins[] = { PIN(GPIOA_10, EE_OFF) };
+static const unsigned int tdmb_dout0_pins[] = { PIN(GPIOA_10, EE_OFF) };
+static const unsigned int tdmb_din1_pins[] = { PIN(GPIOA_11, EE_OFF) };
+static const unsigned int tdmb_dout1_pins[] = { PIN(GPIOA_11, EE_OFF) };
+static const unsigned int tdmb_din2_pins[] = { PIN(GPIOA_12, EE_OFF) };
+static const unsigned int tdmb_dout2_pins[] = { PIN(GPIOA_12, EE_OFF) };
+static const unsigned int tdmb_din3_pins[] = { PIN(GPIOA_13, EE_OFF) };
+static const unsigned int tdmb_dout3_pins[] = { PIN(GPIOA_13, EE_OFF) };
 
 static struct meson_pmx_group meson_axg_periphs_groups[] = {
        GPIO_GROUP(GPIOZ_0, EE_OFF),
@@ -907,12 +907,12 @@ static struct meson_bank meson_axg_aobus_banks[] = {
 };
 
 static struct meson_pmx_bank meson_axg_periphs_pmx_banks[] = {
-       /*       name    first          lask       reg  offset  */
-       BANK_PMX("Z",    GPIOZ_0, GPIOZ_10, 0x2, 0),
-       BANK_PMX("BOOT", BOOT_0,  BOOT_14,  0x0, 0),
-       BANK_PMX("A",    GPIOA_0, GPIOA_20, 0xb, 0),
-       BANK_PMX("X",    GPIOX_0, GPIOX_22, 0x4, 0),
-       BANK_PMX("Y",    GPIOY_0, GPIOY_15, 0x8, 0),
+       /*       name    first                  last                  reg  offset  */
+       BANK_PMX("Z",    PIN(GPIOZ_0, EE_OFF),  PIN(GPIOZ_10, EE_OFF), 0x2, 0),
+       BANK_PMX("BOOT", PIN(BOOT_0, EE_OFF),   PIN(BOOT_14, EE_OFF),  0x0, 0),
+       BANK_PMX("A",    PIN(GPIOA_0, EE_OFF),  PIN(GPIOA_20, EE_OFF), 0xb, 0),
+       BANK_PMX("X",    PIN(GPIOX_0, EE_OFF),  PIN(GPIOX_22, EE_OFF), 0x4, 0),
+       BANK_PMX("Y",    PIN(GPIOY_0, EE_OFF),  PIN(GPIOY_15, EE_OFF), 0x8, 0),
 };
 
 static struct meson_axg_pmx_data meson_axg_periphs_pmx_banks_data = {
@@ -931,7 +931,7 @@ static struct meson_axg_pmx_data meson_axg_aobus_pmx_banks_data = {
 
 struct meson_pinctrl_data meson_axg_periphs_pinctrl_data = {
        .name           = "periphs-banks",
-       .pin_base       = 15,
+       .pin_base       = EE_OFF,
        .groups         = meson_axg_periphs_groups,
        .funcs          = meson_axg_periphs_functions,
        .banks          = meson_axg_periphs_banks,
diff --git a/drivers/pinctrl/meson/pinctrl-meson-g12a.c b/drivers/pinctrl/meson/pinctrl-meson-g12a.c
new file mode 100644 (file)
index 0000000..9cc2b9d
--- /dev/null
@@ -0,0 +1,1294 @@
+// SPDX-License-Identifier: (GPL-2.0+ or MIT)
+/*
+ * (C) Copyright (C) 2019 Jerome Brunet <jbrunet@baylibre.com>
+ *
+ * Based on code from Linux kernel:
+ * Copyright (c) 2018 Amlogic, Inc. All rights reserved.
+ * Author: Xingyu Chen <xingyu.chen@amlogic.com>
+ * Author: Yixun Lan <yixun.lan@amlogic.com>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <dm/pinctrl.h>
+#include <dt-bindings/gpio/meson-g12a-gpio.h>
+
+#include "pinctrl-meson-axg.h"
+
+#define EE_OFF 15
+
+/* emmc */
+static const unsigned int emmc_nand_d0_pins[]          = { PIN(BOOT_0, EE_OFF) };
+static const unsigned int emmc_nand_d1_pins[]          = { PIN(BOOT_1, EE_OFF) };
+static const unsigned int emmc_nand_d2_pins[]          = { PIN(BOOT_2, EE_OFF) };
+static const unsigned int emmc_nand_d3_pins[]          = { PIN(BOOT_3, EE_OFF) };
+static const unsigned int emmc_nand_d4_pins[]          = { PIN(BOOT_4, EE_OFF) };
+static const unsigned int emmc_nand_d5_pins[]          = { PIN(BOOT_5, EE_OFF) };
+static const unsigned int emmc_nand_d6_pins[]          = { PIN(BOOT_6, EE_OFF) };
+static const unsigned int emmc_nand_d7_pins[]          = { PIN(BOOT_7, EE_OFF) };
+static const unsigned int emmc_clk_pins[]              = { PIN(BOOT_8, EE_OFF) };
+static const unsigned int emmc_cmd_pins[]              = { PIN(BOOT_10, EE_OFF) };
+static const unsigned int emmc_nand_ds_pins[]          = { PIN(BOOT_13, EE_OFF) };
+
+/* nand */
+static const unsigned int nand_wen_clk_pins[]          = { PIN(BOOT_8, EE_OFF) };
+static const unsigned int nand_ale_pins[]              = { PIN(BOOT_9, EE_OFF) };
+static const unsigned int nand_cle_pins[]              = { PIN(BOOT_10, EE_OFF) };
+static const unsigned int nand_ce0_pins[]              = { PIN(BOOT_11, EE_OFF) };
+static const unsigned int nand_ren_wr_pins[]           = { PIN(BOOT_12, EE_OFF) };
+static const unsigned int nand_rb0_pins[]              = { PIN(BOOT_14, EE_OFF) };
+static const unsigned int nand_ce1_pins[]              = { PIN(BOOT_15, EE_OFF) };
+
+/* nor */
+static const unsigned int nor_hold_pins[]              = { PIN(BOOT_3, EE_OFF) };
+static const unsigned int nor_d_pins[]                 = { PIN(BOOT_4, EE_OFF) };
+static const unsigned int nor_q_pins[]                 = { PIN(BOOT_5, EE_OFF) };
+static const unsigned int nor_c_pins[]                 = { PIN(BOOT_6, EE_OFF) };
+static const unsigned int nor_wp_pins[]                        = { PIN(BOOT_7, EE_OFF) };
+static const unsigned int nor_cs_pins[]                        = { PIN(BOOT_14, EE_OFF) };
+
+/* sdio */
+static const unsigned int sdio_d0_pins[]               = { PIN(GPIOX_0, EE_OFF) };
+static const unsigned int sdio_d1_pins[]               = { PIN(GPIOX_1, EE_OFF) };
+static const unsigned int sdio_d2_pins[]               = { PIN(GPIOX_2, EE_OFF) };
+static const unsigned int sdio_d3_pins[]               = { PIN(GPIOX_3, EE_OFF) };
+static const unsigned int sdio_clk_pins[]              = { PIN(GPIOX_4, EE_OFF) };
+static const unsigned int sdio_cmd_pins[]              = { PIN(GPIOX_5, EE_OFF) };
+
+/* sdcard */
+static const unsigned int sdcard_d0_c_pins[]           = { PIN(GPIOC_0, EE_OFF) };
+static const unsigned int sdcard_d1_c_pins[]           = { PIN(GPIOC_1, EE_OFF) };
+static const unsigned int sdcard_d2_c_pins[]           = { PIN(GPIOC_2, EE_OFF) };
+static const unsigned int sdcard_d3_c_pins[]           = { PIN(GPIOC_3, EE_OFF) };
+static const unsigned int sdcard_clk_c_pins[]          = { PIN(GPIOC_4, EE_OFF) };
+static const unsigned int sdcard_cmd_c_pins[]          = { PIN(GPIOC_5, EE_OFF) };
+
+static const unsigned int sdcard_d0_z_pins[]           = { PIN(GPIOZ_2, EE_OFF) };
+static const unsigned int sdcard_d1_z_pins[]           = { PIN(GPIOZ_3, EE_OFF) };
+static const unsigned int sdcard_d2_z_pins[]           = { PIN(GPIOZ_4, EE_OFF) };
+static const unsigned int sdcard_d3_z_pins[]           = { PIN(GPIOZ_5, EE_OFF) };
+static const unsigned int sdcard_clk_z_pins[]          = { PIN(GPIOZ_6, EE_OFF) };
+static const unsigned int sdcard_cmd_z_pins[]          = { PIN(GPIOZ_7, EE_OFF) };
+
+/* spi0 */
+static const unsigned int spi0_mosi_c_pins[]           = { PIN(GPIOC_0, EE_OFF) };
+static const unsigned int spi0_miso_c_pins[]           = { PIN(GPIOC_1, EE_OFF) };
+static const unsigned int spi0_ss0_c_pins[]            = { PIN(GPIOC_2, EE_OFF) };
+static const unsigned int spi0_clk_c_pins[]            = { PIN(GPIOC_3, EE_OFF) };
+
+static const unsigned int spi0_mosi_x_pins[]           = { PIN(GPIOX_8, EE_OFF) };
+static const unsigned int spi0_miso_x_pins[]           = { PIN(GPIOX_9, EE_OFF) };
+static const unsigned int spi0_ss0_x_pins[]            = { PIN(GPIOX_10, EE_OFF) };
+static const unsigned int spi0_clk_x_pins[]            = { PIN(GPIOX_11, EE_OFF) };
+
+/* spi1 */
+static const unsigned int spi1_mosi_pins[]             = { PIN(GPIOH_4, EE_OFF) };
+static const unsigned int spi1_miso_pins[]             = { PIN(GPIOH_5, EE_OFF) };
+static const unsigned int spi1_ss0_pins[]              = { PIN(GPIOH_6, EE_OFF) };
+static const unsigned int spi1_clk_pins[]              = { PIN(GPIOH_7, EE_OFF) };
+
+/* i2c0 */
+static const unsigned int i2c0_sda_c_pins[]            = { PIN(GPIOC_5, EE_OFF) };
+static const unsigned int i2c0_sck_c_pins[]            = { PIN(GPIOC_6, EE_OFF) };
+static const unsigned int i2c0_sda_z0_pins[]           = { PIN(GPIOZ_0, EE_OFF) };
+static const unsigned int i2c0_sck_z1_pins[]           = { PIN(GPIOZ_1, EE_OFF) };
+static const unsigned int i2c0_sda_z7_pins[]           = { PIN(GPIOZ_7, EE_OFF) };
+static const unsigned int i2c0_sck_z8_pins[]           = { PIN(GPIOZ_8, EE_OFF) };
+
+/* i2c1 */
+static const unsigned int i2c1_sda_x_pins[]            = { PIN(GPIOX_10, EE_OFF) };
+static const unsigned int i2c1_sck_x_pins[]            = { PIN(GPIOX_11, EE_OFF) };
+static const unsigned int i2c1_sda_h2_pins[]           = { PIN(GPIOH_2, EE_OFF) };
+static const unsigned int i2c1_sck_h3_pins[]           = { PIN(GPIOH_3, EE_OFF) };
+static const unsigned int i2c1_sda_h6_pins[]           = { PIN(GPIOH_6, EE_OFF) };
+static const unsigned int i2c1_sck_h7_pins[]           = { PIN(GPIOH_7, EE_OFF) };
+
+/* i2c2 */
+static const unsigned int i2c2_sda_x_pins[]            = { PIN(GPIOX_17, EE_OFF) };
+static const unsigned int i2c2_sck_x_pins[]            = { PIN(GPIOX_18, EE_OFF) };
+static const unsigned int i2c2_sda_z_pins[]            = { PIN(GPIOZ_14, EE_OFF) };
+static const unsigned int i2c2_sck_z_pins[]            = { PIN(GPIOZ_15, EE_OFF) };
+
+/* i2c3 */
+static const unsigned int i2c3_sda_h_pins[]            = { PIN(GPIOH_0, EE_OFF) };
+static const unsigned int i2c3_sck_h_pins[]            = { PIN(GPIOH_1, EE_OFF) };
+static const unsigned int i2c3_sda_a_pins[]            = { PIN(GPIOA_14, EE_OFF) };
+static const unsigned int i2c3_sck_a_pins[]            = { PIN(GPIOA_15, EE_OFF) };
+
+/* uart_a */
+static const unsigned int uart_a_tx_pins[]             = { PIN(GPIOX_12, EE_OFF) };
+static const unsigned int uart_a_rx_pins[]             = { PIN(GPIOX_13, EE_OFF) };
+static const unsigned int uart_a_cts_pins[]            = { PIN(GPIOX_14, EE_OFF) };
+static const unsigned int uart_a_rts_pins[]            = { PIN(GPIOX_15, EE_OFF) };
+
+/* uart_b */
+static const unsigned int uart_b_tx_pins[]             = { PIN(GPIOX_6, EE_OFF) };
+static const unsigned int uart_b_rx_pins[]             = { PIN(GPIOX_7, EE_OFF) };
+
+/* uart_c */
+static const unsigned int uart_c_rts_pins[]            = { PIN(GPIOH_4, EE_OFF) };
+static const unsigned int uart_c_cts_pins[]            = { PIN(GPIOH_5, EE_OFF) };
+static const unsigned int uart_c_rx_pins[]             = { PIN(GPIOH_6, EE_OFF) };
+static const unsigned int uart_c_tx_pins[]             = { PIN(GPIOH_7, EE_OFF) };
+
+/* uart_ao_a_c */
+static const unsigned int uart_ao_a_rx_c_pins[]                = { PIN(GPIOC_2, EE_OFF) };
+static const unsigned int uart_ao_a_tx_c_pins[]                = { PIN(GPIOC_3, EE_OFF) };
+
+/* iso7816 */
+static const unsigned int iso7816_clk_c_pins[]         = { PIN(GPIOC_5, EE_OFF) };
+static const unsigned int iso7816_data_c_pins[]                = { PIN(GPIOC_6, EE_OFF) };
+static const unsigned int iso7816_clk_x_pins[]         = { PIN(GPIOX_8, EE_OFF) };
+static const unsigned int iso7816_data_x_pins[]                = { PIN(GPIOX_9, EE_OFF) };
+static const unsigned int iso7816_clk_h_pins[]         = { PIN(GPIOH_6, EE_OFF) };
+static const unsigned int iso7816_data_h_pins[]                = { PIN(GPIOH_7, EE_OFF) };
+static const unsigned int iso7816_clk_z_pins[]         = { PIN(GPIOZ_0, EE_OFF) };
+static const unsigned int iso7816_data_z_pins[]                = { PIN(GPIOZ_1, EE_OFF) };
+
+/* eth */
+static const unsigned int eth_mdio_pins[]              = { PIN(GPIOZ_0, EE_OFF) };
+static const unsigned int eth_mdc_pins[]               = { PIN(GPIOZ_1, EE_OFF) };
+static const unsigned int eth_rgmii_rx_clk_pins[]      = { PIN(GPIOZ_2, EE_OFF) };
+static const unsigned int eth_rx_dv_pins[]             = { PIN(GPIOZ_3, EE_OFF) };
+static const unsigned int eth_rxd0_pins[]              = { PIN(GPIOZ_4, EE_OFF) };
+static const unsigned int eth_rxd1_pins[]              = { PIN(GPIOZ_5, EE_OFF) };
+static const unsigned int eth_rxd2_rgmii_pins[]                = { PIN(GPIOZ_6, EE_OFF) };
+static const unsigned int eth_rxd3_rgmii_pins[]                = { PIN(GPIOZ_7, EE_OFF) };
+static const unsigned int eth_rgmii_tx_clk_pins[]      = { PIN(GPIOZ_8, EE_OFF) };
+static const unsigned int eth_txen_pins[]              = { PIN(GPIOZ_9, EE_OFF) };
+static const unsigned int eth_txd0_pins[]              = { PIN(GPIOZ_10, EE_OFF) };
+static const unsigned int eth_txd1_pins[]              = { PIN(GPIOZ_11, EE_OFF) };
+static const unsigned int eth_txd2_rgmii_pins[]                = { PIN(GPIOZ_12, EE_OFF) };
+static const unsigned int eth_txd3_rgmii_pins[]                = { PIN(GPIOZ_13, EE_OFF) };
+static const unsigned int eth_link_led_pins[]          = { PIN(GPIOZ_14, EE_OFF) };
+static const unsigned int eth_act_led_pins[]           = { PIN(GPIOZ_15, EE_OFF) };
+
+/* pwm_a */
+static const unsigned int pwm_a_pins[]                 = { PIN(GPIOX_6, EE_OFF) };
+
+/* pwm_b */
+static const unsigned int pwm_b_x7_pins[]              = { PIN(GPIOX_7, EE_OFF) };
+static const unsigned int pwm_b_x19_pins[]             = { PIN(GPIOX_19, EE_OFF) };
+
+/* pwm_c */
+static const unsigned int pwm_c_c_pins[]               = { PIN(GPIOC_4, EE_OFF) };
+static const unsigned int pwm_c_x5_pins[]              = { PIN(GPIOX_5, EE_OFF) };
+static const unsigned int pwm_c_x8_pins[]              = { PIN(GPIOX_8, EE_OFF) };
+
+/* pwm_d */
+static const unsigned int pwm_d_x3_pins[]              = { PIN(GPIOX_3, EE_OFF) };
+static const unsigned int pwm_d_x6_pins[]              = { PIN(GPIOX_6, EE_OFF) };
+
+/* pwm_e */
+static const unsigned int pwm_e_pins[]                 = { PIN(GPIOX_16, EE_OFF) };
+
+/* pwm_f */
+static const unsigned int pwm_f_x_pins[]               = { PIN(GPIOX_7, EE_OFF) };
+static const unsigned int pwm_f_h_pins[]               = { PIN(GPIOH_5, EE_OFF) };
+
+/* cec_ao */
+static const unsigned int cec_ao_a_h_pins[]            = { PIN(GPIOH_3, EE_OFF) };
+static const unsigned int cec_ao_b_h_pins[]            = { PIN(GPIOH_3, EE_OFF) };
+
+/* jtag_b */
+static const unsigned int jtag_b_tdo_pins[]            = { PIN(GPIOC_0, EE_OFF) };
+static const unsigned int jtag_b_tdi_pins[]            = { PIN(GPIOC_1, EE_OFF) };
+static const unsigned int jtag_b_clk_pins[]            = { PIN(GPIOC_4, EE_OFF) };
+static const unsigned int jtag_b_tms_pins[]            = { PIN(GPIOC_5, EE_OFF) };
+
+/* bt565_a */
+static const unsigned int bt565_a_vs_pins[]            = { PIN(GPIOZ_0, EE_OFF) };
+static const unsigned int bt565_a_hs_pins[]            = { PIN(GPIOZ_1, EE_OFF) };
+static const unsigned int bt565_a_clk_pins[]           = { PIN(GPIOZ_3, EE_OFF) };
+static const unsigned int bt565_a_din0_pins[]          = { PIN(GPIOZ_4, EE_OFF) };
+static const unsigned int bt565_a_din1_pins[]          = { PIN(GPIOZ_5, EE_OFF) };
+static const unsigned int bt565_a_din2_pins[]          = { PIN(GPIOZ_6, EE_OFF) };
+static const unsigned int bt565_a_din3_pins[]          = { PIN(GPIOZ_7, EE_OFF) };
+static const unsigned int bt565_a_din4_pins[]          = { PIN(GPIOZ_8, EE_OFF) };
+static const unsigned int bt565_a_din5_pins[]          = { PIN(GPIOZ_9, EE_OFF) };
+static const unsigned int bt565_a_din6_pins[]          = { PIN(GPIOZ_10, EE_OFF) };
+static const unsigned int bt565_a_din7_pins[]          = { PIN(GPIOZ_11, EE_OFF) };
+
+/* tsin_a */
+static const unsigned int tsin_a_valid_pins[]          = { PIN(GPIOX_2, EE_OFF) };
+static const unsigned int tsin_a_sop_pins[]            = { PIN(GPIOX_1, EE_OFF) };
+static const unsigned int tsin_a_din0_pins[]           = { PIN(GPIOX_0, EE_OFF) };
+static const unsigned int tsin_a_clk_pins[]            = { PIN(GPIOX_3, EE_OFF) };
+
+/* tsin_b */
+static const unsigned int tsin_b_valid_x_pins[]                = { PIN(GPIOX_9, EE_OFF) };
+static const unsigned int tsin_b_sop_x_pins[]          = { PIN(GPIOX_8, EE_OFF) };
+static const unsigned int tsin_b_din0_x_pins[]         = { PIN(GPIOX_10, EE_OFF) };
+static const unsigned int tsin_b_clk_x_pins[]          = { PIN(GPIOX_11, EE_OFF) };
+
+static const unsigned int tsin_b_valid_z_pins[]                = { PIN(GPIOZ_2, EE_OFF) };
+static const unsigned int tsin_b_sop_z_pins[]          = { PIN(GPIOZ_3, EE_OFF) };
+static const unsigned int tsin_b_din0_z_pins[]         = { PIN(GPIOZ_4, EE_OFF) };
+static const unsigned int tsin_b_clk_z_pins[]          = { PIN(GPIOZ_5, EE_OFF) };
+
+static const unsigned int tsin_b_fail_pins[]           = { PIN(GPIOZ_6, EE_OFF) };
+static const unsigned int tsin_b_din1_pins[]           = { PIN(GPIOZ_7, EE_OFF) };
+static const unsigned int tsin_b_din2_pins[]           = { PIN(GPIOZ_8, EE_OFF) };
+static const unsigned int tsin_b_din3_pins[]           = { PIN(GPIOZ_9, EE_OFF) };
+static const unsigned int tsin_b_din4_pins[]           = { PIN(GPIOZ_10, EE_OFF) };
+static const unsigned int tsin_b_din5_pins[]           = { PIN(GPIOZ_11, EE_OFF) };
+static const unsigned int tsin_b_din6_pins[]           = { PIN(GPIOZ_12, EE_OFF) };
+static const unsigned int tsin_b_din7_pins[]           = { PIN(GPIOZ_13, EE_OFF) };
+
+/* hdmitx */
+static const unsigned int hdmitx_sda_pins[]            = { PIN(GPIOH_0, EE_OFF) };
+static const unsigned int hdmitx_sck_pins[]            = { PIN(GPIOH_1, EE_OFF) };
+static const unsigned int hdmitx_hpd_in_pins[]         = { PIN(GPIOH_2, EE_OFF) };
+
+/* pdm */
+static const unsigned int pdm_din0_c_pins[]            = { PIN(GPIOC_0, EE_OFF) };
+static const unsigned int pdm_din1_c_pins[]            = { PIN(GPIOC_1, EE_OFF) };
+static const unsigned int pdm_din2_c_pins[]            = { PIN(GPIOC_2, EE_OFF) };
+static const unsigned int pdm_din3_c_pins[]            = { PIN(GPIOC_3, EE_OFF) };
+static const unsigned int pdm_dclk_c_pins[]            = { PIN(GPIOC_4, EE_OFF) };
+
+static const unsigned int pdm_din0_x_pins[]            = { PIN(GPIOX_0, EE_OFF) };
+static const unsigned int pdm_din1_x_pins[]            = { PIN(GPIOX_1, EE_OFF) };
+static const unsigned int pdm_din2_x_pins[]            = { PIN(GPIOX_2, EE_OFF) };
+static const unsigned int pdm_din3_x_pins[]            = { PIN(GPIOX_3, EE_OFF) };
+static const unsigned int pdm_dclk_x_pins[]            = { PIN(GPIOX_4, EE_OFF) };
+
+static const unsigned int pdm_din0_z_pins[]            = { PIN(GPIOZ_2, EE_OFF) };
+static const unsigned int pdm_din1_z_pins[]            = { PIN(GPIOZ_3, EE_OFF) };
+static const unsigned int pdm_din2_z_pins[]            = { PIN(GPIOZ_4, EE_OFF) };
+static const unsigned int pdm_din3_z_pins[]            = { PIN(GPIOZ_5, EE_OFF) };
+static const unsigned int pdm_dclk_z_pins[]            = { PIN(GPIOZ_6, EE_OFF) };
+
+static const unsigned int pdm_din0_a_pins[]            = { PIN(GPIOA_8, EE_OFF) };
+static const unsigned int pdm_din1_a_pins[]            = { PIN(GPIOA_9, EE_OFF) };
+static const unsigned int pdm_din2_a_pins[]            = { PIN(GPIOA_6, EE_OFF) };
+static const unsigned int pdm_din3_a_pins[]            = { PIN(GPIOA_5, EE_OFF) };
+static const unsigned int pdm_dclk_a_pins[]            = { PIN(GPIOA_7, EE_OFF) };
+
+/* spdif_in */
+static const unsigned int spdif_in_h_pins[]            = { PIN(GPIOH_5, EE_OFF) };
+static const unsigned int spdif_in_a10_pins[]          = { PIN(GPIOA_10, EE_OFF) };
+static const unsigned int spdif_in_a12_pins[]          = { PIN(GPIOA_12, EE_OFF) };
+
+/* spdif_out */
+static const unsigned int spdif_out_h_pins[]           = { PIN(GPIOH_4, EE_OFF) };
+static const unsigned int spdif_out_a11_pins[]         = { PIN(GPIOA_11, EE_OFF) };
+static const unsigned int spdif_out_a13_pins[]         = { PIN(GPIOA_13, EE_OFF) };
+
+/* mclk0 */
+static const unsigned int mclk0_a_pins[]               = { PIN(GPIOA_0, EE_OFF) };
+
+/* mclk1 */
+static const unsigned int mclk1_x_pins[]               = { PIN(GPIOX_5, EE_OFF) };
+static const unsigned int mclk1_z_pins[]               = { PIN(GPIOZ_8, EE_OFF) };
+static const unsigned int mclk1_a_pins[]               = { PIN(GPIOA_11, EE_OFF) };
+
+/* tdm */
+static const unsigned int tdm_a_slv_sclk_pins[]                = { PIN(GPIOX_11, EE_OFF) };
+static const unsigned int tdm_a_slv_fs_pins[]          = { PIN(GPIOX_10, EE_OFF) };
+static const unsigned int tdm_a_sclk_pins[]            = { PIN(GPIOX_11, EE_OFF) };
+static const unsigned int tdm_a_fs_pins[]              = { PIN(GPIOX_10, EE_OFF) };
+static const unsigned int tdm_a_din0_pins[]            = { PIN(GPIOX_9, EE_OFF) };
+static const unsigned int tdm_a_din1_pins[]            = { PIN(GPIOX_8, EE_OFF) };
+static const unsigned int tdm_a_dout0_pins[]           = { PIN(GPIOX_9, EE_OFF) };
+static const unsigned int tdm_a_dout1_pins[]           = { PIN(GPIOX_8, EE_OFF) };
+
+static const unsigned int tdm_b_slv_sclk_pins[]                = { PIN(GPIOA_1, EE_OFF) };
+static const unsigned int tdm_b_slv_fs_pins[]          = { PIN(GPIOA_2, EE_OFF) };
+static const unsigned int tdm_b_sclk_pins[]            = { PIN(GPIOA_1, EE_OFF) };
+static const unsigned int tdm_b_fs_pins[]              = { PIN(GPIOA_2, EE_OFF) };
+static const unsigned int tdm_b_din0_pins[]            = { PIN(GPIOA_3, EE_OFF) };
+static const unsigned int tdm_b_din1_pins[]            = { PIN(GPIOA_4, EE_OFF) };
+static const unsigned int tdm_b_din2_pins[]            = { PIN(GPIOA_5, EE_OFF) };
+static const unsigned int tdm_b_din3_a_pins[]          = { PIN(GPIOA_6, EE_OFF) };
+static const unsigned int tdm_b_din3_h_pins[]          = { PIN(GPIOH_5, EE_OFF) };
+static const unsigned int tdm_b_dout0_pins[]           = { PIN(GPIOA_3, EE_OFF) };
+static const unsigned int tdm_b_dout1_pins[]           = { PIN(GPIOA_4, EE_OFF) };
+static const unsigned int tdm_b_dout2_pins[]           = { PIN(GPIOA_5, EE_OFF) };
+static const unsigned int tdm_b_dout3_a_pins[]         = { PIN(GPIOA_6, EE_OFF) };
+static const unsigned int tdm_b_dout3_h_pins[]         = { PIN(GPIOH_5, EE_OFF) };
+
+static const unsigned int tdm_c_slv_sclk_a_pins[]      = { PIN(GPIOA_12, EE_OFF) };
+static const unsigned int tdm_c_slv_fs_a_pins[]                = { PIN(GPIOA_13, EE_OFF) };
+static const unsigned int tdm_c_slv_sclk_z_pins[]      = { PIN(GPIOZ_7, EE_OFF) };
+static const unsigned int tdm_c_slv_fs_z_pins[]                = { PIN(GPIOZ_6, EE_OFF) };
+static const unsigned int tdm_c_sclk_a_pins[]          = { PIN(GPIOA_12, EE_OFF) };
+static const unsigned int tdm_c_fs_a_pins[]            = { PIN(GPIOA_13, EE_OFF) };
+static const unsigned int tdm_c_sclk_z_pins[]          = { PIN(GPIOZ_7, EE_OFF) };
+static const unsigned int tdm_c_fs_z_pins[]            = { PIN(GPIOZ_6, EE_OFF) };
+static const unsigned int tdm_c_din0_a_pins[]          = { PIN(GPIOA_10, EE_OFF) };
+static const unsigned int tdm_c_din1_a_pins[]          = { PIN(GPIOA_9, EE_OFF) };
+static const unsigned int tdm_c_din2_a_pins[]          = { PIN(GPIOA_8, EE_OFF) };
+static const unsigned int tdm_c_din3_a_pins[]          = { PIN(GPIOA_7, EE_OFF) };
+static const unsigned int tdm_c_din0_z_pins[]          = { PIN(GPIOZ_2, EE_OFF) };
+static const unsigned int tdm_c_din1_z_pins[]          = { PIN(GPIOZ_3, EE_OFF) };
+static const unsigned int tdm_c_din2_z_pins[]          = { PIN(GPIOZ_4, EE_OFF) };
+static const unsigned int tdm_c_din3_z_pins[]          = { PIN(GPIOZ_5, EE_OFF) };
+static const unsigned int tdm_c_dout0_a_pins[]         = { PIN(GPIOA_10, EE_OFF) };
+static const unsigned int tdm_c_dout1_a_pins[]         = { PIN(GPIOA_9, EE_OFF) };
+static const unsigned int tdm_c_dout2_a_pins[]         = { PIN(GPIOA_8, EE_OFF) };
+static const unsigned int tdm_c_dout3_a_pins[]         = { PIN(GPIOA_7, EE_OFF) };
+static const unsigned int tdm_c_dout0_z_pins[]         = { PIN(GPIOZ_2, EE_OFF) };
+static const unsigned int tdm_c_dout1_z_pins[]         = { PIN(GPIOZ_3, EE_OFF) };
+static const unsigned int tdm_c_dout2_z_pins[]         = { PIN(GPIOZ_4, EE_OFF) };
+static const unsigned int tdm_c_dout3_z_pins[]         = { PIN(GPIOZ_5, EE_OFF) };
+
+static struct meson_pmx_group meson_g12a_periphs_groups[] = {
+       GPIO_GROUP(GPIOZ_0, EE_OFF),
+       GPIO_GROUP(GPIOZ_1, EE_OFF),
+       GPIO_GROUP(GPIOZ_2, EE_OFF),
+       GPIO_GROUP(GPIOZ_3, EE_OFF),
+       GPIO_GROUP(GPIOZ_4, EE_OFF),
+       GPIO_GROUP(GPIOZ_5, EE_OFF),
+       GPIO_GROUP(GPIOZ_6, EE_OFF),
+       GPIO_GROUP(GPIOZ_7, EE_OFF),
+       GPIO_GROUP(GPIOZ_8, EE_OFF),
+       GPIO_GROUP(GPIOZ_9, EE_OFF),
+       GPIO_GROUP(GPIOZ_10, EE_OFF),
+       GPIO_GROUP(GPIOZ_11, EE_OFF),
+       GPIO_GROUP(GPIOZ_12, EE_OFF),
+       GPIO_GROUP(GPIOZ_13, EE_OFF),
+       GPIO_GROUP(GPIOZ_14, EE_OFF),
+       GPIO_GROUP(GPIOZ_15, EE_OFF),
+       GPIO_GROUP(GPIOH_0, EE_OFF),
+       GPIO_GROUP(GPIOH_1, EE_OFF),
+       GPIO_GROUP(GPIOH_2, EE_OFF),
+       GPIO_GROUP(GPIOH_3, EE_OFF),
+       GPIO_GROUP(GPIOH_4, EE_OFF),
+       GPIO_GROUP(GPIOH_5, EE_OFF),
+       GPIO_GROUP(GPIOH_6, EE_OFF),
+       GPIO_GROUP(GPIOH_7, EE_OFF),
+       GPIO_GROUP(GPIOH_8, EE_OFF),
+       GPIO_GROUP(BOOT_0, EE_OFF),
+       GPIO_GROUP(BOOT_1, EE_OFF),
+       GPIO_GROUP(BOOT_2, EE_OFF),
+       GPIO_GROUP(BOOT_3, EE_OFF),
+       GPIO_GROUP(BOOT_4, EE_OFF),
+       GPIO_GROUP(BOOT_5, EE_OFF),
+       GPIO_GROUP(BOOT_6, EE_OFF),
+       GPIO_GROUP(BOOT_7, EE_OFF),
+       GPIO_GROUP(BOOT_8, EE_OFF),
+       GPIO_GROUP(BOOT_9, EE_OFF),
+       GPIO_GROUP(BOOT_10, EE_OFF),
+       GPIO_GROUP(BOOT_11, EE_OFF),
+       GPIO_GROUP(BOOT_12, EE_OFF),
+       GPIO_GROUP(BOOT_13, EE_OFF),
+       GPIO_GROUP(BOOT_14, EE_OFF),
+       GPIO_GROUP(BOOT_15, EE_OFF),
+       GPIO_GROUP(GPIOC_0, EE_OFF),
+       GPIO_GROUP(GPIOC_1, EE_OFF),
+       GPIO_GROUP(GPIOC_2, EE_OFF),
+       GPIO_GROUP(GPIOC_3, EE_OFF),
+       GPIO_GROUP(GPIOC_4, EE_OFF),
+       GPIO_GROUP(GPIOC_5, EE_OFF),
+       GPIO_GROUP(GPIOC_6, EE_OFF),
+       GPIO_GROUP(GPIOC_7, EE_OFF),
+       GPIO_GROUP(GPIOA_0, EE_OFF),
+       GPIO_GROUP(GPIOA_1, EE_OFF),
+       GPIO_GROUP(GPIOA_2, EE_OFF),
+       GPIO_GROUP(GPIOA_3, EE_OFF),
+       GPIO_GROUP(GPIOA_4, EE_OFF),
+       GPIO_GROUP(GPIOA_5, EE_OFF),
+       GPIO_GROUP(GPIOA_6, EE_OFF),
+       GPIO_GROUP(GPIOA_7, EE_OFF),
+       GPIO_GROUP(GPIOA_8, EE_OFF),
+       GPIO_GROUP(GPIOA_9, EE_OFF),
+       GPIO_GROUP(GPIOA_10, EE_OFF),
+       GPIO_GROUP(GPIOA_11, EE_OFF),
+       GPIO_GROUP(GPIOA_12, EE_OFF),
+       GPIO_GROUP(GPIOA_13, EE_OFF),
+       GPIO_GROUP(GPIOA_14, EE_OFF),
+       GPIO_GROUP(GPIOA_15, EE_OFF),
+       GPIO_GROUP(GPIOX_0, EE_OFF),
+       GPIO_GROUP(GPIOX_1, EE_OFF),
+       GPIO_GROUP(GPIOX_2, EE_OFF),
+       GPIO_GROUP(GPIOX_3, EE_OFF),
+       GPIO_GROUP(GPIOX_4, EE_OFF),
+       GPIO_GROUP(GPIOX_5, EE_OFF),
+       GPIO_GROUP(GPIOX_6, EE_OFF),
+       GPIO_GROUP(GPIOX_7, EE_OFF),
+       GPIO_GROUP(GPIOX_8, EE_OFF),
+       GPIO_GROUP(GPIOX_9, EE_OFF),
+       GPIO_GROUP(GPIOX_10, EE_OFF),
+       GPIO_GROUP(GPIOX_11, EE_OFF),
+       GPIO_GROUP(GPIOX_12, EE_OFF),
+       GPIO_GROUP(GPIOX_13, EE_OFF),
+       GPIO_GROUP(GPIOX_14, EE_OFF),
+       GPIO_GROUP(GPIOX_15, EE_OFF),
+       GPIO_GROUP(GPIOX_16, EE_OFF),
+       GPIO_GROUP(GPIOX_17, EE_OFF),
+       GPIO_GROUP(GPIOX_18, EE_OFF),
+       GPIO_GROUP(GPIOX_19, EE_OFF),
+
+       /* bank BOOT */
+       GROUP(emmc_nand_d0,             1),
+       GROUP(emmc_nand_d1,             1),
+       GROUP(emmc_nand_d2,             1),
+       GROUP(emmc_nand_d3,             1),
+       GROUP(emmc_nand_d4,             1),
+       GROUP(emmc_nand_d5,             1),
+       GROUP(emmc_nand_d6,             1),
+       GROUP(emmc_nand_d7,             1),
+       GROUP(emmc_clk,                 1),
+       GROUP(emmc_cmd,                 1),
+       GROUP(emmc_nand_ds,             1),
+       GROUP(nand_ce0,                 2),
+       GROUP(nand_ale,                 2),
+       GROUP(nand_cle,                 2),
+       GROUP(nand_wen_clk,             2),
+       GROUP(nand_ren_wr,              2),
+       GROUP(nand_rb0,                 2),
+       GROUP(nand_ce1,                 2),
+       GROUP(nor_hold,                 3),
+       GROUP(nor_d,                    3),
+       GROUP(nor_q,                    3),
+       GROUP(nor_c,                    3),
+       GROUP(nor_wp,                   3),
+       GROUP(nor_cs,                   3),
+
+       /* bank GPIOZ */
+       GROUP(sdcard_d0_z,              5),
+       GROUP(sdcard_d1_z,              5),
+       GROUP(sdcard_d2_z,              5),
+       GROUP(sdcard_d3_z,              5),
+       GROUP(sdcard_clk_z,             5),
+       GROUP(sdcard_cmd_z,             5),
+       GROUP(i2c0_sda_z0,              4),
+       GROUP(i2c0_sck_z1,              4),
+       GROUP(i2c0_sda_z7,              7),
+       GROUP(i2c0_sck_z8,              7),
+       GROUP(i2c2_sda_z,               3),
+       GROUP(i2c2_sck_z,               3),
+       GROUP(iso7816_clk_z,            3),
+       GROUP(iso7816_data_z,           3),
+       GROUP(eth_mdio,                 1),
+       GROUP(eth_mdc,                  1),
+       GROUP(eth_rgmii_rx_clk,         1),
+       GROUP(eth_rx_dv,                1),
+       GROUP(eth_rxd0,                 1),
+       GROUP(eth_rxd1,                 1),
+       GROUP(eth_rxd2_rgmii,           1),
+       GROUP(eth_rxd3_rgmii,           1),
+       GROUP(eth_rgmii_tx_clk,         1),
+       GROUP(eth_txen,                 1),
+       GROUP(eth_txd0,                 1),
+       GROUP(eth_txd1,                 1),
+       GROUP(eth_txd2_rgmii,           1),
+       GROUP(eth_txd3_rgmii,           1),
+       GROUP(eth_link_led,             1),
+       GROUP(eth_act_led,              1),
+       GROUP(bt565_a_vs,               2),
+       GROUP(bt565_a_hs,               2),
+       GROUP(bt565_a_clk,              2),
+       GROUP(bt565_a_din0,             2),
+       GROUP(bt565_a_din1,             2),
+       GROUP(bt565_a_din2,             2),
+       GROUP(bt565_a_din3,             2),
+       GROUP(bt565_a_din4,             2),
+       GROUP(bt565_a_din5,             2),
+       GROUP(bt565_a_din6,             2),
+       GROUP(bt565_a_din7,             2),
+       GROUP(tsin_b_valid_z,           3),
+       GROUP(tsin_b_sop_z,             3),
+       GROUP(tsin_b_din0_z,            3),
+       GROUP(tsin_b_clk_z,             3),
+       GROUP(tsin_b_fail,              3),
+       GROUP(tsin_b_din1,              3),
+       GROUP(tsin_b_din2,              3),
+       GROUP(tsin_b_din3,              3),
+       GROUP(tsin_b_din4,              3),
+       GROUP(tsin_b_din5,              3),
+       GROUP(tsin_b_din6,              3),
+       GROUP(tsin_b_din7,              3),
+       GROUP(pdm_din0_z,               7),
+       GROUP(pdm_din1_z,               7),
+       GROUP(pdm_din2_z,               7),
+       GROUP(pdm_din3_z,               7),
+       GROUP(pdm_dclk_z,               7),
+       GROUP(tdm_c_slv_sclk_z,         6),
+       GROUP(tdm_c_slv_fs_z,           6),
+       GROUP(tdm_c_din0_z,             6),
+       GROUP(tdm_c_din1_z,             6),
+       GROUP(tdm_c_din2_z,             6),
+       GROUP(tdm_c_din3_z,             6),
+       GROUP(tdm_c_sclk_z,             4),
+       GROUP(tdm_c_fs_z,               4),
+       GROUP(tdm_c_dout0_z,            4),
+       GROUP(tdm_c_dout1_z,            4),
+       GROUP(tdm_c_dout2_z,            4),
+       GROUP(tdm_c_dout3_z,            4),
+       GROUP(mclk1_z,                  4),
+
+       /* bank GPIOX */
+       GROUP(sdio_d0,                  1),
+       GROUP(sdio_d1,                  1),
+       GROUP(sdio_d2,                  1),
+       GROUP(sdio_d3,                  1),
+       GROUP(sdio_clk,                 1),
+       GROUP(sdio_cmd,                 1),
+       GROUP(spi0_mosi_x,              4),
+       GROUP(spi0_miso_x,              4),
+       GROUP(spi0_ss0_x,               4),
+       GROUP(spi0_clk_x,               4),
+       GROUP(i2c1_sda_x,               5),
+       GROUP(i2c1_sck_x,               5),
+       GROUP(i2c2_sda_x,               1),
+       GROUP(i2c2_sck_x,               1),
+       GROUP(uart_a_tx,                1),
+       GROUP(uart_a_rx,                1),
+       GROUP(uart_a_cts,               1),
+       GROUP(uart_a_rts,               1),
+       GROUP(uart_b_tx,                2),
+       GROUP(uart_b_rx,                2),
+       GROUP(iso7816_clk_x,            6),
+       GROUP(iso7816_data_x,           6),
+       GROUP(pwm_a,                    1),
+       GROUP(pwm_b_x7,                 4),
+       GROUP(pwm_b_x19,                1),
+       GROUP(pwm_c_x5,                 4),
+       GROUP(pwm_c_x8,                 5),
+       GROUP(pwm_d_x3,                 4),
+       GROUP(pwm_d_x6,                 4),
+       GROUP(pwm_e,                    1),
+       GROUP(pwm_f_x,                  1),
+       GROUP(tsin_a_valid,             3),
+       GROUP(tsin_a_sop,               3),
+       GROUP(tsin_a_din0,              3),
+       GROUP(tsin_a_clk,               3),
+       GROUP(tsin_b_valid_x,           3),
+       GROUP(tsin_b_sop_x,             3),
+       GROUP(tsin_b_din0_x,            3),
+       GROUP(tsin_b_clk_x,             3),
+       GROUP(pdm_din0_x,               2),
+       GROUP(pdm_din1_x,               2),
+       GROUP(pdm_din2_x,               2),
+       GROUP(pdm_din3_x,               2),
+       GROUP(pdm_dclk_x,               2),
+       GROUP(tdm_a_slv_sclk,           2),
+       GROUP(tdm_a_slv_fs,             2),
+       GROUP(tdm_a_din0,               2),
+       GROUP(tdm_a_din1,               2),
+       GROUP(tdm_a_sclk,               1),
+       GROUP(tdm_a_fs,                 1),
+       GROUP(tdm_a_dout0,              1),
+       GROUP(tdm_a_dout1,              1),
+       GROUP(mclk1_x,                  2),
+
+       /* bank GPIOC */
+       GROUP(sdcard_d0_c,              1),
+       GROUP(sdcard_d1_c,              1),
+       GROUP(sdcard_d2_c,              1),
+       GROUP(sdcard_d3_c,              1),
+       GROUP(sdcard_clk_c,             1),
+       GROUP(sdcard_cmd_c,             1),
+       GROUP(spi0_mosi_c,              5),
+       GROUP(spi0_miso_c,              5),
+       GROUP(spi0_ss0_c,               5),
+       GROUP(spi0_clk_c,               5),
+       GROUP(i2c0_sda_c,               3),
+       GROUP(i2c0_sck_c,               3),
+       GROUP(uart_ao_a_rx_c,           2),
+       GROUP(uart_ao_a_tx_c,           2),
+       GROUP(iso7816_clk_c,            5),
+       GROUP(iso7816_data_c,           5),
+       GROUP(pwm_c_c,                  5),
+       GROUP(jtag_b_tdo,               2),
+       GROUP(jtag_b_tdi,               2),
+       GROUP(jtag_b_clk,               2),
+       GROUP(jtag_b_tms,               2),
+       GROUP(pdm_din0_c,               4),
+       GROUP(pdm_din1_c,               4),
+       GROUP(pdm_din2_c,               4),
+       GROUP(pdm_din3_c,               4),
+       GROUP(pdm_dclk_c,               4),
+
+       /* bank GPIOH */
+       GROUP(spi1_mosi,                3),
+       GROUP(spi1_miso,                3),
+       GROUP(spi1_ss0,                 3),
+       GROUP(spi1_clk,                 3),
+       GROUP(i2c1_sda_h2,              2),
+       GROUP(i2c1_sck_h3,              2),
+       GROUP(i2c1_sda_h6,              4),
+       GROUP(i2c1_sck_h7,              4),
+       GROUP(i2c3_sda_h,               2),
+       GROUP(i2c3_sck_h,               2),
+       GROUP(uart_c_tx,                2),
+       GROUP(uart_c_rx,                2),
+       GROUP(uart_c_cts,               2),
+       GROUP(uart_c_rts,               2),
+       GROUP(iso7816_clk_h,            1),
+       GROUP(iso7816_data_h,           1),
+       GROUP(pwm_f_h,                  4),
+       GROUP(cec_ao_a_h,               4),
+       GROUP(cec_ao_b_h,               5),
+       GROUP(hdmitx_sda,               1),
+       GROUP(hdmitx_sck,               1),
+       GROUP(hdmitx_hpd_in,            1),
+       GROUP(spdif_out_h,              1),
+       GROUP(spdif_in_h,               1),
+       GROUP(tdm_b_din3_h,             6),
+       GROUP(tdm_b_dout3_h,            5),
+
+       /* bank GPIOA */
+       GROUP(i2c3_sda_a,               2),
+       GROUP(i2c3_sck_a,               2),
+       GROUP(pdm_din0_a,               1),
+       GROUP(pdm_din1_a,               1),
+       GROUP(pdm_din2_a,               1),
+       GROUP(pdm_din3_a,               1),
+       GROUP(pdm_dclk_a,               1),
+       GROUP(spdif_in_a10,             1),
+       GROUP(spdif_in_a12,             1),
+       GROUP(spdif_out_a11,            1),
+       GROUP(spdif_out_a13,            1),
+       GROUP(tdm_b_slv_sclk,           2),
+       GROUP(tdm_b_slv_fs,             2),
+       GROUP(tdm_b_din0,               2),
+       GROUP(tdm_b_din1,               2),
+       GROUP(tdm_b_din2,               2),
+       GROUP(tdm_b_din3_a,             2),
+       GROUP(tdm_b_sclk,               1),
+       GROUP(tdm_b_fs,                 1),
+       GROUP(tdm_b_dout0,              1),
+       GROUP(tdm_b_dout1,              1),
+       GROUP(tdm_b_dout2,              3),
+       GROUP(tdm_b_dout3_a,            3),
+       GROUP(tdm_c_slv_sclk_a,         3),
+       GROUP(tdm_c_slv_fs_a,           3),
+       GROUP(tdm_c_din0_a,             3),
+       GROUP(tdm_c_din1_a,             3),
+       GROUP(tdm_c_din2_a,             3),
+       GROUP(tdm_c_din3_a,             3),
+       GROUP(tdm_c_sclk_a,             2),
+       GROUP(tdm_c_fs_a,               2),
+       GROUP(tdm_c_dout0_a,            2),
+       GROUP(tdm_c_dout1_a,            2),
+       GROUP(tdm_c_dout2_a,            2),
+       GROUP(tdm_c_dout3_a,            2),
+       GROUP(mclk0_a,                  1),
+       GROUP(mclk1_a,                  2),
+};
+
+/* uart_ao_a */
+static const unsigned int uart_ao_a_tx_pins[]          = { GPIOAO_0 };
+static const unsigned int uart_ao_a_rx_pins[]          = { GPIOAO_1 };
+static const unsigned int uart_ao_a_cts_pins[]         = { GPIOE_0 };
+static const unsigned int uart_ao_a_rts_pins[]         = { GPIOE_1 };
+
+/* uart_ao_b */
+static const unsigned int uart_ao_b_tx_2_pins[]                = { GPIOAO_2 };
+static const unsigned int uart_ao_b_rx_3_pins[]                = { GPIOAO_3 };
+static const unsigned int uart_ao_b_tx_8_pins[]                = { GPIOAO_8 };
+static const unsigned int uart_ao_b_rx_9_pins[]                = { GPIOAO_9 };
+static const unsigned int uart_ao_b_cts_pins[]         = { GPIOE_0 };
+static const unsigned int uart_ao_b_rts_pins[]         = { GPIOE_1 };
+
+/* i2c_ao */
+static const unsigned int i2c_ao_sck_pins[]            = { GPIOAO_2 };
+static const unsigned int i2c_ao_sda_pins[]            = { GPIOAO_3 };
+
+static const unsigned int i2c_ao_sck_e_pins[]          = { GPIOE_0 };
+static const unsigned int i2c_ao_sda_e_pins[]          = { GPIOE_1 };
+
+/* i2c_ao_slave */
+static const unsigned int i2c_ao_slave_sck_pins[]      = { GPIOAO_2 };
+static const unsigned int i2c_ao_slave_sda_pins[]      = { GPIOAO_3 };
+
+/* ir_in */
+static const unsigned int remote_ao_input_pins[]       = { GPIOAO_5 };
+
+/* ir_out */
+static const unsigned int remote_ao_out_pins[]         = { GPIOAO_4 };
+
+/* pwm_ao_a */
+static const unsigned int pwm_ao_a_pins[]              = { GPIOAO_11 };
+static const unsigned int pwm_ao_a_hiz_pins[]          = { GPIOAO_11 };
+
+/* pwm_ao_b */
+static const unsigned int pwm_ao_b_pins[]              = { GPIOE_0 };
+
+/* pwm_ao_c */
+static const unsigned int pwm_ao_c_4_pins[]            = { GPIOAO_4 };
+static const unsigned int pwm_ao_c_hiz_pins[]          = { GPIOAO_4 };
+static const unsigned int pwm_ao_c_6_pins[]            = { GPIOAO_6 };
+
+/* pwm_ao_d */
+static const unsigned int pwm_ao_d_5_pins[]            = { GPIOAO_5 };
+static const unsigned int pwm_ao_d_10_pins[]           = { GPIOAO_10 };
+static const unsigned int pwm_ao_d_e_pins[]            = { GPIOE_1 };
+
+/* jtag_a */
+static const unsigned int jtag_a_tdi_pins[]            = { GPIOAO_8 };
+static const unsigned int jtag_a_tdo_pins[]            = { GPIOAO_9 };
+static const unsigned int jtag_a_clk_pins[]            = { GPIOAO_6 };
+static const unsigned int jtag_a_tms_pins[]            = { GPIOAO_7 };
+
+/* cec_ao */
+static const unsigned int cec_ao_a_pins[]              = { GPIOAO_10 };
+static const unsigned int cec_ao_b_pins[]              = { GPIOAO_10 };
+
+/* tsin_ao_a */
+static const unsigned int tsin_ao_asop_pins[]          = { GPIOAO_6 };
+static const unsigned int tsin_ao_adin0_pins[]         = { GPIOAO_7 };
+static const unsigned int tsin_ao_aclk_pins[]          = { GPIOAO_8 };
+static const unsigned int tsin_ao_a_valid_pins[]       = { GPIOAO_9 };
+
+/* spdif_ao_out */
+static const unsigned int spdif_ao_out_pins[]          = { GPIOAO_10 };
+
+/* tdm_ao_b */
+static const unsigned int tdm_ao_b_slv_fs_pins[]       = { GPIOAO_7 };
+static const unsigned int tdm_ao_b_slv_sclk_pins[]     = { GPIOAO_8 };
+static const unsigned int tdm_ao_b_fs_pins[]           = { GPIOAO_7 };
+static const unsigned int tdm_ao_b_sclk_pins[]         = { GPIOAO_8 };
+static const unsigned int tdm_ao_b_din0_pins[]         = { GPIOAO_4 };
+static const unsigned int tdm_ao_b_din1_pins[]         = { GPIOAO_10 };
+static const unsigned int tdm_ao_b_din2_pins[]         = { GPIOAO_6 };
+static const unsigned int tdm_ao_b_dout0_pins[]                = { GPIOAO_4 };
+static const unsigned int tdm_ao_b_dout1_pins[]                = { GPIOAO_10 };
+static const unsigned int tdm_ao_b_dout2_pins[]                = { GPIOAO_6 };
+
+/* mclk0_ao */
+static const unsigned int mclk0_ao_pins[]              = { GPIOAO_9 };
+
+static struct meson_pmx_group meson_g12a_aobus_groups[] = {
+       GPIO_GROUP(GPIOAO_0, 0),
+       GPIO_GROUP(GPIOAO_1, 0),
+       GPIO_GROUP(GPIOAO_2, 0),
+       GPIO_GROUP(GPIOAO_3, 0),
+       GPIO_GROUP(GPIOAO_4, 0),
+       GPIO_GROUP(GPIOAO_5, 0),
+       GPIO_GROUP(GPIOAO_6, 0),
+       GPIO_GROUP(GPIOAO_7, 0),
+       GPIO_GROUP(GPIOAO_8, 0),
+       GPIO_GROUP(GPIOAO_9, 0),
+       GPIO_GROUP(GPIOAO_10, 0),
+       GPIO_GROUP(GPIOAO_11, 0),
+       GPIO_GROUP(GPIOE_0, 0),
+       GPIO_GROUP(GPIOE_1, 0),
+       GPIO_GROUP(GPIOE_2, 0),
+
+       /* bank AO */
+       GROUP(uart_ao_a_tx,             1),
+       GROUP(uart_ao_a_rx,             1),
+       GROUP(uart_ao_a_cts,            1),
+       GROUP(uart_ao_a_rts,            1),
+       GROUP(uart_ao_b_tx_2,           2),
+       GROUP(uart_ao_b_rx_3,           2),
+       GROUP(uart_ao_b_tx_8,           3),
+       GROUP(uart_ao_b_rx_9,           3),
+       GROUP(uart_ao_b_cts,            2),
+       GROUP(uart_ao_b_rts,            2),
+       GROUP(i2c_ao_sck,               1),
+       GROUP(i2c_ao_sda,               1),
+       GROUP(i2c_ao_sck_e,             4),
+       GROUP(i2c_ao_sda_e,             4),
+       GROUP(i2c_ao_slave_sck,         3),
+       GROUP(i2c_ao_slave_sda,         3),
+       GROUP(remote_ao_input,          1),
+       GROUP(remote_ao_out,            1),
+       GROUP(pwm_ao_a,                 3),
+       GROUP(pwm_ao_a_hiz,             2),
+       GROUP(pwm_ao_b,                 3),
+       GROUP(pwm_ao_c_4,               3),
+       GROUP(pwm_ao_c_hiz,             4),
+       GROUP(pwm_ao_c_6,               3),
+       GROUP(pwm_ao_d_5,               3),
+       GROUP(pwm_ao_d_10,              3),
+       GROUP(pwm_ao_d_e,               3),
+       GROUP(jtag_a_tdi,               1),
+       GROUP(jtag_a_tdo,               1),
+       GROUP(jtag_a_clk,               1),
+       GROUP(jtag_a_tms,               1),
+       GROUP(cec_ao_a,                 1),
+       GROUP(cec_ao_b,                 2),
+       GROUP(tsin_ao_asop,             4),
+       GROUP(tsin_ao_adin0,            4),
+       GROUP(tsin_ao_aclk,             4),
+       GROUP(tsin_ao_a_valid,          4),
+       GROUP(spdif_ao_out,             4),
+       GROUP(tdm_ao_b_dout0,           5),
+       GROUP(tdm_ao_b_dout1,           5),
+       GROUP(tdm_ao_b_dout2,           5),
+       GROUP(tdm_ao_b_fs,              5),
+       GROUP(tdm_ao_b_sclk,            5),
+       GROUP(tdm_ao_b_din0,            6),
+       GROUP(tdm_ao_b_din1,            6),
+       GROUP(tdm_ao_b_din2,            6),
+       GROUP(tdm_ao_b_slv_fs,          6),
+       GROUP(tdm_ao_b_slv_sclk,        6),
+       GROUP(mclk0_ao,                 5),
+};
+
+static const char * const gpio_periphs_groups[] = {
+       "GPIOZ_0", "GPIOZ_1", "GPIOZ_2", "GPIOZ_3", "GPIOZ_4",
+       "GPIOZ_5", "GPIOZ_6", "GPIOZ_7", "GPIOZ_8", "GPIOZ_9",
+       "GPIOZ_10", "GPIOZ_11", "GPIOZ_12", "GPIOZ_13", "GPIOZ_14",
+       "GPIOZ_15",
+
+       "GPIOH_0", "GPIOH_1", "GPIOH_2", "GPIOH_3", "GPIOH_4",
+       "GPIOH_5", "GPIOH_6", "GPIOH_7", "GPIOH_8",
+
+       "BOOT_0", "BOOT_1", "BOOT_2", "BOOT_3", "BOOT_4",
+       "BOOT_5", "BOOT_6", "BOOT_7", "BOOT_8", "BOOT_9",
+       "BOOT_10", "BOOT_11", "BOOT_12", "BOOT_13", "BOOT_14",
+       "BOOT_15",
+
+       "GPIOC_0", "GPIOC_1", "GPIOC_2", "GPIOC_3", "GPIOC_4",
+       "GPIOC_5", "GPIOC_6", "GPIOC_7",
+
+       "GPIOA_0", "GPIOA_1", "GPIOA_2", "GPIOA_3", "GPIOA_4",
+       "GPIOA_5", "GPIOA_6", "GPIOA_7", "GPIOA_8", "GPIOA_9",
+       "GPIOA_10", "GPIOA_11", "GPIOA_12", "GPIOA_13", "GPIOA_14",
+       "GPIOA_15",
+
+       "GPIOX_0", "GPIOX_1", "GPIOX_2", "GPIOX_3", "GPIOX_4",
+       "GPIOX_5", "GPIOX_6", "GPIOX_7", "GPIOX_8", "GPIOX_9",
+       "GPIOX_10", "GPIOX_11", "GPIOX_12", "GPIOX_13", "GPIOX_14",
+       "GPIOX_15", "GPIOX_16", "GPIOX_17", "GPIOX_18", "GPIOX_19",
+};
+
+static const char * const emmc_groups[] = {
+       "emmc_nand_d0", "emmc_nand_d1", "emmc_nand_d2",
+       "emmc_nand_d3", "emmc_nand_d4", "emmc_nand_d5",
+       "emmc_nand_d6", "emmc_nand_d7",
+       "emmc_clk", "emmc_cmd", "emmc_nand_ds",
+};
+
+static const char * const nand_groups[] = {
+       "emmc_nand_d0", "emmc_nand_d1", "emmc_nand_d2",
+       "emmc_nand_d3", "emmc_nand_d4", "emmc_nand_d5",
+       "emmc_nand_d6", "emmc_nand_d7",
+       "nand_ce0", "nand_ale", "nand_cle",
+       "nand_wen_clk", "nand_ren_wr", "nand_rb0",
+       "emmc_nand_ds", "nand_ce1",
+};
+
+static const char * const nor_groups[] = {
+       "nor_d", "nor_q", "nor_c", "nor_cs",
+       "nor_hold", "nor_wp",
+};
+
+static const char * const sdio_groups[] = {
+       "sdio_d0", "sdio_d1", "sdio_d2", "sdio_d3",
+       "sdio_cmd", "sdio_clk", "sdio_dummy",
+};
+
+static const char * const sdcard_groups[] = {
+       "sdcard_d0_c", "sdcard_d1_c", "sdcard_d2_c", "sdcard_d3_c",
+       "sdcard_clk_c", "sdcard_cmd_c",
+       "sdcard_d0_z", "sdcard_d1_z", "sdcard_d2_z", "sdcard_d3_z",
+       "sdcard_clk_z", "sdcard_cmd_z",
+};
+
+static const char * const spi0_groups[] = {
+       "spi0_mosi_c", "spi0_miso_c", "spi0_ss0_c", "spi0_clk_c",
+       "spi0_mosi_x", "spi0_miso_x", "spi0_ss0_x", "spi0_clk_x",
+};
+
+static const char * const spi1_groups[] = {
+       "spi1_mosi", "spi1_miso", "spi1_ss0", "spi1_clk",
+};
+
+static const char * const i2c0_groups[] = {
+       "i2c0_sda_c", "i2c0_sck_c",
+       "i2c0_sda_z0", "i2c0_sck_z1",
+       "i2c0_sda_z7", "i2c0_sck_z8",
+};
+
+static const char * const i2c1_groups[] = {
+       "i2c1_sda_x", "i2c1_sck_x",
+       "i2c1_sda_h2", "i2c1_sck_h3",
+       "i2c1_sda_h6", "i2c1_sck_h7",
+};
+
+static const char * const i2c2_groups[] = {
+       "i2c2_sda_x", "i2c2_sck_x",
+       "i2c2_sda_z", "i2c2_sck_z",
+};
+
+static const char * const i2c3_groups[] = {
+       "i2c3_sda_h", "i2c3_sck_h",
+       "i2c3_sda_a", "i2c3_sck_a",
+};
+
+static const char * const uart_a_groups[] = {
+       "uart_a_tx", "uart_a_rx", "uart_a_cts", "uart_a_rts",
+};
+
+static const char * const uart_b_groups[] = {
+       "uart_b_tx", "uart_b_rx",
+};
+
+static const char * const uart_c_groups[] = {
+       "uart_c_tx", "uart_c_rx", "uart_c_cts", "uart_c_rts",
+};
+
+static const char * const uart_ao_a_c_groups[] = {
+       "uart_ao_a_rx_c", "uart_ao_a_tx_c",
+};
+
+static const char * const iso7816_groups[] = {
+       "iso7816_clk_c", "iso7816_data_c",
+       "iso7816_clk_x", "iso7816_data_x",
+       "iso7816_clk_h", "iso7816_data_h",
+       "iso7816_clk_z", "iso7816_data_z",
+};
+
+static const char * const eth_groups[] = {
+       "eth_rxd2_rgmii", "eth_rxd3_rgmii", "eth_rgmii_tx_clk",
+       "eth_txd2_rgmii", "eth_txd3_rgmii", "eth_rgmii_rx_clk",
+       "eth_txd0", "eth_txd1", "eth_txen", "eth_mdc",
+       "eth_rxd0", "eth_rxd1", "eth_rx_dv", "eth_mdio",
+       "eth_link_led", "eth_act_led",
+};
+
+static const char * const pwm_a_groups[] = {
+       "pwm_a",
+};
+
+static const char * const pwm_b_groups[] = {
+       "pwm_b_x7", "pwm_b_x19",
+};
+
+static const char * const pwm_c_groups[] = {
+       "pwm_c_c", "pwm_c_x5", "pwm_c_x8",
+};
+
+static const char * const pwm_d_groups[] = {
+       "pwm_d_x3", "pwm_d_x6",
+};
+
+static const char * const pwm_e_groups[] = {
+       "pwm_e",
+};
+
+static const char * const pwm_f_groups[] = {
+       "pwm_f_x", "pwm_f_h",
+};
+
+static const char * const cec_ao_a_h_groups[] = {
+       "cec_ao_a_h",
+};
+
+static const char * const cec_ao_b_h_groups[] = {
+       "cec_ao_b_h",
+};
+
+static const char * const jtag_b_groups[] = {
+       "jtag_b_tdi", "jtag_b_tdo", "jtag_b_clk", "jtag_b_tms",
+};
+
+static const char * const bt565_a_groups[] = {
+       "bt565_a_vs", "bt565_a_hs", "bt565_a_clk",
+       "bt565_a_din0", "bt565_a_din1", "bt565_a_din2",
+       "bt565_a_din3", "bt565_a_din4", "bt565_a_din5",
+       "bt565_a_din6", "bt565_a_din7",
+};
+
+static const char * const tsin_a_groups[] = {
+       "tsin_a_valid", "tsin_a_sop", "tsin_a_din0",
+       "tsin_a_clk",
+};
+
+static const char * const tsin_b_groups[] = {
+       "tsin_b_valid_x", "tsin_b_sop_x", "tsin_b_din0_x", "tsin_b_clk_x",
+       "tsin_b_valid_z", "tsin_b_sop_z", "tsin_b_din0_z", "tsin_b_clk_z",
+       "tsin_b_fail", "tsin_b_din1", "tsin_b_din2", "tsin_b_din3",
+       "tsin_b_din4", "tsin_b_din5", "tsin_b_din6", "tsin_b_din7",
+};
+
+static const char * const hdmitx_groups[] = {
+       "hdmitx_sda", "hdmitx_sck", "hdmitx_hpd_in",
+};
+
+static const char * const pdm_groups[] = {
+       "pdm_din0_c", "pdm_din1_c", "pdm_din2_c", "pdm_din3_c",
+       "pdm_dclk_c",
+       "pdm_din0_x", "pdm_din1_x", "pdm_din2_x", "pdm_din3_x",
+       "pdm_dclk_x",
+       "pdm_din0_z", "pdm_din1_z", "pdm_din2_z", "pdm_din3_z",
+       "pdm_dclk_z",
+       "pdm_din0_a", "pdm_din1_a", "pdm_din2_a", "pdm_din3_a",
+       "pdm_dclk_a",
+};
+
+static const char * const spdif_in_groups[] = {
+       "spdif_in_h", "spdif_in_a10", "spdif_in_a12",
+};
+
+static const char * const spdif_out_groups[] = {
+       "spdif_out_h", "spdif_out_a11", "spdif_out_a13",
+};
+
+static const char * const mclk0_groups[] = {
+       "mclk0_a",
+};
+
+static const char * const mclk1_groups[] = {
+       "mclk1_x", "mclk1_z", "mclk1_a",
+};
+
+static const char * const tdm_a_groups[] = {
+       "tdm_a_slv_sclk", "tdm_a_slv_fs", "tdm_a_sclk", "tdm_a_fs",
+       "tdm_a_din0", "tdm_a_din1", "tdm_a_dout0", "tdm_a_dout1",
+};
+
+static const char * const tdm_b_groups[] = {
+       "tdm_b_slv_sclk", "tdm_b_slv_fs", "tdm_b_sclk", "tdm_b_fs",
+       "tdm_b_din0", "tdm_b_din1", "tdm_b_din2",
+       "tdm_b_din3_a", "tdm_b_din3_h",
+       "tdm_b_dout0", "tdm_b_dout1", "tdm_b_dout2",
+       "tdm_b_dout3_a", "tdm_b_dout3_h",
+};
+
+static const char * const tdm_c_groups[] = {
+       "tdm_c_slv_sclk_a", "tdm_c_slv_fs_a",
+       "tdm_c_slv_sclk_z", "tdm_c_slv_fs_z",
+       "tdm_c_sclk_a", "tdm_c_fs_a",
+       "tdm_c_sclk_z", "tdm_c_fs_z",
+       "tdm_c_din0_a", "tdm_c_din1_a",
+       "tdm_c_din2_a", "tdm_c_din3_a",
+       "tdm_c_din0_z", "tdm_c_din1_z",
+       "tdm_c_din2_z", "tdm_c_din3_z",
+       "tdm_c_dout0_a", "tdm_c_dout1_a",
+       "tdm_c_dout2_a", "tdm_c_dout3_a",
+       "tdm_c_dout0_z", "tdm_c_dout1_z",
+       "tdm_c_dout2_z", "tdm_c_dout3_z",
+};
+
+static const char * const gpio_aobus_groups[] = {
+       "GPIOAO_0", "GPIOAO_1", "GPIOAO_2", "GPIOAO_3", "GPIOAO_4",
+       "GPIOAO_5", "GPIOAO_6", "GPIOAO_7", "GPIOAO_8", "GPIOAO_9",
+       "GPIOAO_10", "GPIOAO_11", "GPIOE_0", "GPIOE_1", "GPIOE_2",
+};
+
+static const char * const uart_ao_a_groups[] = {
+       "uart_ao_a_tx", "uart_ao_a_rx",
+       "uart_ao_a_cts", "uart_ao_a_rts",
+};
+
+static const char * const uart_ao_b_groups[] = {
+       "uart_ao_b_tx_2", "uart_ao_b_rx_3",
+       "uart_ao_b_tx_8", "uart_ao_b_rx_9",
+       "uart_ao_b_cts", "uart_ao_b_rts",
+};
+
+static const char * const i2c_ao_groups[] = {
+       "i2c_ao_sck", "i2c_ao_sda",
+       "i2c_ao_sck_e", "i2c_ao_sda_e",
+};
+
+static const char * const i2c_ao_slave_groups[] = {
+       "i2c_ao_slave_sck", "i2c_ao_slave_sda",
+};
+
+static const char * const remote_ao_input_groups[] = {
+       "remote_ao_input",
+};
+
+static const char * const remote_ao_out_groups[] = {
+       "remote_ao_out",
+};
+
+static const char * const pwm_ao_a_groups[] = {
+       "pwm_ao_a", "pwm_ao_a_hiz",
+};
+
+static const char * const pwm_ao_b_groups[] = {
+       "pwm_ao_b",
+};
+
+static const char * const pwm_ao_c_groups[] = {
+       "pwm_ao_c_4", "pwm_ao_c_hiz",
+       "pwm_ao_c_6",
+};
+
+static const char * const pwm_ao_d_groups[] = {
+       "pwm_ao_d_5", "pwm_ao_d_10", "pwm_ao_d_e",
+};
+
+static const char * const jtag_a_groups[] = {
+       "jtag_a_tdi", "jtag_a_tdo", "jtag_a_clk", "jtag_a_tms",
+};
+
+static const char * const cec_ao_a_groups[] = {
+       "cec_ao_a",
+};
+
+static const char * const cec_ao_b_groups[] = {
+       "cec_ao_b",
+};
+
+static const char * const tsin_ao_a_groups[] = {
+       "tsin_ao_asop", "tsin_ao_adin0", "tsin_ao_aclk", "tsin_ao_a_valid",
+};
+
+static const char * const spdif_ao_out_groups[] = {
+       "spdif_ao_out",
+};
+
+static const char * const tdm_ao_b_groups[] = {
+       "tdm_ao_b_dout0", "tdm_ao_b_dout1", "tdm_ao_b_dout2",
+       "tdm_ao_b_fs", "tdm_ao_b_sclk",
+       "tdm_ao_b_din0", "tdm_ao_b_din1", "tdm_ao_b_din2",
+       "tdm_ao_b_slv_fs", "tdm_ao_b_slv_sclk",
+};
+
+static const char * const mclk0_ao_groups[] = {
+       "mclk0_ao",
+};
+
+static struct meson_pmx_func meson_g12a_periphs_functions[] = {
+       FUNCTION(gpio_periphs),
+       FUNCTION(emmc),
+       FUNCTION(nor),
+       FUNCTION(spi0),
+       FUNCTION(spi1),
+       FUNCTION(sdio),
+       FUNCTION(nand),
+       FUNCTION(sdcard),
+       FUNCTION(i2c0),
+       FUNCTION(i2c1),
+       FUNCTION(i2c2),
+       FUNCTION(i2c3),
+       FUNCTION(uart_a),
+       FUNCTION(uart_b),
+       FUNCTION(uart_c),
+       FUNCTION(uart_ao_a_c),
+       FUNCTION(iso7816),
+       FUNCTION(eth),
+       FUNCTION(pwm_a),
+       FUNCTION(pwm_b),
+       FUNCTION(pwm_c),
+       FUNCTION(pwm_d),
+       FUNCTION(pwm_e),
+       FUNCTION(pwm_f),
+       FUNCTION(cec_ao_a_h),
+       FUNCTION(cec_ao_b_h),
+       FUNCTION(jtag_b),
+       FUNCTION(bt565_a),
+       FUNCTION(tsin_a),
+       FUNCTION(tsin_b),
+       FUNCTION(hdmitx),
+       FUNCTION(pdm),
+       FUNCTION(spdif_out),
+       FUNCTION(spdif_in),
+       FUNCTION(mclk0),
+       FUNCTION(mclk1),
+       FUNCTION(tdm_a),
+       FUNCTION(tdm_b),
+       FUNCTION(tdm_c),
+};
+
+static struct meson_pmx_func meson_g12a_aobus_functions[] = {
+       FUNCTION(gpio_aobus),
+       FUNCTION(uart_ao_a),
+       FUNCTION(uart_ao_b),
+       FUNCTION(i2c_ao),
+       FUNCTION(i2c_ao_slave),
+       FUNCTION(remote_ao_input),
+       FUNCTION(remote_ao_out),
+       FUNCTION(pwm_ao_a),
+       FUNCTION(pwm_ao_b),
+       FUNCTION(pwm_ao_c),
+       FUNCTION(pwm_ao_d),
+       FUNCTION(jtag_a),
+       FUNCTION(cec_ao_a),
+       FUNCTION(cec_ao_b),
+       FUNCTION(tsin_ao_a),
+       FUNCTION(spdif_ao_out),
+       FUNCTION(tdm_ao_b),
+       FUNCTION(mclk0_ao),
+};
+
+static struct meson_bank meson_g12a_periphs_banks[] = {
+       /*    name   first                   last                   pullen  pull   dir     out     in   */
+       BANK("Z",    PIN(GPIOZ_0, EE_OFF),   PIN(GPIOZ_15, EE_OFF), 4,  0,  4,  0, 12,  0, 13,  0, 14,  0),
+       BANK("H",    PIN(GPIOH_0, EE_OFF),   PIN(GPIOH_8,  EE_OFF), 3,  0,  3,  0,  9,  0, 10,  0, 11,  0),
+       BANK("BOOT", PIN(BOOT_0,  EE_OFF),   PIN(BOOT_15,  EE_OFF), 0,  0,  0,  0,  0,  0,  1,  0,  2,  0),
+       BANK("C",    PIN(GPIOC_0, EE_OFF),   PIN(GPIOC_7,  EE_OFF), 1,  0,  1,  0,  3,  0,  4,  0,  5,  0),
+       BANK("A",    PIN(GPIOA_0, EE_OFF),   PIN(GPIOA_15, EE_OFF), 5,  0,  5,  0, 16,  0, 17,  0, 18,  0),
+       BANK("X",    PIN(GPIOX_0, EE_OFF),   PIN(GPIOX_19, EE_OFF), 2,  0,  2,  0,  6,  0,  7,  0,  8,  0),
+};
+
+static struct meson_bank meson_g12a_aobus_banks[] = {
+       /*   name    first                   last                   pullen  pull   dir     out     in  */
+       BANK("AO",   PIN(GPIOAO_0, 0),       PIN(GPIOAO_11, 0),     3,  0,  2,  0,  0,  0,  4,  0,  1,  0),
+       BANK("E",    PIN(GPIOE_0, 0),        PIN(GPIOE_2, 0),       3, 16,  2, 16,  0, 16,  4, 16,  1,  16),
+};
+
+static struct meson_pmx_bank meson_g12a_periphs_pmx_banks[] = {
+       /*       name    first                  last                   reg   offset  */
+       BANK_PMX("Z",    PIN(GPIOZ_0, EE_OFF),   PIN(GPIOZ_15, EE_OFF), 0x6, 0),
+       BANK_PMX("H",    PIN(GPIOH_0, EE_OFF),   PIN(GPIOH_8,  EE_OFF),  0xb, 0),
+       BANK_PMX("BOOT", PIN(BOOT_0,  EE_OFF),   PIN(BOOT_15,  EE_OFF),  0x0, 0),
+       BANK_PMX("C",    PIN(GPIOC_0, EE_OFF),   PIN(GPIOC_7,  EE_OFF),  0x9, 0),
+       BANK_PMX("A",    PIN(GPIOA_0, EE_OFF),   PIN(GPIOA_15, EE_OFF), 0xd, 0),
+       BANK_PMX("X",    PIN(GPIOX_0, EE_OFF),   PIN(GPIOX_19, EE_OFF), 0x3, 0),
+};
+
+static struct meson_axg_pmx_data meson_g12a_periphs_pmx_banks_data = {
+       .pmx_banks      = meson_g12a_periphs_pmx_banks,
+       .num_pmx_banks  = ARRAY_SIZE(meson_g12a_periphs_pmx_banks),
+};
+
+static struct meson_pmx_bank meson_g12a_aobus_pmx_banks[] = {
+       BANK_PMX("AO",  GPIOAO_0, GPIOAO_11, 0x0, 0),
+       BANK_PMX("E",   GPIOE_0,  GPIOE_2,   0x1, 16),
+};
+
+static struct meson_axg_pmx_data meson_g12a_aobus_pmx_banks_data = {
+       .pmx_banks      = meson_g12a_aobus_pmx_banks,
+       .num_pmx_banks  = ARRAY_SIZE(meson_g12a_aobus_pmx_banks),
+};
+
+static struct meson_pinctrl_data meson_g12a_periphs_pinctrl_data = {
+       .name           = "periphs-banks",
+       .pin_base       = EE_OFF,
+       .groups         = meson_g12a_periphs_groups,
+       .funcs          = meson_g12a_periphs_functions,
+       .banks          = meson_g12a_periphs_banks,
+       .num_pins       = 85,
+       .num_groups     = ARRAY_SIZE(meson_g12a_periphs_groups),
+       .num_funcs      = ARRAY_SIZE(meson_g12a_periphs_functions),
+       .num_banks      = ARRAY_SIZE(meson_g12a_periphs_banks),
+       .gpio_driver    = &meson_axg_gpio_driver,
+       .pmx_data       = &meson_g12a_periphs_pmx_banks_data,
+};
+
+static struct meson_pinctrl_data meson_g12a_aobus_pinctrl_data = {
+       .name           = "aobus-banks",
+       .pin_base       = 0,
+       .groups         = meson_g12a_aobus_groups,
+       .funcs          = meson_g12a_aobus_functions,
+       .banks          = meson_g12a_aobus_banks,
+       .num_pins       = 15,
+       .num_groups     = ARRAY_SIZE(meson_g12a_aobus_groups),
+       .num_funcs      = ARRAY_SIZE(meson_g12a_aobus_functions),
+       .num_banks      = ARRAY_SIZE(meson_g12a_aobus_banks),
+       .gpio_driver    = &meson_axg_gpio_driver,
+       .pmx_data       = &meson_g12a_aobus_pmx_banks_data,
+};
+
+static const struct udevice_id meson_g12a_pinctrl_match[] = {
+       {
+               .compatible = "amlogic,meson-g12a-periphs-pinctrl",
+               .data = (ulong)&meson_g12a_periphs_pinctrl_data,
+       },
+       {
+               .compatible = "amlogic,meson-g12a-aobus-pinctrl",
+               .data = (ulong)&meson_g12a_aobus_pinctrl_data,
+       },
+       { },
+};
+
+U_BOOT_DRIVER(meson_axg_pinctrl) = {
+       .name = "meson-g12a-pinctrl",
+       .id = UCLASS_PINCTRL,
+       .of_match = of_match_ptr(meson_g12a_pinctrl_match),
+       .probe = meson_pinctrl_probe,
+       .priv_auto_alloc_size = sizeof(struct meson_pinctrl),
+       .ops = &meson_axg_pinctrl_ops,
+};
index fa3d78858a9e0f615021509f26ca0e75a31a1693..8735418c5b93652b26b0629d4e40f4e902b52d49 100644 (file)
@@ -314,11 +314,11 @@ int meson_pinctrl_probe(struct udevice *dev)
        priv->reg_gpio = (void __iomem *)addr;
 
        addr = parse_address(gpio, "pull", na, ns);
-       if (addr == FDT_ADDR_T_NONE) {
-               debug("pull address not found\n");
-               return -EINVAL;
-       }
-       priv->reg_pull = (void __iomem *)addr;
+       /* Use gpio region if pull one is not present */
+       if (addr == FDT_ADDR_T_NONE)
+               priv->reg_pull = priv->reg_gpio;
+       else
+               priv->reg_pull = (void __iomem *)addr;
 
        addr = parse_address(gpio, "pull-enable", na, ns);
        /* Use pull region if pull-enable one is not present */
@@ -327,6 +327,13 @@ int meson_pinctrl_probe(struct udevice *dev)
        else
                priv->reg_pullen = (void __iomem *)addr;
 
+       addr = parse_address(gpio, "ds", na, ns);
+       /* Drive strength region is optional */
+       if (addr == FDT_ADDR_T_NONE)
+               priv->reg_ds = NULL;
+       else
+               priv->reg_ds = (void __iomem *)addr;
+
        priv->data = (struct meson_pinctrl_data *)dev_get_driver_data(dev);
 
        /* Lookup GPIO driver */
index 28085a7495d461b3edf947c92e0db07199d5241a..b3683e2073655c573c228c6cb97989c8f389ea59 100644 (file)
@@ -41,6 +41,7 @@ struct meson_pinctrl {
        void __iomem *reg_gpio;
        void __iomem *reg_pull;
        void __iomem *reg_pullen;
+       void __iomem *reg_ds;
 };
 
 /**
index 24affe0414cef93be6f35d881c72d74e0ca762e1..43dbdd9d6a8a96e7c5b30684000e81bbe2047a42 100644 (file)
@@ -421,6 +421,7 @@ static const struct udevice_id stm32_pinctrl_ids[] = {
        { .compatible = "st,stm32f429-pinctrl" },
        { .compatible = "st,stm32f469-pinctrl" },
        { .compatible = "st,stm32f746-pinctrl" },
+       { .compatible = "st,stm32f769-pinctrl" },
        { .compatible = "st,stm32h743-pinctrl" },
        { .compatible = "st,stm32mp157-pinctrl" },
        { .compatible = "st,stm32mp157-z-pinctrl" },
index 92f04695ecdac72cb3e23bbac7d2436db6e10cb9..31aa4d41e8d6d4a54c113d5eb7fc1ac538cc68d4 100644 (file)
@@ -69,6 +69,7 @@ struct reset_ops meson_reset_ops = {
 
 static const struct udevice_id meson_reset_ids[] = {                          
        { .compatible = "amlogic,meson-gxbb-reset" },                                  
+       { .compatible = "amlogic,meson-axg-reset" },
        { }                                                                     
 };  
 
index 6d2b045fe862109f86eac7991814828ea5f35084..5228486082c278a5c4ea62f81f900c72adad9d0d 100644 (file)
@@ -14,7 +14,7 @@
 /* system timer offset in ms */
 static unsigned long sandbox_timer_offset;
 
-void sandbox_timer_add_offset(unsigned long offset)
+void timer_test_add_offset(unsigned long offset)
 {
        sandbox_timer_offset += offset;
 }
index 78dcf40bff486841d7c34a2f49b4979806940f0c..65ee3e5d5a0ade4c1e654bebac29d5c72c641f73 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #ifndef __ASSEMBLY__
+#include <fdtdec.h>
 #include <membuff.h>
 #include <linux/list.h>
 
@@ -133,6 +134,9 @@ typedef struct global_data {
        struct spl_handoff *spl_handoff;
 # endif
 #endif
+#if defined(CONFIG_TRANSLATION_OFFSET)
+       fdt_addr_t translation_offset;  /* optional translation offset */
+#endif
 } gd_t;
 #endif
 
diff --git a/include/configs/libretech-ac.h b/include/configs/libretech-ac.h
new file mode 100644 (file)
index 0000000..419dc61
--- /dev/null
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Configuration for LibreTech AC
+ *
+ * Copyright (C) 2017 Baylibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#define CONFIG_ENV_SECT_SIZE   0x10000
+#define CONFIG_ENV_OFFSET      (-0x10000)
+
+#define BOOT_TARGET_DEVICES(func) \
+       func(ROMUSB, romusb, na)  \
+       func(MMC, mmc, 0) \
+       BOOT_TARGET_DEVICES_USB(func) \
+       func(PXE, pxe, na) \
+       func(DHCP, dhcp, na)
+
+#include <configs/meson64.h>
+
+#endif /* __CONFIG_H */
index e36a5fec0ef2244f4b5beb667f87330e5b60f434..bf03baefe83b9d9d994112fee0fa5208a84f899a 100644 (file)
@@ -8,11 +8,11 @@
 
 #ifdef FTRACE
 #define CONFIG_TRACE
+#define CONFIG_CMD_TRACE
 #define CONFIG_TRACE_BUFFER_SIZE       (16 << 20)
-#define CONFIG_TRACE_EARLY_SIZE                (8 << 20)
+#define CONFIG_TRACE_EARLY_SIZE                (16 << 20)
 #define CONFIG_TRACE_EARLY
 #define CONFIG_TRACE_EARLY_ADDR                0x00100000
-
 #endif
 
 #ifndef CONFIG_SPL_BUILD
index dae402f91b8cc04cfdbe40b2fba40114428c62f6..84bbc76ef55c096fbdb8bbb0bf38e5be3154b5f4 100644 (file)
 
 #define CONFIG_SYS_MALLOC_LEN          (1 * 1024 * 1024)
 
-#define CONFIG_BOOTCOMMAND                                             \
-       "run bootcmd_romfs"
-
-#define CONFIG_EXTRA_ENV_SETTINGS \
-       "bootargs_romfs=uclinux.physaddr=0x08180000 root=/dev/mtdblock0\0" \
-       "bootcmd_romfs=setenv bootargs ${bootargs} ${bootargs_romfs};" \
-       "bootm 0x08044000 - 0x08042000\0"
-
+#define BOOT_TARGET_DEVICES(func) \
+       func(MMC, mmc, 0)
+
+#include <config_distro_bootcmd.h>
+#define CONFIG_EXTRA_ENV_SETTINGS                              \
+                       "kernel_addr_r=0xC0008000\0"            \
+                       "fdtfile=stm32f746-disco.dtb\0" \
+                       "fdt_addr_r=0xC0500000\0"               \
+                       "scriptaddr=0xC0008000\0"               \
+                       "pxefile_addr_r=0xC0008000\0" \
+                       "fdt_high=0xffffffffffffffff\0"         \
+                       "initrd_high=0xffffffffffffffff\0"      \
+                       "ramdisk_addr_r=0xD0900000\0"           \
+                       BOOTENV
 
 /*
  * Command line configuration.
index 76563ef9786a017f7ab3e3c76e4e2526a23b6445..8b92d2b18347ec7ccb76fda0a38256513823b084 100644 (file)
@@ -9,11 +9,11 @@
  *
  * The semantics of do_div() are:
  *
- * uint32_t do_div(uint64_t *n, uint32_t base)
+ * u32 do_div(u64 *n, u32 base)
  * {
- *     uint32_t remainder = *n % base;
- *     *n = *n / base;
- *     return remainder;
+ *     u32 remainder = *n % base;
+ *     *n = *n / base;
+ *     return remainder;
  * }
  *
  * NOTE: macro parameter n is evaluated multiple times,
 #if BITS_PER_LONG == 64
 
 # define do_div(n,base) ({                                     \
-       uint32_t __base = (base);                               \
-       uint32_t __rem;                                         \
-       __rem = ((uint64_t)(n)) % __base;                       \
-       (n) = ((uint64_t)(n)) / __base;                         \
+       u32 __base = (base);                            \
+       u32 __rem;                                              \
+       __rem = ((u64)(n)) % __base;                    \
+       (n) = ((u64)(n)) / __base;                              \
        __rem;                                                  \
  })
 
@@ -62,8 +62,8 @@
         * Hence this monstrous macro (static inline doesn't always     \
         * do the trick here).                                          \
         */                                                             \
-       uint64_t ___res, ___x, ___t, ___m, ___n = (n);                  \
-       uint32_t ___p, ___bias;                                         \
+       u64 ___res, ___x, ___t, ___m, ___n = (n);                       \
+       u32 ___p, ___bias;                                              \
                                                                        \
        /* determine MSB of b */                                        \
        ___p = 1 << ilog2(___b);                                        \
                 * possible, otherwise that'll need extra overflow      \
                 * handling later.                                      \
                 */                                                     \
-               uint32_t ___bits = -(___m & -___m);                     \
+               u32 ___bits = -(___m & -___m);                  \
                ___bits |= ___m >> 32;                                  \
                ___bits = (~___bits) << 1;                              \
                /*                                                      \
 /*
  * Default C implementation for __arch_xprod_64()
  *
- * Prototype: uint64_t __arch_xprod_64(const uint64_t m, uint64_t n, bool bias)
+ * Prototype: u64 __arch_xprod_64(const u64 m, u64 n, bool bias)
  * Semantic:  retval = ((bias ? m : 0) + m * n) >> 64
  *
  * The product is a 128-bit value, scaled down to 64 bits.
  * Assuming constant propagation to optimize away unused conditional code.
  * Architectures may provide their own optimized assembly implementation.
  */
-static inline uint64_t __arch_xprod_64(const uint64_t m, uint64_t n, bool bias)
+static inline u64 __arch_xprod_64(const u64 m, u64 n, bool bias)
 {
-       uint32_t m_lo = m;
-       uint32_t m_hi = m >> 32;
-       uint32_t n_lo = n;
-       uint32_t n_hi = n >> 32;
-       uint64_t res, tmp;
+       u32 m_lo = m;
+       u32 m_hi = m >> 32;
+       u32 n_lo = n;
+       u32 n_hi = n >> 32;
+       u64 res, tmp;
 
        if (!bias) {
-               res = ((uint64_t)m_lo * n_lo) >> 32;
+               res = ((u64)m_lo * n_lo) >> 32;
        } else if (!(m & ((1ULL << 63) | (1ULL << 31)))) {
                /* there can't be any overflow here */
-               res = (m + (uint64_t)m_lo * n_lo) >> 32;
+               res = (m + (u64)m_lo * n_lo) >> 32;
        } else {
-               res = m + (uint64_t)m_lo * n_lo;
+               res = m + (u64)m_lo * n_lo;
                tmp = (res < m) ? (1ULL << 32) : 0;
                res = (res >> 32) + tmp;
        }
 
        if (!(m & ((1ULL << 63) | (1ULL << 31)))) {
                /* there can't be any overflow here */
-               res += (uint64_t)m_lo * n_hi;
-               res += (uint64_t)m_hi * n_lo;
+               res += (u64)m_lo * n_hi;
+               res += (u64)m_hi * n_lo;
                res >>= 32;
        } else {
-               tmp = res += (uint64_t)m_lo * n_hi;
-               res += (uint64_t)m_hi * n_lo;
+               tmp = res += (u64)m_lo * n_hi;
+               res += (u64)m_hi * n_lo;
                tmp = (res < tmp) ? (1ULL << 32) : 0;
                res = (res >> 32) + tmp;
        }
 
-       res += (uint64_t)m_hi * n_hi;
+       res += (u64)m_hi * n_hi;
 
        return res;
 }
 #endif
 
 #ifndef __div64_32
-extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
+extern u32 __div64_32(u64 *dividend, u32 divisor);
 #endif
 
 /* The unnecessary pointer compare is there
  * to check for type safety (n must be 64bit)
  */
 # define do_div(n,base) ({                             \
-       uint32_t __base = (base);                       \
-       uint32_t __rem;                                 \
-       (void)(((typeof((n)) *)0) == ((uint64_t *)0));  \
+       u32 __base = (base);                    \
+       u32 __rem;                                      \
+       (void)(((typeof((n)) *)0) == ((u64 *)0));       \
        if (__builtin_constant_p(__base) &&             \
            is_power_of_2(__base)) {                    \
                __rem = (n) & (__base - 1);             \
@@ -212,14 +212,14 @@ extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
        } else if (__div64_const32_is_OK &&             \
                   __builtin_constant_p(__base) &&      \
                   __base != 0) {                       \
-               uint32_t __res_lo, __n_lo = (n);        \
+               u32 __res_lo, __n_lo = (n);     \
                (n) = __div64_const32(n, __base);       \
                /* the remainder can be computed with 32-bit regs */ \
                __res_lo = (n);                         \
                __rem = __n_lo - __res_lo * __base;     \
        } else if (likely(((n) >> 32) == 0)) {          \
-               __rem = (uint32_t)(n) % __base;         \
-               (n) = (uint32_t)(n) / __base;           \
+               __rem = (u32)(n) % __base;              \
+               (n) = (u32)(n) / __base;                \
        } else                                          \
                __rem = __div64_32(&(n), __base);       \
        __rem;                                          \
@@ -234,9 +234,9 @@ extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
 /* Wrapper for do_div(). Doesn't modify dividend and returns
  * the result, not remainder.
  */
-static inline uint64_t lldiv(uint64_t dividend, uint32_t divisor)
+static inline u64 lldiv(u64 dividend, u32 divisor)
 {
-       uint64_t __res = dividend;
+       u64 __res = dividend;
        do_div(__res, divisor);
        return(__res);
 }
index c171d9bc2f42898aa02795280102f3e654132243..3bc2599b6cbd2eaa173ae272e88323fce91349bd 100644 (file)
@@ -120,25 +120,4 @@ fdt_addr_t devfdt_get_addr_size_index(struct udevice *dev, int index,
  */
 fdt_addr_t devfdt_get_addr_name(struct udevice *dev, const char *name);
 
-/**
- * dm_set_translation_offset() - Set translation offset
- * @offs: Translation offset
- *
- * Some platforms need a special address translation. Those
- * platforms (e.g. mvebu in SPL) can configure a translation
- * offset in the DM by calling this function. It will be
- * added to all addresses returned in devfdt_get_addr().
- */
-void dm_set_translation_offset(fdt_addr_t offs);
-
-/**
- * dm_get_translation_offset() - Get translation offset
- *
- * This function returns the translation offset that can
- * be configured by calling dm_set_translation_offset().
- *
- * @return translation offset for the device address (0 as default).
- */
-fdt_addr_t dm_get_translation_offset(void);
-
 #endif
diff --git a/include/dt-bindings/clock/g12a-aoclkc.h b/include/dt-bindings/clock/g12a-aoclkc.h
new file mode 100644 (file)
index 0000000..8db01ff
--- /dev/null
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
+/*
+ * Copyright (c) 2016 BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ *
+ * Copyright (c) 2018 Amlogic, inc.
+ * Author: Qiufang Dai <qiufang.dai@amlogic.com>
+ */
+
+#ifndef DT_BINDINGS_CLOCK_AMLOGIC_MESON_G12A_AOCLK
+#define DT_BINDINGS_CLOCK_AMLOGIC_MESON_G12A_AOCLK
+
+#define CLKID_AO_AHB           0
+#define CLKID_AO_IR_IN         1
+#define CLKID_AO_I2C_M0                2
+#define CLKID_AO_I2C_S0                3
+#define CLKID_AO_UART          4
+#define CLKID_AO_PROD_I2C      5
+#define CLKID_AO_UART2         6
+#define CLKID_AO_IR_OUT                7
+#define CLKID_AO_SAR_ADC       8
+#define CLKID_AO_MAILBOX       9
+#define CLKID_AO_M3            10
+#define CLKID_AO_AHB_SRAM      11
+#define CLKID_AO_RTI           12
+#define CLKID_AO_M4_FCLK       13
+#define CLKID_AO_M4_HCLK       14
+#define CLKID_AO_CLK81         15
+#define CLKID_AO_SAR_ADC_CLK   18
+#define CLKID_AO_32K           23
+#define CLKID_AO_CEC           27
+#define CLKID_AO_CTS_RTC_OSCIN 28
+
+#endif
diff --git a/include/dt-bindings/clock/g12a-clkc.h b/include/dt-bindings/clock/g12a-clkc.h
new file mode 100644 (file)
index 0000000..83b6570
--- /dev/null
@@ -0,0 +1,135 @@
+/* SPDX-License-Identifier: GPL-2.0+ OR MIT */
+/*
+ * Meson-G12A clock tree IDs
+ *
+ * Copyright (c) 2018 Amlogic, Inc. All rights reserved.
+ */
+
+#ifndef __G12A_CLKC_H
+#define __G12A_CLKC_H
+
+#define CLKID_SYS_PLL                          0
+#define CLKID_FIXED_PLL                                1
+#define CLKID_FCLK_DIV2                                2
+#define CLKID_FCLK_DIV3                                3
+#define CLKID_FCLK_DIV4                                4
+#define CLKID_FCLK_DIV5                                5
+#define CLKID_FCLK_DIV7                                6
+#define CLKID_GP0_PLL                          7
+#define CLKID_CLK81                            10
+#define CLKID_MPLL0                            11
+#define CLKID_MPLL1                            12
+#define CLKID_MPLL2                            13
+#define CLKID_MPLL3                            14
+#define CLKID_DDR                              15
+#define CLKID_DOS                              16
+#define CLKID_AUDIO_LOCKER                     17
+#define CLKID_MIPI_DSI_HOST                    18
+#define CLKID_ETH_PHY                          19
+#define CLKID_ISA                              20
+#define CLKID_PL301                            21
+#define CLKID_PERIPHS                          22
+#define CLKID_SPICC0                           23
+#define CLKID_I2C                              24
+#define CLKID_SANA                             25
+#define CLKID_SD                               26
+#define CLKID_RNG0                             27
+#define CLKID_UART0                            28
+#define CLKID_SPICC1                           29
+#define CLKID_HIU_IFACE                                30
+#define CLKID_MIPI_DSI_PHY                     31
+#define CLKID_ASSIST_MISC                      32
+#define CLKID_SD_EMMC_A                                33
+#define CLKID_SD_EMMC_B                                34
+#define CLKID_SD_EMMC_C                                35
+#define CLKID_AUDIO_CODEC                      36
+#define CLKID_AUDIO                            37
+#define CLKID_ETH                              38
+#define CLKID_DEMUX                            39
+#define CLKID_AUDIO_IFIFO                      40
+#define CLKID_ADC                              41
+#define CLKID_UART1                            42
+#define CLKID_G2D                              43
+#define CLKID_RESET                            44
+#define CLKID_PCIE_COMB                                45
+#define CLKID_PARSER                           46
+#define CLKID_USB                              47
+#define CLKID_PCIE_PHY                         48
+#define CLKID_AHB_ARB0                         49
+#define CLKID_AHB_DATA_BUS                     50
+#define CLKID_AHB_CTRL_BUS                     51
+#define CLKID_HTX_HDCP22                       52
+#define CLKID_HTX_PCLK                         53
+#define CLKID_BT656                            54
+#define CLKID_USB1_DDR_BRIDGE                  55
+#define CLKID_MMC_PCLK                         56
+#define CLKID_UART2                            57
+#define CLKID_VPU_INTR                         58
+#define CLKID_GIC                              59
+#define CLKID_SD_EMMC_A_CLK0                   60
+#define CLKID_SD_EMMC_B_CLK0                   61
+#define CLKID_SD_EMMC_C_CLK0                   62
+#define CLKID_HIFI_PLL                         74
+#define CLKID_VCLK2_VENCI0                     80
+#define CLKID_VCLK2_VENCI1                     81
+#define CLKID_VCLK2_VENCP0                     82
+#define CLKID_VCLK2_VENCP1                     83
+#define CLKID_VCLK2_VENCT0                     84
+#define CLKID_VCLK2_VENCT1                     85
+#define CLKID_VCLK2_OTHER                      86
+#define CLKID_VCLK2_ENCI                       87
+#define CLKID_VCLK2_ENCP                       88
+#define CLKID_DAC_CLK                          89
+#define CLKID_AOCLK                            90
+#define CLKID_IEC958                           91
+#define CLKID_ENC480P                          92
+#define CLKID_RNG1                             93
+#define CLKID_VCLK2_ENCT                       94
+#define CLKID_VCLK2_ENCL                       95
+#define CLKID_VCLK2_VENCLMMC                   96
+#define CLKID_VCLK2_VENCL                      97
+#define CLKID_VCLK2_OTHER1                     98
+#define CLKID_FCLK_DIV2P5                      99
+#define CLKID_DMA                              105
+#define CLKID_EFUSE                            106
+#define CLKID_ROM_BOOT                         107
+#define CLKID_RESET_SEC                                108
+#define CLKID_SEC_AHB_APB3                     109
+#define CLKID_VPU_0_SEL                                110
+#define CLKID_VPU_0                            112
+#define CLKID_VPU_1_SEL                                113
+#define CLKID_VPU_1                            115
+#define CLKID_VPU                              116
+#define CLKID_VAPB_0_SEL                       117
+#define CLKID_VAPB_0                           119
+#define CLKID_VAPB_1_SEL                       120
+#define CLKID_VAPB_1                           122
+#define CLKID_VAPB_SEL                         123
+#define CLKID_VAPB                             124
+#define CLKID_HDMI_PLL                         128
+#define CLKID_VID_PLL                          129
+#define CLKID_VCLK                             138
+#define CLKID_VCLK2                            139
+#define CLKID_VCLK_DIV1                                148
+#define CLKID_VCLK_DIV2                                149
+#define CLKID_VCLK_DIV4                                150
+#define CLKID_VCLK_DIV6                                151
+#define CLKID_VCLK_DIV12                       152
+#define CLKID_VCLK2_DIV1                       153
+#define CLKID_VCLK2_DIV2                       154
+#define CLKID_VCLK2_DIV4                       155
+#define CLKID_VCLK2_DIV6                       156
+#define CLKID_VCLK2_DIV12                      157
+#define CLKID_CTS_ENCI                         162
+#define CLKID_CTS_ENCP                         163
+#define CLKID_CTS_VDAC                         164
+#define CLKID_HDMI_TX                          165
+#define CLKID_HDMI                             168
+#define CLKID_MALI_0_SEL                       169
+#define CLKID_MALI_0                           171
+#define CLKID_MALI_1_SEL                       172
+#define CLKID_MALI_1                           174
+#define CLKID_MALI                             175
+#define CLKID_MPLL_5OM                         177
+
+#endif /* __G12A_CLKC_H */
index 49bb3c203e5c0988a2c8dd2ecfb9ad786bdf3f82..58d8b515be55f4a2a44aaf3b10b41191747cb994 100644 (file)
 #define CLK_SAI2               11
 #define CLK_I2SQ_PDIV          12
 #define CLK_SAIQ_PDIV          13
-
-#define END_PRIMARY_CLK                14
-
 #define CLK_HSI                        14
 #define CLK_SYSCLK             15
+#define CLK_F469_DSI           16
+
+#define END_PRIMARY_CLK                17
+
 #define CLK_HDMI_CEC           16
 #define CLK_SPDIF              17
 #define CLK_USART1             18
diff --git a/include/dt-bindings/gpio/meson-g12a-gpio.h b/include/dt-bindings/gpio/meson-g12a-gpio.h
new file mode 100644 (file)
index 0000000..f7bd693
--- /dev/null
@@ -0,0 +1,114 @@
+/* SPDX-License-Identifier: (GPL-2.0+ or MIT) */
+/*
+ * Copyright (c) 2018 Amlogic, Inc. All rights reserved.
+ * Author: Xingyu Chen <xingyu.chen@amlogic.com>
+ */
+
+#ifndef _DT_BINDINGS_MESON_G12A_GPIO_H
+#define _DT_BINDINGS_MESON_G12A_GPIO_H
+
+/* First GPIO chip */
+#define GPIOAO_0       0
+#define GPIOAO_1       1
+#define GPIOAO_2       2
+#define GPIOAO_3       3
+#define GPIOAO_4       4
+#define GPIOAO_5       5
+#define GPIOAO_6       6
+#define GPIOAO_7       7
+#define GPIOAO_8       8
+#define GPIOAO_9       9
+#define GPIOAO_10      10
+#define GPIOAO_11      11
+#define GPIOE_0                12
+#define GPIOE_1                13
+#define GPIOE_2                14
+
+/* Second GPIO chip */
+#define GPIOZ_0                0
+#define GPIOZ_1                1
+#define GPIOZ_2                2
+#define GPIOZ_3                3
+#define GPIOZ_4                4
+#define GPIOZ_5                5
+#define GPIOZ_6                6
+#define GPIOZ_7                7
+#define GPIOZ_8                8
+#define GPIOZ_9                9
+#define GPIOZ_10       10
+#define GPIOZ_11       11
+#define GPIOZ_12       12
+#define GPIOZ_13       13
+#define GPIOZ_14       14
+#define GPIOZ_15       15
+#define GPIOH_0                16
+#define GPIOH_1                17
+#define GPIOH_2                18
+#define GPIOH_3                19
+#define GPIOH_4                20
+#define GPIOH_5                21
+#define GPIOH_6                22
+#define GPIOH_7                23
+#define GPIOH_8                24
+#define BOOT_0         25
+#define BOOT_1         26
+#define BOOT_2         27
+#define BOOT_3         28
+#define BOOT_4         29
+#define BOOT_5         30
+#define BOOT_6         31
+#define BOOT_7         32
+#define BOOT_8         33
+#define BOOT_9         34
+#define BOOT_10                35
+#define BOOT_11                36
+#define BOOT_12                37
+#define BOOT_13                38
+#define BOOT_14                39
+#define BOOT_15                40
+#define GPIOC_0                41
+#define GPIOC_1                42
+#define GPIOC_2                43
+#define GPIOC_3                44
+#define GPIOC_4                45
+#define GPIOC_5                46
+#define GPIOC_6                47
+#define GPIOC_7                48
+#define GPIOA_0                49
+#define GPIOA_1                50
+#define GPIOA_2                51
+#define GPIOA_3                52
+#define GPIOA_4                53
+#define GPIOA_5                54
+#define GPIOA_6                55
+#define GPIOA_7                56
+#define GPIOA_8                57
+#define GPIOA_9                58
+#define GPIOA_10       59
+#define GPIOA_11       60
+#define GPIOA_12       61
+#define GPIOA_13       62
+#define GPIOA_14       63
+#define GPIOA_15       64
+#define GPIOX_0                65
+#define GPIOX_1                66
+#define GPIOX_2                67
+#define GPIOX_3                68
+#define GPIOX_4                69
+#define GPIOX_5                70
+#define GPIOX_6                71
+#define GPIOX_7                72
+#define GPIOX_8                73
+#define GPIOX_9                74
+#define GPIOX_10       75
+#define GPIOX_11       76
+#define GPIOX_12       77
+#define GPIOX_13       78
+#define GPIOX_14       79
+#define GPIOX_15       80
+#define GPIOX_16       81
+#define GPIOX_17       82
+#define GPIOX_18       83
+#define GPIOX_19       84
+
+#endif /* _DT_BINDINGS_MESON_G12A_GPIO_H */
diff --git a/include/dt-bindings/pinctrl/stm32f746-pinfunc.h b/include/dt-bindings/pinctrl/stm32f746-pinfunc.h
deleted file mode 100644 (file)
index 549323f..0000000
+++ /dev/null
@@ -1,1341 +0,0 @@
-#ifndef _DT_BINDINGS_STM32F746_PINFUNC_H
-#define _DT_BINDINGS_STM32F746_PINFUNC_H
-
-#define STM32F746_PA0_FUNC_GPIO 0x0
-#define STM32F746_PA0_FUNC_TIM2_CH1_TIM2_ETR 0x2
-#define STM32F746_PA0_FUNC_TIM5_CH1 0x3
-#define STM32F746_PA0_FUNC_TIM8_ETR 0x4
-#define STM32F746_PA0_FUNC_USART2_CTS 0x8
-#define STM32F746_PA0_FUNC_UART4_TX 0x9
-#define STM32F746_PA0_FUNC_SAI2_SD_B 0xb
-#define STM32F746_PA0_FUNC_ETH_MII_CRS 0xc
-#define STM32F746_PA0_FUNC_EVENTOUT 0x10
-#define STM32F746_PA0_FUNC_ANALOG 0x11
-
-#define STM32F746_PA1_FUNC_GPIO 0x100
-#define STM32F746_PA1_FUNC_TIM2_CH2 0x102
-#define STM32F746_PA1_FUNC_TIM5_CH2 0x103
-#define STM32F746_PA1_FUNC_USART2_RTS 0x108
-#define STM32F746_PA1_FUNC_UART4_RX 0x109
-#define STM32F746_PA1_FUNC_QUADSPI_BK1_IO3 0x10a
-#define STM32F746_PA1_FUNC_SAI2_MCLK_B 0x10b
-#define STM32F746_PA1_FUNC_ETH_MII_RX_CLK_ETH_RMII_REF_CLK 0x10c
-#define STM32F746_PA1_FUNC_LCD_R2 0x10f
-#define STM32F746_PA1_FUNC_EVENTOUT 0x110
-#define STM32F746_PA1_FUNC_ANALOG 0x111
-
-#define STM32F746_PA2_FUNC_GPIO 0x200
-#define STM32F746_PA2_FUNC_TIM2_CH3 0x202
-#define STM32F746_PA2_FUNC_TIM5_CH3 0x203
-#define STM32F746_PA2_FUNC_TIM9_CH1 0x204
-#define STM32F746_PA2_FUNC_USART2_TX 0x208
-#define STM32F746_PA2_FUNC_SAI2_SCK_B 0x209
-#define STM32F746_PA2_FUNC_ETH_MDIO 0x20c
-#define STM32F746_PA2_FUNC_LCD_R1 0x20f
-#define STM32F746_PA2_FUNC_EVENTOUT 0x210
-#define STM32F746_PA2_FUNC_ANALOG 0x211
-
-#define STM32F746_PA3_FUNC_GPIO 0x300
-#define STM32F746_PA3_FUNC_TIM2_CH4 0x302
-#define STM32F746_PA3_FUNC_TIM5_CH4 0x303
-#define STM32F746_PA3_FUNC_TIM9_CH2 0x304
-#define STM32F746_PA3_FUNC_USART2_RX 0x308
-#define STM32F746_PA3_FUNC_OTG_HS_ULPI_D0 0x30b
-#define STM32F746_PA3_FUNC_ETH_MII_COL 0x30c
-#define STM32F746_PA3_FUNC_LCD_B5 0x30f
-#define STM32F746_PA3_FUNC_EVENTOUT 0x310
-#define STM32F746_PA3_FUNC_ANALOG 0x311
-
-#define STM32F746_PA4_FUNC_GPIO 0x400
-#define STM32F746_PA4_FUNC_SPI1_NSS_I2S1_WS 0x406
-#define STM32F746_PA4_FUNC_SPI3_NSS_I2S3_WS 0x407
-#define STM32F746_PA4_FUNC_USART2_CK 0x408
-#define STM32F746_PA4_FUNC_OTG_HS_SOF 0x40d
-#define STM32F746_PA4_FUNC_DCMI_HSYNC 0x40e
-#define STM32F746_PA4_FUNC_LCD_VSYNC 0x40f
-#define STM32F746_PA4_FUNC_EVENTOUT 0x410
-#define STM32F746_PA4_FUNC_ANALOG 0x411
-
-#define STM32F746_PA5_FUNC_GPIO 0x500
-#define STM32F746_PA5_FUNC_TIM2_CH1_TIM2_ETR 0x502
-#define STM32F746_PA5_FUNC_TIM8_CH1N 0x504
-#define STM32F746_PA5_FUNC_SPI1_SCK_I2S1_CK 0x506
-#define STM32F746_PA5_FUNC_OTG_HS_ULPI_CK 0x50b
-#define STM32F746_PA5_FUNC_LCD_R4 0x50f
-#define STM32F746_PA5_FUNC_EVENTOUT 0x510
-#define STM32F746_PA5_FUNC_ANALOG 0x511
-
-#define STM32F746_PA6_FUNC_GPIO 0x600
-#define STM32F746_PA6_FUNC_TIM1_BKIN 0x602
-#define STM32F746_PA6_FUNC_TIM3_CH1 0x603
-#define STM32F746_PA6_FUNC_TIM8_BKIN 0x604
-#define STM32F746_PA6_FUNC_SPI1_MISO 0x606
-#define STM32F746_PA6_FUNC_TIM13_CH1 0x60a
-#define STM32F746_PA6_FUNC_DCMI_PIXCLK 0x60e
-#define STM32F746_PA6_FUNC_LCD_G2 0x60f
-#define STM32F746_PA6_FUNC_EVENTOUT 0x610
-#define STM32F746_PA6_FUNC_ANALOG 0x611
-
-#define STM32F746_PA7_FUNC_GPIO 0x700
-#define STM32F746_PA7_FUNC_TIM1_CH1N 0x702
-#define STM32F746_PA7_FUNC_TIM3_CH2 0x703
-#define STM32F746_PA7_FUNC_TIM8_CH1N 0x704
-#define STM32F746_PA7_FUNC_SPI1_MOSI_I2S1_SD 0x706
-#define STM32F746_PA7_FUNC_TIM14_CH1 0x70a
-#define STM32F746_PA7_FUNC_ETH_MII_RX_DV_ETH_RMII_CRS_DV 0x70c
-#define STM32F746_PA7_FUNC_FMC_SDNWE 0x70d
-#define STM32F746_PA7_FUNC_EVENTOUT 0x710
-#define STM32F746_PA7_FUNC_ANALOG 0x711
-
-#define STM32F746_PA8_FUNC_GPIO 0x800
-#define STM32F746_PA8_FUNC_MCO1 0x801
-#define STM32F746_PA8_FUNC_TIM1_CH1 0x802
-#define STM32F746_PA8_FUNC_TIM8_BKIN2 0x804
-#define STM32F746_PA8_FUNC_I2C3_SCL 0x805
-#define STM32F746_PA8_FUNC_USART1_CK 0x808
-#define STM32F746_PA8_FUNC_OTG_FS_SOF 0x80b
-#define STM32F746_PA8_FUNC_LCD_R6 0x80f
-#define STM32F746_PA8_FUNC_EVENTOUT 0x810
-#define STM32F746_PA8_FUNC_ANALOG 0x811
-
-#define STM32F746_PA9_FUNC_GPIO 0x900
-#define STM32F746_PA9_FUNC_TIM1_CH2 0x902
-#define STM32F746_PA9_FUNC_I2C3_SMBA 0x905
-#define STM32F746_PA9_FUNC_SPI2_SCK_I2S2_CK 0x906
-#define STM32F746_PA9_FUNC_USART1_TX 0x908
-#define STM32F746_PA9_FUNC_DCMI_D0 0x90e
-#define STM32F746_PA9_FUNC_EVENTOUT 0x910
-#define STM32F746_PA9_FUNC_ANALOG 0x911
-
-#define STM32F746_PA10_FUNC_GPIO 0xa00
-#define STM32F746_PA10_FUNC_TIM1_CH3 0xa02
-#define STM32F746_PA10_FUNC_USART1_RX 0xa08
-#define STM32F746_PA10_FUNC_OTG_FS_ID 0xa0b
-#define STM32F746_PA10_FUNC_DCMI_D1 0xa0e
-#define STM32F746_PA10_FUNC_EVENTOUT 0xa10
-#define STM32F746_PA10_FUNC_ANALOG 0xa11
-
-#define STM32F746_PA11_FUNC_GPIO 0xb00
-#define STM32F746_PA11_FUNC_TIM1_CH4 0xb02
-#define STM32F746_PA11_FUNC_USART1_CTS 0xb08
-#define STM32F746_PA11_FUNC_CAN1_RX 0xb0a
-#define STM32F746_PA11_FUNC_OTG_FS_DM 0xb0b
-#define STM32F746_PA11_FUNC_LCD_R4 0xb0f
-#define STM32F746_PA11_FUNC_EVENTOUT 0xb10
-#define STM32F746_PA11_FUNC_ANALOG 0xb11
-
-#define STM32F746_PA12_FUNC_GPIO 0xc00
-#define STM32F746_PA12_FUNC_TIM1_ETR 0xc02
-#define STM32F746_PA12_FUNC_USART1_RTS 0xc08
-#define STM32F746_PA12_FUNC_SAI2_FS_B 0xc09
-#define STM32F746_PA12_FUNC_CAN1_TX 0xc0a
-#define STM32F746_PA12_FUNC_OTG_FS_DP 0xc0b
-#define STM32F746_PA12_FUNC_LCD_R5 0xc0f
-#define STM32F746_PA12_FUNC_EVENTOUT 0xc10
-#define STM32F746_PA12_FUNC_ANALOG 0xc11
-
-#define STM32F746_PA13_FUNC_GPIO 0xd00
-#define STM32F746_PA13_FUNC_JTMS_SWDIO 0xd01
-#define STM32F746_PA13_FUNC_EVENTOUT 0xd10
-#define STM32F746_PA13_FUNC_ANALOG 0xd11
-
-#define STM32F746_PA14_FUNC_GPIO 0xe00
-#define STM32F746_PA14_FUNC_JTCK_SWCLK 0xe01
-#define STM32F746_PA14_FUNC_EVENTOUT 0xe10
-#define STM32F746_PA14_FUNC_ANALOG 0xe11
-
-#define STM32F746_PA15_FUNC_GPIO 0xf00
-#define STM32F746_PA15_FUNC_JTDI 0xf01
-#define STM32F746_PA15_FUNC_TIM2_CH1_TIM2_ETR 0xf02
-#define STM32F746_PA15_FUNC_HDMI_CEC 0xf05
-#define STM32F746_PA15_FUNC_SPI1_NSS_I2S1_WS 0xf06
-#define STM32F746_PA15_FUNC_SPI3_NSS_I2S3_WS 0xf07
-#define STM32F746_PA15_FUNC_UART4_RTS 0xf09
-#define STM32F746_PA15_FUNC_EVENTOUT 0xf10
-#define STM32F746_PA15_FUNC_ANALOG 0xf11
-
-#define STM32F746_PB0_FUNC_GPIO 0x1000
-#define STM32F746_PB0_FUNC_TIM1_CH2N 0x1002
-#define STM32F746_PB0_FUNC_TIM3_CH3 0x1003
-#define STM32F746_PB0_FUNC_TIM8_CH2N 0x1004
-#define STM32F746_PB0_FUNC_UART4_CTS 0x1009
-#define STM32F746_PB0_FUNC_LCD_R3 0x100a
-#define STM32F746_PB0_FUNC_OTG_HS_ULPI_D1 0x100b
-#define STM32F746_PB0_FUNC_ETH_MII_RXD2 0x100c
-#define STM32F746_PB0_FUNC_EVENTOUT 0x1010
-#define STM32F746_PB0_FUNC_ANALOG 0x1011
-
-#define STM32F746_PB1_FUNC_GPIO 0x1100
-#define STM32F746_PB1_FUNC_TIM1_CH3N 0x1102
-#define STM32F746_PB1_FUNC_TIM3_CH4 0x1103
-#define STM32F746_PB1_FUNC_TIM8_CH3N 0x1104
-#define STM32F746_PB1_FUNC_LCD_R6 0x110a
-#define STM32F746_PB1_FUNC_OTG_HS_ULPI_D2 0x110b
-#define STM32F746_PB1_FUNC_ETH_MII_RXD3 0x110c
-#define STM32F746_PB1_FUNC_EVENTOUT 0x1110
-#define STM32F746_PB1_FUNC_ANALOG 0x1111
-
-#define STM32F746_PB2_FUNC_GPIO 0x1200
-#define STM32F746_PB2_FUNC_SAI1_SD_A 0x1207
-#define STM32F746_PB2_FUNC_SPI3_MOSI_I2S3_SD 0x1208
-#define STM32F746_PB2_FUNC_QUADSPI_CLK 0x120a
-#define STM32F746_PB2_FUNC_EVENTOUT 0x1210
-#define STM32F746_PB2_FUNC_ANALOG 0x1211
-
-#define STM32F746_PB3_FUNC_GPIO 0x1300
-#define STM32F746_PB3_FUNC_JTDO_TRACESWO 0x1301
-#define STM32F746_PB3_FUNC_TIM2_CH2 0x1302
-#define STM32F746_PB3_FUNC_SPI1_SCK_I2S1_CK 0x1306
-#define STM32F746_PB3_FUNC_SPI3_SCK_I2S3_CK 0x1307
-
-#define STM32F769_PB3_FUNC_SDMMC2_D2 0x130b
-
-#define STM32F746_PB3_FUNC_EVENTOUT 0x1310
-#define STM32F746_PB3_FUNC_ANALOG 0x1311
-
-#define STM32F746_PB4_FUNC_GPIO 0x1400
-#define STM32F746_PB4_FUNC_NJTRST 0x1401
-#define STM32F746_PB4_FUNC_TIM3_CH1 0x1403
-#define STM32F746_PB4_FUNC_SPI1_MISO 0x1406
-#define STM32F746_PB4_FUNC_SPI3_MISO 0x1407
-#define STM32F746_PB4_FUNC_SPI2_NSS_I2S2_WS 0x1408
-
-#define STM32F769_PB4_FUNC_SDMMC2_D3 0x140b
-
-#define STM32F746_PB4_FUNC_EVENTOUT 0x1410
-#define STM32F746_PB4_FUNC_ANALOG 0x1411
-
-#define STM32F746_PB5_FUNC_GPIO 0x1500
-#define STM32F746_PB5_FUNC_TIM3_CH2 0x1503
-#define STM32F746_PB5_FUNC_I2C1_SMBA 0x1505
-#define STM32F746_PB5_FUNC_SPI1_MOSI_I2S1_SD 0x1506
-#define STM32F746_PB5_FUNC_SPI3_MOSI_I2S3_SD 0x1507
-#define STM32F746_PB5_FUNC_CAN2_RX 0x150a
-#define STM32F746_PB5_FUNC_OTG_HS_ULPI_D7 0x150b
-#define STM32F746_PB5_FUNC_ETH_PPS_OUT 0x150c
-#define STM32F746_PB5_FUNC_FMC_SDCKE1 0x150d
-#define STM32F746_PB5_FUNC_DCMI_D10 0x150e
-#define STM32F746_PB5_FUNC_EVENTOUT 0x1510
-#define STM32F746_PB5_FUNC_ANALOG 0x1511
-
-#define STM32F746_PB6_FUNC_GPIO 0x1600
-#define STM32F746_PB6_FUNC_TIM4_CH1 0x1603
-#define STM32F746_PB6_FUNC_HDMI_CEC 0x1604
-#define STM32F746_PB6_FUNC_I2C1_SCL 0x1605
-#define STM32F746_PB6_FUNC_USART1_TX 0x1608
-#define STM32F746_PB6_FUNC_CAN2_TX 0x160a
-#define STM32F746_PB6_FUNC_QUADSPI_BK1_NCS 0x160b
-#define STM32F746_PB6_FUNC_FMC_SDNE1 0x160d
-#define STM32F746_PB6_FUNC_DCMI_D5 0x160e
-#define STM32F746_PB6_FUNC_EVENTOUT 0x1610
-#define STM32F746_PB6_FUNC_ANALOG 0x1611
-
-#define STM32F746_PB7_FUNC_GPIO 0x1700
-#define STM32F746_PB7_FUNC_TIM4_CH2 0x1703
-#define STM32F746_PB7_FUNC_I2C1_SDA 0x1705
-#define STM32F746_PB7_FUNC_USART1_RX 0x1708
-#define STM32F746_PB7_FUNC_FMC_NL 0x170d
-#define STM32F746_PB7_FUNC_DCMI_VSYNC 0x170e
-#define STM32F746_PB7_FUNC_EVENTOUT 0x1710
-#define STM32F746_PB7_FUNC_ANALOG 0x1711
-
-#define STM32F746_PB8_FUNC_GPIO 0x1800
-#define STM32F746_PB8_FUNC_TIM4_CH3 0x1803
-#define STM32F746_PB8_FUNC_TIM10_CH1 0x1804
-#define STM32F746_PB8_FUNC_I2C1_SCL 0x1805
-#define STM32F746_PB8_FUNC_CAN1_RX 0x180a
-#define STM32F746_PB8_FUNC_ETH_MII_TXD3 0x180c
-#define STM32F746_PB8_FUNC_SDMMC1_D4 0x180d
-#define STM32F746_PB8_FUNC_DCMI_D6 0x180e
-#define STM32F746_PB8_FUNC_LCD_B6 0x180f
-#define STM32F746_PB8_FUNC_EVENTOUT 0x1810
-#define STM32F746_PB8_FUNC_ANALOG 0x1811
-
-#define STM32F746_PB9_FUNC_GPIO 0x1900
-#define STM32F746_PB9_FUNC_TIM4_CH4 0x1903
-#define STM32F746_PB9_FUNC_TIM11_CH1 0x1904
-#define STM32F746_PB9_FUNC_I2C1_SDA 0x1905
-#define STM32F746_PB9_FUNC_SPI2_NSS_I2S2_WS 0x1906
-#define STM32F746_PB9_FUNC_CAN1_TX 0x190a
-#define STM32F746_PB9_FUNC_SDMMC1_D5 0x190d
-#define STM32F746_PB9_FUNC_DCMI_D7 0x190e
-#define STM32F746_PB9_FUNC_LCD_B7 0x190f
-#define STM32F746_PB9_FUNC_EVENTOUT 0x1910
-#define STM32F746_PB9_FUNC_ANALOG 0x1911
-
-#define STM32F746_PB10_FUNC_GPIO 0x1a00
-#define STM32F746_PB10_FUNC_TIM2_CH3 0x1a02
-#define STM32F746_PB10_FUNC_I2C2_SCL 0x1a05
-#define STM32F746_PB10_FUNC_SPI2_SCK_I2S2_CK 0x1a06
-#define STM32F746_PB10_FUNC_USART3_TX 0x1a08
-#define STM32F746_PB10_FUNC_OTG_HS_ULPI_D3 0x1a0b
-#define STM32F746_PB10_FUNC_ETH_MII_RX_ER 0x1a0c
-#define STM32F746_PB10_FUNC_LCD_G4 0x1a0f
-#define STM32F746_PB10_FUNC_EVENTOUT 0x1a10
-#define STM32F746_PB10_FUNC_ANALOG 0x1a11
-
-#define STM32F746_PB11_FUNC_GPIO 0x1b00
-#define STM32F746_PB11_FUNC_TIM2_CH4 0x1b02
-#define STM32F746_PB11_FUNC_I2C2_SDA 0x1b05
-#define STM32F746_PB11_FUNC_USART3_RX 0x1b08
-#define STM32F746_PB11_FUNC_OTG_HS_ULPI_D4 0x1b0b
-#define STM32F746_PB11_FUNC_ETH_MII_TX_EN_ETH_RMII_TX_EN 0x1b0c
-#define STM32F746_PB11_FUNC_LCD_G5 0x1b0f
-#define STM32F746_PB11_FUNC_EVENTOUT 0x1b10
-#define STM32F746_PB11_FUNC_ANALOG 0x1b11
-
-#define STM32F746_PB12_FUNC_GPIO 0x1c00
-#define STM32F746_PB12_FUNC_TIM1_BKIN 0x1c02
-#define STM32F746_PB12_FUNC_I2C2_SMBA 0x1c05
-#define STM32F746_PB12_FUNC_SPI2_NSS_I2S2_WS 0x1c06
-#define STM32F746_PB12_FUNC_USART3_CK 0x1c08
-#define STM32F746_PB12_FUNC_CAN2_RX 0x1c0a
-#define STM32F746_PB12_FUNC_OTG_HS_ULPI_D5 0x1c0b
-#define STM32F746_PB12_FUNC_ETH_MII_TXD0_ETH_RMII_TXD0 0x1c0c
-#define STM32F746_PB12_FUNC_OTG_HS_ID 0x1c0d
-#define STM32F746_PB12_FUNC_EVENTOUT 0x1c10
-#define STM32F746_PB12_FUNC_ANALOG 0x1c11
-
-#define STM32F746_PB13_FUNC_GPIO 0x1d00
-#define STM32F746_PB13_FUNC_TIM1_CH1N 0x1d02
-#define STM32F746_PB13_FUNC_SPI2_SCK_I2S2_CK 0x1d06
-#define STM32F746_PB13_FUNC_USART3_CTS 0x1d08
-#define STM32F746_PB13_FUNC_CAN2_TX 0x1d0a
-#define STM32F746_PB13_FUNC_OTG_HS_ULPI_D6 0x1d0b
-#define STM32F746_PB13_FUNC_ETH_MII_TXD1_ETH_RMII_TXD1 0x1d0c
-#define STM32F746_PB13_FUNC_EVENTOUT 0x1d10
-#define STM32F746_PB13_FUNC_ANALOG 0x1d11
-
-#define STM32F746_PB14_FUNC_GPIO 0x1e00
-#define STM32F746_PB14_FUNC_TIM1_CH2N 0x1e02
-#define STM32F746_PB14_FUNC_TIM8_CH2N 0x1e04
-#define STM32F746_PB14_FUNC_SPI2_MISO 0x1e06
-#define STM32F746_PB14_FUNC_USART3_RTS 0x1e08
-#define STM32F746_PB14_FUNC_TIM12_CH1 0x1e0a
-#define STM32F746_PB14_FUNC_OTG_HS_DM 0x1e0d
-#define STM32F746_PB14_FUNC_EVENTOUT 0x1e10
-#define STM32F746_PB14_FUNC_ANALOG 0x1e11
-
-#define STM32F746_PB15_FUNC_GPIO 0x1f00
-#define STM32F746_PB15_FUNC_RTC_REFIN 0x1f01
-#define STM32F746_PB15_FUNC_TIM1_CH3N 0x1f02
-#define STM32F746_PB15_FUNC_TIM8_CH3N 0x1f04
-#define STM32F746_PB15_FUNC_SPI2_MOSI_I2S2_SD 0x1f06
-#define STM32F746_PB15_FUNC_TIM12_CH2 0x1f0a
-#define STM32F746_PB15_FUNC_OTG_HS_DP 0x1f0d
-#define STM32F746_PB15_FUNC_EVENTOUT 0x1f10
-#define STM32F746_PB15_FUNC_ANALOG 0x1f11
-
-
-#define STM32F746_PC0_FUNC_GPIO 0x2000
-#define STM32F746_PC0_FUNC_SAI2_FS_B 0x2009
-#define STM32F746_PC0_FUNC_OTG_HS_ULPI_STP 0x200b
-#define STM32F746_PC0_FUNC_FMC_SDNWE 0x200d
-#define STM32F746_PC0_FUNC_LCD_R5 0x200f
-#define STM32F746_PC0_FUNC_EVENTOUT 0x2010
-#define STM32F746_PC0_FUNC_ANALOG 0x2011
-
-#define STM32F746_PC1_FUNC_GPIO 0x2100
-#define STM32F746_PC1_FUNC_TRACED0 0x2101
-#define STM32F746_PC1_FUNC_SPI2_MOSI_I2S2_SD 0x2106
-#define STM32F746_PC1_FUNC_SAI1_SD_A 0x2107
-#define STM32F746_PC1_FUNC_ETH_MDC 0x210c
-#define STM32F746_PC1_FUNC_EVENTOUT 0x2110
-#define STM32F746_PC1_FUNC_ANALOG 0x2111
-
-#define STM32F746_PC2_FUNC_GPIO 0x2200
-#define STM32F746_PC2_FUNC_SPI2_MISO 0x2206
-#define STM32F746_PC2_FUNC_OTG_HS_ULPI_DIR 0x220b
-#define STM32F746_PC2_FUNC_ETH_MII_TXD2 0x220c
-#define STM32F746_PC2_FUNC_FMC_SDNE0 0x220d
-#define STM32F746_PC2_FUNC_EVENTOUT 0x2210
-#define STM32F746_PC2_FUNC_ANALOG 0x2211
-
-#define STM32F746_PC3_FUNC_GPIO 0x2300
-#define STM32F746_PC3_FUNC_SPI2_MOSI_I2S2_SD 0x2306
-#define STM32F746_PC3_FUNC_OTG_HS_ULPI_NXT 0x230b
-#define STM32F746_PC3_FUNC_ETH_MII_TX_CLK 0x230c
-#define STM32F746_PC3_FUNC_FMC_SDCKE0 0x230d
-#define STM32F746_PC3_FUNC_EVENTOUT 0x2310
-#define STM32F746_PC3_FUNC_ANALOG 0x2311
-
-#define STM32F746_PC4_FUNC_GPIO 0x2400
-#define STM32F746_PC4_FUNC_I2S1_MCK 0x2406
-#define STM32F746_PC4_FUNC_SPDIFRX_IN2 0x2409
-#define STM32F746_PC4_FUNC_ETH_MII_RXD0_ETH_RMII_RXD0 0x240c
-#define STM32F746_PC4_FUNC_FMC_SDNE0 0x240d
-#define STM32F746_PC4_FUNC_EVENTOUT 0x2410
-#define STM32F746_PC4_FUNC_ANALOG 0x2411
-
-#define STM32F746_PC5_FUNC_GPIO 0x2500
-#define STM32F746_PC5_FUNC_SPDIFRX_IN3 0x2509
-#define STM32F746_PC5_FUNC_ETH_MII_RXD1_ETH_RMII_RXD1 0x250c
-#define STM32F746_PC5_FUNC_FMC_SDCKE0 0x250d
-#define STM32F746_PC5_FUNC_EVENTOUT 0x2510
-#define STM32F746_PC5_FUNC_ANALOG 0x2511
-
-#define STM32F746_PC6_FUNC_GPIO 0x2600
-#define STM32F746_PC6_FUNC_TIM3_CH1 0x2603
-#define STM32F746_PC6_FUNC_TIM8_CH1 0x2604
-#define STM32F746_PC6_FUNC_I2S2_MCK 0x2606
-#define STM32F746_PC6_FUNC_USART6_TX 0x2609
-#define STM32F746_PC6_FUNC_SDMMC1_D6 0x260d
-#define STM32F746_PC6_FUNC_DCMI_D0 0x260e
-#define STM32F746_PC6_FUNC_LCD_HSYNC 0x260f
-#define STM32F746_PC6_FUNC_EVENTOUT 0x2610
-#define STM32F746_PC6_FUNC_ANALOG 0x2611
-
-#define STM32F746_PC7_FUNC_GPIO 0x2700
-#define STM32F746_PC7_FUNC_TIM3_CH2 0x2703
-#define STM32F746_PC7_FUNC_TIM8_CH2 0x2704
-#define STM32F746_PC7_FUNC_I2S3_MCK 0x2707
-#define STM32F746_PC7_FUNC_USART6_RX 0x2709
-#define STM32F746_PC7_FUNC_SDMMC1_D7 0x270d
-#define STM32F746_PC7_FUNC_DCMI_D1 0x270e
-#define STM32F746_PC7_FUNC_LCD_G6 0x270f
-#define STM32F746_PC7_FUNC_EVENTOUT 0x2710
-#define STM32F746_PC7_FUNC_ANALOG 0x2711
-
-#define STM32F746_PC8_FUNC_GPIO 0x2800
-#define STM32F746_PC8_FUNC_TRACED1 0x2801
-#define STM32F746_PC8_FUNC_TIM3_CH3 0x2803
-#define STM32F746_PC8_FUNC_TIM8_CH3 0x2804
-#define STM32F746_PC8_FUNC_UART5_RTS 0x2808
-#define STM32F746_PC8_FUNC_USART6_CK 0x2809
-#define STM32F746_PC8_FUNC_SDMMC1_D0 0x280d
-#define STM32F746_PC8_FUNC_DCMI_D2 0x280e
-#define STM32F746_PC8_FUNC_EVENTOUT 0x2810
-#define STM32F746_PC8_FUNC_ANALOG 0x2811
-
-#define STM32F746_PC9_FUNC_GPIO 0x2900
-#define STM32F746_PC9_FUNC_MCO2 0x2901
-#define STM32F746_PC9_FUNC_TIM3_CH4 0x2903
-#define STM32F746_PC9_FUNC_TIM8_CH4 0x2904
-#define STM32F746_PC9_FUNC_I2C3_SDA 0x2905
-#define STM32F746_PC9_FUNC_I2S_CKIN 0x2906
-#define STM32F746_PC9_FUNC_UART5_CTS 0x2908
-#define STM32F746_PC9_FUNC_QUADSPI_BK1_IO0 0x290a
-#define STM32F746_PC9_FUNC_SDMMC1_D1 0x290d
-#define STM32F746_PC9_FUNC_DCMI_D3 0x290e
-#define STM32F746_PC9_FUNC_EVENTOUT 0x2910
-#define STM32F746_PC9_FUNC_ANALOG 0x2911
-
-#define STM32F746_PC10_FUNC_GPIO 0x2a00
-#define STM32F746_PC10_FUNC_SPI3_SCK_I2S3_CK 0x2a07
-#define STM32F746_PC10_FUNC_USART3_TX 0x2a08
-#define STM32F746_PC10_FUNC_UART4_TX 0x2a09
-#define STM32F746_PC10_FUNC_QUADSPI_BK1_IO1 0x2a0a
-#define STM32F746_PC10_FUNC_SDMMC1_D2 0x2a0d
-#define STM32F746_PC10_FUNC_DCMI_D8 0x2a0e
-#define STM32F746_PC10_FUNC_LCD_R2 0x2a0f
-#define STM32F746_PC10_FUNC_EVENTOUT 0x2a10
-#define STM32F746_PC10_FUNC_ANALOG 0x2a11
-
-#define STM32F746_PC11_FUNC_GPIO 0x2b00
-#define STM32F746_PC11_FUNC_SPI3_MISO 0x2b07
-#define STM32F746_PC11_FUNC_USART3_RX 0x2b08
-#define STM32F746_PC11_FUNC_UART4_RX 0x2b09
-#define STM32F746_PC11_FUNC_QUADSPI_BK2_NCS 0x2b0a
-#define STM32F746_PC11_FUNC_SDMMC1_D3 0x2b0d
-#define STM32F746_PC11_FUNC_DCMI_D4 0x2b0e
-#define STM32F746_PC11_FUNC_EVENTOUT 0x2b10
-#define STM32F746_PC11_FUNC_ANALOG 0x2b11
-
-#define STM32F746_PC12_FUNC_GPIO 0x2c00
-#define STM32F746_PC12_FUNC_TRACED3 0x2c01
-#define STM32F746_PC12_FUNC_SPI3_MOSI_I2S3_SD 0x2c07
-#define STM32F746_PC12_FUNC_USART3_CK 0x2c08
-#define STM32F746_PC12_FUNC_UART5_TX 0x2c09
-#define STM32F746_PC12_FUNC_SDMMC1_CK 0x2c0d
-#define STM32F746_PC12_FUNC_DCMI_D9 0x2c0e
-#define STM32F746_PC12_FUNC_EVENTOUT 0x2c10
-#define STM32F746_PC12_FUNC_ANALOG 0x2c11
-
-#define STM32F746_PC13_FUNC_GPIO 0x2d00
-#define STM32F746_PC13_FUNC_EVENTOUT 0x2d10
-#define STM32F746_PC13_FUNC_ANALOG 0x2d11
-
-#define STM32F746_PC14_FUNC_GPIO 0x2e00
-#define STM32F746_PC14_FUNC_EVENTOUT 0x2e10
-#define STM32F746_PC14_FUNC_ANALOG 0x2e11
-
-#define STM32F746_PC15_FUNC_GPIO 0x2f00
-#define STM32F746_PC15_FUNC_EVENTOUT 0x2f10
-#define STM32F746_PC15_FUNC_ANALOG 0x2f11
-
-
-#define STM32F746_PD0_FUNC_GPIO 0x3000
-#define STM32F746_PD0_FUNC_CAN1_RX 0x300a
-#define STM32F746_PD0_FUNC_FMC_D2 0x300d
-#define STM32F746_PD0_FUNC_EVENTOUT 0x3010
-#define STM32F746_PD0_FUNC_ANALOG 0x3011
-
-#define STM32F746_PD1_FUNC_GPIO 0x3100
-#define STM32F746_PD1_FUNC_CAN1_TX 0x310a
-#define STM32F746_PD1_FUNC_FMC_D3 0x310d
-#define STM32F746_PD1_FUNC_EVENTOUT 0x3110
-#define STM32F746_PD1_FUNC_ANALOG 0x3111
-
-#define STM32F746_PD2_FUNC_GPIO 0x3200
-#define STM32F746_PD2_FUNC_TRACED2 0x3201
-#define STM32F746_PD2_FUNC_TIM3_ETR 0x3203
-#define STM32F746_PD2_FUNC_UART5_RX 0x3209
-#define STM32F746_PD2_FUNC_SDMMC1_CMD 0x320d
-#define STM32F746_PD2_FUNC_DCMI_D11 0x320e
-#define STM32F746_PD2_FUNC_EVENTOUT 0x3210
-#define STM32F746_PD2_FUNC_ANALOG 0x3211
-
-#define STM32F746_PD3_FUNC_GPIO 0x3300
-#define STM32F746_PD3_FUNC_SPI2_SCK_I2S2_CK 0x3306
-#define STM32F746_PD3_FUNC_USART2_CTS 0x3308
-#define STM32F746_PD3_FUNC_FMC_CLK 0x330d
-#define STM32F746_PD3_FUNC_DCMI_D5 0x330e
-#define STM32F746_PD3_FUNC_LCD_G7 0x330f
-#define STM32F746_PD3_FUNC_EVENTOUT 0x3310
-#define STM32F746_PD3_FUNC_ANALOG 0x3311
-
-#define STM32F746_PD4_FUNC_GPIO 0x3400
-#define STM32F746_PD4_FUNC_USART2_RTS 0x3408
-#define STM32F746_PD4_FUNC_FMC_NOE 0x340d
-#define STM32F746_PD4_FUNC_EVENTOUT 0x3410
-#define STM32F746_PD4_FUNC_ANALOG 0x3411
-
-#define STM32F746_PD5_FUNC_GPIO 0x3500
-#define STM32F746_PD5_FUNC_USART2_TX 0x3508
-#define STM32F746_PD5_FUNC_FMC_NWE 0x350d
-#define STM32F746_PD5_FUNC_EVENTOUT 0x3510
-#define STM32F746_PD5_FUNC_ANALOG 0x3511
-
-#define STM32F746_PD6_FUNC_GPIO 0x3600
-#define STM32F746_PD6_FUNC_SPI3_MOSI_I2S3_SD 0x3606
-#define STM32F746_PD6_FUNC_SAI1_SD_A 0x3607
-#define STM32F746_PD6_FUNC_USART2_RX 0x3608
-
-#define STM32F769_PD6_FUNC_SDMMC2_CLK 0x360c
-
-#define STM32F746_PD6_FUNC_FMC_NWAIT 0x360d
-#define STM32F746_PD6_FUNC_DCMI_D10 0x360e
-#define STM32F746_PD6_FUNC_LCD_B2 0x360f
-#define STM32F746_PD6_FUNC_EVENTOUT 0x3610
-#define STM32F746_PD6_FUNC_ANALOG 0x3611
-
-#define STM32F746_PD7_FUNC_GPIO 0x3700
-#define STM32F746_PD7_FUNC_USART2_CK 0x3708
-#define STM32F746_PD7_FUNC_SPDIFRX_IN0 0x3709
-
-#define STM32F769_PD7_FUNC_SDMMC2_CMD 0x370c
-
-#define STM32F746_PD7_FUNC_FMC_NE1 0x370d
-#define STM32F746_PD7_FUNC_EVENTOUT 0x3710
-#define STM32F746_PD7_FUNC_ANALOG 0x3711
-
-#define STM32F746_PD8_FUNC_GPIO 0x3800
-#define STM32F746_PD8_FUNC_USART3_TX 0x3808
-#define STM32F746_PD8_FUNC_SPDIFRX_IN1 0x3809
-#define STM32F746_PD8_FUNC_FMC_D13 0x380d
-#define STM32F746_PD8_FUNC_EVENTOUT 0x3810
-#define STM32F746_PD8_FUNC_ANALOG 0x3811
-
-#define STM32F746_PD9_FUNC_GPIO 0x3900
-#define STM32F746_PD9_FUNC_USART3_RX 0x3908
-#define STM32F746_PD9_FUNC_FMC_D14 0x390d
-#define STM32F746_PD9_FUNC_EVENTOUT 0x3910
-#define STM32F746_PD9_FUNC_ANALOG 0x3911
-
-#define STM32F746_PD10_FUNC_GPIO 0x3a00
-#define STM32F746_PD10_FUNC_USART3_CK 0x3a08
-#define STM32F746_PD10_FUNC_FMC_D15 0x3a0d
-#define STM32F746_PD10_FUNC_LCD_B3 0x3a0f
-#define STM32F746_PD10_FUNC_EVENTOUT 0x3a10
-#define STM32F746_PD10_FUNC_ANALOG 0x3a11
-
-#define STM32F746_PD11_FUNC_GPIO 0x3b00
-#define STM32F746_PD11_FUNC_I2C4_SMBA 0x3b05
-#define STM32F746_PD11_FUNC_USART3_CTS 0x3b08
-#define STM32F746_PD11_FUNC_QUADSPI_BK1_IO0 0x3b0a
-#define STM32F746_PD11_FUNC_SAI2_SD_A 0x3b0b
-#define STM32F746_PD11_FUNC_FMC_A16_FMC_CLE 0x3b0d
-#define STM32F746_PD11_FUNC_EVENTOUT 0x3b10
-#define STM32F746_PD11_FUNC_ANALOG 0x3b11
-
-#define STM32F746_PD12_FUNC_GPIO 0x3c00
-#define STM32F746_PD12_FUNC_TIM4_CH1 0x3c03
-#define STM32F746_PD12_FUNC_LPTIM1_IN1 0x3c04
-#define STM32F746_PD12_FUNC_I2C4_SCL 0x3c05
-#define STM32F746_PD12_FUNC_USART3_RTS 0x3c08
-#define STM32F746_PD12_FUNC_QUADSPI_BK1_IO1 0x3c0a
-#define STM32F746_PD12_FUNC_SAI2_FS_A 0x3c0b
-#define STM32F746_PD12_FUNC_FMC_A17_FMC_ALE 0x3c0d
-#define STM32F746_PD12_FUNC_EVENTOUT 0x3c10
-#define STM32F746_PD12_FUNC_ANALOG 0x3c11
-
-#define STM32F746_PD13_FUNC_GPIO 0x3d00
-#define STM32F746_PD13_FUNC_TIM4_CH2 0x3d03
-#define STM32F746_PD13_FUNC_LPTIM1_OUT 0x3d04
-#define STM32F746_PD13_FUNC_I2C4_SDA 0x3d05
-#define STM32F746_PD13_FUNC_QUADSPI_BK1_IO3 0x3d0a
-#define STM32F746_PD13_FUNC_SAI2_SCK_A 0x3d0b
-#define STM32F746_PD13_FUNC_FMC_A18 0x3d0d
-#define STM32F746_PD13_FUNC_EVENTOUT 0x3d10
-#define STM32F746_PD13_FUNC_ANALOG 0x3d11
-
-#define STM32F746_PD14_FUNC_GPIO 0x3e00
-#define STM32F746_PD14_FUNC_TIM4_CH3 0x3e03
-#define STM32F746_PD14_FUNC_UART8_CTS 0x3e09
-#define STM32F746_PD14_FUNC_FMC_D0 0x3e0d
-#define STM32F746_PD14_FUNC_EVENTOUT 0x3e10
-#define STM32F746_PD14_FUNC_ANALOG 0x3e11
-
-#define STM32F746_PD15_FUNC_GPIO 0x3f00
-#define STM32F746_PD15_FUNC_TIM4_CH4 0x3f03
-#define STM32F746_PD15_FUNC_UART8_RTS 0x3f09
-#define STM32F746_PD15_FUNC_FMC_D1 0x3f0d
-#define STM32F746_PD15_FUNC_EVENTOUT 0x3f10
-#define STM32F746_PD15_FUNC_ANALOG 0x3f11
-
-
-#define STM32F746_PE0_FUNC_GPIO 0x4000
-#define STM32F746_PE0_FUNC_TIM4_ETR 0x4003
-#define STM32F746_PE0_FUNC_LPTIM1_ETR 0x4004
-#define STM32F746_PE0_FUNC_UART8_RX 0x4009
-#define STM32F746_PE0_FUNC_SAI2_MCLK_A 0x400b
-#define STM32F746_PE0_FUNC_FMC_NBL0 0x400d
-#define STM32F746_PE0_FUNC_DCMI_D2 0x400e
-#define STM32F746_PE0_FUNC_EVENTOUT 0x4010
-#define STM32F746_PE0_FUNC_ANALOG 0x4011
-
-#define STM32F746_PE1_FUNC_GPIO 0x4100
-#define STM32F746_PE1_FUNC_LPTIM1_IN2 0x4104
-#define STM32F746_PE1_FUNC_UART8_TX 0x4109
-#define STM32F746_PE1_FUNC_FMC_NBL1 0x410d
-#define STM32F746_PE1_FUNC_DCMI_D3 0x410e
-#define STM32F746_PE1_FUNC_EVENTOUT 0x4110
-#define STM32F746_PE1_FUNC_ANALOG 0x4111
-
-#define STM32F746_PE2_FUNC_GPIO 0x4200
-#define STM32F746_PE2_FUNC_TRACECLK 0x4201
-#define STM32F746_PE2_FUNC_SPI4_SCK 0x4206
-#define STM32F746_PE2_FUNC_SAI1_MCLK_A 0x4207
-#define STM32F746_PE2_FUNC_QUADSPI_BK1_IO2 0x420a
-#define STM32F746_PE2_FUNC_ETH_MII_TXD3 0x420c
-#define STM32F746_PE2_FUNC_FMC_A23 0x420d
-#define STM32F746_PE2_FUNC_EVENTOUT 0x4210
-#define STM32F746_PE2_FUNC_ANALOG 0x4211
-
-#define STM32F746_PE3_FUNC_GPIO 0x4300
-#define STM32F746_PE3_FUNC_TRACED0 0x4301
-#define STM32F746_PE3_FUNC_SAI1_SD_B 0x4307
-#define STM32F746_PE3_FUNC_FMC_A19 0x430d
-#define STM32F746_PE3_FUNC_EVENTOUT 0x4310
-#define STM32F746_PE3_FUNC_ANALOG 0x4311
-
-#define STM32F746_PE4_FUNC_GPIO 0x4400
-#define STM32F746_PE4_FUNC_TRACED1 0x4401
-#define STM32F746_PE4_FUNC_SPI4_NSS 0x4406
-#define STM32F746_PE4_FUNC_SAI1_FS_A 0x4407
-#define STM32F746_PE4_FUNC_FMC_A20 0x440d
-#define STM32F746_PE4_FUNC_DCMI_D4 0x440e
-#define STM32F746_PE4_FUNC_LCD_B0 0x440f
-#define STM32F746_PE4_FUNC_EVENTOUT 0x4410
-#define STM32F746_PE4_FUNC_ANALOG 0x4411
-
-#define STM32F746_PE5_FUNC_GPIO 0x4500
-#define STM32F746_PE5_FUNC_TRACED2 0x4501
-#define STM32F746_PE5_FUNC_TIM9_CH1 0x4504
-#define STM32F746_PE5_FUNC_SPI4_MISO 0x4506
-#define STM32F746_PE5_FUNC_SAI1_SCK_A 0x4507
-#define STM32F746_PE5_FUNC_FMC_A21 0x450d
-#define STM32F746_PE5_FUNC_DCMI_D6 0x450e
-#define STM32F746_PE5_FUNC_LCD_G0 0x450f
-#define STM32F746_PE5_FUNC_EVENTOUT 0x4510
-#define STM32F746_PE5_FUNC_ANALOG 0x4511
-
-#define STM32F746_PE6_FUNC_GPIO 0x4600
-#define STM32F746_PE6_FUNC_TRACED3 0x4601
-#define STM32F746_PE6_FUNC_TIM1_BKIN2 0x4602
-#define STM32F746_PE6_FUNC_TIM9_CH2 0x4604
-#define STM32F746_PE6_FUNC_SPI4_MOSI 0x4606
-#define STM32F746_PE6_FUNC_SAI1_SD_A 0x4607
-#define STM32F746_PE6_FUNC_SAI2_MCLK_B 0x460b
-#define STM32F746_PE6_FUNC_FMC_A22 0x460d
-#define STM32F746_PE6_FUNC_DCMI_D7 0x460e
-#define STM32F746_PE6_FUNC_LCD_G1 0x460f
-#define STM32F746_PE6_FUNC_EVENTOUT 0x4610
-#define STM32F746_PE6_FUNC_ANALOG 0x4611
-
-#define STM32F746_PE7_FUNC_GPIO 0x4700
-#define STM32F746_PE7_FUNC_TIM1_ETR 0x4702
-#define STM32F746_PE7_FUNC_UART7_RX 0x4709
-#define STM32F746_PE7_FUNC_QUADSPI_BK2_IO0 0x470b
-#define STM32F746_PE7_FUNC_FMC_D4 0x470d
-#define STM32F746_PE7_FUNC_EVENTOUT 0x4710
-#define STM32F746_PE7_FUNC_ANALOG 0x4711
-
-#define STM32F746_PE8_FUNC_GPIO 0x4800
-#define STM32F746_PE8_FUNC_TIM1_CH1N 0x4802
-#define STM32F746_PE8_FUNC_UART7_TX 0x4809
-#define STM32F746_PE8_FUNC_QUADSPI_BK2_IO1 0x480b
-#define STM32F746_PE8_FUNC_FMC_D5 0x480d
-#define STM32F746_PE8_FUNC_EVENTOUT 0x4810
-#define STM32F746_PE8_FUNC_ANALOG 0x4811
-
-#define STM32F746_PE9_FUNC_GPIO 0x4900
-#define STM32F746_PE9_FUNC_TIM1_CH1 0x4902
-#define STM32F746_PE9_FUNC_UART7_RTS 0x4909
-#define STM32F746_PE9_FUNC_QUADSPI_BK2_IO2 0x490b
-#define STM32F746_PE9_FUNC_FMC_D6 0x490d
-#define STM32F746_PE9_FUNC_EVENTOUT 0x4910
-#define STM32F746_PE9_FUNC_ANALOG 0x4911
-
-#define STM32F746_PE10_FUNC_GPIO 0x4a00
-#define STM32F746_PE10_FUNC_TIM1_CH2N 0x4a02
-#define STM32F746_PE10_FUNC_UART7_CTS 0x4a09
-#define STM32F746_PE10_FUNC_QUADSPI_BK2_IO3 0x4a0b
-#define STM32F746_PE10_FUNC_FMC_D7 0x4a0d
-#define STM32F746_PE10_FUNC_EVENTOUT 0x4a10
-#define STM32F746_PE10_FUNC_ANALOG 0x4a11
-
-#define STM32F746_PE11_FUNC_GPIO 0x4b00
-#define STM32F746_PE11_FUNC_TIM1_CH2 0x4b02
-#define STM32F746_PE11_FUNC_SPI4_NSS 0x4b06
-#define STM32F746_PE11_FUNC_SAI2_SD_B 0x4b0b
-#define STM32F746_PE11_FUNC_FMC_D8 0x4b0d
-#define STM32F746_PE11_FUNC_LCD_G3 0x4b0f
-#define STM32F746_PE11_FUNC_EVENTOUT 0x4b10
-#define STM32F746_PE11_FUNC_ANALOG 0x4b11
-
-#define STM32F746_PE12_FUNC_GPIO 0x4c00
-#define STM32F746_PE12_FUNC_TIM1_CH3N 0x4c02
-#define STM32F746_PE12_FUNC_SPI4_SCK 0x4c06
-#define STM32F746_PE12_FUNC_SAI2_SCK_B 0x4c0b
-#define STM32F746_PE12_FUNC_FMC_D9 0x4c0d
-#define STM32F746_PE12_FUNC_LCD_B4 0x4c0f
-#define STM32F746_PE12_FUNC_EVENTOUT 0x4c10
-#define STM32F746_PE12_FUNC_ANALOG 0x4c11
-
-#define STM32F746_PE13_FUNC_GPIO 0x4d00
-#define STM32F746_PE13_FUNC_TIM1_CH3 0x4d02
-#define STM32F746_PE13_FUNC_SPI4_MISO 0x4d06
-#define STM32F746_PE13_FUNC_SAI2_FS_B 0x4d0b
-#define STM32F746_PE13_FUNC_FMC_D10 0x4d0d
-#define STM32F746_PE13_FUNC_LCD_DE 0x4d0f
-#define STM32F746_PE13_FUNC_EVENTOUT 0x4d10
-#define STM32F746_PE13_FUNC_ANALOG 0x4d11
-
-#define STM32F746_PE14_FUNC_GPIO 0x4e00
-#define STM32F746_PE14_FUNC_TIM1_CH4 0x4e02
-#define STM32F746_PE14_FUNC_SPI4_MOSI 0x4e06
-#define STM32F746_PE14_FUNC_SAI2_MCLK_B 0x4e0b
-#define STM32F746_PE14_FUNC_FMC_D11 0x4e0d
-#define STM32F746_PE14_FUNC_LCD_CLK 0x4e0f
-#define STM32F746_PE14_FUNC_EVENTOUT 0x4e10
-#define STM32F746_PE14_FUNC_ANALOG 0x4e11
-
-#define STM32F746_PE15_FUNC_GPIO 0x4f00
-#define STM32F746_PE15_FUNC_TIM1_BKIN 0x4f02
-#define STM32F746_PE15_FUNC_FMC_D12 0x4f0d
-#define STM32F746_PE15_FUNC_LCD_R7 0x4f0f
-#define STM32F746_PE15_FUNC_EVENTOUT 0x4f10
-#define STM32F746_PE15_FUNC_ANALOG 0x4f11
-
-
-#define STM32F746_PF0_FUNC_GPIO 0x5000
-#define STM32F746_PF0_FUNC_I2C2_SDA 0x5005
-#define STM32F746_PF0_FUNC_FMC_A0 0x500d
-#define STM32F746_PF0_FUNC_EVENTOUT 0x5010
-#define STM32F746_PF0_FUNC_ANALOG 0x5011
-
-#define STM32F746_PF1_FUNC_GPIO 0x5100
-#define STM32F746_PF1_FUNC_I2C2_SCL 0x5105
-#define STM32F746_PF1_FUNC_FMC_A1 0x510d
-#define STM32F746_PF1_FUNC_EVENTOUT 0x5110
-#define STM32F746_PF1_FUNC_ANALOG 0x5111
-
-#define STM32F746_PF2_FUNC_GPIO 0x5200
-#define STM32F746_PF2_FUNC_I2C2_SMBA 0x5205
-#define STM32F746_PF2_FUNC_FMC_A2 0x520d
-#define STM32F746_PF2_FUNC_EVENTOUT 0x5210
-#define STM32F746_PF2_FUNC_ANALOG 0x5211
-
-#define STM32F746_PF3_FUNC_GPIO 0x5300
-#define STM32F746_PF3_FUNC_FMC_A3 0x530d
-#define STM32F746_PF3_FUNC_EVENTOUT 0x5310
-#define STM32F746_PF3_FUNC_ANALOG 0x5311
-
-#define STM32F746_PF4_FUNC_GPIO 0x5400
-#define STM32F746_PF4_FUNC_FMC_A4 0x540d
-#define STM32F746_PF4_FUNC_EVENTOUT 0x5410
-#define STM32F746_PF4_FUNC_ANALOG 0x5411
-
-#define STM32F746_PF5_FUNC_GPIO 0x5500
-#define STM32F746_PF5_FUNC_FMC_A5 0x550d
-#define STM32F746_PF5_FUNC_EVENTOUT 0x5510
-#define STM32F746_PF5_FUNC_ANALOG 0x5511
-
-#define STM32F746_PF6_FUNC_GPIO 0x5600
-#define STM32F746_PF6_FUNC_TIM10_CH1 0x5604
-#define STM32F746_PF6_FUNC_SPI5_NSS 0x5606
-#define STM32F746_PF6_FUNC_SAI1_SD_B 0x5607
-#define STM32F746_PF6_FUNC_UART7_RX 0x5609
-#define STM32F746_PF6_FUNC_QUADSPI_BK1_IO3 0x560a
-#define STM32F746_PF6_FUNC_EVENTOUT 0x5610
-#define STM32F746_PF6_FUNC_ANALOG 0x5611
-
-#define STM32F746_PF7_FUNC_GPIO 0x5700
-#define STM32F746_PF7_FUNC_TIM11_CH1 0x5704
-#define STM32F746_PF7_FUNC_SPI5_SCK 0x5706
-#define STM32F746_PF7_FUNC_SAI1_MCLK_B 0x5707
-#define STM32F746_PF7_FUNC_UART7_TX 0x5709
-#define STM32F746_PF7_FUNC_QUADSPI_BK1_IO2 0x570a
-#define STM32F746_PF7_FUNC_EVENTOUT 0x5710
-#define STM32F746_PF7_FUNC_ANALOG 0x5711
-
-#define STM32F746_PF8_FUNC_GPIO 0x5800
-#define STM32F746_PF8_FUNC_SPI5_MISO 0x5806
-#define STM32F746_PF8_FUNC_SAI1_SCK_B 0x5807
-#define STM32F746_PF8_FUNC_UART7_RTS 0x5809
-#define STM32F746_PF8_FUNC_TIM13_CH1 0x580a
-#define STM32F746_PF8_FUNC_QUADSPI_BK1_IO0 0x580b
-#define STM32F746_PF8_FUNC_EVENTOUT 0x5810
-#define STM32F746_PF8_FUNC_ANALOG 0x5811
-
-#define STM32F746_PF9_FUNC_GPIO 0x5900
-#define STM32F746_PF9_FUNC_SPI5_MOSI 0x5906
-#define STM32F746_PF9_FUNC_SAI1_FS_B 0x5907
-#define STM32F746_PF9_FUNC_UART7_CTS 0x5909
-#define STM32F746_PF9_FUNC_TIM14_CH1 0x590a
-#define STM32F746_PF9_FUNC_QUADSPI_BK1_IO1 0x590b
-#define STM32F746_PF9_FUNC_EVENTOUT 0x5910
-#define STM32F746_PF9_FUNC_ANALOG 0x5911
-
-#define STM32F746_PF10_FUNC_GPIO 0x5a00
-#define STM32F746_PF10_FUNC_DCMI_D11 0x5a0e
-#define STM32F746_PF10_FUNC_LCD_DE 0x5a0f
-#define STM32F746_PF10_FUNC_EVENTOUT 0x5a10
-#define STM32F746_PF10_FUNC_ANALOG 0x5a11
-
-#define STM32F746_PF11_FUNC_GPIO 0x5b00
-#define STM32F746_PF11_FUNC_SPI5_MOSI 0x5b06
-#define STM32F746_PF11_FUNC_SAI2_SD_B 0x5b0b
-#define STM32F746_PF11_FUNC_FMC_SDNRAS 0x5b0d
-#define STM32F746_PF11_FUNC_DCMI_D12 0x5b0e
-#define STM32F746_PF11_FUNC_EVENTOUT 0x5b10
-#define STM32F746_PF11_FUNC_ANALOG 0x5b11
-
-#define STM32F746_PF12_FUNC_GPIO 0x5c00
-#define STM32F746_PF12_FUNC_FMC_A6 0x5c0d
-#define STM32F746_PF12_FUNC_EVENTOUT 0x5c10
-#define STM32F746_PF12_FUNC_ANALOG 0x5c11
-
-#define STM32F746_PF13_FUNC_GPIO 0x5d00
-#define STM32F746_PF13_FUNC_I2C4_SMBA 0x5d05
-#define STM32F746_PF13_FUNC_FMC_A7 0x5d0d
-#define STM32F746_PF13_FUNC_EVENTOUT 0x5d10
-#define STM32F746_PF13_FUNC_ANALOG 0x5d11
-
-#define STM32F746_PF14_FUNC_GPIO 0x5e00
-#define STM32F746_PF14_FUNC_I2C4_SCL 0x5e05
-#define STM32F746_PF14_FUNC_FMC_A8 0x5e0d
-#define STM32F746_PF14_FUNC_EVENTOUT 0x5e10
-#define STM32F746_PF14_FUNC_ANALOG 0x5e11
-
-#define STM32F746_PF15_FUNC_GPIO 0x5f00
-#define STM32F746_PF15_FUNC_I2C4_SDA 0x5f05
-#define STM32F746_PF15_FUNC_FMC_A9 0x5f0d
-#define STM32F746_PF15_FUNC_EVENTOUT 0x5f10
-#define STM32F746_PF15_FUNC_ANALOG 0x5f11
-
-
-#define STM32F746_PG0_FUNC_GPIO 0x6000
-#define STM32F746_PG0_FUNC_FMC_A10 0x600d
-#define STM32F746_PG0_FUNC_EVENTOUT 0x6010
-#define STM32F746_PG0_FUNC_ANALOG 0x6011
-
-#define STM32F746_PG1_FUNC_GPIO 0x6100
-#define STM32F746_PG1_FUNC_FMC_A11 0x610d
-#define STM32F746_PG1_FUNC_EVENTOUT 0x6110
-#define STM32F746_PG1_FUNC_ANALOG 0x6111
-
-#define STM32F746_PG2_FUNC_GPIO 0x6200
-#define STM32F746_PG2_FUNC_FMC_A12 0x620d
-#define STM32F746_PG2_FUNC_EVENTOUT 0x6210
-#define STM32F746_PG2_FUNC_ANALOG 0x6211
-
-#define STM32F746_PG3_FUNC_GPIO 0x6300
-#define STM32F746_PG3_FUNC_FMC_A13 0x630d
-#define STM32F746_PG3_FUNC_EVENTOUT 0x6310
-#define STM32F746_PG3_FUNC_ANALOG 0x6311
-
-#define STM32F746_PG4_FUNC_GPIO 0x6400
-#define STM32F746_PG4_FUNC_FMC_A14_FMC_BA0 0x640d
-#define STM32F746_PG4_FUNC_EVENTOUT 0x6410
-#define STM32F746_PG4_FUNC_ANALOG 0x6411
-
-#define STM32F746_PG5_FUNC_GPIO 0x6500
-#define STM32F746_PG5_FUNC_FMC_A15_FMC_BA1 0x650d
-#define STM32F746_PG5_FUNC_EVENTOUT 0x6510
-#define STM32F746_PG5_FUNC_ANALOG 0x6511
-
-#define STM32F746_PG6_FUNC_GPIO 0x6600
-#define STM32F746_PG6_FUNC_DCMI_D12 0x660e
-#define STM32F746_PG6_FUNC_LCD_R7 0x660f
-#define STM32F746_PG6_FUNC_EVENTOUT 0x6610
-#define STM32F746_PG6_FUNC_ANALOG 0x6611
-
-#define STM32F746_PG7_FUNC_GPIO 0x6700
-#define STM32F746_PG7_FUNC_USART6_CK 0x6709
-#define STM32F746_PG7_FUNC_FMC_INT 0x670d
-#define STM32F746_PG7_FUNC_DCMI_D13 0x670e
-#define STM32F746_PG7_FUNC_LCD_CLK 0x670f
-#define STM32F746_PG7_FUNC_EVENTOUT 0x6710
-#define STM32F746_PG7_FUNC_ANALOG 0x6711
-
-#define STM32F746_PG8_FUNC_GPIO 0x6800
-#define STM32F746_PG8_FUNC_SPI6_NSS 0x6806
-#define STM32F746_PG8_FUNC_SPDIFRX_IN2 0x6808
-#define STM32F746_PG8_FUNC_USART6_RTS 0x6809
-#define STM32F746_PG8_FUNC_ETH_PPS_OUT 0x680c
-#define STM32F746_PG8_FUNC_FMC_SDCLK 0x680d
-#define STM32F746_PG8_FUNC_EVENTOUT 0x6810
-#define STM32F746_PG8_FUNC_ANALOG 0x6811
-
-#define STM32F746_PG9_FUNC_GPIO 0x6900
-#define STM32F746_PG9_FUNC_SPDIFRX_IN3 0x6908
-#define STM32F746_PG9_FUNC_USART6_RX 0x6909
-#define STM32F746_PG9_FUNC_QUADSPI_BK2_IO2 0x690a
-#define STM32F746_PG9_FUNC_SAI2_FS_B 0x690b
-
-#define STM32F769_PG9_FUNC_SDMMC2_D0 0x690c
-
-#define STM32F746_PG9_FUNC_FMC_NE2_FMC_NCE 0x690d
-#define STM32F746_PG9_FUNC_DCMI_VSYNC 0x690e
-#define STM32F746_PG9_FUNC_EVENTOUT 0x6910
-#define STM32F746_PG9_FUNC_ANALOG 0x6911
-
-#define STM32F746_PG10_FUNC_GPIO 0x6a00
-#define STM32F746_PG10_FUNC_LCD_G3 0x6a0a
-#define STM32F746_PG10_FUNC_SAI2_SD_B 0x6a0b
-
-#define STM32F769_PG10_FUNC_SDMMC2_D1 0x6a0c
-
-#define STM32F746_PG10_FUNC_FMC_NE3 0x6a0d
-#define STM32F746_PG10_FUNC_DCMI_D2 0x6a0e
-#define STM32F746_PG10_FUNC_LCD_B2 0x6a0f
-#define STM32F746_PG10_FUNC_EVENTOUT 0x6a10
-#define STM32F746_PG10_FUNC_ANALOG 0x6a11
-
-#define STM32F746_PG11_FUNC_GPIO 0x6b00
-#define STM32F746_PG11_FUNC_SPDIFRX_IN0 0x6b08
-#define STM32F746_PG11_FUNC_ETH_MII_TX_EN_ETH_RMII_TX_EN 0x6b0c
-#define STM32F746_PG11_FUNC_DCMI_D3 0x6b0e
-#define STM32F746_PG11_FUNC_LCD_B3 0x6b0f
-#define STM32F746_PG11_FUNC_EVENTOUT 0x6b10
-#define STM32F746_PG11_FUNC_ANALOG 0x6b11
-
-#define STM32F746_PG12_FUNC_GPIO 0x6c00
-#define STM32F746_PG12_FUNC_LPTIM1_IN1 0x6c04
-#define STM32F746_PG12_FUNC_SPI6_MISO 0x6c06
-#define STM32F746_PG12_FUNC_SPDIFRX_IN1 0x6c08
-#define STM32F746_PG12_FUNC_USART6_RTS 0x6c09
-#define STM32F746_PG12_FUNC_LCD_B4 0x6c0a
-#define STM32F746_PG12_FUNC_FMC_NE4 0x6c0d
-#define STM32F746_PG12_FUNC_LCD_B1 0x6c0f
-#define STM32F746_PG12_FUNC_EVENTOUT 0x6c10
-#define STM32F746_PG12_FUNC_ANALOG 0x6c11
-
-#define STM32F746_PG13_FUNC_GPIO 0x6d00
-#define STM32F746_PG13_FUNC_TRACED0 0x6d01
-#define STM32F746_PG13_FUNC_LPTIM1_OUT 0x6d04
-#define STM32F746_PG13_FUNC_SPI6_SCK 0x6d06
-#define STM32F746_PG13_FUNC_USART6_CTS 0x6d09
-#define STM32F746_PG13_FUNC_ETH_MII_TXD0_ETH_RMII_TXD0 0x6d0c
-#define STM32F746_PG13_FUNC_FMC_A24 0x6d0d
-#define STM32F746_PG13_FUNC_LCD_R0 0x6d0f
-#define STM32F746_PG13_FUNC_EVENTOUT 0x6d10
-#define STM32F746_PG13_FUNC_ANALOG 0x6d11
-
-#define STM32F746_PG14_FUNC_GPIO 0x6e00
-#define STM32F746_PG14_FUNC_TRACED1 0x6e01
-#define STM32F746_PG14_FUNC_LPTIM1_ETR 0x6e04
-#define STM32F746_PG14_FUNC_SPI6_MOSI 0x6e06
-#define STM32F746_PG14_FUNC_USART6_TX 0x6e09
-#define STM32F746_PG14_FUNC_QUADSPI_BK2_IO3 0x6e0a
-#define STM32F746_PG14_FUNC_ETH_MII_TXD1_ETH_RMII_TXD1 0x6e0c
-#define STM32F746_PG14_FUNC_FMC_A25 0x6e0d
-#define STM32F746_PG14_FUNC_LCD_B0 0x6e0f
-#define STM32F746_PG14_FUNC_EVENTOUT 0x6e10
-#define STM32F746_PG14_FUNC_ANALOG 0x6e11
-
-#define STM32F746_PG15_FUNC_GPIO 0x6f00
-#define STM32F746_PG15_FUNC_USART6_CTS 0x6f09
-#define STM32F746_PG15_FUNC_FMC_SDNCAS 0x6f0d
-#define STM32F746_PG15_FUNC_DCMI_D13 0x6f0e
-#define STM32F746_PG15_FUNC_EVENTOUT 0x6f10
-#define STM32F746_PG15_FUNC_ANALOG 0x6f11
-
-
-#define STM32F746_PH0_FUNC_GPIO 0x7000
-#define STM32F746_PH0_FUNC_EVENTOUT 0x7010
-#define STM32F746_PH0_FUNC_ANALOG 0x7011
-
-#define STM32F746_PH1_FUNC_GPIO 0x7100
-#define STM32F746_PH1_FUNC_EVENTOUT 0x7110
-#define STM32F746_PH1_FUNC_ANALOG 0x7111
-
-#define STM32F746_PH2_FUNC_GPIO 0x7200
-#define STM32F746_PH2_FUNC_LPTIM1_IN2 0x7204
-#define STM32F746_PH2_FUNC_QUADSPI_BK2_IO0 0x720a
-#define STM32F746_PH2_FUNC_SAI2_SCK_B 0x720b
-#define STM32F746_PH2_FUNC_ETH_MII_CRS 0x720c
-#define STM32F746_PH2_FUNC_FMC_SDCKE0 0x720d
-#define STM32F746_PH2_FUNC_LCD_R0 0x720f
-#define STM32F746_PH2_FUNC_EVENTOUT 0x7210
-#define STM32F746_PH2_FUNC_ANALOG 0x7211
-
-#define STM32F746_PH3_FUNC_GPIO 0x7300
-#define STM32F746_PH3_FUNC_QUADSPI_BK2_IO1 0x730a
-#define STM32F746_PH3_FUNC_SAI2_MCLK_B 0x730b
-#define STM32F746_PH3_FUNC_ETH_MII_COL 0x730c
-#define STM32F746_PH3_FUNC_FMC_SDNE0 0x730d
-#define STM32F746_PH3_FUNC_LCD_R1 0x730f
-#define STM32F746_PH3_FUNC_EVENTOUT 0x7310
-#define STM32F746_PH3_FUNC_ANALOG 0x7311
-
-#define STM32F746_PH4_FUNC_GPIO 0x7400
-#define STM32F746_PH4_FUNC_I2C2_SCL 0x7405
-#define STM32F746_PH4_FUNC_OTG_HS_ULPI_NXT 0x740b
-#define STM32F746_PH4_FUNC_EVENTOUT 0x7410
-#define STM32F746_PH4_FUNC_ANALOG 0x7411
-
-#define STM32F746_PH5_FUNC_GPIO 0x7500
-#define STM32F746_PH5_FUNC_I2C2_SDA 0x7505
-#define STM32F746_PH5_FUNC_SPI5_NSS 0x7506
-#define STM32F746_PH5_FUNC_FMC_SDNWE 0x750d
-#define STM32F746_PH5_FUNC_EVENTOUT 0x7510
-#define STM32F746_PH5_FUNC_ANALOG 0x7511
-
-#define STM32F746_PH6_FUNC_GPIO 0x7600
-#define STM32F746_PH6_FUNC_I2C2_SMBA 0x7605
-#define STM32F746_PH6_FUNC_SPI5_SCK 0x7606
-#define STM32F746_PH6_FUNC_TIM12_CH1 0x760a
-#define STM32F746_PH6_FUNC_ETH_MII_RXD2 0x760c
-#define STM32F746_PH6_FUNC_FMC_SDNE1 0x760d
-#define STM32F746_PH6_FUNC_DCMI_D8 0x760e
-#define STM32F746_PH6_FUNC_EVENTOUT 0x7610
-#define STM32F746_PH6_FUNC_ANALOG 0x7611
-
-#define STM32F746_PH7_FUNC_GPIO 0x7700
-#define STM32F746_PH7_FUNC_I2C3_SCL 0x7705
-#define STM32F746_PH7_FUNC_SPI5_MISO 0x7706
-#define STM32F746_PH7_FUNC_ETH_MII_RXD3 0x770c
-#define STM32F746_PH7_FUNC_FMC_SDCKE1 0x770d
-#define STM32F746_PH7_FUNC_DCMI_D9 0x770e
-#define STM32F746_PH7_FUNC_EVENTOUT 0x7710
-#define STM32F746_PH7_FUNC_ANALOG 0x7711
-
-#define STM32F746_PH8_FUNC_GPIO 0x7800
-#define STM32F746_PH8_FUNC_I2C3_SDA 0x7805
-#define STM32F746_PH8_FUNC_FMC_D16 0x780d
-#define STM32F746_PH8_FUNC_DCMI_HSYNC 0x780e
-#define STM32F746_PH8_FUNC_LCD_R2 0x780f
-#define STM32F746_PH8_FUNC_EVENTOUT 0x7810
-#define STM32F746_PH8_FUNC_ANALOG 0x7811
-
-#define STM32F746_PH9_FUNC_GPIO 0x7900
-#define STM32F746_PH9_FUNC_I2C3_SMBA 0x7905
-#define STM32F746_PH9_FUNC_TIM12_CH2 0x790a
-#define STM32F746_PH9_FUNC_FMC_D17 0x790d
-#define STM32F746_PH9_FUNC_DCMI_D0 0x790e
-#define STM32F746_PH9_FUNC_LCD_R3 0x790f
-#define STM32F746_PH9_FUNC_EVENTOUT 0x7910
-#define STM32F746_PH9_FUNC_ANALOG 0x7911
-
-#define STM32F746_PH10_FUNC_GPIO 0x7a00
-#define STM32F746_PH10_FUNC_TIM5_CH1 0x7a03
-#define STM32F746_PH10_FUNC_I2C4_SMBA 0x7a05
-#define STM32F746_PH10_FUNC_FMC_D18 0x7a0d
-#define STM32F746_PH10_FUNC_DCMI_D1 0x7a0e
-#define STM32F746_PH10_FUNC_LCD_R4 0x7a0f
-#define STM32F746_PH10_FUNC_EVENTOUT 0x7a10
-#define STM32F746_PH10_FUNC_ANALOG 0x7a11
-
-#define STM32F746_PH11_FUNC_GPIO 0x7b00
-#define STM32F746_PH11_FUNC_TIM5_CH2 0x7b03
-#define STM32F746_PH11_FUNC_I2C4_SCL 0x7b05
-#define STM32F746_PH11_FUNC_FMC_D19 0x7b0d
-#define STM32F746_PH11_FUNC_DCMI_D2 0x7b0e
-#define STM32F746_PH11_FUNC_LCD_R5 0x7b0f
-#define STM32F746_PH11_FUNC_EVENTOUT 0x7b10
-#define STM32F746_PH11_FUNC_ANALOG 0x7b11
-
-#define STM32F746_PH12_FUNC_GPIO 0x7c00
-#define STM32F746_PH12_FUNC_TIM5_CH3 0x7c03
-#define STM32F746_PH12_FUNC_I2C4_SDA 0x7c05
-#define STM32F746_PH12_FUNC_FMC_D20 0x7c0d
-#define STM32F746_PH12_FUNC_DCMI_D3 0x7c0e
-#define STM32F746_PH12_FUNC_LCD_R6 0x7c0f
-#define STM32F746_PH12_FUNC_EVENTOUT 0x7c10
-#define STM32F746_PH12_FUNC_ANALOG 0x7c11
-
-#define STM32F746_PH13_FUNC_GPIO 0x7d00
-#define STM32F746_PH13_FUNC_TIM8_CH1N 0x7d04
-#define STM32F746_PH13_FUNC_CAN1_TX 0x7d0a
-#define STM32F746_PH13_FUNC_FMC_D21 0x7d0d
-#define STM32F746_PH13_FUNC_LCD_G2 0x7d0f
-#define STM32F746_PH13_FUNC_EVENTOUT 0x7d10
-#define STM32F746_PH13_FUNC_ANALOG 0x7d11
-
-#define STM32F746_PH14_FUNC_GPIO 0x7e00
-#define STM32F746_PH14_FUNC_TIM8_CH2N 0x7e04
-#define STM32F746_PH14_FUNC_FMC_D22 0x7e0d
-#define STM32F746_PH14_FUNC_DCMI_D4 0x7e0e
-#define STM32F746_PH14_FUNC_LCD_G3 0x7e0f
-#define STM32F746_PH14_FUNC_EVENTOUT 0x7e10
-#define STM32F746_PH14_FUNC_ANALOG 0x7e11
-
-#define STM32F746_PH15_FUNC_GPIO 0x7f00
-#define STM32F746_PH15_FUNC_TIM8_CH3N 0x7f04
-#define STM32F746_PH15_FUNC_FMC_D23 0x7f0d
-#define STM32F746_PH15_FUNC_DCMI_D11 0x7f0e
-#define STM32F746_PH15_FUNC_LCD_G4 0x7f0f
-#define STM32F746_PH15_FUNC_EVENTOUT 0x7f10
-#define STM32F746_PH15_FUNC_ANALOG 0x7f11
-
-
-#define STM32F746_PI0_FUNC_GPIO 0x8000
-#define STM32F746_PI0_FUNC_TIM5_CH4 0x8003
-#define STM32F746_PI0_FUNC_SPI2_NSS_I2S2_WS 0x8006
-#define STM32F746_PI0_FUNC_FMC_D24 0x800d
-#define STM32F746_PI0_FUNC_DCMI_D13 0x800e
-#define STM32F746_PI0_FUNC_LCD_G5 0x800f
-#define STM32F746_PI0_FUNC_EVENTOUT 0x8010
-#define STM32F746_PI0_FUNC_ANALOG 0x8011
-
-#define STM32F746_PI1_FUNC_GPIO 0x8100
-#define STM32F746_PI1_FUNC_TIM8_BKIN2 0x8104
-#define STM32F746_PI1_FUNC_SPI2_SCK_I2S2_CK 0x8106
-#define STM32F746_PI1_FUNC_FMC_D25 0x810d
-#define STM32F746_PI1_FUNC_DCMI_D8 0x810e
-#define STM32F746_PI1_FUNC_LCD_G6 0x810f
-#define STM32F746_PI1_FUNC_EVENTOUT 0x8110
-#define STM32F746_PI1_FUNC_ANALOG 0x8111
-
-#define STM32F746_PI2_FUNC_GPIO 0x8200
-#define STM32F746_PI2_FUNC_TIM8_CH4 0x8204
-#define STM32F746_PI2_FUNC_SPI2_MISO 0x8206
-#define STM32F746_PI2_FUNC_FMC_D26 0x820d
-#define STM32F746_PI2_FUNC_DCMI_D9 0x820e
-#define STM32F746_PI2_FUNC_LCD_G7 0x820f
-#define STM32F746_PI2_FUNC_EVENTOUT 0x8210
-#define STM32F746_PI2_FUNC_ANALOG 0x8211
-
-#define STM32F746_PI3_FUNC_GPIO 0x8300
-#define STM32F746_PI3_FUNC_TIM8_ETR 0x8304
-#define STM32F746_PI3_FUNC_SPI2_MOSI_I2S2_SD 0x8306
-#define STM32F746_PI3_FUNC_FMC_D27 0x830d
-#define STM32F746_PI3_FUNC_DCMI_D10 0x830e
-#define STM32F746_PI3_FUNC_EVENTOUT 0x8310
-#define STM32F746_PI3_FUNC_ANALOG 0x8311
-
-#define STM32F746_PI4_FUNC_GPIO 0x8400
-#define STM32F746_PI4_FUNC_TIM8_BKIN 0x8404
-#define STM32F746_PI4_FUNC_SAI2_MCLK_A 0x840b
-#define STM32F746_PI4_FUNC_FMC_NBL2 0x840d
-#define STM32F746_PI4_FUNC_DCMI_D5 0x840e
-#define STM32F746_PI4_FUNC_LCD_B4 0x840f
-#define STM32F746_PI4_FUNC_EVENTOUT 0x8410
-#define STM32F746_PI4_FUNC_ANALOG 0x8411
-
-#define STM32F746_PI5_FUNC_GPIO 0x8500
-#define STM32F746_PI5_FUNC_TIM8_CH1 0x8504
-#define STM32F746_PI5_FUNC_SAI2_SCK_A 0x850b
-#define STM32F746_PI5_FUNC_FMC_NBL3 0x850d
-#define STM32F746_PI5_FUNC_DCMI_VSYNC 0x850e
-#define STM32F746_PI5_FUNC_LCD_B5 0x850f
-#define STM32F746_PI5_FUNC_EVENTOUT 0x8510
-#define STM32F746_PI5_FUNC_ANALOG 0x8511
-
-#define STM32F746_PI6_FUNC_GPIO 0x8600
-#define STM32F746_PI6_FUNC_TIM8_CH2 0x8604
-#define STM32F746_PI6_FUNC_SAI2_SD_A 0x860b
-#define STM32F746_PI6_FUNC_FMC_D28 0x860d
-#define STM32F746_PI6_FUNC_DCMI_D6 0x860e
-#define STM32F746_PI6_FUNC_LCD_B6 0x860f
-#define STM32F746_PI6_FUNC_EVENTOUT 0x8610
-#define STM32F746_PI6_FUNC_ANALOG 0x8611
-
-#define STM32F746_PI7_FUNC_GPIO 0x8700
-#define STM32F746_PI7_FUNC_TIM8_CH3 0x8704
-#define STM32F746_PI7_FUNC_SAI2_FS_A 0x870b
-#define STM32F746_PI7_FUNC_FMC_D29 0x870d
-#define STM32F746_PI7_FUNC_DCMI_D7 0x870e
-#define STM32F746_PI7_FUNC_LCD_B7 0x870f
-#define STM32F746_PI7_FUNC_EVENTOUT 0x8710
-#define STM32F746_PI7_FUNC_ANALOG 0x8711
-
-#define STM32F746_PI8_FUNC_GPIO 0x8800
-#define STM32F746_PI8_FUNC_EVENTOUT 0x8810
-#define STM32F746_PI8_FUNC_ANALOG 0x8811
-
-#define STM32F746_PI9_FUNC_GPIO 0x8900
-#define STM32F746_PI9_FUNC_CAN1_RX 0x890a
-#define STM32F746_PI9_FUNC_FMC_D30 0x890d
-#define STM32F746_PI9_FUNC_LCD_VSYNC 0x890f
-#define STM32F746_PI9_FUNC_EVENTOUT 0x8910
-#define STM32F746_PI9_FUNC_ANALOG 0x8911
-
-#define STM32F746_PI10_FUNC_GPIO 0x8a00
-#define STM32F746_PI10_FUNC_ETH_MII_RX_ER 0x8a0c
-#define STM32F746_PI10_FUNC_FMC_D31 0x8a0d
-#define STM32F746_PI10_FUNC_LCD_HSYNC 0x8a0f
-#define STM32F746_PI10_FUNC_EVENTOUT 0x8a10
-#define STM32F746_PI10_FUNC_ANALOG 0x8a11
-
-#define STM32F746_PI11_FUNC_GPIO 0x8b00
-#define STM32F746_PI11_FUNC_OTG_HS_ULPI_DIR 0x8b0b
-#define STM32F746_PI11_FUNC_EVENTOUT 0x8b10
-#define STM32F746_PI11_FUNC_ANALOG 0x8b11
-
-#define STM32F746_PI12_FUNC_GPIO 0x8c00
-#define STM32F746_PI12_FUNC_LCD_HSYNC 0x8c0f
-#define STM32F746_PI12_FUNC_EVENTOUT 0x8c10
-#define STM32F746_PI12_FUNC_ANALOG 0x8c11
-
-#define STM32F746_PI13_FUNC_GPIO 0x8d00
-#define STM32F746_PI13_FUNC_LCD_VSYNC 0x8d0f
-#define STM32F746_PI13_FUNC_EVENTOUT 0x8d10
-#define STM32F746_PI13_FUNC_ANALOG 0x8d11
-
-#define STM32F746_PI14_FUNC_GPIO 0x8e00
-#define STM32F746_PI14_FUNC_LCD_CLK 0x8e0f
-#define STM32F746_PI14_FUNC_EVENTOUT 0x8e10
-#define STM32F746_PI14_FUNC_ANALOG 0x8e11
-
-#define STM32F746_PI15_FUNC_GPIO 0x8f00
-#define STM32F746_PI15_FUNC_LCD_R0 0x8f0f
-#define STM32F746_PI15_FUNC_EVENTOUT 0x8f10
-#define STM32F746_PI15_FUNC_ANALOG 0x8f11
-
-
-#define STM32F746_PJ0_FUNC_GPIO 0x9000
-#define STM32F746_PJ0_FUNC_LCD_R1 0x900f
-#define STM32F746_PJ0_FUNC_EVENTOUT 0x9010
-#define STM32F746_PJ0_FUNC_ANALOG 0x9011
-
-#define STM32F746_PJ1_FUNC_GPIO 0x9100
-#define STM32F746_PJ1_FUNC_LCD_R2 0x910f
-#define STM32F746_PJ1_FUNC_EVENTOUT 0x9110
-#define STM32F746_PJ1_FUNC_ANALOG 0x9111
-
-#define STM32F746_PJ2_FUNC_GPIO 0x9200
-#define STM32F746_PJ2_FUNC_LCD_R3 0x920f
-#define STM32F746_PJ2_FUNC_EVENTOUT 0x9210
-#define STM32F746_PJ2_FUNC_ANALOG 0x9211
-
-#define STM32F746_PJ3_FUNC_GPIO 0x9300
-#define STM32F746_PJ3_FUNC_LCD_R4 0x930f
-#define STM32F746_PJ3_FUNC_EVENTOUT 0x9310
-#define STM32F746_PJ3_FUNC_ANALOG 0x9311
-
-#define STM32F746_PJ4_FUNC_GPIO 0x9400
-#define STM32F746_PJ4_FUNC_LCD_R5 0x940f
-#define STM32F746_PJ4_FUNC_EVENTOUT 0x9410
-#define STM32F746_PJ4_FUNC_ANALOG 0x9411
-
-#define STM32F746_PJ5_FUNC_GPIO 0x9500
-#define STM32F746_PJ5_FUNC_LCD_R6 0x950f
-#define STM32F746_PJ5_FUNC_EVENTOUT 0x9510
-#define STM32F746_PJ5_FUNC_ANALOG 0x9511
-
-#define STM32F746_PJ6_FUNC_GPIO 0x9600
-#define STM32F746_PJ6_FUNC_LCD_R7 0x960f
-#define STM32F746_PJ6_FUNC_EVENTOUT 0x9610
-#define STM32F746_PJ6_FUNC_ANALOG 0x9611
-
-#define STM32F746_PJ7_FUNC_GPIO 0x9700
-#define STM32F746_PJ7_FUNC_LCD_G0 0x970f
-#define STM32F746_PJ7_FUNC_EVENTOUT 0x9710
-#define STM32F746_PJ7_FUNC_ANALOG 0x9711
-
-#define STM32F746_PJ8_FUNC_GPIO 0x9800
-#define STM32F746_PJ8_FUNC_LCD_G1 0x980f
-#define STM32F746_PJ8_FUNC_EVENTOUT 0x9810
-#define STM32F746_PJ8_FUNC_ANALOG 0x9811
-
-#define STM32F746_PJ9_FUNC_GPIO 0x9900
-#define STM32F746_PJ9_FUNC_LCD_G2 0x990f
-#define STM32F746_PJ9_FUNC_EVENTOUT 0x9910
-#define STM32F746_PJ9_FUNC_ANALOG 0x9911
-
-#define STM32F746_PJ10_FUNC_GPIO 0x9a00
-#define STM32F746_PJ10_FUNC_LCD_G3 0x9a0f
-#define STM32F746_PJ10_FUNC_EVENTOUT 0x9a10
-#define STM32F746_PJ10_FUNC_ANALOG 0x9a11
-
-#define STM32F746_PJ11_FUNC_GPIO 0x9b00
-#define STM32F746_PJ11_FUNC_LCD_G4 0x9b0f
-#define STM32F746_PJ11_FUNC_EVENTOUT 0x9b10
-#define STM32F746_PJ11_FUNC_ANALOG 0x9b11
-
-#define STM32F746_PJ12_FUNC_GPIO 0x9c00
-#define STM32F746_PJ12_FUNC_LCD_B0 0x9c0f
-#define STM32F746_PJ12_FUNC_EVENTOUT 0x9c10
-#define STM32F746_PJ12_FUNC_ANALOG 0x9c11
-
-#define STM32F746_PJ13_FUNC_GPIO 0x9d00
-#define STM32F746_PJ13_FUNC_LCD_B1 0x9d0f
-#define STM32F746_PJ13_FUNC_EVENTOUT 0x9d10
-#define STM32F746_PJ13_FUNC_ANALOG 0x9d11
-
-#define STM32F746_PJ14_FUNC_GPIO 0x9e00
-#define STM32F746_PJ14_FUNC_LCD_B2 0x9e0f
-#define STM32F746_PJ14_FUNC_EVENTOUT 0x9e10
-#define STM32F746_PJ14_FUNC_ANALOG 0x9e11
-
-#define STM32F746_PJ15_FUNC_GPIO 0x9f00
-#define STM32F746_PJ15_FUNC_LCD_B3 0x9f0f
-#define STM32F746_PJ15_FUNC_EVENTOUT 0x9f10
-#define STM32F746_PJ15_FUNC_ANALOG 0x9f11
-
-
-#define STM32F746_PK0_FUNC_GPIO 0xa000
-#define STM32F746_PK0_FUNC_LCD_G5 0xa00f
-#define STM32F746_PK0_FUNC_EVENTOUT 0xa010
-#define STM32F746_PK0_FUNC_ANALOG 0xa011
-
-#define STM32F746_PK1_FUNC_GPIO 0xa100
-#define STM32F746_PK1_FUNC_LCD_G6 0xa10f
-#define STM32F746_PK1_FUNC_EVENTOUT 0xa110
-#define STM32F746_PK1_FUNC_ANALOG 0xa111
-
-#define STM32F746_PK2_FUNC_GPIO 0xa200
-#define STM32F746_PK2_FUNC_LCD_G7 0xa20f
-#define STM32F746_PK2_FUNC_EVENTOUT 0xa210
-#define STM32F746_PK2_FUNC_ANALOG 0xa211
-
-#define STM32F746_PK3_FUNC_GPIO 0xa300
-#define STM32F746_PK3_FUNC_LCD_B4 0xa30f
-#define STM32F746_PK3_FUNC_EVENTOUT 0xa310
-#define STM32F746_PK3_FUNC_ANALOG 0xa311
-
-#define STM32F746_PK4_FUNC_GPIO 0xa400
-#define STM32F746_PK4_FUNC_LCD_B5 0xa40f
-#define STM32F746_PK4_FUNC_EVENTOUT 0xa410
-#define STM32F746_PK4_FUNC_ANALOG 0xa411
-
-#define STM32F746_PK5_FUNC_GPIO 0xa500
-#define STM32F746_PK5_FUNC_LCD_B6 0xa50f
-#define STM32F746_PK5_FUNC_EVENTOUT 0xa510
-#define STM32F746_PK5_FUNC_ANALOG 0xa511
-
-#define STM32F746_PK6_FUNC_GPIO 0xa600
-#define STM32F746_PK6_FUNC_LCD_B7 0xa60f
-#define STM32F746_PK6_FUNC_EVENTOUT 0xa610
-#define STM32F746_PK6_FUNC_ANALOG 0xa611
-
-#define STM32F746_PK7_FUNC_GPIO 0xa700
-#define STM32F746_PK7_FUNC_LCD_DE 0xa70f
-#define STM32F746_PK7_FUNC_EVENTOUT 0xa710
-#define STM32F746_PK7_FUNC_ANALOG 0xa711
-
-#endif /* _DT_BINDINGS_STM32F746_PINFUNC_H */
diff --git a/include/dt-bindings/pinctrl/stm32h7-pinfunc.h b/include/dt-bindings/pinctrl/stm32h7-pinfunc.h
deleted file mode 100644 (file)
index cb673b5..0000000
+++ /dev/null
@@ -1,1612 +0,0 @@
-#ifndef _DT_BINDINGS_STM32H7_PINFUNC_H
-#define _DT_BINDINGS_STM32H7_PINFUNC_H
-
-#define STM32H7_PA0_FUNC_GPIO 0x0
-#define STM32H7_PA0_FUNC_TIM2_CH1_TIM2_ETR 0x2
-#define STM32H7_PA0_FUNC_TIM5_CH1 0x3
-#define STM32H7_PA0_FUNC_TIM8_ETR 0x4
-#define STM32H7_PA0_FUNC_TIM15_BKIN 0x5
-#define STM32H7_PA0_FUNC_USART2_CTS_NSS 0x8
-#define STM32H7_PA0_FUNC_UART4_TX 0x9
-#define STM32H7_PA0_FUNC_SDMMC2_CMD 0xa
-#define STM32H7_PA0_FUNC_SAI2_SD_B 0xb
-#define STM32H7_PA0_FUNC_ETH_MII_CRS 0xc
-#define STM32H7_PA0_FUNC_EVENTOUT 0x10
-#define STM32H7_PA0_FUNC_ANALOG 0x11
-
-#define STM32H7_PA1_FUNC_GPIO 0x100
-#define STM32H7_PA1_FUNC_TIM2_CH2 0x102
-#define STM32H7_PA1_FUNC_TIM5_CH2 0x103
-#define STM32H7_PA1_FUNC_LPTIM3_OUT 0x104
-#define STM32H7_PA1_FUNC_TIM15_CH1N 0x105
-#define STM32H7_PA1_FUNC_USART2_RTS 0x108
-#define STM32H7_PA1_FUNC_UART4_RX 0x109
-#define STM32H7_PA1_FUNC_QUADSPI_BK1_IO3 0x10a
-#define STM32H7_PA1_FUNC_SAI2_MCK_B 0x10b
-#define STM32H7_PA1_FUNC_ETH_MII_RX_CLK_ETH_RMII_REF_CLK 0x10c
-#define STM32H7_PA1_FUNC_LCD_R2 0x10f
-#define STM32H7_PA1_FUNC_EVENTOUT 0x110
-#define STM32H7_PA1_FUNC_ANALOG 0x111
-
-#define STM32H7_PA2_FUNC_GPIO 0x200
-#define STM32H7_PA2_FUNC_TIM2_CH3 0x202
-#define STM32H7_PA2_FUNC_TIM5_CH3 0x203
-#define STM32H7_PA2_FUNC_LPTIM4_OUT 0x204
-#define STM32H7_PA2_FUNC_TIM15_CH1 0x205
-#define STM32H7_PA2_FUNC_USART2_TX 0x208
-#define STM32H7_PA2_FUNC_SAI2_SCK_B 0x209
-#define STM32H7_PA2_FUNC_ETH_MDIO 0x20c
-#define STM32H7_PA2_FUNC_MDIOS_MDIO 0x20d
-#define STM32H7_PA2_FUNC_LCD_R1 0x20f
-#define STM32H7_PA2_FUNC_EVENTOUT 0x210
-#define STM32H7_PA2_FUNC_ANALOG 0x211
-
-#define STM32H7_PA3_FUNC_GPIO 0x300
-#define STM32H7_PA3_FUNC_TIM2_CH4 0x302
-#define STM32H7_PA3_FUNC_TIM5_CH4 0x303
-#define STM32H7_PA3_FUNC_LPTIM5_OUT 0x304
-#define STM32H7_PA3_FUNC_TIM15_CH2 0x305
-#define STM32H7_PA3_FUNC_USART2_RX 0x308
-#define STM32H7_PA3_FUNC_LCD_B2 0x30a
-#define STM32H7_PA3_FUNC_OTG_HS_ULPI_D0 0x30b
-#define STM32H7_PA3_FUNC_ETH_MII_COL 0x30c
-#define STM32H7_PA3_FUNC_LCD_B5 0x30f
-#define STM32H7_PA3_FUNC_EVENTOUT 0x310
-#define STM32H7_PA3_FUNC_ANALOG 0x311
-
-#define STM32H7_PA4_FUNC_GPIO 0x400
-#define STM32H7_PA4_FUNC_TIM5_ETR 0x403
-#define STM32H7_PA4_FUNC_SPI1_NSS_I2S1_WS 0x406
-#define STM32H7_PA4_FUNC_SPI3_NSS_I2S3_WS 0x407
-#define STM32H7_PA4_FUNC_USART2_CK 0x408
-#define STM32H7_PA4_FUNC_SPI6_NSS 0x409
-#define STM32H7_PA4_FUNC_OTG_HS_SOF 0x40d
-#define STM32H7_PA4_FUNC_DCMI_HSYNC 0x40e
-#define STM32H7_PA4_FUNC_LCD_VSYNC 0x40f
-#define STM32H7_PA4_FUNC_EVENTOUT 0x410
-#define STM32H7_PA4_FUNC_ANALOG 0x411
-
-#define STM32H7_PA5_FUNC_GPIO 0x500
-#define STM32H7_PA5_FUNC_TIM2_CH1_TIM2_ETR 0x502
-#define STM32H7_PA5_FUNC_TIM8_CH1N 0x504
-#define STM32H7_PA5_FUNC_SPI1_SCK_I2S1_CK 0x506
-#define STM32H7_PA5_FUNC_SPI6_SCK 0x509
-#define STM32H7_PA5_FUNC_OTG_HS_ULPI_CK 0x50b
-#define STM32H7_PA5_FUNC_LCD_R4 0x50f
-#define STM32H7_PA5_FUNC_EVENTOUT 0x510
-#define STM32H7_PA5_FUNC_ANALOG 0x511
-
-#define STM32H7_PA6_FUNC_GPIO 0x600
-#define STM32H7_PA6_FUNC_TIM1_BKIN 0x602
-#define STM32H7_PA6_FUNC_TIM3_CH1 0x603
-#define STM32H7_PA6_FUNC_TIM8_BKIN 0x604
-#define STM32H7_PA6_FUNC_SPI1_MISO_I2S1_SDI 0x606
-#define STM32H7_PA6_FUNC_SPI6_MISO 0x609
-#define STM32H7_PA6_FUNC_TIM13_CH1 0x60a
-#define STM32H7_PA6_FUNC_TIM8_BKIN_COMP12 0x60b
-#define STM32H7_PA6_FUNC_MDIOS_MDC 0x60c
-#define STM32H7_PA6_FUNC_TIM1_BKIN_COMP12 0x60d
-#define STM32H7_PA6_FUNC_DCMI_PIXCLK 0x60e
-#define STM32H7_PA6_FUNC_LCD_G2 0x60f
-#define STM32H7_PA6_FUNC_EVENTOUT 0x610
-#define STM32H7_PA6_FUNC_ANALOG 0x611
-
-#define STM32H7_PA7_FUNC_GPIO 0x700
-#define STM32H7_PA7_FUNC_TIM1_CH1N 0x702
-#define STM32H7_PA7_FUNC_TIM3_CH2 0x703
-#define STM32H7_PA7_FUNC_TIM8_CH1N 0x704
-#define STM32H7_PA7_FUNC_SPI1_MOSI_I2S1_SDO 0x706
-#define STM32H7_PA7_FUNC_SPI6_MOSI 0x709
-#define STM32H7_PA7_FUNC_TIM14_CH1 0x70a
-#define STM32H7_PA7_FUNC_ETH_MII_RX_DV_ETH_RMII_CRS_DV 0x70c
-#define STM32H7_PA7_FUNC_FMC_SDNWE 0x70d
-#define STM32H7_PA7_FUNC_EVENTOUT 0x710
-#define STM32H7_PA7_FUNC_ANALOG 0x711
-
-#define STM32H7_PA8_FUNC_GPIO 0x800
-#define STM32H7_PA8_FUNC_MCO1 0x801
-#define STM32H7_PA8_FUNC_TIM1_CH1 0x802
-#define STM32H7_PA8_FUNC_HRTIM_CHB2 0x803
-#define STM32H7_PA8_FUNC_TIM8_BKIN2 0x804
-#define STM32H7_PA8_FUNC_I2C3_SCL 0x805
-#define STM32H7_PA8_FUNC_USART1_CK 0x808
-#define STM32H7_PA8_FUNC_OTG_FS_SOF 0x80b
-#define STM32H7_PA8_FUNC_UART7_RX 0x80c
-#define STM32H7_PA8_FUNC_TIM8_BKIN2_COMP12 0x80d
-#define STM32H7_PA8_FUNC_LCD_B3 0x80e
-#define STM32H7_PA8_FUNC_LCD_R6 0x80f
-#define STM32H7_PA8_FUNC_EVENTOUT 0x810
-#define STM32H7_PA8_FUNC_ANALOG 0x811
-
-#define STM32H7_PA9_FUNC_GPIO 0x900
-#define STM32H7_PA9_FUNC_TIM1_CH2 0x902
-#define STM32H7_PA9_FUNC_HRTIM_CHC1 0x903
-#define STM32H7_PA9_FUNC_LPUART1_TX 0x904
-#define STM32H7_PA9_FUNC_I2C3_SMBA 0x905
-#define STM32H7_PA9_FUNC_SPI2_SCK_I2S2_CK 0x906
-#define STM32H7_PA9_FUNC_USART1_TX 0x908
-#define STM32H7_PA9_FUNC_CAN1_RXFD 0x90a
-#define STM32H7_PA9_FUNC_ETH_TX_ER 0x90c
-#define STM32H7_PA9_FUNC_DCMI_D0 0x90e
-#define STM32H7_PA9_FUNC_LCD_R5 0x90f
-#define STM32H7_PA9_FUNC_EVENTOUT 0x910
-#define STM32H7_PA9_FUNC_ANALOG 0x911
-
-#define STM32H7_PA10_FUNC_GPIO 0xa00
-#define STM32H7_PA10_FUNC_TIM1_CH3 0xa02
-#define STM32H7_PA10_FUNC_HRTIM_CHC2 0xa03
-#define STM32H7_PA10_FUNC_LPUART1_RX 0xa04
-#define STM32H7_PA10_FUNC_USART1_RX 0xa08
-#define STM32H7_PA10_FUNC_CAN1_TXFD 0xa0a
-#define STM32H7_PA10_FUNC_OTG_FS_ID 0xa0b
-#define STM32H7_PA10_FUNC_MDIOS_MDIO 0xa0c
-#define STM32H7_PA10_FUNC_LCD_B4 0xa0d
-#define STM32H7_PA10_FUNC_DCMI_D1 0xa0e
-#define STM32H7_PA10_FUNC_LCD_B1 0xa0f
-#define STM32H7_PA10_FUNC_EVENTOUT 0xa10
-#define STM32H7_PA10_FUNC_ANALOG 0xa11
-
-#define STM32H7_PA11_FUNC_GPIO 0xb00
-#define STM32H7_PA11_FUNC_TIM1_CH4 0xb02
-#define STM32H7_PA11_FUNC_HRTIM_CHD1 0xb03
-#define STM32H7_PA11_FUNC_LPUART1_CTS 0xb04
-#define STM32H7_PA11_FUNC_SPI2_NSS_I2S2_WS 0xb06
-#define STM32H7_PA11_FUNC_UART4_RX 0xb07
-#define STM32H7_PA11_FUNC_USART1_CTS_NSS 0xb08
-#define STM32H7_PA11_FUNC_CAN1_RX 0xb0a
-#define STM32H7_PA11_FUNC_OTG_FS_DM 0xb0b
-#define STM32H7_PA11_FUNC_LCD_R4 0xb0f
-#define STM32H7_PA11_FUNC_EVENTOUT 0xb10
-#define STM32H7_PA11_FUNC_ANALOG 0xb11
-
-#define STM32H7_PA12_FUNC_GPIO 0xc00
-#define STM32H7_PA12_FUNC_TIM1_ETR 0xc02
-#define STM32H7_PA12_FUNC_HRTIM_CHD2 0xc03
-#define STM32H7_PA12_FUNC_LPUART1_RTS 0xc04
-#define STM32H7_PA12_FUNC_SPI2_SCK_I2S2_CK 0xc06
-#define STM32H7_PA12_FUNC_UART4_TX 0xc07
-#define STM32H7_PA12_FUNC_USART1_RTS 0xc08
-#define STM32H7_PA12_FUNC_SAI2_FS_B 0xc09
-#define STM32H7_PA12_FUNC_CAN1_TX 0xc0a
-#define STM32H7_PA12_FUNC_OTG_FS_DP 0xc0b
-#define STM32H7_PA12_FUNC_LCD_R5 0xc0f
-#define STM32H7_PA12_FUNC_EVENTOUT 0xc10
-#define STM32H7_PA12_FUNC_ANALOG 0xc11
-
-#define STM32H7_PA13_FUNC_GPIO 0xd00
-#define STM32H7_PA13_FUNC_JTMS_SWDIO 0xd01
-#define STM32H7_PA13_FUNC_EVENTOUT 0xd10
-#define STM32H7_PA13_FUNC_ANALOG 0xd11
-
-#define STM32H7_PA14_FUNC_GPIO 0xe00
-#define STM32H7_PA14_FUNC_JTCK_SWCLK 0xe01
-#define STM32H7_PA14_FUNC_EVENTOUT 0xe10
-#define STM32H7_PA14_FUNC_ANALOG 0xe11
-
-#define STM32H7_PA15_FUNC_GPIO 0xf00
-#define STM32H7_PA15_FUNC_JTDI 0xf01
-#define STM32H7_PA15_FUNC_TIM2_CH1_TIM2_ETR 0xf02
-#define STM32H7_PA15_FUNC_HRTIM_FLT1 0xf03
-#define STM32H7_PA15_FUNC_HDMI_CEC 0xf05
-#define STM32H7_PA15_FUNC_SPI1_NSS_I2S1_WS 0xf06
-#define STM32H7_PA15_FUNC_SPI3_NSS_I2S3_WS 0xf07
-#define STM32H7_PA15_FUNC_SPI6_NSS 0xf08
-#define STM32H7_PA15_FUNC_UART4_RTS 0xf09
-#define STM32H7_PA15_FUNC_UART7_TX 0xf0c
-#define STM32H7_PA15_FUNC_DSI_TE 0xf0e
-#define STM32H7_PA15_FUNC_EVENTOUT 0xf10
-#define STM32H7_PA15_FUNC_ANALOG 0xf11
-
-#define STM32H7_PB0_FUNC_GPIO 0x1000
-#define STM32H7_PB0_FUNC_TIM1_CH2N 0x1002
-#define STM32H7_PB0_FUNC_TIM3_CH3 0x1003
-#define STM32H7_PB0_FUNC_TIM8_CH2N 0x1004
-#define STM32H7_PB0_FUNC_DFSDM_CKOUT 0x1007
-#define STM32H7_PB0_FUNC_UART4_CTS 0x1009
-#define STM32H7_PB0_FUNC_LCD_R3 0x100a
-#define STM32H7_PB0_FUNC_OTG_HS_ULPI_D1 0x100b
-#define STM32H7_PB0_FUNC_ETH_MII_RXD2 0x100c
-#define STM32H7_PB0_FUNC_LCD_G1 0x100f
-#define STM32H7_PB0_FUNC_EVENTOUT 0x1010
-#define STM32H7_PB0_FUNC_ANALOG 0x1011
-
-#define STM32H7_PB1_FUNC_GPIO 0x1100
-#define STM32H7_PB1_FUNC_TIM1_CH3N 0x1102
-#define STM32H7_PB1_FUNC_TIM3_CH4 0x1103
-#define STM32H7_PB1_FUNC_TIM8_CH3N 0x1104
-#define STM32H7_PB1_FUNC_DFSDM_DATIN1 0x1107
-#define STM32H7_PB1_FUNC_LCD_R6 0x110a
-#define STM32H7_PB1_FUNC_OTG_HS_ULPI_D2 0x110b
-#define STM32H7_PB1_FUNC_ETH_MII_RXD3 0x110c
-#define STM32H7_PB1_FUNC_LCD_G0 0x110f
-#define STM32H7_PB1_FUNC_EVENTOUT 0x1110
-#define STM32H7_PB1_FUNC_ANALOG 0x1111
-
-#define STM32H7_PB2_FUNC_GPIO 0x1200
-#define STM32H7_PB2_FUNC_SAI1_D1 0x1203
-#define STM32H7_PB2_FUNC_DFSDM_CKIN1 0x1205
-#define STM32H7_PB2_FUNC_SAI1_SD_A 0x1207
-#define STM32H7_PB2_FUNC_SPI3_MOSI_I2S3_SDO 0x1208
-#define STM32H7_PB2_FUNC_SAI4_SD_A 0x1209
-#define STM32H7_PB2_FUNC_QUADSPI_CLK 0x120a
-#define STM32H7_PB2_FUNC_SAI4_D1 0x120b
-#define STM32H7_PB2_FUNC_ETH_TX_ER 0x120c
-#define STM32H7_PB2_FUNC_EVENTOUT 0x1210
-#define STM32H7_PB2_FUNC_ANALOG 0x1211
-
-#define STM32H7_PB3_FUNC_GPIO 0x1300
-#define STM32H7_PB3_FUNC_JTDO_TRACESWO 0x1301
-#define STM32H7_PB3_FUNC_TIM2_CH2 0x1302
-#define STM32H7_PB3_FUNC_HRTIM_FLT4 0x1303
-#define STM32H7_PB3_FUNC_SPI1_SCK_I2S1_CK 0x1306
-#define STM32H7_PB3_FUNC_SPI3_SCK_I2S3_CK 0x1307
-#define STM32H7_PB3_FUNC_SPI6_SCK 0x1309
-#define STM32H7_PB3_FUNC_SDMMC2_D2 0x130a
-#define STM32H7_PB3_FUNC_UART7_RX 0x130c
-#define STM32H7_PB3_FUNC_EVENTOUT 0x1310
-#define STM32H7_PB3_FUNC_ANALOG 0x1311
-
-#define STM32H7_PB4_FUNC_GPIO 0x1400
-#define STM32H7_PB4_FUNC_NJTRST 0x1401
-#define STM32H7_PB4_FUNC_TIM16_BKIN 0x1402
-#define STM32H7_PB4_FUNC_TIM3_CH1 0x1403
-#define STM32H7_PB4_FUNC_HRTIM_EEV6 0x1404
-#define STM32H7_PB4_FUNC_SPI1_MISO_I2S1_SDI 0x1406
-#define STM32H7_PB4_FUNC_SPI3_MISO_I2S3_SDI 0x1407
-#define STM32H7_PB4_FUNC_SPI2_NSS_I2S2_WS 0x1408
-#define STM32H7_PB4_FUNC_SPI6_MISO 0x1409
-#define STM32H7_PB4_FUNC_SDMMC2_D3 0x140a
-#define STM32H7_PB4_FUNC_UART7_TX 0x140c
-#define STM32H7_PB4_FUNC_EVENTOUT 0x1410
-#define STM32H7_PB4_FUNC_ANALOG 0x1411
-
-#define STM32H7_PB5_FUNC_GPIO 0x1500
-#define STM32H7_PB5_FUNC_TIM17_BKIN 0x1502
-#define STM32H7_PB5_FUNC_TIM3_CH2 0x1503
-#define STM32H7_PB5_FUNC_HRTIM_EEV7 0x1504
-#define STM32H7_PB5_FUNC_I2C1_SMBA 0x1505
-#define STM32H7_PB5_FUNC_SPI1_MOSI_I2S1_SDO 0x1506
-#define STM32H7_PB5_FUNC_I2C4_SMBA 0x1507
-#define STM32H7_PB5_FUNC_SPI3_MOSI_I2S3_SDO 0x1508
-#define STM32H7_PB5_FUNC_SPI6_MOSI 0x1509
-#define STM32H7_PB5_FUNC_CAN2_RX 0x150a
-#define STM32H7_PB5_FUNC_OTG_HS_ULPI_D7 0x150b
-#define STM32H7_PB5_FUNC_ETH_PPS_OUT 0x150c
-#define STM32H7_PB5_FUNC_FMC_SDCKE1 0x150d
-#define STM32H7_PB5_FUNC_DCMI_D10 0x150e
-#define STM32H7_PB5_FUNC_UART5_RX 0x150f
-#define STM32H7_PB5_FUNC_EVENTOUT 0x1510
-#define STM32H7_PB5_FUNC_ANALOG 0x1511
-
-#define STM32H7_PB6_FUNC_GPIO 0x1600
-#define STM32H7_PB6_FUNC_TIM16_CH1N 0x1602
-#define STM32H7_PB6_FUNC_TIM4_CH1 0x1603
-#define STM32H7_PB6_FUNC_HRTIM_EEV8 0x1604
-#define STM32H7_PB6_FUNC_I2C1_SCL 0x1605
-#define STM32H7_PB6_FUNC_HDMI_CEC 0x1606
-#define STM32H7_PB6_FUNC_I2C4_SCL 0x1607
-#define STM32H7_PB6_FUNC_USART1_TX 0x1608
-#define STM32H7_PB6_FUNC_LPUART1_TX 0x1609
-#define STM32H7_PB6_FUNC_CAN2_TX 0x160a
-#define STM32H7_PB6_FUNC_QUADSPI_BK1_NCS 0x160b
-#define STM32H7_PB6_FUNC_DFSDM_DATIN5 0x160c
-#define STM32H7_PB6_FUNC_FMC_SDNE1 0x160d
-#define STM32H7_PB6_FUNC_DCMI_D5 0x160e
-#define STM32H7_PB6_FUNC_UART5_TX 0x160f
-#define STM32H7_PB6_FUNC_EVENTOUT 0x1610
-#define STM32H7_PB6_FUNC_ANALOG 0x1611
-
-#define STM32H7_PB7_FUNC_GPIO 0x1700
-#define STM32H7_PB7_FUNC_TIM17_CH1N 0x1702
-#define STM32H7_PB7_FUNC_TIM4_CH2 0x1703
-#define STM32H7_PB7_FUNC_HRTIM_EEV9 0x1704
-#define STM32H7_PB7_FUNC_I2C1_SDA 0x1705
-#define STM32H7_PB7_FUNC_I2C4_SDA 0x1707
-#define STM32H7_PB7_FUNC_USART1_RX 0x1708
-#define STM32H7_PB7_FUNC_LPUART1_RX 0x1709
-#define STM32H7_PB7_FUNC_CAN2_TXFD 0x170a
-#define STM32H7_PB7_FUNC_DFSDM_CKIN5 0x170c
-#define STM32H7_PB7_FUNC_FMC_NL 0x170d
-#define STM32H7_PB7_FUNC_DCMI_VSYNC 0x170e
-#define STM32H7_PB7_FUNC_EVENTOUT 0x1710
-#define STM32H7_PB7_FUNC_ANALOG 0x1711
-
-#define STM32H7_PB8_FUNC_GPIO 0x1800
-#define STM32H7_PB8_FUNC_TIM16_CH1 0x1802
-#define STM32H7_PB8_FUNC_TIM4_CH3 0x1803
-#define STM32H7_PB8_FUNC_DFSDM_CKIN7 0x1804
-#define STM32H7_PB8_FUNC_I2C1_SCL 0x1805
-#define STM32H7_PB8_FUNC_I2C4_SCL 0x1807
-#define STM32H7_PB8_FUNC_SDMMC1_CKIN 0x1808
-#define STM32H7_PB8_FUNC_UART4_RX 0x1809
-#define STM32H7_PB8_FUNC_CAN1_RX 0x180a
-#define STM32H7_PB8_FUNC_SDMMC2_D4 0x180b
-#define STM32H7_PB8_FUNC_ETH_MII_TXD3 0x180c
-#define STM32H7_PB8_FUNC_SDMMC1_D4 0x180d
-#define STM32H7_PB8_FUNC_DCMI_D6 0x180e
-#define STM32H7_PB8_FUNC_LCD_B6 0x180f
-#define STM32H7_PB8_FUNC_EVENTOUT 0x1810
-#define STM32H7_PB8_FUNC_ANALOG 0x1811
-
-#define STM32H7_PB9_FUNC_GPIO 0x1900
-#define STM32H7_PB9_FUNC_TIM17_CH1 0x1902
-#define STM32H7_PB9_FUNC_TIM4_CH4 0x1903
-#define STM32H7_PB9_FUNC_DFSDM_DATIN7 0x1904
-#define STM32H7_PB9_FUNC_I2C1_SDA 0x1905
-#define STM32H7_PB9_FUNC_SPI2_NSS_I2S2_WS 0x1906
-#define STM32H7_PB9_FUNC_I2C4_SDA 0x1907
-#define STM32H7_PB9_FUNC_SDMMC1_CDIR 0x1908
-#define STM32H7_PB9_FUNC_UART4_TX 0x1909
-#define STM32H7_PB9_FUNC_CAN1_TX 0x190a
-#define STM32H7_PB9_FUNC_SDMMC2_D5 0x190b
-#define STM32H7_PB9_FUNC_I2C4_SMBA 0x190c
-#define STM32H7_PB9_FUNC_SDMMC1_D5 0x190d
-#define STM32H7_PB9_FUNC_DCMI_D7 0x190e
-#define STM32H7_PB9_FUNC_LCD_B7 0x190f
-#define STM32H7_PB9_FUNC_EVENTOUT 0x1910
-#define STM32H7_PB9_FUNC_ANALOG 0x1911
-
-#define STM32H7_PB10_FUNC_GPIO 0x1a00
-#define STM32H7_PB10_FUNC_TIM2_CH3 0x1a02
-#define STM32H7_PB10_FUNC_HRTIM_SCOUT 0x1a03
-#define STM32H7_PB10_FUNC_LPTIM2_IN1 0x1a04
-#define STM32H7_PB10_FUNC_I2C2_SCL 0x1a05
-#define STM32H7_PB10_FUNC_SPI2_SCK_I2S2_CK 0x1a06
-#define STM32H7_PB10_FUNC_DFSDM_DATIN7 0x1a07
-#define STM32H7_PB10_FUNC_USART3_TX 0x1a08
-#define STM32H7_PB10_FUNC_QUADSPI_BK1_NCS 0x1a0a
-#define STM32H7_PB10_FUNC_OTG_HS_ULPI_D3 0x1a0b
-#define STM32H7_PB10_FUNC_ETH_MII_RX_ER 0x1a0c
-#define STM32H7_PB10_FUNC_LCD_G4 0x1a0f
-#define STM32H7_PB10_FUNC_EVENTOUT 0x1a10
-#define STM32H7_PB10_FUNC_ANALOG 0x1a11
-
-#define STM32H7_PB11_FUNC_GPIO 0x1b00
-#define STM32H7_PB11_FUNC_TIM2_CH4 0x1b02
-#define STM32H7_PB11_FUNC_HRTIM_SCIN 0x1b03
-#define STM32H7_PB11_FUNC_LPTIM2_ETR 0x1b04
-#define STM32H7_PB11_FUNC_I2C2_SDA 0x1b05
-#define STM32H7_PB11_FUNC_DFSDM_CKIN7 0x1b07
-#define STM32H7_PB11_FUNC_USART3_RX 0x1b08
-#define STM32H7_PB11_FUNC_OTG_HS_ULPI_D4 0x1b0b
-#define STM32H7_PB11_FUNC_ETH_MII_TX_EN_ETH_RMII_TX_EN 0x1b0c
-#define STM32H7_PB11_FUNC_DSI_TE 0x1b0e
-#define STM32H7_PB11_FUNC_LCD_G5 0x1b0f
-#define STM32H7_PB11_FUNC_EVENTOUT 0x1b10
-#define STM32H7_PB11_FUNC_ANALOG 0x1b11
-
-#define STM32H7_PB12_FUNC_GPIO 0x1c00
-#define STM32H7_PB12_FUNC_TIM1_BKIN 0x1c02
-#define STM32H7_PB12_FUNC_I2C2_SMBA 0x1c05
-#define STM32H7_PB12_FUNC_SPI2_NSS_I2S2_WS 0x1c06
-#define STM32H7_PB12_FUNC_DFSDM_DATIN1 0x1c07
-#define STM32H7_PB12_FUNC_USART3_CK 0x1c08
-#define STM32H7_PB12_FUNC_CAN2_RX 0x1c0a
-#define STM32H7_PB12_FUNC_OTG_HS_ULPI_D5 0x1c0b
-#define STM32H7_PB12_FUNC_ETH_MII_TXD0_ETH_RMII_TXD0 0x1c0c
-#define STM32H7_PB12_FUNC_OTG_HS_ID 0x1c0d
-#define STM32H7_PB12_FUNC_TIM1_BKIN_COMP12 0x1c0e
-#define STM32H7_PB12_FUNC_UART5_RX 0x1c0f
-#define STM32H7_PB12_FUNC_EVENTOUT 0x1c10
-#define STM32H7_PB12_FUNC_ANALOG 0x1c11
-
-#define STM32H7_PB13_FUNC_GPIO 0x1d00
-#define STM32H7_PB13_FUNC_TIM1_CH1N 0x1d02
-#define STM32H7_PB13_FUNC_LPTIM2_OUT 0x1d04
-#define STM32H7_PB13_FUNC_SPI2_SCK_I2S2_CK 0x1d06
-#define STM32H7_PB13_FUNC_DFSDM_CKIN1 0x1d07
-#define STM32H7_PB13_FUNC_USART3_CTS_NSS 0x1d08
-#define STM32H7_PB13_FUNC_CAN2_TX 0x1d0a
-#define STM32H7_PB13_FUNC_OTG_HS_ULPI_D6 0x1d0b
-#define STM32H7_PB13_FUNC_ETH_MII_TXD1_ETH_RMII_TXD1 0x1d0c
-#define STM32H7_PB13_FUNC_UART5_TX 0x1d0f
-#define STM32H7_PB13_FUNC_EVENTOUT 0x1d10
-#define STM32H7_PB13_FUNC_ANALOG 0x1d11
-
-#define STM32H7_PB14_FUNC_GPIO 0x1e00
-#define STM32H7_PB14_FUNC_TIM1_CH2N 0x1e02
-#define STM32H7_PB14_FUNC_TIM8_CH2N 0x1e04
-#define STM32H7_PB14_FUNC_USART1_TX 0x1e05
-#define STM32H7_PB14_FUNC_SPI2_MISO_I2S2_SDI 0x1e06
-#define STM32H7_PB14_FUNC_DFSDM_DATIN2 0x1e07
-#define STM32H7_PB14_FUNC_USART3_RTS 0x1e08
-#define STM32H7_PB14_FUNC_UART4_RTS 0x1e09
-#define STM32H7_PB14_FUNC_SDMMC2_D0 0x1e0a
-#define STM32H7_PB14_FUNC_OTG_HS_DM 0x1e0d
-#define STM32H7_PB14_FUNC_EVENTOUT 0x1e10
-#define STM32H7_PB14_FUNC_ANALOG 0x1e11
-
-#define STM32H7_PB15_FUNC_GPIO 0x1f00
-#define STM32H7_PB15_FUNC_RTC_REFIN 0x1f01
-#define STM32H7_PB15_FUNC_TIM1_CH3N 0x1f02
-#define STM32H7_PB15_FUNC_TIM8_CH3N 0x1f04
-#define STM32H7_PB15_FUNC_USART1_RX 0x1f05
-#define STM32H7_PB15_FUNC_SPI2_MOSI_I2S2_SDO 0x1f06
-#define STM32H7_PB15_FUNC_DFSDM_CKIN2 0x1f07
-#define STM32H7_PB15_FUNC_UART4_CTS 0x1f09
-#define STM32H7_PB15_FUNC_SDMMC2_D1 0x1f0a
-#define STM32H7_PB15_FUNC_OTG_HS_DP 0x1f0d
-#define STM32H7_PB15_FUNC_EVENTOUT 0x1f10
-#define STM32H7_PB15_FUNC_ANALOG 0x1f11
-
-#define STM32H7_PC0_FUNC_GPIO 0x2000
-#define STM32H7_PC0_FUNC_DFSDM_CKIN0 0x2004
-#define STM32H7_PC0_FUNC_DFSDM_DATIN4 0x2007
-#define STM32H7_PC0_FUNC_SAI2_FS_B 0x2009
-#define STM32H7_PC0_FUNC_OTG_HS_ULPI_STP 0x200b
-#define STM32H7_PC0_FUNC_FMC_SDNWE 0x200d
-#define STM32H7_PC0_FUNC_LCD_R5 0x200f
-#define STM32H7_PC0_FUNC_EVENTOUT 0x2010
-#define STM32H7_PC0_FUNC_ANALOG 0x2011
-
-#define STM32H7_PC1_FUNC_GPIO 0x2100
-#define STM32H7_PC1_FUNC_TRACED0 0x2101
-#define STM32H7_PC1_FUNC_SAI1_D1 0x2103
-#define STM32H7_PC1_FUNC_DFSDM_DATIN0 0x2104
-#define STM32H7_PC1_FUNC_DFSDM_CKIN4 0x2105
-#define STM32H7_PC1_FUNC_SPI2_MOSI_I2S2_SDO 0x2106
-#define STM32H7_PC1_FUNC_SAI1_SD_A 0x2107
-#define STM32H7_PC1_FUNC_SAI4_SD_A 0x2109
-#define STM32H7_PC1_FUNC_SDMMC2_CK 0x210a
-#define STM32H7_PC1_FUNC_SAI4_D1 0x210b
-#define STM32H7_PC1_FUNC_ETH_MDC 0x210c
-#define STM32H7_PC1_FUNC_MDIOS_MDC 0x210d
-#define STM32H7_PC1_FUNC_EVENTOUT 0x2110
-#define STM32H7_PC1_FUNC_ANALOG 0x2111
-
-#define STM32H7_PC2_FUNC_GPIO 0x2200
-#define STM32H7_PC2_FUNC_DFSDM_CKIN1 0x2204
-#define STM32H7_PC2_FUNC_SPI2_MISO_I2S2_SDI 0x2206
-#define STM32H7_PC2_FUNC_DFSDM_CKOUT 0x2207
-#define STM32H7_PC2_FUNC_OTG_HS_ULPI_DIR 0x220b
-#define STM32H7_PC2_FUNC_ETH_MII_TXD2 0x220c
-#define STM32H7_PC2_FUNC_FMC_SDNE0 0x220d
-#define STM32H7_PC2_FUNC_EVENTOUT 0x2210
-#define STM32H7_PC2_FUNC_ANALOG 0x2211
-
-#define STM32H7_PC3_FUNC_GPIO 0x2300
-#define STM32H7_PC3_FUNC_DFSDM_DATIN1 0x2304
-#define STM32H7_PC3_FUNC_SPI2_MOSI_I2S2_SDO 0x2306
-#define STM32H7_PC3_FUNC_OTG_HS_ULPI_NXT 0x230b
-#define STM32H7_PC3_FUNC_ETH_MII_TX_CLK 0x230c
-#define STM32H7_PC3_FUNC_FMC_SDCKE0 0x230d
-#define STM32H7_PC3_FUNC_EVENTOUT 0x2310
-#define STM32H7_PC3_FUNC_ANALOG 0x2311
-
-#define STM32H7_PC4_FUNC_GPIO 0x2400
-#define STM32H7_PC4_FUNC_DFSDM_CKIN2 0x2404
-#define STM32H7_PC4_FUNC_I2S1_MCK 0x2406
-#define STM32H7_PC4_FUNC_SPDIFRX_IN2 0x240a
-#define STM32H7_PC4_FUNC_ETH_MII_RXD0_ETH_RMII_RXD0 0x240c
-#define STM32H7_PC4_FUNC_FMC_SDNE0 0x240d
-#define STM32H7_PC4_FUNC_EVENTOUT 0x2410
-#define STM32H7_PC4_FUNC_ANALOG 0x2411
-
-#define STM32H7_PC5_FUNC_GPIO 0x2500
-#define STM32H7_PC5_FUNC_SAI1_D3 0x2503
-#define STM32H7_PC5_FUNC_DFSDM_DATIN2 0x2504
-#define STM32H7_PC5_FUNC_SPDIFRX_IN3 0x250a
-#define STM32H7_PC5_FUNC_SAI4_D3 0x250b
-#define STM32H7_PC5_FUNC_ETH_MII_RXD1_ETH_RMII_RXD1 0x250c
-#define STM32H7_PC5_FUNC_FMC_SDCKE0 0x250d
-#define STM32H7_PC5_FUNC_COMP_1_OUT 0x250e
-#define STM32H7_PC5_FUNC_EVENTOUT 0x2510
-#define STM32H7_PC5_FUNC_ANALOG 0x2511
-
-#define STM32H7_PC6_FUNC_GPIO 0x2600
-#define STM32H7_PC6_FUNC_HRTIM_CHA1 0x2602
-#define STM32H7_PC6_FUNC_TIM3_CH1 0x2603
-#define STM32H7_PC6_FUNC_TIM8_CH1 0x2604
-#define STM32H7_PC6_FUNC_DFSDM_CKIN3 0x2605
-#define STM32H7_PC6_FUNC_I2S2_MCK 0x2606
-#define STM32H7_PC6_FUNC_USART6_TX 0x2608
-#define STM32H7_PC6_FUNC_SDMMC1_D0DIR 0x2609
-#define STM32H7_PC6_FUNC_FMC_NWAIT 0x260a
-#define STM32H7_PC6_FUNC_SDMMC2_D6 0x260b
-#define STM32H7_PC6_FUNC_SDMMC1_D6 0x260d
-#define STM32H7_PC6_FUNC_DCMI_D0 0x260e
-#define STM32H7_PC6_FUNC_LCD_HSYNC 0x260f
-#define STM32H7_PC6_FUNC_EVENTOUT 0x2610
-#define STM32H7_PC6_FUNC_ANALOG 0x2611
-
-#define STM32H7_PC7_FUNC_GPIO 0x2700
-#define STM32H7_PC7_FUNC_TRGIO 0x2701
-#define STM32H7_PC7_FUNC_HRTIM_CHA2 0x2702
-#define STM32H7_PC7_FUNC_TIM3_CH2 0x2703
-#define STM32H7_PC7_FUNC_TIM8_CH2 0x2704
-#define STM32H7_PC7_FUNC_DFSDM_DATIN3 0x2705
-#define STM32H7_PC7_FUNC_I2S3_MCK 0x2707
-#define STM32H7_PC7_FUNC_USART6_RX 0x2708
-#define STM32H7_PC7_FUNC_SDMMC1_D123DIR 0x2709
-#define STM32H7_PC7_FUNC_FMC_NE1 0x270a
-#define STM32H7_PC7_FUNC_SDMMC2_D7 0x270b
-#define STM32H7_PC7_FUNC_SWPMI_TX 0x270c
-#define STM32H7_PC7_FUNC_SDMMC1_D7 0x270d
-#define STM32H7_PC7_FUNC_DCMI_D1 0x270e
-#define STM32H7_PC7_FUNC_LCD_G6 0x270f
-#define STM32H7_PC7_FUNC_EVENTOUT 0x2710
-#define STM32H7_PC7_FUNC_ANALOG 0x2711
-
-#define STM32H7_PC8_FUNC_GPIO 0x2800
-#define STM32H7_PC8_FUNC_TRACED1 0x2801
-#define STM32H7_PC8_FUNC_HRTIM_CHB1 0x2802
-#define STM32H7_PC8_FUNC_TIM3_CH3 0x2803
-#define STM32H7_PC8_FUNC_TIM8_CH3 0x2804
-#define STM32H7_PC8_FUNC_USART6_CK 0x2808
-#define STM32H7_PC8_FUNC_UART5_RTS 0x2809
-#define STM32H7_PC8_FUNC_FMC_NE2_FMC_NCE 0x280a
-#define STM32H7_PC8_FUNC_SWPMI_RX 0x280c
-#define STM32H7_PC8_FUNC_SDMMC1_D0 0x280d
-#define STM32H7_PC8_FUNC_DCMI_D2 0x280e
-#define STM32H7_PC8_FUNC_EVENTOUT 0x2810
-#define STM32H7_PC8_FUNC_ANALOG 0x2811
-
-#define STM32H7_PC9_FUNC_GPIO 0x2900
-#define STM32H7_PC9_FUNC_MCO2 0x2901
-#define STM32H7_PC9_FUNC_TIM3_CH4 0x2903
-#define STM32H7_PC9_FUNC_TIM8_CH4 0x2904
-#define STM32H7_PC9_FUNC_I2C3_SDA 0x2905
-#define STM32H7_PC9_FUNC_I2S_CKIN 0x2906
-#define STM32H7_PC9_FUNC_UART5_CTS 0x2909
-#define STM32H7_PC9_FUNC_QUADSPI_BK1_IO0 0x290a
-#define STM32H7_PC9_FUNC_LCD_G3 0x290b
-#define STM32H7_PC9_FUNC_SWPMI_SUSPEND 0x290c
-#define STM32H7_PC9_FUNC_SDMMC1_D1 0x290d
-#define STM32H7_PC9_FUNC_DCMI_D3 0x290e
-#define STM32H7_PC9_FUNC_LCD_B2 0x290f
-#define STM32H7_PC9_FUNC_EVENTOUT 0x2910
-#define STM32H7_PC9_FUNC_ANALOG 0x2911
-
-#define STM32H7_PC10_FUNC_GPIO 0x2a00
-#define STM32H7_PC10_FUNC_HRTIM_EEV1 0x2a03
-#define STM32H7_PC10_FUNC_DFSDM_CKIN5 0x2a04
-#define STM32H7_PC10_FUNC_SPI3_SCK_I2S3_CK 0x2a07
-#define STM32H7_PC10_FUNC_USART3_TX 0x2a08
-#define STM32H7_PC10_FUNC_UART4_TX 0x2a09
-#define STM32H7_PC10_FUNC_QUADSPI_BK1_IO1 0x2a0a
-#define STM32H7_PC10_FUNC_SDMMC1_D2 0x2a0d
-#define STM32H7_PC10_FUNC_DCMI_D8 0x2a0e
-#define STM32H7_PC10_FUNC_LCD_R2 0x2a0f
-#define STM32H7_PC10_FUNC_EVENTOUT 0x2a10
-#define STM32H7_PC10_FUNC_ANALOG 0x2a11
-
-#define STM32H7_PC11_FUNC_GPIO 0x2b00
-#define STM32H7_PC11_FUNC_HRTIM_FLT2 0x2b03
-#define STM32H7_PC11_FUNC_DFSDM_DATIN5 0x2b04
-#define STM32H7_PC11_FUNC_SPI3_MISO_I2S3_SDI 0x2b07
-#define STM32H7_PC11_FUNC_USART3_RX 0x2b08
-#define STM32H7_PC11_FUNC_UART4_RX 0x2b09
-#define STM32H7_PC11_FUNC_QUADSPI_BK2_NCS 0x2b0a
-#define STM32H7_PC11_FUNC_SDMMC1_D3 0x2b0d
-#define STM32H7_PC11_FUNC_DCMI_D4 0x2b0e
-#define STM32H7_PC11_FUNC_EVENTOUT 0x2b10
-#define STM32H7_PC11_FUNC_ANALOG 0x2b11
-
-#define STM32H7_PC12_FUNC_GPIO 0x2c00
-#define STM32H7_PC12_FUNC_TRACED3 0x2c01
-#define STM32H7_PC12_FUNC_HRTIM_EEV2 0x2c03
-#define STM32H7_PC12_FUNC_SPI3_MOSI_I2S3_SDO 0x2c07
-#define STM32H7_PC12_FUNC_USART3_CK 0x2c08
-#define STM32H7_PC12_FUNC_UART5_TX 0x2c09
-#define STM32H7_PC12_FUNC_SDMMC1_CK 0x2c0d
-#define STM32H7_PC12_FUNC_DCMI_D9 0x2c0e
-#define STM32H7_PC12_FUNC_EVENTOUT 0x2c10
-#define STM32H7_PC12_FUNC_ANALOG 0x2c11
-
-#define STM32H7_PC13_FUNC_GPIO 0x2d00
-#define STM32H7_PC13_FUNC_EVENTOUT 0x2d10
-#define STM32H7_PC13_FUNC_ANALOG 0x2d11
-
-#define STM32H7_PC14_FUNC_GPIO 0x2e00
-#define STM32H7_PC14_FUNC_EVENTOUT 0x2e10
-#define STM32H7_PC14_FUNC_ANALOG 0x2e11
-
-#define STM32H7_PC15_FUNC_GPIO 0x2f00
-#define STM32H7_PC15_FUNC_EVENTOUT 0x2f10
-#define STM32H7_PC15_FUNC_ANALOG 0x2f11
-
-#define STM32H7_PD0_FUNC_GPIO 0x3000
-#define STM32H7_PD0_FUNC_DFSDM_CKIN6 0x3004
-#define STM32H7_PD0_FUNC_SAI3_SCK_A 0x3007
-#define STM32H7_PD0_FUNC_UART4_RX 0x3009
-#define STM32H7_PD0_FUNC_CAN1_RX 0x300a
-#define STM32H7_PD0_FUNC_FMC_D2_FMC_DA2 0x300d
-#define STM32H7_PD0_FUNC_EVENTOUT 0x3010
-#define STM32H7_PD0_FUNC_ANALOG 0x3011
-
-#define STM32H7_PD1_FUNC_GPIO 0x3100
-#define STM32H7_PD1_FUNC_DFSDM_DATIN6 0x3104
-#define STM32H7_PD1_FUNC_SAI3_SD_A 0x3107
-#define STM32H7_PD1_FUNC_UART4_TX 0x3109
-#define STM32H7_PD1_FUNC_CAN1_TX 0x310a
-#define STM32H7_PD1_FUNC_FMC_D3_FMC_DA3 0x310d
-#define STM32H7_PD1_FUNC_EVENTOUT 0x3110
-#define STM32H7_PD1_FUNC_ANALOG 0x3111
-
-#define STM32H7_PD2_FUNC_GPIO 0x3200
-#define STM32H7_PD2_FUNC_TRACED2 0x3201
-#define STM32H7_PD2_FUNC_TIM3_ETR 0x3203
-#define STM32H7_PD2_FUNC_UART5_RX 0x3209
-#define STM32H7_PD2_FUNC_SDMMC1_CMD 0x320d
-#define STM32H7_PD2_FUNC_DCMI_D11 0x320e
-#define STM32H7_PD2_FUNC_EVENTOUT 0x3210
-#define STM32H7_PD2_FUNC_ANALOG 0x3211
-
-#define STM32H7_PD3_FUNC_GPIO 0x3300
-#define STM32H7_PD3_FUNC_DFSDM_CKOUT 0x3304
-#define STM32H7_PD3_FUNC_SPI2_SCK_I2S2_CK 0x3306
-#define STM32H7_PD3_FUNC_USART2_CTS_NSS 0x3308
-#define STM32H7_PD3_FUNC_FMC_CLK 0x330d
-#define STM32H7_PD3_FUNC_DCMI_D5 0x330e
-#define STM32H7_PD3_FUNC_LCD_G7 0x330f
-#define STM32H7_PD3_FUNC_EVENTOUT 0x3310
-#define STM32H7_PD3_FUNC_ANALOG 0x3311
-
-#define STM32H7_PD4_FUNC_GPIO 0x3400
-#define STM32H7_PD4_FUNC_HRTIM_FLT3 0x3403
-#define STM32H7_PD4_FUNC_SAI3_FS_A 0x3407
-#define STM32H7_PD4_FUNC_USART2_RTS 0x3408
-#define STM32H7_PD4_FUNC_CAN1_RXFD 0x340a
-#define STM32H7_PD4_FUNC_FMC_NOE 0x340d
-#define STM32H7_PD4_FUNC_EVENTOUT 0x3410
-#define STM32H7_PD4_FUNC_ANALOG 0x3411
-
-#define STM32H7_PD5_FUNC_GPIO 0x3500
-#define STM32H7_PD5_FUNC_HRTIM_EEV3 0x3503
-#define STM32H7_PD5_FUNC_USART2_TX 0x3508
-#define STM32H7_PD5_FUNC_CAN1_TXFD 0x350a
-#define STM32H7_PD5_FUNC_FMC_NWE 0x350d
-#define STM32H7_PD5_FUNC_EVENTOUT 0x3510
-#define STM32H7_PD5_FUNC_ANALOG 0x3511
-
-#define STM32H7_PD6_FUNC_GPIO 0x3600
-#define STM32H7_PD6_FUNC_SAI1_D1 0x3603
-#define STM32H7_PD6_FUNC_DFSDM_CKIN4 0x3604
-#define STM32H7_PD6_FUNC_DFSDM_DATIN1 0x3605
-#define STM32H7_PD6_FUNC_SPI3_MOSI_I2S3_SDO 0x3606
-#define STM32H7_PD6_FUNC_SAI1_SD_A 0x3607
-#define STM32H7_PD6_FUNC_USART2_RX 0x3608
-#define STM32H7_PD6_FUNC_SAI4_SD_A 0x3609
-#define STM32H7_PD6_FUNC_CAN2_RXFD 0x360a
-#define STM32H7_PD6_FUNC_SAI4_D1 0x360b
-#define STM32H7_PD6_FUNC_SDMMC2_CK 0x360c
-#define STM32H7_PD6_FUNC_FMC_NWAIT 0x360d
-#define STM32H7_PD6_FUNC_DCMI_D10 0x360e
-#define STM32H7_PD6_FUNC_LCD_B2 0x360f
-#define STM32H7_PD6_FUNC_EVENTOUT 0x3610
-#define STM32H7_PD6_FUNC_ANALOG 0x3611
-
-#define STM32H7_PD7_FUNC_GPIO 0x3700
-#define STM32H7_PD7_FUNC_DFSDM_DATIN4 0x3704
-#define STM32H7_PD7_FUNC_SPI1_MOSI_I2S1_SDO 0x3706
-#define STM32H7_PD7_FUNC_DFSDM_CKIN1 0x3707
-#define STM32H7_PD7_FUNC_USART2_CK 0x3708
-#define STM32H7_PD7_FUNC_SPDIFRX_IN0 0x370a
-#define STM32H7_PD7_FUNC_SDMMC2_CMD 0x370c
-#define STM32H7_PD7_FUNC_FMC_NE1 0x370d
-#define STM32H7_PD7_FUNC_EVENTOUT 0x3710
-#define STM32H7_PD7_FUNC_ANALOG 0x3711
-
-#define STM32H7_PD8_FUNC_GPIO 0x3800
-#define STM32H7_PD8_FUNC_DFSDM_CKIN3 0x3804
-#define STM32H7_PD8_FUNC_SAI3_SCK_B 0x3807
-#define STM32H7_PD8_FUNC_USART3_TX 0x3808
-#define STM32H7_PD8_FUNC_SPDIFRX_IN1 0x380a
-#define STM32H7_PD8_FUNC_FMC_D13_FMC_DA13 0x380d
-#define STM32H7_PD8_FUNC_EVENTOUT 0x3810
-#define STM32H7_PD8_FUNC_ANALOG 0x3811
-
-#define STM32H7_PD9_FUNC_GPIO 0x3900
-#define STM32H7_PD9_FUNC_DFSDM_DATIN3 0x3904
-#define STM32H7_PD9_FUNC_SAI3_SD_B 0x3907
-#define STM32H7_PD9_FUNC_USART3_RX 0x3908
-#define STM32H7_PD9_FUNC_CAN2_RXFD 0x390a
-#define STM32H7_PD9_FUNC_FMC_D14_FMC_DA14 0x390d
-#define STM32H7_PD9_FUNC_EVENTOUT 0x3910
-#define STM32H7_PD9_FUNC_ANALOG 0x3911
-
-#define STM32H7_PD10_FUNC_GPIO 0x3a00
-#define STM32H7_PD10_FUNC_DFSDM_CKOUT 0x3a04
-#define STM32H7_PD10_FUNC_SAI3_FS_B 0x3a07
-#define STM32H7_PD10_FUNC_USART3_CK 0x3a08
-#define STM32H7_PD10_FUNC_CAN2_TXFD 0x3a0a
-#define STM32H7_PD10_FUNC_FMC_D15_FMC_DA15 0x3a0d
-#define STM32H7_PD10_FUNC_LCD_B3 0x3a0f
-#define STM32H7_PD10_FUNC_EVENTOUT 0x3a10
-#define STM32H7_PD10_FUNC_ANALOG 0x3a11
-
-#define STM32H7_PD11_FUNC_GPIO 0x3b00
-#define STM32H7_PD11_FUNC_LPTIM2_IN2 0x3b04
-#define STM32H7_PD11_FUNC_I2C4_SMBA 0x3b05
-#define STM32H7_PD11_FUNC_USART3_CTS_NSS 0x3b08
-#define STM32H7_PD11_FUNC_QUADSPI_BK1_IO0 0x3b0a
-#define STM32H7_PD11_FUNC_SAI2_SD_A 0x3b0b
-#define STM32H7_PD11_FUNC_FMC_A16 0x3b0d
-#define STM32H7_PD11_FUNC_EVENTOUT 0x3b10
-#define STM32H7_PD11_FUNC_ANALOG 0x3b11
-
-#define STM32H7_PD12_FUNC_GPIO 0x3c00
-#define STM32H7_PD12_FUNC_LPTIM1_IN1 0x3c02
-#define STM32H7_PD12_FUNC_TIM4_CH1 0x3c03
-#define STM32H7_PD12_FUNC_LPTIM2_IN1 0x3c04
-#define STM32H7_PD12_FUNC_I2C4_SCL 0x3c05
-#define STM32H7_PD12_FUNC_USART3_RTS 0x3c08
-#define STM32H7_PD12_FUNC_QUADSPI_BK1_IO1 0x3c0a
-#define STM32H7_PD12_FUNC_SAI2_FS_A 0x3c0b
-#define STM32H7_PD12_FUNC_FMC_A17 0x3c0d
-#define STM32H7_PD12_FUNC_EVENTOUT 0x3c10
-#define STM32H7_PD12_FUNC_ANALOG 0x3c11
-
-#define STM32H7_PD13_FUNC_GPIO 0x3d00
-#define STM32H7_PD13_FUNC_LPTIM1_OUT 0x3d02
-#define STM32H7_PD13_FUNC_TIM4_CH2 0x3d03
-#define STM32H7_PD13_FUNC_I2C4_SDA 0x3d05
-#define STM32H7_PD13_FUNC_QUADSPI_BK1_IO3 0x3d0a
-#define STM32H7_PD13_FUNC_SAI2_SCK_A 0x3d0b
-#define STM32H7_PD13_FUNC_FMC_A18 0x3d0d
-#define STM32H7_PD13_FUNC_EVENTOUT 0x3d10
-#define STM32H7_PD13_FUNC_ANALOG 0x3d11
-
-#define STM32H7_PD14_FUNC_GPIO 0x3e00
-#define STM32H7_PD14_FUNC_TIM4_CH3 0x3e03
-#define STM32H7_PD14_FUNC_SAI3_MCLK_B 0x3e07
-#define STM32H7_PD14_FUNC_UART8_CTS 0x3e09
-#define STM32H7_PD14_FUNC_FMC_D0_FMC_DA0 0x3e0d
-#define STM32H7_PD14_FUNC_EVENTOUT 0x3e10
-#define STM32H7_PD14_FUNC_ANALOG 0x3e11
-
-#define STM32H7_PD15_FUNC_GPIO 0x3f00
-#define STM32H7_PD15_FUNC_TIM4_CH4 0x3f03
-#define STM32H7_PD15_FUNC_SAI3_MCLK_A 0x3f07
-#define STM32H7_PD15_FUNC_UART8_RTS 0x3f09
-#define STM32H7_PD15_FUNC_FMC_D1_FMC_DA1 0x3f0d
-#define STM32H7_PD15_FUNC_EVENTOUT 0x3f10
-#define STM32H7_PD15_FUNC_ANALOG 0x3f11
-
-#define STM32H7_PE0_FUNC_GPIO 0x4000
-#define STM32H7_PE0_FUNC_LPTIM1_ETR 0x4002
-#define STM32H7_PE0_FUNC_TIM4_ETR 0x4003
-#define STM32H7_PE0_FUNC_HRTIM_SCIN 0x4004
-#define STM32H7_PE0_FUNC_LPTIM2_ETR 0x4005
-#define STM32H7_PE0_FUNC_UART8_RX 0x4009
-#define STM32H7_PE0_FUNC_CAN1_RXFD 0x400a
-#define STM32H7_PE0_FUNC_SAI2_MCK_A 0x400b
-#define STM32H7_PE0_FUNC_FMC_NBL0 0x400d
-#define STM32H7_PE0_FUNC_DCMI_D2 0x400e
-#define STM32H7_PE0_FUNC_EVENTOUT 0x4010
-#define STM32H7_PE0_FUNC_ANALOG 0x4011
-
-#define STM32H7_PE1_FUNC_GPIO 0x4100
-#define STM32H7_PE1_FUNC_LPTIM1_IN2 0x4102
-#define STM32H7_PE1_FUNC_HRTIM_SCOUT 0x4104
-#define STM32H7_PE1_FUNC_UART8_TX 0x4109
-#define STM32H7_PE1_FUNC_CAN1_TXFD 0x410a
-#define STM32H7_PE1_FUNC_FMC_NBL1 0x410d
-#define STM32H7_PE1_FUNC_DCMI_D3 0x410e
-#define STM32H7_PE1_FUNC_EVENTOUT 0x4110
-#define STM32H7_PE1_FUNC_ANALOG 0x4111
-
-#define STM32H7_PE2_FUNC_GPIO 0x4200
-#define STM32H7_PE2_FUNC_TRACECLK 0x4201
-#define STM32H7_PE2_FUNC_SAI1_CK1 0x4203
-#define STM32H7_PE2_FUNC_SPI4_SCK 0x4206
-#define STM32H7_PE2_FUNC_SAI1_MCLK_A 0x4207
-#define STM32H7_PE2_FUNC_SAI4_MCLK_A 0x4209
-#define STM32H7_PE2_FUNC_QUADSPI_BK1_IO2 0x420a
-#define STM32H7_PE2_FUNC_SAI4_CK1 0x420b
-#define STM32H7_PE2_FUNC_ETH_MII_TXD3 0x420c
-#define STM32H7_PE2_FUNC_FMC_A23 0x420d
-#define STM32H7_PE2_FUNC_EVENTOUT 0x4210
-#define STM32H7_PE2_FUNC_ANALOG 0x4211
-
-#define STM32H7_PE3_FUNC_GPIO 0x4300
-#define STM32H7_PE3_FUNC_TRACED0 0x4301
-#define STM32H7_PE3_FUNC_TIM15_BKIN 0x4305
-#define STM32H7_PE3_FUNC_SAI1_SD_B 0x4307
-#define STM32H7_PE3_FUNC_SAI4_SD_B 0x4309
-#define STM32H7_PE3_FUNC_FMC_A19 0x430d
-#define STM32H7_PE3_FUNC_EVENTOUT 0x4310
-#define STM32H7_PE3_FUNC_ANALOG 0x4311
-
-#define STM32H7_PE4_FUNC_GPIO 0x4400
-#define STM32H7_PE4_FUNC_TRACED1 0x4401
-#define STM32H7_PE4_FUNC_SAI1_D2 0x4403
-#define STM32H7_PE4_FUNC_DFSDM_DATIN3 0x4404
-#define STM32H7_PE4_FUNC_TIM15_CH1N 0x4405
-#define STM32H7_PE4_FUNC_SPI4_NSS 0x4406
-#define STM32H7_PE4_FUNC_SAI1_FS_A 0x4407
-#define STM32H7_PE4_FUNC_SAI4_FS_A 0x4409
-#define STM32H7_PE4_FUNC_SAI4_D2 0x440b
-#define STM32H7_PE4_FUNC_FMC_A20 0x440d
-#define STM32H7_PE4_FUNC_DCMI_D4 0x440e
-#define STM32H7_PE4_FUNC_LCD_B0 0x440f
-#define STM32H7_PE4_FUNC_EVENTOUT 0x4410
-#define STM32H7_PE4_FUNC_ANALOG 0x4411
-
-#define STM32H7_PE5_FUNC_GPIO 0x4500
-#define STM32H7_PE5_FUNC_TRACED2 0x4501
-#define STM32H7_PE5_FUNC_SAI1_CK2 0x4503
-#define STM32H7_PE5_FUNC_DFSDM_CKIN3 0x4504
-#define STM32H7_PE5_FUNC_TIM15_CH1 0x4505
-#define STM32H7_PE5_FUNC_SPI4_MISO 0x4506
-#define STM32H7_PE5_FUNC_SAI1_SCK_A 0x4507
-#define STM32H7_PE5_FUNC_SAI4_SCK_A 0x4509
-#define STM32H7_PE5_FUNC_SAI4_CK2 0x450b
-#define STM32H7_PE5_FUNC_FMC_A21 0x450d
-#define STM32H7_PE5_FUNC_DCMI_D6 0x450e
-#define STM32H7_PE5_FUNC_LCD_G0 0x450f
-#define STM32H7_PE5_FUNC_EVENTOUT 0x4510
-#define STM32H7_PE5_FUNC_ANALOG 0x4511
-
-#define STM32H7_PE6_FUNC_GPIO 0x4600
-#define STM32H7_PE6_FUNC_TRACED3 0x4601
-#define STM32H7_PE6_FUNC_TIM1_BKIN2 0x4602
-#define STM32H7_PE6_FUNC_SAI1_D1 0x4603
-#define STM32H7_PE6_FUNC_TIM15_CH2 0x4605
-#define STM32H7_PE6_FUNC_SPI4_MOSI 0x4606
-#define STM32H7_PE6_FUNC_SAI1_SD_A 0x4607
-#define STM32H7_PE6_FUNC_SAI4_SD_A 0x4609
-#define STM32H7_PE6_FUNC_SAI4_D1 0x460a
-#define STM32H7_PE6_FUNC_SAI2_MCK_B 0x460b
-#define STM32H7_PE6_FUNC_TIM1_BKIN2_COMP12 0x460c
-#define STM32H7_PE6_FUNC_FMC_A22 0x460d
-#define STM32H7_PE6_FUNC_DCMI_D7 0x460e
-#define STM32H7_PE6_FUNC_LCD_G1 0x460f
-#define STM32H7_PE6_FUNC_EVENTOUT 0x4610
-#define STM32H7_PE6_FUNC_ANALOG 0x4611
-
-#define STM32H7_PE7_FUNC_GPIO 0x4700
-#define STM32H7_PE7_FUNC_TIM1_ETR 0x4702
-#define STM32H7_PE7_FUNC_DFSDM_DATIN2 0x4704
-#define STM32H7_PE7_FUNC_UART7_RX 0x4708
-#define STM32H7_PE7_FUNC_QUADSPI_BK2_IO0 0x470b
-#define STM32H7_PE7_FUNC_FMC_D4_FMC_DA4 0x470d
-#define STM32H7_PE7_FUNC_EVENTOUT 0x4710
-#define STM32H7_PE7_FUNC_ANALOG 0x4711
-
-#define STM32H7_PE8_FUNC_GPIO 0x4800
-#define STM32H7_PE8_FUNC_TIM1_CH1N 0x4802
-#define STM32H7_PE8_FUNC_DFSDM_CKIN2 0x4804
-#define STM32H7_PE8_FUNC_UART7_TX 0x4808
-#define STM32H7_PE8_FUNC_QUADSPI_BK2_IO1 0x480b
-#define STM32H7_PE8_FUNC_FMC_D5_FMC_DA5 0x480d
-#define STM32H7_PE8_FUNC_COMP_2_OUT 0x480e
-#define STM32H7_PE8_FUNC_EVENTOUT 0x4810
-#define STM32H7_PE8_FUNC_ANALOG 0x4811
-
-#define STM32H7_PE9_FUNC_GPIO 0x4900
-#define STM32H7_PE9_FUNC_TIM1_CH1 0x4902
-#define STM32H7_PE9_FUNC_DFSDM_CKOUT 0x4904
-#define STM32H7_PE9_FUNC_UART7_RTS 0x4908
-#define STM32H7_PE9_FUNC_QUADSPI_BK2_IO2 0x490b
-#define STM32H7_PE9_FUNC_FMC_D6_FMC_DA6 0x490d
-#define STM32H7_PE9_FUNC_EVENTOUT 0x4910
-#define STM32H7_PE9_FUNC_ANALOG 0x4911
-
-#define STM32H7_PE10_FUNC_GPIO 0x4a00
-#define STM32H7_PE10_FUNC_TIM1_CH2N 0x4a02
-#define STM32H7_PE10_FUNC_DFSDM_DATIN4 0x4a04
-#define STM32H7_PE10_FUNC_UART7_CTS 0x4a08
-#define STM32H7_PE10_FUNC_QUADSPI_BK2_IO3 0x4a0b
-#define STM32H7_PE10_FUNC_FMC_D7_FMC_DA7 0x4a0d
-#define STM32H7_PE10_FUNC_EVENTOUT 0x4a10
-#define STM32H7_PE10_FUNC_ANALOG 0x4a11
-
-#define STM32H7_PE11_FUNC_GPIO 0x4b00
-#define STM32H7_PE11_FUNC_TIM1_CH2 0x4b02
-#define STM32H7_PE11_FUNC_DFSDM_CKIN4 0x4b04
-#define STM32H7_PE11_FUNC_SPI4_NSS 0x4b06
-#define STM32H7_PE11_FUNC_SAI2_SD_B 0x4b0b
-#define STM32H7_PE11_FUNC_FMC_D8_FMC_DA8 0x4b0d
-#define STM32H7_PE11_FUNC_LCD_G3 0x4b0f
-#define STM32H7_PE11_FUNC_EVENTOUT 0x4b10
-#define STM32H7_PE11_FUNC_ANALOG 0x4b11
-
-#define STM32H7_PE12_FUNC_GPIO 0x4c00
-#define STM32H7_PE12_FUNC_TIM1_CH3N 0x4c02
-#define STM32H7_PE12_FUNC_DFSDM_DATIN5 0x4c04
-#define STM32H7_PE12_FUNC_SPI4_SCK 0x4c06
-#define STM32H7_PE12_FUNC_SAI2_SCK_B 0x4c0b
-#define STM32H7_PE12_FUNC_FMC_D9_FMC_DA9 0x4c0d
-#define STM32H7_PE12_FUNC_COMP_1_OUT 0x4c0e
-#define STM32H7_PE12_FUNC_LCD_B4 0x4c0f
-#define STM32H7_PE12_FUNC_EVENTOUT 0x4c10
-#define STM32H7_PE12_FUNC_ANALOG 0x4c11
-
-#define STM32H7_PE13_FUNC_GPIO 0x4d00
-#define STM32H7_PE13_FUNC_TIM1_CH3 0x4d02
-#define STM32H7_PE13_FUNC_DFSDM_CKIN5 0x4d04
-#define STM32H7_PE13_FUNC_SPI4_MISO 0x4d06
-#define STM32H7_PE13_FUNC_SAI2_FS_B 0x4d0b
-#define STM32H7_PE13_FUNC_FMC_D10_FMC_DA10 0x4d0d
-#define STM32H7_PE13_FUNC_COMP_2_OUT 0x4d0e
-#define STM32H7_PE13_FUNC_LCD_DE 0x4d0f
-#define STM32H7_PE13_FUNC_EVENTOUT 0x4d10
-#define STM32H7_PE13_FUNC_ANALOG 0x4d11
-
-#define STM32H7_PE14_FUNC_GPIO 0x4e00
-#define STM32H7_PE14_FUNC_TIM1_CH4 0x4e02
-#define STM32H7_PE14_FUNC_SPI4_MOSI 0x4e06
-#define STM32H7_PE14_FUNC_SAI2_MCK_B 0x4e0b
-#define STM32H7_PE14_FUNC_FMC_D11_FMC_DA11 0x4e0d
-#define STM32H7_PE14_FUNC_LCD_CLK 0x4e0f
-#define STM32H7_PE14_FUNC_EVENTOUT 0x4e10
-#define STM32H7_PE14_FUNC_ANALOG 0x4e11
-
-#define STM32H7_PE15_FUNC_GPIO 0x4f00
-#define STM32H7_PE15_FUNC_TIM1_BKIN 0x4f02
-#define STM32H7_PE15_FUNC_HDMI__TIM1_BKIN 0x4f06
-#define STM32H7_PE15_FUNC_FMC_D12_FMC_DA12 0x4f0d
-#define STM32H7_PE15_FUNC_TIM1_BKIN_COMP12 0x4f0e
-#define STM32H7_PE15_FUNC_LCD_R7 0x4f0f
-#define STM32H7_PE15_FUNC_EVENTOUT 0x4f10
-#define STM32H7_PE15_FUNC_ANALOG 0x4f11
-
-#define STM32H7_PF0_FUNC_GPIO 0x5000
-#define STM32H7_PF0_FUNC_I2C2_SDA 0x5005
-#define STM32H7_PF0_FUNC_FMC_A0 0x500d
-#define STM32H7_PF0_FUNC_EVENTOUT 0x5010
-#define STM32H7_PF0_FUNC_ANALOG 0x5011
-
-#define STM32H7_PF1_FUNC_GPIO 0x5100
-#define STM32H7_PF1_FUNC_I2C2_SCL 0x5105
-#define STM32H7_PF1_FUNC_FMC_A1 0x510d
-#define STM32H7_PF1_FUNC_EVENTOUT 0x5110
-#define STM32H7_PF1_FUNC_ANALOG 0x5111
-
-#define STM32H7_PF2_FUNC_GPIO 0x5200
-#define STM32H7_PF2_FUNC_I2C2_SMBA 0x5205
-#define STM32H7_PF2_FUNC_FMC_A2 0x520d
-#define STM32H7_PF2_FUNC_EVENTOUT 0x5210
-#define STM32H7_PF2_FUNC_ANALOG 0x5211
-
-#define STM32H7_PF3_FUNC_GPIO 0x5300
-#define STM32H7_PF3_FUNC_FMC_A3 0x530d
-#define STM32H7_PF3_FUNC_EVENTOUT 0x5310
-#define STM32H7_PF3_FUNC_ANALOG 0x5311
-
-#define STM32H7_PF4_FUNC_GPIO 0x5400
-#define STM32H7_PF4_FUNC_FMC_A4 0x540d
-#define STM32H7_PF4_FUNC_EVENTOUT 0x5410
-#define STM32H7_PF4_FUNC_ANALOG 0x5411
-
-#define STM32H7_PF5_FUNC_GPIO 0x5500
-#define STM32H7_PF5_FUNC_FMC_A5 0x550d
-#define STM32H7_PF5_FUNC_EVENTOUT 0x5510
-#define STM32H7_PF5_FUNC_ANALOG 0x5511
-
-#define STM32H7_PF6_FUNC_GPIO 0x5600
-#define STM32H7_PF6_FUNC_TIM16_CH1 0x5602
-#define STM32H7_PF6_FUNC_SPI5_NSS 0x5606
-#define STM32H7_PF6_FUNC_SAI1_SD_B 0x5607
-#define STM32H7_PF6_FUNC_UART7_RX 0x5608
-#define STM32H7_PF6_FUNC_SAI4_SD_B 0x5609
-#define STM32H7_PF6_FUNC_QUADSPI_BK1_IO3 0x560a
-#define STM32H7_PF6_FUNC_EVENTOUT 0x5610
-#define STM32H7_PF6_FUNC_ANALOG 0x5611
-
-#define STM32H7_PF7_FUNC_GPIO 0x5700
-#define STM32H7_PF7_FUNC_TIM17_CH1 0x5702
-#define STM32H7_PF7_FUNC_SPI5_SCK 0x5706
-#define STM32H7_PF7_FUNC_SAI1_MCLK_B 0x5707
-#define STM32H7_PF7_FUNC_UART7_TX 0x5708
-#define STM32H7_PF7_FUNC_SAI4_MCLK_B 0x5709
-#define STM32H7_PF7_FUNC_QUADSPI_BK1_IO2 0x570a
-#define STM32H7_PF7_FUNC_EVENTOUT 0x5710
-#define STM32H7_PF7_FUNC_ANALOG 0x5711
-
-#define STM32H7_PF8_FUNC_GPIO 0x5800
-#define STM32H7_PF8_FUNC_TIM16_CH1N 0x5802
-#define STM32H7_PF8_FUNC_SPI5_MISO 0x5806
-#define STM32H7_PF8_FUNC_SAI1_SCK_B 0x5807
-#define STM32H7_PF8_FUNC_UART7_RTS 0x5808
-#define STM32H7_PF8_FUNC_SAI4_SCK_B 0x5809
-#define STM32H7_PF8_FUNC_TIM13_CH1 0x580a
-#define STM32H7_PF8_FUNC_QUADSPI_BK1_IO0 0x580b
-#define STM32H7_PF8_FUNC_EVENTOUT 0x5810
-#define STM32H7_PF8_FUNC_ANALOG 0x5811
-
-#define STM32H7_PF9_FUNC_GPIO 0x5900
-#define STM32H7_PF9_FUNC_TIM17_CH1N 0x5902
-#define STM32H7_PF9_FUNC_SPI5_MOSI 0x5906
-#define STM32H7_PF9_FUNC_SAI1_FS_B 0x5907
-#define STM32H7_PF9_FUNC_UART7_CTS 0x5908
-#define STM32H7_PF9_FUNC_SAI4_FS_B 0x5909
-#define STM32H7_PF9_FUNC_TIM14_CH1 0x590a
-#define STM32H7_PF9_FUNC_QUADSPI_BK1_IO1 0x590b
-#define STM32H7_PF9_FUNC_EVENTOUT 0x5910
-#define STM32H7_PF9_FUNC_ANALOG 0x5911
-
-#define STM32H7_PF10_FUNC_GPIO 0x5a00
-#define STM32H7_PF10_FUNC_TIM16_BKIN 0x5a02
-#define STM32H7_PF10_FUNC_SAI1_D3 0x5a03
-#define STM32H7_PF10_FUNC_QUADSPI_CLK 0x5a0a
-#define STM32H7_PF10_FUNC_SAI4_D3 0x5a0b
-#define STM32H7_PF10_FUNC_DCMI_D11 0x5a0e
-#define STM32H7_PF10_FUNC_LCD_DE 0x5a0f
-#define STM32H7_PF10_FUNC_EVENTOUT 0x5a10
-#define STM32H7_PF10_FUNC_ANALOG 0x5a11
-
-#define STM32H7_PF11_FUNC_GPIO 0x5b00
-#define STM32H7_PF11_FUNC_SPI5_MOSI 0x5b06
-#define STM32H7_PF11_FUNC_SAI2_SD_B 0x5b0b
-#define STM32H7_PF11_FUNC_FMC_SDNRAS 0x5b0d
-#define STM32H7_PF11_FUNC_DCMI_D12 0x5b0e
-#define STM32H7_PF11_FUNC_EVENTOUT 0x5b10
-#define STM32H7_PF11_FUNC_ANALOG 0x5b11
-
-#define STM32H7_PF12_FUNC_GPIO 0x5c00
-#define STM32H7_PF12_FUNC_FMC_A6 0x5c0d
-#define STM32H7_PF12_FUNC_EVENTOUT 0x5c10
-#define STM32H7_PF12_FUNC_ANALOG 0x5c11
-
-#define STM32H7_PF13_FUNC_GPIO 0x5d00
-#define STM32H7_PF13_FUNC_DFSDM_DATIN6 0x5d04
-#define STM32H7_PF13_FUNC_I2C4_SMBA 0x5d05
-#define STM32H7_PF13_FUNC_FMC_A7 0x5d0d
-#define STM32H7_PF13_FUNC_EVENTOUT 0x5d10
-#define STM32H7_PF13_FUNC_ANALOG 0x5d11
-
-#define STM32H7_PF14_FUNC_GPIO 0x5e00
-#define STM32H7_PF14_FUNC_DFSDM_CKIN6 0x5e04
-#define STM32H7_PF14_FUNC_I2C4_SCL 0x5e05
-#define STM32H7_PF14_FUNC_FMC_A8 0x5e0d
-#define STM32H7_PF14_FUNC_EVENTOUT 0x5e10
-#define STM32H7_PF14_FUNC_ANALOG 0x5e11
-
-#define STM32H7_PF15_FUNC_GPIO 0x5f00
-#define STM32H7_PF15_FUNC_I2C4_SDA 0x5f05
-#define STM32H7_PF15_FUNC_FMC_A9 0x5f0d
-#define STM32H7_PF15_FUNC_EVENTOUT 0x5f10
-#define STM32H7_PF15_FUNC_ANALOG 0x5f11
-
-#define STM32H7_PG0_FUNC_GPIO 0x6000
-#define STM32H7_PG0_FUNC_FMC_A10 0x600d
-#define STM32H7_PG0_FUNC_EVENTOUT 0x6010
-#define STM32H7_PG0_FUNC_ANALOG 0x6011
-
-#define STM32H7_PG1_FUNC_GPIO 0x6100
-#define STM32H7_PG1_FUNC_FMC_A11 0x610d
-#define STM32H7_PG1_FUNC_EVENTOUT 0x6110
-#define STM32H7_PG1_FUNC_ANALOG 0x6111
-
-#define STM32H7_PG2_FUNC_GPIO 0x6200
-#define STM32H7_PG2_FUNC_TIM8_BKIN 0x6204
-#define STM32H7_PG2_FUNC_TIM8_BKIN_COMP12 0x620c
-#define STM32H7_PG2_FUNC_FMC_A12 0x620d
-#define STM32H7_PG2_FUNC_EVENTOUT 0x6210
-#define STM32H7_PG2_FUNC_ANALOG 0x6211
-
-#define STM32H7_PG3_FUNC_GPIO 0x6300
-#define STM32H7_PG3_FUNC_TIM8_BKIN2 0x6304
-#define STM32H7_PG3_FUNC_TIM8_BKIN2_COMP12 0x630c
-#define STM32H7_PG3_FUNC_FMC_A13 0x630d
-#define STM32H7_PG3_FUNC_EVENTOUT 0x6310
-#define STM32H7_PG3_FUNC_ANALOG 0x6311
-
-#define STM32H7_PG4_FUNC_GPIO 0x6400
-#define STM32H7_PG4_FUNC_TIM1_BKIN2 0x6402
-#define STM32H7_PG4_FUNC_TIM1_BKIN2_COMP12 0x640c
-#define STM32H7_PG4_FUNC_FMC_A14_FMC_BA0 0x640d
-#define STM32H7_PG4_FUNC_EVENTOUT 0x6410
-#define STM32H7_PG4_FUNC_ANALOG 0x6411
-
-#define STM32H7_PG5_FUNC_GPIO 0x6500
-#define STM32H7_PG5_FUNC_TIM1_ETR 0x6502
-#define STM32H7_PG5_FUNC_FMC_A15_FMC_BA1 0x650d
-#define STM32H7_PG5_FUNC_EVENTOUT 0x6510
-#define STM32H7_PG5_FUNC_ANALOG 0x6511
-
-#define STM32H7_PG6_FUNC_GPIO 0x6600
-#define STM32H7_PG6_FUNC_TIM17_BKIN 0x6602
-#define STM32H7_PG6_FUNC_HRTIM_CHE1 0x6603
-#define STM32H7_PG6_FUNC_QUADSPI_BK1_NCS 0x660b
-#define STM32H7_PG6_FUNC_FMC_NE3 0x660d
-#define STM32H7_PG6_FUNC_DCMI_D12 0x660e
-#define STM32H7_PG6_FUNC_LCD_R7 0x660f
-#define STM32H7_PG6_FUNC_EVENTOUT 0x6610
-#define STM32H7_PG6_FUNC_ANALOG 0x6611
-
-#define STM32H7_PG7_FUNC_GPIO 0x6700
-#define STM32H7_PG7_FUNC_HRTIM_CHE2 0x6703
-#define STM32H7_PG7_FUNC_SAI1_MCLK_A 0x6707
-#define STM32H7_PG7_FUNC_USART6_CK 0x6708
-#define STM32H7_PG7_FUNC_FMC_INT 0x670d
-#define STM32H7_PG7_FUNC_DCMI_D13 0x670e
-#define STM32H7_PG7_FUNC_LCD_CLK 0x670f
-#define STM32H7_PG7_FUNC_EVENTOUT 0x6710
-#define STM32H7_PG7_FUNC_ANALOG 0x6711
-
-#define STM32H7_PG8_FUNC_GPIO 0x6800
-#define STM32H7_PG8_FUNC_TIM8_ETR 0x6804
-#define STM32H7_PG8_FUNC_SPI6_NSS 0x6806
-#define STM32H7_PG8_FUNC_USART6_RTS 0x6808
-#define STM32H7_PG8_FUNC_SPDIFRX_IN2 0x6809
-#define STM32H7_PG8_FUNC_ETH_PPS_OUT 0x680c
-#define STM32H7_PG8_FUNC_FMC_SDCLK 0x680d
-#define STM32H7_PG8_FUNC_LCD_G7 0x680f
-#define STM32H7_PG8_FUNC_EVENTOUT 0x6810
-#define STM32H7_PG8_FUNC_ANALOG 0x6811
-
-#define STM32H7_PG9_FUNC_GPIO 0x6900
-#define STM32H7_PG9_FUNC_SPI1_MISO_I2S1_SDI 0x6906
-#define STM32H7_PG9_FUNC_USART6_RX 0x6908
-#define STM32H7_PG9_FUNC_SPDIFRX_IN3 0x6909
-#define STM32H7_PG9_FUNC_QUADSPI_BK2_IO2 0x690a
-#define STM32H7_PG9_FUNC_SAI2_FS_B 0x690b
-#define STM32H7_PG9_FUNC_FMC_NE2_FMC_NCE 0x690d
-#define STM32H7_PG9_FUNC_DCMI_VSYNC 0x690e
-#define STM32H7_PG9_FUNC_EVENTOUT 0x6910
-#define STM32H7_PG9_FUNC_ANALOG 0x6911
-
-#define STM32H7_PG10_FUNC_GPIO 0x6a00
-#define STM32H7_PG10_FUNC_HRTIM_FLT5 0x6a03
-#define STM32H7_PG10_FUNC_SPI1_NSS_I2S1_WS 0x6a06
-#define STM32H7_PG10_FUNC_LCD_G3 0x6a0a
-#define STM32H7_PG10_FUNC_SAI2_SD_B 0x6a0b
-#define STM32H7_PG10_FUNC_FMC_NE3 0x6a0d
-#define STM32H7_PG10_FUNC_DCMI_D2 0x6a0e
-#define STM32H7_PG10_FUNC_LCD_B2 0x6a0f
-#define STM32H7_PG10_FUNC_EVENTOUT 0x6a10
-#define STM32H7_PG10_FUNC_ANALOG 0x6a11
-
-#define STM32H7_PG11_FUNC_GPIO 0x6b00
-#define STM32H7_PG11_FUNC_HRTIM_EEV4 0x6b03
-#define STM32H7_PG11_FUNC_SPI1_SCK_I2S1_CK 0x6b06
-#define STM32H7_PG11_FUNC_SPDIFRX_IN0 0x6b09
-#define STM32H7_PG11_FUNC_SDMMC2_D2 0x6b0b
-#define STM32H7_PG11_FUNC_ETH_MII_TX_EN_ETH_RMII_TX_EN 0x6b0c
-#define STM32H7_PG11_FUNC_DCMI_D3 0x6b0e
-#define STM32H7_PG11_FUNC_LCD_B3 0x6b0f
-#define STM32H7_PG11_FUNC_EVENTOUT 0x6b10
-#define STM32H7_PG11_FUNC_ANALOG 0x6b11
-
-#define STM32H7_PG12_FUNC_GPIO 0x6c00
-#define STM32H7_PG12_FUNC_LPTIM1_IN1 0x6c02
-#define STM32H7_PG12_FUNC_HRTIM_EEV5 0x6c03
-#define STM32H7_PG12_FUNC_SPI6_MISO 0x6c06
-#define STM32H7_PG12_FUNC_USART6_RTS 0x6c08
-#define STM32H7_PG12_FUNC_SPDIFRX_IN1 0x6c09
-#define STM32H7_PG12_FUNC_LCD_B4 0x6c0a
-#define STM32H7_PG12_FUNC_ETH_MII_TXD1_ETH_RMII_TXD1 0x6c0c
-#define STM32H7_PG12_FUNC_FMC_NE4 0x6c0d
-#define STM32H7_PG12_FUNC_LCD_B1 0x6c0f
-#define STM32H7_PG12_FUNC_EVENTOUT 0x6c10
-#define STM32H7_PG12_FUNC_ANALOG 0x6c11
-
-#define STM32H7_PG13_FUNC_GPIO 0x6d00
-#define STM32H7_PG13_FUNC_TRACED0 0x6d01
-#define STM32H7_PG13_FUNC_LPTIM1_OUT 0x6d02
-#define STM32H7_PG13_FUNC_HRTIM_EEV10 0x6d03
-#define STM32H7_PG13_FUNC_SPI6_SCK 0x6d06
-#define STM32H7_PG13_FUNC_USART6_CTS_NSS 0x6d08
-#define STM32H7_PG13_FUNC_ETH_MII_TXD0_ETH_RMII_TXD0 0x6d0c
-#define STM32H7_PG13_FUNC_FMC_A24 0x6d0d
-#define STM32H7_PG13_FUNC_LCD_R0 0x6d0f
-#define STM32H7_PG13_FUNC_EVENTOUT 0x6d10
-#define STM32H7_PG13_FUNC_ANALOG 0x6d11
-
-#define STM32H7_PG14_FUNC_GPIO 0x6e00
-#define STM32H7_PG14_FUNC_TRACED1 0x6e01
-#define STM32H7_PG14_FUNC_LPTIM1_ETR 0x6e02
-#define STM32H7_PG14_FUNC_SPI6_MOSI 0x6e06
-#define STM32H7_PG14_FUNC_USART6_TX 0x6e08
-#define STM32H7_PG14_FUNC_QUADSPI_BK2_IO3 0x6e0a
-#define STM32H7_PG14_FUNC_ETH_MII_TXD1_ETH_RMII_TXD1 0x6e0c
-#define STM32H7_PG14_FUNC_FMC_A25 0x6e0d
-#define STM32H7_PG14_FUNC_LCD_B0 0x6e0f
-#define STM32H7_PG14_FUNC_EVENTOUT 0x6e10
-#define STM32H7_PG14_FUNC_ANALOG 0x6e11
-
-#define STM32H7_PG15_FUNC_GPIO 0x6f00
-#define STM32H7_PG15_FUNC_USART6_CTS_NSS 0x6f08
-#define STM32H7_PG15_FUNC_FMC_SDNCAS 0x6f0d
-#define STM32H7_PG15_FUNC_DCMI_D13 0x6f0e
-#define STM32H7_PG15_FUNC_EVENTOUT 0x6f10
-#define STM32H7_PG15_FUNC_ANALOG 0x6f11
-
-#define STM32H7_PH0_FUNC_GPIO 0x7000
-#define STM32H7_PH0_FUNC_EVENTOUT 0x7010
-#define STM32H7_PH0_FUNC_ANALOG 0x7011
-
-#define STM32H7_PH1_FUNC_GPIO 0x7100
-#define STM32H7_PH1_FUNC_EVENTOUT 0x7110
-#define STM32H7_PH1_FUNC_ANALOG 0x7111
-
-#define STM32H7_PH2_FUNC_GPIO 0x7200
-#define STM32H7_PH2_FUNC_LPTIM1_IN2 0x7202
-#define STM32H7_PH2_FUNC_QUADSPI_BK2_IO0 0x720a
-#define STM32H7_PH2_FUNC_SAI2_SCK_B 0x720b
-#define STM32H7_PH2_FUNC_ETH_MII_CRS 0x720c
-#define STM32H7_PH2_FUNC_FMC_SDCKE0 0x720d
-#define STM32H7_PH2_FUNC_LCD_R0 0x720f
-#define STM32H7_PH2_FUNC_EVENTOUT 0x7210
-#define STM32H7_PH2_FUNC_ANALOG 0x7211
-
-#define STM32H7_PH3_FUNC_GPIO 0x7300
-#define STM32H7_PH3_FUNC_QUADSPI_BK2_IO1 0x730a
-#define STM32H7_PH3_FUNC_SAI2_MCK_B 0x730b
-#define STM32H7_PH3_FUNC_ETH_MII_COL 0x730c
-#define STM32H7_PH3_FUNC_FMC_SDNE0 0x730d
-#define STM32H7_PH3_FUNC_LCD_R1 0x730f
-#define STM32H7_PH3_FUNC_EVENTOUT 0x7310
-#define STM32H7_PH3_FUNC_ANALOG 0x7311
-
-#define STM32H7_PH4_FUNC_GPIO 0x7400
-#define STM32H7_PH4_FUNC_I2C2_SCL 0x7405
-#define STM32H7_PH4_FUNC_LCD_G5 0x740a
-#define STM32H7_PH4_FUNC_OTG_HS_ULPI_NXT 0x740b
-#define STM32H7_PH4_FUNC_LCD_G4 0x740f
-#define STM32H7_PH4_FUNC_EVENTOUT 0x7410
-#define STM32H7_PH4_FUNC_ANALOG 0x7411
-
-#define STM32H7_PH5_FUNC_GPIO 0x7500
-#define STM32H7_PH5_FUNC_I2C2_SDA 0x7505
-#define STM32H7_PH5_FUNC_SPI5_NSS 0x7506
-#define STM32H7_PH5_FUNC_FMC_SDNWE 0x750d
-#define STM32H7_PH5_FUNC_EVENTOUT 0x7510
-#define STM32H7_PH5_FUNC_ANALOG 0x7511
-
-#define STM32H7_PH6_FUNC_GPIO 0x7600
-#define STM32H7_PH6_FUNC_I2C2_SMBA 0x7605
-#define STM32H7_PH6_FUNC_SPI5_SCK 0x7606
-#define STM32H7_PH6_FUNC_ETH_MII_RXD2 0x760c
-#define STM32H7_PH6_FUNC_FMC_SDNE1 0x760d
-#define STM32H7_PH6_FUNC_DCMI_D8 0x760e
-#define STM32H7_PH6_FUNC_EVENTOUT 0x7610
-#define STM32H7_PH6_FUNC_ANALOG 0x7611
-
-#define STM32H7_PH7_FUNC_GPIO 0x7700
-#define STM32H7_PH7_FUNC_I2C3_SCL 0x7705
-#define STM32H7_PH7_FUNC_SPI5_MISO 0x7706
-#define STM32H7_PH7_FUNC_ETH_MII_RXD3 0x770c
-#define STM32H7_PH7_FUNC_FMC_SDCKE1 0x770d
-#define STM32H7_PH7_FUNC_DCMI_D9 0x770e
-#define STM32H7_PH7_FUNC_EVENTOUT 0x7710
-#define STM32H7_PH7_FUNC_ANALOG 0x7711
-
-#define STM32H7_PH8_FUNC_GPIO 0x7800
-#define STM32H7_PH8_FUNC_TIM5_ETR 0x7803
-#define STM32H7_PH8_FUNC_I2C3_SDA 0x7805
-#define STM32H7_PH8_FUNC_FMC_D16 0x780d
-#define STM32H7_PH8_FUNC_DCMI_HSYNC 0x780e
-#define STM32H7_PH8_FUNC_LCD_R2 0x780f
-#define STM32H7_PH8_FUNC_EVENTOUT 0x7810
-#define STM32H7_PH8_FUNC_ANALOG 0x7811
-
-#define STM32H7_PH9_FUNC_GPIO 0x7900
-#define STM32H7_PH9_FUNC_I2C3_SMBA 0x7905
-#define STM32H7_PH9_FUNC_FMC_D17 0x790d
-#define STM32H7_PH9_FUNC_DCMI_D0 0x790e
-#define STM32H7_PH9_FUNC_LCD_R3 0x790f
-#define STM32H7_PH9_FUNC_EVENTOUT 0x7910
-#define STM32H7_PH9_FUNC_ANALOG 0x7911
-
-#define STM32H7_PH10_FUNC_GPIO 0x7a00
-#define STM32H7_PH10_FUNC_TIM5_CH1 0x7a03
-#define STM32H7_PH10_FUNC_I2C4_SMBA 0x7a05
-#define STM32H7_PH10_FUNC_FMC_D18 0x7a0d
-#define STM32H7_PH10_FUNC_DCMI_D1 0x7a0e
-#define STM32H7_PH10_FUNC_LCD_R4 0x7a0f
-#define STM32H7_PH10_FUNC_EVENTOUT 0x7a10
-#define STM32H7_PH10_FUNC_ANALOG 0x7a11
-
-#define STM32H7_PH11_FUNC_GPIO 0x7b00
-#define STM32H7_PH11_FUNC_TIM5_CH2 0x7b03
-#define STM32H7_PH11_FUNC_I2C4_SCL 0x7b05
-#define STM32H7_PH11_FUNC_FMC_D19 0x7b0d
-#define STM32H7_PH11_FUNC_DCMI_D2 0x7b0e
-#define STM32H7_PH11_FUNC_LCD_R5 0x7b0f
-#define STM32H7_PH11_FUNC_EVENTOUT 0x7b10
-#define STM32H7_PH11_FUNC_ANALOG 0x7b11
-
-#define STM32H7_PH12_FUNC_GPIO 0x7c00
-#define STM32H7_PH12_FUNC_TIM5_CH3 0x7c03
-#define STM32H7_PH12_FUNC_I2C4_SDA 0x7c05
-#define STM32H7_PH12_FUNC_FMC_D20 0x7c0d
-#define STM32H7_PH12_FUNC_DCMI_D3 0x7c0e
-#define STM32H7_PH12_FUNC_LCD_R6 0x7c0f
-#define STM32H7_PH12_FUNC_EVENTOUT 0x7c10
-#define STM32H7_PH12_FUNC_ANALOG 0x7c11
-
-#define STM32H7_PH13_FUNC_GPIO 0x7d00
-#define STM32H7_PH13_FUNC_TIM8_CH1N 0x7d04
-#define STM32H7_PH13_FUNC_UART4_TX 0x7d09
-#define STM32H7_PH13_FUNC_CAN1_TX 0x7d0a
-#define STM32H7_PH13_FUNC_FMC_D21 0x7d0d
-#define STM32H7_PH13_FUNC_LCD_G2 0x7d0f
-#define STM32H7_PH13_FUNC_EVENTOUT 0x7d10
-#define STM32H7_PH13_FUNC_ANALOG 0x7d11
-
-#define STM32H7_PH14_FUNC_GPIO 0x7e00
-#define STM32H7_PH14_FUNC_TIM8_CH2N 0x7e04
-#define STM32H7_PH14_FUNC_UART4_RX 0x7e09
-#define STM32H7_PH14_FUNC_CAN1_RX 0x7e0a
-#define STM32H7_PH14_FUNC_FMC_D22 0x7e0d
-#define STM32H7_PH14_FUNC_DCMI_D4 0x7e0e
-#define STM32H7_PH14_FUNC_LCD_G3 0x7e0f
-#define STM32H7_PH14_FUNC_EVENTOUT 0x7e10
-#define STM32H7_PH14_FUNC_ANALOG 0x7e11
-
-#define STM32H7_PH15_FUNC_GPIO 0x7f00
-#define STM32H7_PH15_FUNC_TIM8_CH3N 0x7f04
-#define STM32H7_PH15_FUNC_CAN1_TXFD 0x7f0a
-#define STM32H7_PH15_FUNC_FMC_D23 0x7f0d
-#define STM32H7_PH15_FUNC_DCMI_D11 0x7f0e
-#define STM32H7_PH15_FUNC_LCD_G4 0x7f0f
-#define STM32H7_PH15_FUNC_EVENTOUT 0x7f10
-#define STM32H7_PH15_FUNC_ANALOG 0x7f11
-
-#define STM32H7_PI0_FUNC_GPIO 0x8000
-#define STM32H7_PI0_FUNC_TIM5_CH4 0x8003
-#define STM32H7_PI0_FUNC_SPI2_NSS_I2S2_WS 0x8006
-#define STM32H7_PI0_FUNC_CAN1_RXFD 0x800a
-#define STM32H7_PI0_FUNC_FMC_D24 0x800d
-#define STM32H7_PI0_FUNC_DCMI_D13 0x800e
-#define STM32H7_PI0_FUNC_LCD_G5 0x800f
-#define STM32H7_PI0_FUNC_EVENTOUT 0x8010
-#define STM32H7_PI0_FUNC_ANALOG 0x8011
-
-#define STM32H7_PI1_FUNC_GPIO 0x8100
-#define STM32H7_PI1_FUNC_TIM8_BKIN2 0x8104
-#define STM32H7_PI1_FUNC_SPI2_SCK_I2S2_CK 0x8106
-#define STM32H7_PI1_FUNC_TIM8_BKIN2_COMP12 0x810c
-#define STM32H7_PI1_FUNC_FMC_D25 0x810d
-#define STM32H7_PI1_FUNC_DCMI_D8 0x810e
-#define STM32H7_PI1_FUNC_LCD_G6 0x810f
-#define STM32H7_PI1_FUNC_EVENTOUT 0x8110
-#define STM32H7_PI1_FUNC_ANALOG 0x8111
-
-#define STM32H7_PI2_FUNC_GPIO 0x8200
-#define STM32H7_PI2_FUNC_TIM8_CH4 0x8204
-#define STM32H7_PI2_FUNC_SPI2_MISO_I2S2_SDI 0x8206
-#define STM32H7_PI2_FUNC_FMC_D26 0x820d
-#define STM32H7_PI2_FUNC_DCMI_D9 0x820e
-#define STM32H7_PI2_FUNC_LCD_G7 0x820f
-#define STM32H7_PI2_FUNC_EVENTOUT 0x8210
-#define STM32H7_PI2_FUNC_ANALOG 0x8211
-
-#define STM32H7_PI3_FUNC_GPIO 0x8300
-#define STM32H7_PI3_FUNC_TIM8_ETR 0x8304
-#define STM32H7_PI3_FUNC_SPI2_MOSI_I2S2_SDO 0x8306
-#define STM32H7_PI3_FUNC_FMC_D27 0x830d
-#define STM32H7_PI3_FUNC_DCMI_D10 0x830e
-#define STM32H7_PI3_FUNC_EVENTOUT 0x8310
-#define STM32H7_PI3_FUNC_ANALOG 0x8311
-
-#define STM32H7_PI4_FUNC_GPIO 0x8400
-#define STM32H7_PI4_FUNC_TIM8_BKIN 0x8404
-#define STM32H7_PI4_FUNC_SAI2_MCK_A 0x840b
-#define STM32H7_PI4_FUNC_TIM8_BKIN_COMP12 0x840c
-#define STM32H7_PI4_FUNC_FMC_NBL2 0x840d
-#define STM32H7_PI4_FUNC_DCMI_D5 0x840e
-#define STM32H7_PI4_FUNC_LCD_B4 0x840f
-#define STM32H7_PI4_FUNC_EVENTOUT 0x8410
-#define STM32H7_PI4_FUNC_ANALOG 0x8411
-
-#define STM32H7_PI5_FUNC_GPIO 0x8500
-#define STM32H7_PI5_FUNC_TIM8_CH1 0x8504
-#define STM32H7_PI5_FUNC_SAI2_SCK_A 0x850b
-#define STM32H7_PI5_FUNC_FMC_NBL3 0x850d
-#define STM32H7_PI5_FUNC_DCMI_VSYNC 0x850e
-#define STM32H7_PI5_FUNC_LCD_B5 0x850f
-#define STM32H7_PI5_FUNC_EVENTOUT 0x8510
-#define STM32H7_PI5_FUNC_ANALOG 0x8511
-
-#define STM32H7_PI6_FUNC_GPIO 0x8600
-#define STM32H7_PI6_FUNC_TIM8_CH2 0x8604
-#define STM32H7_PI6_FUNC_SAI2_SD_A 0x860b
-#define STM32H7_PI6_FUNC_FMC_D28 0x860d
-#define STM32H7_PI6_FUNC_DCMI_D6 0x860e
-#define STM32H7_PI6_FUNC_LCD_B6 0x860f
-#define STM32H7_PI6_FUNC_EVENTOUT 0x8610
-#define STM32H7_PI6_FUNC_ANALOG 0x8611
-
-#define STM32H7_PI7_FUNC_GPIO 0x8700
-#define STM32H7_PI7_FUNC_TIM8_CH3 0x8704
-#define STM32H7_PI7_FUNC_SAI2_FS_A 0x870b
-#define STM32H7_PI7_FUNC_FMC_D29 0x870d
-#define STM32H7_PI7_FUNC_DCMI_D7 0x870e
-#define STM32H7_PI7_FUNC_LCD_B7 0x870f
-#define STM32H7_PI7_FUNC_EVENTOUT 0x8710
-#define STM32H7_PI7_FUNC_ANALOG 0x8711
-
-#define STM32H7_PI8_FUNC_GPIO 0x8800
-#define STM32H7_PI8_FUNC_EVENTOUT 0x8810
-#define STM32H7_PI8_FUNC_ANALOG 0x8811
-
-#define STM32H7_PI9_FUNC_GPIO 0x8900
-#define STM32H7_PI9_FUNC_UART4_RX 0x8909
-#define STM32H7_PI9_FUNC_CAN1_RX 0x890a
-#define STM32H7_PI9_FUNC_FMC_D30 0x890d
-#define STM32H7_PI9_FUNC_LCD_VSYNC 0x890f
-#define STM32H7_PI9_FUNC_EVENTOUT 0x8910
-#define STM32H7_PI9_FUNC_ANALOG 0x8911
-
-#define STM32H7_PI10_FUNC_GPIO 0x8a00
-#define STM32H7_PI10_FUNC_CAN1_RXFD 0x8a0a
-#define STM32H7_PI10_FUNC_ETH_MII_RX_ER 0x8a0c
-#define STM32H7_PI10_FUNC_FMC_D31 0x8a0d
-#define STM32H7_PI10_FUNC_LCD_HSYNC 0x8a0f
-#define STM32H7_PI10_FUNC_EVENTOUT 0x8a10
-#define STM32H7_PI10_FUNC_ANALOG 0x8a11
-
-#define STM32H7_PI11_FUNC_GPIO 0x8b00
-#define STM32H7_PI11_FUNC_LCD_G6 0x8b0a
-#define STM32H7_PI11_FUNC_OTG_HS_ULPI_DIR 0x8b0b
-#define STM32H7_PI11_FUNC_EVENTOUT 0x8b10
-#define STM32H7_PI11_FUNC_ANALOG 0x8b11
-
-#define STM32H7_PI12_FUNC_GPIO 0x8c00
-#define STM32H7_PI12_FUNC_ETH_TX_ER 0x8c0c
-#define STM32H7_PI12_FUNC_LCD_HSYNC 0x8c0f
-#define STM32H7_PI12_FUNC_EVENTOUT 0x8c10
-#define STM32H7_PI12_FUNC_ANALOG 0x8c11
-
-#define STM32H7_PI13_FUNC_GPIO 0x8d00
-#define STM32H7_PI13_FUNC_LCD_VSYNC 0x8d0f
-#define STM32H7_PI13_FUNC_EVENTOUT 0x8d10
-#define STM32H7_PI13_FUNC_ANALOG 0x8d11
-
-#define STM32H7_PI14_FUNC_GPIO 0x8e00
-#define STM32H7_PI14_FUNC_LCD_CLK 0x8e0f
-#define STM32H7_PI14_FUNC_EVENTOUT 0x8e10
-#define STM32H7_PI14_FUNC_ANALOG 0x8e11
-
-#define STM32H7_PI15_FUNC_GPIO 0x8f00
-#define STM32H7_PI15_FUNC_LCD_G2 0x8f0a
-#define STM32H7_PI15_FUNC_LCD_R0 0x8f0f
-#define STM32H7_PI15_FUNC_EVENTOUT 0x8f10
-#define STM32H7_PI15_FUNC_ANALOG 0x8f11
-
-#define STM32H7_PJ0_FUNC_GPIO 0x9000
-#define STM32H7_PJ0_FUNC_LCD_R7 0x900a
-#define STM32H7_PJ0_FUNC_LCD_R1 0x900f
-#define STM32H7_PJ0_FUNC_EVENTOUT 0x9010
-#define STM32H7_PJ0_FUNC_ANALOG 0x9011
-
-#define STM32H7_PJ1_FUNC_GPIO 0x9100
-#define STM32H7_PJ1_FUNC_LCD_R2 0x910f
-#define STM32H7_PJ1_FUNC_EVENTOUT 0x9110
-#define STM32H7_PJ1_FUNC_ANALOG 0x9111
-
-#define STM32H7_PJ2_FUNC_GPIO 0x9200
-#define STM32H7_PJ2_FUNC_DSI_TE 0x920e
-#define STM32H7_PJ2_FUNC_LCD_R3 0x920f
-#define STM32H7_PJ2_FUNC_EVENTOUT 0x9210
-#define STM32H7_PJ2_FUNC_ANALOG 0x9211
-
-#define STM32H7_PJ3_FUNC_GPIO 0x9300
-#define STM32H7_PJ3_FUNC_LCD_R4 0x930f
-#define STM32H7_PJ3_FUNC_EVENTOUT 0x9310
-#define STM32H7_PJ3_FUNC_ANALOG 0x9311
-
-#define STM32H7_PJ4_FUNC_GPIO 0x9400
-#define STM32H7_PJ4_FUNC_LCD_R5 0x940f
-#define STM32H7_PJ4_FUNC_EVENTOUT 0x9410
-#define STM32H7_PJ4_FUNC_ANALOG 0x9411
-
-#define STM32H7_PJ5_FUNC_GPIO 0x9500
-#define STM32H7_PJ5_FUNC_LCD_R6 0x950f
-#define STM32H7_PJ5_FUNC_EVENTOUT 0x9510
-#define STM32H7_PJ5_FUNC_ANALOG 0x9511
-
-#define STM32H7_PJ6_FUNC_GPIO 0x9600
-#define STM32H7_PJ6_FUNC_TIM8_CH2 0x9604
-#define STM32H7_PJ6_FUNC_LCD_R7 0x960f
-#define STM32H7_PJ6_FUNC_EVENTOUT 0x9610
-#define STM32H7_PJ6_FUNC_ANALOG 0x9611
-
-#define STM32H7_PJ7_FUNC_GPIO 0x9700
-#define STM32H7_PJ7_FUNC_TRGIN 0x9701
-#define STM32H7_PJ7_FUNC_TIM8_CH2N 0x9704
-#define STM32H7_PJ7_FUNC_LCD_G0 0x970f
-#define STM32H7_PJ7_FUNC_EVENTOUT 0x9710
-#define STM32H7_PJ7_FUNC_ANALOG 0x9711
-
-#define STM32H7_PJ8_FUNC_GPIO 0x9800
-#define STM32H7_PJ8_FUNC_TIM1_CH3N 0x9802
-#define STM32H7_PJ8_FUNC_TIM8_CH1 0x9804
-#define STM32H7_PJ8_FUNC_UART8_TX 0x9809
-#define STM32H7_PJ8_FUNC_LCD_G1 0x980f
-#define STM32H7_PJ8_FUNC_EVENTOUT 0x9810
-#define STM32H7_PJ8_FUNC_ANALOG 0x9811
-
-#define STM32H7_PJ9_FUNC_GPIO 0x9900
-#define STM32H7_PJ9_FUNC_TIM1_CH3 0x9902
-#define STM32H7_PJ9_FUNC_TIM8_CH1N 0x9904
-#define STM32H7_PJ9_FUNC_UART8_RX 0x9909
-#define STM32H7_PJ9_FUNC_LCD_G2 0x990f
-#define STM32H7_PJ9_FUNC_EVENTOUT 0x9910
-#define STM32H7_PJ9_FUNC_ANALOG 0x9911
-
-#define STM32H7_PJ10_FUNC_GPIO 0x9a00
-#define STM32H7_PJ10_FUNC_TIM1_CH2N 0x9a02
-#define STM32H7_PJ10_FUNC_TIM8_CH2 0x9a04
-#define STM32H7_PJ10_FUNC_SPI5_MOSI 0x9a06
-#define STM32H7_PJ10_FUNC_LCD_G3 0x9a0f
-#define STM32H7_PJ10_FUNC_EVENTOUT 0x9a10
-#define STM32H7_PJ10_FUNC_ANALOG 0x9a11
-
-#define STM32H7_PJ11_FUNC_GPIO 0x9b00
-#define STM32H7_PJ11_FUNC_TIM1_CH2 0x9b02
-#define STM32H7_PJ11_FUNC_TIM8_CH2N 0x9b04
-#define STM32H7_PJ11_FUNC_SPI5_MISO 0x9b06
-#define STM32H7_PJ11_FUNC_LCD_G4 0x9b0f
-#define STM32H7_PJ11_FUNC_EVENTOUT 0x9b10
-#define STM32H7_PJ11_FUNC_ANALOG 0x9b11
-
-#define STM32H7_PJ12_FUNC_GPIO 0x9c00
-#define STM32H7_PJ12_FUNC_TRGOUT 0x9c01
-#define STM32H7_PJ12_FUNC_LCD_G3 0x9c0a
-#define STM32H7_PJ12_FUNC_LCD_B0 0x9c0f
-#define STM32H7_PJ12_FUNC_EVENTOUT 0x9c10
-#define STM32H7_PJ12_FUNC_ANALOG 0x9c11
-
-#define STM32H7_PJ13_FUNC_GPIO 0x9d00
-#define STM32H7_PJ13_FUNC_LCD_B4 0x9d0a
-#define STM32H7_PJ13_FUNC_LCD_B1 0x9d0f
-#define STM32H7_PJ13_FUNC_EVENTOUT 0x9d10
-#define STM32H7_PJ13_FUNC_ANALOG 0x9d11
-
-#define STM32H7_PJ14_FUNC_GPIO 0x9e00
-#define STM32H7_PJ14_FUNC_LCD_B2 0x9e0f
-#define STM32H7_PJ14_FUNC_EVENTOUT 0x9e10
-#define STM32H7_PJ14_FUNC_ANALOG 0x9e11
-
-#define STM32H7_PJ15_FUNC_GPIO 0x9f00
-#define STM32H7_PJ15_FUNC_LCD_B3 0x9f0f
-#define STM32H7_PJ15_FUNC_EVENTOUT 0x9f10
-#define STM32H7_PJ15_FUNC_ANALOG 0x9f11
-
-#define STM32H7_PK0_FUNC_GPIO 0xa000
-#define STM32H7_PK0_FUNC_TIM1_CH1N 0xa002
-#define STM32H7_PK0_FUNC_TIM8_CH3 0xa004
-#define STM32H7_PK0_FUNC_SPI5_SCK 0xa006
-#define STM32H7_PK0_FUNC_LCD_G5 0xa00f
-#define STM32H7_PK0_FUNC_EVENTOUT 0xa010
-#define STM32H7_PK0_FUNC_ANALOG 0xa011
-
-#define STM32H7_PK1_FUNC_GPIO 0xa100
-#define STM32H7_PK1_FUNC_TIM1_CH1 0xa102
-#define STM32H7_PK1_FUNC_TIM8_CH3N 0xa104
-#define STM32H7_PK1_FUNC_SPI5_NSS 0xa106
-#define STM32H7_PK1_FUNC_LCD_G6 0xa10f
-#define STM32H7_PK1_FUNC_EVENTOUT 0xa110
-#define STM32H7_PK1_FUNC_ANALOG 0xa111
-
-#define STM32H7_PK2_FUNC_GPIO 0xa200
-#define STM32H7_PK2_FUNC_TIM1_BKIN 0xa202
-#define STM32H7_PK2_FUNC_TIM8_BKIN 0xa204
-#define STM32H7_PK2_FUNC_TIM8_BKIN_COMP12 0xa20b
-#define STM32H7_PK2_FUNC_TIM1_BKIN_COMP12 0xa20c
-#define STM32H7_PK2_FUNC_LCD_G7 0xa20f
-#define STM32H7_PK2_FUNC_EVENTOUT 0xa210
-#define STM32H7_PK2_FUNC_ANALOG 0xa211
-
-#define STM32H7_PK3_FUNC_GPIO 0xa300
-#define STM32H7_PK3_FUNC_LCD_B4 0xa30f
-#define STM32H7_PK3_FUNC_EVENTOUT 0xa310
-#define STM32H7_PK3_FUNC_ANALOG 0xa311
-
-#define STM32H7_PK4_FUNC_GPIO 0xa400
-#define STM32H7_PK4_FUNC_LCD_B5 0xa40f
-#define STM32H7_PK4_FUNC_EVENTOUT 0xa410
-#define STM32H7_PK4_FUNC_ANALOG 0xa411
-
-#define STM32H7_PK5_FUNC_GPIO 0xa500
-#define STM32H7_PK5_FUNC_LCD_B6 0xa50f
-#define STM32H7_PK5_FUNC_EVENTOUT 0xa510
-#define STM32H7_PK5_FUNC_ANALOG 0xa511
-
-#define STM32H7_PK6_FUNC_GPIO 0xa600
-#define STM32H7_PK6_FUNC_LCD_B7 0xa60f
-#define STM32H7_PK6_FUNC_EVENTOUT 0xa610
-#define STM32H7_PK6_FUNC_ANALOG 0xa611
-
-#define STM32H7_PK7_FUNC_GPIO 0xa700
-#define STM32H7_PK7_FUNC_LCD_DE 0xa70f
-#define STM32H7_PK7_FUNC_EVENTOUT 0xa710
-#define STM32H7_PK7_FUNC_ANALOG 0xa711
-
-#endif /* _DT_BINDINGS_STM32H7_PINFUNC_H */
diff --git a/include/dt-bindings/reset/amlogic,meson-g12a-reset.h b/include/dt-bindings/reset/amlogic,meson-g12a-reset.h
new file mode 100644 (file)
index 0000000..8063e83
--- /dev/null
@@ -0,0 +1,134 @@
+/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */
+/*
+ * Copyright (c) 2019 BayLibre, SAS.
+ * Author: Jerome Brunet <jbrunet@baylibre.com>
+ *
+ */
+
+#ifndef _DT_BINDINGS_AMLOGIC_MESON_G12A_RESET_H
+#define _DT_BINDINGS_AMLOGIC_MESON_G12A_RESET_H
+
+/*     RESET0                                  */
+#define RESET_HIU                      0
+/*                                     1       */
+#define RESET_DOS                      2
+/*                                     3-4     */
+#define RESET_VIU                      5
+#define RESET_AFIFO                    6
+#define RESET_VID_PLL_DIV              7
+/*                                     8-9     */
+#define RESET_VENC                     10
+#define RESET_ASSIST                   11
+#define RESET_PCIE_CTRL_A              12
+#define RESET_VCBUS                    13
+#define RESET_PCIE_PHY                 14
+#define RESET_PCIE_APB                 15
+#define RESET_GIC                      16
+#define RESET_CAPB3_DECODE             17
+/*                                     18      */
+#define RESET_HDMITX_CAPB3             19
+#define RESET_DVALIN_CAPB3             20
+#define RESET_DOS_CAPB3                        21
+/*                                     22      */
+#define RESET_CBUS_CAPB3               23
+#define RESET_AHB_CNTL                 24
+#define RESET_AHB_DATA                 25
+#define RESET_VCBUS_CLK81              26
+/*                                     27-31   */
+/*     RESET1                                  */
+/*                                     32      */
+#define RESET_DEMUX                    33
+#define RESET_USB                      34
+#define RESET_DDR                      35
+/*                                     36      */
+#define RESET_BT656                    37
+#define RESET_AHB_SRAM                 38
+/*                                     39      */
+#define RESET_PARSER                   40
+/*                                     41      */
+#define RESET_ISA                      42
+#define RESET_ETHERNET                 43
+#define RESET_SD_EMMC_A                        44
+#define RESET_SD_EMMC_B                        45
+#define RESET_SD_EMMC_C                        46
+/*                                     47-60 */
+#define RESET_AUDIO_CODEC              61
+/*                                     62-63   */
+/*     RESET2                                  */
+/*                                     64      */
+#define RESET_AUDIO                    65
+#define RESET_HDMITX_PHY               66
+/*                                     67      */
+#define RESET_MIPI_DSI_HOST            68
+#define RESET_ALOCKER                  69
+#define RESET_GE2D                     70
+#define RESET_PARSER_REG               71
+#define RESET_PARSER_FETCH             72
+#define RESET_CTL                      73
+#define RESET_PARSER_TOP               74
+/*                                     75-77   */
+#define RESET_DVALIN                   78
+#define RESET_HDMITX                   79
+/*                                     80-95   */
+/*     RESET3                                  */
+/*                                     96-95   */
+#define RESET_DEMUX_TOP                        105
+#define RESET_DEMUX_DES_PL             106
+#define RESET_DEMUX_S2P_0              107
+#define RESET_DEMUX_S2P_1              108
+#define RESET_DEMUX_0                  109
+#define RESET_DEMUX_1                  110
+#define RESET_DEMUX_2                  111
+/*                                     112-127 */
+/*     RESET4                                  */
+/*                                     128-129 */
+#define RESET_MIPI_DSI_PHY             130
+/*                                     131-132 */
+#define RESET_RDMA                     133
+#define RESET_VENCI                    134
+#define RESET_VENCP                    135
+/*                                     136     */
+#define RESET_VDAC                     137
+/*                                     138-139 */
+#define RESET_VDI6                     140
+#define RESET_VENCL                    141
+#define RESET_I2C_M1                   142
+#define RESET_I2C_M2                   143
+/*                                     144-159 */
+/*     RESET5                                  */
+/*                                     160-191 */
+/*     RESET6                                  */
+#define RESET_GEN                      192
+#define RESET_SPICC0                   193
+#define RESET_SC                       194
+#define RESET_SANA_3                   195
+#define RESET_I2C_M0                   196
+#define RESET_TS_PLL                   197
+#define RESET_SPICC1                   198
+#define RESET_STREAM                   199
+#define RESET_TS_CPU                   200
+#define RESET_UART0                    201
+#define RESET_UART1_2                  202
+#define RESET_ASYNC0                   203
+#define RESET_ASYNC1                   204
+#define RESET_SPIFC0                   205
+#define RESET_I2C_M3                   206
+/*                                     207-223 */
+/*     RESET7                                  */
+#define RESET_USB_DDR_0                        224
+#define RESET_USB_DDR_1                        225
+#define RESET_USB_DDR_2                        226
+#define RESET_USB_DDR_3                        227
+#define RESET_TS_GPU                   228
+#define RESET_DEVICE_MMC_ARB           229
+#define RESET_DVALIN_DMC_PIPL          230
+#define RESET_VID_LOCK                 231
+#define RESET_NIC_DMC_PIPL             232
+#define RESET_DMC_VPU_PIPL             233
+#define RESET_GE2D_DMC_PIPL            234
+#define RESET_HCODEC_DMC_PIPL          235
+#define RESET_WAVE420_DMC_PIPL         236
+#define RESET_HEVCF_DMC_PIPL           237
+/*                                     238-255 */
+
+#endif
diff --git a/include/dt-bindings/reset/g12a-aoclkc.h b/include/dt-bindings/reset/g12a-aoclkc.h
new file mode 100644 (file)
index 0000000..bd2e233
--- /dev/null
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
+/*
+ * Copyright (c) 2016 BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#ifndef DT_BINDINGS_RESET_AMLOGIC_MESON_G12A_AOCLK
+#define DT_BINDINGS_RESET_AMLOGIC_MESON_G12A_AOCLK
+
+#define RESET_AO_IR_IN         0
+#define RESET_AO_UART          1
+#define RESET_AO_I2C_M         2
+#define RESET_AO_I2C_S         3
+#define RESET_AO_SAR_ADC       4
+#define RESET_AO_UART2         5
+#define RESET_AO_IR_OUT                6
+
+#endif
index 3c9d20f8c0b6b518e4bb3ab20e0871729e59b280..5f415a99cc9002413ce10f821c273b35e4186c04 100644 (file)
@@ -168,6 +168,10 @@ enum efi_mem_type {
         * part of the processor.
         */
        EFI_PAL_CODE,
+       /*
+        * Non-volatile memory.
+        */
+       EFI_PERSISTENT_MEMORY_TYPE,
 
        EFI_MAX_MEMORY_TYPE,
        EFI_TABLE_END,  /* For efi_build_mem_table() */
index 5b0a10063548755167dafac24517c5dfe5f2161b..472160cb300c661d4d5a0c260f8592b2f40bef6a 100644 (file)
@@ -290,10 +290,6 @@ struct efi_runtime_services {
        EFI_GUID(0x8be4df61, 0x93ca, 0x11d2, 0xaa, 0x0d, \
                 0x00, 0xe0, 0x98, 0x03, 0x2b, 0x8c)
 
-#define LOADED_IMAGE_PROTOCOL_GUID \
-       EFI_GUID(0x5b1b31a1, 0x9562, 0x11d2, 0x8e, 0x3f, \
-                0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
-
 #define EFI_FDT_GUID \
        EFI_GUID(0xb1b621d5, 0xf19c, 0x41a5, \
                 0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0)
@@ -329,11 +325,11 @@ struct efi_system_table {
        struct efi_configuration_table *tables;
 };
 
-#define LOADED_IMAGE_GUID \
+#define EFI_LOADED_IMAGE_PROTOCOL_GUID \
        EFI_GUID(0x5b1b31a1, 0x9562, 0x11d2, \
                 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
 
-#define LOADED_IMAGE_DEVICE_PATH_GUID \
+#define EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID \
        EFI_GUID(0xbc62157e, 0x3e33, 0x4fec, \
                 0x99, 0x20, 0x2d, 0x3b, 0x36, 0xd7, 0x50, 0xdf)
 
@@ -355,7 +351,7 @@ struct efi_loaded_image {
        unsigned long unload;
 };
 
-#define DEVICE_PATH_GUID \
+#define EFI_DEVICE_PATH_PROTOCOL_GUID \
        EFI_GUID(0x09576e91, 0x6d3f, 0x11d2, \
                 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
 
@@ -478,7 +474,7 @@ struct efi_device_path_file_path {
        u16 str[];
 } __packed;
 
-#define BLOCK_IO_GUID \
+#define EFI_BLOCK_IO_PROTOCOL_GUID \
        EFI_GUID(0x964e5b21, 0x6459, 0x11d2, \
                 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
 
@@ -1123,7 +1119,7 @@ struct efi_hii_config_access_protocol {
                efi_browser_action_request_t *action_request);
 };
 
-#define EFI_GOP_GUID \
+#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \
        EFI_GUID(0x9042a9de, 0x23dc, 0x4a38, \
                 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a)
 
@@ -1175,7 +1171,7 @@ struct efi_gop {
        struct efi_gop_mode *mode;
 };
 
-#define EFI_SIMPLE_NETWORK_GUID \
+#define EFI_SIMPLE_NETWORK_PROTOCOL_GUID \
        EFI_GUID(0xa19832b9, 0xac25, 0x11d3, \
                 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)
 
@@ -1268,7 +1264,7 @@ struct efi_simple_network {
        struct efi_simple_network_mode *mode;
 };
 
-#define EFI_PXE_GUID \
+#define EFI_PXE_BASE_CODE_PROTOCOL_GUID \
        EFI_GUID(0x03c4e603, 0xac28, 0x11d3, \
                 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)
 
index f7bf7328271a9f4dd27444f44953d04b01b7dab6..39ed8a6fa592de197fc483dbfb034a16b9e1708a 100644 (file)
@@ -25,6 +25,9 @@
        EFI_GUID(0xe61d73b9, 0xa384, 0x4acc, \
                 0xae, 0xab, 0x82, 0xe8, 0x28, 0xf3, 0x62, 0x8b)
 
+/* Root node */
+extern efi_handle_t efi_root;
+
 int __efi_entry_check(void);
 int __efi_exit_check(void);
 const char *__efi_nesting(void);
@@ -409,8 +412,6 @@ efi_status_t efi_setup_loaded_image(struct efi_device_path *device_path,
                                    struct efi_device_path *file_path,
                                    struct efi_loaded_image_obj **handle_ptr,
                                    struct efi_loaded_image **info_ptr);
-efi_status_t efi_load_image_from_path(struct efi_device_path *file_path,
-                                     void **buffer, efi_uintn_t *size);
 /* Print information about all loaded images */
 void efi_print_image_infos(void *pc);
 
@@ -564,8 +565,7 @@ struct efi_load_option {
 
 void efi_deserialize_load_option(struct efi_load_option *lo, u8 *data);
 unsigned long efi_serialize_load_option(struct efi_load_option *lo, u8 **data);
-void *efi_bootmgr_load(struct efi_device_path **device_path,
-                      struct efi_device_path **file_path);
+efi_status_t efi_bootmgr_load(efi_handle_t *handle);
 
 #else /* CONFIG_IS_ENABLED(EFI_LOADER) */
 
index 266c58271f0bb627b8c69b4de6dd8e3d6bd9c90c..110aa6ab6dea81b8a036c13c65c2d55f66c6159f 100644 (file)
@@ -1029,7 +1029,10 @@ int fdtdec_setup_memory_banksize(void);
  * @param phandle      phandle to set for the given node
  * @return 0 on success or a negative error code on failure
  */
-int fdtdec_set_phandle(void *blob, int node, uint32_t phandle);
+static inline int fdtdec_set_phandle(void *blob, int node, uint32_t phandle)
+{
+       return fdt_setprop_u32(blob, node, "phandle", phandle);
+}
 
 /**
  * fdtdec_add_reserved_memory() - add or find a reserved-memory node
index 3ac01aa2cd2ce4420d4805dc2ccd982b3c9aa230..78d15afe69b7c7889eebda7ff2f343c69218c878 100644 (file)
@@ -8,12 +8,11 @@
 
 typedef int (*init_fnc_t)(void);
 
-#include <common.h>
-#include <initcall.h>
-#include <efi.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
+/*
+ * To enable debugging. add #define DEBUG at the top of the including file.
+ *
+ * To find a symbol, use grep on u-boot.map
+ */
 static inline int initcall_run_list(const init_fnc_t init_sequence[])
 {
        const init_fnc_t *init_fnc_ptr;
@@ -22,13 +21,17 @@ static inline int initcall_run_list(const init_fnc_t init_sequence[])
                unsigned long reloc_ofs = 0;
                int ret;
 
-               if (gd->flags & GD_FLG_RELOC)
+               /*
+                * Sandbox is relocated by the OS, so symbols always appear at
+                * the relocated address.
+                */
+               if (IS_ENABLED(CONFIG_SANDBOX) || (gd->flags & GD_FLG_RELOC))
                        reloc_ofs = gd->reloc_off;
 #ifdef CONFIG_EFI_APP
                reloc_ofs = (unsigned long)image_base;
 #endif
                debug("initcall: %p", (char *)*init_fnc_ptr - reloc_ofs);
-               if (gd->flags & GD_FLG_RELOC)
+               if (reloc_ofs)
                        debug(" (relocated to %p)\n", (char *)*init_fnc_ptr);
                else
                        debug("\n");
index 6f33b08cf0b11aa5f6f386804c346d50d631895b..7a4f78b9b1fa7919e4a37940831ee976be323e89 100644 (file)
@@ -364,4 +364,15 @@ int os_write_file(const char *name, const void *buf, int size);
  */
 int os_read_file(const char *name, void **bufp, int *sizep);
 
+/*
+ * os_find_text_base() - Find the text section in this running process
+ *
+ * This tries to find the address of the text section in this running process.
+ * It can be useful to map the address of functions to the address listed in
+ * the u-boot.map file.
+ *
+ * @return address if found, else NULL
+ */
+void *os_find_text_base(void);
+
 #endif
index 9668503f0930ba5618dfd128a12d0dabcccdc502..066238a9c3c686bfd7d8f7b984ea17a47cb7b0b2 100644 (file)
 #define  PCI_MSI_FLAGS_QSIZE   0x70    /* Message queue size configured */
 #define  PCI_MSI_FLAGS_QMASK   0x0e    /* Maximum queue size available */
 #define  PCI_MSI_FLAGS_ENABLE  0x01    /* MSI feature enabled */
+#define  PCI_MSI_FLAGS_MASKBIT 0x0100  /* Per-vector masking capable */
 #define PCI_MSI_RFU            3       /* Rest of capability flags */
 #define PCI_MSI_ADDRESS_LO     4       /* Lower 32 bits */
 #define PCI_MSI_ADDRESS_HI     8       /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */
index 8359c511d25f77e6cacd99b2da066f9d485b40d7..3cd7a66cea70a16ad3161ac73ab25146e1263743 100644 (file)
@@ -274,7 +274,7 @@ int regmap_raw_read_range(struct regmap *map, uint range_num, uint offset,
                if (cond) \
                        break; \
                if (IS_ENABLED(CONFIG_SANDBOX) && test_add_time) \
-                       sandbox_timer_add_offset(test_add_time); \
+                       timer_test_add_offset(test_add_time); \
                if ((timeout_ms) && get_timer(__start) > (timeout_ms)) { \
                        __ret = regmap_read((map), (addr), &(val)); \
                        break; \
index 825991e2223a0e5f8a782d97c4f9454e0048e40a..9fd0d73fb4e4342dc7650c1b4dcb114772b257ea 100644 (file)
@@ -13,6 +13,14 @@ unsigned long get_timer(unsigned long base);
  */
 unsigned long timer_get_us(void);
 
+/*
+ * timer_test_add_offset()
+ *
+ * Allow tests to add to the time reported through lib/time.c functions
+ * offset: number of milliseconds to advance the system time
+ */
+void timer_test_add_offset(unsigned long offset);
+
 /*
  *     These inlines deal with timer wrapping correctly. You are
  *     strongly encouraged to use them
index 2120216593eec74b3f462e3a83dbb7cbbc8b06ad..05f82d4a5025e68c832f11fc901ff22f6f884cee 100644 (file)
@@ -165,6 +165,63 @@ config RBTREE
 config BITREVERSE
        bool "Bit reverse library from Linux"
 
+config TRACE
+       bool "Support for tracing of function calls and timing"
+       imply CMD_TRACE
+       help
+         Enables function tracing within U-Boot. This allows recording of call
+         traces including timing information. The command can write data to
+         memory for exporting for analysis (e.g. using bootchart).
+         See doc/README.trace for full details.
+
+config TRACE_BUFFER_SIZE
+       hex "Size of trace buffer in U-Boot"
+       depends on TRACE
+       default 0x01000000
+       help
+         Sets the size of the trace buffer in U-Boot. This is allocated from
+         memory during relocation. If this buffer is too small, the trace
+         history will be truncated, with later records omitted.
+
+         If early trace is enabled (i.e. before relocation), this buffer must
+         be large enough to include all the data from the early trace buffer as
+         well, since this is copied over to the main buffer during relocation.
+
+         A trace record is emitted for each function call and each record is
+         12 bytes (see struct trace_call). A suggested minimum size is 1MB. If
+         the size is too small then 'trace stats' will show a message saying
+         how many records were dropped due to buffer overflow.
+
+config TRACE_EARLY
+       bool "Enable tracing before relocation"
+       depends on TRACE
+       help
+         Sometimes it is helpful to trace execution of U-Boot before
+         relocation. This is possible by using a arch-specific, fixed buffer
+         position in memory. Enable this option to start tracing as early as
+         possible after U-Boot starts.
+
+config TRACE_EARLY_SIZE
+       hex "Size of early trace buffer in U-Boot"
+       depends on TRACE_EARLY
+       default 0x00100000
+       help
+         Sets the size of the early trace buffer in bytes. This is used to hold
+         tracing information before relocation.
+
+config TRACE_EARLY_ADDR
+       hex "Address of early trace buffer in U-Boot"
+       depends on TRACE_EARLY
+       default 0x00100000
+       help
+         Sets the address of the early trace buffer in U-Boot. This memory
+         must be accessible before relocation.
+
+         A trace record is emitted for each function call and each record is
+         12 bytes (see struct trace_call). A suggested minimum size is 1MB. If
+         the size is too small then the message which says the amount of early
+         data being coped will the the same as the
+
 source lib/dhry/Kconfig
 
 menu "Security support"
index 206f582ca96c5a11df528cd7dfc7f16eb57145da..62933c92c4fb0638101e09fcaf78045c8a07e1dd 100644 (file)
 #if BITS_PER_LONG == 32
 
 #ifndef __div64_32
-uint32_t __attribute__((weak)) __div64_32(uint64_t *n, uint32_t base)
+/*
+ * Don't instrument this function as it may be called from tracing code, since
+ * it needs to read the timer and this often requires calling do_div(), which
+ * calls this function.
+ */
+uint32_t __attribute__((weak, no_instrument_function)) __div64_32(u64 *n,
+                                                                 u32 base)
 {
-       uint64_t rem = *n;
-       uint64_t b = base;
-       uint64_t res, d = 1;
-       uint32_t high = rem >> 32;
+       u64 rem = *n;
+       u64 b = base;
+       u64 res, d = 1;
+       u32 high = rem >> 32;
 
        /* Reduce the thing a bit first */
        res = 0;
        if (high >= base) {
                high /= base;
-               res = (uint64_t) high << 32;
-               rem -= (uint64_t) (high*base) << 32;
+               res = (u64)high << 32;
+               rem -= (u64)(high * base) << 32;
        }
 
        while ((int64_t)b > 0 && b < rem) {
index 2c6a50824fd2be0db2da69a56b0358139eea92b2..7cba57b131f626e168d230ee77a2ac46042f92f2 100644 (file)
@@ -53,7 +53,7 @@ void efi_puts(struct efi_priv *priv, const char *str)
 int efi_init(struct efi_priv *priv, const char *banner, efi_handle_t image,
             struct efi_system_table *sys_table)
 {
-       efi_guid_t loaded_image_guid = LOADED_IMAGE_PROTOCOL_GUID;
+       efi_guid_t loaded_image_guid = EFI_LOADED_IMAGE_PROTOCOL_GUID;
        struct efi_boot_services *boot = sys_table->boottime;
        struct efi_loaded_image *loaded_image;
        int ret;
index 12e3d637ddaab3974c1e502021fa62d22bd8bb28..6dd93ff435a5a408151f34d868ef4daa6d962dc7 100644 (file)
@@ -278,7 +278,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t image,
        struct efi_gop *gop;
        struct efi_entry_gopmode mode;
        struct efi_entry_systable table;
-       efi_guid_t efi_gop_guid = EFI_GOP_GUID;
+       efi_guid_t efi_gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
        efi_uintn_t key, desc_size, size;
        efi_status_t ret;
        u32 version;
index 4fccadc5483d00212feb4ded6913faa5f8af79c0..4ccba2287572a659d8363144c70e70fcc31b5705 100644 (file)
@@ -120,14 +120,14 @@ static void *get_var(u16 *name, const efi_guid_t *vendor,
  * if successful.  This checks that the EFI_LOAD_OPTION is active (enabled)
  * and that the specified file to boot exists.
  */
-static void *try_load_entry(uint16_t n, struct efi_device_path **device_path,
-                           struct efi_device_path **file_path)
+static efi_status_t try_load_entry(u16 n, efi_handle_t *handle)
 {
        struct efi_load_option lo;
        u16 varname[] = L"Boot0000";
        u16 hexmap[] = L"0123456789ABCDEF";
-       void *load_option, *image = NULL;
+       void *load_option;
        efi_uintn_t size;
+       efi_status_t ret;
 
        varname[4] = hexmap[(n & 0xf000) >> 12];
        varname[5] = hexmap[(n & 0x0f00) >> 8];
@@ -136,19 +136,18 @@ static void *try_load_entry(uint16_t n, struct efi_device_path **device_path,
 
        load_option = get_var(varname, &efi_global_variable_guid, &size);
        if (!load_option)
-               return NULL;
+               return EFI_LOAD_ERROR;
 
        efi_deserialize_load_option(&lo, load_option);
 
        if (lo.attributes & LOAD_OPTION_ACTIVE) {
                u32 attributes;
-               efi_status_t ret;
 
                debug("%s: trying to load \"%ls\" from %pD\n",
                      __func__, lo.label, lo.file_path);
 
-               ret = efi_load_image_from_path(lo.file_path, &image, &size);
-
+               ret = EFI_CALL(efi_load_image(true, efi_root, lo.file_path,
+                                             NULL, 0, handle));
                if (ret != EFI_SUCCESS)
                        goto error;
 
@@ -159,17 +158,22 @@ static void *try_load_entry(uint16_t n, struct efi_device_path **device_path,
                                L"BootCurrent",
                                (efi_guid_t *)&efi_global_variable_guid,
                                attributes, size, &n));
-               if (ret != EFI_SUCCESS)
+               if (ret != EFI_SUCCESS) {
+                       if (EFI_CALL(efi_unload_image(*handle))
+                           != EFI_SUCCESS)
+                               printf("Unloading image failed\n");
                        goto error;
+               }
 
                printf("Booting: %ls\n", lo.label);
-               efi_dp_split_file_path(lo.file_path, device_path, file_path);
+       } else {
+               ret = EFI_LOAD_ERROR;
        }
 
 error:
        free(load_option);
 
-       return image;
+       return ret;
 }
 
 /*
@@ -177,12 +181,10 @@ error:
  * EFI variable, the available load-options, finding and returning
  * the first one that can be loaded successfully.
  */
-void *efi_bootmgr_load(struct efi_device_path **device_path,
-                      struct efi_device_path **file_path)
+efi_status_t efi_bootmgr_load(efi_handle_t *handle)
 {
        u16 bootnext, *bootorder;
        efi_uintn_t size;
-       void *image = NULL;
        int i, num;
        efi_status_t ret;
 
@@ -209,10 +211,9 @@ void *efi_bootmgr_load(struct efi_device_path **device_path,
                /* load BootNext */
                if (ret == EFI_SUCCESS) {
                        if (size == sizeof(u16)) {
-                               image = try_load_entry(bootnext, device_path,
-                                                      file_path);
-                               if (image)
-                                       return image;
+                               ret = try_load_entry(bootnext, handle);
+                               if (ret == EFI_SUCCESS)
+                                       return ret;
                        }
                } else {
                        printf("Deleting BootNext failed\n");
@@ -223,19 +224,20 @@ void *efi_bootmgr_load(struct efi_device_path **device_path,
        bootorder = get_var(L"BootOrder", &efi_global_variable_guid, &size);
        if (!bootorder) {
                printf("BootOrder not defined\n");
+               ret = EFI_NOT_FOUND;
                goto error;
        }
 
        num = size / sizeof(uint16_t);
        for (i = 0; i < num; i++) {
                debug("%s: trying to load Boot%04X\n", __func__, bootorder[i]);
-               image = try_load_entry(bootorder[i], device_path, file_path);
-               if (image)
+               ret = try_load_entry(bootorder[i], handle);
+               if (ret == EFI_SUCCESS)
                        break;
        }
 
        free(bootorder);
 
 error:
-       return image;
+       return ret;
 }
index abc295e392e93338122578a8cdda61290605755e..601b0a2cb88db82d1f9c3ef15d7d41c04f1fde86 100644 (file)
@@ -1591,6 +1591,7 @@ failure:
  * @size:      size of the loaded image
  * Return:     status code
  */
+static
 efi_status_t efi_load_image_from_path(struct efi_device_path *file_path,
                                      void **buffer, efi_uintn_t *size)
 {
@@ -1699,19 +1700,11 @@ efi_status_t EFIAPI efi_load_image(bool boot_policy,
                                               &source_size);
                if (ret != EFI_SUCCESS)
                        goto error;
-               /*
-                * split file_path which contains both the device and
-                * file parts:
-                */
-               efi_dp_split_file_path(file_path, &dp, &fp);
        } else {
-               /* In this case, file_path is the "device" path, i.e.
-                * something like a HARDWARE_DEVICE:MEMORY_MAPPED
-                */
                dest_buffer = source_buffer;
-               dp = file_path;
-               fp = NULL;
        }
+       /* split file_path which contains both the device and file parts */
+       efi_dp_split_file_path(file_path, &dp, &fp);
        ret = efi_setup_loaded_image(dp, fp, image_obj, &info);
        if (ret == EFI_SUCCESS)
                ret = efi_load_pe(*image_obj, dest_buffer, info);
@@ -2664,6 +2657,7 @@ efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle,
        }
 
        current_image = image_handle;
+       EFI_PRINT("Jumping into 0x%p\n", image_obj->entry);
        ret = EFI_CALL(image_obj->entry(image_handle, &systab));
 
        /*
index d8c052d6ec50f743642ac375513ca821a499fa30..10f890f44f660153be523726dfc02b18a489a3bd 100644 (file)
@@ -335,6 +335,9 @@ struct efi_device_path *efi_dp_create_device_node(const u8 type,
 {
        struct efi_device_path *ret;
 
+       if (length < sizeof(struct efi_device_path))
+               return NULL;
+
        ret = dp_alloc(length);
        if (!ret)
                return ret;
@@ -917,14 +920,14 @@ struct efi_device_path *efi_dp_from_mem(uint32_t memory_type,
  *
  * @full_path:         device path including device and file path
  * @device_path:       path of the device
- * @file_path:         relative path of the file
+ * @file_path:         relative path of the file or NULL if there is none
  * Return:             status code
  */
 efi_status_t efi_dp_split_file_path(struct efi_device_path *full_path,
                                    struct efi_device_path **device_path,
                                    struct efi_device_path **file_path)
 {
-       struct efi_device_path *p, *dp, *fp;
+       struct efi_device_path *p, *dp, *fp = NULL;
 
        *device_path = NULL;
        *file_path = NULL;
@@ -935,7 +938,7 @@ efi_status_t efi_dp_split_file_path(struct efi_device_path *full_path,
        while (!EFI_DP_TYPE(p, MEDIA_DEVICE, FILE_PATH)) {
                p = efi_dp_next(p);
                if (!p)
-                       return EFI_INVALID_PARAMETER;
+                       goto out;
        }
        fp = efi_dp_dup(p);
        if (!fp)
@@ -944,6 +947,7 @@ efi_status_t efi_dp_split_file_path(struct efi_device_path *full_path,
        p->sub_type = DEVICE_PATH_SUB_TYPE_END;
        p->length = sizeof(*p);
 
+out:
        *device_path = dp;
        *file_path = fp;
        return EFI_SUCCESS;
index c037526ad2d0ec21ef682b4875624b7ba251445a..7a6b06821a477895354807722c6d0dd36c046c04 100644 (file)
@@ -12,7 +12,7 @@
 #include <part.h>
 #include <malloc.h>
 
-const efi_guid_t efi_block_io_guid = BLOCK_IO_GUID;
+const efi_guid_t efi_block_io_guid = EFI_BLOCK_IO_PROTOCOL_GUID;
 
 /**
  * struct efi_disk_obj - EFI disk object
index d62ce45912729b3e28da2af2f77c38d7a1f5e37c..e003823b6061efd390f127fd3350ce0a59bb3782 100644 (file)
@@ -14,7 +14,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static const efi_guid_t efi_gop_guid = EFI_GOP_GUID;
+static const efi_guid_t efi_gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
 
 /**
  * struct efi_gop_obj - graphical output protocol object
index 93feefd366cd0a267cb01bff247d51bf5e461ff3..f8092b62026f9dc7a6cb03582545f3f316daa887 100644 (file)
 #include <pe.h>
 
 const efi_guid_t efi_global_variable_guid = EFI_GLOBAL_VARIABLE_GUID;
-const efi_guid_t efi_guid_device_path = DEVICE_PATH_GUID;
-const efi_guid_t efi_guid_loaded_image = LOADED_IMAGE_GUID;
-const efi_guid_t efi_guid_loaded_image_device_path
-               = LOADED_IMAGE_DEVICE_PATH_GUID;
+const efi_guid_t efi_guid_device_path = EFI_DEVICE_PATH_PROTOCOL_GUID;
+const efi_guid_t efi_guid_loaded_image = EFI_LOADED_IMAGE_PROTOCOL_GUID;
+const efi_guid_t efi_guid_loaded_image_device_path =
+               EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID;
 const efi_guid_t efi_simple_file_system_protocol_guid =
                EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID;
 const efi_guid_t efi_file_info_guid = EFI_FILE_INFO_GUID;
index 46681dc2082b120edd4f4c160eac3cb25f323f54..987cc6dc5f61aaaec7fea74c8e87ecbd0c927a90 100644 (file)
@@ -376,6 +376,10 @@ efi_status_t efi_allocate_pages(int type, int memory_type,
        efi_status_t r = EFI_SUCCESS;
        uint64_t addr;
 
+       /* Check import parameters */
+       if (memory_type >= EFI_PERSISTENT_MEMORY_TYPE &&
+           memory_type <= 0x6FFFFFFF)
+               return EFI_INVALID_PARAMETER;
        if (!memory)
                return EFI_INVALID_PARAMETER;
 
index c7d9da8521af931586ec0739e318ae3da9b3db29..e0e222a70bffc2a1051a04c378fd3116ddf1981d 100644 (file)
@@ -9,8 +9,8 @@
 #include <efi_loader.h>
 #include <malloc.h>
 
-static const efi_guid_t efi_net_guid = EFI_SIMPLE_NETWORK_GUID;
-static const efi_guid_t efi_pxe_guid = EFI_PXE_GUID;
+static const efi_guid_t efi_net_guid = EFI_SIMPLE_NETWORK_PROTOCOL_GUID;
+static const efi_guid_t efi_pxe_guid = EFI_PXE_BASE_CODE_PROTOCOL_GUID;
 static struct efi_pxe_packet *dhcp_ack;
 static bool new_rx_packet;
 static void *new_tx_packet;
index 392f5c49513d9874fdef858c118aa9fcd0d281cc..e0fcbb85a4d2324dca08723a746e890512f7eda9 100644 (file)
@@ -11,6 +11,8 @@
 
 const efi_guid_t efi_u_boot_guid = U_BOOT_GUID;
 
+efi_handle_t efi_root = NULL;
+
 struct efi_root_dp {
        struct efi_device_path_vendor vendor;
        struct efi_device_path end;
@@ -26,7 +28,6 @@ struct efi_root_dp {
  */
 efi_status_t efi_root_node_register(void)
 {
-       efi_handle_t root = NULL;
        struct efi_root_dp *dp;
 
        /* Create device path protocol */
@@ -46,7 +47,7 @@ efi_status_t efi_root_node_register(void)
        dp->end.length = sizeof(struct efi_device_path);
 
        /* Create root node and install protocols */
-       return EFI_CALL(efi_install_multiple_protocol_interfaces(&root,
+       return EFI_CALL(efi_install_multiple_protocol_interfaces(&efi_root,
                       /* Device path protocol */
                       &efi_guid_device_path, dp,
                       /* Device path to text protocol */
index 426f276361a6020f424ab30c9095005e31495d25..9ae2ee33898758bf02ac665bfbdbe8a5179cc774 100644 (file)
@@ -12,7 +12,7 @@
 #include <common.h>
 #include <efi_api.h>
 
-static const efi_guid_t loaded_image_guid = LOADED_IMAGE_GUID;
+static const efi_guid_t loaded_image_guid = EFI_LOADED_IMAGE_PROTOCOL_GUID;
 static const efi_guid_t fdt_guid = EFI_FDT_GUID;
 static const efi_guid_t acpi_guid = EFI_ACPI_TABLE_GUID;
 static const efi_guid_t smbios_guid = SMBIOS_TABLE_GUID;
index c9720c9da8da2f10eb3bb7f98b82bcbc2cb003dd..4945691e6733423880aadcb28dc7d41c5fed2ff7 100644 (file)
@@ -23,7 +23,6 @@ efi_selftest_events.o \
 efi_selftest_event_groups.o \
 efi_selftest_exception.o \
 efi_selftest_exitbootservices.o \
-efi_selftest_fdt.o \
 efi_selftest_gop.o \
 efi_selftest_loaded_image.o \
 efi_selftest_manageprotocols.o \
@@ -42,6 +41,10 @@ efi_selftest_watchdog.o
 obj-$(CONFIG_CPU_V7) += efi_selftest_unaligned.o
 obj-$(CONFIG_EFI_LOADER_HII) += efi_selftest_hii.o
 
+ifeq ($(CONFIG_GENERATE_ACPI_TABLE),)
+obj-y += efi_selftest_fdt.o
+endif
+
 ifeq ($(CONFIG_BLK)$(CONFIG_PARTITIONS),yy)
 obj-y += efi_selftest_block_device.o
 endif
index 9033109807c2aeeb5bd38f40402dbf49e85686c9..fb33150c4b2a6dfca6c941db02d1a12d11a5b56a 100644 (file)
@@ -23,7 +23,7 @@ static const struct efi_gop_pixel DARK_BLUE = {128,   0,   0, 0};
 static const struct efi_gop_pixel LIGHT_BLUE = {255, 192, 192, 0};
 
 static struct efi_boot_services *boottime;
-static efi_guid_t efi_gop_guid = EFI_GOP_GUID;
+static efi_guid_t efi_gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
 static struct efi_gop *gop;
 static struct efi_gop_pixel *bitmap;
 static struct efi_event *event;
index 21409aed6f54e90e29b0cd52541918e00003f6a4..29ac0ce65104711ec1ba581e7486802793c37faf 100644 (file)
@@ -24,8 +24,8 @@
 
 static struct efi_boot_services *boottime;
 
-static const efi_guid_t block_io_protocol_guid = BLOCK_IO_GUID;
-static const efi_guid_t guid_device_path = DEVICE_PATH_GUID;
+static const efi_guid_t block_io_protocol_guid = EFI_BLOCK_IO_PROTOCOL_GUID;
+static const efi_guid_t guid_device_path = EFI_DEVICE_PATH_PROTOCOL_GUID;
 static const efi_guid_t guid_simple_file_system_protocol =
                                        EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID;
 static const efi_guid_t guid_file_system_info = EFI_FILE_SYSTEM_INFO_GUID;
index 105ce2c92b3aaa0a856170128665dd7d0a15bc45..4ce3fad8959d4602f38670c0cb51a50de43b49a7 100644 (file)
@@ -20,7 +20,7 @@ struct interface {
        void (EFIAPI * inc)(void);
 } interface;
 
-static efi_guid_t guid_device_path = DEVICE_PATH_GUID;
+static efi_guid_t guid_device_path = EFI_DEVICE_PATH_PROTOCOL_GUID;
 
 static efi_guid_t guid_device_path_to_text_protocol =
        EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID;
index d545d518120d6e12ed743ee29bcbdaf84650fcc2..94d72d3f6d853358d4d86640eeacd009c8e4769c 100644 (file)
 #include <efi_selftest.h>
 #include <linux/libfdt.h>
 
-static struct efi_boot_services *boottime;
+static const struct efi_system_table *systemtab;
+static const struct efi_boot_services *boottime;
 static const char *fdt;
 
 /* This should be sufficient for */
 #define BUFFERSIZE 0x100000
 
-static efi_guid_t fdt_guid = EFI_FDT_GUID;
+static const efi_guid_t fdt_guid = EFI_FDT_GUID;
+static const efi_guid_t acpi_guid = EFI_ACPI_TABLE_GUID;
 
 /*
  * Convert FDT value to host endianness.
@@ -115,6 +117,23 @@ static char *get_property(const u16 *property)
        }
 }
 
+/**
+ * efi_st_get_config_table() - get configuration table
+ *
+ * @guid:      GUID of the configuration table
+ * Return:     pointer to configuration table or NULL
+ */
+static void *efi_st_get_config_table(const efi_guid_t *guid)
+{
+       size_t i;
+
+       for (i = 0; i < systab.nr_tables; i++) {
+               if (!guidcmp(guid, &systemtab->tables[i].guid))
+                       return systemtab->tables[i].table;
+       }
+       return NULL;
+}
+
 /*
  * Setup unit test.
  *
@@ -125,21 +144,22 @@ static char *get_property(const u16 *property)
 static int setup(const efi_handle_t img_handle,
                 const struct efi_system_table *systable)
 {
-       efi_uintn_t i;
+       void *acpi;
 
+       systemtab = systable;
        boottime = systable->boottime;
 
-       /* Find configuration tables */
-       for (i = 0; i < systable->nr_tables; ++i) {
-               if (!efi_st_memcmp(&systable->tables[i].guid, &fdt_guid,
-                                  sizeof(efi_guid_t)))
-                       fdt = systable->tables[i].table;
-       }
+       acpi = efi_st_get_config_table(&acpi_guid);
+       fdt = efi_st_get_config_table(&fdt_guid);
+
        if (!fdt) {
                efi_st_error("Missing device tree\n");
                return EFI_ST_FAILURE;
        }
-
+       if (acpi) {
+               efi_st_error("Found ACPI table and device tree\n");
+               return EFI_ST_FAILURE;
+       }
        return EFI_ST_SUCCESS;
 }
 
@@ -183,5 +203,4 @@ EFI_UNIT_TEST(fdt) = {
        .phase = EFI_EXECUTE_BEFORE_BOOTTIME_EXIT,
        .setup = setup,
        .execute = execute,
-       .on_request = true,
 };
index 5b0e2a96059af219a051c27b58cbce95aef74454..4ad043c59743bf056e73c08b9b58cf703bce168d 100644 (file)
@@ -10,7 +10,7 @@
 #include <efi_selftest.h>
 
 static struct efi_boot_services *boottime;
-static efi_guid_t efi_gop_guid = EFI_GOP_GUID;
+static efi_guid_t efi_gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
 static struct efi_gop *gop;
 
 /*
index 96faa67a157c09a26be4e3e6ef0b7afd4f532a64..449b6bfcace124261099677f618fb2d6139c55f6 100644 (file)
@@ -27,7 +27,7 @@ static struct efi_boot_services *boottime;
 static efi_handle_t handle_image;
 static efi_handle_t handle_volume;
 
-static const efi_guid_t guid_device_path = DEVICE_PATH_GUID;
+static const efi_guid_t guid_device_path = EFI_DEVICE_PATH_PROTOCOL_GUID;
 static const efi_guid_t guid_simple_file_system_protocol =
                EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID;
 static const efi_guid_t guid_file_info = EFI_FILE_INFO_GUID;
index d63b9e3addfd340d35c67284cc1ec7eb2f5c189c..b3ca109d811a4f28b08fddee5200a845134aa56f 100644 (file)
@@ -11,7 +11,7 @@
 #include <common.h>
 #include <efi_api.h>
 
-static efi_guid_t loaded_image_protocol_guid = LOADED_IMAGE_GUID;
+static efi_guid_t loaded_image_protocol_guid = EFI_LOADED_IMAGE_PROTOCOL_GUID;
 
 /**
  * check_loaded_image_protocol() - check image_base/image_size
index f1e23c4921c0ae0ac386227921b39eb49b550977..d7350e2158da261ef5ccd0d87fbde1da33d3b9af 100644 (file)
@@ -66,7 +66,7 @@ struct dhcp {
 static struct efi_boot_services *boottime;
 static struct efi_simple_network *net;
 static struct efi_event *timer;
-static const efi_guid_t efi_net_guid = EFI_SIMPLE_NETWORK_GUID;
+static const efi_guid_t efi_net_guid = EFI_SIMPLE_NETWORK_PROTOCOL_GUID;
 /* IP packet ID */
 static unsigned int net_ip_id;
 
index 9c9c30234732f09b8162414e12145373a23b6cc6..fea44a9a8c65d22cff39fd953328532e5b9b55aa 100644 (file)
@@ -1261,13 +1261,6 @@ __weak void *board_fdt_blob_setup(void)
 }
 #endif
 
-int fdtdec_set_phandle(void *blob, int node, uint32_t phandle)
-{
-       fdt32_t value = cpu_to_fdt32(phandle);
-
-       return fdt_setprop(blob, node, "phandle", &value, sizeof(value));
-}
-
 static int fdtdec_init_reserved_memory(void *blob)
 {
        int na, ns, node, err;
index bb089c2eca9aa39a067e378aa7ad5696f9d0f738..9956442fefe6b422fb5b048f9aa039a0acb44aad 100644 (file)
@@ -183,7 +183,8 @@ int trace_list_functions(void *buff, int buff_size, unsigned int *needed)
        /* Work out how must of the buffer we used */
        *needed = ptr - buff;
        if (ptr > end)
-               return -1;
+               return -ENOSPC;
+
        return 0;
 }
 
@@ -227,7 +228,8 @@ int trace_list_calls(void *buff, int buff_size, unsigned *needed)
        /* Work out how must of the buffer we used */
        *needed = ptr - buff;
        if (ptr > end)
-               return -1;
+               return -ENOSPC;
+
        return 0;
 }
 
@@ -294,7 +296,8 @@ int __attribute__((no_instrument_function)) trace_init(void *buff,
                trace_enabled = 0;
                hdr = map_sysmem(CONFIG_TRACE_EARLY_ADDR,
                                 CONFIG_TRACE_EARLY_SIZE);
-               end = (char *)&hdr->ftrace[hdr->ftrace_count];
+               end = (char *)&hdr->ftrace[min(hdr->ftrace_count,
+                                              hdr->ftrace_size)];
                used = end - (char *)hdr;
                printf("trace: copying %08lx bytes of early data from %x to %08lx\n",
                       used, CONFIG_TRACE_EARLY_ADDR,
@@ -302,7 +305,7 @@ int __attribute__((no_instrument_function)) trace_init(void *buff,
                memcpy(buff, hdr, used);
 #else
                puts("trace: already enabled\n");
-               return -1;
+               return -EALREADY;
 #endif
        }
        hdr = (struct trace_hdr *)buff;
@@ -310,7 +313,7 @@ int __attribute__((no_instrument_function)) trace_init(void *buff,
        if (needed > buff_size) {
                printf("trace: buffer size %zd bytes: at least %zd needed\n",
                       buff_size, needed);
-               return -1;
+               return -ENOSPC;
        }
 
        if (was_disabled)
@@ -327,6 +330,7 @@ int __attribute__((no_instrument_function)) trace_init(void *buff,
        hdr->depth_limit = 15;
        trace_enabled = 1;
        trace_inited = 1;
+
        return 0;
 }
 
@@ -346,7 +350,7 @@ int __attribute__((no_instrument_function)) trace_early_init(void)
        if (needed > buff_size) {
                printf("trace: buffer size is %zd bytes, at least %zd needed\n",
                       buff_size, needed);
-               return -1;
+               return -ENOSPC;
        }
 
        memset(hdr, '\0', needed);
@@ -361,6 +365,7 @@ int __attribute__((no_instrument_function)) trace_early_init(void)
        printf("trace: early enable at %08x\n", CONFIG_TRACE_EARLY_ADDR);
 
        trace_enabled = 1;
+
        return 0;
 }
 #endif
index 421362d9532fa2fa1f369dce9a4cf0ef34dcbc2d..3e6bdf81613902dca496719b817b1225950c7a5a 100644 (file)
@@ -4401,11 +4401,6 @@ CONFIG_TMU_TIMER
 CONFIG_TPL_PAD_TO
 CONFIG_TPM_TIS_BASE_ADDRESS
 CONFIG_TPS6586X_POWER
-CONFIG_TRACE
-CONFIG_TRACE_BUFFER_SIZE
-CONFIG_TRACE_EARLY
-CONFIG_TRACE_EARLY_ADDR
-CONFIG_TRACE_EARLY_SIZE
 CONFIG_TRAILBLAZER
 CONFIG_TRATS
 CONFIG_TSEC
index 4d9d2b81d1e6d78f7ddc4b7e5524687d399e6af7..2156661d6c4251a18ce10e35dad74480f4164188 100644 (file)
@@ -310,6 +310,7 @@ instances of:
 
 - `buildconfig.get(...`
 - `@pytest.mark.buildconfigspec(...`
+- `@pytest.mark.notbuildconfigspec(...`
 
 ### Complete invocation example
 
index e40cbf0ba12ab329afdc08413d71719cee992b8b..00d8ef8ba99ce76ce4a48df0d81773ef10237892 100644 (file)
@@ -460,11 +460,15 @@ def setup_buildconfigspec(item):
     """
 
     mark = item.get_marker('buildconfigspec')
-    if not mark:
-        return
-    for option in mark.args:
-        if not ubconfig.buildconfig.get('config_' + option.lower(), None):
-            pytest.skip('.config feature "%s" not enabled' % option.lower())
+    if mark:
+        for option in mark.args:
+            if not ubconfig.buildconfig.get('config_' + option.lower(), None):
+                pytest.skip('.config feature "%s" not enabled' % option.lower())
+    notmark = item.get_marker('notbuildconfigspec')
+    if notmark:
+        for option in notmark.args:
+            if ubconfig.buildconfig.get('config_' + option.lower(), None):
+                pytest.skip('.config feature "%s" enabled' % option.lower())
 
 def tool_is_in_path(tool):
     for path in os.environ["PATH"].split(os.pathsep):
index bc226a8e6376a07c4c35850ea1ee78e6511cd1db..07e4db0452840cd736ac7ae5d2bb469e277d44ed 100644 (file)
@@ -15,7 +15,7 @@ def test_efi_selftest(u_boot_console):
        This function executes all selftests that are not marked as on request.
        """
        u_boot_console.run_command(cmd='setenv efi_selftest')
-       u_boot_console.run_command(cmd='bootefi selftest ${fdtcontroladdr}', wait_for_prompt=False)
+       u_boot_console.run_command(cmd='bootefi selftest', wait_for_prompt=False)
        m = u_boot_console.p.expect(['Summary: 0 failures', 'Press any key'])
        if m != 0:
                raise Exception('Failures occurred during the EFI selftest')
@@ -27,6 +27,7 @@ def test_efi_selftest(u_boot_console):
 
 @pytest.mark.buildconfigspec('cmd_bootefi_selftest')
 @pytest.mark.buildconfigspec('of_control')
+@pytest.mark.notbuildconfigspec('generate_acpi_table')
 def test_efi_selftest_device_tree(u_boot_console):
        u_boot_console.run_command(cmd='setenv efi_selftest list')
        output = u_boot_console.run_command('bootefi selftest')