Skip to contentSkip to conversation

Support for LEGO MINDSTORMS EV3

PATCH Superseded David Lechner 4 participants 18 messages Jan 6, 2017 – Jan 13, 2017

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover Support for LEGO MINDSTORMS EV3

This patch series adds support for LEGO MINDSTORMS EV3. This is a TI AM1808 based board.

v2 changes:
* Dropped defconfig patches that have already been pick up
* Added some new defconfig patches
* Updated device tree file based on feedback and new available bindings
* Renamed file to include da850- prefix
* Changed button labels
* Fixed LED names
* Added beeper device for sound
* Added regulators for USB and A/DC
* Removed unused pinmux nodes
* Added pinconf for buttons
* Enabled pwms
* Used preferred bindings for flash partitions
* Added A/DC spi device
* Enabled USB

This patch series has been tested working on next-20170105 with linux-davinci/ next merged into it, along with a few other patches that have been submitted.

Dependencies:

i.e. Things that are not in next-20170105 or linux-davinci/next already. I know this seems like a long list, but most of these are just small fixes and not necessarily strict dependencies.

* "iio: adc: New driver for TI ADS7950 chips" [1]
This patch is currently in iio/testing. It is expected to be included as-is in v4.11.

* "ARM: davinci: Allocate extra interrupts" [2]
This patch has been submitted but has not received any feedback. It is not critical, but needed to use the trigger capabilities of iio.

* "spi: davinci: Allow device tree devices to use DMA" [3]
This has been (re)submitted, but no response from spi maintainer yet. It is needed for the flash memory to work correctly.

* "ARM: dts: da850: Add usb device node" [4]
The dependencies that were holding up this patch are all merged, so it is OK to pick up this patch in linux-davinci now.

* "regulator: fixed: Handle optional overcurrent pin" [5]
This is used by the USB/input port/output port/ADC regulator. This patch has been slow in getting accepted into regulator.

* "serial: 8250: Add new port type for TI DA8xx/66AK2x" [6]
"ARM: da850: Add ti,da830-uart compatible for serial ports" [7] This series fixes UART0 and UART2 not working. Waiting for patch to be picked up in serial tree.

* "Input: pwm-beeper: add optional enable gpio" [8]
I just submitted this patch, so we will see what happens. It is needed for the speaker to actually make sound.

[1]: https://patchwork.kernel.org/patch/9449767/
[2]: https://patchwork.kernel.org/patch/9438709/
[3]: https://patchwork.kernel.org/patch/9499937/
[4]: https://patchwork.kernel.org/patch/9439839/
[5]: https://patchwork.kernel.org/patch/9476509/
[6]: https://patchwork.kernel.org/patch/9499459/
[7]: https://patchwork.kernel.org/patch/9499457/
[8]: https://patchwork.kernel.org/patch/9499919/

David Lechner (5):
ARM: davinci_all_defconfig: enable DA8xx pinconf
ARM: davinci_all_defconfig: Enable PWM modules
ARM: davinci_all_defconfig: enable iio and ADS7950
ARM: davinci_all_defconfig: enable pwm-beeper
ARM: dts: Add LEGO MINDSTORMS EV3 dts

 arch/arm/boot/dts/Makefile             |   3 +-
 arch/arm/boot/dts/da850-lego-ev3.dts   | 381 +++++++++++++++++++++++++++++++++
 arch/arm/configs/davinci_all_defconfig |  12 ++
 3 files changed, 395 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/da850-lego-ev3.dts
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/5 ARM: davinci_all_defconfig: enable DA8xx pinconf

This enables the DA8xx pinconf driver by default. It is needed by LEGO MINDSTORMS EV3.

---
 arch/arm/configs/davinci_all_defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/configs/davinci_all_defconfig +1 -0
index ddb586a..a12e4c2 100644
@@ -114,6 +114,7 @@ CONFIG_I2C_CHARDEV=y
 CONFIG_I2C_DAVINCI=y
 CONFIG_SPI=y
 CONFIG_SPI_DAVINCI=m
+CONFIG_PINCTRL_DA850_PUPD=m
 CONFIG_PINCTRL_SINGLE=y
 CONFIG_GPIO_SYSFS=y
 CONFIG_GPIO_PCA953X=y
