Devicetree
 help / color / mirror / Atom feed
* Re: [PATCH v2 1/5] ARM: dts: iwg20d-q7-common: Sound PIO support
From: Simon Horman @ 2017-12-20  9:49 UTC (permalink / raw)
  To: Biju Das
  Cc: Rob Herring, Mark Rutland, Kuninori Morimoto, Magnus Damm,
	Chris Paterson, Fabrizio Castro, devicetree, linux-renesas-soc
In-Reply-To: <20171220094128.cffetpgij42m57kq@verge.net.au>

On Wed, Dec 20, 2017 at 10:41:28AM +0100, Simon Horman wrote:
> On Mon, Dec 18, 2017 at 06:22:37PM +0000, Biju Das wrote:
> > Enable sound PIO support on carrier board.
> > 
> > Signed-off-by: Biju Das <biju.das@bp.renesas.com>
> > Reviewed-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
> > Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > ---
> > v1-->v2
> >  * Reworked sorting
> > 
> >  arch/arm/boot/dts/iwg20d-q7-common.dtsi | 46 +++++++++++++++++++++++++++++++++
> >  1 file changed, 46 insertions(+)
> > 
> > diff --git a/arch/arm/boot/dts/iwg20d-q7-common.dtsi b/arch/arm/boot/dts/iwg20d-q7-common.dtsi
> > index 2070b14..ed67201 100644
> > --- a/arch/arm/boot/dts/iwg20d-q7-common.dtsi
> > +++ b/arch/arm/boot/dts/iwg20d-q7-common.dtsi
> > @@ -34,6 +34,22 @@
> >  		regulator-always-on;
> >  	};
> >  
> > +	rsnd_sgtl5000: sound {
> > +		compatible = "simple-audio-card";
> > +
> > +		simple-audio-card,format = "i2s";
> > +		simple-audio-card,bitclock-master = <&sndcodec>;
> > +		simple-audio-card,frame-master = <&sndcodec>;
> > +
> > +		sndcpu: simple-audio-card,cpu {
> > +			sound-dai = <&rcar_sound>;
> > +		};
> > +
> > +		sndcodec: simple-audio-card,codec {
> > +			sound-dai = <&sgtl5000>;
> 
> I'm sorry for not noticing this earlier but with this patch applied
> (and none of the others in this series) I see the following error:
> 
> arch/arm/boot/dts/r8a7743-iwg20d-q7.dtb: ERROR (phandle_references):
> Reference to non-existent node or label "sgtl5000"
> 
> At the very least this will break bisection.
> Please find a way to avoid this.

Sorry for the false alarm!!!

It looks like "ARM: dts: iwg20d-q7-common: Enable SGTL5000 audio codec"
was missing from my tree and all is well with that patch present.

^ permalink raw reply

* RE: [PATCH v3 2/5] dt-bindings: pwm: rcar: Document r8a774[35] PWM bindings
From: Fabrizio Castro @ 2017-12-20  9:54 UTC (permalink / raw)
  To: Simon Horman
  Cc: Thierry Reding, Rob Herring, Mark Rutland,
	linux-pwm@vger.kernel.org, devicetree@vger.kernel.org,
	Geert Uytterhoeven, Chris Paterson, Biju Das,
	linux-renesas-soc@vger.kernel.org
In-Reply-To: <20171220083137.63jj4rrkztguvvbm@verge.net.au>

Hello Simon,

> Subject: Re: [PATCH v3 2/5] dt-bindings: pwm: rcar: Document r8a774[35] PWM bindings
>
> On Tue, Dec 19, 2017 at 01:34:57PM +0000, Fabrizio Castro wrote:
> > This patch adds compatible strings specific to r8a774[35], no driver
> > change is needed as the fallback compatible string will activate the
> > right code. Also, this patch replaces the example with a DT snippet used
> > for adding PWM0 support to an r8a7743 based platform.
>
> What is the motivation for updating the example?

I am sorry I forgot to copy the explanation across from the first version of the patch:
https://patchwork.kernel.org/patch/10111831/

"the reason for replacing the example with one of a different SoC is that
the new example refers to recent code from a real use case. I hope that's ok."

Basically the r8a7743 will be the first platform with full upstream support, and I believe it is better to have up-to-date examples proven to work in the documentation.

> Could it be stated here?

Shall I send a new version for this?


Thanks,
Fab


[https://www2.renesas.eu/media/email/unicef_2017.jpg]

This Christmas, instead of sending out cards, Renesas Electronics Europe have decided to support Unicef with a donation. For further details click here<https://www.unicef.org/> to find out about the valuable work they do, helping children all over the world.
We would like to take this opportunity to wish you a Merry Christmas and a prosperous New Year.



Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.

^ permalink raw reply

* Re: [PATCH v4 33/36] net: faraday add nds32 support.
From: kbuild test robot @ 2017-12-20  9:54 UTC (permalink / raw)
  Cc: kbuild-all, greentime, linux-kernel, arnd, linux-arch, tglx,
	jason, marc.zyngier, robh+dt, netdev, deanbo422, devicetree, viro,
	dhowells, will.deacon, daniel.lezcano, linux-serial,
	geert.uytterhoeven, linus.walleij, mark.rutland, greg, ren_guo,
	pombredanne, green.hu
In-Reply-To: <95be78502aa406f106ecbe87e751a45333883b1f.1513577007.git.green.hu@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3649 bytes --]

Hi Greentime,

I love your patch! Perhaps something to improve:

[auto build test WARNING on tip/timers/core]
[cannot apply to linus/master v4.15-rc4 next-20171220]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Greentime-Hu/Andes-nds32-Linux-Kernel/20171220-155937
config: sparc64-allyesconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=sparc64 

All warnings (new ones prefixed by >>):

   drivers/net/ethernet/faraday/ftmac100.c: In function 'ftmac100_rxdes_set_page':
>> drivers/net/ethernet/faraday/ftmac100.c:288:18: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     rxdes->rxdes3 = (unsigned int)page;
                     ^
   drivers/net/ethernet/faraday/ftmac100.c: In function 'ftmac100_rxdes_get_page':
>> drivers/net/ethernet/faraday/ftmac100.c:293:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     return (struct page *)rxdes->rxdes3;
            ^
   drivers/net/ethernet/faraday/ftmac100.c: In function 'ftmac100_txdes_set_skb':
   drivers/net/ethernet/faraday/ftmac100.c:548:18: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     txdes->txdes3 = (unsigned int)skb;
                     ^
   drivers/net/ethernet/faraday/ftmac100.c: In function 'ftmac100_txdes_get_skb':
   drivers/net/ethernet/faraday/ftmac100.c:553:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     return (struct sk_buff *)txdes->txdes3;
            ^

vim +288 drivers/net/ethernet/faraday/ftmac100.c

8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  281  
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  282  /*
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  283   * rxdes3 is not used by hardware. We use it to keep track of page.
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  284   * Since hardware does not touch it, we can skip cpu_to_le32()/le32_to_cpu().
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  285   */
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  286  static void ftmac100_rxdes_set_page(struct ftmac100_rxdes *rxdes, struct page *page)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  287  {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 @288  	rxdes->rxdes3 = (unsigned int)page;
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  289  }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  290  
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  291  static struct page *ftmac100_rxdes_get_page(struct ftmac100_rxdes *rxdes)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  292  {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 @293  	return (struct page *)rxdes->rxdes3;
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  294  }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  295  

:::::: The code at line 288 was first introduced by commit
:::::: 8d77c036b57cf813d838f859e11b6a188acdb1fb net: add Faraday FTMAC100 10/100 Ethernet driver

:::::: TO: Po-Yu Chuang <ratbert@faraday-tech.com>
:::::: CC: David S. Miller <davem@davemloft.net>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 52104 bytes --]

^ permalink raw reply

* Re: [PATCH v2 0/5] Add sound support
From: Simon Horman @ 2017-12-20  9:55 UTC (permalink / raw)
  To: Biju Das
  Cc: Rob Herring, Mark Rutland, Kuninori Morimoto, Magnus Damm,
	Chris Paterson, Fabrizio Castro,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1513621361-10944-1-git-send-email-biju.das-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>

On Mon, Dec 18, 2017 at 06:22:36PM +0000, Biju Das wrote:
> This series aims to add sound support for iWave RZ/G1M board.
> 
> This patch series has below dependency
> 1)https://patchwork.kernel.org/patch/10108041/
> 
> Biju Das (5):
>   ARM: dts: iwg20d-q7-common: Sound PIO support
>   ARM: dts: iwg20d-q7-common: Sound DMA support on DTS
>   ARM: dts: iwg20d-q7-common: Sound DMA support via BUSIF on DTS
>   ARM: dts: iwg20d-q7-common: Sound DMA support via SRC on DTS
>   ARM: dts: iwg20d-q7-common: Sound DMA support via DVC on DTS

Thanks, series applied.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 5/5] ARM: dts: iwg20d-q7-common: Enable SGTL5000 audio codec
From: Simon Horman @ 2017-12-20  9:58 UTC (permalink / raw)
  To: Biju Das
  Cc: Rob Herring, Mark Rutland, Russell King, Magnus Damm,
	Chris Paterson, devicetree, linux-renesas-soc, linux-arm-kernel
In-Reply-To: <1513103111-45830-6-git-send-email-biju.das@bp.renesas.com>

On Tue, Dec 12, 2017 at 06:25:11PM +0000, Biju Das wrote:
> This patch enables SGTL5000 audio codec on the carrier board.
> 
> Signed-off-by: Biju Das <biju.das@bp.renesas.com>
> Reviewed-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>

Somehow I missed applying this one.
I have now done so with the minor update noted below.

