Merge changes from topic "st_fixes" into integration
* changes: fix(stm32_console): do not skip init for crash console fix(plat/st): add UART reset in crash console init refactor(stm32mp1_clk): update RCC registers file fix(stm32mp1_clk): keep RTCAPB clock always on fix(stm32mp1_clk): fix RTC clock rating fix(stm32mp1_clk): correctly manage RTC clock source fix(spi_nand): check correct manufacturer id fix(spi_nand): check that parameters have been set
This commit is contained in:
commit
890ee3e87a
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2019, STMicroelectronics - All Rights Reserved
|
||||
* Copyright (c) 2019-2021, STMicroelectronics - All Rights Reserved
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -286,6 +286,10 @@ int spi_nand_init(unsigned long long *size, unsigned int *erase_size)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
assert((spinand_dev.nand_dev->page_size != 0U) &&
|
||||
(spinand_dev.nand_dev->block_size != 0U) &&
|
||||
(spinand_dev.nand_dev->size != 0U));
|
||||
|
||||
ret = spi_nand_reset();
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
|
@ -301,12 +305,12 @@ int spi_nand_init(unsigned long long *size, unsigned int *erase_size)
|
|||
return ret;
|
||||
}
|
||||
|
||||
ret = spi_nand_quad_enable(id[0]);
|
||||
ret = spi_nand_quad_enable(id[1]);
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
VERBOSE("SPI_NAND Detected ID 0x%x 0x%x\n", id[0], id[1]);
|
||||
VERBOSE("SPI_NAND Detected ID 0x%x\n", id[1]);
|
||||
|
||||
VERBOSE("Page size %i, Block size %i, size %lli\n",
|
||||
spinand_dev.nand_dev->page_size,
|
||||
|
|
|
@ -56,6 +56,7 @@ enum stm32mp1_parent_id {
|
|||
_HSI_KER = NB_OSC,
|
||||
_HSE_KER,
|
||||
_HSE_KER_DIV2,
|
||||
_HSE_RTC,
|
||||
_CSI_KER,
|
||||
_PLL1_P,
|
||||
_PLL1_Q,
|
||||
|
@ -107,7 +108,7 @@ enum stm32mp1_parent_sel {
|
|||
_USBPHY_SEL,
|
||||
_USBO_SEL,
|
||||
_MPU_SEL,
|
||||
_PER_SEL,
|
||||
_CKPER_SEL,
|
||||
_RTC_SEL,
|
||||
_PARENT_SEL_NB,
|
||||
_UNKNOWN_SEL = 0xff,
|
||||
|
@ -125,6 +126,7 @@ static const uint8_t parent_id_clock_id[_PARENT_NB] = {
|
|||
[_HSI_KER] = CK_HSI,
|
||||
[_HSE_KER] = CK_HSE,
|
||||
[_HSE_KER_DIV2] = CK_HSE_DIV2,
|
||||
[_HSE_RTC] = _UNKNOWN_ID,
|
||||
[_CSI_KER] = CK_CSI,
|
||||
[_PLL1_P] = PLL1_P,
|
||||
[_PLL1_Q] = PLL1_Q,
|
||||
|
@ -490,7 +492,7 @@ static const uint8_t per_parents[] = {
|
|||
};
|
||||
|
||||
static const uint8_t rtc_parents[] = {
|
||||
_UNKNOWN_ID, _LSE, _LSI, _HSE
|
||||
_UNKNOWN_ID, _LSE, _LSI, _HSE_RTC
|
||||
};
|
||||
|
||||
static const struct stm32mp1_clk_sel stm32mp1_clk_sel[_PARENT_SEL_NB] = {
|
||||
|
@ -502,7 +504,7 @@ static const struct stm32mp1_clk_sel stm32mp1_clk_sel[_PARENT_SEL_NB] = {
|
|||
_CLK_PARENT_SEL(UART1, RCC_UART1CKSELR, usart1_parents),
|
||||
_CLK_PARENT_SEL(RNG1, RCC_RNG1CKSELR, rng1_parents),
|
||||
_CLK_PARENT_SEL(MPU, RCC_MPCKSELR, mpu_parents),
|
||||
_CLK_PARENT_SEL(PER, RCC_CPERCKSELR, per_parents),
|
||||
_CLK_PARENT_SEL(CKPER, RCC_CPERCKSELR, per_parents),
|
||||
_CLK_PARENT_SEL(RTC, RCC_BDCR, rtc_parents),
|
||||
_CLK_PARENT_SEL(UART6, RCC_UART6CKSELR, uart6_parents),
|
||||
_CLK_PARENT_SEL(UART24, RCC_UART24CKSELR, uart234578_parents),
|
||||
|
@ -587,6 +589,7 @@ static const char * const stm32mp1_clk_parent_name[_PARENT_NB] __unused = {
|
|||
[_HSI_KER] = "HSI_KER",
|
||||
[_HSE_KER] = "HSE_KER",
|
||||
[_HSE_KER_DIV2] = "HSE_KER_DIV2",
|
||||
[_HSE_RTC] = "HSE_RTC",
|
||||
[_CSI_KER] = "CSI_KER",
|
||||
[_PLL1_P] = "PLL1_P",
|
||||
[_PLL1_Q] = "PLL1_Q",
|
||||
|
@ -969,6 +972,10 @@ static unsigned long get_clock_rate(int p)
|
|||
case _HSE_KER_DIV2:
|
||||
clock = stm32mp1_clk_get_fixed(_HSE) >> 1;
|
||||
break;
|
||||
case _HSE_RTC:
|
||||
clock = stm32mp1_clk_get_fixed(_HSE);
|
||||
clock /= (mmio_read_32(rcc_base + RCC_RTCDIVR) & RCC_DIVR_DIV_MASK) + 1U;
|
||||
break;
|
||||
case _LSI:
|
||||
clock = stm32mp1_clk_get_fixed(_LSI);
|
||||
break;
|
||||
|
@ -1652,7 +1659,7 @@ static void stm32mp1_set_rtcsrc(unsigned int clksrc, bool lse_css)
|
|||
(clksrc != (uint32_t)CLK_RTC_DISABLED)) {
|
||||
mmio_clrsetbits_32(address,
|
||||
RCC_BDCR_RTCSRC_MASK,
|
||||
clksrc << RCC_BDCR_RTCSRC_SHIFT);
|
||||
(clksrc & RCC_SELR_SRC_MASK) << RCC_BDCR_RTCSRC_SHIFT);
|
||||
|
||||
mmio_setbits_32(address, RCC_BDCR_RTCCKEN);
|
||||
}
|
||||
|
@ -2152,6 +2159,7 @@ static void secure_parent_clocks(unsigned long parent_id)
|
|||
case _HSE:
|
||||
case _HSE_KER:
|
||||
case _HSE_KER_DIV2:
|
||||
case _HSE_RTC:
|
||||
case _LSE:
|
||||
break;
|
||||
|
||||
|
@ -2210,6 +2218,7 @@ static void sync_earlyboot_clocks_state(void)
|
|||
DDRC2, DDRC2LP,
|
||||
DDRCAPB, DDRPHYCAPB, DDRPHYCAPBLP,
|
||||
DDRPHYC, DDRPHYCLP,
|
||||
RTCAPB,
|
||||
TZC1, TZC2,
|
||||
TZPC,
|
||||
STGEN_K,
|
||||
|
@ -2218,10 +2227,6 @@ static void sync_earlyboot_clocks_state(void)
|
|||
for (idx = 0U; idx < ARRAY_SIZE(secure_enable); idx++) {
|
||||
stm32mp_clk_enable(secure_enable[idx]);
|
||||
}
|
||||
|
||||
if (!stm32mp_is_single_core()) {
|
||||
stm32mp1_clk_enable_secure(RTCAPB);
|
||||
}
|
||||
}
|
||||
|
||||
int stm32mp1_clk_probe(void)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020, ARM Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2018-2021, ARM Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -45,7 +45,12 @@ func console_stm32_core_init
|
|||
/* Check the input base address */
|
||||
cmp r0, #0
|
||||
beq core_init_fail
|
||||
#if defined(IMAGE_BL2)
|
||||
#if !defined(IMAGE_BL2)
|
||||
/* Skip UART initialization if it is already enabled */
|
||||
ldr r3, [r0, #USART_CR1]
|
||||
ands r3, r3, #USART_CR1_UE
|
||||
bne 1f
|
||||
#endif /* IMAGE_BL2 */
|
||||
/* Check baud rate and uart clock for sanity */
|
||||
cmp r1, #0
|
||||
beq core_init_fail
|
||||
|
@ -78,7 +83,7 @@ teack_loop:
|
|||
ldr r3, [r0, #USART_ISR]
|
||||
tst r3, #USART_ISR_TEACK
|
||||
beq teack_loop
|
||||
#endif /* IMAGE_BL2 */
|
||||
1:
|
||||
mov r0, #1
|
||||
bx lr
|
||||
core_init_fail:
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -205,6 +205,8 @@ enum ddr_type {
|
|||
#define DEBUG_UART_TX_CLKSRC RCC_UART24CKSELR_HSI
|
||||
#define DEBUG_UART_TX_EN_REG RCC_MP_APB1ENSETR
|
||||
#define DEBUG_UART_TX_EN RCC_MP_APB1ENSETR_UART4EN
|
||||
#define DEBUG_UART_RST_REG RCC_APB1RSTSETR
|
||||
#define DEBUG_UART_RST_BIT RCC_APB1RSTSETR_UART4RST
|
||||
|
||||
/*******************************************************************************
|
||||
* STM32MP1 ETZPC
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015-2020, ARM Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2015-2021, ARM Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -148,6 +148,19 @@ endfunc plat_my_core_pos
|
|||
* ---------------------------------------------
|
||||
*/
|
||||
func plat_crash_console_init
|
||||
/* Reset UART peripheral */
|
||||
ldr r1, =(RCC_BASE + DEBUG_UART_RST_REG)
|
||||
ldr r2, =DEBUG_UART_RST_BIT
|
||||
str r2, [r1]
|
||||
1:
|
||||
ldr r0, [r1]
|
||||
ands r2, r0, r2
|
||||
beq 1b
|
||||
str r2, [r1, #4] /* RSTCLR register */
|
||||
2:
|
||||
ldr r0, [r1]
|
||||
ands r2, r0, r2
|
||||
bne 2b
|
||||
/* Enable GPIOs for UART TX */
|
||||
ldr r1, =(RCC_BASE + DEBUG_UART_TX_GPIO_BANK_CLK_REG)
|
||||
ldr r2, [r1]
|
||||
|
|
Loading…
Reference in New Issue