Issues with mmc-over-gpio on Barrier Breaker

I am currently in the middle of modifying my D-link DIR-601 B1 and I have hit a snag with trying to get an SD card to work. I insert a micro sd card, and the router doesn't even acknowledge that it's been plugged in. I have located 4 unused gpios on the motherboard, and have a micro sd card slot wired up, and I've also checked to make sure that the wires are properly soldered. I have compiled a version of Barrier Breaker that has the necessary kmod-mmc-over-gpio package installed. I've also included the output of dmesg here in case it give hints as to what the issue may be.

I'm unsure if this has anything to do with my issue, but when the router turns on the cs line is around 2.4v, when all the lights flash the line goes down to 0v, and when the router has fully booted the line goes up to 2.7v which is what the gpio voltage is.

root@OpenWrt:~# dmesg
[    0.000000] Linux version 3.10.49 (nurripter@Nurripters-Comp) (gcc version 4.8.3 (OpenWrt/Linaro GCC 4.8-2014.04 r48549) ) #3 Sat Jun 2 13:42:09 EDT 2018
[    0.000000] MyLoader: sysp=ebe30cf3, boardp=25a63232, parts=2cf3245a
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU revision is: 00019374 (MIPS 24Kc)
[    0.000000] SoC: Atheros AR9330 rev 1
[    0.000000] Clocks: CPU:400.000MHz, DDR:400.000MHz, AHB:200.000MHz, Ref:25.000MHz
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 02000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x00000000-0x01ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x00000000-0x01ffffff]
[    0.000000] On node 0 totalpages: 8192
[    0.000000] free_area_init_node: node 0, pgdat 8030c5b0, node_mem_map 81000000
[    0.000000]   Normal zone: 64 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 8192 pages, LIFO batch:0
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    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=TEW-712BR console=ttyATH0,115200 mtdparts=spi0.0:64k(u-boot)ro,64k(art)ro,64k(mac)ro,64k(nvram)ro,192k(language)ro,3648k(firmware) rootfstype=squashfs,jffs2 noinitrd
[    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] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 28784k/32768k available (2228k kernel code, 3984k reserved, 597k data, 244k init, 0k highmem)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:51
[    0.080000] Calibrating delay loop... 265.42 BogoMIPS (lpj=1327104)
[    0.080000] pid_max: default: 32768 minimum: 301
[    0.080000] Mount-cache hash table entries: 512
[    0.090000] NET: Registered protocol family 16
[    0.100000] MIPS: machine is TRENDnet TEW-712BR
[    0.550000] bio: create slab <bio-0> at 0
[    0.560000] Switching to clocksource MIPS
[    0.570000] NET: Registered protocol family 2
[    0.570000] TCP established hash table entries: 512 (order: 0, 4096 bytes)
[    0.570000] TCP bind hash table entries: 512 (order: -1, 2048 bytes)
[    0.570000] TCP: Hash tables configured (established 512 bind 512)
[    0.580000] TCP: reno registered
[    0.580000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.590000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.600000] NET: Registered protocol family 1
[    0.600000] PCI: CLS 0 bytes, default 32
[    0.620000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.620000] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.640000] msgmni has been set to 56
[    0.640000] io scheduler noop registered
[    0.640000] io scheduler deadline registered (default)
[    0.650000] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    0.650000] ar933x-uart: ttyATH0 at MMIO 0x18020000 (irq = 11) is a AR933X UART
[    0.660000] console [ttyATH0] enabled, bootconsole disabled
[    0.670000] ath79-spi ath79-spi: master is unqueued, this is deprecated
[    0.680000] m25p80 spi0.0: found mx25l3205d, expected m25p80
[    0.680000] m25p80 spi0.0: mx25l3205d (4096 Kbytes)
[    0.690000] 6 cmdlinepart partitions found on MTD device spi0.0
[    0.700000] Creating 6 MTD partitions on "spi0.0":
[    0.700000] 0x000000000000-0x000000010000 : "u-boot"
[    0.710000] 0x000000010000-0x000000020000 : "art"
[    0.710000] 0x000000020000-0x000000030000 : "mac"
[    0.720000] 0x000000030000-0x000000040000 : "nvram"
[    0.720000] 0x000000040000-0x000000070000 : "language"
[    0.730000] 0x000000070000-0x000000400000 : "firmware"
[    0.740000] 2 uimage-fw partitions found on MTD device firmware
[    0.740000] 0x000000070000-0x000000170ecc : "kernel"
[    0.750000] mtd: partition "kernel" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only
[    0.760000] 0x000000170ecc-0x000000400000 : "rootfs"
[    0.770000] mtd: partition "rootfs" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only
[    0.780000] mtd: device 7 (rootfs) set to be root filesystem
[    0.780000] 1 squashfs-split partitions found on MTD device rootfs
[    0.790000] 0x000000390000-0x000000400000 : "rootfs_data"
[    0.810000] libphy: ag71xx_mdio: probed
[    1.370000] ag71xx-mdio.1: Found an AR7240/AR9330 built-in switch
[    2.400000] eth0: Atheros AG71xx at 0xba000000, irq 5, mode:GMII
[    2.950000] ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.1:04 [uid=004dd041, driver=Generic PHY]
[    2.960000] eth1: Atheros AG71xx at 0xb9000000, irq 4, mode:MII
[    2.970000] TCP: cubic registered
[    2.970000] NET: Registered protocol family 17
[    2.980000] 8021q: 802.1Q VLAN Support v1.8
[    2.990000] VFS: Mounted root (squashfs filesystem) readonly on device 31:7.
[    3.000000] Freeing unused kernel memory: 244K (80323000 - 80360000)
[    6.070000] usbcore: registered new interface driver usbfs
[    6.070000] usbcore: registered new interface driver hub
[    6.080000] usbcore: registered new device driver usb
[    6.130000] SCSI subsystem initialized
[    6.140000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    6.150000] ehci-platform: EHCI generic platform driver
[    6.150000] ehci-platform ehci-platform: EHCI Host Controller
[    6.160000] ehci-platform ehci-platform: new USB bus registered, assigned bus number 1
[    6.170000] ehci-platform ehci-platform: irq 3, io mem 0x1b000000
[    6.190000] ehci-platform ehci-platform: USB 2.0 started, EHCI 1.00
[    6.190000] hub 1-0:1.0: USB hub found
[    6.190000] hub 1-0:1.0: 1 port detected
[    6.200000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    6.220000] usbcore: registered new interface driver usb-storage
[    8.170000] eth0: link up (1000Mbps/Full duplex)
[   11.410000] jffs2: notice: (347) jffs2_build_xattr_subsystem: complete building xattr subsystem, 17 of xdatum (0 unchecked, 16 orphan) and 45 of xref (0 dead, 33 orphan) found.
[   11.430000] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
[   11.430000] block: unable to load configuration (fstab: Entry not found)
[   11.440000] block: attempting to load /tmp/jffs_cfg/etc/config/fstab
[   11.450000] block: extroot: not configured
[   11.490000] jffs2: notice: (344) jffs2_build_xattr_subsystem: complete building xattr subsystem, 17 of xdatum (0 unchecked, 16 orphan) and 45 of xref (0 dead, 33 orphan) found.
[   11.800000] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
[   11.810000] block: unable to load configuration (fstab: Entry not found)
[   11.810000] block: attempting to load /tmp/jffs_cfg/etc/config/fstab
[   11.820000] block: extroot: not configured
[   11.860000] eth0: link down
[   13.790000] Loading modules backported from Linux version master-2014-05-22-0-gf2032ea
[   13.790000] Backport generated by backports.git backports-20140320-37-g5c33da0
[   13.810000] nf_conntrack version 0.5.0 (453 buckets, 1812 max)
[   13.860000] xt_time: kernel timezone is -0000
[   13.900000] ip_tables: (C) 2000-2006 Netfilter Core Team
[   13.910000] cfg80211: Calling CRDA to update world regulatory domain
[   13.910000] cfg80211: World regulatory domain updated:
[   13.920000] cfg80211:  DFS Master region: unset
[   13.920000] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[   13.930000] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[   13.940000] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[   13.950000] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
[   13.950000] cfg80211:   (5170000 KHz - 5250000 KHz @ 160000 KHz), (N/A, 2000 mBm), (N/A)
[   13.960000] cfg80211:   (5250000 KHz - 5330000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[   13.970000] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[   13.980000] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[   13.990000] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
[   14.080000] PPP generic driver version 2.4.2
[   14.080000] NET: Registered protocol family 24
[   14.140000] ath: EEPROM regdomain: 0x0
[   14.140000] ath: EEPROM indicates default country code should be used
[   14.140000] ath: doing EEPROM country->regdmn map search
[   14.140000] ath: country maps to regdmn code: 0x3a
[   14.140000] ath: Country alpha2 being used: US
[   14.140000] ath: Regpair used: 0x3a
[   14.160000] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[   14.170000] cfg80211: Calling CRDA for country: US
[   14.170000] cfg80211: Regulatory domain changed to country: US
[   14.180000] cfg80211:  DFS Master region: FCC
[   14.180000] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[   14.190000] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 3000 mBm), (N/A)
[   14.200000] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz), (N/A, 1700 mBm), (N/A)
[   14.210000] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz), (N/A, 2300 mBm), (0 s)
[   14.220000] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 3000 mBm), (N/A)
[   14.230000] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 4000 mBm), (N/A)
[   14.230000] ieee80211 phy0: Atheros AR9330 Rev:1 mem=0xb8100000, irq=2
[   22.080000] gpio-mmc: Failed to request mmc_spi module.
[   22.080000] spi-gpio spi-gpio.0: master is unqueued, this is deprecated
[   22.120000] mmc_spi spi32766.0: ASSUMING 3.2-3.4 V slot power
[   24.770000] device eth0 entered promiscuous mode
[   25.150000] mmc_spi spi32766.0: setup: unsupported mode bits 4
[   25.150000] mmc_spi spi32766.0: can't change chip-select polarity
[   25.180000] mmc_spi spi32766.0: SD/MMC host mmc0, no DMA, no WP, no poweroff
[   25.180000] gpio-mmc: MMC-Card "uSD" attached to GPIO pins di=18, do=21, clk=22, cs=19
[   25.190000] mmc0: host doesn't support card's voltages
[   25.200000] mmc0: error -22 whilst initialising SDIO card
[   25.210000] mmc0: host doesn't support card's voltages
[   25.210000] mmc0: error -22 whilst initialising SD card
[   25.230000] mmc0: host doesn't support card's voltages
[   25.230000] mmc0: error -22 whilst initialising MMC card
[   25.370000] eth0: link up (1000Mbps/Full duplex)
[   25.370000] br-lan: port 1(eth0) entered forwarding state
[   25.370000] br-lan: port 1(eth0) entered forwarding state
[   27.370000] br-lan: port 1(eth0) entered forwarding state