Signature · 1 line
2.7.4
#3 lore raw

PATCH v2 2/5 ARM: davinci_all_defconfig: Enable PWM modules

In reply to David Lechner

This enables PWM and the TI ECAP and EHRWPM modules. These are used on LEGO MINDSTORMS EV3.

---
 arch/arm/configs/davinci_all_defconfig | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/configs/davinci_all_defconfig +3 -0
index a12e4c2..2b1967a 100644
@@ -200,6 +200,9 @@ CONFIG_TI_EDMA=y
 CONFIG_MEMORY=y
 CONFIG_TI_AEMIF=m
 CONFIG_DA8XX_DDRCTL=y
+CONFIG_PWM=y
+CONFIG_PWM_TIECAP=m
+CONFIG_PWM_TIEHRPWM=m
 CONFIG_EXT2_FS=y
 CONFIG_EXT3_FS=y
 CONFIG_EXT4_FS_POSIX_ACL=y
Signature · 1 line
2.7.4
#5 lore raw

PATCH v2 3/5 ARM: davinci_all_defconfig: enable iio and ADS7950

In reply to David Lechner

This enables the iio subsystem and the TI ADS7950 driver. This is used by LEGO MINDSTORMS EV3, which has an ADS7957 chip.
---

The CONFIG_TI_ADS7950 driver is currently in iio/testing, so some coordination may be needed before picking up this patch.

 arch/arm/configs/davinci_all_defconfig | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/configs/davinci_all_defconfig +7 -0
index 2b1967a..a899876 100644
@@ -200,6 +200,13 @@ CONFIG_TI_EDMA=y
 CONFIG_MEMORY=y
 CONFIG_TI_AEMIF=m
 CONFIG_DA8XX_DDRCTL=y
+CONFIG_IIO=m
+CONFIG_IIO_BUFFER_CB=m
+CONFIG_IIO_SW_DEVICE=m
+CONFIG_IIO_SW_TRIGGER=m
+CONFIG_TI_ADS7950=m
+CONFIG_IIO_HRTIMER_TRIGGER=m
+CONFIG_IIO_SYSFS_TRIGGER=m
 CONFIG_PWM=y
 CONFIG_PWM_TIECAP=m
 CONFIG_PWM_TIEHRPWM=m
Signature · 1 line
2.7.4
#12 lore raw

PATCH v2 4/5 ARM: davinci_all_defconfig: enable pwm-beeper

In reply to David Lechner

This enables the pwm-beeper module. This is used by the speaker on LEGO MINDSTORMS EV3.

---
 arch/arm/configs/davinci_all_defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/configs/davinci_all_defconfig +1 -0
index a899876..e046fd7 100644
@@ -100,6 +100,7 @@ CONFIG_KEYBOARD_XTKBD=m
 # CONFIG_INPUT_MOUSE is not set
 CONFIG_INPUT_TOUCHSCREEN=y
 CONFIG_INPUT_MISC=y
+CONFIG_INPUT_PWM_BEEPER=m
 CONFIG_INPUT_DM355EVM=m
 CONFIG_SERIO_LIBPS2=y
 # CONFIG_VT_CONSOLE is not set
Signature · 1 line
2.7.4
#13 lore raw

PATCH v2 5/5 ARM: dts: Add LEGO MINDSTORMS EV3 dts

In reply to David Lechner

This adds a device tree definition file for LEGO MINDSTORMS EV3.

What is working:

* Pin muxing
* Pinconf
* GPIOs
* MicroSD card reader
* UART on input ports 1 and 2
* Buttons
* LEDs
* Poweroff/reset
* Flash memory
* EEPROM
* Speaker
* USB host port
* USB perepheral port
* A/DC chip

What is not working/to be added later:

* Display - waiting for "simple DRM" to be mainlined
* Bluetooth - needs new driver for sequencing power/enable/clock - usable now by manipulating gpios/pwm in userspace
* Input and output ports - need some sort of new phy or extcon driver
* Battery indication - needs new power supply driver

Note on flash partitions:

