@ -8,16 +8,12 @@
# include <dm.h>
# include <dm.h>
# include <errno.h>
# include <errno.h>
# include <reset-uclass.h>
# include <reset-uclass.h>
# include <stm32_rcc.h>
# include <asm/io.h>
# include <asm/io.h>
/* reset clear offset for STM32MP RCC */
/* reset clear offset for STM32MP RCC */
# define RCC_CL 0x4
# define RCC_CL 0x4
enum rcc_type {
RCC_STM32 = 0 ,
RCC_STM32MP ,
} ;
struct stm32_reset_priv {
struct stm32_reset_priv {
fdt_addr_t base ;
fdt_addr_t base ;
} ;
} ;
@ -40,7 +36,7 @@ static int stm32_reset_assert(struct reset_ctl *reset_ctl)
debug ( " %s: reset id = %ld bank = %d offset = %d) \n " , __func__ ,
debug ( " %s: reset id = %ld bank = %d offset = %d) \n " , __func__ ,
reset_ctl - > id , bank , offset ) ;
reset_ctl - > id , bank , offset ) ;
if ( dev_get_driver_data ( reset_ctl - > dev ) = = RCC_ STM32MP)
if ( dev_get_driver_data ( reset_ctl - > dev ) = = STM32MP1 )
/* reset assert is done in rcc set register */
/* reset assert is done in rcc set register */
writel ( BIT ( offset ) , priv - > base + bank ) ;
writel ( BIT ( offset ) , priv - > base + bank ) ;
else
else
@ -57,7 +53,7 @@ static int stm32_reset_deassert(struct reset_ctl *reset_ctl)
debug ( " %s: reset id = %ld bank = %d offset = %d) \n " , __func__ ,
debug ( " %s: reset id = %ld bank = %d offset = %d) \n " , __func__ ,
reset_ctl - > id , bank , offset ) ;
reset_ctl - > id , bank , offset ) ;
if ( dev_get_driver_data ( reset_ctl - > dev ) = = RCC_ STM32MP)
if ( dev_get_driver_data ( reset_ctl - > dev ) = = STM32MP1 )
/* reset deassert is done in rcc clr register */
/* reset deassert is done in rcc clr register */
writel ( BIT ( offset ) , priv - > base + bank + RCC_CL ) ;
writel ( BIT ( offset ) , priv - > base + bank + RCC_CL ) ;
else
else
@ -88,15 +84,9 @@ static int stm32_reset_probe(struct udevice *dev)
return 0 ;
return 0 ;
}
}
static const struct udevice_id stm32_reset_ids [ ] = {
{ . compatible = " st,stm32mp1-rcc-rst " , . data = RCC_STM32MP } ,
{ }
} ;
U_BOOT_DRIVER ( stm32_rcc_reset ) = {
U_BOOT_DRIVER ( stm32_rcc_reset ) = {
. name = " stm32_rcc_reset " ,
. name = " stm32_rcc_reset " ,
. id = UCLASS_RESET ,
. id = UCLASS_RESET ,
. of_match = stm32_reset_ids ,
. probe = stm32_reset_probe ,
. probe = stm32_reset_probe ,
. priv_auto_alloc_size = sizeof ( struct stm32_reset_priv ) ,
. priv_auto_alloc_size = sizeof ( struct stm32_reset_priv ) ,
. ops = & stm32_reset_ops ,
. ops = & stm32_reset_ops ,