odroid-c2 linux 4.15 and eMMC [SOLVED - well work arround]

This is for ARMv8 based devices

odroid-c2 linux 4.15 and eMMC [SOLVED - well work arround]

Postby summers » Sun Feb 18, 2018 11:26 am

Just had something odd happen. I've been using arch on a sd card for some time, and updated to the mainline kernel. That worked fine.

So just decided to move root to an eMMC card. But what seems strange is on the odroid-c2 whenever I try and write to the eMMC card I get CRC errors.

Not downgrading to hardkernel linux 3.14 - and I can write to the eMMC.

Has anyone else had this - trying to get to the bottom of it ....
Last edited by summers on Mon Feb 19, 2018 12:00 pm, edited 1 time in total.
summers
 
Posts: 984
Joined: Sat Sep 06, 2014 12:56 pm

Re: odroid-c2 linux 4.15 and eMMC

Postby naums » Sun Feb 18, 2018 12:15 pm

So, you are moving a root-partition from SD to eMMC? So, running on a PC doing

$this->bbcode_second_pass_quote('', 's')udo dd if=<sdcard> of=<image>
sudo dd if=<image> of=<emmc>


yes? If so: be sure to change /boot/boot.ini file and modify the root-UUID. If not: what are you trying to do and with what tools? What parameters do you pass, what is the output?
naums
 
Posts: 27
Joined: Sun Dec 31, 2017 11:11 am

Re: odroid-c2 linux 4.15 and eMMC

Postby summers » Sun Feb 18, 2018 12:37 pm

well I was going to install from latest: ArchLinuxARM-odroid-c2-latest.tar.gz

Problem is I didn't get that far, running fdisk on the odoid, and on trying to write it I got CRC errors. So I moved the eMMC to my desk top, where went to latest. Then booted via the SD card and still had CRC errors.

Reflecting on it, this story doesn't make much sense. When I installed on the PC to the eMMC, when the odroid booted, it booted from the SD. That is odd behaviour - it isn't odroid standard way to boot. Thats when I saw CRC errors. However clearing out the SD card, and then rewriting the latest odroid c2 arch to the eMMC, and machine booted fine. The default image still uses 3.14 kernel, so put it down to that.

Half think I should try the upgrade to mainline linux again, just to see if the problem happens again.
summers
 
Posts: 984
Joined: Sat Sep 06, 2014 12:56 pm

Re: odroid-c2 linux 4.15 and eMMC

Postby summers » Sun Feb 18, 2018 2:00 pm

OK its definitly the mainline kernel.

Reinstalled completely clean ArchLinuxARM-odroid-c2-latest.tar.gz.

