Skip to content

Commit 09a2c21

Browse files
committed
fsp: tgl: staggering GPIOs configuration
1 parent af90fd7 commit 09a2c21

1 file changed

Lines changed: 33 additions & 13 deletions

File tree

src/x86/tgl_fsp.c

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,7 @@ struct tgl_gpio_conf {
10261026
};
10271027

10281028
#if defined (TARGET_kontron_vx3060_s2)
1029-
static const struct tgl_gpio_conf gpio_table[] = {
1029+
static const struct tgl_gpio_conf gpio_table_tempram[] = {
10301030
/* UART 0 */
10311031
{.gpio =
10321032
{
@@ -1142,22 +1142,30 @@ static const struct tgl_gpio_conf gpio_table[] = {
11421142
.gpio_dir = GPIO_DIR_OUTPUT,
11431143
.gpio_term = GPIO_TERM_NONE,
11441144
.gpio_reset = GPIO_RESET_PLTRST},
1145-
/* set to GPIO mode as native functino aren't used */
1145+
};
1146+
1147+
static const struct tgl_gpio_conf gpio_table_premem[] = {
1148+
/* Disable CNVi (Bluetooth Radio Interface) */
11461149
{.gpio =
11471150
{
1148-
.comm_port_id = GPIO_COMM_0_PORT_ID,
1149-
.cfg_offset = GPIO_GPPC_A8_CFG_OFF,
1151+
.comm_port_id = GPIO_COMM_4_PORT_ID,
1152+
.cfg_offset = GPIO_GPPC_F2_CFG_OFF,
11501153
},
11511154
.flags = (GPIO_SET_MODE | GPIO_SET_DIRECTION | GPIO_SET_INTERRUPT |
11521155
GPIO_SET_RESET),
11531156
.gpio_mode = GPIO_MODE_GPIO,
1154-
.gpio_dir = GPIO_DIR_INPUT,
1157+
.gpio_dir = GPIO_DIR_OUTPUT,
11551158
.gpio_interrupt = GPIO_INTERRUPT_DISABLE,
11561159
.gpio_reset = GPIO_RESET_PLTRST},
1160+
};
1161+
1162+
static const struct tgl_gpio_conf gpio_table_presilicon[] = {
1163+
1164+
/* set to GPIO mode as native functions aren't used */
11571165
{.gpio =
11581166
{
1159-
.comm_port_id = GPIO_COMM_4_PORT_ID,
1160-
.cfg_offset = GPIO_GPPC_E12_CFG_OFF,
1167+
.comm_port_id = GPIO_COMM_0_PORT_ID,
1168+
.cfg_offset = GPIO_GPPC_A8_CFG_OFF,
11611169
},
11621170
.flags = (GPIO_SET_MODE | GPIO_SET_DIRECTION | GPIO_SET_INTERRUPT |
11631171
GPIO_SET_RESET),
@@ -1168,7 +1176,7 @@ static const struct tgl_gpio_conf gpio_table[] = {
11681176
{.gpio =
11691177
{
11701178
.comm_port_id = GPIO_COMM_4_PORT_ID,
1171-
.cfg_offset = GPIO_GPPC_E15_CFG_OFF,
1179+
.cfg_offset = GPIO_GPPC_E12_CFG_OFF,
11721180
},
11731181
.flags = (GPIO_SET_MODE | GPIO_SET_DIRECTION | GPIO_SET_INTERRUPT |
11741182
GPIO_SET_RESET),
@@ -1179,7 +1187,7 @@ static const struct tgl_gpio_conf gpio_table[] = {
11791187
{.gpio =
11801188
{
11811189
.comm_port_id = GPIO_COMM_4_PORT_ID,
1182-
.cfg_offset = GPIO_GPPC_E16_CFG_OFF,
1190+
.cfg_offset = GPIO_GPPC_E15_CFG_OFF,
11831191
},
11841192
.flags = (GPIO_SET_MODE | GPIO_SET_DIRECTION | GPIO_SET_INTERRUPT |
11851193
GPIO_SET_RESET),
@@ -1190,12 +1198,12 @@ static const struct tgl_gpio_conf gpio_table[] = {
11901198
{.gpio =
11911199
{
11921200
.comm_port_id = GPIO_COMM_4_PORT_ID,
1193-
.cfg_offset = GPIO_GPPC_F2_CFG_OFF,
1201+
.cfg_offset = GPIO_GPPC_E16_CFG_OFF,
11941202
},
11951203
.flags = (GPIO_SET_MODE | GPIO_SET_DIRECTION | GPIO_SET_INTERRUPT |
11961204
GPIO_SET_RESET),
11971205
.gpio_mode = GPIO_MODE_GPIO,
1198-
.gpio_dir = GPIO_DIR_OUTPUT,
1206+
.gpio_dir = GPIO_DIR_INPUT,
11991207
.gpio_interrupt = GPIO_INTERRUPT_DISABLE,
12001208
.gpio_reset = GPIO_RESET_PLTRST},
12011209

@@ -1620,8 +1628,8 @@ int post_temp_ram_init_cb(void)
16201628
return err;
16211629

16221630
/* setup GPIOs */
1623-
for (i = 0; i < sizeof(gpio_table)/sizeof(gpio_table[0]); i++) {
1624-
tgl_gpio_configure(&gpio_table[i]);
1631+
for (i = 0; i < sizeof(gpio_table_tempram)/sizeof(gpio_table_tempram[0]); i++) {
1632+
tgl_gpio_configure(&gpio_table_tempram[i]);
16251633
}
16261634

16271635

@@ -1667,11 +1675,23 @@ int fsp_machine_update_m_parameters(uint8_t *default_m_params,
16671675

16681676
int fsp_pre_mem_init_cb(void)
16691677
{
1678+
unsigned int i;
1679+
1680+
for (i = 0; i < sizeof(gpio_table_premem)/sizeof(gpio_table_premem[0]); i++) {
1681+
tgl_gpio_configure(&gpio_table_premem[i]);
1682+
}
1683+
16701684
return 0;
16711685
}
16721686

16731687
int fsp_pre_silicon_init_cb(void)
16741688
{
1689+
unsigned int i;
1690+
1691+
for (i = 0; i < sizeof(gpio_table_presilicon)/sizeof(gpio_table_presilicon[0]); i++) {
1692+
tgl_gpio_configure(&gpio_table_presilicon[i]);
1693+
}
1694+
16751695
return 0;
16761696
}
16771697
#endif /* TGL_FSP_H */

0 commit comments

Comments
 (0)