(四)正点原子STM32MP135移植——u-boot移植

一、概述

        u-boot概述就不概述了,u-boot、kernel、dtb三件套,dddd

        

        经过国庆艰苦奋战,已经成功把所有功能移植好了

二、编译官方代码

        进入u-boot的目录

2.1 解压源码、打补丁

/* 解压源码 */
tar xf u-boot-stm32mp-v2022.10-stm32mp-r1-r0.tar.xz /* 进入源码目录 */
cd u-boot-stm32mp-v2022.10-stm32mp-r1//* 打补丁 */
for p in `ls -1 ../*.patch`; do patch -p1 < $p; done

2.2 修改Makefile.sdk

        打开Makefile.sdk,把DEPLOYDIR目录改成这个:

DEPLOYDIR ?= $(SRC_PATH)/../../FIP_artifacts/u-boot

         然后第12行开始,我们把157的屏蔽掉,留下135

# Init default config settings
# UBOOT_CONFIGS += trusted
# UBOOT_DEFCONFIG_trusted += stm32mp15_defconfig
# UBOOT_BINARY_stm32mp15_defconfig ?= u-boot.dtb
# UBOOT_DEVICETREE_stm32mp15_defconfig ?=  stm32mp157c-ed1 stm32mp157f-ed1 stm32mp157a-ev1 stm32mp157c-ev1 stm32mp157d-ev1 stm32mp157f-ev1 stm32mp157a-dk1 stm32mp157d-dk1 stm32mp157c-dk2 stm32mp157f-dk2
# Init default config settings
UBOOT_CONFIGS += trusted
UBOOT_DEFCONFIG_trusted += stm32mp13_defconfig
UBOOT_BINARY_stm32mp13_defconfig ?= u-boot.dtb
UBOOT_DEVICETREE_stm32mp13_defconfig ?=  stm32mp135f-dk
DEVICETREE ?= stm32mp135f-dk

2.3 配置编译环境

/* 加载环境 */
source /opt/st/stm32mp1/4.2.1-openstlinux-6.1-yocto-mickledore-mp1-v23.06.21/environment-setup-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi/* 配置环境变量 */
export FIP_DEPLOYDIR_ROOT=$PWD/../../FIP_artifacts

不要关了这个终端,它已经配置好了,关于这部分的配置,可以看上一篇关于TF-A的解释比较详细。

2.4 编译

make -f ../Makefile.sdk all

由于之前我们编译过了stm32mp135f-dk的TF-A和optee,这里编译完成之后,会直接调用fiptool工具给我们打包生成fip-stm32mp135-atk-optee.bin到FIP文件夹里。

[fiptool] Create fip-stm32mp135f-dk-optee.bin fip binary into 'FIP_DEPLOYDIR_FIP' folder...
[fiptool] Done

三、移植

3.1 复制官方文件

/* 进入设备树目录 */
cd arch/arm/dts/cp stm32mp135f-dk.dts stm32mp135-atk.dts
cp stm32mp13-pinctrl.dtsi stm32mp13-pinctrl-atk.dtsi
cp stm32mp135f-dk-u-boot.dtsi stm32mp135-atk-u-boot.dtsi/* 回到源码根目录 */
cd ../../../

3.2 修改头文件

        打开stm32mp135-atk.dts,把引脚头文件改成我们的

// #include "stm32mp13-pinctrl.dtsi"
#include "stm32mp13-pinctrl-atk.dtsi"

3.3 修改电源

        首先找到scmi_regu节点,把里面的内容删,但是节点别删,还得留下一个scmi_v1v8_periph

&scmi_regu {scmi_vddcpu: voltd-vddcpu {reg = <VOLTD_SCMI_STPMIC1_BUCK1>;regulator-name = "vddcpu";};scmi_vdd: voltd-vdd {reg = <VOLTD_SCMI_STPMIC1_BUCK3>;regulator-name = "vdd";};scmi_vddcore: voltd-vddcore {reg = <VOLTD_SCMI_STPMIC1_BUCK4>;regulator-name = "vddcore";};scmi_vdd_adc: voltd-vdd-adc {reg = <VOLTD_SCMI_STPMIC1_LDO1>;regulator-name = "vdd_adc";};scmi_vdd_usb: voltd-vdd-usb {reg = <VOLTD_SCMI_STPMIC1_LDO4>;regulator-name = "vdd_usb";};scmi_vdd_sd: voltd-vdd-sd {reg = <VOLTD_SCMI_STPMIC1_LDO5>;regulator-name = "vdd_sd";};scmi_v1v8_periph: voltd-v1v8-periph {reg = <VOLTD_SCMI_STPMIC1_LDO6>;regulator-name = "v1v8_periph";};scmi_v3v3_sw: voltd-v3v3-sw {reg = <VOLTD_SCMI_STPMIC1_PWR_SW2>;regulator-name = "v3v3_sw";};
};

修改过后如下:如果有大佬知道怎么解决麻烦底下留言帮帮忙

/* 这一段不知道怎么解决,不能删
删除之后,烧写到u-boot阶段,会被强行复位,但是使用分立电源又不行
*/
&scmi_regu {scmi_v1v8_periph: voltd-v1v8-periph {reg = <VOLTD_SCMI_STPMIC1_LDO6>;regulator-name = "v1v8_periph";};
};

笔者尝试过在根节点下加入对1.8V电源的描述,但是并不行,烧录的时候会直接被迫重启,刚学linux不久,大佬带带

/* 想用分立电源代替掉scmi_v1v8_periph,但是没有实现 */// v1v8: v1v8 {//     compatible = "regulator-fixed";// 	regulator-name = "v1v8_periph";//     regulator-min-microvolt = <1800000>;//     regulator-max-microvolt = <1800000>;//     regulator-off-in-suspend;//     regulator-always-on;// };

删除scmi电源之后,在根节点下面加入我们的电源描述,和之前的一样

vddcore: vddcore {compatible = "regulator-fixed";regulator-name = "vddcore";regulator-min-microvolt = <1200000>;regulator-max-microvolt = <1350000>;regulator-off-in-suspend;regulator-always-on;};vddcpu: vddcpu {compatible = "regulator-fixed";regulator-name = "vddcpu";regulator-min-microvolt = <1350000>;regulator-max-microvolt = <1350000>;regulator-off-in-suspend;regulator-always-on;};v3v3: v3v3 {compatible = "regulator-fixed";regulator-name = "v3v3";regulator-min-microvolt = <3300000>;regulator-max-microvolt = <3300000>;regulator-off-in-suspend;regulator-always-on;};vbus_otg: vbus_otg {compatible = "regulator-fixed";regulator-name = "vbus_otg";regulator-min-microvolt = <5000000>;regulator-max-microvolt = <5000000>;regulator-off-in-suspend;regulator-always-on;};vdd: vdd {compatible = "regulator-fixed";regulator-name = "vdd";regulator-min-microvolt = <3300000>;regulator-max-microvolt = <3300000>;regulator-off-in-suspend;regulator-always-on;};vdd_usb: vdd_usb {compatible = "regulator-fixed";regulator-name = "vdd_usb";regulator-min-microvolt = <3300000>;regulator-max-microvolt = <3300000>;regulator-off-in-suspend;regulator-always-on;};

3.4 删除无关节点

        可以删除(建议删除)的节点如下

1.        &i2c5全部

2.        &uart8 &usart1 &usart2三个串口

3.        根节点下的gpio-keys

4.        根节点下aliases里的几个串口,只留下串口4

5.        &dcmipp节点

6.        &spi5  &timer3  &timer4  &timer8  &timer14这几个都可以删了

3.5 修改USB OTG

        正点原子的OTG使用的是usbphyc_port1,而usbphyc_port0是host,找到&usbphyc_port1节点,只需要修改该它的电源即可。

&usbphyc_port1 {// phy-supply = <&scmi_vdd_usb>;    /* 删了原来的 */phy-supply = <&vdd_usb>;st,current-boost-microamp = <1000>;st,decrease-hs-slew-rate;st,tune-hs-dc-level = <2>;st,enable-hs-rftime-reduction;st,trim-hs-current = <11>;st,trim-hs-impedance = <2>;st,tune-squelch-level = <1>;st,enable-hs-rx-gain-eq;st,no-hs-ftime-ctrl;st,no-lsfs-sc;
};

 修改&usbotg_hs

&usbotg_hs {phys = <&usbphyc_port1 0>;phy-names = "usb2-phy";usb-role-switch;dr_mode = "otg";pinctrl-0 = <&usbotg_hs_pins_a>;pinctrl-names = "default";vbus-supply = <&vbus_otg>;status = "okay";
};

3.6 修改USB节点

        同OTG,先把电源改了,下面那个connector好像不要也行

&usbphyc_port0 {// phy-supply = <&scmi_vdd_usb>;    /* 删了原来的 */phy-supply = <&vdd_usb>;st,current-boost-microamp = <1000>;st,decrease-hs-slew-rate;st,tune-hs-dc-level = <2>;st,enable-hs-rftime-reduction;st,trim-hs-current = <11>;st,trim-hs-impedance = <2>;st,tune-squelch-level = <1>;st,enable-hs-rx-gain-eq;st,no-hs-ftime-ctrl;st,no-lsfs-sc;/** Hack to keep hub active if wakeup source is enabled* otherwise the hub will wakeup the port0 as soon as the v3v3_sw is disabled*/connector {compatible = "usb-a-connector";vbus-supply = <&v3v3>;};
};

修改usbh_ehci节点:

&usbh_ehci {phys = <&usbphyc_port0>;status = "okay";
};

3.7 修改TF卡和emmc节点

这里,偷个懒,直接把原子的复制过来了,直接替换掉

&sdmmc1 {pinctrl-names = "default", "opendrain", "sleep";pinctrl-0 = <&sdmmc1_b4_pins_a &sdmmc1_clk_pins_a>;pinctrl-1 = <&sdmmc1_b4_od_pins_a &sdmmc1_clk_pins_a>;pinctrl-2 = <&sdmmc1_b4_sleep_pins_a>;cd-gpios = <&gpiof 15 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;disable-wp;st,neg-edge;no-1-8-v;bus-width = <4>;vmmc-supply = <&v3v3>;status = "okay";
};/* EMMC */
&sdmmc2 {pinctrl-names = "default", "opendrain", "sleep";pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_b4_b7_pins_a &sdmmc2_clk_pins_a>;pinctrl-1 = <&sdmmc2_b4_od_pins_a &sdmmc2_b4_b7_od_pins_a &sdmmc2_clk_pins_a>;pinctrl-2 = <&sdmmc2_b4_sleep_pins_a &sdmmc2_b4_b7_sleep_pins_a>;non-removable;st,neg-edge;mmc-ddr-3_3v;no-1-8-v;bus-width = <8>;vmmc-supply = <&v3v3>;#address-cells = <1>;#size-cells = <0>;status = "okay";
};

3.8 修改ltdc

        在根节点下添加:

atk_pinctrl_lcd {gpior = <&gpioe 9 GPIO_ACTIVE_LOW>;gpiog = <&gpioa 15 GPIO_ACTIVE_LOW>;gpiob = <&gpioe 15 GPIO_ACTIVE_LOW>;};

        修改panel_rgb:panel-rgb,这里继续偷懒,直接复制粘贴了

panel_rgb: panel-rgb {compatible = "simple-panel";backlight = <&panel_backlight>;power-supply = <&v3v3>;status = "okay";port {panel_in_rgb: endpoint {remote-endpoint = <&ltdc_out_rgb>;};};display-timings {native-mode = <&timing0>; 			/* 时序信息 */timing0: timing0 { 					/* 7 寸 1024*600 分辨率 */clock-frequency = <51200000>; 	/* LCD 像素时钟,单位 Hz */hactive = <1024>; 				/* LCD X 轴像素个数 */vactive = <600>; 				/* LCD Y 轴像素个数 */hfront-porch = <160>; 			/* LCD hfp 参数 */hback-porch = <140>; 			/* LCD hbp 参数 */hsync-len = <20>; 				/* LCD hspw 参数 */vback-porch = <20>; 			/* LCD vbp 参数 */vfront-porch = <12>; 			/* LCD vfp 参数 */vsync-len = <3>; 				/* LCD vspw 参数 */};};};

        修改panel_backlight,ST用的是PE 12,正点原子用的是PD 13

panel_backlight: panel-backlight {compatible = "gpio-backlight";gpios = <&gpiod 13 GPIO_ACTIVE_HIGH>;default-on;status = "okay";};

        然后向pinctrl追加:

&pinctrl {gpio_r:gpio_r {pins {pinmux = <STM32_PINMUX('E', 9, GPIO)>; /* PE9.GPIO */bias-pull-up;drive-push-pull;};};gpio_g:gpio_g {pins {pinmux = <STM32_PINMUX('A', 15, GPIO)>; /* PA15.GPIO */bias-pull-up;drive-push-pull;};};gpio_b:gpio_b {pins {pinmux = <STM32_PINMUX('E', 15, GPIO)>; /* PE15.GPIO */bias-pull-up;drive-push-pull;};};
};

3.9 修改网络

        找到eth1和eth2两个节点,直接覆盖修改

&eth1 {status = "okay";pinctrl-0 = <&eth1_rgmii_pins_a>;pinctrl-1 = <&eth1_rgmii_sleep_pins_a>;pinctrl-names = "default", "sleep";phy-mode = "rgmii-id";max-speed = <1000>;phy-handle = <&phy0_eth1>;nvmem-cells = <&ethernet_mac1_address>;nvmem-cell-names = "mac-address";mdio1 {#address-cells = <1>;#size-cells = <0>;compatible = "snps,dwmac-mdio";phy0_eth1: ethernet-phy@1 {reg = <1>;};};
};/* 需要用eth2就取消注释即可 */
// &eth2 {
// 	status = "okay";
// 	pinctrl-0 = <&eth2_rgmii_pins_a>;
// 	pinctrl-1 = <&eth2_rgmii_sleep_pins_a>;
// 	pinctrl-names = "default", "sleep";
// 	phy-mode = "rgmii-id";
// 	max-speed = <1000>;
// 	phy-handle = <&phy0_eth2>;
// 	phy-supply = <&v3v3>;
// 	nvmem-cells = <&ethernet_mac2_address>;
// 	nvmem-cell-names = "mac-address";// 	mdio1 {
// 		#address-cells = <1>;
// 		#size-cells = <0>;
// 		compatible = "snps,dwmac-mdio";
// 		phy0_eth2: ethernet-phy@2 {
// 			reg = <2>;
// 		};
// 	};
// };

3.10 修改引脚

        偷个懒,直接照搬原子的引脚配置即可

// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/** Copyright (C) STMicroelectronics 2021 - All Rights Reserved* Author: Alexandre Torgue <alexandre.torgue@foss.st.com>*/
#include <dt-bindings/pinctrl/stm32-pinfunc.h>&pinctrl {eth1_rgmii_pins_a: eth1-rgmii-1 {pins1 {pinmux = <STM32_PINMUX('F', 12, AF11)>, /* ETH1_RGMII_CLK125 */<STM32_PINMUX('C', 1, AF11)>, 	/* ETH1_RGMII_GTX_CLK */<STM32_PINMUX('G', 13, AF11)>, /* ETH1_RGMII_TXD0 */<STM32_PINMUX('G', 14, AF11)>, /* ETH1_RGMII_TXD1 */<STM32_PINMUX('C', 2, AF11)>, 	/* ETH1_RGMII_TXD2 */<STM32_PINMUX('E', 5, AF10)>, 	/* ETH1_RGMII_TXD3 */<STM32_PINMUX('B', 11, AF11)>, /* ETH1_RGMII_TX_CTL */<STM32_PINMUX('A', 2, AF11)>, 	/* ETH1_MDIO */<STM32_PINMUX('G', 2, AF11)>; 	/* ETH1_MDC */bias-disable;drive-push-pull;slew-rate = <2>;};pins2 {pinmux = <STM32_PINMUX('C', 4, AF11)>, /* ETH1_RGMII_RXD0 */<STM32_PINMUX('C', 5, AF11)>, /* ETH1_RGMII_RXD1 */<STM32_PINMUX('B', 0, AF11)>, /* ETH1_RGMII_RXD2 */<STM32_PINMUX('B', 1, AF11)>, /* ETH1_RGMII_RXD3 */<STM32_PINMUX('A', 1, AF11)>, /* ETH1_RGMII_RX_CLK */<STM32_PINMUX('A', 7, AF11)>; /* ETH1_RGMII_RX_CTL */bias-disable;};};eth1_rgmii_sleep_pins_a: eth1-rgmii-sleep-1 {pins1 {pinmux = <STM32_PINMUX('F', 12, ANALOG)>, /* ETH1_RGMII_CLK125 */<STM32_PINMUX('C', 1, ANALOG)>, 	/* ETH1_RGMII_GTX_CLK */<STM32_PINMUX('G', 13, ANALOG)>, 	/* ETH1_RGMII_TXD0 */<STM32_PINMUX('G', 14, ANALOG)>, 	/* ETH1_RGMII_TXD1 */<STM32_PINMUX('C', 2, ANALOG)>, 	/* ETH1_RGMII_TXD2 */<STM32_PINMUX('E', 5, ANALOG)>, 	/* ETH1_RGMII_TXD3 */<STM32_PINMUX('B', 11, ANALOG)>, 	/* ETH1_RGMII_TX_CTL */<STM32_PINMUX('A', 2, ANALOG)>, 	/* ETH1_MDIO */<STM32_PINMUX('G', 2, ANALOG)>, 	/* ETH1_MDC */<STM32_PINMUX('C', 4, ANALOG)>, 	/* ETH1_RGMII_RXD0 */<STM32_PINMUX('C', 5, ANALOG)>, 	/* ETH1_RGMII_RXD1 */<STM32_PINMUX('B', 0, ANALOG)>, 	/* ETH1_RGMII_RXD2 */<STM32_PINMUX('B', 1, ANALOG)>, 	/* ETH1_RGMII_RXD3 */<STM32_PINMUX('A', 1, ANALOG)>, 	/* ETH1_RGMII_RX_CLK */<STM32_PINMUX('A', 7, ANALOG)>; 	/* ETH1_RGMII_RX_CTL */};};eth2_rgmii_pins_a: eth2-rgmii-2 {pins1 {pinmux = <STM32_PINMUX('H', 2, AF13)>, /* ETH2_RGMII_CLK125 */<STM32_PINMUX('F', 7, AF11)>, 	/* ETH2_RGMII_TXD0 */<STM32_PINMUX('G', 11, AF10)>, /* ETH2_RGMII_TXD1 */<STM32_PINMUX('G', 1, AF10)>, 	/* ETH2_RGMII_TXD2 */<STM32_PINMUX('E', 6, AF11)>, 	/* ETH2_RGMII_TXD3 */<STM32_PINMUX('G', 3, AF10)>, 	/* ETH2_RGMII_GTX_CLK */<STM32_PINMUX('F', 6, AF11)>, 	/* ETH2_RGMII_TX_CTL */<STM32_PINMUX('B', 2, AF11)>, 	/* ETH2_MDIO */<STM32_PINMUX('G', 5, AF10)>; 	/* ETH2_MDC */bias-disable;drive-push-pull;slew-rate = <2>;};pins2 {pinmux = <STM32_PINMUX('F', 4, AF11)>, /* ETH2_RGMII_RXD0 */<STM32_PINMUX('E', 2, AF10)>, 	/* ETH2_RGMII_RXD1 */<STM32_PINMUX('H', 6, AF12)>, 	/* ETH2_RGMII_RXD2 */<STM32_PINMUX('A', 8, AF11)>, 	/* ETH2_RGMII_RXD3 */<STM32_PINMUX('H', 11, AF11)>, /* ETH2_RGMII_RX_CLK */<STM32_PINMUX('G', 12, AF12)>; /* ETH2_RGMII_RX_CTL */bias-disable;};};eth2_rgmii_sleep_pins_a: eth2-rgmii-sleep-2 {pins1 {pinmux = <STM32_PINMUX('H', 2, ANALOG)>, /* ETH2_RGMII_CLK125 */<STM32_PINMUX('F', 7, ANALOG)>, 	/* ETH2_RGMII_TXD0 */<STM32_PINMUX('G', 11, ANALOG)>, 	/* ETH2_RGMII_TXD1 */<STM32_PINMUX('G', 1, ANALOG)>, 	/* ETH2_RGMII_TXD2 */<STM32_PINMUX('E', 6, ANALOG)>, 	/* ETH2_RGMII_TXD3 */<STM32_PINMUX('G', 3, ANALOG)>, 	/* ETH2_RGMII_GTX_CLK */<STM32_PINMUX('F', 6, ANALOG)>, 	/* ETH2_RGMII_TX_CTL */<STM32_PINMUX('B', 2, ANALOG)>, 	/* ETH2_MDIO */<STM32_PINMUX('G', 5, ANALOG)>, 	/* ETH2_MDC */<STM32_PINMUX('F', 4, ANALOG)>, 	/* ETH2_RGMII_RXD0 */<STM32_PINMUX('E', 2, ANALOG)>, 	/* ETH2_RGMII_RXD1 */<STM32_PINMUX('H', 6, ANALOG)>, 	/* ETH2_RGMII_RXD2 */<STM32_PINMUX('A', 8, ANALOG)>, 	/* ETH2_RGMII_RXD3 */<STM32_PINMUX('H', 11, ANALOG)>, 	/* ETH2_RGMII_RX_CLK */<STM32_PINMUX('G', 12, ANALOG)>; 	/* ETH2_RGMII_RX_CTL */};};ltdc_pins_a: ltdc-0 {pins {pinmux = <STM32_PINMUX('D',  9, AF13)>, /* LCD_CLK */<STM32_PINMUX('H',  10, AF13)>, /* LCD_HSYNC */<STM32_PINMUX('G',  4, AF11)>, /* LCD_VSYNC */ <STM32_PINMUX('H',  9, AF11)>, /* LCD_DE */<STM32_PINMUX('E', 11, AF9)>,  /* LCD_R0 */<STM32_PINMUX('D',  4, AF11)>, /* LCD_R1 */<STM32_PINMUX('G',  7, AF14)>, /* LCD_R2 */<STM32_PINMUX('B', 12, AF13)>, /* LCD_R3 */<STM32_PINMUX('D', 14, AF14)>, /* LCD_R4 */<STM32_PINMUX('E',  7, AF14)>, /* LCD_R5 */<STM32_PINMUX('E', 13, AF14)>, /* LCD_R6 */<STM32_PINMUX('E',  9, AF14)>, /* LCD_R7 */<STM32_PINMUX('F',  5, AF9)>,  /* LCD_G0 */<STM32_PINMUX('F',  1, AF14)>, /* LCD_G1 */<STM32_PINMUX('H', 13, AF14)>, /* LCD_G2 */<STM32_PINMUX('F',  3, AF14)>, /* LCD_G3 */<STM32_PINMUX('E', 12, AF11)>, /* LCD_G4 */<STM32_PINMUX('G',  0, AF14)>, /* LCD_G5 */<STM32_PINMUX('A', 12, AF14)>, /* LCD_G6 */<STM32_PINMUX('A', 15, AF11)>, /* LCD_G7 */<STM32_PINMUX('D',  5, AF13)>, /* LCD_B0 */<STM32_PINMUX('G',  8, AF7)>,  /* LCD_B1 */<STM32_PINMUX('D', 10, AF14)>, /* LCD_B2 */<STM32_PINMUX('F',  2, AF14)>, /* LCD_B3 */<STM32_PINMUX('G', 15, AF11)>, /* LCD_B4 */<STM32_PINMUX('D', 15, AF14)>, /* LCD_B5 */<STM32_PINMUX('D',  1, AF11)>, /* LCD_B6 */<STM32_PINMUX('E', 15, AF14)>; /* LCD_B7 */bias-disable;drive-push-pull;slew-rate = <1>;};};ltdc_sleep_pins_a: ltdc-sleep-0 {pins {pinmux = <STM32_PINMUX('D',  9, ANALOG)>, /* LCD_CLK */<STM32_PINMUX('H',  10, ANALOG)>, /* LCD_HSYNC */<STM32_PINMUX('G',  4, ANALOG)>, /* LCD_VSYNC */<STM32_PINMUX('H',  9, ANALOG)>, /* LCD_DE */<STM32_PINMUX('E', 11, ANALOG)>, /* LCD_R0 */<STM32_PINMUX('D',  4, ANALOG)>, /* LCD_R1 */				 <STM32_PINMUX('G',  7, ANALOG)>, /* LCD_R2 */<STM32_PINMUX('B', 12, ANALOG)>, /* LCD_R3 */<STM32_PINMUX('D', 14, ANALOG)>, /* LCD_R4 */<STM32_PINMUX('E',  7, ANALOG)>, /* LCD_R5 */<STM32_PINMUX('E', 13, ANALOG)>, /* LCD_R6 */<STM32_PINMUX('E',  9, ANALOG)>, /* LCD_R7 */<STM32_PINMUX('F',  5, ANALOG)>, /* LCD_G0 */<STM32_PINMUX('F',  1, ANALOG)>, /* LCD_G1 */				 <STM32_PINMUX('H', 13, ANALOG)>, /* LCD_G2 */<STM32_PINMUX('F',  3, ANALOG)>, /* LCD_G3 */<STM32_PINMUX('E', 12, ANALOG)>, /* LCD_G4 */<STM32_PINMUX('G',  0, ANALOG)>, /* LCD_G5 */<STM32_PINMUX('A', 12, ANALOG)>, /* LCD_G6 */<STM32_PINMUX('A', 15, ANALOG)>, /* LCD_G7 */<STM32_PINMUX('D',  5, ANALOG)>, /* LCD_B0 */<STM32_PINMUX('G',  8, ANALOG)>, /* LCD_B1 */				 <STM32_PINMUX('D', 10, ANALOG)>, /* LCD_B2 */<STM32_PINMUX('F',  2, ANALOG)>, /* LCD_B3 */<STM32_PINMUX('G', 15, ANALOG)>, /* LCD_B4 */<STM32_PINMUX('D', 15, ANALOG)>, /* LCD_B5 */<STM32_PINMUX('D',  1, ANALOG)>, /* LCD_B6 */<STM32_PINMUX('E', 15, ANALOG)>; /* LCD_B7 */};};sdmmc1_b4_pins_a: sdmmc1-b4-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('D', 2, AF12)>; /* SDMMC1_CMD */slew-rate = <1>;drive-push-pull;bias-disable;};};sdmmc1_b4_od_pins_a: sdmmc1-b4-od-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 */slew-rate = <1>;drive-push-pull;bias-disable;};pins2 {pinmux = <STM32_PINMUX('D', 2, AF12)>; /* SDMMC1_CMD */slew-rate = <1>;drive-open-drain;bias-disable;};};sdmmc1_b4_sleep_pins_a: sdmmc1-b4-sleep-0 {pins {pinmux = <STM32_PINMUX('C', 8, ANALOG)>, /* SDMMC1_D0 */<STM32_PINMUX('C', 9, ANALOG)>, /* SDMMC1_D1 */<STM32_PINMUX('C', 10, ANALOG)>, /* SDMMC1_D2 */<STM32_PINMUX('C', 11, ANALOG)>, /* SDMMC1_D3 */<STM32_PINMUX('C', 12, ANALOG)>, /* SDMMC1_CK */<STM32_PINMUX('D', 2, ANALOG)>; /* SDMMC1_CMD */};};sdmmc1_clk_pins_a: sdmmc1-clk-0 {pins {pinmux = <STM32_PINMUX('C', 12, AF12)>; /* SDMMC1_CK */slew-rate = <1>;drive-push-pull;bias-disable;};};sdmmc2_b4_pins_a: sdmmc2-b4-0 {pins {pinmux = <STM32_PINMUX('B', 14, AF10)>, /* SDMMC2_D0 */<STM32_PINMUX('B', 15, AF10)>, /* SDMMC2_D1 */<STM32_PINMUX('B', 3, AF10)>, /* SDMMC2_D2 */<STM32_PINMUX('B', 4, AF10)>, /* SDMMC2_D3 */<STM32_PINMUX('G', 6, AF10)>; /* SDMMC2_CMD */slew-rate = <1>;drive-push-pull;bias-pull-up;};};sdmmc2_b4_b7_pins_a: sdmmc2-b4-b7-0 {pins {pinmux = <STM32_PINMUX('F', 0, AF10)>, /* SDMMC2_D4 */<STM32_PINMUX('B', 9, AF10)>, /* SDMMC2_D5 */<STM32_PINMUX('C', 6, AF10)>, /* SDMMC2_D6 */				 <STM32_PINMUX('C', 7, AF10)>; /* SDMMC2_D7 */slew-rate = <1>;drive-push-pull;bias-pull-up;};};sdmmc2_b4_od_pins_a: sdmmc2-b4-od-0 {pins1 {pinmux = <STM32_PINMUX('B', 14, AF10)>, /* SDMMC2_D0 */<STM32_PINMUX('B', 15, AF10)>, /* SDMMC2_D1 */<STM32_PINMUX('B', 3, AF10)>, /* SDMMC2_D2 */<STM32_PINMUX('B', 4, AF10)>; /* SDMMC2_D3 */slew-rate = <1>;drive-push-pull;bias-pull-up;};pins2 {pinmux = <STM32_PINMUX('G', 6, AF10)>; /* SDMMC2_CMD */slew-rate = <1>;drive-open-drain;bias-pull-up;};};sdmmc2_b4_b7_od_pins_a: sdmmc2-b4-b7-od-0 {pins {pinmux = <STM32_PINMUX('F', 0, AF10)>, /* SDMMC2_D4 */<STM32_PINMUX('B', 9, AF10)>, /* SDMMC2_D5 */<STM32_PINMUX('C', 6, AF10)>, /* SDMMC2_D6 */				 <STM32_PINMUX('C', 7, AF10)>; /* SDMMC2_D7 */slew-rate = <1>;drive-push-pull;bias-pull-up;};};	sdmmc2_b4_sleep_pins_a: sdmmc2-b4-sleep-0 {pins {pinmux = <STM32_PINMUX('B', 14, ANALOG)>, /* SDMMC2_D0 */<STM32_PINMUX('B', 15, ANALOG)>, /* SDMMC2_D1 */<STM32_PINMUX('B', 3, ANALOG)>, /* SDMMC2_D2 */<STM32_PINMUX('B', 4, ANALOG)>, /* SDMMC2_D3 */<STM32_PINMUX('E', 3, ANALOG)>, /* SDMMC2_CK */<STM32_PINMUX('G', 6, ANALOG)>; /* SDMMC2_CMD */};};sdmmc2_b4_b7_sleep_pins_a: sdmmc2-b4-b7-sleep-0 {pins {pinmux = <STM32_PINMUX('F', 0, ANALOG)>, /* SDMMC2_D4 */<STM32_PINMUX('B', 9, ANALOG)>, /* SDMMC2_D5 */<STM32_PINMUX('C', 6, ANALOG)>, /* SDMMC2_D6 */				 <STM32_PINMUX('C', 7, ANALOG)>; /* SDMMC2_D7 */};};sdmmc2_clk_pins_a: sdmmc2-clk-0 {pins {pinmux = <STM32_PINMUX('E', 3, AF10)>; /* SDMMC2_CK */slew-rate = <1>;drive-push-pull;bias-pull-up;};};uart4_pins_a: uart4-0 {pins1 {pinmux = <STM32_PINMUX('D', 6, AF8)>; /* UART4_TX */bias-disable;drive-push-pull;slew-rate = <0>;};pins2 {pinmux = <STM32_PINMUX('D', 8, AF8)>; /* UART4_RX */bias-pull-up;};};uart4_idle_pins_a: uart4-idle-0 {pins1 {pinmux = <STM32_PINMUX('D', 6, ANALOG)>; /* UART4_TX */};pins2 {pinmux = <STM32_PINMUX('D', 8, AF8)>; /* UART4_RX */bias-pull-up;};};uart4_sleep_pins_a: uart4-sleep-0 {pins {pinmux = <STM32_PINMUX('D', 6, ANALOG)>, /* UART4_TX */<STM32_PINMUX('D', 8, ANALOG)>; /* UART4_RX */};};usbotg_hs_pins_a: usbotg-hs-0 {pins {pinmux = <STM32_PINMUX('A', 10, ANALOG)>; /* OTG_ID */};};
};

