Skip to contentSkip to conversation

Add support for STM32 ADC

PATCH New Fabrice Gasnier 4 participants 17 messages Jul 24, 2018 – Aug 6, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover Add support for STM32 ADC

This series adds support for STM32 Analog to Digital Converter. STM32 ADC support is originally based on Linux kernel v4.18-rcs:
- First two patches brings some changes in clk and adc uclass
- Next two patches add STM32 ADC dt-bindings and driver for STM32MP1 and STM32H7
- Last patches add config and DT on stm32mp15

Changes in v2:
- add test case for 'clk_valid()', e.g. in test/dm/clk.c and sandbox.
- Update TRUE/FALSE comments to lower case: true/false
- move device_get_supply_regulator() call to pre_probe() routine

Fabrice Gasnier (6):
clk: add clk_valid()
dm: adc: uclass: get reference regulator once
dt-bindings: Document STM32 ADC DT bindings
adc: Add driver for STM32 ADC
configs: stm32mp15: enable ADC
ARM: dts: stm32mp157: Add ADC DT node

 arch/arm/dts/stm32mp157.dtsi                  |  32 ++++
 arch/sandbox/include/asm/clk.h                |   8 +
 configs/stm32mp15_basic_defconfig             |   3 +-
 doc/device-tree-bindings/adc/st,stm32-adc.txt | 141 ++++++++++++++
 drivers/adc/Kconfig                           |  16 ++
 drivers/adc/Makefile                          |   1 +
 drivers/adc/adc-uclass.c                      |  35 ++--
 drivers/adc/stm32-adc-core.c                  | 209 +++++++++++++++++++++
 drivers/adc/stm32-adc-core.h                  |  51 +++++
 drivers/adc/stm32-adc.c                       | 257 ++++++++++++++++++++++++++
 drivers/clk/clk_sandbox_test.c                |  13 ++
 include/clk.h                                 |  10 +
 test/dm/clk.c                                 |   1 +
 13 files changed, 758 insertions(+), 19 deletions(-)
 create mode 100644 doc/device-tree-bindings/adc/st,stm32-adc.txt
 create mode 100644 drivers/adc/stm32-adc-core.c
 create mode 100644 drivers/adc/stm32-adc-core.h
 create mode 100644 drivers/adc/stm32-adc.c
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/6 clk: add clk_valid()

Add clk_valid() to check for optional clocks are valid. Call clk_valid() in test/dm/clk.c and add relevant test routine to sandbox clk tests.

---

Changes in v2:
- add test case for 'clk_valid()', e.g. in test/dm/clk.c and sandbox.
- Update TRUE/FALSE comments to lower case: true/false

---
 arch/sandbox/include/asm/clk.h |  8 ++++++++
 drivers/clk/clk_sandbox_test.c | 13 +++++++++++++
 include/clk.h                  | 10 ++++++++++
 test/dm/clk.c                  |  1 +
 4 files changed, 32 insertions(+)
arch/sandbox/include/asm/clk.h +8 -0
index d85cbad..2b1c49f 100644
@@ -138,5 +138,13 @@ int sandbox_clk_test_free(struct udevice *dev);
  * @return:	0 if OK, or a negative error code.
  */
 int sandbox_clk_test_release_bulk(struct udevice *dev);
+/**
+ * sandbox_clk_test_valid - Ask the sandbox clock test device to check its
+ * clocks are valid.
+ *
+ * @dev:	The sandbox clock test (client) devivce.
+ * @return:	0 if OK, or a negative error code.
+ */
+int sandbox_clk_test_valid(struct udevice *dev);
 
 #endif
drivers/clk/clk_sandbox_test.c +13 -0
index 8cd4abb..e8465db 100644
@@ -116,6 +116,19 @@ int sandbox_clk_test_release_bulk(struct udevice *dev)
 	return clk_release_bulk(&sbct->bulk);
 }
 
