Skip to content

Commit 8a40158

Browse files
authored
Merge pull request #5 from FrameworkComputer/pr-tulip-evt
tulip: add hw config for eeprom
2 parents 98d0e2b + b1dd3fb commit 8a40158

File tree

13 files changed

+493
-245
lines changed

13 files changed

+493
-245
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ gpu_cfg_generator.exe: gpu_cfg_generator
66
cp gpu_cfg_gen gpu_cfg_gen.exe
77

88
gpu_cfg_generator: gpu_cfg_generator.c gpu_cfg_generator.h
9-
$(COSMOCC)/bin/cosmocc -o gpu_cfg_gen gpu_cfg_generator.c
9+
$(COSMOCC)/bin/cosmocc -o gpu_cfg_gen *.c -I ./
1010

1111
native: gpu_cfg_generator.c gpu_cfg_generator.h
12-
$(CC) -o gpu_cfg_gen gpu_cfg_generator.c -Wall
12+
$(CC) -o gpu_cfg_gen *.c -Wall -I ./
1313

1414

1515
clean :

config_definition.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
1+
#ifndef __CONFIG_DEFINITION_H
2+
#define __CONFIG_DEFINITION_H
23
/*
34
* The Framework bay descriptor consists of a header and a series of blocks
45
* after the header that describe the function of the card.
@@ -19,6 +20,8 @@
1920
* -------------
2021
*/
2122
#include <stddef.h>
23+
#include <stdint.h>
24+
2225
#define GPU_MAX_BLOCK_LEN (256)
2326
#define GPU_SERIAL_LEN 20
2427
#define BUILD_ASSERT(dummy)
@@ -126,6 +129,7 @@ enum gpu_gpio_purpose {
126129
GPIO_FUNC_VSYS_EN,
127130
GPIO_FUNC_VADP_EN,
128131
GPIO_FUNC_GPU_PWR,
132+
GPIO_FUNC_IS_THROTTLING,
129133
GPIO_FUNC_MAX,
130134
};
131135

@@ -216,13 +220,15 @@ enum gpu_vendor {
216220
GPU_FAN_ONLY = 1,
217221
GPU_AMD_R23M = 2,
218222
GPU_SSD = 3,
219-
GPU_PCIE_ACCESSORY = 4
223+
GPU_PCIE_ACCESSORY = 4,
224+
GPU_NV_GN22 = 5,
220225
} __packed;
221226
BUILD_ASSERT(sizeof(enum gpu_vendor) == sizeof(uint8_t));
222227

