QEMU仿真器不会为i.MX6 sabrelite初始化mmc卡

时间:2019-03-24 11:08:00

标签: linux-kernel arm embedded-linux virtualization qemu

我试图在带有#41-Ubuntu 4.15.0-38通用SMP的主机上使用QEMU仿真器版本3.1.0在i.MX6Q设备上进行仿真。

CPU:   Freescale i.MX6Q rev1.2 at 792 MHz
Board: Mx6Q 4G
Boot Device: SPI NOR
I2C:   ready
DRAM:  3.7 GiB
MMC:   FSL_SDHC: 0

下面是我模仿设备的逐步方法

步骤1 ::将uImage从实际设备复制到主机

第2步:使用以下命令从实际设备中克隆SD / MMC卡

sudo dd if=/dev/sdc of=sdcard1.img bs=4096 conv=notrunc,noerror

现在在主机上具有uImage和SD卡映像的副本,下面的命令用于启动仿真器。

$./qemu-3.1.0/arm-softmmu/qemu-system-arm 
-machine sabrelite,accel=kvm:tcg 
-kernel uImage 
-m 3840 
-smp cpus=4 
-serial mon:stdio 
-drive file=sdcard1.img,format=raw,id=mycard 
-device sd-card,drive=mycard

它已如下所示正确启动了内核uImage

VNC server running on 127.0.0.1:5900
Booting Linux on physical CPU 0x0
Initializing cgroup subsys cpuset
Initializing cgroup subsys cpu
Initializing cgroup subsys cpuacct
Linux version 3.10.53 (build_team@u1004-swb02) (gcc version 4.7.3 20130102 (prerelease) (crosstool-NG 1.18.0) ) #1 SMP PREEMPT Tue Jun 13 16:03:05 PDT 2017
CPU: ARMv7 Processor [410fc090] revision 0 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
Machine: i.MX6q 
... so on

但是,它没有附加从实际设备克隆的sdcard映像,只是忽略了它,并且像下面一样继续进行,而未安装mmc0。

mmc0: no vqmmc regulator found
mmc0: no vmmc regulator found
mmc0: SDHCI controller on 2190000.usdhc [2190000.usdhc] using ADMA
mmc2: no vqmmc regulator found
mmc2: no vmmc regulator found
mmc2: SDHCI controller on 2198000.usdhc [2198000.usdhc] using ADMA

在实际设备上,我相信mmc是由U-Boot本身初始化的。并在内核执行期间将其安装到mmblk0,如下所示。

mmc0: no vqmmc regulator found
mmc0: no vmmc regulator found
mmc0: SDHCI controller on 2190000.usdhc [2190000.usdhc] using ADMA
mmc2: no vqmmc regulator found
mmc2: no vmmc regulator found
mmc0: host does not support reading read-only switch. assuming write-enable.
mmc0: new high speed SDHC card at address 59b4
mmcblk0: mmc0:59b4 HSG04 3.74 GiB
 mmcblk0: p1 p2
mmc2: SDHCI controller on 2198000.usdhc [2198000.usdhc] using ADMA

与此处的实际设备不同,mmc不会通过u-boot初始化,并且内核将直接通过QEMU进行引导,因此,在特定的引导点之后,内核崩溃并显示错误“无法在虚拟地址ffffffec处处理内核调页请求”。 >

所以我的问题是如何在QEMU中用内核(无u-boot)初始化mmc驱动器。还是我在创建mmc驱动器或用于初始化mmc驱动器的qemu命令的任何步骤中都出错了?

在设备树上添加更多信息。它实际上是定制板。不太确定DT的节点。请参阅与mmc设备相关的设备树摘录。请检查并提供您的输入。

aliases {
    .... other device info
    mmc0 = "/soc/aips-bus@02100000/usdhc@02190000";
    mmc1 = "/soc/aips-bus@02100000/usdhc@02194000";
    mmc2 = "/soc/aips-bus@02100000/usdhc@02198000";
    mmc3 = "/soc/aips-bus@02100000/usdhc@0219c000";
    ....
};


