herobrine: fix emmc and sd card clocks

Found an issue where emmc and sd clocks were being misconfigured due
to using incorrect integer values when called instead of the defined
enums.  Fixing by splitting the clock_configure_sdcc() function into
two (sdcc1 and sdcc2) as there was no commonality between the two
cases anyway.  As a result, we can also get rid of the clk_sdcc enum.

BUG=b:198627043
BRANCH=None
TEST=build herobrine image and test in conjunction with CB:63289
     make sure assert is not thrown.

Change-Id: I68f9167499ede057922135623a4b04202f4da9b5
Signed-off-by: Shelley Chen <shchen@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/63311
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Shelley Chen 2022-04-01 14:58:22 -07:00
parent 0b7aa5abcb
commit faaa759763
3 changed files with 42 additions and 45 deletions

View File

@ -50,9 +50,9 @@ static void qi2s_configure_gpios(void)
static void mainboard_init(struct device *dev) static void mainboard_init(struct device *dev)
{ {
/* Configure clock for eMMC */ /* Configure clock for eMMC */
clock_configure_sdcc(1, 384 * MHz); clock_configure_sdcc1(384 * MHz);
/* Configure clock for SD card */ /* Configure clock for SD card */
clock_configure_sdcc(2, 50 * MHz); clock_configure_sdcc2(50 * MHz);
configure_sdhci(); configure_sdhci();
gpi_firmware_load(QUP_0_GSI_BASE); gpi_firmware_load(QUP_0_GSI_BASE);

View File

@ -291,9 +291,8 @@ void clock_enable_qup(int qup)
} }
} }
void clock_configure_sdcc(enum clk_sdcc sdcc, uint32_t hz) void clock_configure_sdcc1(uint32_t hz)
{ {
if (sdcc == SDCC1_CLK) {
if (hz > CLK_100MHZ) { if (hz > CLK_100MHZ) {
struct alpha_pll_reg_val_config gpll10_cfg = {0}; struct alpha_pll_reg_val_config gpll10_cfg = {0};
gpll10_cfg.reg_mode = &gcc->gpll10.mode; gpll10_cfg.reg_mode = &gcc->gpll10.mode;
@ -310,7 +309,10 @@ void clock_configure_sdcc(enum clk_sdcc sdcc, uint32_t hz)
hz, ARRAY_SIZE(sdcc1_core_cfg)); hz, ARRAY_SIZE(sdcc1_core_cfg));
clock_enable(&gcc->sdcc1_ahb_cbcr); clock_enable(&gcc->sdcc1_ahb_cbcr);
clock_enable(&gcc->sdcc1_apps_cbcr); clock_enable(&gcc->sdcc1_apps_cbcr);
} else if (sdcc == SDCC2_CLK) { }
void clock_configure_sdcc2(uint32_t hz)
{
if (hz > CLK_100MHZ) { if (hz > CLK_100MHZ) {
struct alpha_pll_reg_val_config gpll9_cfg = {0}; struct alpha_pll_reg_val_config gpll9_cfg = {0};
gpll9_cfg.reg_mode = &gcc->gpll9.mode; gpll9_cfg.reg_mode = &gcc->gpll9.mode;
@ -330,7 +332,6 @@ void clock_configure_sdcc(enum clk_sdcc sdcc, uint32_t hz)
clock_enable(&gcc->sdcc2_ahb_cbcr); clock_enable(&gcc->sdcc2_ahb_cbcr);
clock_enable(&gcc->sdcc2_apps_cbcr); clock_enable(&gcc->sdcc2_apps_cbcr);
} }
}
void clock_configure_dfsr(int qup) void clock_configure_dfsr(int qup)
{ {

View File

@ -272,11 +272,6 @@ struct pcie {
int vote_bit; int vote_bit;
}; };
enum clk_sdcc {
SDCC1_CLK,
SDCC2_CLK,
};
enum clk_qup { enum clk_qup {
QUP_WRAP0_S0, QUP_WRAP0_S0,
QUP_WRAP0_S1, QUP_WRAP0_S1,
@ -385,7 +380,8 @@ static struct sc7280_disp_cc *const mdss = (void *)DISP_CC_BASE;
void clock_init(void); void clock_init(void);
void clock_configure_qspi(uint32_t hz); void clock_configure_qspi(uint32_t hz);
void clock_enable_qup(int qup); void clock_enable_qup(int qup);
void clock_configure_sdcc(enum clk_sdcc, uint32_t hz); void clock_configure_sdcc1(uint32_t hz);
void clock_configure_sdcc2(uint32_t hz);
void clock_configure_dfsr(int qup); void clock_configure_dfsr(int qup);
int clock_enable_gdsc(enum clk_gdsc gdsc_type); int clock_enable_gdsc(enum clk_gdsc gdsc_type);