soc/intel/skylake: Clean up SD GPIO handling

This is to align with newer platforms.

Change-Id: If33ea3a7835ec071be3fd060f9712c47678bd6bf
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/50963
Reviewed-by: Michael Niewöhner <foss@mniewoehner.de>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Angel Pons 2021-02-20 00:16:47 +01:00
parent ba4cfb504c
commit 6bd99f9ada
13 changed files with 24 additions and 31 deletions

View File

@ -1,7 +1,7 @@
chip soc/intel/skylake chip soc/intel/skylake
# Use default SD card detect GPIO configuration # Use default SD card detect GPIO configuration
register "sdcard_cd_gpio_default" = "GPP_A7" register "sdcard_cd_gpio" = "GPP_A7"
device domain 0 on device domain 0 on
device pci 14.0 on device pci 14.0 on

View File

@ -23,7 +23,7 @@ chip soc/intel/skylake
register "tcc_offset" = "10" register "tcc_offset" = "10"
# Use default SD card detect GPIO configuration # Use default SD card detect GPIO configuration
register "sdcard_cd_gpio_default" = "GPP_A7" register "sdcard_cd_gpio" = "GPP_A7"
device domain 0 on device domain 0 on
device pci 15.0 on device pci 15.0 on

View File

@ -16,7 +16,7 @@ chip soc/intel/skylake
register "i2c_voltage[0]" = "I2C_VOLTAGE_3V3" register "i2c_voltage[0]" = "I2C_VOLTAGE_3V3"
# Use default SD card detect GPIO configuration # Use default SD card detect GPIO configuration
register "sdcard_cd_gpio_default" = "GPP_A7" register "sdcard_cd_gpio" = "GPP_A7"
device domain 0 on device domain 0 on
device pci 15.0 on device pci 15.0 on

View File

@ -251,7 +251,7 @@ chip soc/intel/skylake
register "tcc_offset" = "10" # TCC of 90C register "tcc_offset" = "10" # TCC of 90C
# Use default SD card detect GPIO configuration # Use default SD card detect GPIO configuration
register "sdcard_cd_gpio_default" = "GPP_E15" register "sdcard_cd_gpio" = "GPP_E15"
device cpu_cluster 0 on device cpu_cluster 0 on
device lapic 0 on end device lapic 0 on end

View File

@ -273,7 +273,7 @@ chip soc/intel/skylake
register "tcc_offset" = "10" # TCC of 90C register "tcc_offset" = "10" # TCC of 90C
# Use default SD card detect GPIO configuration # Use default SD card detect GPIO configuration
register "sdcard_cd_gpio_default" = "GPP_E15" register "sdcard_cd_gpio" = "GPP_E15"
device cpu_cluster 0 on device cpu_cluster 0 on
device lapic 0 on end device lapic 0 on end

View File

@ -232,7 +232,7 @@ chip soc/intel/skylake
register "tcc_offset" = "10" # TCC of 90C register "tcc_offset" = "10" # TCC of 90C
# Use default SD card detect GPIO configuration # Use default SD card detect GPIO configuration
register "sdcard_cd_gpio_default" = "GPP_E15" register "sdcard_cd_gpio" = "GPP_E15"
device cpu_cluster 0 on device cpu_cluster 0 on
device lapic 0 on end device lapic 0 on end

View File

@ -252,7 +252,7 @@ chip soc/intel/skylake
register "tcc_offset" = "10" # TCC of 90C register "tcc_offset" = "10" # TCC of 90C
# Use default SD card detect GPIO configuration # Use default SD card detect GPIO configuration
register "sdcard_cd_gpio_default" = "GPP_E15" register "sdcard_cd_gpio" = "GPP_E15"
device cpu_cluster 0 on device cpu_cluster 0 on
device lapic 0 on end device lapic 0 on end

View File

@ -150,7 +150,7 @@ chip soc/intel/skylake
# Use default SD card detect GPIO configuration # Use default SD card detect GPIO configuration
register "sdcard_cd_gpio_default" = "GPP_G5" register "sdcard_cd_gpio" = "GPP_G5"
# Lock Down # Lock Down
register "common_soc_config" = "{ register "common_soc_config" = "{

View File

@ -156,7 +156,7 @@ chip soc/intel/skylake
}" }"
# Use default SD card detect GPIO configuration # Use default SD card detect GPIO configuration
#register "sdcard_cd_gpio_default" = "GPP_D10" #register "sdcard_cd_gpio" = "GPP_D10"
device domain 0 on device domain 0 on
device pci 17.0 on end # SATA device pci 17.0 on end # SATA

