[linux-sunxi] [RFC 2/2] ARM: dts: sun8i: Add SPI support to the Allwinner A23/A33 dtsi.

2016-09-04 Thread Karsten Merker
Define the necessary nodes in the A23/A33 dtsi files to make the
SPI0 controller accessible.

The SoCs also have a secondary SPI controller (SPI1), but it
cannot be muxed to any available pins and therefore doesn't get
included in the dtsi.

Signed-off-by: Karsten Merker <mer...@debian.org>
---
 arch/arm/boot/dts/sun8i-a23-a33.dtsi | 38 
 arch/arm/boot/dts/sun8i-a23.dtsi | 12 
 arch/arm/boot/dts/sun8i-a33.dtsi | 12 
 3 files changed, 62 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-a23-a33.dtsi 
b/arch/arm/boot/dts/sun8i-a23-a33.dtsi
index 6d6509c..a076b5d 100644
--- a/arch/arm/boot/dts/sun8i-a23-a33.dtsi
+++ b/arch/arm/boot/dts/sun8i-a23-a33.dtsi
@@ -3,6 +3,8 @@
  *
  * Chen-Yu Tsai <w...@csie.org>
  *
+ * Copyright 2016 Karsten Merker <mer...@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
@@ -247,6 +249,14 @@
clock-output-names = "nand";
};
 
+   spi0_clk: clk@1c200a0 {
+   #clock-cells = <0>;
+   compatible = "allwinner,sun4i-a10-mod0-clk";
+   reg = <0x01c200a0 0x4>;
+   clocks = <>, < 0>;
+   clock-output-names = "spi0";
+   };
+
usb_clk: clk@01c200cc {
#clock-cells = <1>;
#reset-cells = <1>;
@@ -435,6 +445,34 @@
allwinner,drive = ;
allwinner,pull = ;
};
+
+   spi0_pins_a: spi0@0 {
+   allwinner,pins = "PH7", "PH8", "PH9";
+   allwinner,function = "spi0";
+   allwinner,drive = ;
+   allwinner,pull = ;
+   };
+
+   spi0_cs0_pins_a: spi0_cs0@0 {
+   allwinner,pins = "PH6";
+   allwinner,function = "spi0";
+   allwinner,drive = ;
+   allwinner,pull = ;
+   };
+
+   spi0_pins_b: spi0@1 {
+   allwinner,pins = "PC0", "PC1", "PC2";
+   allwinner,function = "spi0";
+   allwinner,drive = ;
+   allwinner,pull = ;
+   };
+
+   spi0_cs0_pins_b: spi0_cs0@1 {
+   allwinner,pins = "PC3";
+   allwinner,function = "spi0";
+   allwinner,drive = ;
+   allwinner,pull = ;
+   };
};
 
ahb1_rst: reset@01c202c0 {
diff --git a/arch/arm/boot/dts/sun8i-a23.dtsi b/arch/arm/boot/dts/sun8i-a23.dtsi
index 92e6616..f55dc50 100644
--- a/arch/arm/boot/dts/sun8i-a23.dtsi
+++ b/arch/arm/boot/dts/sun8i-a23.dtsi
@@ -3,6 +3,8 @@
  *
  * Chen-Yu Tsai <w...@csie.org>
  *
+ * Copyright 2016 Karsten Merker <mer...@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
@@ -85,6 +87,16 @@
};
 
