* [PATCH 1/4] dt-bindings: mfd: Add STM32F4 RCC numeric constants into DT include file
@ 2016-07-04 13:47 ` gabriel.fernandez-qxv4g6HH51o
0 siblings, 0 replies; 44+ messages in thread
From: gabriel.fernandez @ 2016-07-04 13:47 UTC (permalink / raw)
To: Philipp Zabel, Rob Herring, Mark Rutland, Maxime Coquelin,
Russell King, patrice.chotard, alexandre.torgue
Cc: devicetree, linux-arm-kernel, linux-kernel
From: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Ths patch lists STM32F4's RCC numeric constants.
It will be used by clock and reset drivers, and DT bindings.
Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
---
include/dt-bindings/mfd/stm32f4-rcc.h | 92 +++++++++++++++++++++++++++++++++++
1 file changed, 92 insertions(+)
create mode 100644 include/dt-bindings/mfd/stm32f4-rcc.h
diff --git a/include/dt-bindings/mfd/stm32f4-rcc.h b/include/dt-bindings/mfd/stm32f4-rcc.h
new file mode 100644
index 0000000..2f7ab9c
--- /dev/null
+++ b/include/dt-bindings/mfd/stm32f4-rcc.h
@@ -0,0 +1,92 @@
+/*
+ * This header provides constants for the STM32F4 RCC IP
+ */
+
+#ifndef _DT_BINDINGS_MFD_STM32F4_RCC_H
+#define _DT_BINDINGS_MFD_STM32F4_RCC_H
+
+/* AHB1 */
+#define STM32F4_RCC_AHB1_GPIOA 0
+#define STM32F4_RCC_AHB1_GPIOB 1
+#define STM32F4_RCC_AHB1_GPIOC 2
+#define STM32F4_RCC_AHB1_GPIOD 3
+#define STM32F4_RCC_AHB1_GPIOE 4
+#define STM32F4_RCC_AHB1_GPIOF 5
+#define STM32F4_RCC_AHB1_GPIOG 6
+#define STM32F4_RCC_AHB1_GPIOH 7
+#define STM32F4_RCC_AHB1_GPIOI 8
+#define STM32F4_RCC_AHB1_GPIOJ 9
+#define STM32F4_RCC_AHB1_GPIOK 10
+#define STM32F4_RCC_AHB1_CRC 12
+#define STM32F4_RCC_AHB1_DMA1 21
+#define STM32F4_RCC_AHB1_DMA2 22
+#define STM32F4_RCC_AHB1_DMA2D 23
+#define STM32F4_RCC_AHB1_ETHMAC 25
+#define STM32F4_RCC_AHB1_OTGHS 29
+
+#define STM32F4_AHB1_RESET(bit) (STM32F4_RCC_AHB1_##bit + (0x10 * 8))
+
+/* AHB2 */
+#define STM32F4_RCC_AHB2_DCMI 0
+#define STM32F4_RCC_AHB2_CRYP 4
+#define STM32F4_RCC_AHB2_HASH 5
+#define STM32F4_RCC_AHB2_RNG 6
+#define STM32F4_RCC_AHB2_OTGFS 7
+
+#define STM32F4_AHB2_RESET(bit) (STM32F4_RCC_AHB2_##bit + (0x14 * 8))
+
+/* AHB3 */
+#define STM32F4_RCC_AHB3_FMC 0
+
+#define STM32F4_AHB3_RESET(bit) (STM32F4_RCC_AHB3_##bit + (0x18 * 8))
+
+/* APB1 */
+#define STM32F4_RCC_APB1_TIM2 0
+#define STM32F4_RCC_APB1_TIM3 1
+#define STM32F4_RCC_APB1_TIM4 2
+#define STM32F4_RCC_APB1_TIM5 3
+#define STM32F4_RCC_APB1_TIM6 4
+#define STM32F4_RCC_APB1_TIM7 5
+#define STM32F4_RCC_APB1_TIM12 6
+#define STM32F4_RCC_APB1_TIM13 7
+#define STM32F4_RCC_APB1_TIM14 8
+#define STM32F4_RCC_APB1_WWDG 11
+#define STM32F4_RCC_APB1_SPI2 14
+#define STM32F4_RCC_APB1_SPI3 15
+#define STM32F4_RCC_APB1_UART2 17
+#define STM32F4_RCC_APB1_UART3 18
+#define STM32F4_RCC_APB1_UART4 19
+#define STM32F4_RCC_APB1_UART5 20
+#define STM32F4_RCC_APB1_I2C1 21
+#define STM32F4_RCC_APB1_I2C2 22
+#define STM32F4_RCC_APB1_I2C3 23
+#define STM32F4_RCC_APB1_CAN1 25
+#define STM32F4_RCC_APB1_CAN2 26
+#define STM32F4_RCC_APB1_PWR 28
+#define STM32F4_RCC_APB1_DAC 29
+#define STM32F4_RCC_APB1_UART7 30
+#define STM32F4_RCC_APB1_UART8 31
+
+#define STM32F4_APB1_RESET(bit) (STM32F4_RCC_APB1_##bit + (0x20 * 8))
+
+/* APB2 */
+#define STM32F4_RCC_APB2_TIM1 0
+#define STM32F4_RCC_APB2_TIM8 1
+#define STM32F4_RCC_APB2_USART1 4
+#define STM32F4_RCC_APB2_USART6 5
+#define STM32F4_RCC_APB2_ADC 8
+#define STM32F4_RCC_APB2_SDIO 11
+#define STM32F4_RCC_APB2_SPI1 12
+#define STM32F4_RCC_APB2_SPI4 13
+#define STM32F4_RCC_APB2_SYSCFG 14
+#define STM32F4_RCC_APB2_TIM9 16
+#define STM32F4_RCC_APB2_TIM10 17
+#define STM32F4_RCC_APB2_TIM11 18
+#define STM32F4_RCC_APB2_SPI5 20
+#define STM32F4_RCC_APB2_SPI6 21
+#define STM32F4_RCC_APB2_SAI1 22
+#define STM32F4_RCC_APB2_LTDC 26
+
+#define STM32F4_APB2_RESET(bit) (STM32F4_RCC_APB2_##bit + (0x24 * 8))
+
+#endif /* _DT_BINDINGS_MFD_STM32F4_RCC_H */
--
1.9.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 1/4] dt-bindings: mfd: Add STM32F4 RCC numeric constants into DT include file
@ 2016-07-04 13:47 ` gabriel.fernandez-qxv4g6HH51o
0 siblings, 0 replies; 44+ messages in thread
From: gabriel.fernandez-qxv4g6HH51o @ 2016-07-04 13:47 UTC (permalink / raw)
To: Philipp Zabel, Rob Herring, Mark Rutland, Maxime Coquelin,
Russell King, patrice.chotard-qxv4g6HH51o,
alexandre.torgue-qxv4g6HH51o
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
From: Maxime Coquelin <mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Ths patch lists STM32F4's RCC numeric constants.
It will be used by clock and reset drivers, and DT bindings.
Signed-off-by: Maxime Coquelin <mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
include/dt-bindings/mfd/stm32f4-rcc.h | 92 +++++++++++++++++++++++++++++++++++
1 file changed, 92 insertions(+)
create mode 100644 include/dt-bindings/mfd/stm32f4-rcc.h
diff --git a/include/dt-bindings/mfd/stm32f4-rcc.h b/include/dt-bindings/mfd/stm32f4-rcc.h
new file mode 100644
index 0000000..2f7ab9c
--- /dev/null
+++ b/include/dt-bindings/mfd/stm32f4-rcc.h
@@ -0,0 +1,92 @@
+/*
+ * This header provides constants for the STM32F4 RCC IP
+ */
+
+#ifndef _DT_BINDINGS_MFD_STM32F4_RCC_H
+#define _DT_BINDINGS_MFD_STM32F4_RCC_H
+
+/* AHB1 */
+#define STM32F4_RCC_AHB1_GPIOA 0
+#define STM32F4_RCC_AHB1_GPIOB 1
+#define STM32F4_RCC_AHB1_GPIOC 2
+#define STM32F4_RCC_AHB1_GPIOD 3
+#define STM32F4_RCC_AHB1_GPIOE 4
+#define STM32F4_RCC_AHB1_GPIOF 5
+#define STM32F4_RCC_AHB1_GPIOG 6
+#define STM32F4_RCC_AHB1_GPIOH 7
+#define STM32F4_RCC_AHB1_GPIOI 8
+#define STM32F4_RCC_AHB1_GPIOJ 9
+#define STM32F4_RCC_AHB1_GPIOK 10
+#define STM32F4_RCC_AHB1_CRC 12
+#define STM32F4_RCC_AHB1_DMA1 21
+#define STM32F4_RCC_AHB1_DMA2 22
+#define STM32F4_RCC_AHB1_DMA2D 23
+#define STM32F4_RCC_AHB1_ETHMAC 25
+#define STM32F4_RCC_AHB1_OTGHS 29
+
+#define STM32F4_AHB1_RESET(bit) (STM32F4_RCC_AHB1_##bit + (0x10 * 8))
+
+/* AHB2 */
+#define STM32F4_RCC_AHB2_DCMI 0
+#define STM32F4_RCC_AHB2_CRYP 4
+#define STM32F4_RCC_AHB2_HASH 5
+#define STM32F4_RCC_AHB2_RNG 6
+#define STM32F4_RCC_AHB2_OTGFS 7
+
+#define STM32F4_AHB2_RESET(bit) (STM32F4_RCC_AHB2_##bit + (0x14 * 8))
+
+/* AHB3 */
+#define STM32F4_RCC_AHB3_FMC 0
+
+#define STM32F4_AHB3_RESET(bit) (STM32F4_RCC_AHB3_##bit + (0x18 * 8))
+
+/* APB1 */
+#define STM32F4_RCC_APB1_TIM2 0
+#define STM32F4_RCC_APB1_TIM3 1
+#define STM32F4_RCC_APB1_TIM4 2
+#define STM32F4_RCC_APB1_TIM5 3
+#define STM32F4_RCC_APB1_TIM6 4
+#define STM32F4_RCC_APB1_TIM7 5
+#define STM32F4_RCC_APB1_TIM12 6
+#define STM32F4_RCC_APB1_TIM13 7
+#define STM32F4_RCC_APB1_TIM14 8
+#define STM32F4_RCC_APB1_WWDG 11
+#define STM32F4_RCC_APB1_SPI2 14
+#define STM32F4_RCC_APB1_SPI3 15
+#define STM32F4_RCC_APB1_UART2 17
+#define STM32F4_RCC_APB1_UART3 18
+#define STM32F4_RCC_APB1_UART4 19
+#define STM32F4_RCC_APB1_UART5 20
+#define STM32F4_RCC_APB1_I2C1 21
+#define STM32F4_RCC_APB1_I2C2 22
+#define STM32F4_RCC_APB1_I2C3 23
+#define STM32F4_RCC_APB1_CAN1 25
+#define STM32F4_RCC_APB1_CAN2 26
+#define STM32F4_RCC_APB1_PWR 28
+#define STM32F4_RCC_APB1_DAC 29
+#define STM32F4_RCC_APB1_UART7 30
+#define STM32F4_RCC_APB1_UART8 31
+
+#define STM32F4_APB1_RESET(bit) (STM32F4_RCC_APB1_##bit + (0x20 * 8))
+
+/* APB2 */
+#define STM32F4_RCC_APB2_TIM1 0
+#define STM32F4_RCC_APB2_TIM8 1
+#define STM32F4_RCC_APB2_USART1 4
+#define STM32F4_RCC_APB2_USART6 5
+#define STM32F4_RCC_APB2_ADC 8
+#define STM32F4_RCC_APB2_SDIO 11
+#define STM32F4_RCC_APB2_SPI1 12
+#define STM32F4_RCC_APB2_SPI4 13
+#define STM32F4_RCC_APB2_SYSCFG 14
+#define STM32F4_RCC_APB2_TIM9 16
+#define STM32F4_RCC_APB2_TIM10 17
+#define STM32F4_RCC_APB2_TIM11 18
+#define STM32F4_RCC_APB2_SPI5 20
+#define STM32F4_RCC_APB2_SPI6 21
+#define STM32F4_RCC_APB2_SAI1 22
+#define STM32F4_RCC_APB2_LTDC 26
+
+#define STM32F4_APB2_RESET(bit) (STM32F4_RCC_APB2_##bit + (0x24 * 8))
+
+#endif /* _DT_BINDINGS_MFD_STM32F4_RCC_H */
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 1/4] dt-bindings: mfd: Add STM32F4 RCC numeric constants into DT include file
@ 2016-07-04 13:47 ` gabriel.fernandez-qxv4g6HH51o
0 siblings, 0 replies; 44+ messages in thread
From: gabriel.fernandez at st.com @ 2016-07-04 13:47 UTC (permalink / raw)
To: linux-arm-kernel
From: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Ths patch lists STM32F4's RCC numeric constants.
It will be used by clock and reset drivers, and DT bindings.
Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
---
include/dt-bindings/mfd/stm32f4-rcc.h | 92 +++++++++++++++++++++++++++++++++++
1 file changed, 92 insertions(+)
create mode 100644 include/dt-bindings/mfd/stm32f4-rcc.h
diff --git a/include/dt-bindings/mfd/stm32f4-rcc.h b/include/dt-bindings/mfd/stm32f4-rcc.h
new file mode 100644
index 0000000..2f7ab9c
--- /dev/null
+++ b/include/dt-bindings/mfd/stm32f4-rcc.h
@@ -0,0 +1,92 @@
+/*
+ * This header provides constants for the STM32F4 RCC IP
+ */
+
+#ifndef _DT_BINDINGS_MFD_STM32F4_RCC_H
+#define _DT_BINDINGS_MFD_STM32F4_RCC_H
+
+/* AHB1 */
+#define STM32F4_RCC_AHB1_GPIOA 0
+#define STM32F4_RCC_AHB1_GPIOB 1
+#define STM32F4_RCC_AHB1_GPIOC 2
+#define STM32F4_RCC_AHB1_GPIOD 3
+#define STM32F4_RCC_AHB1_GPIOE 4
+#define STM32F4_RCC_AHB1_GPIOF 5
+#define STM32F4_RCC_AHB1_GPIOG 6
+#define STM32F4_RCC_AHB1_GPIOH 7
+#define STM32F4_RCC_AHB1_GPIOI 8
+#define STM32F4_RCC_AHB1_GPIOJ 9
+#define STM32F4_RCC_AHB1_GPIOK 10
+#define STM32F4_RCC_AHB1_CRC 12
+#define STM32F4_RCC_AHB1_DMA1 21
+#define STM32F4_RCC_AHB1_DMA2 22
+#define STM32F4_RCC_AHB1_DMA2D 23
+#define STM32F4_RCC_AHB1_ETHMAC 25
+#define STM32F4_RCC_AHB1_OTGHS 29
+
+#define STM32F4_AHB1_RESET(bit) (STM32F4_RCC_AHB1_##bit + (0x10 * 8))
+
+/* AHB2 */
+#define STM32F4_RCC_AHB2_DCMI 0
+#define STM32F4_RCC_AHB2_CRYP 4
+#define STM32F4_RCC_AHB2_HASH 5
+#define STM32F4_RCC_AHB2_RNG 6
+#define STM32F4_RCC_AHB2_OTGFS 7
+
+#define STM32F4_AHB2_RESET(bit) (STM32F4_RCC_AHB2_##bit + (0x14 * 8))
+
+/* AHB3 */
+#define STM32F4_RCC_AHB3_FMC 0
+
+#define STM32F4_AHB3_RESET(bit) (STM32F4_RCC_AHB3_##bit + (0x18 * 8))
+
+/* APB1 */
+#define STM32F4_RCC_APB1_TIM2 0
+#define STM32F4_RCC_APB1_TIM3 1
+#define STM32F4_RCC_APB1_TIM4 2
+#define STM32F4_RCC_APB1_TIM5 3
+#define STM32F4_RCC_APB1_TIM6 4
+#define STM32F4_RCC_APB1_TIM7 5
+#define STM32F4_RCC_APB1_TIM12 6
+#define STM32F4_RCC_APB1_TIM13 7
+#define STM32F4_RCC_APB1_TIM14 8
+#define STM32F4_RCC_APB1_WWDG 11
+#define STM32F4_RCC_APB1_SPI2 14
+#define STM32F4_RCC_APB1_SPI3 15
+#define STM32F4_RCC_APB1_UART2 17
+#define STM32F4_RCC_APB1_UART3 18
+#define STM32F4_RCC_APB1_UART4 19
+#define STM32F4_RCC_APB1_UART5 20
+#define STM32F4_RCC_APB1_I2C1 21
+#define STM32F4_RCC_APB1_I2C2 22
+#define STM32F4_RCC_APB1_I2C3 23
+#define STM32F4_RCC_APB1_CAN1 25
+#define STM32F4_RCC_APB1_CAN2 26
+#define STM32F4_RCC_APB1_PWR 28
+#define STM32F4_RCC_APB1_DAC 29
+#define STM32F4_RCC_APB1_UART7 30
+#define STM32F4_RCC_APB1_UART8 31
+
+#define STM32F4_APB1_RESET(bit) (STM32F4_RCC_APB1_##bit + (0x20 * 8))
+
+/* APB2 */
+#define STM32F4_RCC_APB2_TIM1 0
+#define STM32F4_RCC_APB2_TIM8 1
+#define STM32F4_RCC_APB2_USART1 4
+#define STM32F4_RCC_APB2_USART6 5
+#define STM32F4_RCC_APB2_ADC 8
+#define STM32F4_RCC_APB2_SDIO 11
+#define STM32F4_RCC_APB2_SPI1 12
+#define STM32F4_RCC_APB2_SPI4 13
+#define STM32F4_RCC_APB2_SYSCFG 14
+#define STM32F4_RCC_APB2_TIM9 16
+#define STM32F4_RCC_APB2_TIM10 17
+#define STM32F4_RCC_APB2_TIM11 18
+#define STM32F4_RCC_APB2_SPI5 20
+#define STM32F4_RCC_APB2_SPI6 21
+#define STM32F4_RCC_APB2_SAI1 22
+#define STM32F4_RCC_APB2_LTDC 26
+
+#define STM32F4_APB2_RESET(bit) (STM32F4_RCC_APB2_##bit + (0x24 * 8))
+
+#endif /* _DT_BINDINGS_MFD_STM32F4_RCC_H */
--
1.9.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 2/4] dt-bindings: Document the STM32 reset bindings
@ 2016-07-04 13:47 ` gabriel.fernandez-qxv4g6HH51o
0 siblings, 0 replies; 44+ messages in thread
From: gabriel.fernandez @ 2016-07-04 13:47 UTC (permalink / raw)
To: Philipp Zabel, Rob Herring, Mark Rutland, Maxime Coquelin,
Russell King, patrice.chotard, alexandre.torgue
Cc: devicetree, linux-arm-kernel, linux-kernel
From: Maxime Coquelin <mcoquelin.stm32@gmail.com>
This adds documentation of device tree bindings for the
STM32 reset controller.
Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
---
.../devicetree/bindings/reset/st,stm32-rcc.txt | 50 ++++++++++++++++++++++
1 file changed, 50 insertions(+)
create mode 100644 Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
diff --git a/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
new file mode 100644
index 0000000..333080c
--- /dev/null
+++ b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
@@ -0,0 +1,50 @@
+STMicroelectronics STM32 Peripheral Reset Controller
+====================================================
+
+The RCC IP is both a reset and a clock controller. This documentation only
+documents the reset part.
+
+Please also refer to reset.txt in this directory for common reset
+controller binding usage.
+
+Required properties:
+- compatible: Should be "st,stm32-rcc"
+- reg: should be register base and length as documented in the
+ datasheet
+- #reset-cells: 1, see below
+
+example:
+
+rcc: reset@40023800 {
+ #reset-cells = <1>;
+ compatible = "st,stm32-rcc";
+ reg = <0x40023800 0x400>;
+};
+
+Specifying softreset control of devices
+=======================================
+
+Device nodes should specify the reset channel required in their "resets"
+property, containing a phandle to the reset device node and an index specifying
+which channel to use.
+The index is the bit number within the RCC registers bank, starting from RCC
+base address.
+It is calculated as: index = register_offset / 4 * 32 + bit_offset.
+Where bit_offset is the bit offset within the register.
+For example, for CRC reset:
+ crc = AHB1RSTR_offset / 4 * 32 + CRCRST_bit_offset = 0x10 / 4 * 32 + 12 = 140
+
+To simplify the usagen and to share bit definition with the clock driver of
+the RCC IP, macros are available to generate the index in human-readble
+format.
+
+For STM32F4 series, the macro are available here:
+ - include/dt-bindings/mfd/stm32f4-rcc.h
+
+example:
+
+ timer2 {
+ resets = <&rcc STM32F4_APB1_RESET(TIM2)>;
+ };
+
+
--
1.9.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 2/4] dt-bindings: Document the STM32 reset bindings
@ 2016-07-04 13:47 ` gabriel.fernandez-qxv4g6HH51o
0 siblings, 0 replies; 44+ messages in thread
From: gabriel.fernandez-qxv4g6HH51o @ 2016-07-04 13:47 UTC (permalink / raw)
To: Philipp Zabel, Rob Herring, Mark Rutland, Maxime Coquelin,
Russell King, patrice.chotard-qxv4g6HH51o,
alexandre.torgue-qxv4g6HH51o
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
From: Maxime Coquelin <mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
This adds documentation of device tree bindings for the
STM32 reset controller.
Signed-off-by: Maxime Coquelin <mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
.../devicetree/bindings/reset/st,stm32-rcc.txt | 50 ++++++++++++++++++++++
1 file changed, 50 insertions(+)
create mode 100644 Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
diff --git a/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
new file mode 100644
index 0000000..333080c
--- /dev/null
+++ b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
@@ -0,0 +1,50 @@
+STMicroelectronics STM32 Peripheral Reset Controller
+====================================================
+
+The RCC IP is both a reset and a clock controller. This documentation only
+documents the reset part.
+
+Please also refer to reset.txt in this directory for common reset
+controller binding usage.
+
+Required properties:
+- compatible: Should be "st,stm32-rcc"
+- reg: should be register base and length as documented in the
+ datasheet
+- #reset-cells: 1, see below
+
+example:
+
+rcc: reset@40023800 {
+ #reset-cells = <1>;
+ compatible = "st,stm32-rcc";
+ reg = <0x40023800 0x400>;
+};
+
+Specifying softreset control of devices
+=======================================
+
+Device nodes should specify the reset channel required in their "resets"
+property, containing a phandle to the reset device node and an index specifying
+which channel to use.
+The index is the bit number within the RCC registers bank, starting from RCC
+base address.
+It is calculated as: index = register_offset / 4 * 32 + bit_offset.
+Where bit_offset is the bit offset within the register.
+For example, for CRC reset:
+ crc = AHB1RSTR_offset / 4 * 32 + CRCRST_bit_offset = 0x10 / 4 * 32 + 12 = 140
+
+To simplify the usagen and to share bit definition with the clock driver of
+the RCC IP, macros are available to generate the index in human-readble
+format.
+
+For STM32F4 series, the macro are available here:
+ - include/dt-bindings/mfd/stm32f4-rcc.h
+
+example:
+
+ timer2 {
+ resets = <&rcc STM32F4_APB1_RESET(TIM2)>;
+ };
+
+
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 2/4] dt-bindings: Document the STM32 reset bindings
@ 2016-07-04 13:47 ` gabriel.fernandez-qxv4g6HH51o
0 siblings, 0 replies; 44+ messages in thread
From: gabriel.fernandez at st.com @ 2016-07-04 13:47 UTC (permalink / raw)
To: linux-arm-kernel
From: Maxime Coquelin <mcoquelin.stm32@gmail.com>
This adds documentation of device tree bindings for the
STM32 reset controller.
Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
---
.../devicetree/bindings/reset/st,stm32-rcc.txt | 50 ++++++++++++++++++++++
1 file changed, 50 insertions(+)
create mode 100644 Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
diff --git a/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
new file mode 100644
index 0000000..333080c
--- /dev/null
+++ b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
@@ -0,0 +1,50 @@
+STMicroelectronics STM32 Peripheral Reset Controller
+====================================================
+
+The RCC IP is both a reset and a clock controller. This documentation only
+documents the reset part.
+
+Please also refer to reset.txt in this directory for common reset
+controller binding usage.
+
+Required properties:
+- compatible: Should be "st,stm32-rcc"
+- reg: should be register base and length as documented in the
+ datasheet
+- #reset-cells: 1, see below
+
+example:
+
+rcc: reset at 40023800 {
+ #reset-cells = <1>;
+ compatible = "st,stm32-rcc";
+ reg = <0x40023800 0x400>;
+};
+
+Specifying softreset control of devices
+=======================================
+
+Device nodes should specify the reset channel required in their "resets"
+property, containing a phandle to the reset device node and an index specifying
+which channel to use.
+The index is the bit number within the RCC registers bank, starting from RCC
+base address.
+It is calculated as: index = register_offset / 4 * 32 + bit_offset.
+Where bit_offset is the bit offset within the register.
+For example, for CRC reset:
+ crc = AHB1RSTR_offset / 4 * 32 + CRCRST_bit_offset = 0x10 / 4 * 32 + 12 = 140
+
+To simplify the usagen and to share bit definition with the clock driver of
+the RCC IP, macros are available to generate the index in human-readble
+format.
+
+For STM32F4 series, the macro are available here:
+ - include/dt-bindings/mfd/stm32f4-rcc.h
+
+example:
+
+ timer2 {
+ resets = <&rcc STM32F4_APB1_RESET(TIM2)>;
+ };
+
+
--
1.9.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 3/4] drivers: reset: Add STM32 reset driver
2016-07-04 13:47 ` gabriel.fernandez-qxv4g6HH51o
(?)
@ 2016-07-04 13:47 ` gabriel.fernandez
-1 siblings, 0 replies; 44+ messages in thread
From: gabriel.fernandez @ 2016-07-04 13:47 UTC (permalink / raw)
To: Philipp Zabel, Rob Herring, Mark Rutland, Maxime Coquelin,
Russell King, patrice.chotard, alexandre.torgue
Cc: devicetree, linux-arm-kernel, linux-kernel, Gabriel Fernandez
From: Gabriel Fernandez <gabriel.fernandez@st.com>
The STM32 MCUs family IPs can be reset by accessing some registers
from the RCC block.
The list of available reset lines is documented in the DT bindings.
Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
---
drivers/reset/Makefile | 1 +
drivers/reset/reset-stm32.c | 113 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 114 insertions(+)
create mode 100644 drivers/reset/reset-stm32.c
diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
index 03dc1bb..3776b7b 100644
--- a/drivers/reset/Makefile
+++ b/drivers/reset/Makefile
@@ -4,6 +4,7 @@ obj-$(CONFIG_ARCH_SOCFPGA) += reset-socfpga.o
obj-$(CONFIG_ARCH_BERLIN) += reset-berlin.o
obj-$(CONFIG_MACH_PISTACHIO) += reset-pistachio.o
obj-$(CONFIG_ARCH_MESON) += reset-meson.o
+obj-$(CONFIG_ARCH_STM32) += reset-stm32.o
obj-$(CONFIG_ARCH_SUNXI) += reset-sunxi.o
obj-$(CONFIG_ARCH_STI) += sti/
obj-$(CONFIG_ARCH_HISI) += hisilicon/
diff --git a/drivers/reset/reset-stm32.c b/drivers/reset/reset-stm32.c
new file mode 100644
index 0000000..be42bff
--- /dev/null
+++ b/drivers/reset/reset-stm32.c
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) Maxime Coquelin 2015
+ * Author: Maxime Coquelin <mcoquelin.stm32@gmail.com>
+ * License terms: GNU General Public License (GPL), version 2
+ *
+ * Heavily based on sunxi driver from Maxime Ripard.
+ */
+
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/platform_device.h>
+#include <linux/reset-controller.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/types.h>
+
+struct stm32_reset_data {
+ spinlock_t lock;
+ void __iomem *membase;
+ struct reset_controller_dev rcdev;
+};
+
+static int stm32_reset_assert(struct reset_controller_dev *rcdev,
+ unsigned long id)
+{
+ struct stm32_reset_data *data = container_of(rcdev,
+ struct stm32_reset_data,
+ rcdev);
+ int bank = id / BITS_PER_LONG;
+ int offset = id % BITS_PER_LONG;
+ unsigned long flags;
+ u32 reg;
+
+ spin_lock_irqsave(&data->lock, flags);
+
+ reg = readl_relaxed(data->membase + (bank * 4));
+ writel_relaxed(reg | BIT(offset), data->membase + (bank * 4));
+
+ spin_unlock_irqrestore(&data->lock, flags);
+
+ return 0;
+}
+
+static int stm32_reset_deassert(struct reset_controller_dev *rcdev,
+ unsigned long id)
+{
+ struct stm32_reset_data *data = container_of(rcdev,
+ struct stm32_reset_data,
+ rcdev);
+ int bank = id / BITS_PER_LONG;
+ int offset = id % BITS_PER_LONG;
+ unsigned long flags;
+ u32 reg;
+
+ spin_lock_irqsave(&data->lock, flags);
+
+ reg = readl_relaxed(data->membase + (bank * 4));
+ writel_relaxed(reg & ~BIT(offset), data->membase + (bank * 4));
+
+ spin_unlock_irqrestore(&data->lock, flags);
+
+ return 0;
+}
+
+static const struct reset_control_ops stm32_reset_ops = {
+ .assert = stm32_reset_assert,
+ .deassert = stm32_reset_deassert,
+};
+
+static const struct of_device_id stm32_reset_dt_ids[] = {
+ { .compatible = "st,stm32-rcc", },
+ { /* sentinel */ },
+};
+
+static int stm32_reset_probe(struct platform_device *pdev)
+{
+ struct stm32_reset_data *data;
+ struct resource *res;
+
+ data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
+ if (!data)
+ return -ENOMEM;
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ data->membase = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(data->membase))
+ return PTR_ERR(data->membase);
+
+ spin_lock_init(&data->lock);
+
+ data->rcdev.owner = THIS_MODULE;
+ data->rcdev.nr_resets = resource_size(res) * 8;
+ data->rcdev.ops = &stm32_reset_ops;
+ data->rcdev.of_node = pdev->dev.of_node;
+
+ return devm_reset_controller_register(&pdev->dev, &data->rcdev);
+}
+
+static struct platform_driver stm32_reset_driver = {
+ .probe = stm32_reset_probe,
+ .driver = {
+ .name = "stm32-rcc-reset",
+ .of_match_table = stm32_reset_dt_ids,
+ },
+};
+module_platform_driver(stm32_reset_driver);
+
+MODULE_AUTHOR("Maxime Coquelin <maxime.coquelin@gmail.com>");
+MODULE_DESCRIPTION("STM32 MCUs Reset Controller Driver");
+MODULE_LICENSE("GPL");
--
1.9.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 3/4] drivers: reset: Add STM32 reset driver
@ 2016-07-04 13:47 ` gabriel.fernandez
0 siblings, 0 replies; 44+ messages in thread
From: gabriel.fernandez @ 2016-07-04 13:47 UTC (permalink / raw)
To: Philipp Zabel, Rob Herring, Mark Rutland, Maxime Coquelin,
Russell King, patrice.chotard, alexandre.torgue
Cc: devicetree, linux-kernel, linux-arm-kernel, Gabriel Fernandez
From: Gabriel Fernandez <gabriel.fernandez@st.com>
The STM32 MCUs family IPs can be reset by accessing some registers
from the RCC block.
The list of available reset lines is documented in the DT bindings.
Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
---
drivers/reset/Makefile | 1 +
drivers/reset/reset-stm32.c | 113 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 114 insertions(+)
create mode 100644 drivers/reset/reset-stm32.c
diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
index 03dc1bb..3776b7b 100644
--- a/drivers/reset/Makefile
+++ b/drivers/reset/Makefile
@@ -4,6 +4,7 @@ obj-$(CONFIG_ARCH_SOCFPGA) += reset-socfpga.o
obj-$(CONFIG_ARCH_BERLIN) += reset-berlin.o
obj-$(CONFIG_MACH_PISTACHIO) += reset-pistachio.o
obj-$(CONFIG_ARCH_MESON) += reset-meson.o
+obj-$(CONFIG_ARCH_STM32) += reset-stm32.o
obj-$(CONFIG_ARCH_SUNXI) += reset-sunxi.o
obj-$(CONFIG_ARCH_STI) += sti/
obj-$(CONFIG_ARCH_HISI) += hisilicon/
diff --git a/drivers/reset/reset-stm32.c b/drivers/reset/reset-stm32.c
new file mode 100644
index 0000000..be42bff
--- /dev/null
+++ b/drivers/reset/reset-stm32.c
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) Maxime Coquelin 2015
+ * Author: Maxime Coquelin <mcoquelin.stm32@gmail.com>
+ * License terms: GNU General Public License (GPL), version 2
+ *
+ * Heavily based on sunxi driver from Maxime Ripard.
+ */
+
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/platform_device.h>
+#include <linux/reset-controller.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/types.h>
+
+struct stm32_reset_data {
+ spinlock_t lock;
+ void __iomem *membase;
+ struct reset_controller_dev rcdev;
+};
+
+static int stm32_reset_assert(struct reset_controller_dev *rcdev,
+ unsigned long id)
+{
+ struct stm32_reset_data *data = container_of(rcdev,
+ struct stm32_reset_data,
+ rcdev);
+ int bank = id / BITS_PER_LONG;
+ int offset = id % BITS_PER_LONG;
+ unsigned long flags;
+ u32 reg;
+
+ spin_lock_irqsave(&data->lock, flags);
+
+ reg = readl_relaxed(data->membase + (bank * 4));
+ writel_relaxed(reg | BIT(offset), data->membase + (bank * 4));
+
+ spin_unlock_irqrestore(&data->lock, flags);
+
+ return 0;
+}
+
+static int stm32_reset_deassert(struct reset_controller_dev *rcdev,
+ unsigned long id)
+{
+ struct stm32_reset_data *data = container_of(rcdev,
+ struct stm32_reset_data,
+ rcdev);
+ int bank = id / BITS_PER_LONG;
+ int offset = id % BITS_PER_LONG;
+ unsigned long flags;
+ u32 reg;
+
+ spin_lock_irqsave(&data->lock, flags);
+
+ reg = readl_relaxed(data->membase + (bank * 4));
+ writel_relaxed(reg & ~BIT(offset), data->membase + (bank * 4));
+
+ spin_unlock_irqrestore(&data->lock, flags);
+
+ return 0;
+}
+
+static const struct reset_control_ops stm32_reset_ops = {
+ .assert = stm32_reset_assert,
+ .deassert = stm32_reset_deassert,
+};
+
+static const struct of_device_id stm32_reset_dt_ids[] = {
+ { .compatible = "st,stm32-rcc", },
+ { /* sentinel */ },
+};
+
+static int stm32_reset_probe(struct platform_device *pdev)
+{
+ struct stm32_reset_data *data;
+ struct resource *res;
+
+ data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
+ if (!data)
+ return -ENOMEM;
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ data->membase = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(data->membase))
+ return PTR_ERR(data->membase);
+
+ spin_lock_init(&data->lock);
+
+ data->rcdev.owner = THIS_MODULE;
+ data->rcdev.nr_resets = resource_size(res) * 8;
+ data->rcdev.ops = &stm32_reset_ops;
+ data->rcdev.of_node = pdev->dev.of_node;
+
+ return devm_reset_controller_register(&pdev->dev, &data->rcdev);
+}
+
+static struct platform_driver stm32_reset_driver = {
+ .probe = stm32_reset_probe,
+ .driver = {
+ .name = "stm32-rcc-reset",
+ .of_match_table = stm32_reset_dt_ids,
+ },
+};
+module_platform_driver(stm32_reset_driver);
+
+MODULE_AUTHOR("Maxime Coquelin <maxime.coquelin@gmail.com>");
+MODULE_DESCRIPTION("STM32 MCUs Reset Controller Driver");
+MODULE_LICENSE("GPL");
--
1.9.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 3/4] drivers: reset: Add STM32 reset driver
@ 2016-07-04 13:47 ` gabriel.fernandez
0 siblings, 0 replies; 44+ messages in thread
From: gabriel.fernandez at st.com @ 2016-07-04 13:47 UTC (permalink / raw)
To: linux-arm-kernel
From: Gabriel Fernandez <gabriel.fernandez@st.com>
The STM32 MCUs family IPs can be reset by accessing some registers
from the RCC block.
The list of available reset lines is documented in the DT bindings.
Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
---
drivers/reset/Makefile | 1 +
drivers/reset/reset-stm32.c | 113 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 114 insertions(+)
create mode 100644 drivers/reset/reset-stm32.c
diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
index 03dc1bb..3776b7b 100644
--- a/drivers/reset/Makefile
+++ b/drivers/reset/Makefile
@@ -4,6 +4,7 @@ obj-$(CONFIG_ARCH_SOCFPGA) += reset-socfpga.o
obj-$(CONFIG_ARCH_BERLIN) += reset-berlin.o
obj-$(CONFIG_MACH_PISTACHIO) += reset-pistachio.o
obj-$(CONFIG_ARCH_MESON) += reset-meson.o
+obj-$(CONFIG_ARCH_STM32) += reset-stm32.o
obj-$(CONFIG_ARCH_SUNXI) += reset-sunxi.o
obj-$(CONFIG_ARCH_STI) += sti/
obj-$(CONFIG_ARCH_HISI) += hisilicon/
diff --git a/drivers/reset/reset-stm32.c b/drivers/reset/reset-stm32.c
new file mode 100644
index 0000000..be42bff
--- /dev/null
+++ b/drivers/reset/reset-stm32.c
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) Maxime Coquelin 2015
+ * Author: Maxime Coquelin <mcoquelin.stm32@gmail.com>
+ * License terms: GNU General Public License (GPL), version 2
+ *
+ * Heavily based on sunxi driver from Maxime Ripard.
+ */
+
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/platform_device.h>
+#include <linux/reset-controller.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/types.h>
+
+struct stm32_reset_data {
+ spinlock_t lock;
+ void __iomem *membase;
+ struct reset_controller_dev rcdev;
+};
+
+static int stm32_reset_assert(struct reset_controller_dev *rcdev,
+ unsigned long id)
+{
+ struct stm32_reset_data *data = container_of(rcdev,
+ struct stm32_reset_data,
+ rcdev);
+ int bank = id / BITS_PER_LONG;
+ int offset = id % BITS_PER_LONG;
+ unsigned long flags;
+ u32 reg;
+
+ spin_lock_irqsave(&data->lock, flags);
+
+ reg = readl_relaxed(data->membase + (bank * 4));
+ writel_relaxed(reg | BIT(offset), data->membase + (bank * 4));
+
+ spin_unlock_irqrestore(&data->lock, flags);
+
+ return 0;
+}
+
+static int stm32_reset_deassert(struct reset_controller_dev *rcdev,
+ unsigned long id)
+{
+ struct stm32_reset_data *data = container_of(rcdev,
+ struct stm32_reset_data,
+ rcdev);
+ int bank = id / BITS_PER_LONG;
+ int offset = id % BITS_PER_LONG;
+ unsigned long flags;
+ u32 reg;
+
+ spin_lock_irqsave(&data->lock, flags);
+
+ reg = readl_relaxed(data->membase + (bank * 4));
+ writel_relaxed(reg & ~BIT(offset), data->membase + (bank * 4));
+
+ spin_unlock_irqrestore(&data->lock, flags);
+
+ return 0;
+}
+
+static const struct reset_control_ops stm32_reset_ops = {
+ .assert = stm32_reset_assert,
+ .deassert = stm32_reset_deassert,
+};
+
+static const struct of_device_id stm32_reset_dt_ids[] = {
+ { .compatible = "st,stm32-rcc", },
+ { /* sentinel */ },
+};
+
+static int stm32_reset_probe(struct platform_device *pdev)
+{
+ struct stm32_reset_data *data;
+ struct resource *res;
+
+ data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
+ if (!data)
+ return -ENOMEM;
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ data->membase = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(data->membase))
+ return PTR_ERR(data->membase);
+
+ spin_lock_init(&data->lock);
+
+ data->rcdev.owner = THIS_MODULE;
+ data->rcdev.nr_resets = resource_size(res) * 8;
+ data->rcdev.ops = &stm32_reset_ops;
+ data->rcdev.of_node = pdev->dev.of_node;
+
+ return devm_reset_controller_register(&pdev->dev, &data->rcdev);
+}
+
+static struct platform_driver stm32_reset_driver = {
+ .probe = stm32_reset_probe,
+ .driver = {
+ .name = "stm32-rcc-reset",
+ .of_match_table = stm32_reset_dt_ids,
+ },
+};
+module_platform_driver(stm32_reset_driver);
+
+MODULE_AUTHOR("Maxime Coquelin <maxime.coquelin@gmail.com>");
+MODULE_DESCRIPTION("STM32 MCUs Reset Controller Driver");
+MODULE_LICENSE("GPL");
--
1.9.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 4/4] ARM: dts: stm32f429: add missing #reset-cells of rcc
@ 2016-07-04 13:47 ` gabriel.fernandez-qxv4g6HH51o
0 siblings, 0 replies; 44+ messages in thread
From: gabriel.fernandez @ 2016-07-04 13:47 UTC (permalink / raw)
To: Philipp Zabel, Rob Herring, Mark Rutland, Maxime Coquelin,
Russell King, patrice.chotard, alexandre.torgue
Cc: devicetree, linux-arm-kernel, linux-kernel, Gabriel Fernandez
From: Gabriel Fernandez <gabriel.fernandez@st.com>
This patch adds #reset-cells property to rcc node.
Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
---
arch/arm/boot/dts/stm32f429.dtsi | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi
index 35df462..fe89236 100644
--- a/arch/arm/boot/dts/stm32f429.dtsi
+++ b/arch/arm/boot/dts/stm32f429.dtsi
@@ -326,6 +326,7 @@
};
rcc: rcc@40023810 {
+ #reset-cells = <1>;
#clock-cells = <2>;
compatible = "st,stm32f42xx-rcc", "st,stm32-rcc";
reg = <0x40023800 0x400>;
--
1.9.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 4/4] ARM: dts: stm32f429: add missing #reset-cells of rcc
@ 2016-07-04 13:47 ` gabriel.fernandez-qxv4g6HH51o
0 siblings, 0 replies; 44+ messages in thread
From: gabriel.fernandez-qxv4g6HH51o @ 2016-07-04 13:47 UTC (permalink / raw)
To: Philipp Zabel, Rob Herring, Mark Rutland, Maxime Coquelin,
Russell King, patrice.chotard-qxv4g6HH51o,
alexandre.torgue-qxv4g6HH51o
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Gabriel Fernandez
From: Gabriel Fernandez <gabriel.fernandez-qxv4g6HH51o@public.gmane.org>
This patch adds #reset-cells property to rcc node.
Signed-off-by: Gabriel Fernandez <gabriel.fernandez-qxv4g6HH51o@public.gmane.org>
---
arch/arm/boot/dts/stm32f429.dtsi | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi
index 35df462..fe89236 100644
--- a/arch/arm/boot/dts/stm32f429.dtsi
+++ b/arch/arm/boot/dts/stm32f429.dtsi
@@ -326,6 +326,7 @@
};
rcc: rcc@40023810 {
+ #reset-cells = <1>;
#clock-cells = <2>;
compatible = "st,stm32f42xx-rcc", "st,stm32-rcc";
reg = <0x40023800 0x400>;
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 4/4] ARM: dts: stm32f429: add missing #reset-cells of rcc
@ 2016-07-04 13:47 ` gabriel.fernandez-qxv4g6HH51o
0 siblings, 0 replies; 44+ messages in thread
From: gabriel.fernandez at st.com @ 2016-07-04 13:47 UTC (permalink / raw)
To: linux-arm-kernel
From: Gabriel Fernandez <gabriel.fernandez@st.com>
This patch adds #reset-cells property to rcc node.
Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
---
arch/arm/boot/dts/stm32f429.dtsi | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi
index 35df462..fe89236 100644
--- a/arch/arm/boot/dts/stm32f429.dtsi
+++ b/arch/arm/boot/dts/stm32f429.dtsi
@@ -326,6 +326,7 @@
};
rcc: rcc at 40023810 {
+ #reset-cells = <1>;
#clock-cells = <2>;
compatible = "st,stm32f42xx-rcc", "st,stm32-rcc";
reg = <0x40023800 0x400>;
--
1.9.1
^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [PATCH 2/4] dt-bindings: Document the STM32 reset bindings
@ 2016-07-04 17:36 ` Philipp Zabel
0 siblings, 0 replies; 44+ messages in thread
From: Philipp Zabel @ 2016-07-04 17:36 UTC (permalink / raw)
To: gabriel.fernandez
Cc: Rob Herring, Mark Rutland, Maxime Coquelin, Russell King,
patrice.chotard, alexandre.torgue, devicetree, linux-arm-kernel,
linux-kernel
Am Montag, den 04.07.2016, 15:47 +0200 schrieb gabriel.fernandez@st.com:
> From: Maxime Coquelin <mcoquelin.stm32@gmail.com>
>
> This adds documentation of device tree bindings for the
> STM32 reset controller.
>
> Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
The way I understand Documentation/SubmittingPatches, this should also
have your Signed-off-by.
> ---
> .../devicetree/bindings/reset/st,stm32-rcc.txt | 50 ++++++++++++++++++++++
> 1 file changed, 50 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
>
> diff --git a/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
> new file mode 100644
> index 0000000..333080c
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
> @@ -0,0 +1,50 @@
> +STMicroelectronics STM32 Peripheral Reset Controller
> +====================================================
> +
> +The RCC IP is both a reset and a clock controller. This documentation only
> +documents the reset part.
> +
> +Please also refer to reset.txt in this directory for common reset
> +controller binding usage.
> +
> +Required properties:
> +- compatible: Should be "st,stm32-rcc"
> +- reg: should be register base and length as documented in the
> + datasheet
> +- #reset-cells: 1, see below
> +
> +example:
> +
> +rcc: reset@40023800 {
> + #reset-cells = <1>;
> + compatible = "st,stm32-rcc";
> + reg = <0x40023800 0x400>;
> +};
> +
> +Specifying softreset control of devices
> +=======================================
> +
> +Device nodes should specify the reset channel required in their "resets"
> +property, containing a phandle to the reset device node and an index specifying
> +which channel to use.
> +The index is the bit number within the RCC registers bank, starting from RCC
> +base address.
> +It is calculated as: index = register_offset / 4 * 32 + bit_offset.
> +Where bit_offset is the bit offset within the register.
> +For example, for CRC reset:
> + crc = AHB1RSTR_offset / 4 * 32 + CRCRST_bit_offset = 0x10 / 4 * 32 + 12 = 140
I see you decided to keep the register offset encoded in the reset
index.
> +
> +To simplify the usagen and to share bit definition with the clock driver of
s/usagen/usage/
> +the RCC IP, macros are available to generate the index in human-readble
> +format.
> +
> +For STM32F4 series, the macro are available here:
> + - include/dt-bindings/mfd/stm32f4-rcc.h
If DT and ARM/STI and maintainers agree with the binding and header
macros, I'm inclined to take patches 1-3.
regards
Philipp
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 2/4] dt-bindings: Document the STM32 reset bindings
@ 2016-07-04 17:36 ` Philipp Zabel
0 siblings, 0 replies; 44+ messages in thread
From: Philipp Zabel @ 2016-07-04 17:36 UTC (permalink / raw)
To: gabriel.fernandez-qxv4g6HH51o
Cc: Rob Herring, Mark Rutland, Maxime Coquelin, Russell King,
patrice.chotard-qxv4g6HH51o, alexandre.torgue-qxv4g6HH51o,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Am Montag, den 04.07.2016, 15:47 +0200 schrieb gabriel.fernandez-qxv4g6HH51o@public.gmane.org:
> From: Maxime Coquelin <mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>
> This adds documentation of device tree bindings for the
> STM32 reset controller.
>
> Signed-off-by: Maxime Coquelin <mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
The way I understand Documentation/SubmittingPatches, this should also
have your Signed-off-by.
> ---
> .../devicetree/bindings/reset/st,stm32-rcc.txt | 50 ++++++++++++++++++++++
> 1 file changed, 50 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
>
> diff --git a/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
> new file mode 100644
> index 0000000..333080c
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
> @@ -0,0 +1,50 @@
> +STMicroelectronics STM32 Peripheral Reset Controller
> +====================================================
> +
> +The RCC IP is both a reset and a clock controller. This documentation only
> +documents the reset part.
> +
> +Please also refer to reset.txt in this directory for common reset
> +controller binding usage.
> +
> +Required properties:
> +- compatible: Should be "st,stm32-rcc"
> +- reg: should be register base and length as documented in the
> + datasheet
> +- #reset-cells: 1, see below
> +
> +example:
> +
> +rcc: reset@40023800 {
> + #reset-cells = <1>;
> + compatible = "st,stm32-rcc";
> + reg = <0x40023800 0x400>;
> +};
> +
> +Specifying softreset control of devices
> +=======================================
> +
> +Device nodes should specify the reset channel required in their "resets"
> +property, containing a phandle to the reset device node and an index specifying
> +which channel to use.
> +The index is the bit number within the RCC registers bank, starting from RCC
> +base address.
> +It is calculated as: index = register_offset / 4 * 32 + bit_offset.
> +Where bit_offset is the bit offset within the register.
> +For example, for CRC reset:
> + crc = AHB1RSTR_offset / 4 * 32 + CRCRST_bit_offset = 0x10 / 4 * 32 + 12 = 140
I see you decided to keep the register offset encoded in the reset
index.
> +
> +To simplify the usagen and to share bit definition with the clock driver of
s/usagen/usage/
> +the RCC IP, macros are available to generate the index in human-readble
> +format.
> +
> +For STM32F4 series, the macro are available here:
> + - include/dt-bindings/mfd/stm32f4-rcc.h
If DT and ARM/STI and maintainers agree with the binding and header
macros, I'm inclined to take patches 1-3.
regards
Philipp
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 2/4] dt-bindings: Document the STM32 reset bindings
@ 2016-07-04 17:36 ` Philipp Zabel
0 siblings, 0 replies; 44+ messages in thread
From: Philipp Zabel @ 2016-07-04 17:36 UTC (permalink / raw)
To: linux-arm-kernel
Am Montag, den 04.07.2016, 15:47 +0200 schrieb gabriel.fernandez at st.com:
> From: Maxime Coquelin <mcoquelin.stm32@gmail.com>
>
> This adds documentation of device tree bindings for the
> STM32 reset controller.
>
> Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
The way I understand Documentation/SubmittingPatches, this should also
have your Signed-off-by.
> ---
> .../devicetree/bindings/reset/st,stm32-rcc.txt | 50 ++++++++++++++++++++++
> 1 file changed, 50 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
>
> diff --git a/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
> new file mode 100644
> index 0000000..333080c
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
> @@ -0,0 +1,50 @@
> +STMicroelectronics STM32 Peripheral Reset Controller
> +====================================================
> +
> +The RCC IP is both a reset and a clock controller. This documentation only
> +documents the reset part.
> +
> +Please also refer to reset.txt in this directory for common reset
> +controller binding usage.
> +
> +Required properties:
> +- compatible: Should be "st,stm32-rcc"
> +- reg: should be register base and length as documented in the
> + datasheet
> +- #reset-cells: 1, see below
> +
> +example:
> +
> +rcc: reset at 40023800 {
> + #reset-cells = <1>;
> + compatible = "st,stm32-rcc";
> + reg = <0x40023800 0x400>;
> +};
> +
> +Specifying softreset control of devices
> +=======================================
> +
> +Device nodes should specify the reset channel required in their "resets"
> +property, containing a phandle to the reset device node and an index specifying
> +which channel to use.
> +The index is the bit number within the RCC registers bank, starting from RCC
> +base address.
> +It is calculated as: index = register_offset / 4 * 32 + bit_offset.
> +Where bit_offset is the bit offset within the register.
> +For example, for CRC reset:
> + crc = AHB1RSTR_offset / 4 * 32 + CRCRST_bit_offset = 0x10 / 4 * 32 + 12 = 140
I see you decided to keep the register offset encoded in the reset
index.
> +
> +To simplify the usagen and to share bit definition with the clock driver of
s/usagen/usage/
> +the RCC IP, macros are available to generate the index in human-readble
> +format.
> +
> +For STM32F4 series, the macro are available here:
> + - include/dt-bindings/mfd/stm32f4-rcc.h
If DT and ARM/STI and maintainers agree with the binding and header
macros, I'm inclined to take patches 1-3.
regards
Philipp
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 3/4] drivers: reset: Add STM32 reset driver
@ 2016-07-04 17:36 ` Philipp Zabel
0 siblings, 0 replies; 44+ messages in thread
From: Philipp Zabel @ 2016-07-04 17:36 UTC (permalink / raw)
To: gabriel.fernandez
Cc: Rob Herring, Mark Rutland, Maxime Coquelin, Russell King,
patrice.chotard, alexandre.torgue, devicetree, linux-arm-kernel,
linux-kernel
Hi Gabriel,
Am Montag, den 04.07.2016, 15:47 +0200 schrieb gabriel.fernandez@st.com:
> From: Gabriel Fernandez <gabriel.fernandez@st.com>
Isn't Maxime the author of this driver?
> The STM32 MCUs family IPs can be reset by accessing some registers
> from the RCC block.
>
> The list of available reset lines is documented in the DT bindings.
>
> Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
> Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
> ---
> drivers/reset/Makefile | 1 +
> drivers/reset/reset-stm32.c | 113 ++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 114 insertions(+)
> create mode 100644 drivers/reset/reset-stm32.c
>
> diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
> index 03dc1bb..3776b7b 100644
> --- a/drivers/reset/Makefile
> +++ b/drivers/reset/Makefile
[...]
> +static const struct reset_control_ops stm32_reset_ops = {
> + .assert = stm32_reset_assert,
> + .deassert = stm32_reset_deassert,
Are the registers not readable, or did you choose not to
implement .status on purpose?
regards
Philipp
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 3/4] drivers: reset: Add STM32 reset driver
@ 2016-07-04 17:36 ` Philipp Zabel
0 siblings, 0 replies; 44+ messages in thread
From: Philipp Zabel @ 2016-07-04 17:36 UTC (permalink / raw)
To: gabriel.fernandez-qxv4g6HH51o
Cc: Rob Herring, Mark Rutland, Maxime Coquelin, Russell King,
patrice.chotard-qxv4g6HH51o, alexandre.torgue-qxv4g6HH51o,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Hi Gabriel,
Am Montag, den 04.07.2016, 15:47 +0200 schrieb gabriel.fernandez-qxv4g6HH51o@public.gmane.org:
> From: Gabriel Fernandez <gabriel.fernandez-qxv4g6HH51o@public.gmane.org>
Isn't Maxime the author of this driver?
> The STM32 MCUs family IPs can be reset by accessing some registers
> from the RCC block.
>
> The list of available reset lines is documented in the DT bindings.
>
> Signed-off-by: Maxime Coquelin <mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Gabriel Fernandez <gabriel.fernandez-qxv4g6HH51o@public.gmane.org>
> ---
> drivers/reset/Makefile | 1 +
> drivers/reset/reset-stm32.c | 113 ++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 114 insertions(+)
> create mode 100644 drivers/reset/reset-stm32.c
>
> diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
> index 03dc1bb..3776b7b 100644
> --- a/drivers/reset/Makefile
> +++ b/drivers/reset/Makefile
[...]
> +static const struct reset_control_ops stm32_reset_ops = {
> + .assert = stm32_reset_assert,
> + .deassert = stm32_reset_deassert,
Are the registers not readable, or did you choose not to
implement .status on purpose?
regards
Philipp
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 3/4] drivers: reset: Add STM32 reset driver
@ 2016-07-04 17:36 ` Philipp Zabel
0 siblings, 0 replies; 44+ messages in thread
From: Philipp Zabel @ 2016-07-04 17:36 UTC (permalink / raw)
To: linux-arm-kernel
Hi Gabriel,
Am Montag, den 04.07.2016, 15:47 +0200 schrieb gabriel.fernandez at st.com:
> From: Gabriel Fernandez <gabriel.fernandez@st.com>
Isn't Maxime the author of this driver?
> The STM32 MCUs family IPs can be reset by accessing some registers
> from the RCC block.
>
> The list of available reset lines is documented in the DT bindings.
>
> Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
> Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
> ---
> drivers/reset/Makefile | 1 +
> drivers/reset/reset-stm32.c | 113 ++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 114 insertions(+)
> create mode 100644 drivers/reset/reset-stm32.c
>
> diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
> index 03dc1bb..3776b7b 100644
> --- a/drivers/reset/Makefile
> +++ b/drivers/reset/Makefile
[...]
> +static const struct reset_control_ops stm32_reset_ops = {
> + .assert = stm32_reset_assert,
> + .deassert = stm32_reset_deassert,
Are the registers not readable, or did you choose not to
implement .status on purpose?
regards
Philipp
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 3/4] drivers: reset: Add STM32 reset driver
@ 2016-07-05 7:29 ` Gabriel Fernandez
0 siblings, 0 replies; 44+ messages in thread
From: Gabriel Fernandez @ 2016-07-05 7:29 UTC (permalink / raw)
To: Philipp Zabel
Cc: Rob Herring, Mark Rutland, Maxime Coquelin, Russell King,
patrice.chotard, alexandre.torgue, devicetree, linux-arm-kernel,
linux-kernel
Hi Philipp,
Thanks for reviewing.
On 07/04/2016 07:36 PM, Philipp Zabel wrote:
> Hi Gabriel,
>
> Am Montag, den 04.07.2016, 15:47 +0200 schrieb gabriel.fernandez@st.com:
>> From: Gabriel Fernandez <gabriel.fernandez@st.com>
> Isn't Maxime the author of this driver?
Yes i upstream with his agreement.
I only made small modifications (use of devm_reset_controller_register(),
make reset_control_ops const...) that's why the author in the git
history has
been changed... I will use g |it commit --amend --author="Maxime.." for
the v2.
|
>> The STM32 MCUs family IPs can be reset by accessing some registers
>> from the RCC block.
>>
>> The list of available reset lines is documented in the DT bindings.
>>
>> Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
>> Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
>> ---
>> drivers/reset/Makefile | 1 +
>> drivers/reset/reset-stm32.c | 113 ++++++++++++++++++++++++++++++++++++++++++++
>> 2 files changed, 114 insertions(+)
>> create mode 100644 drivers/reset/reset-stm32.c
>>
>> diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
>> index 03dc1bb..3776b7b 100644
>> --- a/drivers/reset/Makefile
>> +++ b/drivers/reset/Makefile
> [...]
>> +static const struct reset_control_ops stm32_reset_ops = {
>> + .assert = stm32_reset_assert,
>> + .deassert = stm32_reset_deassert,
> Are the registers not readable, or did you choose not to
> implement .status on purpose?
We choose to not implement.
Thanks!
Best Regards
Gabriel
> regards
> Philipp
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 3/4] drivers: reset: Add STM32 reset driver
@ 2016-07-05 7:29 ` Gabriel Fernandez
0 siblings, 0 replies; 44+ messages in thread
From: Gabriel Fernandez @ 2016-07-05 7:29 UTC (permalink / raw)
To: Philipp Zabel
Cc: Rob Herring, Mark Rutland, Maxime Coquelin, Russell King,
patrice.chotard-qxv4g6HH51o, alexandre.torgue-qxv4g6HH51o,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Hi Philipp,
Thanks for reviewing.
On 07/04/2016 07:36 PM, Philipp Zabel wrote:
> Hi Gabriel,
>
> Am Montag, den 04.07.2016, 15:47 +0200 schrieb gabriel.fernandez-qxv4g6HH51o@public.gmane.org:
>> From: Gabriel Fernandez <gabriel.fernandez-qxv4g6HH51o@public.gmane.org>
> Isn't Maxime the author of this driver?
Yes i upstream with his agreement.
I only made small modifications (use of devm_reset_controller_register(),
make reset_control_ops const...) that's why the author in the git
history has
been changed... I will use g |it commit --amend --author="Maxime.." for
the v2.
|
>> The STM32 MCUs family IPs can be reset by accessing some registers
>> from the RCC block.
>>
>> The list of available reset lines is documented in the DT bindings.
>>
>> Signed-off-by: Maxime Coquelin <mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> Signed-off-by: Gabriel Fernandez <gabriel.fernandez-qxv4g6HH51o@public.gmane.org>
>> ---
>> drivers/reset/Makefile | 1 +
>> drivers/reset/reset-stm32.c | 113 ++++++++++++++++++++++++++++++++++++++++++++
>> 2 files changed, 114 insertions(+)
>> create mode 100644 drivers/reset/reset-stm32.c
>>
>> diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
>> index 03dc1bb..3776b7b 100644
>> --- a/drivers/reset/Makefile
>> +++ b/drivers/reset/Makefile
> [...]
>> +static const struct reset_control_ops stm32_reset_ops = {
>> + .assert = stm32_reset_assert,
>> + .deassert = stm32_reset_deassert,
> Are the registers not readable, or did you choose not to
> implement .status on purpose?
We choose to not implement.
Thanks!
Best Regards
Gabriel
> regards
> Philipp
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 3/4] drivers: reset: Add STM32 reset driver
@ 2016-07-05 7:29 ` Gabriel Fernandez
0 siblings, 0 replies; 44+ messages in thread
From: Gabriel Fernandez @ 2016-07-05 7:29 UTC (permalink / raw)
To: linux-arm-kernel
Hi Philipp,
Thanks for reviewing.
On 07/04/2016 07:36 PM, Philipp Zabel wrote:
> Hi Gabriel,
>
> Am Montag, den 04.07.2016, 15:47 +0200 schrieb gabriel.fernandez at st.com:
>> From: Gabriel Fernandez <gabriel.fernandez@st.com>
> Isn't Maxime the author of this driver?
Yes i upstream with his agreement.
I only made small modifications (use of devm_reset_controller_register(),
make reset_control_ops const...) that's why the author in the git
history has
been changed... I will use g |it commit --amend --author="Maxime.." for
the v2.
|
>> The STM32 MCUs family IPs can be reset by accessing some registers
>> from the RCC block.
>>
>> The list of available reset lines is documented in the DT bindings.
>>
>> Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
>> Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
>> ---
>> drivers/reset/Makefile | 1 +
>> drivers/reset/reset-stm32.c | 113 ++++++++++++++++++++++++++++++++++++++++++++
>> 2 files changed, 114 insertions(+)
>> create mode 100644 drivers/reset/reset-stm32.c
>>
>> diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
>> index 03dc1bb..3776b7b 100644
>> --- a/drivers/reset/Makefile
>> +++ b/drivers/reset/Makefile
> [...]
>> +static const struct reset_control_ops stm32_reset_ops = {
>> + .assert = stm32_reset_assert,
>> + .deassert = stm32_reset_deassert,
> Are the registers not readable, or did you choose not to
> implement .status on purpose?
We choose to not implement.
Thanks!
Best Regards
Gabriel
> regards
> Philipp
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 2/4] dt-bindings: Document the STM32 reset bindings
@ 2016-07-05 7:30 ` Gabriel Fernandez
0 siblings, 0 replies; 44+ messages in thread
From: Gabriel Fernandez @ 2016-07-05 7:30 UTC (permalink / raw)
To: Philipp Zabel
Cc: Rob Herring, Mark Rutland, Maxime Coquelin, Russell King,
patrice.chotard, alexandre.torgue, devicetree, linux-arm-kernel,
linux-kernel
Hi Philipp,
On 07/04/2016 07:36 PM, Philipp Zabel wrote:
> Am Montag, den 04.07.2016, 15:47 +0200 schrieb gabriel.fernandez@st.com:
>> From: Maxime Coquelin <mcoquelin.stm32@gmail.com>
>>
>> This adds documentation of device tree bindings for the
>> STM32 reset controller.
>>
>> Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
> The way I understand Documentation/SubmittingPatches, this should also
> have your Signed-off-by.
ok
>> ---
>> .../devicetree/bindings/reset/st,stm32-rcc.txt | 50 ++++++++++++++++++++++
>> 1 file changed, 50 insertions(+)
>> create mode 100644 Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
>>
>> diff --git a/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
>> new file mode 100644
>> index 0000000..333080c
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
>> @@ -0,0 +1,50 @@
>> +STMicroelectronics STM32 Peripheral Reset Controller
>> +====================================================
>> +
>> +The RCC IP is both a reset and a clock controller. This documentation only
>> +documents the reset part.
>> +
>> +Please also refer to reset.txt in this directory for common reset
>> +controller binding usage.
>> +
>> +Required properties:
>> +- compatible: Should be "st,stm32-rcc"
>> +- reg: should be register base and length as documented in the
>> + datasheet
>> +- #reset-cells: 1, see below
>> +
>> +example:
>> +
>> +rcc: reset@40023800 {
>> + #reset-cells = <1>;
>> + compatible = "st,stm32-rcc";
>> + reg = <0x40023800 0x400>;
>> +};
>> +
>> +Specifying softreset control of devices
>> +=======================================
>> +
>> +Device nodes should specify the reset channel required in their "resets"
>> +property, containing a phandle to the reset device node and an index specifying
>> +which channel to use.
>> +The index is the bit number within the RCC registers bank, starting from RCC
>> +base address.
>> +It is calculated as: index = register_offset / 4 * 32 + bit_offset.
>> +Where bit_offset is the bit offset within the register.
>> +For example, for CRC reset:
>> + crc = AHB1RSTR_offset / 4 * 32 + CRCRST_bit_offset = 0x10 / 4 * 32 + 12 = 140
> I see you decided to keep the register offset encoded in the reset
> index.
>
>> +
>> +To simplify the usagen and to share bit definition with the clock driver of
> s/usagen/usage/
ok
>> +the RCC IP, macros are available to generate the index in human-readble
>> +format.
>> +
>> +For STM32F4 series, the macro are available here:
>> + - include/dt-bindings/mfd/stm32f4-rcc.h
> If DT and ARM/STI and maintainers agree with the binding and header
> macros, I'm inclined to take patches 1-3.
>
> regards
> Philipp
>
Thanks!
Best Regards
Gabriel
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 2/4] dt-bindings: Document the STM32 reset bindings
@ 2016-07-05 7:30 ` Gabriel Fernandez
0 siblings, 0 replies; 44+ messages in thread
From: Gabriel Fernandez @ 2016-07-05 7:30 UTC (permalink / raw)
To: Philipp Zabel
Cc: Rob Herring, Mark Rutland, Maxime Coquelin, Russell King,
patrice.chotard-qxv4g6HH51o, alexandre.torgue-qxv4g6HH51o,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Hi Philipp,
On 07/04/2016 07:36 PM, Philipp Zabel wrote:
> Am Montag, den 04.07.2016, 15:47 +0200 schrieb gabriel.fernandez-qxv4g6HH51o@public.gmane.org:
>> From: Maxime Coquelin <mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>>
>> This adds documentation of device tree bindings for the
>> STM32 reset controller.
>>
>> Signed-off-by: Maxime Coquelin <mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> The way I understand Documentation/SubmittingPatches, this should also
> have your Signed-off-by.
ok
>> ---
>> .../devicetree/bindings/reset/st,stm32-rcc.txt | 50 ++++++++++++++++++++++
>> 1 file changed, 50 insertions(+)
>> create mode 100644 Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
>>
>> diff --git a/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
>> new file mode 100644
>> index 0000000..333080c
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
>> @@ -0,0 +1,50 @@
>> +STMicroelectronics STM32 Peripheral Reset Controller
>> +====================================================
>> +
>> +The RCC IP is both a reset and a clock controller. This documentation only
>> +documents the reset part.
>> +
>> +Please also refer to reset.txt in this directory for common reset
>> +controller binding usage.
>> +
>> +Required properties:
>> +- compatible: Should be "st,stm32-rcc"
>> +- reg: should be register base and length as documented in the
>> + datasheet
>> +- #reset-cells: 1, see below
>> +
>> +example:
>> +
>> +rcc: reset@40023800 {
>> + #reset-cells = <1>;
>> + compatible = "st,stm32-rcc";
>> + reg = <0x40023800 0x400>;
>> +};
>> +
>> +Specifying softreset control of devices
>> +=======================================
>> +
>> +Device nodes should specify the reset channel required in their "resets"
>> +property, containing a phandle to the reset device node and an index specifying
>> +which channel to use.
>> +The index is the bit number within the RCC registers bank, starting from RCC
>> +base address.
>> +It is calculated as: index = register_offset / 4 * 32 + bit_offset.
>> +Where bit_offset is the bit offset within the register.
>> +For example, for CRC reset:
>> + crc = AHB1RSTR_offset / 4 * 32 + CRCRST_bit_offset = 0x10 / 4 * 32 + 12 = 140
> I see you decided to keep the register offset encoded in the reset
> index.
>
>> +
>> +To simplify the usagen and to share bit definition with the clock driver of
> s/usagen/usage/
ok
>> +the RCC IP, macros are available to generate the index in human-readble
>> +format.
>> +
>> +For STM32F4 series, the macro are available here:
>> + - include/dt-bindings/mfd/stm32f4-rcc.h
> If DT and ARM/STI and maintainers agree with the binding and header
> macros, I'm inclined to take patches 1-3.
>
> regards
> Philipp
>
Thanks!
Best Regards
Gabriel
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 2/4] dt-bindings: Document the STM32 reset bindings
@ 2016-07-05 7:30 ` Gabriel Fernandez
0 siblings, 0 replies; 44+ messages in thread
From: Gabriel Fernandez @ 2016-07-05 7:30 UTC (permalink / raw)
To: linux-arm-kernel
Hi Philipp,
On 07/04/2016 07:36 PM, Philipp Zabel wrote:
> Am Montag, den 04.07.2016, 15:47 +0200 schrieb gabriel.fernandez at st.com:
>> From: Maxime Coquelin <mcoquelin.stm32@gmail.com>
>>
>> This adds documentation of device tree bindings for the
>> STM32 reset controller.
>>
>> Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
> The way I understand Documentation/SubmittingPatches, this should also
> have your Signed-off-by.
ok
>> ---
>> .../devicetree/bindings/reset/st,stm32-rcc.txt | 50 ++++++++++++++++++++++
>> 1 file changed, 50 insertions(+)
>> create mode 100644 Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
>>
>> diff --git a/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
>> new file mode 100644
>> index 0000000..333080c
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
>> @@ -0,0 +1,50 @@
>> +STMicroelectronics STM32 Peripheral Reset Controller
>> +====================================================
>> +
>> +The RCC IP is both a reset and a clock controller. This documentation only
>> +documents the reset part.
>> +
>> +Please also refer to reset.txt in this directory for common reset
>> +controller binding usage.
>> +
>> +Required properties:
>> +- compatible: Should be "st,stm32-rcc"
>> +- reg: should be register base and length as documented in the
>> + datasheet
>> +- #reset-cells: 1, see below
>> +
>> +example:
>> +
>> +rcc: reset at 40023800 {
>> + #reset-cells = <1>;
>> + compatible = "st,stm32-rcc";
>> + reg = <0x40023800 0x400>;
>> +};
>> +
>> +Specifying softreset control of devices
>> +=======================================
>> +
>> +Device nodes should specify the reset channel required in their "resets"
>> +property, containing a phandle to the reset device node and an index specifying
>> +which channel to use.
>> +The index is the bit number within the RCC registers bank, starting from RCC
>> +base address.
>> +It is calculated as: index = register_offset / 4 * 32 + bit_offset.
>> +Where bit_offset is the bit offset within the register.
>> +For example, for CRC reset:
>> + crc = AHB1RSTR_offset / 4 * 32 + CRCRST_bit_offset = 0x10 / 4 * 32 + 12 = 140
> I see you decided to keep the register offset encoded in the reset
> index.
>
>> +
>> +To simplify the usagen and to share bit definition with the clock driver of
> s/usagen/usage/
ok
>> +the RCC IP, macros are available to generate the index in human-readble
>> +format.
>> +
>> +For STM32F4 series, the macro are available here:
>> + - include/dt-bindings/mfd/stm32f4-rcc.h
> If DT and ARM/STI and maintainers agree with the binding and header
> macros, I'm inclined to take patches 1-3.
>
> regards
> Philipp
>
Thanks!
Best Regards
Gabriel
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 3/4] drivers: reset: Add STM32 reset driver
@ 2016-07-05 13:28 ` Philipp Zabel
0 siblings, 0 replies; 44+ messages in thread
From: Philipp Zabel @ 2016-07-05 13:28 UTC (permalink / raw)
To: gabriel.fernandez
Cc: Rob Herring, Mark Rutland, Maxime Coquelin, Russell King,
patrice.chotard, alexandre.torgue, devicetree, linux-arm-kernel,
linux-kernel
Am Montag, den 04.07.2016, 15:47 +0200 schrieb gabriel.fernandez@st.com:
> From: Gabriel Fernandez <gabriel.fernandez@st.com>
>
> The STM32 MCUs family IPs can be reset by accessing some registers
> from the RCC block.
>
> The list of available reset lines is documented in the DT bindings.
>
> Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
> Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
> ---
> drivers/reset/Makefile | 1 +
> drivers/reset/reset-stm32.c | 113 ++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 114 insertions(+)
> create mode 100644 drivers/reset/reset-stm32.c
>
> diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
> index 03dc1bb..3776b7b 100644
> --- a/drivers/reset/Makefile
> +++ b/drivers/reset/Makefile
> @@ -4,6 +4,7 @@ obj-$(CONFIG_ARCH_SOCFPGA) += reset-socfpga.o
> obj-$(CONFIG_ARCH_BERLIN) += reset-berlin.o
> obj-$(CONFIG_MACH_PISTACHIO) += reset-pistachio.o
> obj-$(CONFIG_ARCH_MESON) += reset-meson.o
> +obj-$(CONFIG_ARCH_STM32) += reset-stm32.o
> obj-$(CONFIG_ARCH_SUNXI) += reset-sunxi.o
> obj-$(CONFIG_ARCH_STI) += sti/
> obj-$(CONFIG_ARCH_HISI) += hisilicon/
> diff --git a/drivers/reset/reset-stm32.c b/drivers/reset/reset-stm32.c
> new file mode 100644
> index 0000000..be42bff
> --- /dev/null
> +++ b/drivers/reset/reset-stm32.c
> @@ -0,0 +1,113 @@
> +/*
> + * Copyright (C) Maxime Coquelin 2015
> + * Author: Maxime Coquelin <mcoquelin.stm32@gmail.com>
> + * License terms: GNU General Public License (GPL), version 2
> + *
> + * Heavily based on sunxi driver from Maxime Ripard.
> + */
> +
> +#include <linux/err.h>
> +#include <linux/io.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/of_address.h>
> +#include <linux/platform_device.h>
> +#include <linux/reset-controller.h>
> +#include <linux/slab.h>
> +#include <linux/spinlock.h>
> +#include <linux/types.h>
> +
> +struct stm32_reset_data {
> + spinlock_t lock;
> + void __iomem *membase;
> + struct reset_controller_dev rcdev;
> +};
> +
> +static int stm32_reset_assert(struct reset_controller_dev *rcdev,
> + unsigned long id)
> +{
> + struct stm32_reset_data *data = container_of(rcdev,
> + struct stm32_reset_data,
> + rcdev);
> + int bank = id / BITS_PER_LONG;
> + int offset = id % BITS_PER_LONG;
> + unsigned long flags;
> + u32 reg;
> +
> + spin_lock_irqsave(&data->lock, flags);
> +
> + reg = readl_relaxed(data->membase + (bank * 4));
> + writel_relaxed(reg | BIT(offset), data->membase + (bank * 4));
Please also switch to the non-relaxed variants. It shouldn't make a
difference here, and as Arnd points out, reduces the risk of new
developers using readl/writel_relaxed without thinking about the
consequences.
Further, this will make the stm32, sunxi, and socfpga accessors look the
same. I'd like to try and combine them after this is merged.
regards
Philipp
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 3/4] drivers: reset: Add STM32 reset driver
@ 2016-07-05 13:28 ` Philipp Zabel
0 siblings, 0 replies; 44+ messages in thread
From: Philipp Zabel @ 2016-07-05 13:28 UTC (permalink / raw)
To: gabriel.fernandez-qxv4g6HH51o
Cc: Rob Herring, Mark Rutland, Maxime Coquelin, Russell King,
patrice.chotard-qxv4g6HH51o, alexandre.torgue-qxv4g6HH51o,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Am Montag, den 04.07.2016, 15:47 +0200 schrieb gabriel.fernandez-qxv4g6HH51o@public.gmane.org:
> From: Gabriel Fernandez <gabriel.fernandez-qxv4g6HH51o@public.gmane.org>
>
> The STM32 MCUs family IPs can be reset by accessing some registers
> from the RCC block.
>
> The list of available reset lines is documented in the DT bindings.
>
> Signed-off-by: Maxime Coquelin <mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Gabriel Fernandez <gabriel.fernandez-qxv4g6HH51o@public.gmane.org>
> ---
> drivers/reset/Makefile | 1 +
> drivers/reset/reset-stm32.c | 113 ++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 114 insertions(+)
> create mode 100644 drivers/reset/reset-stm32.c
>
> diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
> index 03dc1bb..3776b7b 100644
> --- a/drivers/reset/Makefile
> +++ b/drivers/reset/Makefile
> @@ -4,6 +4,7 @@ obj-$(CONFIG_ARCH_SOCFPGA) += reset-socfpga.o
> obj-$(CONFIG_ARCH_BERLIN) += reset-berlin.o
> obj-$(CONFIG_MACH_PISTACHIO) += reset-pistachio.o
> obj-$(CONFIG_ARCH_MESON) += reset-meson.o
> +obj-$(CONFIG_ARCH_STM32) += reset-stm32.o
> obj-$(CONFIG_ARCH_SUNXI) += reset-sunxi.o
> obj-$(CONFIG_ARCH_STI) += sti/
> obj-$(CONFIG_ARCH_HISI) += hisilicon/
> diff --git a/drivers/reset/reset-stm32.c b/drivers/reset/reset-stm32.c
> new file mode 100644
> index 0000000..be42bff
> --- /dev/null
> +++ b/drivers/reset/reset-stm32.c
> @@ -0,0 +1,113 @@
> +/*
> + * Copyright (C) Maxime Coquelin 2015
> + * Author: Maxime Coquelin <mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> + * License terms: GNU General Public License (GPL), version 2
> + *
> + * Heavily based on sunxi driver from Maxime Ripard.
> + */
> +
> +#include <linux/err.h>
> +#include <linux/io.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/of_address.h>
> +#include <linux/platform_device.h>
> +#include <linux/reset-controller.h>
> +#include <linux/slab.h>
> +#include <linux/spinlock.h>
> +#include <linux/types.h>
> +
> +struct stm32_reset_data {
> + spinlock_t lock;
> + void __iomem *membase;
> + struct reset_controller_dev rcdev;
> +};
> +
> +static int stm32_reset_assert(struct reset_controller_dev *rcdev,
> + unsigned long id)
> +{
> + struct stm32_reset_data *data = container_of(rcdev,
> + struct stm32_reset_data,
> + rcdev);
> + int bank = id / BITS_PER_LONG;
> + int offset = id % BITS_PER_LONG;
> + unsigned long flags;
> + u32 reg;
> +
> + spin_lock_irqsave(&data->lock, flags);
> +
> + reg = readl_relaxed(data->membase + (bank * 4));
> + writel_relaxed(reg | BIT(offset), data->membase + (bank * 4));
Please also switch to the non-relaxed variants. It shouldn't make a
difference here, and as Arnd points out, reduces the risk of new
developers using readl/writel_relaxed without thinking about the
consequences.
Further, this will make the stm32, sunxi, and socfpga accessors look the
same. I'd like to try and combine them after this is merged.
regards
Philipp
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 3/4] drivers: reset: Add STM32 reset driver
@ 2016-07-05 13:28 ` Philipp Zabel
0 siblings, 0 replies; 44+ messages in thread
From: Philipp Zabel @ 2016-07-05 13:28 UTC (permalink / raw)
To: linux-arm-kernel
Am Montag, den 04.07.2016, 15:47 +0200 schrieb gabriel.fernandez at st.com:
> From: Gabriel Fernandez <gabriel.fernandez@st.com>
>
> The STM32 MCUs family IPs can be reset by accessing some registers
> from the RCC block.
>
> The list of available reset lines is documented in the DT bindings.
>
> Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
> Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
> ---
> drivers/reset/Makefile | 1 +
> drivers/reset/reset-stm32.c | 113 ++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 114 insertions(+)
> create mode 100644 drivers/reset/reset-stm32.c
>
> diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
> index 03dc1bb..3776b7b 100644
> --- a/drivers/reset/Makefile
> +++ b/drivers/reset/Makefile
> @@ -4,6 +4,7 @@ obj-$(CONFIG_ARCH_SOCFPGA) += reset-socfpga.o
> obj-$(CONFIG_ARCH_BERLIN) += reset-berlin.o
> obj-$(CONFIG_MACH_PISTACHIO) += reset-pistachio.o
> obj-$(CONFIG_ARCH_MESON) += reset-meson.o
> +obj-$(CONFIG_ARCH_STM32) += reset-stm32.o
> obj-$(CONFIG_ARCH_SUNXI) += reset-sunxi.o
> obj-$(CONFIG_ARCH_STI) += sti/
> obj-$(CONFIG_ARCH_HISI) += hisilicon/
> diff --git a/drivers/reset/reset-stm32.c b/drivers/reset/reset-stm32.c
> new file mode 100644
> index 0000000..be42bff
> --- /dev/null
> +++ b/drivers/reset/reset-stm32.c
> @@ -0,0 +1,113 @@
> +/*
> + * Copyright (C) Maxime Coquelin 2015
> + * Author: Maxime Coquelin <mcoquelin.stm32@gmail.com>
> + * License terms: GNU General Public License (GPL), version 2
> + *
> + * Heavily based on sunxi driver from Maxime Ripard.
> + */
> +
> +#include <linux/err.h>
> +#include <linux/io.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/of_address.h>
> +#include <linux/platform_device.h>
> +#include <linux/reset-controller.h>
> +#include <linux/slab.h>
> +#include <linux/spinlock.h>
> +#include <linux/types.h>
> +
> +struct stm32_reset_data {
> + spinlock_t lock;
> + void __iomem *membase;
> + struct reset_controller_dev rcdev;
> +};
> +
> +static int stm32_reset_assert(struct reset_controller_dev *rcdev,
> + unsigned long id)
> +{
> + struct stm32_reset_data *data = container_of(rcdev,
> + struct stm32_reset_data,
> + rcdev);
> + int bank = id / BITS_PER_LONG;
> + int offset = id % BITS_PER_LONG;
> + unsigned long flags;
> + u32 reg;
> +
> + spin_lock_irqsave(&data->lock, flags);
> +
> + reg = readl_relaxed(data->membase + (bank * 4));
> + writel_relaxed(reg | BIT(offset), data->membase + (bank * 4));
Please also switch to the non-relaxed variants. It shouldn't make a
difference here, and as Arnd points out, reduces the risk of new
developers using readl/writel_relaxed without thinking about the
consequences.
Further, this will make the stm32, sunxi, and socfpga accessors look the
same. I'd like to try and combine them after this is merged.
regards
Philipp
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 3/4] drivers: reset: Add STM32 reset driver
@ 2016-07-05 13:29 ` Philipp Zabel
0 siblings, 0 replies; 44+ messages in thread
From: Philipp Zabel @ 2016-07-05 13:29 UTC (permalink / raw)
To: Gabriel Fernandez
Cc: Rob Herring, Mark Rutland, Maxime Coquelin, Russell King,
patrice.chotard, alexandre.torgue, devicetree, linux-arm-kernel,
linux-kernel
Am Dienstag, den 05.07.2016, 09:29 +0200 schrieb Gabriel Fernandez:
[...]
> >> +static const struct reset_control_ops stm32_reset_ops = {
> >> + .assert = stm32_reset_assert,
> >> + .deassert = stm32_reset_deassert,
> > Are the registers not readable, or did you choose not to
> > implement .status on purpose?
> We choose to not implement.
Ok. Because of size issues or just because you don't need them in any of
your drivers?
regards
Philipp
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 3/4] drivers: reset: Add STM32 reset driver
@ 2016-07-05 13:29 ` Philipp Zabel
0 siblings, 0 replies; 44+ messages in thread
From: Philipp Zabel @ 2016-07-05 13:29 UTC (permalink / raw)
To: Gabriel Fernandez
Cc: Rob Herring, Mark Rutland, Maxime Coquelin, Russell King,
patrice.chotard-qxv4g6HH51o, alexandre.torgue-qxv4g6HH51o,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Am Dienstag, den 05.07.2016, 09:29 +0200 schrieb Gabriel Fernandez:
[...]
> >> +static const struct reset_control_ops stm32_reset_ops = {
> >> + .assert = stm32_reset_assert,
> >> + .deassert = stm32_reset_deassert,
> > Are the registers not readable, or did you choose not to
> > implement .status on purpose?
> We choose to not implement.
Ok. Because of size issues or just because you don't need them in any of
your drivers?
regards
Philipp
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 3/4] drivers: reset: Add STM32 reset driver
@ 2016-07-05 13:29 ` Philipp Zabel
0 siblings, 0 replies; 44+ messages in thread
From: Philipp Zabel @ 2016-07-05 13:29 UTC (permalink / raw)
To: linux-arm-kernel
Am Dienstag, den 05.07.2016, 09:29 +0200 schrieb Gabriel Fernandez:
[...]
> >> +static const struct reset_control_ops stm32_reset_ops = {
> >> + .assert = stm32_reset_assert,
> >> + .deassert = stm32_reset_deassert,
> > Are the registers not readable, or did you choose not to
> > implement .status on purpose?
> We choose to not implement.
Ok. Because of size issues or just because you don't need them in any of
your drivers?
regards
Philipp
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 2/4] dt-bindings: Document the STM32 reset bindings
2016-07-04 13:47 ` gabriel.fernandez-qxv4g6HH51o
@ 2016-07-05 16:18 ` Rob Herring
-1 siblings, 0 replies; 44+ messages in thread
From: Rob Herring @ 2016-07-05 16:18 UTC (permalink / raw)
To: gabriel.fernandez
Cc: Philipp Zabel, Mark Rutland, Maxime Coquelin, Russell King,
patrice.chotard, alexandre.torgue, devicetree, linux-arm-kernel,
linux-kernel
On Mon, Jul 04, 2016 at 03:47:30PM +0200, gabriel.fernandez@st.com wrote:
> From: Maxime Coquelin <mcoquelin.stm32@gmail.com>
>
> This adds documentation of device tree bindings for the
> STM32 reset controller.
>
> Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
> ---
> .../devicetree/bindings/reset/st,stm32-rcc.txt | 50 ++++++++++++++++++++++
> 1 file changed, 50 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
>
> diff --git a/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
> new file mode 100644
> index 0000000..333080c
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
> @@ -0,0 +1,50 @@
> +STMicroelectronics STM32 Peripheral Reset Controller
> +====================================================
> +
> +The RCC IP is both a reset and a clock controller. This documentation only
> +documents the reset part.
The clock part is already documented or will do later? Either way, you
are describing an IP block, so please describe all of it now and in one
place.
Rob
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 2/4] dt-bindings: Document the STM32 reset bindings
@ 2016-07-05 16:18 ` Rob Herring
0 siblings, 0 replies; 44+ messages in thread
From: Rob Herring @ 2016-07-05 16:18 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Jul 04, 2016 at 03:47:30PM +0200, gabriel.fernandez at st.com wrote:
> From: Maxime Coquelin <mcoquelin.stm32@gmail.com>
>
> This adds documentation of device tree bindings for the
> STM32 reset controller.
>
> Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
> ---
> .../devicetree/bindings/reset/st,stm32-rcc.txt | 50 ++++++++++++++++++++++
> 1 file changed, 50 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
>
> diff --git a/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
> new file mode 100644
> index 0000000..333080c
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
> @@ -0,0 +1,50 @@
> +STMicroelectronics STM32 Peripheral Reset Controller
> +====================================================
> +
> +The RCC IP is both a reset and a clock controller. This documentation only
> +documents the reset part.
The clock part is already documented or will do later? Either way, you
are describing an IP block, so please describe all of it now and in one
place.
Rob
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 2/4] dt-bindings: Document the STM32 reset bindings
2016-07-05 16:18 ` Rob Herring
(?)
@ 2016-07-06 7:39 ` Gabriel Fernandez
-1 siblings, 0 replies; 44+ messages in thread
From: Gabriel Fernandez @ 2016-07-06 7:39 UTC (permalink / raw)
To: Rob Herring
Cc: Philipp Zabel, Mark Rutland, Maxime Coquelin, Russell King,
patrice.chotard, alexandre.torgue, devicetree, linux-arm-kernel,
linux-kernel
Hi Rob,
Thanks for reviewing
On 07/05/2016 06:18 PM, Rob Herring wrote:
> On Mon, Jul 04, 2016 at 03:47:30PM +0200, gabriel.fernandez@st.com wrote:
>> From: Maxime Coquelin <mcoquelin.stm32@gmail.com>
>>
>> This adds documentation of device tree bindings for the
>> STM32 reset controller.
>>
>> Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
>> ---
>> .../devicetree/bindings/reset/st,stm32-rcc.txt | 50 ++++++++++++++++++++++
>> 1 file changed, 50 insertions(+)
>> create mode 100644 Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
>>
>> diff --git a/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
>> new file mode 100644
>> index 0000000..333080c
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
>> @@ -0,0 +1,50 @@
>> +STMicroelectronics STM32 Peripheral Reset Controller
>> +====================================================
>> +
>> +The RCC IP is both a reset and a clock controller. This documentation only
>> +documents the reset part.
> The clock part is already documented or will do later? Either way, you
> are describing an IP block, so please describe all of it now and in one
> place.
>
> Rob
The clock part is already documented.
Okay to put this in one place, but in which directory ?
what do you prefer ?
- create a rcc directory
- put the file on top, in Documentation/devicetree/bindings
Best regards
Gabriel
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 2/4] dt-bindings: Document the STM32 reset bindings
@ 2016-07-06 7:39 ` Gabriel Fernandez
0 siblings, 0 replies; 44+ messages in thread
From: Gabriel Fernandez @ 2016-07-06 7:39 UTC (permalink / raw)
To: Rob Herring
Cc: Philipp Zabel, Mark Rutland, Maxime Coquelin, Russell King,
patrice.chotard-qxv4g6HH51o, alexandre.torgue-qxv4g6HH51o,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Hi Rob,
Thanks for reviewing
On 07/05/2016 06:18 PM, Rob Herring wrote:
> On Mon, Jul 04, 2016 at 03:47:30PM +0200, gabriel.fernandez-qxv4g6HH51o@public.gmane.org wrote:
>> From: Maxime Coquelin <mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>>
>> This adds documentation of device tree bindings for the
>> STM32 reset controller.
>>
>> Signed-off-by: Maxime Coquelin <mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> ---
>> .../devicetree/bindings/reset/st,stm32-rcc.txt | 50 ++++++++++++++++++++++
>> 1 file changed, 50 insertions(+)
>> create mode 100644 Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
>>
>> diff --git a/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
>> new file mode 100644
>> index 0000000..333080c
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
>> @@ -0,0 +1,50 @@
>> +STMicroelectronics STM32 Peripheral Reset Controller
>> +====================================================
>> +
>> +The RCC IP is both a reset and a clock controller. This documentation only
>> +documents the reset part.
> The clock part is already documented or will do later? Either way, you
> are describing an IP block, so please describe all of it now and in one
> place.
>
> Rob
The clock part is already documented.
Okay to put this in one place, but in which directory ?
what do you prefer ?
- create a rcc directory
- put the file on top, in Documentation/devicetree/bindings
Best regards
Gabriel
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 2/4] dt-bindings: Document the STM32 reset bindings
@ 2016-07-06 7:39 ` Gabriel Fernandez
0 siblings, 0 replies; 44+ messages in thread
From: Gabriel Fernandez @ 2016-07-06 7:39 UTC (permalink / raw)
To: linux-arm-kernel
Hi Rob,
Thanks for reviewing
On 07/05/2016 06:18 PM, Rob Herring wrote:
> On Mon, Jul 04, 2016 at 03:47:30PM +0200, gabriel.fernandez at st.com wrote:
>> From: Maxime Coquelin <mcoquelin.stm32@gmail.com>
>>
>> This adds documentation of device tree bindings for the
>> STM32 reset controller.
>>
>> Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
>> ---
>> .../devicetree/bindings/reset/st,stm32-rcc.txt | 50 ++++++++++++++++++++++
>> 1 file changed, 50 insertions(+)
>> create mode 100644 Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
>>
>> diff --git a/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
>> new file mode 100644
>> index 0000000..333080c
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
>> @@ -0,0 +1,50 @@
>> +STMicroelectronics STM32 Peripheral Reset Controller
>> +====================================================
>> +
>> +The RCC IP is both a reset and a clock controller. This documentation only
>> +documents the reset part.
> The clock part is already documented or will do later? Either way, you
> are describing an IP block, so please describe all of it now and in one
> place.
>
> Rob
The clock part is already documented.
Okay to put this in one place, but in which directory ?
what do you prefer ?
- create a rcc directory
- put the file on top, in Documentation/devicetree/bindings
Best regards
Gabriel
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 3/4] drivers: reset: Add STM32 reset driver
@ 2016-07-06 7:44 ` Gabriel Fernandez
0 siblings, 0 replies; 44+ messages in thread
From: Gabriel Fernandez @ 2016-07-06 7:44 UTC (permalink / raw)
To: Philipp Zabel
Cc: Rob Herring, Mark Rutland, Maxime Coquelin, Russell King,
patrice.chotard, alexandre.torgue, devicetree, linux-arm-kernel,
linux-kernel
Hi Philipp,
On 07/05/2016 03:28 PM, Philipp Zabel wrote:
> Am Montag, den 04.07.2016, 15:47 +0200 schrieb gabriel.fernandez@st.com:
>> From: Gabriel Fernandez <gabriel.fernandez@st.com>
>>
>> The STM32 MCUs family IPs can be reset by accessing some registers
>> from the RCC block.
>>
>> The list of available reset lines is documented in the DT bindings.
>>
>> Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
>> Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
>> ---
>> drivers/reset/Makefile | 1 +
>> drivers/reset/reset-stm32.c | 113 ++++++++++++++++++++++++++++++++++++++++++++
>> 2 files changed, 114 insertions(+)
>> create mode 100644 drivers/reset/reset-stm32.c
>>
>> diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
>> index 03dc1bb..3776b7b 100644
>> --- a/drivers/reset/Makefile
>> +++ b/drivers/reset/Makefile
>> @@ -4,6 +4,7 @@ obj-$(CONFIG_ARCH_SOCFPGA) += reset-socfpga.o
>> obj-$(CONFIG_ARCH_BERLIN) += reset-berlin.o
>> obj-$(CONFIG_MACH_PISTACHIO) += reset-pistachio.o
>> obj-$(CONFIG_ARCH_MESON) += reset-meson.o
>> +obj-$(CONFIG_ARCH_STM32) += reset-stm32.o
>> obj-$(CONFIG_ARCH_SUNXI) += reset-sunxi.o
>> obj-$(CONFIG_ARCH_STI) += sti/
>> obj-$(CONFIG_ARCH_HISI) += hisilicon/
>> diff --git a/drivers/reset/reset-stm32.c b/drivers/reset/reset-stm32.c
>> new file mode 100644
>> index 0000000..be42bff
>> --- /dev/null
>> +++ b/drivers/reset/reset-stm32.c
>> @@ -0,0 +1,113 @@
>> +/*
>> + * Copyright (C) Maxime Coquelin 2015
>> + * Author: Maxime Coquelin <mcoquelin.stm32@gmail.com>
>> + * License terms: GNU General Public License (GPL), version 2
>> + *
>> + * Heavily based on sunxi driver from Maxime Ripard.
>> + */
>> +
>> +#include <linux/err.h>
>> +#include <linux/io.h>
>> +#include <linux/module.h>
>> +#include <linux/of.h>
>> +#include <linux/of_address.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/reset-controller.h>
>> +#include <linux/slab.h>
>> +#include <linux/spinlock.h>
>> +#include <linux/types.h>
>> +
>> +struct stm32_reset_data {
>> + spinlock_t lock;
>> + void __iomem *membase;
>> + struct reset_controller_dev rcdev;
>> +};
>> +
>> +static int stm32_reset_assert(struct reset_controller_dev *rcdev,
>> + unsigned long id)
>> +{
>> + struct stm32_reset_data *data = container_of(rcdev,
>> + struct stm32_reset_data,
>> + rcdev);
>> + int bank = id / BITS_PER_LONG;
>> + int offset = id % BITS_PER_LONG;
>> + unsigned long flags;
>> + u32 reg;
>> +
>> + spin_lock_irqsave(&data->lock, flags);
>> +
>> + reg = readl_relaxed(data->membase + (bank * 4));
>> + writel_relaxed(reg | BIT(offset), data->membase + (bank * 4));
> Please also switch to the non-relaxed variants. It shouldn't make a
> difference here, and as Arnd points out, reduces the risk of new
> developers using readl/writel_relaxed without thinking about the
> consequences.
> Further, this will make the stm32, sunxi, and socfpga accessors look the
> same. I'd like to try and combine them after this is merged.
>
> regards
> Philipp
>
ok no problem, i will fix it.
Thanks
Gabriel
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 3/4] drivers: reset: Add STM32 reset driver
@ 2016-07-06 7:44 ` Gabriel Fernandez
0 siblings, 0 replies; 44+ messages in thread
From: Gabriel Fernandez @ 2016-07-06 7:44 UTC (permalink / raw)
To: Philipp Zabel
Cc: Rob Herring, Mark Rutland, Maxime Coquelin, Russell King,
patrice.chotard-qxv4g6HH51o, alexandre.torgue-qxv4g6HH51o,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Hi Philipp,
On 07/05/2016 03:28 PM, Philipp Zabel wrote:
> Am Montag, den 04.07.2016, 15:47 +0200 schrieb gabriel.fernandez-qxv4g6HH51o@public.gmane.org:
>> From: Gabriel Fernandez <gabriel.fernandez-qxv4g6HH51o@public.gmane.org>
>>
>> The STM32 MCUs family IPs can be reset by accessing some registers
>> from the RCC block.
>>
>> The list of available reset lines is documented in the DT bindings.
>>
>> Signed-off-by: Maxime Coquelin <mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> Signed-off-by: Gabriel Fernandez <gabriel.fernandez-qxv4g6HH51o@public.gmane.org>
>> ---
>> drivers/reset/Makefile | 1 +
>> drivers/reset/reset-stm32.c | 113 ++++++++++++++++++++++++++++++++++++++++++++
>> 2 files changed, 114 insertions(+)
>> create mode 100644 drivers/reset/reset-stm32.c
>>
>> diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
>> index 03dc1bb..3776b7b 100644
>> --- a/drivers/reset/Makefile
>> +++ b/drivers/reset/Makefile
>> @@ -4,6 +4,7 @@ obj-$(CONFIG_ARCH_SOCFPGA) += reset-socfpga.o
>> obj-$(CONFIG_ARCH_BERLIN) += reset-berlin.o
>> obj-$(CONFIG_MACH_PISTACHIO) += reset-pistachio.o
>> obj-$(CONFIG_ARCH_MESON) += reset-meson.o
>> +obj-$(CONFIG_ARCH_STM32) += reset-stm32.o
>> obj-$(CONFIG_ARCH_SUNXI) += reset-sunxi.o
>> obj-$(CONFIG_ARCH_STI) += sti/
>> obj-$(CONFIG_ARCH_HISI) += hisilicon/
>> diff --git a/drivers/reset/reset-stm32.c b/drivers/reset/reset-stm32.c
>> new file mode 100644
>> index 0000000..be42bff
>> --- /dev/null
>> +++ b/drivers/reset/reset-stm32.c
>> @@ -0,0 +1,113 @@
>> +/*
>> + * Copyright (C) Maxime Coquelin 2015
>> + * Author: Maxime Coquelin <mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> + * License terms: GNU General Public License (GPL), version 2
>> + *
>> + * Heavily based on sunxi driver from Maxime Ripard.
>> + */
>> +
>> +#include <linux/err.h>
>> +#include <linux/io.h>
>> +#include <linux/module.h>
>> +#include <linux/of.h>
>> +#include <linux/of_address.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/reset-controller.h>
>> +#include <linux/slab.h>
>> +#include <linux/spinlock.h>
>> +#include <linux/types.h>
>> +
>> +struct stm32_reset_data {
>> + spinlock_t lock;
>> + void __iomem *membase;
>> + struct reset_controller_dev rcdev;
>> +};
>> +
>> +static int stm32_reset_assert(struct reset_controller_dev *rcdev,
>> + unsigned long id)
>> +{
>> + struct stm32_reset_data *data = container_of(rcdev,
>> + struct stm32_reset_data,
>> + rcdev);
>> + int bank = id / BITS_PER_LONG;
>> + int offset = id % BITS_PER_LONG;
>> + unsigned long flags;
>> + u32 reg;
>> +
>> + spin_lock_irqsave(&data->lock, flags);
>> +
>> + reg = readl_relaxed(data->membase + (bank * 4));
>> + writel_relaxed(reg | BIT(offset), data->membase + (bank * 4));
> Please also switch to the non-relaxed variants. It shouldn't make a
> difference here, and as Arnd points out, reduces the risk of new
> developers using readl/writel_relaxed without thinking about the
> consequences.
> Further, this will make the stm32, sunxi, and socfpga accessors look the
> same. I'd like to try and combine them after this is merged.
>
> regards
> Philipp
>
ok no problem, i will fix it.
Thanks
Gabriel
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 3/4] drivers: reset: Add STM32 reset driver
@ 2016-07-06 7:44 ` Gabriel Fernandez
0 siblings, 0 replies; 44+ messages in thread
From: Gabriel Fernandez @ 2016-07-06 7:44 UTC (permalink / raw)
To: linux-arm-kernel
Hi Philipp,
On 07/05/2016 03:28 PM, Philipp Zabel wrote:
> Am Montag, den 04.07.2016, 15:47 +0200 schrieb gabriel.fernandez at st.com:
>> From: Gabriel Fernandez <gabriel.fernandez@st.com>
>>
>> The STM32 MCUs family IPs can be reset by accessing some registers
>> from the RCC block.
>>
>> The list of available reset lines is documented in the DT bindings.
>>
>> Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
>> Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
>> ---
>> drivers/reset/Makefile | 1 +
>> drivers/reset/reset-stm32.c | 113 ++++++++++++++++++++++++++++++++++++++++++++
>> 2 files changed, 114 insertions(+)
>> create mode 100644 drivers/reset/reset-stm32.c
>>
>> diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
>> index 03dc1bb..3776b7b 100644
>> --- a/drivers/reset/Makefile
>> +++ b/drivers/reset/Makefile
>> @@ -4,6 +4,7 @@ obj-$(CONFIG_ARCH_SOCFPGA) += reset-socfpga.o
>> obj-$(CONFIG_ARCH_BERLIN) += reset-berlin.o
>> obj-$(CONFIG_MACH_PISTACHIO) += reset-pistachio.o
>> obj-$(CONFIG_ARCH_MESON) += reset-meson.o
>> +obj-$(CONFIG_ARCH_STM32) += reset-stm32.o
>> obj-$(CONFIG_ARCH_SUNXI) += reset-sunxi.o
>> obj-$(CONFIG_ARCH_STI) += sti/
>> obj-$(CONFIG_ARCH_HISI) += hisilicon/
>> diff --git a/drivers/reset/reset-stm32.c b/drivers/reset/reset-stm32.c
>> new file mode 100644
>> index 0000000..be42bff
>> --- /dev/null
>> +++ b/drivers/reset/reset-stm32.c
>> @@ -0,0 +1,113 @@
>> +/*
>> + * Copyright (C) Maxime Coquelin 2015
>> + * Author: Maxime Coquelin <mcoquelin.stm32@gmail.com>
>> + * License terms: GNU General Public License (GPL), version 2
>> + *
>> + * Heavily based on sunxi driver from Maxime Ripard.
>> + */
>> +
>> +#include <linux/err.h>
>> +#include <linux/io.h>
>> +#include <linux/module.h>
>> +#include <linux/of.h>
>> +#include <linux/of_address.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/reset-controller.h>
>> +#include <linux/slab.h>
>> +#include <linux/spinlock.h>
>> +#include <linux/types.h>
>> +
>> +struct stm32_reset_data {
>> + spinlock_t lock;
>> + void __iomem *membase;
>> + struct reset_controller_dev rcdev;
>> +};
>> +
>> +static int stm32_reset_assert(struct reset_controller_dev *rcdev,
>> + unsigned long id)
>> +{
>> + struct stm32_reset_data *data = container_of(rcdev,
>> + struct stm32_reset_data,
>> + rcdev);
>> + int bank = id / BITS_PER_LONG;
>> + int offset = id % BITS_PER_LONG;
>> + unsigned long flags;
>> + u32 reg;
>> +
>> + spin_lock_irqsave(&data->lock, flags);
>> +
>> + reg = readl_relaxed(data->membase + (bank * 4));
>> + writel_relaxed(reg | BIT(offset), data->membase + (bank * 4));
> Please also switch to the non-relaxed variants. It shouldn't make a
> difference here, and as Arnd points out, reduces the risk of new
> developers using readl/writel_relaxed without thinking about the
> consequences.
> Further, this will make the stm32, sunxi, and socfpga accessors look the
> same. I'd like to try and combine them after this is merged.
>
> regards
> Philipp
>
ok no problem, i will fix it.
Thanks
Gabriel
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 3/4] drivers: reset: Add STM32 reset driver
2016-07-05 13:29 ` Philipp Zabel
(?)
@ 2016-07-06 15:39 ` Gabriel Fernandez
-1 siblings, 0 replies; 44+ messages in thread
From: Gabriel Fernandez @ 2016-07-06 15:39 UTC (permalink / raw)
To: Philipp Zabel
Cc: Rob Herring, Mark Rutland, Maxime Coquelin, Russell King,
patrice.chotard, alexandre.torgue, devicetree, linux-arm-kernel,
linux-kernel
Hi Philipp
On 07/05/2016 03:29 PM, Philipp Zabel wrote:
> Am Dienstag, den 05.07.2016, 09:29 +0200 schrieb Gabriel Fernandez:
> [...]
>>>> +static const struct reset_control_ops stm32_reset_ops = {
>>>> + .assert = stm32_reset_assert,
>>>> + .deassert = stm32_reset_deassert,
>>> Are the registers not readable, or did you choose not to
>>> implement .status on purpose?
>> We choose to not implement.
> Ok. Because of size issues or just because you don't need them in any of
> your drivers?
Because i don't need them.
BR
Gabriel
>
> regards
> Philipp
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 3/4] drivers: reset: Add STM32 reset driver
@ 2016-07-06 15:39 ` Gabriel Fernandez
0 siblings, 0 replies; 44+ messages in thread
From: Gabriel Fernandez @ 2016-07-06 15:39 UTC (permalink / raw)
To: Philipp Zabel
Cc: Mark Rutland, devicetree, alexandre.torgue, linux-kernel,
Russell King, patrice.chotard, Rob Herring, Maxime Coquelin,
linux-arm-kernel
Hi Philipp
On 07/05/2016 03:29 PM, Philipp Zabel wrote:
> Am Dienstag, den 05.07.2016, 09:29 +0200 schrieb Gabriel Fernandez:
> [...]
>>>> +static const struct reset_control_ops stm32_reset_ops = {
>>>> + .assert = stm32_reset_assert,
>>>> + .deassert = stm32_reset_deassert,
>>> Are the registers not readable, or did you choose not to
>>> implement .status on purpose?
>> We choose to not implement.
> Ok. Because of size issues or just because you don't need them in any of
> your drivers?
Because i don't need them.
BR
Gabriel
>
> regards
> Philipp
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 3/4] drivers: reset: Add STM32 reset driver
@ 2016-07-06 15:39 ` Gabriel Fernandez
0 siblings, 0 replies; 44+ messages in thread
From: Gabriel Fernandez @ 2016-07-06 15:39 UTC (permalink / raw)
To: linux-arm-kernel
Hi Philipp
On 07/05/2016 03:29 PM, Philipp Zabel wrote:
> Am Dienstag, den 05.07.2016, 09:29 +0200 schrieb Gabriel Fernandez:
> [...]
>>>> +static const struct reset_control_ops stm32_reset_ops = {
>>>> + .assert = stm32_reset_assert,
>>>> + .deassert = stm32_reset_deassert,
>>> Are the registers not readable, or did you choose not to
>>> implement .status on purpose?
>> We choose to not implement.
> Ok. Because of size issues or just because you don't need them in any of
> your drivers?
Because i don't need them.
BR
Gabriel
>
> regards
> Philipp
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 3/4] drivers: reset: Add STM32 reset driver
@ 2016-07-06 15:43 ` Philipp Zabel
0 siblings, 0 replies; 44+ messages in thread
From: Philipp Zabel @ 2016-07-06 15:43 UTC (permalink / raw)
To: Gabriel Fernandez
Cc: Rob Herring, Mark Rutland, Maxime Coquelin, Russell King,
patrice.chotard, alexandre.torgue, devicetree, linux-arm-kernel,
linux-kernel
Am Mittwoch, den 06.07.2016, 17:39 +0200 schrieb Gabriel Fernandez:
> Hi Philipp
>
> On 07/05/2016 03:29 PM, Philipp Zabel wrote:
> > Am Dienstag, den 05.07.2016, 09:29 +0200 schrieb Gabriel Fernandez:
> > [...]
> >>>> +static const struct reset_control_ops stm32_reset_ops = {
> >>>> + .assert = stm32_reset_assert,
> >>>> + .deassert = stm32_reset_deassert,
> >>> Are the registers not readable, or did you choose not to
> >>> implement .status on purpose?
> >> We choose to not implement.
> > Ok. Because of size issues or just because you don't need them in any of
> > your drivers?
> Because i don't need them.
Ok, thanks for clarifying.
regards
Philipp
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 3/4] drivers: reset: Add STM32 reset driver
@ 2016-07-06 15:43 ` Philipp Zabel
0 siblings, 0 replies; 44+ messages in thread
From: Philipp Zabel @ 2016-07-06 15:43 UTC (permalink / raw)
To: Gabriel Fernandez
Cc: Rob Herring, Mark Rutland, Maxime Coquelin, Russell King,
patrice.chotard-qxv4g6HH51o, alexandre.torgue-qxv4g6HH51o,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Am Mittwoch, den 06.07.2016, 17:39 +0200 schrieb Gabriel Fernandez:
> Hi Philipp
>
> On 07/05/2016 03:29 PM, Philipp Zabel wrote:
> > Am Dienstag, den 05.07.2016, 09:29 +0200 schrieb Gabriel Fernandez:
> > [...]
> >>>> +static const struct reset_control_ops stm32_reset_ops = {
> >>>> + .assert = stm32_reset_assert,
> >>>> + .deassert = stm32_reset_deassert,
> >>> Are the registers not readable, or did you choose not to
> >>> implement .status on purpose?
> >> We choose to not implement.
> > Ok. Because of size issues or just because you don't need them in any of
> > your drivers?
> Because i don't need them.
Ok, thanks for clarifying.
regards
Philipp
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 3/4] drivers: reset: Add STM32 reset driver
@ 2016-07-06 15:43 ` Philipp Zabel
0 siblings, 0 replies; 44+ messages in thread
From: Philipp Zabel @ 2016-07-06 15:43 UTC (permalink / raw)
To: linux-arm-kernel
Am Mittwoch, den 06.07.2016, 17:39 +0200 schrieb Gabriel Fernandez:
> Hi Philipp
>
> On 07/05/2016 03:29 PM, Philipp Zabel wrote:
> > Am Dienstag, den 05.07.2016, 09:29 +0200 schrieb Gabriel Fernandez:
> > [...]
> >>>> +static const struct reset_control_ops stm32_reset_ops = {
> >>>> + .assert = stm32_reset_assert,
> >>>> + .deassert = stm32_reset_deassert,
> >>> Are the registers not readable, or did you choose not to
> >>> implement .status on purpose?
> >> We choose to not implement.
> > Ok. Because of size issues or just because you don't need them in any of
> > your drivers?
> Because i don't need them.
Ok, thanks for clarifying.
regards
Philipp
^ permalink raw reply [flat|nested] 44+ messages in thread
end of thread, other threads:[~2016-07-06 15:46 UTC | newest]
Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-04 13:47 [PATCH 1/4] dt-bindings: mfd: Add STM32F4 RCC numeric constants into DT include file gabriel.fernandez
2016-07-04 13:47 ` gabriel.fernandez at st.com
2016-07-04 13:47 ` gabriel.fernandez-qxv4g6HH51o
2016-07-04 13:47 ` [PATCH 2/4] dt-bindings: Document the STM32 reset bindings gabriel.fernandez
2016-07-04 13:47 ` gabriel.fernandez at st.com
2016-07-04 13:47 ` gabriel.fernandez-qxv4g6HH51o
2016-07-04 17:36 ` Philipp Zabel
2016-07-04 17:36 ` Philipp Zabel
2016-07-04 17:36 ` Philipp Zabel
2016-07-05 7:30 ` Gabriel Fernandez
2016-07-05 7:30 ` Gabriel Fernandez
2016-07-05 7:30 ` Gabriel Fernandez
2016-07-05 16:18 ` Rob Herring
2016-07-05 16:18 ` Rob Herring
2016-07-06 7:39 ` Gabriel Fernandez
2016-07-06 7:39 ` Gabriel Fernandez
2016-07-06 7:39 ` Gabriel Fernandez
2016-07-04 13:47 ` [PATCH 3/4] drivers: reset: Add STM32 reset driver gabriel.fernandez
2016-07-04 13:47 ` gabriel.fernandez at st.com
2016-07-04 13:47 ` gabriel.fernandez
2016-07-04 17:36 ` Philipp Zabel
2016-07-04 17:36 ` Philipp Zabel
2016-07-04 17:36 ` Philipp Zabel
2016-07-05 7:29 ` Gabriel Fernandez
2016-07-05 7:29 ` Gabriel Fernandez
2016-07-05 7:29 ` Gabriel Fernandez
2016-07-05 13:29 ` Philipp Zabel
2016-07-05 13:29 ` Philipp Zabel
2016-07-05 13:29 ` Philipp Zabel
2016-07-06 15:39 ` Gabriel Fernandez
2016-07-06 15:39 ` Gabriel Fernandez
2016-07-06 15:39 ` Gabriel Fernandez
2016-07-06 15:43 ` Philipp Zabel
2016-07-06 15:43 ` Philipp Zabel
2016-07-06 15:43 ` Philipp Zabel
2016-07-05 13:28 ` Philipp Zabel
2016-07-05 13:28 ` Philipp Zabel
2016-07-05 13:28 ` Philipp Zabel
2016-07-06 7:44 ` Gabriel Fernandez
2016-07-06 7:44 ` Gabriel Fernandez
2016-07-06 7:44 ` Gabriel Fernandez
2016-07-04 13:47 ` [PATCH 4/4] ARM: dts: stm32f429: add missing #reset-cells of rcc gabriel.fernandez
2016-07-04 13:47 ` gabriel.fernandez at st.com
2016-07-04 13:47 ` gabriel.fernandez-qxv4g6HH51o
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.