mirror of
				https://xff.cz/git/u-boot/
				synced 2025-10-31 18:35:42 +01:00 
			
		
		
		
	fastboot: Implement generic fastboot_set_reboot_flag
It is possible to implement fastboot_set_reboot_flag in a generic way if BCB commands are turned on for a target. Using bcb_set_reboot_reason allows to do this by simply passing string with correct reboot reason that should be handled during next boot process. If BCB are turned off, then bcb_set_reboot_reason would simply return error, so it won't introduce any new behaviour for such targets. Signed-off-by: Roman Kovalivskyi <roman.kovalivskyi@globallogic.com>
This commit is contained in:
		
				
					committed by
					
						 Marek Vasut
						Marek Vasut
					
				
			
			
				
	
			
			
			
						parent
						
							f80798122a
						
					
				
				
					commit
					a362ce214f
				
			| @@ -10,6 +10,7 @@ | |||||||
|  * Rob Herring <robh@kernel.org> |  * Rob Herring <robh@kernel.org> | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
|  | #include <bcb.h> | ||||||
| #include <common.h> | #include <common.h> | ||||||
| #include <command.h> | #include <command.h> | ||||||
| #include <env.h> | #include <env.h> | ||||||
| @@ -90,7 +91,20 @@ void fastboot_okay(const char *reason, char *response) | |||||||
|  */ |  */ | ||||||
| int __weak fastboot_set_reboot_flag(enum fastboot_reboot_reason reason) | int __weak fastboot_set_reboot_flag(enum fastboot_reboot_reason reason) | ||||||
| { | { | ||||||
| 	return -ENOSYS; | #if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC_DEV) | ||||||
|  | 	static const char * const boot_cmds[] = { | ||||||
|  | 		[FASTBOOT_REBOOT_REASON_BOOTLOADER] = "bootonce-bootloader", | ||||||
|  | 		[FASTBOOT_REBOOT_REASON_FASTBOOTD] = "boot-fastboot", | ||||||
|  | 		[FASTBOOT_REBOOT_REASON_RECOVERY] = "boot-recovery" | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	if (reason >= FASTBOOT_REBOOT_REASONS_COUNT) | ||||||
|  | 		return -EINVAL; | ||||||
|  |  | ||||||
|  | 	return bcb_write_reboot_reason(CONFIG_FASTBOOT_FLASH_MMC_DEV, "misc", boot_cmds[reason]); | ||||||
|  | #else | ||||||
|  |     return -EINVAL; | ||||||
|  | #endif | ||||||
| } | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user