mirror of https://github.com/xemu-project/xemu.git
hw/arm/stm32f405: Add RCC device to stm32f405 SoC
Add the reset and clock controller device to the stm32f405 SoC. Signed-off-by: Roman Cardenas Rodriguez <rcardenas.rod@gmail.com> [PMM: tweak commit message] Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
d1613f2a53
commit
950dff9aa4
|
@ -36,6 +36,7 @@ Supported devices
|
||||||
* SPI controller
|
* SPI controller
|
||||||
* System configuration (SYSCFG)
|
* System configuration (SYSCFG)
|
||||||
* Timer controller (TIMER)
|
* Timer controller (TIMER)
|
||||||
|
* Reset and Clock Controller (RCC) (STM32F4 only, reset and enable only)
|
||||||
|
|
||||||
Missing devices
|
Missing devices
|
||||||
---------------
|
---------------
|
||||||
|
@ -53,7 +54,7 @@ Missing devices
|
||||||
* Power supply configuration (PWR)
|
* Power supply configuration (PWR)
|
||||||
* Random Number Generator (RNG)
|
* Random Number Generator (RNG)
|
||||||
* Real-Time Clock (RTC) controller
|
* Real-Time Clock (RTC) controller
|
||||||
* Reset and Clock Controller (RCC)
|
* Reset and Clock Controller (RCC) (other features than reset and enable)
|
||||||
* Secure Digital Input/Output (SDIO) interface
|
* Secure Digital Input/Output (SDIO) interface
|
||||||
* USB OTG
|
* USB OTG
|
||||||
* Watchdog controller (IWDG, WWDG)
|
* Watchdog controller (IWDG, WWDG)
|
||||||
|
|
|
@ -397,6 +397,7 @@ config STM32F405_SOC
|
||||||
bool
|
bool
|
||||||
select ARM_V7M
|
select ARM_V7M
|
||||||
select OR_IRQ
|
select OR_IRQ
|
||||||
|
select STM32_RCC
|
||||||
select STM32F4XX_SYSCFG
|
select STM32F4XX_SYSCFG
|
||||||
select STM32F4XX_EXTI
|
select STM32F4XX_EXTI
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "hw/qdev-clock.h"
|
#include "hw/qdev-clock.h"
|
||||||
#include "hw/misc/unimp.h"
|
#include "hw/misc/unimp.h"
|
||||||
|
|
||||||
|
#define RCC_ADDR 0x40023800
|
||||||
#define SYSCFG_ADD 0x40013800
|
#define SYSCFG_ADD 0x40013800
|
||||||
static const uint32_t usart_addr[] = { 0x40011000, 0x40004400, 0x40004800,
|
static const uint32_t usart_addr[] = { 0x40011000, 0x40004400, 0x40004800,
|
||||||
0x40004C00, 0x40005000, 0x40011400,
|
0x40004C00, 0x40005000, 0x40011400,
|
||||||
|
@ -59,6 +60,8 @@ static void stm32f405_soc_initfn(Object *obj)
|
||||||
|
|
||||||
object_initialize_child(obj, "armv7m", &s->armv7m, TYPE_ARMV7M);
|
object_initialize_child(obj, "armv7m", &s->armv7m, TYPE_ARMV7M);
|
||||||
|
|
||||||
|
object_initialize_child(obj, "rcc", &s->rcc, TYPE_STM32_RCC);
|
||||||
|
|
||||||
object_initialize_child(obj, "syscfg", &s->syscfg, TYPE_STM32F4XX_SYSCFG);
|
object_initialize_child(obj, "syscfg", &s->syscfg, TYPE_STM32F4XX_SYSCFG);
|
||||||
|
|
||||||
for (i = 0; i < STM_NUM_USARTS; i++) {
|
for (i = 0; i < STM_NUM_USARTS; i++) {
|
||||||
|
@ -160,6 +163,14 @@ static void stm32f405_soc_realize(DeviceState *dev_soc, Error **errp)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Reset and clock controller */
|
||||||
|
dev = DEVICE(&s->rcc);
|
||||||
|
if (!sysbus_realize(SYS_BUS_DEVICE(&s->rcc), errp)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
busdev = SYS_BUS_DEVICE(dev);
|
||||||
|
sysbus_mmio_map(busdev, 0, RCC_ADDR);
|
||||||
|
|
||||||
/* System configuration controller */
|
/* System configuration controller */
|
||||||
dev = DEVICE(&s->syscfg);
|
dev = DEVICE(&s->syscfg);
|
||||||
if (!sysbus_realize(SYS_BUS_DEVICE(&s->syscfg), errp)) {
|
if (!sysbus_realize(SYS_BUS_DEVICE(&s->syscfg), errp)) {
|
||||||
|
@ -276,7 +287,6 @@ static void stm32f405_soc_realize(DeviceState *dev_soc, Error **errp)
|
||||||
create_unimplemented_device("GPIOH", 0x40021C00, 0x400);
|
create_unimplemented_device("GPIOH", 0x40021C00, 0x400);
|
||||||
create_unimplemented_device("GPIOI", 0x40022000, 0x400);
|
create_unimplemented_device("GPIOI", 0x40022000, 0x400);
|
||||||
create_unimplemented_device("CRC", 0x40023000, 0x400);
|
create_unimplemented_device("CRC", 0x40023000, 0x400);
|
||||||
create_unimplemented_device("RCC", 0x40023800, 0x400);
|
|
||||||
create_unimplemented_device("Flash Int", 0x40023C00, 0x400);
|
create_unimplemented_device("Flash Int", 0x40023C00, 0x400);
|
||||||
create_unimplemented_device("BKPSRAM", 0x40024000, 0x400);
|
create_unimplemented_device("BKPSRAM", 0x40024000, 0x400);
|
||||||
create_unimplemented_device("DMA1", 0x40026000, 0x400);
|
create_unimplemented_device("DMA1", 0x40026000, 0x400);
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#ifndef HW_ARM_STM32F405_SOC_H
|
#ifndef HW_ARM_STM32F405_SOC_H
|
||||||
#define HW_ARM_STM32F405_SOC_H
|
#define HW_ARM_STM32F405_SOC_H
|
||||||
|
|
||||||
|
#include "hw/misc/stm32_rcc.h"
|
||||||
#include "hw/misc/stm32f4xx_syscfg.h"
|
#include "hw/misc/stm32f4xx_syscfg.h"
|
||||||
#include "hw/timer/stm32f2xx_timer.h"
|
#include "hw/timer/stm32f2xx_timer.h"
|
||||||
#include "hw/char/stm32f2xx_usart.h"
|
#include "hw/char/stm32f2xx_usart.h"
|
||||||
|
@ -55,6 +56,7 @@ struct STM32F405State {
|
||||||
|
|
||||||
ARMv7MState armv7m;
|
ARMv7MState armv7m;
|
||||||
|
|
||||||
|
STM32RccState rcc;
|
||||||
STM32F4xxSyscfgState syscfg;
|
STM32F4xxSyscfgState syscfg;
|
||||||
STM32F4xxExtiState exti;
|
STM32F4xxExtiState exti;
|
||||||
STM32F2XXUsartState usart[STM_NUM_USARTS];
|
STM32F2XXUsartState usart[STM_NUM_USARTS];
|
||||||
|
|
Loading…
Reference in New Issue