+int sandbox_clk_test_valid(struct udevice *dev)
+{
+	struct sandbox_clk_test *sbct = dev_get_priv(dev);
+	int i;
+
+	for (i = 0; i < SANDBOX_CLK_TEST_ID_COUNT; i++) {
+		if (!clk_valid(&sbct->clks[i]))
+			return -EINVAL;
+	}
+
+	return 0;
+}
+
 static const struct udevice_id sandbox_clk_test_ids[] = {
 	{ .compatible = "sandbox,clk-test" },
 	{ }
include/clk.h +10 -0
index 9a35764..f6d1cc5 100644
@@ -294,4 +294,14 @@ int clk_disable_bulk(struct clk_bulk *bulk);
 
 int soc_clk_dump(void);
 
+/**
+ * clk_valid() - check if clk is valid
+ *
+ * @clk:	the clock to check
+ * @return true if valid, or false
+ */
+static inline bool clk_valid(struct clk *clk)
+{
+	return !!clk->dev;
+}
 #endif
test/dm/clk.c +1 -0
index b06906a..898c034 100644
@@ -28,6 +28,7 @@ static int dm_test_clk(struct unit_test_state *uts)
 	ut_assertok(uclass_get_device_by_name(UCLASS_MISC, "clk-test",
 					      &dev_test));
 	ut_assertok(sandbox_clk_test_get(dev_test));
+	ut_assertok(sandbox_clk_test_valid(dev_test));
 
 	ut_asserteq(1234,
 		    sandbox_clk_test_get_rate(dev_test,
Signature · 1 line
1.9.1
#2 lore raw

PATCH v2 1/6 clk: add clk_valid()

Quoted 11 lines · Fabrice Gasnier

Add clk_valid() to check for optional clocks are valid. Call clk_valid() in test/dm/clk.c and add relevant test routine to sandbox clk tests.

---

Changes in v2:
- add test case for 'clk_valid()', e.g. in test/dm/clk.c and sandbox.
- Update TRUE/FALSE comments to lower case: true/false

Quoted 6 lines
---
 arch/sandbox/include/asm/clk.h |  8 ++++++++
 drivers/clk/clk_sandbox_test.c | 13 +++++++++++++
 include/clk.h                  | 10 ++++++++++
 test/dm/clk.c                  |  1 +
 4 files changed, 32 insertions(+)
#3 lore raw

PATCH v2 1/6 clk: add clk_valid()

In reply to Fabrice Gasnier
Quoted 6 lines · Fabrice Gasnier

Add clk_valid() to check for optional clocks are valid. Call clk_valid() in test/dm/clk.c and add relevant test routine to sandbox clk tests.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180804/6ea94d16/attachment.sig>
#4 lore raw

PATCH v2 2/6 dm: adc: uclass: get reference regulator once

In reply to Fabrice Gasnier

device_get_supply_regulator() only needs to be called once. But each time there's call to adc_vxx_value() for instance, it calls adc_vxx_platdata_update() -> device_get_supply_regulator().

So, move device_get_supply_regulator() to pre_probe() routine.

This also allows vdd_supply/vss_supply to be provided directly from uc_pdata, e.g dt-binding variant like stm32-adc provide its own 'vref-supply'.

---

Changes in v2:
- move device_get_supply_regulator() call to pre_probe() routine

---
 drivers/adc/adc-uclass.c | 35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)
drivers/adc/adc-uclass.c +17 -18
index 17c1a4e..738c1ea 100644
@@ -264,10 +264,8 @@ static int adc_vdd_platdata_update(struct udevice *dev)
 	 * will bind before its supply regulator device, then the below 'get'
 	 * will return an error.
 	 */
-	ret = device_get_supply_regulator(dev, "vdd-supply",
-					  &uc_pdata->vdd_supply);
-	if (ret)
-		return ret;
+	if (!uc_pdata->vdd_supply)
+		return 0;
 
 	ret = regulator_get_value(uc_pdata->vdd_supply);
 	if (ret < 0)
@@ -283,10 +281,8 @@ static int adc_vss_platdata_update(struct udevice *dev)
 	struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev);
 	int ret;
 
-	ret = device_get_supply_regulator(dev, "vss-supply",
-					  &uc_pdata->vss_supply);
-	if (ret)
-		return ret;
+	if (!uc_pdata->vss_supply)
+		return 0;
 
 	ret = regulator_get_value(uc_pdata->vss_supply);
 	if (ret < 0)
@@ -302,14 +298,11 @@ int adc_vdd_value(struct udevice *dev, int *uV)
 	struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev);
 	int ret, value_sign = uc_pdata->vdd_polarity_negative ? -1 : 1;
 
-	if (!uc_pdata->vdd_supply)
-		goto nodev;
-
 	/* Update the regulator Value. */
 	ret = adc_vdd_platdata_update(dev);
 	if (ret)
 		return ret;
-nodev:
+
 	if (uc_pdata->vdd_microvolts == -ENODATA)
 		return -ENODATA;
 