These partitions are based on the official EV3 firmware from LEGO. It is expected that most users of the mainline kernel on EV3 will be booting from an SD card while retaining the official firmware in the flash memory. Furthermore, the official firmware uses an ancient U-Boot (2009) that has no device tree support. So, it makes sense to have this partition table in the EV3 device tree file. In the unlikely case that anyone does create their own firmware image with different partitioning, they can use a modern U-Boot in that firmware image that modifies the device tree with the custom partitions.

---
 arch/arm/boot/dts/Makefile           |   3 +-
 arch/arm/boot/dts/da850-lego-ev3.dts | 381 +++++++++++++++++++++++++++++++++++
 2 files changed, 383 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/da850-lego-ev3.dts
arch/arm/boot/dts/Makefile +2 -1
index 9a7375c..471b802 100644
@@ -128,7 +128,8 @@ dtb-$(CONFIG_ARCH_CLPS711X) += \
 dtb-$(CONFIG_ARCH_DAVINCI) += \
 	da850-lcdk.dtb \
 	da850-enbw-cmc.dtb \
-	da850-evm.dtb
+	da850-evm.dtb \
+	da850-lego-ev3.dtb
 dtb-$(CONFIG_ARCH_DIGICOLOR) += \
 	cx92755_equinox.dtb
 dtb-$(CONFIG_ARCH_EFM32) += \
arch/arm/boot/dts/da850-lego-ev3.dts new file +381 -0

381 lines not on this page · raw message

Signature · 1 line
2.7.4
#14 lore raw

Re: [PATCH v2 5/5] ARM: dts: Add LEGO MINDSTORMS EV3 dts

url: https://github.com/0day-ci/linux/commits/David-Lechner/Support-for-LEGO-MINDSTORMS-EV3/20170107-002649 config: arm-at91_dt_defconfig (attached as .config) compiler: arm-linux-gnueabi-gcc…

Hi David,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.10-rc2 next-20170106]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/David-Lechner/Support-for-LEGO-MINDSTORMS-EV3/20170107-002649
config: arm-at91_dt_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm

All errors (new ones prefixed by >>):

>> Error: arch/arm/boot/dts/da850-lego-ev3.dts:378.1-6 Label or path usb1 not found

FATAL ERROR: Syntax error parsing input tree

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 22125 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170107/22479587/attachment-0001.gz>

#6 lore raw

Re: Congratulation_stephen iiFH

In reply to David Lechner

Leave me alone

Sent from my iPhone

Quoted 33 lines · David Lechner

zdg
Congratulations_stephen,

The_Home_Warranty_Limited_time_event.

Never_pay_for_covered_home_repairs_again!

Your_Roof_is_CoveredFREE!

Click_ _Here

,.u 'n 5^ *u :b
0' p- .,t 't - o *u ' t

#2 lore raw

Re: [PATCH v2 1/5] ARM: davinci_all_defconfig: enable DA8xx pinconf

In reply to David Lechner
Quoted 2 lines · David Lechner

This enables the DA8xx pinconf driver by default. It is needed by LEGO MINDSTORMS EV3.

Missing your sign-off. I cannot apply that myself. Please resend.

Thanks,
Sekhar

#4 lore raw

Re: [PATCH v2 2/5] ARM: davinci_all_defconfig: Enable PWM modules

In reply to David Lechner
Quoted 2 lines · David Lechner

This enables PWM and the TI ECAP and EHRWPM modules. These are used on LEGO MINDSTORMS EV3.

Here too. Please resend with sign-off.

Thanks,
Sekhar

#7 lore raw

Re: [PATCH v2 3/5] ARM: davinci_all_defconfig: enable iio and ADS7950

In reply to David Lechner
Quoted 2 lines · David Lechner

This enables the iio subsystem and the TI ADS7950 driver. This is used by LEGO MINDSTORMS EV3, which has an ADS7957 chip.

Can you add your sign-off?

Quoted 13 lines

---

The CONFIG_TI_ADS7950 driver is currently in iio/testing, so some coordination may be needed before picking up this patch.

 arch/arm/configs/davinci_all_defconfig | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/configs/davinci_all_defconfig +0 -0
index 2b1967a..a899876 100644

arch/arm/configs/davinci_all_defconfig CONFIG_TI_EDMA=y · line 208

