[Linux驱动炼成记] 05-存储eMMC配置

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/z2066411585/article/details/83095688

嵌入式开发环境

  • 主控芯片: Amlogic A113X
  • Linux Kernel : 4.9
  • eMMc : 金士顿 4GB
    lADPDgQ9qSqDpHLNCADNBvY_1782_20482.jpg
  1. A113X主控芯片
  2. 金士顿的4GB eMMC
  3. 海力士256M DDR
  4. 博通WIFI模组 AP6212

支持eMMC

现有项目存储需要由Nand Flash换成eMMC

eMMC介绍

eMMC (Embedded Multi Media Card) 为MMC协会所订立的,eMMC 相当于 NandFlash+主控IC ,对外的接口协议与SD、TF卡一样,主要是针对手机或平板电脑等产品的内嵌式存储器标准规格。eMMC的一个明显优势是在封装中集成了一个控制器,它提供标准接口并管理闪存,使得手机厂商就能专注于产品开发的其它部分,并缩短向市场推出产品的时间。这些特点对于希望通过缩小光刻尺寸和降低成本的NAND供应商来说,同样的重要。1

原厂补丁介绍

原厂主要提供3个补丁: uboot,kernel,rootfs

  • kernel改动如下
    • 禁用nand flash
    • 使能eMMC
