Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2013 Gateworks Corporation |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #ifndef _VENTANA_EEPROM_ |
| 7 | #define _VENTANA_EEPROM_ |
| 8 | |
Tim Harvey | 4137785 | 2022-04-13 09:29:16 -0700 | [diff] [blame] | 9 | #define BOARD_EEPROM_BUSNO 0 |
| 10 | #define BOARD_EEPROM_ADDR 0x51 |
| 11 | |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 12 | struct ventana_board_info { |
| 13 | u8 mac0[6]; /* 0x00: MAC1 */ |
| 14 | u8 mac1[6]; /* 0x06: MAC2 */ |
| 15 | u8 res0[12]; /* 0x0C: reserved */ |
| 16 | u32 serial; /* 0x18: Serial Number (read only) */ |
| 17 | u8 res1[4]; /* 0x1C: reserved */ |
| 18 | u8 mfgdate[4]; /* 0x20: MFG date (read only) */ |
| 19 | u8 res2[7]; /* 0x24 */ |
| 20 | /* sdram config */ |
Tim Harvey | a61d021 | 2014-04-02 22:10:48 -0700 | [diff] [blame] | 21 | u8 sdram_size; /* 0x2B: (16 << n) MB */ |
| 22 | u8 sdram_speed; /* 0x2C: (33.333 * n) MHz */ |
| 23 | u8 sdram_width; /* 0x2D: (8 << n) bit */ |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 24 | /* cpu config */ |
Tim Harvey | a61d021 | 2014-04-02 22:10:48 -0700 | [diff] [blame] | 25 | u8 cpu_speed; /* 0x2E: (33.333 * n) MHz */ |
| 26 | u8 cpu_type; /* 0x2F: 7=imx6q, 8=imx6dl */ |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 27 | u8 model[16]; /* 0x30: model string */ |
| 28 | /* FLASH config */ |
Tim Harvey | a61d021 | 2014-04-02 22:10:48 -0700 | [diff] [blame] | 29 | u8 nand_flash_size; /* 0x40: (8 << (n-1)) MB */ |
| 30 | u8 spi_flash_size; /* 0x41: (4 << (n-1)) MB */ |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 31 | |
| 32 | /* Config1: SoC Peripherals */ |
| 33 | u8 config[8]; /* 0x42: loading options */ |
| 34 | |
| 35 | u8 res3[4]; /* 0x4A */ |
| 36 | |
| 37 | u8 chksum[2]; /* 0x4E */ |
| 38 | }; |
| 39 | |
| 40 | /* config bits */ |
| 41 | enum { |
| 42 | EECONFIG_ETH0, |
| 43 | EECONFIG_ETH1, |
| 44 | EECONFIG_HDMI_OUT, |
| 45 | EECONFIG_SATA, |
| 46 | EECONFIG_PCIE, |
| 47 | EECONFIG_SSI0, |
| 48 | EECONFIG_SSI1, |
| 49 | EECONFIG_LCD, |
| 50 | EECONFIG_LVDS0, |
| 51 | EECONFIG_LVDS1, |
| 52 | EECONFIG_USB0, |
| 53 | EECONFIG_USB1, |
| 54 | EECONFIG_SD0, |
| 55 | EECONFIG_SD1, |
| 56 | EECONFIG_SD2, |
| 57 | EECONFIG_SD3, |
| 58 | EECONFIG_UART0, |
| 59 | EECONFIG_UART1, |
| 60 | EECONFIG_UART2, |
| 61 | EECONFIG_UART3, |
| 62 | EECONFIG_UART4, |
| 63 | EECONFIG_IPU0, |
| 64 | EECONFIG_IPU1, |
| 65 | EECONFIG_FLEXCAN, |
| 66 | EECONFIG_MIPI_DSI, |
| 67 | EECONFIG_MIPI_CSI, |
| 68 | EECONFIG_TZASC0, |
| 69 | EECONFIG_TZASC1, |
| 70 | EECONFIG_I2C0, |
| 71 | EECONFIG_I2C1, |
| 72 | EECONFIG_I2C2, |
| 73 | EECONFIG_VPU, |
| 74 | EECONFIG_CSI0, |
| 75 | EECONFIG_CSI1, |
| 76 | EECONFIG_CAAM, |
| 77 | EECONFIG_MEZZ, |
| 78 | EECONFIG_RES1, |
| 79 | EECONFIG_RES2, |
| 80 | EECONFIG_RES3, |
| 81 | EECONFIG_RES4, |
| 82 | EECONFIG_ESPCI0, |
| 83 | EECONFIG_ESPCI1, |
| 84 | EECONFIG_ESPCI2, |
| 85 | EECONFIG_ESPCI3, |
| 86 | EECONFIG_ESPCI4, |
| 87 | EECONFIG_ESPCI5, |
| 88 | EECONFIG_RES5, |
| 89 | EECONFIG_RES6, |
| 90 | EECONFIG_GPS, |
| 91 | EECONFIG_SPIFL0, |
| 92 | EECONFIG_SPIFL1, |
| 93 | EECONFIG_GSPBATT, |
| 94 | EECONFIG_HDMI_IN, |
| 95 | EECONFIG_VID_OUT, |
| 96 | EECONFIG_VID_IN, |
| 97 | EECONFIG_NAND, |
| 98 | EECONFIG_RES8, |
| 99 | EECONFIG_RES9, |
| 100 | EECONFIG_RES10, |
| 101 | EECONFIG_RES11, |
| 102 | EECONFIG_RES12, |
| 103 | EECONFIG_RES13, |
| 104 | EECONFIG_RES14, |
| 105 | EECONFIG_RES15, |
| 106 | }; |
| 107 | |
Tim Harvey | 0dccde7 | 2014-06-02 16:13:25 -0700 | [diff] [blame] | 108 | enum { |
| 109 | GW54proto, /* original GW5400-A prototype */ |
| 110 | GW51xx, |
| 111 | GW52xx, |
| 112 | GW53xx, |
| 113 | GW54xx, |
Tim Harvey | b6de3b2 | 2015-04-08 12:54:45 -0700 | [diff] [blame] | 114 | GW551x, |
Tim Harvey | 5058183 | 2014-08-20 23:35:14 -0700 | [diff] [blame] | 115 | GW552x, |
Tim Harvey | 892068c | 2016-05-24 11:03:58 -0700 | [diff] [blame] | 116 | GW553x, |
Tim Harvey | 659441b | 2017-03-17 07:31:02 -0700 | [diff] [blame] | 117 | GW560x, |
Tim Harvey | 5852a33 | 2019-02-04 13:10:58 -0800 | [diff] [blame] | 118 | GW5901, |
| 119 | GW5902, |
Tim Harvey | 4533c90 | 2017-03-17 07:32:21 -0700 | [diff] [blame] | 120 | GW5903, |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 121 | GW5904, |
Tim Harvey | a2d24c9 | 2019-02-04 13:10:50 -0800 | [diff] [blame] | 122 | GW5905, |
Tim Harvey | b7c48a9 | 2019-02-04 13:10:54 -0800 | [diff] [blame] | 123 | GW5906, |
Tim Harvey | 83cad80 | 2019-02-04 13:10:55 -0800 | [diff] [blame] | 124 | GW5907, |
Tim Harvey | c262540 | 2019-02-04 13:10:56 -0800 | [diff] [blame] | 125 | GW5908, |
Tim Harvey | 2df5046 | 2019-02-04 13:10:57 -0800 | [diff] [blame] | 126 | GW5909, |
Tim Harvey | 08aec66 | 2021-07-24 10:40:42 -0700 | [diff] [blame] | 127 | GW5910, |
Tim Harvey | d67ad6e | 2021-07-24 10:40:43 -0700 | [diff] [blame] | 128 | GW5912, |
Tim Harvey | b7c9f36 | 2021-07-24 10:40:44 -0700 | [diff] [blame] | 129 | GW5913, |
Tim Harvey | 0dccde7 | 2014-06-02 16:13:25 -0700 | [diff] [blame] | 130 | GW_UNKNOWN, |
Tim Harvey | 0da2c52 | 2014-08-07 22:35:45 -0700 | [diff] [blame] | 131 | GW_BADCRC, |
| 132 | }; |
| 133 | |
| 134 | /* config items */ |
| 135 | struct ventana_eeprom_config { |
| 136 | const char *name; /* name of item */ |
| 137 | const char *dtalias; /* name of dt node to remove if not set */ |
| 138 | int bit; /* bit within config */ |
Tim Harvey | 0dccde7 | 2014-06-02 16:13:25 -0700 | [diff] [blame] | 139 | }; |
| 140 | |
Tim Harvey | 0da2c52 | 2014-08-07 22:35:45 -0700 | [diff] [blame] | 141 | extern struct ventana_eeprom_config econfig[]; |
| 142 | extern struct ventana_board_info ventana_info; |
Tim Harvey | 4137785 | 2022-04-13 09:29:16 -0700 | [diff] [blame] | 143 | extern int board_type; |
| 144 | |
| 145 | int read_eeprom(struct ventana_board_info *info); |
Tim Harvey | 0da2c52 | 2014-08-07 22:35:45 -0700 | [diff] [blame] | 146 | |
Tim Harvey | 4137785 | 2022-04-13 09:29:16 -0700 | [diff] [blame] | 147 | /* |
| 148 | * I2C transactions to the GSC are done via these functions which |
| 149 | * perform retries in the case of a busy GSC NAK'ing the transaction |
| 150 | */ |
| 151 | int gsc_i2c_read(uchar chip, uint addr, int alen, uchar *buf, int len); |
| 152 | int gsc_i2c_write(uchar chip, uint addr, int alen, uchar *buf, int len); |
| 153 | const char *gsc_get_dtb_name(int level, char *buf, int sz); |
| 154 | struct udevice *i2c_get_dev(int busno, int slave); |
| 155 | const char *eeprom_get_model(void); |
Tim Harvey | 0dccde7 | 2014-06-02 16:13:25 -0700 | [diff] [blame] | 156 | |
Tim Harvey | 552c358 | 2014-03-06 07:46:30 -0800 | [diff] [blame] | 157 | #endif |