View File

@ -156,7 +156,7 @@ chip soc/intel/skylake
register "SendVrMbxCmd" = "2" register "SendVrMbxCmd" = "2"
# Use default SD card detect GPIO configuration # Use default SD card detect GPIO configuration
register "sdcard_cd_gpio_default" = "GPP_A7" register "sdcard_cd_gpio" = "GPP_A7"
# Lock Down # Lock Down
register "common_soc_config" = "{ register "common_soc_config" = "{

View File

@ -197,7 +197,7 @@ chip soc/intel/skylake
register "SendVrMbxCmd" = "2" register "SendVrMbxCmd" = "2"
# Use default SD card detect GPIO configuration # Use default SD card detect GPIO configuration
#register "sdcard_cd_gpio_default" = "GPP_A7" #register "sdcard_cd_gpio" = "GPP_A7"
device cpu_cluster 0 on device cpu_cluster 0 on
device lapic 0 on end device lapic 0 on end

View File

@ -427,12 +427,9 @@ struct soc_intel_skylake_config {
* *
* GpioInt (Edge, ActiveBoth, SharedAndWake, PullNone, 10000, * GpioInt (Edge, ActiveBoth, SharedAndWake, PullNone, 10000,
* "\\_SB.PCI0.GPIO", 0, ResourceConsumer) * "\\_SB.PCI0.GPIO", 0, ResourceConsumer)
* { sdcard_cd_gpio_default } * { sdcard_cd_gpio }
*/ */
unsigned int sdcard_cd_gpio_default; unsigned int sdcard_cd_gpio;
/* Use custom SD card detect GPIO configuration */
struct acpi_gpio sdcard_cd_gpio;
/* Wake Enable Bitmap for USB2 ports */ /* Wake Enable Bitmap for USB2 ports */
u16 usb2_wake_enable_bitmap; u16 usb2_wake_enable_bitmap;

View File

@ -3,26 +3,22 @@
#include <intelblocks/sd.h> #include <intelblocks/sd.h>
#include "chip.h" #include "chip.h"
int sd_fill_soc_gpio_info(struct acpi_gpio* gpio, const struct device *dev) int sd_fill_soc_gpio_info(struct acpi_gpio *gpio, const struct device *dev)
{ {
config_t *config = config_of(dev); config_t *config = config_of(dev);
/* Nothing to write if GPIO is not set in devicetree */ if (!config->sdcard_cd_gpio)
if (!config->sdcard_cd_gpio_default && !config->sdcard_cd_gpio.pins[0])
return -1; return -1;
if (config->sdcard_cd_gpio_default) { gpio->type = ACPI_GPIO_TYPE_INTERRUPT;
gpio->type = ACPI_GPIO_TYPE_INTERRUPT; gpio->pull = ACPI_GPIO_PULL_NONE;
gpio->pull = ACPI_GPIO_PULL_NONE; gpio->irq.mode = ACPI_IRQ_EDGE_TRIGGERED;
gpio->irq.mode = ACPI_IRQ_EDGE_TRIGGERED; gpio->irq.polarity = ACPI_IRQ_ACTIVE_BOTH;
gpio->irq.polarity = ACPI_IRQ_ACTIVE_BOTH; gpio->irq.shared = ACPI_IRQ_SHARED;
gpio->irq.shared = ACPI_IRQ_SHARED; gpio->irq.wake = ACPI_IRQ_WAKE;
gpio->irq.wake = ACPI_IRQ_WAKE; gpio->interrupt_debounce_timeout = 10000; /* 100ms */
gpio->interrupt_debounce_timeout = 10000; /* 100ms */ gpio->pin_count = 1;
gpio->pin_count = 1; gpio->pins[0] = config->sdcard_cd_gpio;
gpio->pins[0] = config->sdcard_cd_gpio_default;
} else
*gpio = config->sdcard_cd_gpio;
return 0; return 0;
} }