Re: [PATCH RFC 2/2] ARM: dts: imx: add devicetree for Tolino Shine 2 HD

2020-08-26 Thread Andreas Kemnade
On Sun, 16 Aug 2020 14:54:41 +0200
Jonathan Neuschäfer  wrote:

> On Sat, Aug 15, 2020 at 09:33:36PM +0200, Andreas Kemnade wrote:
> > This adds a devicetree for the Tolino Shine 2 HD Ebook reader. It is based
> > on boards marked with "37NB-E60QF0+4A2". It is equipped with an i.MX6SL
> > SoC.
> > 
> > Expected to work:
> > - Buttons
> > - Wifi
> > - Touchscreen
> > - LED
> > - uSD
> > - USB
> > - RTC
> > 
> > Not working due to missing drivers:
> > - Backlight (requires NTXEC driver)
> > - EPD
> > 
> > Not working due to unknown reasons:
> > - deep sleep (echo standby >/sys/power/state works),
> >   wakeup fails when imx_gpc_pre_suspend(true) was called.
> > 
> > Signed-off-by: Andreas Kemnade 
> > ---
> > Reason for RFC: The suspend trouble might be caused by bad devicetree.
> > But as the devicetree is already useful I decided to submit it.  
> [...]
> > +++ b/arch/arm/boot/dts/imx6sl-tolino-shine2hd.dts
> > @@ -0,0 +1,582 @@
> > +// SPDX-License-Identifier: (GPL-2.0)  
> 
> I don't think the parentheses are required when you don't have a logical
> operator (OR) in the SPDX expression.
> 
> > + {
> > +   pinctrl-names = "default","sleep";
> > +   pinctrl-0 = <_i2c1>;
> > +   pinctrl-1 = <_i2c1_sleep>;
> > +   status = "okay";
> > +
> > +   /* TODO: embedded controller at 0x43 (driver missing) */  
> 
> Sorry for the delay, BTW. I'm still (slowly) working on v2.
> 
> > +   ricoh619: pmic@32 {
> > +   compatible = "ricoh,rc5t619";
> > +   pinctrl-names = "default";
> > +   pinctrl-0 = <_ricoh_gpio>;
> > +   reg = <0x32>;
> > +   interrupt-parent = <>;
> > +   interrupts = <11 IRQ_TYPE_EDGE_FALLING>;
> > +   system-power-controller;
> > +
> > +   regulators {  
> 
> How did you derive the regulator voltages?
> 
Several sources:
- deriving from the existing device trees,
- looking for board specific variances in
board-mx6sl_ntx.c of the Tolino kernel, 
- looking for comments in the file.

I compared a register dump of the PMIC from both the vendor kernel
and my devicetree and found no significant differences.


> > +   pinctrl_hog: hoggrp {
> > +   fsl,pins = <
> > +   MX6SL_PAD_LCD_DAT0__GPIO2_IO20  0x79
> > +   MX6SL_PAD_LCD_DAT1__GPIO2_IO21  0x79
> > +   MX6SL_PAD_LCD_DAT2__GPIO2_IO22  0x79
> > +   MX6SL_PAD_LCD_DAT3__GPIO2_IO23  0x79
> > +   MX6SL_PAD_LCD_DAT4__GPIO2_IO24  0x79
> > +   MX6SL_PAD_LCD_DAT5__GPIO2_IO25  0x79
> > +   MX6SL_PAD_LCD_DAT6__GPIO2_IO26  0x79
> > +   MX6SL_PAD_LCD_DAT7__GPIO2_IO27  0x79
> > +   MX6SL_PAD_LCD_DAT8__GPIO2_IO28  0x79
> > +   MX6SL_PAD_LCD_DAT9__GPIO2_IO29  0x79
> > +   MX6SL_PAD_LCD_DAT10__GPIO2_IO30 0x79
> > +   MX6SL_PAD_LCD_DAT11__GPIO2_IO31 0x79
> > +   MX6SL_PAD_LCD_DAT12__GPIO3_IO00 0x79
> > +   MX6SL_PAD_LCD_DAT13__GPIO3_IO01 0x79
> > +   MX6SL_PAD_LCD_DAT14__GPIO3_IO02 0x79
> > +   MX6SL_PAD_LCD_DAT15__GPIO3_IO03 0x79
> > +   MX6SL_PAD_LCD_DAT16__GPIO3_IO04 0x79
> > +   MX6SL_PAD_LCD_DAT17__GPIO3_IO05 0x79
> > +   MX6SL_PAD_LCD_DAT18__GPIO3_IO06 0x79
> > +   MX6SL_PAD_LCD_DAT19__GPIO3_IO07 0x79
> > +   MX6SL_PAD_LCD_DAT20__GPIO3_IO08 0x79
> > +   MX6SL_PAD_LCD_DAT21__GPIO3_IO09 0x79
> > +   MX6SL_PAD_LCD_DAT22__GPIO3_IO10 0x79
> > +   MX6SL_PAD_LCD_DAT23__GPIO3_IO11 0x79
> > +   MX6SL_PAD_LCD_CLK__GPIO2_IO15   0x79
> > +   MX6SL_PAD_LCD_ENABLE__GPIO2_IO160x79
> > +   MX6SL_PAD_LCD_HSYNC__GPIO2_IO17 0x79
> > +   MX6SL_PAD_LCD_VSYNC__GPIO2_IO18 0x79
> > +   MX6SL_PAD_LCD_RESET__GPIO2_IO19 0x79
> > +   MX6SL_PAD_KEY_COL3__GPIO3_IO30  0x79
> > +   MX6SL_PAD_KEY_ROW7__GPIO4_IO07  0x79
> > +   MX6SL_PAD_ECSPI2_MOSI__GPIO4_IO13   0x79
> > +   MX6SL_PAD_KEY_COL5__GPIO4_IO02  0x79
> > +   MX6SL_PAD_KEY_ROW6__GPIO4_IO05  0x79
> > +   >;
> > +   };  
> 
> Why are there so many hogged pins? Will some of them receive a proper
> configuration once the EPDC driver is implemented?
> 
I copied them over and found no hints in the
Tolino kernel that it is a bad idea.

Regards,
Andreas


Re: [PATCH RFC 2/2] ARM: dts: imx: add devicetree for Tolino Shine 2 HD

2020-08-23 Thread Andreas Kemnade
On Sun, 23 Aug 2020 09:42:31 +0800
Shawn Guo  wrote:

> On Sat, Aug 15, 2020 at 09:33:36PM +0200, Andreas Kemnade wrote:
> > This adds a devicetree for the Tolino Shine 2 HD Ebook reader. It is based
> > on boards marked with "37NB-E60QF0+4A2". It is equipped with an i.MX6SL
> > SoC.
> > 
> > Expected to work:
> > - Buttons
> > - Wifi
> > - Touchscreen
> > - LED
> > - uSD
> > - USB
> > - RTC
> > 
> > Not working due to missing drivers:
> > - Backlight (requires NTXEC driver)
> > - EPD
> > 
> > Not working due to unknown reasons:
> > - deep sleep (echo standby >/sys/power/state works),
> >   wakeup fails when imx_gpc_pre_suspend(true) was called.
> > 
> > Signed-off-by: Andreas Kemnade 
> > ---
> > Reason for RFC: The suspend trouble might be caused by bad devicetree.
> > But as the devicetree is already useful I decided to submit it.
> > 
> >  arch/arm/boot/dts/Makefile   |   1 +
> >  arch/arm/boot/dts/imx6sl-tolino-shine2hd.dts | 582 +++
> >  2 files changed, 583 insertions(+)
> >  create mode 100644 arch/arm/boot/dts/imx6sl-tolino-shine2hd.dts
> > 
> > diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> > index e6a1cac0bfc7..c65fa3852246 100644
> > --- a/arch/arm/boot/dts/Makefile
> > +++ b/arch/arm/boot/dts/Makefile
> > @@ -581,6 +581,7 @@ dtb-$(CONFIG_SOC_IMX6Q) += \
> > imx6qp-zii-rdu2.dtb
> >  dtb-$(CONFIG_SOC_IMX6SL) += \
> > imx6sl-evk.dtb \
> > +   imx6sl-tolino-shine2hd.dtb \
> > imx6sl-tolino-shine3.dtb \
> > imx6sl-warp.dtb
> >  dtb-$(CONFIG_SOC_IMX6SLL) += \
> > diff --git a/arch/arm/boot/dts/imx6sl-tolino-shine2hd.dts 
> > b/arch/arm/boot/dts/imx6sl-tolino-shine2hd.dts
> > new file mode 100644
> > index ..7b28e19a1d98
> > --- /dev/null
> > +++ b/arch/arm/boot/dts/imx6sl-tolino-shine2hd.dts
> > @@ -0,0 +1,582 @@
> > +// SPDX-License-Identifier: (GPL-2.0)
> > +/*
> > + * Device tree for the Tolino Shine 2 HD ebook reader
> > + *
> > + * Name on mainboard is: 37NB-E60QF0+4A2
> > + * Serials start with: E60QF2
> > + *
> > + * Copyright 2020 Andreas Kemnade
> > + */
> > +
> > +/dts-v1/;
> > +
> > +#include 
> > +#include 
> > +#include "imx6sl.dtsi"
> > +
> > +/ {
> > +   model = "Tolino Shine 2 HD";
> > +   compatible = "kobo,tolino-shine2hd", "fsl,imx6sl";
> > +
> > +   chosen {
> > +   stdout-path = 
> > +   };
> > +
> > +   gpio_keys: gpio-keys {
> > +   compatible = "gpio-keys";
> > +   pinctrl-names = "default";
> > +   pinctrl-0 = <_gpio_keys>;
> > +
> > +   cover {
> > +   label = "Cover";
> > +   gpios = < 12 GPIO_ACTIVE_LOW>;
> > +   linux,code = ;
> > +   linux,input-type = ;
> > +   wakeup-source;
> > +   };
> > +
> > +   fl {
> > +   label = "Frontlight";
> > +   gpios = < 26 GPIO_ACTIVE_LOW>;
> > +   linux,code = ;
> > +   };
> > +
> > +   home {
> > +   label = "Home";
> > +   gpios = < 25 GPIO_ACTIVE_LOW>;
> > +   linux,code = ;
> > +   };
> > +
> > +   power {
> > +   label = "Power";
> > +   gpios = < 8 GPIO_ACTIVE_LOW>;
> > +   linux,code = ;
> > +   wakeup-source;
> > +   };
> > +   };
> > +
> > +   leds: leds {
> > +   compatible = "gpio-leds";
> > +   pinctrl-names = "default";
> > +   pinctrl-0 = <_led>;
> > +
> > +   on {
> > +   label = "tolinoshine2hd:white:on";
> > +   gpios = < 13 GPIO_ACTIVE_LOW>;
> > +   linux,default-trigger = "timer";
> > +   };
> > +   };
> > +
> > +   memory@8000 {
> > +   device_type = "memory";
> > +   reg = <0x8000 0x2000>;
> > +   };
> > +
> > +   reg_wifi: regulator-wifi {
> > +   compatible = "regulator-fixed";
> > +   pinctrl-names = "default";
> > +   pinctrl-0 = <_wifi_power>;
> > +   regulator-name = "SD3_SPWR";
> > +   regulator-min-microvolt = <300>;
> > +   regulator-max-microvolt = <300>;
> > +   gpio = < 29 GPIO_ACTIVE_HIGH>;  
> 
> Missing enable-active-high?
> 
no. I should rather use GPIO_ACTIVE_LOW to avoid that confusion.
corresponding code in vendor kernel is the function
_ntx_wifi_power_ctrl()


Regards,
Andreas


Re: [PATCH RFC 2/2] ARM: dts: imx: add devicetree for Tolino Shine 2 HD

2020-08-22 Thread Shawn Guo
On Sat, Aug 15, 2020 at 09:33:36PM +0200, Andreas Kemnade wrote:
> This adds a devicetree for the Tolino Shine 2 HD Ebook reader. It is based
> on boards marked with "37NB-E60QF0+4A2". It is equipped with an i.MX6SL
> SoC.
> 
> Expected to work:
> - Buttons
> - Wifi
> - Touchscreen
> - LED
> - uSD
> - USB
> - RTC
> 
> Not working due to missing drivers:
> - Backlight (requires NTXEC driver)
> - EPD
> 
> Not working due to unknown reasons:
> - deep sleep (echo standby >/sys/power/state works),
>   wakeup fails when imx_gpc_pre_suspend(true) was called.
> 
> Signed-off-by: Andreas Kemnade 
> ---
> Reason for RFC: The suspend trouble might be caused by bad devicetree.
> But as the devicetree is already useful I decided to submit it.
> 
>  arch/arm/boot/dts/Makefile   |   1 +
>  arch/arm/boot/dts/imx6sl-tolino-shine2hd.dts | 582 +++
>  2 files changed, 583 insertions(+)
>  create mode 100644 arch/arm/boot/dts/imx6sl-tolino-shine2hd.dts
> 
> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> index e6a1cac0bfc7..c65fa3852246 100644
> --- a/arch/arm/boot/dts/Makefile
> +++ b/arch/arm/boot/dts/Makefile
> @@ -581,6 +581,7 @@ dtb-$(CONFIG_SOC_IMX6Q) += \
>   imx6qp-zii-rdu2.dtb
>  dtb-$(CONFIG_SOC_IMX6SL) += \
>   imx6sl-evk.dtb \
> + imx6sl-tolino-shine2hd.dtb \
>   imx6sl-tolino-shine3.dtb \
>   imx6sl-warp.dtb
>  dtb-$(CONFIG_SOC_IMX6SLL) += \
> diff --git a/arch/arm/boot/dts/imx6sl-tolino-shine2hd.dts 
> b/arch/arm/boot/dts/imx6sl-tolino-shine2hd.dts
> new file mode 100644
> index ..7b28e19a1d98
> --- /dev/null
> +++ b/arch/arm/boot/dts/imx6sl-tolino-shine2hd.dts
> @@ -0,0 +1,582 @@
> +// SPDX-License-Identifier: (GPL-2.0)
> +/*
> + * Device tree for the Tolino Shine 2 HD ebook reader
> + *
> + * Name on mainboard is: 37NB-E60QF0+4A2
> + * Serials start with: E60QF2
> + *
> + * Copyright 2020 Andreas Kemnade
> + */
> +
> +/dts-v1/;
> +
> +#include 
> +#include 
> +#include "imx6sl.dtsi"
> +
> +/ {
> + model = "Tolino Shine 2 HD";
> + compatible = "kobo,tolino-shine2hd", "fsl,imx6sl";
> +
> + chosen {
> + stdout-path = 
> + };
> +
> + gpio_keys: gpio-keys {
> + compatible = "gpio-keys";
> + pinctrl-names = "default";
> + pinctrl-0 = <_gpio_keys>;
> +
> + cover {
> + label = "Cover";
> + gpios = < 12 GPIO_ACTIVE_LOW>;
> + linux,code = ;
> + linux,input-type = ;
> + wakeup-source;
> + };
> +
> + fl {
> + label = "Frontlight";
> + gpios = < 26 GPIO_ACTIVE_LOW>;
> + linux,code = ;
> + };
> +
> + home {
> + label = "Home";
> + gpios = < 25 GPIO_ACTIVE_LOW>;
> + linux,code = ;
> + };
> +
> + power {
> + label = "Power";
> + gpios = < 8 GPIO_ACTIVE_LOW>;
> + linux,code = ;
> + wakeup-source;
> + };
> + };
> +
> + leds: leds {
> + compatible = "gpio-leds";
> + pinctrl-names = "default";
> + pinctrl-0 = <_led>;
> +
> + on {
> + label = "tolinoshine2hd:white:on";
> + gpios = < 13 GPIO_ACTIVE_LOW>;
> + linux,default-trigger = "timer";
> + };
> + };
> +
> + memory@8000 {
> + device_type = "memory";
> + reg = <0x8000 0x2000>;
> + };
> +
> + reg_wifi: regulator-wifi {
> + compatible = "regulator-fixed";
> + pinctrl-names = "default";
> + pinctrl-0 = <_wifi_power>;
> + regulator-name = "SD3_SPWR";
> + regulator-min-microvolt = <300>;
> + regulator-max-microvolt = <300>;
> + gpio = < 29 GPIO_ACTIVE_HIGH>;

Missing enable-active-high?

> + };
> +
> + wifi_pwrseq: wifi_pwrseq {
> + compatible = "mmc-pwrseq-simple";
> + pinctrl-names = "default";
> + pinctrl-0 = <_wifi_reset>;
> + post-power-on-delay-ms = <20>;
> + reset-gpios = < 0 GPIO_ACTIVE_LOW>;
> + };
> +};
> +
> + {
> + pinctrl-names = "default","sleep";
> + pinctrl-0 = <_i2c1>;
> + pinctrl-1 = <_i2c1_sleep>;
> + status = "okay";
> +
> + /* TODO: embedded controller at 0x43 (driver missing) */
> +
> +};
> +
> + {
> + pinctrl-names = "default","sleep";
> + pinctrl-0 = <_i2c2>;
> + pinctrl-1 = <_i2c2_sleep>;
> + clock-frequency = <10>;
> + status = "okay";
> +
> + zforce: touchscreen@50 {
> + compatible = "neonode,zforce";
> + pinctrl-names = "default";
> + pinctrl-0 = <_zforce>;
> + reg = <0x50>;
> +   

Re: [PATCH RFC 2/2] ARM: dts: imx: add devicetree for Tolino Shine 2 HD

2020-08-16 Thread Andreas Kemnade
Hi,

On Sun, 16 Aug 2020 17:57:51 +0200
Jonathan Neuschäfer  wrote:

> On Sun, Aug 16, 2020 at 04:50:58PM +0200, Andreas Kemnade wrote:
> > Hi,
> > 
> > Seems that we have different hardware, so the first question is
> > first the most interesting thing: how much does the hw actually differ,
> > especially do they require different device trees?
> > 
> > Can you provide me a photo of your hardware?
> > Or is it a Shine 3?  
> 
> It is a Shine 2HD
> 
> > 
> > Mine is at https://misc.andi.de1.cc/tolino2.jpg  
> 
> Mine:
> 
> https://raw.githubusercontent.com/wiki/neuschaefer/linux/Tolino-Shine2HD.jpg
> 
> 
> It appears to be the next PCB revision (+4A3 instead of +4A2), but I
> think the PCB layout looks the same. The Realtek-based Wifi module is
> exactly where the CyberTan WC121 was.
> 

From other sources I also think these revisions are same besides wifi.

So the only thing warranting separate dtbs might be the OOB IRQ thing.
In the Tolino sources there is the function dhd_customer_oob_irq_map in
the bcmdhd driver, and it gets its number from this:
drivers/net/wireless/bcmdhd/Makefile:   -DCUSTOMER_HW2 
-DCUSTOM_OOB_GPIO_NUM=127 -DOOB_INTR_ONLY -DHW_OOB

The brcmfmac driver is upstream and has devicetree support, but the
rtl8189fs is not. For the Clara I am using this one:
https://github.com/jwrdegoede/rtl8189ES_linux.git (branch 8189fs)
It has no devicetree support, so things cannot be defined anyway.

On one hand the hardware should be described in the devicetree as good
as possible but on the other hand the OOB IRQ is not mandatory.

Regards,
Andreas


Re: [PATCH RFC 2/2] ARM: dts: imx: add devicetree for Tolino Shine 2 HD

2020-08-16 Thread Jonathan Neuschäfer
On Sun, Aug 16, 2020 at 04:50:58PM +0200, Andreas Kemnade wrote:
> Hi,
> 
> Seems that we have different hardware, so the first question is
> first the most interesting thing: how much does the hw actually differ,
> especially do they require different device trees?
> 
> Can you provide me a photo of your hardware?
> Or is it a Shine 3?

It is a Shine 2HD

> 
> Mine is at https://misc.andi.de1.cc/tolino2.jpg

Mine:

https://raw.githubusercontent.com/wiki/neuschaefer/linux/Tolino-Shine2HD.jpg


It appears to be the next PCB revision (+4A3 instead of +4A2), but I
think the PCB layout looks the same. The Realtek-based Wifi module is
exactly where the CyberTan WC121 was.


Jonathan


signature.asc
Description: PGP signature


Re: [PATCH RFC 2/2] ARM: dts: imx: add devicetree for Tolino Shine 2 HD

2020-08-16 Thread Andreas Kemnade
Hi,

Seems that we have different hardware, so the first question is
first the most interesting thing: how much does the hw actually differ,
especially do they require different device trees?

Can you provide me a photo of your hardware?
Or is it a Shine 3?

Mine is at https://misc.andi.de1.cc/tolino2.jpg

On Sun, 16 Aug 2020 14:54:41 +0200
Jonathan Neuschäfer  wrote:

[...]
> > +
> > + {
> > +   pinctrl-names = "default", "state_100mhz", "state_200mhz", "sleep";
> > +   pinctrl-0 = <_usdhc3>;
> > +   pinctrl-1 = <_usdhc3_100mhz>;
> > +   pinctrl-2 = <_usdhc3_200mhz>;
> > +   pinctrl-3 = <_usdhc3_sleep>;
> > +   vmmc-supply = <_wifi>;
> > +   mmc-pwrseq = <_pwrseq>;
> > +   cap-power-off-card;
> > +   non-removable;
> > +   status = "okay";
> > +
> > +   /* CyberTan WC121 SDIO WiFi */
> > +};  
> 
> The HWCONFIG block from my Shine2HD reports RTL8189 as the Wifi chip
> (value 8 at offset 4), and kernel logs from the vendor kernel appear to
> agree that it's a realtek chip, at least (lines prefixed RTL871X).
> 
Just for the readers with IMX knowledge but without knowledge of the
vendor kernel hacks used here: That block is on a hidden partition of
the boot medium (uSD or eMMC) describing the hardware, the kernel gets
it from the bootloader and it is used e.g. in the board file.

My hwconfig is:
{m_hdr = {cMagicNameA = "HW CONFIG "
 cVersionNameA = "v2.6"
 bHWConfigSize = 62 '>'}
 m_val = {bPCB = 50 '2'
 bKeyPad = 13 '\r'
 bAudioCodec = 0 '\000'
 
bAudioAmp = 0 '\000'
 bWifi = 7 '\a'
 bBT = 0 '\000'
 bMobile = 0 '\000'
 bTouchCtrl = 11 '\v'
 bTouchType = 4 '\004'
 bDisplayCtrl = 7 '\a'
 
bDisplayPanel = 6 '\006'
 bRSensor = 0 '\000'
 bMicroP = 0 '\000'
 bCustomer = 0 '\000'
 bBattery = 1 '\001'
 bLed = 4 '\004'
 bRamSize = 3 '\003'
 
bIFlash = 0 '\000'
 bExternalMem = 0 '\000'
 bRootFsType = 2 '\002'
 bSysPartType = 11 '\v'
 bProgressXHiByte = 1 '\001'
 bProgressXLoByte = 104 'h'
 
bProgressYHiByte = 2 '\002'
 bProgressYLoByte = 228 '\344'
 bProgressCnts = 0 '\000'
 bContentType = 0 '\000'
 bCPU = 5 '\005'
 bUIStyle = 2 '\002'
 
bRamType = 5 '\005'
 bUIConfig = 0 '\000'
 bDisplayResolution = 5 '\005'
 bFrontLight = 13 '\r'
 bCPUFreq = 0 '\000'
 bHallSensor = 1 '\001'
 
bDisplayBusWidth = 0 '\000'
 bFrontLight_Flags = 4 '\004'
 bPCB_Flags = 17 '\021'
 bFrontLight_LED_Driver = 3 '\003'
 bVCOM_10mV_HiByte = 0 '\000'
 
bVCOM_10mV_LoByte = 0 '\000'
 bPCB_REV = 0 '\000'
 bPCB_LVL = 0 '\000'
 bHOME_LED_PWM = 0 '\000'
 bPMIC = 1 '\001'
 bFL_PWM = 0 '\000'
 bRTC = 1 '\001'
 
bBootOpt = 0 '\000'
 bTouch2Ctrl = 0 '\000'
 bTouch2Type = 0 '\000'
 bGPS = 0 '\000'
 bFM = 0 '\000'
 bRSensor2 = 0 '\000'
 bLightSensor = 0 '\000'
 
bTPFWIDByte0 = 0 '\000'
 bTPFWIDByte1 = 0 '\000'
 bTPFWIDByte2 = 0 '\000'
 bTPFWIDByte3 = 0 '\000'
 bTPFWIDByte4 = 0 '\000'
 bTPFWIDByte5 = 0 '\000'
 
bTPFWIDByte6 = 0 '\000'
 bTPFWIDByte7 = 0 '\000'
 bGPU = 0 '\000'
 bPCB_Flags2 = 0 '\000'
 bEPD_Flags = 0 '\000'
 bLAN = 0 '\000'
 bMobileIF = 0 '\000'
 
bPIR = 0 '\000'
 bPanelLaminationSrc = 0 '\000'}
 m_bReserveA = '\000' }


> From my experience with the CyberTan WC121, it has a Broadcom fullmac
> chip inside. Now I wonder where this discrepancy or variability comes
> from.
> 
correct. It uses the brcmfmac driver on mainline and the .
bcmdhd in the vendor kernel

Output on the vendor kernel:
bcmsdh_register: Linux Kernel SDIO/MMC Driver
[bcm_wlan_get_oob_irq-43] gpio 127, irq 383
dhd_conf_set_hw_oob_intr: Enable HW OOB for 43362
F1 signature OK, socitype:0x1 chip:0xa962 rev:0x1 pkg:0x9
DHD: dongle ram size is set to 245760(orig 245760) at 0x0
dhdsdio_probe: Disable prop_txstatus
dhd_conf_set_fw_name_by_chip: 
firmware_path=/system/lib/firmware/wc121/fw_bcm40181a2.bin
wl_create_event_handler(): thread:wl_event_handler:92d started
tsk Enter, tsk = 0xdb501304
p2p0: P2P Interface Registered
dhd_attach(): thread:dhd_watchdog_thread:932 started
dhd_attach(): thread:dhd_dpc:933 started
dhd_attach(): thread:dhd_sysioc:934 started

On mainline:
[   11.686469] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43362-sdio 
for chip BCM43362/1
[   12.282783] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43362-sdio 
for chip BCM43362/1
[   12.387000] brcmfmac: brcmf_c_process_clm_blob: no clm_blob available 
(err=-11), device may have limited channels available
[   12.479403] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43362/1 wl0: May 
16 2018 23:42:49 version 5.90.244 FWID 01-0


> I guess the SDIO setup can deal with different chips (like Broadcom vs.
> Realtek) as long as the board has been designed to always use the same
> reset/power/etc. lines. I don't see any branching based on the 'Wifi'
> HWCONFIG entry in the vendor kernel, so I guess that's the case.
> 
as long as these chips do not use oob interrupts, just sdio,
it should be no problem. The question is just how much our devices
differ.

Regards,
Andreas


Re: [PATCH RFC 2/2] ARM: dts: imx: add devicetree for Tolino Shine 2 HD

2020-08-16 Thread Jonathan Neuschäfer
On Sat, Aug 15, 2020 at 09:33:36PM +0200, Andreas Kemnade wrote:
> This adds a devicetree for the Tolino Shine 2 HD Ebook reader. It is based
> on boards marked with "37NB-E60QF0+4A2". It is equipped with an i.MX6SL
> SoC.
> 
> Expected to work:
> - Buttons
> - Wifi
> - Touchscreen
> - LED
> - uSD
> - USB
> - RTC
> 
> Not working due to missing drivers:
> - Backlight (requires NTXEC driver)
> - EPD
> 
> Not working due to unknown reasons:
> - deep sleep (echo standby >/sys/power/state works),
>   wakeup fails when imx_gpc_pre_suspend(true) was called.
> 
> Signed-off-by: Andreas Kemnade 
> ---
> Reason for RFC: The suspend trouble might be caused by bad devicetree.
> But as the devicetree is already useful I decided to submit it.
[...]
> +++ b/arch/arm/boot/dts/imx6sl-tolino-shine2hd.dts
> @@ -0,0 +1,582 @@
> +// SPDX-License-Identifier: (GPL-2.0)

I don't think the parentheses are required when you don't have a logical
operator (OR) in the SPDX expression.

> + {
> + pinctrl-names = "default","sleep";
> + pinctrl-0 = <_i2c1>;
> + pinctrl-1 = <_i2c1_sleep>;
> + status = "okay";
> +
> + /* TODO: embedded controller at 0x43 (driver missing) */

Sorry for the delay, BTW. I'm still (slowly) working on v2.

> + ricoh619: pmic@32 {
> + compatible = "ricoh,rc5t619";
> + pinctrl-names = "default";
> + pinctrl-0 = <_ricoh_gpio>;
> + reg = <0x32>;
> + interrupt-parent = <>;
> + interrupts = <11 IRQ_TYPE_EDGE_FALLING>;
> + system-power-controller;
> +
> + regulators {

How did you derive the regulator voltages?

> + pinctrl_hog: hoggrp {
> + fsl,pins = <
> + MX6SL_PAD_LCD_DAT0__GPIO2_IO20  0x79
> + MX6SL_PAD_LCD_DAT1__GPIO2_IO21  0x79
> + MX6SL_PAD_LCD_DAT2__GPIO2_IO22  0x79
> + MX6SL_PAD_LCD_DAT3__GPIO2_IO23  0x79
> + MX6SL_PAD_LCD_DAT4__GPIO2_IO24  0x79
> + MX6SL_PAD_LCD_DAT5__GPIO2_IO25  0x79
> + MX6SL_PAD_LCD_DAT6__GPIO2_IO26  0x79
> + MX6SL_PAD_LCD_DAT7__GPIO2_IO27  0x79
> + MX6SL_PAD_LCD_DAT8__GPIO2_IO28  0x79
> + MX6SL_PAD_LCD_DAT9__GPIO2_IO29  0x79
> + MX6SL_PAD_LCD_DAT10__GPIO2_IO30 0x79
> + MX6SL_PAD_LCD_DAT11__GPIO2_IO31 0x79
> + MX6SL_PAD_LCD_DAT12__GPIO3_IO00 0x79
> + MX6SL_PAD_LCD_DAT13__GPIO3_IO01 0x79
> + MX6SL_PAD_LCD_DAT14__GPIO3_IO02 0x79
> + MX6SL_PAD_LCD_DAT15__GPIO3_IO03 0x79
> + MX6SL_PAD_LCD_DAT16__GPIO3_IO04 0x79
> + MX6SL_PAD_LCD_DAT17__GPIO3_IO05 0x79
> + MX6SL_PAD_LCD_DAT18__GPIO3_IO06 0x79
> + MX6SL_PAD_LCD_DAT19__GPIO3_IO07 0x79
> + MX6SL_PAD_LCD_DAT20__GPIO3_IO08 0x79
> + MX6SL_PAD_LCD_DAT21__GPIO3_IO09 0x79
> + MX6SL_PAD_LCD_DAT22__GPIO3_IO10 0x79
> + MX6SL_PAD_LCD_DAT23__GPIO3_IO11 0x79
> + MX6SL_PAD_LCD_CLK__GPIO2_IO15   0x79
> + MX6SL_PAD_LCD_ENABLE__GPIO2_IO160x79
> + MX6SL_PAD_LCD_HSYNC__GPIO2_IO17 0x79
> + MX6SL_PAD_LCD_VSYNC__GPIO2_IO18 0x79
> + MX6SL_PAD_LCD_RESET__GPIO2_IO19 0x79
> + MX6SL_PAD_KEY_COL3__GPIO3_IO30  0x79
> + MX6SL_PAD_KEY_ROW7__GPIO4_IO07  0x79
> + MX6SL_PAD_ECSPI2_MOSI__GPIO4_IO13   0x79
> + MX6SL_PAD_KEY_COL5__GPIO4_IO02  0x79
> + MX6SL_PAD_KEY_ROW6__GPIO4_IO05  0x79
> + >;
> + };

Why are there so many hogged pins? Will some of them receive a proper
configuration once the EPDC driver is implemented?

> +_rtc {
> + /* we are using the RTC in the PMIC, not disabled in imx6sl.dtsi */
> + status = "disabled";

This comment sounds a bit ambiguous (and this potentially confusing). Perhaps:

+   /* we are using the RTC in the PMIC, but this one is not disabled in 
imx6sl.dtsi */

Or even just:

+   /* we are using the RTC in the PMIC */

> + {
> + pinctrl-names = "default", "state_100mhz", "state_200mhz", "sleep";
> + pinctrl-0 = <_usdhc2>;
> + pinctrl-1 = <_usdhc2_100mhz>;
> + pinctrl-2 = <_usdhc2_200mhz>;
> + pinctrl-3 = <_usdhc2_sleep>;
> + non-removable;
> + status = "okay";
> +};

IMHO, please add a comment saying what this MMC controller is connected
to (internal storage?).

> +
> + {
> + pinctrl-names = "default", "state_100mhz", "state_200mhz", "sleep";
> + pinctrl-0 = <_usdhc3>;
> + pinctrl-1 = <_usdhc3_100mhz>;
> + pinctrl-2 = <_usdhc3_200mhz>;
> + pinctrl-3 = <_usdhc3_sleep>;
> + vmmc-supply = <_wifi>;
> + 

[PATCH RFC 2/2] ARM: dts: imx: add devicetree for Tolino Shine 2 HD

2020-08-15 Thread Andreas Kemnade
This adds a devicetree for the Tolino Shine 2 HD Ebook reader. It is based
on boards marked with "37NB-E60QF0+4A2". It is equipped with an i.MX6SL
SoC.

Expected to work:
- Buttons
- Wifi
- Touchscreen
- LED
- uSD
- USB
- RTC

Not working due to missing drivers:
- Backlight (requires NTXEC driver)
- EPD

Not working due to unknown reasons:
- deep sleep (echo standby >/sys/power/state works),
  wakeup fails when imx_gpc_pre_suspend(true) was called.

Signed-off-by: Andreas Kemnade 
---
Reason for RFC: The suspend trouble might be caused by bad devicetree.
But as the devicetree is already useful I decided to submit it.

 arch/arm/boot/dts/Makefile   |   1 +
 arch/arm/boot/dts/imx6sl-tolino-shine2hd.dts | 582 +++
 2 files changed, 583 insertions(+)
 create mode 100644 arch/arm/boot/dts/imx6sl-tolino-shine2hd.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index e6a1cac0bfc7..c65fa3852246 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -581,6 +581,7 @@ dtb-$(CONFIG_SOC_IMX6Q) += \
imx6qp-zii-rdu2.dtb
 dtb-$(CONFIG_SOC_IMX6SL) += \
imx6sl-evk.dtb \
+   imx6sl-tolino-shine2hd.dtb \
imx6sl-tolino-shine3.dtb \
imx6sl-warp.dtb
 dtb-$(CONFIG_SOC_IMX6SLL) += \
diff --git a/arch/arm/boot/dts/imx6sl-tolino-shine2hd.dts 
b/arch/arm/boot/dts/imx6sl-tolino-shine2hd.dts
new file mode 100644
index ..7b28e19a1d98
--- /dev/null
+++ b/arch/arm/boot/dts/imx6sl-tolino-shine2hd.dts
@@ -0,0 +1,582 @@
+// SPDX-License-Identifier: (GPL-2.0)
+/*
+ * Device tree for the Tolino Shine 2 HD ebook reader
+ *
+ * Name on mainboard is: 37NB-E60QF0+4A2
+ * Serials start with: E60QF2
+ *
+ * Copyright 2020 Andreas Kemnade
+ */
+
+/dts-v1/;
+
+#include 
+#include 
+#include "imx6sl.dtsi"
+
+/ {
+   model = "Tolino Shine 2 HD";
+   compatible = "kobo,tolino-shine2hd", "fsl,imx6sl";
+
+   chosen {
+   stdout-path = 
+   };
+
+   gpio_keys: gpio-keys {
+   compatible = "gpio-keys";
+   pinctrl-names = "default";
+   pinctrl-0 = <_gpio_keys>;
+
+   cover {
+   label = "Cover";
+   gpios = < 12 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   linux,input-type = ;
+   wakeup-source;
+   };
+
+   fl {
+   label = "Frontlight";
+   gpios = < 26 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+
+   home {
+   label = "Home";
+   gpios = < 25 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+
+   power {
+   label = "Power";
+   gpios = < 8 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   wakeup-source;
+   };
+   };
+
+   leds: leds {
+   compatible = "gpio-leds";
+   pinctrl-names = "default";
+   pinctrl-0 = <_led>;
+
+   on {
+   label = "tolinoshine2hd:white:on";
+   gpios = < 13 GPIO_ACTIVE_LOW>;
+   linux,default-trigger = "timer";
+   };
+   };
+
+   memory@8000 {
+   device_type = "memory";
+   reg = <0x8000 0x2000>;
+   };
+
+   reg_wifi: regulator-wifi {
+   compatible = "regulator-fixed";
+   pinctrl-names = "default";
+   pinctrl-0 = <_wifi_power>;
+   regulator-name = "SD3_SPWR";
+   regulator-min-microvolt = <300>;
+   regulator-max-microvolt = <300>;
+   gpio = < 29 GPIO_ACTIVE_HIGH>;
+   };
+
+   wifi_pwrseq: wifi_pwrseq {
+   compatible = "mmc-pwrseq-simple";
+   pinctrl-names = "default";
+   pinctrl-0 = <_wifi_reset>;
+   post-power-on-delay-ms = <20>;
+   reset-gpios = < 0 GPIO_ACTIVE_LOW>;
+   };
+};
+
+ {
+   pinctrl-names = "default","sleep";
+   pinctrl-0 = <_i2c1>;
+   pinctrl-1 = <_i2c1_sleep>;
+   status = "okay";
+
+   /* TODO: embedded controller at 0x43 (driver missing) */
+
+};
+
+ {
+   pinctrl-names = "default","sleep";
+   pinctrl-0 = <_i2c2>;
+   pinctrl-1 = <_i2c2_sleep>;
+   clock-frequency = <10>;
+   status = "okay";
+
+   zforce: touchscreen@50 {
+   compatible = "neonode,zforce";
+   pinctrl-names = "default";
+   pinctrl-0 = <_zforce>;
+   reg = <0x50>;
+   interrupt-parent = <>;
+   interrupts = <6 IRQ_TYPE_EDGE_FALLING>;
+   vdd-supply = <_reg>;
+
+   reset-gpios = < 9 GPIO_ACTIVE_LOW>;
+   x-size = <1072>;
+   y-size = <1448>;
+   };
+
+