soc@01c0 {
+   spi0: spi@01c68000 {
+   compatible = "allwinner,sun8i-a23-spi";
+   reg = <0x01c68000 0x1000>;
+   interrupts = ;
+   clocks = <_gates 20>, <_clk>;
+   clock-names = "ahb", "mod";
+   resets = <_rst 20>;
+   status = "disabled";
+   };
+
usb_otg: usb@01c19000 {
compatible = "allwinner,sun6i-a31-musb";
reg = <0x01c19000 0x0400>;
diff --git a/arch/arm/boot/dts/sun8i-a33.dtsi b/arch/arm/boot/dts/sun8i-a33.dtsi
index 001d840..e94aea1 100644
--- a/arch/arm/boot/dts/sun8i-a33.dtsi
+++ b/arch/arm/boot/dts/sun8i-a33.dtsi
@@ -3,6 +3,8 @@
  *
  * Chen-Yu Tsai <w...@csie.org>
  *
+ * Copyright 2016 Karsten Merker <mer...@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
@@ -127,6 +12

[linux-sunxi] [RFC 1/2] spi: sunxi: Add Allwinner A23/A33 support to spi-sun6i

2016-09-04 Thread Karsten Merker
The Allwinner A23/A33 SoCs contain an SPI controller that is
largely identical to the one in the A31. The major differences
from A31 to A23/A33 are:

- The TX and RX FIFOs on the A23/A33 are only 64 Bytes deep
  compared to 128 Bytes on the A31.

- On A23/A33, the SPI_INTCTL register provides an additional
  "Master Sample Data Mode" configuration option.

Currently the FIFO depth is hardcoded to 128 Bytes in the
driver; this patch moves it into SoC-specific platform data
instead of defining it globally and adds a new compatible
"allwinner,sun8i-a23-spi".

Signed-off-by: Karsten Merker <mer...@debian.org>
---
 .../devicetree/bindings/spi/spi-sun6i.txt  |  6 ++-
 drivers/spi/spi-sun6i.c| 43 +++---
 2 files changed, 41 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/spi-sun6i.txt 
b/Documentation/devicetree/bindings/spi/spi-sun6i.txt
index 21de73d..4d3eb86 100644
--- a/Documentation/devicetree/bindings/spi/spi-sun6i.txt
+++ b/Documentation/devicetree/bindings/spi/spi-sun6i.txt
@@ -1,7 +1,9 @@
-Allwinner A31 SPI controller
+Allwinner A31/A23 SPI controller
 
 Required properties:
-- compatible: Should be "allwinner,sun6i-a31-spi".
+- compatible: Should be one of
+   - "allwinner,sun6i-a31-spi"
+   - "allwinner,sun8i-a23-spi"
 - reg: Should contain register location and length.
 - interrupts: Should contain interrupt.
 - clocks: phandle to the clocks feeding the SPI controller. Two are
diff --git a/drivers/spi/spi-sun6i.c b/drivers/spi/spi-sun6i.c
index 9918a57..c6d88c9 100644
--- a/drivers/spi/spi-sun6i.c
+++ b/drivers/spi/spi-sun6i.c
@@ -5,6 +5,8 @@
  * Copyright (C) 2014 Maxime Ripard
  * Maxime Ripard <maxime.rip...@free-electrons.com>
  *
+ * Copyright (C) 2016 Karsten Merker <merker@@debian.org>
+ *
  * This program 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
@@ -24,6 +26,7 @@
 #include 
 
 #define SUN6I_FIFO_DEPTH   128
+#define SUN8I_A23_FIFO_DEPTH   64
 
 #define SUN6I_GBL_CTL_REG  0x04
 #define SUN6I_GBL_CTL_BUS_ENABLE   BIT(0)
@@ -92,6 +95,18 @@ struct sun6i_spi {
int len;
 };
 
+struct sun6i_spi_platform_data {
+   int fifo_depth;
+};
+
+static struct sun6i_spi_platform_data sun6i_a31_spi_platform_data = {
+   .fifo_depth = SUN6I_FIFO_DEPTH,
+};
+
+static struct sun6i_spi_platform_data sun8i_a23_spi_platform_data = {
+   .fifo_depth = SUN8I_A23_FIFO_DEPTH,
+};
+
 static inline u32 sun6i_spi_read(struct sun6i_spi *sspi, u32 reg)
 {
return readl(sspi->base_addr + reg);
@@ -155,7 +170,10 @@ static void sun6i_spi_set_cs(struct spi_device *spi, bool 
enable)
 
 static size_t sun6i_spi_max_transfer_size(struct spi_device *spi)
 {
-   return SUN6I_FIFO_DEPTH - 1;
+   struct sun6i_spi_platform_data *pdata;
+
+   pdata = spi->dev.platform_data;
+   return (pdata->fifo_depth - 1);
 }
 
 static int sun6i_spi_transfer_one(struct spi_master *master,
@@ -168,9 +186,14 @@ static int sun6i_spi_transfer_one(struct spi_master 
*master,
unsigned int tx_len = 0;
int ret = 0;
u32 reg;
+   int fifo_depth;
+   struct sun6i_spi_platform_data *pdata;
 
/* We don't support transfer larger than the FIFO */
-   if (tfr->len > SUN6I_FIFO_DEPTH)
+   pdata = spi->dev.platform_data;
+   fifo_depth = pdata->fifo_depth;
+
+   if (tfr->len > fifo_depth)
return -EINVAL;
 
reinit_completion(>done);
@@ -265,7 +288,7 @@ static int sun6i_spi_transfer_one(struct spi_master *master,
SUN6I_BURST_CTL_CNT_STC(tx_len));
 
/* Fill the TX FIFO */
-   sun6i_spi_fill_fifo(sspi, SUN6I_FIFO_DEPTH);
+   sun6i_spi_fill_fifo(sspi, fifo_depth);
 
/* Enable the interrupts */
sun6i_spi_write(sspi, SUN6I_INT_CTL_REG, SUN6I_INT_CTL_TC);
@@ -288,7 +311,7 @@ static int sun6i_spi_transfer_one(struct spi_master *master,
goto out;
}
 
-   sun6i_spi_drain_fifo(sspi, SUN6I_FIFO_DEPTH);
+   sun6i_spi_drain_fifo(sspi, fifo_depth);
 
 out:
sun6i_spi_write(sspi, SUN6I_INT_CTL_REG, 0);
@@ -470,7 +493,14 @@ static int sun6i_spi_remove(struct platform_device *pdev)
 }
 
 static const struct of_device_id sun6i_spi_match[] = {
-   { .compatible = "allwinner,sun6i-a31-spi", },
+   {
+   .compatible = "allwinner,sun6i-a31-spi",
+   .data = _a31_spi_platform_data,
+   },
+   {
+   .compatible = "allwinner,sun8i-a23-spi",
+   .data = _a23_spi_platform_data,
+   },
{}
 };
 MODULE_DEVICE_TABLE(of, sun6i_spi_match);
@@ -493,5 +523,6 @@ module_platform_dri

[linux-sunxi] [RFC 0/2] A33 SPI support

2016-09-04 Thread Karsten Merker
Hello everybody,

during the mainlining discussion in the Olimex blog at
https://olimex.wordpress.com/2016/08/30/free-electrons-add-mainline-linux-kernel-support-for-the-a13-allwinner-vpu/#comments
the topic of A33 SPI support came up.  Chen-Yu and Siarhei have
pointed out that the chances are good that the A33 can work with
the already existing SPI drivers and that simply nobody has taken
a look at those in the context of the A33 yet - so I have taken
that as an inspiration to take a look :-).

>From the description in the docs published by Allwinner, the
A23/A33 SPI controller is clearly derived from the one in the
A31, but it is not completely identical.  The biggest difference
is that the RX and TX FIFOs on the A23/A33 are only 64 Bytes deep
while they are 128 Bytes deep on the A31. Documentation source:

Page 463 of the A33 manual:
https://github.com/allwinner-zh/documents/raw/master/A33/A33%20user%20manual%20release%201.1.pdf

Page 889 of the A31 manual:
https://github.com/allwinner-zh/documents/raw/master/A31/A31_User_Manual_v1.3_20150510.pdf

The current spi-sun6i driver hardcodes the FIFO depth to 128
Bytes, so that needs to be changed depending on the SoC type.

Another difference is an additional configuration option
influencing the signal sampling on the A23/A33.  This is handled
by bit 13 of the SPI_INTCTL register.  The description states:

  "Master Sample Data Mode
   1-Normal Sample Mode
   0-Delay Sample Mode
   In Normal Sample Mode,SPI Master samples the data at
   the correct edge for each SPI mode.
   In Delay Sample Mode,SPI master samples data at the
   edge that is half cycle delayed by the correct edge defined
   in respective SPI mode."

The manual states that "Delay Sample Mode" is the default, which
sounds a bit strange to me.  Can somebody with a deeper knowledge
of SPI comment on that?

There are some additional test modes on the A23/33 compared to the A31,
but those should be irrelevant for normal operations.

Following are two RFC patches based on Maxime Ripard's sunxi/for-next
branch at

  
https://git.kernel.org/cgit/linux/kernel/git/mripard/linux.git/log/?h=sunxi/for-next

that modify the spi-sun6i driver to handle different FIFO depths and add the
relevant nodes (clock, pinctrl, spi0 controller) to the A23/A33 dtsi files. 
Please note that this is largely untested as I currently don't have any
A23/A33 hardware (an A33 board is on the way to me but will probably take
some time to arrive).  All I can say at the moment is that the code
compiles.  I would apprechiate very much if people could take a look at it
and provide feedback, and if somebody has appropriate hardware, I would
welcome very much if you could subject the code to some practical tests.

Btw, while checking the docs I have stumbled over one thing that strikes me
as rather strange: the A23/A33 has two SPI controllers (SPI0 and SPI1), but
there is no documented pinmux that makes SPI1 available on any pins, so SPI1
appears to be completely useless?

Regards,
Karsten


Karsten Merker (2):
  spi: sunxi: Add Allwinner A23/A33 support to spi-sun6i
  ARM: dts: sun8i: Add SPI support to the Allwinner A23/A33 dtsi.

 .../devicetree/bindings/spi/spi-sun6i.txt  |  6 ++-
 arch/arm/boot/dts/sun8i-a23-a33.dtsi   | 38 +++
 arch/arm/boot/dts/sun8i-a23.dtsi   | 12 ++
 arch/arm/boot/dts/sun8i-a33.dtsi   | 12 ++
 drivers/spi/spi-sun6i.c| 43 +++---
 5 files changed, 103 insertions(+), 8 deletions(-)

-- 
2.1.4

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH V2 1/2] sunxi: A20-Olimex-SOM-EVB defconfig: enable mmc3

2015-12-16 Thread Karsten Merker
The Olimex A20-SOM-EVB is an evaluation board for the Olimex
A20-SOM system-on-module. The baseboard provides a full-size SD
socket (connected to mmc3) in addition to the micro-SD socket on
the SOM itself (which is connected to mmc0).

Enable the mmc3 controller in the board defconfig.

Signed-off-by: Karsten Merker <mer...@debian.org>
---
 configs/A20-Olimex-SOM-EVB_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configs/A20-Olimex-SOM-EVB_defconfig 
b/configs/A20-Olimex-SOM-EVB_defconfig
index 5166c06..34b3f36 100644
--- a/configs/A20-Olimex-SOM-EVB_defconfig
+++ b/configs/A20-Olimex-SOM-EVB_defconfig
@@ -3,6 +3,9 @@ CONFIG_ARCH_SUNXI=y
 CONFIG_MACH_SUN7I=y
 CONFIG_DRAM_CLK=480
 CONFIG_MMC0_CD_PIN="PH1"
+CONFIG_MMC3_CD_PIN="PH0"
+CONFIG_MMC3_PINS="PH"
+CONFIG_MMC_SUNXI_SLOT_EXTRA=3
 CONFIG_USB0_VBUS_PIN="PB9"
 CONFIG_USB0_VBUS_DET="PH5"
 CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-olimex-som-evb"
-- 
2.1.4

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH V2 0/2] sunxi: support for a second SD card socket

2015-12-16 Thread Karsten Merker
Hello,

this patchset enables the full-size SD card socket on the
A20-Olimex-SOM-EVB baseboard in u-boot and adds support for
including this kind of secondary socket into the boot environment
provided by config_distro_bootcmd.h on sunxi-based systems.

The latter is particularly useful on the A20-Olimex-SOM-EVB as
changing the card in the primary micro-SD socket is kind of
fiddly when the SOM is plugged into the baseboard.

Changes since V1:
I had botched the patch generation for V1 so that the posted
patch was incomplete. This is now the complete patch.

Regards,
Karsten

Karsten Merker (2):
  sunxi: A20-Olimex-SOM-EVB defconfig: enable mmc3
  sunxi: Enable a second mmc socket as boot target in the environment

 configs/A20-Olimex-SOM-EVB_defconfig | 3 +++
 include/configs/sunxi-common.h   | 7 +++
 2 files changed, 10 insertions(+)

-- 
2.1.4

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH 0/2] sunxi: support for a second SD card socket

2015-12-12 Thread Karsten Merker
Hello,

this patchset enables the full-size SD card socket on the
A20-Olimex-SOM-EVB baseboard in u-boot and adds support for
including this kind of secondary socket into the boot process
provided by config_distro_bootcmd.h.

The latter is particularly useful on the A20-Olimex-SOM-EVB as
changing the card in the primary micro-SD socket is kind of
fiddly when the SOM is plugged into the baseboard.

Regards,
Karsten

Karsten Merker (2):
  sunxi: A20-Olimex-SOM-EVB defconfig: enable mmc3
  sunxi: Enable a second mmc socket as boot target in the environment

 configs/A20-Olimex-SOM-EVB_defconfig | 3 +++
 include/configs/sunxi-common.h   | 6 ++
 2 files changed, 9 insertions(+)

-- 
2.1.4

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH 1/2] sunxi: A20-Olimex-SOM-EVB defconfig: enable mmc3

2015-12-12 Thread Karsten Merker
The Olimex A20-SOM-EVB is an evaluation board for the Olimex
A20-SOM system-on-module. The baseboard provides a full-size SD
socket (connected to mmc3) in addition to the micro-SD socket on
the SOM itself (which is connected to mmc0).

Enable the mmc3 controller in the board defconfig.

Signed-off-by: Karsten Merker <mer...@debian.org>
---
 configs/A20-Olimex-SOM-EVB_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configs/A20-Olimex-SOM-EVB_defconfig 
