diff mbox

mvsdio not working on OpenRD

Message ID 20160110153843.GA22229@lunn.ch (mailing list archive)
State New, archived
Headers show

Commit Message

Andrew Lunn Jan. 10, 2016, 3:38 p.m. UTC
On Sat, Jan 09, 2016 at 08:26:19PM -0800, Martin Michlmayr wrote:
> Rick Thomas reported that MMC no longer works on his OpenRD Base.
> 
> With Debian's 3.16 kernel (using mach ID):
> 
> mvsdio mvsdio: no pins associated
> mmc0: host does not support reading read-only switch.  assuming write-enable.
> mmc0: new high speed SDHC card at address 0007
> mmcblk0: mmc0:0007 SD4GB 3.70 GiB·
>  mmcblk0: p1
> 
> With Debian's 4.3 and 4.4-rc8 kernels (using Device Tree):
> 
> kirkwood-pinctrl f1010000.pin-controller: pin PIN13 already requested by f1012100.serial; cannot claim for f1090000.mvsdio
> kirkwood-pinctrl f1010000.pin-controller: pin-13 (f1090000.mvsdio) status -22
> kirkwood-pinctrl f1010000.pin-controller: could not request pin 13 (PIN13) from group mpp13  on device f1010000.pin-controller
> mvsdio f1090000.mvsdio: Error applying setting, reverse things back
> mvsdio f1090000.mvsdio: Got CD GPIO
> [and no mmc0 or mmcblk0]
> 
> -- 
> Martin Michlmayr
> http://www.cyrius.com/

Hi Rick, Martin

If i remember correctly, the OpenRD has some odd muxing going on with
MMC and the second serial port. This fits the error message:

                        pmx_uart1: pmx-uart1 {
                                marvell,pins = "mpp13", "mpp14";
                                marvell,function = "uart1";
                        };

and

                        pmx_sdio: pmx-sdio {
                                marvell,pins = "mpp12", "mpp13", "mpp14",
                                               "mpp15", "mpp16", "mpp17";
                                marvell,function = "sdio";
			};

Either you can have MMC, or you can have the RS-232/RS485 on a DB9 or
you can have MMC. You cannot have both.

It seems like older Debian kernels has defaulted to MMC, so we should
probably disable the serial port.

Please can you try the following patch. If this works, i can add it to
mainline. The issue we might run into is that somebody else wants
serial not MMC....

       Andrew

Comments

Rick Thomas Jan. 10, 2016, 9:19 p.m. UTC | #1
On Jan 10, 2016, at 7:38 AM, Andrew Lunn <andrew@lunn.ch> wrote:

> On Sat, Jan 09, 2016 at 08:26:19PM -0800, Martin Michlmayr wrote:
>> Rick Thomas reported that MMC no longer works on his OpenRD Base.
>> 
>> With Debian's 3.16 kernel (using mach ID):
>> 
>> mvsdio mvsdio: no pins associated
>> mmc0: host does not support reading read-only switch.  assuming write-enable.
>> mmc0: new high speed SDHC card at address 0007
>> mmcblk0: mmc0:0007 SD4GB 3.70 GiB·
>> mmcblk0: p1
>> 
>> With Debian's 4.3 and 4.4-rc8 kernels (using Device Tree):
>> 
>> kirkwood-pinctrl f1010000.pin-controller: pin PIN13 already requested by f1012100.serial; cannot claim for f1090000.mvsdio
>> kirkwood-pinctrl f1010000.pin-controller: pin-13 (f1090000.mvsdio) status -22
>> kirkwood-pinctrl f1010000.pin-controller: could not request pin 13 (PIN13) from group mpp13  on device f1010000.pin-controller
>> mvsdio f1090000.mvsdio: Error applying setting, reverse things back
>> mvsdio f1090000.mvsdio: Got CD GPIO
>> [and no mmc0 or mmcblk0]
>> 
>> -- 
>> Martin Michlmayr
>> http://www.cyrius.com/
> 
> Hi Rick, Martin
> 
> If i remember correctly, the OpenRD has some odd muxing going on with
> MMC and the second serial port. This fits the error message:
> 
>                        pmx_uart1: pmx-uart1 {
>                                marvell,pins = "mpp13", "mpp14";
>                                marvell,function = "uart1";
>                        };
> 
> and
> 
>                        pmx_sdio: pmx-sdio {
>                                marvell,pins = "mpp12", "mpp13", "mpp14",
>                                               "mpp15", "mpp16", "mpp17";
>                                marvell,function = "sdio";
> 			};
> 
> Either you can have MMC, or you can have the RS-232/RS485 on a DB9 or
> you can have MMC. You cannot have both.
> 
> It seems like older Debian kernels has defaulted to MMC, so we should
> probably disable the serial port.
> 
> Please can you try the following patch. If this works, i can add it to
> mainline. The issue we might run into is that somebody else wants
> serial not MMC....
> 
>       Andrew
> 
> diff --git a/arch/arm/boot/dts/kirkwood-openrd-base.dts b/arch/arm/boot/dts/kirkwood-openrd-base.dts
> index 8af58999606d..883bd416ba0b 100644
> --- a/arch/arm/boot/dts/kirkwood-openrd-base.dts
> +++ b/arch/arm/boot/dts/kirkwood-openrd-base.dts
> @@ -18,11 +18,6 @@
> / {
>        model = "OpenRD Base";
>        compatible = "marvell,openrd-base", "marvell,openrd", "marvell,kirkwood-88f6281", "marvell,kirkwood";
> -
> -       ocp@f1000000 {
> -               serial@12100 {
> -                       status = "okay";
> -               };
>        };
> };

