Skip to content
Advertisement

Linux kernel does not see all components on my at91sam9g20 board

I am working with a Stamp9g20 embedded chip. It is based on the Atmel at91sam9g20 platform. For a client I need to upgrade the kernel to a newer version. After a bit of research, I landed on the Linux4SAM pages and their additional yocto layer, complete with a 4.14 kernel!

However, when I compile that kernel, I don’t see all of my devices, for example, I can write onto the NAND memory and mount an USB device, but I cannot see nor mount any mmc/mci devices. I have tried checking how the Stamp9g20 really differs from the AT91SAM9G20EK, but I couldn’t find a definitive clue to an answer there.

The Linux4SAM repo supports slightly different versions of the AT91SAM9 family, but I got it working for the 4.14 kernel, using the at91sam9g20ek.dts as an input for the board. Had to add my machine to the compatible machine list, so it will compile for the 9g20 versions as well.

COMPATIBLE_MACHINE += 'at91sam9g20ek'

and my machine.conf looks like:

#@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"

When the kernel launches, it shows that it registers a device driver onto the address 0xffff8000, but it doesn’t see a block device.

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

I have tried this board with the 2.6.x version where it works as expected.

How can I make the block device mmcblk available in the system? Do I need to change the .dts (currently I am using the at91sam9g20ek.dts as a template with a minor change to the NAND memory). Or what can I do to get more information as to why the kernel doesn’t interact with the mmc device?

Also, if I compare the source code from before the dts structure, I don’t see significant differences in the mcc part of the code: 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

The only difference I found, at91sam9g20ek board:

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

stamp9g20 board:

    .slot_b     = 0,

so I tried changing the reg<> property in the dts to 1, but to no avail…

Advertisement

Answer

Found it! All I had to do was change the mmc slot (was 1) in the dts to slot 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>;
                                };
                        };

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement