-
Notifications
You must be signed in to change notification settings - Fork 353
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
Support for msm8974-based HTC One (M8) #314
Conversation
Implement gpio_status() for msm8974 platform, making it possible to read a GPIO of the main SoC. Signed-off-by: Alexandre Messier <[email protected]>
There are two functions to detect if the SoC is a Pro variant or the more specific Pro-AC variant. The implementation of the two functions is seemingly swapped, as the function containing only the AC models is obviously the one detecting for the AC variant. Fix the functions by swapping them around. Signed-off-by: Alexandre Messier <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flashing system partition using lk2nd makes the phone shutdown during the flashing
Does the device crash when uploading to ram or when writing to the emmc? Perhaps we need to shrink the scratch memory region....
dts/msm8974/msm8974pro-htc-m8.dts
Outdated
panel { | ||
compatible = "htc,m8-panel"; | ||
|
||
qcom,mdss_dsi_glu_sharp_1080p_cmd {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO it would be nice to assign compatibles to those already, even if we don't know if any other are actually used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added some compatibles, but I don't know if they are correct and if they will be the same that will be used in the Linux kernel. Let me know if I should change them!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW It's an arbitrary choice and later when/if we need to use panel selection, we can use those compatibles when creating/generating panel drivers. I.e. for msm8916 we generate drivers for known tested panels with a special tool, and assign compatibles in it's config like here:
@@ -52,6 +52,11 @@ void gpio_set(uint32_t gpio, uint32_t dir) | |||
return; | |||
} | |||
|
|||
uint32_t gpio_status(uint32_t gpio) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm interesting, For the future lk2nd rebase we have implemented a different way to use gpios to avoid things like this.
Any chance you can try to add your device on top of the experimental-tmp4
branch? The dts model is a bit different, but that branch (and also rebase/dts
) has some examples.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK I will try to use that branch as a base, will let you know when I get it to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried the experimental-tmp4
branch, and the new gpio driver works great, no change required.
I did have to rollback to the older (current) version of mkbootimg
. The new version in that branch did not generate a working image.
In any case, I don't know what is the plan for that new codebase, I can wait for it to be merged and in use, and resend a new PR. I will fix the other comments in that new PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to eventually switch to the new branch as a primary one, carrying over all the devices we support here.
It's not an issue for dts-only changes but I want to make sure all new code changes are addressed on the new branch, so this PR is "non-trivial" in that regard...
I'll still be happy to accept it here so you have a working bootloader in the meantime, though the changes and crashes are "interesting" here... I suppose all the same changes are necessary there and the crash is still present on the new branch?
/* Check for 8974PRO AC chip */ | ||
int platform_is_8974ac() | ||
/* Check for 8974 PRO chip */ | ||
int platform_is_8974Pro() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this change is unsafe as-is or if the original impl was bugged, but this would change how usb_ss phy is inited/reset on pro-not-ac I think..
https://github.com/msm8916-mainline/lk2nd/blob/master/platform/msm_shared/usb30_udc.c#L116-L155
But I'm somewhat inclined to think it was their mistake so this is a reasonable change
plz remind me (or someone else) to test this for regressions on 8974-hammerhead or klte before merging... |
It crashes (either reboot or shutdown) when writing to the eMMC, i.e. the "Writing" part of a I did some more investigation, and it crashes when writing a sparse image, but not when writing regular data. I did a test, writing 256MiB of random data to This explains why it does not crash when writing a |
Sorry for the delay, I found the issue when flashing an image last month. Thanks to this post, I tried to disable the watchdog in lk2nd too, and it works now! I have been using in the past month, flashing multiple images, and I never saw the issue again. I've also addressed the issue raised in the review. Please let me know if there are other issues! Finally, I've also added two commits that fixed some issues I was not happy about: the device tree rename, to match what will be used in the kernel, and a small change in the device name in the device tree. Also let me know what is preferred, fix-up commits, or should I squash the fix-up commits and force push the new changes? |
@minlexx if @TravMurav gives the OK then this would be ready to test on the other 8974 devices, if you are available to! Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me.
Also let me know what is preferred, fix-up commits, or should I squash the fix-up commits and force push the new changes?
I'd appreciate if you can squash the fixups within this PR into relevant commits, so I'd like to see last 4 commits squashed in
Watchdog
Gah, something we don't always have in the future branch, I will need to add it later...
I'll try this weekend 😔 |
Seems to be okay on samsung-klte: https://p.calebs.dev/1ea4d6 |
Seems to be fine on lg-hammerhead https://p.calebs.dev/bc29e2 USB works on both, booting to linux is ok.. |
From perusing the vendor kernel code, only the AC variant supports HS400 mode (and only on the first sdhc interface). For the other variants, the interface only supports HS200 mode. This fixes eMMC init on the HTC One M8. Signed-off-by: Alexandre Messier <[email protected]>
Support the HTC One (M8) devices. Like for the htc-memul, the htc,project-id from the vendor device tree (and used by the bootloader) is used as the qcom,msm-id. Then, the match is done on the panel compatible, which is also extracted from the vendor device tree. Signed-off-by: Alexandre Messier <[email protected]>
In case the first bootloader enabled the watchdog timer, disable it. This is required on some devices (e.g. HTC One M8). This fixes the phone rebooting/shutting down by itself when using the phone, for example when flashing an image to the system partition using fastboot. Signed-off-by: Alexandre Messier <[email protected]>
Done!
Thanks for testing! |
Thanks! |
Add initial support for the HTC One (M8), codename
m8
, based on MSM8974.Three fixes are required before the
m8
can be supported:gpio_status()
for GPIOs on the SOC, as these are used for the volume up/down buttons.Then the device tree is added, using the
htc,project-id
values of the vendor kernel (which are used by the HTC bootloader) as theqcom,msm-id
values, which makes it possible to use the common build for them8
. Panel name match is used to detect if it lk2nd booted on am8
.I was able to boot a near-mainline kernel using PostmarketOS. I cannot confirm it still works now, as I don't have UART access and SSH is broken for
m8
in PostmarketOS right now.Known issues:
system
partition usinglk2nd
makes the phone shutdown during the flashing phase. Workaround is to use HTC bootloader to flashsystem
partition, andlk2nd
to flash theboot
partition.