> ---
>  arch/arm/boot/dts/iwg20d-q7-common.dtsi | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/iwg20d-q7-common.dtsi b/arch/arm/boot/dts/iwg20d-q7-common.dtsi
> index 54470c6..2070b14 100644
> --- a/arch/arm/boot/dts/iwg20d-q7-common.dtsi
> +++ b/arch/arm/boot/dts/iwg20d-q7-common.dtsi
> @@ -20,6 +20,20 @@
>  		stdout-path = "serial0:115200n8";
>  	};
>  
> +	audio_clock: audio_clock {
> +		compatible = "fixed-clock";
> +		#clock-cells = <0>;
> +		clock-frequency = <26000000>;
> +	};
> +
> +	reg_1p5v: 1p5v {
> +		compatible = "regulator-fixed";
> +		regulator-name = "1P5V";
> +		regulator-min-microvolt = <1500000>;
> +		regulator-max-microvolt = <1500000>;
> +		regulator-always-on;
> +	};
> +
>  	vcc_sdhi1: regulator-vcc-sdhi1 {
>  		compatible = "regulator-fixed";
>  
> @@ -83,6 +97,16 @@
>  		compatible = "ti,bq32000";
>  		reg = <0x68>;
>  	};
> +
> +	sgtl5000: codec@0a {

s/@0a/@a/

Base addresses should not have a leading 0.

# make dtbs W=1
DTC     arch/arm/boot/dts/r8a7743-iwg20d-q7-dbcm-ca.dtb
arch/arm/boot/dts/r8a7743-iwg20d-q7.dtb: Warning (unit_address_format): Node /soc/i2c@e6530000/codec@0a unit name should not have leading 0s

> +		compatible = "fsl,sgtl5000";
> +		#sound-dai-cells = <0>;
> +		reg = <0x0a>;
> +		clocks = <&audio_clock>;
> +		VDDA-supply = <&reg_3p3v>;
> +		VDDIO-supply = <&reg_3p3v>;
> +		VDDD-supply = <&reg_1p5v>;
> +	};
>  };
>  
>  &pci0 {
> -- 
> 1.9.1
> 

^ permalink raw reply

* Re: [PATCH v4 33/36] net: faraday add nds32 support.
From: Geert Uytterhoeven @ 2017-12-20  9:58 UTC (permalink / raw)
  To: kbuild test robot
  Cc: Greentime Hu, kbuild-all-JC7UmRfGjtg, Greentime,
	Linux Kernel Mailing List, Arnd Bergmann, Linux-Arch,
	Thomas Gleixner, Jason Cooper, Marc Zyngier, Rob Herring,
	netdev-u79uwXL29TY76Z2rM5mHXA, Vincent Chen,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Al Viro, David Howells,
	Will Deacon, Daniel Lezcano, linux-serial-u79uwXL29TY76Z2rM5mHXA,
	Linus Walleij, Mark Rutland, Greg KH,
	ren_guo-Y+KPrCd2zL4AvxtiuMwx3w
In-Reply-To: <201712201744.gsBDa4yK%fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

On Wed, Dec 20, 2017 at 10:54 AM, kbuild test robot <lkp-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
> I love your patch! Perhaps something to improve:
>
> [auto build test WARNING on tip/timers/core]
> [cannot apply to linus/master v4.15-rc4 next-20171220]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url:    https://github.com/0day-ci/linux/commits/Greentime-Hu/Andes-nds32-Linux-Kernel/20171220-155937
> config: sparc64-allyesconfig (attached as .config)
> compiler: sparc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
> reproduce:
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # save the attached .config to linux build tree
>         make.cross ARCH=sparc64
>
> All warnings (new ones prefixed by >>):
>
>    drivers/net/ethernet/faraday/ftmac100.c: In function 'ftmac100_rxdes_set_page':
>>> drivers/net/ethernet/faraday/ftmac100.c:288:18: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
>      rxdes->rxdes3 = (unsigned int)page;
>                      ^

The proper way to casts pointer to integers is to cast to "uintptr_t".

However, the address is stored in a 32-bit descriptor, which means it can
not work on 64-bit platforms.

Please make the driver depend on "!64BIT || BROKEN"

Cfr. commit 15bfe05c8d6386f1 ("net: ethernet: xilinx: Mark XILINX_LL_TEMAC
broken on 64-bit")

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* RE: [PATCH 5/5] ARM: dts: iwg20d-q7-common: Enable SGTL5000 audio codec
From: Biju Das @ 2017-12-20 10:02 UTC (permalink / raw)
  To: Simon Horman
  Cc: Rob Herring, Mark Rutland, Russell King, Magnus Damm,
	Chris Paterson,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
In-Reply-To: <20171220095806.jqtkmximxybsq6tr-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>

Thanks Simon for this information.

Next time I will make sure that  compiler won't give any warning message with make dtbs W=1

Regards,
Biju

> -----Original Message-----
> From: Simon Horman [mailto:horms-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org]
> Sent: 20 December 2017 09:58
> To: Biju Das <biju.das-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
> Cc: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>; Mark Rutland
> <mark.rutland-5wv7dgnIgG8@public.gmane.org>; Russell King <linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org>; Magnus
> Damm <magnus.damm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>; Chris Paterson
> <Chris.Paterson2-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>; devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-renesas-
> soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
> Subject: Re: [PATCH 5/5] ARM: dts: iwg20d-q7-common: Enable SGTL5000
> audio codec
>
> On Tue, Dec 12, 2017 at 06:25:11PM +0000, Biju Das wrote:
> > This patch enables SGTL5000 audio codec on the carrier board.
> >
> > Signed-off-by: Biju Das <biju.das-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
> > Reviewed-by: Fabrizio Castro <fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
>
> Somehow I missed applying this one.
> I have now done so with the minor update noted below.
>
> > ---
> >  arch/arm/boot/dts/iwg20d-q7-common.dtsi | 24
> ++++++++++++++++++++++++
> >  1 file changed, 24 insertions(+)
> >
> > diff --git a/arch/arm/boot/dts/iwg20d-q7-common.dtsi
> b/arch/arm/boot/dts/iwg20d-q7-common.dtsi
> > index 54470c6..2070b14 100644
> > --- a/arch/arm/boot/dts/iwg20d-q7-common.dtsi
> > +++ b/arch/arm/boot/dts/iwg20d-q7-common.dtsi
> > @@ -20,6 +20,20 @@
> >  stdout-path = "serial0:115200n8";
> >  };
> >
> > +audio_clock: audio_clock {
> > +compatible = "fixed-clock";
> > +#clock-cells = <0>;
> > +clock-frequency = <26000000>;
> > +};
> > +
> > +reg_1p5v: 1p5v {
> > +compatible = "regulator-fixed";
> > +regulator-name = "1P5V";
> > +regulator-min-microvolt = <1500000>;
> > +regulator-max-microvolt = <1500000>;
> > +regulator-always-on;
> > +};
> > +
> >  vcc_sdhi1: regulator-vcc-sdhi1 {
> >  compatible = "regulator-fixed";
> >
> > @@ -83,6 +97,16 @@
> >  compatible = "ti,bq32000";
> >  reg = <0x68>;
> >  };
> > +
> > +sgtl5000: codec@0a {
>
> s/@0a/@a/
>
> Base addresses should not have a leading 0.
>
> # make dtbs W=1
> DTC     arch/arm/boot/dts/r8a7743-iwg20d-q7-dbcm-ca.dtb
> arch/arm/boot/dts/r8a7743-iwg20d-q7.dtb: Warning (unit_address_format):
> Node /soc/i2c@e6530000/codec@0a unit name should not have leading 0s
>
> > +compatible = "fsl,sgtl5000";
> > +#sound-dai-cells = <0>;
> > +reg = <0x0a>;
> > +clocks = <&audio_clock>;
> > +VDDA-supply = <&reg_3p3v>;
> > +VDDIO-supply = <&reg_3p3v>;
> > +VDDD-supply = <&reg_1p5v>;
> > +};
> >  };
> >
> >  &pci0 {
> > --
> > 1.9.1
> >


[https://www2.renesas.eu/media/email/unicef_2017.jpg]

This Christmas, instead of sending out cards, Renesas Electronics Europe have decided to support Unicef with a donation. For further details click here<https://www.unicef.org/> to find out about the valuable work they do, helping children all over the world.
We would like to take this opportunity to wish you a Merry Christmas and a prosperous New Year.



Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [PATCH v5 0/2] Input: Add Cypress Gen5 Touchscreen driver
From: Mylène Josserand @ 2017-12-20 10:08 UTC (permalink / raw)
  To: dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8
  Cc: mylene.josserand-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA

Hello,

Here is a V5 series to add the driver of the touchscreen Cypress,
TrueTouch Generation 5.
Based on last master branch of "input" kernel's tree.

This patch series has already been posted in several iterations:
    - v1: Sent on 2017/05/29
    - v2: Sent on 2017/08/18
    - v3: Sent on 2017/09/27
    - v4: Sent on 2017/12/01

As I did not have any comments on the last 3 versions, it would be
great to have some feedback in case there is something wrong with this
series?

Changes since v4:
   - Fixed kbuild errors about enum hid_cmd_state and .owner
Changes since v3:
   - Rebased on last input's branch
   - Changed the CRC table to use crc_itu_t_table instead of
   crc_ccitt_false_table which is not merged.
   - Added selection of CRC_ITU_T on KConfig
Changes since v2:
   - Removed pinctrl in dt-binding example which is uncessecary.
   - Added Acked-by and Reviewed-by received.
Changes since v1:
   - Updated the driver according to reviews. Most important modifications:
   removed unnecessary mutex, updated dev_err output, handled return cases
   in a better way, created a HID_ENUM, removed magic value, used an
   existing CRC table and used "linux-keycodes" instead of sub-nodes.
   - Updated the dt-bindings to use linux-keycodes and removed properties'
   description that comes from touchscreen's binding.

Patch 01: Add the basis of the driver for Cypress Gen5 Touchscreen.
Patch 02: Add the binding documentation for this driver.

Thank you in advance,
Mylène

Mylène Josserand (2):
  Input: Add driver for Cypress Generation 5 touchscreen
  dt-bindings: input: Add documentation for cyttsp5

 .../bindings/input/touchscreen/cypress,cyttsp5.txt |   39 +
 drivers/input/touchscreen/Kconfig                  |   16 +
 drivers/input/touchscreen/Makefile                 |    1 +
 drivers/input/touchscreen/cyttsp5.c                | 1112 ++++++++++++++++++++
 4 files changed, 1168 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/cypress,cyttsp5.txt
 create mode 100644 drivers/input/touchscreen/cyttsp5.c

-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [PATCH v5 1/2] Input: Add driver for Cypress Generation 5 touchscreen
From: Mylène Josserand @ 2017-12-20 10:08 UTC (permalink / raw)
  To: dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8
  Cc: mylene.josserand-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20171220100843.2759-1-mylene.josserand-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>

This is the basic driver for the Cypress TrueTouch Gen5 touchscreen
controllers. This driver supports only the I2C bus but it uses regmap
so SPI support could be added later.
The touchscreen can retrieve some defined zone that are handled as
buttons (according to the hardware). That is why it handles
button and multitouch events.

Reviewed-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
Signed-off-by: Mylène Josserand <mylene.josserand-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
---
 drivers/input/touchscreen/Kconfig   |   16 +
 drivers/input/touchscreen/Makefile  |    1 +
 drivers/input/touchscreen/cyttsp5.c | 1112 +++++++++++++++++++++++++++++++++++
 3 files changed, 1129 insertions(+)
 create mode 100644 drivers/input/touchscreen/cyttsp5.c

diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 0cfdb7cb610e..28eea6d5f1bb 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -238,6 +238,22 @@ config TOUCHSCREEN_CYTTSP4_SPI
 	  To compile this driver as a module, choose M here: the
 	  module will be called cyttsp4_spi.
 
+config TOUCHSCREEN_CYTTSP5
+	tristate "Cypress TrueTouch Gen5 Touchscreen Driver"
+	depends on OF
+	select REGMAP_I2C
+	select CRC_ITU_T
+	help
+	  Driver for Parade TrueTouch Standard Product
+	  Generation 5 touchscreen controllers.
+	  I2C bus interface support only.
+
+	  Say Y here if you have a Cypress Gen5 touchscreen.
+	  If unsure, say N.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called cyttsp5.
+
 config TOUCHSCREEN_DA9034
 	tristate "Touchscreen support for Dialog Semiconductor DA9034"
 	depends on PMIC_DA903X
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
index d2a2b3b7af27..e7d124901dd9 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_TOUCHSCREEN_CYTTSP_SPI)	+= cyttsp_spi.o
 obj-$(CONFIG_TOUCHSCREEN_CYTTSP4_CORE)	+= cyttsp4_core.o
 obj-$(CONFIG_TOUCHSCREEN_CYTTSP4_I2C)	+= cyttsp4_i2c.o cyttsp_i2c_common.o
 obj-$(CONFIG_TOUCHSCREEN_CYTTSP4_SPI)	+= cyttsp4_spi.o
+obj-$(CONFIG_TOUCHSCREEN_CYTTSP5)	+= cyttsp5.o
 obj-$(CONFIG_TOUCHSCREEN_DA9034)	+= da9034-ts.o
 obj-$(CONFIG_TOUCHSCREEN_DA9052)	+= da9052_tsi.o
 obj-$(CONFIG_TOUCHSCREEN_DYNAPRO)	+= dynapro.o
diff --git a/drivers/input/touchscreen/cyttsp5.c b/drivers/input/touchscreen/cyttsp5.c
new file mode 100644
index 000000000000..f059dc41e7ad
--- /dev/null
+++ b/drivers/input/touchscreen/cyttsp5.c
@@ -0,0 +1,1112 @@
+/*
+ * Parade TrueTouch(TM) Standard Product V5 Module.
+ * For use with Parade touchscreen controllers.
+ *
+ * Copyright (C) 2015 Parade Technologies
+ * Copyright (C) 2012-2015 Cypress Semiconductor
+ * Copyright (C) 2017 Free Electrons
+ *
+ * Author: Mylène Josserand <mylene.josserand-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2, and only version 2, as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <asm/unaligned.h>
+#include <linux/crc-itu-t.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/gpio.h>
+#include <linux/input/mt.h>
+#include <linux/input/touchscreen.h>
+#include <linux/interrupt.h>
+#include <linux/i2c.h>
+#include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/regmap.h>
+
+#define CYTTSP5_NAME				"cyttsp5"
+#define CY_I2C_DATA_SIZE			(2 * 256)
+#define HID_VERSION				0x0100
+#define CY_MAX_INPUT				512
+#define CYTTSP5_PREALLOCATED_CMD_BUFFER	32
+#define CY_BITS_PER_BTN			1
+#define CY_NUM_BTN_EVENT_ID			((1 << CY_BITS_PER_BTN) - 1)
+
+#define MAX_AREA				255
+#define HID_OUTPUT_BL_SOP			0x1
+#define HID_OUTPUT_BL_EOP			0x17
+#define HID_OUTPUT_BL_LAUNCH_APP		0x3B
+#define HID_OUTPUT_BL_LAUNCH_APP_SIZE		11
+#define HID_OUTPUT_GET_SYSINFO			0x2
+#define HID_OUTPUT_GET_SYSINFO_SIZE		5
+
+#define HID_DESC_REG				0x1
+#define HID_INPUT_REG				0x3
+#define HID_OUTPUT_REG				0x4
+
+#define REPORT_ID_TOUCH			0x1
+#define REPORT_ID_BTN				0x3
+#define REPORT_SIZE_5				5
+#define REPORT_SIZE_8				8
+#define REPORT_SIZE_16				16
+
+/* Touch reports offsets */
+/* Header offsets */
+#define TOUCH_REPORT_DESC_HDR_CONTACTCOUNT	16
+/* Record offsets */
+#define TOUCH_REPORT_DESC_CONTACTID		8
+#define TOUCH_REPORT_DESC_X			16
+#define TOUCH_REPORT_DESC_Y			32
+#define TOUCH_REPORT_DESC_P			48
+#define TOUCH_REPORT_DESC_MAJ			56
+#define TOUCH_REPORT_DESC_MIN			64
+
+/* HID */
+#define HID_TOUCH_REPORT_ID			0x1
+#define HID_BTN_REPORT_ID			0x3
+#define HID_APP_RESPONSE_REPORT_ID		0x1F
+#define HID_APP_OUTPUT_REPORT_ID		0x2F
+#define HID_BL_RESPONSE_REPORT_ID		0x30
+#define HID_BL_OUTPUT_REPORT_ID		0x40
+
+#define HID_OUTPUT_RESPONSE_REPORT_OFFSET	2
+#define HID_OUTPUT_RESPONSE_CMD_OFFSET		4
+#define HID_OUTPUT_RESPONSE_CMD_MASK		0x7F
+
+#define HID_SYSINFO_SENSING_OFFSET		33
+#define HID_SYSINFO_BTN_OFFSET			48
+#define HID_SYSINFO_BTN_MASK			0xFF
+#define HID_SYSINFO_MAX_BTN			8
+
+/*  Timeout in ms */
+#define CY_HID_OUTPUT_TIMEOUT			200
+#define CY_HID_OUTPUT_GET_SYSINFO_TIMEOUT	3000
+#define CY_HID_GET_HID_DESCRIPTOR_TIMEOUT	4000
+
+/* maximum number of concurrent tracks */
+#define TOUCH_REPORT_SIZE			10
+#define TOUCH_INPUT_HEADER_SIZE		7
+#define BTN_REPORT_SIZE			9
+#define BTN_INPUT_HEADER_SIZE			5
+
+/* All usage pages for Touch Report */
+#define TOUCH_REPORT_USAGE_PG_X		0x00010030
+#define TOUCH_REPORT_USAGE_PG_Y		0x00010031
+#define TOUCH_REPORT_USAGE_PG_P		0x000D0030
+#define TOUCH_REPORT_USAGE_PG_CONTACTID	0x000D0051
+#define TOUCH_REPORT_USAGE_PG_CONTACTCOUNT	0x000D0054
+#define TOUCH_REPORT_USAGE_PG_MAJ		0xFF010062
+#define TOUCH_REPORT_USAGE_PG_MIN		0xFF010063
+#define TOUCH_COL_USAGE_PG			0x000D0022
+
+/* helpers */
+#define HI_BYTE(x)				(u8)(((x) >> 8) & 0xFF)
+#define LOW_BYTE(x)				(u8)((x) & 0xFF)
+
+/* System Information interface definitions */
+struct cyttsp5_sensing_conf_data_dev {
+	u8 electrodes_x;
+	u8 electrodes_y;
+	__le16 len_x;
+	__le16 len_y;
+	__le16 res_x;
+	__le16 res_y;
+	__le16 max_z;
+	u8 origin_x;
+	u8 origin_y;
+	u8 btn;
+	u8 scan_mode;
+	u8 max_num_of_tch_per_refresh_cycle;
+} __packed;
+
+struct cyttsp5_sensing_conf_data {
+	u16 res_x;
+	u16 res_y;
+	u16 max_z;
+	u16 len_x;
+	u16 len_y;
+	u8 origin_x;
+	u8 origin_y;
+	u8 max_tch;
+};
+
+enum hid_cmd_state {
+	HID_CMD_DONE,
+	HID_CMD_BUSY,
+};
+
+enum cyttsp5_tch_abs {	/* for ordering within the extracted touch data array */
+	CY_TCH_X,	/* X */
+	CY_TCH_Y,	/* Y */
+	CY_TCH_P,	/* P (Z) */
+	CY_TCH_T,	/* TOUCH ID */
+	CY_TCH_MAJ,	/* TOUCH_MAJOR */
+	CY_TCH_MIN,	/* TOUCH_MINOR */
+	CY_TCH_NUM_ABS,
+};
+
+struct cyttsp5_tch_abs_params {
+	size_t ofs;	/* abs byte offset */
+	size_t size;	/* size in bits */
+	size_t min;	/* min value */
+	size_t max;	/* max value */
+	size_t bofs;	/* bit offset */
+};
+
+struct cyttsp5_touch {
+	int hdr;
+	int abs[CY_TCH_NUM_ABS];
+};
+
+struct cyttsp5_sysinfo {
+	struct cyttsp5_sensing_conf_data sensing_conf_data;
+	int num_btns;
+	struct cyttsp5_tch_abs_params tch_hdr;
+	struct cyttsp5_tch_abs_params tch_abs[CY_TCH_NUM_ABS];
+	u32 key_code[HID_SYSINFO_MAX_BTN];
+	u8 *xy_mode;
+	u8 *xy_data;
+};
+
+struct cyttsp5_hid_desc {
+	__le16 hid_desc_len;
+	u8 packet_id;
+	u8 reserved_byte;
+	__le16 bcd_version;
+	__le16 report_desc_len;
+	__le16 report_desc_register;
+	__le16 input_register;
+	__le16 max_input_len;
+	__le16 output_register;
+	__le16 max_output_len;
+	__le16 command_register;
+	__le16 data_register;
+	__le16 vendor_id;
+	__le16 product_id;
+	__le16 version_id;
+	u8 reserved[4];
+} __packed;
+
+struct cyttsp5 {
+	struct device *dev;
+	struct mutex system_lock;
+	wait_queue_head_t wait_q;
+	struct cyttsp5_sysinfo sysinfo;
+	int hid_cmd_state;
+	struct cyttsp5_hid_desc hid_desc;
+	u8 cmd_buf[CYTTSP5_PREALLOCATED_CMD_BUFFER];
+	u8 input_buf[CY_MAX_INPUT];
+	u8 response_buf[CY_MAX_INPUT];
+	struct gpio_desc *reset_gpio;
+	struct input_dev *input;
+	char phys[NAME_MAX];
+	int num_prv_rec;
+	struct regmap *regmap;
+};
+
+/*
+ * For what understood in the datasheet, the register does not
+ * matter. For consistency, used the Input Register address
+ * but it does mean anything to the device. The important data
+ * to send is the I2C address
+ */
+static int cyttsp5_read(struct cyttsp5 *ts, u8 *buf, u32 max)
+{
+	int rc;
+	u32 size;
+	u8 temp[2];
+
+	if (!buf)
+		return -EINVAL;
+
+	/* Read the frame to retrieve the size */
+	rc = regmap_bulk_read(ts->regmap, HID_INPUT_REG, temp, 2);
+	if (rc < 0)
+		return rc;
+
+	size = get_unaligned_le16(temp);
+	if (!size || size == 2)
+		return 0;
+
+	if (size > max)
+		return -EINVAL;
+
+	/* Get the real value */
+	return regmap_bulk_read(ts->regmap, HID_INPUT_REG, buf, size);
+}
+
+static int cyttsp5_write(struct cyttsp5 *ts, unsigned int reg, u8 *data,
+			 size_t size)
+{
+	u8 cmd[size + 1];
+
+	/* High bytes of register address needed as first byte of cmd */
+	cmd[0] = HI_BYTE(reg);
+
+	/* Copy the rest of the data */
+	if (data)
+		memcpy(&cmd[1], data, size);
+
+	/* The hardware wants to receive a frame with the address register
+	 * contains in the first two bytes. As the regmap_write function
+	 * add the register adresse in the frame, we use the LOW_BYTE as
+	 * first frame byte for the address register and the first
+	 * data byte is the high register + left of the cmd to send
+	 */
+	return regmap_bulk_write(ts->regmap, LOW_BYTE(reg), cmd, size + 1);
+}
+
+static void cyttsp5_final_sync(struct input_dev *input, int max_slots,
+			       unsigned long *ids)
+{
+	int t;
+
+	for (t = 0; t < max_slots; t++) {
+		if (test_bit(t, ids))
+			continue;
+		input_mt_slot(input, t);
+		input_mt_report_slot_state(input, MT_TOOL_FINGER, false);
+	}
+
+	input_sync(input);
+}
+
+static void cyttsp5_report_slot_liftoff(struct cyttsp5 *ts, int max_slots)
+{
+	int t;
+
+	if (ts->num_prv_rec == 0)
+		return;
+
+	for (t = 0; t < max_slots; t++) {
+		input_mt_slot(ts->input, t);
+		input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, false);
+	}
+}
+
+static void cyttsp5_mt_lift_all(struct cyttsp5 *ts)
+{
+	struct cyttsp5_sysinfo *si = &ts->sysinfo;
+	int max = si->tch_abs[CY_TCH_T].max;
+
+	if (ts->num_prv_rec != 0) {
+		cyttsp5_report_slot_liftoff(ts, max);
+		input_sync(ts->input);
+		ts->num_prv_rec = 0;
+	}
+}
+
+static void cyttsp5_get_touch_axis(int *axis, int size, int max, u8 *xy_data,
+				   int bofs)
+{
+	int nbyte;
+	int next;
+
+	for (nbyte = 0, *axis = 0, next = 0; nbyte < size; nbyte++)
+		*axis = *axis + ((xy_data[nbyte] >> bofs) << (nbyte * 8));
+
+	*axis &= max - 1;
+}
+
+static void cyttsp5_get_touch_record(struct cyttsp5 *ts,
+				     struct cyttsp5_touch *touch, u8 *xy_data)
+{
+	struct cyttsp5_sysinfo *si = &ts->sysinfo;
+	enum cyttsp5_tch_abs abs;
+
+	for (abs = CY_TCH_X; abs < CY_TCH_NUM_ABS; abs++) {
+		cyttsp5_get_touch_axis(&touch->abs[abs],
+				       si->tch_abs[abs].size,
+				       si->tch_abs[abs].max,
+				       xy_data + si->tch_abs[abs].ofs,
+				       si->tch_abs[abs].bofs);
+	}
+}
+
+static void cyttsp5_get_mt_touches(struct cyttsp5 *ts,
+				   struct cyttsp5_touch *tch, int num_cur_tch)
+{
+	struct cyttsp5_sysinfo *si = &ts->sysinfo;
+	int i, t = 0;
+	DECLARE_BITMAP(ids, si->tch_abs[CY_TCH_T].max);
+	u8 *tch_addr;
+	int tmp;
+
+	bitmap_zero(ids, si->tch_abs[CY_TCH_T].max);
+	memset(tch->abs, 0, sizeof(tch->abs));
+
+	for (i = 0; i < num_cur_tch; i++) {
+		tch_addr = si->xy_data + (i * TOUCH_REPORT_SIZE);
+		cyttsp5_get_touch_record(ts, tch, tch_addr);
+
+		/* Convert MAJOR/MINOR from mm to resolution */
+		tmp = tch->abs[CY_TCH_MAJ] * 100 * si->sensing_conf_data.res_x;
+		tch->abs[CY_TCH_MAJ] = tmp / si->sensing_conf_data.len_x;
+		tmp = tch->abs[CY_TCH_MIN] * 100 * si->sensing_conf_data.res_x;
+		tch->abs[CY_TCH_MIN] = tmp / si->sensing_conf_data.len_x;
+
+		t = tch->abs[CY_TCH_T];
+		input_mt_slot(ts->input, t);
+		input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, true);
+		__set_bit(t, ids);
+
+		/* position and pressure fields */
+		input_report_abs(ts->input, ABS_MT_POSITION_X,
+				 tch->abs[CY_TCH_X]);
+		input_report_abs(ts->input, ABS_MT_POSITION_Y,
+				 tch->abs[CY_TCH_Y]);
+		input_report_abs(ts->input, ABS_MT_PRESSURE,
+				 tch->abs[CY_TCH_P]);
+
+		/* Get the extended touch fields */
+		input_report_abs(ts->input, ABS_MT_TOUCH_MAJOR,
+				 tch->abs[CY_TCH_MAJ]);
+		input_report_abs(ts->input, ABS_MT_TOUCH_MINOR,
+				 tch->abs[CY_TCH_MIN]);
+	}
+
+	cyttsp5_final_sync(ts->input, si->tch_abs[CY_TCH_T].max, ids);
+
+	ts->num_prv_rec = num_cur_tch;
+}
+
+/* read xy_data for all current touches */
+static int cyttsp5_xy_worker(struct cyttsp5 *ts)
+{
+	struct device *dev = ts->dev;
+	struct cyttsp5_sysinfo *si = &ts->sysinfo;
+	int max_tch = si->sensing_conf_data.max_tch;
+	struct cyttsp5_touch tch;
+	u8 num_cur_tch;
+
+	cyttsp5_get_touch_axis(&tch.hdr, si->tch_hdr.size,
+			       si->tch_hdr.max,
+			       si->xy_mode + 3 + si->tch_hdr.ofs,
+			       si->tch_hdr.bofs);
+
+	num_cur_tch = tch.hdr;
+	if (num_cur_tch > max_tch) {
+		dev_err(dev, "Num touch err detected (n=%d)\n", num_cur_tch);
+		num_cur_tch = max_tch;
+	}
+
+	if (num_cur_tch == 0 && ts->num_prv_rec == 0)
+		return 0;
+
+	/* extract xy_data for all currently reported touches */
+	if (num_cur_tch)
+		cyttsp5_get_mt_touches(ts, &tch, num_cur_tch);
+	else
+		cyttsp5_mt_lift_all(ts);
+
+	return 0;
+}
+
+static int cyttsp5_mt_attention(struct device *dev)
+{
+	struct cyttsp5 *ts = dev_get_drvdata(dev);
+	struct cyttsp5_sysinfo *si = &ts->sysinfo;
+	int rc;
+
+	if (si->xy_mode[2] != HID_TOUCH_REPORT_ID)
+		return 0;
+
+	/* core handles handshake */
+	rc = cyttsp5_xy_worker(ts);
+	if (rc < 0)
+		dev_err(dev, "xy_worker error r=%d\n", rc);
+
+	return rc;
+}
+
+static int cyttsp5_setup_input_device(struct device *dev)
+{
+	struct cyttsp5 *ts = dev_get_drvdata(dev);
+	struct cyttsp5_sysinfo *si = &ts->sysinfo;
+	int max_x, max_y, max_p;
+	int max_x_tmp, max_y_tmp;
+	int rc;
+
+	__set_bit(EV_ABS, ts->input->evbit);
+	__set_bit(EV_REL, ts->input->evbit);
+	__set_bit(EV_KEY, ts->input->evbit);
+
+	max_x_tmp = si->sensing_conf_data.res_x;
+	max_y_tmp = si->sensing_conf_data.res_y;
+	max_x = max_y_tmp - 1;
+	max_y = max_x_tmp - 1;
+	max_p = si->sensing_conf_data.max_z;
+
+	input_mt_init_slots(ts->input, si->tch_abs[CY_TCH_T].max, 0);
+
+	__set_bit(ABS_MT_POSITION_X, ts->input->absbit);
+	__set_bit(ABS_MT_POSITION_Y, ts->input->absbit);
+	__set_bit(ABS_MT_PRESSURE, ts->input->absbit);
+
+	input_set_abs_params(ts->input, ABS_MT_POSITION_X, 0, max_x, 0, 0);
+	input_set_abs_params(ts->input, ABS_MT_POSITION_Y, 0, max_y, 0, 0);
+	input_set_abs_params(ts->input, ABS_MT_PRESSURE, 0, max_p, 0, 0);
+
+	input_set_abs_params(ts->input, ABS_MT_TOUCH_MAJOR, 0, MAX_AREA, 0, 0);
+	input_set_abs_params(ts->input, ABS_MT_TOUCH_MINOR, 0, MAX_AREA, 0, 0);
+
+	rc = input_register_device(ts->input);
+	if (rc < 0)
+		dev_err(dev, "Error, failed register input device r=%d\n", rc);
+
+	return rc;
+}
+
+#ifdef CONFIG_OF
+static int cyttsp5_parse_dt_key_code(struct device *dev)
+{
+	struct cyttsp5 *ts = dev_get_drvdata(dev);
+	struct cyttsp5_sysinfo *si = &ts->sysinfo;
+	struct device_node *np;
+	int i;
+
+	np = dev->of_node;
+	if (!np)
+		return -EINVAL;
+
+	if (!si->num_btns)
+		return 0;
+
+	/* Initialize the button to RESERVED */
+	for (i = 0; i < si->num_btns; i++)
+		si->key_code[i] = KEY_RESERVED;
+
+	return of_property_read_u32_array(np, "linux,keycodes",
+				   si->key_code, si->num_btns);
+}
+#else
+static int cyttsp5_parse_dt_key_code(struct device *dev)
+{
+	struct cyttsp5 *ts = dev_get_drvdata(dev);
+	struct cyttsp5_sysinfo *si = &ts->sysinfo;
+	int i;
+
+	if (!si->num_btns)
+		return 0;
+
+	/* Initialize the button to RESERVED */
+	for (i = 0; i < si->num_btns; i++)
+		si->key_code[i] = KEY_RESERVED;
+
+	return 0;
+}
+#endif
+
+static int cyttsp5_btn_attention(struct device *dev)
+{
+	struct cyttsp5 *ts = dev_get_drvdata(dev);
+	struct cyttsp5_sysinfo *si = &ts->sysinfo;
+	int cur_btn;
+	int cur_btn_state;
+
+	if (si->xy_mode[2] != HID_BTN_REPORT_ID || !si->num_btns)
+		return 0;
+
+	/* extract button press/release touch information */
+	for (cur_btn = 0; cur_btn < si->num_btns; cur_btn++) {
+		/* Get current button state */
+		cur_btn_state = (si->xy_data[0] >> (cur_btn * CY_BITS_PER_BTN))
+			& CY_NUM_BTN_EVENT_ID;
+
+		input_report_key(ts->input, si->key_code[cur_btn],
+				 cur_btn_state);
+		input_sync(ts->input);
+	}
+
+	return 0;
+}
+
+static u16 cyttsp5_compute_crc(u8 *buf, u32 size)
+{
+	u16 remainder = 0xFFFF;
+	u16 xor_mask = 0x0000;
+	u32 index;
+	u32 byte_value;
+	u32 table_index;
+	u32 crc_bit_width = sizeof(u16) * 8;
+
+	/* Divide the message by polynomial, via the table. */
+	for (index = 0; index < size; index++) {
+		byte_value = buf[index];
+		table_index = ((byte_value >> 4) & 0x0F)
+			^ (remainder >> (crc_bit_width - 4));
+		remainder = crc_itu_t_table[table_index]
+			^ (remainder << 4);
+		table_index = (byte_value & 0x0F)
+			^ (remainder >> (crc_bit_width - 4));
+		remainder = crc_itu_t_table[table_index]
+			^ (remainder << 4);
+	}
+
+	/* Perform the final remainder CRC. */
+	return remainder ^ xor_mask;
+}
+
+static int cyttsp5_validate_cmd_response(struct cyttsp5 *ts, u8 code)
+{
+	u16 size, crc;
+	u8 status, offset;
+	int command_code;
+
+	size = get_unaligned_le16(&ts->response_buf[0]);
+
+	if (!size)
+		return 0;
+
+	offset = ts->response_buf[HID_OUTPUT_RESPONSE_REPORT_OFFSET];
+
+	if (offset == HID_BL_RESPONSE_REPORT_ID) {
+		if (ts->response_buf[4] != HID_OUTPUT_BL_SOP) {
+			dev_err(ts->dev, "HID output response, wrong SOP\n");
+			return -EPROTO;
+		}
+
+		if (ts->response_buf[size - 1] != HID_OUTPUT_BL_EOP) {
+			dev_err(ts->dev, "HID output response, wrong EOP\n");
+			return -EPROTO;
+		}
+
+		crc = cyttsp5_compute_crc(&ts->response_buf[4], size - 7);
+		if (ts->response_buf[size - 3] != LOW_BYTE(crc) ||
+		    ts->response_buf[size - 2] != HI_BYTE(crc)) {
+			dev_err(ts->dev, "HID output response, wrong CRC 0x%X\n",
+				crc);
+			return -EPROTO;
+		}
+
+		status = ts->response_buf[5];
+		if (status) {
+			dev_err(ts->dev, "HID output response, ERROR:%d\n",
+				status);
+			return -EPROTO;
+		}
+	}
+
+	if (offset == HID_APP_RESPONSE_REPORT_ID) {
+		command_code = ts->response_buf[HID_OUTPUT_RESPONSE_CMD_OFFSET]
+			& HID_OUTPUT_RESPONSE_CMD_MASK;
+		if (command_code != code) {
+			dev_err(ts->dev,
+				"HID output response, wrong command_code:%X\n",
+				command_code);
+			return -EPROTO;
+		}
+	}
+
+	return 0;
+}
+
+static void cyttsp5_si_get_btn_data(struct cyttsp5 *ts)
+{
+	struct cyttsp5_sysinfo *si = &ts->sysinfo;
+	int i;
+	unsigned int btns = ts->response_buf[HID_SYSINFO_BTN_OFFSET]
+		& HID_SYSINFO_BTN_MASK;
+
+	si->num_btns = 0;
+	for (i = 0; i < HID_SYSINFO_MAX_BTN; i++) {
+		if (btns & BIT(i))
+			si->num_btns++;
+	}
+}
+
+static int cyttsp5_get_sysinfo_regs(struct cyttsp5 *ts)
+{
+	struct cyttsp5_sensing_conf_data *scd = &ts->sysinfo.sensing_conf_data;
+	struct cyttsp5_sensing_conf_data_dev *scd_dev =
+		(struct cyttsp5_sensing_conf_data_dev *)
+		&ts->response_buf[HID_SYSINFO_SENSING_OFFSET];
+	struct cyttsp5_sysinfo *si = &ts->sysinfo;
+
+	cyttsp5_si_get_btn_data(ts);
+
+	scd->max_tch = scd_dev->max_num_of_tch_per_refresh_cycle;
+	scd->res_x = get_unaligned_le16(&scd_dev->res_x);
+	scd->res_y = get_unaligned_le16(&scd_dev->res_y);
+	scd->max_z = get_unaligned_le16(&scd_dev->max_z);
+	scd->len_x = get_unaligned_le16(&scd_dev->len_x);
+	scd->len_y = get_unaligned_le16(&scd_dev->len_y);
+
+	si->xy_data = devm_kzalloc(ts->dev, scd->max_tch * TOUCH_REPORT_SIZE,
+				   GFP_KERNEL);
+	if (!si->xy_data)
+		return -ENOMEM;
+
+	si->xy_mode = devm_kzalloc(ts->dev, TOUCH_INPUT_HEADER_SIZE,
+				   GFP_KERNEL);
+	if (!si->xy_mode)
+		return -ENOMEM;
+
+	return 0;
+}
+
+static int cyttsp5_hid_output_get_sysinfo(struct cyttsp5 *ts)
+{
+	int rc;
+	u8 cmd[HID_OUTPUT_GET_SYSINFO_SIZE];
+
+	ts->hid_cmd_state = HID_CMD_BUSY;
+
+	/* HI bytes of Output register address */
+	cmd[0] = LOW_BYTE(HID_OUTPUT_GET_SYSINFO_SIZE);
+	cmd[1] = HI_BYTE(HID_OUTPUT_GET_SYSINFO_SIZE);
+	cmd[2] = HID_APP_OUTPUT_REPORT_ID;
+	cmd[3] = 0x0; /* Reserved */
+	cmd[4] = HID_OUTPUT_GET_SYSINFO;
+
+	rc = cyttsp5_write(ts, HID_OUTPUT_REG, cmd,
+			   HID_OUTPUT_GET_SYSINFO_SIZE);
+	if (rc) {
+		dev_err(ts->dev, "Failed to write command %d", rc);
+		goto error;
+	}
+
+	rc = wait_event_timeout(ts->wait_q, (ts->hid_cmd_state == HID_CMD_DONE),
+				msecs_to_jiffies(CY_HID_OUTPUT_GET_SYSINFO_TIMEOUT));
+	if (!rc) {
+		dev_err(ts->dev, "HID output cmd execution timed out\n");
+		rc = -ETIME;
+		goto error;
+	}
+
+	rc = cyttsp5_validate_cmd_response(ts, HID_OUTPUT_GET_SYSINFO);
+	if (rc) {
+		dev_err(ts->dev, "Validation of the response failed\n");
+		goto error;
+	}
+
+	return cyttsp5_get_sysinfo_regs(ts);
+
+error:
+	mutex_lock(&ts->system_lock);
+	ts->hid_cmd_state = HID_CMD_DONE;
+	mutex_unlock(&ts->system_lock);
+	return rc;
+}
+
+static int cyttsp5_hid_output_bl_launch_app(struct cyttsp5 *ts)
+{
+	int rc;
+	u8 cmd[HID_OUTPUT_BL_LAUNCH_APP];
+	u16 crc;
+
+	mutex_lock(&ts->system_lock);
+	ts->hid_cmd_state = HID_CMD_BUSY;
+	mutex_unlock(&ts->system_lock);
+
+	cmd[0] = LOW_BYTE(HID_OUTPUT_BL_LAUNCH_APP_SIZE);
+	cmd[1] = HI_BYTE(HID_OUTPUT_BL_LAUNCH_APP_SIZE);
+	cmd[2] = HID_BL_OUTPUT_REPORT_ID;
+	cmd[3] = 0x0; /* Reserved */
+	cmd[4] = HID_OUTPUT_BL_SOP;
+	cmd[5] = HID_OUTPUT_BL_LAUNCH_APP;
+	cmd[6] = 0x0; /* Low bytes of data */
+	cmd[7] = 0x0; /* Hi bytes of data */
+	crc = cyttsp5_compute_crc(&cmd[4], 4);
+	cmd[8] = LOW_BYTE(crc);
+	cmd[9] = HI_BYTE(crc);
+	cmd[10] = HID_OUTPUT_BL_EOP;
+
+	rc = cyttsp5_write(ts, HID_OUTPUT_REG, cmd,
+			   HID_OUTPUT_BL_LAUNCH_APP_SIZE);
+	if (rc) {
+		dev_err(ts->dev, "Failed to write command %d", rc);
+		goto error;
+	}
+
+	rc = wait_event_timeout(ts->wait_q, (ts->hid_cmd_state == HID_CMD_DONE),
+				msecs_to_jiffies(CY_HID_OUTPUT_TIMEOUT));
+	if (!rc) {
+		dev_err(ts->dev, "HID output cmd execution timed out\n");
+		rc = -ETIME;
+		goto error;
+	}
+
+	rc = cyttsp5_validate_cmd_response(ts, HID_OUTPUT_BL_LAUNCH_APP);
+	if (rc) {
+		dev_err(ts->dev, "Validation of the response failed\n");
+		goto error;
+	}
+
+	return rc;
+
+error:
+	mutex_lock(&ts->system_lock);
+	ts->hid_cmd_state = HID_CMD_DONE;
+	mutex_unlock(&ts->system_lock);
+
+	return rc;
+}
+
+static int cyttsp5_get_hid_descriptor(struct cyttsp5 *ts,
+				      struct cyttsp5_hid_desc *desc)
+{
+	struct device *dev = ts->dev;
+	__le16 hid_desc_register = HID_DESC_REG;
+	int rc;
+	u8 cmd[2];
+
+	/* Read HID descriptor length and version */
+	mutex_lock(&ts->system_lock);
+	ts->hid_cmd_state = HID_CMD_BUSY;
+	mutex_unlock(&ts->system_lock);
+
+	/* Set HID descriptor register */
+	memcpy(cmd, &hid_desc_register, sizeof(hid_desc_register));
+
+	rc = cyttsp5_write(ts, HID_DESC_REG, NULL, 0);
+	if (rc < 0) {
+		dev_err(dev, "Failed to get HID descriptor, rc=%d\n", rc);
+		goto error;
+	}
+
+	rc = wait_event_timeout(ts->wait_q, (ts->hid_cmd_state == HID_CMD_DONE),
+				msecs_to_jiffies(CY_HID_GET_HID_DESCRIPTOR_TIMEOUT));
+	if (!rc) {
+		dev_err(ts->dev, "HID get descriptor timed out\n");
+		rc = -ETIME;
+		goto error;
+	}
+
+	memcpy(desc, ts->response_buf, sizeof(struct cyttsp5_hid_desc));
+
+	/* Check HID descriptor length and version */
+	if (le16_to_cpu(desc->hid_desc_len) != sizeof(*desc) ||
+	    le16_to_cpu(desc->bcd_version) != HID_VERSION) {
+		dev_err(dev, "Unsupported HID version\n");
+		return -ENODEV;
+	}
+
+	goto exit;
+
+error:
+	mutex_lock(&ts->system_lock);
+	ts->hid_cmd_state = HID_CMD_DONE;
+	mutex_unlock(&ts->system_lock);
+exit:
+	return rc;
+}
+
+static int fill_tch_abs(struct cyttsp5_tch_abs_params *tch_abs, int report_size,
+			int offset)
+{
+	tch_abs->ofs = offset / 8;
+	tch_abs->size = report_size / 8;
+	if (report_size % 8)
+		tch_abs->size += 1;
+	tch_abs->min = 0;
+	tch_abs->max = 1 << report_size;
+	tch_abs->bofs = offset - (tch_abs->ofs << 3);
+
+	return 0;
+}
+
+static int move_button_data(struct cyttsp5 *ts, struct cyttsp5_sysinfo *si)
+{
+	memcpy(si->xy_mode, ts->input_buf, BTN_INPUT_HEADER_SIZE);
+	memcpy(si->xy_data, &ts->input_buf[BTN_INPUT_HEADER_SIZE],
+	       BTN_REPORT_SIZE);
+
+	return 0;
+}
+
+static int move_touch_data(struct cyttsp5 *ts, struct cyttsp5_sysinfo *si)
+{
+	int max_tch = si->sensing_conf_data.max_tch;
+	int num_cur_tch;
+	int length;
+	struct cyttsp5_tch_abs_params *tch = &si->tch_hdr;
+
+	memcpy(si->xy_mode, ts->input_buf, TOUCH_INPUT_HEADER_SIZE);
+
+	cyttsp5_get_touch_axis(&num_cur_tch, tch->size,
+			       tch->max, si->xy_mode + 3 + tch->ofs, tch->bofs);
+	if (unlikely(num_cur_tch > max_tch))
+		num_cur_tch = max_tch;
+
+	length = num_cur_tch * TOUCH_REPORT_SIZE;
+
+	memcpy(si->xy_data, &ts->input_buf[TOUCH_INPUT_HEADER_SIZE], length);
+
+	return 0;
+}
+
+static irqreturn_t cyttsp5_handle_irq(int irq, void *handle)
+{
+	struct cyttsp5 *ts = handle;
+	int report_id;
+	int size;
+	int rc;
+
+	rc = cyttsp5_read(ts, ts->input_buf, CY_MAX_INPUT);
+	if (rc)
+		return IRQ_HANDLED;
+
+	size = get_unaligned_le16(&ts->input_buf[0]);
+
+	/* check reset */
+	if (size == 0) {
+		memcpy(ts->response_buf, ts->input_buf, 2);
+
+		mutex_lock(&ts->system_lock);
+		ts->hid_cmd_state = HID_CMD_DONE;
+		mutex_unlock(&ts->system_lock);
+		wake_up(&ts->wait_q);
+		return IRQ_HANDLED;
+	}
+
+	report_id = ts->input_buf[2];
+
+	if (report_id == HID_TOUCH_REPORT_ID) {
+		move_touch_data(ts, &ts->sysinfo);
+		cyttsp5_mt_attention(ts->dev);
+	} else if (report_id == HID_BTN_REPORT_ID) {
+		move_button_data(ts, &ts->sysinfo);
+		cyttsp5_btn_attention(ts->dev);
+	} else {
+		/* It is not an input but a command response */
+		memcpy(ts->response_buf, ts->input_buf, size);
+
+		mutex_lock(&ts->system_lock);
+		ts->hid_cmd_state = HID_CMD_DONE;
+		mutex_unlock(&ts->system_lock);
+		wake_up(&ts->wait_q);
+	}
+
+	return IRQ_HANDLED;
+}
+
+static int cyttsp5_deassert_int(struct cyttsp5 *ts)
+{
+	u16 size;
+	u8 buf[2];
+	int rc;
+
+	rc = regmap_bulk_read(ts->regmap, HID_INPUT_REG, buf, 2);
+	if (rc < 0)
+		return rc;
+
+	size = get_unaligned_le16(&buf[0]);
+	if (size == 2 || size == 0)
+		return 0;
+
+	return -EINVAL;
+}
+
+static int cyttsp5_fill_all_touch(struct cyttsp5 *ts)
+{
+	struct cyttsp5_sysinfo *si = &ts->sysinfo;
+
+	fill_tch_abs(&si->tch_abs[CY_TCH_X], REPORT_SIZE_16,
+		     TOUCH_REPORT_DESC_X);
+	fill_tch_abs(&si->tch_abs[CY_TCH_Y], REPORT_SIZE_16,
+		     TOUCH_REPORT_DESC_Y);
+	fill_tch_abs(&si->tch_abs[CY_TCH_P], REPORT_SIZE_8,
+		     TOUCH_REPORT_DESC_P);
+	fill_tch_abs(&si->tch_abs[CY_TCH_T], REPORT_SIZE_5,
+		     TOUCH_REPORT_DESC_CONTACTID);
+	fill_tch_abs(&si->tch_hdr, REPORT_SIZE_5,
+		     TOUCH_REPORT_DESC_HDR_CONTACTCOUNT);
+	fill_tch_abs(&si->tch_abs[CY_TCH_MAJ], REPORT_SIZE_8,
+		     TOUCH_REPORT_DESC_MAJ);
+	fill_tch_abs(&si->tch_abs[CY_TCH_MIN], REPORT_SIZE_8,
+		     TOUCH_REPORT_DESC_MIN);
+
+	return 0;
+}
+
+static int cyttsp5_startup(struct cyttsp5 *ts)
+{
+	int rc;
+
+	rc = cyttsp5_deassert_int(ts);
+	if (rc) {
+		dev_err(ts->dev, "Error on deassert int r=%d\n", rc);
+		return -ENODEV;
+	}
+
+	/*
+	 * Launch the application as the device starts in bootloader mode
+	 * because of a power-on-reset
+	 */
+	rc = cyttsp5_hid_output_bl_launch_app(ts);
+	if (rc < 0) {
+		dev_err(ts->dev, "Error on launch app r=%d\n", rc);
+		return rc;
+	}
+
+	rc = cyttsp5_get_hid_descriptor(ts, &ts->hid_desc);
+	if (rc < 0) {
+		dev_err(ts->dev, "Error on getting HID descriptor r=%d\n", rc);
+		return rc;
+	}
+
+	rc = cyttsp5_fill_all_touch(ts);
+	if (rc < 0) {
+		dev_err(ts->dev, "Error on report descriptor r=%d\n", rc);
+		return rc;
+	}
+
+	rc = cyttsp5_hid_output_get_sysinfo(ts);
+	if (rc) {
+		dev_err(ts->dev, "Error on getting sysinfo r=%d\n", rc);
+		return rc;
+	}
+
+	return rc;
+}
+
+#ifdef CONFIG_OF
+static const struct of_device_id cyttsp5_of_match[] = {
+	{ .compatible = "cypress,cyttsp5", },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, cyttsp5_of_match);
+#endif
+
+static const struct i2c_device_id cyttsp5_i2c_id[] = {
+	{ CYTTSP5_NAME, 0, },
+	{ }
+};
+MODULE_DEVICE_TABLE(i2c, cyttsp5_i2c_id);
+
+static int cyttsp5_probe(struct device *dev, struct regmap *regmap, int irq,
+			 const char *name)
+{
+	struct cyttsp5 *ts;
+	struct cyttsp5_sysinfo *si;
+	int rc = 0, i;
+
+	ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL);
+	if (!ts)
+		return -ENOMEM;
+
+	/* Initialize device info */
+	ts->regmap = regmap;
+	ts->dev = dev;
+	si = &ts->sysinfo;
+	dev_set_drvdata(dev, ts);
+
+	/* Initialize mutexes and spinlocks */
+	mutex_init(&ts->system_lock);
+
+	/* Initialize wait queue */
+	init_waitqueue_head(&ts->wait_q);
+
+	/* Reset the gpio to be in a reset state */
+	ts->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
+	if (IS_ERR(ts->reset_gpio)) {
+		rc = PTR_ERR(ts->reset_gpio);
+		dev_err(dev, "Failed to request reset gpio, error %d\n", rc);
+		return rc;
+	}
+	gpiod_set_value(ts->reset_gpio, 1);
+
+	/* Need a delay to have device up */
+	msleep(20);
+
+	rc = devm_request_threaded_irq(dev, irq, NULL, cyttsp5_handle_irq,
+				       IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+				       name, ts);
+	if (rc) {
+		dev_err(dev, "unable to request IRQ\n");
+		return rc;
+	}
+
+	rc = cyttsp5_startup(ts);
+	if (rc) {
+		dev_err(ts->dev, "Fail initial startup r=%d\n", rc);
+		return rc;
+	}
+
+	rc = cyttsp5_parse_dt_key_code(dev);
+	if (rc < 0) {
+		dev_err(ts->dev, "Error while parsing dts %d\n", rc);
+		return rc;
+	}
+
+	ts->input = devm_input_allocate_device(dev);
+	if (!ts->input) {
+		dev_err(dev, "Error, failed to allocate input device\n");
+		return -ENODEV;
+	}
+
+	ts->input->name = "cyttsp5";
+	scnprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(dev));
+	ts->input->phys = ts->phys;
+	ts->input->dev.parent = ts->dev;
+	input_set_drvdata(ts->input, ts);
+
+	touchscreen_parse_properties(ts->input, true, NULL);
+
+	__set_bit(EV_KEY, ts->input->evbit);
+	for (i = 0; i < si->num_btns; i++)
+		__set_bit(si->key_code[i], ts->input->keybit);
+
+	return cyttsp5_setup_input_device(dev);
+}
+
+static int cyttsp5_i2c_probe(struct i2c_client *client,
+			     const struct i2c_device_id *id)
+{
+	struct regmap *regmap;
+	static const struct regmap_config config = {
+		.reg_bits = 8,
+		.val_bits = 8,
+	};
+
+	regmap = devm_regmap_init_i2c(client, &config);
+	if (IS_ERR(regmap)) {
+		dev_err(&client->dev, "regmap allocation failed: %ld\n",
+			PTR_ERR(regmap));
+		return PTR_ERR(regmap);
+	}
+
+	return cyttsp5_probe(&client->dev, regmap, client->irq, client->name);
+}
+
+static int cyttsp5_remove(struct device *dev)
+{
+	struct cyttsp5 *ts = dev_get_drvdata(dev);
+
+	input_unregister_device(ts->input);
+
+	return 0;
+}
+
+static int cyttsp5_i2c_remove(struct i2c_client *client)
+{
+	struct device *dev = &client->dev;
+
+	return cyttsp5_remove(dev);
+}
+
+static struct i2c_driver cyttsp5_i2c_driver = {
+	.driver = {
+		.name = CYTTSP5_NAME,
+		.of_match_table = of_match_ptr(cyttsp5_of_match),
+	},
+	.probe = cyttsp5_i2c_probe,
+	.remove = cyttsp5_i2c_remove,
+	.id_table = cyttsp5_i2c_id,
+};
+
+module_i2c_driver(cyttsp5_i2c_driver);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Touchscreen driver for Cypress TrueTouch Gen 5 Product");
+MODULE_AUTHOR("Mylène Josserand <mylene.josserand-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>");
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH v5 2/2] dt-bindings: input: Add documentation for cyttsp5
From: Mylène Josserand @ 2017-12-20 10:08 UTC (permalink / raw)
  To: dmitry.torokhov, robh+dt, mark.rutland
  Cc: mylene.josserand, thomas.petazzoni, maxime.ripard, linux-kernel,
	linux-input, devicetree
