1 /* 2 * Copyright (C) 2013 Gateworks Corporation 3 * 4 * SPDX-License-Identifier: GPL-2.0+ 5 */ 6 7 #ifndef _VENTANA_EEPROM_ 8 #define _VENTANA_EEPROM_ 9 10 struct ventana_board_info { 11 u8 mac0[6]; /* 0x00: MAC1 */ 12 u8 mac1[6]; /* 0x06: MAC2 */ 13 u8 res0[12]; /* 0x0C: reserved */ 14 u32 serial; /* 0x18: Serial Number (read only) */ 15 u8 res1[4]; /* 0x1C: reserved */ 16 u8 mfgdate[4]; /* 0x20: MFG date (read only) */ 17 u8 res2[7]; /* 0x24 */ 18 /* sdram config */ 19 u8 sdram_size; /* 0x2B: (16 << n) MB */ 20 u8 sdram_speed; /* 0x2C: (33.333 * n) MHz */ 21 u8 sdram_width; /* 0x2D: (8 << n) bit */ 22 /* cpu config */ 23 u8 cpu_speed; /* 0x2E: (33.333 * n) MHz */ 24 u8 cpu_type; /* 0x2F: 7=imx6q, 8=imx6dl */ 25 u8 model[16]; /* 0x30: model string */ 26 /* FLASH config */ 27 u8 nand_flash_size; /* 0x40: (8 << (n-1)) MB */ 28 u8 spi_flash_size; /* 0x41: (4 << (n-1)) MB */ 29 30 /* Config1: SoC Peripherals */ 31 u8 config[8]; /* 0x42: loading options */ 32 33 u8 res3[4]; /* 0x4A */ 34 35 u8 chksum[2]; /* 0x4E */ 36 }; 37 38 /* config bits */ 39 enum { 40 EECONFIG_ETH0, 41 EECONFIG_ETH1, 42 EECONFIG_HDMI_OUT, 43 EECONFIG_SATA, 44 EECONFIG_PCIE, 45 EECONFIG_SSI0, 46 EECONFIG_SSI1, 47 EECONFIG_LCD, 48 EECONFIG_LVDS0, 49 EECONFIG_LVDS1, 50 EECONFIG_USB0, 51 EECONFIG_USB1, 52 EECONFIG_SD0, 53 EECONFIG_SD1, 54 EECONFIG_SD2, 55 EECONFIG_SD3, 56 EECONFIG_UART0, 57 EECONFIG_UART1, 58 EECONFIG_UART2, 59 EECONFIG_UART3, 60 EECONFIG_UART4, 61 EECONFIG_IPU0, 62 EECONFIG_IPU1, 63 EECONFIG_FLEXCAN, 64 EECONFIG_MIPI_DSI, 65 EECONFIG_MIPI_CSI, 66 EECONFIG_TZASC0, 67 EECONFIG_TZASC1, 68 EECONFIG_I2C0, 69 EECONFIG_I2C1, 70 EECONFIG_I2C2, 71 EECONFIG_VPU, 72 EECONFIG_CSI0, 73 EECONFIG_CSI1, 74 EECONFIG_CAAM, 75 EECONFIG_MEZZ, 76 EECONFIG_RES1, 77 EECONFIG_RES2, 78 EECONFIG_RES3, 79 EECONFIG_RES4, 80 EECONFIG_ESPCI0, 81 EECONFIG_ESPCI1, 82 EECONFIG_ESPCI2, 83 EECONFIG_ESPCI3, 84 EECONFIG_ESPCI4, 85 EECONFIG_ESPCI5, 86 EECONFIG_RES5, 87 EECONFIG_RES6, 88 EECONFIG_GPS, 89 EECONFIG_SPIFL0, 90 EECONFIG_SPIFL1, 91 EECONFIG_GSPBATT, 92 EECONFIG_HDMI_IN, 93 EECONFIG_VID_OUT, 94 EECONFIG_VID_IN, 95 EECONFIG_NAND, 96 EECONFIG_RES8, 97 EECONFIG_RES9, 98 EECONFIG_RES10, 99 EECONFIG_RES11, 100 EECONFIG_RES12, 101 EECONFIG_RES13, 102 EECONFIG_RES14, 103 EECONFIG_RES15, 104 }; 105 106 enum { 107 GW54proto, /* original GW5400-A prototype */ 108 GW51xx, 109 GW52xx, 110 GW53xx, 111 GW54xx, 112 GW551x, 113 GW552x, 114 GW553x, 115 GW560x, 116 GW5903, 117 GW5904, 118 GW_UNKNOWN, 119 GW_BADCRC, 120 }; 121 122 /* config items */ 123 struct ventana_eeprom_config { 124 const char *name; /* name of item */ 125 const char *dtalias; /* name of dt node to remove if not set */ 126 int bit; /* bit within config */ 127 }; 128 129 extern struct ventana_eeprom_config econfig[]; 130 extern struct ventana_board_info ventana_info; 131 132 int read_eeprom(int bus, struct ventana_board_info *); 133 134 #endif 135