blob: 0b3c9c8e1ee851343386043937d186f90f42380c [file] [log] [blame]
Daniel Schultz0bee8852024-04-19 08:55:40 -07001/* 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 Egorov8b9e76d2024-05-22 09:55:05 +020012#define EEPROM_ADDR 0x50
Daniel Schultz0bee8852024-04-19 08:55:40 -070013#define PHYTEC_AM62X_SOM 71
Daniel Schultzcd58e2b2025-03-05 05:58:36 +010014#define PHYTEC_AM62AX_SOM 75
Daniel Schultz0bee8852024-04-19 08:55:40 -070015#define PHYTEC_AM64X_SOM 72
16#define PHYTEC_EEPROM_VALUE_X 0x21
17#define PHYTEC_EEPROM_NOR_FLASH_64MB_QSPI 0xC
18
Wadim Egorov8b9e76d2024-05-22 09:55:05 +020019enum {
20 EEPROM_RAM_SIZE_512MB = 0,
21 EEPROM_RAM_SIZE_1GB = 1,
22 EEPROM_RAM_SIZE_2GB = 2,
23 EEPROM_RAM_SIZE_4GB = 4
24};
25
Daniel Schultz0bee8852024-04-19 08:55:40 -070026int __maybe_unused phytec_am6_detect(struct phytec_eeprom_data *data);
27u8 __maybe_unused phytec_get_am6_ddr_size(struct phytec_eeprom_data *data);
28u8 __maybe_unused phytec_get_am6_spi(struct phytec_eeprom_data *data);
29u8 __maybe_unused phytec_get_am6_eth(struct phytec_eeprom_data *data);
30u8 __maybe_unused phytec_get_am6_rtc(struct phytec_eeprom_data *data);
31
32static inline int phytec_am6_is_qspi(struct phytec_eeprom_data *data)
33{
34 u8 spi = phytec_get_am6_spi(data);
35
36 if (spi == PHYTEC_EEPROM_VALUE_X)
37 return 0;
38 return spi <= PHYTEC_EEPROM_NOR_FLASH_64MB_QSPI;
39}
40
41static inline int phytec_am6_is_ospi(struct phytec_eeprom_data *data)
42{
43 return phytec_get_am6_spi(data) > PHYTEC_EEPROM_NOR_FLASH_64MB_QSPI;
44}
45#endif /* _PHYTEC_AM6_SOM_DETECTION_H */