Daniel Schultz | 0bee885 | 2024-04-19 08:55:40 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
| 2 | /* |
| 3 | * Copyright (C) 2024 PHYTEC Messtechnik GmbH |
| 4 | * Author: Daniel Schultz <d.schultz@phytec.de> |
| 5 | */ |
| 6 | |
| 7 | #ifndef _PHYTEC_AM6_SOM_DETECTION_H |
| 8 | #define _PHYTEC_AM6_SOM_DETECTION_H |
| 9 | |
| 10 | #include "phytec_som_detection.h" |
| 11 | |
Wadim Egorov | 8b9e76d | 2024-05-22 09:55:05 +0200 | [diff] [blame^] | 12 | #define EEPROM_ADDR 0x50 |
Daniel Schultz | 0bee885 | 2024-04-19 08:55:40 -0700 | [diff] [blame] | 13 | #define PHYTEC_AM62X_SOM 71 |
| 14 | #define PHYTEC_AM64X_SOM 72 |
| 15 | #define PHYTEC_EEPROM_VALUE_X 0x21 |
| 16 | #define PHYTEC_EEPROM_NOR_FLASH_64MB_QSPI 0xC |
| 17 | |
Wadim Egorov | 8b9e76d | 2024-05-22 09:55:05 +0200 | [diff] [blame^] | 18 | enum { |
| 19 | EEPROM_RAM_SIZE_512MB = 0, |
| 20 | EEPROM_RAM_SIZE_1GB = 1, |
| 21 | EEPROM_RAM_SIZE_2GB = 2, |
| 22 | EEPROM_RAM_SIZE_4GB = 4 |
| 23 | }; |
| 24 | |
Daniel Schultz | 0bee885 | 2024-04-19 08:55:40 -0700 | [diff] [blame] | 25 | int __maybe_unused phytec_am6_detect(struct phytec_eeprom_data *data); |
| 26 | u8 __maybe_unused phytec_get_am6_ddr_size(struct phytec_eeprom_data *data); |
| 27 | u8 __maybe_unused phytec_get_am6_spi(struct phytec_eeprom_data *data); |
| 28 | u8 __maybe_unused phytec_get_am6_eth(struct phytec_eeprom_data *data); |
| 29 | u8 __maybe_unused phytec_get_am6_rtc(struct phytec_eeprom_data *data); |
| 30 | |
| 31 | static inline int phytec_am6_is_qspi(struct phytec_eeprom_data *data) |
| 32 | { |
| 33 | u8 spi = phytec_get_am6_spi(data); |
| 34 | |
| 35 | if (spi == PHYTEC_EEPROM_VALUE_X) |
| 36 | return 0; |
| 37 | return spi <= PHYTEC_EEPROM_NOR_FLASH_64MB_QSPI; |
| 38 | } |
| 39 | |
| 40 | static inline int phytec_am6_is_ospi(struct phytec_eeprom_data *data) |
| 41 | { |
| 42 | return phytec_get_am6_spi(data) > PHYTEC_EEPROM_NOR_FLASH_64MB_QSPI; |
| 43 | } |
| 44 | #endif /* _PHYTEC_AM6_SOM_DETECTION_H */ |