In-Reply-To: <20171220100843.2759-1-mylene.josserand@free-electrons.com>

Add the Cypress TrueTouch Generation 5 touchscreen device tree bindings
documentation. It can use I2C or SPI bus.
This touchscreen can handle some defined zone that are designed and
sent as button. To be able to customize the keycode sent, the
"linux,keycodes" property can be used.

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mylène Josserand <mylene.josserand@free-electrons.com>
---
 .../bindings/input/touchscreen/cypress,cyttsp5.txt | 39 ++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/cypress,cyttsp5.txt

diff --git a/Documentation/devicetree/bindings/input/touchscreen/cypress,cyttsp5.txt b/Documentation/devicetree/bindings/input/touchscreen/cypress,cyttsp5.txt
new file mode 100644
index 000000000000..1e0e90e322c7
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/touchscreen/cypress,cyttsp5.txt
@@ -0,0 +1,39 @@
+* Cypress cyttsp touchscreen controller, generation 5
+
+Required properties:
+ - compatible		: must be "cypress,cyttsp5"
+ - reg			: Device I2C address or SPI chip select number
+ - interrupt-parent	: the phandle for the gpio controller
+			  (see interrupt binding[0]).
+ - interrupts		: (gpio) interrupt to which the chip is connected
+			  (see interrupt binding[0]).
+
+Optional properties:
+ - reset-gpios		: the reset gpio the chip is connected to
+			  (see GPIO binding[1] for more details).
+Some other touchscreen optional properties can be defined such as
+"touchscreen-size-x". See ./touchscreen.txt[2] for more details.
+
+This touchscreen can handle some buttons that are touchscreen's defined zones.
+Each button's event can be customized using a property:
+	- linux,keycodes: List of keycode to emit.
+
+[0]: Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
+[1]: Documentation/devicetree/bindings/gpio/gpio.txt
+[2]: Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
+
+Example:
+&i2c0 {
+	[...]
+
+	touchscreen@24 {
+		compatible = "cypress,cyttsp5";
+		reg = <0x24>;
+
+		interrupt-parent = <&pio>;
+		interrupts = <1 5 IRQ_TYPE_LEVEL_LOW>;
+		reset-gpios = <&pio 7 1 GPIO_ACTIVE_HIGH>;
+		touchscreen-swapped-x-y;
+		linux,keycodes = <KEY_HOMEPAGE>, <KEY_MENU>, <KEY_BACK>;
+	};
+};
-- 
2.11.0

