blob: 97ce5a7c772df1d00e7af13166413f9150d3cf67 [file] [log] [blame]
T Michael Turneyb97e6f72021-03-18 09:16:44 -07001/* SPDX-License-Identifier: GPL-2.0-only */
2
3#include <arch/stages.h>
Ravi Kumar Bokkad11c8142021-07-05 21:03:56 +05304#include <soc/usb/usb_common.h>
T Michael Turneyb97e6f72021-03-18 09:16:44 -07005#include <soc/qclib_common.h>
Shelley Chenffebd492021-09-28 12:42:11 -07006#include "board.h"
Ravi Kumar Bokka5afeba32021-01-04 14:28:14 +05307#include <soc/shrm.h>
Sudheer Kumar Amrabadidfe817e2022-03-22 20:00:29 +05308#include <soc/cpucp.h>
T Michael Turneyb97e6f72021-03-18 09:16:44 -07009
Ravi Kumar Bokkad11c8142021-07-05 21:03:56 +053010static void prepare_usb(void)
11{
12 /*
13 * Do DWC3 core and phy reset. Kick these resets
14 * off early so they get at least 1ms to settle.
15 */
16 reset_usb0();
17}
18
T Michael Turneyb97e6f72021-03-18 09:16:44 -070019void platform_romstage_main(void)
20{
Ravi Kumar Bokka5afeba32021-01-04 14:28:14 +053021 shrm_fw_load_reset();
Sudheer Kumar Amrabadidfe817e2022-03-22 20:00:29 +053022 cpucp_prepare();
T Michael Turneyb97e6f72021-03-18 09:16:44 -070023 /* QCLib: DDR init & train */
24 qclib_load_and_run();
Ravi Kumar Bokkad11c8142021-07-05 21:03:56 +053025 prepare_usb();
Shelley Chenffebd492021-09-28 12:42:11 -070026 /* This rail needs to be stable by the time we take the FPMCU out of
27 reset in ramstage, so already turn it on here. This needs to happen
28 at least 200ms after this pin was first driven low in the bootblock. */
29 if (CONFIG(HEROBRINE_HAS_FINGERPRINT))
30 gpio_output(GPIO_EN_FP_RAILS, 1);
T Michael Turneyb97e6f72021-03-18 09:16:44 -070031}