Is there a reason you're not using a current build?

Barrier Breaker is three or four releases old now, released in 2014, and is known to be insecure.

[ 13.790000] Loading modules backported from Linux version master-2014-05-22-0-gf2032ea
[ 13.790000] Backport generated by backports.git backports-20140320-37-g5c33da0

Once you're on a current kernel, I'd look at why the kernel believes three times that

 [25.190000] mmc0: host doesn't support card's voltages

Yes there is. I tried to get the most current version to build with what I wanted, but I couldn't get it small enough. My device is several years old and only has 4mb of flash, and for me, it's more of a device I can play around with and learn. Barrier Breaker is just what I could get to properly compile.

There are snapshot images available for the new "tiny" subtarget for devices with only 4MB flash.

=> DIR-601 B1 OpenWrt snapshot images

Have you tried that already?

1 Like

I have not, as it doesn't suit my needs. I have to compile my own images as I have also modded my router to add a USB port as per the instructions at post 99 located on this topic. I want to keep the USB port as it opens the router up to more experimentation.

Hi there, I am the poster of that usb mod at openwrt forum. I also tried a mmc SPI mod on a dir-601 a1 which has worked for the most part( I had problems with luci but everything else still works ). I talked at length with the originator of that mmc hardware mod, who was very helpful, have you seen that thread?