@@ -323,14 +316,11 @@ int adc_vss_value(struct udevice *dev, int *uV)
 	struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev);
 	int ret, value_sign = uc_pdata->vss_polarity_negative ? -1 : 1;
 
-	if (!uc_pdata->vss_supply)
-		goto nodev;
-
 	/* Update the regulator Value. */
 	ret = adc_vss_platdata_update(dev);
 	if (ret)
 		return ret;
-nodev:
+
 	if (uc_pdata->vss_microvolts == -ENODATA)
 		return -ENODATA;
 
@@ -348,7 +338,12 @@ static int adc_vdd_platdata_set(struct udevice *dev)
 	prop = "vdd-polarity-negative";
 	uc_pdata->vdd_polarity_negative = dev_read_bool(dev, prop);
 
-	ret = adc_vdd_platdata_update(dev);
+	/* Optionally get regulators */
+	ret = device_get_supply_regulator(dev, "vdd-supply",
+					  &uc_pdata->vdd_supply);
+	if (!ret)
+		return adc_vdd_platdata_update(dev);
+
 	if (ret != -ENOENT)
 		return ret;
 
@@ -368,7 +363,11 @@ static int adc_vss_platdata_set(struct udevice *dev)
 	prop = "vss-polarity-negative";
 	uc_pdata->vss_polarity_negative = dev_read_bool(dev, prop);
 
-	ret = adc_vss_platdata_update(dev);
+	ret = device_get_supply_regulator(dev, "vss-supply",
+					  &uc_pdata->vss_supply);
+	if (!ret)
+		return adc_vss_platdata_update(dev);
+
 	if (ret != -ENOENT)
 		return ret;
 
Signature · 1 line
1.9.1
#5 lore raw

PATCH v2 2/6 dm: adc: uclass: get reference regulator once

Quoted 11 lines · Fabrice Gasnier

device_get_supply_regulator() only needs to be called once. But each time there's call to adc_vxx_value() for instance, it calls adc_vxx_platdata_update() -> device_get_supply_regulator().

So, move device_get_supply_regulator() to pre_probe() routine.

This also allows vdd_supply/vss_supply to be provided directly from uc_pdata, e.g dt-binding variant like stm32-adc provide its own 'vref-supply'.

Quoted 8 lines

---

Changes in v2:
- move device_get_supply_regulator() call to pre_probe() routine

---
 drivers/adc/adc-uclass.c | 35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)

I think this looks right.

#6 lore raw

PATCH v2 2/6 dm: adc: uclass: get reference regulator once

In reply to Fabrice Gasnier
Quoted 4 lines · Fabrice Gasnier

device_get_supply_regulator() only needs to be called once. But each time there's call to adc_vxx_value() for instance, it calls adc_vxx_platdata_update() -> device_get_supply_regulator().

Quoted 8 lines

So, move device_get_supply_regulator() to pre_probe() routine.

This also allows vdd_supply/vss_supply to be provided directly from uc_pdata, e.g dt-binding variant like stm32-adc provide its own 'vref-supply'.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180804/3178779b/attachment.sig>
#7 lore raw

PATCH v2 3/6 dt-bindings: Document STM32 ADC DT bindings

In reply to Fabrice Gasnier

This patch adds documentation of device tree bindings for the STM32 ADC. It's based on linux-v4.18-rc* dt-bindings, at the time of writing:
- Documentation/devicetree/bindings/iio/adc/st,stm32-adc.txt

---

Changes in v2: None

 doc/device-tree-bindings/adc/st,stm32-adc.txt | 141 ++++++++++++++++++++++++++
 1 file changed, 141 insertions(+)
 create mode 100644 doc/device-tree-bindings/adc/st,stm32-adc.txt