b/configs/A20-Olimex-SOM-EVB_defconfig
index 5166c06..34b3f36 100644
--- a/configs/A20-Olimex-SOM-EVB_defconfig
+++ b/configs/A20-Olimex-SOM-EVB_defconfig
@@ -3,6 +3,9 @@ CONFIG_ARCH_SUNXI=y
 CONFIG_MACH_SUN7I=y
 CONFIG_DRAM_CLK=480
 CONFIG_MMC0_CD_PIN="PH1"
+CONFIG_MMC3_CD_PIN="PH0"
+CONFIG_MMC3_PINS="PH"
+CONFIG_MMC_SUNXI_SLOT_EXTRA=3
 CONFIG_USB0_VBUS_PIN="PB9"
 CONFIG_USB0_VBUS_DET="PH5"
 CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-olimex-som-evb"
-- 
2.1.4

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH 2/2] sunxi: Enable a second mmc socket as boot target in the environment

2015-12-12 Thread Karsten Merker
Some sunxi-based boards (such as the Olimex A20-SOM-EVB) have a
second MMC socket. This socket is not bootable hardware-wise,
i.e. u-boot itself cannot be loaded from it, but once u-boot has
started, the second socket can be used in the boot process
provided by config_distro_bootcmd.h.

If a second MMC socket is present, place it in the boot order
after the first MMC socket.

Signed-off-by: Karsten Merker <mer...@debian.org>
---
 include/configs/sunxi-common.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 98a2c74..53ad6d2 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -418,6 +418,11 @@ extern int soft_i2c_gpio_scl;
 
 #ifdef CONFIG_MMC
 #define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0)
+#if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1
+#define BOOT_TARGET_DEVICES_MMC_EXTRA(func) func(MMC, mmc, 1)
+#else
+#define BOOT_TARGET_DEVICES_MMC_EXTRA(func)
+#endif
 #else
 #define BOOT_TARGET_DEVICES_MMC(func)
 #endif
@@ -447,6 +452,7 @@ extern int soft_i2c_gpio_scl;
 #define BOOT_TARGET_DEVICES(func) \
func(FEL, fel, na) \
BOOT_TARGET_DEVICES_MMC(func) \
+   BOOT_TARGET_DEVICES_MMC_EXTRA(func) \
BOOT_TARGET_DEVICES_SCSI(func) \
BOOT_TARGET_DEVICES_USB(func) \
func(PXE, pxe, na) \
-- 
2.1.4

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH 2/3] ARM: dts: sun7i: Olimex A20-SOM-EVB: Enable mmc3 (baseboard SD socket)

2015-12-10 Thread Karsten Merker
The Olimex A20-SOM-EVB is an evaluation board for the Olimex
A20-SOM system-on-module. The baseboard provides a full-size SD
socket (connected to mmc3) in addition to the micro-SD socket on
the SOM itself (which is connected to mmc0).

Enable the mmc3 controller in the dts.

Signed-off-by: Karsten Merker <mer...@debian.org>
---
 arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts | 17 +
 1 file changed, 17 insertions(+)

diff --git a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts 
b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts
index 6562a6bc..6a3d95d 100644
--- a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts
+++ b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts
@@ -176,6 +176,16 @@
status = "okay";
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins_a>, <_cd_pin_olimex_som_evb>;
+   vmmc-supply = <_vcc3v3>;
+   bus-width = <4>;
+   cd-gpios = < 7 0 GPIO_ACTIVE_HIGH>; /* PH0 */
+   cd-inverted;
+   status = "okay";
+};
+
  {
status = "okay";
 };
@@ -198,6 +208,13 @@
allwinner,drive = ;
allwinner,pull = ;
};
+
+   mmc3_cd_pin_olimex_som_evb: mmc3_cd_pin@0 {
+   allwinner,pins = "PH0";
+   allwinner,function = "gpio_in";
+   allwinner,drive = ;
+   allwinner,pull = ;
+   };
 };
 
 _ahci_5v {
-- 
2.1.4

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH 0/3] ARM: dts: sun7i: Olimex A20-SOM-EVB: LRADC-keys, MMC3 and typo fix in the sunxi LRADC binding

2015-12-10 Thread Karsten Merker
Hello,

the Olimex A20-SOM-EVB is an evaluation board for the Olimex
A20-SOM system-on-module. This patchset adds/enables some more
hardware features in the board dts:

  - Patch 1 adds support for the LRADC-keys on the baseboard.

  - Patch 2 enables the MMC3 controller to allow use of the
full-size SD card socket on the baseboard.

While adding the LRADC-keys support, I have stumbled over
a typo in the bindings documentation. Patch 3 fixes that.

Regards,
Karsten

Karsten Merker (3):
  ARM: dts: sun7i: Olimex A20-SOM-EVB: Add LRADC keys
  ARM: dts: sun7i: Olimex A20-SOM-EVB: Enable mmc3 (baseboard SD socket)
  ARM: dts: sunxi: allwinner,sun4i-a10-lradc-keys binding: typo fix

 .../devicetree/bindings/input/sun4i-lradc-keys.txt |  2 +-
 arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts | 73 ++
 2 files changed, 74 insertions(+), 1 deletion(-)

