diff mbox series

[u-boot-marvell,01/11] tools: kwbimage: Add support for new commands UART_PORT and UART_MPP

Message ID 20211108171251.25382-2-kabel@kernel.org
State Accepted
Commit 12f2c03f4d1f7a7ef768f3358b0326cd8af54509
Delegated to: Stefan Roese
Headers show
Series Another kwbimage series | expand

Commit Message

Marek Behún Nov. 8, 2021, 5:12 p.m. UTC
From: Pali Rohár <pali@kernel.org>

These two commands allow to specify custom setting of UART port used for
printing BootROM messages.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <marek.behun@nic.cz>
---
 tools/kwbimage.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

Comments

Stefan Roese Nov. 10, 2021, 8:23 a.m. UTC | #1
On 08.11.21 18:12, Marek Behún wrote:
> From: Pali Rohár <pali@kernel.org>
> 
> These two commands allow to specify custom setting of UART port used for
> printing BootROM messages.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>
> Signed-off-by: Marek Behún <marek.behun@nic.cz>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   tools/kwbimage.c | 20 +++++++++++++++++++-
>   1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/kwbimage.c b/tools/kwbimage.c
> index 67c0c628ae..f24d49496b 100644
> --- a/tools/kwbimage.c
> +++ b/tools/kwbimage.c
> @@ -101,6 +101,8 @@ enum image_cfg_type {
>   	IMAGE_CFG_DATA,
>   	IMAGE_CFG_DATA_DELAY,
>   	IMAGE_CFG_BAUDRATE,
> +	IMAGE_CFG_UART_PORT,
> +	IMAGE_CFG_UART_MPP,
>   	IMAGE_CFG_DEBUG,
>   	IMAGE_CFG_KAK,
>   	IMAGE_CFG_CSK,
> @@ -129,6 +131,8 @@ static const char * const id_strs[] = {
>   	[IMAGE_CFG_DATA] = "DATA",
>   	[IMAGE_CFG_DATA_DELAY] = "DATA_DELAY",
>   	[IMAGE_CFG_BAUDRATE] = "BAUDRATE",
> +	[IMAGE_CFG_UART_PORT] = "UART_PORT",
> +	[IMAGE_CFG_UART_MPP] = "UART_MPP",
>   	[IMAGE_CFG_DEBUG] = "DEBUG",
>   	[IMAGE_CFG_KAK] = "KAK",
>   	[IMAGE_CFG_CSK] = "CSK",
> @@ -161,6 +165,8 @@ struct image_cfg_element {
>   		struct ext_hdr_v0_reg regdata;
>   		unsigned int regdata_delay;
>   		unsigned int baudrate;
> +		unsigned int uart_port;
> +		unsigned int uart_mpp;
>   		unsigned int debug;
>   		const char *key_name;
>   		int csk_idx;
> @@ -1239,7 +1245,13 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
>   		main_hdr->nandbadblklocation = e->nandbadblklocation;
>   	e = image_find_option(IMAGE_CFG_BAUDRATE);
>   	if (e)
> -		main_hdr->options = baudrate_to_option(e->baudrate);
> +		main_hdr->options |= baudrate_to_option(e->baudrate);
> +	e = image_find_option(IMAGE_CFG_UART_PORT);
> +	if (e)
> +		main_hdr->options |= (e->uart_port & 3) << 3;
> +	e = image_find_option(IMAGE_CFG_UART_MPP);
> +	if (e)
> +		main_hdr->options |= (e->uart_mpp & 7) << 5;
>   	e = image_find_option(IMAGE_CFG_DEBUG);
>   	if (e)
>   		main_hdr->flags = e->debug ? 0x1 : 0;
> @@ -1441,6 +1453,12 @@ static int image_create_config_parse_oneline(char *line,
>   	case IMAGE_CFG_BAUDRATE:
>   		el->baudrate = strtoul(value1, NULL, 10);
>   		break;
> +	case IMAGE_CFG_UART_PORT:
> +		el->uart_port = strtoul(value1, NULL, 16);
> +		break;
> +	case IMAGE_CFG_UART_MPP:
> +		el->uart_mpp = strtoul(value1, NULL, 16);
> +		break;
>   	case IMAGE_CFG_DEBUG:
>   		el->debug = strtoul(value1, NULL, 10);
>   		break;
> 

Viele Grüße,
Stefan Roese
diff mbox series

Patch

diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index 67c0c628ae..f24d49496b 100644
--- a/tools/kwbimage.c
+++ b/tools/kwbimage.c
@@ -101,6 +101,8 @@  enum image_cfg_type {
 	IMAGE_CFG_DATA,
 	IMAGE_CFG_DATA_DELAY,
 	IMAGE_CFG_BAUDRATE,
+	IMAGE_CFG_UART_PORT,
+	IMAGE_CFG_UART_MPP,
 	IMAGE_CFG_DEBUG,
 	IMAGE_CFG_KAK,
 	IMAGE_CFG_CSK,
@@ -129,6 +131,8 @@  static const char * const id_strs[] = {
 	[IMAGE_CFG_DATA] = "DATA",
 	[IMAGE_CFG_DATA_DELAY] = "DATA_DELAY",
 	[IMAGE_CFG_BAUDRATE] = "BAUDRATE",
+	[IMAGE_CFG_UART_PORT] = "UART_PORT",
+	[IMAGE_CFG_UART_MPP] = "UART_MPP",
 	[IMAGE_CFG_DEBUG] = "DEBUG",
 	[IMAGE_CFG_KAK] = "KAK",
 	[IMAGE_CFG_CSK] = "CSK",
@@ -161,6 +165,8 @@  struct image_cfg_element {
 		struct ext_hdr_v0_reg regdata;
 		unsigned int regdata_delay;
 		unsigned int baudrate;
+		unsigned int uart_port;
+		unsigned int uart_mpp;
 		unsigned int debug;
 		const char *key_name;
 		int csk_idx;
@@ -1239,7 +1245,13 @@  static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
 		main_hdr->nandbadblklocation = e->nandbadblklocation;
 	e = image_find_option(IMAGE_CFG_BAUDRATE);
 	if (e)
-		main_hdr->options = baudrate_to_option(e->baudrate);
+		main_hdr->options |= baudrate_to_option(e->baudrate);
+	e = image_find_option(IMAGE_CFG_UART_PORT);
+	if (e)
+		main_hdr->options |= (e->uart_port & 3) << 3;
+	e = image_find_option(IMAGE_CFG_UART_MPP);
+	if (e)
+		main_hdr->options |= (e->uart_mpp & 7) << 5;
 	e = image_find_option(IMAGE_CFG_DEBUG);
 	if (e)
 		main_hdr->flags = e->debug ? 0x1 : 0;
@@ -1441,6 +1453,12 @@  static int image_create_config_parse_oneline(char *line,
 	case IMAGE_CFG_BAUDRATE:
 		el->baudrate = strtoul(value1, NULL, 10);
 		break;
+	case IMAGE_CFG_UART_PORT:
+		el->uart_port = strtoul(value1, NULL, 16);
+		break;
+	case IMAGE_CFG_UART_MPP:
+		el->uart_mpp = strtoul(value1, NULL, 16);
+		break;
 	case IMAGE_CFG_DEBUG:
 		el->debug = strtoul(value1, NULL, 10);
 		break;