^ permalink raw reply related

* Re: [PATCH v4 01/36] asm-generic/io.h: move ioremap_nocache/ioremap_uc/ioremap_wc/ioremap_wt out of ifndef CONFIG_MMU
From: kbuild test robot @ 2017-12-20 10:09 UTC (permalink / raw)
  Cc: kbuild-all, greentime, linux-kernel, arnd, linux-arch, tglx,
	jason, marc.zyngier, robh+dt, netdev, deanbo422, devicetree, viro,
	dhowells, will.deacon, daniel.lezcano, linux-serial,
	geert.uytterhoeven, linus.walleij, mark.rutland, greg, ren_guo,
	pombredanne, green.hu, Vincent Chen
In-Reply-To: <d25ea659bc370a6bb24c4d42416f890a34051df1.1513577007.git.green.hu@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 22586 bytes --]

Hi Greentime,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on tip/timers/core]
[also build test ERROR on v4.15-rc4 next-20171220]
[cannot apply to linus/master]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Greentime-Hu/Andes-nds32-Linux-Kernel/20171220-155937
config: sparc-defconfig (attached as .config)
compiler: sparc-linux-gcc (GCC) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=sparc 

All error/warnings (new ones prefixed by >>):

   In file included from arch/sparc/include/asm/io.h:6:0,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from arch/sparc/kernel/kernel.h:4,
                    from arch/sparc/kernel/traps_32.c:30:
>> arch/sparc/include/asm/io_32.h:129:15: error: conflicting types for 'ioremap'
    void __iomem *ioremap(unsigned long offset, unsigned long size);
                  ^~~~~~~
   In file included from arch/sparc/include/asm/io_32.h:13:0,
                    from arch/sparc/include/asm/io.h:6,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from arch/sparc/kernel/kernel.h:4,
                    from arch/sparc/kernel/traps_32.c:30:
   include/asm-generic/io.h:864:15: note: previous declaration of 'ioremap' was here
    void __iomem *ioremap(phys_addr_t phys_addr, size_t size);
                  ^~~~~~~
   In file included from arch/sparc/include/asm/io.h:6:0,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from arch/sparc/kernel/kernel.h:4,
                    from arch/sparc/kernel/traps_32.c:30:
   arch/sparc/include/asm/io_32.h:130:0: error: "ioremap_nocache" redefined [-Werror]
    #define ioremap_nocache(X,Y) ioremap((X),(Y))
    
   In file included from arch/sparc/include/asm/io_32.h:13:0,
                    from arch/sparc/include/asm/io.h:6,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from arch/sparc/kernel/kernel.h:4,
                    from arch/sparc/kernel/traps_32.c:30:
   include/asm-generic/io.h:865:0: note: this is the location of the previous definition
    #define ioremap_nocache ioremap_nocache
    
   In file included from arch/sparc/include/asm/io.h:6:0,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from arch/sparc/kernel/kernel.h:4,
                    from arch/sparc/kernel/traps_32.c:30:
   arch/sparc/include/asm/io_32.h:131:0: error: "ioremap_wc" redefined [-Werror]
    #define ioremap_wc(X,Y)  ioremap((X),(Y))
    
   In file included from arch/sparc/include/asm/io_32.h:13:0,
                    from arch/sparc/include/asm/io.h:6,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from arch/sparc/kernel/kernel.h:4,
                    from arch/sparc/kernel/traps_32.c:30:
   include/asm-generic/io.h:881:0: note: this is the location of the previous definition
    #define ioremap_wc ioremap_wc
    
   In file included from arch/sparc/include/asm/io.h:6:0,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from arch/sparc/kernel/kernel.h:4,
                    from arch/sparc/kernel/traps_32.c:30:
   arch/sparc/include/asm/io_32.h:132:0: error: "ioremap_wt" redefined [-Werror]
    #define ioremap_wt(X,Y)  ioremap((X),(Y))
    
   In file included from arch/sparc/include/asm/io_32.h:13:0,
                    from arch/sparc/include/asm/io.h:6,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from arch/sparc/kernel/kernel.h:4,
                    from arch/sparc/kernel/traps_32.c:30:
   include/asm-generic/io.h:889:0: note: this is the location of the previous definition
    #define ioremap_wt ioremap_wt
    
   cc1: all warnings being treated as errors
--
   In file included from arch/sparc/include/asm/io.h:6:0,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc/kernel/ioport.c:36:
>> arch/sparc/include/asm/io_32.h:129:15: error: conflicting types for 'ioremap'
    void __iomem *ioremap(unsigned long offset, unsigned long size);
                  ^~~~~~~
   In file included from arch/sparc/include/asm/io_32.h:13:0,
                    from arch/sparc/include/asm/io.h:6,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc/kernel/ioport.c:36:
   include/asm-generic/io.h:864:15: note: previous declaration of 'ioremap' was here
    void __iomem *ioremap(phys_addr_t phys_addr, size_t size);
                  ^~~~~~~
   In file included from arch/sparc/include/asm/io.h:6:0,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc/kernel/ioport.c:36:
   arch/sparc/include/asm/io_32.h:130:0: error: "ioremap_nocache" redefined [-Werror]
    #define ioremap_nocache(X,Y) ioremap((X),(Y))
    
   In file included from arch/sparc/include/asm/io_32.h:13:0,
                    from arch/sparc/include/asm/io.h:6,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc/kernel/ioport.c:36:
   include/asm-generic/io.h:865:0: note: this is the location of the previous definition
    #define ioremap_nocache ioremap_nocache
    
   In file included from arch/sparc/include/asm/io.h:6:0,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc/kernel/ioport.c:36:
   arch/sparc/include/asm/io_32.h:131:0: error: "ioremap_wc" redefined [-Werror]
    #define ioremap_wc(X,Y)  ioremap((X),(Y))
    
   In file included from arch/sparc/include/asm/io_32.h:13:0,
                    from arch/sparc/include/asm/io.h:6,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc/kernel/ioport.c:36:
   include/asm-generic/io.h:881:0: note: this is the location of the previous definition
    #define ioremap_wc ioremap_wc
    
   In file included from arch/sparc/include/asm/io.h:6:0,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc/kernel/ioport.c:36:
   arch/sparc/include/asm/io_32.h:132:0: error: "ioremap_wt" redefined [-Werror]
    #define ioremap_wt(X,Y)  ioremap((X),(Y))
    
   In file included from arch/sparc/include/asm/io_32.h:13:0,
                    from arch/sparc/include/asm/io.h:6,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc/kernel/ioport.c:36:
   include/asm-generic/io.h:889:0: note: this is the location of the previous definition
    #define ioremap_wt ioremap_wt
    
>> arch/sparc/kernel/ioport.c:124:15: error: conflicting types for 'ioremap'
    void __iomem *ioremap(unsigned long offset, unsigned long size)
                  ^~~~~~~
   In file included from arch/sparc/include/asm/io_32.h:13:0,
                    from arch/sparc/include/asm/io.h:6,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc/kernel/ioport.c:36:
   include/asm-generic/io.h:864:15: note: previous declaration of 'ioremap' was here
    void __iomem *ioremap(phys_addr_t phys_addr, size_t size);
                  ^~~~~~~
   In file included from include/linux/linkage.h:6:0,
                    from include/linux/kernel.h:6,
                    from include/linux/list.h:8,
                    from include/linux/module.h:9,
                    from arch/sparc/kernel/ioport.c:28:
   arch/sparc/kernel/ioport.c:131:15: error: conflicting types for 'ioremap'
    EXPORT_SYMBOL(ioremap);
                  ^
   include/linux/export.h:65:21: note: in definition of macro '___EXPORT_SYMBOL'
     extern typeof(sym) sym;      \
                        ^~~
>> arch/sparc/kernel/ioport.c:131:1: note: in expansion of macro 'EXPORT_SYMBOL'
    EXPORT_SYMBOL(ioremap);
    ^~~~~~~~~~~~~
   In file included from arch/sparc/include/asm/io_32.h:13:0,
                    from arch/sparc/include/asm/io.h:6,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc/kernel/ioport.c:36:
   include/asm-generic/io.h:864:15: note: previous declaration of 'ioremap' was here
    void __iomem *ioremap(phys_addr_t phys_addr, size_t size);
                  ^~~~~~~
   cc1: all warnings being treated as errors
--
   In file included from arch/sparc/include/asm/io.h:6:0,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc//kernel/ioport.c:36:
>> arch/sparc/include/asm/io_32.h:129:15: error: conflicting types for 'ioremap'
    void __iomem *ioremap(unsigned long offset, unsigned long size);
                  ^~~~~~~
   In file included from arch/sparc/include/asm/io_32.h:13:0,
                    from arch/sparc/include/asm/io.h:6,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc//kernel/ioport.c:36:
   include/asm-generic/io.h:864:15: note: previous declaration of 'ioremap' was here
    void __iomem *ioremap(phys_addr_t phys_addr, size_t size);
                  ^~~~~~~
   In file included from arch/sparc/include/asm/io.h:6:0,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc//kernel/ioport.c:36:
   arch/sparc/include/asm/io_32.h:130:0: error: "ioremap_nocache" redefined [-Werror]
    #define ioremap_nocache(X,Y) ioremap((X),(Y))
    
   In file included from arch/sparc/include/asm/io_32.h:13:0,
                    from arch/sparc/include/asm/io.h:6,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc//kernel/ioport.c:36:
   include/asm-generic/io.h:865:0: note: this is the location of the previous definition
    #define ioremap_nocache ioremap_nocache
    
   In file included from arch/sparc/include/asm/io.h:6:0,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc//kernel/ioport.c:36:
   arch/sparc/include/asm/io_32.h:131:0: error: "ioremap_wc" redefined [-Werror]
    #define ioremap_wc(X,Y)  ioremap((X),(Y))
    
   In file included from arch/sparc/include/asm/io_32.h:13:0,
                    from arch/sparc/include/asm/io.h:6,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc//kernel/ioport.c:36:
   include/asm-generic/io.h:881:0: note: this is the location of the previous definition
    #define ioremap_wc ioremap_wc
    
   In file included from arch/sparc/include/asm/io.h:6:0,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc//kernel/ioport.c:36:
   arch/sparc/include/asm/io_32.h:132:0: error: "ioremap_wt" redefined [-Werror]
    #define ioremap_wt(X,Y)  ioremap((X),(Y))
    
   In file included from arch/sparc/include/asm/io_32.h:13:0,
                    from arch/sparc/include/asm/io.h:6,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc//kernel/ioport.c:36:
   include/asm-generic/io.h:889:0: note: this is the location of the previous definition
    #define ioremap_wt ioremap_wt
    
   arch/sparc//kernel/ioport.c:124:15: error: conflicting types for 'ioremap'
    void __iomem *ioremap(unsigned long offset, unsigned long size)
                  ^~~~~~~

vim +/ioremap +129 arch/sparc/include/asm/io_32.h

f5e706ad include/asm-sparc/io_32.h      Sam Ravnborg    2008-07-17  124  
f5e706ad include/asm-sparc/io_32.h      Sam Ravnborg    2008-07-17  125  /*
f5e706ad include/asm-sparc/io_32.h      Sam Ravnborg    2008-07-17  126   * Bus number may be embedded in the higher bits of the physical address.
f5e706ad include/asm-sparc/io_32.h      Sam Ravnborg    2008-07-17  127   * This is why we have no bus number argument to ioremap().
f5e706ad include/asm-sparc/io_32.h      Sam Ravnborg    2008-07-17  128   */
f05a6865 arch/sparc/include/asm/io_32.h Sam Ravnborg    2014-05-16 @129  void __iomem *ioremap(unsigned long offset, unsigned long size);
f5e706ad include/asm-sparc/io_32.h      Sam Ravnborg    2008-07-17  130  #define ioremap_nocache(X,Y)	ioremap((X),(Y))
428695b8 include/asm-sparc/io_32.h      David S. Miller 2008-07-22  131  #define ioremap_wc(X,Y)		ioremap((X),(Y))
556269c1 arch/sparc/include/asm/io_32.h Toshi Kani      2015-06-04  132  #define ioremap_wt(X,Y)		ioremap((X),(Y))
f05a6865 arch/sparc/include/asm/io_32.h Sam Ravnborg    2014-05-16  133  void iounmap(volatile void __iomem *addr);
f5e706ad include/asm-sparc/io_32.h      Sam Ravnborg    2008-07-17  134  

:::::: The code at line 129 was first introduced by commit
:::::: f05a68653e56ca2f23bccf7e50be69486886f052 sparc: drop use of extern for prototypes in arch/sparc/include/asm

:::::: TO: Sam Ravnborg <sam@ravnborg.org>
:::::: CC: David S. Miller <davem@davemloft.net>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 12283 bytes --]

^ permalink raw reply

* Re: [PATCH v4 01/36] asm-generic/io.h: move ioremap_nocache/ioremap_uc/ioremap_wc/ioremap_wt out of ifndef CONFIG_MMU
From: kbuild test robot @ 2017-12-20 10:10 UTC (permalink / raw)
  Cc: kbuild-all, greentime, linux-kernel, arnd, linux-arch, tglx,
	jason, marc.zyngier, robh+dt, netdev, deanbo422, devicetree, viro,
	dhowells, will.deacon, daniel.lezcano, linux-serial,
	geert.uytterhoeven, linus.walleij, mark.rutland, greg, ren_guo,
	pombredanne, green.hu, Vincent Chen
In-Reply-To: <d25ea659bc370a6bb24c4d42416f890a34051df1.1513577007.git.green.hu@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4102 bytes --]

Hi Greentime,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on tip/timers/core]
[also build test ERROR on v4.15-rc4 next-20171220]
[cannot apply to linus/master]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Greentime-Hu/Andes-nds32-Linux-Kernel/20171220-155937
config: openrisc-or1ksim_defconfig (attached as .config)
compiler: or1k-linux-gcc (GCC) 6.0.0 20160327 (experimental)
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=openrisc 

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/io.h:25:0,
                    from arch/openrisc/kernel/asm-offsets.c:35:
>> arch/openrisc/include/asm/io.h:38:29: error: conflicting types for 'ioremap'
    static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size)
                                ^~~~~~~
   In file included from arch/openrisc/include/asm/io.h:32:0,
                    from include/linux/io.h:25,
                    from arch/openrisc/kernel/asm-offsets.c:35:
   include/asm-generic/io.h:864:15: note: previous declaration of 'ioremap' was here
    void __iomem *ioremap(phys_addr_t phys_addr, size_t size);
                  ^~~~~~~
   include/asm-generic/io.h:865:25: error: conflicting types for 'ioremap_nocache'
    #define ioremap_nocache ioremap_nocache
                            ^
