-
Notifications
You must be signed in to change notification settings - Fork 2
[TOPIC] Add NVMEM bitfield support and reboot‑mode integration #11
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
base: u-boot-mainline-1.0
Are you sure you want to change the base?
Changes from all commits
5e52dc6
3e1994c
d952bcf
3b1ce2d
a613668
81a42d8
8a700bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,4 +11,30 @@ | |
| <0x0 0xc0000000 0x0 0xc0000000>, | ||
| <0x1 0x80000000 0x1 0x00000000>; | ||
| }; | ||
|
|
||
| reboot-mode { | ||
| compatible = "nvmem-reboot-mode"; | ||
| nvmem-cells = <&reboot_reason>; | ||
| nvmem-cell-names = "reboot-mode"; | ||
|
|
||
| mode-bootloader = <0x02>; | ||
| mode-recovery = <0x01>; | ||
| }; | ||
| }; | ||
|
|
||
| &pm8150_0 { | ||
| /* Virtual NVMEM node for PON-based reboot reason storage */ | ||
| nvram@800 { | ||
| compatible = "qcom,spmi-sdam"; | ||
| reg = <0x800>; | ||
| #address-cells = <1>; | ||
| #size-cells = <1>; | ||
| ranges = <0x00 0x800 0x100>; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
|
|
||
| /* Reboot reason cell at PON_SOFT_RB_SPARE (0x88F) */ | ||
| reboot_reason: reboot-reason@8f { | ||
| reg = <0x8f 0x1>; | ||
| bits = <1 7>; | ||
| }; | ||
| }; | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,29 +9,30 @@ | |
| #define LOG_CATEGORY LOGC_BOARD | ||
| #define pr_fmt(fmt) "QCOM: " fmt | ||
|
|
||
| #include <command.h> | ||
| #include <env.h> | ||
| #include <fdt_support.h> | ||
| #include <init.h> | ||
| #include <lmb.h> | ||
| #include <malloc.h> | ||
| #include <sort.h> | ||
| #include <time.h> | ||
| #include <usb.h> | ||
| #include <asm/armv8/mmu.h> | ||
| #include <asm/gpio.h> | ||
| #include <asm/io.h> | ||
| #include <asm/psci.h> | ||
| #include <asm/system.h> | ||
| #include <dm/device.h> | ||
| #include <dm/pinctrl.h> | ||
| #include <dm/uclass-internal.h> | ||
| #include <dm/read.h> | ||
| #include <power/regulator.h> | ||
| #include <env.h> | ||
| #include <fdt_support.h> | ||
| #include <init.h> | ||
| #include <dm/uclass-internal.h> | ||
| #include <linux/arm-smccc.h> | ||
| #include <linux/bug.h> | ||
| #include <linux/psci.h> | ||
| #include <linux/sizes.h> | ||
| #include <lmb.h> | ||
| #include <malloc.h> | ||
| #include <fdt_support.h> | ||
| #include <usb.h> | ||
| #include <sort.h> | ||
| #include <time.h> | ||
| #include <power/regulator.h> | ||
| #include <reboot-mode/reboot-mode.h> | ||
|
|
||
| #include "qcom-priv.h" | ||
|
|
||
|
|
@@ -506,6 +507,38 @@ void qcom_show_boot_source(void) | |
| env_set("boot_source", name); | ||
| } | ||
|
|
||
| /** | ||
| * qcom_handle_reboot_mode() - Process reboot-mode detection and handle fastboot entry | ||
| * | ||
| * This function detects the reboot reason from PMIC registers and automatically | ||
| * enters fastboot mode if the reboot reason was "bootloader". | ||
| */ | ||
| static void qcom_handle_reboot_mode(void) | ||
| { | ||
| struct udevice *reboot_dev; | ||
| const char *reboot_mode; | ||
| int ret; | ||
|
|
||
| if (!IS_ENABLED(CONFIG_DM_REBOOT_MODE)) | ||
| return; | ||
|
|
||
| ret = uclass_first_device_err(UCLASS_REBOOT_MODE, &reboot_dev); | ||
| if (ret) | ||
| return; | ||
|
|
||
| ret = dm_reboot_mode_update(reboot_dev); | ||
| if (ret) | ||
| return; | ||
|
|
||
| reboot_mode = env_get("reboot-mode"); | ||
| if (reboot_mode && !strcmp(reboot_mode, "bootloader")) { | ||
| log_info("Entering fastboot mode due to reboot reason...\n"); | ||
| ret = run_command("run fastboot", 0); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is 'fastboot' a variable? Why
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, it is a variable |
||
| if (ret) | ||
| log_warning("Failed to enter fastboot mode: %d\n", ret); | ||
| } | ||
| } | ||
|
|
||
| void __weak qcom_late_init(void) | ||
| { | ||
| } | ||
|
|
@@ -570,6 +603,9 @@ int board_late_init(void) | |
| qcom_late_init(); | ||
|
|
||
| qcom_show_boot_source(); | ||
|
|
||
| qcom_handle_reboot_mode(); | ||
|
|
||
| /* Configure the dfu_string for capsule updates */ | ||
| qcom_configure_capsule_updates(); | ||
|
|
||
|
|
||
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.
Generally address values are expected to be spelled out in full. i.e. 0x00000800
Uh oh!
There was an error while loading. Please reload this page.
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.
@varada-qcom , It was referred from other soc dts in kernel, they didn't spelled out fully so I did the same to maintain the uniformity
https://source.denx.de/u-boot/u-boot/-/blob/master/dts/upstream/src/arm64/qcom/lemans-pmics.dtsi#L154
Do we need to change it?