• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: mmc issue with eSATA plugs  (Read 2323 times)
marcus
Jr. Member
**

Karma: 5
Posts: 83


View Profile
« on: November 27, 2010, 04:51:33 AM »

I have encountered a problem, which I have traced back to the kernel, when using an SD card on an eSATA plug that boots from NAND.

The problem is that the SD card is not recognised at all, but in some cases it may be recognised if it is inserted in a particular way (ie very quickly), or perhaps the first SD card that is inserted is recognised, but after it is removed, no other SD cards may be recognised.

My investigations tell me:

  • SATA support (using the "sata_mv" module) was first offered in kernel version 2.6.33
  • "Official support" for the eSATA Sheevaplug arrived with 2.6.34
  • On an eSATA plug, with all kernels since 2.6.34, /dev/mmcblk0 is just fine if the plug is booted with arcNumber 2097
  • Conversely, with all kernels since 2.6.34, if an eSATA plug is booted with arcNumber 2678, /dev/mmcblk0 is not recognised
  • In the kernel source, in arch/arm/mach-kirkwood/sheevaplug-setup.c, there is some relevant code


Here are fragments of the code that I have been looking at:

Code:
static struct mvsdio_platform_data sheevaplug_mvsdio_data = {
/* unfortunately the CD signal has not been connected */
};

static struct mvsdio_platform_data sheeva_esata_mvsdio_data = {
.gpio_write_protect = 44, /* MPP44 used as SD write protect */
.gpio_card_detect = 47,   /* MPP47 used as SD card detect */
};

Code:
static unsigned int sheevaplug_mpp_config[] __initdata = {
MPP29_GPIO, /* USB Power Enable */
MPP49_GPIO, /* LED */
0
};

static unsigned int sheeva_esata_mpp_config[] __initdata = {
MPP29_GPIO, /* USB Power Enable */
MPP44_GPIO, /* SD Write Protect */
MPP47_GPIO, /* SD Card Detect */
MPP49_GPIO, /* LED Green */
0
};

And here is where those different settings come into play:

Code:
/* setup gpio pin select */
if (machine_is_sheeva_esata())
kirkwood_mpp_conf(sheeva_esata_mpp_config);
else
kirkwood_mpp_conf(sheevaplug_mpp_config)

Code:
/* enable sd wp and sd cd on plugs with esata */
if (machine_is_sheeva_esata())
kirkwood_sdio_init(&sheeva_esata_mvsdio_data);
else
kirkwood_sdio_init(&sheevaplug_mvsdio_data);

Given the symptoms (that an eSATA plug can cope just fine with SD cards when it boots with arcNumber 2097 - albeit without the ability to use the eSATA port), it seems to me that the problem must lie here.

I don't know why there are different GPIO settings for eSATA and non-eSATA plugs, and by hacking the code I've so far only been able to create a totally non-bootable kernel. I'll try to find time again tomorrow to try again.
Logged

cjm
Jr. Member
**

Karma: 6
Posts: 69


View Profile
« Reply #1 on: November 29, 2010, 01:06:56 PM »

That's indeed odd -- I, too, was under the impression that there's no hardware difference between the original Sheevaplug and the eSATA models from NewIT (except the eSATA port being soldered onto the circuit board, of course).