OK, I understand the issue, and what the patch would mean.  Given that Debian releases up thru Jessie have chosen to support MMC rather than RS-232/RS485, I don’t think there will be many Debian users who would complain.

Unfortuntaely, I’m not set up to build kernels here.  If someone can apply this patch and send me a link to the resulting binary or .deb or .dts, or … I’ll be happy to try it out on my test machine.

Thanks!
Rick
Aaro Koskinen Jan. 15, 2016, 6:03 p.m. UTC | #2
Hi,

On Sun, Jan 10, 2016 at 04:38:43PM +0100, Andrew Lunn wrote:
> If i remember correctly, the OpenRD has some odd muxing going on with
> MMC and the second serial port. This fits the error message:
> 
>                         pmx_uart1: pmx-uart1 {
>                                 marvell,pins = "mpp13", "mpp14";
>                                 marvell,function = "uart1";
>                         };
> 
> and
> 
>                         pmx_sdio: pmx-sdio {
>                                 marvell,pins = "mpp12", "mpp13", "mpp14",
>                                                "mpp15", "mpp16", "mpp17";
>                                 marvell,function = "sdio";
> 			};
> 
> Either you can have MMC, or you can have the RS-232/RS485 on a DB9 or
> you can have MMC. You cannot have both.
> 
> It seems like older Debian kernels has defaulted to MMC, so we should
> probably disable the serial port.

In addition, the UART/SD selection GPIO needs to be set up. I sent a
patch proposal for this:

	http://marc.info/?l=linux-arm-kernel&m=145262936504783&w=2

> Please can you try the following patch. If this works, i can add it to
> mainline. The issue we might run into is that somebody else wants
> serial not MMC....

I use mainline kernel only, and I also think the default should be SD
like it used to be with legacy boot...

A.
Martin Michlmayr Jan. 15, 2016, 7:22 p.m. UTC | #3
* Aaro Koskinen <aaro.koskinen@iki.fi> [2016-01-15 20:03]:
> On Sun, Jan 10, 2016 at 04:38:43PM +0100, Andrew Lunn wrote:
> > If i remember correctly, the OpenRD has some odd muxing going on with
> > MMC and the second serial port. This fits the error message:

Andrew, your memory is good!  I looked at the old board file and
noticed there used to be a kw_openrd_init_uart1 kernel option to
choose.  The default was MMC (this was not a Debian choice, but one
from kernel.org), so I think that should become the default again.

See https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/diff/arch/arm/mach-kirkwood/openrd-setup.c?id=ba364fc752daeded072a5ef31e43b84cb1f9e5fd

Rick Thomas did some tests we came to the conclusion that MMC on DTB
doesn't work, even with your patch.  We established that the same
kernel (3.16) works with the board file but not with DTB.  I was about
to send an udpate when I saw Aaro's email.

I suggested we put in both of these patches.  I'll produce a test
kernel for Rick with Aaro's patch.

> In addition, the UART/SD selection GPIO needs to be set up. I sent a
> patch proposal for this:
> 	http://marc.info/?l=linux-arm-kernel&m=145262936504783&w=2

Thanks!

> I use mainline kernel only, and I also think the default should be SD
> like it used to be with legacy boot...

