OpenWrt Forum Archive

Topic: Dir-300 B1 MMC Hack

The content of this topic has been archived between 7 Apr 2018 and 18 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Thank you for being so interested in my problem,

I understand that these modules take off with the system, but unfortunately can not help himself with a script that turns them off, and to give it priority, how would you find even a moment of time to write such a script that I put in / etc / init.d I would be very very grateful.

Second question:

or for test is a command which I can use to used to disable the modules to a running system

3rd question:

maybe if I give you the address to my ssh, check what can be done?

thanx for help

root@OpenWrt:~# ls
root@OpenWrt:~# lsmod | grep -i gpio
gpiommc                 3600  2
spi_gpio_old            2192  1 gpiommc
spi_gpio                3744  0
spi_bitbang             2848  2 spi_gpio_old,spi_gpio
gpio_keys_polled        2064  0
input_polldev           1696  1 gpio_keys_polled
input_core             20000  4 button_hotplug,gpio_keys_polled,input_polldev


root@OpenWrt:~# rmmod gpio_keys_polled
root@OpenWrt:~# lsmod | grep -i button


button_hotplug          2656  0
input_core             20000  2 button_hotplug,input_polldev


root@OpenWrt:~# rmmod button_hotplug
root@OpenWrt:~# /etc/init.d/mmc_over_gpio stop
root@OpenWrt:~# /etc/init.d/mmc_over_gpio start


configfs on /config type configfs (rw,relatime)

root@OpenWrt:~# dmesg | grep -i mmc


[   38.890000] gpio-mmc: Failed to request mmc_spi module.
[   38.910000] gpio-mmc: MMC-Card "default" attached to GPIO pins di=9, do=13, clk=8, cs=0
[ 1176.970000] gpio-mmc: GPIO based MMC-Card "default" removed
[ 1185.490000] gpio-mmc: Failed to request mmc_spi module.
[ 1185.510000] mmc_spi spi32766.0: ASSUMING 3.2-3.4 V slot power
[ 1185.520000] mmc_spi spi32766.0: SD/MMC host mmc0, no DMA, no WP, no poweroff
[ 1185.530000] gpio-mmc: MMC-Card "default" attached to GPIO pins di=9, do=13, clk=8, cs=0
[ 1185.570000] mmc_spi spi32766.0: setup: unsupported mode bits 4
[ 1185.590000] mmc_spi spi32766.0: can't change chip-select polarity
root@OpenWrt:~#

what can i made now?

(Last edited by finch84 on 13 Mar 2014, 20:50)

Maybe this helps now:

podly wrote:

Some progress.. I removed LEDs - WPS and Power. Also rearrange connections and change to smaller SD CARD - it is detected now, but I have problems with errors:

i remove led-s from board and have the same problem.

i make new connection to sd card

Button                      (gpio0)     connect to       data in     [02 pin ] SDcard
Amber status led       (gpio9)     connect to         CS         [01 pin] SDCard
Green  status led       (gpio8)     connect to     data out     [07 pin] SDCard
Blue WPS led            (gpio13)    connect to         clk         [05 pin] SDCard

make new file  /etc/config/mmc_over_gpio

config 'mmc_over_gpio'
        option 'name' 'default'
        option 'enabled' '1'
        option 'DI_pin' '0'
        option 'DO_pin' '8'
        option 'CLK_pin' '13'
        option 'CS_pin' '9'
        option 'mode' '0'

And have this resoult in dmesg:

[  362.870000] gpio-mmc: Failed to request mmc_spi module.
[  362.890000] mmc_spi spi32764.0: ASSUMING 3.2-3.4 V slot power
[  362.900000] mmc_spi spi32764.0: SD/MMC host mmc0, no DMA, no WP, no poweroff
[  362.910000] gpio-mmc: MMC-Card "default" attached to GPIO pins di=0, do=8, clk=13, cs=9
[  365.960000] mmc_spi spi32764.0: setup: unsupported mode bits 4
[  365.970000] mmc_spi spi32764.0: can't change chip-select polarity
[  366.000000] mmc0: host doesn't support card's voltages
[  366.010000] mmc0: error -22 whilst initialising SDIO card
[  366.030000] mmc0: host doesn't support card's voltages
[  366.040000] mmc0: error -22 whilst initialising SD card
[  366.050000] mmc0: host doesn't support card's voltages
[  366.060000] mmc0: error -22 whilst initialising MMC card

meyby some can help now smile

Have you tried different SD-Cards? It seemed that some cards work better than others (and sometimes older/smaller ones better than newer/bigger ones).
Also, did you remove the debounce circuits from the button-GPIO? I think they have a bigger influence on signal quality than the circuits for LEDs.

hello Again smile


i use again the pineout from:

Podly

DONE!
Changed GPIOs to
Data Input = GPIO9 (Green Power LED)
Data Output = GPIO13 (WPS LED)
Clock = GPIO8 (Amber Power LED)
ChipSel = GPIO0 (WPS Switch)

