Sheetal Tigadoli | ad0943e | 2019-12-18 19:44:43 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2017 - 2020, Broadcom |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #ifndef SR_UTILS_H |
| 8 | #define SR_UTILS_H |
| 9 | |
| 10 | #include <lib/mmio.h> |
| 11 | |
| 12 | #include <chip_id.h> |
| 13 | #include <cmn_plat_util.h> |
| 14 | #include <sr_def.h> |
| 15 | |
| 16 | static inline void brcm_stingray_set_qspi_mux(int enable_ap) |
| 17 | { |
| 18 | mmio_write_32(QSPI_HOLD_N_MODE_SEL_CONTROL, enable_ap); |
| 19 | mmio_write_32(QSPI_WP_N_MODE_SEL_CONTROL, enable_ap); |
| 20 | mmio_write_32(QSPI_SCK_MODE_SEL_CONTROL, enable_ap); |
| 21 | mmio_write_32(QSPI_CS_N_MODE_SEL_CONTROL, enable_ap); |
| 22 | mmio_write_32(QSPI_MOSI_MODE_SEL_CONTROL, enable_ap); |
| 23 | mmio_write_32(QSPI_MISO_MODE_SEL_CONTROL, enable_ap); |
| 24 | } |
| 25 | |
| 26 | static inline void brcm_stingray_set_straps(uint32_t boot_source) |
| 27 | { |
| 28 | /* Enable software strap override */ |
| 29 | mmio_setbits_32(CDRU_CHIP_STRAP_CTRL, |
| 30 | BIT(CDRU_CHIP_STRAP_CTRL__SOFTWARE_OVERRIDE)); |
| 31 | |
| 32 | /* set straps to the next boot source */ |
| 33 | mmio_clrsetbits_32(CDRU_CHIP_STRAP_DATA, |
| 34 | BOOT_SOURCE_MASK, |
| 35 | boot_source); |
| 36 | |
| 37 | /* Disable software strap override */ |
| 38 | mmio_clrbits_32(CDRU_CHIP_STRAP_CTRL, |
| 39 | BIT(CDRU_CHIP_STRAP_CTRL__SOFTWARE_OVERRIDE)); |
| 40 | } |
| 41 | |
| 42 | #endif |