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:
parent
b36f3bc412
commit
3cbbcefb12
2 changed files with 12 additions and 0 deletions
|
|
@ -11,6 +11,7 @@
|
||||||
#include <zephyr/devicetree.h>
|
#include <zephyr/devicetree.h>
|
||||||
#include <zephyr/drivers/reset.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_SET_OFFSET(id) (((id) >> 5U) & 0xFFFU)
|
||||||
#define STM32_RESET_REG_BIT(id) ((id)&0x1FU)
|
#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;
|
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),
|
sys_clear_bit(config->base + STM32_RESET_SET_OFFSET(id),
|
||||||
STM32_RESET_REG_BIT(id));
|
STM32_RESET_REG_BIT(id));
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,5 +27,11 @@ properties:
|
||||||
"#reset-cells":
|
"#reset-cells":
|
||||||
const: 1
|
const: 1
|
||||||
|
|
||||||
|
set-bit-to-deassert:
|
||||||
|
type: boolean
|
||||||
|
description: |
|
||||||
|
Indicates if the driver should set bit in clear register to
|
||||||
|
deassert reset.
|
||||||
|
|
||||||
reset-cells:
|
reset-cells:
|
||||||
- id
|
- id
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue