【北京迅为】《i.MX8MM嵌入式Linux开发指南》-第四篇 嵌入式Linux系统移植篇-第七十一章内核基础配置
i.MX8MM处理器采用了先进的14LPCFinFET工艺,提供更快的速度和更高的电源效率;四核Cortex-A53,单核Cortex-M4,多达五个内核 ,主频高达1.8GHz,2G DDR4内存、8G EMMC存储。千兆工业级以太网、MIPI-DSI、USB HOST、WIFI/BT、4G模块、CAN、RS485等接口一应俱全。H264、VP8视频硬编码,H.264、H.265、VP8、VP9视频硬解码,并提供相关历程,支持8路PDM接口、5路SAI接口、2路Speaker。系统支持Android9.0(支持获取root限)Linux4.14.78+Qt5.10.1、Yocto、Ubuntu20、Debian9系统。适用于智能充电桩,物联网,工业控制,医疗,智能交通等,可用于任何通用工业和物联网应用、
【公众号】迅为电子
【粉丝群】258811263
第七十一章内核基础配置
71.1 电源管理配置
我们进入到内核源码文件夹,如下图所示:
然后修改/home/topeet/bsp_kernel_imx/bsp_kernel_imx/linux-imx/arch/arm64/boot/dts/freescale/itop8mm-evk.dts设备树文件,添加如下内容:
#if 0
pmic: bd71837@4b {........................};
/*add by apple*/
#else
pmic: pca9450@25 {
reg = <0x25>;
compatible = "nxp,pca9450";
/* PMIC PCA9450 PMIC_nINT GPIO1_IO3 */
pinctrl-0 = <&pinctrl_pmic>;
gpio_intr = <&gpio1 3 GPIO_ACTIVE_LOW>;
gpo {
nxp,drv = <0x0C>; /* 0b0000_1100 all gpos with cmos output mode */
};
regulators {
#address-cells = <1>;
#size-cells = <0>;
pca9450,pmic-buck2-uses-i2c-dvs;
/* Run/Standby voltage */
pca9450,pmic-buck2-dvs-voltage = <950000>, <850000>;
buck1_reg: regulator@0 {
reg = <0>;
regulator-compatible = "buck1";
regulator-min-microvolt = <600000>;
regulator-max-microvolt = <2187500>;
regulator-boot-on;
regulator-always-on;
regulator-ramp-delay = <3125>;
};
buck2_reg: regulator@1 {
reg = <1>;
regulator-compatible = "buck2";
regulator-min-microvolt = <600000>;
regulator-max-microvolt = <2187500>;
regulator-boot-on;
regulator-always-on;
regulator-ramp-delay = <3125>;
};
buck3_reg: regulator@2 {
reg = <2>;
regulator-compatible = "buck3";
regulator-min-microvolt = <600000>;
regulator-max-microvolt = <2187500>;
regulator-boot-on;
regulator-always-on;
};
buck4_reg: regulator@3 {
reg = <3>;
regulator-compatible = "buck4";
regulator-min-microvolt = <600000>;
regulator-max-microvolt = <3400000>;
regulator-boot-on;
regulator-always-on;
};
buck5_reg: regulator@4 {
reg = <4>;
regulator-compatible = "buck5";
regulator-min-microvolt = <600000>;
regulator-max-microvolt = <3400000>;
regulator-boot-on;
regulator-always-on;
};
buck6_reg: regulator@5 {
reg = <5>;
regulator-compatible = "buck6";
regulator-min-microvolt = <600000>;
regulator-max-microvolt = <3400000>;
regulator-boot-on;
regulator-always-on;
};
ldo1_reg: regulator@6 {
reg = <6>;
regulator-compatible = "ldo1";
regulator-min-microvolt = <1600000>;
regulator-max-microvolt = <3300000>;
regulator-boot-on;
regulator-always-on;
};
ldo2_reg: regulator@7 {
reg = <7>;
regulator-compatible = "ldo2";
regulator-min-microvolt = <800000>;
regulator-max-microvolt = <1150000>;
regulator-boot-on;
regulator-always-on;
};
ldo3_reg: regulator@8 {
reg = <8>;
regulator-compatible = "ldo3";
regulator-min-microvolt = <800000>;
regulator-max-microvolt = <3300000>;
regulator-boot-on;
regulator-always-on;
};
ldo4_reg: regulator@9 {
reg = <9>;
regulator-compatible = "ldo4";
regulator-min-microvolt = <800000>;
regulator-max-microvolt = <3300000>;
regulator-boot-on;
regulator-always-on;
};
ldo5_reg: regulator@10 {
reg = <10>;
regulator-compatible = "ldo5";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <3300000>;
};
};
};
#endif
电源管理 regulator 节点修改如下图所示,注释掉如下图所示框柱的部分。
然后将网盘资料“iTOP-i.MX8MM开发板\02-i.MX8MM开发板网盘资料汇总(不含光盘内容)\嵌入式Linux开发指南(iTOP-i.MX8MM)手册配套资料\3.Linux系统移植\8.移植内核需要用到的文件\00 适配电源管理芯片需要使用的文件”目录下的pca9450.c文件拷贝到内核源码linux-imx/driver/mfd目录下。pca9450.h拷贝到源码linux-imx/include/linux/mfd目录下。
然后修改linux-imx/driver/mfd/Makefile文件,添加如下内容:
obj-$(CONFIG_MFD_PCA9450) += pca9450.o
然后修改linux-imx/driver/mfd/Kconfig文件,如下图所示:
config MFD_PCA9450
bool "PCA9450 Power Management chip"
depends on I2C=y
select MFD_CORE
help
if you say yes here you get support for the PCA9450
Power Management chips.
在上面小节配置完毕,保存修改,然后重新打开一个终端,输入以下命令,将默认的配置文件写入到.config文件。
make defconfig
然后输入以下命令进入menuconfig进行配置,如下所示:
export ARCH=arm64
make menuconfig
然后按如下图所示的路径,配置上屏幕,如下图所示:
Location: │
│ -> Device Drivers │
│ -> Multifunction device drivers
最后保存配置文件到arch/arm64/configs/defconfig文件,如下图所示:
然后再回到之前的终端窗口进行编译镜像。
71.2 基础配置
修改/home/topeet/bsp_kernel_imx/bsp_kernel_imx/linux-imx/arch/arm64/boot/dts/freescale/itop8mm-evk.dts设备树文件,将model的值改为“TOPEET i.MX8MM EVK board”
model = "TOPEET i.MX8MM EVK board";
经过上面的修改,如下图所示的值会变成自己设置的内容。
71.3 配置底板按键
修改/home/topeet/bsp_kernel_imx/bsp_kernel_imx/linux-imx/arch/arm64/boot/dts/freescale/itop8mm-evk.dts设备树文件,在根目录下添加gpio-keys节点。
gpio-keys {
compatible = "gpio-keys";
autorepeat;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_gpio_keys>;
volumeup {
label = "GPIO Key VOLUMEUP";
linux,code = <115>;
gpios = <&gpio4 31 GPIO_ACTIVE_LOW>;
};
volumedown {
label = "GPIO Key VOLUMEDOWN";
linux,code = <114>;
gpios = <&gpio4 28 GPIO_ACTIVE_LOW>;
};
back {
label = "GPIO Key BACK";
linux,code = <172>;
gpios = <&gpio5 2 GPIO_ACTIVE_LOW>;
};
};
然后在&iomuxc中添加pinctrl信息,如下图所示:
pinctrl_gpio_keys: gpio_keys {
fsl,pins = <
MX8MM_IOMUXC_SAI3_TXFS_GPIO4_IO31 0x19
MX8MM_IOMUXC_SAI3_RXFS_GPIO4_IO28 0x19
MX8MM_IOMUXC_SAI3_MCLK_GPIO5_IO2 0x19
>;
};
71.4 串口配置
iTOP-iMX8MM开发板底板上默认有四个串口,在我们默认配置中,串口2作为A53核的调试打印,串口4是调试M4内核的串口,原理图如下图所示:
串口1 是普通串口,串口3用做了485,原理图如下图所示:
修改/home/topeet/bsp_kernel_imx/bsp_kernel_imx/linux-imx/arch/arm64/boot/dts/freescale/itop8mm-evk.dts设备树文件,然后注释掉如下图所示内容:
modem_reset: modem-reset {
compatible = "gpio-reset";
reset-gpios = <&gpio2 6 GPIO_ACTIVE_LOW>;
reset-delay-us = <2000>;
reset-post-delay-ms = <40>;
#reset-cells = <0>;
};
Uart1串口注释掉如下内容
&uart1 { /* BT */
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart1>;
assigned-clocks = <&clk IMX8MM_CLK_UART1_SRC>;
assigned-clock-parents = <&clk IMX8MM_SYS_PLL1_80M>;
/*fsl,uart-has-rtscts;
resets = <&modem_reset>;*/
status = "okay";
};
Uart3注释掉如下内容:
&uart3 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart3>;
assigned-clocks = <&clk IMX8MM_CLK_UART3_SRC>;
assigned-clock-parents = <&clk IMX8MM_SYS_PLL1_80M>;
/*fsl,uart-has-rtscts;*/
status = "okay";
};
接下来我们来配置pinctrl信息,如下图所示:
Uart1注释掉如下所示的内容:
Uart3 修改为如下图所示:
然后保存修改,重新编译源码,然后烧写镜像,输入以下命令查看是否生成串口:
ls /dev/ttymx*
如上图所示,/dev/ttymxc0,/dev/ttymxc1,/dev/ttymxc2分别是串口1 串口2 串口3。
原文地址:https://blog.csdn.net/BeiJingXunWei/article/details/140802068
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!