and have good news smile

my card slot its bad and open self

if i push it, all its ok

its my new dmsg:


[  128.860000] gpio-mmc: Failed to request mmc_spi module.
[  128.880000] mmc_spi spi32765.0: ASSUMING 3.2-3.4 V slot power
[  128.890000] mmc_spi spi32765.0: SD/MMC host mmc0, no DMA, no WP, no poweroff
[  128.900000] gpio-mmc: MMC-Card "default" attached to GPIO pins di=9, do=13, clk=8, cs=0
[  128.940000] mmc_spi spi32765.0: setup: unsupported mode bits 4
[  128.950000] mmc_spi spi32765.0: can't change chip-select polarity
[  129.020000] mmc0: host does not support reading read-only switch. assuming write-enable.
[  129.030000] mmc0: new SD card on SPI
[  129.040000] mmcblk0: mmc0:0000 SA02G 1.83 GiB
[  129.120000]  mmcblk0: p1
[  266.830000] mmc0: SPI card removed
[  266.840000] gpio-mmc: GPIO based MMC-Card "default" removed


[  283.270000] gpio-mmc: Failed to request mmc_spi module.
[  283.290000] mmc_spi spi32764.0: ASSUMING 3.2-3.4 V slot power
[  283.300000] mmc_spi spi32764.0: SD/MMC host mmc0, no DMA, no WP, no poweroff
[  283.310000] gpio-mmc: MMC-Card "default" attached to GPIO pins di=9, do=13, clk=8, cs=0
[  283.350000] mmc_spi spi32764.0: setup: unsupported mode bits 4
[  283.360000] mmc_spi spi32764.0: can't change chip-select polarity
[  283.580000] mmc0: host does not support reading read-only switch. assuming write-enable.
[  283.590000] mmc0: new SD card on SPI
[  283.610000] mmcblk0: mmc0:0000 SD    1.85 GiB
[  283.660000]  mmcblk0: p1
[  310.070000] mmc0: SPI card removed
[  310.090000] gpio-mmc: GPIO based MMC-Card "default" removed


[  343.080000] gpio-mmc: Failed to request mmc_spi module.
[  343.090000] mmc_spi spi32763.0: ASSUMING 3.2-3.4 V slot power
[  343.100000] mmc_spi spi32763.0: SD/MMC host mmc0, no DMA, no WP, no poweroff
[  343.120000] gpio-mmc: MMC-Card "default" attached to GPIO pins di=9, do=13, clk=8, cs=0
[  343.160000] mmc_spi spi32763.0: setup: unsupported mode bits 4
[  343.170000] mmc_spi spi32763.0: can't change chip-select polarity
[  343.380000] mmc0: host does not support reading read-only switch. assuming write-enable.
[  343.400000] mmc0: new SDHC card on SPI
[  343.410000] mmcblk0: mmc0:0000 SU08G 7.40 GiB
[  343.480000]  mmcblk0: p1 p2
[ 1280.100000] mmc0: SPI card removed
[ 1280.110000] gpio-mmc: GPIO based MMC-Card "default" removed


[ 1305.890000] gpio-mmc: Failed to request mmc_spi module.
[ 1305.910000] mmc_spi spi32762.0: ASSUMING 3.2-3.4 V slot power
[ 1305.920000] mmc_spi spi32762.0: SD/MMC host mmc0, no DMA, no WP, no poweroff
[ 1305.940000] gpio-mmc: MMC-Card "default" attached to GPIO pins di=9, do=13, clk=8, cs=0
[ 1305.980000] mmc_spi spi32762.0: setup: unsupported mode bits 4
[ 1305.990000] mmc_spi spi32762.0: can't change chip-select polarity
[ 1306.530000] mmc0: host does not support reading read-only switch. assuming write-enable.
[ 1306.550000] mmc0: new SDHC card on SPI
[ 1306.560000] mmcblk0: mmc0:0000 SD    29.4 GiB
[ 1306.620000]  mmcblk0:

Realy thanx for help MBS



now i need write a scrip to automatical remove the modules

i made file /etc/init.d/proceskill

edit:

#!/bin/sh
START=89
rmmod leds_gpio
rmmod button_hotplug
rmmod gpio_keys_polled
rmmod input_polldev
rmmod input_core



but this dont wont start automatical in boot, i activate it in webgui   system--->startup, but dont start in boot.

i give chmod 777 /etc/init.d/proceskill
and if i start it in console /etc/init.d/proceskill --> all its ok, but dont want start automatical

pls help, i need to mount this card and dont know what i need to use






EDIT :::



i use section Webui----->system------->startup, and in local startup i write:



# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
rmmod leds_gpio
rmmod button_hotplug
rmmod gpio_keys_polled
rmmod input_polldev
rmmod input_core
sleep 2
/etc/init.d/mmc_over_gpio start
exit 0



next i reboot router and all its good.


now i need mount the SD card,
have problem becouste my opkg can't install packages:

root@OpenWrt:/mnt# opkg install block-mount block-hotplug kmod-fs-vfat kmod-nls-
cp437 kmod-nls-iso8859-1
Unknown package 'block-mount'.
Unknown package 'block-hotplug'.
Unknown package 'kmod-fs-vfat'.
Unknown package 'kmod-nls-cp437'.
Unknown package 'kmod-nls-iso8859-1'.
Unknown package 'kmod-fs-ext2'.
Collected errors:
* opkg_install_cmd: Cannot install package block-mount.
* opkg_install_cmd: Cannot install package block-hotplug.
* opkg_install_cmd: Cannot install package kmod-fs-vfat.
* opkg_install_cmd: Cannot install package kmod-nls-cp437.
* opkg_install_cmd: Cannot install package kmod-nls-iso8859-1.
* opkg_install_cmd: Cannot install package kmod-fs-ext2.

Where i can find this package, meyby i must use other src configuration ?


need help.
Thanx

(Last edited by finch84 on 13 Mar 2014, 20:50)

Did you run "opkg update"?
For removing the modules in autostart, have a look in /etc/rc.d. There should be a file called something like S90mmc_over_gpio, which would start the mmc card (assuming you did a "/etc/init.d/mmc_over_gpio enable" once before). Make a copy of it, named something like S89rmmod. Then edit it and delete everything, except the start()-function. Then modify that function to just contain your rmmods. See how that works out.

ok i flash new firmware:

OpenWrt Attitude Adjustment 12.09-beta2

and install

kmod-fs-ext4
block-mount

and storage card success mounted on  /mnt/mmcblk0p1

i try make extroot

format card for ext3 and 100mb swap

use

tar -C /overlay -cvf - . | tar -C /mnt/mmcblk0p1 -xf -

mkdir -p /tmp/cproot
mount --bind / /tmp/cproot
tar -C /tmp/cproot -cvf - . | tar -C /mnt/mmcblk0p1 -xf -
umount /tmp/cproot

use nano /etc/config/fstab

config mount
        option target        /mnt  # This is ignored once is_rootfs is set to 1
        option device        /dev/mmcblk0p1
        option fstype        ext3
        option options       rw,sync
        option enabled       1
        option enabled_fsck  0
        option is_rootfs     1
and reboot

free space on device not changed

i use new fstab

config mount
        option target        /overlay  # This is ignored once is_rootfs is set to 1
        option device        /dev/mmcblk0p1
        option fstype        ext3
        option options       rw,sync
        option enabled       1
        option enabled_fsck  0

and have 1,5 gb free space in web gui
EXTROOT

but if I want to change anything, gets the message

No space left on device

root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
rootfs                    1.1M      1.0M     56.0K  95% /
/dev/root                 1.8M      1.8M         0 100% /rom
tmpfs                    14.6M     68.0K     14.5M   0% /tmp
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/mtdblock5            1.6G     46.5M      1.5G   3% /overlay
overlayfs:/overlay        1.1M      1.0M     56.0K  95% /
/dev/mmcblk0p1            1.6G     46.5M      1.5G   3% /overlay

overlay its doble mounted

I do not know what I can do now.

(Last edited by finch84 on 9 Sep 2014, 21:44)

Good to see that much progress, please give some feedback on how you managed to solve the problems, that you encountered, so that people who may also struggle such issues will know what to do.
Now, better use the stable release of Attitude Adjustment (http://downloads.openwrt.org/attitude_adjustment/12.09/), beta2 is a pretty early development stage. And the other thing is, that you don't need to copy your existing /overlay to the external storage, but can leave it completely empty (fresh formatted) - that's how I did it during the last years and never had any problems this way.

Thanks for the reply

Tell me if you did extroot on Dir300b1 or on another router?
I can not use attitude_adjustment/12.09 / because it does not contain packages for handling file systems, eg kmod-fs-ext4 or even mount_block
I asked you pasted the contents of your fstab file,
when I finish the mod 100%, put an extensive description on the forum.

sorry for my english, in most writing as I can, or I use a translator

Greetings from Polish

I used exactly the same manual and unfortunately my problem is the same as above,



QUOTE:

i try make extroot
format card for ext3 and 100mb swap
use
tar -C /overlay -cvf - . | tar -C /mnt/mmcblk0p1 -xf -
mkdir -p /tmp/cproot
mount --bind / /tmp/cproot
tar -C /tmp/cproot -cvf - . | tar -C /mnt/mmcblk0p1 -xf -
umount /tmp/cproot
use nano /etc/config/fstab
config mount
        option target        /mnt  # This is ignored once is_rootfs is set to 1
        option device        /dev/mmcblk0p1
        option fstype        ext3
        option options       rw,sync
        option enabled       1
        option enabled_fsck  0
        option is_rootfs     1
and reboot
free space on device not changed
i use new fstab
config mount
        option target        /overlay  # This is ignored once is_rootfs is set to 1
        option device        /dev/mmcblk0p1
        option fstype        ext3
        option options       rw,sync
        option enabled       1
        option enabled_fsck  0
and have 1,5 gb free space in web gui
but if I want to change anything, gets the message
No space left on device

What is the output of mount and df in console? And which revision number is your firmware?

t the moment I have no extroot system because they do not know how to do.
My firmware revision is r33883)