soc {
    #address-cells = <0x1>;
    #size-cells = <0x1>;
    compatible = "simple-bus";
    interrupt-parent = <0x1>;
    ranges;
    .....
        iomuxc@020e0000 {
            reg = <0x20e0000 0x4000>;
            compatible = "fsl,imx6q-iomuxc";
            pinctrl-names = "default";
            pinctrl-0 = <0x16>;
            ..........

            usdhc1 {

                usdhc1grp-1 {
                    fsl,pins = <0x348 0x730 0x0 0x0 0x0 0x17071 0x350 0x738 0x0 0x0 0x0 0x10071 0x340 0x728 0x0 0x0 0x0 0x17071 0x33c 0x724 0x0 0x0 0x0 0x17071 0x34c 0x734 0x0 0x0 0x0 0x17071 0x344 0x72c 0x0 0x0 0x0 0x17071>;
                    linux,phandle = <0x1d>;
                    phandle = <0x1d>;
                };
            };

            usdhc2 {

                usdhc2grp-1 {
                    fsl,pins = <0x358 0x740 0x0 0x0 0x0 0x17059 0x354 0x73c 0x0 0x0 0x0 0x10059 0x54 0x368 0x0 0x0 0x0 0x17059 0x4c 0x360 0x0 0x0 0x0 0x17059 0x50 0x364 0x0 0x0 0x0 0x17059 0x35c 0x744 0x0 0x0 0x0 0x17059 0x30c 0x6f4 0x0 0x1 0x0 0x17059 0x310 0x6f8 0x0 0x1 0x0 0x17059 0x314 0x6fc 0x0 0x1 0x0 0x17059 0x318 0x700 0x0 0x1 0x0 0x17059>;
                };

                usdhc2grp-2 {
                    fsl,pins = <0x358 0x740 0x0 0x0 0x0 0x17059 0x354 0x73c 0x0 0x0 0x0 0x10059 0x54 0x368 0x0 0x0 0x0 0x17059 0x4c 0x360 0x0 0x0 0x0 0x17059 0x50 0x364 0x0 0x0 0x0 0x17059 0x35c 0x744 0x0 0x0 0x0 0x17059>;
                };
            };

            usdhc3 {

                usdhc3grp-1 {
                    fsl,pins = <0x2b8 0x6a0 0x0 0x0 0x0 0x17059 0x2bc 0x6a4 0x0 0x0 0x0 0x10059 0x2c0 0x6a8 0x0 0x0 0x0 0x17059 0x2c4 0x6ac 0x0 0x0 0x0 0x17059 0x2c8 0x6b0 0x0 0x0 0x0 0x17059 0x2cc 0x6b4 0x0 0x0 0x0 0x17059 0x2b4 0x69c 0x0 0x0 0x0 0x17059 0x2b0 0x698 0x0 0x0 0x0 0x17059 0x2ac 0x694 0x0 0x0 0x0 0x17059 0x2a8 0x690 0x0 0x0 0x0 0x17059>;
                };

                usdhc3grp-1-100mhz {
                    fsl,pins = <0x2b8 0x6a0 0x0 0x0 0x0 0x170b9 0x2bc 0x6a4 0x0 0x0 0x0 0x100b9 0x2c0 0x6a8 0x0 0x0 0x0 0x170b9 0x2c4 0x6ac 0x0 0x0 0x0 0x170b9 0x2c8 0x6b0 0x0 0x0 0x0 0x170b9 0x2cc 0x6b4 0x0 0x0 0x0 0x170b9 0x2b4 0x69c 0x0 0x0 0x0 0x170b9 0x2b0 0x698 0x0 0x0 0x0 0x170b9 0x2ac 0x694 0x0 0x0 0x0 0x170b9 0x2a8 0x690 0x0 0x0 0x0 0x170b9>;
                };

                usdhc3grp-1-200mhz {
                    fsl,pins = <0x2b8 0x6a0 0x0 0x0 0x0 0x170f9 0x2bc 0x6a4 0x0 0x0 0x0 0x100f9 0x2c0 0x6a8 0x0 0x0 0x0 0x170f9 0x2c4 0x6ac 0x0 0x0 0x0 0x170f9 0x2c8 0x6b0 0x0 0x0 0x0 0x170f9 0x2cc 0x6b4 0x0 0x0 0x0 0x170f9 0x2b4 0x69c 0x0 0x0 0x0 0x170f9 0x2b0 0x698 0x0 0x0 0x0 0x170f9 0x2ac 0x694 0x0 0x0 0x0 0x170f9 0x2a8 0x690 0x0 0x0 0x0 0x170f9>;
                };

                usdhc3grp-2 {
                    fsl,pins = <0x2b8 0x6a0 0x0 0x0 0x0 0x17059 0x2bc 0x6a4 0x0 0x0 0x0 0x10059 0x2c0 0x6a8 0x0 0x0 0x0 0x17059 0x2c4 0x6ac 0x0 0x0 0x0 0x17059 0x2c8 0x6b0 0x0 0x0 0x0 0x17059 0x2cc 0x6b4 0x0 0x0 0x0 0x17059>;
                    linux,phandle = <0x1e>;
                    phandle = <0x1e>;
                };
            };

            usdhc4 {

                usdhc4grp-1 {
                    fsl,pins = <0x2f4 0x6dc 0x0 0x0 0x0 0x17059 0x2f8 0x6e0 0x0 0x0 0x0 0x10059 0x31c 0x704 0x0 0x1 0x0 0x17059 0x320 0x708 0x0 0x1 0x0 0x17059 0x324 0x70c 0x0 0x1 0x0 0x17059 0x328 0x710 0x0 0x1 0x0 0x17059 0x32c 0x714 0x0 0x1 0x0 0x17059 0x330 0x718 0x0 0x1 0x0 0x17059 0x334 0x71c 0x0 0x1 0x0 0x17059 0x338 0x720 0x0 0x1 0x0 0x17059>;
                };

                usdhc4grp-2 {
                    fsl,pins = <0x2f4 0x6dc 0x0 0x0 0x0 0x17059 0x2f8 0x6e0 0x0 0x0 0x0 0x10059 0x31c 0x704 0x0 0x1 0x0 0x17059 0x320 0x708 0x0 0x1 0x0 0x17059 0x324 0x70c 0x0 0x1 0x0 0x17059 0x328 0x710 0x0 0x1 0x0 0x17059>;
                };
            };

    aips-bus@02100000 {
        compatible = "fsl,aips-bus", "simple-bus";
        #address-cells = <0x1>;
        #size-cells = <0x1>;
        reg = <0x2100000 0x100000>;
        ranges;
        .....

        usdhc@02190000 {
            compatible = "fsl,imx6q-usdhc";
            reg = <0x2190000 0x4000>;
            interrupts = <0x0 0x16 0x4>;
            clocks = <0x2 0xa3 0x2 0xa3 0x2 0xa3>;
            clock-names = "ipg", "ahb", "per";
            bus-width = <0x4>;
            status = "okay";
            non-removable;
            pinctrl-names = "default";
            pinctrl-0 = <0x1d>;
            no-1-8-v;
        };

        usdhc@02194000 {
            compatible = "fsl,imx6q-usdhc";
            reg = <0x2194000 0x4000>;
            interrupts = <0x0 0x17 0x4>;
            clocks = <0x2 0xa4 0x2 0xa4 0x2 0xa4>;
            clock-names = "ipg", "ahb", "per";
            bus-width = <0x4>;
            status = "disabled";
        };

        usdhc@02198000 {
            compatible = "fsl,imx6q-usdhc";
            reg = <0x2198000 0x4000>;
            interrupts = <0x0 0x18 0x4>;
            clocks = <0x2 0xa5 0x2 0xa5 0x2 0xa5>;
            clock-names = "ipg", "ahb", "per";
            bus-width = <0x4>;
            status = "okay";
            non-removable;
            pinctrl-names = "default";
            pinctrl-0 = <0x1e>;
            no-1-8-v;
        };

        usdhc@0219c000 {
            compatible = "fsl,imx6q-usdhc";
            reg = <0x219c000 0x4000>;
            interrupts = <0x0 0x19 0x4>;
            clocks = <0x2 0xa6 0x2 0xa6 0x2 0xa6>;
            clock-names = "ipg", "ahb", "per";
            bus-width = <0x4>;
            status = "disabled";
        };

0 个答案:

没有答案