Hi,
After finding out the gpio points for my WRT54G *v1.0* I have been trying to use mmc.o with no luck:
(whiterussian 0.9 - clean flash)
root@OpenWrt:/# insmod ./mmc.o
Using ./mmc.o
Segmentation fault
Dump:
mmc Hardware init
Data bus error, epc == c00b0f18, ra == c00b0f0c
Oops in traps.c::do_be, line 385:
$0 : 00000000 1000fc00 b8000060 c00b0000 b8000068 00000000 0000001f 8037a420
$8 : 00000000 00001890 00001890 0000187b 801a0000 801a0000 801a0000 00000001
$16: 00000000 80013514 100df418 80010000 00000060 c00b0000 c00b0000 100dde68
$24: ba2e8ba3 801a95d4 80eb0000 80eb1e30 00000007 c00b0f0c
Hi : 00000000
Lo : 000005a0
epc : c00b0f18 Tainted: P
Status: 1000fc03
Cause : 0000001c
PrId : 00024000
Process insmod (pid: 604, stackpage=80eb0000)
Stack: 100df418 00000001 801e0000 1000fc01 000de000 0000001a 8002c4bc
8002c3a0 1000fc01 c00b0000 100df418 ffffffea 00000060 809c6b60 00000007
c00b0000 100df418 ffffffea 00000060 809c6b60 80957000 100dde68 80014978
80014898 80239800 000001f2 000007df 00000002 00000060 c00e3000 c00b0060
00001e48 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 ...
Call Trace: [<8002c4bc>] [<8002c3a0>] [<80014978>] [<80014898>] [<c00b0060>]
[<80008a00>] [<8005bdac>]
Code: 3c03c00b 8c641604 3c03c00b <8c820000> 344200a8 304200ef ac820000 8c641600 3c02c00b
Apparently this is due to some gpio structure diference for v1.0 than other versions, as mbm and nbd pointed out. They suggested that, since diag correctly manages gpios in this model from diag.c could be seen what needed to be changed in mmc. But my knowledge of C is very limited.
The only thing i could figure out is that, this is the difference in the structure:
<<from diag.c>>
[WRT54GV1] = {
118 .name = "Linksys WRT54G V1.x",
119 .buttons = {
120 { .name = "reset", .gpio = 1 << 6 },
121 },
122 .leds = {
123 { .name = "diag", .gpio = 0x13 | GPIO_TYPE_EXTIF, .polarity = NORMAL },
124 { .name = "dmz", .gpio = 0x12 | GPIO_TYPE_EXTIF, .polarity = NORMAL },
125 },
126 },
127 [WRT54G] = {
128 .name = "Linksys WRT54G/GS/GL",
129 .buttons = {
130 { .name = "reset", .gpio = 1 << 6 },
131 { .name = "ses", .gpio = 1 << 4 },
132 },
133 .leds = {
134 { .name = "power", .gpio = 1 << 1, .polarity = NORMAL },
135 { .name = "dmz", .gpio = 1 << 7, .polarity = REVERSE },
136 { .name = "ses_white", .gpio = 1 << 2, .polarity = REVERSE },
137 { .name = "ses_orange", .gpio = 1 << 3, .polarity = REVERSE },
138 { .name = "wlan", .gpio = 1 << 0, .polarity = REVERSE },
139 },
140 },
<<from diag.h>>
107 #define GPIO_TYPE_NORMAL (0x0 << 24)
108 #define GPIO_TYPE_EXTIF (0x1 << 24)
So I though that if GPIO 7 was being hadled in such a different way, and I had another two extra gpios to use, it would be just easier to swap GPIO 7 for GPIO 6 and forget about the "different" gpio... So i changed it like:
#define SD_DI 0x20
#define SD_DO 0x10
#define SD_CLK 0x08
#define SD_CS 0x40 <- I changed gpio 7 for gpio 6 which is available on my board (and also gpio 1 - no serial in this model)
with a gpiomask of 0x5c .....
No luck, once again it seg faults... Probably I just dont understant it and what I am trying doesnt make sense...
Cyril perhaps could you fix it to work with V1.0?
I don't know what else to do.
I would supposse that it should work just not using gpio 7 because, also when using the gpio utility for locating the gpio points all were correctly located and operating except gpio 7 and gpio 0, even though writing to /proc/diag/led/DMZ or DIAG would correctly change the led. (but no action using gpio utility).
I hope something of this makes any sense to anyone and comes a fix. Thanks for the great work!
P.D.: The same problem happens with V1.1. Another guy (_trine) also figured the gpio points for that board but mmc behaviour is the same as in v1.0.