Skip to contentSkip to conversation

Add support for the Purism Librem5 devkit

PATCH Superseded Angus Ainslie (Purism) 3 participants 12 messages May 20, 2019 – May 24, 2019

Subsystems (2)

v13 of 16 Superseded Latest is v16 →

lore
Share & tools
lore
#0 lore raw

v13 cover Add support for the Purism Librem5 devkit

The Librem5 devkit is based on the imx8mq from NXP. This is a default devicetree to boot the board to a command prompt.

Changes since v12:

Updated patch to vendor-prefixes.yaml.
Dropped always on from regulators.

Changes since v11:

Added reviewed-by tags.
Fixed subject typo.

Changes since v10:

Moved MAINTAINERS entry to "ARM/FREESCALE IMX" section

Changes since v9:

Added a MAINTAINERS entry for arm64 imx devicetree files.

Changes since v8:

Fixed license comment.
Changed regulators to all lower case.
Changed clock frequency for NXP errata e7805.
Dropped blank line.

Changes since v7:

More regulators always on for USB.
Add vbus regulator.
Drop vbat regulator.
Replace legacy "gpio-key,wakeup" with "wakeup-source".
Add vbus-supply to get rid of warning
imx8mq-usb-phy 382f0040.usb-phy: 382f0040.usb-phy supply vbus not found, using dummy regulator

Changes since v6:

Dropped unused regulators.
Fix regulator phandles case.
Dropped extra whitespace.

Changes since v5:

Added reviewed-by tags.
Moved USB port links to USB controller node.

Changes since v4:

Compiled against linux-next next-20190415. Added imx8mq to the arm yaml file.
Re-arrange regulator nodes to drop undefined supplies. Additional ordering for aesthetics.
Split some long lines.
Added lots of blank lines.
Moved pinctl muxes to where they are used. Cleaned out reg defintions from regulator nodes.

Changes since v3:

Freshly sorted and pressed nodes.
Change the backlight to an interpolated scale.
Dropped i2c2.
Dropped devkit version number to match debian MR.

Changes since v2:

Fixed incorrect phy-supply for the fsl-fec.
Dropped unused regulator property.
Fixup Makefile for linux-next.

Changes since v1:

Dropped config file.
Updated the board compatible label.
Changed node names to follow naming conventions.
Added a more complete regulator hierachy.
Removed unused nodes.
Removed unknown devices.
Fixed comment style.
Dropped undocumented properties.

Angus Ainslie (Purism) (4):
MAINTAINERS: add an entry for for arm64 imx devicetrees
arm64: dts: fsl: librem5: Add a device tree for the Librem5 devkit
dt-bindings: Add an entry for Purism SPC
dt-bindings: arm: fsl: Add the imx8mq boards

 .../devicetree/bindings/arm/fsl.yaml          |   7 +
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 MAINTAINERS                                   |   1 +
 arch/arm64/boot/dts/freescale/Makefile        |   1 +
 .../dts/freescale/imx8mq-librem5-devkit.dts   | 810 ++++++++++++++++++
 5 files changed, 821 insertions(+)
 create mode 100644 arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts
Signature · 1 line
2.17.1
#1 lore raw

PATCH v13 1/4 MAINTAINERS: add an entry for for arm64 imx devicetrees

Add an explicit reference to imx* devicetrees

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index a2cd3690b6b1..019c945d308d 100644
@@ -1630,6 +1630,7 @@ R:	NXP Linux Team <[email protected]>
 L:	[email protected] (moderated for non-subscribers)
 S:	Maintained
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git
+F:	arch/arm64/boot/dts/freescale/imx*
 N:	imx
 N:	mxs
 X:	drivers/media/i2c/
Signature · 1 line
2.17.1
#2 lore raw

PATCH v13 2/4 arm64: dts: fsl: librem5: Add a device tree for the Librem5 devkit

In reply to Angus Ainslie (Purism)

This is for the development kit board for the Librem 5. The current level of support yields a working console and is able to boot userspace from the network or eMMC.

Additional subsystems that are active :

- Both USB ports
- SD card socket
- WiFi usdhc
- WWAN modem
- GNSS
- GPIO keys
- LEDs
- gyro
- magnetometer
- touchscreen
- pwm
- backlight
- haptic motor

