NetBSD Problem Report #49140
From www@NetBSD.org Fri Aug 22 11:57:23 2014
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id 0EFC4AE9FD
for <gnats-bugs@gnats.NetBSD.org>; Fri, 22 Aug 2014 11:57:23 +0000 (UTC)
Message-Id: <20140822115721.DEEBBAEA09@mollari.NetBSD.org>
Date: Fri, 22 Aug 2014 11:57:21 +0000 (UTC)
From: prlw1@cam.ac.uk
Reply-To: prlw1@cam.ac.uk
To: gnats-bugs@NetBSD.org
Subject: Can't write to SD card
X-Send-Pr-Version: www-1.0
>Number: 49140
>Category: kern
>Synopsis: Can't write to SD card
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Aug 22 12:00:00 +0000 2014
>Closed-Date:
>Last-Modified: Thu Nov 24 00:45:51 +0000 2016
>Originator: Patrick Welche
>Release: -current/amd64 in 2012 and today
>Organization:
>Environment:
7.99.1/amd64
>Description:
This is the same setup as the old posts:
http://mail-index.netbsd.org/netbsd-users/2012/11/02/msg011815.html
http://mail-index.netbsd.org/current-users/2013/01/10/msg021821.html
Laptop contains a:
sdhc0 at pci1 dev 0 function 0: Ricoh 5U823 SD/MMC Controller (rev. 0x04)
sdhc0: interrupting at ioapic0 pin 16
sdhc0: SD Host Specification 3.0, rev.5
sdhc0: software reset reg=00000001
sdhc0: using DMA transfer
sdhc0: base clock frequency 50 MHz
sdhc0: max block length 512 bytes
sdmmc0 at sdhc0 slot 0
sdmmc_dump_data: CID
--------+--------------------------------------------------+------------------+
offset | +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +a +b +c +d +e +f | data |
offset | +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +a +b +c +d +e +f |------------------+
00000000| c7 00 06 db 78 7c 30 47 36 31 44 53 48 50 27 00 | ....x|0G61DSHP'. |
--------+--------------------------------------------------+------------------+
ld0 at sdmmc0: <0x27:0x5048:SD16G:0x30:0x7c78db06:0x0c7>
ld0: WARNING: power management not supported
ld0: 14756 MB, 7495 cyl, 64 head, 63 sec, 512 bytes/sect x 30220288 sectors
ld0: 4-bit width, bus clock 50.000 MHz
but writing to the card fails:
# dd if=rpi.img of=/dev/rld0d
dd: /dev/rld0d: Input/output error
1+0 records in
0+0 records out
0 bytes transferred in 0.001 secs (0 bytes/sec)
# dd if=rpi.img of=/dev/ld0d
dd: /dev/ld0d: Input/output error
1+0 records in
0+0 records out
0 bytes transferred in 0.001 secs (0 bytes/sec)
This is an extract the mass of debug output:
ld0: I/O operation (dir=IN, blkno=0x0, bcnt=0x200)
seg#0: addr=0x4037a000, size=0x200
sdhc0: start cmd 17 arg=00000000 data=0xfffffe81411fa800 dlen=512 flags=00000572
, status=0
sdhc0: writing cmd: blksize=512 blkcnt=1 mode=0013 cmd=113a
sdhc0: resp = 00000900
sdhc0: resp = 00000900sdhc0: software reset reg=00000006
sdhc0: resp = 00000900sdhc0: softwar
sdhc0: cmd 17 abort (flags=00000573 error=60)
ld0: error 60
>How-To-Repeat:
Try to write directly to an SD card using a Ricoh 5U823. I can write to the card successfully
with a USB SD card reader, so the card doesn't seem to be at fault.
>Fix:
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback
State-Changed-By: jmcneill@NetBSD.org
State-Changed-When: Wed, 01 Oct 2014 22:37:32 +0000
State-Changed-Why:
Can you see if this change helps?
http://mail-index.netbsd.org/source-changes/2014/10/01/msg059065.html
From: Patrick Welche <prlw1@cam.ac.uk>
To: gnats-bugs@NetBSD.org
Cc: kern-bug-people@netbsd.org, netbsd-bugs@netbsd.org,
gnats-admin@netbsd.org, jmcneill@NetBSD.org
Subject: Re: kern/49140 (Can't write to SD card)
Date: Thu, 2 Oct 2014 15:53:50 +0100
On Wed, Oct 01, 2014 at 10:37:33PM +0000, jmcneill@NetBSD.org wrote:
> http://mail-index.netbsd.org/source-changes/2014/10/01/msg059065.html
Overall, I'm afraid not:
# dd if=/dev/zero of=/dev/rld0d bs=64k count=100
dd: /dev/rld0d: Input/output error
1+0 records in
0+0 records out
0 bytes transferred in 0.001 secs (0 bytes/sec)
ld0 at sdmmc0: <0x27:0x5048:SD16G:0x30:0x7c78db06:0x0c7>
ld0: 14756 MB, 7495 cyl, 64 head, 63 sec, 512 bytes/sect x 30220288 sectors
ld0: 4-bit width, bus clock 50.000 MHz
ld0d: error writing fsbn 0 of 0-127 (ld0 bn 0; cn 0 tn 0 sn 0)
ld0d: error reading fsbn 0 (ld0 bn 0; cn 0 tn 0 sn 0)
ld0: dos partition I/O error
ld0d: error writing fsbn 0 of 0-127 (ld0 bn 0; cn 0 tn 0 sn 0)
The above was from a cold boot with your timing fixes.
In another session, I managed to write 1.6G to the card once (also with
the new kernel), so not all is bad, but I was very lucky that one time.
State-Changed-From-To: feedback->open
State-Changed-By: jmcneill@NetBSD.org
State-Changed-When: Fri, 03 Oct 2014 22:53:40 +0000
State-Changed-Why:
From: Patrick Welche <prlw1@cam.ac.uk>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: kern/49140 (Can't write to SD card)
Date: Sat, 4 Oct 2014 09:58:08 +0100
After the 1/(2N)->N calculation, with an ordinary kernel, still no luck.
This isn't properly reproducible though, e.g.,
- boot with new kernel, dd failed immediately
- boot with kernel full of sdhc_debug,
# dd if=rpi.img of=/dev/rld0d
^C43154+0 records in
43153+0 records out
22094336 bytes transferred in 162.393 secs (136054 bytes/sec)
- so it got quite far until I stopped it, in order to:
# dd if=rpi.img ibs=64k | progress -l 657219584 dd of=/dev/rld0d obs=64k
0% | | 0 0.00 KiB/s --:-- ETAdd: /dev/rld0d: Connection timed out
128+0 records in
0+0 records out
0 bytes transferred in 0.998 secs (0 bytes/sec)
0% | | 81920 79.61 KiB/s 2:14:19 ETA
dd: stdout: Broken pipe
2+0 records in
193+0 records out
98816 bytes transferred in 1.061 secs (93134 bytes/sec)
The end of that last session looked like:
sdhc0: start cmd 17 arg=01cd1fff data=0xfffffe8114db6000 dlen=512 flags=00000572, status=0
sdhc0: writing cmd: blksize=512 blkcnt=1 mode=0013 cmd=113a
sdhc0: resp = 00000900
sdhc0: data transfer: resp=00000900 datalen=512
sdhc0: data transfer done (error=0)
sdhc0: cmd 17 done (flags=00000573 error=0)
sdhc0: start cmd 13 arg=00070000 data=0x0 dlen=0 flags=00000c32, status=0
sdhc0: writing cmd: blksize=0 blkcnt=0 mode=0002 cmd=0d1a
sdhc0: resp = 00000900
sdhc0: cmd 13 done (flags=00000c33 error=0)
seg#0: addr=0x4037a000, size=0x10000
sdhc0: start cmd 25 arg=00000000 data=0xffff8000462d0000 dlen=65536 flags=00000132, status=0
sdhc0: writing cmd: blksize=512 blkcnt=128 mode=0027 cmd=193a
sdhc0: resp = 00000900
sdhc0: data transfer: resp=00000900 datalen=65536
sdhc0: software reset reg=00000006
sdhc0: data transfer done (error=60)
sdhc0: cmd 25 abort (flags=00000133 error=60)
sdhc0: cmd 25 abort (flags=0000-127 (ld0 bn 0; cn 0 tn 0 sn 0)
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.