1
完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
1.实验原理
参考原理图可知eMMC使用的是sdmmc2总线,当前所使用的设备树文件中没有sdmmc2的支持,所以需要增加相关内容才能正常驱动eMMC。 由于在使STM32MP1芯片很多管脚为多功能复用管脚,且很多管脚具备同样的功能,所以移植eMMC时需要确认硬件设计是使用的是那些管脚,根据原理图确认后管脚对应关系为:
参考文档: Documentation/devicetree/bindings/mmc/mmc-controller.yaml Documentation/devicetree/bindings/mmc/mmci.txt 内核中ST对STM32MP15x系列芯片的设备树资源了做了定义,可参见: arch/arm/boot/dts/stm32mp151.dtsi stm32mp151中sdmmc2定义如下: sdmmc2: sdmmc@58007000 { compatible = "arm,pl18x", "arm,primecell"; arm,primecell-periphid = <0x00253180>; reg = <0x58007000 0x1000>, <0x58008000 0x1000>; interrupts = interrupt-names = "cmd_irq"; clocks = <&rcc SDMMC2_K>; clock-names = "apb_pclk"; resets = <&rcc SDMMC2_R>; cap-sd-highspeed; cap-mmc-highspeed; max-frequency = <120000000>; status = "disabled"; }; 上述代码只对sdmmc2做了基本的初始化,并没有针对不同的硬件设计做适配,所以需结合硬件补全设备树节点信息。 eMMC有8根数据线,且eMMC无需热插拔等功能,结合硬件信息添加sdmmc2节点信息,也可参考内核中其他设备树文件中相关描述,比如stm32mp15xx-edx.dtsi关于sdmmc2的描述符合我们的要求,内容如下: &sdmmc2 { pinctrl-names = "default", "opendrain", "sleep"; pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_pins_a>; pinctrl-1 = <&sdmmc2_b4_od_pins_a &sdmmc2_d47_pins_a>; pinctrl-2 = <&sdmmc2_b4_sleep_pins_a &sdmmc2_d47_sleep_pins_a>; non-removable; no-sd; no-sdio; st,neg-edge; bus-width = <8>; vmmc-supply = <&v3v3>; vqmmc-supply = <&vdd>; mmc-ddr-3_3v; status = "okay"; };
在内核中STM32MP1默认管脚定义在文件arch/arm/dts/stm32mp15-pinctrl.dtsi中,查看文件中是否有需要的管脚定义: 查看后确认有sdmmc2的管脚定义,且与FS-MP1A硬件使用情况一致,定义如下: sdmmc2_b4_pins_a: sdmmc2-b4-0 { pins1 { pinmux = slew-rate = <1>; drive-push-pull; bias-pull-up; }; pins2 { pinmux = slew-rate = <2>; drive-push-pull; bias-pull-up; }; }; sdmmc2_b4_od_pins_a: sdmmc2-b4-od-0 { pins1 { pinmux = slew-rate = <1>; drive-push-pull; bias-pull-up; }; pins2 { pinmux = slew-rate = <2>; drive-push-pull; bias-pull-up; }; pins3 { pinmux = slew-rate = <1>; drive-open-drain; bias-pull-up; }; }; sdmmc2_b4_sleep_pins_a: sdmmc2-b4-sleep-0 { pins { pinmux = }; }; sdmmc2_b4_pins_b: sdmmc2-b4-1 { pins1 { pinmux = slew-rate = <1>; drive-push-pull; bias-disable; }; pins2 { pinmux = slew-rate = <2>; drive-push-pull; bias-disable; }; }; sdmmc2_b4_od_pins_b: sdmmc2-b4-od-1 { pins1 { pinmux = slew-rate = <1>; drive-push-pull; bias-disable; }; pins2 { pinmux = slew-rate = <2>; drive-push-pull; bias-disable; }; pins3 { pinmux = slew-rate = <1>; drive-open-drain; bias-disable; }; }; sdmmc2_d47_pins_a: sdmmc2-d47-0 { pins { pinmux = slew-rate = <1>; drive-push-pull; bias-pull-up; }; }; sdmmc2_d47_sleep_pins_a: sdmmc2-d47-sleep-0 { pins { pinmux = }; }; 2.实验目的 熟悉基于Linux操作系统下的块设备驱动移植配置过程。 3.实验平台 华清远见开发环境,FS-MP1A平台; 4.实验步骤 1.导入交叉编译工具链 linux@ubuntu:$ source /opt/st/stm32mp1/3.1-openstlinux-5.4-dunfell-mp1-20-06-24/environment-setup-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi 2.添加eMMC设备树配置 修改arch/arm/boot/dts/stm32mp15xx-fsmp1x.dtsi文件 在原有sdmmc1节点下添加如下内容: &sdmmc2 { pinctrl-names = "default", "opendrain", "sleep"; pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_pins_a>; pinctrl-1 = <&sdmmc2_b4_od_pins_a &sdmmc2_d47_pins_a>; pinctrl-2 = <&sdmmc2_b4_sleep_pins_a &sdmmc2_d47_sleep_pins_a>; non-removable; no-sd; no-sdio; st,neg-edge; bus-width = <8>; vmmc-supply = <&v3v3>; vqmmc-supply = <&vdd>; mmc-ddr-3_3v; status = "okay"; }; 3.配置内核 由于内核源码默认配置已经支持eMMC,本节列出主要选项,如下 linux@ubuntu:$ make menuconfig Device Drivers ---> <*> MMC/SD/SDIO card support --->
|
|||
|
|||
只有小组成员才能发言,加入小组>>
3310 浏览 9 评论
2991 浏览 16 评论
3492 浏览 1 评论
9055 浏览 16 评论
4086 浏览 18 评论
1174浏览 3评论
603浏览 2评论
const uint16_t Tab[10]={0}; const uint16_t *p; p = Tab;//报错是怎么回事?
596浏览 2评论
用NUC131单片机UART3作为打印口,但printf没有输出东西是什么原因?
2333浏览 2评论
NUC980DK61YC启动随机性出现Err-DDR是为什么?
1894浏览 2评论
小黑屋| 手机版| Archiver| 德赢Vwin官网 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-21 20:55 , Processed in 1.297590 second(s), Total 80, Slave 61 queries .
Powered by 德赢Vwin官网 网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
德赢Vwin官网 观察
版权所有 © 湖南华秋数字科技有限公司
德赢Vwin官网 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号