3.11 其他

        在stm32mp135-atk-u-boot.dtsi里,关于adc那一行是检测usb电压的,把它注释掉,然后笔者把快速启动注释了,led灯也没有用到。

	config {// u-boot,boot-led = "led-blue";// u-boot,error-led = "led-red";u-boot,mmc-env-partition = "u-boot-env";// st,adc_usb_pd = <&adc1 6>, <&adc1 12>;// st,fastboot-gpios = <&gpioa 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;st,stm32prog-gpios = <&gpioa 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;};

3.12 网络补充

        这里一点至关重要!!!!

        正点原子修改了phy的驱动,所以我们要找到drivers\net\phy\phy.c这个文件,在genphy_config_aneg(struct phy_device *phydev)这个函数后面插入

/***************alientek add****************/
#define YT8531_REG_DEBUG_ADDR_OFFSET		0x1e
#define YT8531_REG_DEBUG_DATA				0x1fstatic int yt8531_rd_ext(struct phy_device *phydev, u32 regnum)
{int val;phy_write(phydev, MDIO_DEVAD_NONE, YT8531_REG_DEBUG_ADDR_OFFSET, regnum);val = phy_read(phydev, MDIO_DEVAD_NONE, YT8531_REG_DEBUG_DATA);return val;
}static int yt8531_wr_ext(struct phy_device *phydev, u32 regnum, u16 val)
{int ret;ret = phy_write(phydev, MDIO_DEVAD_NONE, YT8531_REG_DEBUG_ADDR_OFFSET, regnum);ret = phy_write(phydev, MDIO_DEVAD_NONE, YT8531_REG_DEBUG_DATA, val);return ret;
}int yt8531_xtal_init(struct phy_device *phydev)
{int ret = 0;int val = 0;mdelay(50);do {ret = yt8531_wr_ext(phydev, 0xa012, 0x88);if (ret < 0)return ret;mdelay(100);val = yt8531_rd_ext(phydev, 0xa012);if (val < 0)return val;mdelay(20);} while (val != 0x88);ret = yt8531_wr_ext(phydev, 0xa012, 0xd0);if (ret < 0)return ret;return ret;
}void yt8531_led_init(struct phy_device *phydev)
{yt8531_wr_ext(phydev, 0xa00d, 0x2600);	//yellow led blinkyt8531_wr_ext(phydev, 0xa00c, 0x30);	//10_100M green led always lightyt8531_wr_ext(phydev, 0xa00e, 0x40);	//1000M green led always light	
}/*********************end add***************************/

然后修改 int genphy_update_link(struct phy_device *phydev)这个函数

/*** genphy_update_link - update link status in @phydev* @phydev: target phy_device struct** Description: Update the value in phydev->link to reflect the*   current link value.  In order to do this, we need to read*   the status register twice, keeping the second value.*/
int genphy_update_link(struct phy_device *phydev)
{unsigned int mii_reg;/************alientek add********/int ret = 0;unsigned int phyid1, phyid2;phyid1 = phy_read(phydev, MDIO_DEVAD_NONE, MII_PHYSID1);phyid2 = phy_read(phydev, MDIO_DEVAD_NONE, MII_PHYSID2);if((phyid1 == 0x4f51) && (phyid2 == 0xe91b)) { //YT8531 IDret = yt8531_xtal_init(phydev);if (ret < 0){printf("yt8531_xtal_init failed.\r\n");return ret;}yt8531_led_init(phydev);}/*********************end add***************************//** Wait if the link is up, and autonegotiation is in progress* (ie - we're capable and it's not done)*/mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMSR);/** If we already saw the link up, and it hasn't gone down, then* we don't need to wait for autoneg again*/if (phydev->link && mii_reg & BMSR_LSTATUS)return 0;if ((phydev->autoneg == AUTONEG_ENABLE) &&!(mii_reg & BMSR_ANEGCOMPLETE)) {int i = 0;printf("%s Waiting for PHY auto negotiation to complete",phydev->dev->name);while (!(mii_reg & BMSR_ANEGCOMPLETE)) {/** Timeout reached ?*/if (i > (PHY_ANEG_TIMEOUT / 50)) {printf(" TIMEOUT !\n");phydev->link = 0;return -ETIMEDOUT;}if (ctrlc()) {puts("user interrupt!\n");phydev->link = 0;return -EINTR;}if ((i++ % 10) == 0)printf(".");mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMSR);mdelay(50);	/* 50 ms */}printf(" done\n");phydev->link = 1;} else {/* Read the link a second time to clear the latched state */mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMSR);if (mii_reg & BMSR_LSTATUS)phydev->link = 1;elsephydev->link = 0;}return 0;
}

四、编译

make -f ../Makefile.sdk all

        由于我们前面已经编译好了TF-A和optee,在这里编译uboot的时候,会自动用fiptool给我们打包好,然后生成我们需要的fip-stm32mp135-atk-optee.bin文件

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/96026.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

充分理清限制与条件+构造二分图+最小割:ARC142E

https://www.luogu.com.cn/problem/AT_arc142_e 他的充要条件是是什么&#xff1a; a i , a j ≥ m i n ( b i , b j ) a_i,a_j\ge min(b_i,b_j) ai​,aj​≥min(bi​,bj​)存在 a i ≥ m a x ( b i , b j ) a_i\ge max(b_i,b_j) ai​≥max(bi​,bj​) 第一个条件直接预处理一…

Springcloud支付模块

客户端消费者80 order 微服务提供者8001 payment 订单模块可以调动支付模块 步骤&#xff1a; 1、建moudle 2、改写pom 3、写yml 4、主启类 5、业务类

【LinuxC】时间、时区,相关命令、函数

文章目录 一、序1.1 时间和时区1.11 时间1.12 时区 1.2 查看时间时区的命令1.21 Windows1.22 Linux 二、C语言函数2.1 通用2.11 函数简介2.12 数据类型简介 2.2 windows 和 Linux特有函数2.3 C语言示例 一、序 1.1 时间和时区 1.11 时间 时间是一种用来描述物体运动变化的量…

黑马点评-01基于Redis实现短信登陆的功能

环境准备 当前模型 nginx服务器的作用 手机或者app端向nginx服务器发起请求,nginx基于七层模型走的是HTTP协议,可以实现基于Lua直接绕开tomcat访问Redis nginx也可以作为静态资源服务器,轻松扛下上万并发并负载均衡到下游的tomcat服务器,利用集群支撑起整个项目 使用nginx部…

黑马JVM总结(二十七)

&#xff08;1&#xff09;synchronized代码块 synchronized代码块的底层原理&#xff0c;它是给一个对象进行一个加锁操作&#xff0c;它是如何保证如果你出现了synchronized代码块中出现了问题&#xff0c;它需要给这个对象有一个正确的解锁操作呢&#xff0c;加锁解锁是成对…

【c++_containers】10分钟带你学会list

前言 链表作为一个像是用“链子”链接起来的容器&#xff0c;在数据的存储等方面极为便捷。虽然单链表单独在实际的应用中没用什么作用&#xff0c;但是当他可以结合其他结构&#xff0c;比如哈希桶之类的。不过今天学习的list其实是一个带头双向链表。 言归正传&#xff0c;让…

overleaf在线编辑工具使用教程

文章目录 1 用 orcid注册overleaf获取模板2 使用模板 1 用 orcid注册overleaf获取模板 通常来说&#xff0c;在期刊投稿网站information for author中找template 。下载压缩包后上传到over leaf中。 加入找不到官方模板&#xff0c;用overleaf中的 2 使用模板 .bib文件&…

3D孪生场景SDK:Viwer 孪生世界

NSDT 编辑器 提供三维场景构建、场景效果设计、场景服务发布全流程工具等&#xff0c;其场景编辑器支持资产管理、灯光设置、骨骼动画等功能&#xff1b;致力于协助资源不足的中小企业及个人快速开发数字孪生场景&#xff0c;帮助企业提高生产力、实现降本增效。 NSDT编辑器简…

adb详细教程(四)-使用adb启动应用、关闭应用、清空应用数据、获取设备已安装应用列表

adb对于安卓移动端来说&#xff0c;是个非常重要的调试工具。本篇介绍常用的adb指令 文章目录 一、启动应用&#xff1a;adb shell am start二、使用浏览器打开指定网址&#xff1a;adb shell am start三、杀死应用进程adb shell am force-stop/adb shell am kill四、删除应用所…

【AI视野·今日CV 计算机视觉论文速览 第262期】Fri, 6 Oct 2023

AI视野今日CS.CV 计算机视觉论文速览 Fri, 6 Oct 2023 Totally 73 papers &#x1f449;上期速览✈更多精彩请移步主页 Daily Computer Vision Papers Improved Baselines with Visual Instruction Tuning Authors Haotian Liu, Chunyuan Li, Yuheng Li, Yong Jae Lee大型多模…

python开发幸运水果抽奖大转盘

概述 当我女朋友跟我说要吃水果&#xff0c;又不知道吃啥水果时候&#xff0c;她以为难为到我了&#xff0c;有啥事难为到程序员的呢&#xff01; 今天用python利用第三方tkinterthreadingtime库开发一个幸运水果抽奖大转盘&#xff01;抽到啥吃啥 详细 老规矩&#xff01;咱…

基于A4988/DRV8825的四路步进电机驱动器

概述 简化板的CNC sheild V3.0&#xff0c;仅保留步进电机速度与方向的控制引脚STEP/DIR、使能端EN、芯片供电VCC\GND&#xff0c;共计11个引脚。PCB四周开设四个M3通孔&#xff0c;以便于安装固定。此外&#xff0c;将板载的焊死的保险丝更改为可更换的保险座保险丝&#xff…

Labview 实战 99乘法表

基于新手小白&#xff0c;使用Labview实现99乘法表&#xff0c;敢于发表自己的一点方法&#xff0c;还请各位大侠放过&#xff01; 如下&#xff1a; 运行效果如下&#xff1a; 思路为&#xff1a;将要显示出来的数据&#xff0c;全部转换为字符串形式&#xff0c;再塞入到数组…

Java基于SSM+Vue的平时成绩管理系统

末尾获取源码 开发语言&#xff1a;Java Java开发工具&#xff1a;JDK1.8 后端框架&#xff1a;SSM 前端&#xff1a;采用Vue技术开发 数据库&#xff1a;MySQL5.7和Navicat管理工具结合 服务器&#xff1a;Tomcat8.5 开发软件&#xff1a;IDEA / Eclipse 是否Maven项目&#x…

频次直方图、KDE和密度图

Seaborn的主要思想是用高级命令为统计数据探索和统计模型拟合创建各种图形&#xff0c;下面将介绍一些Seaborn中的数据集和图形类型。 虽然所有这些图形都可以用Matplotlib命令实现&#xff08;其实Matplotlib就是Seaborn的底层&#xff09;&#xff0c;但是用 Seaborn API会更…

基于SSM+Vue的鲜花销售系统设计与实现

末尾获取源码 开发语言&#xff1a;Java Java开发工具&#xff1a;JDK1.8 后端框架&#xff1a;SSM 前端&#xff1a;采用Vue技术开发 数据库&#xff1a;MySQL5.7和Navicat管理工具结合 服务器&#xff1a;Tomcat8.5 开发软件&#xff1a;IDEA / Eclipse 是否Maven项目&#x…

Kafka快速实战以及基本原理详解

这一部分主要是接触 Kafka &#xff0c;并熟悉 Kafka 的使用方式。快速熟练的搭建 kafka 服务&#xff0c;对于快速验证一些基于Kafka 的解决方案&#xff0c;也是非常有用的。 一、 Kafka 介绍 ChatGPT 对于 Apache Kafka 的介绍&#xff1a; 1 、 MQ 的作用 MQ &#xff1a;…

【AI视野·今日NLP 自然语言处理论文速览 四十九期】Fri, 6 Oct 2023

AI视野今日CS.NLP 自然语言处理论文速览 Fri, 6 Oct 2023 Totally 44 papers &#x1f449;上期速览✈更多精彩请移步主页 Daily Computation and Language Papers MathCoder: Seamless Code Integration in LLMs for Enhanced Mathematical Reasoning Authors Ke Wang, Houxi…

【Java 进阶篇】使用 JDBCTemplate 执行 DQL 语句详解

在前面的文章中&#xff0c;我们已经学习了如何使用 Spring 的 JDBCTemplate 执行 DML&#xff08;Data Manipulation Language&#xff09;操作&#xff0c;包括插入、更新和删除操作。现在&#xff0c;让我们来深入了解如何使用 JDBCTemplate 执行 DQL&#xff08;Data Query…

Youtube视频下载工具分享-油管视频,音乐,字幕下载方法汇总

YouTube视频下载方法简介 互联网上存在很多 YouTube 下载工具&#xff0c;但我们经常会发现自己收藏的工具没过多久就会失效&#xff0c;我们为大家整理的这几种方法&#xff0c;是存在时间较久并且亲测可用的。后续如果这些工具失效或者有更好的工具&#xff0c;我们也会分享…