skylake: Add SD card device to configure card detect GPIO

Add a PCI driver for the skylake SD card device and have it generate
an entry in the SSDT for the card detect GPIO if it is provided by the
mainboard in devicetree.

This sets up a card detect GPIO configuration that will trigger an
interrupt on both edges with a 100ms debounce timeout and can wake the
SD controller from D3 state.

The GpioInt() entry is bound to the "cd-gpio" device property which will
be consumed by the kernel driver.

The resulting ACPI output in the SSDT will be combined with the SDXC
device declaration in the DSDT.

Example:

Scope (\_SB.PCI0.SDXC)
{
  Name (_CRS, ResourceTemplate () {
    GpioInt (Edge, ActiveBoth, SharedAndWake, PullNone, 10000,
             "\\_SB.PCI0.GPIO", 0, ResourceConsumer) { 35 }
  })
  Name (_DSD, Package () {
    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
    Package () {
      Package () { "cd-gpio", Package () { \_SB.PCI0.SDXC, 0, 0, 1 } }
    }
  })
}

Change-Id: Ie4c1bfadd962cf55a987edb9ef86e92174205770
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://review.coreboot.org/14995
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Duncan Laurie
2016-05-10 15:56:16 -07:00
parent 98d69c0627
commit b25a45ca46
3 changed files with 106 additions and 0 deletions

View File

@@ -19,6 +19,7 @@
#ifndef _SOC_CHIP_H_
#define _SOC_CHIP_H_
#include <arch/acpi_device.h>
#include <stdint.h>
#include <soc/gpio_defs.h>
#include <soc/gpe.h>
@@ -339,6 +340,23 @@ struct soc_intel_skylake_config {
u8 SendVrMbxCmd;
/* Statically clock gate 8254 PIT. */
u8 clock_gate_8254;
/*
* Use SD card detect GPIO with default config:
* - Edge triggered
* - No internal pull
* - Active both (high + low)
* - Can wake device from D3
* - 100ms debounce timeout
*
* GpioInt (Edge, ActiveBoth, SharedAndWake, PullNone, 10000,
* "\\_SB.PCI0.GPIO", 0, ResourceConsumer)
* { sdcard_cd_gpio_default }
*/
unsigned sdcard_cd_gpio_default;
/* Use custom SD card detect GPIO configuration */
struct acpi_gpio sdcard_cd_gpio;
};
typedef struct soc_intel_skylake_config config_t;