Agreed.  It's unfortunate that we found out so late about the change,
but I think MMC is the right choice and in line with what users expect.
Aaro Koskinen Jan. 15, 2016, 10 p.m. UTC | #4
Hi,

On Fri, Jan 15, 2016 at 11:22:17AM -0800, Martin Michlmayr wrote:
> * Aaro Koskinen <aaro.koskinen@iki.fi> [2016-01-15 20:03]:
> > On Sun, Jan 10, 2016 at 04:38:43PM +0100, Andrew Lunn wrote:
> > > If i remember correctly, the OpenRD has some odd muxing going on with
> > > MMC and the second serial port. This fits the error message:
> 
> Andrew, your memory is good!  I looked at the old board file and
> noticed there used to be a kw_openrd_init_uart1 kernel option to
> choose.  The default was MMC (this was not a Debian choice, but one
> from kernel.org), so I think that should become the default again.
> 
> See https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/diff/arch/arm/mach-kirkwood/openrd-setup.c?id=ba364fc752daeded072a5ef31e43b84cb1f9e5fd
> 
> Rick Thomas did some tests we came to the conclusion that MMC on DTB
> doesn't work, even with your patch.  We established that the same
> kernel (3.16) works with the board file but not with DTB.  I was about
> to send an udpate when I saw Aaro's email.
> 
> I suggested we put in both of these patches.  I'll produce a test
> kernel for Rick with Aaro's patch.
> 
> > In addition, the UART/SD selection GPIO needs to be set up. I sent a
> > patch proposal for this:
> > 	http://marc.info/?l=linux-arm-kernel&m=145262936504783&w=2
> 
> Thanks!

BTW, the GPIO hogging binding used in the patch might not be supported
by the old Debian 3.16 kernel. :-(

One workaround would be to setup the GPIO from userspace using sysfs,
but that would need replug of the SD card (unbind/bind, or if the driver
a module unload/reload, might work), but that's quite clumsy...

A.
Martin Michlmayr Jan. 17, 2016, 10:42 p.m. UTC | #5
* Andrew Lunn <andrew@lunn.ch> [2016-01-10 16:38]:
> Please can you try the following patch. If this works, i can add it to
> mainline. The issue we might run into is that somebody else wants
> serial not MMC....

This works fine on the OpenRD-Base (together with Aaro's patch), as
tested by Rick Thomas.

Reported-by: Rick Thomas <rbthomas@pobox.com>
Tested-by: Rick Thomas <rbthomas@pobox.com>
Reviewed-by: Martin Michlmayr <tbm@cyrius.com>

>        Andrew
> 
> diff --git a/arch/arm/boot/dts/kirkwood-openrd-base.dts b/arch/arm/boot/dts/kirkwood-openrd-base.dts
> index 8af58999606d..883bd416ba0b 100644
> --- a/arch/arm/boot/dts/kirkwood-openrd-base.dts
> +++ b/arch/arm/boot/dts/kirkwood-openrd-base.dts
> @@ -18,11 +18,6 @@
>  / {
>         model = "OpenRD Base";
>         compatible = "marvell,openrd-base", "marvell,openrd", "marvell,kirkwood-88f6281", "marvell,kirkwood";
> -
> -       ocp@f1000000 {
> -               serial@12100 {
> -                       status = "okay";
> -               };
>         };
>  };
Martin Michlmayr Jan. 17, 2016, 11:05 p.m. UTC | #6
* Aaro Koskinen <aaro.koskinen@iki.fi> [2016-01-16 00:00]:
> BTW, the GPIO hogging binding used in the patch might not be
> supported by the old Debian 3.16 kernel. :-(

We don't actually care about 3.16.  Debian's 3.16 uses the board file
anyway, so none of these bugs show up.  (However, 3.16 is often a good
way to test since it has support both for board file and DTB.)
diff mbox

Patch

diff --git a/arch/arm/boot/dts/kirkwood-openrd-base.dts b/arch/arm/boot/dts/kirkwood-openrd-base.dts
index 8af58999606d..883bd416ba0b 100644
--- a/arch/arm/boot/dts/kirkwood-openrd-base.dts
+++ b/arch/arm/boot/dts/kirkwood-openrd-base.dts
@@ -18,11 +18,6 @@ 
 / {
        model = "OpenRD Base";
        compatible = "marvell,openrd-base", "marvell,openrd", "marvell,kirkwood-88f6281", "marvell,kirkwood";
-
-       ocp@f1000000 {
-               serial@12100 {
-                       status = "okay";
-               };
        };
 };