【问题标题】:Linux kernel does not see all components on my at91sam9g20 boardLinux 内核看不到我的 at91sam9g20 板上的所有组件
【发布时间】:2019-10-02 18:35:27
【问题描述】:

我正在使用Stamp9g20 嵌入式芯片。它基于 Atmel at91sam9g20 平台。对于客户端,我需要将内核升级到更新版本。经过一番研究,我找到了Linux4SAM 页面及其附加的 yocto 层,并配有 4.14 内核!

但是,当我编译该内核时,我看不到我的所有设备,例如,我可以写入 NAND 内存并挂载 USB 设备,但我看不到也无法挂载任何 mmc/mci 设备。我曾尝试检查 Stamp9g20 与 AT91SAM9G20EK 的真正区别,但我无法找到确切的答案。

Linux4SAM 存储库支持稍有不同的 AT91SAM9 系列版本,但我让它适用于 4.14 内核,使用 at91sam9g20ek.dts 作为板的输入。必须将我的机器添加到兼容机器列表中,因此它也可以编译为 9g20 版本。

COMPATIBLE_MACHINE += 'at91sam9g20ek'

我的 machine.conf 看起来像:

#@Name: ATMEL AT91SAM9G20EK 
#@DESCRIPTION: Machine configuration for Atmel's evaluation board
#

# define SOC_FAMILY (we are the family of ...)

SOC_FAMILY = "atsam9"

# Add arm926ejs to the DEFAULTTUNE, so it will be selected in our environment
DEFAULTTUNE = "arm926ejs"

# http://lists.openembedded.org/pipermail/openembedded-core/2019-January/277527.html
#TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv5', ' -march=armv5t${ARMPKGSFX_DSP}', '', d)}"
TUNE_CCARGS = "${@bb.utils.contains('TUNE_FEATURES', 'armv5', ' -march=armv5t${ARMPKGSFX_DSP}', '', d)}"

# We rely on the generic meta-atmel layer
require conf/machine/include/at91sam9.inc

MACHINE_FEATURES = "apm ext2 ext3 ext4 usbhost usbgadget vfat jffs2"

# This device tree is available in the kernel
KERNEL_DEVICETREE = " \
                        at91sam9g20ek.dtb \
                     "
# Create filesystems tar.gz and jffs2
IMAGE_FSTYPES += " tar.gz jffs2 tar"

# UNTESTED IMAGES (both bootstrap and uboot)
UBOOT_MACHINE ?= "at91sam9g20ek_nandflash_defconfig"
UBOOT_ENTRYPOINT = "0x20008000"
UBOOT_LOADADDRESS = "0x20008000"

AT91BOOTSTRAP_MACHINE ?= "at91sam9g20ek"

当内核启动时,它显示它在地址 0xffff8000 上注册了一个设备驱动程序,但它没有看到块设备。

bus: 'mmc': add driver mmcblk       
bus: 'sdio': add driver sdio_uart
bus: 'platform': add driver atmel_mci
bus: 'platform': driver_probe_device: matched device fffa8000.mmc with driver atmel_mci
bus: 'platform': really_probe: probing driver atmel_mci with device fffa8000.mmc
atmel_mci fffa8000.mmc: no init pinctrl state
atmel_mci fffa8000.mmc: version: 0x210
atmel_mci fffa8000.mmc: using PDC              
device: 'mmc0': device_add                     
atmel_mci fffa8000.mmc: Atmel MCI controller at 0xfffa8000 irq 30, 1 slots
driver: 'atmel_mci': driver_bound: bound to device 'fffa8000.mmc'
bus: 'platform': really_probe: bound device fffa8000.mmc to driver atmel_mci

我已经用 2.6.x 版本试用过这个板,它可以按预期工作。

如何使块设备 mmcblk 在系统中可用?我是否需要更改 .dts(目前我使用 at91sam9g20ek.dts 作为模板,对 NAND 内存进行了细微更改)。或者我能做些什么来获得更多关于内核为什么不与 mmc 设备交互的信息?

另外,如果我比较 dts 结构之前的源代码,我看不出代码的 mcc 部分有显着差异: https://elixir.bootlin.com/linux/v3.6.9/source/arch/arm/mach-at91/board-sam9g20ek.c https://elixir.bootlin.com/linux/v3.6.9/source/arch/arm/mach-at91/board-stamp9g20.c

我发现的唯一区别是, at91sam9g20ek 板:

    .slot_b     = 1,    /* Only one slot so use slot B */

stamp9g20 板:

    .slot_b     = 0,

所以我尝试将 dts 中的 reg 属性更改为 1,但无济于事...

【问题讨论】:

  • 您是否检查了您正在使用的设备树是否使用与您的硬件预期相同的 MMC 引脚复用和相同的 SoC 引脚?我将首先查看硬件原理图并交叉检查设备树中是否使用了 MMC 的相同引脚。您需要检查 Stamp9g20 与 AT91SAM9G20EK 在硬件连接方面的 MMC 有何不同。
  • 感谢您的回复。试图在原理图中找到一些差异,但在 MMC 中没有找到。正如他们的参考pagePlease note that this is the same slot used on the Evaluation Board 中所述,我希望它能够完全按照参考板进行配置。但我会研究多路复用,也许我会在那里找到一些线索。

标签: linux linux-kernel embedded-linux device-tree


【解决方案1】:

找到了!我所要做的就是将 dts 中的 mmc 插槽(原为 1)更改为插槽 0:

--- a/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
+++ b/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
@@ -39,8 +39,8 @@

                                };

-                               mmc0_slot1 {
-                                       pinctrl_board_mmc0_slot1: mmc0_slot1-board {
+                               mmc0_slot0 {
+                                       pinctrl_board_mmc0_slot0: mmc0_slot0-board {
                                                atmel,pins =
                                                        <AT91_PIOC 9 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;   /* PC9 gpio CD pin pull up and deglitch */
                                        };
@@ -90,15 +90,14 @@

                        mmc0: mmc@fffa8000 {
                                pinctrl-0 = <
-                                       &pinctrl_board_mmc0_slot1
+                                       &pinctrl_board_mmc0_slot0
                                        &pinctrl_mmc0_clk
-                                       &pinctrl_mmc0_slot1_cmd_dat0
-                                       &pinctrl_mmc0_slot1_dat1_3>;
+                                       &pinctrl_mmc0_slot0_cmd_dat0
+                                       &pinctrl_mmc0_slot0_dat1_3>;
                                status = "okay";
-                               slot@1 {
-                                       reg = <1>;
+                               slot@0 {
+                                       reg = <0>;
                                        bus-width = <4>;
-                                       cd-gpios = <&pioC 9 GPIO_ACTIVE_HIGH>;
                                };
                        };

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-01-23
    • 1970-01-01
    • 2016-03-20
    • 2020-10-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-07
    相关资源
    最近更新 更多