Quoted 9 lines
arch/arm/configs/davinci_all_defconfig +5 -0
@@ -200,6 +200,13 @@ CONFIG_TI_EDMA=y
 CONFIG_MEMORY=y
 CONFIG_TI_AEMIF=m
 CONFIG_DA8XX_DDRCTL=y
+CONFIG_IIO=m
+CONFIG_IIO_BUFFER_CB=m
+CONFIG_IIO_SW_DEVICE=m
+CONFIG_IIO_SW_TRIGGER=m
 
+CONFIG_TI_ADS7950=m

Can you separate this from rest of the patch. I would like to enable this option only after I can find the symbol in linux-next.

arch/arm/configs/davinci_all_defconfig CONFIG_TI_EDMA=y · line 209

Quoted 2 lines
arch/arm/configs/davinci_all_defconfig +2 -0
+CONFIG_IIO_HRTIMER_TRIGGER=m
+CONFIG_IIO_SYSFS_TRIGGER=m

Need CONFIG_IIO_TRIGGER=y also for these two options to take effect.

Thanks,
Sekhar

#8 lore raw

Re: [PATCH v2 3/5] ARM: davinci_all_defconfig: enable iio and ADS7950

Quoted 27 lines · Sekhar Nori
Quoted 2 lines · David Lechner

This enables the iio subsystem and the TI ADS7950 driver. This is used by LEGO MINDSTORMS EV3, which has an ADS7957 chip.

Can you add your sign-off?

Quoted 20 lines

---

The CONFIG_TI_ADS7950 driver is currently in iio/testing, so some coordination may be needed before picking up this patch.

 arch/arm/configs/davinci_all_defconfig | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/configs/davinci_all_defconfig +4 -0
index 2b1967a..a899876 100644
@@ -200,6 +200,13 @@ CONFIG_TI_EDMA=y
 CONFIG_MEMORY=y
 CONFIG_TI_AEMIF=m
 CONFIG_DA8XX_DDRCTL=y
+CONFIG_IIO=m
+CONFIG_IIO_BUFFER_CB=m
+CONFIG_IIO_SW_DEVICE=m
+CONFIG_IIO_SW_TRIGGER=m
Quoted 4 lines

arch/arm/configs/davinci_all_defconfig CONFIG_TI_EDMA=y · line 207

Quoted 1 line
arch/arm/configs/davinci_all_defconfig +1 -0
+CONFIG_TI_ADS7950=m

Can you separate this from rest of the patch. I would like to enable this option only after I can find the symbol in linux-next.

Will resend without CONFIG_TI_ADS7950

Quoted 5 lines

arch/arm/configs/davinci_all_defconfig CONFIG_TI_EDMA=y · line 209

Quoted 3 lines
arch/arm/configs/davinci_all_defconfig +2 -0
+CONFIG_IIO_HRTIMER_TRIGGER=m
+CONFIG_IIO_SYSFS_TRIGGER=m

Need CONFIG_IIO_TRIGGER=y also for these two options to take effect.

CONFIG_IIO_TRIGGER is selected by IIO_TRIGGERED_BUFFER [=m] && IIO [=m] && IIO_BUFFER [=y], so save_defconfig does not pick it up.

Quoted 4 lines

Thanks,
Sekhar

#9 lore raw

Re: [PATCH v2 3/5] ARM: davinci_all_defconfig: enable iio and ADS7950

Quoted 39 lines · David Lechner
Quoted 30 lines · Sekhar Nori
Quoted 3 lines · David Lechner

This enables the iio subsystem and the TI ADS7950 driver. This is used by
LEGO MINDSTORMS EV3, which has an ADS7957 chip.

Can you add your sign-off?

Quoted 22 lines

---

The CONFIG_TI_ADS7950 driver is currently in iio/testing, so some coordination
may be needed before picking up this patch.

 arch/arm/configs/davinci_all_defconfig | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/configs/davinci_all_defconfig +4 -0
index 2b1967a..a899876 100644
@@ -200,6 +200,13 @@ CONFIG_TI_EDMA=y
 CONFIG_MEMORY=y
 CONFIG_TI_AEMIF=m
 CONFIG_DA8XX_DDRCTL=y
+CONFIG_IIO=m
+CONFIG_IIO_BUFFER_CB=m
+CONFIG_IIO_SW_DEVICE=m
+CONFIG_IIO_SW_TRIGGER=m
Quoted 4 lines

arch/arm/configs/davinci_all_defconfig CONFIG_TI_EDMA=y · line 207

Quoted 1 line
arch/arm/configs/davinci_all_defconfig +1 -0
+CONFIG_TI_ADS7950=m

Can you separate this from rest of the patch. I would like to enable this option only after I can find the symbol in linux-next.

Will resend without CONFIG_TI_ADS7950

Quoted 1 line
Quoted 7 lines
Quoted 4 lines

arch/arm/configs/davinci_all_defconfig CONFIG_TI_EDMA=y · line 209

Quoted 2 lines
arch/arm/configs/davinci_all_defconfig +2 -0
+CONFIG_IIO_HRTIMER_TRIGGER=m
+CONFIG_IIO_SYSFS_TRIGGER=m

Need CONFIG_IIO_TRIGGER=y also for these two options to take effect.

CONFIG_IIO_TRIGGER is selected by IIO_TRIGGERED_BUFFER [=m] && IIO [=m] && IIO_BUFFER [=y], so save_defconfig does not pick it up.

I do remember I did not see these two modules did not get enabled in .config after 'make davinci_all_defconfig'. Will check what I may have missed.

Thanks,
Sekhar

#15 lore raw

Re: [PATCH v2 5/5] ARM: dts: Add LEGO MINDSTORMS EV3 dts

In reply to David Lechner

arch/arm/boot/dts/da850-lego-ev3.dts line 104