>> arch/openrisc/include/asm/io.h:44:29: note: in expansion of macro 'ioremap_nocache'
    static inline void __iomem *ioremap_nocache(phys_addr_t offset,
                                ^~~~~~~~~~~~~~~
   include/asm-generic/io.h:865:25: note: previous definition of 'ioremap_nocache' was here
    #define ioremap_nocache ioremap_nocache
                            ^
   include/asm-generic/io.h:866:29: note: in expansion of macro 'ioremap_nocache'
    static inline void __iomem *ioremap_nocache(phys_addr_t offset, size_t size)
                                ^~~~~~~~~~~~~~~
   make[2]: *** [arch/openrisc/kernel/asm-offsets.s] Error 1
   make[2]: Target '__build' not remade because of errors.
   make[1]: *** [prepare0] Error 2
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [sub-make] Error 2

vim +/ioremap +38 arch/openrisc/include/asm/io.h

58e0166a Jonas Bonn  2011-06-04  31  
58e0166a Jonas Bonn  2011-06-04 @32  #include <asm-generic/io.h>
9b04ebd1 James Hogan 2012-10-23  33  #include <asm/pgtable.h>
58e0166a Jonas Bonn  2011-06-04  34  
58e0166a Jonas Bonn  2011-06-04  35  extern void __iomem *__ioremap(phys_addr_t offset, unsigned long size,
58e0166a Jonas Bonn  2011-06-04  36  				pgprot_t prot);
58e0166a Jonas Bonn  2011-06-04  37  
58e0166a Jonas Bonn  2011-06-04 @38  static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size)
58e0166a Jonas Bonn  2011-06-04  39  {
58e0166a Jonas Bonn  2011-06-04  40  	return __ioremap(offset, size, PAGE_KERNEL);
58e0166a Jonas Bonn  2011-06-04  41  }
58e0166a Jonas Bonn  2011-06-04  42  
58e0166a Jonas Bonn  2011-06-04  43  /* #define _PAGE_CI       0x002 */
58e0166a Jonas Bonn  2011-06-04 @44  static inline void __iomem *ioremap_nocache(phys_addr_t offset,
58e0166a Jonas Bonn  2011-06-04  45  					     unsigned long size)
58e0166a Jonas Bonn  2011-06-04  46  {
58e0166a Jonas Bonn  2011-06-04  47  	return __ioremap(offset, size,
58e0166a Jonas Bonn  2011-06-04  48  			 __pgprot(pgprot_val(PAGE_KERNEL) | _PAGE_CI));
58e0166a Jonas Bonn  2011-06-04  49  }
58e0166a Jonas Bonn  2011-06-04  50  

:::::: The code at line 38 was first introduced by commit
:::::: 58e0166a4772aaeb10c9b0f6d59f19099d2047df OpenRISC: Headers

:::::: TO: Jonas Bonn <jonas@southpole.se>
:::::: CC: Jonas Bonn <jonas@southpole.se>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 7613 bytes --]

^ permalink raw reply

* Re: [PATCH 5/5] ARM: dts: iwg20d-q7-common: Enable SGTL5000 audio codec
From: Simon Horman @ 2017-12-20 10:11 UTC (permalink / raw)
  To: Biju Das
  Cc: Rob Herring, Mark Rutland, Russell King, Magnus Damm,
	Chris Paterson,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
In-Reply-To: <KL1PR06MB1702453058AFB66AA8110825B80C0-k6wCOA2IOKSx7cDWSRonpW0DtJ1/0DrXvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>

On Wed, Dec 20, 2017 at 10:02:54AM +0000, Biju Das wrote:
> Thanks Simon for this information.
> 
> Next time I will make sure that  compiler won't give any warning message with make dtbs W=1

Thanks, I've been on a bit of a mission to clean up such warnings of late.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH v3 2/5] dt-bindings: pwm: rcar: Document r8a774[35] PWM bindings
From: Simon Horman @ 2017-12-20 10:12 UTC (permalink / raw)
  To: Fabrizio Castro
  Cc: Thierry Reding, Rob Herring, Mark Rutland,
	linux-pwm@vger.kernel.org, devicetree@vger.kernel.org,
	Geert Uytterhoeven, Chris Paterson, Biju Das,
	linux-renesas-soc@vger.kernel.org
In-Reply-To: <TY1PR06MB08955E0D55B2712C6105A2F0C00C0@TY1PR06MB0895.apcprd06.prod.outlook.com>

On Wed, Dec 20, 2017 at 09:54:14AM +0000, Fabrizio Castro wrote:
> Hello Simon,
> 
> > Subject: Re: [PATCH v3 2/5] dt-bindings: pwm: rcar: Document r8a774[35] PWM bindings
> >
> > On Tue, Dec 19, 2017 at 01:34:57PM +0000, Fabrizio Castro wrote:
> > > This patch adds compatible strings specific to r8a774[35], no driver
> > > change is needed as the fallback compatible string will activate the
> > > right code. Also, this patch replaces the example with a DT snippet used
> > > for adding PWM0 support to an r8a7743 based platform.
> >
> > What is the motivation for updating the example?
> 
> I am sorry I forgot to copy the explanation across from the first version of the patch:
> https://patchwork.kernel.org/patch/10111831/
> 
> "the reason for replacing the example with one of a different SoC is that
> the new example refers to recent code from a real use case. I hope that's ok."
> 
> Basically the r8a7743 will be the first platform with full upstream support, and I believe it is better to have up-to-date examples proven to work in the documentation.

Thanks, that sounds reasonable.

> 
> > Could it be stated here?
> 
> Shall I send a new version for this?

That would be best in my opinion.

^ permalink raw reply

* Re: [PATCH v2 0/2] eeprom: at24: write-protect pin support
From: Andy Shevchenko @ 2017-12-20 10:21 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Rob Herring, Mark Rutland, Linus Walleij, Peter Rosin, linux-i2c,
	devicetree, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
In-Reply-To: <20171220082633.32237-1-brgl-ARrdPY/1zhM@public.gmane.org>

On Wed, Dec 20, 2017 at 10:26 AM, Bartosz Golaszewski <brgl-ARrdPY/1zhM@public.gmane.org> wrote:
> AT24 EEPROMs have a write-protect pin, which - when pulled high -
> inhibits writes to the upper quadrant of memory (although it has been
> observed that on some chips it disables writing to the entire memory
> range).
>
> On some boards, this pin is connected to a GPIO and pulled high by
> default, which forces the user to manually change its state before
> writing. On linux this means that we either need to hog the line all
> the time, or set the GPIO value before writing from outside of the
> at24 driver.
>
> This series adds support for the write-protect pin split into two
> parts. The first patch extends the relevant binding document, while
> the second modifies the at24 code to pull the write-protect GPIO
> low (if present) during write operations.
>

Reviewed-by: Andy Shevchenko <andy.shevchenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

A one totally minor nit: if it possible now to have one line where
devm_gpiod_get_optional() is called?
You may ignore this nit anyway.

> v1 -> v2:
> - renamed the DT property to wp-gpios
>
> Bartosz Golaszewski (2):
>   dt-bindings: at24: new optional property - wp-gpios
>   eeprom: at24: add support for the write-protect pin
>
>  Documentation/devicetree/bindings/eeprom/at24.txt |  3 +++
>  drivers/misc/eeprom/at24.c                        | 11 +++++++++++
>  2 files changed, 14 insertions(+)
>
> --
> 2.15.1
>



-- 
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH v5 06/11] thermal: armada: Add support for Armada AP806
From: Gregory CLEMENT @ 2017-12-20 10:27 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Zhang Rui, Eduardo Valentin, Rob Herring, Mark Rutland,
	linux-pm-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	Thomas Petazzoni, Antoine Tenart, Nadav Haklai, Baruch Siach,
	David Sniatkiwicz
In-Reply-To: <20171219135719.9531-7-miquel.raynal-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>

Hi Miquel,
 
 On mar., déc. 19 2017, Miquel Raynal <miquel.raynal-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:

> From: Baruch Siach <baruch-NswTu9S1W3P6gbPvEgmw2w@public.gmane.org>
>
> The AP806 component is integrated in the Armada 8K and 7K lines of
> processors.
>
> The thermal sensor sample field on the status register is a signed
> value. Extend armada_get_temp() and the driver structure to handle
> signed values.
>
> Signed-off-by: Baruch Siach <baruch-NswTu9S1W3P6gbPvEgmw2w@public.gmane.org>
> [<miquel.raynal-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>: Changes when applying over the
> previous patches, including the register names changes, also switched
> the coefficients values to s64 instead of unsigned long to deal with
> negative values and used do_div instead of the traditionnal '/']
> Signed-off-by: Miquel Raynal <miquel.raynal-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> Reviewed-by: Gregory CLEMENT <gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> ---
>  drivers/thermal/armada_thermal.c | 74 ++++++++++++++++++++++++++++++++--------
>  1 file changed, 59 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
> index ceebabf45c53..c7dcac39cbf9 100644
> --- a/drivers/thermal/armada_thermal.c
> +++ b/drivers/thermal/armada_thermal.c
> @@ -47,6 +47,11 @@
>  #define CONTROL0_OFFSET			0x0
>  #define CONTROL1_OFFSET			0x4
>  
> +/* TSEN refers to the temperature sensors within the AP */
> +#define CONTROL0_TSEN_START		BIT(0)
> +#define CONTROL0_TSEN_RESET		BIT(1)
> +#define CONTROL0_TSEN_ENABLE		BIT(2)
> +
>  struct armada_thermal_data;
>  
>  /* Marvell EBU Thermal Sensor Dev Structure */
> @@ -66,10 +71,11 @@ struct armada_thermal_data {
>  	bool (*is_valid)(struct armada_thermal_priv *);
>  
>  	/* Formula coeficients: temp = (b - m * reg) / div */
> -	unsigned long coef_b;
> -	unsigned long coef_m;
> -	unsigned long coef_div;
> +	s64 coef_b;
> +	s64 coef_m;
> +	u32 coef_div;
>  	bool inverted;
> +	bool signed_sample;
>  
>  	/* Register shift and mask to access the sensor temperature */
>  	unsigned int temp_shift;
> @@ -155,6 +161,18 @@ static void armada380_init_sensor(struct platform_device *pdev,
>  	}
>  }
>  
> +static void armada_ap806_init_sensor(struct platform_device *pdev,
> +				     struct armada_thermal_priv *priv)
> +{
> +	u32 reg;
> +
> +	reg = readl_relaxed(priv->control0);
> +	reg &= ~CONTROL0_TSEN_RESET;
> +	reg |= CONTROL0_TSEN_START | CONTROL0_TSEN_ENABLE;
> +	writel(reg, priv->control0);
> +	msleep(10);
> +}
> +
>  static bool armada_is_valid(struct armada_thermal_priv *priv)
>  {
>  	u32 reg = readl_relaxed(priv->status);
> @@ -166,8 +184,8 @@ static int armada_get_temp(struct thermal_zone_device *thermal,
>  			  int *temp)
>  {
>  	struct armada_thermal_priv *priv = thermal->devdata;
> -	unsigned long reg;
> -	unsigned long m, b, div;
> +	u32 reg, div;
> +	s64 sample, b, m;
>  
>  	/* Valid check */
>  	if (priv->data->is_valid && !priv->data->is_valid(priv)) {
> @@ -178,6 +196,11 @@ static int armada_get_temp(struct thermal_zone_device *thermal,
>  
>  	reg = readl_relaxed(priv->status);
>  	reg = (reg >> priv->data->temp_shift) & priv->data->temp_mask;
> +	if (priv->data->signed_sample)
> +		/* The most significant bit is the sign bit */
> +		sample = sign_extend32(reg, fls(priv->data->temp_mask) - 1);
> +	else
> +		sample = reg;
>  
>  	/* Get formula coeficients */
>  	b = priv->data->coef_b;
> @@ -185,9 +208,12 @@ static int armada_get_temp(struct thermal_zone_device *thermal,
>  	div = priv->data->coef_div;
>  
>  	if (priv->data->inverted)
> -		*temp = ((m * reg) - b) / div;
> +		*temp = (m * sample) - b;
>  	else
> -		*temp = (b - (m * reg)) / div;
> +		*temp = b - (m * sample);
> +
> +	do_div(*temp, div);

I wanted to test in on ARMv7 and this line failed to compile:
In file included from arch/arm/include/asm/div64.h:127:0,
                 from include/linux/kernel.h:173,
                 from include/linux/list.h:9,
                 from include/linux/kobject.h:20,
                 from include/linux/device.h:17,
                 from drivers/thermal/armada_thermal.c:16:
drivers/thermal/armada_thermal.c: In function ‘armada_get_temp’:
include/asm-generic/div64.h:208:28: warning: comparison of distinct pointer types lacks a cast
  (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
                            ^
drivers/thermal/armada_thermal.c:247:2: note: in expansion of macro ‘do_div’
  do_div(*temp, div);
  ^~~~~~
In file included from include/linux/ioport.h:13:0,
                 from include/linux/device.h:16,
                 from drivers/thermal/armada_thermal.c:16:
include/asm-generic/div64.h:221:25: warning: right shift count >= width of type [-Wshift-count-overflow]
  } else if (likely(((n) >> 32) == 0)) {  \
                         ^
include/linux/compiler.h:175:40: note: in definition of macro ‘likely’
 # define likely(x) __builtin_expect(!!(x), 1)
                                        ^
drivers/thermal/armada_thermal.c:247:2: note: in expansion of macro ‘do_div’
  do_div(*temp, div);
  ^~~~~~
In file included from arch/arm/include/asm/div64.h:127:0,
                 from include/linux/kernel.h:173,
                 from include/linux/list.h:9,
                 from include/linux/kobject.h:20,
                 from include/linux/device.h:17,
                 from drivers/thermal/armada_thermal.c:16:
include/asm-generic/div64.h:225:22: error: passing argument 1 of ‘__div64_32’ from incompatible pointer type [-Werror=incompatible-pointer-types]
   __rem = __div64_32(&(n), __base); \
                      ^
drivers/thermal/armada_thermal.c:247:2: note: in expansion of macro ‘do_div’
  do_div(*temp, div);
  ^~~~~~
In file included from include/linux/kernel.h:173:0,
                 from include/linux/list.h:9,
                 from include/linux/kobject.h:20,
                 from include/linux/device.h:17,
                 from drivers/thermal/armada_thermal.c:16:
arch/arm/include/asm/div64.h:33:24: note: expected ‘uint64_t * {aka long long unsigned int *}’ but argument is of type ‘int *’
 static inline uint32_t __div64_32(uint64_t *n, uint32_t base)

Gregory

> +
>  	return 0;
>  }
>  
> @@ -199,8 +225,8 @@ static const struct armada_thermal_data armadaxp_data = {
>  	.init_sensor = armadaxp_init_sensor,
>  	.temp_shift = 10,
>  	.temp_mask = 0x1ff,
> -	.coef_b = 3153000000UL,
> -	.coef_m = 10000000UL,
> +	.coef_b = 3153000000ULL,
> +	.coef_m = 10000000ULL,
>  	.coef_div = 13825,
>  };
>  
> @@ -210,8 +236,8 @@ static const struct armada_thermal_data armada370_data = {
>  	.is_valid_bit = BIT(9),
>  	.temp_shift = 10,
>  	.temp_mask = 0x1ff,
> -	.coef_b = 3153000000UL,
> -	.coef_m = 10000000UL,
> +	.coef_b = 3153000000ULL,
> +	.coef_m = 10000000ULL,
>  	.coef_div = 13825,
>  };
>  
> @@ -221,8 +247,8 @@ static const struct armada_thermal_data armada375_data = {
>  	.is_valid_bit = BIT(10),
>  	.temp_shift = 0,
>  	.temp_mask = 0x1ff,
> -	.coef_b = 3171900000UL,
> -	.coef_m = 10000000UL,
> +	.coef_b = 3171900000ULL,
> +	.coef_m = 10000000ULL,
>  	.coef_div = 13616,
>  	.needs_control0 = true,
>  };
> @@ -233,12 +259,26 @@ static const struct armada_thermal_data armada380_data = {
>  	.is_valid_bit = BIT(10),
>  	.temp_shift = 0,
>  	.temp_mask = 0x3ff,
> -	.coef_b = 1172499100UL,
> -	.coef_m = 2000096UL,
> +	.coef_b = 1172499100ULL,
> +	.coef_m = 2000096ULL,
>  	.coef_div = 4201,
>  	.inverted = true,
>  };
>  
> +static const struct armada_thermal_data armada_ap806_data = {
> +	.is_valid = armada_is_valid,
> +	.init_sensor = armada_ap806_init_sensor,
> +	.is_valid_bit = BIT(16),
> +	.temp_shift = 0,
> +	.temp_mask = 0x3ff,
> +	.coef_b = -150000LL,
> +	.coef_m = 423ULL,
> +	.coef_div = 1,
> +	.inverted = true,
> +	.signed_sample = true,
> +	.needs_control0 = true,
> +};
> +
>  static const struct of_device_id armada_thermal_id_table[] = {
>  	{
>  		.compatible = "marvell,armadaxp-thermal",
> @@ -257,6 +297,10 @@ static const struct of_device_id armada_thermal_id_table[] = {
>  		.data       = &armada380_data,
>  	},
>  	{
> +		.compatible = "marvell,armada-ap806-thermal",
> +		.data       = &armada_ap806_data,
> +	},
> +	{
>  		/* sentinel */
>  	},
>  };
> -- 
> 2.11.0
>

-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH v4 33/36] net: faraday add nds32 support.
From: Greentime Hu @ 2017-12-20 10:34 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: kbuild test robot, kbuild-all, Greentime,
	Linux Kernel Mailing List, Arnd Bergmann, Linux-Arch,
	Thomas Gleixner, Jason Cooper, Marc Zyngier, Rob Herring, netdev,
	Vincent Chen, DTML, Al Viro, David Howells, Will Deacon,
	Daniel Lezcano, linux-serial, Linus Walleij, Mark Rutland,
	Greg KH
In-Reply-To: <CAMuHMdXp5b-Y79kaKgmDRshnpN2=VEd-f3v-6QW+6mUqv6YW-A@mail.gmail.com>

2017-12-20 17:58 GMT+08:00 Geert Uytterhoeven <geert@linux-m68k.org>:
> On Wed, Dec 20, 2017 at 10:54 AM, kbuild test robot <lkp@intel.com> wrote:
>> I love your patch! Perhaps something to improve:
>>
>> [auto build test WARNING on tip/timers/core]
>> [cannot apply to linus/master v4.15-rc4 next-20171220]
>> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>>
>> url:    https://github.com/0day-ci/linux/commits/Greentime-Hu/Andes-nds32-Linux-Kernel/20171220-155937
>> config: sparc64-allyesconfig (attached as .config)
>> compiler: sparc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
>> reproduce:
>>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>>         chmod +x ~/bin/make.cross
>>         # save the attached .config to linux build tree
>>         make.cross ARCH=sparc64
>>
>> All warnings (new ones prefixed by >>):
>>
>>    drivers/net/ethernet/faraday/ftmac100.c: In function 'ftmac100_rxdes_set_page':
>>>> drivers/net/ethernet/faraday/ftmac100.c:288:18: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
>>      rxdes->rxdes3 = (unsigned int)page;
>>                      ^
>
> The proper way to casts pointer to integers is to cast to "uintptr_t".
>
> However, the address is stored in a 32-bit descriptor, which means it can
> not work on 64-bit platforms.
>
> Please make the driver depend on "!64BIT || BROKEN"
>
> Cfr. commit 15bfe05c8d6386f1 ("net: ethernet: xilinx: Mark XILINX_LL_TEMAC
> broken on 64-bit")
>
Thanks Geert.

I will apply it like this.

+++ b/drivers/net/ethernet/faraday/Kconfig
@@ -5,7 +5,7 @@
 config NET_VENDOR_FARADAY
        bool "Faraday devices"
        default y
-       depends on ARM
+       depends on ARM || NDS32 || COMPILE_TEST
        ---help---
          If you have a network (Ethernet) card belonging to this class, say Y.

@@ -18,7 +18,8 @@ if NET_VENDOR_FARADAY

 config FTMAC100
        tristate "Faraday FTMAC100 10/100 Ethernet support"
-       depends on ARM
+       depends on ARM || NDS32 || COMPILE_TEST
+       depends on !64BIT || BROKEN
        select MII
        ---help---
          This driver supports the FTMAC100 10/100 Ethernet controller
@@ -27,7 +28,8 @@ config FTMAC100

 config FTGMAC100
        tristate "Faraday FTGMAC100 Gigabit Ethernet support"
-       depends on ARM
+       depends on ARM || NDS32 || COMPILE_TEST
+       depends on !64BIT || BROKEN
        select PHYLIB
        ---help---
          This driver supports the FTGMAC100 Gigabit Ethernet controller

^ permalink raw reply

* Re: [PATCH v5 06/11] thermal: armada: Add support for Armada AP806
From: Gregory CLEMENT @ 2017-12-20 10:56 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Zhang Rui, Eduardo Valentin, Rob Herring, Mark Rutland,
	linux-pm-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	Thomas Petazzoni, Antoine Tenart, Nadav Haklai, Baruch Siach,
	David Sniatkiwicz
In-Reply-To: <20171219135719.9531-7-miquel.raynal-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>

Hi Miquel,
 
 On mar., déc. 19 2017, Miquel Raynal <miquel.raynal-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:

> From: Baruch Siach <baruch-NswTu9S1W3P6gbPvEgmw2w@public.gmane.org>
>
> The AP806 component is integrated in the Armada 8K and 7K lines of
> processors.
>
> The thermal sensor sample field on the status register is a signed
> value. Extend armada_get_temp() and the driver structure to handle
> signed values.
>
> Signed-off-by: Baruch Siach <baruch-NswTu9S1W3P6gbPvEgmw2w@public.gmane.org>
> [<miquel.raynal-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>: Changes when applying over the
> previous patches, including the register names changes, also switched
> the coefficients values to s64 instead of unsigned long to deal with
> negative values and used do_div instead of the traditionnal '/']
> Signed-off-by: Miquel Raynal <miquel.raynal-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> Reviewed-by: Gregory CLEMENT <gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>

On Armada 7040 DB and Machitobin, the temperature value looks coherent:

Tested-by: Gregory CLEMENT <gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>

Gregory


> ---
>  drivers/thermal/armada_thermal.c | 74 ++++++++++++++++++++++++++++++++--------
>  1 file changed, 59 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
> index ceebabf45c53..c7dcac39cbf9 100644
> --- a/drivers/thermal/armada_thermal.c
> +++ b/drivers/thermal/armada_thermal.c
> @@ -47,6 +47,11 @@
>  #define CONTROL0_OFFSET			0x0
>  #define CONTROL1_OFFSET			0x4
>  
> +/* TSEN refers to the temperature sensors within the AP */
> +#define CONTROL0_TSEN_START		BIT(0)
> +#define CONTROL0_TSEN_RESET		BIT(1)
> +#define CONTROL0_TSEN_ENABLE		BIT(2)
> +
>  struct armada_thermal_data;
>  
>  /* Marvell EBU Thermal Sensor Dev Structure */
> @@ -66,10 +71,11 @@ struct armada_thermal_data {
>  	bool (*is_valid)(struct armada_thermal_priv *);
>  
>  	/* Formula coeficients: temp = (b - m * reg) / div */
> -	unsigned long coef_b;
> -	unsigned long coef_m;
> -	unsigned long coef_div;
> +	s64 coef_b;
> +	s64 coef_m;
> +	u32 coef_div;
>  	bool inverted;
> +	bool signed_sample;
>  
>  	/* Register shift and mask to access the sensor temperature */
>  	unsigned int temp_shift;
> @@ -155,6 +161,18 @@ static void armada380_init_sensor(struct platform_device *pdev,
>  	}
>  }
>  
> +static void armada_ap806_init_sensor(struct platform_device *pdev,
> +				     struct armada_thermal_priv *priv)
> +{
> +	u32 reg;
> +
> +	reg = readl_relaxed(priv->control0);
> +	reg &= ~CONTROL0_TSEN_RESET;
> +	reg |= CONTROL0_TSEN_START | CONTROL0_TSEN_ENABLE;
> +	writel(reg, priv->control0);
> +	msleep(10);
> +}
> +
>  static bool armada_is_valid(struct armada_thermal_priv *priv)
>  {
>  	u32 reg = readl_relaxed(priv->status);
> @@ -166,8 +184,8 @@ static int armada_get_temp(struct thermal_zone_device *thermal,
>  			  int *temp)
>  {
>  	struct armada_thermal_priv *priv = thermal->devdata;
> -	unsigned long reg;
> -	unsigned long m, b, div;
> +	u32 reg, div;
> +	s64 sample, b, m;
>  
>  	/* Valid check */
>  	if (priv->data->is_valid && !priv->data->is_valid(priv)) {
> @@ -178,6 +196,11 @@ static int armada_get_temp(struct thermal_zone_device *thermal,
>  
>  	reg = readl_relaxed(priv->status);
>  	reg = (reg >> priv->data->temp_shift) & priv->data->temp_mask;
> +	if (priv->data->signed_sample)
> +		/* The most significant bit is the sign bit */
> +		sample = sign_extend32(reg, fls(priv->data->temp_mask) - 1);
> +	else
> +		sample = reg;
>  
>  	/* Get formula coeficients */
>  	b = priv->data->coef_b;
> @@ -185,9 +208,12 @@ static int armada_get_temp(struct thermal_zone_device *thermal,
>  	div = priv->data->coef_div;
>  
>  	if (priv->data->inverted)
> -		*temp = ((m * reg) - b) / div;
> +		*temp = (m * sample) - b;
>  	else
> -		*temp = (b - (m * reg)) / div;
> +		*temp = b - (m * sample);
> +
> +	do_div(*temp, div);
> +
>  	return 0;
>  }
>  
> @@ -199,8 +225,8 @@ static const struct armada_thermal_data armadaxp_data = {
>  	.init_sensor = armadaxp_init_sensor,
>  	.temp_shift = 10,
>  	.temp_mask = 0x1ff,
> -	.coef_b = 3153000000UL,
> -	.coef_m = 10000000UL,
> +	.coef_b = 3153000000ULL,
> +	.coef_m = 10000000ULL,
>  	.coef_div = 13825,
>  };
>  
> @@ -210,8 +236,8 @@ static const struct armada_thermal_data armada370_data = {
>  	.is_valid_bit = BIT(9),
>  	.temp_shift = 10,
>  	.temp_mask = 0x1ff,
> -	.coef_b = 3153000000UL,
> -	.coef_m = 10000000UL,
> +	.coef_b = 3153000000ULL,
> +	.coef_m = 10000000ULL,
>  	.coef_div = 13825,
>  };
>  
> @@ -221,8 +247,8 @@ static const struct armada_thermal_data armada375_data = {
>  	.is_valid_bit = BIT(10),
>  	.temp_shift = 0,
>  	.temp_mask = 0x1ff,
> -	.coef_b = 3171900000UL,
> -	.coef_m = 10000000UL,
> +	.coef_b = 3171900000ULL,
> +	.coef_m = 10000000ULL,
>  	.coef_div = 13616,
>  	.needs_control0 = true,
>  };
> @@ -233,12 +259,26 @@ static const struct armada_thermal_data armada380_data = {
>  	.is_valid_bit = BIT(10),
>  	.temp_shift = 0,
>  	.temp_mask = 0x3ff,
> -	.coef_b = 1172499100UL,
> -	.coef_m = 2000096UL,
> +	.coef_b = 1172499100ULL,
> +	.coef_m = 2000096ULL,
>  	.coef_div = 4201,
>  	.inverted = true,
>  };
>  
> +static const struct armada_thermal_data armada_ap806_data = {
> +	.is_valid = armada_is_valid,
> +	.init_sensor = armada_ap806_init_sensor,
> +	.is_valid_bit = BIT(16),
> +	.temp_shift = 0,
> +	.temp_mask = 0x3ff,
> +	.coef_b = -150000LL,
> +	.coef_m = 423ULL,
> +	.coef_div = 1,
> +	.inverted = true,
> +	.signed_sample = true,
> +	.needs_control0 = true,
> +};
> +
>  static const struct of_device_id armada_thermal_id_table[] = {
>  	{
>  		.compatible = "marvell,armadaxp-thermal",
> @@ -257,6 +297,10 @@ static const struct of_device_id armada_thermal_id_table[] = {
>  		.data       = &armada380_data,
>  	},
>  	{
> +		.compatible = "marvell,armada-ap806-thermal",
> +		.data       = &armada_ap806_data,
> +	},
> +	{
>  		/* sentinel */
>  	},
>  };
> -- 
> 2.11.0
>

-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH v5 07/11] thermal: armada: Add support for Armada CP110
From: Gregory CLEMENT @ 2017-12-20 10:56 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Zhang Rui, Eduardo Valentin, Rob Herring, Mark Rutland, linux-pm,
	devicetree, linux-arm-kernel, Thomas Petazzoni, Antoine Tenart,
	Nadav Haklai, Baruch Siach, David Sniatkiwicz
In-Reply-To: <20171219135719.9531-8-miquel.raynal@free-electrons.com>

Hi Miquel,
 
 On mar., déc. 19 2017, Miquel Raynal <miquel.raynal@free-electrons.com> wrote:

> From: Baruch Siach <baruch@tkos.co.il>
>
> The CP110 component is integrated in the Armada 8k and 7k lines of
> processors.
>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> [<miquel.raynal@free-electrons.com>: renamed the register pointers as
> well as some definitions related to the new register names and
> simplified the init sequence for Armada 380]
> Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
> Reviewed-by: Gregory CLEMENT <gregory.clement@free-electrons.com>

Here again, on Armada 7040 DB and Machitobin, the temperature value
looks coherent:

Tested-by: Gregory CLEMENT <gregory.clement@free-electrons.com>

Gregory


> ---
>  drivers/thermal/armada_thermal.c | 33 ++++++++++++++++++++++++++-------
>  1 file changed, 26 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
> index c7dcac39cbf9..3785b5248bf5 100644
> --- a/drivers/thermal/armada_thermal.c
> +++ b/drivers/thermal/armada_thermal.c
> @@ -37,7 +37,6 @@
>  #define A375_UNIT_CONTROL_MASK		0x7
>  #define A375_READOUT_INVERT		BIT(15)
>  #define A375_HW_RESETn			BIT(8)
> -#define A380_HW_RESET			BIT(8)
>  
>  /* Legacy bindings */
>  #define LEGACY_CONTROL_MEM_LEN		0x4
> @@ -52,6 +51,10 @@
>  #define CONTROL0_TSEN_RESET		BIT(1)
>  #define CONTROL0_TSEN_ENABLE		BIT(2)
>  
> +/* EXT_TSEN refers to the external temperature sensors, out of the AP */
> +#define CONTROL1_EXT_TSEN_SW_RESET	BIT(7)
> +#define CONTROL1_EXT_TSEN_HW_RESETn	BIT(8)
> +
>  struct armada_thermal_data;
>  
>  /* Marvell EBU Thermal Sensor Dev Structure */
> @@ -153,12 +156,11 @@ static void armada380_init_sensor(struct platform_device *pdev,
>  {
>  	u32 reg = readl_relaxed(priv->control1);
>  
> -	/* Reset hardware once */
> -	if (!(reg & A380_HW_RESET)) {
> -		reg |= A380_HW_RESET;
> -		writel(reg, priv->control1);
> -		msleep(10);
> -	}
> +	/* Disable the HW/SW reset */
> +	reg |= CONTROL1_EXT_TSEN_HW_RESETn;
> +	reg &= ~CONTROL1_EXT_TSEN_SW_RESET;
> +	writel(reg, priv->control1);
> +	msleep(10);
>  }
>  
>  static void armada_ap806_init_sensor(struct platform_device *pdev,
> @@ -279,6 +281,19 @@ static const struct armada_thermal_data armada_ap806_data = {
>  	.needs_control0 = true,
>  };
>  
> +static const struct armada_thermal_data armada_cp110_data = {
> +	.is_valid = armada_is_valid,
> +	.init_sensor = armada380_init_sensor,
> +	.is_valid_bit = BIT(10),
> +	.temp_shift = 0,
> +	.temp_mask = 0x3ff,
> +	.coef_b = 1172499100ULL,
> +	.coef_m = 2000096ULL,
> +	.coef_div = 4201,
> +	.inverted = true,
> +	.needs_control0 = true,
> +};
> +
>  static const struct of_device_id armada_thermal_id_table[] = {
>  	{
>  		.compatible = "marvell,armadaxp-thermal",
> @@ -301,6 +316,10 @@ static const struct of_device_id armada_thermal_id_table[] = {
>  		.data       = &armada_ap806_data,
>  	},
>  	{
> +		.compatible = "marvell,armada-cp110-thermal",
> +		.data       = &armada_cp110_data,
> +	},
> +	{
>  		/* sentinel */
>  	},
>  };
> -- 
> 2.11.0
>

-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply

* Re: [PATCH v4 33/36] net: faraday add nds32 support.
From: kbuild test robot @ 2017-12-20 11:03 UTC (permalink / raw)
  Cc: kbuild-all, greentime, linux-kernel, arnd, linux-arch, tglx,
	jason, marc.zyngier, robh+dt, netdev, deanbo422, devicetree, viro,
	dhowells, will.deacon, daniel.lezcano, linux-serial,
	geert.uytterhoeven, linus.walleij, mark.rutland, greg, ren_guo,
	pombredanne, green.hu
In-Reply-To: <95be78502aa406f106ecbe87e751a45333883b1f.1513577007.git.green.hu@gmail.com>

Hi Greentime,

I love your patch! Perhaps something to improve:

[auto build test WARNING on tip/timers/core]
[cannot apply to linus/master v4.15-rc4 next-20171220]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Greentime-Hu/Andes-nds32-Linux-Kernel/20171220-155937
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)


vim +205 drivers/net/ethernet/faraday/ftmac100.c

8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  199  
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  200  /******************************************************************************
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  201   * internal functions (receive descriptor)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  202   *****************************************************************************/
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  203  static bool ftmac100_rxdes_first_segment(struct ftmac100_rxdes *rxdes)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  204  {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 @205  	return rxdes->rxdes0 & cpu_to_le32(FTMAC100_RXDES0_FRS);
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  206  }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  207  
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  208  static bool ftmac100_rxdes_last_segment(struct ftmac100_rxdes *rxdes)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  209  {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  210  	return rxdes->rxdes0 & cpu_to_le32(FTMAC100_RXDES0_LRS);
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  211  }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  212  
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  213  static bool ftmac100_rxdes_owned_by_dma(struct ftmac100_rxdes *rxdes)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  214  {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 @215  	return rxdes->rxdes0 & cpu_to_le32(FTMAC100_RXDES0_RXDMA_OWN);
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  216  }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  217  
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  218  static void ftmac100_rxdes_set_dma_own(struct ftmac100_rxdes *rxdes)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  219  {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  220  	/* clear status bits */
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 @221  	rxdes->rxdes0 = cpu_to_le32(FTMAC100_RXDES0_RXDMA_OWN);
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  222  }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  223  
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  224  static bool ftmac100_rxdes_rx_error(struct ftmac100_rxdes *rxdes)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  225  {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  226  	return rxdes->rxdes0 & cpu_to_le32(FTMAC100_RXDES0_RX_ERR);
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  227  }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  228  
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  229  static bool ftmac100_rxdes_crc_error(struct ftmac100_rxdes *rxdes)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  230  {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  231  	return rxdes->rxdes0 & cpu_to_le32(FTMAC100_RXDES0_CRC_ERR);
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  232  }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  233  
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  234  static bool ftmac100_rxdes_frame_too_long(struct ftmac100_rxdes *rxdes)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  235  {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  236  	return rxdes->rxdes0 & cpu_to_le32(FTMAC100_RXDES0_FTL);
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  237  }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  238  
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  239  static bool ftmac100_rxdes_runt(struct ftmac100_rxdes *rxdes)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  240  {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  241  	return rxdes->rxdes0 & cpu_to_le32(FTMAC100_RXDES0_RUNT);
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  242  }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  243  
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  244  static bool ftmac100_rxdes_odd_nibble(struct ftmac100_rxdes *rxdes)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  245  {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  246  	return rxdes->rxdes0 & cpu_to_le32(FTMAC100_RXDES0_RX_ODD_NB);
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  247  }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  248  
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  249  static unsigned int ftmac100_rxdes_frame_length(struct ftmac100_rxdes *rxdes)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  250  {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 @251  	return le32_to_cpu(rxdes->rxdes0) & FTMAC100_RXDES0_RFL;
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  252  }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  253  
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  254  static bool ftmac100_rxdes_multicast(struct ftmac100_rxdes *rxdes)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  255  {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  256  	return rxdes->rxdes0 & cpu_to_le32(FTMAC100_RXDES0_MULTICAST);
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  257  }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  258  
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  259  static void ftmac100_rxdes_set_buffer_size(struct ftmac100_rxdes *rxdes,
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  260  					   unsigned int size)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  261  {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 @262  	rxdes->rxdes1 &= cpu_to_le32(FTMAC100_RXDES1_EDORR);
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  263  	rxdes->rxdes1 |= cpu_to_le32(FTMAC100_RXDES1_RXBUF_SIZE(size));
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  264  }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  265  
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  266  static void ftmac100_rxdes_set_end_of_ring(struct ftmac100_rxdes *rxdes)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  267  {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  268  	rxdes->rxdes1 |= cpu_to_le32(FTMAC100_RXDES1_EDORR);
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  269  }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  270  
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  271  static void ftmac100_rxdes_set_dma_addr(struct ftmac100_rxdes *rxdes,
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  272  					dma_addr_t addr)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  273  {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 @274  	rxdes->rxdes2 = cpu_to_le32(addr);
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  275  }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  276  

:::::: The code at line 205 was first introduced by commit
:::::: 8d77c036b57cf813d838f859e11b6a188acdb1fb net: add Faraday FTMAC100 10/100 Ethernet driver

:::::: TO: Po-Yu Chuang <ratbert@faraday-tech.com>
:::::: CC: David S. Miller <davem@davemloft.net>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

^ permalink raw reply

* RE: [PATCH v3 2/5] dt-bindings: pwm: rcar: Document r8a774[35] PWM bindings
From: Fabrizio Castro @ 2017-12-20 11:15 UTC (permalink / raw)
  To: Simon Horman
  Cc: Thierry Reding, Rob Herring, Mark Rutland,
	linux-pwm@vger.kernel.org, devicetree@vger.kernel.org,
	Geert Uytterhoeven, Chris Paterson, Biju Das,
	linux-renesas-soc@vger.kernel.org
In-Reply-To: <20171220101223.kwnm7kpf7hssuxbc@verge.net.au>

Hello Simon,

> Subject: Re: [PATCH v3 2/5] dt-bindings: pwm: rcar: Document r8a774[35] PWM bindings
>
> On Wed, Dec 20, 2017 at 09:54:14AM +0000, Fabrizio Castro wrote:
> > Hello Simon,
> >
> > > Subject: Re: [PATCH v3 2/5] dt-bindings: pwm: rcar: Document r8a774[35] PWM bindings
> > >
> > > On Tue, Dec 19, 2017 at 01:34:57PM +0000, Fabrizio Castro wrote:
> > > > This patch adds compatible strings specific to r8a774[35], no driver
> > > > change is needed as the fallback compatible string will activate the
> > > > right code. Also, this patch replaces the example with a DT snippet used
> > > > for adding PWM0 support to an r8a7743 based platform.
> > >
> > > What is the motivation for updating the example?
> >
> > I am sorry I forgot to copy the explanation across from the first version of the patch:
> > https://patchwork.kernel.org/patch/10111831/
> >
> > "the reason for replacing the example with one of a different SoC is that
> > the new example refers to recent code from a real use case. I hope that's ok."
> >
> > Basically the r8a7743 will be the first platform with full upstream support, and I believe it is better to have up-to-date examples
> proven to work in the documentation.
>
> Thanks, that sounds reasonable.
>
> >
> > > Could it be stated here?
> >
> > Shall I send a new version for this?
>
> That would be best in my opinion.

Thank you for your feedback, I'll send a new version separately (not in the context of this series anymore as the pending patches from this series are dt-bindings related) to enhance the changelog.

Cheers,
Fab


[https://www2.renesas.eu/media/email/unicef_2017.jpg]

This Christmas, instead of sending out cards, Renesas Electronics Europe have decided to support Unicef with a donation. For further details click here<https://www.unicef.org/> to find out about the valuable work they do, helping children all over the world.
We would like to take this opportunity to wish you a Merry Christmas and a prosperous New Year.



Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.

^ permalink raw reply

* [PATCH v4] dt-bindings: pwm: rcar: Document r8a774[35] PWM bindings
From: Fabrizio Castro @ 2017-12-20 11:15 UTC (permalink / raw)
  To: Thierry Reding, Rob Herring, Mark Rutland
  Cc: Fabrizio Castro, linux-pwm, devicetree, Simon Horman,
	Geert Uytterhoeven, Chris Paterson, Biju Das, linux-renesas-soc

This patch adds compatible strings specific to r8a774[35], no driver
change is needed as the fallback compatible string will activate the
right code.

Also, this patch replaces the example with a DT snippet used
for adding PWM0 support to an r8a7743 based platform as the r8a7743 is
now the first platform fully compatible with this driver and its PWM DT
nodes refer to up-to-date code.

Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Reviewed-by: Biju Das <biju.das@bp.renesas.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3->v4:
* The changelog now explains why the patch is replacing the example.

 Documentation/devicetree/bindings/pwm/renesas,pwm-rcar.txt | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/pwm/renesas,pwm-rcar.txt b/Documentation/devicetree/bindings/pwm/renesas,pwm-rcar.txt
index 74c1180..f3bba59 100644
--- a/Documentation/devicetree/bindings/pwm/renesas,pwm-rcar.txt
+++ b/Documentation/devicetree/bindings/pwm/renesas,pwm-rcar.txt
@@ -2,6 +2,8 @@
 
 Required Properties:
 - compatible: should be "renesas,pwm-rcar" and one of the following.
+ - "renesas,pwm-r8a7743": for RZ/G1M
+ - "renesas,pwm-r8a7745": for RZ/G1E
  - "renesas,pwm-r8a7778": for R-Car M1A
  - "renesas,pwm-r8a7779": for R-Car H1
  - "renesas,pwm-r8a7790": for R-Car H2
@@ -17,13 +19,15 @@ Required Properties:
 - pinctrl-0: phandle, referring to a default pin configuration node.
 - pinctrl-names: Set to "default".
 
-Example: R8A7790 (R-Car H2) PWM Timer node
+Example: R8A7743 (RZ/G1M) PWM Timer node
 
 	pwm0: pwm@e6e30000 {
-		compatible = "renesas,pwm-r8a7790", "renesas,pwm-rcar";
+		compatible = "renesas,pwm-r8a7743", "renesas,pwm-rcar";
 		reg = <0 0xe6e30000 0 0x8>;
+		clocks = <&cpg CPG_MOD 523>;
+		power-domains = <&sysc R8A7743_PD_ALWAYS_ON>;
+		resets = <&cpg 523>;
 		#pwm-cells = <2>;
-		clocks = <&mstp5_clks R8A7790_CLK_PWM>;
 		pinctrl-0 = <&pwm0_pins>;
 		pinctrl-names = "default";
 	};
-- 
2.7.4

^ permalink raw reply related

* RE: [PATCH v2 2/2] ARM: dts: r8a7743: Add thermal device to DT
From: Biju Das @ 2017-12-20 11:36 UTC (permalink / raw)
  To: Simon Horman
  Cc: Zhang Rui, Eduardo Valentin, Rob Herring, Mark Rutland,
	Magnus Damm, Chris Paterson, Fabrizio Castro,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
In-Reply-To: <20171220085036.gdcnbhonyqlewyi4-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>

Hi Simon,

Just noticed that

# make dtbs W=1 is giving below warning message.

arch/arm/boot/dts/r8a7743-iwg20d-q7-dbcm-ca.dtb: Warning (simple_bus_reg): Node /soc/thermal-zones missing or empty reg/ranges property

Do you prefer a fix patch or a v2 ?

Regards,
Biju


> -----Original Message-----
> From: Simon Horman [mailto:horms-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org]
> Sent: 20 December 2017 08:51
> To: Biju Das <biju.das-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
> Cc: Zhang Rui <rui.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>; Eduardo Valentin
> <edubezval-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>; Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>; Mark Rutland
> <mark.rutland-5wv7dgnIgG8@public.gmane.org>; Magnus Damm <magnus.damm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>;
> Chris Paterson <Chris.Paterson2-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>; Fabrizio Castro
> <fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>; devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-renesas-
> soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Subject: Re: [PATCH v2 2/2] ARM: dts: r8a7743: Add thermal device to DT
>
> On Tue, Dec 19, 2017 at 01:17:29PM +0000, Biju Das wrote:
> > This patch instantiates the thermal sensor module with thermal-zone
> > support.
> >
> > This patch is based on the commit cac68a56e34b
> > ("ARM: dts: r8a7791: enable to use thermal-zone") by Kuninori Morimoto.
> >
> > Signed-off-by: Biju Das <biju.das-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
> > Reviewed-by: Fabrizio Castro <fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
> > Reviewed-by: Geert Uytterhoeven <geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
> > ---
> > v1->v2
> >  * Fixed the size.
>
> Thanks, applied.


[https://www2.renesas.eu/media/email/unicef_2017.jpg]

This Christmas, instead of sending out cards, Renesas Electronics Europe have decided to support Unicef with a donation. For further details click here<https://www.unicef.org/> to find out about the valuable work they do, helping children all over the world.
We would like to take this opportunity to wish you a Merry Christmas and a prosperous New Year.



Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 1/4] arm64: dts: renesas: r8a7795: add usb3_phy node
From: Simon Horman @ 2017-12-20 11:42 UTC (permalink / raw)
  To: Yoshihiro Shimoda
  Cc: magnus.damm-Re5JQEeQqe8AvxtiuMwx3w,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1512640542-10380-2-git-send-email-yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>

On Thu, Dec 07, 2017 at 06:55:39PM +0900, Yoshihiro Shimoda wrote:
> This patch adds USB3.0 PHY node for r8a7795.
> 
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
> ---
>  arch/arm64/boot/dts/renesas/r8a7795.dtsi | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
> index 6db4f10..9710814 100644
> --- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi
> +++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
> @@ -184,6 +184,19 @@
>  		clock-frequency = <0>;
>  	};
>  
> +	/* External USB clocks - can be overridden by the board */
> +	usb3s0_clk: usb3s0 {
> +		compatible = "fixed-clock";
> +		#clock-cells = <0>;
> +		clock-frequency = <0>;
> +	};
> +
> +	usb_extal_clk: usb_extal {
> +		compatible = "fixed-clock";
> +		#clock-cells = <0>;
> +		clock-frequency = <0>;
> +	};
> +
>  	soc: soc {
>  		compatible = "simple-bus";
>  		interrupt-parent = <&gic>;
> @@ -1643,6 +1656,19 @@
>  			iommus = <&ipmmu_hc 2>;
>  		};
>  
> +		usb3_phy0: usb-phy@e65ee000 {
> +			compatible = "renesas,r8a7795-usb3-phy",
> +				     "renesas,rcar-gen3-usb3-phy";
> +			reg = <0 0xe65ee000 0 0x90>;
> +			clocks = <&cpg CPG_MOD 328>, <&usb3s0_clk>,
> +				 <&usb_extal_clk>;
> +			clock-names = "usb3-if", "usb3s_clk", "usb_extal";
> +			power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
> +			resets = <&cpg 328>;
> +			#phy-cells = <0>;
> +			status = "disabled";
> +		};
> +
>  		xhci0: usb@ee000000 {
>  			compatible = "renesas,xhci-r8a7795", "renesas,rcar-gen3-xhci";
>  			reg = <0 0xee000000 0 0xc00>;


Hi Shimoda-san,

I have applied this patch with some minor updates.

1. There was some fuzz when applying the patch which I resolved.
2. I shifted the _clk nodes to the bottom of the file to
   preserve alphabetical order of the sub-nodes of the root node.
   This ordering is new and probably was not the case when you submitted
   the patch (it probably also explains the fuzz).

What I have applied is as follows:

From: Yoshihiro Shimoda <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
Subject: [PATCH] arm64: dts: renesas: r8a7795: add usb3_phy node

This patch adds USB3.0 PHY node for r8a7795.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
---
 arch/arm64/boot/dts/renesas/r8a7795.dtsi | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
index 62dfc7781cc1..d12df6f2ff09 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
@@ -1631,6 +1631,19 @@
 			iommus = <&ipmmu_hc 2>;
 		};
 
+		usb3_phy0: usb-phy@e65ee000 {
+			compatible = "renesas,r8a7795-usb3-phy",
+				     "renesas,rcar-gen3-usb3-phy";
+			reg = <0 0xe65ee000 0 0x90>;
+			clocks = <&cpg CPG_MOD 328>, <&usb3s0_clk>,
+				 <&usb_extal_clk>;
+			clock-names = "usb3-if", "usb3s_clk", "usb_extal";
+			power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
+			resets = <&cpg 328>;
+			#phy-cells = <0>;
+			status = "disabled";
+		};
+
 		xhci0: usb@ee000000 {
 			compatible = "renesas,xhci-r8a7795", "renesas,rcar-gen3-xhci";
 			reg = <0 0xee000000 0 0xc00>;
@@ -2380,4 +2393,17 @@
 			};
 		};
 	};
+
+	/* External USB clocks - can be overridden by the board */
+	usb3s0_clk: usb3s0 {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <0>;
+	};
+
+	usb_extal_clk: usb_extal {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <0>;
+	};
 };
-- 
2.11.0


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* Re: [PATCH 3/4] arm64: dts: renesas: salvator-common: enable usb3_phy0 node
From: Simon Horman @ 2017-12-20 11:43 UTC (permalink / raw)
  To: Yoshihiro Shimoda
  Cc: magnus.damm-Re5JQEeQqe8AvxtiuMwx3w,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1512640542-10380-4-git-send-email-yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>

On Thu, Dec 07, 2017 at 06:55:41PM +0900, Yoshihiro Shimoda wrote:
> This patch enables usb3_phy0 node for Salvator-X[S].
> 
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>

Thanks, applied.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox