Talustus / i9100-uboot

Other
3 stars 7 forks source link

Porting i9100 patches to newer u-boot version: Sdhci driver fail #1

Closed onny closed 4 years ago

onny commented 4 years ago

Hey, I would like to port the i9100 patches to a newer uboot version. Maybe not to the most recent version, because this would require a lot of refactoring etc., but to a version less older than 2012.04. So here is what I did:

git clone https://github.com/u-boot/u-boot.git
cd u-boot
git checkout f8c4a86b5e9717c1539b6aa45667ba531581ab28
patch -p1 -i ../i9100-uboot/i9100-uboot-2012.07.patch
patch -p1 -i ../i9100-uboot/i9100-uboot-2012.04-min-bootarchlinux.patch
export PATH="/usr/local/arm/gcc-arm-none-eabi-4_9-2015q3/bin:$PATH"
export ARCH=arm
export CROSS_COMPILE=arm-none-eabi-
make galaxys2

This is working so far. I took the changes made by @astarasikov and put them into a patch file and adapted it to a newer version of u-boot: https://git.project-insanity.org/onny/i9100-uboot/-/blob/master/i9100-uboot-2012.07.patch Therefore the patch is already smaller in size and is still working. Unfortunately starting with this commit, switching from s5p_mmc to s5p_sdhci driver, booting on the Galaxy S2 fails: https://github.com/u-boot/u-boot/commit/6bc337fb13003a9a949dfb2713e308fb97faae8a As far as I can see I had only to change these lines in include/configs/galaxys2.h to support the sdhci driver:

/* SD/MMC configuration */
#define CONFIG_GENERIC_MMC              1
#define CONFIG_MMC                      1
#define CONFIG_S5P_MMC                  1

to

/* SD/MMC configuration */
#define CONFIG_GENERIC_MMC              1
#define CONFIG_MMC                      1
#define CONFIG_SDHCI                  1
#define CONFIG_S5P_SDHCI                  1

It compiles fine and uboot is starting, but with following error: image

MMC read: dev # 0, block # 90112, count 16384 ... MMC: block number 0x1a000 exceeds max(0x0)
0 blocks read: ERROR
Command Line: console=tty0 consoleblank=0 root=/dev/mmcblk1p1 rw rootfstype=ext4 rootwait init=/sbin/init
Wrong Image Format for bootm command
ERROR: can't get kernel image!
Failed to boot

So if anyone has an idea what I could do to further debug this issue (@Sekilsgs2 ?), I would be very glad :)

Best regards Jonas

Sekilsgs2 commented 4 years ago

I'm try research in next days share where all sources for this ?

пн, 9 мар. 2020 г., 11:36 Jonas Heinrich notifications@github.com:

Hey, I would like to port the i9100 patches to a newer uboot version. Maybe not to the most recent version, because this would require a lot of refactoring etc., but to a version less older than 2012.04. So here is what I did:

git clone https://github.com/u-boot/u-boot.git cd u-boot git checkout f8c4a86b5e9717c1539b6aa45667ba531581ab28 patch -p1 -i ../i9100-uboot/i9100-uboot-2012.07.patch patch -p1 -i ../i9100-uboot/i9100-uboot-2012.04-min-bootarchlinux.patch export PATH="/usr/local/arm/gcc-arm-none-eabi-4_9-2015q3/bin:$PATH" export ARCH=arm export CROSS_COMPILE=arm-none-eabi- make galaxys2

This is working so far. I took the changes made by @astarasikov https://github.com/astarasikov and put them into a patch file and adapted it to a newer version of u-boot: https://git.project-insanity.org/onny/i9100-uboot/-/blob/master/i9100-uboot-2012.07.patch Therefore the patch is already smaller in size and is still working. Unfortunately starting with this commit, switching from s5p_mmc to s5p_sdhci driver, booting on the Galaxy S2 fails: u-boot/u-boot@6bc337f https://github.com/u-boot/u-boot/commit/6bc337fb13003a9a949dfb2713e308fb97faae8a As far as I see I had only to change these lines in include/configs/galaxys2.h to support the sdhci driver:

