Tim Harvey | 256dba0 | 2021-03-02 14:00:21 -0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
| 2 | /* |
| 3 | * Copyright 2021 Gateworks Corporation |
| 4 | */ |
| 5 | |
| 6 | #ifndef _GSC_H_ |
| 7 | #define _GSC_H_ |
| 8 | |
Tim Harvey | d541927 | 2021-07-27 15:19:38 -0700 | [diff] [blame] | 9 | /* I2C bus numbers */ |
| 10 | #define GSC_BUSNO 0 |
| 11 | #define BASEBOARD_EEPROM_BUSNO 1 |
| 12 | |
Tim Harvey | 256dba0 | 2021-03-02 14:00:21 -0800 | [diff] [blame] | 13 | /* I2C slave addresses */ |
| 14 | #define GSC_SC_ADDR 0x20 |
| 15 | #define GSC_RTC_ADDR 0x68 |
| 16 | #define GSC_HWMON_ADDR 0x29 |
| 17 | #define GSC_EEPROM_ADDR 0x51 |
Tim Harvey | d541927 | 2021-07-27 15:19:38 -0700 | [diff] [blame] | 18 | #define BASEBOARD_EEPROM_ADDR 0x52 |
Tim Harvey | 256dba0 | 2021-03-02 14:00:21 -0800 | [diff] [blame] | 19 | |
| 20 | struct venice_board_info { |
| 21 | u8 mac[6]; /* 0x00: MAC base */ |
| 22 | char equiv_dts[16]; /* 0x06: equivalent device-tree */ |
| 23 | u8 res0[2]; /* 0x16: reserved */ |
| 24 | u32 serial; /* 0x18: Serial Number */ |
| 25 | u8 res1[4]; /* 0x1C: reserved */ |
| 26 | u8 mfgdate[4]; /* 0x20: MFG date */ |
| 27 | u8 macno; /* 0x24: number of mac addrs */ |
| 28 | u8 res2[6]; /* 0x25 */ |
| 29 | u8 sdram_size; /* 0x2B: (16 << n) MB */ |
| 30 | u8 sdram_speed; /* 0x2C: (33.333 * n) MHz */ |
| 31 | u8 sdram_width; /* 0x2D: (8 << n) bit */ |
| 32 | u8 res3[2]; /* 0x2E */ |
| 33 | char model[16]; /* 0x30: model string */ |
| 34 | u8 res4[14]; /* 0x40 */ |
| 35 | u8 chksum[2]; /* 0x4E */ |
| 36 | }; |
| 37 | |
| 38 | int gsc_init(int quiet); |
| 39 | int gsc_hwmon(void); |
| 40 | const char *gsc_get_model(void); |
| 41 | const char *gsc_get_dtb_name(int level, char *buf, int len); |
| 42 | int gsc_getmac(int index, uint8_t *enetaddr); |
Tim Harvey | 78b8e07 | 2021-07-27 15:19:39 -0700 | [diff] [blame] | 43 | uint32_t gsc_get_serial(void); |
Tim Harvey | 256dba0 | 2021-03-02 14:00:21 -0800 | [diff] [blame] | 44 | |
| 45 | #endif |