From be20fe159d000ca6d8ce0b7b10f8787d879490ab Mon Sep 17 00:00:00 2001 From: Gabriel Fernandez Date: Tue, 13 Dec 2016 15:20:00 +0100 Subject: [PATCH 01/12] clk: stm32f4: Update DT bindings documentation Creation of dt include file for specific stm32f4 clocks. These specific clocks are not derived from system clock (SYSCLOCK) We should use index 1 to use these clocks in DT. e.g. <&rcc 1 CLK_LSI> Signed-off-by: Gabriel Fernandez Acked-by: Rob Herring --- .../bindings/clock/st,stm32-rcc.txt | 17 ++++++++ include/dt-bindings/clock/stm32fx-clock.h | 39 +++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 include/dt-bindings/clock/stm32fx-clock.h diff --git a/Documentation/devicetree/bindings/clock/st,stm32-rcc.txt b/Documentation/devicetree/bindings/clock/st,stm32-rcc.txt index 0532d815dae3..8f19d87cbf24 100644 --- a/Documentation/devicetree/bindings/clock/st,stm32-rcc.txt +++ b/Documentation/devicetree/bindings/clock/st,stm32-rcc.txt @@ -17,6 +17,9 @@ Required properties: property, containing a phandle to the clock device node, an index selecting between gated clocks and other clocks and an index specifying the clock to use. +- clocks: External oscillator clock phandle + - high speed external clock signal (HSE) + - external I2S clock (I2S_CKIN) Example: @@ -25,6 +28,7 @@ Example: #clock-cells = <2> compatible = "st,stm32f42xx-rcc", "st,stm32-rcc"; reg = <0x40023800 0x400>; + clocks = <&clk_hse>, <&clk_i2s_ckin>; }; Specifying gated clocks @@ -66,6 +70,19 @@ The secondary index is bound with the following magic numbers: 0 SYSTICK 1 FCLK + 2 CLK_LSI (low-power clock source) + 3 CLK_LSE (generated from a 32.768 kHz low-speed external + crystal or ceramic resonator) + 4 CLK_HSE_RTC (HSE division factor for RTC clock) + 5 CLK_RTC (real-time clock) + 6 PLL_VCO_I2S (vco frequency of I2S pll) + 7 PLL_VCO_SAI (vco frequency of SAI pll) + 8 CLK_LCD (LCD-TFT) + 9 CLK_I2S (I2S clocks) + 10 CLK_SAI1 (audio clocks) + 11 CLK_SAI2 + 12 CLK_I2SQ_PDIV (post divisor of pll i2s q divisor) + 13 CLK_SAIQ_PDIV (post divisor of pll sai q divisor) Example: diff --git a/include/dt-bindings/clock/stm32fx-clock.h b/include/dt-bindings/clock/stm32fx-clock.h new file mode 100644 index 000000000000..08bcab61b714 --- /dev/null +++ b/include/dt-bindings/clock/stm32fx-clock.h @@ -0,0 +1,39 @@ +/* + * stm32fx-clock.h + * + * Copyright (C) 2016 STMicroelectronics + * Author: Gabriel Fernandez for STMicroelectronics. + * License terms: GNU General Public License (GPL), version 2 + */ + +/* + * List of clocks wich are not derived from system clock (SYSCLOCK) + * + * The index of these clocks is the secondary index of DT bindings + * (see Documentatoin/devicetree/bindings/clock/st,stm32-rcc.txt) + * + * e.g: + ; +*/ + +#ifndef _DT_BINDINGS_CLK_STMFX_H +#define _DT_BINDINGS_CLK_STMFX_H + +#define SYSTICK 0 +#define FCLK 1 +#define CLK_LSI 2 +#define CLK_LSE 3 +#define CLK_HSE_RTC 4 +#define CLK_RTC 5 +#define PLL_VCO_I2S 6 +#define PLL_VCO_SAI 7 +#define CLK_LCD 8 +#define CLK_I2S 9 +#define CLK_SAI1 10 +#define CLK_SAI2 11 +#define CLK_I2SQ_PDIV 12 +#define CLK_SAIQ_PDIV 13 + +#define END_PRIMARY_CLK 14 + +#endif From 6d6122c218c1ec809eb99c2f39a1d118050930b7 Mon Sep 17 00:00:00 2001 From: Bruno Herrera Date: Fri, 18 Nov 2016 15:58:00 +0100 Subject: [PATCH 02/12] ARM: dts: stm32: Fix memory size from 8MB to 16MB on stm32f469-disco board This patch fix memory size to support 16MB of external SDRAM. Signed-off-by: Bruno Herrera Signed-off-by: Alexandre TORGUE --- arch/arm/boot/dts/stm32f469-disco.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/stm32f469-disco.dts b/arch/arm/boot/dts/stm32f469-disco.dts index 8877c00ce8e8..5030decd5dac 100644 --- a/arch/arm/boot/dts/stm32f469-disco.dts +++ b/arch/arm/boot/dts/stm32f469-disco.dts @@ -58,7 +58,7 @@ chosen { }; memory { - reg = <0x00000000 0x800000>; + reg = <0x00000000 0x1000000>; }; aliases { From 6084ce05de366384929f55dadb509ec00fefedd3 Mon Sep 17 00:00:00 2001 From: Bruno Meirelles Herrera Date: Fri, 18 Nov 2016 16:10:00 +0100 Subject: [PATCH 03/12] ARM: dts: stm32: Add missing USART3 pin config to stm32f469-disco board This patch adds USART3 pin configuration on PB10/PA11 pins for STM32F469I-DISCO board. Signed-off-by: Bruno Herrera Signed-off-by: Alexandre TORGUE --- arch/arm/boot/dts/stm32f429.dtsi | 13 +++++++++++++ arch/arm/boot/dts/stm32f469-disco.dts | 2 ++ 2 files changed, 15 insertions(+) diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi index e4dae0eda3cd..1b8b1057d4cb 100644 --- a/arch/arm/boot/dts/stm32f429.dtsi +++ b/arch/arm/boot/dts/stm32f429.dtsi @@ -316,6 +316,19 @@ pins2 { }; }; + usart3_pins_a: usart3@0 { + pins1 { + pinmux = ; + bias-disable; + drive-push-pull; + slew-rate = <0>; + }; + pins2 { + pinmux = ; + bias-disable; + }; + }; + usbotg_hs_pins_a: usbotg_hs@0 { pins { pinmux = , diff --git a/arch/arm/boot/dts/stm32f469-disco.dts b/arch/arm/boot/dts/stm32f469-disco.dts index 5030decd5dac..fda12a466320 100644 --- a/arch/arm/boot/dts/stm32f469-disco.dts +++ b/arch/arm/boot/dts/stm32f469-disco.dts @@ -79,5 +79,7 @@ &clk_hse { }; &usart3 { + pinctrl-0 = <&usart3_pins_a>; + pinctrl-names = "default"; status = "okay"; }; From 3604ef9c8154d25908edde6afc664e54ab754fab Mon Sep 17 00:00:00 2001 From: Fabrice GASNIER Date: Fri, 2 Dec 2016 14:57:00 +0100 Subject: [PATCH 04/12] ARM: dts: stm32: Add ADC support to stm32f429 Add ADC support & pinctrl analog phandle (adc3_in8) to stm32f429. Signed-off-by: Fabrice Gasnier Signed-off-by: Alexandre TORGUE --- arch/arm/boot/dts/stm32f429.dtsi | 49 ++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi index 1b8b1057d4cb..77055aa2f2f2 100644 --- a/arch/arm/boot/dts/stm32f429.dtsi +++ b/arch/arm/boot/dts/stm32f429.dtsi @@ -188,6 +188,49 @@ usart6: serial@40011400 { status = "disabled"; }; + adc: adc@40012000 { + compatible = "st,stm32f4-adc-core"; + reg = <0x40012000 0x400>; + interrupts = <18>; + clocks = <&rcc 0 168>; + clock-names = "adc"; + interrupt-controller; + #interrupt-cells = <1>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + + adc1: adc@0 { + compatible = "st,stm32f4-adc"; + #io-channel-cells = <1>; + reg = <0x0>; + clocks = <&rcc 0 168>; + interrupt-parent = <&adc>; + interrupts = <0>; + status = "disabled"; + }; + + adc2: adc@100 { + compatible = "st,stm32f4-adc"; + #io-channel-cells = <1>; + reg = <0x100>; + clocks = <&rcc 0 169>; + interrupt-parent = <&adc>; + interrupts = <1>; + status = "disabled"; + }; + + adc3: adc@200 { + compatible = "st,stm32f4-adc"; + #io-channel-cells = <1>; + reg = <0x200>; + clocks = <&rcc 0 170>; + interrupt-parent = <&adc>; + interrupts = <2>; + status = "disabled"; + }; + }; + syscfg: system-config@40013800 { compatible = "syscon"; reg = <0x40013800 0x400>; @@ -368,6 +411,12 @@ pins { slew-rate = <2>; }; }; + + adc3_in8_pin: adc@200 { + pins { + pinmux = ; + }; + }; }; rcc: rcc@40023810 { From 0bacd39be9d433bbbfee3fbb1dcf53cc8cf8f0e3 Mon Sep 17 00:00:00 2001 From: Fabrice GASNIER Date: Mon, 9 Jan 2017 14:08:32 +0100 Subject: [PATCH 05/12] ARM: dts: stm32: enable ADC on stm32f429i-eval board Enable analog to digital converter on stm32f429i-eval board. It has on-board potentimeter wired to ADC3 in8 analog pin and uses fixed regulator to provide reference voltage. Signed-off-by: Fabrice Gasnier Signed-off-by: Alexandre TORGUE --- arch/arm/boot/dts/stm32429i-eval.dts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/arch/arm/boot/dts/stm32429i-eval.dts b/arch/arm/boot/dts/stm32429i-eval.dts index 5436e880e28f..21812207dcfa 100644 --- a/arch/arm/boot/dts/stm32429i-eval.dts +++ b/arch/arm/boot/dts/stm32429i-eval.dts @@ -70,6 +70,20 @@ soc { dma-ranges = <0xc0000000 0x0 0x10000000>; }; + regulators { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <0>; + + reg_vref: regulator@0 { + compatible = "regulator-fixed"; + reg = <0>; + regulator-name = "vref"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; + }; + leds { compatible = "gpio-leds"; green { @@ -112,6 +126,17 @@ usbotg_hs_phy: usbphy { }; }; +&adc { + pinctrl-names = "default"; + pinctrl-0 = <&adc3_in8_pin>; + vref-supply = <®_vref>; + status = "okay"; + adc3: adc@200 { + st,adc-channels = <8>; + status = "okay"; + }; +}; + &clk_hse { clock-frequency = <25000000>; }; From c22188d40b7b17c7cb892dfe0920278b0ecb004a Mon Sep 17 00:00:00 2001 From: Gabriel Fernandez Date: Tue, 13 Dec 2016 15:20:00 +0100 Subject: [PATCH 06/12] ARM: dts: stm32: Add external I2S clock on stm32f429 MCU This patch adds an external I2S clock in the DT. The I2S clock could be derived from an external I2S clock or by I2S pll. Signed-off-by: Gabriel Fernandez Signed-off-by: Alexandre TORGUE --- arch/arm/boot/dts/stm32f429.dtsi | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi index 77055aa2f2f2..a92c80914768 100644 --- a/arch/arm/boot/dts/stm32f429.dtsi +++ b/arch/arm/boot/dts/stm32f429.dtsi @@ -68,6 +68,12 @@ clk-lsi { compatible = "fixed-clock"; clock-frequency = <32000>; }; + + clk_i2s_ckin: i2s-ckin { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-frequency = <0>; + }; }; soc { @@ -424,7 +430,7 @@ rcc: rcc@40023810 { #clock-cells = <2>; compatible = "st,stm32f42xx-rcc", "st,stm32-rcc"; reg = <0x40023800 0x400>; - clocks = <&clk_hse>; + clocks = <&clk_hse>, <&clk_i2s_ckin>; st,syscfg = <&pwrcfg>; }; From cb5e497c0eafa6c593934f725bf48742f0e472b0 Mon Sep 17 00:00:00 2001 From: Gabriel Fernandez Date: Tue, 13 Dec 2016 15:20:00 +0100 Subject: [PATCH 07/12] ARM: dts: stm32: Include auxiliary stm32fx clock definition This patch include auxiliary clock definition (clocks which are not derived from system clock. Signed-off-by: Gabriel Fernandez Signed-off-by: Alexandre TORGUE --- 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 a92c80914768..e9324a390ac7 100644 --- a/arch/arm/boot/dts/stm32f429.dtsi +++ b/arch/arm/boot/dts/stm32f429.dtsi @@ -48,6 +48,7 @@ #include "skeleton.dtsi" #include "armv7-m.dtsi" #include +#include / { clocks { From 8b9f4efd47a9ab75bb988944d5d784abba061224 Mon Sep 17 00:00:00 2001 From: Amelie Delaunay Date: Mon, 16 Jan 2017 14:29:00 +0100 Subject: [PATCH 08/12] ARM: dts: stm32: set HSE_RTC clock frequency to 1 MHz on stm32f429 This patch set HSE_RTC clock frequency to 1 MHz, as the clock supplied to the RTC must be 1 MHz. Signed-off-by: Amelie Delaunay Signed-off-by: Alexandre TORGUE --- arch/arm/boot/dts/stm32f429.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi index e9324a390ac7..557c1f482937 100644 --- a/arch/arm/boot/dts/stm32f429.dtsi +++ b/arch/arm/boot/dts/stm32f429.dtsi @@ -433,6 +433,8 @@ rcc: rcc@40023810 { reg = <0x40023800 0x400>; clocks = <&clk_hse>, <&clk_i2s_ckin>; st,syscfg = <&pwrcfg>; + assigned-clocks = <&rcc 1 CLK_HSE_RTC>; + assigned-clock-rates = <1000000>; }; dma1: dma-controller@40026000 { From dd3feb755a4ac28f89913512c1ac1beab470391f Mon Sep 17 00:00:00 2001 From: Amelie Delaunay Date: Mon, 16 Jan 2017 14:29:00 +0100 Subject: [PATCH 09/12] ARM: dts: stm32: Add RTC support for STM32F429 MCU This patch adds STM32 RTC bindings for STM32F429. Signed-off-by: Amelie Delaunay Signed-off-by: Alexandre TORGUE --- arch/arm/boot/dts/stm32f429.dtsi | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi index 557c1f482937..f05a9d95ef23 100644 --- a/arch/arm/boot/dts/stm32f429.dtsi +++ b/arch/arm/boot/dts/stm32f429.dtsi @@ -125,6 +125,20 @@ timer7: timer@40001400 { status = "disabled"; }; + rtc: rtc@40002800 { + compatible = "st,stm32-rtc"; + reg = <0x40002800 0x400>; + clocks = <&rcc 1 CLK_RTC>; + clock-names = "ck_rtc"; + assigned-clocks = <&rcc 1 CLK_RTC>; + assigned-clock-parents = <&rcc 1 CLK_LSE>; + interrupt-parent = <&exti>; + interrupts = <17 1>; + interrupt-names = "alarm"; + st,syscfg = <&pwrcfg>; + status = "disabled"; + }; + usart2: serial@40004400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004400 0x400>; From e1d27cca79016aaa0ebfe6b6c3a1e73251a21038 Mon Sep 17 00:00:00 2001 From: Amelie Delaunay Date: Mon, 16 Jan 2017 14:29:00 +0100 Subject: [PATCH 10/12] ARM: dts: stm32: enable RTC on stm32f429-disco This patch enables RTC on stm32f429-disco with LSI as clock source because X2 crystal for LSE is not fitted by default. Signed-off-by: Amelie Delaunay Signed-off-by: Alexandre TORGUE --- arch/arm/boot/dts/stm32f429-disco.dts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/stm32f429-disco.dts b/arch/arm/boot/dts/stm32f429-disco.dts index 7d0415e80668..9222b9f37bc0 100644 --- a/arch/arm/boot/dts/stm32f429-disco.dts +++ b/arch/arm/boot/dts/stm32f429-disco.dts @@ -94,6 +94,12 @@ &clk_hse { clock-frequency = <8000000>; }; +&rtc { + assigned-clocks = <&rcc 1 CLK_RTC>; + assigned-clock-parents = <&rcc 1 CLK_LSI>; + status = "okay"; +}; + &usart1 { pinctrl-0 = <&usart1_pins_a>; pinctrl-names = "default"; From d1b89100fe2e1852e43687592ebf583fd59bbe32 Mon Sep 17 00:00:00 2001 From: Amelie Delaunay Date: Mon, 16 Jan 2017 14:29:00 +0100 Subject: [PATCH 11/12] ARM: dts: stm32: enable RTC on stm32f469-disco This patch enables RTC on stm32f469-disco with default LSE clock source. Signed-off-by: Amelie Delaunay Signed-off-by: Alexandre TORGUE --- arch/arm/boot/dts/stm32f469-disco.dts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/boot/dts/stm32f469-disco.dts b/arch/arm/boot/dts/stm32f469-disco.dts index fda12a466320..f52b9f6cf566 100644 --- a/arch/arm/boot/dts/stm32f469-disco.dts +++ b/arch/arm/boot/dts/stm32f469-disco.dts @@ -78,6 +78,10 @@ &clk_hse { clock-frequency = <8000000>; }; +&rtc { + status = "okay"; +}; + &usart3 { pinctrl-0 = <&usart3_pins_a>; pinctrl-names = "default"; From d99c66406a846748e26989759caa7e966c1804dd Mon Sep 17 00:00:00 2001 From: Amelie Delaunay Date: Mon, 16 Jan 2017 14:29:00 +0100 Subject: [PATCH 12/12] ARM: dts: stm32: enable RTC on stm32429i-eval This patch enables RTC on stm32429i-eval with default LSE clock source. Signed-off-by: Amelie Delaunay Signed-off-by: Alexandre TORGUE --- arch/arm/boot/dts/stm32429i-eval.dts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/boot/dts/stm32429i-eval.dts b/arch/arm/boot/dts/stm32429i-eval.dts index 21812207dcfa..eedb27d33f66 100644 --- a/arch/arm/boot/dts/stm32429i-eval.dts +++ b/arch/arm/boot/dts/stm32429i-eval.dts @@ -157,6 +157,10 @@ phy1: ethernet-phy@1 { }; }; +&rtc { + status = "okay"; +}; + &usart1 { pinctrl-0 = <&usart1_pins_a>; pinctrl-names = "default";