root@OpenWrt:~# mount
rootfs on / type rootfs (rw)
/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,noatime)
sysfs on /sys type sysfs (rw,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
tmpfs on /dev type tmpfs (rw,noatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,noatime,mode=600)
/dev/mtdblock5 on /overlay type jffs2 (rw,noatime)
overlayfs:/overlay on / type overlayfs (rw,relatime,lowerdir=/,upperdir=/overlay)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
none on /proc/bus/usb type usbfs (rw,relatime)
configfs on /config type configfs (rw,relatime)
/dev/mmcblk0p1 on /mnt/mmcblk0p1 type ext3 (rw,relatime,user_xattr,barrier=1,nodelalloc,data=ordered)

root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
rootfs                    1.1M    804.0K    284.0K  74% /
/dev/root                 1.8M      1.8M         0 100% /rom
tmpfs                    14.6M    136.0K     14.4M   1% /tmp
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/mtdblock5            1.1M    804.0K    284.0K  74% /overlay
overlayfs:/overlay        1.1M    804.0K    284.0K  74% /
/dev/mmcblk0p1            1.6G     60.5M      1.5G   4% /mnt/mmcblk0p1

Thanx for u time.

I don't know if I am of big help at this point. I recently checked the fstab on my AR71xx device and realized, that I stopped using extroot on it, like 1 or 2 years ago. It was due to the typical USB issues, which caused way too much trouble. So since then, I just mounted my USB flash drive to /srv. And on my ADM5120 runs a version of trunk, where extroot did not work, due to the change to ubox/ubus. Seems to be time to resume working on that one.
So, the only thing I could recommend you is, trying to pivot /overlay with a freshly formatted memory card and checking with df and mount, and also to create dummy files in /overlay using dd.

I did a HW mod for an SD-Card on a dir 615H2. I do have the same problem as described here with the Dir 300 B1 router (overlay seems ok but error with installing software: no space left on device). A short description of what I did:

- HW Mod as on http://wiki.openwrt.org/toh/d-link/dir- … dir-615.h1
- I have installed  ATTITUDE ADJUSTMENT (12.09, r36088)
- Following config:


opkg update
opkg install kmod-mmc-over-gpio luci-app-mmc-over-gpio
opkg remove remove kmod-leds-gpio kmod-input-gpio-keys-polled
rmmod gpio_keys_polled leds_gpio
opkg install kmod-fs-ext4

opkg remove kmod-button-hotplug kmod-ledtrig-usbdev
uci set mmc_over_gpio.@mmc_over_gpio[0].enabled=1
uci set mmc_over_gpio.@mmc_over_gpio[0].DI_pin=7
uci set mmc_over_gpio.@mmc_over_gpio[0].DO_pin=0
uci set mmc_over_gpio.@mmc_over_gpio[0].CLK_pin=9
uci set mmc_over_gpio.@mmc_over_gpio[0].CS_pin=14
uci commit mmc_over_gpio
/etc/init.d/mmc_over_gpio enable
opkg install block-mount




Remove Modules at Boot:
Create a file /etc/init.d/rmmodules
#!/bin/sh /etc/rc.common
# Copyright (C) 2008 OpenWrt.org
START=89

start() {
    rmmod gpio_keys_polled
    rmmod leds_gpio
}

Change rights:
chmod 755 /etc/init.d/rmmodules

Create softlink in
cd /etc/rc.d:
ln –s ../init.d/rmmodules  /etc/rc.d/S89rmmodules


Changed fstab into
config global automount
        option from_fstab 1
        option anon_mount 1

config global autoswap
        option from_fstab 1
        option anon_swap 0

config swap
        option device /dev/sda2
        option enabled 0

config mount
        option target /overlay
        option device /dev/mmcblk0p1
        option options rw,sync
        option fstype ext2
        option enable_fsck 0
        option enabled 1

df:
Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                    1088       664       424  61% /
/dev/root                 1792      1792         0 100% /rom
tmpfs                    14924        80     14844   1% /tmp
tmpfs                      512         0       512   0% /dev
/dev/mtdblock5          250943       126    237761   0% /overlay
overlayfs:/overlay        1088       664       424  61% /
/dev/mmcblk0p1          250943       126    237761   0% /overlay

Mount:
rootfs on / type rootfs (rw)
/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,noatime)
sysfs on /sys type sysfs (rw,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
tmpfs on /dev type tmpfs (rw,noatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,noatime,mode=600)
/dev/mtdblock5 on /overlay type jffs2 (rw,noatime)
overlayfs:/overlay on / type overlayfs (rw,relatime,lowerdir=/,upperdir=/overlay)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
none on /proc/bus/usb type usbfs (rw,relatime)
configfs on /config type configfs (rw,relatime)
/dev/mmcblk0p1 on /overlay type ext2 (rw,sync,relatime,user_xattr,barrier=1)


Is there something I can do to have the overlay working correctly?

Tx

Bart

I'm sorry my friend, but my work stopped. Not got success, above you can see that attempts have done it and ran out ideas, I hope that my previous posts have helped you get to the same stage. In post number 33 revealed a way as to show the amount of free space in the web gui, but unfortunately I managed to get rid of " no space left on device" .
Maybe you'll have better luck if success count on help. Sry for my english i use translator smile

Hello All! I have DiR-300B1. I installed ATTITUDE ADJUSTMENT from:
https://downloads.openwrt.org/attitude_ … actory.bin

I used follow GPIOs:
SD Pin1(CS) - GPIO0 (WPS Switch)
SD Pin2(DI) - GPIO12 (Green WAN LED)
SD Pin3(GND)
SD Pin4(+3.3V)
SD Pin5(CLK) - GPIO8 (Amber Power LED)
SD Pin6(GND)
SD Pin7(DO) - GPIO13 (WPS LED)

I removed modules:
rmmod leds_gpio
rmmod button_hotplug
rmmod gpio_keys_polled
rmmod input_polldev
rmmod input_core

/etc/init.d/mmc_over_gpio start

dmesg said:
[13258.320000] gpio-mmc: Failed to request mmc_spi module.
[13258.340000] mmc_spi spi32766.0: ASSUMING 3.2-3.4 V slot power
[13258.350000] mmc_spi spi32766.0: SD/MMC host mmc0, no DMA, no WP, no poweroff
[13258.360000] gpio-mmc: MMC-Card "mmc-card" attached to GPIO pins di=12, do=13, clk=8, cs=0
[13258.410000] mmc_spi spi32766.0: setup: unsupported mode bits 4
[13258.420000] mmc_spi spi32766.0: can't change chip-select polarity

After that, nothing happened.

Then I installed Barrier Breaker from:
https://downloads.openwrt.org/barrier_b … actory.bin

I removed modules leds_gpio and gpio_button_hotplug, then I started /etc/init.d/mmc_over_gpio start

dmesg said:
[   24.090000] gpiommc gpiommc.0: no of_node; not parsing pinctrl DT
[   24.090000] gpio-mmc: Failed to request mmc_spi module.
[   24.110000] spi-gpio spi-gpio.0: no of_node; not parsing pinctrl DT
[   24.110000] spi-gpio: probe of spi-gpio.0 failed with error -16
[   24.120000] gpio-mmc: MMC-Card "default" attached to GPIO pins di=12, do=13, clk=8, cs=0

Do you have any ideas?

Reboot router
Use this 5 command in terminal:
rmmod leds_gpio
rmmod button_hotplug
rmmod gpio_keys_polled
rmmod input_polldev
rmmod input_core

And again try start mmcovergpio
send log dmesg.

Have good luck and good day

Hello! Thanks for the quick reply!
Now, I have: ATTITUDE ADJUSTMENT (12.09, r36088)

I installed follow modules:

root@OpenWrt:~# opkg update
Downloading http://downloads.openwrt.org/attitude_a … ckages.gz.
Updated list of available packages in /var/opkg-lists/attitude_adjustment.
root@OpenWrt:~# opkg install kmod-mmc-over-gpio
Installing kmod-mmc-over-gpio (3.3.8-4) to root...
Downloading http://downloads.openwrt.org/attitude_a … amips.ipk.
Installing kmod-mmc-spi (3.3.8-1) to root...
Downloading http://downloads.openwrt.org/attitude_a … amips.ipk.
Installing kmod-mmc (3.3.8-1) to root...
Downloading http://downloads.openwrt.org/attitude_a … amips.ipk.
Installing kmod-lib-crc7 (3.3.8-1) to root...
Downloading http://downloads.openwrt.org/attitude_a … amips.ipk.
Installing kmod-spi-gpio-old (3.3.8-1) to root...
Downloading http://downloads.openwrt.org/attitude_a … amips.ipk.
Installing kmod-spi-bitbang (3.3.8-1) to root...
Downloading http://downloads.openwrt.org/attitude_a … amips.ipk.
Configuring kmod-mmc.
Configuring kmod-spi-bitbang.
Configuring kmod-spi-gpio-old.
Configuring kmod-lib-crc7.
Configuring kmod-mmc-spi.
Configuring kmod-mmc-over-gpio.
root@OpenWrt:~#

Then I configured mmc_over_gpio:

root@OpenWrt:~# cat /etc/config/mmc_over_gpio

config mmc_over_gpio
        option name 'default'
        option mode '0'
        option enabled '1'
        option DI_pin '12'
        option DO_pin '13'
        option CLK_pin '8'
        option CS_pin '0'

root@OpenWrt:~#

Then I removed modules:
root@OpenWrt:~# rmmod leds_gpio
root@OpenWrt:~# rmmod button_hotplug
root@OpenWrt:~# rmmod gpio_keys_polled
root@OpenWrt:~# rmmod input_polldev
root@OpenWrt:~# rmmod input_core
root@OpenWrt:~#

Trying /etc/init.d/mmc_over_gpio start :
[  285.320000] gpio-mmc: Failed to request mmc_spi module.
[  285.340000] mmc_spi spi32766.0: ASSUMING 3.2-3.4 V slot power
[  285.350000] mmc_spi spi32766.0: SD/MMC host mmc0, no DMA, no WP, no poweroff
[  285.360000] gpio-mmc: MMC-Card "default" attached to GPIO pins di=12, do=13, clk=8, cs=0
[  285.410000] mmc_spi spi32766.0: setup: unsupported mode bits 4
[  285.420000] mmc_spi spi32766.0: can't change chip-select polarity

Then nothing happed, but GPIO8 (CLK) (Amber Power LED) is switch on.

PS: I tried SD-to-microSD adapter and microSD card 2 Gb. It`s work fine on notebook (Windows 7). I tried other microSD cards 2Gb and 1Gb, not result. I tried remove leds, no result. I tried change GPIOs, no result. I tied change SPI mode to 3, also no result.

PPS: Full dmesg:
root@OpenWrt:~# dmesg
[    0.000000] Linux version 3.3.8 (blogic@Debian-60-squeeze-64-minimal) (gcc version 4.6.3 20120201 (prerelease) (Linaro GCC 4.6-2012.02) ) #1 Sat Mar 23 19:00:46 UTC 2013
[    0.000000] prom: fw_arg0=00000001, fw_arg1=01f5bfb0, fw_arg2=01f5c3b0, fw_arg3=00000000
[    0.000000] env[0]: memsize=32
[    0.000000] env[1]: initrd_start=0x00000000
[    0.000000] env[2]: initrd_size=0x0
[    0.000000] env[3]: flash_start=0xBF000000
[    0.000000] env[4]: flash_size=0x800000
[    0.000000] env[0]: memsize=32
[    0.000000] env[1]: initrd_start=0x00000000
[    0.000000] env[2]: initrd_size=0x0
[    0.000000] env[3]: flash_start=0xBF000000
[    0.000000] env[4]: flash_size=0x800000
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU revision is: 0001964c (MIPS 24KEc)
[    0.000000] Ralink RT3350 id:1 rev:2 running at 320.00 MHz
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 02000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Zone PFN ranges:
[    0.000000]   Normal   0x00000000 -> 0x00002000
[    0.000000] Movable zone start PFN for each node
[    0.000000] Early memory PFN ranges
[    0.000000]     0: 0x00000000 -> 0x00002000
[    0.000000] On node 0 totalpages: 8192
[    0.000000] free_area_init_node: node 0, pgdat 802547a0, node_mem_map 81000000
[    0.000000]   Normal zone: 64 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 8128 pages, LIFO batch:0
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 8128
[    0.000000] Kernel command line:  board=DIR-300-B1 console=ttyS1,57600 mtdparts=physmap-flash.0:192k(u-boot)ro,64k(devdata)ro,64k(devconf)ro,896k(kernel),2880k(rootfs),3776k@0x50000(firmware) rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 128 (order: -3, 512 bytes)
[    0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Primary instruction cache 16kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 16kB, 4-way, VIPT, no aliases, linesize 32 bytes
[    0.000000] Writing ErrCtl register=00063510
[    0.000000] Readback ErrCtl register=00063510
[    0.000000] Memory: 29672k/32768k available (2046k kernel code, 3096k reserved, 340k data, 176k init, 0k highmem)
[    0.000000] SLUB: Genslabs=9, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:48
[    0.000000] console [ttyS1] enabled, bootconsole disabled
[    0.010000] Calibrating delay loop... 212.58 BogoMIPS (lpj=1062912)
[    0.090000] pid_max: default: 32768 minimum: 301
[    0.090000] Mount-cache hash table entries: 512
[    0.100000] NET: Registered protocol family 16
[    0.110000] MIPS: machine is D-Link DIR-300 B1
[    0.120000] gpiochip_add: registered GPIOs 0 to 23 on device: RT305X-GPIO0
[    0.130000] gpiochip_add: registered GPIOs 24 to 39 on device: RT305X-GPIO1
[    0.140000] gpiochip_add: registered GPIOs 40 to 51 on device: RT305X-GPIO2
[    0.180000] bio: create slab <bio-0> at 0
[    0.190000] Switching to clocksource MIPS
[    0.210000] NET: Registered protocol family 2
[    0.210000] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.230000] TCP established hash table entries: 1024 (order: 1, 8192 bytes)
[    0.240000] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.260000] TCP: Hash tables configured (established 1024 bind 1024)
[    0.270000] TCP reno registered
[    0.280000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.290000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.300000] NET: Registered protocol family 1
[    0.360000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.380000] JFFS2 version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.400000] msgmni has been set to 57
[    0.410000] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
[    0.420000] io scheduler noop registered
[    0.430000] io scheduler deadline registered (default)
[    0.440000] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    0.460000] serial8250: ttyS0 at MMIO 0x10000500 (irq = 13) is a 16550A
[    0.470000] serial8250: ttyS1 at MMIO 0x10000c00 (irq = 20) is a 16550A
[    0.500000] physmap platform flash device: 00800000 at bf000000
[    0.520000] physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank. Manufacturer ID 0x000001 Chip ID 0x001a00
[    0.540000] physmap-flash.0: Found an alias at 0x400000 for the chip at 0x0
[    0.540000] Amd/Fujitsu Extended Query Table at 0x0040
[    0.550000]   Amd/Fujitsu Extended Query version 1.3.
[    0.560000] number of CFI chips: 1
[    0.570000] 6 cmdlinepart partitions found on MTD device physmap-flash.0
[    0.580000] Creating 6 MTD partitions on "physmap-flash.0":
[    0.590000] 0x000000000000-0x000000030000 : "u-boot"
[    0.610000] 0x000000030000-0x000000040000 : "devdata"
[    0.620000] 0x000000040000-0x000000050000 : "devconf"
[    0.640000] 0x000000050000-0x000000130000 : "kernel"
[    0.650000] 0x000000130000-0x000000400000 : "rootfs"
[    0.670000] mtd: partition "rootfs" set to be root filesystem
[    0.680000] mtd: partition "rootfs_data" created automatically, ofs=2F0000, len=110000
[    0.700000] 0x0000002f0000-0x000000400000 : "rootfs_data"
[    0.710000] 0x000000050000-0x000000400000 : "firmware"
[    0.740000] ramips-wdt ramips-wdt: timeout value must be 0 < timeout <= 40, using 40
[    0.760000] TCP cubic registered
[    0.760000] NET: Registered protocol family 17
[    0.770000] Bridge firewalling registered
[    0.780000] 8021q: 802.1Q VLAN Support v1.8
[    0.800000] VFS: Mounted root (squashfs filesystem) readonly on device 31:4.
[    0.820000] Freeing unused kernel memory: 176k freed
[    3.350000] input: gpio-keys-polled as /devices/platform/gpio-keys-polled/input/input0
[    3.460000] Button Hotplug driver version 0.4.1
[    3.710000] Registered led device: d-link:amber:status
[    3.710000] Registered led device: d-link:green:status
[    3.710000] Registered led device: d-link:amber:wan
[    3.720000] Registered led device: d-link:green:wan
[    3.720000] Registered led device: d-link:blue:wps
[    7.130000] JFFS2 notice: (378) jffs2_build_xattr_subsystem: complete building xattr subsystem, 1 of xdatum (1 unchecked, 0 orphan) and 9 of xref (0 dead, 2 orphan) found.
[    9.670000] Compat-drivers backport release: compat-drivers-2012-09-04-2-gddac993
[    9.690000] Backport based on wireless-testing.git master-2012-09-07
[    9.700000] compat.git: wireless-testing.git
[    9.770000] cfg80211: Calling CRDA to update world regulatory domain
[    9.780000] cfg80211: World regulatory domain updated:
[    9.790000] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[    9.810000] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[    9.820000] cfg80211:   (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[    9.840000] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[    9.850000] cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[    9.870000] cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[   10.560000] usbcore: registered new interface driver usbfs
[   10.570000] usbcore: registered new interface driver hub
[   10.580000] usbcore: registered new device driver usb
[   11.200000] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[   11.210000] Registered led device: rt2800pci-phy0::radio
[   11.210000] Registered led device: rt2800pci-phy0::assoc
[   11.210000] Registered led device: rt2800pci-phy0::quality
[   11.300000] PPP generic driver version 2.4.2
[   11.550000] ip_tables: (C) 2000-2006 Netfilter Core Team
[   11.940000] NET: Registered protocol family 24
[   11.980000] nf_conntrack version 0.5.0 (466 buckets, 1864 max)
[   12.590000] dwc_otg: version 2.72a 24-JUN-2008
[   18.680000] device eth0.1 entered promiscuous mode
[   18.690000] device eth0 entered promiscuous mode
[   18.710000] br-lan: port 1(eth0.1) entered forwarding state
[   18.720000] br-lan: port 1(eth0.1) entered forwarding state
[   20.260000] ramips-wdt: timeout value 60 must be 0 < timeout <= 40, using 40
[   20.720000] br-lan: port 1(eth0.1) entered forwarding state
[  285.320000] gpio-mmc: Failed to request mmc_spi module.
[  285.340000] mmc_spi spi32766.0: ASSUMING 3.2-3.4 V slot power
[  285.350000] mmc_spi spi32766.0: SD/MMC host mmc0, no DMA, no WP, no poweroff
[  285.360000] gpio-mmc: MMC-Card "default" attached to GPIO pins di=12, do=13, clk=8, cs=0
[  285.410000] mmc_spi spi32766.0: setup: unsupported mode bits 4
[  285.420000] mmc_spi spi32766.0: can't change chip-select polarity
root@OpenWrt:~#

U need duplicate this
Data Input = GPIO9 (Green Power LED)--> 02 pin sd card
Data Output = GPIO13 (WPS LED)         -->  07 pin sd card
Clock = GPIO8 (Amber Power LED)       -->  05 pin sd card
ChipSel = GPIO0 (WPS Switch)              -->  01 pin sd card

And make new config file
U need this log in resoult
default" attached to GPIO pins di=9, do=13, clk=8, cs=0

u use sd card or sd card slot + sd card??


I use this config and can mount card np 2gb

If u have problem i can open my dir300 and make foto for u.

Good luck.

Sry for my english

New tests... I changed GPIO and connected pin2 SD to GPIO9 (Green Power LED):
root@OpenWrt:~# cat /etc/config/mmc_over_gpio
config mmc_over_gpio
        option name 'default'
        option mode '0'
        option enabled '1'
        option DO_pin '13'
        option CLK_pin '8'
        option CS_pin '0'
        option DI_pin '9'

Remove modules:
root@OpenWrt:~# rmmod leds_gpio
root@OpenWrt:~# rmmod button_hotplug
root@OpenWrt:~# rmmod gpio_keys_polled
root@OpenWrt:~# rmmod input_polldev
root@OpenWrt:~# rmmod input_core

Trying /etc/init.d/mmc_over_gpio start  , dmesg said:
[  239.790000] gpio-mmc: Failed to request mmc_spi module.
[  239.810000] mmc_spi spi32766.0: ASSUMING 3.2-3.4 V slot power
[  239.820000] mmc_spi spi32766.0: SD/MMC host mmc0, no DMA, no WP, no poweroff
[  239.830000] gpio-mmc: MMC-Card "default" attached to GPIO pins di=9, do=13, clk=8, cs=0
[  239.870000] mmc_spi spi32766.0: setup: unsupported mode bits 4
[  239.880000] mmc_spi spi32766.0: can't change chip-select polarity

nothing happed, but GPIO8 (CLK) (Amber Power LED) is switch on sad((

PS I use sd card slot+microSD card (2 Gb). Example there:
http://www.jbprojects.net/articles/wrt54gl_mods/

I have analog scheme:
https://dl.dropbox.com/u/101429500/dir300b1.jpg

PPS If I change SPI-mode from 0 to 3, CLK GPIO does not turn on, but during /etc/init.d/mmc_over_gpio start, GPIOs 8 and 9 blink 1 time.

(Last edited by Senya on 2 Oct 2014, 09:05)

Bro if i use /etc/init.d/mmc_over_gpio start , my amber led too switch on and give light.

I make this mod  6 month ago, and write all in this topic, u must read step bu step all my posts, now i dont remember what you can do.

In next 10h i give u my config file, meyby u try other card.

Where are u from bro?
Good luck.

(Last edited by finch84 on 2 Oct 2014, 09:17)

finch84 wrote:

Bro if i use /etc/init.d/mmc_over_gpio start , my amber led too switch on and give light.
I make this mod  6 month ago, and write all in this topic, u must read step bu step all my posts, now i dont remember what you can do.
In next 10h i give u my config file, meyby u try other card.
Where are u from bro?
Good luck.

Thanks for the quick answers! I have read several times your posts, but I realized that your problem was a broken SD card slot?
What do you think is required to remove LEDs?
Perhaps I have broken SD card slot, but it worked in Windows 7 of 100% as well as microSD card. Earlier, I tried two different microSD cards, 2Gb and 1Gb, it`s no result sad
The only option to change SD card slot or use true SD/MMC card. I checked all GPIO except WPS button using this manual:
http://squidge.sourceforge.net/gpio/

GPIOs was right.

PS Bro, don`t worry about language! I myself use a google translator smile
Hello from: https://en.wikipedia.org/wiki/Kostroma

(Last edited by Senya on 2 Oct 2014, 09:47)

May be all my microSD cards don`t support SPI mode...

The discussion might have continued from here.