223228
enum gpu_pd {
224229
PD_TYPE_INVALID = 0,
225230
PD_TYPE_ETRON_EJ889I = 1,
231+
PD_TYPE_CCG8S = 2,
226232
PD_TYPE_MAX = 0xFF
227233
} __packed;
228234
struct gpu_subsys_pd {
@@ -235,3 +241,6 @@ struct gpu_subsys_pd {
235241
uint8_t gpio_hpd;
236242
uint8_t gpio_interrupt;
237243
} __packed;
244+
245+
246+
#endif /* __CONFIG_DEFINITION_H */

gn22.c

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#include <config_definition.h>
2+
#include <gn22.h>
3+
4+
struct default_gpu_cfg gn22_gpu_cfg = {
5+
.descriptor = {
6+
.magic = {0x32, 0xac, 0x00, 0x00},
7+
.length = sizeof(struct gpu_cfg_descriptor),
8+
.descriptor_version_major = 0,
9+
.descriptor_version_minor = 2,
10+
.hardware_version = 0x0004,
11+
.hardware_revision = 0,
12+
.serial = {'F', 'R', 'A', 'K', 'M', 'Q', 'C', 'P', 'A', '1',
13+
'5', '0', '0', 'A', 'S', 'S', 'Y', '0', '\0', '\0'},
14+
.descriptor_length = sizeof(struct default_gpu_cfg) - sizeof(struct gpu_cfg_descriptor),
15+
.descriptor_crc32 = 0,
16+
.crc32 = 0
17+
},
18+
.hdr0 = {.block_type = GPUCFG_TYPE_PCIE, .block_length = sizeof(uint8_t)},
19+
.pcie_cfg = PCIE_8X1,
20+
21+
.hdr1 = {.block_type = GPUCFG_TYPE_FAN, .block_length = sizeof(struct gpu_cfg_fan)},
22+
.fan0_cfg = {.idx = 0, .flags = 0, .min_rpm = 1000, .start_rpm = 1000, .max_rpm = 4700},
23+
24+
.hdr2 = {.block_type = GPUCFG_TYPE_FAN, .block_length = sizeof(struct gpu_cfg_fan)},
25+
.fan1_cfg = {.idx = 1, .flags = 0, .min_rpm = 1000, .start_rpm = 1000, .max_rpm = 4500},
26+
27+
.hdr3 = {.block_type = GPUCFG_TYPE_VENDOR, .block_length = sizeof(enum gpu_vendor)},
28+
.vendor = GPU_NV_GN22,
29+
30+
.hdr4 = {.block_type = GPUCFG_TYPE_GPIO, .block_length = (sizeof(struct gpu_cfg_gpio) * 8)},
31+
/* Critical temperature fault input */
32+
.gpio0 = {.gpio = GPU_1G1_GPIO0_EC, .function = GPIO_FUNC_TEMPFAULT, .flags = GPIO_INPUT, .power_domain = POWER_S3},
33+
/* DP HPD status from PD */
34+
.gpio1 = {.gpio = GPU_1H1_GPIO1_EC, .function = GPIO_FUNC_HPD, .flags = GPIO_INPUT, .power_domain = POWER_S5},
35+
/* output from the GPU if it is throttling */
36+
.gpio2 = {.gpio = GPU_2A2_GPIO2_EC, .function = GPIO_FUNC_IS_THROTTLING, .flags = GPIO_INPUT, .power_domain = POWER_S0},
37+
/* DDS Mux CTRL from dGPU */
38+
.gpio3 = {.gpio = GPU_2L7_GPIO3_EC, .function = GPIO_FUNC_UNUSED, .flags = GPIO_INPUT, .power_domain = POWER_S0},
39+
/* GPU_VSYS_EN */
40+
.gpio_vsys = {.gpio = GPU_VSYS_EN, .function = GPIO_FUNC_GPU_PWR, .flags = GPIO_OUTPUT_LOW, .power_domain = POWER_S3},
41+
/* GPU_VADP_EN */
42+
.gpu_vadp_en = {.gpio = GPU_VADP_EN, .function = GPIO_FUNC_HIGH, .flags = GPIO_OUTPUT_LOW, .power_domain = POWER_G3},
43+
44+
.gpio_fan = {.gpio = GPU_FAN_EN, .function = GPIO_FUNC_HIGH, .flags = GPIO_OUTPUT_LOW, .power_domain = POWER_S0},
45+
46+
.gpu_3v_5v_en = {.gpio = GPU_3V_5V_EN, .function = GPIO_FUNC_HIGH, .flags = GPIO_OUTPUT_LOW, .power_domain = POWER_G3},
47+
48+
.hdr5 = {.block_type = GPUCFG_TYPE_PD, .block_length = sizeof(struct gpu_subsys_pd)},
49+
.pd = {.gpu_pd_type = PD_TYPE_CCG8S, .address = 0x42,
50+
.flags = 0, .pdo = 0, .rdo = 0, .power_domain = POWER_G3,
51+
.gpio_hpd = GPU_1H1_GPIO1_EC, .gpio_interrupt = GPU_1F2_I2C_S5_INT
52+
},
53+
54+
.hdr6 = {.block_type = GPUCFG_TYPE_THERMAL_SENSOR, .block_length = sizeof(struct gpu_cfg_thermal)},
55+
.therm = {.thermal_type = GPU_THERM_F75303, .address = 0x4D},
56+
57+
.hdr7 = {.block_type = GPUCFG_TYPE_CUSTOM_TEMP, .block_length = sizeof(struct gpu_cfg_custom_temp)},
58+
.custom_temp = {.idx = 2, .temp_fan_off = C_TO_K(47), .temp_fan_max = C_TO_K(62)},
59+
60+
.hdr8 = {.block_type = GPUCFG_TYPE_SUBSYS, .block_length = sizeof(struct gpu_subsys_serial)},
61+
.pcba_serial = {.gpu_subsys = GPU_PCB, .serial = {'F', 'R', 'A', 'K', 'H', 'Z', 'C', 'P', 'A', '1',
62+
'5', '0', '0', 'P', 'C', 'B', '0', '0', '\0', '\0'},}
63+
};

gn22.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#ifndef __GN22_H
2+
#define __GN22_H
3+
4+
#include <gpu_cfg_generator.h>
5+
#include <r23m.h>
6+
7+
extern struct default_gpu_cfg gn22_gpu_cfg;
8+
9+
10+
#endif /* __GN22_H */

0 commit comments

Comments
 (0)