-- 
2.1.4

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH 1/3] ARM: dts: sun7i: Olimex A20-SOM-EVB: Add LRADC keys

2015-12-10 Thread Karsten Merker
The Olimex A20-SOM-EVB is an evaluation board for the Olimex
A20-SOM system-on-module.  It provides a set of android-style
buttons (labeled "VOL+", "VOL-", "MENU", "SEARCH", "HOME", "ESC"
and "ENTER") which are connected to a low-resolution ADC via a
resistor network.

This patch adds appropriate button definitions to the board
dts. The voltages assigned to the keys are specified in the
board schematics published by the manufacturer.

Signed-off-by: Karsten Merker <mer...@debian.org>
---
 arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts | 56 ++
 1 file changed, 56 insertions(+)

diff --git a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts 
b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts
index b7fe102..6562a6bc 100644
--- a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts
+++ b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts
@@ -1,5 +1,6 @@
 /*
  * Copyright 2015 - Marcus Cooper <codekip...@gmail.com>
+ * Copyright 2015 - Karsten Merker <mer...@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
@@ -45,6 +46,7 @@
 #include "sunxi-common-regulators.dtsi"
 
 #include 
+#include 
 #include 
 #include 
 
@@ -110,6 +112,60 @@
};
 };
 
+ {
+   vref-supply = <_vcc3v0>;
+   status = "okay";
+
+   button@190 {
+   label = "Volume Up";
+   linux,code = ;
+   channel = <0>;
+   voltage = <19>;
+   };
+
+   button@390 {
+   label = "Volume Down";
+   linux,code = ;
+   channel = <0>;
+   voltage = <39>;
+   };
+
+   button@600 {
+   label = "Menu";
+   linux,code = ;
+   channel = <0>;
+   voltage = <60>;
+   };
+
+   button@800 {
+   label = "Search";
+   linux,code = ;
+   channel = <0>;
+   voltage = <80>;
+   };
+
+   button@980 {
+   label = "Home";
+   linux,code = ;
+   channel = <0>;
+   voltage = <98>;
+   };
+
+   button@1180 {
+   label = "Esc";
+   linux,code = ;
+   channel = <0>;
+   voltage = <118>;
+   };
+
+   button@1400 {
+   label = "Enter";
+   linux,code = ;
+   channel = <0>;
+   voltage = <140>;
+   };
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_pins_a>, <_cd_pin_reference_design>;
-- 
2.1.4

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH RFC 2/2] ARM: dts: sun7i: Olimex A20-SOM-EVB: Enable mmc3 (baseboard SD socket)

2015-12-08 Thread Karsten Merker
The Olimex A20-SOM-EVB is an evaluation board for the Olimex
A20-SOM system-on-module. The baseboard provides a full-size SD
socket (connected to mmc3) in addition to the micro-SD socket on
the SOM itself (which is connected to mmc0).

Enable the mmc3 controller in the dts.

Signed-off-by: Karsten Merker <mer...@debian.org>
---
 arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts | 17 +
 1 file changed, 17 insertions(+)

diff --git a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts 
b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts
index 6562a6bc..6a3d95d 100644
--- a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts
+++ b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts
@@ -176,6 +176,16 @@
status = "okay";
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins_a>, <_cd_pin_olimex_som_evb>;
+   vmmc-supply = <_vcc3v3>;
+   bus-width = <4>;
+   cd-gpios = < 7 0 GPIO_ACTIVE_HIGH>; /* PH0 */
+   cd-inverted;
+   status = "okay";
+};
+
  {
status = "okay";
 };
@@ -198,6 +208,13 @@
allwinner,drive = ;
allwinner,pull = ;
};
+
+   mmc3_cd_pin_olimex_som_evb: mmc3_cd_pin@0 {
+   allwinner,pins = "PH0";
+   allwinner,function = "gpio_in";
+   allwinner,drive = ;
+   allwinner,pull = ;
+   };
 };
 
 _ahci_5v {
-- 
2.1.4

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH V4 2/2] devicetree: Add msi to the vendor-prefix list

2015-06-23 Thread Karsten Merker
Document the the msi (Micro-Star International Co. Ltd.) vendor prefix
which is used in sun6i-a31s-primo81.dts.

Signed-off-by: Karsten Merker mer...@debian.org
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 6a99dda..c415c2b 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -127,6 +127,7 @@ mitsubishi  Mitsubishi Electric Corporation
 mosaixtech Mosaix Technologies, Inc.
 moxa   Moxa
 mplMPL AG
+msiMicro-Star International Co. Ltd.
 mtiImagination Technologies Ltd. (formerly MIPS Technologies Inc.)
 mundoreaderMundo Reader S.L.
 murata Murata Manufacturing Co., Ltd.
-- 
2.1.4

-- 
You received this message because you are subscribed to the Google Groups 
linux-sunxi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH V4 1/2] ARM: dts: sun6i: Add dts file for MSI Primo81 tablet

2015-06-23 Thread Karsten Merker
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.siamas...@gmail.com
Signed-off-by: Karsten Merker mer...@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 000..bd15ee1
--- /dev/null
+++ b/arch/arm/boot/dts/sun6i-a31s-primo81.dts
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2014 Siarhei Siamashka siarhei.siamas...@gmail.com
+ * Copyright 2015 Karsten Merker mer...@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

[linux-sunxi] [PATCH V4 0/2] MSI Primo 81 dts

2015-06-23 Thread Karsten Merker
Hello,

following is V4 of the patchset to add MSI Primo 81 devicetree data.

Regards,
Karsten

Karsten Merker (2):
  ARM: dts: sun6i: Add dts file for MSI Primo81 tablet
  devicetree: Add msi to the vendor-prefix list

 .../devicetree/bindings/vendor-prefixes.txt|   1 +
 arch/arm/boot/dts/Makefile |   3 +-
 arch/arm/boot/dts/sun6i-a31s-primo81.dts   | 103 +
 3 files changed, 106 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/sun6i-a31s-primo81.dts

-- 
2.1.4

-- 
You received this message because you are subscribed to the Google Groups 
linux-sunxi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [RFC PATCH V3] ARM: dts: sun6i: Add dts file for MSI Primo81 tablet

2015-06-16 Thread Karsten Merker
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.siamas...@gmail.com
Signed-off-by: Karsten Merker mer...@debian.org
---
 .../devicetree/bindings/vendor-prefixes.txt|  1 +
 arch/arm/boot/dts/Makefile |  3 +-
 arch/arm/boot/dts/sun6i-a31s-primo81.dts   | 94 ++
 3 files changed, 97 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/sun6i-a31s-primo81.dts

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 6a99dda..c415c2b 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -127,6 +127,7 @@ mitsubishi  Mitsubishi Electric Corporation
 mosaixtech Mosaix Technologies, Inc.
 moxa   Moxa
 mplMPL AG
+msiMicro-Star International Co. Ltd.
 mtiImagination Technologies Ltd. (formerly MIPS Technologies Inc.)
 mundoreaderMundo Reader S.L.
 murata Murata Manufacturing Co., Ltd.
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 000..9c9b4bf
--- /dev/null
+++ b/arch/arm/boot/dts/sun6i-a31s-primo81.dts
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2014 Siarhei Siamashka siarhei.siamas...@gmail.com
+ * Copyright 2015 Karsten Merker mer...@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

[linux-sunxi] [RFC PATCH V3] ARM: dts: sun6i: Add dts file for MSI Primo81 tablet

2015-06-16 Thread Karsten Merker
On Tue, Jun 16, 2015 at 11:40:27AM +0200, Maxime Ripard wrote:

 What I meant in my previous review was to use the syntax
 
 uart0 {
some-property;
 };
   
 Instead of duplicating the tree structure like you're doing
 here. We've converted all the DT to that, so you can look around and
 see how it's done in other boards (note that the nodes should be
 sorted by alphabetical order).

Ah, sorry, I had misunderstood your original email in this regard.
Following is a reworked version of the patch.

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.

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.

On the other hand, setting stdout-path to the serial port does
not seem to influence getting a a boot console on the LCD when
booting from a simplefb-capable u-boot, so there is probably no
harm in doing it.

Comments welcome :-).

Regards,
Karsten
-- 
Gem. Par. 28 Abs. 4 Bundesdatenschutzgesetz widerspreche ich der Nutzung
sowie der Weitergabe meiner personenbezogenen Daten für Zwecke der
Werbung sowie der Markt- oder Meinungsforschung.

-- 
You received this message because you are subscribed to the Google Groups 
linux-sunxi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH V2] ARM: dts: sun6i: Add dts file for MSI Primo81 tablet

2015-06-14 Thread Karsten Merker
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.siamas...@gmail.com
Signed-off-by: Karsten Merker mer...@debian.org
---

Changes since V1:

  - Use symbolic instead of numeric pinctrl values as requested
by Maxime Ripard.
  - Change the include syntax from /include/ to #include to make
the dts build with current kernels.

 arch/arm/boot/dts/Makefile   |  3 +-
 arch/arm/boot/dts/sun6i-a31s-primo81.dts | 96 
 2 files changed, 98 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 000..8ac0bdd
--- /dev/null
+++ b/arch/arm/boot/dts/sun6i-a31s-primo81.dts
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2014 Siarhei Siamashka siarhei.siamas...@gmail.com
+ * Copyright 2015 Karsten Merker mer...@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.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ *
+ * 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;
+
+   chosen {
+   bootargs = earlyprintk console=ttyS0,115200;
+   };
+
+   soc@01c0 {
+   mmc0: mmc@01c0f000 {
+   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

[linux-sunxi] [PATCH V2] ARM: dts: sun6i: Add dts file for MSI Primo81 tablet

2015-06-14 Thread Karsten Merker
Maxime Ripard wrote:
 On Sat, Dec 27, 2014 at 09:37:20AM +0200, Siarhei Siamashka 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.
[...]
 These two patches look very good overall.
 
 There's two things about the two of them though:
   - We just switched to using the DT includes, please use them for
 your GPIO flags and pinctrl drive strength and pull
 configurations.
   - We will switch soon to using the kind of syntax used for example
 by TI in their DTSes (you can look at the beaglebone black for an
 good example.), it would be great if you could use that in your
 two DTSes, in order to avoid changing everything again in a near
 future.

As far as I can see nobody has taken this up until now, so I have
slightly reworked Siarhei's original patch:

- changed the numeric pinctrl and gpio values to their symbolic
  equivalents

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

I have current u-boot master working on the tablet (booted from
SD card), with console on the LCD, USB-OTG-support and a USB
keyboard.  A defconfig patch for OTG+keyboard support has been
submitted to the u-boot list.

Unfortunately I have not yet had much luck with the kernel.
I try to get Hans de Goede's sunxi-wip branch
(https://github.com/jwrdegoede/linux-sunxi/tree/sunxi-wip) to
work on the Primo81, but I have not yet been able to get any
kernel output on the LCD.  Debugging this is slightly difficult
as I currently lack an SD breakout board, so I have no way to
get a serial console for now.

Siarhei, could you perhaps give Hans' sunxi-wip branch a try on
your Primo81? AFAIK you have a breakout board for it.

Regards,
Karsten
-- 
Gem. Par. 28 Abs. 4 Bundesdatenschutzgesetz widerspreche ich der Nutzung
sowie der Weitergabe meiner personenbezogenen Daten für Zwecke der
Werbung sowie der Markt- oder Meinungsforschung.

-- 
You received this message because you are subscribed to the Google Groups 
linux-sunxi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [sunxi] [RFC/RFH] Adding mainline u-boot support for the Olimex A20-SOM-EVB

2015-02-12 Thread Karsten Merker
Hello,

I am working on adding support for the Olimex A20-SOM-EVB development
board to mainline u-boot (and to the mainline Linux kernel, but that is
a topic for a different thread).  The board package actually consists
of two parts, the A20-SOM-EVB baseboard providing I/O and power supply,
and the A20-SOM CPU/memory board that gets plugged onto the baseboard.

The schematics for the boards are available online:

- A20-SOM CPU module:
  
https://github.com/OLIMEX/SOM/blob/master/A20/A20-SOM/A20-SOM_board_rev_D.pdf?raw=true
  
- A20-SOM-EVB baseboard:
  
https://www.olimex.com/Products/SOM/A20/A20-SOM-EVB/resources/A20-SOM-EVB_schematic.pdf

I use the following defconfig with the master branch of
git://git.denx.de/u-boot-sunxi.git, but I currently cannot get it to work
fully as intended and would appreciate any advice.

configs/Olimex-A20-SOM-EVB_defconfig:
=

CONFIG_SPL=y
CONFIG_SYS_EXTRA_OPTIONS=AXP209_POWER,SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPC(3),USB_EHCI
CONFIG_FDTFILE=sun7i-a20-olimex-a20-som-evb.dtb
CONFIG_MMC0_CD_PIN=PH1
CONFIG_USB1_VBUS_PIN=PH6
CONFIG_USB2_VBUS_PIN=PH3
+S:CONFIG_ARM=y
+S:CONFIG_ARCH_SUNXI=y
+S:CONFIG_MACH_SUN7I=y
+S:CONFIG_DRAM_CLK=384
+S:CONFIG_DRAM_ZQ=127
+S:CONFIG_DRAM_EMR1=4

I try to start u-boot via FEL, as the Micro-SD slot on the A20-SOM is very
difficult to reach (even using pliers) when it is plugged onto the
baseboard, and having to change SD cards all the time while testing is
really cumbersome.

The first problem showing up is that starting u-boot via FEL in the
traditional style (using a FEL-specific build) does not work.  The
SPL gets transferred properly and the fel exe command that starts the
SPL returns without error, although I get no output on the serial console.
Trying to transfer the main u-boot image afterwards fails:

$ make distclean
$ make Olimex-A20-SOM-EVB_felconfig
[...]
$ make -j3
[...]
$ fel version
AWUSBFEX soc=1651(A20) 0001 ver=0001 44 08 scratchpad=7e00  

$ fel write 0x2000 spl/u-boot-spl.bin
$ fel exe 0x2000
[wait a few seconds for DRAM init]
$ fel write 0x4a00 u-boot.bin
[takes some time]
libusb usb_bulk_send error -7

I have no idea how to further debug this. My first thought was that my
DRAM parameters (based on data from a manufacturer-supplied FEX file
for the board) are wrong, so that I run into problems while writing the
main u-boot image to DRAM, but this is probably not the reason - see
below.

Running Siarhei's new fel spl command (using a normal non-FEL u-boot
build) succeeds in transferring and starting the SPL, which then - with
a build from git://git.denx.de/u-boot-sunxi.git - either complains that
it cannot do the SD card voltage select when no card is inserted:

U-Boot SPL 2015.01-03533-gdb62a4a (Feb 12 2015 - 20:04:29)
DRAM: 1024 MiB
CPU: 96000Hz, AXI/AHB/APB: 3/2/2
Card did not respond to voltage select!
spl: mmc init failed: err - -17
### ERROR ### Please RESET the board ###

or boots straight into the old u-boot-sunxi that I have
on the card: 

U-Boot SPL 2015.01-03533-gdb62a4a (Feb 12 2015 - 20:04:29)
DRAM: 1024 MiB
CPU: 96000Hz, AXI/AHB/APB: 3/2/2


U-Boot 2014.04-10733-gea1ac32 (Feb 08 2015 - 20:04:39) Allwinner Technology

CPU:   Allwinner A20 (SUN7I)
Board: Olimex_A20-SOM
I2C:   ready
DRAM:  1 GiB
MMC:   SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment

In this case the SPL does not know that it is booted via FEL, so it
tries to load the main u-boot binary from the SD card.  The fact that
chainloading the (old) u-boot from the SD card works, shows me that the
DRAM is working, so I suppose that my DRAM parameters are probably not
the reason why the old-style FEL booting does not work.

When using a u-boot build from the 20150208-fel-fixes branch of
Siarhei's repository at https://github.com/ssvb/u-boot-sunxi.git
(plus Hans' config_distro_bootcmd fix from
http://lists.denx.de/pipermail/u-boot/2015-February/204286.html)
as follows:

$ make distclean
[...]
$ make Olimex-A20-SOM-EVB_defconfig
[...]
$ make -j3
[...]
$ fel version
AWUSBFEX soc=1651(A20) 0001 ver=0001 44 08 scratchpad=7e00  

$ fel spl u-boot-sunxi-with-spl.bin
$ fel write 0x4a00 u-boot.bin
$ fel exe 0x4a00
$ 

u-boot boots fine until it tries to initialize the EHCI controllers:

U-Boot SPL 2015.04-rc1-04039-g6385323 (Feb 12 2015 - 21:08:28)
DRAM: 1024 MiB
CPU: 96000Hz, AXI/AHB/APB: 3/2/2


U-Boot 2015.04-rc1-04039-g6385323 (Feb 12 2015 - 21:08:28) Allwinner
Technology

CPU:   Allwinner A20 (SUN7I)
I2C:   ready
DRAM:  1 GiB
MMC:   SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment

In:serial
Out:   serial
Err:   serial
SCSI:  SUNXI SCSI INIT
SATA link 0 timeout.
AHCI 0001.0100 32 slots 1 ports 3 Gbps 0x1 impl SATA mode
flags: ncq stag pm led clo only pmp pio slum part ccc apst
Net:   dwmac.1c5
starting USB...
USB0:

Then u-boot hangs. The problem appears to be with the GPIO pins that
control the USB voltage 

[linux-sunxi] [PATCH V2 0/1] ARM: dts: Fix failing ethernet PHY detection on the LeMaker Banana Pi

2014-11-11 Thread Karsten Merker
While testing the daily builds of the Debian-Installer (d-i) on the
LeMaker Banana Pi (a small, Allwinner A20-based board), I found that
within the installer environment, the detection of the external Realtek
ethernet PHY connected to the Allwinner A20 GMAC fails upon first
loading of the stmmac driver:

[   77.235117] stmmaceth 1c5.ethernet: no reset control found
[   77.235192]  Ring mode enabled
[   77.235202]  No HW DMA feature register supported
[   77.235211]  Normal descriptors
[   77.235219]  TX Checksum insertion supported
[   77.242678] libphy: stmmac: probed
[   77.242708] eth0: No PHY found

Just unloading the stmmac module and immediately afterwards 
modprobing it again results in proper detection of the PHY:

[  148.823456] stmmaceth 1c5.ethernet: no reset control found
[  148.823487]  Ring mode enabled
[  148.823496]  No HW DMA feature register supported
[  148.823502]  Normal descriptors
[  148.823509]  TX Checksum insertion supported
[  148.854654] libphy: stmmac: probed
[  148.854683] eth0: PHY ID 001cc915 at 0 IRQ POLL (stmmac-0:00) active
[  148.854694] eth0: PHY ID 001cc915 at 1 IRQ POLL (stmmac-0:01)

On the Banana Pi, the PHY power supply is handled by a GPIO-controlled
regulator:

gmac: ethernet@01c5 {
pinctrl-names = default;
pinctrl-0 = gmac_pins_rgmii_a;
phy = phy1;
phy-mode = rgmii;
phy-supply = reg_gmac_3v3;
status = okay;

phy1: ethernet-phy@1 {
reg = 1;
};
};

reg_gmac_3v3: gmac-3v3 {
compatible = regulator-fixed;
pinctrl-names = default;
pinctrl-0 = gmac_power_pin_bananapi;
regulator-name = gmac-3v3;
regulator-min-microvolt = 330;
regulator-max-microvolt = 330;
startup-delay-us = 5;
enable-active-high;
gpio = pio 7 23 0;
};

and this problem did not show up on the hardware-wise rather similar
Cubietech Cubietruck (same SoC, same external PHY, but no
GPIO-controlled regulator for the PHY).  Further tests have shown that
increasing the startup-delay for the regulator solves the problem.  The
current sun7i-a20-bananapi.dts file (in linux-next, intended to go into
kernel 3.19) sets startup-delay-us for the PHY's regulator to 5.  On
my Banana Pi board, even with a value of 55000, the PHY detection does
usually not work on the first probing inside d-i.  Increasing the value
to 57500 results in a successful probing most of the time, but not
always; only setting it to 6 results in a reliable PHY detection
for me.

Following is a patch to increase the startup delay in the Banana Pi dts.

Regards,
Karsten

Karsten Merker (1):
  ARM: dts: sunxi: Banana Pi: increase startup-delay for the GMAC PHY
regulator

 arch/arm/boot/dts/sun7i-a20-bananapi.dts |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Changes since V1:
- increased the delay from 6us to 10us to have a certain
  safety margin and cater for manufacturing variations as proposed
  by Hans de Goede.

-- 
1.7.10.4

-- 
You received this message because you are subscribed to the Google Groups 
linux-sunxi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH V2 1/1] ARM: dts: sunxi: Banana Pi: increase startup-delay for the GMAC PHY regulator

2014-11-11 Thread Karsten Merker
On the LeMaker Banana Pi, probing the external ethernet PHY connected
to the SoC's internal GMAC module sometimes fails. The PHY power
supply is handled via a GPIO-controlled regulator, and the existing
regulator startup-delay of 5us is too short to make sure that the
PHY is always fully powered up when it is queried by phylib. Tests
have shown that to provide a reliable PHY detection, the startup-delay
has to be increased to at least 6us. To have a certain safety margin
and to cater for manufacturing variations between different boards,
the delay gets set to 10us as discussed on the linux-arm-kernel
mailinglist.

Signed-off-by: Karsten Merker mer...@debian.org
Acked-by: Hans de Goede hdego...@redhat.com
---
 arch/arm/boot/dts/sun7i-a20-bananapi.dts |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/sun7i-a20-bananapi.dts 
b/arch/arm/boot/dts/sun7i-a20-bananapi.dts
index 3de847d..1cf1214 100644
--- a/arch/arm/boot/dts/sun7i-a20-bananapi.dts
+++ b/arch/arm/boot/dts/sun7i-a20-bananapi.dts
@@ -207,7 +207,7 @@
regulator-name = gmac-3v3;
regulator-min-microvolt = 330;
regulator-max-microvolt = 330;
-   startup-delay-us = 5;
+   startup-delay-us = 10;
enable-active-high;
gpio = pio 7 23 0;
};
-- 
1.7.10.4

-- 
You received this message because you are subscribed to the Google Groups 
linux-sunxi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.