]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
board: phytec: common: phytec_som_detection: Add helper for PCB revision
authorTeresa Remmet <t.remmet@phytec.de>
Thu, 17 Aug 2023 08:57:10 +0000 (10:57 +0200)
committerStefano Babic <sbabic@denx.de>
Mon, 16 Oct 2023 09:27:58 +0000 (11:27 +0200)
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>
board/phytec/common/phytec_som_detection.c
board/phytec/common/phytec_som_detection.h

index 366bdd4ace4bb4913989085f2a22d2b5d6fd0c7f..55562731270b8bfe7e1d3da99b144de9d322a361 100644 (file)
@@ -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;
+}
index 01f7e4652ddbf60ec53501cfab71be1007b63448..c68e2302cc42edaec880dd7bf07ccba1b8d5dec1 100644 (file)
@@ -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 */