diff options
author | Richard Spiegel <richard.spiegel@amd.corp-partner.google.com> | 2018-08-03 10:37:28 -0700 |
---|---|---|
committer | Martin Roth <martinroth@google.com> | 2018-08-06 01:09:04 +0000 |
commit | bb18b43065f678b8c9987c75075adb9ed25900b3 (patch) | |
tree | 3ac88a84967948b54686372d30f4587e82e17d32 /src/soc/amd/stoneyridge/southbridge.c | |
parent | cea849328599c98219ff78cfb83083573aa80f77 (diff) |
soc/amd/stoneyridge: Disable SATA based on devicetree setting
Grunt boards don't use SATA, so it should be disabled to save power.
Check if SATA is enabled in devicetree, and enable/disable the device
based on that setting.
BUG=b:112139043
TEST=Buil and boot grunt, checked the absence of SATA PCI.
Change-Id: I4a3b5f65e612e8da5bedff0c557a0850f350dfa8
Signed-off-by: Richard Spiegel <richard.spiegel@silverbackltd.com>
Reviewed-on: https://review.coreboot.org/27845
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'src/soc/amd/stoneyridge/southbridge.c')
-rw-r--r-- | src/soc/amd/stoneyridge/southbridge.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/soc/amd/stoneyridge/southbridge.c b/src/soc/amd/stoneyridge/southbridge.c index 63d8806fd0..f098c1c329 100644 --- a/src/soc/amd/stoneyridge/southbridge.c +++ b/src/soc/amd/stoneyridge/southbridge.c @@ -72,18 +72,32 @@ static inline int sb_ide_enable(void) void SetFchResetParams(FCH_RESET_INTERFACE *params) { + const struct device *dev = dev_find_slot(0, SATA_DEVFN); params->Xhci0Enable = IS_ENABLED(CONFIG_STONEYRIDGE_XHCI_ENABLE); - params->SataEnable = sb_sata_enable(); - params->IdeEnable = sb_ide_enable(); + if (dev && dev->enabled) { + params->SataEnable = sb_sata_enable(); + params->IdeEnable = sb_ide_enable(); + } else { + params->SataEnable = FALSE; + params->IdeEnable = FALSE; + } } void SetFchEnvParams(FCH_INTERFACE *params) { + const struct device *dev = dev_find_slot(0, SATA_DEVFN); params->AzaliaController = AzEnable; params->SataClass = CONFIG_STONEYRIDGE_SATA_MODE; - params->SataEnable = is_sata_config(); - params->IdeEnable = !params->SataEnable; - params->SataIdeMode = (CONFIG_STONEYRIDGE_SATA_MODE == SataLegacyIde); + if (dev && dev->enabled) { + params->SataEnable = is_sata_config(); + params->IdeEnable = !params->SataEnable; + params->SataIdeMode = (CONFIG_STONEYRIDGE_SATA_MODE == + SataLegacyIde); + } else { + params->SataEnable = FALSE; + params->IdeEnable = FALSE; + params->SataIdeMode = FALSE; + } } void SetFchMidParams(FCH_INTERFACE *params) |