baytrail: add support for routing gpio pins to smi/sci
In order for gpio pins to trigger an smi/sci the GPIO_ROUT register needs to be set accordingly. For SMI, the ALT_GPIO_SMI register needs to be enabled for each gpio as well. The first 8 gpios from the suspend and core well are the only gpios that can trigger an SMI or SCI. The settings for the GPIO_ROUT and ALT_GPIO_SMI register are not commited until the SMM settings are enabled in the southcluster. BUG=chrome-os-partner:23505 BRANCH=None TEST=Built and booted. Manually triggered SCI by changing GPE0a_EN and toggling PCH_WAKE_L on the EC console. Change-Id: Id79b70084edc39fc047475e984494c224bd75d6d Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/176390 Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: http://review.coreboot.org/4957 Tested-by: build bot (Jenkins) Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
This commit is contained in:
committed by
Aaron Durbin
parent
997d25219b
commit
59a4cd5578
@@ -17,9 +17,11 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <baytrail/gpio.h>
|
||||
#include <device/pci.h>
|
||||
#include <console/console.h>
|
||||
#include <baytrail/gpio.h>
|
||||
#include <baytrail/pmc.h>
|
||||
#include <baytrail/smm.h>
|
||||
|
||||
/* GPIO-to-Pad LUTs */
|
||||
static const u8 gpncore_gpio_to_pad[GPNCORE_COUNT] =
|
||||
@@ -154,12 +156,36 @@ static void setup_gpios(const struct soc_gpio_map *gpios,
|
||||
}
|
||||
}
|
||||
|
||||
static void setup_gpio_route(const struct soc_gpio_map *sus,
|
||||
const struct soc_gpio_map *core)
|
||||
{
|
||||
uint32_t route_reg = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
/* SMI takes precedence and wake_en implies SCI. */
|
||||
if (sus[i].smi) {
|
||||
route_reg |= ROUTE_SMI << (2 * i);
|
||||
} else if (sus[i].wake_en) {
|
||||
route_reg |= ROUTE_SCI << (2 * i);
|
||||
}
|
||||
|
||||
if (core[i].smi) {
|
||||
route_reg |= ROUTE_SMI << (2 * (i + 8));
|
||||
} else if (core[i].wake_en) {
|
||||
route_reg |= ROUTE_SCI << (2 * (i + 8));
|
||||
}
|
||||
}
|
||||
southcluster_smm_save_gpio_route(route_reg);
|
||||
}
|
||||
|
||||
void setup_soc_gpios(struct soc_gpio_config *config)
|
||||
{
|
||||
if (config) {
|
||||
setup_gpios(config->ncore, &gpncore_bank);
|
||||
setup_gpios(config->score, &gpscore_bank);
|
||||
setup_gpios(config->ssus, &gpssus_bank);
|
||||
setup_gpio_route(config->ssus, config->score);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user