The odroid-c2 was running fine on the 3.14 kernel, I updated to mainline:
$this->bbcode_second_pass_code('', 'pacman -R uboot-odroid-c2
pacman -S uboot-odroid-c2-mainline linux-aarch64
systemctl reboot')
Hardware wasn't touched physically during this - so can't have created a bad connection.

On reboot started getting the CRC errors again.

Lets see whats useful in dmesg:
$this->bbcode_second_pass_code('', '
[ 1.774051] meson-gx-mmc d0074000.mmc: allocated mmc-pwrseq
[ 2.163204] meson-gx-mmc d0072000.mmc: Got CD GPIO
[ 2.707512] mmc0: new HS200 MMC card at address 0001
[ 2.707953] mmcblk0: mmc0:0001 8GME4R 7.28 GiB
[ 2.711495] mmcblk0boot0: mmc0:0001 8GME4R partition 1 4.00 MiB
[ 2.717359] mmcblk0boot1: mmc0:0001 8GME4R partition 2 4.00 MiB
[ 2.723176] mmcblk0rpmb: mmc0:0001 8GME4R partition 3 512 KiB, chardev (239:0)
[ 2.730904] mmcblk0: p1
[ 3.086087] mmcblk0: response CRC error sending r/w cmd command, card status 0xd00
[ 8.548473] print_req_error: I/O error, dev mmcblk0, sector 4458496
[ 13.194033] print_req_error: I/O error, dev mmcblk0, sector 2048
[ 13.199970] Buffer I/O error on dev mmcblk0p1, logical block 0, lost sync page write
')
Can't find anything useful in /sys.

I'll leave the odroid up for a bit in case people have questions - but can't do much on it as the root file system is mounted read only. So the *only* way forward is for me to reimage the OS on my desktop ...
Last edited by summers on Sun Feb 18, 2018 2:58 pm, edited 1 time in total.
summers
 
Posts: 984
Joined: Sat Sep 06, 2014 12:56 pm

Re: odroid-c2 linux 4.15 and eMMC

Postby summers » Sun Feb 18, 2018 2:49 pm

This looks suspicious:

https://github.com/torvalds/linux/commit/fe0e58048f005fdce315eb4d185e5c160be4ac01#diff-28b82751ace1b69457b0df82d61a5edf

the mmc meson gx driver looks like it is still having changes made. I wonder if this will make it out in a 4.15.x kernel, or if we have to wait for 4.16? As its a revert - guess we may well see in a 4.15.x ...
summers
 
Posts: 984
Joined: Sat Sep 06, 2014 12:56 pm

Re: odroid-c2 linux 4.15 and eMMC

Postby LNHRT » Sun Feb 18, 2018 8:46 pm

I had the same problem with mainline kernel and emmc module. The problem is the set frequency in the device tree.
I reduced it from 200 to 150 to get rid of the CRC errors. I created a small stupid script, that is doing this for me. The script is triggered by a pacman hook.

Hook:
$this->bbcode_second_pass_code('', '
[Trigger]
Operation = Upgrade
Operation = Install
Type = Package
Target = linux-aarch64

[Action]
Description = Modify Orodid C2 Device Tree for eMMC...
When = PostTransaction
Exec = /usr/local/bin/modify_odroid_c2_dtb.sh')

Script:
$this->bbcode_second_pass_code('', '#!/bin/bash

VAR_ORG=0xbebc200
VAR_NEW=0x8f0d180
VAR_DTB=/boot/dtbs/amlogic/meson-gxbb-odroidc2.dtb
VAR_DTS=/boot/dtbs/amlogic/meson-gxbb-odroidc2.dts

# decompile meson-gxbb-odroidc2.dtb
/usr/bin/dtc -I dtb -O dts -o ${VAR_DTS} ${VAR_DTB}

# change max-frequency for eMMC from 0xbebc200 to 0x8f0d180
/usr/bin/sed -i "s/${VAR_ORG}/${VAR_NEW}/g" ${VAR_DTS}

# compile modified dts to meson-gxbb-odroidc2.dtb
/usr/bin/dtc -O dtb -b O -o ${VAR_DTB} ${VAR_DTS}')

Propably not the nicest solution, but it works for me.
LNHRT
 
Posts: 2
Joined: Sun Feb 18, 2018 8:41 pm

Re: odroid-c2 linux 4.15 and eMMC

Postby summers » Mon Feb 19, 2018 9:41 am

Yes that would tally with the kernel revert. Reading between the lines the timing on the odroid-c2 seems touch and go with HS200 and HS400.

So changing the device tree is a software hack for a probable hardware problem.

Still your solution at least gives a way to get the machine working again without a fresh install of the OS. Still means pulling the eMMC card - as only way to write it it is away from the odroid-c2.

Thanks for the suggestion, I like it. I'll apply after breakfast.
summers
 
Posts: 984
Joined: Sat Sep 06, 2014 12:56 pm

Re: odroid-c2 linux 4.15 and eMMC

Postby summers » Mon Feb 19, 2018 11:44 am

Bingo. Yes that worked - down clocking the eMMC in the device tree.

Makes me wonder how common this problem is on odroid-c2, so what the solution should be.

On the one hand, the eMMC is either HS200 or HS400 standard. Problem is at least some, if not many, odroid-c2 aren't able to cope with that timing. Now if the problem is widespread, it suggests it should be adopted as the default in the device tree.

As the eMMC cards are HS200 or HS400, you have to wonder what the fault is. As far as I can see baylibre, the linux-meson maintainers, are checking with amlogic, and implementing the mainline driver as per design; so sounds to me like its not a kernel problem. Half have to wonder if its the odroid-c2 design of a plug in eMMC card, now that is a nice interface - but is this what eMMC has been designed for?

Oh yes, is there a package with dtc in it? I've always used the one in the kernel/scripts directory - and I only do kernels on my desk top - seems no point in compiling kernels on the small arm boxes. So at the moment can only do dtc on desktop, but ideally could do it direct on the odroid-c2

P.S. I guess mmc@74000 means the eMMC socket? its has bus width of 8 (whereas mmc@72000 sound like the sd slot, with bus width of 4).

P.P.S dtc package contains dtc .... doah!

Also should be able to get uboot to modify the device tree - so if modern uboot reads a file from /boot should be able to do it that way.
summers
 
Posts: 984
Joined: Sat Sep 06, 2014 12:56 pm

Re: odroid-c2 linux 4.15 and eMMC [SOLVED - well work arroun

Postby summers » Mon Feb 19, 2018 7:27 pm

OK tried the uboot method.

Added to /boot/boot.txt:

$this->bbcode_second_pass_code('', 'fdt addr ${fdt_addr_r}
fdt set /soc/apb@d0000000/mmc@74000 max-frequency <0x8f0d180>')

compiled with
$this->bbcode_second_pass_code('', './mksrc')

And this seems to work. This is with the distributed dtb. This change should stay when the kernel is updated, and only need checking when uboot is updated ...

You can check it worked via
$this->bbcode_second_pass_code('', 'hexdump -C /proc/device-tree/soc/apb\@d0000000/mmc\@74000/max-frequency')
e.g.
$this->bbcode_second_pass_quote('', '0')0000000 08 f0 d1 80

Or in decimal:
$this->bbcode_second_pass_code('', 'od -td4 --endian=big /proc/device-tree/soc/apb\@d0000000/mmc\@74000/max-frequency
0000000 150000000
')
summers
 
Posts: 984
Joined: Sat Sep 06, 2014 12:56 pm

Re: odroid-c2 linux 4.15 and eMMC [SOLVED - well work arroun

Postby LNHRT » Thu Feb 22, 2018 2:55 pm

Yes, the uboot modification is also working. Just tried it.
Is trim working for your eMMC module with mainline kernel and mainline uboot?
It was just working for me with legacy Hardkernel kernel.
LNHRT
 
Posts: 2
Joined: Sun Feb 18, 2018 8:41 pm

Next

Return to ARMv8 Devices

Who is online

Users browsing this forum: No registered users and 3 guests