---
 arch/arm64/boot/dts/freescale/Makefile        |   1 +
 .../dts/freescale/imx8mq-librem5-devkit.dts   | 810 ++++++++++++++++++
 2 files changed, 811 insertions(+)
 create mode 100644 arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts
arch/arm64/boot/dts/freescale/Makefile +1 -0
index 0bd122f60549..c043aca66572 100644
@@ -22,6 +22,7 @@ dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-lx2160a-rdb.dtb
 
 dtb-$(CONFIG_ARCH_MXC) += imx8mm-evk.dtb
 dtb-$(CONFIG_ARCH_MXC) += imx8mq-evk.dtb
+dtb-$(CONFIG_ARCH_MXC) += imx8mq-librem5-devkit.dtb
 dtb-$(CONFIG_ARCH_MXC) += imx8mq-zii-ultra-rmb3.dtb
 dtb-$(CONFIG_ARCH_MXC) += imx8mq-zii-ultra-zest.dtb
 dtb-$(CONFIG_ARCH_MXC) += imx8qxp-mek.dtb
arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts new file +810 -0

810 lines not on this page · raw message

Signature · 1 line
2.17.1
#3 lore raw

Re: [PATCH v13 2/4] arm64: dts: fsl: librem5: Add a device tree for the Librem5 devkit

Hi!

Quoted 7 lines

This is for the development kit board for the Librem 5. The current level of support yields a working console and is able to boot userspace from the network or eMMC.

Additional subsystems that are active :

- haptic motor

Haptic motor is not a LED. It should be controlled by input subsystem.

arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts line 88

Quoted 11 lines
arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts new file +11 -0
+	pwmleds {
+		compatible = "pwm-leds";
+
+		haptic {
+			label = "librem5::haptic";
+			pwms = <&pwm2 0 200000>;
+			active-low;
+			max-brightness = <255>;
+			power-supply = <&reg_3v3_p>;
+		};
+	};

You can take a look at N900, that has reasonable interface.

Thanks,
Pavel

#4 lore raw

Re: [PATCH v13 2/4] arm64: dts: fsl: librem5: Add a device tree for the Librem5 devkit

Hi Pavel,

Quoted 12 lines · Pavel Machek

Hi!

Quoted 7 lines

This is for the development kit board for the Librem 5. The current level of support yields a working console and is able to boot userspace from the network or eMMC.

Additional subsystems that are active :

- haptic motor

Haptic motor is not a LED. It should be controlled by input subsystem.

Quoted 14 lines

arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts line 88

Quoted 11 lines
arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts new file +11 -0
+	pwmleds {
+		compatible = "pwm-leds";
+
+		haptic {
+			label = "librem5::haptic";
+			pwms = <&pwm2 0 200000>;
+			active-low;
+			max-brightness = <255>;
+			power-supply = <&reg_3v3_p>;
+		};
+	};

You can take a look at N900, that has reasonable interface.

I wanted to control the haptic with the pwm-vibra driver but "fsl,imx27-pwm" doesn't seem to respect the PWM_POLARITY_INVERTED flag so when I start the system the vibrator is full on.

I could use gpio-vibrator but that seemed like a waste when the device is connected to pwm.

I figured the using the pwm-leds interface was a reasonable compromise until I had an opportunity to make changes the the imx27-pwm driver.

Thanks
Angus

Quoted 2 lines

Thanks,
Pavel

#5 lore raw

Re: [PATCH v13 2/4] arm64: dts: fsl: librem5: Add a device tree for the Librem5 devkit

Hi!

Quoted 25 lines
Quoted 11 lines
Quoted 8 lines

This is for the development kit board for the Librem 5. The current level
of support yields a working console and is able to boot userspace from the network or eMMC.

Additional subsystems that are active :

- haptic motor

Haptic motor is not a LED. It should be controlled by input subsystem.

Quoted 13 lines

arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts line 88

Quoted 11 lines
arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts new file +11 -0
+	pwmleds {
+		compatible = "pwm-leds";
+
+		haptic {
+			label = "librem5::haptic";
+			pwms = <&pwm2 0 200000>;
+			active-low;
+			max-brightness = <255>;
+			power-supply = <&reg_3v3_p>;
+		};
+	};

You can take a look at N900, that has reasonable interface.

Quoted 3 lines

I wanted to control the haptic with the pwm-vibra driver but "fsl,imx27-pwm" doesn't seem to respect the PWM_POLARITY_INVERTED flag so when I start the system the vibrator is full on.

Ok, lets fix that :-).

Quoted 5 lines

I could use gpio-vibrator but that seemed like a waste when the device is connected to pwm.

I figured the using the pwm-leds interface was a reasonable compromise until I had an opportunity to make changes the the imx27-pwm driver.

I guess in such case it would be best to leave out this section for now... or keep it disabled / something. We don't want incorrect device trees to stick around.

Thanks,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#6 lore raw

Re: [PATCH v13 2/4] arm64: dts: fsl: librem5: Add a device tree for the Librem5 devkit

In reply to Angus Ainslie (Purism)

Hi!

arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts line 65

Quoted 11 lines

- LEDs
- gyro
- magnetometer

arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts new file +7 -0
+	leds {
+		compatible = "gpio-leds";
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_gpio_leds>;
+
+		led1 {
+			label = "LED 1";

So, what kind of LED do you have, and what color is it? label should probably be something like notify:green.

arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts line 395

Quoted 9 lines
arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts new file +9 -0
+	charger@6b { /* bq25896 */
+		compatible = "ti,bq25890";
+		reg = <0x6b>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_charger>;
+		interrupt-parent = <&gpio3>;
+		interrupts = <25 IRQ_TYPE_EDGE_FALLING>;
+		ti,battery-regulation-voltage = <4192000>; /* 4.192V */
+		ti,charge-current = <1600000>; /* 1.6 A */

No space before A, for consistency.

arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts line 397

Quoted 2 lines
arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts new file +2 -0
+		ti,termination-current = <66000>;  /* 66mA */
+		ti,precharge-current = <1300000>; /* 1.3A */

I thought precharge is usually something low, because you are not yet sure of battery health...?

arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts line 398

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts new file +1 -0
+		ti,minimum-sys-voltage = <2750000>; /* 2.75V */

Are you sure? Normally systems shut down at 3.2V, 3V or so. Li-ion batteries don't really like to be discharged _this_ deep.

Pavel

#7 lore raw

Re: [PATCH v13 2/4] arm64: dts: fsl: librem5: Add a device tree for the Librem5 devkit

Hi Pavel,

Quoted 6 lines · Pavel Machek

Hi!

Quoted 3 lines

- LEDs
- gyro
- magnetometer

Quoted 12 lines

arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts line 65

Quoted 7 lines
arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts new file +7 -0
+	leds {
+		compatible = "gpio-leds";
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_gpio_leds>;
+
+		led1 {
+			label = "LED 1";

So, what kind of LED do you have, and what color is it? label should probably be something like
notify:green.

As we don't have a specific use for these yet does it really matter if there is a colour or a number associated with them ?

Quoted 12 lines

arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts line 395

Quoted 9 lines
arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts new file +9 -0
+	charger@6b { /* bq25896 */
+		compatible = "ti,bq25890";
+		reg = <0x6b>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_charger>;
+		interrupt-parent = <&gpio3>;
+		interrupts = <25 IRQ_TYPE_EDGE_FALLING>;
+		ti,battery-regulation-voltage = <4192000>; /* 4.192V */
+		ti,charge-current = <1600000>; /* 1.6 A */

No space before A, for consistency.

Quoted 6 lines

arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts line 397

Quoted 2 lines
arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts new file +2 -0
+		ti,termination-current = <66000>;  /* 66mA */
+		ti,precharge-current = <1300000>; /* 1.3A */

I thought precharge is usually something low, because you are not yet sure of battery health...?

I think I put that in incorrectly. The intention was 130mA.

Quoted 5 lines

arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts line 398

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts new file +1 -0
+		ti,minimum-sys-voltage = <2750000>; /* 2.75V */

Are you sure? Normally systems shut down at 3.2V, 3V or so. Li-ion batteries don't
really like to be discharged _this_ deep.

You are correct. I'll fix it for the next version.

Thanks
Angus

Quoted 2 lines

Pavel

#8 lore raw

Re: [PATCH v13 2/4] arm64: dts: fsl: librem5: Add a device tree for the Librem5 devkit

Hi Pavel,

Quoted 46 lines · Angus Ainslie

Hi Pavel,

Quoted 6 lines · Pavel Machek

Hi!

Quoted 3 lines

- LEDs
- gyro
- magnetometer

Quoted 12 lines

arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts line 65

Quoted 7 lines
arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts new file +7 -0
+	leds {
+		compatible = "gpio-leds";
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_gpio_leds>;
+
+		led1 {
+			label = "LED 1";

So, what kind of LED do you have, and what color is it? label should probably be something like
notify:green.

As we don't have a specific use for these yet does it really matter if there is a colour or a number associated with them ?

Quoted 12 lines

arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts line 395

Quoted 9 lines
arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts new file +9 -0
+	charger@6b { /* bq25896 */
+		compatible = "ti,bq25890";
+		reg = <0x6b>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_charger>;
+		interrupt-parent = <&gpio3>;
+		interrupts = <25 IRQ_TYPE_EDGE_FALLING>;
+		ti,battery-regulation-voltage = <4192000>; /* 4.192V */
+		ti,charge-current = <1600000>; /* 1.6 A */

No space before A, for consistency.

Quoted 6 lines

arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts line 397

Quoted 2 lines
arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts new file +2 -0
+		ti,termination-current = <66000>;  /* 66mA */
+		ti,precharge-current = <1300000>; /* 1.3A */

I thought precharge is usually something low, because you are not yet sure of battery health...?

I think I put that in incorrectly. The intention was 130mA.

Quoted 8 lines
Quoted 5 lines

arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts line 398

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts new file +1 -0
+		ti,minimum-sys-voltage = <2750000>; /* 2.75V */

Are you sure? Normally systems shut down at 3.2V, 3V or so. Li-ion batteries don't
really like to be discharged _this_ deep.

You are correct. I'll fix it for the next version.

Looking into it further Sanyo and Panasonic get over 300 cycles bringing the NCR18650 down to 2.5V so 2.75V should be fine.

http://www.batteryonestop.com/baotongusa/products/datasheets/li-ion/SANYO-NCR18650B-3400mAh.pdf
https://industrial.panasonic.com/ww/products/batteries/secondary-batteries/lithium-ion/cylindrical-type/NCR18650PF

Angus

Quoted 5 lines

Thanks
Angus

Quoted 2 lines

Pavel

#9 lore raw

PATCH v13 3/4 dt-bindings: Add an entry for Purism SPC

In reply to Angus Ainslie (Purism)

Add an entry for Purism, SPC

---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index 33a65a45e319..104595f55f34 100644
@@ -683,6 +683,8 @@ patternProperties:
     description: PROBOX2 (by W2COMP Co., Ltd.)
   "^pulsedlight,.*":
     description: PulsedLight, Inc
+  "^purism,.*":
+    description: Purism, SPC
   "^qca,.*":
     description: Qualcomm Atheros, Inc.
   "^qcom,.*":
Signature · 1 line
2.17.1
#11 lore raw

PATCH v13 4/4 dt-bindings: arm: fsl: Add the imx8mq boards

In reply to Angus Ainslie (Purism)

Add an entry for imx8mq based boards

---
 Documentation/devicetree/bindings/arm/fsl.yaml | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/arm/fsl.yaml +7 -0
index 407138ebc0d0..41364b127200 100644
@@ -177,6 +177,13 @@ properties:
               - fsl,imx8mm-evk            # i.MX8MM EVK Board
           - const: fsl,imx8mm
 
+      - description: i.MX8MQ based Boards
+        items:
+          - enum:
+              - fsl,imx8mq-evk            # i.MX8MQ EVK Board
+              - purism,librem5-devkit     # Purism Librem5 devkit
+          - const: fsl,imx8mq
+
       - description: i.MX8QXP based Boards
         items:
           - enum:
Signature · 1 line
2.17.1