doc/device-tree-bindings/adc/st,stm32-adc.txt new file +141 -0
new file mode 100644
index 0000000..07fb6cd
@@ -0,0 +1,141 @@
+STMicroelectronics STM32 ADC device
+
+STM32 ADC is a successive approximation analog-to-digital converter.
+It has several multiplexed input channels. Conversions can be performed
+in single, continuous, scan or discontinuous mode. Result of the ADC is
+stored in a left-aligned or right-aligned 32-bit data register.
+Conversions can be launched in software or using hardware triggers.
+
+The analog watchdog feature allows the application to detect if the input
+voltage goes beyond the user-defined, higher or lower thresholds.
+
+Each STM32 ADC block can have up to 3 ADC instances.
+
+Each instance supports two contexts to manage conversions, each one has its
+own configurable sequence and trigger:
+- regular conversion can be done in sequence, running in background
+- injected conversions have higher priority, and so have the ability to
+  interrupt regular conversion sequence (either triggered in SW or HW).
+  Regular sequence is resumed, in case it has been interrupted.
+
+Contents of a stm32 adc root node:
+-----------------------------------
+Required properties:
+- compatible: Should be one of:
+  "st,stm32f4-adc-core"
+  "st,stm32h7-adc-core"
+  "st,stm32mp1-adc-core"
+- reg: Offset and length of the ADC block register set.
+- interrupts: One or more interrupts for ADC block. Some parts like stm32f4
+  and stm32h7 share a common ADC interrupt line. stm32mp1 has two separate
+  interrupt lines, one for each ADC within ADC block.
+- clocks: Core can use up to two clocks, depending on part used:
+  - "adc" clock: for the analog circuitry, common to all ADCs.
+    It's required on stm32f4.
+    It's optional on stm32h7.
+  - "bus" clock: for registers access, common to all ADCs.
+    It's not present on stm32f4.
+    It's required on stm32h7.
+- clock-names: Must be "adc" and/or "bus" depending on part used.
+- interrupt-controller: Identifies the controller node as interrupt-parent
+- vref-supply: Phandle to the vref input analog reference voltage.
+- #interrupt-cells = <1>;
+- #address-cells = <1>;
+- #size-cells = <0>;
+
+Optional properties:
+- A pinctrl state named "default" for each ADC channel may be defined to set
+  inX ADC pins in mode of operation for analog input on external pin.
+
+Contents of a stm32 adc child node:
+-----------------------------------
+An ADC block node should contain at least one subnode, representing an
+ADC instance available on the machine.
+
+Required properties:
+- compatible: Should be one of:
+  "st,stm32f4-adc"
+  "st,stm32h7-adc"
+  "st,stm32mp1-adc"
+- reg: Offset of ADC instance in ADC block (e.g. may be 0x0, 0x100, 0x200).
+- clocks: Input clock private to this ADC instance. It's required only on
+  stm32f4, that has per instance clock input for registers access.
+- interrupt-parent: Phandle to the parent interrupt controller.
+- interrupts: IRQ Line for the ADC (e.g. may be 0 for adc at 0, 1 for adc at 100 or
+  2 for adc at 200).
+- st,adc-channels: List of single-ended channels muxed for this ADC.
+  It can have up to 16 channels on stm32f4 or 20 channels on stm32h7, numbered
+  from 0 to 15 or 19 (resp. for in0..in15 or in0..in19).
+- st,adc-diff-channels: List of differential channels muxed for this ADC.
+  Depending on part used, some channels can be configured as differential
+  instead of single-ended (e.g. stm32h7). List here positive and negative
+  inputs pairs as <vinp vinn>, <vinp vinn>,... vinp and vinn are numbered
+  from 0 to 19 on stm32h7)
+  Note: At least one of "st,adc-channels" or "st,adc-diff-channels" is required.
+  Both properties can be used together. Some channels can be used as
+  single-ended and some other ones as differential (mixed). But channels
+  can't be configured both as single-ended and differential (invalid).
+- #io-channel-cells = <1>: See the IIO bindings section "IIO consumers" in
+  Documentation/devicetree/bindings/iio/iio-bindings.txt
+
+Optional properties:
+- dmas: Phandle to dma channel for this ADC instance.
+  See ../../dma/dma.txt for details.
+- dma-names: Must be "rx" when dmas property is being used.
+- assigned-resolution-bits: Resolution (bits) to use for conversions. Must
+  match device available resolutions:
+  * can be 6, 8, 10 or 12 on stm32f4
+  * can be 8, 10, 12, 14 or 16 on stm32h7
+  Default is maximum resolution if unset.
+- st,min-sample-time-nsecs: Minimum sampling time in nanoseconds.
+  Depending on hardware (board) e.g. high/low analog input source impedance,
+  fine tune of ADC sampling time may be recommended.
+  This can be either one value or an array that matches 'st,adc-channels' list,
+  to set sample time resp. for all channels, or independently for each channel.
+
+Example:
+	adc: adc at 40012000 {
+		compatible = "st,stm32f4-adc-core";
+		reg = <0x40012000 0x400>;
+		interrupts = <18>;
+		clocks = <&rcc 0 168>;
+		clock-names = "adc";
+		vref-supply = <&reg_vref>;
+		interrupt-controller;
+		pinctrl-names = "default";
+		pinctrl-0 = <&adc3_in8_pin>;
+
+		#interrupt-cells = <1>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		adc at 0 {
+			compatible = "st,stm32f4-adc";
+			#io-channel-cells = <1>;
+			reg = <0x0>;
+			clocks = <&rcc 0 168>;
+			interrupt-parent = <&adc>;
+			interrupts = <0>;
+			st,adc-channels = <8>;
+			dmas = <&dma2 0 0 0x400 0x0>;
+			dma-names = "rx";
+			assigned-resolution-bits = <8>;
+		};
+		...
+		other adc child nodes follow...
+	};
+
+Example to setup:
+- channel 1 as single-ended
+- channels 2 & 3 as differential (with resp. 6 & 7 negative inputs)
+
+	adc: adc at 40022000 {
+		compatible = "st,stm32h7-adc-core";
+		...
+		adc1: adc at 0 {
+			compatible = "st,stm32h7-adc";
+			...
+			st,adc-channels = <1>;
+			st,adc-diff-channels = <2 6>, <3 7>;
+		};
+	};
Signature · 1 line
1.9.1
#8 lore raw