+++ b/arch/arm64/boot/dts/amlogic/xxx.dts
@@ -60,7 +60,7 @@
 	mtd_nand {
 		compatible = "amlogic, aml_mtd_nand";
 		dev_name = "mtdnand";
-		status = "okay";
+		status = "disable";
 		reg = <0x0 0xFFE07800 0x0 0x200>;
 		interrupts = <	0 34 1 >;
 		pinctrl-names = "nand_rb_mod","nand_norb_mod", "nand_cs_only";
@@ -465,7 +465,7 @@
 		};
 	};
 	sd_emmc_c: emmc@ffe07000 {
-		status = "disabled";
+		status = "okay";
 		compatible = "amlogic, meson-aml-mmc";
 		reg = <0x0 0xffe07000 0x0 0x2000>;
 		interrupts = <0 218 1>;
@@ -629,7 +629,7 @@
 		system:system
 		{
 			pname = "system";
-			size = <0x0 0x80000000>;
+			size = <0x0 0x82000000>;
 			mask = <1>;
 		};
 		cache:cache
-- 
1.9.1

  • 内存大小配置
	memory@00000000 {
		device_type = "memory";
		linux,usable-memory = <0x0 0x000000 0x0 0x10000000>;
	};

这个很重要,内存大小不匹配,会造成内核崩溃,由于这点排除了将近3h

  • 文件系统主由buildroot配置编译,主要改动如下:
//分区格式又ubifs改为ext2 
-BR2_TARGET_ROOTFS_INITRAMFS_LIST="board/amlogic/common/initramfs/initramfs-49/ramfslist-32-ubi-release"
+BR2_TARGET_ROOTFS_INITRAMFS_LIST="board/amlogic/common/initramfs/initramfs-49/ramfslist-32-ext2"
-BR2_TARGET_UBOOT_AMLOGIC_BOOTARGS="root=/dev/ubi0_0 rootfstype=ubifs init=/sbin/init"
+BR2_TARGET_UBOOT_AMLOGIC_BOOTARGS="root=/dev/system rootfstype=ext4 init=/sbin/init
问题点

打完原提供的补丁之后,编译固件烧录,系统进入文件系统提示:

[    2.428575@1] meson-mmc: add_emmc_partition
[    2.432972@1] meson-mmc: [mmcblk0p01]           bootloader  offset 0x000000000000, size 0x000000400000 
[    2.442260@1] meson-mmc: [mmcblk0p02]             reserved  offset 0x000002400000, size 0x000004000000 
[    2.451530@1] meson-mmc: [mmcblk0p03]                cache  offset 0x000006c00000, size 0x000020000000 
[    2.460851@1] meson-mmc: [mmcblk0p04]                  env  offset 0x000027400000, size 0x000000800000 
[    2.470182@1] meson-mmc: [mmcblk0p05]                 logo  offset 0x000028400000, size 0x000002000000 
[    2.479483@1] meson-mmc: [mmcblk0p06]             recovery  offset 0x00002ac00000, size 0x000002000000 
[    2.488812@1] meson-mmc: [mmcblk0p07]                  rsv  offset 0x00002d400000, size 0x000000800000 
[    2.498127@1] meson-mmc: [mmcblk0p08]                  tee  offset 0x00002e400000, size 0x000000800000 
[    2.507435@1] meson-mmc: [mmcblk0p09]                crypt  offset 0x00002f400000, size 0x000002000000 
[    2.516736@1] meson-mmc: [mmcblk0p10]                 misc  offset 0x000031c00000, size 0x000002000000 
[    2.526073@1] meson-mmc: [mmcblk0p11]            instaboot  offset 0x000034400000, size 0x000000400000 
[    2.535382@1] meson-mmc: [mmcblk0p12]                 boot  offset 0x000035000000, size 0x000002000000 
[    2.544688@1] meson-mmc: [mmcblk0p13]               system  offset 0x000037800000, size 0x000082000000 
[    2.554014@1] meson-mmc: [mmcblk0p14]                 data  offset 0x0000ba000000, size 0x000028000000 
[    2.563147@1] card key: card_blk_probe.
[    2.566920@1] emmc_key_init:183 emmc key lba_start:0x12020,lba_end:0x12220
[    2.573731@1] emmc key: emmc_key_init:205 ok.
[    2.578066@1] meson-mmc: amlmmc_dtb_init: register dtb chardev[    2.583862@1] meson-mmc: amlmmc_dtb_init: register dtb chardev OK
[    2.589749@1] meson-mmc: Exit aml_emmc_partition_ops OK.
[    2.815558@3] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
[    2.815608@3] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1
[    2.823704@3] xhci-hcd xhci-hcd.0.auto: hcc params 0x0220f664 hci version 0x100 quirks 0x02010010
[    2.832219@3] xhci-hcd xhci-hcd.0.auto: irq 26, io mem 0xff500000
[    2.839052@3] hub 1-0:1.0: USB hub found
[    2.842123@3] hub 1-0:1.0: 1 port detected
[    2.846403@3] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
[    2.851750@3] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 2
[    2.859554@3] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[    2.868496@3] hub 2-0:1.0: USB hub found
[    2.871617@3] hub 2-0:1.0: config failed, hub doesn't have any ports! (err -19)
[    2.879625@3] platform ff642000.audiobus:loopback: Can't retrieve tdmin_mpll clock
[    2.886341@3] if use extern loopback, pls set datalb-lane-mask-in
[    2.892359@3] parse loopback:,       lb mode:0
[    2.896319@3]        datain_src:4, datain_chnum:8, datain_chumask:3f
[    2.902100@3]        datalb_src:2, datalb_chnum:2
[    2.906237@3]        datalb_chswap:0x0,datalb_chumask:3
[    2.913126@3] aml_pdm_probe
[    2.913674@3] aml_pdm_dai_probe
[    2.916781@3] aml_dai_set_tdm_sysclk freq(12288000), mpll/mclk(2)
[    2.922942@3] aml_dai_set_tdm_slot(), txmask(0x3), rxmask(0x3)
[    2.928578@3]        slots(2), slot_width(32), lanes(1)
[    2.933258@3] asoc aml_dai_set_tdm_fmt, 0x4014, ffffffc00cccd118, id(0), clksel(0)
[    2.940750@3] pad clk ctl value:0
[    2.944015@3] sclk_ph0 (pad) clk ctl set:0
[    2.948070@3] master_mode(1), binv(0), finv(0) out_skew(1), in_skew(3)
[    2.954893@3] asoc-aml-card auge_sound: multicodec <-> TDM-A mapping ok
[    2.961104@3] aml_dai_set_tdm_sysclk freq(12288000), mpll/mclk(2)
[    2.967244@3] aml_dai_set_tdm_slot(), txmask(0x3), rxmask(0x3)
[    2.972909@3]        slots(2), slot_width(32), lanes(1)
[    2.977572@3] asoc aml_dai_set_tdm_fmt, 0x4001, ffffffc00cccd318, id(1), clksel(1)
[    2.985072@3] pad clk ctl value:3
[    2.988347@3] sclk_ph0 (pad) clk ctl set:3
[    2.992403@3] master_mode(1), binv(0), finv(0) out_skew(1), in_skew(3)
[    2.999089@3] asoc-aml-card auge_sound: multicodec <-> TDM-B mapping ok
[    3.005429@3] aml_dai_set_tdm_sysclk freq(12288000), mpll/mclk(2)
[    3.011574@3] aml_dai_set_tdm_slot(), txmask(0x3), rxmask(0x3)
[    3.017242@3]        slots(2), slot_width(32), lanes(2)
[    3.021910@3] tas575x_set_dai_fmt, format:0x4011
[    3.026471@3] asoc aml_dai_set_tdm_fmt, 0x4011, ffffffc00cccd618, id(2), clksel(2)
[    3.033976@3] pad clk ctl value:3
[    3.037250@3] sclk_ph0 (pad) clk ctl set:3
[    3.041306@3] master_mode(1), binv(0), finv(0) out_skew(1), in_skew(3)
[    3.047929@3] asoc-aml-card auge_sound: tas575x <-> TDM-C mapping ok
[    3.054282@3] aml_pdm_pcm_new dai->name: ff642000.audiobus:pdm dai->id: 0
[    3.060839@3] asoc-aml-card auge_sound: dummy <-> ff642000.audiobus:pdm mapping ok
[    3.070351@3] snd_card_add_kcontrols card:ffffffc00d1b9818
[    3.075047@0] aml_vrtc rtc: setting system clock to 2015-01-01 00:00:05 UTC (1420070405)
[    3.082182@0] dwc_otg: usb0: type: 2 speed: 0, config: 0, dma: 0, id: 0, phy: ffe09000, ctrl: 0
[    3.190782@0] dwc_otg: Core Release: 3.10a
[    3.190812@0] dwc_otg: Setting default values for core params
[    3.194974@0] dwc_otg: curmode: 0, host_only: 0
[    3.211743@0] dwc_otg: Using Buffer DMA mode
[    3.211763@0] dwc_otg: OTG VER PARAM: 1, OTG VER FLAG: 1
[    3.215642@0] dwc_otg: Working on port type = SLAVE
[    3.220475@0] dwc_otg: Dedicated Tx FIFOs mode
[    3.226670@0] cpucore_cooling_register, max_cpu_core_num:4
[    3.238246@0] gxbb_pm: enter meson_pm_probe!
[    3.238363@0] gxbb_pm: meson_pm_probe done
[    3.24126    3.247556@0] meson_uart ff803000.serial: ttyS0 use xtal(8M) 24000000 change 115200 to 115200
[    3.252569@0] Freeing unused kernel memory: 4480K
[    3.255336@0] Failed to execute /init (error -2) //-2 返回值代表文件夹不存在
[    3.265107@0] meson_uart ff803000.serial: ttyS0 use xtal(8M) 24000000 change 115200 to 115200
mkdir: can't create directory '/dev/pts': File exists
can't run '/etc/init.d/rcS': No such file or directory
can't open /dev/null: No such file or directory
can't open /dev/null: No such file or directory
can't open /dev/null: No such file or directory
can't open /dev/null: No such file or directory
can't open /dev/null: No such file or directory
  • 看到Failed to execute /init (error -2)参考2,可以确定返回值的含义3

  1. NorFlash、NandFlash、eMMC比较区别 ↩︎

  2. Linux init failures now easier to debug ↩︎

  3. Failed to execute /init ↩︎

猜你喜欢

转载自blog.csdn.net/z2066411585/article/details/83095688