public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH v2 5/6] board: phytec: common: phytec_som_detection: Add helper for PCB revision
  2023-08-17  8:57 [PATCH v2 0/6] PHYTEC SoM detection for phyCORE-i.MX8MP Teresa Remmet
@ 2023-08-17  8:57 ` Teresa Remmet
  2023-08-28 12:33   ` Yannic Moog
  0 siblings, 1 reply; 3+ messages in thread
From: Teresa Remmet @ 2023-08-17  8:57 UTC (permalink / raw)
  To: Stefano Babic, Fabio Estevam, NXP i . MX U-Boot Team
  Cc: u-boot, upstream, Yannic Moog, Daniel Schultz, Wadim Egorov

Add helper function to read out the PCB revision of a PHYTEC SoM.

Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
---
Changes in v2:
- none
---
 board/phytec/common/phytec_som_detection.c | 15 +++++++++++++++
 board/phytec/common/phytec_som_detection.h |  5 +++++
 2 files changed, 20 insertions(+)

diff --git a/board/phytec/common/phytec_som_detection.c b/board/phytec/common/phytec_som_detection.c
index 366bdd4ace4b..55562731270b 100644
--- a/board/phytec/common/phytec_som_detection.c
+++ b/board/phytec/common/phytec_som_detection.c
@@ -186,3 +186,18 @@ char * __maybe_unused phytec_get_opt(struct phytec_eeprom_data *data)
 
 	return opt;
 }
+
+u8 __maybe_unused phytec_get_rev(struct phytec_eeprom_data *data)
+{
+	struct phytec_api2_data *api2;
+
+	if (!data)
+		data = &eeprom_data;
+
+	if (data->api_rev < PHYTEC_API_REV2)
+		return PHYTEC_EEPROM_INVAL;
+
+	api2 = &data->data.data_api2;
+
+	return api2->pcb_rev;
+}
diff --git a/board/phytec/common/phytec_som_detection.h b/board/phytec/common/phytec_som_detection.h
index 01f7e4652ddb..c68e2302cc42 100644
--- a/board/phytec/common/phytec_som_detection.h
+++ b/board/phytec/common/phytec_som_detection.h
@@ -68,6 +68,7 @@ int phytec_eeprom_data_init(struct phytec_eeprom_data *data,
 void __maybe_unused phytec_print_som_info(struct phytec_eeprom_data *data);
 
 char * __maybe_unused phytec_get_opt(struct phytec_eeprom_data *data);
+u8 __maybe_unused phytec_get_rev(struct phytec_eeprom_data *data);
 
 #else
 
@@ -99,6 +100,10 @@ inline char *__maybe_unused phytec_get_opt(struct phytec_eeprom_data *data)
 	return NULL;
 }
 
+u8 __maybe_unused phytec_get_rev(struct phytec_eeprom_data *data)
+{
+	return PHYTEC_EEPROM_INVAL;
+}
 #endif /* IS_ENABLED(CONFIG_PHYTEC_SOM_DETECTION) */
 
 #endif /* _PHYTEC_SOM_DETECTION_H */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 5/6] board: phytec: common: phytec_som_detection: Add helper for PCB revision
  2023-08-17  8:57 ` [PATCH v2 5/6] board: phytec: common: phytec_som_detection: Add helper for PCB revision Teresa Remmet
@ 2023-08-28 12:33   ` Yannic Moog
  0 siblings, 0 replies; 3+ messages in thread
From: Yannic Moog @ 2023-08-28 12:33 UTC (permalink / raw)
  To: festevam@gmail.com, uboot-imx@nxp.com, sbabic@denx.de,
	Teresa Remmet
  Cc: upstream@lists.phytec.de, u-boot@lists.denx.de, Daniel Schultz,
	Wadim Egorov

On Thu, 2023-08-17 at 10:57 +0200, Teresa Remmet wrote:
> Add helper function to read out the PCB revision of a PHYTEC SoM.
> 
> Signed-off-by: Teresa Remmet <t.remmet@phytec.de>

Reviewed-by: Yannic Moog <y.moog@phytec.de>
Tested-by: Yannic Moog <y.moog@phytec.de>

> ---
> Changes in v2:
> - none
> ---
>  board/phytec/common/phytec_som_detection.c | 15 +++++++++++++++
>  board/phytec/common/phytec_som_detection.h |  5 +++++
>  2 files changed, 20 insertions(+)
> 
> diff --git a/board/phytec/common/phytec_som_detection.c
> b/board/phytec/common/phytec_som_detection.c
> index 366bdd4ace4b..55562731270b 100644
> --- a/board/phytec/common/phytec_som_detection.c
> +++ b/board/phytec/common/phytec_som_detection.c
> @@ -186,3 +186,18 @@ char * __maybe_unused phytec_get_opt(struct
> phytec_eeprom_data *data)
>  
>         return opt;
>  }
> +
> +u8 __maybe_unused phytec_get_rev(struct phytec_eeprom_data *data)
> +{
> +       struct phytec_api2_data *api2;
> +
> +       if (!data)
> +               data = &eeprom_data;
> +
> +       if (data->api_rev < PHYTEC_API_REV2)
> +               return PHYTEC_EEPROM_INVAL;
> +
> +       api2 = &data->data.data_api2;
> +
> +       return api2->pcb_rev;
> +}
> diff --git a/board/phytec/common/phytec_som_detection.h
> b/board/phytec/common/phytec_som_detection.h
> index 01f7e4652ddb..c68e2302cc42 100644
> --- a/board/phytec/common/phytec_som_detection.h
> +++ b/board/phytec/common/phytec_som_detection.h
> @@ -68,6 +68,7 @@ int phytec_eeprom_data_init(struct
> phytec_eeprom_data *data,
>  void __maybe_unused phytec_print_som_info(struct phytec_eeprom_data
> *data);
>  
>  char * __maybe_unused phytec_get_opt(struct phytec_eeprom_data
> *data);
> +u8 __maybe_unused phytec_get_rev(struct phytec_eeprom_data *data);
>  
>  #else
>  
> @@ -99,6 +100,10 @@ inline char *__maybe_unused phytec_get_opt(struct
> phytec_eeprom_data *data)
>         return NULL;
>  }
>  
> +u8 __maybe_unused phytec_get_rev(struct phytec_eeprom_data *data)
> +{
> +       return PHYTEC_EEPROM_INVAL;
> +}
>  #endif /* IS_ENABLED(CONFIG_PHYTEC_SOM_DETECTION) */
>  
>  #endif /* _PHYTEC_SOM_DETECTION_H */


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 5/6] board: phytec: common: phytec_som_detection: Add helper for PCB revision
@ 2023-10-16 11:50 sbabic
  0 siblings, 0 replies; 3+ messages in thread
From: sbabic @ 2023-10-16 11:50 UTC (permalink / raw)
  To: Teresa Remmet, u-boot

> Add helper function to read out the PCB revision of a PHYTEC SoM.
> Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
> Reviewed-by: Yannic Moog <y.moog@phytec.de>
> Tested-by: Yannic Moog <y.moog@phytec.de>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-10-16 11:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-16 11:50 [PATCH v2 5/6] board: phytec: common: phytec_som_detection: Add helper for PCB revision sbabic
  -- strict thread matches above, loose matches on Subject: below --
2023-08-17  8:57 [PATCH v2 0/6] PHYTEC SoM detection for phyCORE-i.MX8MP Teresa Remmet
2023-08-17  8:57 ` [PATCH v2 5/6] board: phytec: common: phytec_som_detection: Add helper for PCB revision Teresa Remmet
2023-08-28 12:33   ` Yannic Moog

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox