diff mbox

[V4,1/2] ARM: dts: sun6i: Add dts file for MSI Primo81 tablet

Message ID 1435078949-3383-2-git-send-email-merker@debian.org (mailing list archive)
State New, archived
Headers show

Commit Message

Karsten Merker June 23, 2015, 5:02 p.m. UTC
The MSI Primo81 is an A31s based tablet, with 1G RAM, 16G NAND,
1024x768 IPS LCD display, mono speaker, 0.3 MP front camera, 2.0 MP
rear camera, 3500 mAh battery, gt911 touchscreen, mma8452 accelerometer
and rtl8188etv usb wifi. Has "power", "volume+" and "volume-" buttons
(both volume buttons are also connected to the UBOOT_SEL pin). The
external connectors are represented by MicroSD slot, MiniHDMI, MicroUSB
OTG and 3.5mm headphone jack. More details are available at
    http://linux-sunxi.org/MSI_Primo81

This initial dts file only provides support for mmc, wifi and uart
(there is no external connector for uart though). Graphics can be used
via simplefb. However, without usb otg, there are no reasonable means
to handle user input yet.

Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Signed-off-by: Karsten Merker <merker@debian.org>
---
Changelog:

Version 1

Comments

Maxime Ripard June 25, 2015, 10:44 a.m. UTC | #1
On Tue, Jun 23, 2015 at 07:02:28PM +0200, Karsten Merker wrote:
> The MSI Primo81 is an A31s based tablet, with 1G RAM, 16G NAND,
> 1024x768 IPS LCD display, mono speaker, 0.3 MP front camera, 2.0 MP
> rear camera, 3500 mAh battery, gt911 touchscreen, mma8452 accelerometer
> and rtl8188etv usb wifi. Has "power", "volume+" and "volume-" buttons
> (both volume buttons are also connected to the UBOOT_SEL pin). The
> external connectors are represented by MicroSD slot, MiniHDMI, MicroUSB
> OTG and 3.5mm headphone jack. More details are available at
>     http://linux-sunxi.org/MSI_Primo81
> 
> This initial dts file only provides support for mmc, wifi and uart
> (there is no external connector for uart though). Graphics can be used
> via simplefb. However, without usb otg, there are no reasonable means
> to handle user input yet.
> 
> Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
> Signed-off-by: Karsten Merker <merker@debian.org>
> ---
> Changelog:
> 
> Version 1
> =========
> - Original patch by Siarhei Siamashka
> 
> Version 2
> =========
> - Use symbolic instead of numeric pinctrl values.
> 
> - Change the include syntax from /include/ to #include to make
>   the dts build with current kernels.
> 
> Version 3
> =========
> - Use labels for nodes with modifications in relation to the dtsi
>   instead of replicating the tree structure.
> 
> - Remove the FSF address from the license header as done in
>   http://lists.infradead.org/pipermail/linux-arm-kernel/2015-May/340437.html
>   for the other dts files to remove a checkpatch warning.
> 
> - Add msi to the vendor prefix list.
> 
> - Remove earlyprintk from the default kernel commandline.
> 
> - Replace the console kernel commandline parameter by a
>   /chosen/stdout-path node and add an alias serial0 -> uart0.
> 
> Version 4
> =========
> - Split out the vendor prefix documentation into a separate patch.
> 
> - Add a comment regarding the uart0 accessibility to the corresponding
>   entry in the dts.
> 
>  arch/arm/boot/dts/Makefile               |   3 +-
>  arch/arm/boot/dts/sun6i-a31s-primo81.dts | 103 +++++++++++++++++++++++++++++++
>  2 files changed, 105 insertions(+), 1 deletion(-)
>  create mode 100644 arch/arm/boot/dts/sun6i-a31s-primo81.dts
> 
> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> index 867e6e3..31686c7 100644
> --- a/arch/arm/boot/dts/Makefile
> +++ b/arch/arm/boot/dts/Makefile
> @@ -552,7 +552,8 @@ dtb-$(CONFIG_MACH_SUN6I) += \
>  	sun6i-a31-i7.dtb \
>  	sun6i-a31-m9.dtb \
>  	sun6i-a31-mele-a1000g-quad.dtb \
> -	sun6i-a31s-cs908.dtb
> +	sun6i-a31s-cs908.dtb \
> +	sun6i-a31s-primo81.dtb
>  dtb-$(CONFIG_MACH_SUN7I) += \
>  	sun7i-a20-bananapi.dtb \
>  	sun7i-a20-bananapro.dtb \
> diff --git a/arch/arm/boot/dts/sun6i-a31s-primo81.dts b/arch/arm/boot/dts/sun6i-a31s-primo81.dts
> new file mode 100644
> index 0000000..bd15ee1
> --- /dev/null
> +++ b/arch/arm/boot/dts/sun6i-a31s-primo81.dts
> @@ -0,0 +1,103 @@
> +/*
> + * Copyright 2014 Siarhei Siamashka <siarhei.siamashka@gmail.com>
> + * Copyright 2015 Karsten Merker <merker@debian.org>
> + *
> + * This file is dual-licensed: you can use it either under the terms
> + * of the GPL or the X11 license, at your option. Note that this dual
> + * licensing only applies to this file, and not this project as a
> + * whole.
> + *
> + *  a) This library is free software; you can redistribute it and/or
> + *     modify it under the terms of the GNU General Public License as
> + *     published by the Free Software Foundation; either version 2 of the
> + *     License, or (at your option) any later version.
> + *
> + *     This library 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.
> + *
> + * Or, alternatively,
> + *
> + *  b) Permission is hereby granted, free of charge, to any person
> + *     obtaining a copy of this software and associated documentation
> + *     files (the "Software"), to deal in the Software without
> + *     restriction, including without limitation the rights to use,
> + *     copy, modify, merge, publish, distribute, sublicense, and/or
> + *     sell copies of the Software, and to permit persons to whom the
> + *     Software is furnished to do so, subject to the following
> + *     conditions:
> + *
> + *     The above copyright notice and this permission notice shall be
> + *     included in all copies or substantial portions of the Software.
> + *
> + *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> + *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
> + *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> + *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
> + *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
> + *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> + *     OTHER DEALINGS IN THE SOFTWARE.
> + */
> +
> +/dts-v1/;
> +#include "sun6i-a31s.dtsi"
> +#include "sunxi-common-regulators.dtsi"
> +
> +/ {
> +	model = "MSI Primo81 tablet";
> +	compatible = "msi,primo81", "allwinner,sun6i-a31s";
> +
> +	aliases {
> +		serial0 = &uart0;
> +	};
> +
> +	chosen {
> +		stdout-path = "serial0:115200n8";
> +	};
> +
> +};
> +
> +&ehci0 {
> +	/* rtl8188etv wifi is connected here */

No need to mention it, it's what discoverable buses are made for.

> +	status = "okay";
> +};
> +
> +&mmc0 {
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_primo81>;
> +	vmmc-supply = <&reg_vcc3v0>;
> +	bus-width = <4>;
> +	cd-gpios = <&pio 0 8 GPIO_ACTIVE_HIGH>; /* PA8 */
> +	cd-inverted;
> +	status = "okay";
> +};
> +
> +&pio {
> +	mmc0_cd_pin_primo81: mmc0_cd_pin@0 {
> +		allwinner,pins = "PA8";
> +		allwinner,function = "gpio_in";
> +		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
> +		allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
> +	};
> +};
> +
> +&uart0 {
> +	/* The default uart0 pins (PH20: TX, PH21: RX) are not accessible
> +	 * on an external connector. Possible ways to get physical access
> +	 * to uart0 include:
> +	 * - disabling mmc0, changing the pinmuxing for the SD card pins
> +	 *   to the uart0 function (PF2: TX, PF4: RX) and using an SD card
> +	 *   breakout board
> +	 * - opening the case and finding appropriate test points connected
> +	 *   to PH20 and PH21
> +	 */

You already made a choice here, so just document the choice you
made. I'm guessing from what you said that it's the latter, in which
case please document which test points you're talking about.

Thanks!

Maxime
Karsten Merker June 25, 2015, 5:22 p.m. UTC | #2
On Thu, Jun 25, 2015 at 12:44:02PM +0200, Maxime Ripard wrote:
> On Tue, Jun 23, 2015 at 07:02:28PM +0200, Karsten Merker wrote:
> > The MSI Primo81 is an A31s based tablet, with 1G RAM, 16G NAND,
> > 1024x768 IPS LCD display, mono speaker, 0.3 MP front camera, 2.0 MP
> > rear camera, 3500 mAh battery, gt911 touchscreen, mma8452 accelerometer
> > and rtl8188etv usb wifi. Has "power", "volume+" and "volume-" buttons
> > (both volume buttons are also connected to the UBOOT_SEL pin). The
> > external connectors are represented by MicroSD slot, MiniHDMI, MicroUSB
> > OTG and 3.5mm headphone jack. More details are available at
> >     http://linux-sunxi.org/MSI_Primo81
> > 
> > This initial dts file only provides support for mmc, wifi and uart
> > (there is no external connector for uart though). Graphics can be used
> > via simplefb. However, without usb otg, there are no reasonable means
> > to handle user input yet.
> > 
> > Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
> > Signed-off-by: Karsten Merker <merker@debian.org>
[...]
> > +/ {
> > +	model = "MSI Primo81 tablet";
> > +	compatible = "msi,primo81", "allwinner,sun6i-a31s";
> > +
> > +	aliases {
> > +		serial0 = &uart0;
> > +	};
> > +
> > +	chosen {
> > +		stdout-path = "serial0:115200n8";
> > +	};
> > +
> > +};
> > +
> > +&ehci0 {
> > +	/* rtl8188etv wifi is connected here */
> 
> No need to mention it, it's what discoverable buses are made for.

Hello Maxime,

using the same reasoning that caused you to ask for a description
of the uart0 config (no external connector available, so why is
there a uart0 enabled and how is it usable), I think it makes
sense to leave this comment in the dts.  The Primo 81 doesn't
have any external USB host connectors and the fact that the
internal Realtek USB WLAN chip is connected there is the only
reason that the EHCI controller gets enabled in the dts at all. 
If you really prefer, I'll remove the comment in a V5; in that
case please let me know.

> > +	status = "okay";
> > +};
[...]

> > +&uart0 {
> > +	/* The default uart0 pins (PH20: TX, PH21: RX) are not accessible
> > +	 * on an external connector. Possible ways to get physical access
> > +	 * to uart0 include:
> > +	 * - disabling mmc0, changing the pinmuxing for the SD card pins
> > +	 *   to the uart0 function (PF2: TX, PF4: RX) and using an SD card
> > +	 *   breakout board
> > +	 * - opening the case and finding appropriate test points connected
> > +	 *   to PH20 and PH21
> > +	 */
> 
> You already made a choice here, so just document the choice you
> made. I'm guessing from what you said that it's the latter, in which
> case please document which test points you're talking about.

Upwards in this thread you wrote:
> [Karsten Merker wrote]
> > I have tagged this patch RFC as I am unsure what to do with the
> > /chosen/stdout-path node. For now, I have set Siarhei's original
> > choice (first serial port), but I am unsure whether this is the
> > right thing to do as the Primo81 does by default not have a
> > user-accessible serial port.  The only way to get a serial
> > console is to either break the case open and find some test
> > points that carry the RX/TX lines (which with the Primo81 case
> > poses a high risk of breaking the display glass), or to use an SD
> > card breakout board and change the pinmuxing for the SD card pins
> > to the "serial" function.  The latter would not work without
> > modifying the dts, so the SD-breakout case doesn't really count
> > for setting the default stdout-path in the general use case.
>
> Having that as a comment on top of whatever uart you've been using
> would be great, so that people know where to look at on their device
> to find it.

Maybe I have misunderstood you, but to my understanding the
comment I added represents exactly what you asked me to do above?

I cannot tell which test points carry the TX/RX lines from PH20
and PH21 as I have not opened the case (and to my knowledge
nobody else @linunx-sunxi has done that), due to the fact that
the Primo 81 doesn't have one of typical cheap two-part plastic
cases which can be easily opened without destroying anything, but
a one-part aluminum case which fits tightly with the display
glass.  To pry open the aluminium case one would have to apply
pressure to the glass and I don't want to void my warranty and
risk breaking the display while doing that.

The u-boot and the android kernel that come preinstalled on the
tablet use PH20 and PH21 for uart0, so there is an extremely high
probability that there are test points on the board that carry
these lines, but I cannot tell which ones.

So the same question as above: if you really want me to do
that, I'll remove the SD card breakout info in a V5 (just tell me
so), but I think it makes sense to leave it in the dts.

Regards,
Karsten
Maxime Ripard June 28, 2015, 8:25 p.m. UTC | #3
On Thu, Jun 25, 2015 at 07:22:19PM +0200, Karsten Merker wrote:
> > > +&ehci0 {
> > > +	/* rtl8188etv wifi is connected here */
> > 
> > No need to mention it, it's what discoverable buses are made for.
> 
> Hello Maxime,
> 
> using the same reasoning that caused you to ask for a description
> of the uart0 config (no external connector available, so why is
> there a uart0 enabled and how is it usable), I think it makes
> sense to leave this comment in the dts.  The Primo 81 doesn't
> have any external USB host connectors and the fact that the
> internal Realtek USB WLAN chip is connected there is the only
> reason that the EHCI controller gets enabled in the dts at all. 
> If you really prefer, I'll remove the comment in a V5; in that
> case please let me know.

Except that you have no way to magically find out where you're
supposed to get the UART from, while the WiFi module will be magically
discovered, reported in the logs, without any kind of user
interaction, and you actually don't even care.

> > > +&uart0 {
> > > +	/* The default uart0 pins (PH20: TX, PH21: RX) are not accessible
> > > +	 * on an external connector. Possible ways to get physical access
> > > +	 * to uart0 include:
> > > +	 * - disabling mmc0, changing the pinmuxing for the SD card pins
> > > +	 *   to the uart0 function (PF2: TX, PF4: RX) and using an SD card
> > > +	 *   breakout board
> > > +	 * - opening the case and finding appropriate test points connected
> > > +	 *   to PH20 and PH21
> > > +	 */
> > 
> > You already made a choice here, so just document the choice you
> > made. I'm guessing from what you said that it's the latter, in which
> > case please document which test points you're talking about.
> 
> Upwards in this thread you wrote:
> > [Karsten Merker wrote]
> > > I have tagged this patch RFC as I am unsure what to do with the
> > > /chosen/stdout-path node. For now, I have set Siarhei's original
> > > choice (first serial port), but I am unsure whether this is the
> > > right thing to do as the Primo81 does by default not have a
> > > user-accessible serial port.  The only way to get a serial
> > > console is to either break the case open and find some test
> > > points that carry the RX/TX lines (which with the Primo81 case
> > > poses a high risk of breaking the display glass), or to use an SD
> > > card breakout board and change the pinmuxing for the SD card pins
> > > to the "serial" function.  The latter would not work without
> > > modifying the dts, so the SD-breakout case doesn't really count
> > > for setting the default stdout-path in the general use case.
> >
> > Having that as a comment on top of whatever uart you've been using
> > would be great, so that people know where to look at on their device
> > to find it.
> 
> Maybe I have misunderstood you, but to my understanding the
> comment I added represents exactly what you asked me to do above?

Sorry if I haven't been clear enough.

> I cannot tell which test points carry the TX/RX lines from PH20
> and PH21 as I have not opened the case (and to my knowledge
> nobody else @linunx-sunxi has done that), due to the fact that
> the Primo 81 doesn't have one of typical cheap two-part plastic
> cases which can be easily opened without destroying anything, but
> a one-part aluminum case which fits tightly with the display
> glass.  To pry open the aluminium case one would have to apply
> pressure to the glass and I don't want to void my warranty and
> risk breaking the display while doing that.
>
> The u-boot and the android kernel that come preinstalled on the
> tablet use PH20 and PH21 for uart0, so there is an extremely high
> probability that there are test points on the board that carry
> these lines, but I cannot tell which ones.

So you enable a device that you have never actually tested, and you
document a procedure you have never seen to be working? I really hope
the rest of the DTS is not made that way too.

> So the same question as above: if you really want me to do
> that, I'll remove the SD card breakout info in a V5 (just tell me
> so), but I think it makes sense to leave it in the dts.

Don't enable what you haven't tested, or anything that isn't used for
what it's been intended to. Which means don't put any UART on there.

Maxime
diff mbox

Patch

=========
- Original patch by Siarhei Siamashka

Version 2
=========
- Use symbolic instead of numeric pinctrl values.

- Change the include syntax from /include/ to #include to make
  the dts build with current kernels.

Version 3
=========
- Use labels for nodes with modifications in relation to the dtsi
  instead of replicating the tree structure.

- Remove the FSF address from the license header as done in
  http://lists.infradead.org/pipermail/linux-arm-kernel/2015-May/340437.html
  for the other dts files to remove a checkpatch warning.

- Add msi to the vendor prefix list.

- Remove earlyprintk from the default kernel commandline.

- Replace the console kernel commandline parameter by a
  /chosen/stdout-path node and add an alias serial0 -> uart0.

Version 4
=========
- Split out the vendor prefix documentation into a separate patch.

- Add a comment regarding the uart0 accessibility to the corresponding
  entry in the dts.

 arch/arm/boot/dts/Makefile               |   3 +-
 arch/arm/boot/dts/sun6i-a31s-primo81.dts | 103 +++++++++++++++++++++++++++++++
 2 files changed, 105 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/sun6i-a31s-primo81.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 867e6e3..31686c7 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -552,7 +552,8 @@  dtb-$(CONFIG_MACH_SUN6I) += \
 	sun6i-a31-i7.dtb \
 	sun6i-a31-m9.dtb \
 	sun6i-a31-mele-a1000g-quad.dtb \
-	sun6i-a31s-cs908.dtb
+	sun6i-a31s-cs908.dtb \
+	sun6i-a31s-primo81.dtb
 dtb-$(CONFIG_MACH_SUN7I) += \
 	sun7i-a20-bananapi.dtb \
 	sun7i-a20-bananapro.dtb \
diff --git a/arch/arm/boot/dts/sun6i-a31s-primo81.dts b/arch/arm/boot/dts/sun6i-a31s-primo81.dts
new file mode 100644
index 0000000..bd15ee1
--- /dev/null
+++ b/arch/arm/boot/dts/sun6i-a31s-primo81.dts
@@ -0,0 +1,103 @@ 
+/*
+ * Copyright 2014 Siarhei Siamashka <siarhei.siamashka@gmail.com>
+ * Copyright 2015 Karsten Merker <merker@debian.org>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This library 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.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "sun6i-a31s.dtsi"
+#include "sunxi-common-regulators.dtsi"
+
+/ {
+	model = "MSI Primo81 tablet";
+	compatible = "msi,primo81", "allwinner,sun6i-a31s";
+
+	aliases {
+		serial0 = &uart0;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+
+};
+
+&ehci0 {
+	/* rtl8188etv wifi is connected here */
+	status = "okay";
+};
+
+&mmc0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_primo81>;
+	vmmc-supply = <&reg_vcc3v0>;
+	bus-width = <4>;
+	cd-gpios = <&pio 0 8 GPIO_ACTIVE_HIGH>; /* PA8 */
+	cd-inverted;
+	status = "okay";
+};
+
+&pio {
+	mmc0_cd_pin_primo81: mmc0_cd_pin@0 {
+		allwinner,pins = "PA8";
+		allwinner,function = "gpio_in";
+		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+		allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
+	};
+};
+
+&uart0 {
+	/* The default uart0 pins (PH20: TX, PH21: RX) are not accessible
+	 * on an external connector. Possible ways to get physical access
+	 * to uart0 include:
+	 * - disabling mmc0, changing the pinmuxing for the SD card pins
+	 *   to the uart0 function (PF2: TX, PF4: RX) and using an SD card
+	 *   breakout board
+	 * - opening the case and finding appropriate test points connected
+	 *   to PH20 and PH21
+	 */
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart0_pins_a>;
+	status = "okay";
+};
+
+&usbphy {
+	status = "okay";
+};