drivers: reset: Add support for reset clear register

To deassert reset in STM32MP1 RCC the driver needs to set the bit in
reset clear register.

This patch extends existing implementation to support this type of
register.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
This commit is contained in:
Patryk Duda 2022-12-05 15:55:30 +01:00 committed by Marti Bolivar
parent b36f3bc412
commit 3cbbcefb12
2 changed files with 12 additions and 0 deletions

View file

@ -11,6 +11,7 @@
#include <zephyr/devicetree.h>
#include <zephyr/drivers/reset.h>
#define STM32_RESET_CLR_OFFSET(id) (((id) >> 17U) & 0xFFFU)
#define STM32_RESET_SET_OFFSET(id) (((id) >> 5U) & 0xFFFU)
#define STM32_RESET_REG_BIT(id) ((id)&0x1FU)
@ -43,8 +44,13 @@ static int reset_stm32_line_deassert(const struct device *dev, uint32_t id)
{
const struct reset_stm32_config *config = dev->config;
#if DT_INST_PROP(0, set_bit_to_deassert)
sys_set_bit(config->base + STM32_RESET_CLR_OFFSET(id),
STM32_RESET_REG_BIT(id));
#else
sys_clear_bit(config->base + STM32_RESET_SET_OFFSET(id),
STM32_RESET_REG_BIT(id));
#endif
return 0;
}

View file

@ -27,5 +27,11 @@ properties:
"#reset-cells":
const: 1
set-bit-to-deassert:
type: boolean
description: |
Indicates if the driver should set bit in clear register to
deassert reset.
reset-cells:
- id