PATCH v2 3/6 dt-bindings: Document STM32 ADC DT bindings

Quoted 6 lines · Fabrice Gasnier

This patch adds documentation of device tree bindings for the STM32 ADC. It's based on linux-v4.18-rc* dt-bindings, at the time of writing:
- Documentation/devicetree/bindings/iio/adc/st,stm32-adc.txt

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180804/520a3a56/attachment.sig>
#9 lore raw

PATCH v2 4/6 adc: Add driver for STM32 ADC

In reply to Fabrice Gasnier

This patch adds support for STMicroelectronics STM32 ADC (analog to digital converter). It's originally based on Linux kernel v4.18-rcs drivers/iio/adc/stm32-adc*. It's composed of:
- core driver (UCLASS_SIMPLE_BUS) manages common resources (clk, regu).
- child drivers (UCLASS_ADC) declare each ADC, channels and handle conversions.
This driver currently supports STM32H7 and STM32MP1 ADC.

---

Changes in v2: None

 drivers/adc/Kconfig          |  16 +++
 drivers/adc/Makefile         |   1 +
 drivers/adc/stm32-adc-core.c | 209 +++++++++++++++++++++++++++++++++++
 drivers/adc/stm32-adc-core.h |  51 +++++++++
 drivers/adc/stm32-adc.c      | 257 +++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 534 insertions(+)
 create mode 100644 drivers/adc/stm32-adc-core.c
 create mode 100644 drivers/adc/stm32-adc-core.h
 create mode 100644 drivers/adc/stm32-adc.c
drivers/adc/Kconfig +16 -0
index 93e27f1..e719c38 100644
@@ -47,3 +47,19 @@ config SARADC_ROCKCHIP
 	  - 2~6 analog input channels
 	  - 1O or 12 bits resolution
 	  - Up to 1MSPS of sample rate
+
+config STM32_ADC
+	bool "Enable STMicroelectronics STM32 ADC driver"
+	depends on ADC && (STM32H7 || ARCH_STM32MP)
+	help
+	  This enables driver for STMicroelectronics STM32 analog-to-digital
+	  converter (ADC).
+	  A STM32 ADC block can be composed of several individual ADCs.
+	  Each has its own private registers, but shares some resources:
+	  - clock selection and prescaler
+	  - voltage reference
+	  - common registers area.
+	  STM32 ADC driver is composed of:
+	  - core driver to deal with common resources
+	  - child driver to deal with individual ADC resources (declare ADC
+	  device and associated channels, start/stop conversions)
drivers/adc/Makefile +1 -0
index 95c93d4..cca0fec 100644
@@ -10,3 +10,4 @@ obj-$(CONFIG_ADC_EXYNOS) += exynos-adc.o
 obj-$(CONFIG_ADC_SANDBOX) += sandbox.o
 obj-$(CONFIG_SARADC_ROCKCHIP) += rockchip-saradc.o
 obj-$(CONFIG_SARADC_MESON) += meson-saradc.o
+obj-$(CONFIG_STM32_ADC) += stm32-adc.o stm32-adc-core.o
drivers/adc/stm32-adc-core.c new file +209 -0

209 lines not on this page · raw message

drivers/adc/stm32-adc-core.h new file +51 -0

51 lines not on this page · raw message

drivers/adc/stm32-adc.c new file +257 -0

257 lines not on this page · raw message