/ SD/MMC configuration /

define CONFIG_GENERIC_MMC 1

define CONFIG_MMC 1

define CONFIG_S5P_MMC 1

to

/ SD/MMC configuration /

define CONFIG_GENERIC_MMC 1

define CONFIG_MMC 1

define CONFIG_SDHCI 1

define CONFIG_S5P_SDHCI 1

It compiles fine and uboot is starting, but with following error: [image: image] https://user-images.githubusercontent.com/757752/76195580-e9245200-61e8-11ea-9ff8-3ea49bef386b.png

MMC read: dev # 0, block # 90112, count 16384 ... MMC: block number 0x1a000 exceeds max(0x0) 0 blocks read: ERROR Command Line: console=tty0 consoleblank=0 root=/dev/mmcblk1p1 rw rootfstype=ext4 rootwait init=/sbin/init Wrong Image Format for bootm command ERROR: can't get kernel image! Failed to boot

So if anyone has an idea what I could do to further debug this issue ( @Sekilsgs2 https://github.com/Sekilsgs2 ?), I would be very glad :)

Best regards Jonas

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Talustus/i9100-uboot/issues/1?email_source=notifications&email_token=ABNCP5EACWKXFCLQVPF2E5LRGSTBPA5CNFSM4LEDSKXKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4ITPTDGQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNCP5FN7KRWRANMYPGRTPLRGSTBPANCNFSM4LEDSKXA .

onny commented 4 years ago

It looks like u-boot is still able to find the mmc devices using the newer sdhci driver:

# mmc list
SAMSUNG SDHCI: 0
SAMSUNG SDHCI: 1

Booting fails with the error mentioned above. With the old driver, mmc list is printing:

SAMSUNG SD/MMC: 0
SAMSUNG SD/MMC: 1

Also changing mmc dev 0; to mmc dev 1; doesn't resolve the issue with the s5p_sdhci driver in include/configs/galaxys2.h:

147   │     "boot_android=" \
148   │         "mmc dev 1; " \
149   │         "mmc read ${loadaddr} 0x16000 0x4000; " \
150   │         "setenv bootargs console=tty0 consoleblank=0 root=/dev/mmcblk1p1 rw rootfstype=ext4 rootwait init=/sbin/init;"\
151   │         "echo Command Line: ${bootargs}; " \
152   │         "bootm ${loadaddr}\0" \

Bootup error shows a slightly different error message:

MMC read: dev # 1, block # 90112, count 16384 ... Transfer data timeout
0 blocks read: ERROR
[...]

Would be really glad if someone could give me a hint ;) @jh80chung @kyungmin-park

onny commented 4 years ago

Okay it really looks like the newer s5p_sdhci driver is unable to read the partition table of the internal eMMC device. I used following commands in uboot and compared the working version (s5p_mmc) with the faulty one (s5p_sdhci):

[...]
158   │         "mmc rescan; " \
159   │         "echo mmc list; " \
160   │         "mmc list; " \
161   │         "echo mmc dev 0 and part; " \
162   │         "mmc dev 0; " \
163   │         "mmc part; " \
164   │         "echo mmc dev 1 and part; " \
165   │         "mmc dev 1; " \
166   │         "mmc part; " \
167   │         "echo Stop\0"
[...]

Working: image Not working: image

Sekilsgs2 commented 4 years ago

I'm try research - may be you can send me all sources, patches what i'm need? I'm try apply all patches from your first post and getting other errors - messages for not setting voltage for each card and long waits for this..

onny commented 4 years ago
  1. You have to install an older version of dtc, maybe dtc 1.4.1 from here: https://www.kernel.org/pub/software/utils/dtc/dtc-1.4.1.tar.xz
  2. I'm using an older ARM toolchain to compile this version, gcc-arm-none-eabi 4.9 from here: https://launchpad.net/gcc-arm-embedded/4.9/4.9-2015-q3-update/+download/gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar.bz2
  3. Patched source files packaged here http://onny.project-insanity.org/files/uboot-i9100.tar.gz

