-
Notifications
You must be signed in to change notification settings - Fork 522
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
soc/amd: Factor out gpp_clk_setup function
gpp_clk_setup code in most AMD SoC is similar and it can moved to common code. The only thing which is SoC dependent in this function is the SoC config, hence keep it in SoC code and move everything else in new gpp_clk_setup_common function which is in soc/amd/common. Picasso and Glinda don't have pcie_gpp_dxio_update_clk_req_config fixup function so they are addressed in later patches. Change-Id: I7d7da4bfe079f07e31212247dbf3acd14daa6447 Signed-off-by: Varshit Pandya <pandyavarshit@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/80285 Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com> Reviewed-by: Felix Held <felix-coreboot@felixheld.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
- Loading branch information
Showing
13 changed files
with
80 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
config SOC_AMD_COMMON_BLOCK_GPP_CLK | ||
bool | ||
help | ||
Select this option to use AMD common PCIe clk generator configuration. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## SPDX-License-Identifier: GPL-2.0-only | ||
|
||
ramstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_GPP_CLK) += gpp_clk.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* SPDX-License-Identifier: GPL-2.0-only */ | ||
|
||
#include <amdblocks/acpimmio.h> | ||
#include <amdblocks/pci_clk_req.h> | ||
#include <types.h> | ||
|
||
/* configure the general purpose PCIe clock outputs according to the devicetree settings */ | ||
void gpp_clk_setup_common(enum gpp_clk_req *gpp_clk_config, size_t gpp_clk_config_num) | ||
{ | ||
/* look-up table to be able to iterate over the PCIe clock output settings */ | ||
const uint8_t gpp_clk_shift_lut[GPP_CLK_OUTPUT_COUNT] = { | ||
GPP_CLK0_REQ_SHIFT, | ||
GPP_CLK1_REQ_SHIFT, | ||
GPP_CLK2_REQ_SHIFT, | ||
GPP_CLK3_REQ_SHIFT, | ||
GPP_CLK4_REQ_SHIFT, | ||
GPP_CLK5_REQ_SHIFT, | ||
GPP_CLK6_REQ_SHIFT, | ||
}; | ||
|
||
uint32_t gpp_clk_ctl = misc_read32(GPP_CLK_CNTRL); | ||
|
||
pcie_gpp_dxio_update_clk_req_config(gpp_clk_config, gpp_clk_config_num); | ||
for (int i = 0; i < GPP_CLK_OUTPUT_COUNT; i++) { | ||
gpp_clk_ctl &= ~GPP_CLK_REQ_MASK(gpp_clk_shift_lut[i]); | ||
/* | ||
* The remapping of values is done so that the default of the enum used for the | ||
* devicetree settings is the clock being enabled, so that a missing devicetree | ||
* configuration for this will result in an always active clock and not an | ||
* inactive PCIe clock output. Only the configuration for the clock outputs | ||
* available on the package is provided via the devicetree; the rest is | ||
* switched off unconditionally. | ||
*/ | ||
switch (i < gpp_clk_config_num ? gpp_clk_config[i] : GPP_CLK_OFF) { | ||
case GPP_CLK_REQ: | ||
gpp_clk_ctl |= GPP_CLK_REQ_EXT(gpp_clk_shift_lut[i]); | ||
break; | ||
case GPP_CLK_OFF: | ||
gpp_clk_ctl |= GPP_CLK_REQ_OFF(gpp_clk_shift_lut[i]); | ||
break; | ||
case GPP_CLK_ON: | ||
default: | ||
gpp_clk_ctl |= GPP_CLK_REQ_ON(gpp_clk_shift_lut[i]); | ||
} | ||
} | ||
|
||
misc_write32(GPP_CLK_CNTRL, gpp_clk_ctl); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters