summaryrefslogtreecommitdiff
path: root/board/phytec/common
AgeCommit message (Collapse)Author
2024-04-29board: phytec: check eeprom_data validityYannic Moog
For all of the functions that access the eeprom_data, make sure these data are valid. Use the valid member of the phytec_eeprom_data struct. This fixes a bug where only the API revision check guarded against accessing rubbish. But if API revision was e.g. 6, eeprom setup failed before, but phytec_get_imx8m_eth would still happily access the data. Fixes: dc22188cdc8 ("board: phytec: Add common PHYTEC SoM detection") Signed-off-by: Yannic Moog <[email protected]> Signed-off-by: Daniel Schultz <[email protected]> Reviewed-by: Teresa Remmet <[email protected]>
2024-04-29board: phytec: introduce eeprom struct member 'valid'Yannic Moog
Add a new nember to the eeprom_data that indicates whether the associated data is valid or not. Make use of this new member in the phytec_eeprom_data_init function by setting the valid value appropriately. Move the eeprom data to a new struct payload that holds the payload of the eeprom. Signed-off-by: Yannic Moog <[email protected]> Signed-off-by: Daniel Schultz <[email protected]> Reviewed-by: Teresa Remmet <[email protected]>
2024-04-29board: phytec: common: Generic "add extension" functionDaniel Schultz
Add a generic function to apply overlays in our board code to not implement the same logic in different PHYTEC products. Signed-off-by: Daniel Schultz <[email protected]> Reviewed-by: Teresa Remmet <[email protected]>
2024-03-17board: phytec: define get_som_type also when SoM detection is disabledBenjamin Hahn
define the phytec_get_som_type function also when the SoM detection is disabled. Fixes: commit 110d321a56c3 ("board: phytec: common: phytec_som_detection: Add phytec_get_som_type") Signed-off-by: Benjamin Hahn <[email protected]>
2024-03-11board: phytec: common: phytec_som_detection: Add phytec_get_som_typeBenjamin Hahn
Add a function that gets the som_type from the EEPROM. Add an enum for the som_type. Signed-off-by: Benjamin Hahn <[email protected]>
2024-01-15board: phytec: fix link error when disabling PHYTEC_SOM_DETECTIONYannic Moog
Commit aa7858fe5e2e ("board: phytec: som_detection: move definitions to source file") moved function definitions from header to source file. Makefile however was not updated to unconditionally (from [..]_SOM_DETECTION) build the imx8 and phytec som detection units. Also remove unused includes that cause build failures on arm 32bit boards. SoM detection shall support 32bit boards as well, but arch specific code should not be included in the generic module. Fixes: aa7858fe5e2e ("board: phytec: som_detection: move definitions to source file") Signed-off-by: Yannic Moog <[email protected]>
2023-12-20board: phytec: phytec_som_detection: fix uninitialized bugYannic Moog
When som_type does not match any case, it is uninitialized and the function still tries to print the SoM info. Rather, this is an error condition and the function should abort prematurely. Highlight this by printing an error message and returning early. Signed-off-by: Yannic Moog <[email protected]>
2023-12-20board: phytec: som_detection: move definitions to source fileYannic Moog
Move all function definitions in {phytec|imx8m}_som_detection from the header to the source file to prevent potential linker error regarding multiple definitions. Also move the #if blocks with the definitions. Signed-off-by: Yannic Moog <[email protected]>
2023-12-20board: phytec: phytec_som_detection: fix eeprom_data zero checkYannic Moog
In phytec_eeprom_data_init, after reading eeprom data into buffer, it is checked whether all bytes are 0x0 by iterating over chunks of the buffer. The offset, or index of the chunk, was never changed, leading to repeated comparison of only the first chunk. Use array notation and access chunk via array index to compare all chunks of the buffer. Signed-off-by: Yannic Moog <[email protected]>
2023-12-20board: phytec: imx8m_som_detection: fix uninitialized pointer bugYannic Moog
Pointer in phytec_imx8m_detect was accessed without checking it first. Fix this by moving the pointer check in front of any accesses. Signed-off-by: Yannic Moog <[email protected]>
2023-12-20board: phytec: imx8m_som_detection: change phytec_imx8m_detect return typeYannic Moog
phytec_imx8m_detect returns -1 on error, but the return type is u8 leading to 255 return values. Fix this by changing the return type to int; there is no reason to keep it as u8 . Signed-off-by: Yannic Moog <[email protected]>
2023-10-16board: phytec: common: phytec_som_detection: Add helper for PCB revisionTeresa Remmet
Add helper function to read out the PCB revision of a PHYTEC SoM. Signed-off-by: Teresa Remmet <[email protected]> Reviewed-by: Yannic Moog <[email protected]> Tested-by: Yannic Moog <[email protected]>
2023-10-16board: phytec: common: Add imx8m specific EEPROM detection supportTeresa Remmet
Add imx8m specific detection part. Which includes checking the EEPROM data for article number options. Signed-off-by: Teresa Remmet <[email protected]> Reviewed-by: Yannic Moog <[email protected]> Tested-by: Yannic Moog <[email protected]>
2023-10-16board: phytec: Add common PHYTEC SoM detectionTeresa Remmet
Recent shipped PHYTEC SoMs come with an i2c EEPROM containing information about the hardware such as board revision and variant. This can be used for RAM detection and loading device tree overlays during kernel start. Signed-off-by: Teresa Remmet <[email protected]> Reviewed-by: Yannic Moog <[email protected]> Tested-by: Yannic Moog <[email protected]> Reviewed-by: Fabio Estevam <[email protected]>