So I'm compiling it like this:

git clone https://github.com/u-boot/u-boot.git
cd u-boot
git checkout e51a6b7a6c09cb4e7ce792ac38d413dba9367b70 # 01.06.2012, fail, sdhci
wget "https://git.project-insanity.org/onny/i9100-uboot/-/raw/master/i9100-uboot-2012.07.patch"
patch -p1 -i i9100-uboot-2012.07.patch

Change part of file include/configs/galaxys2.h to support the sdhci driver:

/* SD/MMC configuration */
#define CONFIG_GENERIC_MMC              1
#define CONFIG_MMC                      1
#define CONFIG_S5P_MMC                  1

to

/* SD/MMC configuration */
#define CONFIG_GENERIC_MMC              1
#define CONFIG_MMC                      1
#define CONFIG_SDHCI                  1
#define CONFIG_S5P_SDHCI                  1

Compiling using the correct patch to the old 4.9 toolchain:

export PATH="/usr/local/arm/gcc-arm-none-eabi-4_9-2015q3/bin:$PATH" # adapt path to your local installation
export ARCH=arm
export CROSS_COMPILE=arm-none-eabi-
make galaxys2

Thanks for helping out :+1:

Sekilsgs2 commented 4 years ago

I'm try from your link and getting same result - errors about timeout when voltage select on each sd card. I'm try find fix - but now cant understand where errors.. need time to find where..

But other question - any reason to use new (old new) uboot? :) (imho - maybe if you need some stuff - i'm think we can port this stuff to working uboot but not spend many time to fix unclear errors)

onny commented 4 years ago

I'm try from your link and getting same result - errors about timeout when voltage select on each sd card. I'm try find fix - but now cant understand where errors.. need time to find where..

Unfortunately I never encountered those errors

But other question - any reason to use new (old new) uboot? :) (imho - maybe if you need some stuff - i'm think we can port this stuff to working uboot but not spend many time to fix unclear errors)

It would be cool to use the newest u-boot version from upstream but this would require rewriting everything to their new device tree model. Our uboot version for the i9100 is way too old so I thought about updating the code step by step ;)

Sekilsgs2 commented 4 years ago

IMG_20200311_155402 This is error when i'm compile from your link or with your patches. Befor this error uboot stay in some delay - 5 sec P.S. considering that the current uboot is already able to load the latest kernels - there is no point in wasting time looking for fixes. P.S. Try porting mainline uboot - take trats board - comment board_init_clock in trats.c . Disable config_dm_video, enable config_video, add video_hw_init to trats.c

/* when we are chainloading from the proprietary bootloader,
 * the framebuffer is already set up at this fixed location */
#define I9100_FB 0x5ec00000

static GraphicDevice gdev;

void *video_hw_init(void) {
        memset((void*)I9100_FB, 0, 480 * 800 * 4);
        gdev.frameAdrs = I9100_FB;
        gdev.winSizeX = 480;
        gdev.winSizeY = 800;
        gdev.plnSizeX = 480;
        gdev.plnSizeY = 800;
        gdev.gdfBytesPP = 4;
        gdev.gdfIndex = GDF_32BIT_X888RGB;
        gdev.memSize =  gdev.plnSizeX * gdev.plnSizeY * gdev.gdfBytesPP;

        return (void *) &gdev;
}

Change CONFIG_OF_SEPARATE to CONFIG_OF_EMBED. Change voltages for BUCK1 and BUCK2 - proper values in dts from mainline kernel. Try compile and flash and debug - i'm think this a better choice for wasting time :) P.S2 - You need cable with resistor to try debug erros or not bootable...

onny commented 4 years ago

Strange error, don't know why this occurs only in your setup. Regarding newest u-boot, this sounds like a lot of work but I guess you're right. Maybe I'll give it a try ;)