Quoted 6 lines · David Lechner
arch/arm/boot/dts/da850-lego-ev3.dts new file +6 -0
+	beeper {
+		compatible = "pwm-beeper";
+		pinctrl-names = "default";
+		pinctrl-0 = <&ehrpwm0b_pins>, <&amp_pins>;
+		pwms = <&ehrpwm0 1 0 0>;
+		enable-gpios = <&gpio 111 GPIO_ACTIVE_HIGH>;

Since the enable-gpios binding for pwm beeper is still not accepted, can you drop the property or the node itself (if that makes more sense)?

Quoted 34 lines

+&spi0 {

arch/arm/boot/dts/da850-lego-ev3.dts new file +33 -0
+	status = "okay";
+	pinctrl-names = "default";
+	pinctrl-0 = <&spi0_pins>, <&spi0_cs0_pin>, <&spi0_cs3_pin>;
+
+	flash at 0 {
+		compatible = "n25q128a13", "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <50000000>;
+		ti,spi-wdelay = <8>;
+
+		/* Partitions are based on the official firmware from LEGO */
+		partitions {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			partition at 0 {
+				label = "U-Boot";
+				reg = <0 0x40000>;
+			};
+
+			partition at 40000 {
+				label = "U-Boot Env";
+				reg = <0x40000 0x10000>;
+			};
+
+			partition at 50000 {
+				label = "Kernel";
+				reg = <0x50000 0x200000>;
+			};
+
+			partition at 250000 {
+				label = "Filesystem";
+				reg = <0x250000 0xa50000>;
+			};

arch/arm/boot/dts/da850-lego-ev3.dts line 359

Quoted 10 lines
arch/arm/boot/dts/da850-lego-ev3.dts new file +10 -0
+
+			partition at cb0000 {
+				label = "Storage";
+				reg = <0xcb0000 0x2f0000>;
+			};
+		};
+	};
+
+	adc at 3 {
+		compatible = "ti-ads7957";

So looks like this works because of_register_spi_device() sets up modalias of spi device from compatible string. I am fine with it, just highlighting it here to make sure this is acceptable practice. I did not really find any precedence for using SPI device name as compatible property in existing DTS files.

arch/arm/boot/dts/da850-lego-ev3.dts line 363

Quoted 4 lines
arch/arm/boot/dts/da850-lego-ev3.dts new file +4 -0
+		reg = <3>;
+		spi-max-frequency = <10000000>;
+		refin-supply = <&adc_ref>;
+	};

Rest of the patch looks good to me.

Thanks,
Sekhar

#16 lore raw

Re: [PATCH v2 5/5] ARM: dts: Add LEGO MINDSTORMS EV3 dts

Quoted 11 lines · Sekhar Nori

arch/arm/boot/dts/da850-lego-ev3.dts line 104

Quoted 6 lines · David Lechner
arch/arm/boot/dts/da850-lego-ev3.dts new file +6 -0
+	beeper {
+		compatible = "pwm-beeper";
+		pinctrl-names = "default";
+		pinctrl-0 = <&ehrpwm0b_pins>, <&amp_pins>;
+		pwms = <&ehrpwm0 1 0 0>;
+		enable-gpios = <&gpio 111 GPIO_ACTIVE_HIGH>;

Since the enable-gpios binding for pwm beeper is still not accepted, can you drop the property or the node itself (if that makes more sense)?

No sound will come out of the speaker without enabling this gpio. So, I guess I will just drop this node for now.

Quoted 43 lines
Quoted 43 lines

+&spi0 {

arch/arm/boot/dts/da850-lego-ev3.dts new file +41 -0
+	status = "okay";
+	pinctrl-names = "default";
+	pinctrl-0 = <&spi0_pins>, <&spi0_cs0_pin>, <&spi0_cs3_pin>;
+
+	flash at 0 {
+		compatible = "n25q128a13", "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <50000000>;
+		ti,spi-wdelay = <8>;
+
+		/* Partitions are based on the official firmware from LEGO */
+		partitions {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			partition at 0 {
+				label = "U-Boot";
+				reg = <0 0x40000>;
+			};
+
+			partition at 40000 {
+				label = "U-Boot Env";
+				reg = <0x40000 0x10000>;
+			};
+
+			partition at 50000 {
+				label = "Kernel";
+				reg = <0x50000 0x200000>;
+			};
+
+			partition at 250000 {
+				label = "Filesystem";
+				reg = <0x250000 0xa50000>;
+			};
+
+			partition at cb0000 {
+				label = "Storage";
+				reg = <0xcb0000 0x2f0000>;
+			};
+		};
+	};
+
Quoted 8 lines

arch/arm/boot/dts/da850-lego-ev3.dts line 359

Quoted 2 lines
arch/arm/boot/dts/da850-lego-ev3.dts new file +2 -0
+	adc at 3 {
+		compatible = "ti-ads7957";

So looks like this works because of_register_spi_device() sets up modalias of spi device from compatible string. I am fine with it, just highlighting it here to make sure this is acceptable practice. I did not really find any precedence for using SPI device name as compatible property in existing DTS files.

Indeed. It looks like this sort of "trivial" device binding is just used for i2c devices. I will submit some patches to add proper device tree bindings and change this to "ti,ads7957".

Quoted 11 lines

arch/arm/boot/dts/da850-lego-ev3.dts line 363

Quoted 5 lines
arch/arm/boot/dts/da850-lego-ev3.dts new file +4 -0
+		reg = <3>;
+		spi-max-frequency = <10000000>;
+		refin-supply = <&adc_ref>;
+	};

Rest of the patch looks good to me.

Thanks,
Sekhar

#17 lore raw

Re: [PATCH v2 5/5] ARM: dts: Add LEGO MINDSTORMS EV3 dts

Quoted 51 lines · David Lechner
Quoted 42 lines
Quoted 42 lines

+&spi0 {

arch/arm/boot/dts/da850-lego-ev3.dts new file +41 -0
+    status = "okay";
+    pinctrl-names = "default";
+    pinctrl-0 = <&spi0_pins>, <&spi0_cs0_pin>, <&spi0_cs3_pin>;
+
+    flash at 0 {
+        compatible = "n25q128a13", "jedec,spi-nor";
+        reg = <0>;
+        spi-max-frequency = <50000000>;
+        ti,spi-wdelay = <8>;
+
+        /* Partitions are based on the official firmware from LEGO */
+        partitions {
+            #address-cells = <1>;
+            #size-cells = <1>;
+            partition at 0 {
+                label = "U-Boot";
+                reg = <0 0x40000>;
+            };
+
+            partition at 40000 {
+                label = "U-Boot Env";
+                reg = <0x40000 0x10000>;
+            };
+
+            partition at 50000 {
+                label = "Kernel";
+                reg = <0x50000 0x200000>;
+            };
+
+            partition at 250000 {
+                label = "Filesystem";
+                reg = <0x250000 0xa50000>;
+            };
+
+            partition at cb0000 {
+                label = "Storage";
+                reg = <0xcb0000 0x2f0000>;
+            };
+        };
+    };
+
Quoted 8 lines

arch/arm/boot/dts/da850-lego-ev3.dts line 359

Quoted 2 lines
arch/arm/boot/dts/da850-lego-ev3.dts new file +2 -0
+    adc at 3 {
+        compatible = "ti-ads7957";

So looks like this works because of_register_spi_device() sets up modalias of spi device from compatible string. I am fine with it, just highlighting it here to make sure this is acceptable practice. I did not really find any precedence for using SPI device name as compatible property in existing DTS files.

Quoted 3 lines

Indeed. It looks like this sort of "trivial" device binding is just used for i2c devices. I will submit some patches to add proper device tree bindings and change this to "ti,ads7957".

Alright, if you are going to do that, then I suggest you respin this patch with the adc node dropped for now. That way we can ensure basic board support in v4.11. If dependencies pan out, the adc can go in too as a separate patch.

Thanks,
Sekhar

#10 lore raw

Re: [PATCH v2 3/5] ARM: davinci_all_defconfig: enable iio and ADS7950

In reply to Sekhar Nori
Quoted 45 lines · Sekhar Nori
Quoted 44 lines · David Lechner
Quoted 30 lines · Sekhar Nori
Quoted 3 lines · David Lechner

This enables the iio subsystem and the TI ADS7950 driver. This is used by
LEGO MINDSTORMS EV3, which has an ADS7957 chip.

Can you add your sign-off?

Quoted 22 lines

---

The CONFIG_TI_ADS7950 driver is currently in iio/testing, so some coordination
may be needed before picking up this patch.

 arch/arm/configs/davinci_all_defconfig | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/configs/davinci_all_defconfig +4 -0
index 2b1967a..a899876 100644
@@ -200,6 +200,13 @@ CONFIG_TI_EDMA=y
 CONFIG_MEMORY=y
 CONFIG_TI_AEMIF=m
 CONFIG_DA8XX_DDRCTL=y
+CONFIG_IIO=m
+CONFIG_IIO_BUFFER_CB=m
+CONFIG_IIO_SW_DEVICE=m
+CONFIG_IIO_SW_TRIGGER=m
Quoted 4 lines

arch/arm/configs/davinci_all_defconfig CONFIG_TI_EDMA=y · line 207

Quoted 1 line
arch/arm/configs/davinci_all_defconfig +1 -0
+CONFIG_TI_ADS7950=m

Can you separate this from rest of the patch. I would like to enable this option only after I can find the symbol in linux-next.

Will resend without CONFIG_TI_ADS7950

Quoted 5 lines

arch/arm/configs/davinci_all_defconfig CONFIG_TI_EDMA=y · line 209

Quoted 3 lines
arch/arm/configs/davinci_all_defconfig +2 -0
+CONFIG_IIO_HRTIMER_TRIGGER=m
+CONFIG_IIO_SYSFS_TRIGGER=m

Need CONFIG_IIO_TRIGGER=y also for these two options to take effect.

Quoted 6 lines
Quoted 2 lines

CONFIG_IIO_TRIGGER is selected by IIO_TRIGGERED_BUFFER [=m] && IIO [=m] && IIO_BUFFER [=y], so save_defconfig does not pick it up.

I do remember I did not see these two modules did not get enabled in .config after 'make davinci_all_defconfig'. Will check what I may have missed.

So IIO_TRIGGERED_BUFFER is not selected in my tree because I dont have the ADS7950 driver enabled. Same thing with IIO_BUFFER.

Can you try this patch over my tree?

Thanks,
Sekhar

#11 lore raw

Re: [PATCH v2 3/5] ARM: davinci_all_defconfig: enable iio and ADS7950

Quoted 10 lines · Sekhar Nori
Quoted 3 lines · Sekhar Nori

I do remember I did not see these two modules did not get enabled in .config after 'make davinci_all_defconfig'. Will check what I may have missed.

So IIO_TRIGGERED_BUFFER is not selected in my tree because I dont have the ADS7950 driver enabled. Same thing with IIO_BUFFER.

Can you try this patch over my tree?

I've got it sorted now and I have sent a new patch.