Signature · 1 line
1.9.1
#10 lore raw

PATCH v2 4/6 adc: Add driver for STM32 ADC

Quoted 10 lines · Fabrice Gasnier

This patch adds support for STMicroelectronics STM32 ADC (analog to digital converter). It's originally based on Linux kernel v4.18-rcs drivers/iio/adc/stm32-adc*. It's composed of:
- core driver (UCLASS_SIMPLE_BUS) manages common resources (clk, regu).
- child drivers (UCLASS_ADC) declare each ADC, channels and handle conversions.
This driver currently supports STM32H7 and STM32MP1 ADC.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180804/58839deb/attachment.sig>
#11 lore raw

PATCH v2 5/6 configs: stm32mp15: enable ADC

In reply to Fabrice Gasnier

Enable ADC on stm32mp15.
- CONFIG_CMD_ADC
- CONFIG_STM32_ADC

---

Changes in v2: None

 configs/stm32mp15_basic_defconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
configs/stm32mp15_basic_defconfig +2 -1
index 3a94db5..bbb65b5 100644
@@ -18,6 +18,7 @@ CONFIG_SYS_PROMPT="STM32MP> "
 # CONFIG_CMD_EXPORTENV is not set
 # CONFIG_CMD_IMPORTENV is not set
 CONFIG_CMD_MEMINFO=y
+CONFIG_CMD_ADC=y
 CONFIG_CMD_FUSE=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
@@ -27,6 +28,7 @@ CONFIG_CMD_PMIC=y
 CONFIG_CMD_REGULATOR=y
 CONFIG_CMD_EXT4_WRITE=y
 # CONFIG_SPL_DOS_PARTITION is not set
+CONFIG_STM32_ADC=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_STM32F7=y
 CONFIG_DM_MMC=y
@@ -35,7 +37,6 @@ CONFIG_STM32_SDMMC2=y
 CONFIG_DM_PMIC=y
 # CONFIG_SPL_PMIC_CHILDREN is not set
 CONFIG_PMIC_STPMU1=y
-CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_GPIO=y
 CONFIG_DM_REGULATOR_STM32_VREFBUF=y
 CONFIG_DM_REGULATOR_STPMU1=y
Signature · 1 line
1.9.1
#12 lore raw

PATCH v2 5/6 configs: stm32mp15: enable ADC

Quoted 6 lines · Fabrice Gasnier

Enable ADC on stm32mp15.
- CONFIG_CMD_ADC
- CONFIG_STM32_ADC

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180804/254bacfd/attachment.sig>
#13 lore raw

PATCH v2 6/6 ARM: dts: stm32mp157: Add ADC DT node

In reply to Fabrice Gasnier

Add ADC device tree node. This allows to get analog conversions on stm32mp157.

---

Changes in v2: None

---
 arch/arm/dts/stm32mp157.dtsi | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
arch/arm/dts/stm32mp157.dtsi +32 -0
index 2b89416..88b5460 100644
@@ -86,6 +86,38 @@
 			status = "disabled";
 		};
 
+		adc: adc at 48003000 {
+			compatible = "st,stm32mp1-adc-core";
+			reg = <0x48003000 0x400>;
+			interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&rcc_clk ADC12>, <&rcc_clk ADC12_K>;
+			clock-names = "bus", "adc";
+			interrupt-controller;
+			#interrupt-cells = <1>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "disabled";
+
+			adc1: adc at 0 {
+				compatible = "st,stm32mp1-adc";
+				#io-channel-cells = <1>;
+				reg = <0x0>;
+				interrupt-parent = <&adc>;
+				interrupts = <0>;
+				status = "disabled";
+			};
+
+			adc2: adc at 100 {
+				compatible = "st,stm32mp1-adc";
+				#io-channel-cells = <1>;
+				reg = <0x100>;
+				interrupt-parent = <&adc>;
+				interrupts = <1>;
+				status = "disabled";
+			};
+		};
+
 		sdmmc3: sdmmc at 48004000 {
 			compatible = "st,stm32-sdmmc2";
 			reg = <0x48004000 0x400>, <0x48005000 0x400>;
Signature · 1 line
1.9.1
#15 lore raw

PATCH v2 6/6 ARM: dts: stm32mp157: Add ADC DT node

In reply to Fabrice Gasnier
Quoted 5 lines · Fabrice Gasnier

Add ADC device tree node. This allows to get analog conversions on stm32mp157.

This doesn't apply currently, please rebase, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180804/329e48f7/attachment.sig>