EDIT I found the thread with Deoptim, the creator of the mmc hardware hack...I advise reading it over since it is confusing and convoluted on my part. There are pictures of the wiring too. My SPI chip on the A1 is the 16 pin version of mx25l3205d. Your SPI chip is mx25l3205d 8 pin. Pins 8, 15 and 16 on my 601 A1 would correspond to pins 2, 5 and 6 I believe for your 8 pin chip. MISO, MOSI, CLK. Verify this first, if you use this mod.

https://forum.archive.openwrt.org/viewtopic.php?id=54077&p=1

I haven't attempted to do the deep mmc mod yet. I've only done the other mod that uses 4 spare gpio pins. The mod I'm talking about is here.

https://openwrt.org/docs/guide-user/hardware/mmc_over_gpio

I'm currently attempting to remove unnecessary packages from Lede 17.01 so that I can try again on a more updated distro.

I happened to read this line on the Deep mmc mod page:

Note: Keep in mind, very often the unused GPIOs a pulled-down to the ground or pulled-up to the power bus via resistor - this may affect on detection of SD memory cards.

Well these gpio pins don't look to have any resistors on them. I've also tried compiling newer firmwares, and I couldn't seem to get them to fit in the necessary space. I've also gone and recompiled barrier breaker with support for SPI over gpio, and tried using spi-gpio-custom with no luck.

I plan on trying some more to get the mod to work. If all else fails, I'll try the deep mmc mod.

Just to let you know, the forum links to the old forum have changed so the link above https://forum.openwrt.org/viewtopic.php?id=33231&p=4 should now be https://forum.archive.openwrt.org/viewtopic.php?id=33231&p=4

Doesn't make a difference, both links lead to the same page.

That's odd, it now leads to the same link but if you copy the first link verbatim and load it in a new window it goes to the ' Oops! That page doesn’t exist or is private.' page. I assume this forum autocorrects link changes? EDIT Actually, no the first link isn't working for me..
EDIT 2 So if I right click to open a new tab it works, if I click directly it doesn't.

This router is a piece of garbage i got a router with 500MB ram for 90 bucks, I just dug this one out and im going to flash it and thats about it, theres not much you can do with this piece of junk other than experiment. Does it even have a place for a sd chip or are you modifying it?

One man's junk..
If you read this page you'd find this:
https://forum.archive.openwrt.org/viewtopic.php?id=54077&p=1