Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ODROID-C2: Missing bl301.bin source code #26

Closed
Kwiboo opened this issue Aug 6, 2016 · 8 comments
Closed

ODROID-C2: Missing bl301.bin source code #26

Kwiboo opened this issue Aug 6, 2016 · 8 comments

Comments

@Kwiboo
Copy link

Kwiboo commented Aug 6, 2016

I am trying to get suspended wake-up with ir-remote to work on the ODROID-C2 as this feature seems to have better support in the Amlogic 20160504 and 20160701 u-boot/scp_task code.
Currently have the bl2/bl21/bl30/bl301/bl31 from 20160701 running on my ODROID-C2 but it is missing some modifications you have made to bl301/scp_task (e.g. blue led is still active when shutdown).

Is it possible for you to share the source code for the bl301.bin/scp_task changes in ea13764 and ee914ab?

You can see https://github.com/Kwiboo/u-boot for my work-in-progress repo.
Cross compile on x86_64 and use dd if=fip/u-boot.bin of=<sd-card> conv=fsync bs=512 seek=1 to write blX+u-boot to a sd-card.

@Kwiboo
Copy link
Author

Kwiboo commented Aug 8, 2016

I can now successfully wake-up my C2 using the HK IR-remote from the always-on suspended state with Kwiboo@c31b6f7
The power_off/on_vcck methods was using GPIOAO.BIT4 (usb reset?) and power_off/on_3v3 was using the GPIOAO.BIT2 that controls VCCK_CON.
Unsure what power_off/on_3v3 is supposed to power off/on so just left it commented out for now.

@JeonghwaCho
Copy link
Collaborator

Hello, Kwiboo.
Thanks for your code and information.
bl301.bin-related source will be merged on HK's Github soon
and there are some modifications like blue led and ups-related port handling.
Because of current issue, we've adjusted some routines, I think there are some gaps.
so we will check AMLogic's updated u-boot scp_task code and suspend-related codes.
Also the aforementioned your code about VCCK_CON will be merged after checking.

@Kwiboo
Copy link
Author

Kwiboo commented Aug 12, 2016

@JeonghwaCho thanks for adding the bl301/scp_task source code.

I suspected that there was some odroidc2 specific changes, I used the odroidc2 code from uboot-2015-12-15-685bb0bc6f.tar.gz and merged some p200 changes from my amlogic-v2015.01-20160701 tree.

Will try to make IR wake-up to work with minimum changes using your tree with the added bl301 code going forward.
My main goal is to get this working for LibreELEC/OpenPHT with minimal changes but also see if I can remove one or two C2 commits from my amlogic-20160701 kernel if some code is moved to u-boot (mac address and usb reset).

I was having problem getting the updated bl2 in my tree to boot using eMMC (SD worked fine) and it turned out the newer aml_encrypt_gxb is using pos 112-49152 for sha256 check causing problems with MBR.
Kwiboo@de1678f includes a small tool I wrote (aml_chksum) that changes the sha256 check range to 512-49152 and calculates a new checksum.
Unfortunately it does not contain the magic in your bl2 (bl1.bin.hardkernel) that makes SD and eMMC use same offset for bl3X images and requires u-boot.bin.emmc.bin be written to 512+ for SD and to 0-112 and 512+ for eMMC.

@Kwiboo
Copy link
Author

Kwiboo commented Aug 13, 2016

There is now a odroidc2-v2015.01-remote-power-on branch with a small amount of changes to get power-on from power-off state using HK ir-remote working (resume from suspend state do not work).

LibreELEC-master test-image: https://www.dropbox.com/s/rm32sej9bf7ius7/LibreELEC-Odroid_C2.aarch64-8.0-devel-20160813173106-r23611-gebc8203.img.gz?dl=0

@JeonghwaCho
Copy link
Collaborator

@Kwiboo Thanks a lot for sharing your code.
Power-on using remote contoller is working well with uboot of odroidc2-v2015.01-remote-power-on branch and odroidc2 ubuntu image.

And about bl1.bin.hardkernel binary, it's a difficult structure from AMLogic original released one. (I think you already know it.). To release a same image regardless the boot storage, SD or eMMC, we adjusted header structures including MBR part and made some utils to build sha checksum.
Actually I couldn't catch what you mean and if I need to help you about the structure (blX) for your work. The current bl2.bin includes magic number and sha checksum result in its header.

And for the bl2.bin version, we have no plan to update it, but we're checking the newer version of u-boot firmware to adjust suspend/resume. If you have any idea or request, we can talk on the following forum thread. :)
http://forum.odroid.com/viewtopic.php?f=139&t=23073#p155601

@JeonghwaCho
Copy link
Collaborator

JeonghwaCho commented Aug 17, 2016

@Kwiboo
Can I cherry-pick and merge your commits of odroidc2-v2015.01-remote-power-on branch to HK's u-boot?
Now I'm checking and adjusting power controls (3v3 and so on) and current of C2. The current increase should be fixed.

  • current after poweroff : 80mA -> 120mA
    And could you leave messages here or the forum thread if you have any more request or TODO things about bl binaries?

@Kwiboo
Copy link
Author

Kwiboo commented Aug 17, 2016

@JeonghwaCho feel free to cherry pick the commits you think is safe to include, I am currently working on CEC wakeup in my odroidc2-v2015.01-cec-power-on branch and can now also power on using CEC (this branch replaces the 'Disable CEC wakeup' commit with a "working" CEC handler).
The CEC code is still work-in-progress and currently forces a 0x2f cec config, expects kernel to set physical and logical CEC address and needs more testing.

LibreELEC-master cec+remote wakeup test-image: https://www.dropbox.com/s/jj78rdc7gwi3k9v/LibreELEC-Odroid_C2.aarch64-8.0-devel-20160817133009-r23641-ge6dbce4.img.gz?dl=0

As for blX I have no real question and I have settled my curiosity with Kwiboo@6d0a176 where I can modify the 20160701 bl2 and make it boot from both SD and eMMC. It is a very dirty hack and limits the bl21 size from 3k to 2k due to realignments but was the best I could do without any access to blX source code.

I will however make an attempt to update bl30/31 to the 20151205 version as that version adds 'wait for interrupt' handling to the scp_task power-key detection loop and "worked" with current bl2 in my previous tests.

@Kwiboo
Copy link
Author

Kwiboo commented Sep 7, 2016

Closing this issue as most code is merged, see #32 for the final cec-wakeup code changes

@Kwiboo Kwiboo closed this as completed Sep 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants