Re: [PATCH v3 3/4] iio: adc: add STMPE ADC devicetree bindings

2018-12-06 Thread Philippe Schenker
On Sun, 2018-11-25 at 10:04 +, Jonathan Cameron wrote:
> On Fri, 23 Nov 2018 15:24:10 +0100
> Philippe Schenker  wrote:
> 
> > From: Stefan Agner 
> > 
> > This adds the devicetree bindings for the STMPE ADC.
> > 
> > Signed-off-by: Stefan Agner 
> > Signed-off-by: Max Krummenacher 
> > Signed-off-by: Philippe Schenker 
> Clearly this will need review from input and mfd.
> 
> I've suggested inline that you split the realignment out to a
> separate patch for reviewability reasons.

Thank you again Jonathan for your feedback, and of course also all the others!

I will split it much more so everything will be much more readable in v4. You
suggested again, to use the naming 'adc {'. I know that this is standard naming,
but unfortunately, this naming is given by drivers/mfd/stmpe.c (line 1311). 
What do you suggest to do? break the naming scheme in mfd, or just use
'stmpe_adc {' ?

> 
> > ---
> > 
> > Changes in v3:
> >  - Reformatted documentation for touchscreen to use tabs and have a better
> >overview of the settings.
> >  - Added note which adc-settings will take precedence.
> >  - changed typo in sample-time setting from 144 clocks to 124 clocks, as
> > stated
> >in the datasheet.
> > 
> > Changes in v2:
> >  - Moved the bindings for ADC to the overlying mfd.
> >  - Reformatted for better readability
> > 
> >  .../devicetree/bindings/iio/adc/stmpe-adc.txt | 21 +++
> >  .../bindings/input/touchscreen/stmpe.txt  | 60 ---
> >  .../devicetree/bindings/mfd/stmpe.txt | 28 ++---
> >  3 files changed, 80 insertions(+), 29 deletions(-)
> >  create mode 100644 Documentation/devicetree/bindings/iio/adc/stmpe-adc.txt
> > 
> > diff --git a/Documentation/devicetree/bindings/iio/adc/stmpe-adc.txt
> > b/Documentation/devicetree/bindings/iio/adc/stmpe-adc.txt
> > new file mode 100644
> > index ..480e66422625
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/iio/adc/stmpe-adc.txt
> > @@ -0,0 +1,21 @@
> > +STMPE ADC driver
> > +
> > +
> > +Required properties:
> > + - compatible: "st,stmpe-adc"
> > +
> > +Optional properties:
> > +Note that the ADC is shared with the STMPE touchscreen. ADC related
> > settings
> > +have to be done in the mfd.
> > +- st,norequest-mask: bitmask specifying which ADC channels should _not_ be
> > +  requestable due to different usage (e.g. touch)
> > +
> > +Node name must be stmpe_adc and should be child node of stmpe node to
> > +which it belongs.
> > +
> > +Example:
> > +
> > +   stmpe_adc {
> 
> Can we use adc { here to match standard naming?
> 
> > +   compatible = "st,stmpe-adc";
> > +   st,norequest-mask = <0x0F>; /* dont use ADC CH3-0 */
> > +   };
> > diff --git a/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt
> > b/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt
> > index 127baa31a77a..414586513a02 100644
> > --- a/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt
> > +++ b/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt
> > @@ -5,36 +5,52 @@ Required properties:
> >   - compatible: "st,stmpe-ts"
> >  
> >  Optional properties:
> > -- st,sample-time: ADC converstion time in number of clock.  (0 -> 36
> > clocks, 1 ->
> > -  44 clocks, 2 -> 56 clocks, 3 -> 64 clocks, 4 -> 80 clocks, 5 -> 96
> > clocks, 6
> > -  -> 144 clocks), recommended is 4.  
> > -- st,mod-12b: ADC Bit mode (0 -> 10bit ADC, 1 -> 12bit ADC)
> > -- st,ref-sel: ADC reference source (0 -> internal reference, 1 -> external
> > -  reference)
> > -- st,adc-freq: ADC Clock speed (0 -> 1.625 MHz, 1 -> 3.25 MHz, 2 || 3 ->
> > 6.5 MHz)
> > -- st,ave-ctrl: Sample average control (0 -> 1 sample, 1 -> 2 samples, 2 ->
> > 4
> > -  samples, 3 -> 8 samples)
> > -- st,touch-det-delay: Touch detect interrupt delay (0 -> 10 us, 1 -> 50 us,
> > 2 ->
> > -  100 us, 3 -> 500 us, 4-> 1 ms, 5 -> 5 ms, 6 -> 10 ms, 7 -> 50 ms)
> > recommended
> > -  is 3
> > -- st,settling: Panel driver settling time (0 -> 10 us, 1 -> 100 us, 2 ->
> > 500 us, 3
> > -  -> 1 ms, 4 -> 5 ms, 5 -> 10 ms, 6 for 50 ms, 7 -> 100 ms) recommended is
> > 2  
> > -- st,fraction-z: Length of the fractional part in z (fraction-z ([0..7]) =
> > Count of
> > -  the fractional part) recommended is 7
>

[PATCH v3 2/4] iio: adc: add STMPE ADC driver using IIO framework

2018-11-23 Thread Philippe Schenker
From: Stefan Agner 

This adds an ADC driver for the STMPE device using the industrial
input/output interface. The driver supports raw reading of values.
The driver depends on the MFD STMPE driver. If the touchscreen
block is enabled too, only four of the 8 ADC channels are available.

Signed-off-by: Stefan Agner 
Signed-off-by: Max Krummenacher 
Signed-off-by: Philippe Schenker 
---

Changes in v3:
 - Undo ADC-settings related code-deletions in stmpe-ts.c that the code is
   backwards-compatible to older devicetrees.

Changes in v2:
 - Code formatting
 - Move code to setup ADC to MFD device, as it is used by both drivers
   adc and touchscreen
 - Removed unused includes
 - Defined the macro STMPE_START_ONE_TEMP_CONV with other macros.
 - Added new macro that defines the channel of the temperature sensor.
   Took new name for STMPE_MAX_ADC->STMPE_ADC_LAST_NR and used it throughout
   the code for better readability.
 - Added mutex_unlock where missing.

 drivers/iio/adc/Kconfig  |   7 +
 drivers/iio/adc/Makefile |   1 +
 drivers/iio/adc/stmpe-adc.c  | 326 +++
 drivers/input/touchscreen/stmpe-ts.c |  36 +--
 drivers/mfd/Kconfig  |   3 +-
 drivers/mfd/stmpe.c  |  81 +++
 include/linux/mfd/stmpe.h|   9 +
 7 files changed, 437 insertions(+), 26 deletions(-)
 create mode 100644 drivers/iio/adc/stmpe-adc.c

diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
index a52fea8749a9..224f2067494d 100644
--- a/drivers/iio/adc/Kconfig
+++ b/drivers/iio/adc/Kconfig
@@ -734,6 +734,13 @@ config STM32_DFSDM_ADC
  This driver can also be built as a module.  If so, the module
  will be called stm32-dfsdm-adc.
 
+config STMPE_ADC
+   tristate "STMicroelectronics STMPE ADC driver"
+   depends on OF && MFD_STMPE
+   help
+ Say yes here to build support for ST Microelectronics STMPE
+ built-in ADC block (stmpe811).
+
 config STX104
tristate "Apex Embedded Systems STX104 driver"
depends on PC104 && X86
diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile
index a6e6a0b659e2..cba889c30bf9 100644
--- a/drivers/iio/adc/Makefile
+++ b/drivers/iio/adc/Makefile
@@ -69,6 +69,7 @@ obj-$(CONFIG_STM32_ADC_CORE) += stm32-adc-core.o
 obj-$(CONFIG_STM32_ADC) += stm32-adc.o
 obj-$(CONFIG_STM32_DFSDM_CORE) += stm32-dfsdm-core.o
 obj-$(CONFIG_STM32_DFSDM_ADC) += stm32-dfsdm-adc.o
+obj-$(CONFIG_STMPE_ADC) += stmpe-adc.o
 obj-$(CONFIG_TI_ADC081C) += ti-adc081c.o
 obj-$(CONFIG_TI_ADC0832) += ti-adc0832.o
 obj-$(CONFIG_TI_ADC084S021) += ti-adc084s021.o
diff --git a/drivers/iio/adc/stmpe-adc.c b/drivers/iio/adc/stmpe-adc.c
new file mode 100644
index ..bea3f3c27bb5
--- /dev/null
+++ b/drivers/iio/adc/stmpe-adc.c
@@ -0,0 +1,326 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ *  STMicroelectronics STMPE811 IIO ADC Driver
+ *
+ *  4 channel, 10/12-bit ADC
+ *
+ *  Copyright (C) 2013-2018 Toradex AG 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define STMPE_REG_INT_STA  0x0B
+#define STMPE_REG_ADC_INT_EN   0x0E
+#define STMPE_REG_ADC_INT_STA  0x0F
+
+#define STMPE_REG_ADC_CTRL10x20
+#define STMPE_REG_ADC_CTRL20x21
+#define STMPE_REG_ADC_CAPT 0x22
+#define STMPE_REG_ADC_DATA_CH(channel) (0x30 + 2 * (channel))
+
+#define STMPE_REG_TEMP_CTRL0x60
+#define STMPE_TEMP_CTRL_ENABLE BIT(0)
+#define STMPE_TEMP_CTRL_ACQBIT(1)
+#define STMPE_TEMP_CTRL_THRES_EN   BIT(3)
+#define STMPE_START_ONE_TEMP_CONV  (STMPE_TEMP_CTRL_ENABLE | \
+   STMPE_TEMP_CTRL_ACQ | \
+   STMPE_TEMP_CTRL_THRES_EN)
+#define STMPE_REG_TEMP_DATA0x61
+#define STMPE_REG_TEMP_TH  0x63
+#define STMPE_ADC_LAST_NR  7
+#define STMPE_TEMP_CHANNEL (STMPE_ADC_LAST_NR + 1)
+
+#define STMPE_ADC_CH(channel)  ((1 << (channel)) & 0xff)
+
+#define STMPE_ADC_TIMEOUT  msecs_to_jiffies(1000)
+
+struct stmpe_adc {
+   struct stmpe *stmpe;
+   struct clk *clk;
+   struct device *dev;
+
+   /* We are allocating plus one for the temperature channel */
+   struct iio_chan_spec stmpe_adc_iio_channels[STMPE_ADC_LAST_NR + 2];
+
+   struct completion completion;
+
+   u8 channel;
+   u32 value;
+};
+
+static int stmpe_read_raw(struct iio_dev *indio_dev,
+ struct iio_chan_spec const *chan,
+ int *val,
+ int *val2,
+ long mask)
+{
+   struct stmpe_adc *info = iio_priv(indio_dev);
+   long ret;
+
+   switch (mask) {
+   case IIO_CHAN_INFO_RAW:
+   case IIO_CHAN_INFO_PROCESSED:
+
+   mutex_lock(_dev->mlock);

[PATCH v3 1/4] mfd: stmpe: Move ADC related defines to header of mfd

2018-11-23 Thread Philippe Schenker
Move defines that are ADC related to the header of the overlying mfd,
so they can be used from multiple sub-devices.

Signed-off-by: Philippe Schenker 
---

Changes in v3:
 - None

Changes in v2:
 - This is a new added commit. Separate commit for moving the defines out of
   drivers/input/touchscreen/stmpe-ts.c to overlying mfd-device 
drivers/mfd/stmpe.c
 - Pre-fix defines with STMPE_

 drivers/input/touchscreen/stmpe-ts.c | 34 +++-
 include/linux/mfd/stmpe.h| 11 +
 2 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/drivers/input/touchscreen/stmpe-ts.c 
b/drivers/input/touchscreen/stmpe-ts.c
index 2a78e27b4495..c5d9006588a2 100644
--- a/drivers/input/touchscreen/stmpe-ts.c
+++ b/drivers/input/touchscreen/stmpe-ts.c
@@ -49,17 +49,6 @@
 
 #define STMPE_IRQ_TOUCH_DET0
 
-#define SAMPLE_TIME(x) ((x & 0xf) << 4)
-#define MOD_12B(x) ((x & 0x1) << 3)
-#define REF_SEL(x) ((x & 0x1) << 1)
-#define ADC_FREQ(x)(x & 0x3)
-#define AVE_CTRL(x)((x & 0x3) << 6)
-#define DET_DELAY(x)   ((x & 0x7) << 3)
-#define SETTLING(x)(x & 0x7)
-#define FRACTION_Z(x)  (x & 0x7)
-#define I_DRIVE(x) (x & 0x1)
-#define OP_MODE(x) ((x & 0x7) << 1)
-
 #define STMPE_TS_NAME  "stmpe-ts"
 #define XY_MASK0xfff
 
@@ -213,9 +202,10 @@ static int stmpe_init_hw(struct stmpe_touch *ts)
return ret;
}
 
-   adc_ctrl1 = SAMPLE_TIME(ts->sample_time) | MOD_12B(ts->mod_12b) |
-   REF_SEL(ts->ref_sel);
-   adc_ctrl1_mask = SAMPLE_TIME(0xff) | MOD_12B(0xff) | REF_SEL(0xff);
+   adc_ctrl1 = STMPE_SAMPLE_TIME(ts->sample_time) |
+   STMPE_MOD_12B(ts->mod_12b) | STMPE_REF_SEL(ts->ref_sel);
+   adc_ctrl1_mask = STMPE_SAMPLE_TIME(0xff) | STMPE_MOD_12B(0xff) |
+STMPE_REF_SEL(0xff);
 
ret = stmpe_set_bits(stmpe, STMPE_REG_ADC_CTRL1,
adc_ctrl1_mask, adc_ctrl1);
@@ -225,15 +215,17 @@ static int stmpe_init_hw(struct stmpe_touch *ts)
}
 
ret = stmpe_set_bits(stmpe, STMPE_REG_ADC_CTRL2,
-   ADC_FREQ(0xff), ADC_FREQ(ts->adc_freq));
+   STMPE_ADC_FREQ(0xff), STMPE_ADC_FREQ(ts->adc_freq));
if (ret) {
dev_err(dev, "Could not setup ADC\n");
return ret;
}
 
-   tsc_cfg = AVE_CTRL(ts->ave_ctrl) | DET_DELAY(ts->touch_det_delay) |
-   SETTLING(ts->settling);
-   tsc_cfg_mask = AVE_CTRL(0xff) | DET_DELAY(0xff) | SETTLING(0xff);
+   tsc_cfg = STMPE_AVE_CTRL(ts->ave_ctrl) |
+ STMPE_DET_DELAY(ts->touch_det_delay) |
+ STMPE_SETTLING(ts->settling);
+   tsc_cfg_mask = STMPE_AVE_CTRL(0xff) | STMPE_DET_DELAY(0xff) |
+  STMPE_SETTLING(0xff);
 
ret = stmpe_set_bits(stmpe, STMPE_REG_TSC_CFG, tsc_cfg_mask, tsc_cfg);
if (ret) {
@@ -242,14 +234,14 @@ static int stmpe_init_hw(struct stmpe_touch *ts)
}
 
ret = stmpe_set_bits(stmpe, STMPE_REG_TSC_FRACTION_Z,
-   FRACTION_Z(0xff), FRACTION_Z(ts->fraction_z));
+   STMPE_FRACTION_Z(0xff), 
STMPE_FRACTION_Z(ts->fraction_z));
if (ret) {
dev_err(dev, "Could not config touch\n");
return ret;
}
 
ret = stmpe_set_bits(stmpe, STMPE_REG_TSC_I_DRIVE,
-   I_DRIVE(0xff), I_DRIVE(ts->i_drive));
+   STMPE_I_DRIVE(0xff), STMPE_I_DRIVE(ts->i_drive));
if (ret) {
dev_err(dev, "Could not config touch\n");
return ret;
@@ -263,7 +255,7 @@ static int stmpe_init_hw(struct stmpe_touch *ts)
}
 
ret = stmpe_set_bits(stmpe, STMPE_REG_TSC_CTRL,
-   OP_MODE(0xff), OP_MODE(OP_MOD_XYZ));
+   STMPE_OP_MODE(0xff), STMPE_OP_MODE(OP_MOD_XYZ));
if (ret) {
dev_err(dev, "Could not set mode\n");
return ret;
diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h
index 4a827af17e59..c0353f6431f9 100644
--- a/include/linux/mfd/stmpe.h
+++ b/include/linux/mfd/stmpe.h
@@ -10,6 +10,17 @@
 
 #include 
 
+#define STMPE_SAMPLE_TIME(x)   ((x & 0xf) << 4)
+#define STMPE_MOD_12B(x)   ((x & 0x1) << 3)
+#define STMPE_REF_SEL(x)   ((x & 0x1) << 1)
+#define STMPE_ADC_FREQ(x)  (x & 0x3)
+#define STMPE_AVE_CTRL(x)  ((x & 0x3) << 6)
+#define STMPE_DET_DELAY(x) ((x & 0x7) << 3)
+#define STMPE_SETTLING(x)  (x & 0x7)
+#define STMPE_FRACTION_Z(x)(x & 0x7)
+#define STMPE_I_DRIVE(x)   (x & 0x1)
+#define STMPE_OP_MODE(x)   ((x & 0x7) << 1)
+
 struct device;
 struct regulator;
 
-- 
2.19.1



[PATCH v3 3/4] iio: adc: add STMPE ADC devicetree bindings

2018-11-23 Thread Philippe Schenker
From: Stefan Agner 

This adds the devicetree bindings for the STMPE ADC.

Signed-off-by: Stefan Agner 
Signed-off-by: Max Krummenacher 
Signed-off-by: Philippe Schenker 
---

Changes in v3:
 - Reformatted documentation for touchscreen to use tabs and have a better
   overview of the settings.
 - Added note which adc-settings will take precedence.
 - changed typo in sample-time setting from 144 clocks to 124 clocks, as stated
   in the datasheet.

Changes in v2:
 - Moved the bindings for ADC to the overlying mfd.
 - Reformatted for better readability

 .../devicetree/bindings/iio/adc/stmpe-adc.txt | 21 +++
 .../bindings/input/touchscreen/stmpe.txt  | 60 ---
 .../devicetree/bindings/mfd/stmpe.txt | 28 ++---
 3 files changed, 80 insertions(+), 29 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/stmpe-adc.txt

diff --git a/Documentation/devicetree/bindings/iio/adc/stmpe-adc.txt 
b/Documentation/devicetree/bindings/iio/adc/stmpe-adc.txt
new file mode 100644
index ..480e66422625
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/adc/stmpe-adc.txt
@@ -0,0 +1,21 @@
+STMPE ADC driver
+
+
+Required properties:
+ - compatible: "st,stmpe-adc"
+
+Optional properties:
+Note that the ADC is shared with the STMPE touchscreen. ADC related settings
+have to be done in the mfd.
+- st,norequest-mask: bitmask specifying which ADC channels should _not_ be
+  requestable due to different usage (e.g. touch)
+
+Node name must be stmpe_adc and should be child node of stmpe node to
+which it belongs.
+
+Example:
+
+   stmpe_adc {
+   compatible = "st,stmpe-adc";
+   st,norequest-mask = <0x0F>; /* dont use ADC CH3-0 */
+   };
diff --git a/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt 
b/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt
index 127baa31a77a..414586513a02 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt
@@ -5,36 +5,52 @@ Required properties:
  - compatible: "st,stmpe-ts"
 
 Optional properties:
-- st,sample-time: ADC converstion time in number of clock.  (0 -> 36 clocks, 1 
->
-  44 clocks, 2 -> 56 clocks, 3 -> 64 clocks, 4 -> 80 clocks, 5 -> 96 clocks, 6
-  -> 144 clocks), recommended is 4.
-- st,mod-12b: ADC Bit mode (0 -> 10bit ADC, 1 -> 12bit ADC)
-- st,ref-sel: ADC reference source (0 -> internal reference, 1 -> external
-  reference)
-- st,adc-freq: ADC Clock speed (0 -> 1.625 MHz, 1 -> 3.25 MHz, 2 || 3 -> 6.5 
MHz)
-- st,ave-ctrl: Sample average control (0 -> 1 sample, 1 -> 2 samples, 2 -> 4
-  samples, 3 -> 8 samples)
-- st,touch-det-delay: Touch detect interrupt delay (0 -> 10 us, 1 -> 50 us, 2 
->
-  100 us, 3 -> 500 us, 4-> 1 ms, 5 -> 5 ms, 6 -> 10 ms, 7 -> 50 ms) recommended
-  is 3
-- st,settling: Panel driver settling time (0 -> 10 us, 1 -> 100 us, 2 -> 500 
us, 3
-  -> 1 ms, 4 -> 5 ms, 5 -> 10 ms, 6 for 50 ms, 7 -> 100 ms) recommended is 2
-- st,fraction-z: Length of the fractional part in z (fraction-z ([0..7]) = 
Count of
-  the fractional part) recommended is 7
-- st,i-drive: current limit value of the touchscreen drivers (0 -> 20 mA 
typical 35
-  mA max, 1 -> 50 mA typical 80 mA max)
+- st,ave-ctrl  : Sample average control
+   0 -> 1 sample
+   1 -> 2 samples
+   2 -> 4 samples
+   3 -> 8 samples
+- st,touch-det-delay   : Touch detect interrupt delay (recommended is 3)
+   0 -> 10 us  5 -> 5 ms
+   1 -> 50 us  6 -> 10 ms
+   2 -> 100 us 7 -> 50 ms
+   3 -> 500 us
+   4-> 1 ms
+- st,settling  : Panel driver settling time (recommended is 2)
+   0 -> 10 us  5 -> 10 ms
+   1 -> 100 us 6 for 50 ms
+   2 -> 500 us 7 -> 100 ms
+   3 -> 1 ms
+   4 -> 5 ms
+- st,fraction-z: Length of the fractional part in z 
(recommended is 7)
+ (fraction-z ([0..7]) = Count of the fractional part)
+- st,i-drive   : current limit value of the touchscreen drivers
+   0 -> 20 mA (typical 35mA max)
+   1 -> 50 mA (typical 80 mA max)
+
+Optional properties common with MFD (deprecated):
+ - st,sample-time  : ADC conversion time in number of clock.
+   0 -> 36 clocks 

[PATCH v3 4/4] ARM: dts: Add stmpe-adc driver to relevant devicetrees

2018-11-23 Thread Philippe Schenker
From: Philippe Schenker 

Activate the stmpe-adc driver as found on Apalis/Colibri iMX6/T30 modules

Signed-off-by: Philippe Schenker 
---

Changes in v3:
 - None

Changes in v2:
 - Put common ADC settings in mfd

 arch/arm/boot/dts/imx6qdl-apalis.dtsi  | 22 ++
 arch/arm/boot/dts/imx6qdl-colibri.dtsi | 23 +++
 arch/arm/boot/dts/tegra30-apalis.dtsi  | 22 ++
 arch/arm/boot/dts/tegra30-colibri.dtsi | 22 ++
 4 files changed, 57 insertions(+), 32 deletions(-)

diff --git a/arch/arm/boot/dts/imx6qdl-apalis.dtsi 
b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
index 3dc99dd8dde1..8db476d8978d 100644
--- a/arch/arm/boot/dts/imx6qdl-apalis.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
@@ -331,11 +331,18 @@
id = <0>;
blocks = <0x5>;
irq-trigger = <0x1>;
+   /* 3.25 MHz ADC clock speed */
+   st,adc-freq = <1>;
+   /* 12-bit ADC */
+   st,mod-12b = <1>;
+   /* internal ADC reference */
+   st,ref-sel = <0>;
+   /* ADC converstion time: 80 clocks */
+   st,sample-time = <4>;
+   /* forbid to use ADC channels 3-0 (touch) */
 
stmpe_touchscreen {
compatible = "st,stmpe-ts";
-   /* 3.25 MHz ADC clock speed */
-   st,adc-freq = <1>;
/* 8 sample average control */
st,ave-ctrl = <3>;
/* 7 length fractional part in z */
@@ -345,17 +352,16 @@
 * current limit value
 */
st,i-drive = <1>;
-   /* 12-bit ADC */
-   st,mod-12b = <1>;
-   /* internal ADC reference */
-   st,ref-sel = <0>;
-   /* ADC converstion time: 80 clocks */
-   st,sample-time = <4>;
/* 1 ms panel driver settling time */
st,settling = <3>;
/* 5 ms touch detect interrupt delay */
st,touch-det-delay = <5>;
};
+
+   stmpe_adc {
+   compatible = "st,stmpe-adc";
+   st,norequest-mask = <0x0F>;
+   };
};
 };
 
diff --git a/arch/arm/boot/dts/imx6qdl-colibri.dtsi 
b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
index 87e15e7cb32b..2e303d79c7f8 100644
--- a/arch/arm/boot/dts/imx6qdl-colibri.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
@@ -262,11 +262,18 @@
id = <0>;
blocks = <0x5>;
irq-trigger = <0x1>;
+   /* 3.25 MHz ADC clock speed */
+   st,adc-freq = <1>;
+   /* 12-bit ADC */
+   st,mod-12b = <1>;
+   /* internal ADC reference */
+   st,ref-sel = <0>;
+   /* ADC converstion time: 80 clocks */
+   st,sample-time = <4>;
+   /* forbid to use ADC channels 3-0 (touch) */
 
stmpe_touchscreen {
compatible = "st,stmpe-ts";
-   /* 3.25 MHz ADC clock speed */
-   st,adc-freq = <1>;
/* 8 sample average control */
st,ave-ctrl = <3>;
/* 7 length fractional part in z */
@@ -276,17 +283,17 @@
 * current limit value
 */
st,i-drive = <1>;
-   /* 12-bit ADC */
-   st,mod-12b = <1>;
-   /* internal ADC reference */
-   st,ref-sel = <0>;
-   /* ADC converstion time: 80 clocks */
-   st,sample-time = <4>;
/* 1 ms panel driver settling time */
st,settling = <3>;
/* 5 ms touch detect interrupt delay */
st,touch-det-delay = <5>;
};
+
+   stmpe_adc {
+   compatible = "st,stmpe-adc";
+   /* 3.25 MHz ADC clock speed */
+   st,norequest-mask = <0x0F>;
+   };
};
 };
 
diff --git a/arch/arm/boot/dts/tegra30-apalis.dtsi 
b/arch/arm/boot/dts/tegra30-apalis.dtsi
index 7f112f192fe9..850b0d13549a 100644
--- a/arch/arm/boot/dts/tegra30-apalis.dtsi
+++ b/arch/arm/boot/dts/tegra30-apalis.dtsi
@@ -976,11 +976,18 @@
id = <0>;
blocks = <0x5>;
irq-tri

[PATCH v2 1/4] mfd: stmpe: Move ADC related defines to header of mfd

2018-11-19 Thread Philippe Schenker
Move defines that are ADC related to the header of the overlying mfd,
so they can be used from multiple sub-devices.

Signed-off-by: Philippe Schenker 
---

Changes in v2:
 - This is a new added commit. Separate commit for moving the defines out of
   drivers/input/touchscreen/stmpe-ts.c to overlying mfd-device 
drivers/mfd/stmpe.c
 - Pre-fix defines with STMPE_

 drivers/input/touchscreen/stmpe-ts.c | 34 +++-
 include/linux/mfd/stmpe.h| 11 +
 2 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/drivers/input/touchscreen/stmpe-ts.c 
b/drivers/input/touchscreen/stmpe-ts.c
index 2a78e27b4495..c5d9006588a2 100644
--- a/drivers/input/touchscreen/stmpe-ts.c
+++ b/drivers/input/touchscreen/stmpe-ts.c
@@ -49,17 +49,6 @@
 
 #define STMPE_IRQ_TOUCH_DET0
 
-#define SAMPLE_TIME(x) ((x & 0xf) << 4)
-#define MOD_12B(x) ((x & 0x1) << 3)
-#define REF_SEL(x) ((x & 0x1) << 1)
-#define ADC_FREQ(x)(x & 0x3)
-#define AVE_CTRL(x)((x & 0x3) << 6)
-#define DET_DELAY(x)   ((x & 0x7) << 3)
-#define SETTLING(x)(x & 0x7)
-#define FRACTION_Z(x)  (x & 0x7)
-#define I_DRIVE(x) (x & 0x1)
-#define OP_MODE(x) ((x & 0x7) << 1)
-
 #define STMPE_TS_NAME  "stmpe-ts"
 #define XY_MASK0xfff
 
@@ -213,9 +202,10 @@ static int stmpe_init_hw(struct stmpe_touch *ts)
return ret;
}
 
-   adc_ctrl1 = SAMPLE_TIME(ts->sample_time) | MOD_12B(ts->mod_12b) |
-   REF_SEL(ts->ref_sel);
-   adc_ctrl1_mask = SAMPLE_TIME(0xff) | MOD_12B(0xff) | REF_SEL(0xff);
+   adc_ctrl1 = STMPE_SAMPLE_TIME(ts->sample_time) |
+   STMPE_MOD_12B(ts->mod_12b) | STMPE_REF_SEL(ts->ref_sel);
+   adc_ctrl1_mask = STMPE_SAMPLE_TIME(0xff) | STMPE_MOD_12B(0xff) |
+STMPE_REF_SEL(0xff);
 
ret = stmpe_set_bits(stmpe, STMPE_REG_ADC_CTRL1,
adc_ctrl1_mask, adc_ctrl1);
@@ -225,15 +215,17 @@ static int stmpe_init_hw(struct stmpe_touch *ts)
}
 
ret = stmpe_set_bits(stmpe, STMPE_REG_ADC_CTRL2,
-   ADC_FREQ(0xff), ADC_FREQ(ts->adc_freq));
+   STMPE_ADC_FREQ(0xff), STMPE_ADC_FREQ(ts->adc_freq));
if (ret) {
dev_err(dev, "Could not setup ADC\n");
return ret;
}
 
-   tsc_cfg = AVE_CTRL(ts->ave_ctrl) | DET_DELAY(ts->touch_det_delay) |
-   SETTLING(ts->settling);
-   tsc_cfg_mask = AVE_CTRL(0xff) | DET_DELAY(0xff) | SETTLING(0xff);
+   tsc_cfg = STMPE_AVE_CTRL(ts->ave_ctrl) |
+ STMPE_DET_DELAY(ts->touch_det_delay) |
+ STMPE_SETTLING(ts->settling);
+   tsc_cfg_mask = STMPE_AVE_CTRL(0xff) | STMPE_DET_DELAY(0xff) |
+  STMPE_SETTLING(0xff);
 
ret = stmpe_set_bits(stmpe, STMPE_REG_TSC_CFG, tsc_cfg_mask, tsc_cfg);
if (ret) {
@@ -242,14 +234,14 @@ static int stmpe_init_hw(struct stmpe_touch *ts)
}
 
ret = stmpe_set_bits(stmpe, STMPE_REG_TSC_FRACTION_Z,
-   FRACTION_Z(0xff), FRACTION_Z(ts->fraction_z));
+   STMPE_FRACTION_Z(0xff), 
STMPE_FRACTION_Z(ts->fraction_z));
if (ret) {
dev_err(dev, "Could not config touch\n");
return ret;
}
 
ret = stmpe_set_bits(stmpe, STMPE_REG_TSC_I_DRIVE,
-   I_DRIVE(0xff), I_DRIVE(ts->i_drive));
+   STMPE_I_DRIVE(0xff), STMPE_I_DRIVE(ts->i_drive));
if (ret) {
dev_err(dev, "Could not config touch\n");
return ret;
@@ -263,7 +255,7 @@ static int stmpe_init_hw(struct stmpe_touch *ts)
}
 
ret = stmpe_set_bits(stmpe, STMPE_REG_TSC_CTRL,
-   OP_MODE(0xff), OP_MODE(OP_MOD_XYZ));
+   STMPE_OP_MODE(0xff), STMPE_OP_MODE(OP_MOD_XYZ));
if (ret) {
dev_err(dev, "Could not set mode\n");
return ret;
diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h
index 4a827af17e59..c0353f6431f9 100644
--- a/include/linux/mfd/stmpe.h
+++ b/include/linux/mfd/stmpe.h
@@ -10,6 +10,17 @@
 
 #include 
 
+#define STMPE_SAMPLE_TIME(x)   ((x & 0xf) << 4)
+#define STMPE_MOD_12B(x)   ((x & 0x1) << 3)
+#define STMPE_REF_SEL(x)   ((x & 0x1) << 1)
+#define STMPE_ADC_FREQ(x)  (x & 0x3)
+#define STMPE_AVE_CTRL(x)  ((x & 0x3) << 6)
+#define STMPE_DET_DELAY(x) ((x & 0x7) << 3)
+#define STMPE_SETTLING(x)  (x & 0x7)
+#define STMPE_FRACTION_Z(x)(x & 0x7)
+#define STMPE_I_DRIVE(x)   (x & 0x1)
+#define STMPE_OP_MODE(x)   ((x & 0x7) << 1)
+
 struct device;
 struct regulator;
 
-- 
2.19.1



[PATCH v2 3/4] iio: adc: add STMPE ADC devicetree bindings

2018-11-19 Thread Philippe Schenker
From: Stefan Agner 

This adds the devicetree bindings for the STMPE ADC.

Signed-off-by: Stefan Agner 
Signed-off-by: Max Krummenacher 
Signed-off-by: Philippe Schenker 
---

Changes in v2:
 - Moved the bindings for ADC to the overlying mfd.
 - Reformatted for better readability

 .../devicetree/bindings/iio/adc/stmpe-adc.txt | 21 ++
 .../bindings/input/touchscreen/stmpe.txt  | 11 
 .../devicetree/bindings/mfd/stmpe.txt | 28 ++-
 3 files changed, 42 insertions(+), 18 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/stmpe-adc.txt

diff --git a/Documentation/devicetree/bindings/iio/adc/stmpe-adc.txt 
b/Documentation/devicetree/bindings/iio/adc/stmpe-adc.txt
new file mode 100644
index ..480e66422625
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/adc/stmpe-adc.txt
@@ -0,0 +1,21 @@
+STMPE ADC driver
+
+
+Required properties:
+ - compatible: "st,stmpe-adc"
+
+Optional properties:
+Note that the ADC is shared with the STMPE touchscreen. ADC related settings
+have to be done in the mfd.
+- st,norequest-mask: bitmask specifying which ADC channels should _not_ be
+  requestable due to different usage (e.g. touch)
+
+Node name must be stmpe_adc and should be child node of stmpe node to
+which it belongs.
+
+Example:
+
+   stmpe_adc {
+   compatible = "st,stmpe-adc";
+   st,norequest-mask = <0x0F>; /* dont use ADC CH3-0 */
+   };
diff --git a/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt 
b/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt
index 127baa31a77a..71e1359749f2 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt
@@ -5,13 +5,6 @@ Required properties:
  - compatible: "st,stmpe-ts"
 
 Optional properties:
-- st,sample-time: ADC converstion time in number of clock.  (0 -> 36 clocks, 1 
->
-  44 clocks, 2 -> 56 clocks, 3 -> 64 clocks, 4 -> 80 clocks, 5 -> 96 clocks, 6
-  -> 144 clocks), recommended is 4.
-- st,mod-12b: ADC Bit mode (0 -> 10bit ADC, 1 -> 12bit ADC)
-- st,ref-sel: ADC reference source (0 -> internal reference, 1 -> external
-  reference)
-- st,adc-freq: ADC Clock speed (0 -> 1.625 MHz, 1 -> 3.25 MHz, 2 || 3 -> 6.5 
MHz)
 - st,ave-ctrl: Sample average control (0 -> 1 sample, 1 -> 2 samples, 2 -> 4
   samples, 3 -> 8 samples)
 - st,touch-det-delay: Touch detect interrupt delay (0 -> 10 us, 1 -> 50 us, 2 
->
@@ -31,10 +24,6 @@ Example:
 
stmpe_touchscreen {
compatible = "st,stmpe-ts";
-   st,sample-time = <4>;
-   st,mod-12b = <1>;
-   st,ref-sel = <0>;
-   st,adc-freq = <1>;
st,ave-ctrl = <1>;
st,touch-det-delay = <2>;
st,settling = <2>;
diff --git a/Documentation/devicetree/bindings/mfd/stmpe.txt 
b/Documentation/devicetree/bindings/mfd/stmpe.txt
index c797c05cd3c2..bd991514d6c1 100644
--- a/Documentation/devicetree/bindings/mfd/stmpe.txt
+++ b/Documentation/devicetree/bindings/mfd/stmpe.txt
@@ -4,15 +4,29 @@ STMPE is an MFD device which may expose the following inbuilt 
devices: gpio,
 keypad, touchscreen, adc, pwm, rotator.
 
 Required properties:
- - compatible   : "st,stmpe[610|801|811|1600|1601|2401|2403]"
- - reg  : I2C/SPI address of the device
+ - compatible  : "st,stmpe[610|801|811|1600|1601|2401|2403]"
+ - reg : I2C/SPI address of the device
 
 Optional properties:
- - interrupts   : The interrupt outputs from the controller
- - interrupt-controller : Marks the device node as an interrupt 
controller
- - wakeup-source: Marks the input device as wakable
- - st,autosleep-timeout : Valid entries (ms); 4, 16, 32, 64, 128, 256, 
512 and 1024
- - irq-gpio : If present, which GPIO to use for event IRQ
+ - interrupts  : The interrupt outputs from the controller
+ - interrupt-controller: Marks the device node as an interrupt 
controller
+ - wakeup-source   : Marks the input device as wakable
+ - st,autosleep-timeout: Valid entries (ms); 4, 16, 32, 64, 
128, 256, 512 and 1024
+ - irq-gpio: If present, which GPIO to use for event IRQ
+
+Optional properties for devices with touch and ADC (STMPE811|STMPE610):
+ - st,sample-time  : ADC conversion time in number of clock.
+   0 -> 36 clocks  4 -> 80 clocks 
(recommended)
+   1 -> 44 clocks  5 -> 96 clocks
+   2 -> 56 clocks   

[PATCH v2 2/4] iio: adc: add STMPE ADC driver using IIO framework

2018-11-19 Thread Philippe Schenker
From: Stefan Agner 

This adds an ADC driver for the STMPE device using the industrial
input/output interface. The driver supports raw reading of values.
The driver depends on the MFD STMPE driver. If the touchscreen
block is enabled too, only four of the 8 ADC channels are available.

Signed-off-by: Stefan Agner 
Signed-off-by: Max Krummenacher 
Signed-off-by: Philippe Schenker 
---

Changes in v2:
 - Code formatting
 - Move code to setup ADC to MFD device, as it is used by both drivers
   adc and touchscreen
 - Removed unused includes
 - Defined the macro STMPE_START_ONE_TEMP_CONV with other macros.
 - Added new macro that defines the channel of the temperature sensor.
   Took new name for STMPE_MAX_ADC->STMPE_ADC_LAST_NR and used it throughout
   the code for better readability.
 - Added mutex_unlock where missing.

 drivers/iio/adc/Kconfig  |   7 +
 drivers/iio/adc/Makefile |   1 +
 drivers/iio/adc/stmpe-adc.c  | 340 +++
 drivers/input/touchscreen/stmpe-ts.c |  43 +---
 drivers/mfd/Kconfig  |   3 +-
 drivers/mfd/stmpe.c  |  84 +++
 include/linux/mfd/stmpe.h|   6 +
 7 files changed, 445 insertions(+), 39 deletions(-)
 create mode 100644 drivers/iio/adc/stmpe-adc.c

diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
index a52fea8749a9..5d4c061d8296 100644
--- a/drivers/iio/adc/Kconfig
+++ b/drivers/iio/adc/Kconfig
@@ -734,6 +734,13 @@ config STM32_DFSDM_ADC
  This driver can also be built as a module.  If so, the module
  will be called stm32-dfsdm-adc.
 
+config STMPE_ADC
+   tristate "STMicroelectronics STMPE ADC driver"
+   depends on (OF || COMPILE_TEST || MFD_STMPE)
+   help
+ Say yes here to build support for ST Microelectronics STMPE
+ built-in ADC block (stmpe811).
+
 config STX104
tristate "Apex Embedded Systems STX104 driver"
depends on PC104 && X86
diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile
index a6e6a0b659e2..cba889c30bf9 100644
--- a/drivers/iio/adc/Makefile
+++ b/drivers/iio/adc/Makefile
@@ -69,6 +69,7 @@ obj-$(CONFIG_STM32_ADC_CORE) += stm32-adc-core.o
 obj-$(CONFIG_STM32_ADC) += stm32-adc.o
 obj-$(CONFIG_STM32_DFSDM_CORE) += stm32-dfsdm-core.o
 obj-$(CONFIG_STM32_DFSDM_ADC) += stm32-dfsdm-adc.o
+obj-$(CONFIG_STMPE_ADC) += stmpe-adc.o
 obj-$(CONFIG_TI_ADC081C) += ti-adc081c.o
 obj-$(CONFIG_TI_ADC0832) += ti-adc0832.o
 obj-$(CONFIG_TI_ADC084S021) += ti-adc084s021.o
diff --git a/drivers/iio/adc/stmpe-adc.c b/drivers/iio/adc/stmpe-adc.c
new file mode 100644
index ..151f1c8f827e
--- /dev/null
+++ b/drivers/iio/adc/stmpe-adc.c
@@ -0,0 +1,340 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ *  STMicroelectronics STMPE811 IIO ADC Driver
+ *
+ *  4 channel, 10/12-bit ADC
+ *
+ *  Copyright (C) 2013-2018 Toradex AG 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define STMPE_REG_INT_STA  0x0B
+#define STMPE_REG_ADC_INT_EN   0x0E
+#define STMPE_REG_ADC_INT_STA  0x0F
+
+#define STMPE_REG_ADC_CTRL10x20
+#define STMPE_REG_ADC_CTRL20x21
+#define STMPE_REG_ADC_CAPT 0x22
+#define STMPE_REG_ADC_DATA_CH(channel) (0x30 + 2 * (channel))
+
+#define STMPE_REG_TEMP_CTRL0x60
+#define STMPE_TEMP_CTRL_ENABLE BIT(0)
+#define STMPE_TEMP_CTRL_ACQBIT(1)
+#define STMPE_TEMP_CTRL_THRES_EN   BIT(3)
+#define STMPE_START_ONE_TEMP_CONV  (STMPE_TEMP_CTRL_ENABLE | \
+   STMPE_TEMP_CTRL_ACQ | \
+   STMPE_TEMP_CTRL_THRES_EN)
+#define STMPE_REG_TEMP_DATA0x61
+#define STMPE_REG_TEMP_TH  0x63
+#define STMPE_ADC_LAST_NR  7
+#define STMPE_TEMP_CHANNEL (STMPE_ADC_LAST_NR + 1)
+
+#define STMPE_ADC_CH(channel)  ((1 << (channel)) & 0xff)
+
+#define STMPE_ADC_TIMEOUT  msecs_to_jiffies(1000)
+
+struct stmpe_adc {
+   struct stmpe *stmpe;
+   struct clk *clk;
+   struct device *dev;
+
+   /* We are allocating plus one for the temperature channel */
+   struct iio_chan_spec stmpe_adc_iio_channels[STMPE_ADC_LAST_NR + 2];
+
+   struct completion completion;
+
+   u8 channel;
+   u32 value;
+   u32 norequest_mask;
+};
+
+static int stmpe_read_raw(struct iio_dev *indio_dev,
+ struct iio_chan_spec const *chan,
+ int *val,
+ int *val2,
+ long mask)
+{
+   struct stmpe_adc *info = iio_priv(indio_dev);
+   long ret;
+
+   switch (mask) {
+   case IIO_CHAN_INFO_RAW:
+   case IIO_CHAN_INFO_PROCESSED:
+
+   mutex_lock(_dev->mlock);
+
+   info->channel = (u8)chan->channel;
+
+   swit

[PATCH v2 4/4] ARM: dts: Add stmpe-adc driver to relevant devicetrees

2018-11-19 Thread Philippe Schenker
From: Philippe Schenker 

Activate the stmpe-adc driver as found on Apalis/Colibri iMX6/T30 modules

Signed-off-by: Philippe Schenker 
---

Changes in v2:
 - Put common ADC settings in mfd

 arch/arm/boot/dts/imx6qdl-apalis.dtsi  | 22 ++
 arch/arm/boot/dts/imx6qdl-colibri.dtsi | 23 +++
 arch/arm/boot/dts/tegra30-apalis.dtsi  | 22 ++
 arch/arm/boot/dts/tegra30-colibri.dtsi | 22 ++
 4 files changed, 57 insertions(+), 32 deletions(-)

diff --git a/arch/arm/boot/dts/imx6qdl-apalis.dtsi 
b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
index 3dc99dd8dde1..8db476d8978d 100644
--- a/arch/arm/boot/dts/imx6qdl-apalis.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
@@ -331,11 +331,18 @@
id = <0>;
blocks = <0x5>;
irq-trigger = <0x1>;
+   /* 3.25 MHz ADC clock speed */
+   st,adc-freq = <1>;
+   /* 12-bit ADC */
+   st,mod-12b = <1>;
+   /* internal ADC reference */
+   st,ref-sel = <0>;
+   /* ADC converstion time: 80 clocks */
+   st,sample-time = <4>;
+   /* forbid to use ADC channels 3-0 (touch) */
 
stmpe_touchscreen {
compatible = "st,stmpe-ts";
-   /* 3.25 MHz ADC clock speed */
-   st,adc-freq = <1>;
/* 8 sample average control */
st,ave-ctrl = <3>;
/* 7 length fractional part in z */
@@ -345,17 +352,16 @@
 * current limit value
 */
st,i-drive = <1>;
-   /* 12-bit ADC */
-   st,mod-12b = <1>;
-   /* internal ADC reference */
-   st,ref-sel = <0>;
-   /* ADC converstion time: 80 clocks */
-   st,sample-time = <4>;
/* 1 ms panel driver settling time */
st,settling = <3>;
/* 5 ms touch detect interrupt delay */
st,touch-det-delay = <5>;
};
+
+   stmpe_adc {
+   compatible = "st,stmpe-adc";
+   st,norequest-mask = <0x0F>;
+   };
};
 };
 
diff --git a/arch/arm/boot/dts/imx6qdl-colibri.dtsi 
b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
index 87e15e7cb32b..2e303d79c7f8 100644
--- a/arch/arm/boot/dts/imx6qdl-colibri.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
@@ -262,11 +262,18 @@
id = <0>;
blocks = <0x5>;
irq-trigger = <0x1>;
+   /* 3.25 MHz ADC clock speed */
+   st,adc-freq = <1>;
+   /* 12-bit ADC */
+   st,mod-12b = <1>;
+   /* internal ADC reference */
+   st,ref-sel = <0>;
+   /* ADC converstion time: 80 clocks */
+   st,sample-time = <4>;
+   /* forbid to use ADC channels 3-0 (touch) */
 
stmpe_touchscreen {
compatible = "st,stmpe-ts";
-   /* 3.25 MHz ADC clock speed */
-   st,adc-freq = <1>;
/* 8 sample average control */
st,ave-ctrl = <3>;
/* 7 length fractional part in z */
@@ -276,17 +283,17 @@
 * current limit value
 */
st,i-drive = <1>;
-   /* 12-bit ADC */
-   st,mod-12b = <1>;
-   /* internal ADC reference */
-   st,ref-sel = <0>;
-   /* ADC converstion time: 80 clocks */
-   st,sample-time = <4>;
/* 1 ms panel driver settling time */
st,settling = <3>;
/* 5 ms touch detect interrupt delay */
st,touch-det-delay = <5>;
};
+
+   stmpe_adc {
+   compatible = "st,stmpe-adc";
+   /* 3.25 MHz ADC clock speed */
+   st,norequest-mask = <0x0F>;
+   };
};
 };
 
diff --git a/arch/arm/boot/dts/tegra30-apalis.dtsi 
b/arch/arm/boot/dts/tegra30-apalis.dtsi
index 7f112f192fe9..850b0d13549a 100644
--- a/arch/arm/boot/dts/tegra30-apalis.dtsi
+++ b/arch/arm/boot/dts/tegra30-apalis.dtsi
@@ -976,11 +976,18 @@
id = <0>;
blocks = <0x5>;
irq-trigger = <0x1>;
+ 

[PATCH 3/3] dt-bindings: regulator: add regulator-fixed-clock binding

2019-09-03 Thread Philippe Schenker
This adds the documentation to the compatible regulator-fixed-clock

Signed-off-by: Philippe Schenker 

---

 .../bindings/regulator/fixed-regulator.yaml| 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/regulator/fixed-regulator.yaml 
b/Documentation/devicetree/bindings/regulator/fixed-regulator.yaml
index a650b457085d..5fd081e80b43 100644
--- a/Documentation/devicetree/bindings/regulator/fixed-regulator.yaml
+++ b/Documentation/devicetree/bindings/regulator/fixed-regulator.yaml
@@ -19,9 +19,19 @@ description:
 allOf:
   - $ref: "regulator.yaml#"
 
+select:
+  properties:
+compatible:
+  contains:
+const: regulator-fixed-clock
+  required:
+- clocks
+
 properties:
   compatible:
-const: regulator-fixed
+items:
+  - const: regulator-fixed
+  - const: regulator-fixed-clock
 
   regulator-name: true
 
@@ -29,6 +39,12 @@ properties:
 description: gpio to use for enable control
 maxItems: 1
 
+  clocks:
+description:
+  clock to use for enable control. This binding is only available if
+  the compatible is chosen to regulator-fixed-clock. The clock binding
+  is mandatory if compatible is chosen to regulator-fixed-clock.
+
   startup-delay-us:
 description: startup time in microseconds
 $ref: /schemas/types.yaml#/definitions/uint32
-- 
2.23.0



[PATCH 0/3] Add new binding regulator-fixed-clock to regulator-fixed

2019-09-03 Thread Philippe Schenker


Our hardware has a FET that is switching power rail of the ethernet PHY
on and off. This switching enable signal is a clock from the SoC.

There is no possibility in regulator subsystem to have this hardware
reflected in software.

I already discussed with Mark Brown about possible solutions and he
suggested to create at least a new compatible. [1]
This discussion includes also a better explanation of our circuit as
well as schematics. So please refer to that link if you have questions
about that.

In this first attempt I created a new binding "regulator-fixed-clock"
that can take a clock from devicetree. This is a simple addition to
regulator-fixed. If the binding regulator-fixed-clock is given, the
clock is simply enabled on regulator enable and disabled on regulator
disable.
To be able to have multiple consumers a counter variable is also given
that tells how many consumers need power from this regulator.

Best regards,
Philippe

[1] https://lkml.org/lkml/2019/8/7/78



Philippe Schenker (3):
  regulator: fixed: add possibility to enable by clock
  ARM: dts: imx6ull-colibri: add phy-supply and respective regulator
  dt-bindings: regulator: add regulator-fixed-clock binding

 .../bindings/regulator/fixed-regulator.yaml   | 18 +++-
 arch/arm/boot/dts/imx6ull-colibri.dtsi| 12 +++
 drivers/regulator/fixed.c | 86 ++-
 3 files changed, 112 insertions(+), 4 deletions(-)

-- 
2.23.0



[PATCH 2/3] ARM: dts: imx6ull-colibri: add phy-supply and respective regulator

2019-09-03 Thread Philippe Schenker
This adds regulator-fixed-clock, a fixed-regulator that turns on and
off with a clock and add it to the phy.

Signed-off-by: Philippe Schenker 
---

 arch/arm/boot/dts/imx6ull-colibri.dtsi | 12 
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/boot/dts/imx6ull-colibri.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri.dtsi
index d56728f03c35..76021b842a97 100644
--- a/arch/arm/boot/dts/imx6ull-colibri.dtsi
+++ b/arch/arm/boot/dts/imx6ull-colibri.dtsi
@@ -47,6 +47,17 @@
states = <180 0x1 330 0x0>;
vin-supply = <_module_3v3>;
};
+
+   reg_eth_phy: regulator-eth-phy {
+   compatible = "regulator-fixed-clock";
+   regulator-boot-on;
+   regulator-name = "eth_phy";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   clocks = < IMX6UL_CLK_ENET2_REF_125M>;
+   startup-delay-us = <15>;
+   vin-supply = <_module_3v3>;
+   };
 };
 
  {
@@ -66,6 +77,7 @@
pinctrl-0 = <_enet2>;
phy-mode = "rmii";
phy-handle = <>;
+   phy-supply = <_eth_phy>;
status = "okay";
 
mdio {
-- 
2.23.0



[PATCH 1/3] regulator: fixed: add possibility to enable by clock

2019-09-03 Thread Philippe Schenker
This commit adds the possibility to choose the compatible
"regulator-fixed-clock" in devicetree.

This is a special regulator-fixed that has to have a clock, from which
the regulator gets switched on and off.

Signed-off-by: Philippe Schenker 
---

 drivers/regulator/fixed.c | 86 +--
 1 file changed, 83 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index 999547dde99d..eadeca9a1a6c 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -23,14 +23,66 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
+#include 
+
 
 struct fixed_voltage_data {
struct regulator_desc desc;
struct regulator_dev *dev;
+
+   struct clk *enable_clock;
+   unsigned int clk_enable_counter;
+};
+
+struct fixed_dev_type {
+   bool has_enable_clock;
+};
+
+static const struct fixed_dev_type fixed_voltage_data = {
+   .has_enable_clock = false,
 };
 
+static const struct fixed_dev_type fixed_clkenable_data = {
+   .has_enable_clock = true,
+};
+
+static int reg_clock_enable(struct regulator_dev *rdev)
+{
+   struct fixed_voltage_data *priv = rdev_get_drvdata(rdev);
+   int ret = 0;
+
+   ret = clk_prepare_enable(priv->enable_clock);
+   if (ret)
+   return ret;
+
+   priv->clk_enable_counter++;
+
+   return ret;
+}
+
+static int reg_clock_disable(struct regulator_dev *rdev)
+{
+   struct fixed_voltage_data *priv = rdev_get_drvdata(rdev);
+
+   clk_disable_unprepare(priv->enable_clock);
+   priv->clk_enable_counter--;
+
+   return 0;
+}
+
+static int reg_clock_is_enabled(struct regulator_dev *rdev)
+{
+   struct fixed_voltage_data *priv = rdev_get_drvdata(rdev);
+
+   if (priv->clk_enable_counter > 0)
+   return 1;
+
+   return 0;
+}
+
 
 /**
  * of_get_fixed_voltage_config - extract fixed_voltage_config structure info
@@ -84,10 +136,19 @@ of_get_fixed_voltage_config(struct device *dev,
 static struct regulator_ops fixed_voltage_ops = {
 };
 
+static struct regulator_ops fixed_voltage_clkenabled_ops = {
+   .enable = reg_clock_enable,
+   .disable = reg_clock_disable,
+   .is_enabled = reg_clock_is_enabled,
+};
+
 static int reg_fixed_voltage_probe(struct platform_device *pdev)
 {
+   struct device *dev = >dev;
struct fixed_voltage_config *config;
struct fixed_voltage_data *drvdata;
+   const struct fixed_dev_type *drvtype =
+   of_match_device(dev->driver->of_match_table, dev)->data;
struct regulator_config cfg = { };
enum gpiod_flags gflags;
int ret;
@@ -118,7 +179,18 @@ static int reg_fixed_voltage_probe(struct platform_device 
*pdev)
}
drvdata->desc.type = REGULATOR_VOLTAGE;
drvdata->desc.owner = THIS_MODULE;
-   drvdata->desc.ops = _voltage_ops;
+
+   if (drvtype->has_enable_clock) {
+   drvdata->desc.ops = _voltage_clkenabled_ops;
+
+   drvdata->enable_clock = devm_clk_get(dev, NULL);
+   if (IS_ERR(drvdata->enable_clock)) {
+   dev_err(dev, "Cant get enable-clock from devicetree\n");
+   return -ENOENT;
+   }
+   } else {
+   drvdata->desc.ops = _voltage_ops;
+   }
 
drvdata->desc.enable_time = config->startup_delay;
 
@@ -191,8 +263,16 @@ static int reg_fixed_voltage_probe(struct platform_device 
*pdev)
 
 #if defined(CONFIG_OF)
 static const struct of_device_id fixed_of_match[] = {
-   { .compatible = "regulator-fixed", },
-   {},
+   {
+   .compatible = "regulator-fixed",
+   .data = _voltage_data,
+   },
+   {
+   .compatible = "regulator-fixed-clock",
+   .data = _clkenable_data,
+   },
+   {
+   },
 };
 MODULE_DEVICE_TABLE(of, fixed_of_match);
 #endif
-- 
2.23.0



Re: [PATCH 3/3] dt-bindings: regulator: add regulator-fixed-clock binding

2019-09-04 Thread Philippe Schenker
On Tue, 2019-09-03 at 09:45 +0100, Rob Herring wrote:
> On Tue, Sep 3, 2019 at 9:03 AM Philippe Schenker
>  wrote:
> > This adds the documentation to the compatible regulator-fixed-clock
> 
> Please explain what that is in this patch.

Hi Rob and thanks for your comments. I will change this commit message
for a possible v2 into this:

This adds the documentation to the compatible regulator-fixed-clock.
This binding is a special binding of regulator-fixed and adds the
ability to add a clock to regulator-fixed, so the regulator can be
enabled and disabled with that clock.
If the special compatible regulator-fixed-clock is used it is mandatory
to supply a clock.

> > 
> 
> > Signed-off-by: Philippe Schenker 
> > 
> > ---
> > 
> >  .../bindings/regulator/fixed-regulator.yaml| 18
> > +-
> >  1 file changed, 17 insertions(+), 1 deletion(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/regulator/fixed-
> > regulator.yaml b/Documentation/devicetree/bindings/regulator/fixed-
> > regulator.yaml
> > index a650b457085d..5fd081e80b43 100644
> > --- a/Documentation/devicetree/bindings/regulator/fixed-
> > regulator.yaml
> > +++ b/Documentation/devicetree/bindings/regulator/fixed-
> > regulator.yaml
> > @@ -19,9 +19,19 @@ description:
> >  allOf:
> >- $ref: "regulator.yaml#"
> > 
> > +select:
> > +  properties:
> > +compatible:
> > +  contains:
> > +const: regulator-fixed-clock
> > +  required:
> > +- clocks
> 
> You don't need this.
> 
> If you add a new compatible, then this should probably be a new schema
> doc. Is the 'gpio' property valid in this case as if a clock is the
> enable, can you also have a gpio enable? That said, it seems like the
> new compatible is only for validating the DT in the driver. You could
> just use a clock if present and default to current behavior if not.
> It's not the kernel's job to validate DTs.

The gpio property is valid with this compatible. I added regulator-
fixed-clock to regulator-fixed hence I also don't want to create a new
schema file.

With the above select statement I wanted to state clocks as required
when the compatible regulator-fixed-clock is given.

> 
> >  properties:
> >compatible:
> > -const: regulator-fixed
> > +items:
> > +  - const: regulator-fixed
> > +  - const: regulator-fixed-clock
> 
> This says you must have 'compatible = "regulator-fixed",
> "regulator-fixed-clock";'.
> 
> What you want is:
> 
> enum:
>   - regulator-fixed
>   - regulator-fixed-clock

Thanks, this was exactly what I wanted to do.

> 
> >regulator-name: true
> > 
> > @@ -29,6 +39,12 @@ properties:
> >  description: gpio to use for enable control
> >  maxItems: 1
> > 
> > +  clocks:
> > +description:
> > +  clock to use for enable control. This binding is only
> > available if
> > +  the compatible is chosen to regulator-fixed-clock. The clock
> > binding
> > +  is mandatory if compatible is chosen to regulator-fixed-
> > clock.
> 
> Need to define how many clocks (maxItems: 1).

Will do for a possible v2. I want to wait what Mark Brown says about the
addition in general, maybe I have to change all over how this speciality
is added into regulator subsystem and therefore also the binding will
change.

Philippe
> 
> > +
> >startup-delay-us:
> >  description: startup time in microseconds
> >  $ref: /schemas/types.yaml#/definitions/uint32
> > --
> > 2.23.0
> > 


[PATCH 10/22] ARM: dts: imx6qdl-colibri: Add missing pin declaration in iomuxc

2019-07-30 Thread Philippe Schenker
From: Philippe Schenker 

This adds the muxing for the optional pins usb-oc (overcurrent) and
usb-id.

Signed-off-by: Philippe Schenker 
---

 arch/arm/boot/dts/imx6qdl-colibri.dtsi | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm/boot/dts/imx6qdl-colibri.dtsi 
b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
index 019dda6b88ad..9a63debab0b5 100644
--- a/arch/arm/boot/dts/imx6qdl-colibri.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
@@ -615,6 +615,13 @@
>;
};
 
+   pinctrl_usbh_oc_1: usbh_oc-1 {
+   fsl,pins = <
+   /* USBH_OC */
+   MX6QDL_PAD_EIM_D30__GPIO3_IO30  0x1b0b0
+   >;
+   };
+
pinctrl_spdif: spdifgrp {
fsl,pins = <
MX6QDL_PAD_GPIO_17__SPDIF_OUT 0x1b0b0
@@ -681,6 +688,13 @@
>;
};
 
+   pinctrl_usbc_id_1: usbc_id-1 {
+   fsl,pins = <
+   /* USBC_ID */
+   MX6QDL_PAD_NANDF_D2__GPIO2_IO02 0x1b0b0
+   >;
+   };
+
pinctrl_usdhc1: usdhc1grp {
fsl,pins = <
MX6QDL_PAD_SD1_CMD__SD1_CMD 0x17071
-- 
2.22.0



[PATCH 22/22] ARM: dts: imx6ull-colibri: Add touchscreens used with Eval Board

2019-07-30 Thread Philippe Schenker
From: Philippe Schenker 

This adds the common touchscreens that are used with Toradex's
Eval Boards.

Signed-off-by: Philippe Schenker 

---

 .../arm/boot/dts/imx6ull-colibri-eval-v3.dtsi | 37 +++
 1 file changed, 37 insertions(+)

diff --git a/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi
index d3c4809f140e..cd72d3decf6a 100644
--- a/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi
+++ b/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi
@@ -112,6 +112,34 @@
  {
status = "okay";
 
+   /*
+* the PCAPs use SODIMM 28/30, also used for PWM, PWM, aka pwm5,
+* pwm6. so if you enable one of the PCAP controllers disable the pwms
+*/
+   atmel_mxt_ts: atmel_mxt_ts@4a {
+   compatible = "atmel,maxtouch";
+   pinctrl-names = "default";
+   pinctrl-0 = <_gpiotouch>;
+   reg = <0x4a>;
+   interrupt-parent = <>;
+   interrupts = <16 IRQ_TYPE_EDGE_FALLING>; /* SODIMM 28 */
+   reset-gpios = < 5 GPIO_ACTIVE_HIGH>; /* SODIMM 30 */
+   status = "disabled";
+   };
+
+   touch: touchrevf0710a@10 {
+   compatible = "touchrevolution,fusion-f0710a";
+   pinctrl-names = "default";
+   pinctrl-0 = <_gpiotouch>;
+   reg = <0x10>;
+   /* SODIMM 28, Pen down interrupt */
+   gpios = < 16 GPIO_ACTIVE_HIGH
+   /* SODIMM 30, Reset interrupt */
+ 5 GPIO_ACTIVE_LOW
+   >;
+   status = "disabled";
+   };
+
/* M41T0M6 real time clock on carrier board */
m41t0m6: rtc@68 {
compatible = "st,m41t0";
@@ -188,3 +216,12 @@
sd-uhs-sdr104;
status = "okay";
 };
+
+ {
+   pinctrl_gpiotouch: touchgpios {
+   fsl,pins = <
+   MX6UL_PAD_NAND_DQS__GPIO4_IO16  0x74
+   MX6UL_PAD_ENET1_TX_EN__GPIO2_IO05   0x14
+   >;
+   };
+};
-- 
2.22.0



[PATCH 21/22] ARM: dts: imx6/7-colibri: switch dr_mode to otg

2019-07-30 Thread Philippe Schenker
From: Philippe Schenker 

In order for the otg ports, that these modules support, it is needed
that dr_mode is on otg. Switch to use that feature.

Signed-off-by: Philippe Schenker 
---

 arch/arm/boot/dts/imx6qdl-colibri.dtsi | 2 +-
 arch/arm/boot/dts/imx7-colibri.dtsi| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/imx6qdl-colibri.dtsi 
b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
index 9a63debab0b5..6674198346d2 100644
--- a/arch/arm/boot/dts/imx6qdl-colibri.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
@@ -388,7 +388,7 @@
  {
pinctrl-names = "default";
disable-over-current;
-   dr_mode = "peripheral";
+   dr_mode = "otg";
status = "disabled";
 };
 
diff --git a/arch/arm/boot/dts/imx7-colibri.dtsi 
b/arch/arm/boot/dts/imx7-colibri.dtsi
index 67f5e0c87fdc..42478f1aa146 100644
--- a/arch/arm/boot/dts/imx7-colibri.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri.dtsi
@@ -320,7 +320,7 @@
 };
 
  {
-   dr_mode = "host";
+   dr_mode = "otg";
 };
 
  {
-- 
2.22.0



[PATCH 01/22] ARM: dts: imx7-colibri: make sure module supplies are always on

2019-07-30 Thread Philippe Schenker
From: Marcel Ziswiler 

Prevent regulators from being switched off.

Signed-off-by: Marcel Ziswiler 
Signed-off-by: Philippe Schenker 
---

 arch/arm/boot/dts/imx7-colibri.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/boot/dts/imx7-colibri.dtsi 
b/arch/arm/boot/dts/imx7-colibri.dtsi
index 895fbde4d433..f1c1971f2160 100644
--- a/arch/arm/boot/dts/imx7-colibri.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri.dtsi
@@ -54,6 +54,7 @@
regulator-name = "+V3.3";
regulator-min-microvolt = <330>;
regulator-max-microvolt = <330>;
+   regulator-always-on;
};
 
reg_module_3v3_avdd: regulator-module-3v3-avdd {
@@ -61,6 +62,7 @@
regulator-name = "+V3.3_AVDD_AUDIO";
regulator-min-microvolt = <330>;
regulator-max-microvolt = <330>;
+   regulator-always-on;
};
 
sound {
-- 
2.22.0



[PATCH 15/22] ARM: dts: apalis-imx6: Add some optional I2C devices

2019-07-30 Thread Philippe Schenker
From: Philippe Schenker 

This commit adds the mipi_csi node to Toradex's evalboard as found
on the mezzanine connector

Signed-off-by: Philippe Schenker 
---

 arch/arm/boot/dts/imx6q-apalis-eval.dts | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/imx6q-apalis-eval.dts 
b/arch/arm/boot/dts/imx6q-apalis-eval.dts
index 33193d6137c0..ea419b9a0386 100644
--- a/arch/arm/boot/dts/imx6q-apalis-eval.dts
+++ b/arch/arm/boot/dts/imx6q-apalis-eval.dts
@@ -166,6 +166,14 @@
};
 };
 
+_csi {
+   ipu_id = <0>;
+   csi_id = <1>;
+   v_channel = <0>;
+   lanes = <2>;
+   status = "okay";
+};
+
  {
brightness-levels = <0 127 191 223 239 247 251 255>;
default-brightness-level = <1>;
-- 
2.22.0



[PATCH 12/22] ARM: dts: imx6: Add touchscreens used on Toradex eval boards

2019-07-30 Thread Philippe Schenker
From: Philippe Schenker 

This commit adds the touchscreens from Toradex so one can enable it.

Signed-off-by: Philippe Schenker 
---

 arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts  | 44 +++
 arch/arm/boot/dts/imx6q-apalis-eval.dts   | 19 
 arch/arm/boot/dts/imx6q-apalis-ixora-v1.1.dts | 19 
 arch/arm/boot/dts/imx6q-apalis-ixora.dts  | 19 
 4 files changed, 101 insertions(+)

diff --git a/arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts 
b/arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts
index 9a5d6c94cca4..63d4f9ca9ad8 100644
--- a/arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts
+++ b/arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts
@@ -168,6 +168,34 @@
  {
status = "okay";
 
+   /* Atmel maxtouch controller */
+   atmel_mxt_ts: atmel_mxt_ts@4a {
+   compatible = "atmel,maxtouch";
+   pinctrl-names = "default";
+   pinctrl-0 = <_pcap_1>;
+   reg = <0x4a>;
+   interrupt-parent = <>;
+   interrupts = <9 IRQ_TYPE_EDGE_FALLING>; /* SODIMM 28 */
+   reset-gpios = < 10 GPIO_ACTIVE_HIGH>; /* SODIMM 30 */
+   status = "disabled";
+   };
+
+   /*
+* the PCAPs use SODIMM 28/30, also used for PWM, PWM, aka pwm1,
+* pwm4. So if you enable one of the PCAP controllers disable the pwms.
+*/
+   pcap: pcap@10 {
+   /* TouchRevolution Fusion 7 and 10 multi-touch controller */
+   compatible = "touchrevolution,fusion-f0710a";
+   reg = <0x10>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_pcap_1>;
+   gpios = <  9 0 /* SODIMM 28, Pen down interrupt */
+ 10 0 /* SODIMM 30, Reset */
+   >;
+   status = "disabled";
+   };
+
/* M41T0M6 real time clock on carrier board */
rtc_i2c: rtc@68 {
compatible = "st,m41t0";
@@ -175,6 +203,22 @@
};
 };
 
+ {
+   pinctrl_pcap_1: pcap-1 {
+   fsl,pins = <
+   MX6QDL_PAD_GPIO_9__GPIO1_IO09   0x1b0b0 /* SODIMM 28 */
+   MX6QDL_PAD_SD4_DAT2__GPIO2_IO10 0x1b0b0 /* SODIMM 30 */
+   >;
+   };
+
+   pinctrl_mxt_ts: mxt-ts {
+   fsl,pins = <
+   MX6QDL_PAD_EIM_CS1__GPIO2_IO24  0x130b0 /* SODIMM 107 */
+   MX6QDL_PAD_SD2_DAT1__GPIO1_IO14 0x130b0 /* SODIMM 106 */
+   >;
+   };
+};
+
 _di0_disp0 {
remote-endpoint = <_display_in>;
 };
diff --git a/arch/arm/boot/dts/imx6q-apalis-eval.dts 
b/arch/arm/boot/dts/imx6q-apalis-eval.dts
index 0edd3043d9c1..60ec5e89d215 100644
--- a/arch/arm/boot/dts/imx6q-apalis-eval.dts
+++ b/arch/arm/boot/dts/imx6q-apalis-eval.dts
@@ -167,6 +167,25 @@
  {
status = "okay";
 
+   /* Atmel maxtouch controller */
+   atmel_mxt_ts: atmel_mxt_ts@4a {
+   compatible = "atmel,maxtouch";
+   reg = <0x4a>;
+   interrupt-parent = <>;
+   interrupts = <10 IRQ_TYPE_EDGE_FALLING>;
+   reset-gpios = < 9 GPIO_ACTIVE_HIGH>; /* SODIMM 13 */
+   status = "disabled";
+   };
+
+   pcap@10 {
+   /* TouchRevolution Fusion 7 and 10 multi-touch controller */
+   compatible = "touchrevolution,fusion-f0710a";
+   reg = <0x10>;
+   gpios = < 10 0 /* MXM3 11, Pen down interrupt */
+  9 0 /* MXM3 13, Reset */
+   >;
+   };
+
pcie-switch@58 {
compatible = "plx,pex8605";
reg = <0x58>;
diff --git a/arch/arm/boot/dts/imx6q-apalis-ixora-v1.1.dts 
b/arch/arm/boot/dts/imx6q-apalis-ixora-v1.1.dts
index b94bb687be6b..98a8ae20b1f2 100644
--- a/arch/arm/boot/dts/imx6q-apalis-ixora-v1.1.dts
+++ b/arch/arm/boot/dts/imx6q-apalis-ixora-v1.1.dts
@@ -172,6 +172,25 @@
  {
status = "okay";
 
+   /* Atmel maxtouch controller */
+   atmel_mxt_ts: atmel_mxt_ts@4a {
+   compatible = "atmel,maxtouch";
+   reg = <0x4a>;
+   interrupt-parent = <>;
+   interrupts = <10 IRQ_TYPE_EDGE_FALLING>;
+   reset-gpios = < 9 GPIO_ACTIVE_HIGH>; /* SODIMM 13 */
+   status = "disabled";
+   };
+
+   pcap@10 {
+   /* TouchRevolution Fusion 7 and 10 multi-touch controller */
+   compatible = "touchrevolution,fusion-f0710a";
+   reg = <0x10>;
+   gpios = < 10 GPIO_ACTIVE_HIGH /* MXM3 11, Pen down 
interrupt */
+  9 GPIO_ACTIVE_HIGH /* MXM3 1

[PATCH 14/22] ARM: dts: apalis-imx6: Add some example I2C devices

2019-07-30 Thread Philippe Schenker
From: Philippe Schenker 

Those devices are used in conjunction with Toradex's evalboard.

Signed-off-by: Philippe Schenker 
---

 arch/arm/boot/dts/imx6q-apalis-eval.dts | 95 +
 1 file changed, 95 insertions(+)

diff --git a/arch/arm/boot/dts/imx6q-apalis-eval.dts 
b/arch/arm/boot/dts/imx6q-apalis-eval.dts
index 60ec5e89d215..33193d6137c0 100644
--- a/arch/arm/boot/dts/imx6q-apalis-eval.dts
+++ b/arch/arm/boot/dts/imx6q-apalis-eval.dts
@@ -140,6 +140,30 @@
regulator-max-microvolt = <330>;
regulator-always-on;
};
+
+   reg_1p8v: regulator-1p8v {
+   compatible = "regulator-fixed";
+   regulator-name = "1P8V";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   regulator-always-on;
+   };
+
+   reg_2p5v: regulator-2p5v {
+   compatible = "regulator-fixed";
+   regulator-name = "2P5V";
+   regulator-min-microvolt = <250>;
+   regulator-max-microvolt = <250>;
+   regulator-always-on;
+   };
+
+   reg_3p3v: regulator-3p3v {
+   compatible = "regulator-fixed";
+   regulator-name = "3P3V";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   regulator-always-on;
+   };
 };
 
  {
@@ -204,6 +228,77 @@
  */
  {
status = "okay";
+
+   adv7280: adv7280@21 {
+   compatible = "adv7280";
+   reg = <0x21>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_ipu1_csi0 _cam_mclk>;
+   clocks = < 200>;
+   clock-names = "csi_mclk";
+   DOVDD-supply = <_3p3v>;
+   AVDD-supply = <_3p3v>;
+   DVDD-supply = <_3p3v>;
+   PVDD-supply = <_3p3v>;
+   csi_id = <0>;
+   mclk = <2400>;
+   mclk_source = <1>;
+   status = "okay";
+   };
+
+   /* Video ADC on Analog Camera Module */
+   adv7180: adv7180@21 {
+   compatible = "adv,adv7180";
+   reg = <0x21>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_ipu1_csi0 _cam_mclk>;
+   clocks = < 200>;
+   clock-names = "csi_mclk";
+   DOVDD-supply = <_3p3v>; /* 3.3v */
+   AVDD-supply = <_3p3v>;  /* 1.8v */
+   DVDD-supply = <_3p3v>;  /* 1.8v */
+   PVDD-supply = <_3p3v>;  /* 1.8v */
+   csi_id = <0>;
+   mclk = <2400>;
+   mclk_source = <1>;
+   cvbs = <1>;
+   status = "disabled";
+   };
+
+   max9526: max9526@20 {
+   compatible = "maxim,max9526";
+   reg = <0x20>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_ipu1_csi0 _cam_mclk>;
+   clocks = < 200>;
+   clock-names = "csi_mclk";
+   DVDDIO-supply = <_3p3v>; /* 3.3v */
+   AVDD-supply = <_3p3v>;  /* 1.8v */
+   DVDD-supply = <_3p3v>;  /* 1.8v */
+   csi_id = <0>;
+   mclk = <2400>;
+   mclk_source = <1>;
+   cvbs = <1>;
+   status = "okay";
+   };
+
+   ov5640_mipi@3c {
+   compatible = "ovti,ov564x_mipi";
+   reg = <0x3c>;
+   clocks = < 147>;
+   clock-names = "csi_mclk";
+   DOVDD-supply = <_1p8v>;
+   AVDD-supply = <_2p5v>;
+   DVDD-supply = <_1p8v>;
+   pwn-gpios = < 5 GPIO_ACTIVE_HIGH>;
+   rst-gpios = < 4 GPIO_ACTIVE_LOW>;
+   ipu_id = <0>;
+   csi_id = <1>;
+   mclk = <2200>;
+   mclk_source = <0>;
+   pwms = < 0 45 0>;
+   status = "okay";
+   };
 };
 
 _di1_disp1 {
-- 
2.22.0



[PATCH 17/22] ARM: dts: imx6ull-colibri: reduce v_batt current in power off

2019-07-30 Thread Philippe Schenker
From: Max Krummenacher 

Reduce the current drawn from VCC_BATT when the main power on the 3V3
pins to the module are switched off.

This switches off SoC internal pull resistors which are provided on the
module for TAMPER7 and TAMPER9 SoC pin and switches on a pull down
instead of a pullup for the USBC_DET module pin (TAMPER2).

Signed-off-by: Max Krummenacher 
Signed-off-by: Philippe Schenker 
---

 arch/arm/boot/dts/imx6ull-colibri.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/imx6ull-colibri.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri.dtsi
index 1019ce69a242..1f112ec55e5c 100644
--- a/arch/arm/boot/dts/imx6ull-colibri.dtsi
+++ b/arch/arm/boot/dts/imx6ull-colibri.dtsi
@@ -533,19 +533,19 @@
 
pinctrl_snvs_ad7879_int: snvs-ad7879-int-grp { /* TOUCH Interrupt */
fsl,pins = <
-   MX6ULL_PAD_SNVS_TAMPER7__GPIO5_IO07 0x1b0b0
+   MX6ULL_PAD_SNVS_TAMPER7__GPIO5_IO07 0x100b0
>;
};
 
pinctrl_snvs_reg_sd: snvs-reg-sd-grp {
fsl,pins = <
-   MX6ULL_PAD_SNVS_TAMPER9__GPIO5_IO09 0x4001b8b0
+   MX6ULL_PAD_SNVS_TAMPER9__GPIO5_IO09 0x400100b0
>;
};
 
pinctrl_snvs_usbc_det: snvs-usbc-det-grp {
fsl,pins = <
-   MX6ULL_PAD_SNVS_TAMPER2__GPIO5_IO02 0x1b0b0
+   MX6ULL_PAD_SNVS_TAMPER2__GPIO5_IO02 0x130b0
>;
};
 
-- 
2.22.0



[PATCH 11/22] ARM: dts: imx6: Add sleep state to can interfaces

2019-07-30 Thread Philippe Schenker
From: Philippe Schenker 

This patch prepares the devicetree for the new Ixora V1.2 where we are
able to turn off the supply of the can transceiver. This implies to use
a sleep state on transmission pins in order to prevent backfeeding.

Signed-off-by: Philippe Schenker 
---

 arch/arm/boot/dts/imx6qdl-apalis.dtsi | 27 +--
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/arch/arm/boot/dts/imx6qdl-apalis.dtsi 
b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
index 7c4ad541c3f5..59ed2e4a1fd1 100644
--- a/arch/arm/boot/dts/imx6qdl-apalis.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
@@ -148,14 +148,16 @@
 };
 
  {
-   pinctrl-names = "default";
-   pinctrl-0 = <_flexcan1>;
+   pinctrl-names = "default", "sleep";
+   pinctrl-0 = <_flexcan1_default>;
+   pinctrl-1 = <_flexcan1_sleep>;
status = "disabled";
 };
 
  {
-   pinctrl-names = "default";
-   pinctrl-0 = <_flexcan2>;
+   pinctrl-names = "default", "sleep";
+   pinctrl-0 = <_flexcan2_default>;
+   pinctrl-1 = <_flexcan2_sleep>;
status = "disabled";
 };
 
@@ -599,19 +601,32 @@
>;
};
 
-   pinctrl_flexcan1: flexcan1grp {
+   pinctrl_flexcan1_default: flexcan1defgrp {
fsl,pins = <
MX6QDL_PAD_GPIO_7__FLEXCAN1_TX 0x1b0b0
MX6QDL_PAD_GPIO_8__FLEXCAN1_RX 0x1b0b0
>;
};
 
-   pinctrl_flexcan2: flexcan2grp {
+   pinctrl_flexcan1_sleep: flexcan1slpgrp {
+   fsl,pins = <
+   MX6QDL_PAD_GPIO_7__GPIO1_IO07 0x0
+   MX6QDL_PAD_GPIO_8__GPIO1_IO08 0x0
+   >;
+   };
+
+   pinctrl_flexcan2_default: flexcan2defgrp {
fsl,pins = <
MX6QDL_PAD_KEY_COL4__FLEXCAN2_TX 0x1b0b0
MX6QDL_PAD_KEY_ROW4__FLEXCAN2_RX 0x1b0b0
>;
};
+   pinctrl_flexcan2_sleep: flexcan2slpgrp {
+   fsl,pins = <
+   MX6QDL_PAD_KEY_COL4__GPIO4_IO14 0x0
+   MX6QDL_PAD_KEY_ROW4__GPIO4_IO15 0x0
+   >;
+   };
 
pinctrl_gpio_bl_on: gpioblon {
fsl,pins = <
-- 
2.22.0



[PATCH 16/22] ARM: dts: imx6ull-colibri: Add sleep mode to fec

2019-07-30 Thread Philippe Schenker
From: Philippe Schenker 

Do not change the clock as the power for this phy is switched
with that clock.

Signed-off-by: Philippe Schenker 
---

 arch/arm/boot/dts/imx6ull-colibri.dtsi | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/imx6ull-colibri.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri.dtsi
index d56728f03c35..1019ce69a242 100644
--- a/arch/arm/boot/dts/imx6ull-colibri.dtsi
+++ b/arch/arm/boot/dts/imx6ull-colibri.dtsi
@@ -62,8 +62,9 @@
 };
 
  {
-   pinctrl-names = "default";
+   pinctrl-names = "default", "sleep";
pinctrl-0 = <_enet2>;
+   pinctrl-1 = <_enet2_sleep>;
phy-mode = "rmii";
phy-handle = <>;
status = "okay";
@@ -220,6 +221,21 @@
>;
};
 
+   pinctrl_enet2_sleep: enet2sleepgrp {
+   fsl,pins = <
+   MX6UL_PAD_GPIO1_IO06__GPIO1_IO060x0
+   MX6UL_PAD_GPIO1_IO07__GPIO1_IO070x0
+   MX6UL_PAD_ENET2_RX_DATA0__GPIO2_IO080x0
+   MX6UL_PAD_ENET2_RX_DATA1__GPIO2_IO090x0
+   MX6UL_PAD_ENET2_RX_EN__GPIO2_IO10   0x0
+   MX6UL_PAD_ENET2_RX_ER__GPIO2_IO15   0x0
+   MX6UL_PAD_ENET2_TX_CLK__ENET2_REF_CLK2  0x4001b031
+   MX6UL_PAD_ENET2_TX_DATA0__GPIO2_IO110x0
+   MX6UL_PAD_ENET2_TX_DATA1__GPIO2_IO120x0
+   MX6UL_PAD_ENET2_TX_EN__GPIO2_IO13   0x0
+   >;
+   };
+
pinctrl_ecspi1_cs: ecspi1-cs-grp {
fsl,pins = <
MX6UL_PAD_LCD_DATA21__GPIO3_IO260x000a0
-- 
2.22.0



[PATCH 20/22] ARM: dts: imx6ull-colibri: Add general wakeup key used on Colibri

2019-07-30 Thread Philippe Schenker
From: Philippe Schenker 

This adds the possibility to wake the module with an external signal
as defined in the Colibri standard

Signed-off-by: Philippe Schenker 
---

 arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi
index 3bee37c75aa6..d3c4809f140e 100644
--- a/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi
+++ b/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi
@@ -8,6 +8,20 @@
stdout-path = "serial0:115200n8";
};
 
+   gpio-keys {
+   compatible = "gpio-keys";
+   pinctrl-names = "default";
+   pinctrl-0 = <_snvs_gpiokeys>;
+
+   power {
+   label = "Wake-Up";
+   gpios = < 1 GPIO_ACTIVE_HIGH>;
+   linux,code = ;
+   debounce-interval = <10>;
+   wakeup-source;
+   };
+   };
+
/* fixed crystal dedicated to mcp2515 */
clk16m: clk16m {
compatible = "fixed-clock";
-- 
2.22.0



[PATCH 18/22] ARM: dts: imx6ull-colibri: Add watchdog

2019-07-30 Thread Philippe Schenker
From: Philippe Schenker 

This patch adds the watchdog to the imx6ull-colibri devicetree

Signed-off-by: Philippe Schenker 
---

 arch/arm/boot/dts/imx6ull-colibri.dtsi | 12 
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/boot/dts/imx6ull-colibri.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri.dtsi
index 1f112ec55e5c..e3220298dd6f 100644
--- a/arch/arm/boot/dts/imx6ull-colibri.dtsi
+++ b/arch/arm/boot/dts/imx6ull-colibri.dtsi
@@ -199,6 +199,12 @@
assigned-clock-rates = <0>, <19800>;
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_wdog>;
+   fsl,ext-reset-output;
+};
+
  {
pinctrl_can_int: canint-grp {
fsl,pins = <
@@ -506,6 +512,12 @@
MX6UL_PAD_GPIO1_IO03__OSC32K_32K_OUT0x14
>;
};
+
+   pinctrl_wdog: wdog-grp {
+   fsl,pins = <
+   MX6UL_PAD_LCD_RESET__WDOG1_WDOG_ANY0x30b0
+   >;
+   };
 };
 
 _snvs {
-- 
2.22.0



[PATCH 19/22] ARM: dts: imx6ull: improve can templates

2019-07-30 Thread Philippe Schenker
From: Max Krummenacher 

Add the pinmuxing and a inactive node for flexcan1 on SODIMM 55/63
and move the inactive flexcan nodes to imx6ull-colibri-eval-v3.dtsi
where they belong.

Note that this commit does not enable flexcan functionality, but rather
eases the effort needed to do so.

Signed-off-by: Max Krummenacher 
Signed-off-by: Philippe Schenker 
---

 arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi | 12 
 arch/arm/boot/dts/imx6ull-colibri-nonwifi.dtsi |  2 +-
 arch/arm/boot/dts/imx6ull-colibri-wifi.dtsi|  2 +-
 arch/arm/boot/dts/imx6ull-colibri.dtsi | 16 ++--
 4 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi
index b6147c76d159..3bee37c75aa6 100644
--- a/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi
+++ b/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi
@@ -83,6 +83,18 @@
};
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_flexcan1>;
+   status = "disabled";
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_flexcan2>;
+   status = "disabled";
+};
+
  {
status = "okay";
 
diff --git a/arch/arm/boot/dts/imx6ull-colibri-nonwifi.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri-nonwifi.dtsi
index fb213bec4654..95a11b8bcbdb 100644
--- a/arch/arm/boot/dts/imx6ull-colibri-nonwifi.dtsi
+++ b/arch/arm/boot/dts/imx6ull-colibri-nonwifi.dtsi
@@ -15,7 +15,7 @@
  {
pinctrl-names = "default";
pinctrl-0 = <_gpio1 _gpio2 _gpio3
-   _gpio4 _gpio5 _gpio6>;
+   _gpio4 _gpio5 _gpio6 _gpio7>;
 };
 
 _snvs {
diff --git a/arch/arm/boot/dts/imx6ull-colibri-wifi.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri-wifi.dtsi
index 038d8c90f6df..a0545431b3dc 100644
--- a/arch/arm/boot/dts/imx6ull-colibri-wifi.dtsi
+++ b/arch/arm/boot/dts/imx6ull-colibri-wifi.dtsi
@@ -26,7 +26,7 @@
  {
pinctrl-names = "default";
pinctrl-0 = <_gpio1 _gpio2 _gpio3
-   _gpio4 _gpio5>;
+   _gpio4 _gpio5 _gpio7>;
 
 };
 
diff --git a/arch/arm/boot/dts/imx6ull-colibri.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri.dtsi
index e3220298dd6f..553d4c1f80e9 100644
--- a/arch/arm/boot/dts/imx6ull-colibri.dtsi
+++ b/arch/arm/boot/dts/imx6ull-colibri.dtsi
@@ -256,6 +256,13 @@
>;
};
 
+   pinctrl_flexcan1: flexcan1-grp {
+   fsl,pins = <
+   MX6UL_PAD_ENET1_RX_DATA0__FLEXCAN1_TX   0x1b020
+   MX6UL_PAD_ENET1_RX_DATA1__FLEXCAN1_RX   0x1b020
+   >;
+   };
+
pinctrl_flexcan2: flexcan2-grp {
fsl,pins = <
MX6UL_PAD_ENET1_TX_DATA0__FLEXCAN2_RX   0x1b020
@@ -271,8 +278,6 @@
 
pinctrl_gpio1: gpio1-grp {
fsl,pins = <
-   MX6UL_PAD_ENET1_RX_DATA0__GPIO2_IO000x74 /* SODIMM 
55 */
-   MX6UL_PAD_ENET1_RX_DATA1__GPIO2_IO010x74 /* SODIMM 
63 */
MX6UL_PAD_UART3_RX_DATA__GPIO1_IO25 0X14 /* SODIMM 
77 */
MX6UL_PAD_JTAG_TCK__GPIO1_IO14  0x14 /* SODIMM 
99 */
MX6UL_PAD_NAND_CE1_B__GPIO4_IO140x14 /* SODIMM 
133 */
@@ -325,6 +330,13 @@
>;
};
 
+   pinctrl_gpio7: gpio7-grp { /* CAN1 */
+   fsl,pins = <
+   MX6UL_PAD_ENET1_RX_DATA0__GPIO2_IO000x74 /* SODIMM 
55 */
+   MX6UL_PAD_ENET1_RX_DATA1__GPIO2_IO010x74 /* SODIMM 
63 */
+   >;
+   };
+
pinctrl_gpmi_nand: gpmi-nand-grp {
fsl,pins = <
MX6UL_PAD_NAND_DATA00__RAWNAND_DATA00   0x100a9
-- 
2.22.0



[PATCH 13/22] ARM: dts: colibri-imx6: Add missing pinmuxing to Toradex eval board

2019-07-30 Thread Philippe Schenker
From: Philippe Schenker 

This patch adds some missing pinmuxing that is in the colibri
standard to the dts.

Signed-off-by: Philippe Schenker 
---

 arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts 
b/arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts
index 63d4f9ca9ad8..13800e60246c 100644
--- a/arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts
+++ b/arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts
@@ -204,6 +204,14 @@
 };
 
  {
+   pinctrl-names = "default";
+   pinctrl-0 = <
+   _weim_gpio_1 _weim_gpio_2
+   _weim_gpio_3 _weim_gpio_4
+   _weim_gpio_5 _weim_gpio_6
+   _usbh_oc_1 _usbc_id_1
+   >;
+
pinctrl_pcap_1: pcap-1 {
fsl,pins = <
MX6QDL_PAD_GPIO_9__GPIO1_IO09   0x1b0b0 /* SODIMM 28 */
-- 
2.22.0



[PATCH 09/22] ARM: dts: imx6qdl-colibri: add phy to fec

2019-07-30 Thread Philippe Schenker
From: Philippe Schenker 

Add the phy-node and mdio bus to the fec-node, represented as is on
hardware.
This commit includes micrel,led-mode that is set to the default
value, prepared for someone who wants to change this.

Signed-off-by: Philippe Schenker 
---

 arch/arm/boot/dts/imx6qdl-colibri.dtsi | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm/boot/dts/imx6qdl-colibri.dtsi 
b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
index 1beac22266ed..019dda6b88ad 100644
--- a/arch/arm/boot/dts/imx6qdl-colibri.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
@@ -140,7 +140,18 @@
pinctrl-names = "default";
pinctrl-0 = <_enet>;
phy-mode = "rmii";
+   phy-handle = <>;
status = "okay";
+
+   mdio {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   ethphy: ethernet-phy@0 {
+   reg = <0>;
+   micrel,led-mode = <0>;
+   };
+   };
 };
 
  {
-- 
2.22.0



[PATCH 05/22] ARM: dts: add recovery for I2C for iMX7

2019-07-30 Thread Philippe Schenker
From: Oleksandr Suvorov 

- add recovery mode for applicable i2c buses for
  Colibri iMX7 module.

Signed-off-by: Oleksandr Suvorov 
Signed-off-by: Philippe Schenker 
---

 arch/arm/boot/dts/imx7-colibri.dtsi | 25 +++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/imx7-colibri.dtsi 
b/arch/arm/boot/dts/imx7-colibri.dtsi
index a8d992f3e897..2480623c92ff 100644
--- a/arch/arm/boot/dts/imx7-colibri.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri.dtsi
@@ -140,8 +140,12 @@
 
  {
clock-frequency = <10>;
-   pinctrl-names = "default";
+   pinctrl-names = "default", "gpio";
pinctrl-0 = <_i2c1 _i2c1_int>;
+   pinctrl-1 = <_i2c1_recovery _i2c1_int>;
+   scl-gpios = < 4 GPIO_ACTIVE_HIGH>;
+   sda-gpios = < 5 GPIO_ACTIVE_HIGH>;
+
status = "okay";
 
codec: sgtl5000@a {
@@ -242,8 +246,11 @@
 
  {
clock-frequency = <10>;
-   pinctrl-names = "default";
+   pinctrl-names = "default", "gpio";
pinctrl-0 = <_i2c4>;
+   pinctrl-1 = <_i2c4_recovery>;
+   scl-gpios = < 8 GPIO_ACTIVE_HIGH>;
+   sda-gpios = < 9 GPIO_ACTIVE_HIGH>;
 };
 
  {
@@ -540,6 +547,13 @@
>;
};
 
+   pinctrl_i2c4_recovery: i2c4-recoverygrp {
+   fsl,pins = <
+   MX7D_PAD_ENET1_RGMII_TD2__GPIO7_IO8 0x407f
+   MX7D_PAD_ENET1_RGMII_TD3__GPIO7_IO9 0x407f
+   >;
+   };
+
pinctrl_lcdif_dat: lcdif-dat-grp {
fsl,pins = <
MX7D_PAD_LCD_DATA00__LCD_DATA0  0x79
@@ -740,6 +754,13 @@
>;
};
 
+   pinctrl_i2c1_recovery: i2c1-recoverygrp {
+   fsl,pins = <
+   MX7D_PAD_LPSR_GPIO1_IO04__GPIO1_IO4 0x407f
+   MX7D_PAD_LPSR_GPIO1_IO05__GPIO1_IO5 0x407f
+   >;
+   };
+
pinctrl_cd_usdhc1: usdhc1-cd-grp {
fsl,pins = <
MX7D_PAD_LPSR_GPIO1_IO00__GPIO1_IO0 0x59 /* CD */
-- 
2.22.0



[PATCH 00/22] This patchset holds some common changes that were never upstreamed.

2019-07-30 Thread Philippe Schenker
From: Philippe Schenker 

With latest downstream kernel upgrade, I took the aproach to select
mainline devicetrees and atomically add missing stuff for downstream.

These patches I send here are separated out with changes that also
have a benfit for mainline.

Philippe


Marcel Ziswiler (1):
  ARM: dts: imx7-colibri: make sure module supplies are always on

Max Krummenacher (2):
  ARM: dts: imx6ull-colibri: reduce v_batt current in power off
  ARM: dts: imx6ull: improve can templates

Oleksandr Suvorov (1):
  ARM: dts: add recovery for I2C for iMX7

Philippe Schenker (15):
  ARM: dts: imx7-colibri: prepare module device tree for FlexCAN
  ARM: dts: imx7-colibri: Add sleep mode to ethernet
  ARM: dts: imx7-colibri: Add touch controllers
  ARM: dts: imx6qdl-colibri: add phy to fec
  ARM: dts: imx6qdl-colibri: Add missing pin declaration in iomuxc
  ARM: dts: imx6: Add sleep state to can interfaces
  ARM: dts: imx6: Add touchscreens used on Toradex eval boards
  ARM: dts: colibri-imx6: Add missing pinmuxing to Toradex eval board
  ARM: dts: apalis-imx6: Add some example I2C devices
  ARM: dts: apalis-imx6: Add some optional I2C devices
  ARM: dts: imx6ull-colibri: Add sleep mode to fec
  ARM: dts: imx6ull-colibri: Add watchdog
  ARM: dts: imx6ull-colibri: Add general wakeup key used on Colibri
  ARM: dts: imx6/7-colibri: switch dr_mode to otg
  ARM: dts: imx6ull-colibri: Add touchscreens used with Eval Board

Stefan Agner (3):
  ARM: dts: imx7-colibri: disable HS400
  ARM: dts: imx7-colibri: add GPIO wakeup key
  ARM: dts: imx7-colibri: fix 1.8V/UHS support

 arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts  |  52 
 arch/arm/boot/dts/imx6q-apalis-eval.dts   | 122 ++
 arch/arm/boot/dts/imx6q-apalis-ixora-v1.1.dts |  19 +++
 arch/arm/boot/dts/imx6q-apalis-ixora.dts  |  19 +++
 arch/arm/boot/dts/imx6qdl-apalis.dtsi |  27 +++-
 arch/arm/boot/dts/imx6qdl-colibri.dtsi|  27 +++-
 .../arm/boot/dts/imx6ull-colibri-eval-v3.dtsi |  63 +
 .../arm/boot/dts/imx6ull-colibri-nonwifi.dtsi |   2 +-
 arch/arm/boot/dts/imx6ull-colibri-wifi.dtsi   |   2 +-
 arch/arm/boot/dts/imx6ull-colibri.dtsi|  52 +++-
 arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi   |  51 
 arch/arm/boot/dts/imx7-colibri.dtsi   | 114 ++--
 12 files changed, 524 insertions(+), 26 deletions(-)

-- 
2.22.0



[PATCH 02/22] ARM: dts: imx7-colibri: disable HS400

2019-07-30 Thread Philippe Schenker
From: Stefan Agner 

Force HS200 by masking bit 63 of the SDHCI capability register.
The i.MX ESDHC driver uses SDHCI_QUIRK2_CAPS_BIT63_FOR_HS400. With
that the stack checks bit 63 to descide whether HS400 is available.
Using sdhci-caps-mask allows to mask bit 63. The stack then selects
HS200 as operating mode.

This prevents rare communication errors with minimal effect on
performance:
sdhci-esdhc-imx 30b6.usdhc: warning! HS400 strobe DLL
status REF not lock!

Signed-off-by: Stefan Agner 
Signed-off-by: Philippe Schenker 
---

 arch/arm/boot/dts/imx7-colibri.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/imx7-colibri.dtsi 
b/arch/arm/boot/dts/imx7-colibri.dtsi
index f1c1971f2160..f7c9ce5bed47 100644
--- a/arch/arm/boot/dts/imx7-colibri.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri.dtsi
@@ -325,6 +325,7 @@
vmmc-supply = <_module_3v3>;
vqmmc-supply = <_DCDC3>;
non-removable;
+   sdhci-caps-mask = <0x8000 0x0>;
 };
 
  {
-- 
2.22.0



[PATCH 06/22] ARM: dts: imx7-colibri: add GPIO wakeup key

2019-07-30 Thread Philippe Schenker
From: Stefan Agner 

Add wakeup GPIO key which is able to wake the system from sleep
modes (e.g. Suspend-to-Memory).

Signed-off-by: Stefan Agner 
Signed-off-by: Philippe Schenker 
---

 arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi | 14 ++
 arch/arm/boot/dts/imx7-colibri.dtsi |  7 ++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi 
b/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
index 3f2746169181..d4dbc4fc1adf 100644
--- a/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
@@ -52,6 +52,20 @@
clock-frequency = <1600>;
};
 
+   gpio-keys {
+   compatible = "gpio-keys";
+   pinctrl-names = "default";
+   pinctrl-0 = <_gpiokeys>;
+
+   power {
+   label = "Wake-Up";
+   gpios = < 1 GPIO_ACTIVE_HIGH>;
+   linux,code = ;
+   debounce-interval = <10>;
+   gpio-key,wakeup;
+   };
+   };
+
panel: panel {
compatible = "edt,et057090dhu";
backlight = <>;
diff --git a/arch/arm/boot/dts/imx7-colibri.dtsi 
b/arch/arm/boot/dts/imx7-colibri.dtsi
index 2480623c92ff..16d1a1ed1aff 100644
--- a/arch/arm/boot/dts/imx7-colibri.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri.dtsi
@@ -741,12 +741,17 @@
 
pinctrl_gpio_lpsr: gpio1-grp {
fsl,pins = <
-   MX7D_PAD_LPSR_GPIO1_IO01__GPIO1_IO1 0x59
MX7D_PAD_LPSR_GPIO1_IO02__GPIO1_IO2 0x59
MX7D_PAD_LPSR_GPIO1_IO03__GPIO1_IO3 0x59
>;
};
 
+   pinctrl_gpiokeys: gpiokeysgrp {
+   fsl,pins = <
+   MX7D_PAD_LPSR_GPIO1_IO01__GPIO1_IO1 0x19
+   >;
+   };
+
pinctrl_i2c1: i2c1-grp {
fsl,pins = <
MX7D_PAD_LPSR_GPIO1_IO05__I2C1_SDA  0x407f
-- 
2.22.0



[PATCH 04/22] ARM: dts: imx7-colibri: Add sleep mode to ethernet

2019-07-30 Thread Philippe Schenker
From: Philippe Schenker 

Add sleep pinmux to the fec so it can properly sleep.

Signed-off-by: Philippe Schenker 
---

 arch/arm/boot/dts/imx7-colibri.dtsi | 19 ++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/imx7-colibri.dtsi 
b/arch/arm/boot/dts/imx7-colibri.dtsi
index 52046085ce6f..a8d992f3e897 100644
--- a/arch/arm/boot/dts/imx7-colibri.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri.dtsi
@@ -101,8 +101,9 @@
 };
 
  {
-   pinctrl-names = "default";
+   pinctrl-names = "default", "sleep";
pinctrl-0 = <_enet1>;
+   pinctrl-1 = <_enet1_sleep>;
clocks = < IMX7D_ENET_AXI_ROOT_CLK>,
< IMX7D_ENET_AXI_ROOT_CLK>,
< IMX7D_ENET1_TIME_ROOT_CLK>,
@@ -463,6 +464,22 @@
>;
};
 
+   pinctrl_enet1_sleep: enet1sleepgrp {
+   fsl,pins = <
+   MX7D_PAD_ENET1_RGMII_RX_CTL__GPIO7_IO4  0x0
+   MX7D_PAD_ENET1_RGMII_RD0__GPIO7_IO0 0x0
+   MX7D_PAD_ENET1_RGMII_RD1__GPIO7_IO1 0x0
+   MX7D_PAD_ENET1_RGMII_RXC__GPIO7_IO5 0x0
+
+   MX7D_PAD_ENET1_RGMII_TX_CTL__GPIO7_IO10 0x0
+   MX7D_PAD_ENET1_RGMII_TD0__GPIO7_IO6 0x0
+   MX7D_PAD_ENET1_RGMII_TD1__GPIO7_IO7 0x0
+   MX7D_PAD_GPIO1_IO12__GPIO1_IO12 0x0
+   MX7D_PAD_SD2_CD_B__GPIO5_IO90x0
+   MX7D_PAD_SD2_WP__GPIO5_IO10 0x0
+   >;
+   };
+
pinctrl_ecspi3_cs: ecspi3-cs-grp {
fsl,pins = <
MX7D_PAD_I2C2_SDA__GPIO4_IO11   0x14
-- 
2.22.0



[PATCH 03/22] ARM: dts: imx7-colibri: prepare module device tree for FlexCAN

2019-07-30 Thread Philippe Schenker
From: Philippe Schenker 

Prepare FlexCAN use on SODIMM 55/63 178/188. Those SODIMM pins are
compatible for CAN bus use with several modules from the Colibri
family.
Add Better drivestrength and also add flexcan2.

Signed-off-by: Philippe Schenker 
---

 arch/arm/boot/dts/imx7-colibri.dtsi | 35 -
 1 file changed, 30 insertions(+), 5 deletions(-)

diff --git a/arch/arm/boot/dts/imx7-colibri.dtsi 
b/arch/arm/boot/dts/imx7-colibri.dtsi
index f7c9ce5bed47..52046085ce6f 100644
--- a/arch/arm/boot/dts/imx7-colibri.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri.dtsi
@@ -117,6 +117,18 @@
fsl,magic-packet;
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_flexcan1>;
+   status = "disabled";
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_flexcan2>;
+   status = "disabled";
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_gpmi_nand>;
@@ -330,12 +342,11 @@
 
  {
pinctrl-names = "default";
-   pinctrl-0 = <_gpio1 _gpio2 _gpio3 
_gpio4>;
+   pinctrl-0 = <_gpio1 _gpio2 _gpio3 _gpio4
+_gpio7>;
 
pinctrl_gpio1: gpio1-grp {
fsl,pins = <
-   MX7D_PAD_ENET1_RGMII_RD3__GPIO7_IO3 0x74 /* SODIMM 
55 */
-   MX7D_PAD_ENET1_RGMII_RD2__GPIO7_IO2 0x74 /* SODIMM 
63 */
MX7D_PAD_SAI1_RX_SYNC__GPIO6_IO16   0x14 /* SODIMM 
77 */
MX7D_PAD_EPDC_DATA09__GPIO2_IO9 0x14 /* SODIMM 
89 */
MX7D_PAD_EPDC_DATA08__GPIO2_IO8 0x74 /* SODIMM 
91 */
@@ -416,6 +427,13 @@
>;
};
 
+   pinctrl_gpio7: gpio7-grp { /* Alternatively CAN1 */
+   fsl,pins = <
+   MX7D_PAD_ENET1_RGMII_RD3__GPIO7_IO3 0x14 /* SODIMM 
55 */
+   MX7D_PAD_ENET1_RGMII_RD2__GPIO7_IO2 0x14 /* SODIMM 
63 */
+   >;
+   };
+
pinctrl_i2c1_int: i2c1-int-grp { /* PMIC / TOUCH */
fsl,pins = <
MX7D_PAD_GPIO1_IO13__GPIO1_IO13 0x79
@@ -459,10 +477,17 @@
>;
};
 
+   pinctrl_flexcan1: flexcan1-grp {
+   fsl,pins = <
+   MX7D_PAD_ENET1_RGMII_RD3__FLEXCAN1_TX   0x79 /* SODIMM 
55 */
+   MX7D_PAD_ENET1_RGMII_RD2__FLEXCAN1_RX   0x79 /* SODIMM 
63 */
+   >;
+   };
+
pinctrl_flexcan2: flexcan2-grp {
fsl,pins = <
-   MX7D_PAD_GPIO1_IO14__FLEXCAN2_RX0x59
-   MX7D_PAD_GPIO1_IO15__FLEXCAN2_TX0x59
+   MX7D_PAD_GPIO1_IO14__FLEXCAN2_RX0x79 /* SODIMM 
188 */
+   MX7D_PAD_GPIO1_IO15__FLEXCAN2_TX0x79 /* SODIMM 
178 */
>;
};
 
-- 
2.22.0



[PATCH 07/22] ARM: dts: imx7-colibri: fix 1.8V/UHS support

2019-07-30 Thread Philippe Schenker
From: Stefan Agner 

Add pinmuxing and do not specify voltage restrictions in the
module level device tree.

Signed-off-by: Stefan Agner 
Signed-off-by: Philippe Schenker 
---

 arch/arm/boot/dts/imx7-colibri.dtsi | 23 ++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/imx7-colibri.dtsi 
b/arch/arm/boot/dts/imx7-colibri.dtsi
index 16d1a1ed1aff..67f5e0c87fdc 100644
--- a/arch/arm/boot/dts/imx7-colibri.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri.dtsi
@@ -326,7 +326,6 @@
  {
pinctrl-names = "default";
pinctrl-0 = <_usdhc1 _cd_usdhc1>;
-   no-1-8-v;
cd-gpios = < 0 GPIO_ACTIVE_LOW>;
disable-wp;
vqmmc-supply = <_LDO2>;
@@ -671,6 +670,28 @@
>;
};
 
+   pinctrl_usdhc1_100mhz: usdhc1grp_100mhz {
+   fsl,pins = <
+   MX7D_PAD_SD1_CMD__SD1_CMD   0x5a
+   MX7D_PAD_SD1_CLK__SD1_CLK   0x1a
+   MX7D_PAD_SD1_DATA0__SD1_DATA0   0x5a
+   MX7D_PAD_SD1_DATA1__SD1_DATA1   0x5a
+   MX7D_PAD_SD1_DATA2__SD1_DATA2   0x5a
+   MX7D_PAD_SD1_DATA3__SD1_DATA3   0x5a
+   >;
+   };
+
+   pinctrl_usdhc1_200mhz: usdhc1grp_200mhz {
+   fsl,pins = <
+   MX7D_PAD_SD1_CMD__SD1_CMD   0x5b
+   MX7D_PAD_SD1_CLK__SD1_CLK   0x1b
+   MX7D_PAD_SD1_DATA0__SD1_DATA0   0x5b
+   MX7D_PAD_SD1_DATA1__SD1_DATA1   0x5b
+   MX7D_PAD_SD1_DATA2__SD1_DATA2   0x5b
+   MX7D_PAD_SD1_DATA3__SD1_DATA3   0x5b
+   >;
+   };
+
pinctrl_usdhc3: usdhc3grp {
fsl,pins = <
MX7D_PAD_SD3_CMD__SD3_CMD   0x59
-- 
2.22.0



[PATCH 08/22] ARM: dts: imx7-colibri: Add touch controllers

2019-07-30 Thread Philippe Schenker
From: Philippe Schenker 

Add atmel mxt multitouch controller and TouchRevolution multitouch
controller which are connected over an I2C bus.

Signed-off-by: Philippe Schenker 
---

 arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi | 37 +
 1 file changed, 37 insertions(+)

diff --git a/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi 
b/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
index d4dbc4fc1adf..f6cbbe876532 100644
--- a/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
@@ -145,6 +145,34 @@
  {
status = "okay";
 
+   /*
+* the PCAPs use SODIMM 28/30, also used for PWM, PWM, aka pwm2,
+* pwm3. so if you enable one of the PCAP controllers disable the pwms
+*/
+   atmel_mxt_ts: atmel_mxt_ts@4a {
+   compatible = "atmel,maxtouch";
+   pinctrl-names = "default";
+   pinctrl-0 = <_gpiotouch>;
+   reg = <0x4a>;
+   interrupt-parent = <>;
+   interrupts = <9 IRQ_TYPE_EDGE_FALLING>; /* SODIMM 28 */
+   reset-gpios = < 10 GPIO_ACTIVE_HIGH>; /* SODIMM 30 */
+   status = "disabled";
+   };
+
+   touch: touchrevf0710a@10 {
+   compatible = "touchrevolution,fusion-f0710a";
+   pinctrl-names = "default";
+   pinctrl-0 = <_gpiotouch>;
+   reg = <0x10>;
+   /* SODIMM 28, Pen down interrupt */
+   gpios = < 9 GPIO_ACTIVE_HIGH
+   /* SODIMM 30, Reset interrupt */
+ 10 GPIO_ACTIVE_LOW
+   >;
+   status = "disabled";
+   };
+
/* M41T0M6 real time clock on carrier board */
rtc: m41t0m6@68 {
compatible = "st,m41t0";
@@ -200,3 +228,12 @@
vmmc-supply = <_3v3>;
status = "okay";
 };
+
+ {
+   pinctrl_gpiotouch: touchgpios {
+   fsl,pins = <
+   MX7D_PAD_GPIO1_IO09__GPIO1_IO9  0x74
+   MX7D_PAD_GPIO1_IO10__GPIO1_IO10 0x14
+   >;
+   };
+};
-- 
2.22.0



[RFC PATCH 0/2] Hello

2019-07-30 Thread Philippe Schenker
From: Philippe Schenker 


On our Colibri iMX6ULL board there is a circuit for switching the
power supply of the ethernet PHY with the 50MHz RMII clock.

This works quite fine but has one big problem. It is quite slow when
switching the supply, so Linux has to wait there. I think this switch
is at best represented as a fixed-regulator. In that way I can use
"startup-delay-us" to represent slow switching regulator.

But there's no current possibility to enable fixed-regulator with a
clock. In this RFC I send a patch after we would be able to add a clock
to a fixed-regulator in devicetree and then add the "startup-delay-us"
which would solve all my problems relatively elegant.
This works also the other way, if the PHY now needs power the
clock is not powered off because regulator depends on it.

Because this would need to change code in regulator core I like to
ask for your oppinion first, or if anyone has another idea how
I could solve that problem.

Thanks in advance for your feedback!

Philippe


Philippe Schenker (2):
  Regulator: Core: Add clock-enable to fixed-regulator
  ARM: dts: imx6ull: Add phy-supply to fec

 arch/arm/boot/dts/imx6ull-colibri.dtsi | 12 
 drivers/regulator/core.c   | 15 +++
 drivers/regulator/fixed.c  |  6 ++
 include/linux/regulator/driver.h   |  3 +++
 include/linux/regulator/fixed.h|  1 +
 5 files changed, 37 insertions(+)

-- 
2.22.0



[RFC PATCH 2/2] ARM: dts: imx6ull: Add phy-supply to fec

2019-07-30 Thread Philippe Schenker
From: Philippe Schenker 

This adds the proper phy-supply to the fec. This supply is actually
switched by a clock that is now properly stated. This adds the
advantage to add a delay for that particular regulator that is needed.

Signed-off-by: Philippe Schenker 

---

 arch/arm/boot/dts/imx6ull-colibri.dtsi | 12 
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/boot/dts/imx6ull-colibri.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri.dtsi
index 9ad1da159768..a15f0807e9b0 100644
--- a/arch/arm/boot/dts/imx6ull-colibri.dtsi
+++ b/arch/arm/boot/dts/imx6ull-colibri.dtsi
@@ -47,6 +47,17 @@
states = <180 0x1 330 0x0>;
vin-supply = <_module_3v3>;
};
+
+   reg_eth_phy: regulator-eth-phy {
+   compatible = "regulator-fixed";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   regulator-name = "eth_phy";
+   regulator-type = "voltage";
+   vin-supply = <_module_3v3>;
+   clocks = < IMX6UL_CLK_ENET2_REF_125M>;
+   startup-delay-us = <15>;
+   };
 };
 
  {
@@ -66,6 +77,7 @@
pinctrl-0 = <_enet2>;
phy-mode = "rmii";
phy-handle = <>;
+   phy-supply = <_eth_phy>;
status = "okay";
 
mdio {
-- 
2.22.0



[RFC PATCH 1/2] Regulator: Core: Add clock-enable to fixed-regulator

2019-07-30 Thread Philippe Schenker
From: Philippe Schenker 

This adds the possibility to enable a fixed-regulator with a clock.

Signed-off-by: 
Signed-off-by: Philippe Schenker 
---

 drivers/regulator/core.c | 15 +++
 drivers/regulator/fixed.c|  6 ++
 include/linux/regulator/driver.h |  3 +++
 include/linux/regulator/fixed.h  |  1 +
 4 files changed, 25 insertions(+)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index e0c0cf462004..f16f6c147858 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define CREATE_TRACE_POINTS
 #include 
@@ -2385,6 +2386,11 @@ static int _regulator_do_enable(struct regulator_dev 
*rdev)
ret = rdev->desc->ops->enable(rdev);
if (ret < 0)
return ret;
+   } else if (rdev->ena_clk) {
+   ret = clk_prepare_enable(rdev->ena_clk);
+   if (ret)
+   return ret;
+   rdev->ena_clk_state++;
} else {
return -EINVAL;
}
@@ -2565,6 +2571,9 @@ static int _regulator_do_disable(struct regulator_dev 
*rdev)
ret = rdev->desc->ops->disable(rdev);
if (ret != 0)
return ret;
+   } else if (rdev->ena_clk) {
+   clk_disable_unprepare(rdev->ena_clk);
+   rdev->ena_clk_state--;
}
 
/* cares about last_off_jiffy only if off_on_delay is required by
@@ -2796,6 +2805,9 @@ static int _regulator_is_enabled(struct regulator_dev 
*rdev)
if (rdev->ena_pin)
return rdev->ena_gpio_state;
 
+   if (rdev->ena_clk)
+   return (rdev->ena_clk_state > 0) ? 1 : 0;
+
/* If we don't know then assume that the regulator is always on */
if (!rdev->desc->ops->is_enabled)
return 1;
@@ -5098,6 +5110,9 @@ regulator_register(const struct regulator_desc 
*regulator_desc,
dangling_of_gpiod = false;
}
 
+   if (cfg->ena_clk)
+   rdev->ena_clk = cfg->ena_clk;
+
/* register with sysfs */
rdev->dev.class = _class;
rdev->dev.parent = dev;
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index 999547dde99d..0093c26cda3c 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 
 struct fixed_voltage_data {
struct regulator_desc desc;
@@ -78,6 +79,10 @@ of_get_fixed_voltage_config(struct device *dev,
if (of_find_property(np, "vin-supply", NULL))
config->input_supply = "vin";
 
+   config->ena_clk = devm_clk_get(dev, NULL);
+   if (IS_ERR(config->ena_clk))
+   config->ena_clk = NULL;
+
return config;
 }
 
@@ -172,6 +177,7 @@ static int reg_fixed_voltage_probe(struct platform_device 
*pdev)
cfg.init_data = config->init_data;
cfg.driver_data = drvdata;
cfg.of_node = pdev->dev.of_node;
+   cfg.ena_clk = config->ena_clk;
 
drvdata->dev = devm_regulator_register(>dev, >desc,
   );
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 9a911bb5fb61..335ac1272bbd 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -414,6 +414,7 @@ struct regulator_config {
void *driver_data;
struct device_node *of_node;
struct regmap *regmap;
+   struct clk *ena_clk;
 
struct gpio_desc *ena_gpiod;
 };
@@ -477,6 +478,8 @@ struct regulator_dev {
 
struct regulator_enable_gpio *ena_pin;
unsigned int ena_gpio_state:1;
+   struct clk *ena_clk;
+   unsigned int ena_clk_state;
 
unsigned int is_switch:1;
 
diff --git a/include/linux/regulator/fixed.h b/include/linux/regulator/fixed.h
index d44ce5f18a56..c291e1130381 100644
--- a/include/linux/regulator/fixed.h
+++ b/include/linux/regulator/fixed.h
@@ -38,6 +38,7 @@ struct fixed_voltage_config {
unsigned startup_delay;
unsigned enabled_at_boot:1;
struct regulator_init_data *init_data;
+   struct clk *ena_clk;
 };
 
 struct regulator_consumer_supply;
-- 
2.22.0



Re: [RFC PATCH 1/2] Regulator: Core: Add clock-enable to fixed-regulator

2019-07-30 Thread Philippe Schenker
On Tue, 2019-07-30 at 19:10 +0100, Mark Brown wrote:
> On Tue, Jul 30, 2019 at 07:30:04PM +0200, Philippe Schenker wrote:
> > From: Philippe Schenker 
> > 
> > This adds the possibility to enable a fixed-regulator with a clock.
> 
> Why?  What does the hardware which makes this make sense look like?

Tomorrow I can provide some schematics if needed. But its just a simple
switch that is switched by a clock (on when clock is on and off when
clock is off). This clock is the RGMII 50MHz clock for the ethernet
PHY.

That switch switches power rail of a KSZ8041 ethernet PHY. So the power
rail of the KSZ8041 PHY is switched by its own clock.

> Your cover letter didn't explain at all clearly, it just said that
> there's a circuit that is connected to a clock which somehow switches
> something but it's not clear.  It's certainly not clear that this
> should
> be in the core, the circuit doesn't sound like a good idea at all.

Sorry if I didn't explain it clear enough. I hope the hardware part is
clear now from the explanation above. Otherwise let me know I will
provide further explanations/schematics.

To your other questions, I will split those for better understanding:

Why is a regulator even needed?
- On power up of the PHY there is a huge time I have to wait for
voltage rail to settle. In the range of 100ms.
- Because there is a switch in the circuit I abstract it with a
regulator-fixed in devicetree to make use of the startup-delay.
- This regulator/switch is enabled with a clock. So to be able to use
the startup delay I need an enable-by-clock on regulator-fixed.

Why do I think this should be in core?
- Normally this task is done with gpio that is already in regulator-
core.
- Because that is already there I added the functionality for enabled-
by-clock-functionality.
- I thought of creating a new regulator-clock driver but that would
hold a lot of code duplication from regulator-fixed.

Why is this a good Idea at all?
- Well I'm here for the software part and should just support our
hardware. If that is a good Idea at all I don't know, for sure it is
not a solution that is from some school-book. But I tried it and
measured it out and it seems to work pretty fine.
- The reason behind all of that is limited GPIO availability from the
iMX6ULL.

> 
> > Signed-off-by: 
> > Signed-off-by: Philippe Schenker 
> 
> This needs a cleanup.

Of course, sorry I didn't saw that beforehand. Some mess created with
cherry-picking...

> 
> >  
> > /* cares about last_off_jiffy only if off_on_delay is required
> > by
> > @@ -2796,6 +2805,9 @@ static int _regulator_is_enabled(struct
> > regulator_dev *rdev)
> > if (rdev->ena_pin)
> > return rdev->ena_gpio_state;
> >  
> > +   if (rdev->ena_clk)
> > +   return (rdev->ena_clk_state > 0) ? 1 : 0;
> > +
> 
> Please write normal conditional statements, this isn't helping
> legibility.  Though in this case the ternery operator is totally
> redundant anyway...

Yeah now that I look at it you're right. I have in mind that I copied
that from somewhere to get the same coding style. I developed that in
an old kernel so could be that it's from there.
Anyway, this is just a concept for now and would need some more
thinking...
With this patch I want to put off a discussion, how we can support our
hardware in mainline Linux. This is my first proposal for that.

Philippe


Re: [PATCH 12/22] ARM: dts: imx6: Add touchscreens used on Toradex eval boards

2019-07-31 Thread Philippe Schenker
On Tue, 2019-07-30 at 17:46 -0300, Fabio Estevam wrote:
> On Tue, Jul 30, 2019 at 11:57 AM Philippe Schenker  wrote:
> 
> > +   /* Atmel maxtouch controller */
> > +   atmel_mxt_ts: atmel_mxt_ts@4a {
> 
> Generic node names, please:
> 
> touchscreen@4a
> 
> > +   compatible = "atmel,maxtouch";
> > +   pinctrl-names = "default";
> > +   pinctrl-0 = <_pcap_1>;
> > +   reg = <0x4a>;
> > +   interrupt-parent = <>;
> > +   interrupts = <9 IRQ_TYPE_EDGE_FALLING>; /* SODIMM 28 */
> > +   reset-gpios = < 10 GPIO_ACTIVE_HIGH>; /* SODIMM 30 */
> > +   status = "disabled";
> > +   };
> > +
> > +   /*
> > +* the PCAPs use SODIMM 28/30, also used for PWM, PWM, aka
> > pwm1,
> > +* pwm4. So if you enable one of the PCAP controllers disable the
> > pwms.
> > +*/
> > +   pcap: pcap@10 {
> 
> touchscreen@10
> 
> > +   /* TouchRevolution Fusion 7 and 10 multi-touch controller */
> > +   compatible = "touchrevolution,fusion-f0710a";
> 
> I do not find this binding documented.

Thanks for your feedback Fabio, and sorry such obvious stuff went through. I
will go through my whole patchset again more carefully lookup all the bindings.

Philippe


Re: [PATCH 11/22] ARM: dts: imx6: Add sleep state to can interfaces

2019-07-31 Thread Philippe Schenker
On Wed, 2019-07-31 at 09:14 +0200, Michal Vokáč wrote:
> On 30. 07. 19 16:46, Philippe Schenker wrote:
> > From: Philippe Schenker 
> > 
> > This patch prepares the devicetree for the new Ixora V1.2 where we are
> > able to turn off the supply of the can transceiver. This implies to use
> > a sleep state on transmission pins in order to prevent backfeeding.
> > 
> > Signed-off-by: Philippe Schenker 
> > ---
> 
> What about "ARM: dts: imx6qdl-apalis: " for the subject?
> To be clear that this is not related to the imx6 SoC itself.

Thanks for your comments Michal! Will takte those into account for v2.

> 
> >   arch/arm/boot/dts/imx6qdl-apalis.dtsi | 27 +--
> >   1 file changed, 21 insertions(+), 6 deletions(-)
> > 
> > diff --git a/arch/arm/boot/dts/imx6qdl-apalis.dtsi
> > b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
> > index 7c4ad541c3f5..59ed2e4a1fd1 100644
> > --- a/arch/arm/boot/dts/imx6qdl-apalis.dtsi
> > +++ b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
> > @@ -148,14 +148,16 @@
> >   };
> >   
> >{
> > -   pinctrl-names = "default";
> > -   pinctrl-0 = <_flexcan1>;
> > +   pinctrl-names = "default", "sleep";
> > +   pinctrl-0 = <_flexcan1_default>;
> > +   pinctrl-1 = <_flexcan1_sleep>;
> > status = "disabled";
> >   };
> >   
> >{
> > -   pinctrl-names = "default";
> > -   pinctrl-0 = <_flexcan2>;
> > +   pinctrl-names = "default", "sleep";
> > +   pinctrl-0 = <_flexcan2_default>;
> > +   pinctrl-1 = <_flexcan2_sleep>;
> > status = "disabled";
> >   };
> >   
> > @@ -599,19 +601,32 @@
> > >;
> > };
> >   
> > -   pinctrl_flexcan1: flexcan1grp {
> > +   pinctrl_flexcan1_default: flexcan1defgrp {
> > fsl,pins = <
> > MX6QDL_PAD_GPIO_7__FLEXCAN1_TX 0x1b0b0
> > MX6QDL_PAD_GPIO_8__FLEXCAN1_RX 0x1b0b0
> > >;
> > };
> >   
> > -   pinctrl_flexcan2: flexcan2grp {
> > +   pinctrl_flexcan1_sleep: flexcan1slpgrp {
> > +   fsl,pins = <
> > +   MX6QDL_PAD_GPIO_7__GPIO1_IO07 0x0
> > +   MX6QDL_PAD_GPIO_8__GPIO1_IO08 0x0
> > +   >;
> > +   };
> > +
> > +   pinctrl_flexcan2_default: flexcan2defgrp {
> > fsl,pins = <
> > MX6QDL_PAD_KEY_COL4__FLEXCAN2_TX 0x1b0b0
> > MX6QDL_PAD_KEY_ROW4__FLEXCAN2_RX 0x1b0b0
> > >;
> > };
> > +   pinctrl_flexcan2_sleep: flexcan2slpgrp {
> > +   fsl,pins = <
> > +   MX6QDL_PAD_KEY_COL4__GPIO4_IO14 0x0
> > +   MX6QDL_PAD_KEY_ROW4__GPIO4_IO15 0x0
> > +   >;
> > +   };
> >   
> > pinctrl_gpio_bl_on: gpioblon {
> > fsl,pins = <
> > 


Re: [PATCH 15/22] ARM: dts: apalis-imx6: Add some optional I2C devices

2019-07-31 Thread Philippe Schenker
On Tue, 2019-07-30 at 17:43 -0300, Fabio Estevam wrote:
> Hi Philippe,
> 
> On Tue, Jul 30, 2019 at 11:57 AM Philippe Schenker  wrote:
> 
> > +_csi {
> > +   ipu_id = <0>;
> > +   csi_id = <1>;
> > +   v_channel = <0>;
> > +   lanes = <2>;
> 
> None of these properties are valid upstream.

Will drop that one too.


Re: [PATCH 14/22] ARM: dts: apalis-imx6: Add some example I2C devices

2019-07-31 Thread Philippe Schenker
On Tue, 2019-07-30 at 17:53 -0300, Fabio Estevam wrote:
> On Tue, Jul 30, 2019 at 11:57 AM Philippe Schenker  wrote:
> 
> >   {
> > @@ -204,6 +228,77 @@
> >   */
> >   {
> > status = "okay";
> > +
> > +   adv7280: adv7280@21 {
> > +   compatible = "adv7280";
> > +   reg = <0x21>;
> > +   pinctrl-names = "default";
> > +   pinctrl-0 = <_ipu1_csi0 _cam_mclk>;
> > +   clocks = < 200>;
> 
> Please replace this 200 with a proper clock label.
> 
> > +   clock-names = "csi_mclk";
> > +   DOVDD-supply = <_3p3v>;
> > +   AVDD-supply = <_3p3v>;
> > +   DVDD-supply = <_3p3v>;
> > +   PVDD-supply = <_3p3v>;
> > +   csi_id = <0>;
> 
> This is not a valid property upstream.
> 
> It seems you just ported it from a downstream vendor kernel. Please
> make sure you test with the dt-bindings from mainline.
> 
> > +   mclk = <2400>;
> > +   mclk_source = <1>;
> > +   status = "okay";
> > +   };
> > +
> > +   /* Video ADC on Analog Camera Module */
> > +   adv7180: adv7180@21 {
> > +   compatible = "adv,adv7180";
> > +   reg = <0x21>;
> > +   pinctrl-names = "default";
> > +   pinctrl-0 = <_ipu1_csi0 _cam_mclk>;
> > +   clocks = < 200>;
> 
> clock label, please.
> 
> > +   clock-names = "csi_mclk";
> > +   DOVDD-supply = <_3p3v>; /* 3.3v */
> > +   AVDD-supply = <_3p3v>;  /* 1.8v */
> > +   DVDD-supply = <_3p3v>;  /* 1.8v */
> > +   PVDD-supply = <_3p3v>;  /* 1.8v */
> > +   csi_id = <0>;
> 
> Same here
> 
> > +   mclk = <2400>;
> > +   mclk_source = <1>;
> > +   cvbs = <1>;
> > +   status = "disabled";
> > +   };
> > +
> > +   max9526: max9526@20 {
> > +   compatible = "maxim,max9526";
> 
> This is not documented in mainline.

Yeah, too much downstream stuff in here. I will drop that patch for now...


[PATCH v2 00/20] Common patches from downstream development

2019-07-31 Thread Philippe Schenker

This patchset holds some common changes that were never upstreamed.
With latest downstream kernel upgrade, I took the aproach to select
mainline devicetrees and atomically add missing stuff for downstream.

These patches I send here are separated out with changes that also
have a benfit for mainline.

Philippe

Changes in v2:
- Deleted touchrevolution downstream stuff
- Use generic node name
- Better comment
- Changed commit title to '...imx6qdl-apalis:...'
- Deleted touchrevolution downstream stuff
- Use generic node name
- Put a better comment in there
- Commit title
- Removed f0710a, that is downstream only
- Changed to generic node name
- Better comment

Marcel Ziswiler (1):
  ARM: dts: imx7-colibri: make sure module supplies are always on

Max Krummenacher (2):
  ARM: dts: imx6ull-colibri: reduce v_batt current in power off
  ARM: dts: imx6ull: improve can templates

Oleksandr Suvorov (1):
  ARM: dts: add recovery for I2C for iMX7

Philippe Schenker (13):
  ARM: dts: imx7-colibri: prepare module device tree for FlexCAN
  ARM: dts: imx7-colibri: Add sleep mode to ethernet
  ARM: dts: imx7-colibri: Add touch controllers
  ARM: dts: imx6qdl-colibri: add phy to fec
  ARM: dts: imx6qdl-colibri: Add missing pin declaration in iomuxc
  ARM: dts: imx6qdl-apalis: Add sleep state to can interfaces
  ARM: dts: imx6: Add touchscreens used on Toradex eval boards
  ARM: dts: imx6-colibri: Add missing pinmuxing to Toradex eval board
  ARM: dts: imx6ull-colibri: Add sleep mode to fec
  ARM: dts: imx6ull-colibri: Add watchdog
  ARM: dts: imx6ull-colibri: Add general wakeup key used on Colibri
  ARM: dts: imx6/7-colibri: switch dr_mode to otg
  ARM: dts: imx6ull-colibri: Add touchscreen used with Eval Board

Stefan Agner (3):
  ARM: dts: imx7-colibri: disable HS400
  ARM: dts: imx7-colibri: add GPIO wakeup key
  ARM: dts: imx7-colibri: fix 1.8V/UHS support

 arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts  |  39 ++
 arch/arm/boot/dts/imx6q-apalis-eval.dts   |  13 ++
 arch/arm/boot/dts/imx6q-apalis-ixora-v1.1.dts |  13 ++
 arch/arm/boot/dts/imx6q-apalis-ixora.dts  |  13 ++
 arch/arm/boot/dts/imx6qdl-apalis.dtsi |  27 -
 arch/arm/boot/dts/imx6qdl-colibri.dtsi|  27 -
 .../arm/boot/dts/imx6ull-colibri-eval-v3.dtsi |  50 
 .../arm/boot/dts/imx6ull-colibri-nonwifi.dtsi |   2 +-
 arch/arm/boot/dts/imx6ull-colibri-wifi.dtsi   |   2 +-
 arch/arm/boot/dts/imx6ull-colibri.dtsi|  52 +++-
 arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi   |  38 ++
 arch/arm/boot/dts/imx7-colibri.dtsi   | 114 --
 12 files changed, 364 insertions(+), 26 deletions(-)

-- 
2.22.0



[PATCH v2 04/20] ARM: dts: imx7-colibri: Add sleep mode to ethernet

2019-07-31 Thread Philippe Schenker
Add sleep pinmux to the fec so it can properly sleep.

Signed-off-by: Philippe Schenker 
---

Changes in v2: None

 arch/arm/boot/dts/imx7-colibri.dtsi | 19 ++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/imx7-colibri.dtsi 
b/arch/arm/boot/dts/imx7-colibri.dtsi
index 52046085ce6f..a8d992f3e897 100644
--- a/arch/arm/boot/dts/imx7-colibri.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri.dtsi
@@ -101,8 +101,9 @@
 };
 
  {
-   pinctrl-names = "default";
+   pinctrl-names = "default", "sleep";
pinctrl-0 = <_enet1>;
+   pinctrl-1 = <_enet1_sleep>;
clocks = < IMX7D_ENET_AXI_ROOT_CLK>,
< IMX7D_ENET_AXI_ROOT_CLK>,
< IMX7D_ENET1_TIME_ROOT_CLK>,
@@ -463,6 +464,22 @@
>;
};
 
+   pinctrl_enet1_sleep: enet1sleepgrp {
+   fsl,pins = <
+   MX7D_PAD_ENET1_RGMII_RX_CTL__GPIO7_IO4  0x0
+   MX7D_PAD_ENET1_RGMII_RD0__GPIO7_IO0 0x0
+   MX7D_PAD_ENET1_RGMII_RD1__GPIO7_IO1 0x0
+   MX7D_PAD_ENET1_RGMII_RXC__GPIO7_IO5 0x0
+
+   MX7D_PAD_ENET1_RGMII_TX_CTL__GPIO7_IO10 0x0
+   MX7D_PAD_ENET1_RGMII_TD0__GPIO7_IO6 0x0
+   MX7D_PAD_ENET1_RGMII_TD1__GPIO7_IO7 0x0
+   MX7D_PAD_GPIO1_IO12__GPIO1_IO12 0x0
+   MX7D_PAD_SD2_CD_B__GPIO5_IO90x0
+   MX7D_PAD_SD2_WP__GPIO5_IO10 0x0
+   >;
+   };
+
pinctrl_ecspi3_cs: ecspi3-cs-grp {
fsl,pins = <
MX7D_PAD_I2C2_SDA__GPIO4_IO11   0x14
-- 
2.22.0



[PATCH v2 06/20] ARM: dts: imx7-colibri: add GPIO wakeup key

2019-07-31 Thread Philippe Schenker
From: Stefan Agner 

Add wakeup GPIO key which is able to wake the system from sleep
modes (e.g. Suspend-to-Memory).

Signed-off-by: Stefan Agner 
Signed-off-by: Philippe Schenker 
---

Changes in v2: None

 arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi | 14 ++
 arch/arm/boot/dts/imx7-colibri.dtsi |  7 ++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi 
b/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
index 3f2746169181..d4dbc4fc1adf 100644
--- a/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
@@ -52,6 +52,20 @@
clock-frequency = <1600>;
};
 
+   gpio-keys {
+   compatible = "gpio-keys";
+   pinctrl-names = "default";
+   pinctrl-0 = <_gpiokeys>;
+
+   power {
+   label = "Wake-Up";
+   gpios = < 1 GPIO_ACTIVE_HIGH>;
+   linux,code = ;
+   debounce-interval = <10>;
+   gpio-key,wakeup;
+   };
+   };
+
panel: panel {
compatible = "edt,et057090dhu";
backlight = <>;
diff --git a/arch/arm/boot/dts/imx7-colibri.dtsi 
b/arch/arm/boot/dts/imx7-colibri.dtsi
index 2480623c92ff..16d1a1ed1aff 100644
--- a/arch/arm/boot/dts/imx7-colibri.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri.dtsi
@@ -741,12 +741,17 @@
 
pinctrl_gpio_lpsr: gpio1-grp {
fsl,pins = <
-   MX7D_PAD_LPSR_GPIO1_IO01__GPIO1_IO1 0x59
MX7D_PAD_LPSR_GPIO1_IO02__GPIO1_IO2 0x59
MX7D_PAD_LPSR_GPIO1_IO03__GPIO1_IO3 0x59
>;
};
 
+   pinctrl_gpiokeys: gpiokeysgrp {
+   fsl,pins = <
+   MX7D_PAD_LPSR_GPIO1_IO01__GPIO1_IO1 0x19
+   >;
+   };
+
pinctrl_i2c1: i2c1-grp {
fsl,pins = <
MX7D_PAD_LPSR_GPIO1_IO05__I2C1_SDA  0x407f
-- 
2.22.0



[PATCH v2 05/20] ARM: dts: add recovery for I2C for iMX7

2019-07-31 Thread Philippe Schenker
From: Oleksandr Suvorov 

- add recovery mode for applicable i2c buses for
  Colibri iMX7 module.

Signed-off-by: Oleksandr Suvorov 
Signed-off-by: Philippe Schenker 
---

Changes in v2: None

 arch/arm/boot/dts/imx7-colibri.dtsi | 25 +++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/imx7-colibri.dtsi 
b/arch/arm/boot/dts/imx7-colibri.dtsi
index a8d992f3e897..2480623c92ff 100644
--- a/arch/arm/boot/dts/imx7-colibri.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri.dtsi
@@ -140,8 +140,12 @@
 
  {
clock-frequency = <10>;
-   pinctrl-names = "default";
+   pinctrl-names = "default", "gpio";
pinctrl-0 = <_i2c1 _i2c1_int>;
+   pinctrl-1 = <_i2c1_recovery _i2c1_int>;
+   scl-gpios = < 4 GPIO_ACTIVE_HIGH>;
+   sda-gpios = < 5 GPIO_ACTIVE_HIGH>;
+
status = "okay";
 
codec: sgtl5000@a {
@@ -242,8 +246,11 @@
 
  {
clock-frequency = <10>;
-   pinctrl-names = "default";
+   pinctrl-names = "default", "gpio";
pinctrl-0 = <_i2c4>;
+   pinctrl-1 = <_i2c4_recovery>;
+   scl-gpios = < 8 GPIO_ACTIVE_HIGH>;
+   sda-gpios = < 9 GPIO_ACTIVE_HIGH>;
 };
 
  {
@@ -540,6 +547,13 @@
>;
};
 
+   pinctrl_i2c4_recovery: i2c4-recoverygrp {
+   fsl,pins = <
+   MX7D_PAD_ENET1_RGMII_TD2__GPIO7_IO8 0x407f
+   MX7D_PAD_ENET1_RGMII_TD3__GPIO7_IO9 0x407f
+   >;
+   };
+
pinctrl_lcdif_dat: lcdif-dat-grp {
fsl,pins = <
MX7D_PAD_LCD_DATA00__LCD_DATA0  0x79
@@ -740,6 +754,13 @@
>;
};
 
+   pinctrl_i2c1_recovery: i2c1-recoverygrp {
+   fsl,pins = <
+   MX7D_PAD_LPSR_GPIO1_IO04__GPIO1_IO4 0x407f
+   MX7D_PAD_LPSR_GPIO1_IO05__GPIO1_IO5 0x407f
+   >;
+   };
+
pinctrl_cd_usdhc1: usdhc1-cd-grp {
fsl,pins = <
MX7D_PAD_LPSR_GPIO1_IO00__GPIO1_IO0 0x59 /* CD */
-- 
2.22.0



[PATCH v2 07/20] ARM: dts: imx7-colibri: fix 1.8V/UHS support

2019-07-31 Thread Philippe Schenker
From: Stefan Agner 

Add pinmuxing and do not specify voltage restrictions in the
module level device tree.

Signed-off-by: Stefan Agner 
Signed-off-by: Philippe Schenker 
---

Changes in v2: None

 arch/arm/boot/dts/imx7-colibri.dtsi | 23 ++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/imx7-colibri.dtsi 
b/arch/arm/boot/dts/imx7-colibri.dtsi
index 16d1a1ed1aff..67f5e0c87fdc 100644
--- a/arch/arm/boot/dts/imx7-colibri.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri.dtsi
@@ -326,7 +326,6 @@
  {
pinctrl-names = "default";
pinctrl-0 = <_usdhc1 _cd_usdhc1>;
-   no-1-8-v;
cd-gpios = < 0 GPIO_ACTIVE_LOW>;
disable-wp;
vqmmc-supply = <_LDO2>;
@@ -671,6 +670,28 @@
>;
};
 
+   pinctrl_usdhc1_100mhz: usdhc1grp_100mhz {
+   fsl,pins = <
+   MX7D_PAD_SD1_CMD__SD1_CMD   0x5a
+   MX7D_PAD_SD1_CLK__SD1_CLK   0x1a
+   MX7D_PAD_SD1_DATA0__SD1_DATA0   0x5a
+   MX7D_PAD_SD1_DATA1__SD1_DATA1   0x5a
+   MX7D_PAD_SD1_DATA2__SD1_DATA2   0x5a
+   MX7D_PAD_SD1_DATA3__SD1_DATA3   0x5a
+   >;
+   };
+
+   pinctrl_usdhc1_200mhz: usdhc1grp_200mhz {
+   fsl,pins = <
+   MX7D_PAD_SD1_CMD__SD1_CMD   0x5b
+   MX7D_PAD_SD1_CLK__SD1_CLK   0x1b
+   MX7D_PAD_SD1_DATA0__SD1_DATA0   0x5b
+   MX7D_PAD_SD1_DATA1__SD1_DATA1   0x5b
+   MX7D_PAD_SD1_DATA2__SD1_DATA2   0x5b
+   MX7D_PAD_SD1_DATA3__SD1_DATA3   0x5b
+   >;
+   };
+
pinctrl_usdhc3: usdhc3grp {
fsl,pins = <
MX7D_PAD_SD3_CMD__SD3_CMD   0x59
-- 
2.22.0



[PATCH v2 10/20] ARM: dts: imx6qdl-colibri: Add missing pin declaration in iomuxc

2019-07-31 Thread Philippe Schenker
This adds the muxing for the optional pins usb-oc (overcurrent) and
usb-id.

Signed-off-by: Philippe Schenker 
---

Changes in v2: None

 arch/arm/boot/dts/imx6qdl-colibri.dtsi | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm/boot/dts/imx6qdl-colibri.dtsi 
b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
index 019dda6b88ad..9a63debab0b5 100644
--- a/arch/arm/boot/dts/imx6qdl-colibri.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
@@ -615,6 +615,13 @@
>;
};
 
+   pinctrl_usbh_oc_1: usbh_oc-1 {
+   fsl,pins = <
+   /* USBH_OC */
+   MX6QDL_PAD_EIM_D30__GPIO3_IO30  0x1b0b0
+   >;
+   };
+
pinctrl_spdif: spdifgrp {
fsl,pins = <
MX6QDL_PAD_GPIO_17__SPDIF_OUT 0x1b0b0
@@ -681,6 +688,13 @@
>;
};
 
+   pinctrl_usbc_id_1: usbc_id-1 {
+   fsl,pins = <
+   /* USBC_ID */
+   MX6QDL_PAD_NANDF_D2__GPIO2_IO02 0x1b0b0
+   >;
+   };
+
pinctrl_usdhc1: usdhc1grp {
fsl,pins = <
MX6QDL_PAD_SD1_CMD__SD1_CMD 0x17071
-- 
2.22.0



[PATCH v2 15/20] ARM: dts: imx6ull-colibri: reduce v_batt current in power off

2019-07-31 Thread Philippe Schenker
From: Max Krummenacher 

Reduce the current drawn from VCC_BATT when the main power on the 3V3
pins to the module are switched off.

This switches off SoC internal pull resistors which are provided on the
module for TAMPER7 and TAMPER9 SoC pin and switches on a pull down
instead of a pullup for the USBC_DET module pin (TAMPER2).

Signed-off-by: Max Krummenacher 
Signed-off-by: Philippe Schenker 
---

Changes in v2: None

 arch/arm/boot/dts/imx6ull-colibri.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/imx6ull-colibri.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri.dtsi
index 1019ce69a242..1f112ec55e5c 100644
--- a/arch/arm/boot/dts/imx6ull-colibri.dtsi
+++ b/arch/arm/boot/dts/imx6ull-colibri.dtsi
@@ -533,19 +533,19 @@
 
pinctrl_snvs_ad7879_int: snvs-ad7879-int-grp { /* TOUCH Interrupt */
fsl,pins = <
-   MX6ULL_PAD_SNVS_TAMPER7__GPIO5_IO07 0x1b0b0
+   MX6ULL_PAD_SNVS_TAMPER7__GPIO5_IO07 0x100b0
>;
};
 
pinctrl_snvs_reg_sd: snvs-reg-sd-grp {
fsl,pins = <
-   MX6ULL_PAD_SNVS_TAMPER9__GPIO5_IO09 0x4001b8b0
+   MX6ULL_PAD_SNVS_TAMPER9__GPIO5_IO09 0x400100b0
>;
};
 
pinctrl_snvs_usbc_det: snvs-usbc-det-grp {
fsl,pins = <
-   MX6ULL_PAD_SNVS_TAMPER2__GPIO5_IO02 0x1b0b0
+   MX6ULL_PAD_SNVS_TAMPER2__GPIO5_IO02 0x130b0
>;
};
 
-- 
2.22.0



[PATCH v2 20/20] ARM: dts: imx6ull-colibri: Add touchscreen used with Eval Board

2019-07-31 Thread Philippe Schenker
This adds the common touchscreen that is used with Toradex's
Eval Boards.

Signed-off-by: Philippe Schenker 

---

Changes in v2:
- Removed f0710a, that is downstream only
- Changed to generic node name
- Better comment

 .../arm/boot/dts/imx6ull-colibri-eval-v3.dtsi | 24 +++
 1 file changed, 24 insertions(+)

diff --git a/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi
index d3c4809f140e..78e74bfeca1b 100644
--- a/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi
+++ b/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi
@@ -112,6 +112,21 @@
  {
status = "okay";
 
+   /*
+* Touchscreen is using SODIMM 28/30, also used for PWM, PWM,
+* aka pwm2, pwm3. so if you enable touchscreen, disable the pwms
+*/
+   touchscreen@4a {
+   compatible = "atmel,maxtouch";
+   pinctrl-names = "default";
+   pinctrl-0 = <_gpiotouch>;
+   reg = <0x4a>;
+   interrupt-parent = <>;
+   interrupts = <16 IRQ_TYPE_EDGE_FALLING>;/* SODIMM 28 */
+   reset-gpios = < 5 GPIO_ACTIVE_HIGH>;  /* SODIMM 30 */
+   status = "disabled";
+   };
+
/* M41T0M6 real time clock on carrier board */
m41t0m6: rtc@68 {
compatible = "st,m41t0";
@@ -188,3 +203,12 @@
sd-uhs-sdr104;
status = "okay";
 };
+
+ {
+   pinctrl_gpiotouch: touchgpios {
+   fsl,pins = <
+   MX6UL_PAD_NAND_DQS__GPIO4_IO16  0x74
+   MX6UL_PAD_ENET1_TX_EN__GPIO2_IO05   0x14
+   >;
+   };
+};
-- 
2.22.0



[PATCH v2 16/20] ARM: dts: imx6ull-colibri: Add watchdog

2019-07-31 Thread Philippe Schenker
This patch adds the watchdog to the imx6ull-colibri devicetree

Signed-off-by: Philippe Schenker 
---

Changes in v2: None

 arch/arm/boot/dts/imx6ull-colibri.dtsi | 12 
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/boot/dts/imx6ull-colibri.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri.dtsi
index 1f112ec55e5c..e3220298dd6f 100644
--- a/arch/arm/boot/dts/imx6ull-colibri.dtsi
+++ b/arch/arm/boot/dts/imx6ull-colibri.dtsi
@@ -199,6 +199,12 @@
assigned-clock-rates = <0>, <19800>;
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_wdog>;
+   fsl,ext-reset-output;
+};
+
  {
pinctrl_can_int: canint-grp {
fsl,pins = <
@@ -506,6 +512,12 @@
MX6UL_PAD_GPIO1_IO03__OSC32K_32K_OUT0x14
>;
};
+
+   pinctrl_wdog: wdog-grp {
+   fsl,pins = <
+   MX6UL_PAD_LCD_RESET__WDOG1_WDOG_ANY0x30b0
+   >;
+   };
 };
 
 _snvs {
-- 
2.22.0



[PATCH v2 12/20] ARM: dts: imx6: Add touchscreens used on Toradex eval boards

2019-07-31 Thread Philippe Schenker
This commit adds the touchscreens from Toradex so one can enable it.

Signed-off-by: Philippe Schenker 

---

Changes in v2:
- Deleted touchrevolution downstream stuff
- Use generic node name
- Put a better comment in there

 arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts  | 31 +++
 arch/arm/boot/dts/imx6q-apalis-eval.dts   | 13 
 arch/arm/boot/dts/imx6q-apalis-ixora-v1.1.dts | 13 
 arch/arm/boot/dts/imx6q-apalis-ixora.dts  | 13 
 4 files changed, 70 insertions(+)

diff --git a/arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts 
b/arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts
index 9a5d6c94cca4..763fb5e90bd3 100644
--- a/arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts
+++ b/arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts
@@ -168,6 +168,21 @@
  {
status = "okay";
 
+   /*
+* Touchscreen is using SODIMM 28/30, also used for PWM, PWM,
+* aka pwm2, pwm3. so if you enable touchscreen, disable the pwms
+*/
+   touchscreen@4a {
+   compatible = "atmel,maxtouch";
+   pinctrl-names = "default";
+   pinctrl-0 = <_pcap_1>;
+   reg = <0x4a>;
+   interrupt-parent = <>;
+   interrupts = <9 IRQ_TYPE_EDGE_FALLING>; /* SODIMM 28 */
+   reset-gpios = < 10 GPIO_ACTIVE_HIGH>; /* SODIMM 30 */
+   status = "disabled";
+   };
+
/* M41T0M6 real time clock on carrier board */
rtc_i2c: rtc@68 {
compatible = "st,m41t0";
@@ -175,6 +190,22 @@
};
 };
 
+ {
+   pinctrl_pcap_1: pcap-1 {
+   fsl,pins = <
+   MX6QDL_PAD_GPIO_9__GPIO1_IO09   0x1b0b0 /* SODIMM 28 */
+   MX6QDL_PAD_SD4_DAT2__GPIO2_IO10 0x1b0b0 /* SODIMM 30 */
+   >;
+   };
+
+   pinctrl_mxt_ts: mxt-ts {
+   fsl,pins = <
+   MX6QDL_PAD_EIM_CS1__GPIO2_IO24  0x130b0 /* SODIMM 107 */
+   MX6QDL_PAD_SD2_DAT1__GPIO1_IO14 0x130b0 /* SODIMM 106 */
+   >;
+   };
+};
+
 _di0_disp0 {
remote-endpoint = <_display_in>;
 };
diff --git a/arch/arm/boot/dts/imx6q-apalis-eval.dts 
b/arch/arm/boot/dts/imx6q-apalis-eval.dts
index 0edd3043d9c1..4665e15b196d 100644
--- a/arch/arm/boot/dts/imx6q-apalis-eval.dts
+++ b/arch/arm/boot/dts/imx6q-apalis-eval.dts
@@ -167,6 +167,19 @@
  {
status = "okay";
 
+   /*
+* Touchscreen is using SODIMM 28/30, also used for PWM, PWM,
+* aka pwm2, pwm3. so if you enable touchscreen, disable the pwms
+*/
+   touchscreen@4a {
+   compatible = "atmel,maxtouch";
+   reg = <0x4a>;
+   interrupt-parent = <>;
+   interrupts = <10 IRQ_TYPE_EDGE_FALLING>;
+   reset-gpios = < 9 GPIO_ACTIVE_HIGH>; /* SODIMM 13 */
+   status = "disabled";
+   };
+
pcie-switch@58 {
compatible = "plx,pex8605";
reg = <0x58>;
diff --git a/arch/arm/boot/dts/imx6q-apalis-ixora-v1.1.dts 
b/arch/arm/boot/dts/imx6q-apalis-ixora-v1.1.dts
index b94bb687be6b..a3fa04a97d81 100644
--- a/arch/arm/boot/dts/imx6q-apalis-ixora-v1.1.dts
+++ b/arch/arm/boot/dts/imx6q-apalis-ixora-v1.1.dts
@@ -172,6 +172,19 @@
  {
status = "okay";
 
+   /*
+* Touchscreen is using SODIMM 28/30, also used for PWM, PWM,
+* aka pwm2, pwm3. so if you enable touchscreen, disable the pwms
+*/
+   touchscreen@4a {
+   compatible = "atmel,maxtouch";
+   reg = <0x4a>;
+   interrupt-parent = <>;
+   interrupts = <10 IRQ_TYPE_EDGE_FALLING>;
+   reset-gpios = < 9 GPIO_ACTIVE_HIGH>; /* SODIMM 13 */
+   status = "disabled";
+   };
+
/* M41T0M6 real time clock on carrier board */
rtc_i2c: rtc@68 {
compatible = "st,m41t0";
diff --git a/arch/arm/boot/dts/imx6q-apalis-ixora.dts 
b/arch/arm/boot/dts/imx6q-apalis-ixora.dts
index 302fd6adc8a7..5ba49d0f4880 100644
--- a/arch/arm/boot/dts/imx6q-apalis-ixora.dts
+++ b/arch/arm/boot/dts/imx6q-apalis-ixora.dts
@@ -171,6 +171,19 @@
  {
status = "okay";
 
+   /*
+* Touchscreen is using SODIMM 28/30, also used for PWM, PWM,
+* aka pwm2, pwm3. so if you enable touchscreen, disable the pwms
+*/
+   touchscreen@4a {
+   compatible = "atmel,maxtouch";
+   reg = <0x4a>;
+   interrupt-parent = <>;
+   interrupts = <10 IRQ_TYPE_EDGE_FALLING>;
+   reset-gpios = < 9 GPIO_ACTIVE_HIGH>; /* SODIMM 13 */
+   status = "disabled";
+   };
+
eeprom@50 {
compatible = "atmel,24c02";
reg = <0x50>;
-- 
2.22.0



[PATCH v2 09/20] ARM: dts: imx6qdl-colibri: add phy to fec

2019-07-31 Thread Philippe Schenker
Add the phy-node and mdio bus to the fec-node, represented as is on
hardware.
This commit includes micrel,led-mode that is set to the default
value, prepared for someone who wants to change this.

Signed-off-by: Philippe Schenker 
---

Changes in v2: None

 arch/arm/boot/dts/imx6qdl-colibri.dtsi | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm/boot/dts/imx6qdl-colibri.dtsi 
b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
index 1beac22266ed..019dda6b88ad 100644
--- a/arch/arm/boot/dts/imx6qdl-colibri.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
@@ -140,7 +140,18 @@
pinctrl-names = "default";
pinctrl-0 = <_enet>;
phy-mode = "rmii";
+   phy-handle = <>;
status = "okay";
+
+   mdio {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   ethphy: ethernet-phy@0 {
+   reg = <0>;
+   micrel,led-mode = <0>;
+   };
+   };
 };
 
  {
-- 
2.22.0



[PATCH v2 13/20] ARM: dts: imx6-colibri: Add missing pinmuxing to Toradex eval board

2019-07-31 Thread Philippe Schenker
This patch adds some missing pinmuxing that is in the colibri
standard to the dts.

Signed-off-by: Philippe Schenker 

---

Changes in v2:
- Commit title

 arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts 
b/arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts
index 763fb5e90bd3..e7a2d8c3b2d4 100644
--- a/arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts
+++ b/arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts
@@ -191,6 +191,14 @@
 };
 
  {
+   pinctrl-names = "default";
+   pinctrl-0 = <
+   _weim_gpio_1 _weim_gpio_2
+   _weim_gpio_3 _weim_gpio_4
+   _weim_gpio_5 _weim_gpio_6
+   _usbh_oc_1 _usbc_id_1
+   >;
+
pinctrl_pcap_1: pcap-1 {
fsl,pins = <
MX6QDL_PAD_GPIO_9__GPIO1_IO09   0x1b0b0 /* SODIMM 28 */
-- 
2.22.0



[PATCH v2 08/20] ARM: dts: imx7-colibri: Add touch controllers

2019-07-31 Thread Philippe Schenker
Add atmel mxt multitouch controller and TouchRevolution multitouch
controller which are connected over an I2C bus.

Signed-off-by: Philippe Schenker 

---

Changes in v2:
- Deleted touchrevolution downstream stuff
- Use generic node name
- Better comment

 arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi | 24 +
 1 file changed, 24 insertions(+)

diff --git a/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi 
b/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
index d4dbc4fc1adf..576dec9ff81c 100644
--- a/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
@@ -145,6 +145,21 @@
  {
status = "okay";
 
+   /*
+* Touchscreen is using SODIMM 28/30, also used for PWM, PWM,
+* aka pwm2, pwm3. so if you enable touchscreen, disable the pwms
+*/
+   touchscreen@4a {
+   compatible = "atmel,maxtouch";
+   pinctrl-names = "default";
+   pinctrl-0 = <_gpiotouch>;
+   reg = <0x4a>;
+   interrupt-parent = <>;
+   interrupts = <9 IRQ_TYPE_EDGE_FALLING>; /* SODIMM 28 */
+   reset-gpios = < 10 GPIO_ACTIVE_HIGH>; /* SODIMM 30 */
+   status = "disabled";
+   };
+
/* M41T0M6 real time clock on carrier board */
rtc: m41t0m6@68 {
compatible = "st,m41t0";
@@ -200,3 +215,12 @@
vmmc-supply = <_3v3>;
status = "okay";
 };
+
+ {
+   pinctrl_gpiotouch: touchgpios {
+   fsl,pins = <
+   MX7D_PAD_GPIO1_IO09__GPIO1_IO9  0x74
+   MX7D_PAD_GPIO1_IO10__GPIO1_IO10 0x14
+   >;
+   };
+};
-- 
2.22.0



[PATCH v2 14/20] ARM: dts: imx6ull-colibri: Add sleep mode to fec

2019-07-31 Thread Philippe Schenker
Do not change the clock as the power for this phy is switched
with that clock.

Signed-off-by: Philippe Schenker 
---

Changes in v2: None

 arch/arm/boot/dts/imx6ull-colibri.dtsi | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/imx6ull-colibri.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri.dtsi
index d56728f03c35..1019ce69a242 100644
--- a/arch/arm/boot/dts/imx6ull-colibri.dtsi
+++ b/arch/arm/boot/dts/imx6ull-colibri.dtsi
@@ -62,8 +62,9 @@
 };
 
  {
-   pinctrl-names = "default";
+   pinctrl-names = "default", "sleep";
pinctrl-0 = <_enet2>;
+   pinctrl-1 = <_enet2_sleep>;
phy-mode = "rmii";
phy-handle = <>;
status = "okay";
@@ -220,6 +221,21 @@
>;
};
 
+   pinctrl_enet2_sleep: enet2sleepgrp {
+   fsl,pins = <
+   MX6UL_PAD_GPIO1_IO06__GPIO1_IO060x0
+   MX6UL_PAD_GPIO1_IO07__GPIO1_IO070x0
+   MX6UL_PAD_ENET2_RX_DATA0__GPIO2_IO080x0
+   MX6UL_PAD_ENET2_RX_DATA1__GPIO2_IO090x0
+   MX6UL_PAD_ENET2_RX_EN__GPIO2_IO10   0x0
+   MX6UL_PAD_ENET2_RX_ER__GPIO2_IO15   0x0
+   MX6UL_PAD_ENET2_TX_CLK__ENET2_REF_CLK2  0x4001b031
+   MX6UL_PAD_ENET2_TX_DATA0__GPIO2_IO110x0
+   MX6UL_PAD_ENET2_TX_DATA1__GPIO2_IO120x0
+   MX6UL_PAD_ENET2_TX_EN__GPIO2_IO13   0x0
+   >;
+   };
+
pinctrl_ecspi1_cs: ecspi1-cs-grp {
fsl,pins = <
MX6UL_PAD_LCD_DATA21__GPIO3_IO260x000a0
-- 
2.22.0



[PATCH v2 18/20] ARM: dts: imx6ull-colibri: Add general wakeup key used on Colibri

2019-07-31 Thread Philippe Schenker
This adds the possibility to wake the module with an external signal
as defined in the Colibri standard

Signed-off-by: Philippe Schenker 
---

Changes in v2: None

 arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi
index 3bee37c75aa6..d3c4809f140e 100644
--- a/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi
+++ b/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi
@@ -8,6 +8,20 @@
stdout-path = "serial0:115200n8";
};
 
+   gpio-keys {
+   compatible = "gpio-keys";
+   pinctrl-names = "default";
+   pinctrl-0 = <_snvs_gpiokeys>;
+
+   power {
+   label = "Wake-Up";
+   gpios = < 1 GPIO_ACTIVE_HIGH>;
+   linux,code = ;
+   debounce-interval = <10>;
+   wakeup-source;
+   };
+   };
+
/* fixed crystal dedicated to mcp2515 */
clk16m: clk16m {
compatible = "fixed-clock";
-- 
2.22.0



[PATCH v2 11/20] ARM: dts: imx6qdl-apalis: Add sleep state to can interfaces

2019-07-31 Thread Philippe Schenker
This patch prepares the devicetree for the new Ixora V1.2 where we are
able to turn off the supply of the can transceiver. This implies to use
a sleep state on transmission pins in order to prevent backfeeding.

Signed-off-by: Philippe Schenker 

---

Changes in v2:
- Changed commit title to '...imx6qdl-apalis:...'

 arch/arm/boot/dts/imx6qdl-apalis.dtsi | 27 +--
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/arch/arm/boot/dts/imx6qdl-apalis.dtsi 
b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
index 7c4ad541c3f5..59ed2e4a1fd1 100644
--- a/arch/arm/boot/dts/imx6qdl-apalis.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
@@ -148,14 +148,16 @@
 };
 
  {
-   pinctrl-names = "default";
-   pinctrl-0 = <_flexcan1>;
+   pinctrl-names = "default", "sleep";
+   pinctrl-0 = <_flexcan1_default>;
+   pinctrl-1 = <_flexcan1_sleep>;
status = "disabled";
 };
 
  {
-   pinctrl-names = "default";
-   pinctrl-0 = <_flexcan2>;
+   pinctrl-names = "default", "sleep";
+   pinctrl-0 = <_flexcan2_default>;
+   pinctrl-1 = <_flexcan2_sleep>;
status = "disabled";
 };
 
@@ -599,19 +601,32 @@
>;
};
 
-   pinctrl_flexcan1: flexcan1grp {
+   pinctrl_flexcan1_default: flexcan1defgrp {
fsl,pins = <
MX6QDL_PAD_GPIO_7__FLEXCAN1_TX 0x1b0b0
MX6QDL_PAD_GPIO_8__FLEXCAN1_RX 0x1b0b0
>;
};
 
-   pinctrl_flexcan2: flexcan2grp {
+   pinctrl_flexcan1_sleep: flexcan1slpgrp {
+   fsl,pins = <
+   MX6QDL_PAD_GPIO_7__GPIO1_IO07 0x0
+   MX6QDL_PAD_GPIO_8__GPIO1_IO08 0x0
+   >;
+   };
+
+   pinctrl_flexcan2_default: flexcan2defgrp {
fsl,pins = <
MX6QDL_PAD_KEY_COL4__FLEXCAN2_TX 0x1b0b0
MX6QDL_PAD_KEY_ROW4__FLEXCAN2_RX 0x1b0b0
>;
};
+   pinctrl_flexcan2_sleep: flexcan2slpgrp {
+   fsl,pins = <
+   MX6QDL_PAD_KEY_COL4__GPIO4_IO14 0x0
+   MX6QDL_PAD_KEY_ROW4__GPIO4_IO15 0x0
+   >;
+   };
 
pinctrl_gpio_bl_on: gpioblon {
fsl,pins = <
-- 
2.22.0



[PATCH v2 19/20] ARM: dts: imx6/7-colibri: switch dr_mode to otg

2019-07-31 Thread Philippe Schenker
In order for the otg ports, that these modules support, it is needed
that dr_mode is on otg. Switch to use that feature.

Signed-off-by: Philippe Schenker 
---

Changes in v2: None

 arch/arm/boot/dts/imx6qdl-colibri.dtsi | 2 +-
 arch/arm/boot/dts/imx7-colibri.dtsi| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/imx6qdl-colibri.dtsi 
b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
index 9a63debab0b5..6674198346d2 100644
--- a/arch/arm/boot/dts/imx6qdl-colibri.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
@@ -388,7 +388,7 @@
  {
pinctrl-names = "default";
disable-over-current;
-   dr_mode = "peripheral";
+   dr_mode = "otg";
status = "disabled";
 };
 
diff --git a/arch/arm/boot/dts/imx7-colibri.dtsi 
b/arch/arm/boot/dts/imx7-colibri.dtsi
index 67f5e0c87fdc..42478f1aa146 100644
--- a/arch/arm/boot/dts/imx7-colibri.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri.dtsi
@@ -320,7 +320,7 @@
 };
 
  {
-   dr_mode = "host";
+   dr_mode = "otg";
 };
 
  {
-- 
2.22.0



[PATCH v2 17/20] ARM: dts: imx6ull: improve can templates

2019-07-31 Thread Philippe Schenker
From: Max Krummenacher 

Add the pinmuxing and a inactive node for flexcan1 on SODIMM 55/63
and move the inactive flexcan nodes to imx6ull-colibri-eval-v3.dtsi
where they belong.

Note that this commit does not enable flexcan functionality, but rather
eases the effort needed to do so.

Signed-off-by: Max Krummenacher 
Signed-off-by: Philippe Schenker 
---

Changes in v2: None

 arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi | 12 
 arch/arm/boot/dts/imx6ull-colibri-nonwifi.dtsi |  2 +-
 arch/arm/boot/dts/imx6ull-colibri-wifi.dtsi|  2 +-
 arch/arm/boot/dts/imx6ull-colibri.dtsi | 16 ++--
 4 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi
index b6147c76d159..3bee37c75aa6 100644
--- a/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi
+++ b/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi
@@ -83,6 +83,18 @@
};
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_flexcan1>;
+   status = "disabled";
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_flexcan2>;
+   status = "disabled";
+};
+
  {
status = "okay";
 
diff --git a/arch/arm/boot/dts/imx6ull-colibri-nonwifi.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri-nonwifi.dtsi
index fb213bec4654..95a11b8bcbdb 100644
--- a/arch/arm/boot/dts/imx6ull-colibri-nonwifi.dtsi
+++ b/arch/arm/boot/dts/imx6ull-colibri-nonwifi.dtsi
@@ -15,7 +15,7 @@
  {
pinctrl-names = "default";
pinctrl-0 = <_gpio1 _gpio2 _gpio3
-   _gpio4 _gpio5 _gpio6>;
+   _gpio4 _gpio5 _gpio6 _gpio7>;
 };
 
 _snvs {
diff --git a/arch/arm/boot/dts/imx6ull-colibri-wifi.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri-wifi.dtsi
index 038d8c90f6df..a0545431b3dc 100644
--- a/arch/arm/boot/dts/imx6ull-colibri-wifi.dtsi
+++ b/arch/arm/boot/dts/imx6ull-colibri-wifi.dtsi
@@ -26,7 +26,7 @@
  {
pinctrl-names = "default";
pinctrl-0 = <_gpio1 _gpio2 _gpio3
-   _gpio4 _gpio5>;
+   _gpio4 _gpio5 _gpio7>;
 
 };
 
diff --git a/arch/arm/boot/dts/imx6ull-colibri.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri.dtsi
index e3220298dd6f..553d4c1f80e9 100644
--- a/arch/arm/boot/dts/imx6ull-colibri.dtsi
+++ b/arch/arm/boot/dts/imx6ull-colibri.dtsi
@@ -256,6 +256,13 @@
>;
};
 
+   pinctrl_flexcan1: flexcan1-grp {
+   fsl,pins = <
+   MX6UL_PAD_ENET1_RX_DATA0__FLEXCAN1_TX   0x1b020
+   MX6UL_PAD_ENET1_RX_DATA1__FLEXCAN1_RX   0x1b020
+   >;
+   };
+
pinctrl_flexcan2: flexcan2-grp {
fsl,pins = <
MX6UL_PAD_ENET1_TX_DATA0__FLEXCAN2_RX   0x1b020
@@ -271,8 +278,6 @@
 
pinctrl_gpio1: gpio1-grp {
fsl,pins = <
-   MX6UL_PAD_ENET1_RX_DATA0__GPIO2_IO000x74 /* SODIMM 
55 */
-   MX6UL_PAD_ENET1_RX_DATA1__GPIO2_IO010x74 /* SODIMM 
63 */
MX6UL_PAD_UART3_RX_DATA__GPIO1_IO25 0X14 /* SODIMM 
77 */
MX6UL_PAD_JTAG_TCK__GPIO1_IO14  0x14 /* SODIMM 
99 */
MX6UL_PAD_NAND_CE1_B__GPIO4_IO140x14 /* SODIMM 
133 */
@@ -325,6 +330,13 @@
>;
};
 
+   pinctrl_gpio7: gpio7-grp { /* CAN1 */
+   fsl,pins = <
+   MX6UL_PAD_ENET1_RX_DATA0__GPIO2_IO000x74 /* SODIMM 
55 */
+   MX6UL_PAD_ENET1_RX_DATA1__GPIO2_IO010x74 /* SODIMM 
63 */
+   >;
+   };
+
pinctrl_gpmi_nand: gpmi-nand-grp {
fsl,pins = <
MX6UL_PAD_NAND_DATA00__RAWNAND_DATA00   0x100a9
-- 
2.22.0



[PATCH v2 01/20] ARM: dts: imx7-colibri: make sure module supplies are always on

2019-07-31 Thread Philippe Schenker
From: Marcel Ziswiler 

Prevent regulators from being switched off.

Signed-off-by: Marcel Ziswiler 
Signed-off-by: Philippe Schenker 
---

Changes in v2: None

 arch/arm/boot/dts/imx7-colibri.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/boot/dts/imx7-colibri.dtsi 
b/arch/arm/boot/dts/imx7-colibri.dtsi
index 895fbde4d433..f1c1971f2160 100644
--- a/arch/arm/boot/dts/imx7-colibri.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri.dtsi
@@ -54,6 +54,7 @@
regulator-name = "+V3.3";
regulator-min-microvolt = <330>;
regulator-max-microvolt = <330>;
+   regulator-always-on;
};
 
reg_module_3v3_avdd: regulator-module-3v3-avdd {
@@ -61,6 +62,7 @@
regulator-name = "+V3.3_AVDD_AUDIO";
regulator-min-microvolt = <330>;
regulator-max-microvolt = <330>;
+   regulator-always-on;
};
 
sound {
-- 
2.22.0



[PATCH v2 03/20] ARM: dts: imx7-colibri: prepare module device tree for FlexCAN

2019-07-31 Thread Philippe Schenker
Prepare FlexCAN use on SODIMM 55/63 178/188. Those SODIMM pins are
compatible for CAN bus use with several modules from the Colibri
family.
Add Better drivestrength and also add flexcan2.

Signed-off-by: Philippe Schenker 
---

Changes in v2: None

 arch/arm/boot/dts/imx7-colibri.dtsi | 35 -
 1 file changed, 30 insertions(+), 5 deletions(-)

diff --git a/arch/arm/boot/dts/imx7-colibri.dtsi 
b/arch/arm/boot/dts/imx7-colibri.dtsi
index f7c9ce5bed47..52046085ce6f 100644
--- a/arch/arm/boot/dts/imx7-colibri.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri.dtsi
@@ -117,6 +117,18 @@
fsl,magic-packet;
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_flexcan1>;
+   status = "disabled";
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_flexcan2>;
+   status = "disabled";
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_gpmi_nand>;
@@ -330,12 +342,11 @@
 
  {
pinctrl-names = "default";
-   pinctrl-0 = <_gpio1 _gpio2 _gpio3 
_gpio4>;
+   pinctrl-0 = <_gpio1 _gpio2 _gpio3 _gpio4
+_gpio7>;
 
pinctrl_gpio1: gpio1-grp {
fsl,pins = <
-   MX7D_PAD_ENET1_RGMII_RD3__GPIO7_IO3 0x74 /* SODIMM 
55 */
-   MX7D_PAD_ENET1_RGMII_RD2__GPIO7_IO2 0x74 /* SODIMM 
63 */
MX7D_PAD_SAI1_RX_SYNC__GPIO6_IO16   0x14 /* SODIMM 
77 */
MX7D_PAD_EPDC_DATA09__GPIO2_IO9 0x14 /* SODIMM 
89 */
MX7D_PAD_EPDC_DATA08__GPIO2_IO8 0x74 /* SODIMM 
91 */
@@ -416,6 +427,13 @@
>;
};
 
+   pinctrl_gpio7: gpio7-grp { /* Alternatively CAN1 */
+   fsl,pins = <
+   MX7D_PAD_ENET1_RGMII_RD3__GPIO7_IO3 0x14 /* SODIMM 
55 */
+   MX7D_PAD_ENET1_RGMII_RD2__GPIO7_IO2 0x14 /* SODIMM 
63 */
+   >;
+   };
+
pinctrl_i2c1_int: i2c1-int-grp { /* PMIC / TOUCH */
fsl,pins = <
MX7D_PAD_GPIO1_IO13__GPIO1_IO13 0x79
@@ -459,10 +477,17 @@
>;
};
 
+   pinctrl_flexcan1: flexcan1-grp {
+   fsl,pins = <
+   MX7D_PAD_ENET1_RGMII_RD3__FLEXCAN1_TX   0x79 /* SODIMM 
55 */
+   MX7D_PAD_ENET1_RGMII_RD2__FLEXCAN1_RX   0x79 /* SODIMM 
63 */
+   >;
+   };
+
pinctrl_flexcan2: flexcan2-grp {
fsl,pins = <
-   MX7D_PAD_GPIO1_IO14__FLEXCAN2_RX0x59
-   MX7D_PAD_GPIO1_IO15__FLEXCAN2_TX0x59
+   MX7D_PAD_GPIO1_IO14__FLEXCAN2_RX0x79 /* SODIMM 
188 */
+   MX7D_PAD_GPIO1_IO15__FLEXCAN2_TX0x79 /* SODIMM 
178 */
>;
};
 
-- 
2.22.0



[PATCH v2 02/20] ARM: dts: imx7-colibri: disable HS400

2019-07-31 Thread Philippe Schenker
From: Stefan Agner 

Force HS200 by masking bit 63 of the SDHCI capability register.
The i.MX ESDHC driver uses SDHCI_QUIRK2_CAPS_BIT63_FOR_HS400. With
that the stack checks bit 63 to descide whether HS400 is available.
Using sdhci-caps-mask allows to mask bit 63. The stack then selects
HS200 as operating mode.

This prevents rare communication errors with minimal effect on
performance:
sdhci-esdhc-imx 30b6.usdhc: warning! HS400 strobe DLL
status REF not lock!

Signed-off-by: Stefan Agner 
Signed-off-by: Philippe Schenker 
---

Changes in v2: None

 arch/arm/boot/dts/imx7-colibri.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/imx7-colibri.dtsi 
b/arch/arm/boot/dts/imx7-colibri.dtsi
index f1c1971f2160..f7c9ce5bed47 100644
--- a/arch/arm/boot/dts/imx7-colibri.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri.dtsi
@@ -325,6 +325,7 @@
vmmc-supply = <_module_3v3>;
vqmmc-supply = <_DCDC3>;
non-removable;
+   sdhci-caps-mask = <0x8000 0x0>;
 };
 
  {
-- 
2.22.0



Re: [PATCH v4 07/21] ARM: dts: imx7-colibri: fix 1.8V/UHS support

2019-08-21 Thread Philippe Schenker
On Mon, 2019-08-19 at 13:18 +0200, Shawn Guo wrote:
> On Mon, Aug 12, 2019 at 02:21:25PM +0000, Philippe Schenker wrote:
> > From: Stefan Agner 
> > 
> > Add pinmuxing and do not specify voltage restrictions for the usdhc
> > instance available on the modules edge connector. This allows to use
> > SD-cards with higher transfer modes if supported by the carrier
> > board.
> > 
> > Signed-off-by: Stefan Agner 
> > Signed-off-by: Philippe Schenker 
> > Acked-by: Marcel Ziswiler 
> > 
> > ---
> > 
> > Changes in v4:
> > - Add Marcel Ziswiler's Ack
> > 
> > Changes in v3:
> > - Add new commit message from Stefan's proposal on ML
> > 
> > Changes in v2: None
> > 
> >  arch/arm/boot/dts/imx7-colibri.dtsi | 23 ++-
> >  1 file changed, 22 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm/boot/dts/imx7-colibri.dtsi
> > b/arch/arm/boot/dts/imx7-colibri.dtsi
> > index 5347ed38acb2..c563bb821b5e 100644
> > --- a/arch/arm/boot/dts/imx7-colibri.dtsi
> > +++ b/arch/arm/boot/dts/imx7-colibri.dtsi
> > @@ -326,7 +326,6 @@
> >   {
> > pinctrl-names = "default";
> > pinctrl-0 = <_usdhc1 _cd_usdhc1>;
> > -   no-1-8-v;
> > cd-gpios = < 0 GPIO_ACTIVE_LOW>;
> > disable-wp;
> > vqmmc-supply = <_LDO2>;
> > @@ -671,6 +670,28 @@
> > >;
> > };
> >  
> > +   pinctrl_usdhc1_100mhz: usdhc1grp_100mhz {
> > +   fsl,pins = <
> > +   MX7D_PAD_SD1_CMD__SD1_CMD   0x5a
> > +   MX7D_PAD_SD1_CLK__SD1_CLK   0x1a
> > +   MX7D_PAD_SD1_DATA0__SD1_DATA0   0x5a
> > +   MX7D_PAD_SD1_DATA1__SD1_DATA1   0x5a
> > +   MX7D_PAD_SD1_DATA2__SD1_DATA2   0x5a
> > +   MX7D_PAD_SD1_DATA3__SD1_DATA3   0x5a
> > +   >;
> > +   };
> > +
> > +   pinctrl_usdhc1_200mhz: usdhc1grp_200mhz {
> 
> No reference to them from usdhc1 node?
> 
> Shawn

No. I'd like to have that pinmuxing prepared for someone to add UHS
support to SD. Primary functionality of that pins is something else so
this will have priority.

Philippe

> 
> > +   fsl,pins = <
> > +   MX7D_PAD_SD1_CMD__SD1_CMD   0x5b
> > +   MX7D_PAD_SD1_CLK__SD1_CLK   0x1b
> > +   MX7D_PAD_SD1_DATA0__SD1_DATA0   0x5b
> > +   MX7D_PAD_SD1_DATA1__SD1_DATA1   0x5b
> > +   MX7D_PAD_SD1_DATA2__SD1_DATA2   0x5b
> > +   MX7D_PAD_SD1_DATA3__SD1_DATA3   0x5b
> > +   >;
> > +   };
> > +
> > pinctrl_usdhc3: usdhc3grp {
> > fsl,pins = <
> > MX7D_PAD_SD3_CMD__SD3_CMD   0x59
> > -- 
> > 2.22.0
> > 


Re: [PATCH v4 08/21] ARM: dts: imx7-colibri: Add touch controllers

2019-08-21 Thread Philippe Schenker
On Mon, 2019-08-19 at 13:21 +0200, Shawn Guo wrote:
> On Mon, Aug 12, 2019 at 02:21:26PM +0000, Philippe Schenker wrote:
> > Add touch controller that is connected over an I2C bus.
> > 
> > Signed-off-by: Philippe Schenker 
> > Acked-by: Marcel Ziswiler 
> > 
> > ---
> > 
> > Changes in v4:
> > - Add Marcel Ziswiler's Ack
> > 
> > Changes in v3:
> > - Fix commit message
> > 
> > Changes in v2:
> > - Deleted touchrevolution downstream stuff
> > - Use generic node name
> > - Better comment
> > 
> >  arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi | 24
> > +
> >  1 file changed, 24 insertions(+)
> > 
> > diff --git a/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
> > b/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
> > index d4dbc4fc1adf..576dec9ff81c 100644
> > --- a/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
> > +++ b/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
> > @@ -145,6 +145,21 @@
> >   {
> > status = "okay";
> >  
> > +   /*
> > +* Touchscreen is using SODIMM 28/30, also used for PWM,
> > PWM,
> > +* aka pwm2, pwm3. so if you enable touchscreen, disable the
> > pwms
> > +*/
> > +   touchscreen@4a {
> > +   compatible = "atmel,maxtouch";
> > +   pinctrl-names = "default";
> > +   pinctrl-0 = <_gpiotouch>;
> > +   reg = <0x4a>;
> > +   interrupt-parent = <>;
> > +   interrupts = <9 IRQ_TYPE_EDGE_FALLING>; /*
> > SODIMM 28 */
> > +   reset-gpios = < 10 GPIO_ACTIVE_HIGH>; /* SODIMM 30
> > */
> > +   status = "disabled";
> 
> Why disabled?
> 
> Shawn

Also here, this is meant as an example to get our touchscreen faster
running. But those pins are primarily used as PWM's and they should by
default muxed for PWM's.
If a customer want's to add that touchscreen he just have to switch the
status of this and PWM...

Philippe

> 
> > +   };
> > +
> > /* M41T0M6 real time clock on carrier board */
> > rtc: m41t0m6@68 {
> > compatible = "st,m41t0";
> > @@ -200,3 +215,12 @@
> > vmmc-supply = <_3v3>;
> > status = "okay";
> >  };
> > +
> > + {
> > +   pinctrl_gpiotouch: touchgpios {
> > +   fsl,pins = <
> > +   MX7D_PAD_GPIO1_IO09__GPIO1_IO9  0x74
> > +   MX7D_PAD_GPIO1_IO10__GPIO1_IO10 0x14
> > +   >;
> > +   };
> > +};
> > -- 
> > 2.22.0
> > 


Re: [PATCH v4 11/21] ARM: dts: imx6qdl-apalis: Add sleep state to can interfaces

2019-08-21 Thread Philippe Schenker
On Mon, 2019-08-19 at 13:27 +0200, Shawn Guo wrote:
> On Mon, Aug 12, 2019 at 02:21:31PM +0000, Philippe Schenker wrote:
> > This patch prepares the devicetree for the new Ixora V1.2 where we
> > are
> > able to turn off the supply of the can transceiver. This implies to
> > use
> > a sleep state on transmission pins in order to prevent backfeeding.
> > 
> > Signed-off-by: Philippe Schenker 
> > Acked-by: Marcel Ziswiler 
> > 
> > ---
> > 
> > Changes in v4:
> > - Add Marcel Ziswiler's Ack
> > 
> > Changes in v3: None
> > Changes in v2:
> > - Changed commit title to '...imx6qdl-apalis:...'
> > 
> >  arch/arm/boot/dts/imx6qdl-apalis.dtsi | 27 +---
> > ---
> >  1 file changed, 21 insertions(+), 6 deletions(-)
> > 
> > diff --git a/arch/arm/boot/dts/imx6qdl-apalis.dtsi
> > b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
> > index 7c4ad541c3f5..59ed2e4a1fd1 100644
> > --- a/arch/arm/boot/dts/imx6qdl-apalis.dtsi
> > +++ b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
> > @@ -148,14 +148,16 @@
> >  };
> >  
> >   {
> > -   pinctrl-names = "default";
> > -   pinctrl-0 = <_flexcan1>;
> 
> This line doesn't need to be changed.

You're right, but by adding pinctrl_flexcan1_sleep here, I'd like to
emphasize between "default" and "sleep" and change that.

Since it's only used in this file I don't see any problems.

Philippe
> 
> > +   pinctrl-names = "default", "sleep";
> > +   pinctrl-0 = <_flexcan1_default>;
> > +   pinctrl-1 = <_flexcan1_sleep>;
> > status = "disabled";
> >  };
> >  
> >   {
> > -   pinctrl-names = "default";
> > -   pinctrl-0 = <_flexcan2>;
> > +   pinctrl-names = "default", "sleep";
> > +   pinctrl-0 = <_flexcan2_default>;
> > +   pinctrl-1 = <_flexcan2_sleep>;
> > status = "disabled";
> >  };
> >  
> > @@ -599,19 +601,32 @@
> > >;
> > };
> >  
> > -   pinctrl_flexcan1: flexcan1grp {
> 
> Ditto.  I take them as unnecessary changes.
> 
> Shawn
> 
> > +   pinctrl_flexcan1_default: flexcan1defgrp {
> > fsl,pins = <
> > MX6QDL_PAD_GPIO_7__FLEXCAN1_TX 0x1b0b0
> > MX6QDL_PAD_GPIO_8__FLEXCAN1_RX 0x1b0b0
> > >;
> > };
> >  
> > -   pinctrl_flexcan2: flexcan2grp {
> > +   pinctrl_flexcan1_sleep: flexcan1slpgrp {
> > +   fsl,pins = <
> > +   MX6QDL_PAD_GPIO_7__GPIO1_IO07 0x0
> > +   MX6QDL_PAD_GPIO_8__GPIO1_IO08 0x0
> > +   >;
> > +   };
> > +
> > +   pinctrl_flexcan2_default: flexcan2defgrp {
> > fsl,pins = <
> > MX6QDL_PAD_KEY_COL4__FLEXCAN2_TX 0x1b0b0
> > MX6QDL_PAD_KEY_ROW4__FLEXCAN2_RX 0x1b0b0
> > >;
> > };
> > +   pinctrl_flexcan2_sleep: flexcan2slpgrp {
> > +   fsl,pins = <
> > +   MX6QDL_PAD_KEY_COL4__GPIO4_IO14 0x0
> > +   MX6QDL_PAD_KEY_ROW4__GPIO4_IO15 0x0
> > +   >;
> > +   };
> >  
> > pinctrl_gpio_bl_on: gpioblon {
> > fsl,pins = <
> > -- 
> > 2.22.0
> > 


Re: [RFC PATCH 1/2] Regulator: Core: Add clock-enable to fixed-regulator

2019-08-07 Thread Philippe Schenker
On Tue, 2019-08-06 at 19:26 +0100, Mark Brown wrote:
> On Tue, Aug 06, 2019 at 12:57:32PM +0000, Philippe Schenker wrote:
> > On Mon, 2019-08-05 at 17:37 +0100, Mark Brown wrote:
> > > So the capacitor on the input of the p-FET is keeping the switch
> > > on?
> > > When I say it's not switching with the clock I mean it's not
> > > constantly
> > > bouncing on and off at whatever rate the clock is going at.
> > Ah, that's what you mean. Yes, the capacitor gets slowly charged
> > with
> > the
> > resistor but nearly instantly discharged with the n-FET. So this
> > capacitor
> > is used as a Low-Pass filter to get the p-FET to be constantly
> > switched.
> > It is not bouncing on and off with the clock but rather it is
> > switched
> > constantly.
> 
> Good, I guess this might be part of why it's got this poor ramp time.

Yes, I think so too.

> 
> > > I think you are going to end up with a hack no matter what.
> > That's exactly what I'm trying to prevent. To introduce a fixed
> > regulator that can have a clock is not a hack for me.
> > That the hardware solution is a hack is debatable yes, but why
> > should I
> > not try to solve it properly in software?
> 
> A lot of this discussion is around the definition of terms like "hack"
> and "proper".
> 
> > In the end I just want to represent our hardware in software. Would
> > you
> > agree to create a new clock-regulator.c driver?
> > Or would it make more sense to extend fixed.c to support clocks-
> > enable
> > without touching core?
> 
> At least a separate compatible makes sense, I'd have to see the code
> to
> be clear if a completely separate driver makes sense but it'll need
> separate ops at least.  There'd definitely be a lot of overlap though
> so
> it's worth looking at.

Okay, thanks for discussion! I will try to make something that will fit
in mainline kernel and I will learn more about the regulator subsystem
in general so I can make a solution that fits.
But I'll need some time to do that. I will for sure link to that
discussion when I send the patch.

Philippe


[PATCH v3 01/21] ARM: dts: imx7-colibri: make sure module supplies are always on

2019-08-07 Thread Philippe Schenker
From: Marcel Ziswiler 

Prevent regulators from being switched off.

Signed-off-by: Marcel Ziswiler 
Signed-off-by: Philippe Schenker 
---

Changes in v3: None
Changes in v2: None

 arch/arm/boot/dts/imx7-colibri.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/boot/dts/imx7-colibri.dtsi 
b/arch/arm/boot/dts/imx7-colibri.dtsi
index 895fbde4d433..f1c1971f2160 100644
--- a/arch/arm/boot/dts/imx7-colibri.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri.dtsi
@@ -54,6 +54,7 @@
regulator-name = "+V3.3";
regulator-min-microvolt = <330>;
regulator-max-microvolt = <330>;
+   regulator-always-on;
};
 
reg_module_3v3_avdd: regulator-module-3v3-avdd {
@@ -61,6 +62,7 @@
regulator-name = "+V3.3_AVDD_AUDIO";
regulator-min-microvolt = <330>;
regulator-max-microvolt = <330>;
+   regulator-always-on;
};
 
sound {
-- 
2.22.0



[PATCH v3 05/21] ARM: dts: add recovery for I2C for iMX7

2019-08-07 Thread Philippe Schenker
From: Oleksandr Suvorov 

- add recovery mode for applicable i2c buses for
  Colibri iMX7 module.

Signed-off-by: Oleksandr Suvorov 
Signed-off-by: Philippe Schenker 
---

Changes in v3: None
Changes in v2: None

 arch/arm/boot/dts/imx7-colibri.dtsi | 25 +++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/imx7-colibri.dtsi 
b/arch/arm/boot/dts/imx7-colibri.dtsi
index a8d992f3e897..2480623c92ff 100644
--- a/arch/arm/boot/dts/imx7-colibri.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri.dtsi
@@ -140,8 +140,12 @@
 
  {
clock-frequency = <10>;
-   pinctrl-names = "default";
+   pinctrl-names = "default", "gpio";
pinctrl-0 = <_i2c1 _i2c1_int>;
+   pinctrl-1 = <_i2c1_recovery _i2c1_int>;
+   scl-gpios = < 4 GPIO_ACTIVE_HIGH>;
+   sda-gpios = < 5 GPIO_ACTIVE_HIGH>;
+
status = "okay";
 
codec: sgtl5000@a {
@@ -242,8 +246,11 @@
 
  {
clock-frequency = <10>;
-   pinctrl-names = "default";
+   pinctrl-names = "default", "gpio";
pinctrl-0 = <_i2c4>;
+   pinctrl-1 = <_i2c4_recovery>;
+   scl-gpios = < 8 GPIO_ACTIVE_HIGH>;
+   sda-gpios = < 9 GPIO_ACTIVE_HIGH>;
 };
 
  {
@@ -540,6 +547,13 @@
>;
};
 
+   pinctrl_i2c4_recovery: i2c4-recoverygrp {
+   fsl,pins = <
+   MX7D_PAD_ENET1_RGMII_TD2__GPIO7_IO8 0x407f
+   MX7D_PAD_ENET1_RGMII_TD3__GPIO7_IO9 0x407f
+   >;
+   };
+
pinctrl_lcdif_dat: lcdif-dat-grp {
fsl,pins = <
MX7D_PAD_LCD_DATA00__LCD_DATA0  0x79
@@ -740,6 +754,13 @@
>;
};
 
+   pinctrl_i2c1_recovery: i2c1-recoverygrp {
+   fsl,pins = <
+   MX7D_PAD_LPSR_GPIO1_IO04__GPIO1_IO4 0x407f
+   MX7D_PAD_LPSR_GPIO1_IO05__GPIO1_IO5 0x407f
+   >;
+   };
+
pinctrl_cd_usdhc1: usdhc1-cd-grp {
fsl,pins = <
MX7D_PAD_LPSR_GPIO1_IO00__GPIO1_IO0 0x59 /* CD */
-- 
2.22.0



[PATCH v3 06/21] ARM: dts: imx7-colibri: add GPIO wakeup key

2019-08-07 Thread Philippe Schenker
From: Stefan Agner 

Add wakeup GPIO key which is able to wake the system from sleep
modes (e.g. Suspend-to-Memory).

Signed-off-by: Stefan Agner 
Signed-off-by: Philippe Schenker 
---

Changes in v3: None
Changes in v2: None

 arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi | 14 ++
 arch/arm/boot/dts/imx7-colibri.dtsi |  7 ++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi 
b/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
index 3f2746169181..d4dbc4fc1adf 100644
--- a/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
@@ -52,6 +52,20 @@
clock-frequency = <1600>;
};
 
+   gpio-keys {
+   compatible = "gpio-keys";
+   pinctrl-names = "default";
+   pinctrl-0 = <_gpiokeys>;
+
+   power {
+   label = "Wake-Up";
+   gpios = < 1 GPIO_ACTIVE_HIGH>;
+   linux,code = ;
+   debounce-interval = <10>;
+   gpio-key,wakeup;
+   };
+   };
+
panel: panel {
compatible = "edt,et057090dhu";
backlight = <>;
diff --git a/arch/arm/boot/dts/imx7-colibri.dtsi 
b/arch/arm/boot/dts/imx7-colibri.dtsi
index 2480623c92ff..16d1a1ed1aff 100644
--- a/arch/arm/boot/dts/imx7-colibri.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri.dtsi
@@ -741,12 +741,17 @@
 
pinctrl_gpio_lpsr: gpio1-grp {
fsl,pins = <
-   MX7D_PAD_LPSR_GPIO1_IO01__GPIO1_IO1 0x59
MX7D_PAD_LPSR_GPIO1_IO02__GPIO1_IO2 0x59
MX7D_PAD_LPSR_GPIO1_IO03__GPIO1_IO3 0x59
>;
};
 
+   pinctrl_gpiokeys: gpiokeysgrp {
+   fsl,pins = <
+   MX7D_PAD_LPSR_GPIO1_IO01__GPIO1_IO1 0x19
+   >;
+   };
+
pinctrl_i2c1: i2c1-grp {
fsl,pins = <
MX7D_PAD_LPSR_GPIO1_IO05__I2C1_SDA  0x407f
-- 
2.22.0



[PATCH v3 00/21] Common patches from downstream development

2019-08-07 Thread Philippe Schenker

This patchset holds some common changes that were never upstreamed.
With latest downstream kernel upgrade, I took the aproach to select
mainline devicetrees and atomically add missing stuff for downstream.

These patches I send here are separated out with changes that also
have a benfit for mainline.

Philippe

Changes in v3:
- Add new commit message from Stefan's proposal on ML
- Fix commit message
- Fix commit title to "...imx6-apalis:..."
- New patch to make use of ARM: dts: imx7-colibri: fix 1.8V/UHS support

Changes in v2:
- Deleted touchrevolution downstream stuff
- Use generic node name
- Better comment
- Changed commit title to '...imx6qdl-apalis:...'
- Deleted touchrevolution downstream stuff
- Use generic node name
- Put a better comment in there
- Commit title
- Removed f0710a, that is downstream only
- Changed to generic node name
- Better comment

Marcel Ziswiler (1):
  ARM: dts: imx7-colibri: make sure module supplies are always on

Max Krummenacher (2):
  ARM: dts: imx6ull-colibri: reduce v_batt current in power off
  ARM: dts: imx6ull: improve can templates

Oleksandr Suvorov (1):
  ARM: dts: add recovery for I2C for iMX7

Philippe Schenker (14):
  ARM: dts: imx7-colibri: prepare module device tree for FlexCAN
  ARM: dts: imx7-colibri: Add sleep mode to ethernet
  ARM: dts: imx7-colibri: Add touch controllers
  ARM: dts: imx6qdl-colibri: add phy to fec
  ARM: dts: imx6qdl-colibri: Add missing pin declaration in iomuxc
  ARM: dts: imx6qdl-apalis: Add sleep state to can interfaces
  ARM: dts: imx6-apalis: Add touchscreens used on Toradex eval boards
  ARM: dts: imx6-colibri: Add missing pinmuxing to Toradex eval board
  ARM: dts: imx6ull-colibri: Add sleep mode to fec
  ARM: dts: imx6ull-colibri: Add watchdog
  ARM: dts: imx6ull-colibri: Add general wakeup key used on Colibri
  ARM: dts: imx6/7-colibri: switch dr_mode to otg
  ARM: dts: imx6ull-colibri: Add touchscreen used with Eval Board
  ARM: dts: imx7-colibri: Add UHS support to eval board

Stefan Agner (3):
  ARM: dts: imx7-colibri: disable HS400
  ARM: dts: imx7-colibri: add GPIO wakeup key
  ARM: dts: imx7-colibri: fix 1.8V/UHS support

 arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts  |  39 ++
 arch/arm/boot/dts/imx6q-apalis-eval.dts   |  13 ++
 arch/arm/boot/dts/imx6q-apalis-ixora-v1.1.dts |  13 ++
 arch/arm/boot/dts/imx6q-apalis-ixora.dts  |  13 ++
 arch/arm/boot/dts/imx6qdl-apalis.dtsi |  27 -
 arch/arm/boot/dts/imx6qdl-colibri.dtsi|  27 -
 .../arm/boot/dts/imx6ull-colibri-eval-v3.dtsi |  50 
 .../arm/boot/dts/imx6ull-colibri-nonwifi.dtsi |   2 +-
 arch/arm/boot/dts/imx6ull-colibri-wifi.dtsi   |   2 +-
 arch/arm/boot/dts/imx6ull-colibri.dtsi|  52 +++-
 arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi   |  49 +++-
 arch/arm/boot/dts/imx7-colibri.dtsi   | 114 --
 12 files changed, 373 insertions(+), 28 deletions(-)

-- 
2.22.0



[PATCH v3 14/21] ARM: dts: imx6ull-colibri: Add sleep mode to fec

2019-08-07 Thread Philippe Schenker
Do not change the clock as the power for this phy is switched
with that clock.

Signed-off-by: Philippe Schenker 
---

Changes in v3: None
Changes in v2: None

 arch/arm/boot/dts/imx6ull-colibri.dtsi | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/imx6ull-colibri.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri.dtsi
index d56728f03c35..1019ce69a242 100644
--- a/arch/arm/boot/dts/imx6ull-colibri.dtsi
+++ b/arch/arm/boot/dts/imx6ull-colibri.dtsi
@@ -62,8 +62,9 @@
 };
 
  {
-   pinctrl-names = "default";
+   pinctrl-names = "default", "sleep";
pinctrl-0 = <_enet2>;
+   pinctrl-1 = <_enet2_sleep>;
phy-mode = "rmii";
phy-handle = <>;
status = "okay";
@@ -220,6 +221,21 @@
>;
};
 
+   pinctrl_enet2_sleep: enet2sleepgrp {
+   fsl,pins = <
+   MX6UL_PAD_GPIO1_IO06__GPIO1_IO060x0
+   MX6UL_PAD_GPIO1_IO07__GPIO1_IO070x0
+   MX6UL_PAD_ENET2_RX_DATA0__GPIO2_IO080x0
+   MX6UL_PAD_ENET2_RX_DATA1__GPIO2_IO090x0
+   MX6UL_PAD_ENET2_RX_EN__GPIO2_IO10   0x0
+   MX6UL_PAD_ENET2_RX_ER__GPIO2_IO15   0x0
+   MX6UL_PAD_ENET2_TX_CLK__ENET2_REF_CLK2  0x4001b031
+   MX6UL_PAD_ENET2_TX_DATA0__GPIO2_IO110x0
+   MX6UL_PAD_ENET2_TX_DATA1__GPIO2_IO120x0
+   MX6UL_PAD_ENET2_TX_EN__GPIO2_IO13   0x0
+   >;
+   };
+
pinctrl_ecspi1_cs: ecspi1-cs-grp {
fsl,pins = <
MX6UL_PAD_LCD_DATA21__GPIO3_IO260x000a0
-- 
2.22.0



[PATCH v3 13/21] ARM: dts: imx6-colibri: Add missing pinmuxing to Toradex eval board

2019-08-07 Thread Philippe Schenker
This patch adds some missing pinmuxing that is in the colibri
standard to the dts.

Signed-off-by: Philippe Schenker 

---

Changes in v3: None
Changes in v2:
- Commit title

 arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts 
b/arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts
index 763fb5e90bd3..e7a2d8c3b2d4 100644
--- a/arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts
+++ b/arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts
@@ -191,6 +191,14 @@
 };
 
  {
+   pinctrl-names = "default";
+   pinctrl-0 = <
+   _weim_gpio_1 _weim_gpio_2
+   _weim_gpio_3 _weim_gpio_4
+   _weim_gpio_5 _weim_gpio_6
+   _usbh_oc_1 _usbc_id_1
+   >;
+
pinctrl_pcap_1: pcap-1 {
fsl,pins = <
MX6QDL_PAD_GPIO_9__GPIO1_IO09   0x1b0b0 /* SODIMM 28 */
-- 
2.22.0



[PATCH v3 02/21] ARM: dts: imx7-colibri: disable HS400

2019-08-07 Thread Philippe Schenker
From: Stefan Agner 

Force HS200 by masking bit 63 of the SDHCI capability register.
The i.MX ESDHC driver uses SDHCI_QUIRK2_CAPS_BIT63_FOR_HS400. With
that the stack checks bit 63 to descide whether HS400 is available.
Using sdhci-caps-mask allows to mask bit 63. The stack then selects
HS200 as operating mode.

This prevents rare communication errors with minimal effect on
performance:
sdhci-esdhc-imx 30b6.usdhc: warning! HS400 strobe DLL
status REF not lock!

Signed-off-by: Stefan Agner 
Signed-off-by: Philippe Schenker 
---

Changes in v3: None
Changes in v2: None

 arch/arm/boot/dts/imx7-colibri.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/imx7-colibri.dtsi 
b/arch/arm/boot/dts/imx7-colibri.dtsi
index f1c1971f2160..f7c9ce5bed47 100644
--- a/arch/arm/boot/dts/imx7-colibri.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri.dtsi
@@ -325,6 +325,7 @@
vmmc-supply = <_module_3v3>;
vqmmc-supply = <_DCDC3>;
non-removable;
+   sdhci-caps-mask = <0x8000 0x0>;
 };
 
  {
-- 
2.22.0



[PATCH v3 09/21] ARM: dts: imx6qdl-colibri: add phy to fec

2019-08-07 Thread Philippe Schenker
Add the phy-node and mdio bus to the fec-node, represented as is on
hardware.
This commit includes micrel,led-mode that is set to the default
value, prepared for someone who wants to change this.

Signed-off-by: Philippe Schenker 
---

Changes in v3: None
Changes in v2: None

 arch/arm/boot/dts/imx6qdl-colibri.dtsi | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm/boot/dts/imx6qdl-colibri.dtsi 
b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
index 1beac22266ed..019dda6b88ad 100644
--- a/arch/arm/boot/dts/imx6qdl-colibri.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
@@ -140,7 +140,18 @@
pinctrl-names = "default";
pinctrl-0 = <_enet>;
phy-mode = "rmii";
+   phy-handle = <>;
status = "okay";
+
+   mdio {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   ethphy: ethernet-phy@0 {
+   reg = <0>;
+   micrel,led-mode = <0>;
+   };
+   };
 };
 
  {
-- 
2.22.0



[PATCH v3 21/21] ARM: dts: imx7-colibri: Add UHS support to eval board

2019-08-07 Thread Philippe Schenker
This commit adds UHS capability to Toradex Eval Boards

Signed-off-by: Philippe Schenker 

---

Changes in v3:
- New patch to make use of ARM: dts: imx7-colibri: fix 1.8V/UHS support

Changes in v2: None

 arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi 
b/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
index 576dec9ff81c..90121fbe561f 100644
--- a/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
@@ -210,9 +210,16 @@
 };
 
  {
-   keep-power-in-suspend;
-   wakeup-source;
+   pinctrl-names = "default", "state_100mhz", "state_200mhz";
+   pinctrl-0 = <_usdhc1 _cd_usdhc1>;
+   pinctrl-1 = <_usdhc1_100mhz _cd_usdhc1>;
+   pinctrl-2 = <_usdhc1_200mhz _cd_usdhc1>;
vmmc-supply = <_3v3>;
+   vqmmc-supply = <_LDO2>;
+   cd-gpios = < 0 GPIO_ACTIVE_LOW>;
+   disable-wp;
+   enable-sdio-wakeup;
+   keep-power-in-suspend;
status = "okay";
 };
 
-- 
2.22.0



[PATCH v3 17/21] ARM: dts: imx6ull: improve can templates

2019-08-07 Thread Philippe Schenker
From: Max Krummenacher 

Add the pinmuxing and a inactive node for flexcan1 on SODIMM 55/63
and move the inactive flexcan nodes to imx6ull-colibri-eval-v3.dtsi
where they belong.

Note that this commit does not enable flexcan functionality, but rather
eases the effort needed to do so.

Signed-off-by: Max Krummenacher 
Signed-off-by: Philippe Schenker 
---

Changes in v3: None
Changes in v2: None

 arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi | 12 
 arch/arm/boot/dts/imx6ull-colibri-nonwifi.dtsi |  2 +-
 arch/arm/boot/dts/imx6ull-colibri-wifi.dtsi|  2 +-
 arch/arm/boot/dts/imx6ull-colibri.dtsi | 16 ++--
 4 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi
index b6147c76d159..3bee37c75aa6 100644
--- a/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi
+++ b/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi
@@ -83,6 +83,18 @@
};
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_flexcan1>;
+   status = "disabled";
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_flexcan2>;
+   status = "disabled";
+};
+
  {
status = "okay";
 
diff --git a/arch/arm/boot/dts/imx6ull-colibri-nonwifi.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri-nonwifi.dtsi
index fb213bec4654..95a11b8bcbdb 100644
--- a/arch/arm/boot/dts/imx6ull-colibri-nonwifi.dtsi
+++ b/arch/arm/boot/dts/imx6ull-colibri-nonwifi.dtsi
@@ -15,7 +15,7 @@
  {
pinctrl-names = "default";
pinctrl-0 = <_gpio1 _gpio2 _gpio3
-   _gpio4 _gpio5 _gpio6>;
+   _gpio4 _gpio5 _gpio6 _gpio7>;
 };
 
 _snvs {
diff --git a/arch/arm/boot/dts/imx6ull-colibri-wifi.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri-wifi.dtsi
index 038d8c90f6df..a0545431b3dc 100644
--- a/arch/arm/boot/dts/imx6ull-colibri-wifi.dtsi
+++ b/arch/arm/boot/dts/imx6ull-colibri-wifi.dtsi
@@ -26,7 +26,7 @@
  {
pinctrl-names = "default";
pinctrl-0 = <_gpio1 _gpio2 _gpio3
-   _gpio4 _gpio5>;
+   _gpio4 _gpio5 _gpio7>;
 
 };
 
diff --git a/arch/arm/boot/dts/imx6ull-colibri.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri.dtsi
index e3220298dd6f..553d4c1f80e9 100644
--- a/arch/arm/boot/dts/imx6ull-colibri.dtsi
+++ b/arch/arm/boot/dts/imx6ull-colibri.dtsi
@@ -256,6 +256,13 @@
>;
};
 
+   pinctrl_flexcan1: flexcan1-grp {
+   fsl,pins = <
+   MX6UL_PAD_ENET1_RX_DATA0__FLEXCAN1_TX   0x1b020
+   MX6UL_PAD_ENET1_RX_DATA1__FLEXCAN1_RX   0x1b020
+   >;
+   };
+
pinctrl_flexcan2: flexcan2-grp {
fsl,pins = <
MX6UL_PAD_ENET1_TX_DATA0__FLEXCAN2_RX   0x1b020
@@ -271,8 +278,6 @@
 
pinctrl_gpio1: gpio1-grp {
fsl,pins = <
-   MX6UL_PAD_ENET1_RX_DATA0__GPIO2_IO000x74 /* SODIMM 
55 */
-   MX6UL_PAD_ENET1_RX_DATA1__GPIO2_IO010x74 /* SODIMM 
63 */
MX6UL_PAD_UART3_RX_DATA__GPIO1_IO25 0X14 /* SODIMM 
77 */
MX6UL_PAD_JTAG_TCK__GPIO1_IO14  0x14 /* SODIMM 
99 */
MX6UL_PAD_NAND_CE1_B__GPIO4_IO140x14 /* SODIMM 
133 */
@@ -325,6 +330,13 @@
>;
};
 
+   pinctrl_gpio7: gpio7-grp { /* CAN1 */
+   fsl,pins = <
+   MX6UL_PAD_ENET1_RX_DATA0__GPIO2_IO000x74 /* SODIMM 
55 */
+   MX6UL_PAD_ENET1_RX_DATA1__GPIO2_IO010x74 /* SODIMM 
63 */
+   >;
+   };
+
pinctrl_gpmi_nand: gpmi-nand-grp {
fsl,pins = <
MX6UL_PAD_NAND_DATA00__RAWNAND_DATA00   0x100a9
-- 
2.22.0



[PATCH v3 20/21] ARM: dts: imx6ull-colibri: Add touchscreen used with Eval Board

2019-08-07 Thread Philippe Schenker
This adds the common touchscreen that is used with Toradex's
Eval Boards.

Signed-off-by: Philippe Schenker 

---

Changes in v3: None
Changes in v2:
- Removed f0710a, that is downstream only
- Changed to generic node name
- Better comment

 .../arm/boot/dts/imx6ull-colibri-eval-v3.dtsi | 24 +++
 1 file changed, 24 insertions(+)

diff --git a/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi
index d3c4809f140e..78e74bfeca1b 100644
--- a/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi
+++ b/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi
@@ -112,6 +112,21 @@
  {
status = "okay";
 
+   /*
+* Touchscreen is using SODIMM 28/30, also used for PWM, PWM,
+* aka pwm2, pwm3. so if you enable touchscreen, disable the pwms
+*/
+   touchscreen@4a {
+   compatible = "atmel,maxtouch";
+   pinctrl-names = "default";
+   pinctrl-0 = <_gpiotouch>;
+   reg = <0x4a>;
+   interrupt-parent = <>;
+   interrupts = <16 IRQ_TYPE_EDGE_FALLING>;/* SODIMM 28 */
+   reset-gpios = < 5 GPIO_ACTIVE_HIGH>;  /* SODIMM 30 */
+   status = "disabled";
+   };
+
/* M41T0M6 real time clock on carrier board */
m41t0m6: rtc@68 {
compatible = "st,m41t0";
@@ -188,3 +203,12 @@
sd-uhs-sdr104;
status = "okay";
 };
+
+ {
+   pinctrl_gpiotouch: touchgpios {
+   fsl,pins = <
+   MX6UL_PAD_NAND_DQS__GPIO4_IO16  0x74
+   MX6UL_PAD_ENET1_TX_EN__GPIO2_IO05   0x14
+   >;
+   };
+};
-- 
2.22.0



[PATCH v3 15/21] ARM: dts: imx6ull-colibri: reduce v_batt current in power off

2019-08-07 Thread Philippe Schenker
From: Max Krummenacher 

Reduce the current drawn from VCC_BATT when the main power on the 3V3
pins to the module are switched off.

This switches off SoC internal pull resistors which are provided on the
module for TAMPER7 and TAMPER9 SoC pin and switches on a pull down
instead of a pullup for the USBC_DET module pin (TAMPER2).

Signed-off-by: Max Krummenacher 
Signed-off-by: Philippe Schenker 
---

Changes in v3: None
Changes in v2: None

 arch/arm/boot/dts/imx6ull-colibri.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/imx6ull-colibri.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri.dtsi
index 1019ce69a242..1f112ec55e5c 100644
--- a/arch/arm/boot/dts/imx6ull-colibri.dtsi
+++ b/arch/arm/boot/dts/imx6ull-colibri.dtsi
@@ -533,19 +533,19 @@
 
pinctrl_snvs_ad7879_int: snvs-ad7879-int-grp { /* TOUCH Interrupt */
fsl,pins = <
-   MX6ULL_PAD_SNVS_TAMPER7__GPIO5_IO07 0x1b0b0
+   MX6ULL_PAD_SNVS_TAMPER7__GPIO5_IO07 0x100b0
>;
};
 
pinctrl_snvs_reg_sd: snvs-reg-sd-grp {
fsl,pins = <
-   MX6ULL_PAD_SNVS_TAMPER9__GPIO5_IO09 0x4001b8b0
+   MX6ULL_PAD_SNVS_TAMPER9__GPIO5_IO09 0x400100b0
>;
};
 
pinctrl_snvs_usbc_det: snvs-usbc-det-grp {
fsl,pins = <
-   MX6ULL_PAD_SNVS_TAMPER2__GPIO5_IO02 0x1b0b0
+   MX6ULL_PAD_SNVS_TAMPER2__GPIO5_IO02 0x130b0
>;
};
 
-- 
2.22.0



[PATCH v3 16/21] ARM: dts: imx6ull-colibri: Add watchdog

2019-08-07 Thread Philippe Schenker
This patch adds the watchdog to the imx6ull-colibri devicetree

Signed-off-by: Philippe Schenker 
---

Changes in v3: None
Changes in v2: None

 arch/arm/boot/dts/imx6ull-colibri.dtsi | 12 
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/boot/dts/imx6ull-colibri.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri.dtsi
index 1f112ec55e5c..e3220298dd6f 100644
--- a/arch/arm/boot/dts/imx6ull-colibri.dtsi
+++ b/arch/arm/boot/dts/imx6ull-colibri.dtsi
@@ -199,6 +199,12 @@
assigned-clock-rates = <0>, <19800>;
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_wdog>;
+   fsl,ext-reset-output;
+};
+
  {
pinctrl_can_int: canint-grp {
fsl,pins = <
@@ -506,6 +512,12 @@
MX6UL_PAD_GPIO1_IO03__OSC32K_32K_OUT0x14
>;
};
+
+   pinctrl_wdog: wdog-grp {
+   fsl,pins = <
+   MX6UL_PAD_LCD_RESET__WDOG1_WDOG_ANY0x30b0
+   >;
+   };
 };
 
 _snvs {
-- 
2.22.0



[PATCH v3 18/21] ARM: dts: imx6ull-colibri: Add general wakeup key used on Colibri

2019-08-07 Thread Philippe Schenker
This adds the possibility to wake the module with an external signal
as defined in the Colibri standard

Signed-off-by: Philippe Schenker 
---

Changes in v3: None
Changes in v2: None

 arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi
index 3bee37c75aa6..d3c4809f140e 100644
--- a/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi
+++ b/arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi
@@ -8,6 +8,20 @@
stdout-path = "serial0:115200n8";
};
 
+   gpio-keys {
+   compatible = "gpio-keys";
+   pinctrl-names = "default";
+   pinctrl-0 = <_snvs_gpiokeys>;
+
+   power {
+   label = "Wake-Up";
+   gpios = < 1 GPIO_ACTIVE_HIGH>;
+   linux,code = ;
+   debounce-interval = <10>;
+   wakeup-source;
+   };
+   };
+
/* fixed crystal dedicated to mcp2515 */
clk16m: clk16m {
compatible = "fixed-clock";
-- 
2.22.0



[PATCH v3 08/21] ARM: dts: imx7-colibri: Add touch controllers

2019-08-07 Thread Philippe Schenker
Add touch controller that is connected over an I2C bus.

Signed-off-by: Philippe Schenker 

---

Changes in v3:
- Fix commit message

Changes in v2:
- Deleted touchrevolution downstream stuff
- Use generic node name
- Better comment

 arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi | 24 +
 1 file changed, 24 insertions(+)

diff --git a/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi 
b/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
index d4dbc4fc1adf..576dec9ff81c 100644
--- a/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
@@ -145,6 +145,21 @@
  {
status = "okay";
 
+   /*
+* Touchscreen is using SODIMM 28/30, also used for PWM, PWM,
+* aka pwm2, pwm3. so if you enable touchscreen, disable the pwms
+*/
+   touchscreen@4a {
+   compatible = "atmel,maxtouch";
+   pinctrl-names = "default";
+   pinctrl-0 = <_gpiotouch>;
+   reg = <0x4a>;
+   interrupt-parent = <>;
+   interrupts = <9 IRQ_TYPE_EDGE_FALLING>; /* SODIMM 28 */
+   reset-gpios = < 10 GPIO_ACTIVE_HIGH>; /* SODIMM 30 */
+   status = "disabled";
+   };
+
/* M41T0M6 real time clock on carrier board */
rtc: m41t0m6@68 {
compatible = "st,m41t0";
@@ -200,3 +215,12 @@
vmmc-supply = <_3v3>;
status = "okay";
 };
+
+ {
+   pinctrl_gpiotouch: touchgpios {
+   fsl,pins = <
+   MX7D_PAD_GPIO1_IO09__GPIO1_IO9  0x74
+   MX7D_PAD_GPIO1_IO10__GPIO1_IO10 0x14
+   >;
+   };
+};
-- 
2.22.0



[PATCH v3 10/21] ARM: dts: imx6qdl-colibri: Add missing pin declaration in iomuxc

2019-08-07 Thread Philippe Schenker
This adds the muxing for the optional pins usb-oc (overcurrent) and
usb-id.

Signed-off-by: Philippe Schenker 
---

Changes in v3: None
Changes in v2: None

 arch/arm/boot/dts/imx6qdl-colibri.dtsi | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm/boot/dts/imx6qdl-colibri.dtsi 
b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
index 019dda6b88ad..9a63debab0b5 100644
--- a/arch/arm/boot/dts/imx6qdl-colibri.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
@@ -615,6 +615,13 @@
>;
};
 
+   pinctrl_usbh_oc_1: usbh_oc-1 {
+   fsl,pins = <
+   /* USBH_OC */
+   MX6QDL_PAD_EIM_D30__GPIO3_IO30  0x1b0b0
+   >;
+   };
+
pinctrl_spdif: spdifgrp {
fsl,pins = <
MX6QDL_PAD_GPIO_17__SPDIF_OUT 0x1b0b0
@@ -681,6 +688,13 @@
>;
};
 
+   pinctrl_usbc_id_1: usbc_id-1 {
+   fsl,pins = <
+   /* USBC_ID */
+   MX6QDL_PAD_NANDF_D2__GPIO2_IO02 0x1b0b0
+   >;
+   };
+
pinctrl_usdhc1: usdhc1grp {
fsl,pins = <
MX6QDL_PAD_SD1_CMD__SD1_CMD 0x17071
-- 
2.22.0



[PATCH v3 11/21] ARM: dts: imx6qdl-apalis: Add sleep state to can interfaces

2019-08-07 Thread Philippe Schenker
This patch prepares the devicetree for the new Ixora V1.2 where we are
able to turn off the supply of the can transceiver. This implies to use
a sleep state on transmission pins in order to prevent backfeeding.

Signed-off-by: Philippe Schenker 

---

Changes in v3: None
Changes in v2:
- Changed commit title to '...imx6qdl-apalis:...'

 arch/arm/boot/dts/imx6qdl-apalis.dtsi | 27 +--
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/arch/arm/boot/dts/imx6qdl-apalis.dtsi 
b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
index 7c4ad541c3f5..59ed2e4a1fd1 100644
--- a/arch/arm/boot/dts/imx6qdl-apalis.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
@@ -148,14 +148,16 @@
 };
 
  {
-   pinctrl-names = "default";
-   pinctrl-0 = <_flexcan1>;
+   pinctrl-names = "default", "sleep";
+   pinctrl-0 = <_flexcan1_default>;
+   pinctrl-1 = <_flexcan1_sleep>;
status = "disabled";
 };
 
  {
-   pinctrl-names = "default";
-   pinctrl-0 = <_flexcan2>;
+   pinctrl-names = "default", "sleep";
+   pinctrl-0 = <_flexcan2_default>;
+   pinctrl-1 = <_flexcan2_sleep>;
status = "disabled";
 };
 
@@ -599,19 +601,32 @@
>;
};
 
-   pinctrl_flexcan1: flexcan1grp {
+   pinctrl_flexcan1_default: flexcan1defgrp {
fsl,pins = <
MX6QDL_PAD_GPIO_7__FLEXCAN1_TX 0x1b0b0
MX6QDL_PAD_GPIO_8__FLEXCAN1_RX 0x1b0b0
>;
};
 
-   pinctrl_flexcan2: flexcan2grp {
+   pinctrl_flexcan1_sleep: flexcan1slpgrp {
+   fsl,pins = <
+   MX6QDL_PAD_GPIO_7__GPIO1_IO07 0x0
+   MX6QDL_PAD_GPIO_8__GPIO1_IO08 0x0
+   >;
+   };
+
+   pinctrl_flexcan2_default: flexcan2defgrp {
fsl,pins = <
MX6QDL_PAD_KEY_COL4__FLEXCAN2_TX 0x1b0b0
MX6QDL_PAD_KEY_ROW4__FLEXCAN2_RX 0x1b0b0
>;
};
+   pinctrl_flexcan2_sleep: flexcan2slpgrp {
+   fsl,pins = <
+   MX6QDL_PAD_KEY_COL4__GPIO4_IO14 0x0
+   MX6QDL_PAD_KEY_ROW4__GPIO4_IO15 0x0
+   >;
+   };
 
pinctrl_gpio_bl_on: gpioblon {
fsl,pins = <
-- 
2.22.0



[PATCH v3 12/21] ARM: dts: imx6-apalis: Add touchscreens used on Toradex eval boards

2019-08-07 Thread Philippe Schenker
This commit adds the touchscreens from Toradex so one can enable it.

Signed-off-by: Philippe Schenker 

---

Changes in v3:
- Fix commit title to "...imx6-apalis:..."

Changes in v2:
- Deleted touchrevolution downstream stuff
- Use generic node name
- Put a better comment in there

 arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts  | 31 +++
 arch/arm/boot/dts/imx6q-apalis-eval.dts   | 13 
 arch/arm/boot/dts/imx6q-apalis-ixora-v1.1.dts | 13 
 arch/arm/boot/dts/imx6q-apalis-ixora.dts  | 13 
 4 files changed, 70 insertions(+)

diff --git a/arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts 
b/arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts
index 9a5d6c94cca4..763fb5e90bd3 100644
--- a/arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts
+++ b/arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts
@@ -168,6 +168,21 @@
  {
status = "okay";
 
+   /*
+* Touchscreen is using SODIMM 28/30, also used for PWM, PWM,
+* aka pwm2, pwm3. so if you enable touchscreen, disable the pwms
+*/
+   touchscreen@4a {
+   compatible = "atmel,maxtouch";
+   pinctrl-names = "default";
+   pinctrl-0 = <_pcap_1>;
+   reg = <0x4a>;
+   interrupt-parent = <>;
+   interrupts = <9 IRQ_TYPE_EDGE_FALLING>; /* SODIMM 28 */
+   reset-gpios = < 10 GPIO_ACTIVE_HIGH>; /* SODIMM 30 */
+   status = "disabled";
+   };
+
/* M41T0M6 real time clock on carrier board */
rtc_i2c: rtc@68 {
compatible = "st,m41t0";
@@ -175,6 +190,22 @@
};
 };
 
+ {
+   pinctrl_pcap_1: pcap-1 {
+   fsl,pins = <
+   MX6QDL_PAD_GPIO_9__GPIO1_IO09   0x1b0b0 /* SODIMM 28 */
+   MX6QDL_PAD_SD4_DAT2__GPIO2_IO10 0x1b0b0 /* SODIMM 30 */
+   >;
+   };
+
+   pinctrl_mxt_ts: mxt-ts {
+   fsl,pins = <
+   MX6QDL_PAD_EIM_CS1__GPIO2_IO24  0x130b0 /* SODIMM 107 */
+   MX6QDL_PAD_SD2_DAT1__GPIO1_IO14 0x130b0 /* SODIMM 106 */
+   >;
+   };
+};
+
 _di0_disp0 {
remote-endpoint = <_display_in>;
 };
diff --git a/arch/arm/boot/dts/imx6q-apalis-eval.dts 
b/arch/arm/boot/dts/imx6q-apalis-eval.dts
index 0edd3043d9c1..4665e15b196d 100644
--- a/arch/arm/boot/dts/imx6q-apalis-eval.dts
+++ b/arch/arm/boot/dts/imx6q-apalis-eval.dts
@@ -167,6 +167,19 @@
  {
status = "okay";
 
+   /*
+* Touchscreen is using SODIMM 28/30, also used for PWM, PWM,
+* aka pwm2, pwm3. so if you enable touchscreen, disable the pwms
+*/
+   touchscreen@4a {
+   compatible = "atmel,maxtouch";
+   reg = <0x4a>;
+   interrupt-parent = <>;
+   interrupts = <10 IRQ_TYPE_EDGE_FALLING>;
+   reset-gpios = < 9 GPIO_ACTIVE_HIGH>; /* SODIMM 13 */
+   status = "disabled";
+   };
+
pcie-switch@58 {
compatible = "plx,pex8605";
reg = <0x58>;
diff --git a/arch/arm/boot/dts/imx6q-apalis-ixora-v1.1.dts 
b/arch/arm/boot/dts/imx6q-apalis-ixora-v1.1.dts
index b94bb687be6b..a3fa04a97d81 100644
--- a/arch/arm/boot/dts/imx6q-apalis-ixora-v1.1.dts
+++ b/arch/arm/boot/dts/imx6q-apalis-ixora-v1.1.dts
@@ -172,6 +172,19 @@
  {
status = "okay";
 
+   /*
+* Touchscreen is using SODIMM 28/30, also used for PWM, PWM,
+* aka pwm2, pwm3. so if you enable touchscreen, disable the pwms
+*/
+   touchscreen@4a {
+   compatible = "atmel,maxtouch";
+   reg = <0x4a>;
+   interrupt-parent = <>;
+   interrupts = <10 IRQ_TYPE_EDGE_FALLING>;
+   reset-gpios = < 9 GPIO_ACTIVE_HIGH>; /* SODIMM 13 */
+   status = "disabled";
+   };
+
/* M41T0M6 real time clock on carrier board */
rtc_i2c: rtc@68 {
compatible = "st,m41t0";
diff --git a/arch/arm/boot/dts/imx6q-apalis-ixora.dts 
b/arch/arm/boot/dts/imx6q-apalis-ixora.dts
index 302fd6adc8a7..5ba49d0f4880 100644
--- a/arch/arm/boot/dts/imx6q-apalis-ixora.dts
+++ b/arch/arm/boot/dts/imx6q-apalis-ixora.dts
@@ -171,6 +171,19 @@
  {
status = "okay";
 
+   /*
+* Touchscreen is using SODIMM 28/30, also used for PWM, PWM,
+* aka pwm2, pwm3. so if you enable touchscreen, disable the pwms
+*/
+   touchscreen@4a {
+   compatible = "atmel,maxtouch";
+   reg = <0x4a>;
+   interrupt-parent = <>;
+   interrupts = <10 IRQ_TYPE_EDGE_FALLING>;
+   reset-gpios = < 9 GPIO_ACTIVE_HIGH>; /* SODIMM 13 */
+   status = "disabled";
+   };
+
eeprom@50 {
compatible = "atmel,24c02";
reg = <0x50>;
-- 
2.22.0



[PATCH v3 19/21] ARM: dts: imx6/7-colibri: switch dr_mode to otg

2019-08-07 Thread Philippe Schenker
In order for the otg ports, that these modules support, it is needed
that dr_mode is on otg. Switch to use that feature.

Signed-off-by: Philippe Schenker 
---

Changes in v3: None
Changes in v2: None

 arch/arm/boot/dts/imx6qdl-colibri.dtsi | 2 +-
 arch/arm/boot/dts/imx7-colibri.dtsi| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/imx6qdl-colibri.dtsi 
b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
index 9a63debab0b5..6674198346d2 100644
--- a/arch/arm/boot/dts/imx6qdl-colibri.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
@@ -388,7 +388,7 @@
  {
pinctrl-names = "default";
disable-over-current;
-   dr_mode = "peripheral";
+   dr_mode = "otg";
status = "disabled";
 };
 
diff --git a/arch/arm/boot/dts/imx7-colibri.dtsi 
b/arch/arm/boot/dts/imx7-colibri.dtsi
index 67f5e0c87fdc..42478f1aa146 100644
--- a/arch/arm/boot/dts/imx7-colibri.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri.dtsi
@@ -320,7 +320,7 @@
 };
 
  {
-   dr_mode = "host";
+   dr_mode = "otg";
 };
 
  {
-- 
2.22.0



[PATCH v3 07/21] ARM: dts: imx7-colibri: fix 1.8V/UHS support

2019-08-07 Thread Philippe Schenker
From: Stefan Agner 

Add pinmuxing and do not specify voltage restrictions for the usdhc
instance available on the modules edge connector. This allows to use
SD-cards with higher transfer modes if supported by the carrier board.

Signed-off-by: Stefan Agner 
Signed-off-by: Philippe Schenker 

---

Changes in v3:
- Add new commit message from Stefan's proposal on ML

Changes in v2: None

 arch/arm/boot/dts/imx7-colibri.dtsi | 23 ++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/imx7-colibri.dtsi 
b/arch/arm/boot/dts/imx7-colibri.dtsi
index 16d1a1ed1aff..67f5e0c87fdc 100644
--- a/arch/arm/boot/dts/imx7-colibri.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri.dtsi
@@ -326,7 +326,6 @@
  {
pinctrl-names = "default";
pinctrl-0 = <_usdhc1 _cd_usdhc1>;
-   no-1-8-v;
cd-gpios = < 0 GPIO_ACTIVE_LOW>;
disable-wp;
vqmmc-supply = <_LDO2>;
@@ -671,6 +670,28 @@
>;
};
 
+   pinctrl_usdhc1_100mhz: usdhc1grp_100mhz {
+   fsl,pins = <
+   MX7D_PAD_SD1_CMD__SD1_CMD   0x5a
+   MX7D_PAD_SD1_CLK__SD1_CLK   0x1a
+   MX7D_PAD_SD1_DATA0__SD1_DATA0   0x5a
+   MX7D_PAD_SD1_DATA1__SD1_DATA1   0x5a
+   MX7D_PAD_SD1_DATA2__SD1_DATA2   0x5a
+   MX7D_PAD_SD1_DATA3__SD1_DATA3   0x5a
+   >;
+   };
+
+   pinctrl_usdhc1_200mhz: usdhc1grp_200mhz {
+   fsl,pins = <
+   MX7D_PAD_SD1_CMD__SD1_CMD   0x5b
+   MX7D_PAD_SD1_CLK__SD1_CLK   0x1b
+   MX7D_PAD_SD1_DATA0__SD1_DATA0   0x5b
+   MX7D_PAD_SD1_DATA1__SD1_DATA1   0x5b
+   MX7D_PAD_SD1_DATA2__SD1_DATA2   0x5b
+   MX7D_PAD_SD1_DATA3__SD1_DATA3   0x5b
+   >;
+   };
+
pinctrl_usdhc3: usdhc3grp {
fsl,pins = <
MX7D_PAD_SD3_CMD__SD3_CMD   0x59
-- 
2.22.0



[PATCH v3 03/21] ARM: dts: imx7-colibri: prepare module device tree for FlexCAN

2019-08-07 Thread Philippe Schenker
Prepare FlexCAN use on SODIMM 55/63 178/188. Those SODIMM pins are
compatible for CAN bus use with several modules from the Colibri
family.
Add Better drivestrength and also add flexcan2.

Signed-off-by: Philippe Schenker 
---

Changes in v3: None
Changes in v2: None

 arch/arm/boot/dts/imx7-colibri.dtsi | 35 -
 1 file changed, 30 insertions(+), 5 deletions(-)

diff --git a/arch/arm/boot/dts/imx7-colibri.dtsi 
b/arch/arm/boot/dts/imx7-colibri.dtsi
index f7c9ce5bed47..52046085ce6f 100644
--- a/arch/arm/boot/dts/imx7-colibri.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri.dtsi
@@ -117,6 +117,18 @@
fsl,magic-packet;
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_flexcan1>;
+   status = "disabled";
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_flexcan2>;
+   status = "disabled";
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_gpmi_nand>;
@@ -330,12 +342,11 @@
 
  {
pinctrl-names = "default";
-   pinctrl-0 = <_gpio1 _gpio2 _gpio3 
_gpio4>;
+   pinctrl-0 = <_gpio1 _gpio2 _gpio3 _gpio4
+_gpio7>;
 
pinctrl_gpio1: gpio1-grp {
fsl,pins = <
-   MX7D_PAD_ENET1_RGMII_RD3__GPIO7_IO3 0x74 /* SODIMM 
55 */
-   MX7D_PAD_ENET1_RGMII_RD2__GPIO7_IO2 0x74 /* SODIMM 
63 */
MX7D_PAD_SAI1_RX_SYNC__GPIO6_IO16   0x14 /* SODIMM 
77 */
MX7D_PAD_EPDC_DATA09__GPIO2_IO9 0x14 /* SODIMM 
89 */
MX7D_PAD_EPDC_DATA08__GPIO2_IO8 0x74 /* SODIMM 
91 */
@@ -416,6 +427,13 @@
>;
};
 
+   pinctrl_gpio7: gpio7-grp { /* Alternatively CAN1 */
+   fsl,pins = <
+   MX7D_PAD_ENET1_RGMII_RD3__GPIO7_IO3 0x14 /* SODIMM 
55 */
+   MX7D_PAD_ENET1_RGMII_RD2__GPIO7_IO2 0x14 /* SODIMM 
63 */
+   >;
+   };
+
pinctrl_i2c1_int: i2c1-int-grp { /* PMIC / TOUCH */
fsl,pins = <
MX7D_PAD_GPIO1_IO13__GPIO1_IO13 0x79
@@ -459,10 +477,17 @@
>;
};
 
+   pinctrl_flexcan1: flexcan1-grp {
+   fsl,pins = <
+   MX7D_PAD_ENET1_RGMII_RD3__FLEXCAN1_TX   0x79 /* SODIMM 
55 */
+   MX7D_PAD_ENET1_RGMII_RD2__FLEXCAN1_RX   0x79 /* SODIMM 
63 */
+   >;
+   };
+
pinctrl_flexcan2: flexcan2-grp {
fsl,pins = <
-   MX7D_PAD_GPIO1_IO14__FLEXCAN2_RX0x59
-   MX7D_PAD_GPIO1_IO15__FLEXCAN2_TX0x59
+   MX7D_PAD_GPIO1_IO14__FLEXCAN2_RX0x79 /* SODIMM 
188 */
+   MX7D_PAD_GPIO1_IO15__FLEXCAN2_TX0x79 /* SODIMM 
178 */
>;
};
 
-- 
2.22.0



[PATCH v3 04/21] ARM: dts: imx7-colibri: Add sleep mode to ethernet

2019-08-07 Thread Philippe Schenker
Add sleep pinmux to the fec so it can properly sleep.

Signed-off-by: Philippe Schenker 
---

Changes in v3: None
Changes in v2: None

 arch/arm/boot/dts/imx7-colibri.dtsi | 19 ++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/imx7-colibri.dtsi 
b/arch/arm/boot/dts/imx7-colibri.dtsi
index 52046085ce6f..a8d992f3e897 100644
--- a/arch/arm/boot/dts/imx7-colibri.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri.dtsi
@@ -101,8 +101,9 @@
 };
 
  {
-   pinctrl-names = "default";
+   pinctrl-names = "default", "sleep";
pinctrl-0 = <_enet1>;
+   pinctrl-1 = <_enet1_sleep>;
clocks = < IMX7D_ENET_AXI_ROOT_CLK>,
< IMX7D_ENET_AXI_ROOT_CLK>,
< IMX7D_ENET1_TIME_ROOT_CLK>,
@@ -463,6 +464,22 @@
>;
};
 
+   pinctrl_enet1_sleep: enet1sleepgrp {
+   fsl,pins = <
+   MX7D_PAD_ENET1_RGMII_RX_CTL__GPIO7_IO4  0x0
+   MX7D_PAD_ENET1_RGMII_RD0__GPIO7_IO0 0x0
+   MX7D_PAD_ENET1_RGMII_RD1__GPIO7_IO1 0x0
+   MX7D_PAD_ENET1_RGMII_RXC__GPIO7_IO5 0x0
+
+   MX7D_PAD_ENET1_RGMII_TX_CTL__GPIO7_IO10 0x0
+   MX7D_PAD_ENET1_RGMII_TD0__GPIO7_IO6 0x0
+   MX7D_PAD_ENET1_RGMII_TD1__GPIO7_IO7 0x0
+   MX7D_PAD_GPIO1_IO12__GPIO1_IO12 0x0
+   MX7D_PAD_SD2_CD_B__GPIO5_IO90x0
+   MX7D_PAD_SD2_WP__GPIO5_IO10 0x0
+   >;
+   };
+
pinctrl_ecspi3_cs: ecspi3-cs-grp {
fsl,pins = <
MX7D_PAD_I2C2_SDA__GPIO4_IO11   0x14
-- 
2.22.0



Re: [PATCH v3 07/21] ARM: dts: imx7-colibri: fix 1.8V/UHS support

2019-08-07 Thread Philippe Schenker
On Wed, 2019-08-07 at 08:19 -0300, Fabio Estevam wrote:
> Hi Philippe,
> 
> On Wed, Aug 7, 2019 at 5:26 AM Philippe Schenker
>  wrote:
> > From: Stefan Agner 
> > 
> > Add pinmuxing and do not specify voltage restrictions for the usdhc
> > instance available on the modules edge connector. This allows to use
> > SD-cards with higher transfer modes if supported by the carrier
> > board.
> > 
> > Signed-off-by: Stefan Agner 
> > Signed-off-by: Philippe Schenker 
> > 
> > ---
> > 
> > Changes in v3:
> > - Add new commit message from Stefan's proposal on ML
> 
> The commit message has been improved, but there is also another point
> I mentioned earlier:
> 
> > Changes in v2: None
> > 
> >  arch/arm/boot/dts/imx7-colibri.dtsi | 23 ++-
> >  1 file changed, 22 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm/boot/dts/imx7-colibri.dtsi
> > b/arch/arm/boot/dts/imx7-colibri.dtsi
> > index 16d1a1ed1aff..67f5e0c87fdc 100644
> > --- a/arch/arm/boot/dts/imx7-colibri.dtsi
> > +++ b/arch/arm/boot/dts/imx7-colibri.dtsi
> > @@ -326,7 +326,6 @@
> >   {
> > pinctrl-names = "default";
> > pinctrl-0 = <_usdhc1 _cd_usdhc1>;
> > -   no-1-8-v;
> > cd-gpios = < 0 GPIO_ACTIVE_LOW>;
> > disable-wp;
> > vqmmc-supply = <_LDO2>;
> > @@ -671,6 +670,28 @@
> > >;
> > };
> > 
> > +   pinctrl_usdhc1_100mhz: usdhc1grp_100mhz {
> 
> This new entry has been added and it is not referenced.

Sorry, I probably could have mentioned that in this commit. I want, if
possible, to let this commmit as is. That's why I added another on top
of this patchset. Please see patch 21/21 that makes use of this change.
> 
> > +   fsl,pins = <
> > +   MX7D_PAD_SD1_CMD__SD1_CMD   0x5a
> > +   MX7D_PAD_SD1_CLK__SD1_CLK   0x1a
> > +   MX7D_PAD_SD1_DATA0__SD1_DATA0   0x5a
> > +   MX7D_PAD_SD1_DATA1__SD1_DATA1   0x5a
> > +   MX7D_PAD_SD1_DATA2__SD1_DATA2   0x5a
> > +   MX7D_PAD_SD1_DATA3__SD1_DATA3   0x5a
> > +   >;
> > +   };
> > +
> > +   pinctrl_usdhc1_200mhz: usdhc1grp_200mhz {
> 
> Same here.


Re: [PATCH v3 09/21] ARM: dts: imx6qdl-colibri: add phy to fec

2019-08-08 Thread Philippe Schenker
On Wed, 2019-08-07 at 12:51 +0200, Uwe Kleine-König wrote:
> On Wed, Aug 07, 2019 at 08:26:23AM +0000, Philippe Schenker wrote:
> > Add the phy-node and mdio bus to the fec-node, represented as is on
> > hardware.
> > This commit includes micrel,led-mode that is set to the default
> > value, prepared for someone who wants to change this.
> > 
> > Signed-off-by: Philippe Schenker 
> > ---
> > 
> > Changes in v3: None
> > Changes in v2: None
> > 
> >  arch/arm/boot/dts/imx6qdl-colibri.dtsi | 11 +++
> >  1 file changed, 11 insertions(+)
> > 
> > diff --git a/arch/arm/boot/dts/imx6qdl-colibri.dtsi
> > b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
> > index 1beac22266ed..019dda6b88ad 100644
> > --- a/arch/arm/boot/dts/imx6qdl-colibri.dtsi
> > +++ b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
> > @@ -140,7 +140,18 @@
> > pinctrl-names = "default";
> > pinctrl-0 = <_enet>;
> > phy-mode = "rmii";
> > +   phy-handle = <>;
> > status = "okay";
> > +
> > +   mdio {
> > +   #address-cells = <1>;
> > +   #size-cells = <0>;
> > +
> > +   ethphy: ethernet-phy@0 {
> > +   reg = <0>;
> > +   micrel,led-mode = <0>;
> 
> Doesn't that need a compatible entry to be actually used?
> 
> Best regards
> Uwe

Hi Uwe and thanks for pointing this out. I just tried it and it works
fine without the compatible.

Philippe

> > 


Re: [PATCH v4 20/21] ARM: dts: imx7-colibri: Add UHS support to eval board

2019-08-16 Thread Philippe Schenker
On Mon, 2019-08-12 at 14:21 +, Philippe Schenker wrote:
> This commit adds UHS capability to Toradex Eval Boards
> 
> Signed-off-by: Philippe Schenker 

Please ignore this patch. There was a misunderstanding and this one
shouldn't go into mainline. Sorry for that!
> 
> ---
> 
> Changes in v4: None
> Changes in v3:
> - New patch to make use of ARM: dts: imx7-colibri: fix 1.8V/UHS
> support
> 
> Changes in v2: None
> 
>  arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi | 11 +--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
> b/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
> index 576dec9ff81c..90121fbe561f 100644
> --- a/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
> +++ b/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
> @@ -210,9 +210,16 @@
>  };
>  
>   {
> - keep-power-in-suspend;
> - wakeup-source;
> + pinctrl-names = "default", "state_100mhz", "state_200mhz";
> + pinctrl-0 = <_usdhc1 _cd_usdhc1>;
> + pinctrl-1 = <_usdhc1_100mhz _cd_usdhc1>;
> + pinctrl-2 = <_usdhc1_200mhz _cd_usdhc1>;
>   vmmc-supply = <_3v3>;
> + vqmmc-supply = <_LDO2>;
> + cd-gpios = < 0 GPIO_ACTIVE_LOW>;
> + disable-wp;
> + enable-sdio-wakeup;
> + keep-power-in-suspend;
>   status = "okay";
>  };
>  


Re: [PATCH v4 21/21] ARM: dts: imx6qdl-colibri.dtsi: UHS-I support for v1.1a hw

2019-08-16 Thread Philippe Schenker
On Mon, 2019-08-12 at 14:21 +, Philippe Schenker wrote:
> From: Igor Opaniuk 
> 
> Provide proper configuration for VGEN3, to make sure it's is always
> powered
> which allows that rail to be automatically switched to 1.8 volts
> for proper UHS-I operation. By default it's disabled.
> 
> With UHS-I enabled:
> [  104.153898] mmc1: new ultra high speed SDR104 SDHC card at address
> 59b4
> [  104.166202] mmcblk1: mmc1:59b4 USD00 15.0 GiB
> [  104.173923]  mmcblk1: p1
> 
> root@colibri-imx6:~# hdparm -t /dev/mmcblk1
> /dev/mmcblk1:
> Timing buffered disk reads: 226 MB in  3.01 seconds =  75.01 MB/sec
> 
> Signed-off-by: Igor Opaniuk 
> Signed-off-by: Philippe Schenker 

Please ignore this patch. There was a misunderstanding and this one
shouldn't go into mainline. Sorry for that!
> 
> ---
> 
> Changes in v4:
> - New patch as of the recommendation from Marcel on ML
> 
> Changes in v3: None
> Changes in v2: None
> 
>  arch/arm/boot/dts/imx6qdl-colibri.dtsi | 43 +++
> ---
>  1 file changed, 39 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/imx6qdl-colibri.dtsi
> b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
> index 9a63debab0b5..0241613b5e2b 100644
> --- a/arch/arm/boot/dts/imx6qdl-colibri.dtsi
> +++ b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
> @@ -226,7 +226,12 @@
>   regulator-always-on;
>   };
>  
> - /* vgen3: unused */
> + vgen3_reg: vgen3 {
> + regulator-min-microvolt = <180>;
> + regulator-max-microvolt = <330>;
> + regulator-boot-on;
> + regulator-always-on;
> + };
>  
>   vgen4_reg: vgen4 {
>   regulator-min-microvolt = <180>;
> @@ -394,13 +399,21 @@
>  
>  /* Colibri MMC */
>   {
> - pinctrl-names = "default";
> + pinctrl-names = "default", "state_100mhz", "state_200mhz";
>   pinctrl-0 = <_usdhc1 _mmc_cd>;
> + pinctrl-1 = <_usdhc1_100mhz _mmc_cd>;
> + pinctrl-2 = <_usdhc1_200mhz _mmc_cd>;
> + vqmmc-supply = <_reg>;
> + sd-uhs-sdr12;
> + sd-uhs-sdr25;
> + sd-uhs-sdr50;
> + sd-uhs-sdr104;
> + label = "MMC1";
>   cd-gpios = < 5 GPIO_ACTIVE_LOW>; /* MMCD */
>   disable-wp;
> - vqmmc-supply = <_module_3v3>;
> + enable-sdio-wakeup;
> + keep-power-in-suspend;
>   bus-width = <4>;
> - no-1-8-v;
>   status = "disabled";
>  };
>  
> @@ -706,6 +719,28 @@
>   >;
>   };
>  
> + pinctrl_usdhc1_100mhz: usdhc1grp100mhz {
> + fsl,pins = <
> + MX6QDL_PAD_SD1_CMD__SD1_CMD0x170b1
> + MX6QDL_PAD_SD1_CLK__SD1_CLK0x100b1
> + MX6QDL_PAD_SD1_DAT0__SD1_DATA0 0x170b1
> + MX6QDL_PAD_SD1_DAT1__SD1_DATA1 0x170b1
> + MX6QDL_PAD_SD1_DAT2__SD1_DATA2 0x170b1
> + MX6QDL_PAD_SD1_DAT3__SD1_DATA3 0x170b1
> + >;
> + };
> +
> + pinctrl_usdhc1_200mhz: usdhc1grp200mhz {
> + fsl,pins = <
> + MX6QDL_PAD_SD1_CMD__SD1_CMD0x170f1
> + MX6QDL_PAD_SD1_CLK__SD1_CLK0x100f1
> + MX6QDL_PAD_SD1_DAT0__SD1_DATA0 0x170f1
> + MX6QDL_PAD_SD1_DAT1__SD1_DATA1 0x170f1
> + MX6QDL_PAD_SD1_DAT2__SD1_DATA2 0x170f1
> + MX6QDL_PAD_SD1_DAT3__SD1_DATA3 0x170f1
> + >;
> + };
> +
>   pinctrl_usdhc3: usdhc3grp {
>   fsl,pins = <
>   MX6QDL_PAD_SD3_CMD__SD3_CMD 0x17059
> -- 
> 2.22.0
> 


Re: [PATCH v1 1/7] ARM i.MX6q: remove PHY fixup for KSZ9031

2021-02-03 Thread Philippe Schenker
On Wed, 2021-02-03 at 10:18 +0100, Oleksij Rempel wrote:
> Starting with:
> 
>     bcf3440c6dd7 ("net: phy: micrel: add phy-mode support for the
> KSZ9031 PHY")
> 
> the micrel phy driver started respecting phy-mode for the KSZ9031 PHY.
> At least with kernel v5.8 configuration provided by this fixup was
> overwritten by the micrel driver.
> 
> This fixup was providing following configuration:
> 
> RX path: 2.58ns delay
>     rx -0.42 (left shift) + rx_clk  +0.96ns (right shift) =
>     1,38 + 1,2 internal RX delay = 2.58ns
> TX path: 0.96ns delay
>     tx (no delay) + tx_clk 0.96ns (right shift) = 0.96ns
> 
> This configuration is outside of the recommended RGMII clock skew
> delays
> and about in the middle of: rgmii-idrx and rgmii-id
> 
> Since most embedded systems do not have enough place to introduce
> significant clock skew, rgmii-id is the way to go.
> 
> In case this patch breaks network functionality on your system, build
> kernel with enabled MICREL_PHY. If it is still not working then try
> following device tree options:
> 1. Set (or change) phy-mode in DT to:
>    phy-mode = "rgmii-id";
>    This actives internal delay for both RX and TX.
> 1. Set (or change) phy-mode in DT to:
>    phy-mode = "rgmii-idrx";
>    This actives internal delay for RX only.
> 3. Use following DT properties:
>    phy-mode = "rgmii";
>    txen-skew-psec = <0>;
>    rxdv-skew-psec = <0>;
>    rxd0-skew-psec = <0>;
>    rxd1-skew-psec = <0>;
>    rxd2-skew-psec = <0>;
>    rxd3-skew-psec = <0>;
>    rxc-skew-psec = <1860>;
>    txc-skew-psec = <1860>;
>    This activates the internal delays for RX and TX, with the value as
>    the fixup that is removed in this patch.
> 
> Signed-off-by: Oleksij Rempel 

For Toradex Boards:

Acked-by: Philippe Schenker 

> ---
>  arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts |  2 +-
>  arch/arm/mach-imx/mach-imx6q.c  | 23 ---
>  2 files changed, 1 insertion(+), 24 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts
> b/arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts
> index fa2307d8ce86..c713ac03b3b9 100644
> --- a/arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts
> +++ b/arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts
> @@ -112,7 +112,7 @@ flash: m25p80@0 {
>   {
> pinctrl-names = "default";
> pinctrl-0 = <_enet>;
> -   phy-mode = "rgmii";
> +   phy-mode = "rgmii-id";
> phy-reset-gpios = < 25 GPIO_ACTIVE_LOW>;
> phy-supply = <_1v2_eth>;
> status = "okay";
> diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-
> imx6q.c
> index 703998ebb52e..78205f90da27 100644
> --- a/arch/arm/mach-imx/mach-imx6q.c
> +++ b/arch/arm/mach-imx/mach-imx6q.c
> @@ -40,27 +40,6 @@ static int ksz9021rn_phy_fixup(struct phy_device
> *phydev)
> return 0;
>  }
>  
> -static void mmd_write_reg(struct phy_device *dev, int device, int
> reg, int val)
> -{
> -   phy_write(dev, 0x0d, device);
> -   phy_write(dev, 0x0e, reg);
> -   phy_write(dev, 0x0d, (1 << 14) | device);
> -   phy_write(dev, 0x0e, val);
> -}
> -
> -static int ksz9031rn_phy_fixup(struct phy_device *dev)
> -{
> -   /*
> -    * min rx data delay, max rx/tx clock delay,
> -    * min rx/tx control delay
> -    */
> -   mmd_write_reg(dev, 2, 4, 0);
> -   mmd_write_reg(dev, 2, 5, 0);
> -   mmd_write_reg(dev, 2, 8, 0x003ff);
> -
> -   return 0;
> -}
> -
>  /*
>   * fixup for PLX PEX8909 bridge to configure GPIO1-7 as output High
>   * as they are used for slots1-7 PERST#
> @@ -152,8 +131,6 @@ static void __init imx6q_enet_phy_init(void)
> if (IS_BUILTIN(CONFIG_PHYLIB)) {
> phy_register_fixup_for_uid(PHY_ID_KSZ9021,
> MICREL_PHY_ID_MASK,
> ksz9021rn_phy_fixup);
> -   phy_register_fixup_for_uid(PHY_ID_KSZ9031,
> MICREL_PHY_ID_MASK,
> -   ksz9031rn_phy_fixup);
> phy_register_fixup_for_uid(PHY_ID_AR8031, 0xffef,
> ar8031_phy_fixup);
> phy_register_fixup_for_uid(PHY_ID_AR8035, 0xffef,



Re: [PATCH 1/3] regulator: fixed: add possibility to enable by clock

2019-09-10 Thread Philippe Schenker
On Thu, 2019-09-05 at 19:06 +0100, Mark Brown wrote:
> On Tue, Sep 03, 2019 at 08:03:46AM +0000, Philippe Schenker wrote:
> > This commit adds the possibility to choose the compatible
> > "regulator-fixed-clock" in devicetree.
> > 
> > This is a special regulator-fixed that has to have a clock, from
> > which
> > the regulator gets switched on and off.
> 
> This seems conceptually fine.  Minor issues though:

Thanks for your comments and I'm glad you like it! I will send a v2
shortly, also with Rob's fixes in. Can I expect it to be pulled for 5.4?

Best regards,
Philippe

> 
> > +static int reg_clock_is_enabled(struct regulator_dev *rdev)
> > +{
> > +   struct fixed_voltage_data *priv = rdev_get_drvdata(rdev);
> > +
> > +   if (priv->clk_enable_counter > 0)
> > +   return 1;
> > +
> > +   return 0;
> > +}
> 
> This could just be return priv->clk_enable_counter > 0 - ideally the
> clock API would let us query if the clock is enabled but that might be
> a
> bit confused anyway given that it's possibly shared.


Re: [PATCH 1/3] regulator: fixed: add possibility to enable by clock

2019-09-10 Thread Philippe Schenker
On Tue, 2019-09-10 at 06:08 +, Philippe Schenker wrote:
> On Thu, 2019-09-05 at 19:06 +0100, Mark Brown wrote:
> > On Tue, Sep 03, 2019 at 08:03:46AM +, Philippe Schenker wrote:
> > > This commit adds the possibility to choose the compatible
> > > "regulator-fixed-clock" in devicetree.
> > > 
> > > This is a special regulator-fixed that has to have a clock, from
> > > which
> > > the regulator gets switched on and off.
> > 
> > This seems conceptually fine.  Minor issues though:
> 
> Thanks for your comments and I'm glad you like it! I will send a v2
> shortly, also with Rob's fixes in. Can I expect it to be pulled for
> 5.4?

I meant 5.5 of course.

> 
> Best regards,
> Philippe
> 
> > > +static int reg_clock_is_enabled(struct regulator_dev *rdev)
> > > +{
> > > + struct fixed_voltage_data *priv = rdev_get_drvdata(rdev);
> > > +
> > > + if (priv->clk_enable_counter > 0)
> > > + return 1;
> > > +
> > > + return 0;
> > > +}
> > 
> > This could just be return priv->clk_enable_counter > 0 - ideally the
> > clock API would let us query if the clock is enabled but that might
> > be
> > a
> > bit confused anyway given that it's possibly shared.


[PATCH v2 3/3] dt-bindings: regulator: add regulator-fixed-clock binding

2019-09-10 Thread Philippe Schenker
This adds the documentation to the compatible regulator-fixed-clock.
This binding is a special binding of regulator-fixed and adds the
ability to add a clock to regulator-fixed, so the regulator can be
enabled and disabled with that clock. If the special compatible
regulator-fixed-clock is used it is mandatory to supply a clock.

Signed-off-by: Philippe Schenker 

---

Changes in v2:
- Change select: to if:
- Change items: to enum:
- Defined how many clocks should be given

 .../bindings/regulator/fixed-regulator.yaml   | 19 ++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/regulator/fixed-regulator.yaml 
b/Documentation/devicetree/bindings/regulator/fixed-regulator.yaml
index a650b457085d..a78150c47aa2 100644
--- a/Documentation/devicetree/bindings/regulator/fixed-regulator.yaml
+++ b/Documentation/devicetree/bindings/regulator/fixed-regulator.yaml
@@ -19,9 +19,19 @@ description:
 allOf:
   - $ref: "regulator.yaml#"
 
+if:
+  properties:
+compatible:
+  contains:
+const: regulator-fixed-clock
+  required:
+- clocks
+
 properties:
   compatible:
-const: regulator-fixed
+enum:
+  - const: regulator-fixed
+  - const: regulator-fixed-clock
 
   regulator-name: true
 
@@ -29,6 +39,13 @@ properties:
 description: gpio to use for enable control
 maxItems: 1
 
+  clocks:
+description:
+  clock to use for enable control. This binding is only available if
+  the compatible is chosen to regulator-fixed-clock. The clock binding
+  is mandatory if compatible is chosen to regulator-fixed-clock.
+maxItems: 1
+
   startup-delay-us:
 description: startup time in microseconds
 $ref: /schemas/types.yaml#/definitions/uint32
-- 
2.23.0



  1   2   3   >