Maybe Martin is reading this and has a clue? He is maintaining the Debian ARM kernels... You may also try to send him an email -- he usually replies very quickly and helpfully; his email address can be found on his web page (http://www.cyrius.com/contact)

Thanks,
--Christian
Logged

marcus
Jr. Member
**

Karma: 5
Posts: 83


View Profile
« Reply #2 on: December 07, 2010, 02:49:40 PM »

So ... I created a 2.6.36 kernel with the sheeva.with-linux.com config and a patch that eliminated the eSATA differences listed above.

Here's the patch. Apologies if the format is incorrect - I've commented out 4 lines in total - the 4 lines that begin +// in the code below.

Code:
--- arch/arm/mach-kirkwood/sheevaplug-setup.c.original 2010-11-13 14:25:56.000000000 +0000
+++ arch/arm/mach-kirkwood/sheevaplug-setup.c 2010-12-05 14:59:46.000000000 +0000
@@ -52,8 +52,8 @@
 };
 
 static struct mvsdio_platform_data sheeva_esata_mvsdio_data = {
- .gpio_write_protect = 44, /* MPP44 used as SD write protect */
- .gpio_card_detect = 47,   /* MPP47 used as SD card detect */
+// .gpio_write_protect = 44, /* MPP44 used as SD write protect */
+// .gpio_card_detect = 47,   /* MPP47 used as SD card detect */
 };
 
 static struct gpio_led sheevaplug_led_pins[] = {
@@ -86,8 +86,8 @@
 
 static unsigned int sheeva_esata_mpp_config[] __initdata = {
  MPP29_GPIO, /* USB Power Enable */
- MPP44_GPIO, /* SD Write Protect */
- MPP47_GPIO, /* SD Card Detect */
+// MPP44_GPIO, /* SD Write Protect */
+// MPP47_GPIO, /* SD Card Detect */
  MPP49_GPIO, /* LED Green */
  0
 };

This does seem to eliminate the problems I reported in my first post. As to whether this is an appropriate way to fix those problems ...?
Logged

cjm
Jr. Member
**

Karma: 6
Posts: 69


View Profile
« Reply #3 on: December 08, 2010, 12:07:14 PM »

Quote
This does seem to eliminate the problems I reported in my first post. As to whether this is an appropriate way to fix those problems ...?

Looks fine to me at a glance. Maybe you want to send an email to Martin, or submit a defect on bugs.debian.org, so he can have a look and fix the Debian kernel?

Thanks,
--Christian
Logged

johnbock
Newbie
*

Karma: 0
Posts: 2


View Profile
« Reply #4 on: December 14, 2010, 12:31:10 PM »

Hi Marcus,

I had tested the original patch that went into the kernel, before I posted it. Unfortunately, I don't think I tested booting from the SD.
I do however remember, changing the SD initialization routine after thoroughly testing the eSATA patch. Keeping the SD initialization
for eSATA and the "normal" Sheeva Plug identical will simplify the code...

It seems as if the schematic I used as reference isn't universal. Being that the proposed patch works for you, it may also work for a plethora of sheeva based plugs.
http://plugcomputer.org/data/docs/Sheeva-PowerPlug-V1.3-GTI-090906.pdf

However, before posting the patch to the arm kernel people, it may be worth a try to get some kind of answer from the manufacturer.
The guys at http://www.newit.co.uk/forum/ are pretty good and seem to have connections to Globalscale. And/or you can contact Globalscale directly...

As far as I am concerned you can post the patch to arm kernel list...
Before posting, I would suggest removing the commented lines below or use C comment conventions...


So ... I created a 2.6.36 kernel with the sheeva.with-linux.com config and a patch that eliminated the eSATA differences listed above.

Here's the patch. Apologies if the format is incorrect - I've commented out 4 lines in total - the 4 lines that begin +// in the code below.

Code:
--- arch/arm/mach-kirkwood/sheevaplug-setup.c.original 2010-11-13 14:25:56.000000000 +0000
+++ arch/arm/mach-kirkwood/sheevaplug-setup.c 2010-12-05 14:59:46.000000000 +0000
@@ -52,8 +52,8 @@
 };
 
 static struct mvsdio_platform_data sheeva_esata_mvsdio_data = {
- .gpio_write_protect = 44, /* MPP44 used as SD write protect */
- .gpio_card_detect = 47,   /* MPP47 used as SD card detect */
+// .gpio_write_protect = 44, /* MPP44 used as SD write protect */
+// .gpio_card_detect = 47,   /* MPP47 used as SD card detect */
 };
 
 static struct gpio_led sheevaplug_led_pins[] = {
@@ -86,8 +86,8 @@
 
 static unsigned int sheeva_esata_mpp_config[] __initdata = {
  MPP29_GPIO, /* USB Power Enable */
- MPP44_GPIO, /* SD Write Protect */
- MPP47_GPIO, /* SD Card Detect */
+// MPP44_GPIO, /* SD Write Protect */
+// MPP47_GPIO, /* SD Card Detect */
  MPP49_GPIO, /* LED Green */
  0
 };

This does seem to eliminate the problems I reported in my first post. As to whether this is an appropriate way to fix those problems ...?
Logged

Pages: [1]
Print
Jump to: