Skip to content

Commit f28e8a5

Browse files
committed
Unimplement the APBxRSTR registers
These registers did not seem implemented properly. Fixing them would take some effort, and I do not expect they are commonly used, so I decided to remove them completely. Now, if someone tries to use them, they will receive an error.
1 parent 3e846fc commit f28e8a5

File tree

1 file changed

+7
-38
lines changed

1 file changed

+7
-38
lines changed

hw/arm/stm32_rcc.c

Lines changed: 7 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,7 @@ struct Stm32Rcc {
265265
/* Register Values */
266266
uint32_t
267267
RCC_APB1ENR,
268-
RCC_APB2ENR,
269-
RCC_APB1RSTR,
270-
RCC_APB2RSTR;
268+
RCC_APB2ENR;
271269

272270
/* Register Field Values */
273271
uint32_t
@@ -500,22 +498,6 @@ static void stm32_rcc_RCC_APB2ENR_write(Stm32Rcc *s, uint32_t new_value,
500498
s->RCC_APB2ENR = new_value & 0x0000fffd;
501499
}
502500

503-
static void stm32_rcc_RCC_APB2RSTR_write(Stm32Rcc *s, uint32_t new_value,
504-
bool init)
505-
{
506-
stm32_rcc_periph_enable(s, new_value, init, STM32_UART1, RCC_APB2RSTR_USART1RST_BIT);
507-
stm32_rcc_periph_enable(s, new_value, init, STM32_GPIOE, RCC_APB2RSTR_IOPERST_BIT);
508-
stm32_rcc_periph_enable(s, new_value, init, STM32_GPIOD, RCC_APB2RSTR_IOPDRST_BIT);
509-
stm32_rcc_periph_enable(s, new_value, init, STM32_GPIOC, RCC_APB2RSTR_IOPCRST_BIT);
510-
stm32_rcc_periph_enable(s, new_value, init, STM32_GPIOB, RCC_APB2RSTR_IOPBRST_BIT);
511-
stm32_rcc_periph_enable(s, new_value, init, STM32_GPIOA, RCC_APB2RSTR_IOPARST_BIT);
512-
stm32_rcc_periph_enable(s, new_value, init, STM32_AFIO_PERIPH, RCC_APB2RSTR_AFIORST_BIT);
513-
stm32_rcc_periph_enable(s, new_value, init, STM32_GPIOG, RCC_APB2RSTR_IOPGRST_BIT);
514-
stm32_rcc_periph_enable(s, new_value, init, STM32_GPIOF, RCC_APB2RSTR_IOPFRST_BIT);
515-
516-
s->RCC_APB2RSTR = new_value & 0x0000fffd;
517-
}
518-
519501
/* Write the APB1 peripheral clock enable register
520502
* Enables/Disables the peripheral clocks based on each bit. */
521503
static void stm32_rcc_RCC_APB1ENR_write(Stm32Rcc *s, uint32_t new_value,
@@ -546,21 +528,6 @@ static void stm32_rcc_RCC_APB1ENR_write(Stm32Rcc *s, uint32_t new_value,
546528
s->RCC_APB1ENR = new_value & 0x00005e7d;
547529
}
548530

549-
static void stm32_rcc_RCC_APB1RSTR_write(Stm32Rcc *s, uint32_t new_value,
550-
bool init)
551-
{
552-
stm32_rcc_periph_enable(s, new_value, init, STM32_UART5,
553-
RCC_APB1RSTR_UART5RST_BIT);
554-
stm32_rcc_periph_enable(s, new_value, init, STM32_UART4,
555-
RCC_APB1RSTR_UART4RST_BIT);
556-
stm32_rcc_periph_enable(s, new_value, init, STM32_UART3,
557-
RCC_APB1RSTR_USART3RST_BIT);
558-
stm32_rcc_periph_enable(s, new_value, init, STM32_UART2,
559-
RCC_APB1RSTR_USART2RST_BIT);
560-
561-
s->RCC_APB1RSTR = new_value & 0x00005e7d;
562-
}
563-
564531
static uint32_t stm32_rcc_RCC_BDCR_read(Stm32Rcc *s)
565532
{
566533
int lseon_bit = clktree_is_enabled(s->LSECLK) ? 1 : 0;
@@ -603,9 +570,11 @@ static uint64_t stm32_rcc_readw(void *opaque, hwaddr offset)
603570
case RCC_CIR_OFFSET:
604571
return 0;
605572
case RCC_APB2RSTR_OFFSET:
606-
return s->RCC_APB2RSTR;
573+
STM32_NOT_IMPL_REG(offset, 4);
574+
return 0;
607575
case RCC_APB1RSTR_OFFSET:
608-
return s->RCC_APB1RSTR;
576+
STM32_NOT_IMPL_REG(offset, 4);
577+
return 0;
609578
case RCC_AHBENR_OFFSET:
610579
STM32_NOT_IMPL_REG(offset, 4);
611580
return 0;
@@ -646,10 +615,10 @@ static void stm32_rcc_writew(void *opaque, hwaddr offset,
646615
/* Allow a write but don't take any action */
647616
break;
648617
case RCC_APB2RSTR_OFFSET:
649-
stm32_rcc_RCC_APB2RSTR_write(s, value, false);
618+
STM32_NOT_IMPL_REG(offset, 4);
650619
break;
651620
case RCC_APB1RSTR_OFFSET:
652-
stm32_rcc_RCC_APB1RSTR_write(s, value, false);
621+
STM32_NOT_IMPL_REG(offset, 4);
653622
break;
654623
case RCC_AHBENR_OFFSET:
655624
STM32_NOT_IMPL_REG(offset, 4);

0 commit comments

Comments
 (0)