diff mbox series

[6/7] Input: add `SW_BOOT_ALT`

Message ID 20220922121228.3243467-7-foss+uboot@0leil.net
State Superseded
Delegated to: Kever Yang
Headers show
Series add support for Theobroma Systems PX30-��Q7 (Ringneck) with Haikou devkit | expand

Commit Message

Quentin Schulz Sept. 22, 2022, 12:12 p.m. UTC
From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

This event code represents the firmware source to use at boot.
Value 0 means using "standard" firmware source, value 1 means using
"alternative" firmware source.

For example, some hardware has the ability to force the BOOTROM to load
the bootloader from a secondary firmware source (say SD card) instead of
trying with the standard first and then the secondary. This event allows
the userspace to know which firmware source was requested *in hardware*.

Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Link: https://lore.kernel.org/lkml/20220922101211.3215888-2-foss+kernel@0leil.net/
Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---
 include/dt-bindings/input/linux-event-codes.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Kever Yang Sept. 24, 2022, 8:05 a.m. UTC | #1
Hi Quentin,


On 2022/9/22 20:12, Quentin Schulz wrote:
> From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
>
> This event code represents the firmware source to use at boot.
> Value 0 means using "standard" firmware source, value 1 means using
> "alternative" firmware source.
>
> For example, some hardware has the ability to force the BOOTROM to load
> the bootloader from a secondary firmware source (say SD card) instead of
> trying with the standard first and then the secondary. This event allows
> the userspace to know which firmware source was requested *in hardware*.

Does this series patches need this patch?

I don't understand how can you affect the BOOTROM on PX30, I think PX30 
does not

support this feature.


Thanks,

- Kever

>
> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> Link: https://lore.kernel.org/lkml/20220922101211.3215888-2-foss+kernel@0leil.net/
> Cc: Quentin Schulz <foss+uboot@0leil.net>
> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> ---
>   include/dt-bindings/input/linux-event-codes.h | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/include/dt-bindings/input/linux-event-codes.h b/include/dt-bindings/input/linux-event-codes.h
> index dff8e7f170..8cd2b58c81 100644
> --- a/include/dt-bindings/input/linux-event-codes.h
> +++ b/include/dt-bindings/input/linux-event-codes.h
> @@ -917,7 +917,8 @@
>   #define SW_MUTE_DEVICE		0x0e  /* set = device disabled */
>   #define SW_PEN_INSERTED		0x0f  /* set = pen inserted */
>   #define SW_MACHINE_COVER	0x10  /* set = cover closed */
> -#define SW_MAX			0x10
> +#define SW_BOOT_ALT		0x11  /* set = alternative boot firmware source */
> +#define SW_MAX			0x11
>   #define SW_CNT			(SW_MAX+1)
>   
>   /*
Quentin Schulz Sept. 26, 2022, 9:47 a.m. UTC | #2
Hi Kever,

On 9/24/22 10:05, Kever Yang wrote:
> Hi Quentin,
> 
> 
> On 2022/9/22 20:12, Quentin Schulz wrote:
>> From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
>>
>> This event code represents the firmware source to use at boot.
>> Value 0 means using "standard" firmware source, value 1 means using
>> "alternative" firmware source.
>>
>> For example, some hardware has the ability to force the BOOTROM to load
>> the bootloader from a secondary firmware source (say SD card) instead of
>> trying with the standard first and then the secondary. This event allows
>> the userspace to know which firmware source was requested *in hardware*.
> 
> Does this series patches need this patch?
> 
> I don't understand how can you affect the BOOTROM on PX30, I think PX30 
> does not
> 
> support this feature.
> 

This is being discussed upstream with the kernel folks, this will likely 
not be taken unfortunately. But let me explain how things work on our board:

We have a switch we can toggle to *electrically* disable eMMC/SPI 
flashes and force booting from SD card, even if there is some TPL/SPL on 
eMMC/SPI. This is required by the Q7 standard (via the 
BIOS_DISABLE/BOOT_ALT signal).

Therefore, the SoC is not even aware of this switch (and does not need 
to), it just cannot communicate with the eMMC/SPI so it continues to try 
other boot media, with e.g. SD card or fallbacks to USB if nothing's 
found. Nothing Rockchip specific here.

This version of the series needs the patch because it defines a new 
event code that is then used in the device tree, see gpio-keys Device 
Tree node where you have switch-bios-disable-n.

Cheers,
Quentin
diff mbox series

Patch

diff --git a/include/dt-bindings/input/linux-event-codes.h b/include/dt-bindings/input/linux-event-codes.h
index dff8e7f170..8cd2b58c81 100644
--- a/include/dt-bindings/input/linux-event-codes.h
+++ b/include/dt-bindings/input/linux-event-codes.h
@@ -917,7 +917,8 @@ 
 #define SW_MUTE_DEVICE		0x0e  /* set = device disabled */
 #define SW_PEN_INSERTED		0x0f  /* set = pen inserted */
 #define SW_MACHINE_COVER	0x10  /* set = cover closed */
-#define SW_MAX			0x10
+#define SW_BOOT_ALT		0x11  /* set = alternative boot firmware source */
+#define SW_MAX			0x11
 #define SW_CNT			(SW_MAX+1)
 
 /*