0

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...

2
  • 1
    Did you check if the device tree you are using uses the same pin multiplexing and the same SoC pins for MMC as expected by your hardware? I would first look at the hardware schematics and cross check if the same pins for MMC are used in the device tree. You need to check how Stamp9g20 really differs from the AT91SAM9G20EK with regards to MMC in hardware connection. May 16, 2019 at 2:29
  • Thanks for your reply. Tried to find some diferences in the schematics, but none found in the MMC. As stated on their reference page, Please note that this is the same slot used on the Evaluation Board I would expect it to be configured exactly as the reference board. But I'll look into to multiplexing, maybe I'll find some clues there.
    – MBrothers
    May 17, 2019 at 7:04

1 Answer 1

0

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>;
                                };
                        };

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.