]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
board: phytec: common: phytec_som_detection: Add phytec_get_som_type
authorBenjamin Hahn <B.Hahn@phytec.de>
Wed, 6 Mar 2024 16:18:31 +0000 (17:18 +0100)
committerFabio Estevam <festevam@gmail.com>
Mon, 11 Mar 2024 11:42:44 +0000 (08:42 -0300)
Add a function that gets the som_type from the EEPROM.
Add an enum for the som_type.

Signed-off-by: Benjamin Hahn <B.Hahn@phytec.de>
board/phytec/common/phytec_som_detection.c
board/phytec/common/phytec_som_detection.h

index c73bf9721b2f883189bc8ca7ba2cca99113097f1..f9607b018dea16a26685b6e735656875e55272f0 100644 (file)
@@ -203,6 +203,16 @@ u8 __maybe_unused phytec_get_rev(struct phytec_eeprom_data *data)
        return api2->pcb_rev;
 }
 
+u8 __maybe_unused phytec_get_som_type(struct phytec_eeprom_data *data)
+{
+       if (!data)
+               data = &eeprom_data;
+       if (data->api_rev < PHYTEC_API_REV2)
+               return PHYTEC_EEPROM_INVAL;
+
+       return data->data.data_api2.som_type;
+}
+
 #else
 
 inline int phytec_eeprom_data_setup(struct phytec_eeprom_data *data,
index 11009240875c1085f5a92402b8f7450329c20868..7edbfa3ca5c65f4503e008a8007c32d870bd03ab 100644 (file)
@@ -19,6 +19,13 @@ enum {
        PHYTEC_API_REV2,
 };
 
+enum phytec_som_type_str {
+       SOM_TYPE_PCM = 0,
+       SOM_TYPE_PCL,
+       SOM_TYPE_KSM,
+       SOM_TYPE_KSP,
+};
+
 static const char * const phytec_som_type_str[] = {
        "PCM",
        "PCL",
@@ -67,5 +74,6 @@ 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);
+u8 __maybe_unused phytec_get_som_type(struct phytec_eeprom_data *data);
 
 #endif /* _PHYTEC_SOM_DETECTION_H */